From 496280ef4e0ce1d272e669eca4b63582229b65e4 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 30 May 2023 15:05:06 +0800 Subject: [PATCH 01/32] ath79: add missing symbols by refreshing kernel configs Some symbols are outdated or missing due to daily kernel bumps. It's better to re-add them. All configs are automatically refreshed by 'make kernel_oldconfig CONFIG_TARGET=taget' and 'make kernel_oldconfig CONFIG_TARGET=subtarget' Signed-off-by: Shiji Yang --- target/linux/ath79/config-5.15 | 3 +-- target/linux/ath79/generic/config-default | 2 ++ target/linux/ath79/mikrotik/config-default | 19 ++++++++++++++----- target/linux/ath79/nand/config-default | 8 ++++++-- target/linux/ath79/tiny/config-default | 2 +- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/target/linux/ath79/config-5.15 b/target/linux/ath79/config-5.15 index 21fd091a2e6..5b1b0d5add6 100644 --- a/target/linux/ath79/config-5.15 +++ b/target/linux/ath79/config-5.15 @@ -41,6 +41,7 @@ CONFIG_CSRC_R4K=y CONFIG_DMA_NONCOHERENT=y CONFIG_DTC=y CONFIG_EARLY_PRINTK=y +CONFIG_ETHERNET_PACKET_MANGLE=y CONFIG_FIXED_PHY=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y @@ -80,7 +81,6 @@ CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HZ_PERIODIC=y -CONFIG_IMAGE_CMDLINE_HACK=y CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQCHIP=y CONFIG_IRQ_DOMAIN=y @@ -158,7 +158,6 @@ CONFIG_PHYLIB=y # CONFIG_PHY_AR7200_USB is not set # CONFIG_PHY_ATH79_USB is not set CONFIG_PINCTRL=y -# CONFIG_PINCTRL_PISTACHIO is not set CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_RATIONAL=y CONFIG_REGMAP=y diff --git a/target/linux/ath79/generic/config-default b/target/linux/ath79/generic/config-default index 06f264b626a..d8c674cba7e 100644 --- a/target/linux/ath79/generic/config-default +++ b/target/linux/ath79/generic/config-default @@ -6,6 +6,7 @@ CONFIG_GPIO_WATCHDOG=y CONFIG_GPIO_WATCHDOG_ARCH_INITCALL=y CONFIG_I2C=y CONFIG_I2C_ALGOBIT=y +CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_GPIO=y CONFIG_INTEL_XWAY_PHY=y @@ -20,6 +21,7 @@ CONFIG_NVMEM_U_BOOT_ENV=y CONFIG_PHY_AR7100_USB=y CONFIG_PHY_AR7200_USB=y CONFIG_REALTEK_PHY=y +CONFIG_REGMAP_I2C=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_VITESSE_PHY=y CONFIG_WATCHDOG_CORE=y diff --git a/target/linux/ath79/mikrotik/config-default b/target/linux/ath79/mikrotik/config-default index 67d4ca6edc7..2ff08cec2bd 100644 --- a/target/linux/ath79/mikrotik/config-default +++ b/target/linux/ath79/mikrotik/config-default @@ -1,17 +1,21 @@ CONFIG_CRC16=y CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_HASH_INFO=y +CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_ZSTD=y CONFIG_GPIO_LATCH=y -CONFIG_GPIO_RB91X_KEY=y CONFIG_GPIO_RB4XX=y +CONFIG_GPIO_RB91X_KEY=y CONFIG_GPIO_WATCHDOG=y CONFIG_GPIO_WATCHDOG_ARCH_INITCALL=y +CONFIG_GRO_CELLS=y CONFIG_LEDS_RESET=y +CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y -CONFIG_MDIO_GPIO=y +CONFIG_MFD_CORE=y CONFIG_MFD_RB4XX_CPLD=y CONFIG_MIKROTIK=y CONFIG_MIKROTIK_RB_SYSFS=y -CONFIG_MTD_NAND=y CONFIG_MTD_NAND_AR934X=y CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC=y @@ -24,17 +28,22 @@ CONFIG_MTD_SPI_NAND=y CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y CONFIG_MTD_SPLIT_MINOR_FW=y CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MTD_UBI_BEB_LIMIT=20 +CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_SWITCHDEV=y -CONFIG_PCI_AR71XX=y +CONFIG_PHYLINK=y CONFIG_PHY_AR7100_USB=y CONFIG_PHY_AR7200_USB=y CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_SGL_ALLOC=y CONFIG_SPI_RB4XX=y CONFIG_UBIFS_FS=y CONFIG_WATCHDOG_CORE=y +CONFIG_XXHASH=y CONFIG_ZLIB_DEFLATE=y CONFIG_ZLIB_INFLATE=y +CONFIG_ZSTD_COMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y diff --git a/target/linux/ath79/nand/config-default b/target/linux/ath79/nand/config-default index 3072feea2f2..730d38e1dfe 100644 --- a/target/linux/ath79/nand/config-default +++ b/target/linux/ath79/nand/config-default @@ -1,13 +1,14 @@ +CONFIG_BCH=y CONFIG_CRC16=y -CONFIG_CRYPTO_ACOMP2=y CONFIG_CRYPTO_DEFLATE=y CONFIG_CRYPTO_HASH_INFO=y CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_ZSTD=y CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y -CONFIG_MTD_NAND=y CONFIG_MTD_NAND_AR934X=y CONFIG_MTD_NAND_CORE=y +CONFIG_MTD_NAND_ECC=y CONFIG_MTD_NAND_ECC_SW_BCH=y CONFIG_MTD_RAW_NAND=y CONFIG_MTD_SPI_NAND=y @@ -21,5 +22,8 @@ CONFIG_POWER_RESET=y CONFIG_POWER_RESET_GPIO_RESTART=y CONFIG_SGL_ALLOC=y CONFIG_UBIFS_FS=y +CONFIG_XXHASH=y CONFIG_ZLIB_DEFLATE=y CONFIG_ZLIB_INFLATE=y +CONFIG_ZSTD_COMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y diff --git a/target/linux/ath79/tiny/config-default b/target/linux/ath79/tiny/config-default index fbf08eb0667..df7e6628274 100644 --- a/target/linux/ath79/tiny/config-default +++ b/target/linux/ath79/tiny/config-default @@ -1,9 +1,9 @@ +CONFIG_GRO_CELLS=y CONFIG_LEDS_RESET=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_MV88E6060=y -# CONFIG_NET_DSA_TAG_QCA is not set CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_SWITCHDEV=y CONFIG_PHYLINK=y From c60dd7bef97772bfb7c23691986d71c17233553d Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 31 May 2023 10:50:04 +0800 Subject: [PATCH 02/32] ath79: rename and sort patches by OpenWrt naming rules The patches in the ath79 target have not been sorted for a long time and they are very chaotic now. This patch sorts them again according to the OpenWrt naming rules[1], so that we can better manage them. [1] https://openwrt.org/docs/guide-developer/toolchain/use-patches-with-buildsystem#naming_patches Signed-off-by: Shiji Yang --- ...> 010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch} | 0 ...ize.patch => 011-v5.17-spi-ar934x-fix-transfer-size.patch} | 0 ...020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch} | 0 ... => 030-v5.18-ath79-add-support-for-booting-QCN550x.patch} | 2 +- ...rqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch} | 0 ...ch => 301-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch} | 0 ...=> 310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch} | 0 ...rt-to-OF.patch => 311-MIPS-pci-ar71xx-convert-to-OF.patch} | 0 ...=> 312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch} | 0 ...rt-to-OF.patch => 313-MIPS-pci-ar724x-convert-to-OF.patch} | 0 ...ci.patch => 314-MIPS-ath79-remove-irq-code-from-pci.patch} | 0 ...h => 315-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch} | 4 ++-- ...ch => 316-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch} | 0 ...37-missing-registers.patch => 330-missing-registers.patch} | 2 +- ...> 331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch} | 4 ++-- ...-ath79-sgmii-config.patch => 332-ath79-sgmii-config.patch} | 2 +- ...r_earlier.patch => 340-register_gpio_driver_earlier.patch} | 0 ...ath9k-exports.patch => 350-MIPS-ath79-ath9k-exports.patch} | 0 ...mmon-exports.patch => 351-MIPS-ath79-common-exports.patch} | 0 ...atch => 360-MIPS-ath79-export-UART1-reference-clock.patch} | 0 ...ze-symbols.patch => 370-MIPS-ath79-sanitize-symbols.patch} | 0 ...ch => 400-mtd-nor-support-mtd-name-from-device-tree.patch} | 0 ...tan-trx-parser.patch => 410-mtd-cybertan-trx-parser.patch} | 0 ...before-mtd.patch => 420-drivers-link-spi-before-mtd.patch} | 0 ...34x-nand-driver.patch => 430-mtd-ar934x-nand-driver.patch} | 0 ...-ath79-usb-phys.patch => 700-phy-add-ath79-usb-phys.patch} | 0 ...rties.patch => 701-usb-add-more-OF-quirk-properties.patch} | 0 ...tream-ag71xx.patch => 710-net-use-downstream-ag71xx.patch} | 0 ..._ta_value.patch => 720-mdio_bitbang_ignore_ta_value.patch} | 0 ...hy-mdio-bitbang-prevent-rescheduling-during-command.patch} | 0 ...s-atomic.patch => 730-ar8216-make-reg-access-atomic.patch} | 0 ...patch => 800-leds-add-reset-controller-based-driver.patch} | 0 ...ed_access_hacks.patch => 900-unaligned_access_hacks.patch} | 0 .../{920-mikrotik-rb4xx.patch => 910-mikrotik-rb4xx.patch} | 0 .../{939-mikrotik-rb91x.patch => 911-mikrotik-rb91x.patch} | 0 35 files changed, 7 insertions(+), 7 deletions(-) rename target/linux/ath79/patches-5.15/{402-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch => 010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch} (100%) rename target/linux/ath79/patches-5.15/{403-v5.17-spi-ar934x-fix-transfer-size.patch => 011-v5.17-spi-ar934x-fix-transfer-size.patch} (100%) rename target/linux/ath79/patches-5.15/{410-spi-ath79-Implement-the-spi_mem-interface.patch => 020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch} (100%) rename target/linux/ath79/patches-5.15/{940-ath79-add-support-for-booting-QCN550x.patch => 030-v5.18-ath79-add-support-for-booting-QCN550x.patch} (98%) rename target/linux/ath79/patches-5.15/{0007-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch => 300-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch} (100%) rename target/linux/ath79/patches-5.15/{0008-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch => 301-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch} (100%) rename target/linux/ath79/patches-5.15/{0017-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch => 310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch} (100%) rename target/linux/ath79/patches-5.15/{0018-MIPS-pci-ar71xx-convert-to-OF.patch => 311-MIPS-pci-ar71xx-convert-to-OF.patch} (100%) rename target/linux/ath79/patches-5.15/{0019-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch => 312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch} (100%) rename target/linux/ath79/patches-5.15/{0020-MIPS-pci-ar724x-convert-to-OF.patch => 313-MIPS-pci-ar724x-convert-to-OF.patch} (100%) rename target/linux/ath79/patches-5.15/{0036-MIPS-ath79-remove-irq-code-from-pci.patch => 314-MIPS-ath79-remove-irq-code-from-pci.patch} (100%) rename target/linux/ath79/patches-5.15/{0062-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch => 315-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch} (99%) rename target/linux/ath79/patches-5.15/{470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch => 316-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch} (100%) rename target/linux/ath79/patches-5.15/{0037-missing-registers.patch => 330-missing-registers.patch} (96%) rename target/linux/ath79/patches-5.15/{0038-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch => 331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch} (98%) rename target/linux/ath79/patches-5.15/{0040-ath79-sgmii-config.patch => 332-ath79-sgmii-config.patch} (98%) rename target/linux/ath79/patches-5.15/{004-register_gpio_driver_earlier.patch => 340-register_gpio_driver_earlier.patch} (100%) rename target/linux/ath79/patches-5.15/{0034-MIPS-ath79-ath9k-exports.patch => 350-MIPS-ath79-ath9k-exports.patch} (100%) rename target/linux/ath79/patches-5.15/{0041-MIPS-ath79-common-exports.patch => 351-MIPS-ath79-common-exports.patch} (100%) rename target/linux/ath79/patches-5.15/{0039-MIPS-ath79-export-UART1-reference-clock.patch => 360-MIPS-ath79-export-UART1-reference-clock.patch} (100%) rename target/linux/ath79/patches-5.15/{0032-MIPS-ath79-sanitize-symbols.patch => 370-MIPS-ath79-sanitize-symbols.patch} (100%) rename target/linux/ath79/patches-5.15/{401-mtd-nor-support-mtd-name-from-device-tree.patch => 400-mtd-nor-support-mtd-name-from-device-tree.patch} (100%) rename target/linux/ath79/patches-5.15/{404-mtd-cybertan-trx-parser.patch => 410-mtd-cybertan-trx-parser.patch} (100%) rename target/linux/ath79/patches-5.15/{430-drivers-link-spi-before-mtd.patch => 420-drivers-link-spi-before-mtd.patch} (100%) rename target/linux/ath79/patches-5.15/{440-mtd-ar934x-nand-driver.patch => 430-mtd-ar934x-nand-driver.patch} (100%) rename target/linux/ath79/patches-5.15/{0004-phy-add-ath79-usb-phys.patch => 700-phy-add-ath79-usb-phys.patch} (100%) rename target/linux/ath79/patches-5.15/{0005-usb-add-more-OF-quirk-properties.patch => 701-usb-add-more-OF-quirk-properties.patch} (100%) rename target/linux/ath79/patches-5.15/{420-net-use-downstream-ag71xx.patch => 710-net-use-downstream-ag71xx.patch} (100%) rename target/linux/ath79/patches-5.15/{900-mdio_bitbang_ignore_ta_value.patch => 720-mdio_bitbang_ignore_ta_value.patch} (100%) rename target/linux/ath79/patches-5.15/{901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch => 721-phy-mdio-bitbang-prevent-rescheduling-during-command.patch} (100%) rename target/linux/ath79/patches-5.15/{930-ar8216-make-reg-access-atomic.patch => 730-ar8216-make-reg-access-atomic.patch} (100%) rename target/linux/ath79/patches-5.15/{0003-leds-add-reset-controller-based-driver.patch => 800-leds-add-reset-controller-based-driver.patch} (100%) rename target/linux/ath79/patches-5.15/{910-unaligned_access_hacks.patch => 900-unaligned_access_hacks.patch} (100%) rename target/linux/ath79/patches-5.15/{920-mikrotik-rb4xx.patch => 910-mikrotik-rb4xx.patch} (100%) rename target/linux/ath79/patches-5.15/{939-mikrotik-rb91x.patch => 911-mikrotik-rb91x.patch} (100%) diff --git a/target/linux/ath79/patches-5.15/402-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch b/target/linux/ath79/patches-5.15/010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch similarity index 100% rename from target/linux/ath79/patches-5.15/402-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch rename to target/linux/ath79/patches-5.15/010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch diff --git a/target/linux/ath79/patches-5.15/403-v5.17-spi-ar934x-fix-transfer-size.patch b/target/linux/ath79/patches-5.15/011-v5.17-spi-ar934x-fix-transfer-size.patch similarity index 100% rename from target/linux/ath79/patches-5.15/403-v5.17-spi-ar934x-fix-transfer-size.patch rename to target/linux/ath79/patches-5.15/011-v5.17-spi-ar934x-fix-transfer-size.patch diff --git a/target/linux/ath79/patches-5.15/410-spi-ath79-Implement-the-spi_mem-interface.patch b/target/linux/ath79/patches-5.15/020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch similarity index 100% rename from target/linux/ath79/patches-5.15/410-spi-ath79-Implement-the-spi_mem-interface.patch rename to target/linux/ath79/patches-5.15/020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch diff --git a/target/linux/ath79/patches-5.15/940-ath79-add-support-for-booting-QCN550x.patch b/target/linux/ath79/patches-5.15/030-v5.18-ath79-add-support-for-booting-QCN550x.patch similarity index 98% rename from target/linux/ath79/patches-5.15/940-ath79-add-support-for-booting-QCN550x.patch rename to target/linux/ath79/patches-5.15/030-v5.18-ath79-add-support-for-booting-QCN550x.patch index cf774336343..41ea5d2ef0a 100644 --- a/target/linux/ath79/patches-5.15/940-ath79-add-support-for-booting-QCN550x.patch +++ b/target/linux/ath79/patches-5.15/030-v5.18-ath79-add-support-for-booting-QCN550x.patch @@ -38,7 +38,7 @@ Signed-off-by: Wenli Looi chip = "9343"; --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -867,6 +867,7 @@ +@@ -862,6 +862,7 @@ #define REV_ID_MAJOR_QCA9558 0x1130 #define REV_ID_MAJOR_TP9343 0x0150 #define REV_ID_MAJOR_QCA956X 0x1150 diff --git a/target/linux/ath79/patches-5.15/0007-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch b/target/linux/ath79/patches-5.15/300-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0007-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch rename to target/linux/ath79/patches-5.15/300-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch diff --git a/target/linux/ath79/patches-5.15/0008-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch b/target/linux/ath79/patches-5.15/301-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0008-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch rename to target/linux/ath79/patches-5.15/301-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch diff --git a/target/linux/ath79/patches-5.15/0017-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch b/target/linux/ath79/patches-5.15/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0017-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch rename to target/linux/ath79/patches-5.15/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch diff --git a/target/linux/ath79/patches-5.15/0018-MIPS-pci-ar71xx-convert-to-OF.patch b/target/linux/ath79/patches-5.15/311-MIPS-pci-ar71xx-convert-to-OF.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0018-MIPS-pci-ar71xx-convert-to-OF.patch rename to target/linux/ath79/patches-5.15/311-MIPS-pci-ar71xx-convert-to-OF.patch diff --git a/target/linux/ath79/patches-5.15/0019-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch b/target/linux/ath79/patches-5.15/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0019-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch rename to target/linux/ath79/patches-5.15/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch diff --git a/target/linux/ath79/patches-5.15/0020-MIPS-pci-ar724x-convert-to-OF.patch b/target/linux/ath79/patches-5.15/313-MIPS-pci-ar724x-convert-to-OF.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0020-MIPS-pci-ar724x-convert-to-OF.patch rename to target/linux/ath79/patches-5.15/313-MIPS-pci-ar724x-convert-to-OF.patch diff --git a/target/linux/ath79/patches-5.15/0036-MIPS-ath79-remove-irq-code-from-pci.patch b/target/linux/ath79/patches-5.15/314-MIPS-ath79-remove-irq-code-from-pci.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0036-MIPS-ath79-remove-irq-code-from-pci.patch rename to target/linux/ath79/patches-5.15/314-MIPS-ath79-remove-irq-code-from-pci.patch diff --git a/target/linux/ath79/patches-5.15/0062-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch b/target/linux/ath79/patches-5.15/315-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch similarity index 99% rename from target/linux/ath79/patches-5.15/0062-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch rename to target/linux/ath79/patches-5.15/315-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch index 1949a9f886e..375dec8ba2b 100644 --- a/target/linux/ath79/patches-5.15/0062-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch +++ b/target/linux/ath79/patches-5.15/315-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch @@ -16,7 +16,7 @@ Signed-off-by: David Bauer --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -391,6 +391,7 @@ +@@ -390,6 +390,7 @@ #define QCA955X_PLL_CPU_CONFIG_REG 0x00 #define QCA955X_PLL_DDR_CONFIG_REG 0x04 #define QCA955X_PLL_CLK_CTRL_REG 0x08 @@ -24,7 +24,7 @@ Signed-off-by: David Bauer #define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28 #define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48 #define QCA955X_PLL_ETH_SGMII_SERDES_REG 0x4c -@@ -476,6 +477,9 @@ +@@ -475,6 +476,9 @@ #define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL BIT(21) #define QCA956X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) diff --git a/target/linux/ath79/patches-5.15/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch b/target/linux/ath79/patches-5.15/316-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch similarity index 100% rename from target/linux/ath79/patches-5.15/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch rename to target/linux/ath79/patches-5.15/316-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch diff --git a/target/linux/ath79/patches-5.15/0037-missing-registers.patch b/target/linux/ath79/patches-5.15/330-missing-registers.patch similarity index 96% rename from target/linux/ath79/patches-5.15/0037-missing-registers.patch rename to target/linux/ath79/patches-5.15/330-missing-registers.patch index 0e6ac52ade6..74789437ec9 100644 --- a/target/linux/ath79/patches-5.15/0037-missing-registers.patch +++ b/target/linux/ath79/patches-5.15/330-missing-registers.patch @@ -7,7 +7,7 @@ Subject: [PATCH] ath79: gmac: add parsers for rxd(v)- and tx(d|en)-delay for --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -1226,6 +1226,10 @@ +@@ -1231,6 +1231,10 @@ #define AR934X_ETH_CFG_RDV_DELAY BIT(16) #define AR934X_ETH_CFG_RDV_DELAY_MASK 0x3 #define AR934X_ETH_CFG_RDV_DELAY_SHIFT 16 diff --git a/target/linux/ath79/patches-5.15/0038-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch b/target/linux/ath79/patches-5.15/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch similarity index 98% rename from target/linux/ath79/patches-5.15/0038-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch rename to target/linux/ath79/patches-5.15/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch index bc09062dc59..c2f228dfe1e 100644 --- a/target/linux/ath79/patches-5.15/0038-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch +++ b/target/linux/ath79/patches-5.15/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch @@ -16,7 +16,7 @@ Signed-off-by: David Bauer --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -1246,7 +1246,12 @@ +@@ -1251,7 +1251,12 @@ */ #define QCA955X_GMAC_REG_ETH_CFG 0x00 @@ -29,7 +29,7 @@ Signed-off-by: David Bauer #define QCA955X_ETH_CFG_RGMII_EN BIT(0) #define QCA955X_ETH_CFG_MII_GE0 BIT(1) -@@ -1268,9 +1273,58 @@ +@@ -1273,9 +1278,58 @@ #define QCA955X_ETH_CFG_TXE_DELAY_MASK 0x3 #define QCA955X_ETH_CFG_TXE_DELAY_SHIFT 20 diff --git a/target/linux/ath79/patches-5.15/0040-ath79-sgmii-config.patch b/target/linux/ath79/patches-5.15/332-ath79-sgmii-config.patch similarity index 98% rename from target/linux/ath79/patches-5.15/0040-ath79-sgmii-config.patch rename to target/linux/ath79/patches-5.15/332-ath79-sgmii-config.patch index 4c2b94899ae..a6a50e4a8ab 100644 --- a/target/linux/ath79/patches-5.15/0040-ath79-sgmii-config.patch +++ b/target/linux/ath79/patches-5.15/332-ath79-sgmii-config.patch @@ -21,7 +21,7 @@ Submitted-by: David Bauer --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -1376,5 +1376,6 @@ +@@ -1380,5 +1380,6 @@ #define QCA956X_SGMII_CONFIG_MODE_CTRL_SHIFT 0 #define QCA956X_SGMII_CONFIG_MODE_CTRL_MASK 0x7 diff --git a/target/linux/ath79/patches-5.15/004-register_gpio_driver_earlier.patch b/target/linux/ath79/patches-5.15/340-register_gpio_driver_earlier.patch similarity index 100% rename from target/linux/ath79/patches-5.15/004-register_gpio_driver_earlier.patch rename to target/linux/ath79/patches-5.15/340-register_gpio_driver_earlier.patch diff --git a/target/linux/ath79/patches-5.15/0034-MIPS-ath79-ath9k-exports.patch b/target/linux/ath79/patches-5.15/350-MIPS-ath79-ath9k-exports.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0034-MIPS-ath79-ath9k-exports.patch rename to target/linux/ath79/patches-5.15/350-MIPS-ath79-ath9k-exports.patch diff --git a/target/linux/ath79/patches-5.15/0041-MIPS-ath79-common-exports.patch b/target/linux/ath79/patches-5.15/351-MIPS-ath79-common-exports.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0041-MIPS-ath79-common-exports.patch rename to target/linux/ath79/patches-5.15/351-MIPS-ath79-common-exports.patch diff --git a/target/linux/ath79/patches-5.15/0039-MIPS-ath79-export-UART1-reference-clock.patch b/target/linux/ath79/patches-5.15/360-MIPS-ath79-export-UART1-reference-clock.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0039-MIPS-ath79-export-UART1-reference-clock.patch rename to target/linux/ath79/patches-5.15/360-MIPS-ath79-export-UART1-reference-clock.patch diff --git a/target/linux/ath79/patches-5.15/0032-MIPS-ath79-sanitize-symbols.patch b/target/linux/ath79/patches-5.15/370-MIPS-ath79-sanitize-symbols.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0032-MIPS-ath79-sanitize-symbols.patch rename to target/linux/ath79/patches-5.15/370-MIPS-ath79-sanitize-symbols.patch diff --git a/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/ath79/patches-5.15/400-mtd-nor-support-mtd-name-from-device-tree.patch similarity index 100% rename from target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch rename to target/linux/ath79/patches-5.15/400-mtd-nor-support-mtd-name-from-device-tree.patch diff --git a/target/linux/ath79/patches-5.15/404-mtd-cybertan-trx-parser.patch b/target/linux/ath79/patches-5.15/410-mtd-cybertan-trx-parser.patch similarity index 100% rename from target/linux/ath79/patches-5.15/404-mtd-cybertan-trx-parser.patch rename to target/linux/ath79/patches-5.15/410-mtd-cybertan-trx-parser.patch diff --git a/target/linux/ath79/patches-5.15/430-drivers-link-spi-before-mtd.patch b/target/linux/ath79/patches-5.15/420-drivers-link-spi-before-mtd.patch similarity index 100% rename from target/linux/ath79/patches-5.15/430-drivers-link-spi-before-mtd.patch rename to target/linux/ath79/patches-5.15/420-drivers-link-spi-before-mtd.patch diff --git a/target/linux/ath79/patches-5.15/440-mtd-ar934x-nand-driver.patch b/target/linux/ath79/patches-5.15/430-mtd-ar934x-nand-driver.patch similarity index 100% rename from target/linux/ath79/patches-5.15/440-mtd-ar934x-nand-driver.patch rename to target/linux/ath79/patches-5.15/430-mtd-ar934x-nand-driver.patch diff --git a/target/linux/ath79/patches-5.15/0004-phy-add-ath79-usb-phys.patch b/target/linux/ath79/patches-5.15/700-phy-add-ath79-usb-phys.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0004-phy-add-ath79-usb-phys.patch rename to target/linux/ath79/patches-5.15/700-phy-add-ath79-usb-phys.patch diff --git a/target/linux/ath79/patches-5.15/0005-usb-add-more-OF-quirk-properties.patch b/target/linux/ath79/patches-5.15/701-usb-add-more-OF-quirk-properties.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0005-usb-add-more-OF-quirk-properties.patch rename to target/linux/ath79/patches-5.15/701-usb-add-more-OF-quirk-properties.patch diff --git a/target/linux/ath79/patches-5.15/420-net-use-downstream-ag71xx.patch b/target/linux/ath79/patches-5.15/710-net-use-downstream-ag71xx.patch similarity index 100% rename from target/linux/ath79/patches-5.15/420-net-use-downstream-ag71xx.patch rename to target/linux/ath79/patches-5.15/710-net-use-downstream-ag71xx.patch diff --git a/target/linux/ath79/patches-5.15/900-mdio_bitbang_ignore_ta_value.patch b/target/linux/ath79/patches-5.15/720-mdio_bitbang_ignore_ta_value.patch similarity index 100% rename from target/linux/ath79/patches-5.15/900-mdio_bitbang_ignore_ta_value.patch rename to target/linux/ath79/patches-5.15/720-mdio_bitbang_ignore_ta_value.patch diff --git a/target/linux/ath79/patches-5.15/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch b/target/linux/ath79/patches-5.15/721-phy-mdio-bitbang-prevent-rescheduling-during-command.patch similarity index 100% rename from target/linux/ath79/patches-5.15/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch rename to target/linux/ath79/patches-5.15/721-phy-mdio-bitbang-prevent-rescheduling-during-command.patch diff --git a/target/linux/ath79/patches-5.15/930-ar8216-make-reg-access-atomic.patch b/target/linux/ath79/patches-5.15/730-ar8216-make-reg-access-atomic.patch similarity index 100% rename from target/linux/ath79/patches-5.15/930-ar8216-make-reg-access-atomic.patch rename to target/linux/ath79/patches-5.15/730-ar8216-make-reg-access-atomic.patch diff --git a/target/linux/ath79/patches-5.15/0003-leds-add-reset-controller-based-driver.patch b/target/linux/ath79/patches-5.15/800-leds-add-reset-controller-based-driver.patch similarity index 100% rename from target/linux/ath79/patches-5.15/0003-leds-add-reset-controller-based-driver.patch rename to target/linux/ath79/patches-5.15/800-leds-add-reset-controller-based-driver.patch diff --git a/target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/900-unaligned_access_hacks.patch similarity index 100% rename from target/linux/ath79/patches-5.15/910-unaligned_access_hacks.patch rename to target/linux/ath79/patches-5.15/900-unaligned_access_hacks.patch diff --git a/target/linux/ath79/patches-5.15/920-mikrotik-rb4xx.patch b/target/linux/ath79/patches-5.15/910-mikrotik-rb4xx.patch similarity index 100% rename from target/linux/ath79/patches-5.15/920-mikrotik-rb4xx.patch rename to target/linux/ath79/patches-5.15/910-mikrotik-rb4xx.patch diff --git a/target/linux/ath79/patches-5.15/939-mikrotik-rb91x.patch b/target/linux/ath79/patches-5.15/911-mikrotik-rb91x.patch similarity index 100% rename from target/linux/ath79/patches-5.15/939-mikrotik-rb91x.patch rename to target/linux/ath79/patches-5.15/911-mikrotik-rb91x.patch From d9a9caf3525899a74755bc4ea6ef3f7d4b049941 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 24 May 2023 11:26:37 +0000 Subject: [PATCH 03/32] ath79: copy patches and kernel config from 5.15 to 6.1 This is preparation for kernel 6.1 support. Signed-off-by: Shiji Yang --- target/linux/ath79/config-6.1 | 200 ++++ ...-ar934x-fix-transfer-and-word-delays.patch | 27 + ...1-v5.17-spi-ar934x-fix-transfer-size.patch | 62 ++ ...th79-Implement-the-spi_mem-interface.patch | 68 ++ ...th79-add-support-for-booting-QCN550x.patch | 48 + ...9-intc-add-irq-cascade-driver-for-QC.patch | 168 ++++ ...ip-irq-ath79-cpu-drop-OF-init-helper.patch | 23 + ...ngs-PCI-qcom-ar7100-adds-binding-doc.patch | 57 ++ .../311-MIPS-pci-ar71xx-convert-to-OF.patch | 206 ++++ ...ngs-PCI-qcom-ar7240-adds-binding-doc.patch | 61 ++ .../313-MIPS-pci-ar724x-convert-to-OF.patch | 213 +++++ ...-MIPS-ath79-remove-irq-code-from-pci.patch | 149 +++ ...ci-ar724x-add-QCA9550-reset-sequence.patch | 130 +++ ...ath79-swizzle-pci-address-for-ar71xx.patch | 109 +++ .../patches-6.1/330-missing-registers.patch | 20 + ...9-add-missing-QCA955x-GMAC-registers.patch | 90 ++ .../patches-6.1/332-ath79-sgmii-config.patch | 30 + .../340-register_gpio_driver_earlier.patch | 26 + .../350-MIPS-ath79-ath9k-exports.patch | 36 + .../351-MIPS-ath79-common-exports.patch | 26 + ...S-ath79-export-UART1-reference-clock.patch | 67 ++ .../370-MIPS-ath79-sanitize-symbols.patch | 93 ++ ...or-support-mtd-name-from-device-tree.patch | 54 ++ .../410-mtd-cybertan-trx-parser.patch | 45 + .../420-drivers-link-spi-before-mtd.patch | 20 + .../430-mtd-ar934x-nand-driver.patch | 34 + .../700-phy-add-ath79-usb-phys.patch | 333 +++++++ ...701-usb-add-more-OF-quirk-properties.patch | 24 + .../710-net-use-downstream-ag71xx.patch | 42 + .../720-mdio_bitbang_ignore_ta_value.patch | 44 + ...-prevent-rescheduling-during-command.patch | 61 ++ .../730-ar8216-make-reg-access-atomic.patch | 59 ++ ...ds-add-reset-controller-based-driver.patch | 186 ++++ .../900-unaligned_access_hacks.patch | 899 ++++++++++++++++++ .../patches-6.1/910-mikrotik-rb4xx.patch | 121 +++ .../patches-6.1/911-mikrotik-rb91x.patch | 97 ++ 36 files changed, 3928 insertions(+) create mode 100644 target/linux/ath79/config-6.1 create mode 100644 target/linux/ath79/patches-6.1/010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch create mode 100644 target/linux/ath79/patches-6.1/011-v5.17-spi-ar934x-fix-transfer-size.patch create mode 100644 target/linux/ath79/patches-6.1/020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch create mode 100644 target/linux/ath79/patches-6.1/030-v5.18-ath79-add-support-for-booting-QCN550x.patch create mode 100644 target/linux/ath79/patches-6.1/300-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch create mode 100644 target/linux/ath79/patches-6.1/301-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch create mode 100644 target/linux/ath79/patches-6.1/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch create mode 100644 target/linux/ath79/patches-6.1/311-MIPS-pci-ar71xx-convert-to-OF.patch create mode 100644 target/linux/ath79/patches-6.1/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch create mode 100644 target/linux/ath79/patches-6.1/313-MIPS-pci-ar724x-convert-to-OF.patch create mode 100644 target/linux/ath79/patches-6.1/314-MIPS-ath79-remove-irq-code-from-pci.patch create mode 100644 target/linux/ath79/patches-6.1/315-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch create mode 100644 target/linux/ath79/patches-6.1/316-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch create mode 100644 target/linux/ath79/patches-6.1/330-missing-registers.patch create mode 100644 target/linux/ath79/patches-6.1/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch create mode 100644 target/linux/ath79/patches-6.1/332-ath79-sgmii-config.patch create mode 100644 target/linux/ath79/patches-6.1/340-register_gpio_driver_earlier.patch create mode 100644 target/linux/ath79/patches-6.1/350-MIPS-ath79-ath9k-exports.patch create mode 100644 target/linux/ath79/patches-6.1/351-MIPS-ath79-common-exports.patch create mode 100644 target/linux/ath79/patches-6.1/360-MIPS-ath79-export-UART1-reference-clock.patch create mode 100644 target/linux/ath79/patches-6.1/370-MIPS-ath79-sanitize-symbols.patch create mode 100644 target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch create mode 100644 target/linux/ath79/patches-6.1/410-mtd-cybertan-trx-parser.patch create mode 100644 target/linux/ath79/patches-6.1/420-drivers-link-spi-before-mtd.patch create mode 100644 target/linux/ath79/patches-6.1/430-mtd-ar934x-nand-driver.patch create mode 100644 target/linux/ath79/patches-6.1/700-phy-add-ath79-usb-phys.patch create mode 100644 target/linux/ath79/patches-6.1/701-usb-add-more-OF-quirk-properties.patch create mode 100644 target/linux/ath79/patches-6.1/710-net-use-downstream-ag71xx.patch create mode 100644 target/linux/ath79/patches-6.1/720-mdio_bitbang_ignore_ta_value.patch create mode 100644 target/linux/ath79/patches-6.1/721-phy-mdio-bitbang-prevent-rescheduling-during-command.patch create mode 100644 target/linux/ath79/patches-6.1/730-ar8216-make-reg-access-atomic.patch create mode 100644 target/linux/ath79/patches-6.1/800-leds-add-reset-controller-based-driver.patch create mode 100644 target/linux/ath79/patches-6.1/900-unaligned_access_hacks.patch create mode 100644 target/linux/ath79/patches-6.1/910-mikrotik-rb4xx.patch create mode 100644 target/linux/ath79/patches-6.1/911-mikrotik-rb91x.patch diff --git a/target/linux/ath79/config-6.1 b/target/linux/ath79/config-6.1 new file mode 100644 index 00000000000..5b1b0d5add6 --- /dev/null +++ b/target/linux/ath79/config-6.1 @@ -0,0 +1,200 @@ +CONFIG_AG71XX=y +# CONFIG_AG71XX_DEBUG is not set +CONFIG_AG71XX_DEBUG_FS=y +CONFIG_AR8216_PHY=y +CONFIG_AR8216_PHY_LEDS=y +CONFIG_ARCH_32BIT_OFF_T=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_KEEP_MEMBLOCK=y +CONFIG_ARCH_MMAP_RND_BITS_MAX=15 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_AT803X_PHY=y +CONFIG_ATH79=y +CONFIG_ATH79_WDT=y +CONFIG_BLK_MQ_PCI=y +CONFIG_CEVT_R4K=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="rootfstype=squashfs,jffs2" +CONFIG_CMDLINE_BOOL=y +# CONFIG_CMDLINE_OVERRIDE is not set +CONFIG_COMMON_CLK=y +CONFIG_COMPAT_32BIT_TIME=y +CONFIG_CPU_BIG_ENDIAN=y +CONFIG_CPU_GENERIC_DUMP_TLB=y +CONFIG_CPU_HAS_DIEI=y +CONFIG_CPU_HAS_PREFETCH=y +CONFIG_CPU_HAS_RIXI=y +CONFIG_CPU_HAS_SYNC=y +CONFIG_CPU_MIPS32=y +CONFIG_CPU_MIPS32_R2=y +CONFIG_CPU_MIPSR2=y +CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y +CONFIG_CPU_R4K_CACHE_TLB=y +CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y +CONFIG_CPU_SUPPORTS_HIGHMEM=y +CONFIG_CPU_SUPPORTS_MSA=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2 +CONFIG_CRYPTO_RNG2=y +CONFIG_CSRC_R4K=y +CONFIG_DMA_NONCOHERENT=y +CONFIG_DTC=y +CONFIG_EARLY_PRINTK=y +CONFIG_ETHERNET_PACKET_MANGLE=y +CONFIG_FIXED_PHY=y +CONFIG_FWNODE_MDIO=y +CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_LIB_ASHLDI3=y +CONFIG_GENERIC_LIB_ASHRDI3=y +CONFIG_GENERIC_LIB_CMPDI2=y +CONFIG_GENERIC_LIB_LSHRDI3=y +CONFIG_GENERIC_LIB_UCMPDI2=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_PHY=y +CONFIG_GENERIC_PINCONF=y +CONFIG_GENERIC_PINCTRL_GROUPS=y +CONFIG_GENERIC_PINMUX_FUNCTIONS=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_74X164=y +CONFIG_GPIO_ATH79=y +CONFIG_GPIO_CDEV=y +CONFIG_GPIO_GENERIC=y +# CONFIG_GPIO_LATCH is not set +# CONFIG_GPIO_RB91X_KEY is not set +CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_HARDWARE_WATCHPOINTS=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HZ_PERIODIC=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_MIPS_CPU=y +CONFIG_IRQ_WORK=y +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_RESET is not set +CONFIG_LIBFDT=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MDIO_BITBANG=y +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_DEVRES=y +CONFIG_MDIO_GPIO=y +CONFIG_MEMFD_CREATE=y +# CONFIG_MFD_RB4XX_CPLD is not set +CONFIG_MFD_SYSCON=y +CONFIG_MIGRATION=y +CONFIG_MIPS=y +CONFIG_MIPS_ASID_BITS=8 +CONFIG_MIPS_ASID_SHIFT=0 +CONFIG_MIPS_CLOCK_VSYSCALL=y +# CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set +# CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set +CONFIG_MIPS_CMDLINE_FROM_DTB=y +CONFIG_MIPS_EBPF_JIT=y +CONFIG_MIPS_L1_CACHE_SHIFT=5 +CONFIG_MIPS_LD_CAN_LINK_VDSO=y +# CONFIG_MIPS_NO_APPENDED_DTB is not set +CONFIG_MIPS_RAW_APPENDED_DTB=y +CONFIG_MIPS_SPRAM=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_MTD_CFI_ADV_OPTIONS=y +CONFIG_MTD_CFI_GEOMETRY=y +# CONFIG_MTD_CFI_I2 is not set +# CONFIG_MTD_CFI_INTELEXT is not set +CONFIG_MTD_CMDLINE_PARTS=y +# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set +CONFIG_MTD_PARSER_CYBERTAN=y +# CONFIG_MTD_PARSER_TPLINK_SAFELOADER is not set +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPLIT_ELF_FW=y +CONFIG_MTD_SPLIT_LZMA_FW=y +CONFIG_MTD_SPLIT_SEAMA_FW=y +CONFIG_MTD_SPLIT_TPLINK_FW=y +CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_MTD_SPLIT_WRGG_FW=y +CONFIG_MTD_VIRT_CONCAT=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NET_SELFTESTS=y +CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y +CONFIG_NVMEM=y +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_KOBJ=y +CONFIG_OF_MDIO=y +CONFIG_PCI=y +CONFIG_PCI_AR71XX=y +CONFIG_PCI_AR724X=y +CONFIG_PCI_DISABLE_COMMON_QUIRKS=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_DRIVERS_LEGACY=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PHYLIB=y +# CONFIG_PHY_AR7100_USB is not set +# CONFIG_PHY_AR7200_USB is not set +# CONFIG_PHY_ATH79_USB is not set +CONFIG_PINCTRL=y +CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_RATIONAL=y +CONFIG_REGMAP=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGULATOR=y +CONFIG_RESET_ATH79=y +CONFIG_RESET_CONTROLLER=y +CONFIG_SERIAL_8250_NR_UARTS=1 +CONFIG_SERIAL_8250_RUNTIME_UARTS=1 +CONFIG_SERIAL_AR933X=y +CONFIG_SERIAL_AR933X_CONSOLE=y +CONFIG_SERIAL_AR933X_NR_UARTS=2 +CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SPI=y +CONFIG_SPI_AR934X=y +CONFIG_SPI_ATH79=y +CONFIG_SPI_BITBANG=y +CONFIG_SPI_GPIO=y +CONFIG_SPI_MASTER=y +CONFIG_SPI_MEM=y +# CONFIG_SPI_RB4XX is not set +CONFIG_SRCU=y +CONFIG_SWCONFIG=y +CONFIG_SWCONFIG_LEDS=y +CONFIG_SWPHY=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_SYS_HAS_CPU_MIPS32_R2=y +CONFIG_SYS_HAS_EARLY_PRINTK=y +CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y +CONFIG_SYS_SUPPORTS_ARBIT_HZ=y +CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y +CONFIG_SYS_SUPPORTS_MIPS16=y +CONFIG_SYS_SUPPORTS_ZBOOT=y +CONFIG_SYS_SUPPORTS_ZBOOT_UART_PROM=y +CONFIG_TARGET_ISA_REV=2 +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TINY_SRCU=y +CONFIG_USB_SUPPORT=y +CONFIG_USE_OF=y diff --git a/target/linux/ath79/patches-6.1/010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch b/target/linux/ath79/patches-6.1/010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch new file mode 100644 index 00000000000..7ce6df6d7bd --- /dev/null +++ b/target/linux/ath79/patches-6.1/010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch @@ -0,0 +1,27 @@ +From c70282457c380db7deb57c81a6894debc8f88efa Mon Sep 17 00:00:00 2001 +From: Oskari Lemmela +Date: Wed, 22 Dec 2021 07:59:58 +0200 +Subject: [PATCH] spi: ar934x: fix transfer and word delays + +Add missing delay between transferred messages and words. + +Signed-off-by: Oskari Lemmela +Link: https://lore.kernel.org/r/20211222055958.1383233-3-oskari@lemmela.net +Signed-off-by: Mark Brown +--- + drivers/spi/spi-ar934x.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/spi/spi-ar934x.c ++++ b/drivers/spi/spi-ar934x.c +@@ -137,8 +137,10 @@ static int ar934x_spi_transfer_one_messa + reg >>= 8; + } + } ++ spi_delay_exec(&t->word_delay, t); + } + m->actual_length += t->len; ++ spi_transfer_delay_exec(t); + } + + msg_done: diff --git a/target/linux/ath79/patches-6.1/011-v5.17-spi-ar934x-fix-transfer-size.patch b/target/linux/ath79/patches-6.1/011-v5.17-spi-ar934x-fix-transfer-size.patch new file mode 100644 index 00000000000..87f5da2c60e --- /dev/null +++ b/target/linux/ath79/patches-6.1/011-v5.17-spi-ar934x-fix-transfer-size.patch @@ -0,0 +1,62 @@ +From ebe33e5a98dcf14a9630845f3f10c193584ac054 Mon Sep 17 00:00:00 2001 +From: Oskari Lemmela +Date: Wed, 22 Dec 2021 07:59:57 +0200 +Subject: [PATCH] spi: ar934x: fix transfer size + +If bits_per_word is configured, transfer only word amount +of data per iteration. + +Signed-off-by: Oskari Lemmela +Link: https://lore.kernel.org/r/20211222055958.1383233-2-oskari@lemmela.net +Signed-off-by: Mark Brown +--- + drivers/spi/spi-ar934x.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +--- a/drivers/spi/spi-ar934x.c ++++ b/drivers/spi/spi-ar934x.c +@@ -82,7 +82,7 @@ static int ar934x_spi_transfer_one_messa + struct spi_device *spi = m->spi; + unsigned long trx_done, trx_cur; + int stat = 0; +- u8 term = 0; ++ u8 bpw, term = 0; + int div, i; + u32 reg; + const u8 *tx_buf; +@@ -90,6 +90,11 @@ static int ar934x_spi_transfer_one_messa + + m->actual_length = 0; + list_for_each_entry(t, &m->transfers, transfer_list) { ++ if (t->bits_per_word >= 8 && t->bits_per_word < 32) ++ bpw = t->bits_per_word >> 3; ++ else ++ bpw = 4; ++ + if (t->speed_hz) + div = ar934x_spi_clk_div(sp, t->speed_hz); + else +@@ -105,10 +110,10 @@ static int ar934x_spi_transfer_one_messa + iowrite32(reg, sp->base + AR934X_SPI_REG_CTRL); + iowrite32(0, sp->base + AR934X_SPI_DATAOUT); + +- for (trx_done = 0; trx_done < t->len; trx_done += 4) { ++ for (trx_done = 0; trx_done < t->len; trx_done += bpw) { + trx_cur = t->len - trx_done; +- if (trx_cur > 4) +- trx_cur = 4; ++ if (trx_cur > bpw) ++ trx_cur = bpw; + else if (list_is_last(&t->transfer_list, &m->transfers)) + term = 1; + +@@ -193,7 +198,8 @@ static int ar934x_spi_probe(struct platf + ctlr->mode_bits = SPI_LSB_FIRST; + ctlr->setup = ar934x_spi_setup; + ctlr->transfer_one_message = ar934x_spi_transfer_one_message; +- ctlr->bits_per_word_mask = SPI_BPW_MASK(8); ++ ctlr->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(24) | ++ SPI_BPW_MASK(16) | SPI_BPW_MASK(8); + ctlr->dev.of_node = pdev->dev.of_node; + ctlr->num_chipselect = 3; + diff --git a/target/linux/ath79/patches-6.1/020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch b/target/linux/ath79/patches-6.1/020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch new file mode 100644 index 00000000000..5746a889e8c --- /dev/null +++ b/target/linux/ath79/patches-6.1/020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch @@ -0,0 +1,68 @@ +From 8d8cdb4a6ccee5b62cc0dc64651c3946364514dc Mon Sep 17 00:00:00 2001 +From: Luiz Angelo Daros de Luca +Date: Mon, 10 Feb 2020 16:11:27 -0300 +Subject: [PATCH] spi: ath79: Implement the spi_mem interface + +Signed-off-by: Luiz Angelo Daros de Luca +--- + drivers/spi/spi-ath79.c | 35 +++++++++++++++++++++++++++++++++++ + 1 file changed, 35 insertions(+) + +--- a/drivers/spi/spi-ath79.c ++++ b/drivers/spi/spi-ath79.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -133,6 +134,39 @@ static u32 ath79_spi_txrx_mode0(struct s + return ath79_spi_rr(sp, AR71XX_SPI_REG_RDS); + } + ++static int ath79_exec_mem_op(struct spi_mem *mem, ++ const struct spi_mem_op *op) ++{ ++ struct ath79_spi *sp = ath79_spidev_to_sp(mem->spi); ++ ++ /* Ensures that reading is performed on device connected ++ to hardware cs0 */ ++ if (mem->spi->chip_select || mem->spi->cs_gpiod) ++ return -ENOTSUPP; ++ ++ /* Only use for fast-read op. */ ++ if (op->cmd.opcode != 0x0b || op->data.dir != SPI_MEM_DATA_IN || ++ op->addr.nbytes != 3 || op->dummy.nbytes != 1) ++ return -ENOTSUPP; ++ ++ /* disable GPIO mode */ ++ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, 0); ++ ++ memcpy_fromio(op->data.buf.in, sp->base + op->addr.val, op->data.nbytes); ++ ++ /* enable GPIO mode */ ++ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO); ++ ++ /* restore IOC register */ ++ ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base); ++ ++ return 0; ++} ++ ++static const struct spi_controller_mem_ops ath79_mem_ops = { ++ .exec_op = ath79_exec_mem_op, ++}; ++ + static int ath79_spi_probe(struct platform_device *pdev) + { + struct spi_master *master; +@@ -165,6 +199,7 @@ static int ath79_spi_probe(struct platfo + ret = PTR_ERR(sp->base); + goto err_put_master; + } ++ master->mem_ops = &ath79_mem_ops; + + sp->clk = devm_clk_get(&pdev->dev, "ahb"); + if (IS_ERR(sp->clk)) { diff --git a/target/linux/ath79/patches-6.1/030-v5.18-ath79-add-support-for-booting-QCN550x.patch b/target/linux/ath79/patches-6.1/030-v5.18-ath79-add-support-for-booting-QCN550x.patch new file mode 100644 index 00000000000..41ea5d2ef0a --- /dev/null +++ b/target/linux/ath79/patches-6.1/030-v5.18-ath79-add-support-for-booting-QCN550x.patch @@ -0,0 +1,48 @@ +From: Wenli Looi +Date: Sun, 20 Jun 2021 23:32:28 -0700 +Subject: [PATCH] ath79: add support for booting QCN550x + +Based on wikidevi, QCN550x is a "Dragonfly" like QCA9561 and QCA9563. +Treating it as QCA956x seems to work. +Tested on Netgear EX7300v2 which boots successfully with +the same CPU clock as the stock firmware. + +Link: https://wikidevi.wi-cat.ru/Qualcomm#bgn +Link: https://wikidevi.wi-cat.ru/Qualcomm_Atheros#.28a.29bgn_2 +Signed-off-by: Wenli Looi + +--- a/arch/mips/ath79/early_printk.c ++++ b/arch/mips/ath79/early_printk.c +@@ -121,6 +121,7 @@ static void prom_putchar_init(void) + case REV_ID_MAJOR_QCA9558: + case REV_ID_MAJOR_TP9343: + case REV_ID_MAJOR_QCA956X: ++ case REV_ID_MAJOR_QCN550X: + _prom_putchar = prom_putchar_ar71xx; + break; + +--- a/arch/mips/ath79/setup.c ++++ b/arch/mips/ath79/setup.c +@@ -168,6 +168,12 @@ static void __init ath79_detect_sys_type + rev = id & QCA956X_REV_ID_REVISION_MASK; + break; + ++ case REV_ID_MAJOR_QCN550X: ++ ath79_soc = ATH79_SOC_QCA956X; ++ chip = "550X"; ++ rev = id & QCA956X_REV_ID_REVISION_MASK; ++ break; ++ + case REV_ID_MAJOR_TP9343: + ath79_soc = ATH79_SOC_TP9343; + chip = "9343"; +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h ++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +@@ -862,6 +862,7 @@ + #define REV_ID_MAJOR_QCA9558 0x1130 + #define REV_ID_MAJOR_TP9343 0x0150 + #define REV_ID_MAJOR_QCA956X 0x1150 ++#define REV_ID_MAJOR_QCN550X 0x2170 + + #define AR71XX_REV_ID_MINOR_MASK 0x3 + #define AR71XX_REV_ID_MINOR_AR7130 0x0 diff --git a/target/linux/ath79/patches-6.1/300-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch b/target/linux/ath79/patches-6.1/300-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch new file mode 100644 index 00000000000..ceda511c21a --- /dev/null +++ b/target/linux/ath79/patches-6.1/300-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch @@ -0,0 +1,168 @@ +From f3eacff2310a60348a755c50a8da6fc251fc8587 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Tue, 6 Mar 2018 09:55:13 +0100 +Subject: [PATCH 07/33] irqchip/irq-ath79-intc: add irq cascade driver for + QCA9556 SoCs + +Signed-off-by: John Crispin +--- + drivers/irqchip/Makefile | 1 + + drivers/irqchip/irq-ath79-intc.c | 142 +++++++++++++++++++++++++++++++++++++++ + 2 files changed, 143 insertions(+) + create mode 100644 drivers/irqchip/irq-ath79-intc.c + +--- a/drivers/irqchip/Makefile ++++ b/drivers/irqchip/Makefile +@@ -4,6 +4,7 @@ obj-$(CONFIG_IRQCHIP) += irqchip.o + obj-$(CONFIG_AL_FIC) += irq-al-fic.o + obj-$(CONFIG_ALPINE_MSI) += irq-alpine-msi.o + obj-$(CONFIG_ATH79) += irq-ath79-cpu.o ++obj-$(CONFIG_ATH79) += irq-ath79-intc.o + obj-$(CONFIG_ATH79) += irq-ath79-misc.o + obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o + obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2836.o +--- /dev/null ++++ b/drivers/irqchip/irq-ath79-intc.c +@@ -0,0 +1,142 @@ ++/* ++ * Atheros AR71xx/AR724x/AR913x specific interrupt handling ++ * ++ * Copyright (C) 2018 John Crispin ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#define ATH79_MAX_INTC_CASCADE 3 ++ ++struct ath79_intc { ++ struct irq_chip chip; ++ u32 irq; ++ u32 pending_mask; ++ u32 int_status; ++ u32 irq_mask[ATH79_MAX_INTC_CASCADE]; ++ u32 irq_wb_chan[ATH79_MAX_INTC_CASCADE]; ++}; ++ ++static void ath79_intc_irq_handler(struct irq_desc *desc) ++{ ++ struct irq_domain *domain = irq_desc_get_handler_data(desc); ++ struct ath79_intc *intc = domain->host_data; ++ u32 pending; ++ ++ pending = ath79_reset_rr(intc->int_status); ++ pending &= intc->pending_mask; ++ ++ if (pending) { ++ int i; ++ ++ for (i = 0; i < domain->hwirq_max; i++) ++ if (pending & intc->irq_mask[i]) { ++ if (intc->irq_wb_chan[i] != 0xffffffff) ++ ath79_ddr_wb_flush(intc->irq_wb_chan[i]); ++ generic_handle_irq(irq_find_mapping(domain, i)); ++ } ++ } else { ++ spurious_interrupt(); ++ } ++} ++ ++static void ath79_intc_irq_enable(struct irq_data *d) ++{ ++ struct ath79_intc *intc = d->domain->host_data; ++ enable_irq(intc->irq); ++} ++ ++static void ath79_intc_irq_disable(struct irq_data *d) ++{ ++ struct ath79_intc *intc = d->domain->host_data; ++ disable_irq(intc->irq); ++} ++ ++static int ath79_intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) ++{ ++ struct ath79_intc *intc = d->host_data; ++ ++ irq_set_chip_and_handler(irq, &intc->chip, handle_level_irq); ++ ++ return 0; ++} ++ ++static const struct irq_domain_ops ath79_irq_domain_ops = { ++ .xlate = irq_domain_xlate_onecell, ++ .map = ath79_intc_map, ++}; ++ ++static int __init ath79_intc_of_init( ++ struct device_node *node, struct device_node *parent) ++{ ++ struct irq_domain *domain; ++ struct ath79_intc *intc; ++ int cnt, cntwb, i, err; ++ ++ cnt = of_property_count_u32_elems(node, "qca,pending-bits"); ++ if (cnt > ATH79_MAX_INTC_CASCADE) ++ panic("Too many INTC pending bits\n"); ++ ++ intc = kzalloc(sizeof(*intc), GFP_KERNEL); ++ if (!intc) ++ panic("Failed to allocate INTC memory\n"); ++ intc->chip = dummy_irq_chip; ++ intc->chip.name = "INTC"; ++ intc->chip.irq_disable = ath79_intc_irq_disable; ++ intc->chip.irq_enable = ath79_intc_irq_enable; ++ ++ if (of_property_read_u32(node, "qca,int-status-addr", &intc->int_status) < 0) { ++ panic("Missing address of interrupt status register\n"); ++ } ++ ++ of_property_read_u32_array(node, "qca,pending-bits", intc->irq_mask, cnt); ++ for (i = 0; i < cnt; i++) { ++ intc->pending_mask |= intc->irq_mask[i]; ++ intc->irq_wb_chan[i] = 0xffffffff; ++ } ++ ++ cntwb = of_count_phandle_with_args( ++ node, "qca,ddr-wb-channels", "#qca,ddr-wb-channel-cells"); ++ ++ for (i = 0; i < cntwb; i++) { ++ struct of_phandle_args args; ++ u32 irq = i; ++ ++ of_property_read_u32_index( ++ node, "qca,ddr-wb-channel-interrupts", i, &irq); ++ if (irq >= ATH79_MAX_INTC_CASCADE) ++ continue; ++ ++ err = of_parse_phandle_with_args( ++ node, "qca,ddr-wb-channels", ++ "#qca,ddr-wb-channel-cells", ++ i, &args); ++ if (err) ++ return err; ++ ++ intc->irq_wb_chan[irq] = args.args[0]; ++ } ++ ++ intc->irq = irq_of_parse_and_map(node, 0); ++ if (!intc->irq) ++ panic("Failed to get INTC IRQ"); ++ ++ domain = irq_domain_add_linear(node, cnt, &ath79_irq_domain_ops, intc); ++ irq_set_chained_handler_and_data(intc->irq, ath79_intc_irq_handler, domain); ++ ++ return 0; ++} ++IRQCHIP_DECLARE(ath79_intc, "qca,ar9340-intc", ++ ath79_intc_of_init); diff --git a/target/linux/ath79/patches-6.1/301-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch b/target/linux/ath79/patches-6.1/301-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch new file mode 100644 index 00000000000..13117d9a8e6 --- /dev/null +++ b/target/linux/ath79/patches-6.1/301-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch @@ -0,0 +1,23 @@ +From e029f998594f151008ecbfa024e2957edd2a5189 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Tue, 6 Mar 2018 09:58:19 +0100 +Subject: [PATCH 08/33] irqchip/irq-ath79-cpu: drop !OF init helper + +Signed-off-by: John Crispin +--- + drivers/irqchip/irq-ath79-cpu.c | 7 ------- + 1 file changed, 7 deletions(-) + +--- a/drivers/irqchip/irq-ath79-cpu.c ++++ b/drivers/irqchip/irq-ath79-cpu.c +@@ -85,10 +85,3 @@ static int __init ar79_cpu_intc_of_init( + } + IRQCHIP_DECLARE(ar79_cpu_intc, "qca,ar7100-cpu-intc", + ar79_cpu_intc_of_init); +- +-void __init ath79_cpu_irq_init(unsigned irq_wb_chan2, unsigned irq_wb_chan3) +-{ +- irq_wb_chan[2] = irq_wb_chan2; +- irq_wb_chan[3] = irq_wb_chan3; +- mips_cpu_irq_init(); +-} diff --git a/target/linux/ath79/patches-6.1/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch b/target/linux/ath79/patches-6.1/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch new file mode 100644 index 00000000000..bf7eb691a5d --- /dev/null +++ b/target/linux/ath79/patches-6.1/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch @@ -0,0 +1,57 @@ +From 4a4f869ec58ed8910b9b2e68d0eee50957e9bb20 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 25 Jun 2018 15:52:10 +0200 +Subject: [PATCH 17/33] dt-bindings: PCI: qcom,ar7100: adds binding doc + +With the driver being converted from platform_data to pure OF, we need to +also add some docs. + +Cc: Rob Herring +Cc: devicetree@vger.kernel.org +Signed-off-by: John Crispin +--- + .../devicetree/bindings/pci/qcom,ar7100-pci.txt | 38 ++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + create mode 100644 Documentation/devicetree/bindings/pci/qcom,ar7100-pci.txt + +--- /dev/null ++++ b/Documentation/devicetree/bindings/pci/qcom,ar7100-pci.txt +@@ -0,0 +1,38 @@ ++* Qualcomm Atheros AR7100 PCI express root complex ++ ++Required properties: ++- compatible: should contain "qcom,ar7100-pci" to identify the core. ++- reg: Should contain the register ranges as listed in the reg-names property. ++- reg-names: Definition: Must include the following entries ++ - "cfg_base" IO Memory ++- #address-cells: set to <3> ++- #size-cells: set to <2> ++- ranges: ranges for the PCI memory and I/O regions ++- interrupt-map-mask and interrupt-map: standard PCI ++ properties to define the mapping of the PCIe interface to interrupt ++ numbers. ++- #interrupt-cells: set to <1> ++- interrupt-controller: define to enable the builtin IRQ cascade. ++ ++Optional properties: ++- interrupt-parent: phandle to the MIPS IRQ controller ++ ++* Example for ar7100 ++ pcie-controller@180c0000 { ++ compatible = "qca,ar7100-pci"; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ bus-range = <0x0 0x0>; ++ reg = <0x17010000 0x100>; ++ reg-names = "cfg_base"; ++ ranges = <0x2000000 0 0x10000000 0x10000000 0 0x07000000 ++ 0x1000000 0 0x00000000 0x00000000 0 0x00000001>; ++ interrupt-parent = <&cpuintc>; ++ interrupts = <2>; ++ ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ ++ interrupt-map-mask = <0 0 0 1>; ++ interrupt-map = <0 0 0 0 &pcie0 0>; ++ }; diff --git a/target/linux/ath79/patches-6.1/311-MIPS-pci-ar71xx-convert-to-OF.patch b/target/linux/ath79/patches-6.1/311-MIPS-pci-ar71xx-convert-to-OF.patch new file mode 100644 index 00000000000..9a315aed0b2 --- /dev/null +++ b/target/linux/ath79/patches-6.1/311-MIPS-pci-ar71xx-convert-to-OF.patch @@ -0,0 +1,206 @@ +From 1855ab6b1d27f5b38a648baf57ff6a534afec26d Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sat, 23 Jun 2018 15:07:23 +0200 +Subject: [PATCH 18/33] MIPS: pci-ar71xx: convert to OF + +With the ath79 target getting converted to pure OF, we can drop all the +platform data code and add the missing OF bits to the driver. We also add +a irq domain for the PCI/e controllers cascade, thus making it usable from +dts files. + +Signed-off-by: John Crispin +--- + arch/mips/pci/pci-ar71xx.c | 82 +++++++++++++++++++++++----------------------- + 1 file changed, 41 insertions(+), 41 deletions(-) + +--- a/arch/mips/pci/pci-ar71xx.c ++++ b/arch/mips/pci/pci-ar71xx.c +@@ -15,8 +15,11 @@ + #include + #include + #include ++#include + #include + #include ++#include ++#include + + #include + #include +@@ -46,12 +49,13 @@ + #define AR71XX_PCI_IRQ_COUNT 5 + + struct ar71xx_pci_controller { ++ struct device_node *np; + void __iomem *cfg_base; + int irq; +- int irq_base; + struct pci_controller pci_ctrl; + struct resource io_res; + struct resource mem_res; ++ struct irq_domain *domain; + }; + + /* Byte lane enable bits */ +@@ -225,29 +229,30 @@ static struct pci_ops ar71xx_pci_ops = { + + static void ar71xx_pci_irq_handler(struct irq_desc *desc) + { +- struct ar71xx_pci_controller *apc; + void __iomem *base = ath79_reset_base; ++ struct irq_chip *chip = irq_desc_get_chip(desc); ++ struct ar71xx_pci_controller *apc = irq_desc_get_handler_data(desc); + u32 pending; + +- apc = irq_desc_get_handler_data(desc); +- ++ chained_irq_enter(chip, desc); + pending = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_STATUS) & + __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); + + if (pending & AR71XX_PCI_INT_DEV0) +- generic_handle_irq(apc->irq_base + 0); ++ generic_handle_irq(irq_linear_revmap(apc->domain, 1)); + + else if (pending & AR71XX_PCI_INT_DEV1) +- generic_handle_irq(apc->irq_base + 1); ++ generic_handle_irq(irq_linear_revmap(apc->domain, 2)); + + else if (pending & AR71XX_PCI_INT_DEV2) +- generic_handle_irq(apc->irq_base + 2); ++ generic_handle_irq(irq_linear_revmap(apc->domain, 3)); + + else if (pending & AR71XX_PCI_INT_CORE) +- generic_handle_irq(apc->irq_base + 4); ++ generic_handle_irq(irq_linear_revmap(apc->domain, 4)); + + else + spurious_interrupt(); ++ chained_irq_exit(chip, desc); + } + + static void ar71xx_pci_irq_unmask(struct irq_data *d) +@@ -258,7 +263,7 @@ static void ar71xx_pci_irq_unmask(struct + u32 t; + + apc = irq_data_get_irq_chip_data(d); +- irq = d->irq - apc->irq_base; ++ irq = irq_linear_revmap(apc->domain, d->irq); + + t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); + __raw_writel(t | (1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); +@@ -275,7 +280,7 @@ static void ar71xx_pci_irq_mask(struct i + u32 t; + + apc = irq_data_get_irq_chip_data(d); +- irq = d->irq - apc->irq_base; ++ irq = irq_linear_revmap(apc->domain, d->irq); + + t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); + __raw_writel(t & ~(1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); +@@ -291,24 +296,31 @@ static struct irq_chip ar71xx_pci_irq_ch + .irq_mask_ack = ar71xx_pci_irq_mask, + }; + ++static int ar71xx_pci_irq_map(struct irq_domain *d, ++ unsigned int irq, irq_hw_number_t hw) ++{ ++ struct ar71xx_pci_controller *apc = d->host_data; ++ ++ irq_set_chip_and_handler(irq, &ar71xx_pci_irq_chip, handle_level_irq); ++ irq_set_chip_data(irq, apc); ++ ++ return 0; ++} ++ ++static const struct irq_domain_ops ar71xx_pci_domain_ops = { ++ .xlate = irq_domain_xlate_onecell, ++ .map = ar71xx_pci_irq_map, ++}; ++ + static void ar71xx_pci_irq_init(struct ar71xx_pci_controller *apc) + { + void __iomem *base = ath79_reset_base; +- int i; + + __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_ENABLE); + __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_STATUS); + +- BUILD_BUG_ON(ATH79_PCI_IRQ_COUNT < AR71XX_PCI_IRQ_COUNT); +- +- apc->irq_base = ATH79_PCI_IRQ_BASE; +- for (i = apc->irq_base; +- i < apc->irq_base + AR71XX_PCI_IRQ_COUNT; i++) { +- irq_set_chip_and_handler(i, &ar71xx_pci_irq_chip, +- handle_level_irq); +- irq_set_chip_data(i, apc); +- } +- ++ apc->domain = irq_domain_add_linear(apc->np, AR71XX_PCI_IRQ_COUNT, ++ &ar71xx_pci_domain_ops, apc); + irq_set_chained_handler_and_data(apc->irq, ar71xx_pci_irq_handler, + apc); + } +@@ -325,10 +337,14 @@ static void ar71xx_pci_reset(void) + mdelay(100); + } + ++static const struct of_device_id ar71xx_pci_ids[] = { ++ { .compatible = "qca,ar7100-pci" }, ++ {}, ++}; ++ + static int ar71xx_pci_probe(struct platform_device *pdev) + { + struct ar71xx_pci_controller *apc; +- struct resource *res; + u32 t; + + apc = devm_kzalloc(&pdev->dev, sizeof(struct ar71xx_pci_controller), +@@ -345,26 +361,6 @@ static int ar71xx_pci_probe(struct platf + if (apc->irq < 0) + return -EINVAL; + +- res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base"); +- if (!res) +- return -EINVAL; +- +- apc->io_res.parent = res; +- apc->io_res.name = "PCI IO space"; +- apc->io_res.start = res->start; +- apc->io_res.end = res->end; +- apc->io_res.flags = IORESOURCE_IO; +- +- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem_base"); +- if (!res) +- return -EINVAL; +- +- apc->mem_res.parent = res; +- apc->mem_res.name = "PCI memory space"; +- apc->mem_res.start = res->start; +- apc->mem_res.end = res->end; +- apc->mem_res.flags = IORESOURCE_MEM; +- + ar71xx_pci_reset(); + + /* setup COMMAND register */ +@@ -377,9 +373,11 @@ static int ar71xx_pci_probe(struct platf + + ar71xx_pci_irq_init(apc); + ++ apc->np = pdev->dev.of_node; + apc->pci_ctrl.pci_ops = &ar71xx_pci_ops; + apc->pci_ctrl.mem_resource = &apc->mem_res; + apc->pci_ctrl.io_resource = &apc->io_res; ++ pci_load_of_ranges(&apc->pci_ctrl, pdev->dev.of_node); + + register_pci_controller(&apc->pci_ctrl); + +@@ -390,6 +388,7 @@ static struct platform_driver ar71xx_pci + .probe = ar71xx_pci_probe, + .driver = { + .name = "ar71xx-pci", ++ .of_match_table = of_match_ptr(ar71xx_pci_ids), + }, + }; + diff --git a/target/linux/ath79/patches-6.1/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch b/target/linux/ath79/patches-6.1/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch new file mode 100644 index 00000000000..a0af79cb4da --- /dev/null +++ b/target/linux/ath79/patches-6.1/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch @@ -0,0 +1,61 @@ +From ea27764bc3ef2a05decf3ae05edffc289cd0d93c Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 25 Jun 2018 15:52:02 +0200 +Subject: [PATCH 19/33] dt-bindings: PCI: qcom,ar7240: adds binding doc + +With the driver being converted from platform_data to pure OF, we need to +also add some docs. + +Cc: Rob Herring +Cc: devicetree@vger.kernel.org +Signed-off-by: John Crispin +--- + .../devicetree/bindings/pci/qcom,ar7240-pci.txt | 42 ++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + create mode 100644 Documentation/devicetree/bindings/pci/qcom,ar7240-pci.txt + +--- /dev/null ++++ b/Documentation/devicetree/bindings/pci/qcom,ar7240-pci.txt +@@ -0,0 +1,42 @@ ++* Qualcomm Atheros AR724X PCI express root complex ++ ++Required properties: ++- compatible: should contain "qcom,ar7240-pci" to identify the core. ++- reg: Should contain the register ranges as listed in the reg-names property. ++- reg-names: Definition: Must include the following entries ++ - "crp_base" Configuration registers ++ - "ctrl_base" Control registers ++ - "cfg_base" IO Memory ++- #address-cells: set to <3> ++- #size-cells: set to <2> ++- ranges: ranges for the PCI memory and I/O regions ++- interrupt-map-mask and interrupt-map: standard PCI ++ properties to define the mapping of the PCIe interface to interrupt ++ numbers. ++- #interrupt-cells: set to <1> ++- interrupt-parent: phandle to the MIPS IRQ controller ++ ++Optional properties: ++- interrupt-controller: define to enable the builtin IRQ cascade. ++ ++* Example for qca9557 ++ pcie-controller@180c0000 { ++ compatible = "qcom,ar7240-pci"; ++ #address-cells = <3>; ++ #size-cells = <2>; ++ bus-range = <0x0 0x0>; ++ reg = <0x180c0000 0x1000>, ++ <0x180f0000 0x100>, ++ <0x14000000 0x1000>; ++ reg-names = "crp_base", "ctrl_base", "cfg_base"; ++ ranges = <0x2000000 0 0x10000000 0x10000000 0 0x04000000 ++ 0x1000000 0 0x00000000 0x00000000 0 0x00000001>; ++ interrupt-parent = <&intc2>; ++ interrupts = <1>; ++ ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ ++ interrupt-map-mask = <0 0 0 1>; ++ interrupt-map = <0 0 0 0 &pcie0 0>; ++ }; diff --git a/target/linux/ath79/patches-6.1/313-MIPS-pci-ar724x-convert-to-OF.patch b/target/linux/ath79/patches-6.1/313-MIPS-pci-ar724x-convert-to-OF.patch new file mode 100644 index 00000000000..7927c1cbf5f --- /dev/null +++ b/target/linux/ath79/patches-6.1/313-MIPS-pci-ar724x-convert-to-OF.patch @@ -0,0 +1,213 @@ +From a522ee0199d5d3ea114ca2e211f6ac398d3e8e0b Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sat, 23 Jun 2018 15:07:37 +0200 +Subject: [PATCH 20/33] MIPS: pci-ar724x: convert to OF + +With the ath79 target getting converted to pure OF, we can drop all the +platform data code and add the missing OF bits to the driver. We also add +a irq domain for the PCI/e controllers cascade, thus making it usable from +dts files. + +Signed-off-by: John Crispin +--- + arch/mips/pci/pci-ar724x.c | 88 ++++++++++++++++++++++------------------------ + 1 file changed, 42 insertions(+), 46 deletions(-) + +--- a/arch/mips/pci/pci-ar724x.c ++++ b/arch/mips/pci/pci-ar724x.c +@@ -11,8 +11,11 @@ + #include + #include + #include ++#include + #include + #include ++#include ++#include + + #define AR724X_PCI_REG_APP 0x00 + #define AR724X_PCI_REG_RESET 0x18 +@@ -42,17 +45,20 @@ struct ar724x_pci_controller { + void __iomem *crp_base; + + int irq; +- int irq_base; + + bool link_up; + bool bar0_is_cached; + u32 bar0_value; + ++ struct device_node *np; + struct pci_controller pci_controller; ++ struct irq_domain *domain; + struct resource io_res; + struct resource mem_res; + }; + ++static struct irq_chip ar724x_pci_irq_chip; ++ + static inline bool ar724x_pci_check_link(struct ar724x_pci_controller *apc) + { + u32 reset; +@@ -228,35 +234,31 @@ static struct pci_ops ar724x_pci_ops = { + + static void ar724x_pci_irq_handler(struct irq_desc *desc) + { +- struct ar724x_pci_controller *apc; +- void __iomem *base; ++ struct irq_chip *chip = irq_desc_get_chip(desc); ++ struct ar724x_pci_controller *apc = irq_desc_get_handler_data(desc); + u32 pending; + +- apc = irq_desc_get_handler_data(desc); +- base = apc->ctrl_base; +- +- pending = __raw_readl(base + AR724X_PCI_REG_INT_STATUS) & +- __raw_readl(base + AR724X_PCI_REG_INT_MASK); ++ chained_irq_enter(chip, desc); ++ pending = __raw_readl(apc->ctrl_base + AR724X_PCI_REG_INT_STATUS) & ++ __raw_readl(apc->ctrl_base + AR724X_PCI_REG_INT_MASK); + + if (pending & AR724X_PCI_INT_DEV0) +- generic_handle_irq(apc->irq_base + 0); +- ++ generic_handle_irq(irq_linear_revmap(apc->domain, 1)); + else + spurious_interrupt(); ++ chained_irq_exit(chip, desc); + } + + static void ar724x_pci_irq_unmask(struct irq_data *d) + { + struct ar724x_pci_controller *apc; + void __iomem *base; +- int offset; + u32 t; + + apc = irq_data_get_irq_chip_data(d); + base = apc->ctrl_base; +- offset = apc->irq_base - d->irq; + +- switch (offset) { ++ switch (irq_linear_revmap(apc->domain, d->irq)) { + case 0: + t = __raw_readl(base + AR724X_PCI_REG_INT_MASK); + __raw_writel(t | AR724X_PCI_INT_DEV0, +@@ -270,14 +272,12 @@ static void ar724x_pci_irq_mask(struct i + { + struct ar724x_pci_controller *apc; + void __iomem *base; +- int offset; + u32 t; + + apc = irq_data_get_irq_chip_data(d); + base = apc->ctrl_base; +- offset = apc->irq_base - d->irq; + +- switch (offset) { ++ switch (irq_linear_revmap(apc->domain, d->irq)) { + case 0: + t = __raw_readl(base + AR724X_PCI_REG_INT_MASK); + __raw_writel(t & ~AR724X_PCI_INT_DEV0, +@@ -302,26 +302,34 @@ static struct irq_chip ar724x_pci_irq_ch + .irq_mask_ack = ar724x_pci_irq_mask, + }; + ++static int ar724x_pci_irq_map(struct irq_domain *d, ++ unsigned int irq, irq_hw_number_t hw) ++{ ++ struct ar724x_pci_controller *apc = d->host_data; ++ ++ irq_set_chip_and_handler(irq, &ar724x_pci_irq_chip, handle_level_irq); ++ irq_set_chip_data(irq, apc); ++ ++ return 0; ++} ++ ++static const struct irq_domain_ops ar724x_pci_domain_ops = { ++ .xlate = irq_domain_xlate_onecell, ++ .map = ar724x_pci_irq_map, ++}; ++ + static void ar724x_pci_irq_init(struct ar724x_pci_controller *apc, + int id) + { + void __iomem *base; +- int i; + + base = apc->ctrl_base; + + __raw_writel(0, base + AR724X_PCI_REG_INT_MASK); + __raw_writel(0, base + AR724X_PCI_REG_INT_STATUS); + +- apc->irq_base = ATH79_PCI_IRQ_BASE + (id * AR724X_PCI_IRQ_COUNT); +- +- for (i = apc->irq_base; +- i < apc->irq_base + AR724X_PCI_IRQ_COUNT; i++) { +- irq_set_chip_and_handler(i, &ar724x_pci_irq_chip, +- handle_level_irq); +- irq_set_chip_data(i, apc); +- } +- ++ apc->domain = irq_domain_add_linear(apc->np, 2, ++ &ar724x_pci_domain_ops, apc); + irq_set_chained_handler_and_data(apc->irq, ar724x_pci_irq_handler, + apc); + } +@@ -360,7 +368,6 @@ static void ar724x_pci_hw_init(struct ar + static int ar724x_pci_probe(struct platform_device *pdev) + { + struct ar724x_pci_controller *apc; +- struct resource *res; + int id; + + id = pdev->id; +@@ -388,29 +395,11 @@ static int ar724x_pci_probe(struct platf + if (apc->irq < 0) + return -EINVAL; + +- res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base"); +- if (!res) +- return -EINVAL; +- +- apc->io_res.parent = res; +- apc->io_res.name = "PCI IO space"; +- apc->io_res.start = res->start; +- apc->io_res.end = res->end; +- apc->io_res.flags = IORESOURCE_IO; +- +- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem_base"); +- if (!res) +- return -EINVAL; +- +- apc->mem_res.parent = res; +- apc->mem_res.name = "PCI memory space"; +- apc->mem_res.start = res->start; +- apc->mem_res.end = res->end; +- apc->mem_res.flags = IORESOURCE_MEM; +- ++ apc->np = pdev->dev.of_node; + apc->pci_controller.pci_ops = &ar724x_pci_ops; + apc->pci_controller.io_resource = &apc->io_res; + apc->pci_controller.mem_resource = &apc->mem_res; ++ pci_load_of_ranges(&apc->pci_controller, pdev->dev.of_node); + + /* + * Do the full PCIE Root Complex Initialization Sequence if the PCIe +@@ -432,10 +421,16 @@ static int ar724x_pci_probe(struct platf + return 0; + } + ++static const struct of_device_id ar724x_pci_ids[] = { ++ { .compatible = "qcom,ar7240-pci" }, ++ {}, ++}; ++ + static struct platform_driver ar724x_pci_driver = { + .probe = ar724x_pci_probe, + .driver = { + .name = "ar724x-pci", ++ .of_match_table = of_match_ptr(ar724x_pci_ids), + }, + }; + diff --git a/target/linux/ath79/patches-6.1/314-MIPS-ath79-remove-irq-code-from-pci.patch b/target/linux/ath79/patches-6.1/314-MIPS-ath79-remove-irq-code-from-pci.patch new file mode 100644 index 00000000000..01549eec68d --- /dev/null +++ b/target/linux/ath79/patches-6.1/314-MIPS-ath79-remove-irq-code-from-pci.patch @@ -0,0 +1,149 @@ +From: John Crispin +Subject: ath79: fix remove irq code from pci driver patch + +This patch got mangled in the void while rebasing it. + +Submitted-by: John Crispin +--- + arch/mips/pci/pci-ar71xx.c | 107 ------------------ + 1 file changed, 141 deletions(-) + +--- a/arch/mips/pci/pci-ar71xx.c ++++ b/arch/mips/pci/pci-ar71xx.c +@@ -51,11 +51,9 @@ + struct ar71xx_pci_controller { + struct device_node *np; + void __iomem *cfg_base; +- int irq; + struct pci_controller pci_ctrl; + struct resource io_res; + struct resource mem_res; +- struct irq_domain *domain; + }; + + /* Byte lane enable bits */ +@@ -227,104 +225,6 @@ static struct pci_ops ar71xx_pci_ops = { + .write = ar71xx_pci_write_config, + }; + +-static void ar71xx_pci_irq_handler(struct irq_desc *desc) +-{ +- void __iomem *base = ath79_reset_base; +- struct irq_chip *chip = irq_desc_get_chip(desc); +- struct ar71xx_pci_controller *apc = irq_desc_get_handler_data(desc); +- u32 pending; +- +- chained_irq_enter(chip, desc); +- pending = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_STATUS) & +- __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); +- +- if (pending & AR71XX_PCI_INT_DEV0) +- generic_handle_irq(irq_linear_revmap(apc->domain, 1)); +- +- else if (pending & AR71XX_PCI_INT_DEV1) +- generic_handle_irq(irq_linear_revmap(apc->domain, 2)); +- +- else if (pending & AR71XX_PCI_INT_DEV2) +- generic_handle_irq(irq_linear_revmap(apc->domain, 3)); +- +- else if (pending & AR71XX_PCI_INT_CORE) +- generic_handle_irq(irq_linear_revmap(apc->domain, 4)); +- +- else +- spurious_interrupt(); +- chained_irq_exit(chip, desc); +-} +- +-static void ar71xx_pci_irq_unmask(struct irq_data *d) +-{ +- struct ar71xx_pci_controller *apc; +- unsigned int irq; +- void __iomem *base = ath79_reset_base; +- u32 t; +- +- apc = irq_data_get_irq_chip_data(d); +- irq = irq_linear_revmap(apc->domain, d->irq); +- +- t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); +- __raw_writel(t | (1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); +- +- /* flush write */ +- __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); +-} +- +-static void ar71xx_pci_irq_mask(struct irq_data *d) +-{ +- struct ar71xx_pci_controller *apc; +- unsigned int irq; +- void __iomem *base = ath79_reset_base; +- u32 t; +- +- apc = irq_data_get_irq_chip_data(d); +- irq = irq_linear_revmap(apc->domain, d->irq); +- +- t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); +- __raw_writel(t & ~(1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); +- +- /* flush write */ +- __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); +-} +- +-static struct irq_chip ar71xx_pci_irq_chip = { +- .name = "AR71XX PCI", +- .irq_mask = ar71xx_pci_irq_mask, +- .irq_unmask = ar71xx_pci_irq_unmask, +- .irq_mask_ack = ar71xx_pci_irq_mask, +-}; +- +-static int ar71xx_pci_irq_map(struct irq_domain *d, +- unsigned int irq, irq_hw_number_t hw) +-{ +- struct ar71xx_pci_controller *apc = d->host_data; +- +- irq_set_chip_and_handler(irq, &ar71xx_pci_irq_chip, handle_level_irq); +- irq_set_chip_data(irq, apc); +- +- return 0; +-} +- +-static const struct irq_domain_ops ar71xx_pci_domain_ops = { +- .xlate = irq_domain_xlate_onecell, +- .map = ar71xx_pci_irq_map, +-}; +- +-static void ar71xx_pci_irq_init(struct ar71xx_pci_controller *apc) +-{ +- void __iomem *base = ath79_reset_base; +- +- __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_ENABLE); +- __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_STATUS); +- +- apc->domain = irq_domain_add_linear(apc->np, AR71XX_PCI_IRQ_COUNT, +- &ar71xx_pci_domain_ops, apc); +- irq_set_chained_handler_and_data(apc->irq, ar71xx_pci_irq_handler, +- apc); +-} +- + static void ar71xx_pci_reset(void) + { + ath79_device_reset_set(AR71XX_RESET_PCI_BUS | AR71XX_RESET_PCI_CORE); +@@ -357,10 +257,6 @@ static int ar71xx_pci_probe(struct platf + if (IS_ERR(apc->cfg_base)) + return PTR_ERR(apc->cfg_base); + +- apc->irq = platform_get_irq(pdev, 0); +- if (apc->irq < 0) +- return -EINVAL; +- + ar71xx_pci_reset(); + + /* setup COMMAND register */ +@@ -371,8 +267,6 @@ static int ar71xx_pci_probe(struct platf + /* clear bus errors */ + ar71xx_pci_check_error(apc, 1); + +- ar71xx_pci_irq_init(apc); +- + apc->np = pdev->dev.of_node; + apc->pci_ctrl.pci_ops = &ar71xx_pci_ops; + apc->pci_ctrl.mem_resource = &apc->mem_res; diff --git a/target/linux/ath79/patches-6.1/315-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch b/target/linux/ath79/patches-6.1/315-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch new file mode 100644 index 00000000000..375dec8ba2b --- /dev/null +++ b/target/linux/ath79/patches-6.1/315-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch @@ -0,0 +1,130 @@ +From: David Bauer +Date: Sat, 11 Apr 2020 14:03:12 +0200 +Subject: MIPS: pci-ar724x: add QCA9550 reset sequence + +The QCA9550 family of SoCs have a slightly different reset +sequence compared to older chips. + +Normally the bootloader performs this sequence, however +some bootloader implementation expect the operating system +to clear the reset. + +Also get the resets from OF to support handling of the second +PCIe root-complex on the QCA9558. + +Signed-off-by: David Bauer + +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h ++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +@@ -390,6 +390,7 @@ + #define QCA955X_PLL_CPU_CONFIG_REG 0x00 + #define QCA955X_PLL_DDR_CONFIG_REG 0x04 + #define QCA955X_PLL_CLK_CTRL_REG 0x08 ++#define QCA955X_PLL_PCIE_CONFIG_REG 0x0c + #define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28 + #define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48 + #define QCA955X_PLL_ETH_SGMII_SERDES_REG 0x4c +@@ -475,6 +476,9 @@ + #define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL BIT(21) + #define QCA956X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) + ++#define QCA955X_PLL_PCIE_CONFIG_PLL_PWD BIT(30) ++#define QCA955X_PLL_PCIE_CONFIG_PLL_BYPASS BIT(16) ++ + #define QCA956X_PLL_SWITCH_CLOCK_SPARE_I2C_CLK_SELB BIT(5) + #define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1 BIT(6) + #define QCA956X_PLL_SWITCH_CLOCK_SPARE_UART1_CLK_SEL BIT(7) +--- a/arch/mips/pci/pci-ar724x.c ++++ b/arch/mips/pci/pci-ar724x.c +@@ -8,6 +8,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -55,6 +56,9 @@ struct ar724x_pci_controller { + struct irq_domain *domain; + struct resource io_res; + struct resource mem_res; ++ ++ struct reset_control *hc_reset; ++ struct reset_control *phy_reset; + }; + + static struct irq_chip ar724x_pci_irq_chip; +@@ -340,18 +344,30 @@ static void ar724x_pci_hw_init(struct ar + int wait = 0; + + /* deassert PCIe host controller and PCIe PHY reset */ +- ath79_device_reset_clear(AR724X_RESET_PCIE); +- ath79_device_reset_clear(AR724X_RESET_PCIE_PHY); ++ reset_control_deassert(apc->hc_reset); ++ reset_control_deassert(apc->phy_reset); + +- /* remove the reset of the PCIE PLL */ +- ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG); +- ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_RESET; +- ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl); +- +- /* deassert bypass for the PCIE PLL */ +- ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG); +- ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_BYPASS; +- ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl); ++ if (of_device_is_compatible(apc->np, "qcom,qca9550-pci")) { ++ /* remove the reset of the PCIE PLL */ ++ ppl = ath79_pll_rr(QCA955X_PLL_PCIE_CONFIG_REG); ++ ppl &= ~QCA955X_PLL_PCIE_CONFIG_PLL_PWD; ++ ath79_pll_wr(QCA955X_PLL_PCIE_CONFIG_REG, ppl); ++ ++ /* deassert bypass for the PCIE PLL */ ++ ppl = ath79_pll_rr(QCA955X_PLL_PCIE_CONFIG_REG); ++ ppl &= ~QCA955X_PLL_PCIE_CONFIG_PLL_BYPASS; ++ ath79_pll_wr(QCA955X_PLL_PCIE_CONFIG_REG, ppl); ++ } else { ++ /* remove the reset of the PCIE PLL */ ++ ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG); ++ ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_RESET; ++ ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl); ++ ++ /* deassert bypass for the PCIE PLL */ ++ ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG); ++ ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_BYPASS; ++ ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl); ++ } + + /* set PCIE Application Control to ready */ + app = __raw_readl(apc->ctrl_base + AR724X_PCI_REG_APP); +@@ -395,6 +411,14 @@ static int ar724x_pci_probe(struct platf + if (apc->irq < 0) + return -EINVAL; + ++ apc->hc_reset = devm_reset_control_get_exclusive(&pdev->dev, "hc"); ++ if (IS_ERR(apc->hc_reset)) ++ return PTR_ERR(apc->hc_reset); ++ ++ apc->phy_reset = devm_reset_control_get_exclusive(&pdev->dev, "phy"); ++ if (IS_ERR(apc->phy_reset)) ++ return PTR_ERR(apc->phy_reset); ++ + apc->np = pdev->dev.of_node; + apc->pci_controller.pci_ops = &ar724x_pci_ops; + apc->pci_controller.io_resource = &apc->io_res; +@@ -405,7 +429,7 @@ static int ar724x_pci_probe(struct platf + * Do the full PCIE Root Complex Initialization Sequence if the PCIe + * host controller is in reset. + */ +- if (ath79_reset_rr(AR724X_RESET_REG_RESET_MODULE) & AR724X_RESET_PCIE) ++ if (reset_control_status(apc->hc_reset)) + ar724x_pci_hw_init(apc); + + apc->link_up = ar724x_pci_check_link(apc); +@@ -423,6 +447,7 @@ static int ar724x_pci_probe(struct platf + + static const struct of_device_id ar724x_pci_ids[] = { + { .compatible = "qcom,ar7240-pci" }, ++ { .compatible = "qcom,qca9550-pci" }, + {}, + }; + diff --git a/target/linux/ath79/patches-6.1/316-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch b/target/linux/ath79/patches-6.1/316-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch new file mode 100644 index 00000000000..1e2715b84c3 --- /dev/null +++ b/target/linux/ath79/patches-6.1/316-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch @@ -0,0 +1,109 @@ +From: Gabor Juhos +Subject: [PATCH] ar71xx: swizzle address for PCI byte/word access on AR71xx + +Closes #11683. + +SVN-Revision: 32639 +--- + .../mips/include/asm/mach-ath79/mangle-port.h | 111 ++++++++++++++++++ + 1 file changed, 111 insertions(+) + create mode 100644 arch/mips/include/asm/mach-ath79/mangle-port.h + +--- /dev/null ++++ b/arch/mips/include/asm/mach-ath79/mangle-port.h +@@ -0,0 +1,37 @@ ++/* ++ * Copyright (C) 2012 Gabor Juhos ++ * ++ * This file was derived from: inlude/asm-mips/mach-generic/mangle-port.h ++ * Copyright (C) 2003, 2004 Ralf Baechle ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#ifndef __ASM_MACH_ATH79_MANGLE_PORT_H ++#define __ASM_MACH_ATH79_MANGLE_PORT_H ++ ++#ifdef CONFIG_PCI_AR71XX ++extern unsigned long (ath79_pci_swizzle_b)(unsigned long port); ++extern unsigned long (ath79_pci_swizzle_w)(unsigned long port); ++#else ++#define ath79_pci_swizzle_b(port) (port) ++#define ath79_pci_swizzle_w(port) (port) ++#endif ++ ++#define __swizzle_addr_b(port) ath79_pci_swizzle_b(port) ++#define __swizzle_addr_w(port) ath79_pci_swizzle_w(port) ++#define __swizzle_addr_l(port) (port) ++#define __swizzle_addr_q(port) (port) ++ ++# define ioswabb(a, x) (x) ++# define __mem_ioswabb(a, x) (x) ++# define ioswabw(a, x) (x) ++# define __mem_ioswabw(a, x) cpu_to_le16(x) ++# define ioswabl(a, x) (x) ++# define __mem_ioswabl(a, x) cpu_to_le32(x) ++# define ioswabq(a, x) (x) ++# define __mem_ioswabq(a, x) cpu_to_le64(x) ++ ++#endif /* __ASM_MACH_ATH79_MANGLE_PORT_H */ +--- a/arch/mips/pci/pci-ar71xx.c ++++ b/arch/mips/pci/pci-ar71xx.c +@@ -68,6 +68,45 @@ static const u32 ar71xx_pci_read_mask[8] + 0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0 + }; + ++static unsigned long (*__ath79_pci_swizzle_b)(unsigned long port); ++static unsigned long (*__ath79_pci_swizzle_w)(unsigned long port); ++ ++static inline bool ar71xx_is_pci_addr(unsigned long port) ++{ ++ unsigned long phys = CPHYSADDR(port); ++ ++ return (phys >= AR71XX_PCI_MEM_BASE && ++ phys < AR71XX_PCI_MEM_BASE + AR71XX_PCI_MEM_SIZE); ++} ++ ++static unsigned long ar71xx_pci_swizzle_b(unsigned long port) ++{ ++ return ar71xx_is_pci_addr(port) ? port ^ 3 : port; ++} ++ ++static unsigned long ar71xx_pci_swizzle_w(unsigned long port) ++{ ++ return ar71xx_is_pci_addr(port) ? port ^ 2 : port; ++} ++ ++unsigned long ath79_pci_swizzle_b(unsigned long port) ++{ ++ if (__ath79_pci_swizzle_b) ++ return __ath79_pci_swizzle_b(port); ++ ++ return port; ++} ++EXPORT_SYMBOL(ath79_pci_swizzle_b); ++ ++unsigned long ath79_pci_swizzle_w(unsigned long port) ++{ ++ if (__ath79_pci_swizzle_w) ++ return __ath79_pci_swizzle_w(port); ++ ++ return port; ++} ++EXPORT_SYMBOL(ath79_pci_swizzle_w); ++ + static inline u32 ar71xx_pci_get_ble(int where, int size, int local) + { + u32 t; +@@ -275,6 +314,9 @@ static int ar71xx_pci_probe(struct platf + + register_pci_controller(&apc->pci_ctrl); + ++ __ath79_pci_swizzle_b = ar71xx_pci_swizzle_b; ++ __ath79_pci_swizzle_w = ar71xx_pci_swizzle_w; ++ + return 0; + } + diff --git a/target/linux/ath79/patches-6.1/330-missing-registers.patch b/target/linux/ath79/patches-6.1/330-missing-registers.patch new file mode 100644 index 00000000000..74789437ec9 --- /dev/null +++ b/target/linux/ath79/patches-6.1/330-missing-registers.patch @@ -0,0 +1,20 @@ +From: Christian Lamparter +Subject: [PATCH] ath79: gmac: add parsers for rxd(v)- and tx(d|en)-delay for + + ath79: gmac: add parsers for rxd(v)- and tx(d|en)-delay for AR9344 + + Signed-off-by: Christian Lamparter + +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h ++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +@@ -1231,6 +1231,10 @@ + #define AR934X_ETH_CFG_RDV_DELAY BIT(16) + #define AR934X_ETH_CFG_RDV_DELAY_MASK 0x3 + #define AR934X_ETH_CFG_RDV_DELAY_SHIFT 16 ++#define AR934X_ETH_CFG_TXD_DELAY_MASK 0x3 ++#define AR934X_ETH_CFG_TXD_DELAY_SHIFT 18 ++#define AR934X_ETH_CFG_TXE_DELAY_MASK 0x3 ++#define AR934X_ETH_CFG_TXE_DELAY_SHIFT 20 + + /* + * QCA953X GMAC Interface diff --git a/target/linux/ath79/patches-6.1/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch b/target/linux/ath79/patches-6.1/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch new file mode 100644 index 00000000000..c2f228dfe1e --- /dev/null +++ b/target/linux/ath79/patches-6.1/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch @@ -0,0 +1,90 @@ +From 60efe35257b063ce584968f9f80b437030ce6ba6 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Mon, 18 Mar 2019 00:54:06 +0100 +Subject: [PATCH] MIPS: ath79: add missing QCA955x GMAC registers + +This adds missing GMAC register definitions for the Qualcomm Atheros +QCA955X series MIPS SoCs. + +They originate from the platforms U-Boot code and the AVM FRITZ!WLAN +Repeater 450E's GPL tarball. + +Signed-off-by: David Bauer +--- + .../mips/include/asm/mach-ath79/ar71xx_regs.h | 54 +++++++++++++++++++ + 1 file changed, 54 insertions(+) + +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h ++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +@@ -1251,7 +1251,12 @@ + */ + + #define QCA955X_GMAC_REG_ETH_CFG 0x00 ++#define QCA955X_GMAC_REG_SGMII_RESET 0x14 + #define QCA955X_GMAC_REG_SGMII_SERDES 0x18 ++#define QCA955X_GMAC_REG_MR_AN_CONTROL 0x1c ++#define QCA955X_GMAC_REG_MR_AN_STATUS 0x20 ++#define QCA955X_GMAC_REG_SGMII_CONFIG 0x34 ++#define QCA955X_GMAC_REG_SGMII_DEBUG 0x58 + + #define QCA955X_ETH_CFG_RGMII_EN BIT(0) + #define QCA955X_ETH_CFG_MII_GE0 BIT(1) +@@ -1273,9 +1278,58 @@ + #define QCA955X_ETH_CFG_TXE_DELAY_MASK 0x3 + #define QCA955X_ETH_CFG_TXE_DELAY_SHIFT 20 + ++#define QCA955X_SGMII_RESET_RX_CLK_N_RESET 0 ++#define QCA955X_SGMII_RESET_RX_CLK_N BIT(0) ++#define QCA955X_SGMII_RESET_TX_CLK_N BIT(1) ++#define QCA955X_SGMII_RESET_RX_125M_N BIT(2) ++#define QCA955X_SGMII_RESET_TX_125M_N BIT(3) ++#define QCA955X_SGMII_RESET_HW_RX_125M_N BIT(4) ++ + #define QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15) + #define QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23 + #define QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf ++ ++#define QCA955X_MR_AN_CONTROL_SPEED_SEL1 BIT(6) ++#define QCA955X_MR_AN_CONTROL_DUPLEX_MODE BIT(8) ++#define QCA955X_MR_AN_CONTROL_RESTART_AN BIT(9) ++#define QCA955X_MR_AN_CONTROL_POWER_DOWN BIT(11) ++#define QCA955X_MR_AN_CONTROL_AN_ENABLE BIT(12) ++#define QCA955X_MR_AN_CONTROL_SPEED_SEL0 BIT(13) ++#define QCA955X_MR_AN_CONTROL_LOOPBACK BIT(14) ++#define QCA955X_MR_AN_CONTROL_PHY_RESET BIT(15) ++ ++#define QCA955X_MR_AN_STATUS_EXT_CAP BIT(0) ++#define QCA955X_MR_AN_STATUS_LINK_UP BIT(2) ++#define QCA955X_MR_AN_STATUS_AN_ABILITY BIT(3) ++#define QCA955X_MR_AN_STATUS_REMOTE_FAULT BIT(4) ++#define QCA955X_MR_AN_STATUS_AN_COMPLETE BIT(5) ++#define QCA955X_MR_AN_STATUS_NO_PREAMBLE BIT(6) ++#define QCA955X_MR_AN_STATUS_BASE_PAGE BIT(7) ++ ++#define QCA955X_SGMII_CONFIG_MODE_CTRL_SHIFT 0 ++#define QCA955X_SGMII_CONFIG_MODE_CTRL_MASK 0x7 ++#define QCA955X_SGMII_CONFIG_ENABLE_SGMII_TX_PAUSE BIT(3) ++#define QCA955X_SGMII_CONFIG_MR_REG4_CHANGED BIT(4) ++#define QCA955X_SGMII_CONFIG_FORCE_SPEED BIT(5) ++#define QCA955X_SGMII_CONFIG_SPEED_SHIFT 6 ++#define QCA955X_SGMII_CONFIG_SPEED_MASK 0xc0 ++#define QCA955X_SGMII_CONFIG_REMOTE_PHY_LOOPBACK BIT(8) ++#define QCA955X_SGMII_CONFIG_NEXT_PAGE_LOADED BIT(9) ++#define QCA955X_SGMII_CONFIG_MDIO_ENABLE BIT(10) ++#define QCA955X_SGMII_CONFIG_MDIO_PULSE BIT(11) ++#define QCA955X_SGMII_CONFIG_MDIO_COMPLETE BIT(12) ++#define QCA955X_SGMII_CONFIG_PRBS_ENABLE BIT(13) ++#define QCA955X_SGMII_CONFIG_BERT_ENABLE BIT(14) ++ ++#define QCA955X_SGMII_DEBUG_TX_STATE_MASK 0xff ++#define QCA955X_SGMII_DEBUG_TX_STATE_SHIFT 0 ++#define QCA955X_SGMII_DEBUG_RX_STATE_MASK 0xff00 ++#define QCA955X_SGMII_DEBUG_RX_STATE_SHIFT 8 ++#define QCA955X_SGMII_DEBUG_RX_SYNC_STATE_MASK 0xff0000 ++#define QCA955X_SGMII_DEBUG_RX_SYNC_STATE_SHIFT 16 ++#define QCA955X_SGMII_DEBUG_ARB_STATE_MASK 0xf000000 ++#define QCA955X_SGMII_DEBUG_ARB_STATE_SHIFT 24 ++ + /* + * QCA956X GMAC Interface + */ diff --git a/target/linux/ath79/patches-6.1/332-ath79-sgmii-config.patch b/target/linux/ath79/patches-6.1/332-ath79-sgmii-config.patch new file mode 100644 index 00000000000..a6a50e4a8ab --- /dev/null +++ b/target/linux/ath79/patches-6.1/332-ath79-sgmii-config.patch @@ -0,0 +1,30 @@ +From: David Bauer +Subject: [PATCH] ath79: force SGMII SerDes mode to MAC operation + +The mode on the SGMII SerDes on the QCA9563 is 1000 Base-X by default. +This only allows for 1000 Mbit/s links, however when used with an SGMII +PHY in 100 Mbit/s link mode, the link remains dead. + +This strictly has nothing to do with the SerDes calibration, however it +is done at the same point in the QCA reference U-Boot which is the +blueprint for everything happening here. As the current state is more or +less a hack, this should be fine. + +This fixes the issues outlined above on a TP-Link EAP-225 Outdoor. + +Reported-by: Tom Herbers +Tested-by: Tom Herbers +Submitted-by: David Bauer +--- + arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 1 + + 1 files changed, 1 insertion(+) + +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h ++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +@@ -1380,5 +1380,6 @@ + + #define QCA956X_SGMII_CONFIG_MODE_CTRL_SHIFT 0 + #define QCA956X_SGMII_CONFIG_MODE_CTRL_MASK 0x7 ++#define QCA956X_SGMII_CONFIG_MODE_CTRL_SGMII_MAC 0x2 + + #endif /* __ASM_MACH_AR71XX_REGS_H */ diff --git a/target/linux/ath79/patches-6.1/340-register_gpio_driver_earlier.patch b/target/linux/ath79/patches-6.1/340-register_gpio_driver_earlier.patch new file mode 100644 index 00000000000..a8680ceac4f --- /dev/null +++ b/target/linux/ath79/patches-6.1/340-register_gpio_driver_earlier.patch @@ -0,0 +1,26 @@ +From: John Crispin +Subject: ath79: Register GPIO driver earlier + +HACK: register the GPIO driver earlier to ensure that gpio_request calls +from mach files succeed. + +Submitted-by: John Crispin +--- + drivers/gpio/gpio-ath79.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/gpio/gpio-ath79.c ++++ b/drivers/gpio/gpio-ath79.c +@@ -297,7 +297,11 @@ static struct platform_driver ath79_gpio + .probe = ath79_gpio_probe, + }; + +-module_platform_driver(ath79_gpio_driver); ++static int __init ath79_gpio_init(void) ++{ ++ return platform_driver_register(&ath79_gpio_driver); ++} ++postcore_initcall(ath79_gpio_init); + + MODULE_DESCRIPTION("Atheros AR71XX/AR724X/AR913X GPIO API support"); + MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ath79/patches-6.1/350-MIPS-ath79-ath9k-exports.patch b/target/linux/ath79/patches-6.1/350-MIPS-ath79-ath9k-exports.patch new file mode 100644 index 00000000000..e460fe58f3f --- /dev/null +++ b/target/linux/ath79/patches-6.1/350-MIPS-ath79-ath9k-exports.patch @@ -0,0 +1,36 @@ +From: John Crispin +Subject: [PATCH] ath79: make ahb wifi work + +Submitted-by: John Crispin +--- + arch/mips/ath79/common.c | 3 +++ + mips/include/asm/mach-ath79/ath79.h | 1+ + 1 file changed, 4 insertions(+) + +--- a/arch/mips/ath79/common.c ++++ b/arch/mips/ath79/common.c +@@ -31,11 +31,13 @@ EXPORT_SYMBOL_GPL(ath79_ddr_freq); + + enum ath79_soc_type ath79_soc; + unsigned int ath79_soc_rev; ++EXPORT_SYMBOL_GPL(ath79_soc_rev); + + void __iomem *ath79_pll_base; + void __iomem *ath79_reset_base; + EXPORT_SYMBOL_GPL(ath79_reset_base); +-static void __iomem *ath79_ddr_base; ++void __iomem *ath79_ddr_base; ++EXPORT_SYMBOL_GPL(ath79_ddr_base); + static void __iomem *ath79_ddr_wb_flush_base; + static void __iomem *ath79_ddr_pci_win_base; + +--- a/arch/mips/include/asm/mach-ath79/ath79.h ++++ b/arch/mips/include/asm/mach-ath79/ath79.h +@@ -149,6 +149,7 @@ void ath79_ddr_wb_flush(unsigned int reg + void ath79_ddr_set_pci_windows(void); + + extern void __iomem *ath79_pll_base; ++extern void __iomem *ath79_ddr_base; + extern void __iomem *ath79_reset_base; + + static inline void ath79_pll_wr(unsigned reg, u32 val) diff --git a/target/linux/ath79/patches-6.1/351-MIPS-ath79-common-exports.patch b/target/linux/ath79/patches-6.1/351-MIPS-ath79-common-exports.patch new file mode 100644 index 00000000000..befcf2d50f1 --- /dev/null +++ b/target/linux/ath79/patches-6.1/351-MIPS-ath79-common-exports.patch @@ -0,0 +1,26 @@ +From: Luiz Angelo Daros de Luca +Subject: [PATCH] ath79: export ath79_pll_base + +This symbol is declared as extern but nobody exported it. +Any module including arch/mips/include/asm/mach-ath79/ath79.h +will not build. Without this export, ag71xx.ko will not build +as a module and the build will fail like this: + +ERROR: modpost: "ath79_pll_base" [drivers/net/ethernet/atheros/ag71xx/ag71xx.ko] undefined! + +The ath79_pll_base symbol is accessed in the ath79_pll_wr() inline function. + +--- + arch/mips/ath79/common.c | 1 + + 1 file changed, 1 insertions(+) + +--- a/arch/mips/ath79/common.c ++++ b/arch/mips/ath79/common.c +@@ -34,6 +34,7 @@ unsigned int ath79_soc_rev; + EXPORT_SYMBOL_GPL(ath79_soc_rev); + + void __iomem *ath79_pll_base; ++EXPORT_SYMBOL_GPL(ath79_pll_base); + void __iomem *ath79_reset_base; + EXPORT_SYMBOL_GPL(ath79_reset_base); + void __iomem *ath79_ddr_base; diff --git a/target/linux/ath79/patches-6.1/360-MIPS-ath79-export-UART1-reference-clock.patch b/target/linux/ath79/patches-6.1/360-MIPS-ath79-export-UART1-reference-clock.patch new file mode 100644 index 00000000000..b24ff216928 --- /dev/null +++ b/target/linux/ath79/patches-6.1/360-MIPS-ath79-export-UART1-reference-clock.patch @@ -0,0 +1,67 @@ +From: Daniel Golle +Subject: [PATCH] ath79: add support for Atheros AR934x HS UART + +AR934x chips also got the 'old' qca,ar9330-uart in addition to the +'new' ns16550a compatible one. Add support for UART1 clock selector as +well as device-tree bindings in ar934x.dtsi to make use of that uart. + +Reported-by: Piotr Dymacz +Submitted-by: Daniel Golle +--- + arch/mips/ath79/clock.c | 7 +++++++ + .../mips/include/asm/mach-ath79/ar71xx_regs.h | 1 + + include/dt-bindings/clock/ath79-clk.h | 3 ++- + 3 files changed, 10 insertions(+), 1 deletion(-) + +--- a/arch/mips/ath79/clock.c ++++ b/arch/mips/ath79/clock.c +@@ -40,6 +40,7 @@ static const char * const clk_names[ATH7 + [ATH79_CLK_AHB] = "ahb", + [ATH79_CLK_REF] = "ref", + [ATH79_CLK_MDIO] = "mdio", ++ [ATH79_CLK_UART1] = "uart1", + }; + + static const char * __init ath79_clk_name(int type) +@@ -344,6 +345,9 @@ static void __init ar934x_clocks_init(vo + if (clk_ctrl & AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL) + ath79_set_clk(ATH79_CLK_MDIO, 100 * 1000 * 1000); + ++ if (clk_ctrl & AR934X_PLL_SWITCH_CLOCK_CONTROL_UART1_CLK_SEL) ++ ath79_set_clk(ATH79_CLK_UART1, 100 * 1000 * 1000); ++ + iounmap(dpll_base); + } + +@@ -649,6 +653,9 @@ static void __init ath79_clocks_init_dt( + if (!clks[ATH79_CLK_MDIO]) + clks[ATH79_CLK_MDIO] = clks[ATH79_CLK_REF]; + ++ if (!clks[ATH79_CLK_UART1]) ++ clks[ATH79_CLK_UART1] = clks[ATH79_CLK_REF]; ++ + if (of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data)) { + pr_err("%pOF: could not register clk provider\n", np); + goto err_iounmap; +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h ++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +@@ -348,6 +348,7 @@ + #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) + + #define AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL BIT(6) ++#define AR934X_PLL_SWITCH_CLOCK_CONTROL_UART1_CLK_SEL BIT(7) + + #define QCA953X_PLL_CPU_CONFIG_REG 0x00 + #define QCA953X_PLL_DDR_CONFIG_REG 0x04 +--- a/include/dt-bindings/clock/ath79-clk.h ++++ b/include/dt-bindings/clock/ath79-clk.h +@@ -11,7 +11,8 @@ + #define ATH79_CLK_AHB 2 + #define ATH79_CLK_REF 3 + #define ATH79_CLK_MDIO 4 ++#define ATH79_CLK_UART1 5 + +-#define ATH79_CLK_END 5 ++#define ATH79_CLK_END 6 + + #endif /* __DT_BINDINGS_ATH79_CLK_H */ diff --git a/target/linux/ath79/patches-6.1/370-MIPS-ath79-sanitize-symbols.patch b/target/linux/ath79/patches-6.1/370-MIPS-ath79-sanitize-symbols.patch new file mode 100644 index 00000000000..5eb23ba6c65 --- /dev/null +++ b/target/linux/ath79/patches-6.1/370-MIPS-ath79-sanitize-symbols.patch @@ -0,0 +1,93 @@ +From 3fc8585cf76022dba7496627074d42af88c30718 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sat, 23 Jun 2018 15:16:55 +0200 +Subject: [PATCH 32/33] MIPS: ath79: sanitize symbols + +We no longer need to select which SoCs are supported as the whole arch +code is always built. So lets drop all the SoC symbols + +Signed-off-by: John Crispin +--- + arch/mips/Kconfig | 2 ++ + arch/mips/ath79/Kconfig | 44 +++++--------------------------------------- + arch/mips/pci/Makefile | 2 +- + 3 files changed, 8 insertions(+), 40 deletions(-) + +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -258,6 +258,8 @@ config ATH79 + select SYS_SUPPORTS_BIG_ENDIAN + select SYS_SUPPORTS_MIPS16 + select SYS_SUPPORTS_ZBOOT_UART_PROM ++ select HAVE_PCI ++ select USB_ARCH_HAS_EHCI + select USE_OF + select USB_EHCI_ROOT_HUB_TT if USB_EHCI_HCD_PLATFORM + help +--- a/arch/mips/ath79/Kconfig ++++ b/arch/mips/ath79/Kconfig +@@ -1,48 +1,14 @@ + # SPDX-License-Identifier: GPL-2.0 + if ATH79 + +-config SOC_AR71XX +- select HAVE_PCI +- def_bool n +- +-config SOC_AR724X +- select HAVE_PCI +- select PCI_AR724X if PCI +- def_bool n +- +-config SOC_AR913X +- def_bool n +- +-config SOC_AR933X +- def_bool n +- +-config SOC_AR934X +- select HAVE_PCI +- select PCI_AR724X if PCI +- def_bool n +- +-config SOC_QCA955X +- select HAVE_PCI +- select PCI_AR724X if PCI ++config PCI_AR71XX ++ bool "PCI support for AR7100 type SoCs" ++ depends on PCI + def_bool n + + config PCI_AR724X +- def_bool n +- +-config ATH79_DEV_GPIO_BUTTONS +- def_bool n +- +-config ATH79_DEV_LEDS_GPIO +- def_bool n +- +-config ATH79_DEV_SPI +- def_bool n +- +-config ATH79_DEV_USB +- def_bool n +- +-config ATH79_DEV_WMAC +- depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA955X) ++ bool "PCI support for AR724x type SoCs" ++ depends on PCI + def_bool n + + endif +--- a/arch/mips/pci/Makefile ++++ b/arch/mips/pci/Makefile +@@ -21,7 +21,7 @@ obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o + ops-bcm63xx.o + obj-$(CONFIG_MIPS_ALCHEMY) += pci-alchemy.o + obj-$(CONFIG_PCI_AR2315) += pci-ar2315.o +-obj-$(CONFIG_SOC_AR71XX) += pci-ar71xx.o ++obj-$(CONFIG_PCI_AR71XX) += pci-ar71xx.o + obj-$(CONFIG_PCI_AR724X) += pci-ar724x.o + obj-$(CONFIG_PCI_XTALK_BRIDGE) += pci-xtalk-bridge.o + # diff --git a/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch new file mode 100644 index 00000000000..163bafdb2e5 --- /dev/null +++ b/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch @@ -0,0 +1,54 @@ +From f32bc2aa01edcba2f2ed5db151cf183eac9ef919 Mon Sep 17 00:00:00 2001 +From: Abhimanyu Vishwakarma +Date: Sat, 25 Feb 2017 16:42:50 +0000 +Subject: mtd: nor: support mtd name from device tree + +Signed-off-by: Abhimanyu Vishwakarma +--- + drivers/mtd/spi-nor/spi-nor.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/mtd/spi-nor/core.c ++++ b/drivers/mtd/spi-nor/core.c +@@ -3107,6 +3107,7 @@ int spi_nor_scan(struct spi_nor *nor, co + struct device *dev = nor->dev; + struct mtd_info *mtd = &nor->mtd; + struct device_node *np = spi_nor_get_flash_node(nor); ++ const char __maybe_unused *of_mtd_name = NULL; + int ret; + int i; + +@@ -3161,7 +3162,12 @@ int spi_nor_scan(struct spi_nor *nor, co + if (ret) + return ret; + +- if (!mtd->name) ++#ifdef CONFIG_MTD_OF_PARTS ++ of_property_read_string(np, "linux,mtd-name", &of_mtd_name); ++#endif ++ if (of_mtd_name) ++ mtd->name = of_mtd_name; ++ else if (!mtd->name) + mtd->name = dev_name(dev); + mtd->priv = nor; + mtd->type = MTD_NORFLASH; +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -847,6 +847,17 @@ out_error: + */ + static void mtd_set_dev_defaults(struct mtd_info *mtd) + { ++#ifdef CONFIG_MTD_OF_PARTS ++ const char __maybe_unused *of_mtd_name = NULL; ++ struct device_node *np; ++ ++ np = mtd_get_of_node(mtd); ++ if (np && !mtd->name) { ++ of_property_read_string(np, "linux,mtd-name", &of_mtd_name); ++ if (of_mtd_name) ++ mtd->name = of_mtd_name; ++ } else ++#endif + if (mtd->dev.parent) { + if (!mtd->owner && mtd->dev.parent->driver) + mtd->owner = mtd->dev.parent->driver->owner; diff --git a/target/linux/ath79/patches-6.1/410-mtd-cybertan-trx-parser.patch b/target/linux/ath79/patches-6.1/410-mtd-cybertan-trx-parser.patch new file mode 100644 index 00000000000..4e8e536e294 --- /dev/null +++ b/target/linux/ath79/patches-6.1/410-mtd-cybertan-trx-parser.patch @@ -0,0 +1,45 @@ +From: Christian Lamparter +Subject: [PATCH] ath79: port cybertan_part from ar71xx + +This patch ports the cybertan_part code from ar71xx and converts the +driver to a DT-supported mtd parser. As a result, it will no longer +add the u-boot, nvram and art partitions, which were never part of +the special Cybertan header. + +Instead these partitions have to be specified in the DT, which has the +upside of making it possible to add properties (i.e.: read-only), labels +and references to these important partitions. + +Submitted-by: Christian Lamparter +--- + drivers/mtd/parsers/Makefile | 1 + + drivers/mtd/parsers/Kconfig | 8 ++++++++ + 2 files changed, 9 insertions(+) + +--- a/drivers/mtd/parsers/Makefile ++++ b/drivers/mtd/parsers/Makefile +@@ -8,6 +8,7 @@ obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o + ofpart-y += ofpart_core.o + ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o + ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o ++obj-$(CONFIG_MTD_PARSER_CYBERTAN) += parser_cybertan.o + obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o + obj-$(CONFIG_MTD_AFS_PARTS) += afs.o + obj-$(CONFIG_MTD_PARSER_TPLINK_SAFELOADER) += tplink_safeloader.o +--- a/drivers/mtd/parsers/Kconfig ++++ b/drivers/mtd/parsers/Kconfig +@@ -102,6 +102,14 @@ config MTD_OF_PARTS_LINKSYS_NS + two "firmware" partitions. Currently used firmware has to be detected + using CFE environment variable. + ++config MTD_PARSER_CYBERTAN ++ tristate "Parser for Cybertan format partitions" ++ depends on MTD && (ATH79 || COMPILE_TEST) ++ help ++ Cybertan has a proprietory header than encompasses a Broadcom trx ++ header. This driver will parse the header and take care of the ++ special offsets that result in the extra headers. ++ + config MTD_PARSER_IMAGETAG + tristate "Parser for BCM963XX Image Tag format partitions" + depends on BCM63XX || BMIPS_GENERIC || COMPILE_TEST diff --git a/target/linux/ath79/patches-6.1/420-drivers-link-spi-before-mtd.patch b/target/linux/ath79/patches-6.1/420-drivers-link-spi-before-mtd.patch new file mode 100644 index 00000000000..0cd96909eb9 --- /dev/null +++ b/target/linux/ath79/patches-6.1/420-drivers-link-spi-before-mtd.patch @@ -0,0 +1,20 @@ +From: Gabor Juhos +Subject: [PATCH] ar71xx: Link SPI before MTD + +SVN-Revision: 22863 +--- + drivers/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/Makefile ++++ b/drivers/Makefile +@@ -80,8 +80,8 @@ obj-y += scsi/ + obj-y += nvme/ + obj-$(CONFIG_ATA) += ata/ + obj-$(CONFIG_TARGET_CORE) += target/ +-obj-$(CONFIG_MTD) += mtd/ + obj-$(CONFIG_SPI) += spi/ ++obj-$(CONFIG_MTD) += mtd/ + obj-$(CONFIG_SPMI) += spmi/ + obj-$(CONFIG_HSI) += hsi/ + obj-$(CONFIG_SLIMBUS) += slimbus/ diff --git a/target/linux/ath79/patches-6.1/430-mtd-ar934x-nand-driver.patch b/target/linux/ath79/patches-6.1/430-mtd-ar934x-nand-driver.patch new file mode 100644 index 00000000000..63bc98e14c1 --- /dev/null +++ b/target/linux/ath79/patches-6.1/430-mtd-ar934x-nand-driver.patch @@ -0,0 +1,34 @@ +From: Gabor Juhos +Subject: ar71xx: ar934x_nfc: experimental NAND Flash Controller driver for AR934x + +SVN-Revision: 33385 +--- + drivers/mtd/nand/raw/Kconfig | 8 ++++++++ + drivers/mtd/nand/raw/Makefile | 1 + + 2 files changed, 9 insertions(+) + +--- a/drivers/mtd/nand/raw/Kconfig ++++ b/drivers/mtd/nand/raw/Kconfig +@@ -555,4 +555,12 @@ config MTD_NAND_DISKONCHIP_BBTWRITE + load time (assuming you build diskonchip as a module) with the module + parameter "inftl_bbt_write=1". + ++config MTD_NAND_AR934X ++ tristate "Support for NAND controller on Qualcomm Atheros AR934x/QCA955x SoCs" ++ depends on ATH79 || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ Enables support for NAND controller on Qualcomm Atheros SoCs. ++ This controller is found on AR934x and QCA955x SoCs. ++ + endif # MTD_RAW_NAND +--- a/drivers/mtd/nand/raw/Makefile ++++ b/drivers/mtd/nand/raw/Makefile +@@ -58,6 +58,7 @@ obj-$(CONFIG_MTD_NAND_ARASAN) += arasan + obj-$(CONFIG_MTD_NAND_INTEL_LGM) += intel-nand-controller.o + obj-$(CONFIG_MTD_NAND_ROCKCHIP) += rockchip-nand-controller.o + obj-$(CONFIG_MTD_NAND_PL35X) += pl35x-nand-controller.o ++obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o + + nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o + nand-objs += nand_onfi.o diff --git a/target/linux/ath79/patches-6.1/700-phy-add-ath79-usb-phys.patch b/target/linux/ath79/patches-6.1/700-phy-add-ath79-usb-phys.patch new file mode 100644 index 00000000000..21b655a1098 --- /dev/null +++ b/target/linux/ath79/patches-6.1/700-phy-add-ath79-usb-phys.patch @@ -0,0 +1,333 @@ +From 08c9d6ceef01893678a5d2e8a15517c745417f21 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Tue, 6 Mar 2018 10:04:05 +0100 +Subject: [PATCH 04/27] phy: add ath79 usb phys + +Signed-off-by: John Crispin +--- + drivers/phy/Kconfig | 16 ++++++ + drivers/phy/Makefile | 2 + + drivers/phy/phy-ar7100-usb.c | 124 +++++++++++++++++++++++++++++++++++++++++++ + drivers/phy/phy-ar7200-usb.c | 108 +++++++++++++++++++++++++++++++++++++ + 4 files changed, 250 insertions(+) + create mode 100644 drivers/phy/phy-ar7100-usb.c + create mode 100644 drivers/phy/phy-ar7200-usb.c + +--- a/drivers/phy/Kconfig ++++ b/drivers/phy/Kconfig +@@ -24,6 +24,22 @@ config GENERIC_PHY_MIPI_DPHY + Provides a number of helpers a core functions for MIPI D-PHY + drivers to us. + ++config PHY_AR7100_USB ++ tristate "Atheros AR7100 USB PHY driver" ++ depends on ATH79 || COMPILE_TEST ++ default y if USB_EHCI_HCD_PLATFORM ++ select GENERIC_PHY ++ help ++ Enable this to support the USB PHY on Atheros AR7100 SoCs. ++ ++config PHY_AR7200_USB ++ tristate "Atheros AR7200 USB PHY driver" ++ depends on ATH79 || COMPILE_TEST ++ default y if USB_EHCI_HCD_PLATFORM ++ select GENERIC_PHY ++ help ++ Enable this to support the USB PHY on Atheros AR7200 SoCs. ++ + config PHY_LPC18XX_USB_OTG + tristate "NXP LPC18xx/43xx SoC USB OTG PHY driver" + depends on OF && (ARCH_LPC18XX || COMPILE_TEST) +--- a/drivers/phy/Makefile ++++ b/drivers/phy/Makefile +@@ -4,6 +4,8 @@ + # + + obj-$(CONFIG_GENERIC_PHY) += phy-core.o ++obj-$(CONFIG_PHY_AR7100_USB) += phy-ar7100-usb.o ++obj-$(CONFIG_PHY_AR7200_USB) += phy-ar7200-usb.o + obj-$(CONFIG_GENERIC_PHY_MIPI_DPHY) += phy-core-mipi-dphy.o + obj-$(CONFIG_PHY_CAN_TRANSCEIVER) += phy-can-transceiver.o + obj-$(CONFIG_PHY_LPC18XX_USB_OTG) += phy-lpc18xx-usb-otg.o +--- /dev/null ++++ b/drivers/phy/phy-ar7100-usb.c +@@ -0,0 +1,140 @@ ++/* ++ * Copyright (C) 2018 John Crispin ++ * ++ * 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 2 of the License, or ++ * (at your option) any later version. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++struct ar7100_usb_phy { ++ struct reset_control *rst_phy; ++ struct reset_control *rst_host; ++ struct reset_control *rst_ohci_dll; ++ void __iomem *io_base; ++ struct phy *phy; ++ int gpio; ++}; ++ ++static int ar7100_usb_phy_power_off(struct phy *phy) ++{ ++ struct ar7100_usb_phy *priv = phy_get_drvdata(phy); ++ int err = 0; ++ ++ err |= reset_control_assert(priv->rst_host); ++ err |= reset_control_assert(priv->rst_phy); ++ err |= reset_control_assert(priv->rst_ohci_dll); ++ ++ return err; ++} ++ ++static int ar7100_usb_phy_power_on(struct phy *phy) ++{ ++ struct ar7100_usb_phy *priv = phy_get_drvdata(phy); ++ int err = 0; ++ ++ err |= ar7100_usb_phy_power_off(phy); ++ mdelay(100); ++ err |= reset_control_deassert(priv->rst_ohci_dll); ++ err |= reset_control_deassert(priv->rst_phy); ++ err |= reset_control_deassert(priv->rst_host); ++ mdelay(500); ++ iowrite32(0xf0000, priv->io_base + AR71XX_USB_CTRL_REG_CONFIG); ++ iowrite32(0x20c00, priv->io_base + AR71XX_USB_CTRL_REG_FLADJ); ++ ++ return err; ++} ++ ++static const struct phy_ops ar7100_usb_phy_ops = { ++ .power_on = ar7100_usb_phy_power_on, ++ .power_off = ar7100_usb_phy_power_off, ++ .owner = THIS_MODULE, ++}; ++ ++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); ++ 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); ++ } ++ ++ 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); ++ } ++ ++ 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); ++ } ++ ++ 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); ++ } ++ ++ priv->gpio = of_get_gpio(pdev->dev.of_node, 0); ++ if (priv->gpio >= 0) { ++ 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; ++ } ++ gpio_export_with_name(priv->gpio, 0, dev_name(&pdev->dev)); ++ gpio_set_value(priv->gpio, 1); ++ } ++ ++ phy_set_drvdata(priv->phy, priv); ++ ++ phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); ++ ++ ++ return PTR_ERR_OR_ZERO(phy_provider); ++} ++ ++static const struct of_device_id ar7100_usb_phy_of_match[] = { ++ { .compatible = "qca,ar7100-usb-phy" }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, ar7100_usb_phy_of_match); ++ ++static struct platform_driver ar7100_usb_phy_driver = { ++ .probe = ar7100_usb_phy_probe, ++ .driver = { ++ .of_match_table = ar7100_usb_phy_of_match, ++ .name = "ar7100-usb-phy", ++ } ++}; ++module_platform_driver(ar7100_usb_phy_driver); ++ ++MODULE_DESCRIPTION("ATH79 USB PHY driver"); ++MODULE_AUTHOR("Alban Bedel "); ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/drivers/phy/phy-ar7200-usb.c +@@ -0,0 +1,136 @@ ++/* ++ * Copyright (C) 2015 Alban Bedel ++ * ++ * 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 2 of the License, or ++ * (at your option) any later version. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++struct ar7200_usb_phy { ++ struct reset_control *rst_phy; ++ struct reset_control *rst_phy_analog; ++ struct reset_control *suspend_override; ++ struct phy *phy; ++ int gpio; ++}; ++ ++static int ar7200_usb_phy_power_on(struct phy *phy) ++{ ++ struct ar7200_usb_phy *priv = phy_get_drvdata(phy); ++ int err = 0; ++ ++ if (priv->suspend_override) ++ err = reset_control_assert(priv->suspend_override); ++ if (priv->rst_phy) ++ err |= reset_control_deassert(priv->rst_phy); ++ if (priv->rst_phy_analog) ++ err |= reset_control_deassert(priv->rst_phy_analog); ++ ++ return err; ++} ++ ++static int ar7200_usb_phy_power_off(struct phy *phy) ++{ ++ struct ar7200_usb_phy *priv = phy_get_drvdata(phy); ++ int err = 0; ++ ++ if (priv->suspend_override) ++ err = reset_control_deassert(priv->suspend_override); ++ if (priv->rst_phy) ++ err |= reset_control_assert(priv->rst_phy); ++ if (priv->rst_phy_analog) ++ err |= reset_control_assert(priv->rst_phy_analog); ++ ++ return err; ++} ++ ++static const struct phy_ops ar7200_usb_phy_ops = { ++ .power_on = ar7200_usb_phy_power_on, ++ .power_off = ar7200_usb_phy_power_off, ++ .owner = THIS_MODULE, ++}; ++ ++static int ar7200_usb_phy_probe(struct platform_device *pdev) ++{ ++ struct phy_provider *phy_provider; ++ struct ar7200_usb_phy *priv; ++ ++ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ 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); ++ } ++ ++ 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); ++ } ++ ++ 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); ++ } ++ ++ 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); ++ } ++ ++ priv->gpio = of_get_gpio(pdev->dev.of_node, 0); ++ if (priv->gpio >= 0) { ++ 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; ++ } ++ gpio_export_with_name(priv->gpio, 0, dev_name(&pdev->dev)); ++ gpio_set_value(priv->gpio, 1); ++ } ++ ++ phy_set_drvdata(priv->phy, priv); ++ ++ phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); ++ ++ return PTR_ERR_OR_ZERO(phy_provider); ++} ++ ++static const struct of_device_id ar7200_usb_phy_of_match[] = { ++ { .compatible = "qca,ar7200-usb-phy" }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, ar7200_usb_phy_of_match); ++ ++static struct platform_driver ar7200_usb_phy_driver = { ++ .probe = ar7200_usb_phy_probe, ++ .driver = { ++ .of_match_table = ar7200_usb_phy_of_match, ++ .name = "ar7200-usb-phy", ++ } ++}; ++module_platform_driver(ar7200_usb_phy_driver); ++ ++MODULE_DESCRIPTION("ATH79 USB PHY driver"); ++MODULE_AUTHOR("Alban Bedel "); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/ath79/patches-6.1/701-usb-add-more-OF-quirk-properties.patch b/target/linux/ath79/patches-6.1/701-usb-add-more-OF-quirk-properties.patch new file mode 100644 index 00000000000..d6d8cb69522 --- /dev/null +++ b/target/linux/ath79/patches-6.1/701-usb-add-more-OF-quirk-properties.patch @@ -0,0 +1,24 @@ +From 2201818e5bd33f389beceb3943fdfcf5a698fc5b Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Tue, 6 Mar 2018 10:01:43 +0100 +Subject: [PATCH 05/27] usb: add more OF/quirk properties + +Signed-off-by: John Crispin +--- + drivers/usb/host/ehci-platform.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/usb/host/ehci-platform.c ++++ b/drivers/usb/host/ehci-platform.c +@@ -277,6 +277,11 @@ static int ehci_platform_probe(struct pl + ehci = hcd_to_ehci(hcd); + + if (pdata == &ehci_platform_defaults && dev->dev.of_node) { ++ of_property_read_u32(dev->dev.of_node, "caps-offset", &pdata->caps_offset); ++ ++ if (of_property_read_bool(dev->dev.of_node, "has-synopsys-hc-bug")) ++ pdata->has_synopsys_hc_bug = 1; ++ + if (of_property_read_bool(dev->dev.of_node, "big-endian-regs")) + ehci->big_endian_mmio = 1; + diff --git a/target/linux/ath79/patches-6.1/710-net-use-downstream-ag71xx.patch b/target/linux/ath79/patches-6.1/710-net-use-downstream-ag71xx.patch new file mode 100644 index 00000000000..54e64fb11cf --- /dev/null +++ b/target/linux/ath79/patches-6.1/710-net-use-downstream-ag71xx.patch @@ -0,0 +1,42 @@ +From: John Crispin +Subject: [PATCH] ath79: add new OF only target for QCA MIPS silicon + +This target aims to replace ar71xx mid-term. The big part that is still +missing is making the MMIO/AHB wifi work using OF. NAND and mikrotik +subtargets will follow. + +Submitted-by: John Crispin +--- + drivers/net/ethernet/atheros/Kconfig | 8 +------- + drivers/net/ethernet/atheros/Makefile | 2 +- + 2 files changed, 2 insertions(+), 8 deletions(-) + +--- a/drivers/net/ethernet/atheros/Kconfig ++++ b/drivers/net/ethernet/atheros/Kconfig +@@ -17,14 +17,7 @@ config NET_VENDOR_ATHEROS + + if NET_VENDOR_ATHEROS + +-config AG71XX +- tristate "Atheros AR7XXX/AR9XXX built-in ethernet mac support" +- depends on ATH79 +- select PHYLINK +- imply NET_SELFTESTS +- help +- If you wish to compile a kernel for AR7XXX/91XXX and enable +- ethernet support, then you should always answer Y to this. ++source "drivers/net/ethernet/atheros/ag71xx/Kconfig" + + config ATL2 + tristate "Atheros L2 Fast Ethernet support" +--- a/drivers/net/ethernet/atheros/Makefile ++++ b/drivers/net/ethernet/atheros/Makefile +@@ -3,7 +3,7 @@ + # Makefile for the Atheros network device drivers. + # + +-obj-$(CONFIG_AG71XX) += ag71xx.o ++obj-$(CONFIG_AG71XX) += ag71xx/ + obj-$(CONFIG_ATL1) += atlx/ + obj-$(CONFIG_ATL2) += atlx/ + obj-$(CONFIG_ATL1E) += atl1e/ diff --git a/target/linux/ath79/patches-6.1/720-mdio_bitbang_ignore_ta_value.patch b/target/linux/ath79/patches-6.1/720-mdio_bitbang_ignore_ta_value.patch new file mode 100644 index 00000000000..5363bb37b03 --- /dev/null +++ b/target/linux/ath79/patches-6.1/720-mdio_bitbang_ignore_ta_value.patch @@ -0,0 +1,44 @@ +From: Jonas Gorski +Subject: ar71xx: add a workaround for ar8316 not always driving the TA bit to low + +AR8316 behind a GPIO bitbanged MDIO bus fails to drive the turnaround bit +to low despite returning a valid value. Ignore it and just use the +returned value anyway. + +SVN-Revision: 28422 +--- + drivers/net/mdio/mdio-bitbang.c | 16 ++----------------- + 1 file changed, 2 insertions(+), 14 deletions(-) + +--- a/drivers/net/mdio/mdio-bitbang.c ++++ b/drivers/net/mdio/mdio-bitbang.c +@@ -152,7 +152,7 @@ static int mdiobb_cmd_addr(struct mdiobb + int mdiobb_read(struct mii_bus *bus, int phy, int reg) + { + struct mdiobb_ctrl *ctrl = bus->priv; +- int ret, i; ++ int ret; + + if (reg & MII_ADDR_C45) { + reg = mdiobb_cmd_addr(ctrl, phy, reg); +@@ -162,19 +162,7 @@ int mdiobb_read(struct mii_bus *bus, int + + ctrl->ops->set_mdio_dir(ctrl, 0); + +- /* check the turnaround bit: the PHY should be driving it to zero, if this +- * PHY is listed in phy_ignore_ta_mask as having broken TA, skip that +- */ +- if (mdiobb_get_bit(ctrl) != 0 && +- !(bus->phy_ignore_ta_mask & (1 << phy))) { +- /* PHY didn't drive TA low -- flush any bits it +- * may be trying to send. +- */ +- for (i = 0; i < 32; i++) +- mdiobb_get_bit(ctrl); +- +- return 0xffff; +- } ++ mdiobb_get_bit(ctrl); + + ret = mdiobb_get_num(ctrl, 16); + mdiobb_get_bit(ctrl); diff --git a/target/linux/ath79/patches-6.1/721-phy-mdio-bitbang-prevent-rescheduling-during-command.patch b/target/linux/ath79/patches-6.1/721-phy-mdio-bitbang-prevent-rescheduling-during-command.patch new file mode 100644 index 00000000000..e37d9a1f630 --- /dev/null +++ b/target/linux/ath79/patches-6.1/721-phy-mdio-bitbang-prevent-rescheduling-during-command.patch @@ -0,0 +1,61 @@ +From 66e584435ac0de6e0abeb6d7166fe4fe25d6bb73 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Tue, 16 Jun 2015 13:15:08 +0200 +Subject: [PATCH] phy/mdio-bitbang: prevent rescheduling during command + +It seems some phys have some maximum timings for accessing the MDIO line, +resulting in bit errors under cpu stress. Prevent this from happening by +disabling interrupts when sending commands. + +Signed-off-by: Jonas Gorski +--- + drivers/net/mdio/mdio-bitbang.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/net/mdio/mdio-bitbang.c ++++ b/drivers/net/mdio/mdio-bitbang.c +@@ -14,6 +14,7 @@ + * Vitaly Bordug + */ + ++#include + #include + #include + #include +@@ -153,7 +154,9 @@ int mdiobb_read(struct mii_bus *bus, int + { + struct mdiobb_ctrl *ctrl = bus->priv; + int ret; ++ unsigned long flags; + ++ local_irq_save(flags); + if (reg & MII_ADDR_C45) { + reg = mdiobb_cmd_addr(ctrl, phy, reg); + mdiobb_cmd(ctrl, MDIO_C45_READ, phy, reg); +@@ -166,6 +169,7 @@ int mdiobb_read(struct mii_bus *bus, int + + ret = mdiobb_get_num(ctrl, 16); + mdiobb_get_bit(ctrl); ++ local_irq_restore(flags); + return ret; + } + EXPORT_SYMBOL(mdiobb_read); +@@ -173,7 +177,9 @@ EXPORT_SYMBOL(mdiobb_read); + int mdiobb_write(struct mii_bus *bus, int phy, int reg, u16 val) + { + struct mdiobb_ctrl *ctrl = bus->priv; ++ unsigned long flags; + ++ local_irq_save(flags); + if (reg & MII_ADDR_C45) { + reg = mdiobb_cmd_addr(ctrl, phy, reg); + mdiobb_cmd(ctrl, MDIO_C45_WRITE, phy, reg); +@@ -188,6 +194,8 @@ int mdiobb_write(struct mii_bus *bus, in + + ctrl->ops->set_mdio_dir(ctrl, 0); + mdiobb_get_bit(ctrl); ++ local_irq_restore(flags); ++ + return 0; + } + EXPORT_SYMBOL(mdiobb_write); diff --git a/target/linux/ath79/patches-6.1/730-ar8216-make-reg-access-atomic.patch b/target/linux/ath79/patches-6.1/730-ar8216-make-reg-access-atomic.patch new file mode 100644 index 00000000000..02f763534e4 --- /dev/null +++ b/target/linux/ath79/patches-6.1/730-ar8216-make-reg-access-atomic.patch @@ -0,0 +1,59 @@ +From b3797d1a92afe97c173b00fdb7824cedba24eef0 Mon Sep 17 00:00:00 2001 +From: Chuanhong Guo +Date: Sun, 20 Sep 2020 01:00:45 +0800 +Subject: [PATCH] ath79: ar8216: make switch register access atomic + +due to some unknown reason these register accesses sometimes fail +on the integrated switch without this patch. + +THIS ONLY WORKS ON ATH79 AND MAY BREAK THE DRIVER ON OTHER PLATFORMS! +The mdio bus on ath79 works in polling mode and doesn't rely on +any interrupt. This patch breaks the driver on any mdio master +with interrupts used. + +--- +--- a/drivers/net/phy/ar8216.c ++++ b/drivers/net/phy/ar8216.c +@@ -252,6 +252,7 @@ ar8xxx_mii_write32(struct ar8xxx_priv *p + u32 + ar8xxx_read(struct ar8xxx_priv *priv, int reg) + { ++ unsigned long flags; + struct mii_bus *bus = priv->mii_bus; + u16 r1, r2, page; + u32 val; +@@ -259,11 +260,13 @@ ar8xxx_read(struct ar8xxx_priv *priv, in + split_addr((u32) reg, &r1, &r2, &page); + + mutex_lock(&bus->mdio_lock); ++ local_irq_save(flags); + + bus->write(bus, 0x18, 0, page); + wait_for_page_switch(); + val = ar8xxx_mii_read32(priv, 0x10 | r2, r1); + ++ local_irq_restore(flags); + mutex_unlock(&bus->mdio_lock); + + return val; +@@ -272,17 +275,20 @@ ar8xxx_read(struct ar8xxx_priv *priv, in + void + ar8xxx_write(struct ar8xxx_priv *priv, int reg, u32 val) + { ++ unsigned long flags; + struct mii_bus *bus = priv->mii_bus; + u16 r1, r2, page; + + split_addr((u32) reg, &r1, &r2, &page); + + mutex_lock(&bus->mdio_lock); ++ local_irq_save(flags); + + bus->write(bus, 0x18, 0, page); + wait_for_page_switch(); + ar8xxx_mii_write32(priv, 0x10 | r2, r1, val); + ++ local_irq_restore(flags); + mutex_unlock(&bus->mdio_lock); + } + diff --git a/target/linux/ath79/patches-6.1/800-leds-add-reset-controller-based-driver.patch b/target/linux/ath79/patches-6.1/800-leds-add-reset-controller-based-driver.patch new file mode 100644 index 00000000000..7122756c526 --- /dev/null +++ b/target/linux/ath79/patches-6.1/800-leds-add-reset-controller-based-driver.patch @@ -0,0 +1,186 @@ +From ecbd9c87f073f097d9fe56390353e64e963e866a Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Tue, 6 Mar 2018 10:03:03 +0100 +Subject: [PATCH 03/27] leds: add reset-controller based driver + +Signed-off-by: John Crispin +--- + drivers/leds/Kconfig | 11 ++++ + drivers/leds/Makefile | 1 + + drivers/leds/leds-reset.c | 137 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 149 insertions(+) + create mode 100644 drivers/leds/leds-reset.c + +--- a/drivers/leds/Kconfig ++++ b/drivers/leds/Kconfig +@@ -876,6 +876,17 @@ source "drivers/leds/blink/Kconfig" + comment "Flash and Torch LED drivers" + source "drivers/leds/flash/Kconfig" + ++config LEDS_RESET ++ tristate "LED support for reset-controller API" ++ depends on LEDS_CLASS ++ depends on RESET_CONTROLLER ++ help ++ This option enables support for LEDs connected to pins driven by reset ++ controllers. Yes, DNI actual built HW like that. ++ ++ To compile this driver as a module, choose M here: the module ++ will be called leds-reset. ++ + comment "LED Triggers" + source "drivers/leds/trigger/Kconfig" + +--- /dev/null ++++ b/drivers/leds/leds-reset.c +@@ -0,0 +1,140 @@ ++/* ++ * Copyright (C) 2018 John Crispin ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct reset_led_data { ++ struct led_classdev cdev; ++ struct reset_control *rst; ++}; ++ ++static inline struct reset_led_data * ++ cdev_to_reset_led_data(struct led_classdev *led_cdev) ++{ ++ return container_of(led_cdev, struct reset_led_data, cdev); ++} ++ ++static void reset_led_set(struct led_classdev *led_cdev, ++ enum led_brightness value) ++{ ++ struct reset_led_data *led_dat = cdev_to_reset_led_data(led_cdev); ++ ++ if (value == LED_OFF) ++ reset_control_assert(led_dat->rst); ++ else ++ reset_control_deassert(led_dat->rst); ++} ++ ++struct reset_leds_priv { ++ int num_leds; ++ struct reset_led_data leds[]; ++}; ++ ++static inline int sizeof_reset_leds_priv(int num_leds) ++{ ++ return sizeof(struct reset_leds_priv) + ++ (sizeof(struct reset_led_data) * num_leds); ++} ++ ++static struct reset_leds_priv *reset_leds_create(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct fwnode_handle *child; ++ struct reset_leds_priv *priv; ++ int count, ret; ++ ++ count = device_get_child_node_count(dev); ++ if (!count) ++ return ERR_PTR(-ENODEV); ++ ++ priv = devm_kzalloc(dev, sizeof_reset_leds_priv(count), GFP_KERNEL); ++ if (!priv) ++ return ERR_PTR(-ENOMEM); ++ ++ device_for_each_child_node(dev, child) { ++ struct reset_led_data *led = &priv->leds[priv->num_leds]; ++ struct device_node *np = to_of_node(child); ++ ++ ret = fwnode_property_read_string(child, "label", &led->cdev.name); ++ if (!led->cdev.name) { ++ fwnode_handle_put(child); ++ return ERR_PTR(-EINVAL); ++ } ++ led->rst = __of_reset_control_get(np, NULL, 0, 0, 0, true); ++ if (IS_ERR(led->rst)) ++ return ERR_PTR(-EINVAL); ++ ++ fwnode_property_read_string(child, "linux,default-trigger", ++ &led->cdev.default_trigger); ++ ++ led->cdev.brightness_set = reset_led_set; ++ ret = devm_led_classdev_register(&pdev->dev, &led->cdev); ++ if (ret < 0) ++ return ERR_PTR(ret); ++ led->cdev.dev->of_node = np; ++ priv->num_leds++; ++ } ++ ++ return priv; ++} ++ ++static const struct of_device_id of_reset_leds_match[] = { ++ { .compatible = "reset-leds", }, ++ {}, ++}; ++ ++MODULE_DEVICE_TABLE(of, of_reset_leds_match); ++ ++static int reset_led_probe(struct platform_device *pdev) ++{ ++ struct reset_leds_priv *priv; ++ ++ priv = reset_leds_create(pdev); ++ if (IS_ERR(priv)) ++ return PTR_ERR(priv); ++ ++ platform_set_drvdata(pdev, priv); ++ ++ return 0; ++} ++ ++static void reset_led_shutdown(struct platform_device *pdev) ++{ ++ struct reset_leds_priv *priv = platform_get_drvdata(pdev); ++ int i; ++ ++ for (i = 0; i < priv->num_leds; i++) { ++ struct reset_led_data *led = &priv->leds[i]; ++ ++ if (!(led->cdev.flags & LED_RETAIN_AT_SHUTDOWN)) ++ reset_led_set(&led->cdev, LED_OFF); ++ } ++} ++ ++static struct platform_driver reset_led_driver = { ++ .probe = reset_led_probe, ++ .shutdown = reset_led_shutdown, ++ .driver = { ++ .name = "leds-reset", ++ .of_match_table = of_reset_leds_match, ++ }, ++}; ++ ++module_platform_driver(reset_led_driver); ++ ++MODULE_AUTHOR("John Crispin "); ++MODULE_DESCRIPTION("reset controller LED driver"); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:leds-reset"); +--- a/drivers/leds/Makefile ++++ b/drivers/leds/Makefile +@@ -87,6 +87,7 @@ obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds + obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o + obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o + obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o ++obj-$(CONFIG_LEDS_RESET) += leds-reset.o + + # LED SPI Drivers + obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o diff --git a/target/linux/ath79/patches-6.1/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.1/900-unaligned_access_hacks.patch new file mode 100644 index 00000000000..1971b9cd010 --- /dev/null +++ b/target/linux/ath79/patches-6.1/900-unaligned_access_hacks.patch @@ -0,0 +1,899 @@ +From: Felix Fietkau +Subject: [PATCH] ar71xx: fix unaligned access in a few more places + +SVN-Revision: 35130 +--- + arch/mips/include/asm/checksum.h | 83 +++--------------- + include/uapi/linux/ip.h | 2 +- + include/uapi/linux/ipv6.h | 2 +- + include/uapi/linux/tcp.h | 4 ++-- + include/uapi/linux/udp.h | 2 +- + net/netfilter/nf_conntrack_core.c | 4 ++-- + include/uapi/linux/icmp.h | 2 +- + include/uapi/linux/in6.h | 2 +- + net/ipv6/tcp_ipv6.c | 9 +++-- + net/ipv6/datagram.c | 6 ++-- + net/ipv6/exthdrs.c | 2 +- + include/linux/types.h | 5 +++ + net/ipv4/af_inet.c | 4 ++-- + net/ipv4/tcp_output.c | 69 +++++++++-------- + include/uapi/linux/igmp.h | 8 +++--- + net/core/flow_dissector.c | 2 +- + include/uapi/linux/icmpv6.h | 2 +- + include/net/ndisc.h | 10 ++++---- + net/sched/cls_u32.c | 6 +++--- + net/ipv6/ip6_offload.c | 2 +- + include/net/addrconf.h | 2 +- + include/net/inet_ecn.h | 4 ++-- + include/net/ipv6.h | 23 +++++---- + include/net/secure_seq.h | 1 + + include/uapi/linux/in.h | 2 +- + net/ipv6/ip6_fib.h | 2 +- + net/netfilter/nf_conntrack_proto_tcp.c | 2 +- + net/xfrm/xfrm_input.c | 4 ++-- + net/ipv4/tcp_input.c | 12 ++++--- + include/uapi/linux/if_pppox.h | 1 + + net/ipv6/netfilter/nf_log_ipv6.c | 4 ++-- + include/net/neighbour.h | 6 +++-- + include/uapi/linux/netfilter_arp/arp_tables.h | 2 +- + net/core/utils.c | 10 +++++-- + include/linux/etherdevice.h | 11 ++++--- + net/ipv4/tcp_offload.c | 6 +++--- + net/ipv6/netfilter/ip6table_mangle.c | 4 ++-- + 37 file changed, 171 insertions(+), 141 deletions(-) + +--- a/arch/mips/include/asm/checksum.h ++++ b/arch/mips/include/asm/checksum.h +@@ -100,26 +100,30 @@ static inline __sum16 ip_fast_csum(const + const unsigned int *stop = word + ihl; + unsigned int csum; + int carry; ++ unsigned int w; + +- csum = word[0]; +- csum += word[1]; +- carry = (csum < word[1]); ++ csum = net_hdr_word(word++); ++ ++ w = net_hdr_word(word++); ++ csum += w; ++ carry = (csum < w); + csum += carry; + +- csum += word[2]; +- carry = (csum < word[2]); ++ w = net_hdr_word(word++); ++ csum += w; ++ carry = (csum < w); + csum += carry; + +- csum += word[3]; +- carry = (csum < word[3]); ++ w = net_hdr_word(word++); ++ csum += w; ++ carry = (csum < w); + csum += carry; + +- word += 4; + do { +- csum += *word; +- carry = (csum < *word); ++ w = net_hdr_word(word++); ++ csum += w; ++ carry = (csum < w); + csum += carry; +- word++; + } while (word != stop); + + return csum_fold(csum); +@@ -182,73 +186,6 @@ static inline __sum16 ip_compute_csum(co + return csum_fold(csum_partial(buff, len, 0)); + } + +-#define _HAVE_ARCH_IPV6_CSUM +-static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, +- const struct in6_addr *daddr, +- __u32 len, __u8 proto, +- __wsum sum) +-{ +- __wsum tmp; +- +- __asm__( +- " .set push # csum_ipv6_magic\n" +- " .set noreorder \n" +- " .set noat \n" +- " addu %0, %5 # proto (long in network byte order)\n" +- " sltu $1, %0, %5 \n" +- " addu %0, $1 \n" +- +- " addu %0, %6 # csum\n" +- " sltu $1, %0, %6 \n" +- " lw %1, 0(%2) # four words source address\n" +- " addu %0, $1 \n" +- " addu %0, %1 \n" +- " sltu $1, %0, %1 \n" +- +- " lw %1, 4(%2) \n" +- " addu %0, $1 \n" +- " addu %0, %1 \n" +- " sltu $1, %0, %1 \n" +- +- " lw %1, 8(%2) \n" +- " addu %0, $1 \n" +- " addu %0, %1 \n" +- " sltu $1, %0, %1 \n" +- +- " lw %1, 12(%2) \n" +- " addu %0, $1 \n" +- " addu %0, %1 \n" +- " sltu $1, %0, %1 \n" +- +- " lw %1, 0(%3) \n" +- " addu %0, $1 \n" +- " addu %0, %1 \n" +- " sltu $1, %0, %1 \n" +- +- " lw %1, 4(%3) \n" +- " addu %0, $1 \n" +- " addu %0, %1 \n" +- " sltu $1, %0, %1 \n" +- +- " lw %1, 8(%3) \n" +- " addu %0, $1 \n" +- " addu %0, %1 \n" +- " sltu $1, %0, %1 \n" +- +- " lw %1, 12(%3) \n" +- " addu %0, $1 \n" +- " addu %0, %1 \n" +- " sltu $1, %0, %1 \n" +- +- " addu %0, $1 # Add final carry\n" +- " .set pop" +- : "=&r" (sum), "=&r" (tmp) +- : "r" (saddr), "r" (daddr), +- "0" (htonl(len)), "r" (htonl(proto)), "r" (sum)); +- +- return csum_fold(sum); +-} +- + #include + #endif /* CONFIG_GENERIC_CSUM */ + +--- a/include/uapi/linux/ip.h ++++ b/include/uapi/linux/ip.h +@@ -106,7 +106,7 @@ struct iphdr { + __be32 daddr; + ); + /*The options start here. */ +-}; ++} __attribute__((packed, aligned(2))); + + + struct ip_auth_hdr { +--- a/include/uapi/linux/ipv6.h ++++ b/include/uapi/linux/ipv6.h +@@ -135,7 +135,7 @@ struct ipv6hdr { + struct in6_addr saddr; + struct in6_addr daddr; + ); +-}; ++} __attribute__((packed, aligned(2))); + + + /* index values for the variables in ipv6_devconf */ +--- a/include/uapi/linux/tcp.h ++++ b/include/uapi/linux/tcp.h +@@ -55,7 +55,7 @@ struct tcphdr { + __be16 window; + __sum16 check; + __be16 urg_ptr; +-}; ++} __attribute__((packed, aligned(2))); + + /* + * The union cast uses a gcc extension to avoid aliasing problems +@@ -65,7 +65,7 @@ struct tcphdr { + union tcp_word_hdr { + struct tcphdr hdr; + __be32 words[5]; +-}; ++} __attribute__((packed, aligned(2))); + + #define tcp_flag_word(tp) (((union tcp_word_hdr *)(tp))->words[3]) + +--- a/include/uapi/linux/udp.h ++++ b/include/uapi/linux/udp.h +@@ -25,7 +25,7 @@ struct udphdr { + __be16 dest; + __be16 len; + __sum16 check; +-}; ++} __attribute__((packed, aligned(2))); + + /* UDP socket options */ + #define UDP_CORK 1 /* Never send partially complete segments */ +--- a/net/netfilter/nf_conntrack_core.c ++++ b/net/netfilter/nf_conntrack_core.c +@@ -308,8 +308,8 @@ nf_ct_get_tuple(const struct sk_buff *sk + + switch (l3num) { + case NFPROTO_IPV4: +- tuple->src.u3.ip = ap[0]; +- tuple->dst.u3.ip = ap[1]; ++ tuple->src.u3.ip = net_hdr_word(ap++); ++ tuple->dst.u3.ip = net_hdr_word(ap); + break; + case NFPROTO_IPV6: + memcpy(tuple->src.u3.ip6, ap, sizeof(tuple->src.u3.ip6)); +--- a/include/uapi/linux/icmp.h ++++ b/include/uapi/linux/icmp.h +@@ -102,7 +102,7 @@ struct icmphdr { + } frag; + __u8 reserved[4]; + } un; +-}; ++} __attribute__((packed, aligned(2))); + + + /* +--- a/include/uapi/linux/in6.h ++++ b/include/uapi/linux/in6.h +@@ -43,7 +43,7 @@ struct in6_addr { + #define s6_addr16 in6_u.u6_addr16 + #define s6_addr32 in6_u.u6_addr32 + #endif +-}; ++} __attribute__((packed, aligned(2))); + #endif /* __UAPI_DEF_IN6_ADDR */ + + #if __UAPI_DEF_SOCKADDR_IN6 +--- a/net/ipv6/tcp_ipv6.c ++++ b/net/ipv6/tcp_ipv6.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -944,10 +945,10 @@ static void tcp_v6_send_response(const s + topt = (__be32 *)(t1 + 1); + + if (tsecr) { +- *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | +- (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP); +- *topt++ = htonl(tsval); +- *topt++ = htonl(tsecr); ++ put_unaligned_be32((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | ++ (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP, topt++); ++ put_unaligned_be32(tsval, topt++); ++ put_unaligned_be32(tsecr, topt++); + } + + if (mrst) +--- a/include/linux/ipv6.h ++++ b/include/linux/ipv6.h +@@ -6,6 +6,7 @@ + + #define ipv6_optlen(p) (((p)->hdrlen+1) << 3) + #define ipv6_authlen(p) (((p)->hdrlen+2) << 2) ++ + /* + * This structure contains configuration options per IPv6 link. + */ +--- a/net/ipv6/datagram.c ++++ b/net/ipv6/datagram.c +@@ -492,7 +492,7 @@ int ipv6_recv_error(struct sock *sk, str + ipv6_iface_scope_id(&sin->sin6_addr, + IP6CB(skb)->iif); + } else { +- ipv6_addr_set_v4mapped(*(__be32 *)(nh + serr->addr_offset), ++ ipv6_addr_set_v4mapped(net_hdr_word(nh + serr->addr_offset), + &sin->sin6_addr); + sin->sin6_scope_id = 0; + } +@@ -846,12 +846,12 @@ int ip6_datagram_send_ctl(struct net *ne + } + + if (fl6->flowlabel&IPV6_FLOWINFO_MASK) { +- if ((fl6->flowlabel^*(__be32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) { ++ if ((fl6->flowlabel^net_hdr_word(CMSG_DATA(cmsg)))&~IPV6_FLOWINFO_MASK) { + err = -EINVAL; + goto exit_f; + } + } +- fl6->flowlabel = IPV6_FLOWINFO_MASK & *(__be32 *)CMSG_DATA(cmsg); ++ fl6->flowlabel = IPV6_FLOWINFO_MASK & net_hdr_word(CMSG_DATA(cmsg)); + break; + + case IPV6_2292HOPOPTS: +--- a/net/ipv6/exthdrs.c ++++ b/net/ipv6/exthdrs.c +@@ -1002,7 +1002,7 @@ static bool ipv6_hop_jumbo(struct sk_buf + goto drop; + } + +- pkt_len = ntohl(*(__be32 *)(nh + optoff + 2)); ++ pkt_len = ntohl(net_hdr_word(nh + optoff + 2)); + if (pkt_len <= IPV6_MAXPLEN) { + __IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS); + icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2); +--- a/include/linux/types.h ++++ b/include/linux/types.h +@@ -231,5 +231,11 @@ typedef void (*swap_func_t)(void *a, voi + typedef int (*cmp_r_func_t)(const void *a, const void *b, const void *priv); + typedef int (*cmp_func_t)(const void *a, const void *b); + ++struct net_hdr_word { ++ u32 words[1]; ++} __attribute__((packed, aligned(2))); ++ ++#define net_hdr_word(_p) (((struct net_hdr_word *) (_p))->words[0]) ++ + #endif /* __ASSEMBLY__ */ + #endif /* _LINUX_TYPES_H */ +--- a/net/ipv4/af_inet.c ++++ b/net/ipv4/af_inet.c +@@ -1477,8 +1477,8 @@ struct sk_buff *inet_gro_receive(struct + if (unlikely(ip_fast_csum((u8 *)iph, 5))) + goto out_unlock; + +- id = ntohl(*(__be32 *)&iph->id); +- flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) | (id & ~IP_DF)); ++ id = ntohl(net_hdr_word(&iph->id)); ++ flush = (u16)((ntohl(net_hdr_word(iph)) ^ skb_gro_len(skb)) | (id & ~IP_DF)); + id >>= 16; + + list_for_each_entry(p, head, list) { +--- a/net/ipv4/tcp_output.c ++++ b/net/ipv4/tcp_output.c +@@ -610,48 +610,53 @@ static void tcp_options_write(__be32 *pt + u16 options = opts->options; /* mungable copy */ + + if (unlikely(OPTION_MD5 & options)) { +- *ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | +- (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); ++ net_hdr_word(ptr++) = ++ htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | ++ (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); + /* overload cookie hash location */ + opts->hash_location = (__u8 *)ptr; + ptr += 4; + } + + if (unlikely(opts->mss)) { +- *ptr++ = htonl((TCPOPT_MSS << 24) | +- (TCPOLEN_MSS << 16) | +- opts->mss); ++ net_hdr_word(ptr++) = ++ htonl((TCPOPT_MSS << 24) | (TCPOLEN_MSS << 16) | ++ opts->mss); + } + + if (likely(OPTION_TS & options)) { + if (unlikely(OPTION_SACK_ADVERTISE & options)) { +- *ptr++ = htonl((TCPOPT_SACK_PERM << 24) | +- (TCPOLEN_SACK_PERM << 16) | +- (TCPOPT_TIMESTAMP << 8) | +- TCPOLEN_TIMESTAMP); ++ net_hdr_word(ptr++) = ++ htonl((TCPOPT_SACK_PERM << 24) | ++ (TCPOLEN_SACK_PERM << 16) | ++ (TCPOPT_TIMESTAMP << 8) | ++ TCPOLEN_TIMESTAMP); + options &= ~OPTION_SACK_ADVERTISE; + } else { +- *ptr++ = htonl((TCPOPT_NOP << 24) | +- (TCPOPT_NOP << 16) | +- (TCPOPT_TIMESTAMP << 8) | +- TCPOLEN_TIMESTAMP); ++ net_hdr_word(ptr++) = ++ htonl((TCPOPT_NOP << 24) | ++ (TCPOPT_NOP << 16) | ++ (TCPOPT_TIMESTAMP << 8) | ++ TCPOLEN_TIMESTAMP); + } +- *ptr++ = htonl(opts->tsval); +- *ptr++ = htonl(opts->tsecr); ++ net_hdr_word(ptr++) = htonl(opts->tsval); ++ net_hdr_word(ptr++) = htonl(opts->tsecr); + } + + if (unlikely(OPTION_SACK_ADVERTISE & options)) { +- *ptr++ = htonl((TCPOPT_NOP << 24) | +- (TCPOPT_NOP << 16) | +- (TCPOPT_SACK_PERM << 8) | +- TCPOLEN_SACK_PERM); ++ net_hdr_word(ptr++) = ++ htonl((TCPOPT_NOP << 24) | ++ (TCPOPT_NOP << 16) | ++ (TCPOPT_SACK_PERM << 8) | ++ TCPOLEN_SACK_PERM); + } + + if (unlikely(OPTION_WSCALE & options)) { +- *ptr++ = htonl((TCPOPT_NOP << 24) | +- (TCPOPT_WINDOW << 16) | +- (TCPOLEN_WINDOW << 8) | +- opts->ws); ++ net_hdr_word(ptr++) = ++ htonl((TCPOPT_NOP << 24) | ++ (TCPOPT_WINDOW << 16) | ++ (TCPOLEN_WINDOW << 8) | ++ opts->ws); + } + + if (unlikely(opts->num_sack_blocks)) { +@@ -659,16 +664,17 @@ static void tcp_options_write(__be32 *pt + tp->duplicate_sack : tp->selective_acks; + int this_sack; + +- *ptr++ = htonl((TCPOPT_NOP << 24) | +- (TCPOPT_NOP << 16) | +- (TCPOPT_SACK << 8) | +- (TCPOLEN_SACK_BASE + (opts->num_sack_blocks * ++ net_hdr_word(ptr++) = ++ htonl((TCPOPT_NOP << 24) | ++ (TCPOPT_NOP << 16) | ++ (TCPOPT_SACK << 8) | ++ (TCPOLEN_SACK_BASE + (opts->num_sack_blocks * + TCPOLEN_SACK_PERBLOCK))); + + for (this_sack = 0; this_sack < opts->num_sack_blocks; + ++this_sack) { +- *ptr++ = htonl(sp[this_sack].start_seq); +- *ptr++ = htonl(sp[this_sack].end_seq); ++ net_hdr_word(ptr++) = htonl(sp[this_sack].start_seq); ++ net_hdr_word(ptr++) = htonl(sp[this_sack].end_seq); + } + + tp->rx_opt.dsack = 0; +@@ -681,13 +687,14 @@ static void tcp_options_write(__be32 *pt + + if (foc->exp) { + len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; +- *ptr = htonl((TCPOPT_EXP << 24) | (len << 16) | ++ net_hdr_word(ptr) = ++ htonl((TCPOPT_EXP << 24) | (len << 16) | + TCPOPT_FASTOPEN_MAGIC); + p += TCPOLEN_EXP_FASTOPEN_BASE; + } else { + len = TCPOLEN_FASTOPEN_BASE + foc->len; +- *p++ = TCPOPT_FASTOPEN; +- *p++ = len; ++ net_hdr_word(p++) = TCPOPT_FASTOPEN; ++ net_hdr_word(p++) = len; + } + + memcpy(p, foc->val, foc->len); +--- a/include/uapi/linux/igmp.h ++++ b/include/uapi/linux/igmp.h +@@ -33,7 +33,7 @@ struct igmphdr { + __u8 code; /* For newer IGMP */ + __sum16 csum; + __be32 group; +-}; ++} __attribute__((packed, aligned(2))); + + /* V3 group record types [grec_type] */ + #define IGMPV3_MODE_IS_INCLUDE 1 +@@ -49,7 +49,7 @@ struct igmpv3_grec { + __be16 grec_nsrcs; + __be32 grec_mca; + __be32 grec_src[0]; +-}; ++} __attribute__((packed, aligned(2))); + + struct igmpv3_report { + __u8 type; +@@ -58,7 +58,7 @@ struct igmpv3_report { + __be16 resv2; + __be16 ngrec; + struct igmpv3_grec grec[0]; +-}; ++} __attribute__((packed, aligned(2))); + + struct igmpv3_query { + __u8 type; +@@ -79,7 +79,7 @@ struct igmpv3_query { + __u8 qqic; + __be16 nsrcs; + __be32 srcs[0]; +-}; ++} __attribute__((packed, aligned(2))); + + #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ + #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ +--- a/net/core/flow_dissector.c ++++ b/net/core/flow_dissector.c +@@ -129,7 +129,7 @@ __be32 __skb_flow_get_ports(const struct + ports = __skb_header_pointer(skb, thoff + poff, + sizeof(_ports), data, hlen, &_ports); + if (ports) +- return *ports; ++ return (__be32)net_hdr_word(ports); + } + + return 0; +--- a/include/uapi/linux/icmpv6.h ++++ b/include/uapi/linux/icmpv6.h +@@ -78,7 +78,7 @@ struct icmp6hdr { + #define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other + #define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime + #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref +-}; ++} __attribute__((packed, aligned(2))); + + + #define ICMPV6_ROUTER_PREF_LOW 0x3 +--- a/include/net/ndisc.h ++++ b/include/net/ndisc.h +@@ -93,7 +93,7 @@ struct ra_msg { + struct icmp6hdr icmph; + __be32 reachable_time; + __be32 retrans_timer; +-}; ++} __attribute__((packed, aligned(2))); + + struct rd_msg { + struct icmp6hdr icmph; +@@ -372,10 +372,10 @@ static inline u32 ndisc_hashfn(const voi + { + const u32 *p32 = pkey; + +- return (((p32[0] ^ hash32_ptr(dev)) * hash_rnd[0]) + +- (p32[1] * hash_rnd[1]) + +- (p32[2] * hash_rnd[2]) + +- (p32[3] * hash_rnd[3])); ++ return (((net_hdr_word(&p32[0]) ^ hash32_ptr(dev)) * hash_rnd[0]) + ++ (net_hdr_word(&p32[1]) * hash_rnd[1]) + ++ (net_hdr_word(&p32[2]) * hash_rnd[2]) + ++ (net_hdr_word(&p32[3]) * hash_rnd[3])); + } + + static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey) +--- a/net/sched/cls_u32.c ++++ b/net/sched/cls_u32.c +@@ -155,7 +155,7 @@ next_knode: + data = skb_header_pointer(skb, toff, 4, &hdata); + if (!data) + goto out; +- if ((*data ^ key->val) & key->mask) { ++ if ((net_hdr_word(data) ^ key->val) & key->mask) { + n = rcu_dereference_bh(n->next); + goto next_knode; + } +@@ -206,8 +206,8 @@ check_terminal: + &hdata); + if (!data) + goto out; +- sel = ht->divisor & u32_hash_fold(*data, &n->sel, +- n->fshift); ++ sel = ht->divisor & u32_hash_fold(net_hdr_word(data), ++ &n->sel, n->fshift); + } + if (!(n->sel.flags & (TC_U32_VAROFFSET | TC_U32_OFFSET | TC_U32_EAT))) + goto next_ht; +--- a/net/ipv6/ip6_offload.c ++++ b/net/ipv6/ip6_offload.c +@@ -241,7 +241,7 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff * + continue; + + iph2 = (struct ipv6hdr *)(p->data + off); +- first_word = *(__be32 *)iph ^ *(__be32 *)iph2; ++ first_word = net_hdr_word(iph) ^ net_hdr_word(iph2); + + /* All fields must match except length and Traffic Class. + * XXX skbs on the gro_list have all been parsed and pulled +--- a/include/net/addrconf.h ++++ b/include/net/addrconf.h +@@ -47,7 +47,7 @@ struct prefix_info { + __be32 reserved2; + + struct in6_addr prefix; +-}; ++} __attribute__((packed, aligned(2))); + + #include + #include +--- a/include/net/inet_ecn.h ++++ b/include/net/inet_ecn.h +@@ -138,9 +138,9 @@ static inline int IP6_ECN_set_ce(struct + if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) + return 0; + +- from = *(__be32 *)iph; ++ from = net_hdr_word(iph); + to = from | htonl(INET_ECN_CE << 20); +- *(__be32 *)iph = to; ++ net_hdr_word(iph) = to; + if (skb->ip_summed == CHECKSUM_COMPLETE) + skb->csum = csum_add(csum_sub(skb->csum, (__force __wsum)from), + (__force __wsum)to); +--- a/include/net/ipv6.h ++++ b/include/net/ipv6.h +@@ -147,7 +147,7 @@ struct frag_hdr { + __u8 reserved; + __be16 frag_off; + __be32 identification; +-}; ++} __attribute__((packed, aligned(2))); + + #define IP6_MF 0x0001 + #define IP6_OFFSET 0xFFF8 +@@ -561,8 +561,8 @@ static inline void __ipv6_addr_set_half( + } + #endif + #endif +- addr[0] = wh; +- addr[1] = wl; ++ net_hdr_word(&addr[0]) = wh; ++ net_hdr_word(&addr[1]) = wl; + } + + static inline void ipv6_addr_set(struct in6_addr *addr, +@@ -621,6 +621,8 @@ static inline bool ipv6_prefix_equal(con + const __be32 *a1 = addr1->s6_addr32; + const __be32 *a2 = addr2->s6_addr32; + unsigned int pdw, pbi; ++ /* Used for last <32-bit fraction of prefix */ ++ u32 pbia1, pbia2; + + /* check complete u32 in prefix */ + pdw = prefixlen >> 5; +@@ -629,7 +631,9 @@ static inline bool ipv6_prefix_equal(con + + /* check incomplete u32 in prefix */ + pbi = prefixlen & 0x1f; +- if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi)))) ++ pbia1 = net_hdr_word(&a1[pdw]); ++ pbia2 = net_hdr_word(&a2[pdw]); ++ if (pbi && ((pbia1 ^ pbia2) & htonl((0xffffffff) << (32 - pbi)))) + return false; + + return true; +@@ -746,13 +750,13 @@ static inline void ipv6_addr_set_v4mappe + */ + static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen) + { +- const __be32 *a1 = token1, *a2 = token2; ++ const struct in6_addr *a1 = token1, *a2 = token2; + int i; + + addrlen >>= 2; + + for (i = 0; i < addrlen; i++) { +- __be32 xb = a1[i] ^ a2[i]; ++ __be32 xb = a1->s6_addr32[i] ^ a2->s6_addr32[i]; + if (xb) + return i * 32 + 31 - __fls(ntohl(xb)); + } +@@ -946,17 +950,18 @@ static inline u32 ip6_multipath_hash_fie + static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass, + __be32 flowlabel) + { +- *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | flowlabel; ++ net_hdr_word((__be32 *)hdr) = ++ htonl(0x60000000 | (tclass << 20)) | flowlabel; + } + + static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr) + { +- return *(__be32 *)hdr & IPV6_FLOWINFO_MASK; ++ return net_hdr_word((__be32 *)hdr) & IPV6_FLOWINFO_MASK; + } + + static inline __be32 ip6_flowlabel(const struct ipv6hdr *hdr) + { +- return *(__be32 *)hdr & IPV6_FLOWLABEL_MASK; ++ return net_hdr_word((__be32 *)hdr) & IPV6_FLOWLABEL_MASK; + } + + static inline u8 ip6_tclass(__be32 flowinfo) +--- a/include/net/secure_seq.h ++++ b/include/net/secure_seq.h +@@ -3,6 +3,7 @@ + #define _NET_SECURE_SEQ + + #include ++#include + + u64 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); + u64 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, +--- a/include/uapi/linux/in.h ++++ b/include/uapi/linux/in.h +@@ -88,7 +88,7 @@ enum { + /* Internet address. */ + struct in_addr { + __be32 s_addr; +-}; ++} __attribute__((packed, aligned(2))); + #endif + + #define IP_TOS 1 +--- a/net/ipv6/ip6_fib.c ++++ b/net/ipv6/ip6_fib.c +@@ -141,7 +141,7 @@ static __be32 addr_bit_set(const void *t + * See include/asm-generic/bitops/le.h. + */ + return (__force __be32)(1 << ((~fn_bit ^ BITOP_BE32_SWIZZLE) & 0x1f)) & +- addr[fn_bit >> 5]; ++ net_hdr_word(&addr[fn_bit >> 5]); + } + + struct fib6_info *fib6_info_alloc(gfp_t gfp_flags, bool with_fib6_nh) +--- a/net/netfilter/nf_conntrack_proto_tcp.c ++++ b/net/netfilter/nf_conntrack_proto_tcp.c +@@ -400,7 +400,7 @@ static void tcp_sack(const struct sk_buf + + /* Fast path for timestamp-only option */ + if (length == TCPOLEN_TSTAMP_ALIGNED +- && *(__be32 *)ptr == htonl((TCPOPT_NOP << 24) ++ && net_hdr_word(ptr) == htonl((TCPOPT_NOP << 24) + | (TCPOPT_NOP << 16) + | (TCPOPT_TIMESTAMP << 8) + | TCPOLEN_TIMESTAMP)) +--- a/net/xfrm/xfrm_input.c ++++ b/net/xfrm/xfrm_input.c +@@ -167,8 +167,8 @@ int xfrm_parse_spi(struct sk_buff *skb, + if (!pskb_may_pull(skb, hlen)) + return -EINVAL; + +- *spi = *(__be32 *)(skb_transport_header(skb) + offset); +- *seq = *(__be32 *)(skb_transport_header(skb) + offset_seq); ++ *spi = net_hdr_word(skb_transport_header(skb) + offset); ++ *seq = net_hdr_word(skb_transport_header(skb) + offset_seq); + return 0; + } + EXPORT_SYMBOL(xfrm_parse_spi); +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -4158,14 +4158,16 @@ static bool tcp_parse_aligned_timestamp( + { + const __be32 *ptr = (const __be32 *)(th + 1); + +- if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) +- | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { ++ if (net_hdr_word(ptr) == ++ htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | ++ (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { + tp->rx_opt.saw_tstamp = 1; + ++ptr; +- tp->rx_opt.rcv_tsval = ntohl(*ptr); ++ tp->rx_opt.rcv_tsval = get_unaligned_be32(ptr); + ++ptr; +- if (*ptr) +- tp->rx_opt.rcv_tsecr = ntohl(*ptr) - tp->tsoffset; ++ if (net_hdr_word(ptr)) ++ tp->rx_opt.rcv_tsecr = get_unaligned_be32(ptr) - ++ tp->tsoffset; + else + tp->rx_opt.rcv_tsecr = 0; + return true; +--- a/include/uapi/linux/if_pppox.h ++++ b/include/uapi/linux/if_pppox.h +@@ -51,6 +51,7 @@ struct pppoe_addr { + */ + struct pptp_addr { + __u16 call_id; ++ __u16 pad; + struct in_addr sin_addr; + }; + +--- a/include/net/neighbour.h ++++ b/include/net/neighbour.h +@@ -270,8 +270,10 @@ static inline bool neigh_key_eq128(const + const u32 *n32 = (const u32 *)n->primary_key; + const u32 *p32 = pkey; + +- return ((n32[0] ^ p32[0]) | (n32[1] ^ p32[1]) | +- (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0; ++ return ((n32[0] ^ net_hdr_word(&p32[0])) | ++ (n32[1] ^ net_hdr_word(&p32[1])) | ++ (n32[2] ^ net_hdr_word(&p32[2])) | ++ (n32[3] ^ net_hdr_word(&p32[3]))) == 0; + } + + static inline struct neighbour *___neigh_lookup_noref( +--- a/include/uapi/linux/netfilter_arp/arp_tables.h ++++ b/include/uapi/linux/netfilter_arp/arp_tables.h +@@ -70,7 +70,7 @@ struct arpt_arp { + __u8 flags; + /* Inverse flags */ + __u16 invflags; +-}; ++} __attribute__((aligned(4))); + + /* Values for "flag" field in struct arpt_ip (general arp structure). + * No flags defined yet. +--- a/net/core/utils.c ++++ b/net/core/utils.c +@@ -460,8 +460,14 @@ void inet_proto_csum_replace16(__sum16 * + bool pseudohdr) + { + __be32 diff[] = { +- ~from[0], ~from[1], ~from[2], ~from[3], +- to[0], to[1], to[2], to[3], ++ ~net_hdr_word(&from[0]), ++ ~net_hdr_word(&from[1]), ++ ~net_hdr_word(&from[2]), ++ ~net_hdr_word(&from[3]), ++ net_hdr_word(&to[0]), ++ net_hdr_word(&to[1]), ++ net_hdr_word(&to[2]), ++ net_hdr_word(&to[3]), + }; + if (skb->ip_summed != CHECKSUM_PARTIAL) { + *sum = csum_fold(csum_partial(diff, sizeof(diff), +--- a/include/linux/etherdevice.h ++++ b/include/linux/etherdevice.h +@@ -525,7 +525,7 @@ static inline bool is_etherdev_addr(cons + * @b: Pointer to Ethernet header + * + * Compare two Ethernet headers, returns 0 if equal. +- * This assumes that the network header (i.e., IP header) is 4-byte ++ * This assumes that the network header (i.e., IP header) is 2-byte + * aligned OR the platform can handle unaligned access. This is the + * case for all packets coming into netif_receive_skb or similar + * entry points. +@@ -548,11 +548,12 @@ static inline unsigned long compare_ethe + fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6); + return fold; + #else +- u32 *a32 = (u32 *)((u8 *)a + 2); +- u32 *b32 = (u32 *)((u8 *)b + 2); ++ const u16 *a16 = a; ++ const u16 *b16 = b; + +- return (*(u16 *)a ^ *(u16 *)b) | (a32[0] ^ b32[0]) | +- (a32[1] ^ b32[1]) | (a32[2] ^ b32[2]); ++ return (a16[0] ^ b16[0]) | (a16[1] ^ b16[1]) | (a16[2] ^ b16[2]) | ++ (a16[3] ^ b16[3]) | (a16[4] ^ b16[4]) | (a16[5] ^ b16[5]) | ++ (a16[6] ^ b16[6]); + #endif + } + +--- a/net/ipv4/tcp_offload.c ++++ b/net/ipv4/tcp_offload.c +@@ -223,7 +223,7 @@ struct sk_buff *tcp_gro_receive(struct l + + th2 = tcp_hdr(p); + +- if (*(u32 *)&th->source ^ *(u32 *)&th2->source) { ++ if (net_hdr_word(&th->source) ^ net_hdr_word(&th2->source)) { + NAPI_GRO_CB(p)->same_flow = 0; + continue; + } +@@ -241,8 +241,8 @@ found: + ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH)); + flush |= (__force int)(th->ack_seq ^ th2->ack_seq); + for (i = sizeof(*th); i < thlen; i += 4) +- flush |= *(u32 *)((u8 *)th + i) ^ +- *(u32 *)((u8 *)th2 + i); ++ flush |= net_hdr_word((u8 *)th + i) ^ ++ net_hdr_word((u8 *)th2 + i); + + /* When we receive our second frame we can made a decision on if we + * continue this flow as an atomic flow with a fixed ID or if we use +--- a/net/ipv6/netfilter/ip6table_mangle.c ++++ b/net/ipv6/netfilter/ip6table_mangle.c +@@ -44,7 +44,7 @@ ip6t_mangle_out(struct sk_buff *skb, con + hop_limit = ipv6_hdr(skb)->hop_limit; + + /* flowlabel and prio (includes version, which shouldn't change either */ +- flowlabel = *((u_int32_t *)ipv6_hdr(skb)); ++ flowlabel = net_hdr_word(ipv6_hdr(skb)); + + ret = ip6t_do_table(skb, state, priv); + +@@ -53,7 +53,7 @@ ip6t_mangle_out(struct sk_buff *skb, con + !ipv6_addr_equal(&ipv6_hdr(skb)->daddr, &daddr) || + skb->mark != mark || + ipv6_hdr(skb)->hop_limit != hop_limit || +- flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) { ++ flowlabel != net_hdr_word(ipv6_hdr(skb)))) { + err = ip6_route_me_harder(state->net, state->sk, skb); + if (err < 0) + ret = NF_DROP_ERR(err); diff --git a/target/linux/ath79/patches-6.1/910-mikrotik-rb4xx.patch b/target/linux/ath79/patches-6.1/910-mikrotik-rb4xx.patch new file mode 100644 index 00000000000..4743ad46e25 --- /dev/null +++ b/target/linux/ath79/patches-6.1/910-mikrotik-rb4xx.patch @@ -0,0 +1,121 @@ +From: Christopher Hill +Subject: [PATCH] ath79: add Mikrotik rb4xx series drivers + +This adds 3 Mikrotik rb4xx series drivers as follows: + +rb4xx-cpld: This is in the mfd subsystem, and is the parent CPLD device +that interfaces between the SoC SPI bus and its two children below. +rb4xx-gpio: This is the GPIO expander. +rb4xx-nand: This is the NAND driver. + +The history of this code comes in three phases. + +1. The first is a May 2015 attempt to push the equivalient ar71xx rb4xx +drivers upstream. See https://lore.kernel.org/patchwork/patch/940880/. + +Module-author: Gabor Juhos +Module-author: Imre Kaloz +Module-author: Bert Vermeulen + +2. Next several ar71xx patches were applied bringing the code current. + +commit 7bbf4117c6fe4b764d9d7c62fb2bcf6dd93bff2c +Submitted-by: Hauke Mehrtens + +commit af79fdbe4af32a287798b579141204bda056b8aa +commit 889272d92db689fd9c910243635e44c9d8323095 +commit e21cb649a235180563363b8af5ba8296b9ac0baa +commit 7c09fa4a7492ca436f2c94bd9a465b7c5bbeed6f +Submitted-by: Felix Fietkau + +3. Finally a heavy refactor to split the driver into the three new +subsystems, and updated to work with the device tree configuration, plus +updates and review feedback incorporated + +Reviewed-by: Thibaut VARÈNE +Submitted-by: Christopher Hill +--- + drivers/mfd/Kconfig | 8 ++++++++ + drivers/mfd/Makefile | 1 + + drivers/gpio/Kconfig | 6 ++++++ + drivers/gpio/Makefile | 1 + + drivers/mtd/nand/raw/Kconfig | 7 +++++++ + drivers/mtd/nand/raw/Makefile | 1 + + 6 files changed, 24 insertions(+) + +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -2176,6 +2176,14 @@ config RAVE_SP_CORE + Select this to get support for the Supervisory Processor + device found on several devices in RAVE line of hardware. + ++config MFD_RB4XX_CPLD ++ tristate "CPLD driver for Mikrotik RB4xx series boards" ++ select MFD_CORE ++ depends on ATH79 || COMPILE_TEST ++ help ++ Enables support for the CPLD chip (NAND & GPIO) on Mikrotik ++ Routerboard RB4xx series. ++ + config SGI_MFD_IOC3 + bool "SGI IOC3 core driver" + depends on PCI && MIPS && 64BIT +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -267,6 +267,7 @@ obj-$(CONFIG_MFD_KHADAS_MCU) += khadas- + obj-$(CONFIG_MFD_ACER_A500_EC) += acer-ec-a500.o + obj-$(CONFIG_MFD_QCOM_PM8008) += qcom-pm8008.o + ++obj-$(CONFIG_MFD_RB4XX_CPLD) += rb4xx-cpld.o + obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o + obj-$(CONFIG_MFD_SIMPLE_MFD_I2C) += simple-mfd-i2c.o + obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -1574,6 +1574,12 @@ config GPIO_SODAVILLE + help + Say Y here to support Intel Sodaville GPIO. + ++config GPIO_RB4XX ++ tristate "GPIO expander for Mikrotik RB4xx series boards" ++ depends on MFD_RB4XX_CPLD ++ help ++ GPIO driver for Mikrotik Routerboard RB4xx series. ++ + endmenu + + menu "SPI GPIO expanders" +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -122,6 +122,7 @@ obj-$(CONFIG_GPIO_PL061) += gpio-pl061. + obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio-pmic-eic-sprd.o + obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o + obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o ++obj-$(CONFIG_GPIO_RB4XX) += gpio-rb4xx.o + obj-$(CONFIG_GPIO_RC5T583) += gpio-rc5t583.o + obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o + obj-$(CONFIG_GPIO_RDA) += gpio-rda.o +--- a/drivers/mtd/nand/raw/Kconfig ++++ b/drivers/mtd/nand/raw/Kconfig +@@ -563,4 +563,11 @@ config MTD_NAND_AR934X + Enables support for NAND controller on Qualcomm Atheros SoCs. + This controller is found on AR934x and QCA955x SoCs. + ++config MTD_NAND_RB4XX ++ tristate "Support for NAND driver for Mikrotik RB4xx series boards" ++ depends on MFD_RB4XX_CPLD ++ help ++ Enables support for the NAND flash chip on Mikrotik Routerboard ++ RB4xx series. ++ + endif # MTD_RAW_NAND +--- a/drivers/mtd/nand/raw/Makefile ++++ b/drivers/mtd/nand/raw/Makefile +@@ -59,6 +59,7 @@ obj-$(CONFIG_MTD_NAND_INTEL_LGM) += inte + obj-$(CONFIG_MTD_NAND_ROCKCHIP) += rockchip-nand-controller.o + obj-$(CONFIG_MTD_NAND_PL35X) += pl35x-nand-controller.o + obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o ++obj-$(CONFIG_MTD_NAND_RB4XX) += nand_rb4xx.o + + nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o + nand-objs += nand_onfi.o diff --git a/target/linux/ath79/patches-6.1/911-mikrotik-rb91x.patch b/target/linux/ath79/patches-6.1/911-mikrotik-rb91x.patch new file mode 100644 index 00000000000..94967bf674c --- /dev/null +++ b/target/linux/ath79/patches-6.1/911-mikrotik-rb91x.patch @@ -0,0 +1,97 @@ +From: Denis Kalashnikov +Subject: [PATCH] ath79: add support for reset key on MikroTik RB912UAG-2HPnD + +On MikroTik RB91x board series a reset key shares SoC gpio +line #15 with NAND ALE and NAND IO7. So we need a custom +gpio driver to manage this non-trivial connection schema. +Also rb91x-nand needs to have an ability to disable a polling +of the key while it works with NAND. + +While we've been integrating rb91x-key into a firmware, we've +figured out that: +* In the gpio-latch driver we need to add a "cansleep" suffix to +several gpiolib calls, +* When gpio-latch and rb91x-nand fail to get a gpio and an error +is -EPROBE_DEFER, they shouldn't report about this, since this +actually is not an error and occurs when the gpio-latch probe +function is called before the rb91x-key probe. +We fix these related things here too. + +Submitted-by: Denis Kalashnikov +Reviewed-by: Sergey Ryazanov +Tested-by: Koen Vandeputte +--- + drivers/gpio/Kconfig | 11 +++++++++++ + drivers/gpio/Makefile | 2 ++ + drivers/mtd/nand/raw/Kconfig | 6 ++++++ + drivers/mtd/nand/raw/Makefile | 1 + + 7 files changed, 20 insertions(+) + +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -353,6 +353,13 @@ config GPIO_IXP4XX + IXP4xx series of chips. + + If unsure, say N. ++ ++config GPIO_LATCH ++ tristate "MikroTik RouterBOARD GPIO latch support" ++ depends on ATH79 ++ help ++ GPIO driver for latch on some MikroTik RouterBOARDs. ++ + config GPIO_LOGICVC + tristate "Xylon LogiCVC GPIO support" + depends on MFD_SYSCON && OF +@@ -529,6 +536,10 @@ config GPIO_ROCKCHIP + help + Say yes here to support GPIO on Rockchip SoCs. + ++config GPIO_RB91X_KEY ++ tristate "MikroTik RB91x board series reset key support" ++ depends on ATH79 ++ + config GPIO_SAMA5D2_PIOBU + tristate "SAMA5D2 PIOBU GPIO support" + depends on MFD_SYSCON +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -75,6 +75,7 @@ obj-$(CONFIG_GPIO_IT87) += gpio-it87.o + obj-$(CONFIG_GPIO_IXP4XX) += gpio-ixp4xx.o + obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o + obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o ++obj-$(CONFIG_GPIO_LATCH) += gpio-latch.o + obj-$(CONFIG_GPIO_LOGICVC) += gpio-logicvc.o + obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o + obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o +@@ -123,6 +124,7 @@ obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio + obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o + obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o + obj-$(CONFIG_GPIO_RB4XX) += gpio-rb4xx.o ++obj-$(CONFIG_GPIO_RB91X_KEY) += gpio-rb91x-key.o + obj-$(CONFIG_GPIO_RC5T583) += gpio-rc5t583.o + obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o + obj-$(CONFIG_GPIO_RDA) += gpio-rda.o +--- a/drivers/mtd/nand/raw/Kconfig ++++ b/drivers/mtd/nand/raw/Kconfig +@@ -570,4 +570,10 @@ config MTD_NAND_RB4XX + Enables support for the NAND flash chip on Mikrotik Routerboard + RB4xx series. + ++config MTD_NAND_RB91X ++ tristate "MikroTik RB91x NAND driver support" ++ depends on ATH79 && MTD_RAW_NAND ++ help ++ Enables support for the NAND flash chip on MikroTik RB91x series. ++ + endif # MTD_RAW_NAND +--- a/drivers/mtd/nand/raw/Makefile ++++ b/drivers/mtd/nand/raw/Makefile +@@ -60,6 +60,7 @@ obj-$(CONFIG_MTD_NAND_ROCKCHIP) += rock + obj-$(CONFIG_MTD_NAND_PL35X) += pl35x-nand-controller.o + obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o + obj-$(CONFIG_MTD_NAND_RB4XX) += nand_rb4xx.o ++obj-$(CONFIG_MTD_NAND_RB91X) += rb91x_nand.o + + nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o + nand-objs += nand_onfi.o From 5f59d28bc3434d5b582310579096fa839f86e1df Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 31 May 2023 11:14:04 +0800 Subject: [PATCH 04/32] ath79: refresh patches and configs to introduce kernel 6.1 support All kernel configs are refreshed by 'make kernel_oldconfig CONFIG_TARGET=target' and 'make kernel_oldconfig CONFIG_TARGET=subtarget'. upstreamed patches: 010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch 011-v5.17-spi-ar934x-fix-transfer-size.patch 020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch 030-v5.18-ath79-add-support-for-booting-QCN550x.patch build and run tested on: ath79/generic/ar7241 ath79/generic/qca9563 ath79/nand/ar9344 Signed-off-by: Shiji Yang --- target/linux/ath79/Makefile | 1 + target/linux/ath79/config-6.1 | 19 ++++- target/linux/ath79/mikrotik/config-default | 1 + target/linux/ath79/nand/config-default | 1 + ...-ar934x-fix-transfer-and-word-delays.patch | 27 ------ ...1-v5.17-spi-ar934x-fix-transfer-size.patch | 62 -------------- ...th79-Implement-the-spi_mem-interface.patch | 68 --------------- ...th79-add-support-for-booting-QCN550x.patch | 48 ----------- .../340-register_gpio_driver_earlier.patch | 2 +- .../370-MIPS-ath79-sanitize-symbols.patch | 2 +- ...or-support-mtd-name-from-device-tree.patch | 19 ++--- .../410-mtd-cybertan-trx-parser.patch | 4 +- .../430-mtd-ar934x-nand-driver.patch | 6 +- ...701-usb-add-more-OF-quirk-properties.patch | 2 +- ...ds-add-reset-controller-based-driver.patch | 8 +- .../900-unaligned_access_hacks.patch | 82 +++++++++---------- .../patches-6.1/910-mikrotik-rb4xx.patch | 14 ++-- .../patches-6.1/911-mikrotik-rb91x.patch | 17 ++-- 18 files changed, 95 insertions(+), 288 deletions(-) delete mode 100644 target/linux/ath79/patches-6.1/010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch delete mode 100644 target/linux/ath79/patches-6.1/011-v5.17-spi-ar934x-fix-transfer-size.patch delete mode 100644 target/linux/ath79/patches-6.1/020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch delete mode 100644 target/linux/ath79/patches-6.1/030-v5.18-ath79-add-support-for-booting-QCN550x.patch diff --git a/target/linux/ath79/Makefile b/target/linux/ath79/Makefile index d6ba3b0eada..f7bb31c4ad8 100644 --- a/target/linux/ath79/Makefile +++ b/target/linux/ath79/Makefile @@ -9,6 +9,7 @@ SUBTARGETS:=generic mikrotik nand tiny FEATURES:=ramdisk squashfs usbgadget KERNEL_PATCHVER:=5.15 +KERNEL_TESTING_PATCHVER:=6.1 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/ath79/config-6.1 b/target/linux/ath79/config-6.1 index 5b1b0d5add6..e3119f99a15 100644 --- a/target/linux/ath79/config-6.1 +++ b/target/linux/ath79/config-6.1 @@ -13,12 +13,15 @@ CONFIG_AT803X_PHY=y CONFIG_ATH79=y CONFIG_ATH79_WDT=y CONFIG_BLK_MQ_PCI=y +CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" +CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CEVT_R4K=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="rootfstype=squashfs,jffs2" CONFIG_CMDLINE_BOOL=y # CONFIG_CMDLINE_OVERRIDE is not set CONFIG_COMMON_CLK=y +CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 CONFIG_COMPAT_32BIT_TIME=y CONFIG_CPU_BIG_ENDIAN=y CONFIG_CPU_GENERIC_DUMP_TLB=y @@ -36,24 +39,28 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y CONFIG_CPU_SUPPORTS_MSA=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2 +CONFIG_CRYPTO_LIB_SHA1=y +CONFIG_CRYPTO_LIB_UTILS=y CONFIG_CRYPTO_RNG2=y CONFIG_CSRC_R4K=y +CONFIG_DEBUG_INFO=y CONFIG_DMA_NONCOHERENT=y CONFIG_DTC=y CONFIG_EARLY_PRINTK=y CONFIG_ETHERNET_PACKET_MANGLE=y +CONFIG_EXCLUSIVE_SYSTEM_RAM=y CONFIG_FIXED_PHY=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_FW_LOADER_SYSFS=y +CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_FIND_FIRST_BIT=y CONFIG_GENERIC_GETTIMEOFDAY=y CONFIG_GENERIC_IOMAP=y CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_LIB_ASHLDI3=y CONFIG_GENERIC_LIB_ASHRDI3=y @@ -75,7 +82,6 @@ CONFIG_GPIO_CDEV=y CONFIG_GPIO_GENERIC=y # CONFIG_GPIO_LATCH is not set # CONFIG_GPIO_RB91X_KEY is not set -CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y @@ -107,7 +113,6 @@ CONFIG_MIPS_CLOCK_VSYSCALL=y # CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set # CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set CONFIG_MIPS_CMDLINE_FROM_DTB=y -CONFIG_MIPS_EBPF_JIT=y CONFIG_MIPS_L1_CACHE_SHIFT=5 CONFIG_MIPS_LD_CAN_LINK_VDSO=y # CONFIG_MIPS_NO_APPENDED_DTB is not set @@ -145,6 +150,9 @@ CONFIG_OF_GPIO=y CONFIG_OF_IRQ=y CONFIG_OF_KOBJ=y CONFIG_OF_MDIO=y +CONFIG_PAGE_POOL=y +CONFIG_PAGE_SIZE_LESS_THAN_256KB=y +CONFIG_PAGE_SIZE_LESS_THAN_64KB=y CONFIG_PCI=y CONFIG_PCI_AR71XX=y CONFIG_PCI_AR724X=y @@ -158,7 +166,9 @@ CONFIG_PHYLIB=y # CONFIG_PHY_AR7200_USB is not set # CONFIG_PHY_ATH79_USB is not set CONFIG_PINCTRL=y +CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y CONFIG_REGMAP=y CONFIG_REGMAP_MMIO=y @@ -198,3 +208,4 @@ CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TINY_SRCU=y CONFIG_USB_SUPPORT=y CONFIG_USE_OF=y +CONFIG_ZBOOT_LOAD_ADDRESS=0x0 diff --git a/target/linux/ath79/mikrotik/config-default b/target/linux/ath79/mikrotik/config-default index 2ff08cec2bd..a231188c835 100644 --- a/target/linux/ath79/mikrotik/config-default +++ b/target/linux/ath79/mikrotik/config-default @@ -45,5 +45,6 @@ CONFIG_WATCHDOG_CORE=y CONFIG_XXHASH=y CONFIG_ZLIB_DEFLATE=y CONFIG_ZLIB_INFLATE=y +CONFIG_ZSTD_COMMON=y CONFIG_ZSTD_COMPRESS=y CONFIG_ZSTD_DECOMPRESS=y diff --git a/target/linux/ath79/nand/config-default b/target/linux/ath79/nand/config-default index 730d38e1dfe..ab01a28b019 100644 --- a/target/linux/ath79/nand/config-default +++ b/target/linux/ath79/nand/config-default @@ -25,5 +25,6 @@ CONFIG_UBIFS_FS=y CONFIG_XXHASH=y CONFIG_ZLIB_DEFLATE=y CONFIG_ZLIB_INFLATE=y +CONFIG_ZSTD_COMMON=y CONFIG_ZSTD_COMPRESS=y CONFIG_ZSTD_DECOMPRESS=y diff --git a/target/linux/ath79/patches-6.1/010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch b/target/linux/ath79/patches-6.1/010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch deleted file mode 100644 index 7ce6df6d7bd..00000000000 --- a/target/linux/ath79/patches-6.1/010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch +++ /dev/null @@ -1,27 +0,0 @@ -From c70282457c380db7deb57c81a6894debc8f88efa Mon Sep 17 00:00:00 2001 -From: Oskari Lemmela -Date: Wed, 22 Dec 2021 07:59:58 +0200 -Subject: [PATCH] spi: ar934x: fix transfer and word delays - -Add missing delay between transferred messages and words. - -Signed-off-by: Oskari Lemmela -Link: https://lore.kernel.org/r/20211222055958.1383233-3-oskari@lemmela.net -Signed-off-by: Mark Brown ---- - drivers/spi/spi-ar934x.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/spi/spi-ar934x.c -+++ b/drivers/spi/spi-ar934x.c -@@ -137,8 +137,10 @@ static int ar934x_spi_transfer_one_messa - reg >>= 8; - } - } -+ spi_delay_exec(&t->word_delay, t); - } - m->actual_length += t->len; -+ spi_transfer_delay_exec(t); - } - - msg_done: diff --git a/target/linux/ath79/patches-6.1/011-v5.17-spi-ar934x-fix-transfer-size.patch b/target/linux/ath79/patches-6.1/011-v5.17-spi-ar934x-fix-transfer-size.patch deleted file mode 100644 index 87f5da2c60e..00000000000 --- a/target/linux/ath79/patches-6.1/011-v5.17-spi-ar934x-fix-transfer-size.patch +++ /dev/null @@ -1,62 +0,0 @@ -From ebe33e5a98dcf14a9630845f3f10c193584ac054 Mon Sep 17 00:00:00 2001 -From: Oskari Lemmela -Date: Wed, 22 Dec 2021 07:59:57 +0200 -Subject: [PATCH] spi: ar934x: fix transfer size - -If bits_per_word is configured, transfer only word amount -of data per iteration. - -Signed-off-by: Oskari Lemmela -Link: https://lore.kernel.org/r/20211222055958.1383233-2-oskari@lemmela.net -Signed-off-by: Mark Brown ---- - drivers/spi/spi-ar934x.c | 16 +++++++++++----- - 1 file changed, 11 insertions(+), 5 deletions(-) - ---- a/drivers/spi/spi-ar934x.c -+++ b/drivers/spi/spi-ar934x.c -@@ -82,7 +82,7 @@ static int ar934x_spi_transfer_one_messa - struct spi_device *spi = m->spi; - unsigned long trx_done, trx_cur; - int stat = 0; -- u8 term = 0; -+ u8 bpw, term = 0; - int div, i; - u32 reg; - const u8 *tx_buf; -@@ -90,6 +90,11 @@ static int ar934x_spi_transfer_one_messa - - m->actual_length = 0; - list_for_each_entry(t, &m->transfers, transfer_list) { -+ if (t->bits_per_word >= 8 && t->bits_per_word < 32) -+ bpw = t->bits_per_word >> 3; -+ else -+ bpw = 4; -+ - if (t->speed_hz) - div = ar934x_spi_clk_div(sp, t->speed_hz); - else -@@ -105,10 +110,10 @@ static int ar934x_spi_transfer_one_messa - iowrite32(reg, sp->base + AR934X_SPI_REG_CTRL); - iowrite32(0, sp->base + AR934X_SPI_DATAOUT); - -- for (trx_done = 0; trx_done < t->len; trx_done += 4) { -+ for (trx_done = 0; trx_done < t->len; trx_done += bpw) { - trx_cur = t->len - trx_done; -- if (trx_cur > 4) -- trx_cur = 4; -+ if (trx_cur > bpw) -+ trx_cur = bpw; - else if (list_is_last(&t->transfer_list, &m->transfers)) - term = 1; - -@@ -193,7 +198,8 @@ static int ar934x_spi_probe(struct platf - ctlr->mode_bits = SPI_LSB_FIRST; - ctlr->setup = ar934x_spi_setup; - ctlr->transfer_one_message = ar934x_spi_transfer_one_message; -- ctlr->bits_per_word_mask = SPI_BPW_MASK(8); -+ ctlr->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(24) | -+ SPI_BPW_MASK(16) | SPI_BPW_MASK(8); - ctlr->dev.of_node = pdev->dev.of_node; - ctlr->num_chipselect = 3; - diff --git a/target/linux/ath79/patches-6.1/020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch b/target/linux/ath79/patches-6.1/020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch deleted file mode 100644 index 5746a889e8c..00000000000 --- a/target/linux/ath79/patches-6.1/020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 8d8cdb4a6ccee5b62cc0dc64651c3946364514dc Mon Sep 17 00:00:00 2001 -From: Luiz Angelo Daros de Luca -Date: Mon, 10 Feb 2020 16:11:27 -0300 -Subject: [PATCH] spi: ath79: Implement the spi_mem interface - -Signed-off-by: Luiz Angelo Daros de Luca ---- - drivers/spi/spi-ath79.c | 35 +++++++++++++++++++++++++++++++++++ - 1 file changed, 35 insertions(+) - ---- a/drivers/spi/spi-ath79.c -+++ b/drivers/spi/spi-ath79.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -133,6 +134,39 @@ static u32 ath79_spi_txrx_mode0(struct s - return ath79_spi_rr(sp, AR71XX_SPI_REG_RDS); - } - -+static int ath79_exec_mem_op(struct spi_mem *mem, -+ const struct spi_mem_op *op) -+{ -+ struct ath79_spi *sp = ath79_spidev_to_sp(mem->spi); -+ -+ /* Ensures that reading is performed on device connected -+ to hardware cs0 */ -+ if (mem->spi->chip_select || mem->spi->cs_gpiod) -+ return -ENOTSUPP; -+ -+ /* Only use for fast-read op. */ -+ if (op->cmd.opcode != 0x0b || op->data.dir != SPI_MEM_DATA_IN || -+ op->addr.nbytes != 3 || op->dummy.nbytes != 1) -+ return -ENOTSUPP; -+ -+ /* disable GPIO mode */ -+ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, 0); -+ -+ memcpy_fromio(op->data.buf.in, sp->base + op->addr.val, op->data.nbytes); -+ -+ /* enable GPIO mode */ -+ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO); -+ -+ /* restore IOC register */ -+ ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base); -+ -+ return 0; -+} -+ -+static const struct spi_controller_mem_ops ath79_mem_ops = { -+ .exec_op = ath79_exec_mem_op, -+}; -+ - static int ath79_spi_probe(struct platform_device *pdev) - { - struct spi_master *master; -@@ -165,6 +199,7 @@ static int ath79_spi_probe(struct platfo - ret = PTR_ERR(sp->base); - goto err_put_master; - } -+ master->mem_ops = &ath79_mem_ops; - - sp->clk = devm_clk_get(&pdev->dev, "ahb"); - if (IS_ERR(sp->clk)) { diff --git a/target/linux/ath79/patches-6.1/030-v5.18-ath79-add-support-for-booting-QCN550x.patch b/target/linux/ath79/patches-6.1/030-v5.18-ath79-add-support-for-booting-QCN550x.patch deleted file mode 100644 index 41ea5d2ef0a..00000000000 --- a/target/linux/ath79/patches-6.1/030-v5.18-ath79-add-support-for-booting-QCN550x.patch +++ /dev/null @@ -1,48 +0,0 @@ -From: Wenli Looi -Date: Sun, 20 Jun 2021 23:32:28 -0700 -Subject: [PATCH] ath79: add support for booting QCN550x - -Based on wikidevi, QCN550x is a "Dragonfly" like QCA9561 and QCA9563. -Treating it as QCA956x seems to work. -Tested on Netgear EX7300v2 which boots successfully with -the same CPU clock as the stock firmware. - -Link: https://wikidevi.wi-cat.ru/Qualcomm#bgn -Link: https://wikidevi.wi-cat.ru/Qualcomm_Atheros#.28a.29bgn_2 -Signed-off-by: Wenli Looi - ---- a/arch/mips/ath79/early_printk.c -+++ b/arch/mips/ath79/early_printk.c -@@ -121,6 +121,7 @@ static void prom_putchar_init(void) - case REV_ID_MAJOR_QCA9558: - case REV_ID_MAJOR_TP9343: - case REV_ID_MAJOR_QCA956X: -+ case REV_ID_MAJOR_QCN550X: - _prom_putchar = prom_putchar_ar71xx; - break; - ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -168,6 +168,12 @@ static void __init ath79_detect_sys_type - rev = id & QCA956X_REV_ID_REVISION_MASK; - break; - -+ case REV_ID_MAJOR_QCN550X: -+ ath79_soc = ATH79_SOC_QCA956X; -+ chip = "550X"; -+ rev = id & QCA956X_REV_ID_REVISION_MASK; -+ break; -+ - case REV_ID_MAJOR_TP9343: - ath79_soc = ATH79_SOC_TP9343; - chip = "9343"; ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -862,6 +862,7 @@ - #define REV_ID_MAJOR_QCA9558 0x1130 - #define REV_ID_MAJOR_TP9343 0x0150 - #define REV_ID_MAJOR_QCA956X 0x1150 -+#define REV_ID_MAJOR_QCN550X 0x2170 - - #define AR71XX_REV_ID_MINOR_MASK 0x3 - #define AR71XX_REV_ID_MINOR_AR7130 0x0 diff --git a/target/linux/ath79/patches-6.1/340-register_gpio_driver_earlier.patch b/target/linux/ath79/patches-6.1/340-register_gpio_driver_earlier.patch index a8680ceac4f..48ce7e1d715 100644 --- a/target/linux/ath79/patches-6.1/340-register_gpio_driver_earlier.patch +++ b/target/linux/ath79/patches-6.1/340-register_gpio_driver_earlier.patch @@ -11,7 +11,7 @@ Submitted-by: John Crispin --- a/drivers/gpio/gpio-ath79.c +++ b/drivers/gpio/gpio-ath79.c -@@ -297,7 +297,11 @@ static struct platform_driver ath79_gpio +@@ -301,7 +301,11 @@ static struct platform_driver ath79_gpio .probe = ath79_gpio_probe, }; diff --git a/target/linux/ath79/patches-6.1/370-MIPS-ath79-sanitize-symbols.patch b/target/linux/ath79/patches-6.1/370-MIPS-ath79-sanitize-symbols.patch index 5eb23ba6c65..67dc54725a9 100644 --- a/target/linux/ath79/patches-6.1/370-MIPS-ath79-sanitize-symbols.patch +++ b/target/linux/ath79/patches-6.1/370-MIPS-ath79-sanitize-symbols.patch @@ -82,7 +82,7 @@ Signed-off-by: John Crispin endif --- a/arch/mips/pci/Makefile +++ b/arch/mips/pci/Makefile -@@ -21,7 +21,7 @@ obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o +@@ -19,7 +19,7 @@ obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o ops-bcm63xx.o obj-$(CONFIG_MIPS_ALCHEMY) += pci-alchemy.o obj-$(CONFIG_PCI_AR2315) += pci-ar2315.o diff --git a/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch index 163bafdb2e5..2f83b23e809 100644 --- a/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch @@ -10,18 +10,17 @@ Signed-off-by: Abhimanyu Vishwakarma --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c -@@ -3107,6 +3107,7 @@ int spi_nor_scan(struct spi_nor *nor, co - struct device *dev = nor->dev; +@@ -2941,12 +2941,19 @@ static void spi_nor_set_mtd_info(struct + { struct mtd_info *mtd = &nor->mtd; - struct device_node *np = spi_nor_get_flash_node(nor); + struct device *dev = nor->dev; ++ struct device_node *np = spi_nor_get_flash_node(nor); + const char __maybe_unused *of_mtd_name = NULL; - int ret; - int i; -@@ -3161,7 +3162,12 @@ int spi_nor_scan(struct spi_nor *nor, co - if (ret) - return ret; + spi_nor_set_mtd_locking_ops(nor); + spi_nor_set_mtd_otp_ops(nor); + mtd->dev.parent = dev; - if (!mtd->name) +#ifdef CONFIG_MTD_OF_PARTS + of_property_read_string(np, "linux,mtd-name", &of_mtd_name); @@ -30,11 +29,11 @@ Signed-off-by: Abhimanyu Vishwakarma + mtd->name = of_mtd_name; + else if (!mtd->name) mtd->name = dev_name(dev); - mtd->priv = nor; mtd->type = MTD_NORFLASH; + mtd->flags = MTD_CAP_NORFLASH; --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -847,6 +847,17 @@ out_error: +@@ -840,6 +840,17 @@ out_error: */ static void mtd_set_dev_defaults(struct mtd_info *mtd) { diff --git a/target/linux/ath79/patches-6.1/410-mtd-cybertan-trx-parser.patch b/target/linux/ath79/patches-6.1/410-mtd-cybertan-trx-parser.patch index 4e8e536e294..d0e8aec0d5a 100644 --- a/target/linux/ath79/patches-6.1/410-mtd-cybertan-trx-parser.patch +++ b/target/linux/ath79/patches-6.1/410-mtd-cybertan-trx-parser.patch @@ -18,7 +18,7 @@ Submitted-by: Christian Lamparter --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -8,6 +8,7 @@ obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o +@@ -9,6 +9,7 @@ obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o ofpart-y += ofpart_core.o ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o @@ -28,7 +28,7 @@ Submitted-by: Christian Lamparter obj-$(CONFIG_MTD_PARSER_TPLINK_SAFELOADER) += tplink_safeloader.o --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -102,6 +102,14 @@ config MTD_OF_PARTS_LINKSYS_NS +@@ -112,6 +112,14 @@ config MTD_OF_PARTS_LINKSYS_NS two "firmware" partitions. Currently used firmware has to be detected using CFE environment variable. diff --git a/target/linux/ath79/patches-6.1/430-mtd-ar934x-nand-driver.patch b/target/linux/ath79/patches-6.1/430-mtd-ar934x-nand-driver.patch index 63bc98e14c1..184c39d469b 100644 --- a/target/linux/ath79/patches-6.1/430-mtd-ar934x-nand-driver.patch +++ b/target/linux/ath79/patches-6.1/430-mtd-ar934x-nand-driver.patch @@ -9,7 +9,7 @@ SVN-Revision: 33385 --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig -@@ -555,4 +555,12 @@ config MTD_NAND_DISKONCHIP_BBTWRITE +@@ -557,4 +557,12 @@ config MTD_NAND_DISKONCHIP_BBTWRITE load time (assuming you build diskonchip as a module) with the module parameter "inftl_bbt_write=1". @@ -24,10 +24,10 @@ SVN-Revision: 33385 endif # MTD_RAW_NAND --- a/drivers/mtd/nand/raw/Makefile +++ b/drivers/mtd/nand/raw/Makefile -@@ -58,6 +58,7 @@ obj-$(CONFIG_MTD_NAND_ARASAN) += arasan - obj-$(CONFIG_MTD_NAND_INTEL_LGM) += intel-nand-controller.o +@@ -59,6 +59,7 @@ obj-$(CONFIG_MTD_NAND_INTEL_LGM) += inte obj-$(CONFIG_MTD_NAND_ROCKCHIP) += rockchip-nand-controller.o obj-$(CONFIG_MTD_NAND_PL35X) += pl35x-nand-controller.o + obj-$(CONFIG_MTD_NAND_RENESAS) += renesas-nand-controller.o +obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o diff --git a/target/linux/ath79/patches-6.1/701-usb-add-more-OF-quirk-properties.patch b/target/linux/ath79/patches-6.1/701-usb-add-more-OF-quirk-properties.patch index d6d8cb69522..293a3598845 100644 --- a/target/linux/ath79/patches-6.1/701-usb-add-more-OF-quirk-properties.patch +++ b/target/linux/ath79/patches-6.1/701-usb-add-more-OF-quirk-properties.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c -@@ -277,6 +277,11 @@ static int ehci_platform_probe(struct pl +@@ -274,6 +274,11 @@ static int ehci_platform_probe(struct pl ehci = hcd_to_ehci(hcd); if (pdata == &ehci_platform_defaults && dev->dev.of_node) { diff --git a/target/linux/ath79/patches-6.1/800-leds-add-reset-controller-based-driver.patch b/target/linux/ath79/patches-6.1/800-leds-add-reset-controller-based-driver.patch index 7122756c526..18d5e149923 100644 --- a/target/linux/ath79/patches-6.1/800-leds-add-reset-controller-based-driver.patch +++ b/target/linux/ath79/patches-6.1/800-leds-add-reset-controller-based-driver.patch @@ -13,9 +13,9 @@ Signed-off-by: John Crispin --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig -@@ -876,6 +876,17 @@ source "drivers/leds/blink/Kconfig" - comment "Flash and Torch LED drivers" - source "drivers/leds/flash/Kconfig" +@@ -872,6 +872,17 @@ source "drivers/leds/flash/Kconfig" + comment "RGB LED drivers" + source "drivers/leds/rgb/Kconfig" +config LEDS_RESET + tristate "LED support for reset-controller API" @@ -176,7 +176,7 @@ Signed-off-by: John Crispin +MODULE_ALIAS("platform:leds-reset"); --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile -@@ -87,6 +87,7 @@ obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds +@@ -86,6 +86,7 @@ obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o diff --git a/target/linux/ath79/patches-6.1/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.1/900-unaligned_access_hacks.patch index 1971b9cd010..6e4b2848c83 100644 --- a/target/linux/ath79/patches-6.1/900-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-6.1/900-unaligned_access_hacks.patch @@ -86,7 +86,7 @@ SVN-Revision: 35130 } while (word != stop); return csum_fold(csum); -@@ -182,73 +186,6 @@ static inline __sum16 ip_compute_csum(co +@@ -179,73 +183,6 @@ static inline __sum16 ip_compute_csum(co return csum_fold(csum_partial(buff, len, 0)); } @@ -258,7 +258,7 @@ SVN-Revision: 35130 #include #include #include -@@ -944,10 +945,10 @@ static void tcp_v6_send_response(const s +@@ -901,10 +902,10 @@ static void tcp_v6_send_response(const s topt = (__be32 *)(t1 + 1); if (tsecr) { @@ -285,7 +285,7 @@ SVN-Revision: 35130 */ --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c -@@ -492,7 +492,7 @@ int ipv6_recv_error(struct sock *sk, str +@@ -497,7 +497,7 @@ int ipv6_recv_error(struct sock *sk, str ipv6_iface_scope_id(&sin->sin6_addr, IP6CB(skb)->iif); } else { @@ -294,7 +294,7 @@ SVN-Revision: 35130 &sin->sin6_addr); sin->sin6_scope_id = 0; } -@@ -846,12 +846,12 @@ int ip6_datagram_send_ctl(struct net *ne +@@ -851,12 +851,12 @@ int ip6_datagram_send_ctl(struct net *ne } if (fl6->flowlabel&IPV6_FLOWINFO_MASK) { @@ -311,18 +311,18 @@ SVN-Revision: 35130 case IPV6_2292HOPOPTS: --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c -@@ -1002,7 +1002,7 @@ static bool ipv6_hop_jumbo(struct sk_buf +@@ -1003,7 +1003,7 @@ static bool ipv6_hop_jumbo(struct sk_buf goto drop; } - pkt_len = ntohl(*(__be32 *)(nh + optoff + 2)); + pkt_len = ntohl(net_hdr_word(nh + optoff + 2)); if (pkt_len <= IPV6_MAXPLEN) { - __IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS); - icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2); + icmpv6_param_prob_reason(skb, ICMPV6_HDR_FIELD, optoff + 2, + SKB_DROP_REASON_IP_INHDR); --- a/include/linux/types.h +++ b/include/linux/types.h -@@ -231,5 +231,11 @@ typedef void (*swap_func_t)(void *a, voi +@@ -232,5 +232,11 @@ typedef void (*swap_func_t)(void *a, voi typedef int (*cmp_r_func_t)(const void *a, const void *b, const void *priv); typedef int (*cmp_func_t)(const void *a, const void *b); @@ -336,9 +336,9 @@ SVN-Revision: 35130 #endif /* _LINUX_TYPES_H */ --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c -@@ -1477,8 +1477,8 @@ struct sk_buff *inet_gro_receive(struct +@@ -1488,8 +1488,8 @@ struct sk_buff *inet_gro_receive(struct if (unlikely(ip_fast_csum((u8 *)iph, 5))) - goto out_unlock; + goto out; - id = ntohl(*(__be32 *)&iph->id); - flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) | (id & ~IP_DF)); @@ -349,7 +349,7 @@ SVN-Revision: 35130 list_for_each_entry(p, head, list) { --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -610,48 +610,53 @@ static void tcp_options_write(__be32 *pt +@@ -611,48 +611,53 @@ static void tcp_options_write(struct tcp u16 options = opts->options; /* mungable copy */ if (unlikely(OPTION_MD5 & options)) { @@ -426,7 +426,7 @@ SVN-Revision: 35130 } if (unlikely(opts->num_sack_blocks)) { -@@ -659,16 +664,17 @@ static void tcp_options_write(__be32 *pt +@@ -660,16 +665,17 @@ static void tcp_options_write(struct tcp tp->duplicate_sack : tp->selective_acks; int this_sack; @@ -450,7 +450,7 @@ SVN-Revision: 35130 } tp->rx_opt.dsack = 0; -@@ -681,13 +687,14 @@ static void tcp_options_write(__be32 *pt +@@ -682,13 +688,14 @@ static void tcp_options_write(struct tcp if (foc->exp) { len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; @@ -482,7 +482,7 @@ SVN-Revision: 35130 @@ -49,7 +49,7 @@ struct igmpv3_grec { __be16 grec_nsrcs; __be32 grec_mca; - __be32 grec_src[0]; + __be32 grec_src[]; -}; +} __attribute__((packed, aligned(2))); @@ -491,7 +491,7 @@ SVN-Revision: 35130 @@ -58,7 +58,7 @@ struct igmpv3_report { __be16 resv2; __be16 ngrec; - struct igmpv3_grec grec[0]; + struct igmpv3_grec grec[]; -}; +} __attribute__((packed, aligned(2))); @@ -500,7 +500,7 @@ SVN-Revision: 35130 @@ -79,7 +79,7 @@ struct igmpv3_query { __u8 qqic; __be16 nsrcs; - __be32 srcs[0]; + __be32 srcs[]; -}; +} __attribute__((packed, aligned(2))); @@ -508,7 +508,7 @@ SVN-Revision: 35130 #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c -@@ -129,7 +129,7 @@ __be32 __skb_flow_get_ports(const struct +@@ -131,7 +131,7 @@ __be32 __skb_flow_get_ports(const struct ports = __skb_header_pointer(skb, thoff + poff, sizeof(_ports), data, hlen, &_ports); if (ports) @@ -578,7 +578,7 @@ SVN-Revision: 35130 goto next_ht; --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c -@@ -241,7 +241,7 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff * +@@ -259,7 +259,7 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff * continue; iph2 = (struct ipv6hdr *)(p->data + off); @@ -614,16 +614,16 @@ SVN-Revision: 35130 (__force __wsum)to); --- a/include/net/ipv6.h +++ b/include/net/ipv6.h -@@ -147,7 +147,7 @@ struct frag_hdr { +@@ -149,7 +149,7 @@ struct frag_hdr { __u8 reserved; __be16 frag_off; __be32 identification; -}; +} __attribute__((packed, aligned(2))); - #define IP6_MF 0x0001 - #define IP6_OFFSET 0xFFF8 -@@ -561,8 +561,8 @@ static inline void __ipv6_addr_set_half( + /* + * Jumbo payload option, as described in RFC 2675 2. +@@ -615,8 +615,8 @@ static inline void __ipv6_addr_set_half( } #endif #endif @@ -634,7 +634,7 @@ SVN-Revision: 35130 } static inline void ipv6_addr_set(struct in6_addr *addr, -@@ -621,6 +621,8 @@ static inline bool ipv6_prefix_equal(con +@@ -675,6 +675,8 @@ static inline bool ipv6_prefix_equal(con const __be32 *a1 = addr1->s6_addr32; const __be32 *a2 = addr2->s6_addr32; unsigned int pdw, pbi; @@ -643,7 +643,7 @@ SVN-Revision: 35130 /* check complete u32 in prefix */ pdw = prefixlen >> 5; -@@ -629,7 +631,9 @@ static inline bool ipv6_prefix_equal(con +@@ -683,7 +685,9 @@ static inline bool ipv6_prefix_equal(con /* check incomplete u32 in prefix */ pbi = prefixlen & 0x1f; @@ -654,7 +654,7 @@ SVN-Revision: 35130 return false; return true; -@@ -746,13 +750,13 @@ static inline void ipv6_addr_set_v4mappe +@@ -800,13 +804,13 @@ static inline void ipv6_addr_set_v4mappe */ static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen) { @@ -670,7 +670,7 @@ SVN-Revision: 35130 if (xb) return i * 32 + 31 - __fls(ntohl(xb)); } -@@ -946,17 +950,18 @@ static inline u32 ip6_multipath_hash_fie +@@ -1000,17 +1004,18 @@ static inline u32 ip6_multipath_hash_fie static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass, __be32 flowlabel) { @@ -700,11 +700,11 @@ SVN-Revision: 35130 #include +#include - u64 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); - u64 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, + struct net; + --- a/include/uapi/linux/in.h +++ b/include/uapi/linux/in.h -@@ -88,7 +88,7 @@ enum { +@@ -91,7 +91,7 @@ enum { /* Internet address. */ struct in_addr { __be32 s_addr; @@ -715,7 +715,7 @@ SVN-Revision: 35130 #define IP_TOS 1 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c -@@ -141,7 +141,7 @@ static __be32 addr_bit_set(const void *t +@@ -142,7 +142,7 @@ static __be32 addr_bit_set(const void *t * See include/asm-generic/bitops/le.h. */ return (__force __be32)(1 << ((~fn_bit ^ BITOP_BE32_SWIZZLE) & 0x1f)) & @@ -726,7 +726,7 @@ SVN-Revision: 35130 struct fib6_info *fib6_info_alloc(gfp_t gfp_flags, bool with_fib6_nh) --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c -@@ -400,7 +400,7 @@ static void tcp_sack(const struct sk_buf +@@ -406,7 +406,7 @@ static void tcp_sack(const struct sk_buf /* Fast path for timestamp-only option */ if (length == TCPOLEN_TSTAMP_ALIGNED @@ -737,7 +737,7 @@ SVN-Revision: 35130 | TCPOLEN_TIMESTAMP)) --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c -@@ -167,8 +167,8 @@ int xfrm_parse_spi(struct sk_buff *skb, +@@ -168,8 +168,8 @@ int xfrm_parse_spi(struct sk_buff *skb, if (!pskb_may_pull(skb, hlen)) return -EINVAL; @@ -750,7 +750,7 @@ SVN-Revision: 35130 EXPORT_SYMBOL(xfrm_parse_spi); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -4158,14 +4158,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -4166,14 +4166,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); @@ -784,7 +784,7 @@ SVN-Revision: 35130 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h -@@ -270,8 +270,10 @@ static inline bool neigh_key_eq128(const +@@ -286,8 +286,10 @@ static inline bool neigh_key_eq128(const const u32 *n32 = (const u32 *)n->primary_key; const u32 *p32 = pkey; @@ -829,7 +829,7 @@ SVN-Revision: 35130 *sum = csum_fold(csum_partial(diff, sizeof(diff), --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h -@@ -525,7 +525,7 @@ static inline bool is_etherdev_addr(cons +@@ -555,7 +555,7 @@ static inline bool is_etherdev_addr(cons * @b: Pointer to Ethernet header * * Compare two Ethernet headers, returns 0 if equal. @@ -838,7 +838,7 @@ SVN-Revision: 35130 * aligned OR the platform can handle unaligned access. This is the * case for all packets coming into netif_receive_skb or similar * entry points. -@@ -548,11 +548,12 @@ static inline unsigned long compare_ethe +@@ -578,11 +578,12 @@ static inline unsigned long compare_ethe fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6); return fold; #else @@ -857,7 +857,7 @@ SVN-Revision: 35130 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c -@@ -223,7 +223,7 @@ struct sk_buff *tcp_gro_receive(struct l +@@ -220,7 +220,7 @@ struct sk_buff *tcp_gro_receive(struct l th2 = tcp_hdr(p); @@ -866,7 +866,7 @@ SVN-Revision: 35130 NAPI_GRO_CB(p)->same_flow = 0; continue; } -@@ -241,8 +241,8 @@ found: +@@ -238,8 +238,8 @@ found: ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH)); flush |= (__force int)(th->ack_seq ^ th2->ack_seq); for (i = sizeof(*th); i < thlen; i += 4) @@ -879,16 +879,16 @@ SVN-Revision: 35130 * continue this flow as an atomic flow with a fixed ID or if we use --- a/net/ipv6/netfilter/ip6table_mangle.c +++ b/net/ipv6/netfilter/ip6table_mangle.c -@@ -44,7 +44,7 @@ ip6t_mangle_out(struct sk_buff *skb, con +@@ -44,7 +44,7 @@ ip6t_mangle_out(void *priv, struct sk_bu hop_limit = ipv6_hdr(skb)->hop_limit; /* flowlabel and prio (includes version, which shouldn't change either */ - flowlabel = *((u_int32_t *)ipv6_hdr(skb)); + flowlabel = net_hdr_word(ipv6_hdr(skb)); - ret = ip6t_do_table(skb, state, priv); + ret = ip6t_do_table(priv, skb, state); -@@ -53,7 +53,7 @@ ip6t_mangle_out(struct sk_buff *skb, con +@@ -53,7 +53,7 @@ ip6t_mangle_out(void *priv, struct sk_bu !ipv6_addr_equal(&ipv6_hdr(skb)->daddr, &daddr) || skb->mark != mark || ipv6_hdr(skb)->hop_limit != hop_limit || diff --git a/target/linux/ath79/patches-6.1/910-mikrotik-rb4xx.patch b/target/linux/ath79/patches-6.1/910-mikrotik-rb4xx.patch index 4743ad46e25..b61eef0b8a8 100644 --- a/target/linux/ath79/patches-6.1/910-mikrotik-rb4xx.patch +++ b/target/linux/ath79/patches-6.1/910-mikrotik-rb4xx.patch @@ -45,7 +45,7 @@ Submitted-by: Christopher Hill --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig -@@ -2176,6 +2176,14 @@ config RAVE_SP_CORE +@@ -2208,6 +2208,14 @@ config RAVE_SP_CORE Select this to get support for the Supervisory Processor device found on several devices in RAVE line of hardware. @@ -62,7 +62,7 @@ Submitted-by: Christopher Hill depends on PCI && MIPS && 64BIT --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile -@@ -267,6 +267,7 @@ obj-$(CONFIG_MFD_KHADAS_MCU) += khadas- +@@ -269,6 +269,7 @@ obj-$(CONFIG_MFD_KHADAS_MCU) += khadas- obj-$(CONFIG_MFD_ACER_A500_EC) += acer-ec-a500.o obj-$(CONFIG_MFD_QCOM_PM8008) += qcom-pm8008.o @@ -72,7 +72,7 @@ Submitted-by: Christopher Hill obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig -@@ -1574,6 +1574,12 @@ config GPIO_SODAVILLE +@@ -1593,6 +1593,12 @@ config GPIO_SODAVILLE help Say Y here to support Intel Sodaville GPIO. @@ -87,7 +87,7 @@ Submitted-by: Christopher Hill menu "SPI GPIO expanders" --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile -@@ -122,6 +122,7 @@ obj-$(CONFIG_GPIO_PL061) += gpio-pl061. +@@ -123,6 +123,7 @@ obj-$(CONFIG_GPIO_PL061) += gpio-pl061. obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio-pmic-eic-sprd.o obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o @@ -97,7 +97,7 @@ Submitted-by: Christopher Hill obj-$(CONFIG_GPIO_RDA) += gpio-rda.o --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig -@@ -563,4 +563,11 @@ config MTD_NAND_AR934X +@@ -565,4 +565,11 @@ config MTD_NAND_AR934X Enables support for NAND controller on Qualcomm Atheros SoCs. This controller is found on AR934x and QCA955x SoCs. @@ -111,9 +111,9 @@ Submitted-by: Christopher Hill endif # MTD_RAW_NAND --- a/drivers/mtd/nand/raw/Makefile +++ b/drivers/mtd/nand/raw/Makefile -@@ -59,6 +59,7 @@ obj-$(CONFIG_MTD_NAND_INTEL_LGM) += inte - obj-$(CONFIG_MTD_NAND_ROCKCHIP) += rockchip-nand-controller.o +@@ -60,6 +60,7 @@ obj-$(CONFIG_MTD_NAND_ROCKCHIP) += rock obj-$(CONFIG_MTD_NAND_PL35X) += pl35x-nand-controller.o + obj-$(CONFIG_MTD_NAND_RENESAS) += renesas-nand-controller.o obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o +obj-$(CONFIG_MTD_NAND_RB4XX) += nand_rb4xx.o diff --git a/target/linux/ath79/patches-6.1/911-mikrotik-rb91x.patch b/target/linux/ath79/patches-6.1/911-mikrotik-rb91x.patch index 94967bf674c..768ab6fb49a 100644 --- a/target/linux/ath79/patches-6.1/911-mikrotik-rb91x.patch +++ b/target/linux/ath79/patches-6.1/911-mikrotik-rb91x.patch @@ -29,11 +29,10 @@ Tested-by: Koen Vandeputte --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig -@@ -353,6 +353,13 @@ config GPIO_IXP4XX - IXP4xx series of chips. +@@ -368,6 +368,12 @@ config GPIO_IXP4XX If unsure, say N. -+ + +config GPIO_LATCH + tristate "MikroTik RouterBOARD GPIO latch support" + depends on ATH79 @@ -43,7 +42,7 @@ Tested-by: Koen Vandeputte config GPIO_LOGICVC tristate "Xylon LogiCVC GPIO support" depends on MFD_SYSCON && OF -@@ -529,6 +536,10 @@ config GPIO_ROCKCHIP +@@ -544,6 +550,10 @@ config GPIO_ROCKCHIP help Say yes here to support GPIO on Rockchip SoCs. @@ -56,7 +55,7 @@ Tested-by: Koen Vandeputte depends on MFD_SYSCON --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile -@@ -75,6 +75,7 @@ obj-$(CONFIG_GPIO_IT87) += gpio-it87.o +@@ -76,6 +76,7 @@ obj-$(CONFIG_GPIO_IT87) += gpio-it87.o obj-$(CONFIG_GPIO_IXP4XX) += gpio-ixp4xx.o obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o @@ -64,7 +63,7 @@ Tested-by: Koen Vandeputte obj-$(CONFIG_GPIO_LOGICVC) += gpio-logicvc.o obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o -@@ -123,6 +124,7 @@ obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio +@@ -124,6 +125,7 @@ obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o obj-$(CONFIG_GPIO_RB4XX) += gpio-rb4xx.o @@ -74,7 +73,7 @@ Tested-by: Koen Vandeputte obj-$(CONFIG_GPIO_RDA) += gpio-rda.o --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig -@@ -570,4 +570,10 @@ config MTD_NAND_RB4XX +@@ -572,4 +572,10 @@ config MTD_NAND_RB4XX Enables support for the NAND flash chip on Mikrotik Routerboard RB4xx series. @@ -87,8 +86,8 @@ Tested-by: Koen Vandeputte endif # MTD_RAW_NAND --- a/drivers/mtd/nand/raw/Makefile +++ b/drivers/mtd/nand/raw/Makefile -@@ -60,6 +60,7 @@ obj-$(CONFIG_MTD_NAND_ROCKCHIP) += rock - obj-$(CONFIG_MTD_NAND_PL35X) += pl35x-nand-controller.o +@@ -61,6 +61,7 @@ obj-$(CONFIG_MTD_NAND_PL35X) += pl35x-n + obj-$(CONFIG_MTD_NAND_RENESAS) += renesas-nand-controller.o obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o obj-$(CONFIG_MTD_NAND_RB4XX) += nand_rb4xx.o +obj-$(CONFIG_MTD_NAND_RB91X) += rb91x_nand.o From 7189b4578466a8a4c570ee328895d8a97a942893 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Thu, 25 May 2023 18:35:20 +0800 Subject: [PATCH 05/32] ath79: fix ethernet driver build errors on kernel 6.1 Some net APIs have changed on the new kernel. Update them to fix compile errors. Signed-off-by: Shiji Yang --- .../net/ethernet/atheros/ag71xx/ag71xx_ethtool.c | 14 ++++++++++++++ .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 13 ++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c index 104b9320b9d..e5adc821d27 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c @@ -80,8 +80,15 @@ static void ag71xx_ethtool_set_msglevel(struct net_device *dev, u32 msg_level) ag->msg_enable = msg_level; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) +static void ag71xx_ethtool_get_ringparam(struct net_device *dev, + struct ethtool_ringparam *er, + struct kernel_ethtool_ringparam *kernel_ring, + struct netlink_ext_ack *extack) +#else static void ag71xx_ethtool_get_ringparam(struct net_device *dev, struct ethtool_ringparam *er) +#endif { struct ag71xx *ag = netdev_priv(dev); @@ -99,8 +106,15 @@ static void ag71xx_ethtool_get_ringparam(struct net_device *dev, er->tx_pending /= AG71XX_TX_RING_DS_PER_PKT; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) +static int ag71xx_ethtool_set_ringparam(struct net_device *dev, + struct ethtool_ringparam *er, + struct kernel_ethtool_ringparam *kernel_ring, + struct netlink_ext_ack *extack) +#else static int ag71xx_ethtool_set_ringparam(struct net_device *dev, struct ethtool_ringparam *er) +#endif { struct ag71xx *ag = netdev_priv(dev); unsigned tx_size; diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index 06ebbd8ea38..8f95210e0f8 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -333,7 +333,7 @@ static unsigned char *ag71xx_speed_str(struct ag71xx *ag) return "?"; } -static void ag71xx_hw_set_macaddr(struct ag71xx *ag, unsigned char *mac) +static void ag71xx_hw_set_macaddr(struct ag71xx *ag, const unsigned char *mac) { u32 t; @@ -1166,7 +1166,7 @@ static int ag71xx_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) switch (cmd) { case SIOCSIFHWADDR: if (copy_from_user - (dev->dev_addr, ifr->ifr_data, sizeof(dev->dev_addr))) + ((void*)dev->dev_addr, ifr->ifr_data, sizeof(dev->dev_addr))) return -EFAULT; return 0; @@ -1669,10 +1669,9 @@ static int ag71xx_probe(struct platform_device *pdev) ag->stop_desc->ctrl = 0; ag->stop_desc->next = (u32) ag->stop_desc_dma; - of_get_mac_address(np, dev->dev_addr); - if (!is_valid_ether_addr(dev->dev_addr)) { + if (of_get_ethdev_address(np, dev)) { dev_err(&pdev->dev, "invalid MAC address, using random address\n"); - eth_random_addr(dev->dev_addr); + eth_hw_addr_random(dev); } err = of_get_phy_mode(np, &ag->phy_if_mode); @@ -1699,7 +1698,11 @@ static int ag71xx_probe(struct platform_device *pdev) break; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) + netif_napi_add_weight(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT); +#else netif_napi_add(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT); +#endif ag71xx_dump_regs(ag); From 54758cf24bd8123c724c59805a21d940db0b058c Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Wed, 31 May 2023 08:31:18 +0800 Subject: [PATCH 06/32] ath79: ignore the abused interrupt-map on PCIe node ath79 PCIe interrupt controller has stopped working correctly. This is because the DT exposing a non-sensical interrupt-map property, and their drivers relying on the kernel ignoring this property[1]. This patch fixes the PCIe init error: ath9k 0000:00:00.0: of_irq_parse_pci: failed with rc=-14 Notice: This is just a workaround, not a fix. PCIe driver and related dts node need to be rewritten. [1] https://lore.kernel.org/all/20211201114102.13446-1-maz@kernel.org/ Signed-off-by: Shiji Yang --- ...he-abused-interrupt-map-on-pcie-node.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 target/linux/ath79/patches-6.1/810-ath79-ignore-the-abused-interrupt-map-on-pcie-node.patch diff --git a/target/linux/ath79/patches-6.1/810-ath79-ignore-the-abused-interrupt-map-on-pcie-node.patch b/target/linux/ath79/patches-6.1/810-ath79-ignore-the-abused-interrupt-map-on-pcie-node.patch new file mode 100644 index 00000000000..980c265fe69 --- /dev/null +++ b/target/linux/ath79/patches-6.1/810-ath79-ignore-the-abused-interrupt-map-on-pcie-node.patch @@ -0,0 +1,33 @@ +From: Shiji Yang +Date: Wed, 31 May 2023 00:15:23 +0000 +Subject: [PATCH] ath79: ignore the abused interrupt-map on pcie node + +ath79 PCIe interrupt controller has stopped working correctly. This +is because the DT exposing a non-sensical interrupt-map property, +and their drivers relying on the kernel ignoring this property[1]. + +This patch fix the pcie init error: +ath9k 0000:00:00.0: of_irq_parse_pci: failed with rc=-14 + +Notice: +This is just a workaround, not a fix. PCIe driver and related dts +node need to be rewritten. + +[1] https://lore.kernel.org/all/20211201114102.13446-1-maz@kernel.org/ + +Signed-off-by: Shiji Yang +--- + drivers/of/irq.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/of/irq.c ++++ b/drivers/of/irq.c +@@ -86,6 +86,8 @@ EXPORT_SYMBOL_GPL(of_irq_find_parent); + * drawing board. + */ + static const char * const of_irq_imap_abusers[] = { ++ "qca,ar7100-pci", ++ "qcom,ar7240-pci", + "CBEA,platform-spider-pic", + "sti,platform-spider-pic", + "realtek,rtl-intc", From 7ba69a94f924b0eefd05874d63fd616fab06ded6 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 28 May 2023 09:17:34 +0800 Subject: [PATCH 07/32] ath79: backport gpio immutable irq_chip support This patch converts the driver to immutable irq-chip, which can silence some gpio warnings. Signed-off-by: Shiji Yang --- ...-ath79-Convert-to-immutable-irq_chip.patch | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 target/linux/ath79/patches-6.1/010-v6.4-gpio-ath79-Convert-to-immutable-irq_chip.patch diff --git a/target/linux/ath79/patches-6.1/010-v6.4-gpio-ath79-Convert-to-immutable-irq_chip.patch b/target/linux/ath79/patches-6.1/010-v6.4-gpio-ath79-Convert-to-immutable-irq_chip.patch new file mode 100644 index 00000000000..942380fc7b4 --- /dev/null +++ b/target/linux/ath79/patches-6.1/010-v6.4-gpio-ath79-Convert-to-immutable-irq_chip.patch @@ -0,0 +1,60 @@ +From b11ce7e48121a02ceedec9f4dfcab4f2bee8f35f Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Thu, 9 Mar 2023 08:45:54 +0100 +Subject: gpio: ath79: Convert to immutable irq_chip + +Convert the driver to immutable irq-chip with a bit of +intuition. + +Cc: Marc Zyngier +Acked-by: Marc Zyngier +Signed-off-by: Linus Walleij +Signed-off-by: Bartosz Golaszewski +--- + drivers/gpio/gpio-ath79.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/drivers/gpio/gpio-ath79.c ++++ b/drivers/gpio/gpio-ath79.c +@@ -71,6 +71,7 @@ static void ath79_gpio_irq_unmask(struct + u32 mask = BIT(irqd_to_hwirq(data)); + unsigned long flags; + ++ gpiochip_enable_irq(&ctrl->gc, irqd_to_hwirq(data)); + raw_spin_lock_irqsave(&ctrl->lock, flags); + ath79_gpio_update_bits(ctrl, AR71XX_GPIO_REG_INT_MASK, mask, mask); + raw_spin_unlock_irqrestore(&ctrl->lock, flags); +@@ -85,6 +86,7 @@ static void ath79_gpio_irq_mask(struct i + raw_spin_lock_irqsave(&ctrl->lock, flags); + ath79_gpio_update_bits(ctrl, AR71XX_GPIO_REG_INT_MASK, mask, 0); + raw_spin_unlock_irqrestore(&ctrl->lock, flags); ++ gpiochip_disable_irq(&ctrl->gc, irqd_to_hwirq(data)); + } + + static void ath79_gpio_irq_enable(struct irq_data *data) +@@ -169,13 +171,15 @@ static int ath79_gpio_irq_set_type(struc + return 0; + } + +-static struct irq_chip ath79_gpio_irqchip = { ++static const struct irq_chip ath79_gpio_irqchip = { + .name = "gpio-ath79", + .irq_enable = ath79_gpio_irq_enable, + .irq_disable = ath79_gpio_irq_disable, + .irq_mask = ath79_gpio_irq_mask, + .irq_unmask = ath79_gpio_irq_unmask, + .irq_set_type = ath79_gpio_irq_set_type, ++ .flags = IRQCHIP_IMMUTABLE, ++ GPIOCHIP_IRQ_RESOURCE_HELPERS, + }; + + static void ath79_gpio_irq_handler(struct irq_desc *desc) +@@ -274,7 +278,7 @@ static int ath79_gpio_probe(struct platf + /* Optional interrupt setup */ + if (!np || of_property_read_bool(np, "interrupt-controller")) { + girq = &ctrl->gc.irq; +- girq->chip = &ath79_gpio_irqchip; ++ gpio_irq_chip_set_chip(girq, &ath79_gpio_irqchip); + girq->parent_handler = ath79_gpio_irq_handler; + girq->num_parents = 1; + girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents), From aee2af0f742d6772621dafb872e4ba277b56f8d8 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 30 May 2023 16:50:09 +0800 Subject: [PATCH 08/32] ath79: enable variable sector size erasure for generic subtarget Make use of minor sector size (4k) erasure on supported flash chips to improve spi read/write performance. Signed-off-by: Shiji Yang --- target/linux/ath79/generic/config-default | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/generic/config-default b/target/linux/ath79/generic/config-default index d8c674cba7e..57cc9447d83 100644 --- a/target/linux/ath79/generic/config-default +++ b/target/linux/ath79/generic/config-default @@ -15,6 +15,7 @@ CONFIG_LEDS_RESET=y CONFIG_MARVELL_PHY=y CONFIG_MICREL_PHY=y CONFIG_MTD_REDBOOT_PARTS=y +CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y CONFIG_MTD_SPLIT_EVA_FW=y CONFIG_NVMEM_SYSFS=y CONFIG_NVMEM_U_BOOT_ENV=y From c94383de018c561355c5e239524fbefca4aee3aa Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 8 Sep 2023 21:00:23 +0200 Subject: [PATCH 09/32] ath79: use kernel 6.1 as default Signed-off-by: David Bauer --- target/linux/ath79/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath79/Makefile b/target/linux/ath79/Makefile index f7bb31c4ad8..0a54fc59c67 100644 --- a/target/linux/ath79/Makefile +++ b/target/linux/ath79/Makefile @@ -8,7 +8,7 @@ SUBTARGETS:=generic mikrotik nand tiny FEATURES:=ramdisk squashfs usbgadget -KERNEL_PATCHVER:=5.15 +KERNEL_PATCHVER:=6.1 KERNEL_TESTING_PATCHVER:=6.1 include $(INCLUDE_DIR)/target.mk From 58bb5e147ae50391c29c53890f47e3a5420bbfad Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 7 Sep 2023 06:55:41 -0400 Subject: [PATCH 10/32] kernel: bump 5.15 to 5.15.131 Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.131 All patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia --- include/kernel-5.15 | 4 ++-- target/linux/generic/hack-5.15/204-module_strip.patch | 4 ++-- .../hack-5.15/780-usb-net-MeigLink_modem_support.patch | 2 +- ...Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch | 2 +- .../830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 74130b28309..0423befe74f 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .130 -LINUX_KERNEL_HASH-5.15.130 = ab464e4107329ff5262f1c585c40fc29dc68f17687a9a918f3e90faba5303d62 +LINUX_VERSION-5.15 = .131 +LINUX_KERNEL_HASH-5.15.131 = 997c3391f439fb6fe32f1938fe089a046b840a5cde9a2215b6745144f8b24c69 diff --git a/target/linux/generic/hack-5.15/204-module_strip.patch b/target/linux/generic/hack-5.15/204-module_strip.patch index 31bfe07c78c..e650c1b1847 100644 --- a/target/linux/generic/hack-5.15/204-module_strip.patch +++ b/target/linux/generic/hack-5.15/204-module_strip.patch @@ -120,7 +120,7 @@ Signed-off-by: Felix Fietkau #ifdef CONFIG_MODVERSIONS -@@ -3266,9 +3268,11 @@ static int setup_load_info(struct load_i +@@ -3274,9 +3276,11 @@ static int setup_load_info(struct load_i static int check_modinfo(struct module *mod, struct load_info *info, int flags) { @@ -133,7 +133,7 @@ Signed-off-by: Felix Fietkau if (flags & MODULE_INIT_IGNORE_VERMAGIC) modmagic = NULL; -@@ -3289,6 +3293,7 @@ static int check_modinfo(struct module * +@@ -3297,6 +3301,7 @@ static int check_modinfo(struct module * mod->name); add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK); } diff --git a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch index 4f1966db165..5c1dbd69d3c 100644 --- a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch @@ -29,7 +29,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1179,6 +1181,11 @@ static const struct usb_device_id option +@@ -1180,6 +1182,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/hack-5.15/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch b/target/linux/generic/hack-5.15/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch index 5dd0554edbc..4f4d6c75091 100644 --- a/target/linux/generic/hack-5.15/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch +++ b/target/linux/generic/hack-5.15/930-Revert-Revert-Revert-driver-core-Set-fw_devlink-on-b.patch @@ -19,7 +19,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/base/core.c +++ b/drivers/base/core.c -@@ -1561,7 +1561,7 @@ static void device_links_purge(struct de +@@ -1562,7 +1562,7 @@ static void device_links_purge(struct de #define FW_DEVLINK_FLAGS_RPM (FW_DEVLINK_FLAGS_ON | \ DL_FLAG_PM_RUNTIME) diff --git a/target/linux/ramips/patches-5.15/830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch b/target/linux/ramips/patches-5.15/830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch index 21538859a55..2896002ed1a 100644 --- a/target/linux/ramips/patches-5.15/830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch +++ b/target/linux/ramips/patches-5.15/830-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch @@ -25,7 +25,7 @@ Signed-off-by: John Crispin --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig -@@ -1092,3 +1092,5 @@ config MMC_OWL +@@ -1093,3 +1093,5 @@ config MMC_OWL config MMC_SDHCI_EXTERNAL_DMA bool From 907e9e0bd3df456b32921893cf6ef1b54117d983 Mon Sep 17 00:00:00 2001 From: Patricia Lee Date: Wed, 30 Aug 2023 19:50:54 +0800 Subject: [PATCH 11/32] mediatek: add support for Cetron CT3003 **Hardware specification:** - SoC: MediaTek MT7981B 2x A53 - Flash: ESMT F50L1G41LB 128MB - RAM: Nanya NT5CC128M16JR-EK 256MB - Ethernet: 4 x 10/100/1000 Mbps - Switch: MediaTek MT7531AE - WiFi: MediaTek MT7976C - Button: Reset, Mesh - Power: DC 12V 1A - UART: 3.3v, 115200n8 | Layout: | | :-------- | | | | VCC | | GND | | Tx | | Rx | **Flash instructions:** 1. Rename `openwrt-mediatek-filogic-cetron_ct3003-squashfs-factory.bin` to `factory.bin`. 2. Upload the `factory.bin` using the device's Web interface. 3. Click the upgrade button and wait for the process to finish. 4. Access the OpenWrt interface using the same password. 5. Use the 'Restore' function to reset the firmware to its initial state. **Notes:** If you plan to recovery the stock firmware in the future, it's advisable to connect the device via the serial port and enter failsafe mode to back up all the MTD partitions before proceeding the steps above. Signed-off-by: Patricia Lee --- .../uboot-envtools/files/mediatek_filogic | 1 + .../mediatek/dts/mt7981b-cetron-ct3003.dts | 242 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 6 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + target/linux/mediatek/image/filogic.mk | 32 +++ 5 files changed, 286 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index b0810184e5a..d7d6bbf05c3 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -44,6 +44,7 @@ mercusys,mr90x-v1) local envdev=/dev/mtd$(find_mtd_index "u-boot-env") ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1" ;; +cetron,ct3003|\ netgear,wax220) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; diff --git a/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts b/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts new file mode 100644 index 00000000000..d39083ffb0d --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts @@ -0,0 +1,242 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7981.dtsi" + +/ { + model = "Cetron CT3003"; + compatible = "cetron,ct3003", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + led-boot = &led_status_red; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_green; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x10000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_HIGH>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: led_status_red { + label = "red:status"; + gpios = <&pio 3 GPIO_ACTIVE_LOW>; + }; + + led_status_green: led_status_green { + label = "green:status"; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + +&mdio_bus { + switch: switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand@0 { + compatible = "spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partition@0 { + label = "BL2"; + reg = <0x0000000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + partition@180000 { + label = "art"; + reg = <0x0180000 0x0100000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + }; + + factory: partition@280000 { + label = "Factory"; + reg = <0x0280000 0x0100000>; + read-only; + }; + + partition@380000 { + label = "FIP"; + reg = <0x0380000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x0580000 0x2000000>; + }; + + partition@2580000 { + label = "ubi_backup"; + reg = <0x2580000 0x2000000>; + }; + + partition@4580000 { + label = "Config_backup"; + reg = <0x4580000 0x0400000>; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "wan"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; 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 e5872e7fe4d..680bee604f8 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 @@ -42,6 +42,7 @@ mediatek_setup_interfaces() mercusys,mr90x-v1) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 ;; + cetron,ct3003|\ qihoo,360t7) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan ;; @@ -82,6 +83,11 @@ mediatek_setup_macs() bananapi,bpi-r3) wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1) ;; + cetron,ct3003) + lan_mac=$(mtd_get_mac_binary "art" 0) + wan_mac=$(macaddr_add "$lan_mac" 3) + label_mac=$lan_mac + ;; h3c,magic-nx30-pro) wan_mac=$(mtd_get_mac_ascii pdt_data_1 ethaddr) lan_mac=$(macaddr_add "$wan_mac" 1) 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 ebf76640c87..ea859390680 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 @@ -30,6 +30,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_unsetbit $addr 6 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_setbit $addr 6 > /sys${DEVPATH}/macaddress ;; + cetron,ct3003) + addr=$(mtd_get_mac_binary "art" 0) + [ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 2) > /sys${DEVPATH}/macaddress + ;; cudy,wr3000-v1) addr=$(mtd_get_mac_binary bdinfo 0xde00) # Originally, phy0 is phy1 mac with LA bit set. However, this would conflict diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index a799c7b5ee8..571815249ff 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -90,6 +90,21 @@ define Build/zyxel-nwa-fit-filogic @mv $@.new $@ endef +define Build/cetron-header + $(eval magic=$(word 1,$(1))) + $(eval model=$(word 2,$(1))) + ( \ + dd if=/dev/zero bs=856 count=1 2>/dev/null; \ + printf "$(model)," | dd bs=128 count=1 conv=sync 2>/dev/null; \ + md5sum $@ | cut -f1 -d" " | dd bs=32 count=1 2>/dev/null; \ + printf "$(magic)" | dd bs=4 count=1 conv=sync 2>/dev/null; \ + cat $@; \ + ) > $@.tmp + fw_crc=$$(gzip -c $@.tmp | tail -c 8 | od -An -N4 -tx4 --endian little | tr -d ' \n'); \ + printf "$$(echo $$fw_crc | sed 's/../\\x&/g')" | cat - $@.tmp > $@ + rm $@.tmp +endef + define Device/asus_tuf-ax4200 DEVICE_VENDOR := ASUS DEVICE_MODEL := TUF-AX4200 @@ -172,6 +187,23 @@ define Device/bananapi_bpi-r3 endef TARGET_DEVICES += bananapi_bpi-r3 +define Device/cetron_ct3003 + DEVICE_VENDOR := Cetron + DEVICE_MODEL := CT3003 + DEVICE_DTS := mt7981b-cetron-ct3003 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_IN_UBI := 1 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGES += factory.bin + IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | cetron-header rd30 CT3003 +endef +TARGET_DEVICES += cetron_ct3003 + define Device/cudy_wr3000-v1 DEVICE_VENDOR := Cudy DEVICE_MODEL := WR3000 From 8e0d43d569e934888b1aaea3908c982c0adccac0 Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Thu, 7 Sep 2023 17:06:28 +0200 Subject: [PATCH 12/32] mvebu: refresh 6.1 configs This should be a part of kernel major bump. Fortunately it didn't stall compilation, so no fixes tag. Signed-off-by: Tomasz Maciej Nowak --- target/linux/mvebu/config-6.1 | 26 ++++++++++++++++++------- target/linux/mvebu/cortexa53/config-6.1 | 10 +++++++++- target/linux/mvebu/cortexa72/config-6.1 | 11 +++++++++-- target/linux/mvebu/cortexa9/config-6.1 | 5 +++++ 4 files changed, 42 insertions(+), 10 deletions(-) diff --git a/target/linux/mvebu/config-6.1 b/target/linux/mvebu/config-6.1 index 0811ee6d4ce..88e5fff4d99 100644 --- a/target/linux/mvebu/config-6.1 +++ b/target/linux/mvebu/config-6.1 @@ -29,13 +29,11 @@ CONFIG_ARM_ATAG_DTB_COMPAT=y # CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER is not set CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE=y CONFIG_ARM_CPU_SUSPEND=y -CONFIG_ARM_CRYPTO=y CONFIG_ARM_ERRATA_720789=y CONFIG_ARM_ERRATA_764369=y CONFIG_ARM_GIC=y CONFIG_ARM_GLOBAL_TIMER=y CONFIG_ARM_GT_INITIAL_PRESCALER_VAL=1 -CONFIG_ARM_HAS_SG_CHAIN=y CONFIG_ARM_HEAVY_MB=y CONFIG_ARM_L1_CACHE_SHIFT=6 CONFIG_ARM_L1_CACHE_SHIFT_6=y @@ -58,11 +56,17 @@ CONFIG_BLK_MQ_PCI=y CONFIG_BOUNCE=y # CONFIG_CACHE_FEROCEON_L2 is not set CONFIG_CACHE_L2X0=y +CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y +CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" +CONFIG_CC_NO_ARRAY_BOUNDS=y CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y +CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 CONFIG_COMPAT_32BIT_TIME=y +CONFIG_CONTEXT_TRACKING=y +CONFIG_CONTEXT_TRACKING_IDLE=y CONFIG_CPUFREQ_DT=y CONFIG_CPUFREQ_DT_PLATDEV=y CONFIG_CPU_32v6K=y @@ -111,7 +115,10 @@ CONFIG_CRYPTO_DEV_MARVELL_CESA=y CONFIG_CRYPTO_ESSIV=y CONFIG_CRYPTO_HASH_INFO=y CONFIG_CRYPTO_HW=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y CONFIG_CRYPTO_LIB_DES=y +CONFIG_CRYPTO_LIB_SHA1=y +CONFIG_CRYPTO_LIB_UTILS=y CONFIG_CRYPTO_LZO=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_SHA1=y @@ -133,18 +140,17 @@ CONFIG_DEBUG_UART_8250=y CONFIG_DEBUG_UART_8250_SHIFT=2 CONFIG_DEBUG_UART_PHYS=0xd0012000 CONFIG_DEBUG_UART_VIRT=0xfec12000 -CONFIG_DEBUG_UNCOMPRESS=y CONFIG_DEBUG_USER=y CONFIG_DMADEVICES=y CONFIG_DMA_ENGINE=y CONFIG_DMA_ENGINE_RAID=y CONFIG_DMA_OF=y CONFIG_DMA_OPS=y -CONFIG_DMA_REMAP=y CONFIG_DTC=y CONFIG_EARLY_PRINTK=y CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y +CONFIG_EXCLUSIVE_SYSTEM_RAM=y CONFIG_EXT4_FS=y CONFIG_EXTCON=y CONFIG_F2FS_FS=y @@ -154,6 +160,8 @@ CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_FW_LOADER_SYSFS=y +CONFIG_GCC11_NO_ARRAY_BOUNDS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y @@ -182,7 +190,6 @@ CONFIG_GENERIC_STRNLEN_USER=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GENERIC_VDSO_32=y CONFIG_GLOB=y -CONFIG_GPIOLIB=y CONFIG_GPIOLIB_IRQCHIP=y CONFIG_GPIO_CDEV=y CONFIG_GPIO_GENERIC=y @@ -191,7 +198,6 @@ CONFIG_GPIO_MVEBU=y CONFIG_GPIO_PCA953X=y CONFIG_GPIO_PCA953X_IRQ=y CONFIG_GRO_CELLS=y -CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDEN_BRANCH_PREDICTOR=y CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_DMA=y @@ -315,6 +321,9 @@ CONFIG_OUTER_CACHE_SYNC=y CONFIG_PADATA=y CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_PAGE_POOL=y +CONFIG_PAGE_POOL_STATS=y +CONFIG_PAGE_SIZE_LESS_THAN_256KB=y +CONFIG_PAGE_SIZE_LESS_THAN_64KB=y CONFIG_PCI=y CONFIG_PCI_BRIDGE_EMUL=y CONFIG_PCI_DOMAINS=y @@ -330,7 +339,6 @@ CONFIG_PHYLINK=y # CONFIG_PHY_MVEBU_A3700_UTMI is not set # CONFIG_PHY_MVEBU_A38X_COMPHY is not set # CONFIG_PHY_MVEBU_CP110_COMPHY is not set -# CONFIG_PHY_MVEBU_CP110_UTMI is not set CONFIG_PINCTRL=y CONFIG_PINCTRL_ARMADA_370=y CONFIG_PINCTRL_ARMADA_38X=y @@ -343,9 +351,11 @@ CONFIG_PLAT_ORION=y CONFIG_PM_OPP=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_GPIO=y +CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_PWM=y CONFIG_PWM_SYSFS=y +CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y @@ -381,6 +391,7 @@ CONFIG_SMP=y CONFIG_SMP_ON_UP=y CONFIG_SOCK_RX_QUEUE_MAPPING=y CONFIG_SOC_BUS=y +CONFIG_SOFTIRQ_ON_OWN_STACK=y CONFIG_SPARSE_IRQ=y CONFIG_SPI=y # CONFIG_SPI_ARMADA_3700 is not set @@ -431,5 +442,6 @@ CONFIG_ZBOOT_ROM_BSS=0x0 CONFIG_ZBOOT_ROM_TEXT=0x0 CONFIG_ZLIB_DEFLATE=y CONFIG_ZLIB_INFLATE=y +CONFIG_ZSTD_COMMON=y CONFIG_ZSTD_COMPRESS=y CONFIG_ZSTD_DECOMPRESS=y diff --git a/target/linux/mvebu/cortexa53/config-6.1 b/target/linux/mvebu/cortexa53/config-6.1 index 27d410f68b9..3534537b54f 100644 --- a/target/linux/mvebu/cortexa53/config-6.1 +++ b/target/linux/mvebu/cortexa53/config-6.1 @@ -1,4 +1,6 @@ CONFIG_64BIT=y +CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y +CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y CONFIG_ARCH_MMAP_RND_BITS=18 @@ -8,6 +10,7 @@ CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 CONFIG_ARCH_PROC_KCORE_TEXT=y CONFIG_ARCH_STACKWALK=y CONFIG_ARCH_WANTS_NO_INSTR=y +CONFIG_ARCH_WANTS_THP_SWAP=y CONFIG_ARM64=y CONFIG_ARM64_4K_PAGES=y CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y @@ -35,13 +38,15 @@ CONFIG_ARM_GIC_V3_ITS_PCI=y # CONFIG_ARM_PL172_MPMC is not set CONFIG_ARM_PSCI_FW=y CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y +CONFIG_CC_HAVE_SHADOW_CALL_STACK=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y CONFIG_CPU_LITTLE_ENDIAN=y CONFIG_DMA_DIRECT_REMAP=y CONFIG_FRAME_POINTER=y +CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS=y CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_IOREMAP=y CONFIG_GENERIC_PINCONF=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 CONFIG_MAILBOX=y @@ -61,9 +66,11 @@ CONFIG_PGTABLE_LEVELS=3 CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PHY_MVEBU_A3700_COMPHY=y CONFIG_PHY_MVEBU_A3700_UTMI=y +CONFIG_PINCTRL_AC5=y CONFIG_PINCTRL_ARMADA_37XX=y CONFIG_PINCTRL_ARMADA_AP806=y CONFIG_PINCTRL_ARMADA_CP110=y +CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y CONFIG_POWER_SUPPLY=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y @@ -77,6 +84,7 @@ CONFIG_SPI_ARMADA_3700=y CONFIG_SWIOTLB=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_THREAD_INFO_IN_TASK=y +CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y CONFIG_TURRIS_MOX_RWTM=y CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_VMAP_STACK=y diff --git a/target/linux/mvebu/cortexa72/config-6.1 b/target/linux/mvebu/cortexa72/config-6.1 index cb27e0285fa..5a3dcc66f72 100644 --- a/target/linux/mvebu/cortexa72/config-6.1 +++ b/target/linux/mvebu/cortexa72/config-6.1 @@ -1,5 +1,7 @@ CONFIG_64BIT=y CONFIG_AQUANTIA_PHY=y +CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y +CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y CONFIG_ARCH_MMAP_RND_BITS=18 @@ -9,10 +11,10 @@ CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 CONFIG_ARCH_PROC_KCORE_TEXT=y CONFIG_ARCH_STACKWALK=y CONFIG_ARCH_WANTS_NO_INSTR=y +CONFIG_ARCH_WANTS_THP_SWAP=y CONFIG_ARM64=y CONFIG_ARM64_4K_PAGES=y CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y -CONFIG_ARM64_ERRATUM_1742098=y CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_PA_BITS=48 CONFIG_ARM64_PA_BITS_48=y @@ -36,13 +38,15 @@ CONFIG_ARM_GIC_V3_ITS_PCI=y # CONFIG_ARM_PL172_MPMC is not set CONFIG_ARM_PSCI_FW=y CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y +CONFIG_CC_HAVE_SHADOW_CALL_STACK=y CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y CONFIG_CPU_LITTLE_ENDIAN=y CONFIG_DMA_DIRECT_REMAP=y CONFIG_FRAME_POINTER=y +CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS=y CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_IOREMAP=y CONFIG_GENERIC_PINCONF=y CONFIG_HW_RANDOM_OMAP=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 @@ -72,9 +76,11 @@ CONFIG_PCIE_DW_HOST=y CONFIG_PGTABLE_LEVELS=3 CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PHY_MVEBU_CP110_COMPHY=y +CONFIG_PINCTRL_AC5=y CONFIG_PINCTRL_ARMADA_37XX=y CONFIG_PINCTRL_ARMADA_AP806=y CONFIG_PINCTRL_ARMADA_CP110=y +CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y CONFIG_POWER_SUPPLY=y CONFIG_QUEUED_RWLOCKS=y CONFIG_QUEUED_SPINLOCKS=y @@ -92,6 +98,7 @@ CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y CONFIG_SWIOTLB=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_THREAD_INFO_IN_TASK=y +CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_VMAP_STACK=y CONFIG_ZONE_DMA32=y diff --git a/target/linux/mvebu/cortexa9/config-6.1 b/target/linux/mvebu/cortexa9/config-6.1 index 88a2f14c026..b78c734fada 100644 --- a/target/linux/mvebu/cortexa9/config-6.1 +++ b/target/linux/mvebu/cortexa9/config-6.1 @@ -1,3 +1,8 @@ +CONFIG_ARM_HAS_GROUP_RELOCS=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CURRENT_POINTER_IN_TPIDRURO=y +CONFIG_IRQSTACKS=y CONFIG_LED_TRIGGER_PHY=y CONFIG_PHY_MVEBU_A38X_COMPHY=y CONFIG_RTC_DRV_MV=y +CONFIG_THREAD_INFO_IN_TASK=y From eac192843030d16046a0d603284c2b4c89822431 Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Thu, 7 Sep 2023 17:06:29 +0200 Subject: [PATCH 13/32] mvebu: cortexa72: enable USB PHY Since kernel 5.13 this is needed to enable USB ports on all devices in subtarget. Previously TF-A and COMPHY driver might have set up this PHY, but not anymore. Signed-off-by: Tomasz Maciej Nowak Tested-by: Robert Marko --- target/linux/mvebu/cortexa72/config-5.15 | 1 + target/linux/mvebu/cortexa72/config-6.1 | 1 + 2 files changed, 2 insertions(+) diff --git a/target/linux/mvebu/cortexa72/config-5.15 b/target/linux/mvebu/cortexa72/config-5.15 index cb27e0285fa..978208f1cb5 100644 --- a/target/linux/mvebu/cortexa72/config-5.15 +++ b/target/linux/mvebu/cortexa72/config-5.15 @@ -72,6 +72,7 @@ CONFIG_PCIE_DW_HOST=y CONFIG_PGTABLE_LEVELS=3 CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PHY_MVEBU_CP110_COMPHY=y +CONFIG_PHY_MVEBU_CP110_UTMI=y CONFIG_PINCTRL_ARMADA_37XX=y CONFIG_PINCTRL_ARMADA_AP806=y CONFIG_PINCTRL_ARMADA_CP110=y diff --git a/target/linux/mvebu/cortexa72/config-6.1 b/target/linux/mvebu/cortexa72/config-6.1 index 5a3dcc66f72..535b67225e7 100644 --- a/target/linux/mvebu/cortexa72/config-6.1 +++ b/target/linux/mvebu/cortexa72/config-6.1 @@ -76,6 +76,7 @@ CONFIG_PCIE_DW_HOST=y CONFIG_PGTABLE_LEVELS=3 CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PHY_MVEBU_CP110_COMPHY=y +CONFIG_PHY_MVEBU_CP110_UTMI=y CONFIG_PINCTRL_AC5=y CONFIG_PINCTRL_ARMADA_37XX=y CONFIG_PINCTRL_ARMADA_AP806=y From 5294b358aa1ab2015e151f4caabdb4dcccf62190 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 7 Sep 2023 06:07:43 -0400 Subject: [PATCH 14/32] kernel: bump 6.1 to 6.1.52 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.52 All patches automatically rebased. Build system: x86/64 Build-tested: x86/64/AMD Cezanne Run-tested: x86/64/AMD Cezanne Signed-off-by: John Audia --- include/kernel-6.1 | 4 ++-- target/linux/generic/hack-6.1/204-module_strip.patch | 4 ++-- .../generic/hack-6.1/780-usb-net-MeigLink_modem_support.patch | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/kernel-6.1 b/include/kernel-6.1 index 16e40238b58..cc106e2572f 100644 --- a/include/kernel-6.1 +++ b/include/kernel-6.1 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.1 = .51 -LINUX_KERNEL_HASH-6.1.51 = 58b0446d8ea4bc0b26a35e2e3509bd53efcdeb295c9e4f48d33a23b1cdaa103b +LINUX_VERSION-6.1 = .52 +LINUX_KERNEL_HASH-6.1.52 = 567737990dbc9265966a0786392821a9fa559fd346494fd1eff050dbeb383a52 diff --git a/target/linux/generic/hack-6.1/204-module_strip.patch b/target/linux/generic/hack-6.1/204-module_strip.patch index 71ee62ece8d..bd168649f2e 100644 --- a/target/linux/generic/hack-6.1/204-module_strip.patch +++ b/target/linux/generic/hack-6.1/204-module_strip.patch @@ -118,7 +118,7 @@ Signed-off-by: Felix Fietkau static char *get_modinfo(const struct load_info *info, const char *tag); static char *get_next_modinfo(const struct load_info *info, const char *tag, -@@ -1950,9 +1952,11 @@ static int setup_load_info(struct load_i +@@ -1958,9 +1960,11 @@ static int setup_load_info(struct load_i static int check_modinfo(struct module *mod, struct load_info *info, int flags) { @@ -131,7 +131,7 @@ Signed-off-by: Felix Fietkau if (flags & MODULE_INIT_IGNORE_VERMAGIC) modmagic = NULL; -@@ -1973,6 +1977,7 @@ static int check_modinfo(struct module * +@@ -1981,6 +1985,7 @@ static int check_modinfo(struct module * mod->name); add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK); } diff --git a/target/linux/generic/hack-6.1/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-6.1/780-usb-net-MeigLink_modem_support.patch index 9ec5b539d39..a68562d0958 100644 --- a/target/linux/generic/hack-6.1/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-6.1/780-usb-net-MeigLink_modem_support.patch @@ -29,7 +29,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1179,6 +1181,11 @@ static const struct usb_device_id option +@@ -1180,6 +1182,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, From 7f54d9ba1aa9796e218b554633a4e05906a9ac7f Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 9 Sep 2023 08:42:04 +0200 Subject: [PATCH 15/32] Revert "ath79: use kernel 6.1 as default" This reverts commit c94383de018c561355c5e239524fbefca4aee3aa. THis commit was not meant to be pushed to main yet. Signed-off-by: David Bauer --- target/linux/ath79/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath79/Makefile b/target/linux/ath79/Makefile index 0a54fc59c67..f7bb31c4ad8 100644 --- a/target/linux/ath79/Makefile +++ b/target/linux/ath79/Makefile @@ -8,7 +8,7 @@ SUBTARGETS:=generic mikrotik nand tiny FEATURES:=ramdisk squashfs usbgadget -KERNEL_PATCHVER:=6.1 +KERNEL_PATCHVER:=5.15 KERNEL_TESTING_PATCHVER:=6.1 include $(INCLUDE_DIR)/target.mk From 9725524235b30b436f6430d70cd809abf1b48a91 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 2 Sep 2023 00:54:40 +0100 Subject: [PATCH 16/32] uboot-mediatek: sync mtk-snand driver with SDK Sync SPI-NAND/ECC controller driver for MT7622, MT7981, MT7986 and MT7988: * Platform data for MT7981 was actually missing and is now added. * Add support for Winbond W25N01KV 1Gbit chip. Signed-off-by: Daniel Golle --- ...support-for-MediaTek-SPI-NAND-flash-.patch | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) 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 311c0513440..05138d984e5 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 @@ -17,14 +17,14 @@ Signed-off-by: Weijie Gao drivers/mtd/mtk-snand/Kconfig | 21 + drivers/mtd/mtk-snand/Makefile | 11 + drivers/mtd/mtk-snand/mtk-snand-def.h | 271 ++++ - drivers/mtd/mtk-snand/mtk-snand-ecc.c | 395 +++++ - drivers/mtd/mtk-snand/mtk-snand-ids.c | 511 +++++++ + drivers/mtd/mtk-snand/mtk-snand-ecc.c | 411 ++++++ + drivers/mtd/mtk-snand/mtk-snand-ids.c | 515 +++++++ drivers/mtd/mtk-snand/mtk-snand-mtd.c | 535 +++++++ drivers/mtd/mtk-snand/mtk-snand-os.c | 39 + drivers/mtd/mtk-snand/mtk-snand-os.h | 120 ++ drivers/mtd/mtk-snand/mtk-snand.c | 1933 +++++++++++++++++++++++++ drivers/mtd/mtk-snand/mtk-snand.h | 77 + - 12 files changed, 3917 insertions(+) + 12 files changed, 3937 insertions(+) create mode 100644 drivers/mtd/mtk-snand/Kconfig create mode 100644 drivers/mtd/mtk-snand/Makefile create mode 100644 drivers/mtd/mtk-snand/mtk-snand-def.h @@ -369,7 +369,7 @@ Signed-off-by: Weijie Gao +#endif /* _MTK_SNAND_DEF_H_ */ --- /dev/null +++ b/drivers/mtd/mtk-snand/mtk-snand-ecc.c -@@ -0,0 +1,395 @@ +@@ -0,0 +1,411 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause +/* + * Copyright (C) 2020 MediaTek Inc. All Rights Reserved. @@ -418,6 +418,10 @@ Signed-off-by: Weijie Gao + +static const uint8_t mt7622_ecc_caps[] = { 4, 6, 8, 10, 12 }; + ++static const uint8_t mt7981_ecc_caps[] = { ++ 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 ++}; ++ +static const uint8_t mt7986_ecc_caps[] = { + 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 +}; @@ -426,6 +430,10 @@ Signed-off-by: Weijie Gao + [ECC_DECDONE] = 0x11c, +}; + ++static const uint32_t mt7981_ecc_regs[] = { ++ [ECC_DECDONE] = 0x124, ++}; ++ +static const uint32_t mt7986_ecc_regs[] = { + [ECC_DECDONE] = 0x124, +}; @@ -447,6 +455,14 @@ Signed-off-by: Weijie Gao + .errnum_bits = 5, + .errnum_shift = 5, + }, ++ [SNAND_SOC_MT7981] = { ++ .ecc_caps = mt7981_ecc_caps, ++ .num_ecc_cap = ARRAY_SIZE(mt7981_ecc_caps), ++ .regs = mt7981_ecc_regs, ++ .mode_shift = 5, ++ .errnum_bits = 5, ++ .errnum_shift = 8, ++ }, + [SNAND_SOC_MT7986] = { + .ecc_caps = mt7986_ecc_caps, + .num_ecc_cap = ARRAY_SIZE(mt7986_ecc_caps), @@ -767,7 +783,7 @@ Signed-off-by: Weijie Gao +} --- /dev/null +++ b/drivers/mtd/mtk-snand/mtk-snand-ids.c -@@ -0,0 +1,511 @@ +@@ -0,0 +1,515 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause +/* + * Copyright (C) 2020 MediaTek Inc. All Rights Reserved. @@ -860,6 +876,10 @@ Signed-off-by: Weijie Gao + &snand_cap_read_from_cache_quad, + &snand_cap_program_load_x4, + mtk_snand_winbond_select_die), ++ SNAND_INFO("W25N01KV", SNAND_ID(SNAND_ID_DYMMY, 0xef, 0xae, 0x21), ++ SNAND_MEMORG_1G_2K_64, ++ &snand_cap_read_from_cache_quad, ++ &snand_cap_program_load_x4), + SNAND_INFO("W25N02KV", SNAND_ID(SNAND_ID_DYMMY, 0xef, 0xaa, 0x22), + SNAND_MEMORG_2G_2K_128, + &snand_cap_read_from_cache_quad, @@ -903,7 +923,7 @@ Signed-off-by: Weijie Gao + &snand_cap_program_load_x4), + SNAND_INFO("GD5F2GQ5UExxG", SNAND_ID(SNAND_ID_DYMMY, 0xc8, 0x52), + SNAND_MEMORG_2G_2K_128, -+ &snand_cap_read_from_cache_quad_q2d, ++ &snand_cap_read_from_cache_quad_a8d, + &snand_cap_program_load_x4), + SNAND_INFO("GD5F4GQ4UCxIG", SNAND_ID(SNAND_ID_DYMMY, 0xc8, 0xb4), + SNAND_MEMORG_4G_4K_256, From 948ad2ec7a21645bac4d523c8f31d1cc3e2eac71 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 10 Sep 2023 23:39:33 +0100 Subject: [PATCH 17/32] arm-trusted-firmware-mediatek: fix hang on reboot on MT7622 With recent updates of TF-A the previously already fixed bug slipped back into the source tree. Again, reorder bl2 init for MT7622 and initialize WDT only after DRAM init has completed to avoid the notorious hang. Signed-off-by: Daniel Golle --- .../arm-trusted-firmware-mediatek/Makefile | 2 +- ...mt7622-move-wdt-init-after-dram-init.patch | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 package/boot/arm-trusted-firmware-mediatek/patches/002-mt7622-move-wdt-init-after-dram-init.patch diff --git a/package/boot/arm-trusted-firmware-mediatek/Makefile b/package/boot/arm-trusted-firmware-mediatek/Makefile index 853049cfb0e..718ebf99e09 100644 --- a/package/boot/arm-trusted-firmware-mediatek/Makefile +++ b/package/boot/arm-trusted-firmware-mediatek/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=arm-trusted-firmware-mediatek -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git diff --git a/package/boot/arm-trusted-firmware-mediatek/patches/002-mt7622-move-wdt-init-after-dram-init.patch b/package/boot/arm-trusted-firmware-mediatek/patches/002-mt7622-move-wdt-init-after-dram-init.patch new file mode 100644 index 00000000000..4a4d252bebe --- /dev/null +++ b/package/boot/arm-trusted-firmware-mediatek/patches/002-mt7622-move-wdt-init-after-dram-init.patch @@ -0,0 +1,28 @@ +From 9e8cb08bc64530e7511b86a131cfad1ae0199586 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sun, 10 Sep 2023 23:35:47 +0100 +Subject: [PATCH] mt7622: move wdt init after dram init + +resolves hang on reboot +--- + plat/mediatek/mt7622/bl2/bl2_plat_init.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/plat/mediatek/mt7622/bl2/bl2_plat_init.c ++++ b/plat/mediatek/mt7622/bl2/bl2_plat_init.c +@@ -40,7 +40,6 @@ bool plat_is_my_cpu_primary(void) + const struct initcall bl2_initcalls[] = { + INITCALL(plat_mt_cpuxgpt_init), + INITCALL(generic_delay_timer_init), +- INITCALL(mtk_wdt_init), + INITCALL(mtk_print_cpu), + INITCALL(mtk_pin_init), + #ifndef IMAGE_BL2PL +@@ -49,6 +48,7 @@ const struct initcall bl2_initcalls[] = + INITCALL(mtk_pwrap_init), + INITCALL(mtk_pmic_init), + INITCALL(mtk_mem_init), ++ INITCALL(mtk_wdt_init), + + INITCALL(NULL) + }; From f1aaa267f0ea18ffe5840f3ce46a48be123d2f62 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Fri, 28 Jul 2023 11:41:14 +0200 Subject: [PATCH 18/32] ramips: add support for ALFA Network AX1800RM ALFA Network AX1800RM (FCC ID: 2AB877621) is a dual-band Wi-Fi 6 (AX1800) router, based on MediaTek MT7621A + MT79x5D platform. Specifications: - SOC: MT7621A (880 MHz) - DRAM: DDR3 256 MiB (Nanya NT5CC128M16JR-EK) - Flash: 16 MiB SPI NOR (EN25QH128A-104HIP) - Ethernet: 4x 10/100/1000 Mbps (SOC's built-in switch) - Wi-Fi: 2x2:2 2.4/5 GHz (MT7905DAN + MT7975DN) (MT7905DAN doesn't support background DFS scan/BT) - LED: 6x green, 1x green/red - Buttons: 2x (reset, WPS) - Antenna: 4x external, non-detachable omnidirectional - UART: 1x 4-pin (2.54 mm pitch, J4, not populated) - Power: 12 V DC/1 A (DC jack) MAC addresses: LAN: 00:c0:ca:xx:xx:4e (factory 0x4, +2) WAN: 00:c0:ca:xx:xx:4f (factory 0x4, +3) 2.4 GHz: 00:c0:ca:xx:xx:4c (factory 0x4, device's label) 5 GHz: 00:c0:ca:xx:xx:4c (factory 0xa) Flash instructions for web-based U-Boot recovery: 1. Power the device with WPS button pressed and wait around 10 seconds. 2. Setup static IP 192.168.1.2/24 on your PC. 3. Go to 192.168.1.1 in browser and upload 'recovery' image. The device runs LEDE 17.01 (kernel 4.4.x) based firmware with 'failsafe' mode available which allows alternative upgrade method: 1. Run device in 'failsafe' mode and change password for default user. 2. SSH to the device, transfer 'sysupgrade' image and perform upgrade in forced mode, without preserving settings: 'sysupgrade -n -F ...'. Other notes: If you own early version of this device, the vendor firmware might refuse OpenWrt image because of missing custom header. In that case, ask vendor's customer support for stock firmware without custom header support/requirement. Signed-off-by: Piotr Dymacz --- .../dts/mt7621_alfa-network_ax1800rm.dts | 216 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 12 + .../mt7621/base-files/etc/board.d/01_leds | 6 + .../mt7621/base-files/etc/board.d/02_network | 58 ++--- 4 files changed, 264 insertions(+), 28 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_alfa-network_ax1800rm.dts diff --git a/target/linux/ramips/dts/mt7621_alfa-network_ax1800rm.dts b/target/linux/ramips/dts/mt7621_alfa-network_ax1800rm.dts new file mode 100644 index 00000000000..1ef1f7fb31f --- /dev/null +++ b/target/linux/ramips/dts/mt7621_alfa-network_ax1800rm.dts @@ -0,0 +1,216 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "alfa-network,ax1800rm", "mediatek,mt7621-soc"; + model = "ALFA Network AX1800RM"; + + aliases { + label-mac-device = &wifi0; + led-boot = &led_power; + led-failsafe = &led_wan_red; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + lan1 { + label = "green:lan1"; + color = ; + function = LED_FUNCTION_LAN; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + }; + + lan2 { + label = "green:lan2"; + color = ; + function = LED_FUNCTION_LAN; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + lan3 { + label = "green:lan3"; + color = ; + function = LED_FUNCTION_LAN; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + led_power: power { + label = "green:power"; + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + + wan_green { + label = "green:wan"; + color = ; + function = LED_FUNCTION_WAN; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + led_wan_red: wan_red { + label = "red:wan"; + color = ; + function = LED_FUNCTION_WAN; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + m25p,fast-read; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; + + partition@40000 { + label = "boot-config"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "nvmem-cells"; + label = "factory"; + reg = <0x50000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom: eeprom@0 { + reg = <0x0 0xe00>; + }; + + macaddr: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@60000 { + label = "permanent_config"; + reg = <0x60000 0x80000>; + read-only; + }; + + partition@e0000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0xe0000 0xf20000>; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi0: wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + + nvmem-cells = <&eeprom>; + nvmem-cell-names = "eeprom"; + mediatek,disable-radar-background; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr 2>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr 3>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + + port@1 { + status = "okay"; + label = "lan2"; + }; + + port@2 { + status = "okay"; + label = "lan3"; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "jtag", "uart3", "wdt"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 338cbae5b6a..abcdc08ade3 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -209,6 +209,18 @@ define Device/afoundry_ew1200 endef TARGET_DEVICES += afoundry_ew1200 +define Device/alfa-network_ax1800rm + $(Device/dsa-migration) + IMAGE_SIZE := 15488k + DEVICE_VENDOR := ALFA Network + DEVICE_MODEL := AX1800RM + DEVICE_PACKAGES := kmod-mt7915-firmware + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + IMAGES += recovery.bin + IMAGE/recovery.bin := append-kernel | append-rootfs | pad-rootfs | check-size +endef +TARGET_DEVICES += alfa-network_ax1800rm + define Device/alfa-network_quad-e4g $(Device/dsa-migration) IMAGE_SIZE := 16064k diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 1e13c04c2f2..d4dfdf39e2e 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -7,6 +7,12 @@ board=$(board_name) board_config_update case $board in +alfa-network,ax1800rm) + ucidef_set_led_netdev "lan1" "lan1" "green:lan1" "lan1" + ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" + ucidef_set_led_netdev "lan3" "lan3" "green:lan3" "lan3" + ucidef_set_led_netdev "wan" "wan" "green:wan" "wan" + ;; asus,rp-ac87) ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_rssimon "wlan1" "200000" "1" 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 7bd5e83c5a1..a162cb9d1de 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 @@ -8,6 +8,26 @@ ramips_setup_interfaces() local board="$1" case $board in + alfa-network,ax1800rm|\ + ampedwireless,ally-r1900k|\ + asus,rt-ax53u|\ + gehua,ghl-r-001|\ + h3c,tx1800-plus|\ + h3c,tx1801-plus|\ + h3c,tx1806|\ + haier,har-20s2u1|\ + hiwifi,hc5962|\ + netgear,wax202|\ + sim,simax1800t|\ + xiaomi,mi-router-3-pro|\ + xiaomi,mi-router-ac2100|\ + xiaomi,mi-router-cr6606|\ + xiaomi,mi-router-cr6608|\ + xiaomi,mi-router-cr6609|\ + xiaomi,redmi-router-ac2100|\ + zyxel,wsm20) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" + ;; arcadyan,we420223-99) ucidef_set_interface_lan "swp0 swp1" ;; @@ -39,25 +59,6 @@ ramips_setup_interfaces() zyxel,nwa55axe) ucidef_set_interface_lan "lan" ;; - ampedwireless,ally-r1900k|\ - asus,rt-ax53u|\ - gehua,ghl-r-001|\ - h3c,tx1800-plus|\ - h3c,tx1801-plus|\ - h3c,tx1806|\ - haier,har-20s2u1|\ - hiwifi,hc5962|\ - netgear,wax202|\ - sim,simax1800t|\ - xiaomi,mi-router-3-pro|\ - xiaomi,mi-router-ac2100|\ - xiaomi,mi-router-cr6606|\ - xiaomi,mi-router-cr6608|\ - xiaomi,mi-router-cr6609|\ - xiaomi,redmi-router-ac2100|\ - zyxel,wsm20) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" - ;; asiarf,ap7621-001|\ humax,e10|\ wavlink,ws-wn572hp3-4g|\ @@ -166,6 +167,16 @@ ramips_setup_macs() local label_mac="" case $board in + alfa-network,ax1800rm|\ + jcg,y2|\ + wavlink,wl-wn531a6|\ + wavlink,wl-wn533a8|\ + winstars,ws-wn583a6|\ + zbtlink,zbt-we1326|\ + zbtlink,zbt-wg3526-16m|\ + zbtlink,zbt-wg3526-32m) + label_mac=$(mtd_get_mac_binary factory 0x4) + ;; ampedwireless,ally-00x19k) lan_mac=$(mtd_get_mac_ascii hwconfig HW.LAN.MAC.Address) label_mac=$lan_mac @@ -236,15 +247,6 @@ ramips_setup_macs() lan_mac=$(mtd_get_mac_ascii config ethaddr) wan_mac=$(macaddr_add "$lan_mac" 1) ;; - jcg,y2|\ - wavlink,wl-wn531a6|\ - wavlink,wl-wn533a8|\ - winstars,ws-wn583a6|\ - zbtlink,zbt-we1326|\ - zbtlink,zbt-wg3526-16m|\ - zbtlink,zbt-wg3526-32m) - label_mac=$(mtd_get_mac_binary factory 0x4) - ;; linksys,e5600|\ linksys,ea6350-v4|\ linksys,ea7300-v1|\ From 69f12c2f23c6d32a5fdda2385b4156c9b8bfae22 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Fri, 28 Jul 2023 12:21:49 +0200 Subject: [PATCH 19/32] uboot-envtools: ramips: add support for ALFA Network AX1800RM Signed-off-by: Piotr Dymacz --- package/boot/uboot-envtools/files/ramips | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 835b4ec3e12..a04c0616e57 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -24,16 +24,17 @@ sitecom,wlr-4100-v1-002|\ zyxel,keenetic-lite-iii-a) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000" ;; -arcadyan,we420223-99|\ -dlink,dir-806a-b1) - ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x1000" "0x1000" - ;; +alfa-network,ax1800rm|\ allnet,all0256n-4m|\ allnet,all0256n-8m|\ allnet,all5002|\ yuncore,ax820) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" ;; +arcadyan,we420223-99|\ +dlink,dir-806a-b1) + ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x1000" "0x1000" + ;; ampedwireless,ally-00x19k|\ ampedwireless,ally-r1900k) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000" "4" From f861292abcb77655a9792ead47d397d31f1c356e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 30 Aug 2023 12:31:44 +0200 Subject: [PATCH 20/32] mac80211: update to version 6.5 Signed-off-by: Felix Fietkau --- package/kernel/mac80211/Makefile | 8 +- .../patches/ath/400-ath_move_debug_code.patch | 4 +- .../patches/ath/402-ath_regd_optional.patch | 2 +- .../patches/ath/404-regd_no_assoc_hints.patch | 4 +- .../ath10k/080-ath10k_thermal_config.patch | 4 +- ...21-ath10k_init_devices_synchronously.patch | 2 +- .../930-ath10k_add_tpt_led_trigger.patch | 4 +- ...rolling-support-for-various-chipsets.patch | 24 +- ...75-ath10k-use-tpt-trigger-by-default.patch | 4 +- ...h10k-Try-to-get-mac-address-from-dts.patch | 2 +- ...k-always-use-mac80211-loss-detection.patch | 2 +- ...mi_msg_handler-data-structure-initi.patch} | 2 +- ...-tx-queues-immediately-upon-firmware.patch | 78 -- ...-ath11k-Don-t-exit-on-wakeup-failure.patch | 45 - ...ow-system-suspend-to-survive-ath11k.patch} | 0 ...-Fix-spelling-mistake-chnange-change.patch | 25 - ...-ath11k-suppress-add-interface-error.patch | 52 -- ...support-to-configure-channel-dwell-t.patch | 102 --- ...firmware-crash-on-vdev-delete-race-c.patch | 116 --- ...monitor-vdev-creation-with-firmware-.patch | 40 - ...hronize-ath11k_mac_he_gi_to_nl80211_.patch | 42 - ...-ath11k-Make-QMI-message-rules-const.patch | 341 ------- ...ger-sta-disconnect-on-hardware-resta.patch | 119 --- ...race-condition-with-struct-htt_ppdu_.patch | 103 --- ...-ath11k-update-hw-params-for-IPQ5018.patch | 125 --- ...update-ce-configurations-for-IPQ5018.patch | 246 ----- ...-remap-ce-register-space-for-IPQ5018.patch | 351 -------- ...11k-update-hal-srng-regs-for-IPQ5018.patch | 130 --- ...ath11k-initialize-hw_ops-for-IPQ5018.patch | 90 -- ...new-hw-ops-for-IPQ5018-to-get-rx-des.patch | 84 -- ...fi-ath11k-add-ipq5018-device-support.patch | 31 - ...scan-request-param-frame-size-warnin.patch | 161 ---- ...support-to-configure-FTM-responder-r.patch | 169 ---- ...-channel-177-into-5-GHz-channel-list.patch | 41 - ...ix-ce-memory-mapping-for-ahb-devices.patch | 114 --- ...ext-passive-scan-flag-to-adjust-pass.patch | 73 -- ...return-value-check-in-ath11k_ahb_pro.patch | 27 - ...platform_get_irq-to-get-the-interrup.patch | 50 -- ...SAC-bug-on-peer-addition-with-sta-ba.patch | 53 -- ...fy-accessor-macros-to-match-index-si.patch | 61 -- ...-MU-MIMO-params-from-hostapd-to-hard.patch | 300 ------- ...-HE-MCS-mapper-to-a-separate-functio.patch | 67 -- ...rate-rx-and-tx-mcs-maps-for-supporte.patch | 64 -- ...tx-ack-signal-support-for-management.patch | 150 ---- ...proper-regulatory-reference-for-band.patch | 216 ----- ...support-to-parse-new-WMI-event-for-6.patch | 844 ----------------- ...debug-prints-in-regulatory-WMI-event.patch | 567 ------------ ...ace-fake-flex-array-with-flexible-ar.patch | 246 ----- ...deinitialization-of-firmware-resourc.patch | 79 -- ...BUFFER_DONE-read-on-monitor-ring-rx-.patch | 130 --- ...wifi-ath11k-Optimize-6-GHz-scan-time.patch | 101 --- ...igure-the-FTM-responder-role-using-f.patch | 117 --- ...rssi-station-dump-not-updated-in-QCN.patch | 158 ---- ...invalid-management-rx-frame-length-i.patch | 115 --- ...-writing-to-unintended-memory-region.patch | 43 - ...-11d-scan-start-before-WMI_START_SCA.patch | 61 -- ...1k-Remove-redundant-pci_clear_master.patch | 58 -- ...ble-Spectral-scan-upon-removing-inte.patch | 36 - ...ath11k-enable-SAR-support-on-WCN6750.patch | 29 - ...pci-Add-more-MODULE_FIRMWARE-entries.patch | 36 - ...t-a-warning-when-crypto_alloc_shash-.patch | 34 - ...re-frags-from-uninitialized-peer-in-.patch | 104 --- ...-undefined-behavior-with-__fls-in-dp.patch | 29 - ...double-free-of-peer-rx_tid-during-re.patch | 144 --- ...wifi-ath11k-Prevent-REO-cmd-failures.patch | 43 - ...peer-mac-information-in-failure-case.patch | 74 -- ...tx-status-reporting-in-encap-offload.patch | 119 --- ...-incorrect-update-of-radiotap-fields.patch | 49 - ...SKB-corruption-in-REO-destination-ri.patch | 70 -- ...emove-disabling-of-80-80-and-160-MHz.patch | 49 - ...registration-of-6Ghz-only-phy-withou.patch | 61 -- ...ound-false-positive-stringop-overrea.patch | 84 -- ...k-driver-settings-for-MBSSID-and-EMA.patch | 133 --- ...ID-configuration-during-vdev-create-.patch | 215 ----- ...ame-MBSSID-fields-in-wmi_vdev_up_cmd.patch | 52 -- ...ID-parameter-configuration-in-AP-mod.patch | 138 --- ...efactor-vif-parameter-configurations.patch | 86 -- ...76-wifi-ath11k-MBSSID-beacon-support.patch | 190 ---- .../0077-wifi-ath11k-EMA-beacon-support.patch | 156 ---- ...cate-the-func-ath11k_mac_bitrate_mas.patch | 75 -- ...-HT-fixed-rate-in-WMI-peer-fixed-par.patch | 141 --- ...support-default-regdb-while-searchin.patch | 127 --- ...ve-unused-function-ath11k_tm_event_w.patch | 128 --- ...ifi-ath11k-factory-test-mode-support.patch | 850 ------------------ ...w-ath11k-to-boot-without-caldata-in-.patch | 47 - ...11k-Add-HTT-stats-for-PHY-reset-case.patch | 261 ------ ...k-control-thermal-support-via-symbol.patch | 8 +- ...upport-setting-FW-memory-mode-via-DT.patch | 4 +- ...tersection-support-for-regulatory-ru.patch | 4 +- ..._hw-issue-external-reset-for-QCA955x.patch | 8 +- .../ath9k/511-ath9k_reduce_rxbuf.patch | 2 +- .../ath9k/512-ath9k_channelbw_debugfs.patch | 2 +- .../patches/ath9k/530-ath9k_extra_leds.patch | 6 +- .../ath9k/543-ath9k_entropy_from_adc.patch | 6 +- .../ath9k/548-ath9k_enable_gpio_chip.patch | 8 +- .../ath9k/549-ath9k_enable_gpio_buttons.patch | 2 +- .../ath9k/551-ath9k_ubnt_uap_plus_hsr.patch | 2 +- .../patches/ath9k/552-ath9k-ahb_of.patch | 4 +- ...und-bug-with-some-inconsistent-BSSes.patch | 2 +- ...62-brcmfmac-Disable-power-management.patch | 2 +- ...-in-driver-tables-with-country-codes.patch | 2 +- ...d-alternative-firmware-names-from-DT.patch | 16 +- .../patches/build/060-no_local_ssb_bcma.patch | 4 +- .../patches/build/080-resv_start_op.patch | 10 +- .../build/110-backport_namepace_const.patch | 14 + .../build/110-backport_napi_build_skb.patch | 11 - ...ifi-Use-generic-thermal_zone_get_tri.patch | 159 ++++ .../patches/build/210-revert-split-op.patch | 22 + .../801-libertas-configure-sysfs-links.patch | 2 +- .../802-libertas-set-wireless-macaddr.patch | 2 +- ...ringified-name-of-command-in-error-l.patch | 2 +- .../602-rt2x00-introduce-rt2x00eeprom.patch | 6 +- ...0-rt2x00-change-led-polarity-from-OF.patch | 2 +- .../611-rt2x00-add-AP+STA-support.patch | 2 +- ...t-support-for-external-LNA-on-MT7620.patch | 4 +- ...-differentiate-based-on-SoC-CHIP_VER.patch | 6 +- ...-rework-MT7620-PA-LNA-RF-calibration.patch | 4 +- .../110-mac80211_keep_keys_on_stop_ap.patch | 2 +- .../mac80211/patches/subsys/210-ap_scan.patch | 2 +- ...domize-BA-session-dialog-token-alloc.patch | 2 +- ...crease-quantum-for-airtime-scheduler.patch | 8 +- ...d-internal-handler-for-wake_tx_queue.patch | 183 ---- ...dd-wake_tx_queue-callback-to-drivers.patch | 396 -------- ...c80211-Drop-support-for-TX-push-path.patch | 683 -------------- ...ltek-remove-duplicated-wake_tx_queue.patch | 32 - ...sh-fast-tx-cache-into-local-proxied.patch} | 14 +- ...port-for-restricting-netdev-features.patch | 506 ----------- ...x-and-simplify-unencrypted-drop-chec.patch | 87 -- ...ve-A-MSDU-check-in-ieee80211_data_to.patch | 25 - ...ctor-out-bridge-tunnel-RFC1042-heade.patch | 76 -- ...move-mesh-forwarding-congestion-chec.patch | 54 -- ...x-receiving-A-MSDU-frames-on-mesh-in.patch | 762 ---------------- ...d-a-workaround-for-receiving-non-sta.patch | 145 --- ...x-race-in-mesh-sequence-number-assig.patch | 37 - ...wifi-mac80211-mesh-fast-xmit-support.patch | 850 ------------------ ...e-mesh-header-cache-to-speed-up-mesh.patch | 132 --- .../321-mac80211-fix-mesh-forwarding.patch | 32 - ...x-mesh-path-discovery-based-on-unica.patch | 52 -- ...d-VHT-MU-MIMO-related-flags-in-ieee8.patch | 68 -- ...d-HE-MU-MIMO-related-flags-in-ieee80.patch | 68 -- ...troduce-ieee80211_refresh_tx_agg_ses.patch | 60 -- ...fi-mac80211-add-mesh-fast-rx-support.patch | 77 -- ...d-support-for-letting-drivers-regist.patch | 149 --- ...x-receiving-mesh-packets-in-forwardi.patch | 50 -- ...orrectly-mark-FTM-frames-non-buffera.patch | 134 --- ...mac80211-flush-queues-on-STA-removal.patch | 36 - ...i-mvm-support-flush-on-AP-interfaces.patch | 34 - ...3-wifi-mac80211-add-flush_sta-method.patch | 91 -- ...ifi-mvm-support-new-flush_sta-method.patch | 53 -- ...d-LDPC-related-flags-in-ieee80211_bs.patch | 62 -- ...0211-generate-EMA-beacons-in-AP-mode.patch | 372 -------- ...sband-iftype-data-lookup-for-AP_VLAN.patch | 23 - ...x-receving-mesh-packets-without-RFC1.patch | 25 - .../patches/subsys/400-allow-ibss-mixed.patch | 2 +- 154 files changed, 302 insertions(+), 15217 deletions(-) rename package/kernel/mac80211/patches/ath11k/{0012-wifi-ath11k-Fix-qmi_msg_handler-data-structure-initi.patch => 0001-wifi-ath11k-Fix-qmi_msg_handler-data-structure-initi.patch} (94%) delete mode 100644 package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-stop-tx-queues-immediately-upon-firmware.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-Don-t-exit-on-wakeup-failure.patch rename package/kernel/mac80211/patches/ath11k/{0037-wifi-ath11k-allow-system-suspend-to-survive-ath11k.patch => 0002-wifi-ath11k-allow-system-suspend-to-survive-ath11k.patch} (100%) delete mode 100644 package/kernel/mac80211/patches/ath11k/0005-wifi-ath11k-Fix-spelling-mistake-chnange-change.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0007-wifi-ath11k-suppress-add-interface-error.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0008-wifi-ath11k-add-support-to-configure-channel-dwell-t.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0010-wifi-ath11k-Fix-firmware-crash-on-vdev-delete-race-c.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0011-wifi-ath11k-fix-monitor-vdev-creation-with-firmware-.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0013-wifi-ath11k-synchronize-ath11k_mac_he_gi_to_nl80211_.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0016-wifi-ath11k-Make-QMI-message-rules-const.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0017-wifi-ath11k-Trigger-sta-disconnect-on-hardware-resta.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0018-wifi-ath11k-Fix-race-condition-with-struct-htt_ppdu_.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-update-hw-params-for-IPQ5018.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0020-wifi-ath11k-update-ce-configurations-for-IPQ5018.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0021-wifi-ath11k-remap-ce-register-space-for-IPQ5018.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-update-hal-srng-regs-for-IPQ5018.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0023-wifi-ath11k-initialize-hw_ops-for-IPQ5018.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0024-wifi-ath11k-add-new-hw-ops-for-IPQ5018-to-get-rx-des.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0025-wifi-ath11k-add-ipq5018-device-support.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0029-wifi-ath11k-Add-support-to-configure-FTM-responder-r.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0030-wifi-ath11k-add-channel-177-into-5-GHz-channel-list.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-fix-ce-memory-mapping-for-ahb-devices.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0033-wifi-ath11k-Set-ext-passive-scan-flag-to-adjust-pass.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0034-wifi-ath11k-fix-return-value-check-in-ath11k_ahb_pro.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0035-wifi-ath11k-Use-platform_get_irq-to-get-the-interrup.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0036-wifi-ath11k-fix-SAC-bug-on-peer-addition-with-sta-ba.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0038-wifi-ath11k-modify-accessor-macros-to-match-index-si.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0039-wifi-ath11k-push-MU-MIMO-params-from-hostapd-to-hard.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0040-wifi-ath11k-move-HE-MCS-mapper-to-a-separate-functio.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0041-wifi-ath11k-generate-rx-and-tx-mcs-maps-for-supporte.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0042-wifi-ath11k-Add-tx-ack-signal-support-for-management.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0043-wifi-ath11k-use-proper-regulatory-reference-for-band.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0044-wifi-ath11k-add-support-to-parse-new-WMI-event-for-6.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0045-wifi-ath11k-add-debug-prints-in-regulatory-WMI-event.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0046-wifi-ath11k-Replace-fake-flex-array-with-flexible-ar.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0047-wifi-ath11k-fix-deinitialization-of-firmware-resourc.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0048-wifi-ath11k-fix-BUFFER_DONE-read-on-monitor-ring-rx-.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0049-wifi-ath11k-Optimize-6-GHz-scan-time.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0050-wifi-ath11k-Configure-the-FTM-responder-role-using-f.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0051-wifi-ath11k-fix-rssi-station-dump-not-updated-in-QCN.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0052-wifi-ath11k-Fix-invalid-management-rx-frame-length-i.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0053-wifi-ath11k-fix-writing-to-unintended-memory-region.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0054-wifi-ath11k-Send-11d-scan-start-before-WMI_START_SCA.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0055-wifi-ath11k-Remove-redundant-pci_clear_master.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0056-wifi-ath11k-Disable-Spectral-scan-upon-removing-inte.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0057-wifi-ath11k-enable-SAR-support-on-WCN6750.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0058-wifi-ath11k-pci-Add-more-MODULE_FIRMWARE-entries.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0059-wifi-ath11k-print-a-warning-when-crypto_alloc_shash-.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0060-wifi-ath11k-Ignore-frags-from-uninitialized-peer-in-.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0061-wifi-ath11k-fix-undefined-behavior-with-__fls-in-dp.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0062-wifi-ath11k-fix-double-free-of-peer-rx_tid-during-re.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0063-wifi-ath11k-Prevent-REO-cmd-failures.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0064-wifi-ath11k-add-peer-mac-information-in-failure-case.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0065-wifi-ath11k-fix-tx-status-reporting-in-encap-offload.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0066-wifi-ath11k-Fix-incorrect-update-of-radiotap-fields.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0067-wifi-ath11k-Fix-SKB-corruption-in-REO-destination-ri.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0068-wifi-ath11k-Remove-disabling-of-80-80-and-160-MHz.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0069-wifi-ath11k-fix-registration-of-6Ghz-only-phy-withou.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0070-wifi-ath-work-around-false-positive-stringop-overrea.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0071-wifi-ath11k-driver-settings-for-MBSSID-and-EMA.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0072-wifi-ath11k-MBSSID-configuration-during-vdev-create-.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0073-wifi-ath11k-rename-MBSSID-fields-in-wmi_vdev_up_cmd.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0074-wifi-ath11k-MBSSID-parameter-configuration-in-AP-mod.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0075-wifi-ath11k-refactor-vif-parameter-configurations.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0076-wifi-ath11k-MBSSID-beacon-support.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0077-wifi-ath11k-EMA-beacon-support.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0078-wifi-ath11k-Relocate-the-func-ath11k_mac_bitrate_mas.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0079-wifi-ath11k-Send-HT-fixed-rate-in-WMI-peer-fixed-par.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0080-wifi-ath11k-add-support-default-regdb-while-searchin.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0081-wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0082-wifi-ath11k-factory-test-mode-support.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0083-wifi-ath11k-Allow-ath11k-to-boot-without-caldata-in-.patch delete mode 100644 package/kernel/mac80211/patches/ath11k/0084-wifi-ath11k-Add-HTT-stats-for-PHY-reset-case.patch create mode 100644 package/kernel/mac80211/patches/build/110-backport_namepace_const.patch delete mode 100644 package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch create mode 100644 package/kernel/mac80211/patches/build/200-Revert-wifi-iwlwifi-Use-generic-thermal_zone_get_tri.patch create mode 100644 package/kernel/mac80211/patches/build/210-revert-split-op.patch delete mode 100644 package/kernel/mac80211/patches/subsys/306-01-v6.2-wifi-mac80211-add-internal-handler-for-wake_tx_queue.patch delete mode 100644 package/kernel/mac80211/patches/subsys/306-02-v6.2-wifi-mac80211-add-wake_tx_queue-callback-to-drivers.patch delete mode 100644 package/kernel/mac80211/patches/subsys/306-03-v6.2-wifi-mac80211-Drop-support-for-TX-push-path.patch delete mode 100644 package/kernel/mac80211/patches/subsys/306-04-v6.2-wifi-realtek-remove-duplicated-wake_tx_queue.patch rename package/kernel/mac80211/patches/subsys/{338-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch => 310-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch} (94%) delete mode 100644 package/kernel/mac80211/patches/subsys/310-v6.2-mac80211-add-support-for-restricting-netdev-features.patch delete mode 100644 package/kernel/mac80211/patches/subsys/311-v6.2-wifi-mac80211-fix-and-simplify-unencrypted-drop-chec.patch delete mode 100644 package/kernel/mac80211/patches/subsys/312-v6.3-wifi-cfg80211-move-A-MSDU-check-in-ieee80211_data_to.patch delete mode 100644 package/kernel/mac80211/patches/subsys/313-v6.3-wifi-cfg80211-factor-out-bridge-tunnel-RFC1042-heade.patch delete mode 100644 package/kernel/mac80211/patches/subsys/314-v6.3-wifi-mac80211-remove-mesh-forwarding-congestion-chec.patch delete mode 100644 package/kernel/mac80211/patches/subsys/315-v6.3-wifi-mac80211-fix-receiving-A-MSDU-frames-on-mesh-in.patch delete mode 100644 package/kernel/mac80211/patches/subsys/316-v6.3-wifi-mac80211-add-a-workaround-for-receiving-non-sta.patch delete mode 100644 package/kernel/mac80211/patches/subsys/318-wifi-mac80211-fix-race-in-mesh-sequence-number-assig.patch delete mode 100644 package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch delete mode 100644 package/kernel/mac80211/patches/subsys/320-wifi-mac80211-use-mesh-header-cache-to-speed-up-mesh.patch delete mode 100644 package/kernel/mac80211/patches/subsys/321-mac80211-fix-mesh-forwarding.patch delete mode 100644 package/kernel/mac80211/patches/subsys/322-wifi-mac80211-fix-mesh-path-discovery-based-on-unica.patch delete mode 100644 package/kernel/mac80211/patches/subsys/323-v6.3-wifi-mac80211-Add-VHT-MU-MIMO-related-flags-in-ieee8.patch delete mode 100644 package/kernel/mac80211/patches/subsys/324-v6.3-wifi-mac80211-Add-HE-MU-MIMO-related-flags-in-ieee80.patch delete mode 100644 package/kernel/mac80211/patches/subsys/325-wifi-mac80211-introduce-ieee80211_refresh_tx_agg_ses.patch delete mode 100644 package/kernel/mac80211/patches/subsys/326-wifi-mac80211-add-mesh-fast-rx-support.patch delete mode 100644 package/kernel/mac80211/patches/subsys/327-wifi-mac80211-add-support-for-letting-drivers-regist.patch delete mode 100644 package/kernel/mac80211/patches/subsys/329-wifi-mac80211-fix-receiving-mesh-packets-in-forwardi.patch delete mode 100644 package/kernel/mac80211/patches/subsys/330-wifi-ieee80211-correctly-mark-FTM-frames-non-buffera.patch delete mode 100644 package/kernel/mac80211/patches/subsys/331-wifi-mac80211-flush-queues-on-STA-removal.patch delete mode 100644 package/kernel/mac80211/patches/subsys/332-wifi-iwlwifi-mvm-support-flush-on-AP-interfaces.patch delete mode 100644 package/kernel/mac80211/patches/subsys/333-wifi-mac80211-add-flush_sta-method.patch delete mode 100644 package/kernel/mac80211/patches/subsys/334-wifi-iwlwifi-mvm-support-new-flush_sta-method.patch delete mode 100644 package/kernel/mac80211/patches/subsys/335-wifi-mac80211-add-LDPC-related-flags-in-ieee80211_bs.patch delete mode 100644 package/kernel/mac80211/patches/subsys/336-v6.4-wifi-mac80211-generate-EMA-beacons-in-AP-mode.patch delete mode 100644 package/kernel/mac80211/patches/subsys/337-mac80211-fix-sband-iftype-data-lookup-for-AP_VLAN.patch delete mode 100644 package/kernel/mac80211/patches/subsys/339-wifi-cfg80211-fix-receving-mesh-packets-without-RFC1.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index a7472ee7794..c9e2a37f6d6 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,11 +10,11 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=6.1.24 -PKG_RELEASE:=4 +PKG_VERSION:=6.5 +PKG_RELEASE:=1 # PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.58/ PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/ -PKG_HASH:=5d39aca7e34c33cb9b3e366117b2e86841b7bdd37933679d6b1e61be6b150648 +PKG_HASH:=908c22dceba185eab83caa5a1e58ce6b3ebdc58f099c3fd3e11c7352ebfab2d7 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) @@ -164,7 +164,7 @@ define KernelPackage/mac80211-hwsim $(call KernelPackage/mac80211/Default) TITLE:=mac80211 HW simulation device DEPENDS+= +kmod-mac80211 +@DRIVER_11AX_SUPPORT +@DRIVER_11AC_SUPPORT - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/virtual/mac80211_hwsim.ko AUTOLOAD:=$(call AutoProbe,mac80211_hwsim) endef diff --git a/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch b/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch index eacc72776e0..4c6b175ebe2 100644 --- a/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch +++ b/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/Makefile +++ b/drivers/net/wireless/ath/Makefile -@@ -15,10 +15,10 @@ ath-objs := main.o \ +@@ -16,10 +16,10 @@ ath-objs := main.o \ regd.o \ hw.o \ key.o \ @@ -14,7 +14,7 @@ CFLAGS_trace.o := -I$(src) --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h -@@ -317,14 +317,7 @@ void _ath_dbg(struct ath_common *common, +@@ -319,14 +319,7 @@ void _ath_dbg(struct ath_common *common, #endif /* CPTCFG_ATH_DEBUG */ /** Returns string describing opmode, or NULL if unknown mode. */ 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 fd5493de71d..601ebdc7583 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 -@@ -102,6 +102,7 @@ ADM8211= +@@ -101,6 +101,7 @@ ADM8211= ATH_COMMON= WLAN_VENDOR_ATH= ATH_DEBUG= diff --git a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch index 8d83921a3b8..d0f4b15772f 100644 --- a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch +++ b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch @@ -1,6 +1,6 @@ --- a/net/wireless/reg.c +++ b/net/wireless/reg.c -@@ -3370,6 +3370,8 @@ void regulatory_hint_country_ie(struct w +@@ -3340,6 +3340,8 @@ void regulatory_hint_country_ie(struct w enum environment_cap env = ENVIRON_ANY; struct regulatory_request *request = NULL, *lr; @@ -9,7 +9,7 @@ /* IE len must be evenly divisible by 2 */ if (country_ie_len & 0x01) return; -@@ -3621,6 +3623,7 @@ static bool is_wiphy_all_set_reg_flag(en +@@ -3591,6 +3593,7 @@ static bool is_wiphy_all_set_reg_flag(en void regulatory_hint_disconnect(void) { 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 41ad6006b5c..f1b5ce1f1b2 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 -@@ -86,6 +86,12 @@ config ATH10K_TRACING +@@ -87,6 +87,12 @@ config ATH10K_TRACING help Select this to ath10k use tracing infrastructure. @@ -37,7 +37,7 @@ void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature); --- a/local-symbols +++ b/local-symbols -@@ -161,6 +161,7 @@ ATH10K_SNOC= +@@ -160,6 +160,7 @@ ATH10K_SNOC= ATH10K_DEBUG= ATH10K_DEBUGFS= ATH10K_SPECTRAL= 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 7a38cf3e4ed..adfeb3eaaea 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 -@@ -3516,6 +3516,16 @@ int ath10k_core_register(struct ath10k * +@@ -3507,6 +3507,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 e8beed17e8f..1a043f7b15e 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 -@@ -9909,6 +9909,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -9917,6 +9917,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[] = { -@@ -10267,6 +10282,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -10275,6 +10290,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-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index 1c1630c0519..2465470a577 100644 --- a/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -85,7 +85,7 @@ v13: create mode 100644 drivers/net/wireless/ath/ath10k/leds.h --- a/drivers/net/wireless/ath/ath10k/Kconfig +++ b/drivers/net/wireless/ath/ath10k/Kconfig -@@ -71,6 +71,16 @@ config ATH10K_DEBUGFS +@@ -72,6 +72,16 @@ config ATH10K_DEBUGFS If unsure, say Y to make it easier to debug problems. @@ -114,7 +114,7 @@ v13: ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o --- a/local-symbols +++ b/local-symbols -@@ -162,6 +162,7 @@ ATH10K_DEBUG= +@@ -161,6 +161,7 @@ ATH10K_DEBUG= ATH10K_DEBUGFS= ATH10K_SPECTRAL= ATH10K_THERMAL= @@ -172,7 +172,7 @@ v13: .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -3231,6 +3237,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -3222,6 +3228,10 @@ int ath10k_core_start(struct ath10k *ar, goto err_hif_stop; } @@ -183,7 +183,7 @@ v13: return 0; err_hif_stop: -@@ -3489,9 +3499,18 @@ static void ath10k_core_register_work(st +@@ -3480,9 +3490,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -202,7 +202,7 @@ v13: err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -3537,6 +3556,8 @@ void ath10k_core_unregister(struct ath10 +@@ -3528,6 +3547,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; @@ -221,7 +221,7 @@ v13: #include "htt.h" #include "htc.h" -@@ -1253,6 +1254,13 @@ struct ath10k { +@@ -1256,6 +1257,13 @@ struct ath10k { } testmode; struct { @@ -456,7 +456,7 @@ v13: { --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c -@@ -4594,6 +4594,8 @@ static const struct wmi_ops wmi_tlv_ops +@@ -4601,6 +4601,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, @@ -517,7 +517,7 @@ v13: static struct sk_buff * ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, enum wmi_sta_ps_mode psmode) -@@ -9160,6 +9203,9 @@ static const struct wmi_ops wmi_ops = { +@@ -9138,6 +9181,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, @@ -527,7 +527,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9230,6 +9276,8 @@ static const struct wmi_ops wmi_10_1_ops +@@ -9208,6 +9254,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, @@ -536,7 +536,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9302,6 +9350,8 @@ static const struct wmi_ops wmi_10_2_ops +@@ -9280,6 +9328,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, @@ -545,7 +545,7 @@ v13: /* .gen_pdev_enable_adaptive_cca not implemented */ }; -@@ -9373,6 +9423,8 @@ static const struct wmi_ops wmi_10_2_4_o +@@ -9351,6 +9401,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, @@ -554,7 +554,7 @@ v13: /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9454,6 +9506,8 @@ static const struct wmi_ops wmi_10_4_ops +@@ -9432,6 +9484,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, 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 4c1f9aa815c..95bd48f9235 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 -@@ -1309,6 +1309,10 @@ struct ath10k { +@@ -1312,6 +1312,10 @@ struct ath10k { s32 tx_power_2g_limit; s32 tx_power_5g_limit; @@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin if (ret) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -10284,7 +10284,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -10292,7 +10292,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; #ifdef CPTCFG_MAC80211_LEDS 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 084e28a2d92..cfa0f9108af 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 -@@ -3407,6 +3408,8 @@ static int ath10k_core_probe_fw(struct a +@@ -3398,6 +3399,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/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch b/package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch index f025fea63b7..5a62ea3fc22 100644 --- a/package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch +++ b/package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch @@ -18,7 +18,7 @@ Signed-off-by: David Bauer --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -10080,7 +10080,6 @@ int ath10k_mac_register(struct ath10k *a +@@ -10088,7 +10088,6 @@ int ath10k_mac_register(struct ath10k *a ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); ieee80211_hw_set(ar->hw, QUEUE_CONTROL); ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); diff --git a/package/kernel/mac80211/patches/ath11k/0012-wifi-ath11k-Fix-qmi_msg_handler-data-structure-initi.patch b/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-Fix-qmi_msg_handler-data-structure-initi.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0012-wifi-ath11k-Fix-qmi_msg_handler-data-structure-initi.patch rename to package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-Fix-qmi_msg_handler-data-structure-initi.patch index fccfa4385a7..a3349736633 100644 --- a/package/kernel/mac80211/patches/ath11k/0012-wifi-ath11k-Fix-qmi_msg_handler-data-structure-initi.patch +++ b/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-Fix-qmi_msg_handler-data-structure-initi.patch @@ -21,7 +21,7 @@ Link: https://lore.kernel.org/r/20221021090126.28626-1-quic_rbhattac@quicinc.com --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -1702,6 +1702,9 @@ static struct qmi_elem_info qmi_wlfw_fw_ +@@ -1702,6 +1702,9 @@ static const struct qmi_elem_info qmi_wl .data_type = QMI_EOTI, .array_type = NO_ARRAY, }, diff --git a/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-stop-tx-queues-immediately-upon-firmware.patch b/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-stop-tx-queues-immediately-upon-firmware.patch deleted file mode 100644 index d0dc04febf7..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-stop-tx-queues-immediately-upon-firmware.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 81e60b2dfb2744ab6642c4aa62534b4f711fdc5d Mon Sep 17 00:00:00 2001 -From: Aditya Kumar Singh -Date: Tue, 27 Sep 2022 09:18:54 +0300 -Subject: [PATCH] wifi: ath11k: stop tx queues immediately upon firmware exit - -Currently, recovery flag is set immediately upon firmware -exit but tx queues are stopped once firmware arrives back -and is ready which is during ath11k_core_restart. Once -ieee80211 hw restart is completed, tx queues are resumed. -If during the time delta between firmware exit and firmware -ready, mac80211 send packets, currently ath11k will drop it -since recovery flag will be set. But warning prints will -come - - "ath11k c000000.wifi: failed to transmit frame -108" - -If more tx packets are there, this could lead to flooding -of above print. - -However, actually tx queues should be stopped immediately -when firmware leaves. This will prevent packets to get -dropped when firmware is recovering. - -Add fix to stop tx queues immediately after firmware exit. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aditya Kumar Singh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20220923170235.18873-1-quic_adisi@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 5 +---- - drivers/net/wireless/ath/ath11k/core.h | 1 + - drivers/net/wireless/ath/ath11k/qmi.c | 3 +++ - 3 files changed, 5 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -1641,7 +1641,7 @@ static void ath11k_update_11d(struct wor - } - } - --static void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab) -+void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab) - { - struct ath11k *ar; - struct ath11k_pdev *pdev; -@@ -1730,9 +1730,6 @@ static void ath11k_core_restart(struct w - struct ath11k_base *ab = container_of(work, struct ath11k_base, restart_work); - int ret; - -- if (!ab->is_reset) -- ath11k_core_pre_reconfigure_recovery(ab); -- - ret = ath11k_core_reconfigure_on_crash(ab); - if (ret) { - ath11k_err(ab, "failed to reconfigure driver on crash recovery\n"); ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -1158,6 +1158,7 @@ int ath11k_core_check_smbios(struct ath1 - void ath11k_core_halt(struct ath11k *ar); - int ath11k_core_resume(struct ath11k_base *ab); - int ath11k_core_suspend(struct ath11k_base *ab); -+void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab); - - const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab, - const char *filename); ---- a/drivers/net/wireless/ath/ath11k/qmi.c -+++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -3164,6 +3164,9 @@ static void ath11k_qmi_driver_event_work - case ATH11K_QMI_EVENT_SERVER_EXIT: - set_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags); - set_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags); -+ -+ if (!ab->is_reset) -+ ath11k_core_pre_reconfigure_recovery(ab); - break; - case ATH11K_QMI_EVENT_REQUEST_MEM: - ret = ath11k_qmi_event_mem_request(qmi); diff --git a/package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-Don-t-exit-on-wakeup-failure.patch b/package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-Don-t-exit-on-wakeup-failure.patch deleted file mode 100644 index 47385e0458e..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-Don-t-exit-on-wakeup-failure.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 45d2e268369b0c768d5a644f319758bcfd370521 Mon Sep 17 00:00:00 2001 -From: Baochen Qiang -Date: Wed, 28 Sep 2022 09:51:40 +0800 -Subject: [PATCH] wifi: ath11k: Don't exit on wakeup failure - -Currently, ath11k_pcic_read() returns an error if wakeup() -fails, this makes firmware crash debug quite hard because we can -get nothing. - -Change to go ahead on wakeup failure, in that case we still may -get something valid to check. There should be no mislead due -to incorrect content because we are aware of the failure with the -log printed. - -Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 - -Signed-off-by: Baochen Qiang -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20220928015140.5431-1-quic_bqiang@quicinc.com ---- - drivers/net/wireless/ath/ath11k/pcic.c | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/pcic.c -+++ b/drivers/net/wireless/ath/ath11k/pcic.c -@@ -218,9 +218,16 @@ int ath11k_pcic_read(struct ath11k_base - if (wakeup_required && ab->pci.ops->wakeup) { - ret = ab->pci.ops->wakeup(ab); - if (ret) { -- ath11k_warn(ab, "failed to wakeup for read from 0x%x: %d\n", -- start, ret); -- return ret; -+ ath11k_warn(ab, -+ "wakeup failed, data may be invalid: %d", -+ ret); -+ /* Even though wakeup() failed, continue processing rather -+ * than returning because some parts of the data may still -+ * be valid and useful in some cases, e.g. could give us -+ * some clues on firmware crash. -+ * Mislead due to invalid data could be avoided because we -+ * are aware of the wakeup failure. -+ */ - } - } - diff --git a/package/kernel/mac80211/patches/ath11k/0037-wifi-ath11k-allow-system-suspend-to-survive-ath11k.patch b/package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-allow-system-suspend-to-survive-ath11k.patch similarity index 100% rename from package/kernel/mac80211/patches/ath11k/0037-wifi-ath11k-allow-system-suspend-to-survive-ath11k.patch rename to package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-allow-system-suspend-to-survive-ath11k.patch diff --git a/package/kernel/mac80211/patches/ath11k/0005-wifi-ath11k-Fix-spelling-mistake-chnange-change.patch b/package/kernel/mac80211/patches/ath11k/0005-wifi-ath11k-Fix-spelling-mistake-chnange-change.patch deleted file mode 100644 index 4b52252ef34..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0005-wifi-ath11k-Fix-spelling-mistake-chnange-change.patch +++ /dev/null @@ -1,25 +0,0 @@ -From a797f479bf3e02c6d179c2e6aeace7f9b22b0acd Mon Sep 17 00:00:00 2001 -From: Colin Ian King -Date: Wed, 28 Sep 2022 15:38:34 +0100 -Subject: [PATCH] wifi: ath11k: Fix spelling mistake "chnange" -> "change" - -There is a spelling mistake in an ath11k_dbg debug message. Fix it. - -Signed-off-by: Colin Ian King -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20220928143834.35189-1-colin.i.king@gmail.com ---- - drivers/net/wireless/ath/ath11k/wmi.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -6829,7 +6829,7 @@ static void ath11k_wmi_event_peer_sta_ps - } - - ath11k_dbg(ab, ATH11K_DBG_WMI, -- "peer sta ps chnange ev addr %pM state %u sup_bitmap %x ps_valid %u ts %u\n", -+ "peer sta ps change ev addr %pM state %u sup_bitmap %x ps_valid %u ts %u\n", - ev->peer_macaddr.addr, ev->peer_ps_state, - ev->ps_supported_bitmap, ev->peer_ps_valid, - ev->peer_ps_timestamp); diff --git a/package/kernel/mac80211/patches/ath11k/0007-wifi-ath11k-suppress-add-interface-error.patch b/package/kernel/mac80211/patches/ath11k/0007-wifi-ath11k-suppress-add-interface-error.patch deleted file mode 100644 index fbef0abb8db..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0007-wifi-ath11k-suppress-add-interface-error.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 638b26652b0438563a76ec90014c8cba34db982b Mon Sep 17 00:00:00 2001 -From: Karthikeyan Periyasamy -Date: Thu, 6 Oct 2022 06:28:42 +0530 -Subject: [PATCH 7/9] wifi: ath11k: suppress add interface error - -In the VIF (other than monitor type) creation request, we should not -throw the error code when the monitor VIF creation fails, since the -actual VIF creation succeeds. If we throw the error code from driver -then the actual VIF creation get fail. So suppress the monitor VIF -creation error by throwing warning message instead of error code. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.6.0.1-00760-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Karthikeyan Periyasamy -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221006005842.8599-1-quic_periyasa@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6421,18 +6421,16 @@ static int ath11k_mac_op_add_interface(s - - ath11k_dp_vdev_tx_attach(ar, arvif); - -+ ath11k_debugfs_add_interface(arvif); -+ - if (vif->type != NL80211_IFTYPE_MONITOR && - test_bit(ATH11K_FLAG_MONITOR_CONF_ENABLED, &ar->monitor_flags)) { - ret = ath11k_mac_monitor_vdev_create(ar); -- if (ret) { -+ if (ret) - ath11k_warn(ar->ab, "failed to create monitor vdev during add interface: %d", - ret); -- goto err_peer_del; -- } - } - -- ath11k_debugfs_add_interface(arvif); -- - mutex_unlock(&ar->conf_mutex); - - return 0; -@@ -6457,7 +6455,6 @@ err_vdev_del: - spin_unlock_bh(&ar->data_lock); - - err: -- ath11k_debugfs_remove_interface(arvif); - mutex_unlock(&ar->conf_mutex); - - return ret; diff --git a/package/kernel/mac80211/patches/ath11k/0008-wifi-ath11k-add-support-to-configure-channel-dwell-t.patch b/package/kernel/mac80211/patches/ath11k/0008-wifi-ath11k-add-support-to-configure-channel-dwell-t.patch deleted file mode 100644 index d0b19fe59f5..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0008-wifi-ath11k-add-support-to-configure-channel-dwell-t.patch +++ /dev/null @@ -1,102 +0,0 @@ -From c362daa213cdeb0a9e7c2ed84849544c24505720 Mon Sep 17 00:00:00 2001 -From: Manikanta Pubbisetty -Date: Fri, 7 Oct 2022 10:41:30 +0530 -Subject: [PATCH 8/9] wifi: ath11k: add support to configure channel dwell time - -Add support to configure channel dwell time during scan. -Dwell time help to stay on the channel for a specified duration -during scan and aid userspace in finding WiFi networks. Very -useful in passive scans where longer dwell times are needed -to find the WiFi networks. - -Configure channel dwell time from duration of the scan request -received from mac80211 when the duration is non-zero. When the -scan request does not have duration value, use the default ones, -the current implementation. - -Advertise corresponding feature flag NL80211_EXT_FEATURE_SET_SCAN_DWELL -to enable the feature. - -Change is applicable for all ath11k hardware. - -Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 - -Signed-off-by: Manikanta Pubbisetty -Reviewed-by: Jeff Johnson -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221007051130.6067-1-quic_mpubbise@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 33 +++++++++++++++++++++++---- - 1 file changed, 29 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -241,7 +241,10 @@ const struct htt_rx_ring_tlv_filter ath1 - #define ath11k_a_rates (ath11k_legacy_rates + 4) - #define ath11k_a_rates_size (ARRAY_SIZE(ath11k_legacy_rates) - 4) - --#define ATH11K_MAC_SCAN_TIMEOUT_MSECS 200 /* in msecs */ -+#define ATH11K_MAC_SCAN_CMD_EVT_OVERHEAD 200 /* in msecs */ -+ -+/* Overhead due to the processing of channel switch events from FW */ -+#define ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD 10 /* in msecs */ - - static const u32 ath11k_smps_map[] = { - [WLAN_HT_CAP_SM_PS_STATIC] = WMI_PEER_SMPS_STATIC, -@@ -3612,6 +3615,7 @@ static int ath11k_mac_op_hw_scan(struct - struct scan_req_params arg; - int ret = 0; - int i; -+ u32 scan_timeout; - - mutex_lock(&ar->conf_mutex); - -@@ -3681,6 +3685,26 @@ static int ath11k_mac_op_hw_scan(struct - ether_addr_copy(arg.mac_mask.addr, req->mac_addr_mask); - } - -+ /* if duration is set, default dwell times will be overwritten */ -+ if (req->duration) { -+ arg.dwell_time_active = req->duration; -+ arg.dwell_time_active_2g = req->duration; -+ arg.dwell_time_active_6g = req->duration; -+ arg.dwell_time_passive = req->duration; -+ arg.dwell_time_passive_6g = req->duration; -+ arg.burst_duration = req->duration; -+ -+ scan_timeout = min_t(u32, arg.max_rest_time * -+ (arg.num_chan - 1) + (req->duration + -+ ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD) * -+ arg.num_chan, arg.max_scan_time); -+ } else { -+ scan_timeout = arg.max_scan_time; -+ } -+ -+ /* Add a margin to account for event/command processing */ -+ scan_timeout += ATH11K_MAC_SCAN_CMD_EVT_OVERHEAD; -+ - ret = ath11k_start_scan(ar, &arg); - if (ret) { - ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret); -@@ -3689,10 +3713,8 @@ static int ath11k_mac_op_hw_scan(struct - spin_unlock_bh(&ar->data_lock); - } - -- /* Add a 200ms margin to account for event/command processing */ - ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, -- msecs_to_jiffies(arg.max_scan_time + -- ATH11K_MAC_SCAN_TIMEOUT_MSECS)); -+ msecs_to_jiffies(scan_timeout)); - - exit: - kfree(arg.chan_list); -@@ -9060,6 +9082,9 @@ static int __ath11k_mac_register(struct - NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP); - } - -+ wiphy_ext_feature_set(ar->hw->wiphy, -+ NL80211_EXT_FEATURE_SET_SCAN_DWELL); -+ - ath11k_reg_init(ar); - - if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { diff --git a/package/kernel/mac80211/patches/ath11k/0010-wifi-ath11k-Fix-firmware-crash-on-vdev-delete-race-c.patch b/package/kernel/mac80211/patches/ath11k/0010-wifi-ath11k-Fix-firmware-crash-on-vdev-delete-race-c.patch deleted file mode 100644 index 7275af06ea2..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0010-wifi-ath11k-Fix-firmware-crash-on-vdev-delete-race-c.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 3811fa1f231f1a3e29759efef4992116604aab8b Mon Sep 17 00:00:00 2001 -From: Sowmiya Sree Elavalagan -Date: Tue, 11 Oct 2022 15:23:46 +0530 -Subject: [PATCH] wifi: ath11k: Fix firmware crash on vdev delete race - condition - -Current code does not wait for vdev delete completion on vdev create -failures and tries to send another vdev create followed by vdev set -param to firmware with same vdev id. This causes firmware crash. -Fix this crash by waiting for vdev delete completion on vdev -create failures. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.6.0.1-00905-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sowmiya Sree Elavalagan -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221011095346.3901-1-quic_ssreeela@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 60 +++++++++++++++++---------- - 1 file changed, 37 insertions(+), 23 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6233,6 +6233,40 @@ void ath11k_mac_11d_scan_stop_all(struct - } - } - -+static int ath11k_mac_vdev_delete(struct ath11k *ar, struct ath11k_vif *arvif) -+{ -+ unsigned long time_left; -+ struct ieee80211_vif *vif = arvif->vif; -+ int ret = 0; -+ -+ lockdep_assert_held(&ar->conf_mutex); -+ -+ reinit_completion(&ar->vdev_delete_done); -+ -+ ret = ath11k_wmi_vdev_delete(ar, arvif->vdev_id); -+ if (ret) { -+ ath11k_warn(ar->ab, "failed to delete WMI vdev %d: %d\n", -+ arvif->vdev_id, ret); -+ return ret; -+ } -+ -+ time_left = wait_for_completion_timeout(&ar->vdev_delete_done, -+ ATH11K_VDEV_DELETE_TIMEOUT_HZ); -+ if (time_left == 0) { -+ ath11k_warn(ar->ab, "Timeout in receiving vdev delete response\n"); -+ return -ETIMEDOUT; -+ } -+ -+ ar->ab->free_vdev_map |= 1LL << (arvif->vdev_id); -+ ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); -+ ar->num_created_vdevs--; -+ -+ ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %pM deleted, vdev_id %d\n", -+ vif->addr, arvif->vdev_id); -+ -+ return ret; -+} -+ - static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) - { -@@ -6468,10 +6502,7 @@ err_peer_del: - } - - err_vdev_del: -- ath11k_wmi_vdev_delete(ar, arvif->vdev_id); -- ar->num_created_vdevs--; -- ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); -- ab->free_vdev_map |= 1LL << arvif->vdev_id; -+ ath11k_mac_vdev_delete(ar, arvif); - spin_lock_bh(&ar->data_lock); - list_del(&arvif->list); - spin_unlock_bh(&ar->data_lock); -@@ -6499,7 +6530,6 @@ 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; -- unsigned long time_left; - int ret; - int i; - -@@ -6520,29 +6550,13 @@ static void ath11k_mac_op_remove_interfa - arvif->vdev_id, ret); - } - -- reinit_completion(&ar->vdev_delete_done); -- -- ret = ath11k_wmi_vdev_delete(ar, arvif->vdev_id); -+ ret = ath11k_mac_vdev_delete(ar, arvif); - if (ret) { -- ath11k_warn(ab, "failed to delete WMI vdev %d: %d\n", -+ ath11k_warn(ab, "failed to delete vdev %d: %d\n", - arvif->vdev_id, ret); - goto err_vdev_del; - } - -- time_left = wait_for_completion_timeout(&ar->vdev_delete_done, -- ATH11K_VDEV_DELETE_TIMEOUT_HZ); -- if (time_left == 0) { -- ath11k_warn(ab, "Timeout in receiving vdev delete response\n"); -- goto err_vdev_del; -- } -- -- ab->free_vdev_map |= 1LL << (arvif->vdev_id); -- ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); -- ar->num_created_vdevs--; -- -- ath11k_dbg(ab, ATH11K_DBG_MAC, "vdev %pM deleted, vdev_id %d\n", -- vif->addr, arvif->vdev_id); -- - if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { - clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); - ar->monitor_vdev_id = -1; diff --git a/package/kernel/mac80211/patches/ath11k/0011-wifi-ath11k-fix-monitor-vdev-creation-with-firmware-.patch b/package/kernel/mac80211/patches/ath11k/0011-wifi-ath11k-fix-monitor-vdev-creation-with-firmware-.patch deleted file mode 100644 index 2f066d0a565..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0011-wifi-ath11k-fix-monitor-vdev-creation-with-firmware-.patch +++ /dev/null @@ -1,40 +0,0 @@ -From f3ca72b0327101a074a871539e61775d43908ca4 Mon Sep 17 00:00:00 2001 -From: Nagarajan Maran -Date: Fri, 14 Oct 2022 21:20:54 +0530 -Subject: [PATCH] wifi: ath11k: fix monitor vdev creation with firmware - recovery - -During firmware recovery, the monitor interface is not -getting created in the driver and firmware since -the respective flags are not updated properly. - -So after firmware recovery is successful, when monitor -interface is brought down manually, firmware assertion -is observed, since we are trying to bring down the -interface which is not yet created in the firmware. - -Fix this by updating the monitor flags properly per -phy#, during firmware recovery. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Nagarajan Maran -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221014155054.11471-1-quic_nmaran@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -1677,6 +1677,10 @@ void ath11k_core_pre_reconfigure_recover - ath11k_mac_tx_mgmt_pending_free, ar); - idr_destroy(&ar->txmgmt_idr); - wake_up(&ar->txmgmt_empty_waitq); -+ -+ ar->monitor_vdev_id = -1; -+ clear_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags); -+ clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); - } - - wake_up(&ab->wmi_ab.tx_credits_wq); diff --git a/package/kernel/mac80211/patches/ath11k/0013-wifi-ath11k-synchronize-ath11k_mac_he_gi_to_nl80211_.patch b/package/kernel/mac80211/patches/ath11k/0013-wifi-ath11k-synchronize-ath11k_mac_he_gi_to_nl80211_.patch deleted file mode 100644 index 1e89b4d4f21..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0013-wifi-ath11k-synchronize-ath11k_mac_he_gi_to_nl80211_.patch +++ /dev/null @@ -1,42 +0,0 @@ -From dd1c2322694522f674c874f5fa02ac5ae39135dd Mon Sep 17 00:00:00 2001 -From: "Jiri Slaby (SUSE)" -Date: Mon, 31 Oct 2022 12:43:41 +0100 -Subject: [PATCH] wifi: ath11k: synchronize - ath11k_mac_he_gi_to_nl80211_he_gi()'s return type - -ath11k_mac_he_gi_to_nl80211_he_gi() generates a valid warning with gcc-13: - drivers/net/wireless/ath/ath11k/mac.c:321:20: error: conflicting types for 'ath11k_mac_he_gi_to_nl80211_he_gi' due to enum/integer mismatch; have 'enum nl80211_he_gi(u8)' - drivers/net/wireless/ath/ath11k/mac.h:166:5: note: previous declaration of 'ath11k_mac_he_gi_to_nl80211_he_gi' with type 'u32(u8)' - -I.e. the type of the return value ath11k_mac_he_gi_to_nl80211_he_gi() in -the declaration is u32, while the definition spells enum nl80211_he_gi. -Synchronize them to the latter. - -Cc: Martin Liska -Cc: Kalle Valo -Cc: "David S. Miller" -Cc: Eric Dumazet -Cc: Jakub Kicinski -Cc: Paolo Abeni -Cc: ath11k@lists.infradead.org -Cc: linux-wireless@vger.kernel.org -Cc: netdev@vger.kernel.org -Signed-off-by: Jiri Slaby (SUSE) -Reviewed-by: Jeff Johnson -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221031114341.10377-1-jirislaby@kernel.org ---- - drivers/net/wireless/ath/ath11k/mac.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.h -+++ b/drivers/net/wireless/ath/ath11k/mac.h -@@ -163,7 +163,7 @@ void ath11k_mac_drain_tx(struct ath11k * - void ath11k_mac_peer_cleanup_all(struct ath11k *ar); - int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx); - u8 ath11k_mac_bw_to_mac80211_bw(u8 bw); --u32 ath11k_mac_he_gi_to_nl80211_he_gi(u8 sgi); -+enum nl80211_he_gi ath11k_mac_he_gi_to_nl80211_he_gi(u8 sgi); - enum nl80211_he_ru_alloc ath11k_mac_phy_he_ru_to_nl80211_he_ru_alloc(u16 ru_phy); - enum nl80211_he_ru_alloc ath11k_mac_he_ru_tones_to_nl80211_he_ru_alloc(u16 ru_tones); - enum ath11k_supported_bw ath11k_mac_mac80211_bw_to_ath11k_bw(enum rate_info_bw bw); diff --git a/package/kernel/mac80211/patches/ath11k/0016-wifi-ath11k-Make-QMI-message-rules-const.patch b/package/kernel/mac80211/patches/ath11k/0016-wifi-ath11k-Make-QMI-message-rules-const.patch deleted file mode 100644 index 1f48df73f75..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0016-wifi-ath11k-Make-QMI-message-rules-const.patch +++ /dev/null @@ -1,341 +0,0 @@ -From 93c1592889fca46d09d833455628bab05516cdbf Mon Sep 17 00:00:00 2001 -From: Jeff Johnson -Date: Wed, 14 Sep 2022 17:23:03 -0700 -Subject: [PATCH] wifi: ath11k: Make QMI message rules const - -Commit ff6d365898d4 ("soc: qcom: qmi: use const for struct -qmi_elem_info") allows QMI message encoding/decoding rules to be -const, so do that for ath11k. - -Compile tested only. - -Signed-off-by: Jeff Johnson -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20220915002303.12206-1-quic_jjohnson@quicinc.com ---- - drivers/net/wireless/ath/ath11k/qmi.c | 72 +++++++++++++-------------- - 1 file changed, 36 insertions(+), 36 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/qmi.c -+++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -29,7 +29,7 @@ module_param_named(cold_boot_cal, ath11k - MODULE_PARM_DESC(cold_boot_cal, - "Decrease the channel switch time but increase the driver load time (Default: true)"); - --static struct qmi_elem_info qmi_wlanfw_host_cap_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_host_cap_req_msg_v01_ei[] = { - { - .data_type = QMI_OPT_FLAG, - .elem_len = 1, -@@ -280,7 +280,7 @@ static struct qmi_elem_info qmi_wlanfw_h - }, - }; - --static struct qmi_elem_info qmi_wlanfw_host_cap_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_host_cap_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -297,7 +297,7 @@ static struct qmi_elem_info qmi_wlanfw_h - }, - }; - --static struct qmi_elem_info qmi_wlanfw_ind_register_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_ind_register_req_msg_v01_ei[] = { - { - .data_type = QMI_OPT_FLAG, - .elem_len = 1, -@@ -522,7 +522,7 @@ static struct qmi_elem_info qmi_wlanfw_i - }, - }; - --static struct qmi_elem_info qmi_wlanfw_ind_register_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_ind_register_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -558,7 +558,7 @@ static struct qmi_elem_info qmi_wlanfw_i - }, - }; - --static struct qmi_elem_info qmi_wlanfw_mem_cfg_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_mem_cfg_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_8_BYTE, - .elem_len = 1, -@@ -590,7 +590,7 @@ static struct qmi_elem_info qmi_wlanfw_m - }, - }; - --static struct qmi_elem_info qmi_wlanfw_mem_seg_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_mem_seg_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -632,7 +632,7 @@ static struct qmi_elem_info qmi_wlanfw_m - }, - }; - --static struct qmi_elem_info qmi_wlanfw_request_mem_ind_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_request_mem_ind_msg_v01_ei[] = { - { - .data_type = QMI_DATA_LEN, - .elem_len = 1, -@@ -659,7 +659,7 @@ static struct qmi_elem_info qmi_wlanfw_r - }, - }; - --static struct qmi_elem_info qmi_wlanfw_mem_seg_resp_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_mem_seg_resp_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_8_BYTE, - .elem_len = 1, -@@ -699,7 +699,7 @@ static struct qmi_elem_info qmi_wlanfw_m - }, - }; - --static struct qmi_elem_info qmi_wlanfw_respond_mem_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_respond_mem_req_msg_v01_ei[] = { - { - .data_type = QMI_DATA_LEN, - .elem_len = 1, -@@ -726,7 +726,7 @@ static struct qmi_elem_info qmi_wlanfw_r - }, - }; - --static struct qmi_elem_info qmi_wlanfw_respond_mem_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_respond_mem_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -744,7 +744,7 @@ static struct qmi_elem_info qmi_wlanfw_r - }, - }; - --static struct qmi_elem_info qmi_wlanfw_cap_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_cap_req_msg_v01_ei[] = { - { - .data_type = QMI_EOTI, - .array_type = NO_ARRAY, -@@ -752,7 +752,7 @@ static struct qmi_elem_info qmi_wlanfw_c - }, - }; - --static struct qmi_elem_info qmi_wlanfw_device_info_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_device_info_req_msg_v01_ei[] = { - { - .data_type = QMI_EOTI, - .array_type = NO_ARRAY, -@@ -760,7 +760,7 @@ static struct qmi_elem_info qmi_wlanfw_d - }, - }; - --static struct qmi_elem_info qmi_wlfw_device_info_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlfw_device_info_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -814,7 +814,7 @@ static struct qmi_elem_info qmi_wlfw_dev - }, - }; - --static struct qmi_elem_info qmi_wlanfw_rf_chip_info_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_rf_chip_info_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -840,7 +840,7 @@ static struct qmi_elem_info qmi_wlanfw_r - }, - }; - --static struct qmi_elem_info qmi_wlanfw_rf_board_info_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_rf_board_info_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -857,7 +857,7 @@ static struct qmi_elem_info qmi_wlanfw_r - }, - }; - --static struct qmi_elem_info qmi_wlanfw_soc_info_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_soc_info_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -873,7 +873,7 @@ static struct qmi_elem_info qmi_wlanfw_s - }, - }; - --static struct qmi_elem_info qmi_wlanfw_fw_version_info_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_fw_version_info_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -899,7 +899,7 @@ static struct qmi_elem_info qmi_wlanfw_f - }, - }; - --static struct qmi_elem_info qmi_wlanfw_cap_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_cap_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -1100,7 +1100,7 @@ static struct qmi_elem_info qmi_wlanfw_c - }, - }; - --static struct qmi_elem_info qmi_wlanfw_bdf_download_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_bdf_download_req_msg_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_1_BYTE, - .elem_len = 1, -@@ -1235,7 +1235,7 @@ static struct qmi_elem_info qmi_wlanfw_b - }, - }; - --static struct qmi_elem_info qmi_wlanfw_bdf_download_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_bdf_download_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -1253,7 +1253,7 @@ static struct qmi_elem_info qmi_wlanfw_b - }, - }; - --static struct qmi_elem_info qmi_wlanfw_m3_info_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_m3_info_req_msg_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_8_BYTE, - .elem_len = 1, -@@ -1277,7 +1277,7 @@ static struct qmi_elem_info qmi_wlanfw_m - }, - }; - --static struct qmi_elem_info qmi_wlanfw_m3_info_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_m3_info_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -1294,7 +1294,7 @@ static struct qmi_elem_info qmi_wlanfw_m - }, - }; - --static struct qmi_elem_info qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -1347,7 +1347,7 @@ static struct qmi_elem_info qmi_wlanfw_c - }, - }; - --static struct qmi_elem_info qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -1382,7 +1382,7 @@ static struct qmi_elem_info qmi_wlanfw_c - }, - }; - --static struct qmi_elem_info qmi_wlanfw_shadow_reg_cfg_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_shadow_reg_cfg_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_2_BYTE, - .elem_len = 1, -@@ -1406,7 +1406,7 @@ static struct qmi_elem_info qmi_wlanfw_s - }, - }; - --static struct qmi_elem_info qmi_wlanfw_shadow_reg_v2_cfg_s_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_shadow_reg_v2_cfg_s_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -1423,7 +1423,7 @@ static struct qmi_elem_info qmi_wlanfw_s - }, - }; - --static struct qmi_elem_info qmi_wlanfw_wlan_mode_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_wlan_mode_req_msg_v01_ei[] = { - { - .data_type = QMI_UNSIGNED_4_BYTE, - .elem_len = 1, -@@ -1458,7 +1458,7 @@ static struct qmi_elem_info qmi_wlanfw_w - }, - }; - --static struct qmi_elem_info qmi_wlanfw_wlan_mode_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_wlan_mode_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -1476,7 +1476,7 @@ static struct qmi_elem_info qmi_wlanfw_w - }, - }; - --static struct qmi_elem_info qmi_wlanfw_wlan_cfg_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_wlan_cfg_req_msg_v01_ei[] = { - { - .data_type = QMI_OPT_FLAG, - .elem_len = 1, -@@ -1615,7 +1615,7 @@ static struct qmi_elem_info qmi_wlanfw_w - }, - }; - --static struct qmi_elem_info qmi_wlanfw_wlan_cfg_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_wlan_cfg_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -1632,28 +1632,28 @@ static struct qmi_elem_info qmi_wlanfw_w - }, - }; - --static struct qmi_elem_info qmi_wlanfw_mem_ready_ind_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_mem_ready_ind_msg_v01_ei[] = { - { - .data_type = QMI_EOTI, - .array_type = NO_ARRAY, - }, - }; - --static struct qmi_elem_info qmi_wlanfw_fw_ready_ind_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_fw_ready_ind_msg_v01_ei[] = { - { - .data_type = QMI_EOTI, - .array_type = NO_ARRAY, - }, - }; - --static struct qmi_elem_info qmi_wlanfw_cold_boot_cal_done_ind_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_cold_boot_cal_done_ind_msg_v01_ei[] = { - { - .data_type = QMI_EOTI, - .array_type = NO_ARRAY, - }, - }; - --static struct qmi_elem_info qmi_wlanfw_wlan_ini_req_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_wlan_ini_req_msg_v01_ei[] = { - { - .data_type = QMI_OPT_FLAG, - .elem_len = 1, -@@ -1679,7 +1679,7 @@ static struct qmi_elem_info qmi_wlanfw_w - }, - }; - --static struct qmi_elem_info qmi_wlanfw_wlan_ini_resp_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlanfw_wlan_ini_resp_msg_v01_ei[] = { - { - .data_type = QMI_STRUCT, - .elem_len = 1, -@@ -1697,7 +1697,7 @@ static struct qmi_elem_info qmi_wlanfw_w - }, - }; - --static struct qmi_elem_info qmi_wlfw_fw_init_done_ind_msg_v01_ei[] = { -+static const struct qmi_elem_info qmi_wlfw_fw_init_done_ind_msg_v01_ei[] = { - { - .data_type = QMI_EOTI, - .array_type = NO_ARRAY, diff --git a/package/kernel/mac80211/patches/ath11k/0017-wifi-ath11k-Trigger-sta-disconnect-on-hardware-resta.patch b/package/kernel/mac80211/patches/ath11k/0017-wifi-ath11k-Trigger-sta-disconnect-on-hardware-resta.patch deleted file mode 100644 index f95e5027b25..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0017-wifi-ath11k-Trigger-sta-disconnect-on-hardware-resta.patch +++ /dev/null @@ -1,119 +0,0 @@ -From a018750a2cceaf4427c4ee3d9ce3e83a171d5bd6 Mon Sep 17 00:00:00 2001 -From: Youghandhar Chintala -Date: Fri, 4 Nov 2022 14:24:03 +0530 -Subject: [PATCH] wifi: ath11k: Trigger sta disconnect on hardware restart - -Currently after the hardware restart triggered from the driver, the -station interface connection remains intact, since a disconnect trigger -is not sent to userspace. This can lead to a problem in targets where -the wifi mac sequence is added by the firmware. - -After the target restart, its wifi mac sequence number gets reset to -zero. Hence AP to which our device is connected will receive frames with -a wifi mac sequence number jump to the past, thereby resulting in the -AP dropping all these frames, until the frame arrives with a wifi mac -sequence number which AP was expecting. - -To avoid such frame drops, its better to trigger a station disconnect -upon target hardware restart which can be done with API -ieee80211_reconfig_disconnect exposed to mac80211. - -The other targets are not affected by this change, since the hardware -params flag is not set. - -Reported-by: kernel test robot - -Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 - -Signed-off-by: Youghandhar Chintala -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221104085403.11025-1-quic_youghand@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 6 ++++++ - drivers/net/wireless/ath/ath11k/hw.h | 1 + - drivers/net/wireless/ath/ath11k/mac.c | 7 +++++++ - 3 files changed, 14 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -195,6 +195,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -+ .support_fw_mac_sequence = false, - }, - { - .name = "qca6390 hw2.0", -@@ -277,6 +278,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -+ .support_fw_mac_sequence = true, - }, - { - .name = "qcn9074 hw1.0", -@@ -356,6 +358,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -+ .support_fw_mac_sequence = false, - }, - { - .name = "wcn6855 hw2.0", -@@ -438,6 +441,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -+ .support_fw_mac_sequence = true, - }, - { - .name = "wcn6855 hw2.1", -@@ -519,6 +523,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -+ .support_fw_mac_sequence = true, - }, - { - .name = "wcn6750 hw1.0", -@@ -597,6 +602,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = false, - .tx_ring_size = DP_TCL_DATA_RING_SIZE_WCN6750, - .smp2p_wow_exit = true, -+ .support_fw_mac_sequence = true, - }, - }; - ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -219,6 +219,7 @@ struct ath11k_hw_params { - bool tcl_ring_retry; - u32 tx_ring_size; - bool smp2p_wow_exit; -+ bool support_fw_mac_sequence; - }; - - struct ath11k_hw_ops { ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -8010,6 +8010,7 @@ ath11k_mac_op_reconfig_complete(struct i - struct ath11k *ar = hw->priv; - struct ath11k_base *ab = ar->ab; - int recovery_count; -+ struct ath11k_vif *arvif; - - if (reconfig_type != IEEE80211_RECONFIG_TYPE_RESTART) - return; -@@ -8045,6 +8046,12 @@ ath11k_mac_op_reconfig_complete(struct i - ath11k_dbg(ab, ATH11K_DBG_BOOT, "reset success\n"); - } - } -+ if (ar->ab->hw_params.support_fw_mac_sequence) { -+ list_for_each_entry(arvif, &ar->arvifs, list) { -+ if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_STA) -+ ieee80211_hw_restart_disconnect(arvif->vif); -+ } -+ } - } - - mutex_unlock(&ar->conf_mutex); diff --git a/package/kernel/mac80211/patches/ath11k/0018-wifi-ath11k-Fix-race-condition-with-struct-htt_ppdu_.patch b/package/kernel/mac80211/patches/ath11k/0018-wifi-ath11k-Fix-race-condition-with-struct-htt_ppdu_.patch deleted file mode 100644 index cef61ee3448..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0018-wifi-ath11k-Fix-race-condition-with-struct-htt_ppdu_.patch +++ /dev/null @@ -1,103 +0,0 @@ -From e44de90453bb2b46a523df78c39eb896bab35dcd Mon Sep 17 00:00:00 2001 -From: Govindaraj Saminathan -Date: Tue, 29 Nov 2022 13:04:02 +0200 -Subject: [PATCH] wifi: ath11k: Fix race condition with struct - htt_ppdu_stats_info - -A crash happens when running the traffic with multiple clients: - -Crash Signature : Unable to handle kernel paging request at -virtual address ffffffd700970918 During the crash, PC points to -"ieee80211_tx_rate_update+0x30/0x68 [mac80211]" -LR points to "ath11k_dp_htt_htc_t2h_msg_handler+0x5a8/0x8a0 [ath11k]". - -Struct ppdu_stats_info is allocated and accessed from event callback via copy -engine tasklet, this has a problem when freeing it from ath11k_mac_op_stop(). - -Use data_lock during entire ath11k_dp_htt_get_ppdu_desc() call to protect -struct htt_ppdu_stats_info access and to avoid race condition when accessing it -from ath11k_mac_op_stop(). - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Govindaraj Saminathan -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221124071104.22506-1-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -1535,13 +1535,12 @@ struct htt_ppdu_stats_info *ath11k_dp_ht - { - struct htt_ppdu_stats_info *ppdu_info; - -- spin_lock_bh(&ar->data_lock); -+ lockdep_assert_held(&ar->data_lock); -+ - if (!list_empty(&ar->ppdu_stats_info)) { - list_for_each_entry(ppdu_info, &ar->ppdu_stats_info, list) { -- if (ppdu_info->ppdu_id == ppdu_id) { -- spin_unlock_bh(&ar->data_lock); -+ if (ppdu_info->ppdu_id == ppdu_id) - return ppdu_info; -- } - } - - if (ar->ppdu_stat_list_depth > HTT_PPDU_DESC_MAX_DEPTH) { -@@ -1553,16 +1552,13 @@ struct htt_ppdu_stats_info *ath11k_dp_ht - kfree(ppdu_info); - } - } -- spin_unlock_bh(&ar->data_lock); - - ppdu_info = kzalloc(sizeof(*ppdu_info), GFP_ATOMIC); - if (!ppdu_info) - return NULL; - -- spin_lock_bh(&ar->data_lock); - list_add_tail(&ppdu_info->list, &ar->ppdu_stats_info); - ar->ppdu_stat_list_depth++; -- spin_unlock_bh(&ar->data_lock); - - return ppdu_info; - } -@@ -1586,16 +1582,17 @@ static int ath11k_htt_pull_ppdu_stats(st - ar = ath11k_mac_get_ar_by_pdev_id(ab, pdev_id); - if (!ar) { - ret = -EINVAL; -- goto exit; -+ goto out; - } - - if (ath11k_debugfs_is_pktlog_lite_mode_enabled(ar)) - trace_ath11k_htt_ppdu_stats(ar, skb->data, len); - -+ spin_lock_bh(&ar->data_lock); - ppdu_info = ath11k_dp_htt_get_ppdu_desc(ar, ppdu_id); - if (!ppdu_info) { - ret = -EINVAL; -- goto exit; -+ goto out_unlock_data; - } - - ppdu_info->ppdu_id = ppdu_id; -@@ -1604,10 +1601,13 @@ static int ath11k_htt_pull_ppdu_stats(st - (void *)ppdu_info); - if (ret) { - ath11k_warn(ab, "Failed to parse tlv %d\n", ret); -- goto exit; -+ goto out_unlock_data; - } - --exit: -+out_unlock_data: -+ spin_unlock_bh(&ar->data_lock); -+ -+out: - rcu_read_unlock(); - - return ret; diff --git a/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-update-hw-params-for-IPQ5018.patch b/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-update-hw-params-for-IPQ5018.patch deleted file mode 100644 index 25d39ddb0d3..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-update-hw-params-for-IPQ5018.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 8dfe875aa24aec68baf6702018633c84c2c1feca Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:13 +0200 -Subject: [PATCH] wifi: ath11k: update hw params for IPQ5018 - -Add new compatible string for IPQ5018 and add -required hw params for IPQ5018. The hw descriptors size and -datapath ops are similar to QCN9074, hence reuse the same. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-3-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 71 ++++++++++++++++++++++++++ - drivers/net/wireless/ath/ath11k/core.h | 8 +++ - 2 files changed, 79 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -604,6 +604,77 @@ static const struct ath11k_hw_params ath - .smp2p_wow_exit = true, - .support_fw_mac_sequence = true, - }, -+ { -+ .hw_rev = ATH11K_HW_IPQ5018_HW10, -+ .name = "ipq5018 hw1.0", -+ .fw = { -+ .dir = "IPQ5018/hw1.0", -+ .board_size = 256 * 1024, -+ .cal_offset = 128 * 1024, -+ }, -+ .max_radios = MAX_RADIOS_5018, -+ .bdf_addr = 0x4BA00000, -+ /* hal_desc_sz and hw ops are similar to qcn9074 */ -+ .hal_desc_sz = sizeof(struct hal_rx_desc_qcn9074), -+ .qmi_service_ins_id = ATH11K_QMI_WLFW_SERVICE_INS_ID_V01_IPQ8074, -+ .ring_mask = &ath11k_hw_ring_mask_ipq8074, -+ .credit_flow = false, -+ .max_tx_ring = 1, -+ .spectral = { -+ .fft_sz = 2, -+ .fft_pad_sz = 0, -+ .summary_pad_sz = 16, -+ .fft_hdr_len = 24, -+ .max_fft_bins = 1024, -+ }, -+ .internal_sleep_clock = false, -+ .host_ce_config = ath11k_host_ce_config_qcn9074, -+ .ce_count = CE_CNT_5018, -+ .rxdma1_enable = true, -+ .num_rxmda_per_pdev = RXDMA_PER_PDEV_5018, -+ .rx_mac_buf_ring = false, -+ .vdev_start_delay = false, -+ .htt_peer_map_v2 = true, -+ .interface_modes = BIT(NL80211_IFTYPE_STATION) | -+ BIT(NL80211_IFTYPE_AP) | -+ BIT(NL80211_IFTYPE_MESH_POINT), -+ .supports_monitor = false, -+ .supports_sta_ps = false, -+ .supports_shadow_regs = false, -+ .fw_mem_mode = 0, -+ .num_vdevs = 16 + 1, -+ .num_peers = 512, -+ .supports_regdb = false, -+ .idle_ps = false, -+ .supports_suspend = false, -+ .hal_params = &ath11k_hw_hal_params_ipq8074, -+ .single_pdev_only = false, -+ .cold_boot_calib = true, -+ .fix_l1ss = true, -+ .supports_dynamic_smps_6ghz = false, -+ .alloc_cacheable_memory = true, -+ .supports_rssi_stats = false, -+ .fw_wmi_diag_event = false, -+ .current_cc_support = false, -+ .dbr_debug_support = true, -+ .global_reset = false, -+ .bios_sar_capa = NULL, -+ .m3_fw_support = false, -+ .fixed_bdf_addr = true, -+ .fixed_mem_region = true, -+ .static_window_map = false, -+ .hybrid_bus_type = false, -+ .fixed_fw_mem = false, -+ .support_off_channel_tx = false, -+ .supports_multi_bssid = false, -+ -+ .sram_dump = {}, -+ -+ .tcl_ring_retry = true, -+ .tx_ring_size = DP_TCL_DATA_RING_SIZE, -+ .smp2p_wow_exit = false, -+ .support_fw_mac_sequence = false, -+ }, - }; - - static inline struct ath11k_pdev *ath11k_core_get_single_pdev(struct ath11k_base *ab) ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -142,6 +142,7 @@ enum ath11k_hw_rev { - ATH11K_HW_WCN6855_HW20, - ATH11K_HW_WCN6855_HW21, - ATH11K_HW_WCN6750_HW10, -+ ATH11K_HW_IPQ5018_HW10, - }; - - enum ath11k_firmware_mode { -@@ -230,6 +231,13 @@ struct ath11k_he { - - #define MAX_RADIOS 3 - -+/* ipq5018 hw param macros */ -+#define MAX_RADIOS_5018 1 -+#define CE_CNT_5018 6 -+#define TARGET_CE_CNT_5018 9 -+#define SVC_CE_MAP_LEN_5018 17 -+#define RXDMA_PER_PDEV_5018 1 -+ - enum { - WMI_HOST_TP_SCALE_MAX = 0, - WMI_HOST_TP_SCALE_50 = 1, diff --git a/package/kernel/mac80211/patches/ath11k/0020-wifi-ath11k-update-ce-configurations-for-IPQ5018.patch b/package/kernel/mac80211/patches/ath11k/0020-wifi-ath11k-update-ce-configurations-for-IPQ5018.patch deleted file mode 100644 index 95643a95fec..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0020-wifi-ath11k-update-ce-configurations-for-IPQ5018.patch +++ /dev/null @@ -1,246 +0,0 @@ -From 26af7aabd2d8225c6b2056234626ba5099610871 Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:14 +0200 -Subject: [PATCH] wifi: ath11k: update ce configurations for IPQ5018 - -IPQ5018 is a single pdev device. Update host -and target CE configurations accordingly. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-4-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 4 + - drivers/net/wireless/ath/ath11k/core.h | 3 + - drivers/net/wireless/ath/ath11k/hw.c | 191 +++++++++++++++++++++++++ - 3 files changed, 198 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -630,6 +630,10 @@ static const struct ath11k_hw_params ath - .internal_sleep_clock = false, - .host_ce_config = ath11k_host_ce_config_qcn9074, - .ce_count = CE_CNT_5018, -+ .target_ce_config = ath11k_target_ce_config_wlan_ipq5018, -+ .target_ce_count = TARGET_CE_CNT_5018, -+ .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq5018, -+ .svc_to_ce_map_len = SVC_CE_MAP_LEN_5018, - .rxdma1_enable = true, - .num_rxmda_per_pdev = RXDMA_PER_PDEV_5018, - .rx_mac_buf_ring = false, ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -1145,6 +1145,9 @@ extern const struct service_to_pipe ath1 - extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qca6390[]; - extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qca6390[]; - -+extern const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq5018[]; -+extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq5018[]; -+ - extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qcn9074[]; - extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qcn9074[]; - int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab); ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -1972,6 +1972,197 @@ const struct ath11k_hw_ring_mask ath11k_ - }, - }; - -+/* Target firmware's Copy Engine configuration for IPQ5018 */ -+const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq5018[] = { -+ /* CE0: host->target HTC control and raw streams */ -+ { -+ .pipenum = __cpu_to_le32(0), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(2048), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE1: target->host HTT + HTC control */ -+ { -+ .pipenum = __cpu_to_le32(1), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(2048), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE2: target->host WMI */ -+ { -+ .pipenum = __cpu_to_le32(2), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(2048), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE3: host->target WMI */ -+ { -+ .pipenum = __cpu_to_le32(3), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(2048), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE4: host->target HTT */ -+ { -+ .pipenum = __cpu_to_le32(4), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), -+ .nentries = __cpu_to_le32(256), -+ .nbytes_max = __cpu_to_le32(256), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE5: target->host Pktlog */ -+ { -+ .pipenum = __cpu_to_le32(5), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(2048), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE6: Reserved for target autonomous hif_memcpy */ -+ { -+ .pipenum = __cpu_to_le32(6), -+ .pipedir = __cpu_to_le32(PIPEDIR_INOUT), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(16384), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE7 used only by Host */ -+ { -+ .pipenum = __cpu_to_le32(7), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(2048), -+ .flags = __cpu_to_le32(0x2000), -+ .reserved = __cpu_to_le32(0), -+ }, -+ -+ /* CE8 target->host used only by IPA */ -+ { -+ .pipenum = __cpu_to_le32(8), -+ .pipedir = __cpu_to_le32(PIPEDIR_INOUT), -+ .nentries = __cpu_to_le32(32), -+ .nbytes_max = __cpu_to_le32(16384), -+ .flags = __cpu_to_le32(CE_ATTR_FLAGS), -+ .reserved = __cpu_to_le32(0), -+ }, -+}; -+ -+/* Map from service/endpoint to Copy Engine for IPQ5018. -+ * This table is derived from the CE TABLE, above. -+ * It is passed to the Target at startup for use by firmware. -+ */ -+const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq5018[] = { -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(3), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(2), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(3), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(2), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(3), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(2), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(3), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(2), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(3), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(2), -+ }, -+ -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(0), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(1), -+ }, -+ -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(0), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(1), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG), -+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ -+ .pipenum = __cpu_to_le32(4), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(1), -+ }, -+ { -+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_PKT_LOG), -+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ -+ .pipenum = __cpu_to_le32(5), -+ }, -+ -+ /* (Additions here) */ -+ -+ { /* terminator entry */ } -+}; -+ - const struct ath11k_hw_regs ipq8074_regs = { - /* SW2TCL(x) R0 ring configuration address */ - .hal_tcl1_ring_base_lsb = 0x00000510, diff --git a/package/kernel/mac80211/patches/ath11k/0021-wifi-ath11k-remap-ce-register-space-for-IPQ5018.patch b/package/kernel/mac80211/patches/ath11k/0021-wifi-ath11k-remap-ce-register-space-for-IPQ5018.patch deleted file mode 100644 index d07a258ac2a..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0021-wifi-ath11k-remap-ce-register-space-for-IPQ5018.patch +++ /dev/null @@ -1,351 +0,0 @@ -From b42b3678c91f3ca6e0888bf5a15c1e8678fd5f2d Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:14 +0200 -Subject: [PATCH] wifi: ath11k: remap ce register space for IPQ5018 - -In IPQ5018 ce register space is moved out of wcss unlike -ipq8074 or ipq6018 and the space is not contiguous, -hence remap the CE registers to a new space to access them. - -Register read/write is modified to check if the register to be written -falls in the CE register space and corresponding register is written. -Also adjust the interrupt register address to ce irq enable/disable. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-5-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 44 ++++++++++++++++++++++---- - drivers/net/wireless/ath/ath11k/ce.h | 16 ++++++++++ - drivers/net/wireless/ath/ath11k/core.c | 8 +++++ - drivers/net/wireless/ath/ath11k/core.h | 1 + - drivers/net/wireless/ath/ath11k/hal.c | 17 ++++++---- - drivers/net/wireless/ath/ath11k/hal.h | 5 +++ - drivers/net/wireless/ath/ath11k/hw.c | 17 ++++++++++ - drivers/net/wireless/ath/ath11k/hw.h | 9 ++++++ - drivers/net/wireless/ath/ath11k/pci.c | 2 ++ - 9 files changed, 107 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -267,30 +267,42 @@ static void ath11k_ahb_clearbit32(struct - static void ath11k_ahb_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) - { - const struct ce_attr *ce_attr; -+ const struct ce_ie_addr *ce_ie_addr = ab->hw_params.ce_ie_addr; -+ u32 ie1_reg_addr, ie2_reg_addr, ie3_reg_addr; -+ -+ ie1_reg_addr = ce_ie_addr->ie1_reg_addr + ATH11K_CE_OFFSET(ab); -+ ie2_reg_addr = ce_ie_addr->ie2_reg_addr + ATH11K_CE_OFFSET(ab); -+ ie3_reg_addr = ce_ie_addr->ie3_reg_addr + ATH11K_CE_OFFSET(ab); - - ce_attr = &ab->hw_params.host_ce_config[ce_id]; - if (ce_attr->src_nentries) -- ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_ADDRESS); -+ ath11k_ahb_setbit32(ab, ce_id, ie1_reg_addr); - - if (ce_attr->dest_nentries) { -- ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); -+ ath11k_ahb_setbit32(ab, ce_id, ie2_reg_addr); - ath11k_ahb_setbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, -- CE_HOST_IE_3_ADDRESS); -+ ie3_reg_addr); - } - } - - static void ath11k_ahb_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) - { - const struct ce_attr *ce_attr; -+ const struct ce_ie_addr *ce_ie_addr = ab->hw_params.ce_ie_addr; -+ u32 ie1_reg_addr, ie2_reg_addr, ie3_reg_addr; -+ -+ ie1_reg_addr = ce_ie_addr->ie1_reg_addr + ATH11K_CE_OFFSET(ab); -+ ie2_reg_addr = ce_ie_addr->ie2_reg_addr + ATH11K_CE_OFFSET(ab); -+ ie3_reg_addr = ce_ie_addr->ie3_reg_addr + ATH11K_CE_OFFSET(ab); - - ce_attr = &ab->hw_params.host_ce_config[ce_id]; - if (ce_attr->src_nentries) -- ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_ADDRESS); -+ ath11k_ahb_clearbit32(ab, ce_id, ie1_reg_addr); - - if (ce_attr->dest_nentries) { -- ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); -+ ath11k_ahb_clearbit32(ab, ce_id, ie2_reg_addr); - ath11k_ahb_clearbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, -- CE_HOST_IE_3_ADDRESS); -+ ie3_reg_addr); - } - } - -@@ -1142,10 +1154,26 @@ static int ath11k_ahb_probe(struct platf - goto err_core_free; - } - -+ ab->mem_ce = ab->mem; -+ - ret = ath11k_core_pre_init(ab); - if (ret) - goto err_core_free; - -+ if (ab->hw_params.ce_remap) { -+ const struct ce_remap *ce_remap = ab->hw_params.ce_remap; -+ /* ce register space is moved out of wcss unlike ipq8074 or ipq6018 -+ * and the space is not contiguous, hence remapping the CE registers -+ * to a new space for accessing them. -+ */ -+ ab->mem_ce = ioremap(ce_remap->base, ce_remap->size); -+ if (IS_ERR(ab->mem_ce)) { -+ dev_err(&pdev->dev, "ce ioremap error\n"); -+ ret = -ENOMEM; -+ goto err_core_free; -+ } -+ } -+ - ret = ath11k_ahb_setup_resources(ab); - if (ret) - goto err_core_free; -@@ -1236,6 +1264,10 @@ static void ath11k_ahb_free_resources(st - ath11k_ahb_release_smp2p_handle(ab); - ath11k_ahb_fw_resource_deinit(ab); - ath11k_ce_free_pipes(ab); -+ -+ if (ab->hw_params.ce_remap) -+ iounmap(ab->mem_ce); -+ - ath11k_core_free(ab); - platform_set_drvdata(pdev, NULL); - } ---- a/drivers/net/wireless/ath/ath11k/ce.h -+++ b/drivers/net/wireless/ath/ath11k/ce.h -@@ -49,6 +49,11 @@ void ath11k_ce_byte_swap(void *mem, u32 - #define CE_HOST_IE_2_ADDRESS 0x00A18040 - #define CE_HOST_IE_3_ADDRESS CE_HOST_IE_ADDRESS - -+/* CE IE registers are different for IPQ5018 */ -+#define CE_HOST_IPQ5018_IE_ADDRESS 0x0841804C -+#define CE_HOST_IPQ5018_IE_2_ADDRESS 0x08418050 -+#define CE_HOST_IPQ5018_IE_3_ADDRESS CE_HOST_IPQ5018_IE_ADDRESS -+ - #define CE_HOST_IE_3_SHIFT 0xC - - #define CE_RING_IDX_INCR(nentries_mask, idx) (((idx) + 1) & (nentries_mask)) -@@ -84,6 +89,17 @@ struct ce_pipe_config { - __le32 reserved; - }; - -+struct ce_ie_addr { -+ u32 ie1_reg_addr; -+ u32 ie2_reg_addr; -+ u32 ie3_reg_addr; -+}; -+ -+struct ce_remap { -+ u32 base; -+ u32 size; -+}; -+ - struct ce_attr { - /* CE_ATTR_* values */ - unsigned int flags; ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -54,6 +54,7 @@ static const struct ath11k_hw_params ath - .target_ce_count = 11, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq8074, - .svc_to_ce_map_len = 21, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074, - .single_pdev_only = false, - .rxdma1_enable = true, - .num_rxmda_per_pdev = 1, -@@ -137,6 +138,7 @@ static const struct ath11k_hw_params ath - .target_ce_count = 11, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq6018, - .svc_to_ce_map_len = 19, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074, - .single_pdev_only = false, - .rxdma1_enable = true, - .num_rxmda_per_pdev = 1, -@@ -218,6 +220,7 @@ static const struct ath11k_hw_params ath - .target_ce_count = 9, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390, - .svc_to_ce_map_len = 14, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074, - .single_pdev_only = true, - .rxdma1_enable = false, - .num_rxmda_per_pdev = 2, -@@ -301,6 +304,7 @@ static const struct ath11k_hw_params ath - .target_ce_count = 9, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qcn9074, - .svc_to_ce_map_len = 18, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074, - .rxdma1_enable = true, - .num_rxmda_per_pdev = 1, - .rx_mac_buf_ring = false, -@@ -381,6 +385,7 @@ static const struct ath11k_hw_params ath - .target_ce_count = 9, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390, - .svc_to_ce_map_len = 14, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074, - .single_pdev_only = true, - .rxdma1_enable = false, - .num_rxmda_per_pdev = 2, -@@ -546,6 +551,7 @@ static const struct ath11k_hw_params ath - .target_ce_count = 9, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390, - .svc_to_ce_map_len = 14, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074, - .single_pdev_only = true, - .rxdma1_enable = false, - .num_rxmda_per_pdev = 1, -@@ -634,6 +640,8 @@ static const struct ath11k_hw_params ath - .target_ce_count = TARGET_CE_CNT_5018, - .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq5018, - .svc_to_ce_map_len = SVC_CE_MAP_LEN_5018, -+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq5018, -+ .ce_remap = &ath11k_ce_remap_ipq5018, - .rxdma1_enable = true, - .num_rxmda_per_pdev = RXDMA_PER_PDEV_5018, - .rx_mac_buf_ring = false, ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -851,6 +851,7 @@ struct ath11k_base { - struct ath11k_dp dp; - - void __iomem *mem; -+ void __iomem *mem_ce; - unsigned long mem_len; - - struct { ---- a/drivers/net/wireless/ath/ath11k/hal.c -+++ b/drivers/net/wireless/ath/ath11k/hal.c -@@ -1220,16 +1220,20 @@ static int ath11k_hal_srng_create_config - s->reg_start[1] = HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL_STATUS_RING_HP; - - s = &hal->srng_config[HAL_CE_SRC]; -- s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_BASE_LSB; -- s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_HP; -+ s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_BASE_LSB + -+ ATH11K_CE_OFFSET(ab); -+ s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_HP + -+ ATH11K_CE_OFFSET(ab); - s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) - - HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab); - s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) - - HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab); - - s = &hal->srng_config[HAL_CE_DST]; -- s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_BASE_LSB; -- s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_HP; -+ s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_BASE_LSB + -+ ATH11K_CE_OFFSET(ab); -+ s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_HP + -+ ATH11K_CE_OFFSET(ab); - s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - - HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); - s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - -@@ -1237,8 +1241,9 @@ static int ath11k_hal_srng_create_config - - s = &hal->srng_config[HAL_CE_DST_STATUS]; - s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + -- HAL_CE_DST_STATUS_RING_BASE_LSB; -- s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_STATUS_RING_HP; -+ HAL_CE_DST_STATUS_RING_BASE_LSB + ATH11K_CE_OFFSET(ab); -+ s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_STATUS_RING_HP + -+ ATH11K_CE_OFFSET(ab); - s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - - HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); - s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - ---- a/drivers/net/wireless/ath/ath11k/hal.h -+++ b/drivers/net/wireless/ath/ath11k/hal.h -@@ -321,6 +321,10 @@ struct ath11k_base; - #define HAL_WBM2SW_RELEASE_RING_BASE_MSB_RING_SIZE 0x000fffff - #define HAL_RXDMA_RING_MAX_SIZE 0x0000ffff - -+/* IPQ5018 ce registers */ -+#define HAL_IPQ5018_CE_WFSS_REG_BASE 0x08400000 -+#define HAL_IPQ5018_CE_SIZE 0x200000 -+ - /* Add any other errors here and return them in - * ath11k_hal_rx_desc_get_err(). - */ -@@ -519,6 +523,7 @@ enum hal_srng_dir { - #define HAL_SRNG_FLAGS_MSI_INTR 0x00020000 - #define HAL_SRNG_FLAGS_CACHED 0x20000000 - #define HAL_SRNG_FLAGS_LMAC_RING 0x80000000 -+#define HAL_SRNG_FLAGS_REMAP_CE_RING 0x10000000 - - #define HAL_SRNG_TLV_HDR_TAG GENMASK(9, 1) - #define HAL_SRNG_TLV_HDR_LEN GENMASK(25, 10) ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -2163,6 +2163,23 @@ const struct service_to_pipe ath11k_targ - { /* terminator entry */ } - }; - -+const struct ce_ie_addr ath11k_ce_ie_addr_ipq8074 = { -+ .ie1_reg_addr = CE_HOST_IE_ADDRESS, -+ .ie2_reg_addr = CE_HOST_IE_2_ADDRESS, -+ .ie3_reg_addr = CE_HOST_IE_3_ADDRESS, -+}; -+ -+const struct ce_ie_addr ath11k_ce_ie_addr_ipq5018 = { -+ .ie1_reg_addr = CE_HOST_IPQ5018_IE_ADDRESS - HAL_IPQ5018_CE_WFSS_REG_BASE, -+ .ie2_reg_addr = CE_HOST_IPQ5018_IE_2_ADDRESS - HAL_IPQ5018_CE_WFSS_REG_BASE, -+ .ie3_reg_addr = CE_HOST_IPQ5018_IE_3_ADDRESS - HAL_IPQ5018_CE_WFSS_REG_BASE, -+}; -+ -+const struct ce_remap ath11k_ce_remap_ipq5018 = { -+ .base = HAL_IPQ5018_CE_WFSS_REG_BASE, -+ .size = HAL_IPQ5018_CE_SIZE, -+}; -+ - const struct ath11k_hw_regs ipq8074_regs = { - /* SW2TCL(x) R0 ring configuration address */ - .hal_tcl1_ring_base_lsb = 0x00000510, ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -80,6 +80,8 @@ - #define ATH11K_M3_FILE "m3.bin" - #define ATH11K_REGDB_FILE_NAME "regdb.bin" - -+#define ATH11K_CE_OFFSET(ab) (ab->mem_ce - ab->mem) -+ - enum ath11k_hw_rate_cck { - ATH11K_HW_RATE_CCK_LP_11M = 0, - ATH11K_HW_RATE_CCK_LP_5_5M, -@@ -158,6 +160,8 @@ struct ath11k_hw_params { - u32 target_ce_count; - const struct service_to_pipe *svc_to_ce_map; - u32 svc_to_ce_map_len; -+ const struct ce_ie_addr *ce_ie_addr; -+ const struct ce_remap *ce_remap; - - bool single_pdev_only; - -@@ -277,6 +281,11 @@ extern const struct ath11k_hw_ring_mask - extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qcn9074; - extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_wcn6750; - -+extern const struct ce_ie_addr ath11k_ce_ie_addr_ipq8074; -+extern const struct ce_ie_addr ath11k_ce_ie_addr_ipq5018; -+ -+extern const struct ce_remap ath11k_ce_remap_ipq5018; -+ - extern const struct ath11k_hw_hal_params ath11k_hw_hal_params_ipq8074; - extern const struct ath11k_hw_hal_params ath11k_hw_hal_params_qca6390; - extern const struct ath11k_hw_hal_params ath11k_hw_hal_params_wcn6750; ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -543,6 +543,8 @@ static int ath11k_pci_claim(struct ath11 - goto clear_master; - } - -+ ab->mem_ce = ab->mem; -+ - ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot pci_mem 0x%pK\n", ab->mem); - return 0; - diff --git a/package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-update-hal-srng-regs-for-IPQ5018.patch b/package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-update-hal-srng-regs-for-IPQ5018.patch deleted file mode 100644 index 35ea20a3c4f..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-update-hal-srng-regs-for-IPQ5018.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 711b80acbdfb9667a9cf8374e13320a6e624ce73 Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:14 +0200 -Subject: [PATCH] wifi: ath11k: update hal srng regs for IPQ5018 - -IPQ5018 hal srng register address & offsets are not -similar to IPQ8074/IPQ6018/QCN9074, hence define a -new set of srng register group data for IPQ5018. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-6-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 1 + - drivers/net/wireless/ath/ath11k/hw.c | 79 ++++++++++++++++++++++++++ - drivers/net/wireless/ath/ath11k/hw.h | 1 + - 3 files changed, 81 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -634,6 +634,7 @@ static const struct ath11k_hw_params ath - .max_fft_bins = 1024, - }, - .internal_sleep_clock = false, -+ .regs = &ipq5018_regs, - .host_ce_config = ath11k_host_ce_config_qcn9074, - .ce_count = CE_CNT_5018, - .target_ce_config = ath11k_target_ce_config_wlan_ipq5018, ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -2645,6 +2645,85 @@ static const struct ath11k_hw_tcl2wbm_rb - }, - }; - -+const struct ath11k_hw_regs ipq5018_regs = { -+ /* SW2TCL(x) R0 ring configuration address */ -+ .hal_tcl1_ring_base_lsb = 0x00000694, -+ .hal_tcl1_ring_base_msb = 0x00000698, -+ .hal_tcl1_ring_id = 0x0000069c, -+ .hal_tcl1_ring_misc = 0x000006a4, -+ .hal_tcl1_ring_tp_addr_lsb = 0x000006b0, -+ .hal_tcl1_ring_tp_addr_msb = 0x000006b4, -+ .hal_tcl1_ring_consumer_int_setup_ix0 = 0x000006c4, -+ .hal_tcl1_ring_consumer_int_setup_ix1 = 0x000006c8, -+ .hal_tcl1_ring_msi1_base_lsb = 0x000006dc, -+ .hal_tcl1_ring_msi1_base_msb = 0x000006e0, -+ .hal_tcl1_ring_msi1_data = 0x000006e4, -+ .hal_tcl2_ring_base_lsb = 0x000006ec, -+ .hal_tcl_ring_base_lsb = 0x0000079c, -+ -+ /* TCL STATUS ring address */ -+ .hal_tcl_status_ring_base_lsb = 0x000008a4, -+ -+ /* REO2SW(x) R0 ring configuration address */ -+ .hal_reo1_ring_base_lsb = 0x000001ec, -+ .hal_reo1_ring_base_msb = 0x000001f0, -+ .hal_reo1_ring_id = 0x000001f4, -+ .hal_reo1_ring_misc = 0x000001fc, -+ .hal_reo1_ring_hp_addr_lsb = 0x00000200, -+ .hal_reo1_ring_hp_addr_msb = 0x00000204, -+ .hal_reo1_ring_producer_int_setup = 0x00000210, -+ .hal_reo1_ring_msi1_base_lsb = 0x00000234, -+ .hal_reo1_ring_msi1_base_msb = 0x00000238, -+ .hal_reo1_ring_msi1_data = 0x0000023c, -+ .hal_reo2_ring_base_lsb = 0x00000244, -+ .hal_reo1_aging_thresh_ix_0 = 0x00000564, -+ .hal_reo1_aging_thresh_ix_1 = 0x00000568, -+ .hal_reo1_aging_thresh_ix_2 = 0x0000056c, -+ .hal_reo1_aging_thresh_ix_3 = 0x00000570, -+ -+ /* REO2SW(x) R2 ring pointers (head/tail) address */ -+ .hal_reo1_ring_hp = 0x00003028, -+ .hal_reo1_ring_tp = 0x0000302c, -+ .hal_reo2_ring_hp = 0x00003030, -+ -+ /* REO2TCL R0 ring configuration address */ -+ .hal_reo_tcl_ring_base_lsb = 0x000003fc, -+ .hal_reo_tcl_ring_hp = 0x00003058, -+ -+ /* SW2REO ring address */ -+ .hal_sw2reo_ring_base_lsb = 0x0000013c, -+ .hal_sw2reo_ring_hp = 0x00003018, -+ -+ /* REO CMD ring address */ -+ .hal_reo_cmd_ring_base_lsb = 0x000000e4, -+ .hal_reo_cmd_ring_hp = 0x00003010, -+ -+ /* REO status address */ -+ .hal_reo_status_ring_base_lsb = 0x00000504, -+ .hal_reo_status_hp = 0x00003070, -+ -+ /* WCSS relative address */ -+ .hal_seq_wcss_umac_ce0_src_reg = 0x08400000 -+ - HAL_IPQ5018_CE_WFSS_REG_BASE, -+ .hal_seq_wcss_umac_ce0_dst_reg = 0x08401000 -+ - HAL_IPQ5018_CE_WFSS_REG_BASE, -+ .hal_seq_wcss_umac_ce1_src_reg = 0x08402000 -+ - HAL_IPQ5018_CE_WFSS_REG_BASE, -+ .hal_seq_wcss_umac_ce1_dst_reg = 0x08403000 -+ - HAL_IPQ5018_CE_WFSS_REG_BASE, -+ -+ /* WBM Idle address */ -+ .hal_wbm_idle_link_ring_base_lsb = 0x00000874, -+ .hal_wbm_idle_link_ring_misc = 0x00000884, -+ -+ /* SW2WBM release address */ -+ .hal_wbm_release_ring_base_lsb = 0x000001ec, -+ -+ /* WBM2SW release address */ -+ .hal_wbm0_release_ring_base_lsb = 0x00000924, -+ .hal_wbm1_release_ring_base_lsb = 0x0000097c, -+}; -+ - const struct ath11k_hw_hal_params ath11k_hw_hal_params_ipq8074 = { - .rx_buf_rbm = HAL_RX_BUF_RBM_SW3_BM, - .tcl2wbm_rbm_map = ath11k_hw_tcl2wbm_rbm_map_ipq8074, ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -415,6 +415,7 @@ extern const struct ath11k_hw_regs qca63 - extern const struct ath11k_hw_regs qcn9074_regs; - extern const struct ath11k_hw_regs wcn6855_regs; - extern const struct ath11k_hw_regs wcn6750_regs; -+extern const struct ath11k_hw_regs ipq5018_regs; - - static inline const char *ath11k_bd_ie_type_str(enum ath11k_bd_ie_type type) - { diff --git a/package/kernel/mac80211/patches/ath11k/0023-wifi-ath11k-initialize-hw_ops-for-IPQ5018.patch b/package/kernel/mac80211/patches/ath11k/0023-wifi-ath11k-initialize-hw_ops-for-IPQ5018.patch deleted file mode 100644 index 5ef701a4452..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0023-wifi-ath11k-initialize-hw_ops-for-IPQ5018.patch +++ /dev/null @@ -1,90 +0,0 @@ -From ba60f2793d3a37a00da14bb56a26558a902d2831 Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:14 +0200 -Subject: [PATCH] wifi: ath11k: initialize hw_ops for IPQ5018 - -The ipq5018_ops is initialized for IPQ5018. This is different from -other platforms. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-7-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 1 + - drivers/net/wireless/ath/ath11k/hw.c | 40 ++++++++++++++++++++++++++ - drivers/net/wireless/ath/ath11k/hw.h | 1 + - 3 files changed, 42 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -635,6 +635,7 @@ static const struct ath11k_hw_params ath - }, - .internal_sleep_clock = false, - .regs = &ipq5018_regs, -+ .hw_ops = &ipq5018_ops, - .host_ce_config = ath11k_host_ce_config_qcn9074, - .ce_count = CE_CNT_5018, - .target_ce_config = ath11k_target_ce_config_wlan_ipq5018, ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -1084,6 +1084,46 @@ const struct ath11k_hw_ops wcn6750_ops = - .get_ring_selector = ath11k_hw_wcn6750_get_tcl_ring_selector, - }; - -+/* IPQ5018 hw ops is similar to QCN9074 except for the dest ring remap */ -+const struct ath11k_hw_ops ipq5018_ops = { -+ .get_hw_mac_from_pdev_id = ath11k_hw_ipq6018_mac_from_pdev_id, -+ .wmi_init_config = ath11k_init_wmi_config_ipq8074, -+ .mac_id_to_pdev_id = ath11k_hw_mac_id_to_pdev_id_ipq8074, -+ .mac_id_to_srng_id = ath11k_hw_mac_id_to_srng_id_ipq8074, -+ .tx_mesh_enable = ath11k_hw_qcn9074_tx_mesh_enable, -+ .rx_desc_get_first_msdu = ath11k_hw_qcn9074_rx_desc_get_first_msdu, -+ .rx_desc_get_last_msdu = ath11k_hw_qcn9074_rx_desc_get_last_msdu, -+ .rx_desc_get_l3_pad_bytes = ath11k_hw_qcn9074_rx_desc_get_l3_pad_bytes, -+ .rx_desc_get_hdr_status = ath11k_hw_qcn9074_rx_desc_get_hdr_status, -+ .rx_desc_encrypt_valid = ath11k_hw_qcn9074_rx_desc_encrypt_valid, -+ .rx_desc_get_encrypt_type = ath11k_hw_qcn9074_rx_desc_get_encrypt_type, -+ .rx_desc_get_decap_type = ath11k_hw_qcn9074_rx_desc_get_decap_type, -+ .rx_desc_get_mesh_ctl = ath11k_hw_qcn9074_rx_desc_get_mesh_ctl, -+ .rx_desc_get_ldpc_support = ath11k_hw_qcn9074_rx_desc_get_ldpc_support, -+ .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_qcn9074_rx_desc_get_mpdu_seq_ctl_vld, -+ .rx_desc_get_mpdu_fc_valid = ath11k_hw_qcn9074_rx_desc_get_mpdu_fc_valid, -+ .rx_desc_get_mpdu_start_seq_no = ath11k_hw_qcn9074_rx_desc_get_mpdu_start_seq_no, -+ .rx_desc_get_msdu_len = ath11k_hw_qcn9074_rx_desc_get_msdu_len, -+ .rx_desc_get_msdu_sgi = ath11k_hw_qcn9074_rx_desc_get_msdu_sgi, -+ .rx_desc_get_msdu_rate_mcs = ath11k_hw_qcn9074_rx_desc_get_msdu_rate_mcs, -+ .rx_desc_get_msdu_rx_bw = ath11k_hw_qcn9074_rx_desc_get_msdu_rx_bw, -+ .rx_desc_get_msdu_freq = ath11k_hw_qcn9074_rx_desc_get_msdu_freq, -+ .rx_desc_get_msdu_pkt_type = ath11k_hw_qcn9074_rx_desc_get_msdu_pkt_type, -+ .rx_desc_get_msdu_nss = ath11k_hw_qcn9074_rx_desc_get_msdu_nss, -+ .rx_desc_get_mpdu_tid = ath11k_hw_qcn9074_rx_desc_get_mpdu_tid, -+ .rx_desc_get_mpdu_peer_id = ath11k_hw_qcn9074_rx_desc_get_mpdu_peer_id, -+ .rx_desc_copy_attn_end_tlv = ath11k_hw_qcn9074_rx_desc_copy_attn_end, -+ .rx_desc_get_mpdu_start_tag = ath11k_hw_qcn9074_rx_desc_get_mpdu_start_tag, -+ .rx_desc_get_mpdu_ppdu_id = ath11k_hw_qcn9074_rx_desc_get_mpdu_ppdu_id, -+ .rx_desc_set_msdu_len = ath11k_hw_qcn9074_rx_desc_set_msdu_len, -+ .rx_desc_get_attention = ath11k_hw_qcn9074_rx_desc_get_attention, -+ .rx_desc_get_msdu_payload = ath11k_hw_qcn9074_rx_desc_get_msdu_payload, -+ .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid, -+ .rx_desc_mac_addr2_valid = ath11k_hw_ipq9074_rx_desc_mac_addr2_valid, -+ .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq9074_rx_desc_mpdu_start_addr2, -+ -+}; -+ - #define ATH11K_TX_RING_MASK_0 BIT(0) - #define ATH11K_TX_RING_MASK_1 BIT(1) - #define ATH11K_TX_RING_MASK_2 BIT(2) ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -275,6 +275,7 @@ extern const struct ath11k_hw_ops qca639 - extern const struct ath11k_hw_ops qcn9074_ops; - extern const struct ath11k_hw_ops wcn6855_ops; - extern const struct ath11k_hw_ops wcn6750_ops; -+extern const struct ath11k_hw_ops ipq5018_ops; - - extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_ipq8074; - extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qca6390; diff --git a/package/kernel/mac80211/patches/ath11k/0024-wifi-ath11k-add-new-hw-ops-for-IPQ5018-to-get-rx-des.patch b/package/kernel/mac80211/patches/ath11k/0024-wifi-ath11k-add-new-hw-ops-for-IPQ5018-to-get-rx-des.patch deleted file mode 100644 index 64531f13f81..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0024-wifi-ath11k-add-new-hw-ops-for-IPQ5018-to-get-rx-des.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 69968f88f1770d61cae0febef805fd00d66cf6a1 Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:15 +0200 -Subject: [PATCH] wifi: ath11k: add new hw ops for IPQ5018 to get rx dest ring - hashmap - -The Destination ring control register is different -for IPQ5018 when compared to IPQ8074/IPQ6018/QCN9074. -Hence create a new hw ops to fetch the hash ring map -for different device variants. ipq5018 hw ops -is similar to qcn9074 except for this change, so reuse -all the qcn9074 ops for ipq5018. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-8-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/hw.c | 44 ++++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -791,6 +791,49 @@ static void ath11k_hw_wcn6855_reo_setup( - ring_hash_map); - } - -+static void ath11k_hw_ipq5018_reo_setup(struct ath11k_base *ab) -+{ -+ u32 reo_base = HAL_SEQ_WCSS_UMAC_REO_REG; -+ u32 val; -+ -+ /* Each hash entry uses three bits to map to a particular ring. */ -+ u32 ring_hash_map = HAL_HASH_ROUTING_RING_SW1 << 0 | -+ HAL_HASH_ROUTING_RING_SW2 << 4 | -+ HAL_HASH_ROUTING_RING_SW3 << 8 | -+ HAL_HASH_ROUTING_RING_SW4 << 12 | -+ HAL_HASH_ROUTING_RING_SW1 << 16 | -+ HAL_HASH_ROUTING_RING_SW2 << 20 | -+ HAL_HASH_ROUTING_RING_SW3 << 24 | -+ HAL_HASH_ROUTING_RING_SW4 << 28; -+ -+ val = ath11k_hif_read32(ab, reo_base + HAL_REO1_GEN_ENABLE); -+ -+ val &= ~HAL_REO1_GEN_ENABLE_FRAG_DST_RING; -+ val |= FIELD_PREP(HAL_REO1_GEN_ENABLE_FRAG_DST_RING, -+ HAL_SRNG_RING_ID_REO2SW1) | -+ FIELD_PREP(HAL_REO1_GEN_ENABLE_AGING_LIST_ENABLE, 1) | -+ FIELD_PREP(HAL_REO1_GEN_ENABLE_AGING_FLUSH_ENABLE, 1); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_GEN_ENABLE, val); -+ -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_0(ab), -+ HAL_DEFAULT_REO_TIMEOUT_USEC); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_1(ab), -+ HAL_DEFAULT_REO_TIMEOUT_USEC); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_2(ab), -+ HAL_DEFAULT_REO_TIMEOUT_USEC); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_3(ab), -+ HAL_DEFAULT_REO_TIMEOUT_USEC); -+ -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_0, -+ ring_hash_map); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_1, -+ ring_hash_map); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_2, -+ ring_hash_map); -+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_3, -+ ring_hash_map); -+} -+ - static u16 ath11k_hw_ipq8074_mpdu_info_get_peerid(u8 *tlv_data) - { - u16 peer_id = 0; -@@ -1117,6 +1160,7 @@ const struct ath11k_hw_ops ipq5018_ops = - .rx_desc_get_mpdu_ppdu_id = ath11k_hw_qcn9074_rx_desc_get_mpdu_ppdu_id, - .rx_desc_set_msdu_len = ath11k_hw_qcn9074_rx_desc_set_msdu_len, - .rx_desc_get_attention = ath11k_hw_qcn9074_rx_desc_get_attention, -+ .reo_setup = ath11k_hw_ipq5018_reo_setup, - .rx_desc_get_msdu_payload = ath11k_hw_qcn9074_rx_desc_get_msdu_payload, - .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid, - .rx_desc_mac_addr2_valid = ath11k_hw_ipq9074_rx_desc_mac_addr2_valid, diff --git a/package/kernel/mac80211/patches/ath11k/0025-wifi-ath11k-add-ipq5018-device-support.patch b/package/kernel/mac80211/patches/ath11k/0025-wifi-ath11k-add-ipq5018-device-support.patch deleted file mode 100644 index 5b930e8d4fd..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0025-wifi-ath11k-add-ipq5018-device-support.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 25edca7bb18a2a40cc7e54c6f522e9b3c917e2c5 Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Fri, 2 Dec 2022 23:37:15 +0200 -Subject: [PATCH] wifi: ath11k: add ipq5018 device support - -ipq5018 is a ahb 2ghz device, enable the compatible support for -ipq5018 in ahb. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sriram R -Co-developed-by: Karthikeyan Kathirvel -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221122132152.17771-9-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -32,6 +32,9 @@ static const struct of_device_id ath11k_ - { .compatible = "qcom,wcn6750-wifi", - .data = (void *)ATH11K_HW_WCN6750_HW10, - }, -+ { .compatible = "qcom,ipq5018-wifi", -+ .data = (void *)ATH11K_HW_IPQ5018_HW10, -+ }, - { } - }; - diff --git a/package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch b/package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch deleted file mode 100644 index 50c14e7b98f..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch +++ /dev/null @@ -1,161 +0,0 @@ -From d45daa6d1a8da080f1b516c570a8428a7b9225e4 Mon Sep 17 00:00:00 2001 -From: Karthikeyan Kathirvel -Date: Tue, 6 Dec 2022 00:51:25 +0530 -Subject: [PATCH] wifi: ath11k: Fix scan request param frame size warning - -Following warning was observed - -drivers/net/wireless/ath/ath11k/mac.c:2351:1: warning: the frame -size of 1184 bytes is larger than 1024 bytes [-Wframe-larger-than=] - -A local variable is declared with a size larger than 1024 bytes -this causing a compilation warning. Change the local variable to -heap memory to fix the warning. - -Tested-on: IPQ8074 AHB WLAN.HK.2.7.0.1-01701-QCAHKSWPL_SILICONZ-1 v2 - -Signed-off-by: Karthikeyan Kathirvel -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221205192125.13533-1-quic_kathirve@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 83 +++++++++++++++------------ - 1 file changed, 45 insertions(+), 38 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3612,7 +3612,7 @@ static int ath11k_mac_op_hw_scan(struct - struct ath11k *ar = hw->priv; - struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct cfg80211_scan_request *req = &hw_req->req; -- struct scan_req_params arg; -+ struct scan_req_params *arg = NULL; - int ret = 0; - int i; - u32 scan_timeout; -@@ -3640,72 +3640,78 @@ static int ath11k_mac_op_hw_scan(struct - if (ret) - goto exit; - -- memset(&arg, 0, sizeof(arg)); -- ath11k_wmi_start_scan_init(ar, &arg); -- arg.vdev_id = arvif->vdev_id; -- arg.scan_id = ATH11K_SCAN_ID; -+ arg = kzalloc(sizeof(*arg), GFP_KERNEL); -+ -+ if (!arg) { -+ ret = -ENOMEM; -+ goto exit; -+ } -+ -+ ath11k_wmi_start_scan_init(ar, arg); -+ arg->vdev_id = arvif->vdev_id; -+ arg->scan_id = ATH11K_SCAN_ID; - - if (req->ie_len) { -- arg.extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL); -- if (!arg.extraie.ptr) { -+ arg->extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL); -+ if (!arg->extraie.ptr) { - ret = -ENOMEM; - goto exit; - } -- arg.extraie.len = req->ie_len; -+ arg->extraie.len = req->ie_len; - } - - if (req->n_ssids) { -- arg.num_ssids = req->n_ssids; -- for (i = 0; i < arg.num_ssids; i++) { -- arg.ssid[i].length = req->ssids[i].ssid_len; -- memcpy(&arg.ssid[i].ssid, req->ssids[i].ssid, -+ arg->num_ssids = req->n_ssids; -+ for (i = 0; i < arg->num_ssids; i++) { -+ arg->ssid[i].length = req->ssids[i].ssid_len; -+ memcpy(&arg->ssid[i].ssid, req->ssids[i].ssid, - req->ssids[i].ssid_len); - } - } else { -- arg.scan_flags |= WMI_SCAN_FLAG_PASSIVE; -+ arg->scan_flags |= WMI_SCAN_FLAG_PASSIVE; - } - - if (req->n_channels) { -- arg.num_chan = req->n_channels; -- arg.chan_list = kcalloc(arg.num_chan, sizeof(*arg.chan_list), -- GFP_KERNEL); -+ arg->num_chan = req->n_channels; -+ arg->chan_list = kcalloc(arg->num_chan, sizeof(*arg->chan_list), -+ GFP_KERNEL); - -- if (!arg.chan_list) { -+ if (!arg->chan_list) { - ret = -ENOMEM; - goto exit; - } - -- for (i = 0; i < arg.num_chan; i++) -- arg.chan_list[i] = req->channels[i]->center_freq; -+ for (i = 0; i < arg->num_chan; i++) -+ arg->chan_list[i] = req->channels[i]->center_freq; - } - - if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { -- arg.scan_f_add_spoofed_mac_in_probe = 1; -- ether_addr_copy(arg.mac_addr.addr, req->mac_addr); -- ether_addr_copy(arg.mac_mask.addr, req->mac_addr_mask); -+ arg->scan_f_add_spoofed_mac_in_probe = 1; -+ ether_addr_copy(arg->mac_addr.addr, req->mac_addr); -+ ether_addr_copy(arg->mac_mask.addr, req->mac_addr_mask); - } - - /* if duration is set, default dwell times will be overwritten */ - if (req->duration) { -- arg.dwell_time_active = req->duration; -- arg.dwell_time_active_2g = req->duration; -- arg.dwell_time_active_6g = req->duration; -- arg.dwell_time_passive = req->duration; -- arg.dwell_time_passive_6g = req->duration; -- arg.burst_duration = req->duration; -+ arg->dwell_time_active = req->duration; -+ arg->dwell_time_active_2g = req->duration; -+ arg->dwell_time_active_6g = req->duration; -+ arg->dwell_time_passive = req->duration; -+ arg->dwell_time_passive_6g = req->duration; -+ arg->burst_duration = req->duration; - -- scan_timeout = min_t(u32, arg.max_rest_time * -- (arg.num_chan - 1) + (req->duration + -+ scan_timeout = min_t(u32, arg->max_rest_time * -+ (arg->num_chan - 1) + (req->duration + - ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD) * -- arg.num_chan, arg.max_scan_time); -+ arg->num_chan, arg->max_scan_time); - } else { -- scan_timeout = arg.max_scan_time; -+ scan_timeout = arg->max_scan_time; - } - - /* Add a margin to account for event/command processing */ - scan_timeout += ATH11K_MAC_SCAN_CMD_EVT_OVERHEAD; - -- ret = ath11k_start_scan(ar, &arg); -+ ret = ath11k_start_scan(ar, arg); - if (ret) { - ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret); - spin_lock_bh(&ar->data_lock); -@@ -3717,10 +3723,11 @@ static int ath11k_mac_op_hw_scan(struct - msecs_to_jiffies(scan_timeout)); - - exit: -- kfree(arg.chan_list); -- -- if (req->ie_len) -- kfree(arg.extraie.ptr); -+ if (arg) { -+ kfree(arg->chan_list); -+ kfree(arg->extraie.ptr); -+ kfree(arg); -+ } - - mutex_unlock(&ar->conf_mutex); - diff --git a/package/kernel/mac80211/patches/ath11k/0029-wifi-ath11k-Add-support-to-configure-FTM-responder-r.patch b/package/kernel/mac80211/patches/ath11k/0029-wifi-ath11k-Add-support-to-configure-FTM-responder-r.patch deleted file mode 100644 index f652d689b51..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0029-wifi-ath11k-Add-support-to-configure-FTM-responder-r.patch +++ /dev/null @@ -1,169 +0,0 @@ -From a27c6a5853eb9d4f293b99be73a6891fe88263c7 Mon Sep 17 00:00:00 2001 -From: Sowmiya Sree Elavalagan -Date: Tue, 10 Jan 2023 15:30:57 +0200 -Subject: [PATCH] wifi: ath11k: Add support to configure FTM responder role - -Fine Timing Measurement(FTM) support is used to measure round trip -time between two nodes. - -Enable FTM responder feature using hw_params on supported device. -Since FTM functionality is offloaded to firmware, adding the -interface allows user space to enable or disable FTM responder. -Also add support for advertising the same in extended capabilities. - -QCA6390, WCN6855 and WCN6750 do not support this feature. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sowmiya Sree Elavalagan -Signed-off-by: Raj Kumar Bhagat -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221220044435.10506-1-quic_rajkbhag@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 8 ++++++++ - drivers/net/wireless/ath/ath11k/core.h | 1 + - drivers/net/wireless/ath/ath11k/hw.h | 1 + - drivers/net/wireless/ath/ath11k/mac.c | 20 +++++++++++++++++++- - drivers/net/wireless/ath/ath11k/wmi.h | 1 + - 5 files changed, 30 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -116,6 +116,7 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -+ .ftm_responder = true, - }, - { - .hw_rev = ATH11K_HW_IPQ6018_HW10, -@@ -198,6 +199,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -+ .ftm_responder = true, - }, - { - .name = "qca6390 hw2.0", -@@ -282,6 +284,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = true, -+ .ftm_responder = false, - }, - { - .name = "qcn9074 hw1.0", -@@ -363,6 +366,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -+ .ftm_responder = true, - }, - { - .name = "wcn6855 hw2.0", -@@ -447,6 +451,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = true, -+ .ftm_responder = false, - }, - { - .name = "wcn6855 hw2.1", -@@ -529,6 +534,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = true, -+ .ftm_responder = false, - }, - { - .name = "wcn6750 hw1.0", -@@ -609,6 +615,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE_WCN6750, - .smp2p_wow_exit = true, - .support_fw_mac_sequence = true, -+ .ftm_responder = false, - }, - { - .hw_rev = ATH11K_HW_IPQ5018_HW10, -@@ -688,6 +695,7 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -+ .ftm_responder = true, - }, - }; - ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -346,6 +346,7 @@ struct ath11k_vif { - - bool is_started; - bool is_up; -+ bool ftm_responder; - bool spectral_enabled; - bool ps; - u32 aid; ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -224,6 +224,7 @@ struct ath11k_hw_params { - u32 tx_ring_size; - bool smp2p_wow_exit; - bool support_fw_mac_sequence; -+ bool ftm_responder; - }; - - struct ath11k_hw_ops { ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3110,7 +3110,7 @@ static void ath11k_mac_op_bss_info_chang - u16 bitrate; - int ret = 0; - u8 rateidx; -- u32 rate; -+ u32 rate, param; - u32 ipv4_cnt; - - mutex_lock(&ar->conf_mutex); -@@ -3412,6 +3412,20 @@ static void ath11k_mac_op_bss_info_chang - } - } - -+ if (changed & BSS_CHANGED_FTM_RESPONDER && -+ arvif->ftm_responder != info->ftm_responder && -+ ar->ab->hw_params.ftm_responder && -+ (vif->type == NL80211_IFTYPE_AP || -+ vif->type == NL80211_IFTYPE_MESH_POINT)) { -+ arvif->ftm_responder = info->ftm_responder; -+ param = WMI_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE; -+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, -+ arvif->ftm_responder); -+ if (ret) -+ ath11k_warn(ar->ab, "Failed to set ftm responder %i: %d\n", -+ arvif->vdev_id, ret); -+ } -+ - if (changed & BSS_CHANGED_FILS_DISCOVERY || - changed & BSS_CHANGED_UNSOL_BCAST_PROBE_RESP) - ath11k_mac_fils_discovery(arvif, info); -@@ -9113,6 +9127,10 @@ static int __ath11k_mac_register(struct - wiphy_ext_feature_set(ar->hw->wiphy, - NL80211_EXT_FEATURE_SET_SCAN_DWELL); - -+ if (ab->hw_params.ftm_responder) -+ wiphy_ext_feature_set(ar->hw->wiphy, -+ NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER); -+ - ath11k_reg_init(ar); - - if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -1073,6 +1073,7 @@ enum wmi_tlv_vdev_param { - WMI_VDEV_PARAM_ENABLE_BCAST_PROBE_RESPONSE, - WMI_VDEV_PARAM_FILS_MAX_CHANNEL_GUARD_TIME, - WMI_VDEV_PARAM_HE_LTF = 0x74, -+ WMI_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE = 0x7d, - WMI_VDEV_PARAM_BA_MODE = 0x7e, - WMI_VDEV_PARAM_AUTORATE_MISC_CFG = 0x80, - WMI_VDEV_PARAM_SET_HE_SOUNDING_MODE = 0x87, diff --git a/package/kernel/mac80211/patches/ath11k/0030-wifi-ath11k-add-channel-177-into-5-GHz-channel-list.patch b/package/kernel/mac80211/patches/ath11k/0030-wifi-ath11k-add-channel-177-into-5-GHz-channel-list.patch deleted file mode 100644 index d0ed9c54b88..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0030-wifi-ath11k-add-channel-177-into-5-GHz-channel-list.patch +++ /dev/null @@ -1,41 +0,0 @@ -From e5e94d10c85653609a2893c8d0ef24a27471b68f Mon Sep 17 00:00:00 2001 -From: Wen Gong -Date: Tue, 10 Jan 2023 15:30:58 +0200 -Subject: [PATCH] wifi: ath11k: add channel 177 into 5 GHz channel list - -Add support for the 5 GHz channel 177 with center frequency 5885 MHz and -operating class 125 per IEEE Std 802.11ax-2021, Table E-4. - -Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 - -Signed-off-by: Wen Gong -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221220101912.30816-1-quic_wgong@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.h | 4 ++-- - drivers/net/wireless/ath/ath11k/mac.c | 1 + - 2 files changed, 3 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -521,8 +521,8 @@ struct ath11k_sta { - #define ATH11K_MIN_5G_FREQ 4150 - #define ATH11K_MIN_6G_FREQ 5925 - #define ATH11K_MAX_6G_FREQ 7115 --#define ATH11K_NUM_CHANS 101 --#define ATH11K_MAX_5G_CHAN 173 -+#define ATH11K_NUM_CHANS 102 -+#define ATH11K_MAX_5G_CHAN 177 - - enum ath11k_state { - ATH11K_STATE_OFF, ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -96,6 +96,7 @@ static const struct ieee80211_channel at - CHAN5G(165, 5825, 0), - CHAN5G(169, 5845, 0), - CHAN5G(173, 5865, 0), -+ CHAN5G(177, 5885, 0), - }; - - static const struct ieee80211_channel ath11k_6ghz_channels[] = { diff --git a/package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-fix-ce-memory-mapping-for-ahb-devices.patch b/package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-fix-ce-memory-mapping-for-ahb-devices.patch deleted file mode 100644 index 2786799972f..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-fix-ce-memory-mapping-for-ahb-devices.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 53a998c4d7284debd77734d01e1466e59a1d03b2 Mon Sep 17 00:00:00 2001 -From: Raj Kumar Bhagat -Date: Fri, 13 Jan 2023 12:02:09 +0530 -Subject: [PATCH] wifi: ath11k: fix ce memory mapping for ahb devices - -Currently ath11k_ahb module is not loaded successfully and the wifi -interface is not created. Kernel trace is seen while loading the -ath11k_ahb module. The issue is seen in all ath11k AHB devices except -in IPQ5018. - -This happens because in ath11k_ahb_probe(), ab->mem_ce is initialized -with the value of ab->mem. However, at this instant ab->mem is not -yet set. - -Later, during write to a particular memory via ath11k_ahb_write32() -this ab->mem_ce is used with particular offset. Since ab->mem_ce is -not set properly this possibly leads to memory conflict to handle -kernel paging request and the below trace is seen. - -[ 93.035047] Unable to handle kernel paging request at virtual address ffff800100a00000 -[ 93.035083] Mem abort info: -[ 93.041869] ESR = 0x0000000096000045 -[ 93.044561] EC = 0x25: DABT (current EL), IL = 32 bits -[ 93.048377] SET = 0, FnV = 0 -[ 93.053840] EA = 0, S1PTW = 0 -[ 93.056704] FSC = 0x05: level 1 translation fault -[ 93.059745] Data abort info: -[ 93.064603] ISV = 0, ISS = 0x00000045 -[ 93.067729] CM = 0, WnR = 1 -[ 93.071287] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000042219000 -[ 93.074409] [ffff800100a00000] pgd=100000007ffff003, p4d=100000007ffff003, pud=0000000000000000 -[ 93.081195] Internal error: Oops: 0000000096000045 [#1] PREEMPT SMP -[ 93.089598] Modules linked in: ath11k_ahb ath11k_pci ath11k qmi_helpers -[ 93.095851] CPU: 2 PID: 66 Comm: kworker/u8:3 Not tainted 6.1.0-rc8-wt-ath-658126-g58e4b9df840c-dirty #2 -[ 93.102454] Hardware name: Qualcomm Technologies, Inc. IPQ8074/AP-HK14 (DT) -[ 93.112171] Workqueue: ath11k_qmi_driver_event ath11k_qmi_driver_event_work [ath11k] -[ 93.118856] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) -[ 93.126838] pc : ath11k_ahb_write32+0xc/0x18 [ath11k_ahb] -[ 93.133520] lr : ath11k_hal_srng_setup+0x860/0x8f0 [ath11k] -[ 93.139075] sp : ffff80000aaebb70 -[ 93.144452] x29: ffff80000aaebb70 x28: 0000000000000020 x27: ffff80000aaebc50 -[ 93.147934] x26: ffff000004923750 x25: ffff000004921200 x24: ffff000004928000 -[ 93.155051] x23: 0000000000000020 x22: ffff000004930000 x21: ffff000004923200 -[ 93.162170] x20: ffff000004920000 x19: 00000000eea00000 x18: ffff0000049200f0 -[ 93.169288] x17: 0000000000000000 x16: 0000000000000000 x15: 000000000000025e -[ 93.176405] x14: ffff000003c414f0 x13: 0000000000000000 x12: 0000000000000008 -[ 93.183524] x11: ffff000003c41488 x10: 0000000000000040 x9 : 0000000000000000 -[ 93.190641] x8 : ffff80000a9dd100 x7 : 0000000000000000 x6 : 000000000000003f -[ 93.197759] x5 : ffff800100a00400 x4 : ffff8000031f4018 x3 : 0000000000000004 -[ 93.204877] x2 : 0000000047b62000 x1 : ffff800100a00000 x0 : ffff800012000000 -[ 93.211996] Call trace: -[ 93.219104] ath11k_ahb_write32+0xc/0x18 [ath11k_ahb] -[ 93.221366] ath11k_ce_init_ring+0x184/0x278 [ath11k] -[ 93.226576] ath11k_ce_init_pipes+0x4c/0x1a0 [ath11k] -[ 93.231610] ath11k_core_qmi_firmware_ready+0x3c/0x568 [ath11k] -[ 93.236646] ath11k_qmi_driver_event_work+0x168/0x4f8 [ath11k] -[ 93.242376] process_one_work+0x144/0x350 -[ 93.248275] worker_thread+0x120/0x430 -[ 93.252352] kthread+0xf4/0x110 -[ 93.255997] ret_from_fork+0x10/0x20 -[ 93.259043] Code: d503201f f94e1c00 8b214001 d50332bf (b9000022) -[ 93.262863] ---[ end trace 0000000000000000 ]--- - -However, for the device IPQ5018 ath11k_hw_params .ce_remap is -defined. This parameter is used to recalculate ab->mem_ce and hence, -this issue is not seen in IPQ5018. - -Hence, fix this by initializing ab->mem_ce after ab->mem is set. -ab->mem is set inside the ath11k_ahb_setup_resources() therefore -initialize ab->mem_ce after ath11k_ahb_setup_resources(). - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Fixes: b42b3678c91f ("wifi: ath11k: remap ce register space for IPQ5018") - -Signed-off-by: Raj Kumar Bhagat -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230113063209.7256-1-quic_rajkbhag@quicinc.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -1157,12 +1157,16 @@ static int ath11k_ahb_probe(struct platf - goto err_core_free; - } - -- ab->mem_ce = ab->mem; -- - ret = ath11k_core_pre_init(ab); - if (ret) - goto err_core_free; - -+ ret = ath11k_ahb_setup_resources(ab); -+ if (ret) -+ goto err_core_free; -+ -+ ab->mem_ce = ab->mem; -+ - if (ab->hw_params.ce_remap) { - const struct ce_remap *ce_remap = ab->hw_params.ce_remap; - /* ce register space is moved out of wcss unlike ipq8074 or ipq6018 -@@ -1177,10 +1181,6 @@ static int ath11k_ahb_probe(struct platf - } - } - -- ret = ath11k_ahb_setup_resources(ab); -- if (ret) -- goto err_core_free; -- - ret = ath11k_ahb_fw_resources_init(ab); - if (ret) - goto err_core_free; diff --git a/package/kernel/mac80211/patches/ath11k/0033-wifi-ath11k-Set-ext-passive-scan-flag-to-adjust-pass.patch b/package/kernel/mac80211/patches/ath11k/0033-wifi-ath11k-Set-ext-passive-scan-flag-to-adjust-pass.patch deleted file mode 100644 index 79b79e1053e..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0033-wifi-ath11k-Set-ext-passive-scan-flag-to-adjust-pass.patch +++ /dev/null @@ -1,73 +0,0 @@ -From cf8f3d4deb02a8fdc806c46d4112b69868544697 Mon Sep 17 00:00:00 2001 -From: Tamizh Chelvam Raja -Date: Wed, 15 Feb 2023 20:31:36 +0200 -Subject: [PATCH] wifi: ath11k: Set ext passive scan flag to adjust passive - scan start time - -Set the WMI_SCAN_FLAG_EXT_PASSIVE_SCAN_START_TIME_ENHANCE flag -while sending the scan command. If this flag is enabled when the -incoming scan request comes with a strict start time and its duration -overlaps with next TBTT, then target adjust the start time accordingly -for passive scan. Target supporting this feature will advertise -WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01467-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Tamizh Chelvam Raja -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221222131720.11368-1-quic_tamizhr@quicinc.com ---- - drivers/net/wireless/ath/ath11k/wmi.c | 8 ++++++++ - drivers/net/wireless/ath/ath11k/wmi.h | 3 +++ - 2 files changed, 11 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -2068,6 +2068,12 @@ void ath11k_wmi_start_scan_init(struct a - WMI_SCAN_EVENT_FOREIGN_CHAN | - WMI_SCAN_EVENT_DEQUEUED; - arg->scan_flags |= WMI_SCAN_CHAN_STAT_EVENT; -+ -+ if (test_bit(WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE, -+ ar->ab->wmi_ab.svc_map)) -+ arg->scan_ctrl_flags_ext |= -+ WMI_SCAN_FLAG_EXT_PASSIVE_SCAN_START_TIME_ENHANCE; -+ - arg->num_bssid = 1; - - /* fill bssid_list[0] with 0xff, otherwise bssid and RA will be -@@ -2149,6 +2155,8 @@ ath11k_wmi_copy_scan_event_cntrl_flags(s - /* for adaptive scan mode using 3 bits (21 - 23 bits) */ - WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags, - param->adaptive_dwell_time_mode); -+ -+ cmd->scan_ctrl_flags_ext = param->scan_ctrl_flags_ext; - } - - int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar, ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2093,6 +2093,7 @@ enum wmi_tlv_service { - WMI_TLV_SERVICE_EXT2_MSG = 220, - WMI_TLV_SERVICE_PEER_POWER_SAVE_DURATION_SUPPORT = 246, - WMI_TLV_SERVICE_SRG_SRP_SPATIAL_REUSE_SUPPORT = 249, -+ WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE = 263, - - /* The second 128 bits */ - WMI_MAX_EXT_SERVICE = 256, -@@ -3223,6 +3224,7 @@ struct wmi_start_scan_cmd { - - #define WMI_SCAN_DWELL_MODE_MASK 0x00E00000 - #define WMI_SCAN_DWELL_MODE_SHIFT 21 -+#define WMI_SCAN_FLAG_EXT_PASSIVE_SCAN_START_TIME_ENHANCE 0x00000800 - - enum { - WMI_SCAN_DWELL_MODE_DEFAULT = 0, -@@ -3270,6 +3272,7 @@ struct scan_req_params { - }; - u32 scan_events; - }; -+ u32 scan_ctrl_flags_ext; - u32 dwell_time_active; - u32 dwell_time_active_2g; - u32 dwell_time_passive; diff --git a/package/kernel/mac80211/patches/ath11k/0034-wifi-ath11k-fix-return-value-check-in-ath11k_ahb_pro.patch b/package/kernel/mac80211/patches/ath11k/0034-wifi-ath11k-fix-return-value-check-in-ath11k_ahb_pro.patch deleted file mode 100644 index 59132913bd0..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0034-wifi-ath11k-fix-return-value-check-in-ath11k_ahb_pro.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 342fcde9d91460f01f65707e16368a1571271a3a Mon Sep 17 00:00:00 2001 -From: Yang Yingliang -Date: Fri, 17 Feb 2023 11:00:31 +0800 -Subject: [PATCH] wifi: ath11k: fix return value check in ath11k_ahb_probe() - -ioremap() returns NULL pointer not PTR_ERR() when it fails, -so replace the IS_ERR() check with NULL pointer check. - -Fixes: b42b3678c91f ("wifi: ath11k: remap ce register space for IPQ5018") -Signed-off-by: Yang Yingliang -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230217030031.4021289-1-yangyingliang@huawei.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -1174,7 +1174,7 @@ static int ath11k_ahb_probe(struct platf - * to a new space for accessing them. - */ - ab->mem_ce = ioremap(ce_remap->base, ce_remap->size); -- if (IS_ERR(ab->mem_ce)) { -+ if (!ab->mem_ce) { - dev_err(&pdev->dev, "ce ioremap error\n"); - ret = -ENOMEM; - goto err_core_free; diff --git a/package/kernel/mac80211/patches/ath11k/0035-wifi-ath11k-Use-platform_get_irq-to-get-the-interrup.patch b/package/kernel/mac80211/patches/ath11k/0035-wifi-ath11k-Use-platform_get_irq-to-get-the-interrup.patch deleted file mode 100644 index 93a9da8fc2e..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0035-wifi-ath11k-Use-platform_get_irq-to-get-the-interrup.patch +++ /dev/null @@ -1,50 +0,0 @@ -From f117276638b7600b981b3fe28550823cfbe1ef23 Mon Sep 17 00:00:00 2001 -From: Douglas Anderson -Date: Wed, 1 Feb 2023 08:54:42 -0800 -Subject: [PATCH] wifi: ath11k: Use platform_get_irq() to get the interrupt - -As of commit a1a2b7125e10 ("of/platform: Drop static setup of IRQ -resource from DT core"), we need to use platform_get_irq() instead of -platform_get_resource() to get our IRQs because -platform_get_resource() simply won't get them anymore. - -This was already fixed in several other Atheros WiFi drivers, -apparently in response to Zeal Robot reports. An example of another -fix is commit 9503a1fc123d ("ath9k: Use platform_get_irq() to get the -interrupt"). ath11k seems to have been missed in this effort, though. - -Without this change, WiFi wasn't coming up on my Qualcomm sc7280-based -hardware. Specifically, "platform_get_resource(pdev, IORESOURCE_IRQ, -i)" was failing even for i=0. - -Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 - -Fixes: a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource from DT core") -Fixes: 00402f49d26f ("ath11k: Add support for WCN6750 device") -Signed-off-by: Douglas Anderson -Tested-by: Jun Yu -Reviewed-by: Lad Prabhakar -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230201084131.v2.1.I69cf3d56c97098287fe3a70084ee515098390b70@changeid ---- - drivers/net/wireless/ath/ath11k/ahb.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -874,11 +874,11 @@ static int ath11k_ahb_setup_msi_resource - ab->pci.msi.ep_base_data = int_prop + 32; - - for (i = 0; i < ab->pci.msi.config->total_vectors; i++) { -- res = platform_get_resource(pdev, IORESOURCE_IRQ, i); -- if (!res) -- return -ENODEV; -+ ret = platform_get_irq(pdev, i); -+ if (ret < 0) -+ return ret; - -- ab->pci.msi.irqs[i] = res->start; -+ ab->pci.msi.irqs[i] = ret; - } - - set_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); diff --git a/package/kernel/mac80211/patches/ath11k/0036-wifi-ath11k-fix-SAC-bug-on-peer-addition-with-sta-ba.patch b/package/kernel/mac80211/patches/ath11k/0036-wifi-ath11k-fix-SAC-bug-on-peer-addition-with-sta-ba.patch deleted file mode 100644 index b37f070ba64..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0036-wifi-ath11k-fix-SAC-bug-on-peer-addition-with-sta-ba.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 60b7d62ba8cdbd073997bff0f1cdae8d844002c0 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Thu, 9 Feb 2023 23:26:22 +0100 -Subject: [PATCH] wifi: ath11k: fix SAC bug on peer addition with sta band - migration - -Fix sleep in atomic context warning detected by Smatch static checker -analyzer. - -Following the locking pattern for peer_rhash_add lock tbl_mtx_lock mutex -always even if sta is not transitioning to another band. -This is peer_add function and a more secure locking should not cause -performance regression. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1 - -Fixes: d673cb6fe6c0 ("wifi: ath11k: fix peer addition/deletion error on sta band migration") -Reported-by: Dan Carpenter -Signed-off-by: Christian Marangi -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230209222622.1751-1-ansuelsmth@gmail.com ---- - drivers/net/wireless/ath/ath11k/peer.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/peer.c -+++ b/drivers/net/wireless/ath/ath11k/peer.c -@@ -382,22 +382,23 @@ int ath11k_peer_create(struct ath11k *ar - return -ENOBUFS; - } - -+ mutex_lock(&ar->ab->tbl_mtx_lock); - spin_lock_bh(&ar->ab->base_lock); - peer = ath11k_peer_find_by_addr(ar->ab, param->peer_addr); - if (peer) { - if (peer->vdev_id == param->vdev_id) { - spin_unlock_bh(&ar->ab->base_lock); -+ mutex_unlock(&ar->ab->tbl_mtx_lock); - return -EINVAL; - } - - /* Assume sta is transitioning to another band. - * Remove here the peer from rhash. - */ -- mutex_lock(&ar->ab->tbl_mtx_lock); - ath11k_peer_rhash_delete(ar->ab, peer); -- mutex_unlock(&ar->ab->tbl_mtx_lock); - } - spin_unlock_bh(&ar->ab->base_lock); -+ mutex_unlock(&ar->ab->tbl_mtx_lock); - - ret = ath11k_wmi_send_peer_create_cmd(ar, param); - if (ret) { diff --git a/package/kernel/mac80211/patches/ath11k/0038-wifi-ath11k-modify-accessor-macros-to-match-index-si.patch b/package/kernel/mac80211/patches/ath11k/0038-wifi-ath11k-modify-accessor-macros-to-match-index-si.patch deleted file mode 100644 index 42bf170a03d..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0038-wifi-ath11k-modify-accessor-macros-to-match-index-si.patch +++ /dev/null @@ -1,61 +0,0 @@ -From a96f10422e74cde27c100b321b127ec32ae75747 Mon Sep 17 00:00:00 2001 -From: Muna Sinada -Date: Fri, 24 Feb 2023 12:28:03 +0200 -Subject: [PATCH] wifi: ath11k: modify accessor macros to match index size - -HE PHY is only 11 bytes, therefore it should be using byte indexes -instead of dword. Change corresponding macros to reflect this. - -Signed-off-by: Muna Sinada -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/1666128501-12364-2-git-send-email-quic_msinada@quicinc.com ---- - drivers/net/wireless/ath/ath11k/wmi.h | 24 +++++++++++++----------- - 1 file changed, 13 insertions(+), 11 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2859,30 +2859,32 @@ struct rx_reorder_queue_remove_params { - #define WMI_VDEV_PARAM_TXBF_SU_TX_BFER BIT(2) - #define WMI_VDEV_PARAM_TXBF_MU_TX_BFER BIT(3) - --#define HECAP_PHYDWORD_0 0 --#define HECAP_PHYDWORD_1 1 --#define HECAP_PHYDWORD_2 2 -+#define HE_PHYCAP_BYTE_0 0 -+#define HE_PHYCAP_BYTE_1 1 -+#define HE_PHYCAP_BYTE_2 2 -+#define HE_PHYCAP_BYTE_3 3 -+#define HE_PHYCAP_BYTE_4 4 - --#define HECAP_PHY_SU_BFER BIT(31) -+#define HECAP_PHY_SU_BFER BIT(7) - #define HECAP_PHY_SU_BFEE BIT(0) - #define HECAP_PHY_MU_BFER BIT(1) --#define HECAP_PHY_UL_MUMIMO BIT(22) --#define HECAP_PHY_UL_MUOFDMA BIT(23) -+#define HECAP_PHY_UL_MUMIMO BIT(6) -+#define HECAP_PHY_UL_MUOFDMA BIT(7) - - #define HECAP_PHY_SUBFMR_GET(hecap_phy) \ -- FIELD_GET(HECAP_PHY_SU_BFER, hecap_phy[HECAP_PHYDWORD_0]) -+ FIELD_GET(HECAP_PHY_SU_BFER, hecap_phy[HE_PHYCAP_BYTE_3]) - - #define HECAP_PHY_SUBFME_GET(hecap_phy) \ -- FIELD_GET(HECAP_PHY_SU_BFEE, hecap_phy[HECAP_PHYDWORD_1]) -+ FIELD_GET(HECAP_PHY_SU_BFEE, hecap_phy[HE_PHYCAP_BYTE_4]) - - #define HECAP_PHY_MUBFMR_GET(hecap_phy) \ -- FIELD_GET(HECAP_PHY_MU_BFER, hecap_phy[HECAP_PHYDWORD_1]) -+ FIELD_GET(HECAP_PHY_MU_BFER, hecap_phy[HE_PHYCAP_BYTE_4]) - - #define HECAP_PHY_ULMUMIMO_GET(hecap_phy) \ -- FIELD_GET(HECAP_PHY_UL_MUMIMO, hecap_phy[HECAP_PHYDWORD_0]) -+ FIELD_GET(HECAP_PHY_UL_MUMIMO, hecap_phy[HE_PHYCAP_BYTE_2]) - - #define HECAP_PHY_ULOFDMA_GET(hecap_phy) \ -- FIELD_GET(HECAP_PHY_UL_MUOFDMA, hecap_phy[HECAP_PHYDWORD_0]) -+ FIELD_GET(HECAP_PHY_UL_MUOFDMA, hecap_phy[HE_PHYCAP_BYTE_2]) - - #define HE_MODE_SU_TX_BFEE BIT(0) - #define HE_MODE_SU_TX_BFER BIT(1) diff --git a/package/kernel/mac80211/patches/ath11k/0039-wifi-ath11k-push-MU-MIMO-params-from-hostapd-to-hard.patch b/package/kernel/mac80211/patches/ath11k/0039-wifi-ath11k-push-MU-MIMO-params-from-hostapd-to-hard.patch deleted file mode 100644 index 298ce1a612b..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0039-wifi-ath11k-push-MU-MIMO-params-from-hostapd-to-hard.patch +++ /dev/null @@ -1,300 +0,0 @@ -From 38dfe775d0abf511341f37c1cb77b919a3ad410b Mon Sep 17 00:00:00 2001 -From: Muna Sinada -Date: Fri, 24 Feb 2023 12:28:04 +0200 -Subject: [PATCH] wifi: ath11k: push MU-MIMO params from hostapd to hardware - -In the previous behaviour only HE IE in management frames are changed -regarding MU-MIMO configurations and not in hardware. Adding push of -MU-MIMO configurations to the hardware as well. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00356-QCAHKSWPL_SILICONZ-1 - -Co-developed-by: Anilkumar Kolli -Signed-off-by: Anilkumar Kolli -Signed-off-by: Muna Sinada -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/1666128501-12364-3-git-send-email-quic_msinada@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 200 ++++++++++++++++---------- - drivers/net/wireless/ath/ath11k/wmi.h | 3 + - 2 files changed, 130 insertions(+), 73 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -2699,6 +2699,117 @@ static int ath11k_setup_peer_smps(struct - ath11k_smps_map[smps]); - } - -+static bool ath11k_mac_set_he_txbf_conf(struct ath11k_vif *arvif) -+{ -+ struct ath11k *ar = arvif->ar; -+ u32 param, value; -+ int ret; -+ -+ if (!arvif->vif->bss_conf.he_support) -+ return true; -+ -+ param = WMI_VDEV_PARAM_SET_HEMU_MODE; -+ value = 0; -+ if (arvif->vif->bss_conf.he_su_beamformer) { -+ value |= FIELD_PREP(HE_MODE_SU_TX_BFER, HE_SU_BFER_ENABLE); -+ if (arvif->vif->bss_conf.he_mu_beamformer && -+ arvif->vdev_type == WMI_VDEV_TYPE_AP) -+ value |= FIELD_PREP(HE_MODE_MU_TX_BFER, HE_MU_BFER_ENABLE); -+ } -+ -+ if (arvif->vif->type != NL80211_IFTYPE_MESH_POINT) { -+ value |= FIELD_PREP(HE_MODE_DL_OFDMA, HE_DL_MUOFDMA_ENABLE) | -+ FIELD_PREP(HE_MODE_UL_OFDMA, HE_UL_MUOFDMA_ENABLE); -+ -+ if (arvif->vif->bss_conf.he_full_ul_mumimo) -+ value |= FIELD_PREP(HE_MODE_UL_MUMIMO, HE_UL_MUMIMO_ENABLE); -+ -+ if (arvif->vif->bss_conf.he_su_beamformee) -+ value |= FIELD_PREP(HE_MODE_SU_TX_BFEE, HE_SU_BFEE_ENABLE); -+ } -+ -+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, value); -+ if (ret) { -+ ath11k_warn(ar->ab, "failed to set vdev %d HE MU mode: %d\n", -+ arvif->vdev_id, ret); -+ return false; -+ } -+ -+ param = WMI_VDEV_PARAM_SET_HE_SOUNDING_MODE; -+ value = FIELD_PREP(HE_VHT_SOUNDING_MODE, HE_VHT_SOUNDING_MODE_ENABLE) | -+ FIELD_PREP(HE_TRIG_NONTRIG_SOUNDING_MODE, -+ HE_TRIG_NONTRIG_SOUNDING_MODE_ENABLE); -+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, -+ param, value); -+ if (ret) { -+ ath11k_warn(ar->ab, "failed to set vdev %d sounding mode: %d\n", -+ arvif->vdev_id, ret); -+ return false; -+ } -+ return true; -+} -+ -+static bool ath11k_mac_vif_recalc_sta_he_txbf(struct ath11k *ar, -+ struct ieee80211_vif *vif, -+ struct ieee80211_sta_he_cap *he_cap) -+{ -+ struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ieee80211_he_cap_elem he_cap_elem = {0}; -+ struct ieee80211_sta_he_cap *cap_band = NULL; -+ struct cfg80211_chan_def def; -+ u32 param = WMI_VDEV_PARAM_SET_HEMU_MODE; -+ u32 hemode = 0; -+ int ret; -+ -+ if (!vif->bss_conf.he_support) -+ return true; -+ -+ if (vif->type != NL80211_IFTYPE_STATION) -+ return false; -+ -+ if (WARN_ON(ath11k_mac_vif_chan(vif, &def))) -+ return false; -+ -+ if (def.chan->band == NL80211_BAND_2GHZ) -+ cap_band = &ar->mac.iftype[NL80211_BAND_2GHZ][vif->type].he_cap; -+ else -+ cap_band = &ar->mac.iftype[NL80211_BAND_5GHZ][vif->type].he_cap; -+ -+ memcpy(&he_cap_elem, &cap_band->he_cap_elem, sizeof(he_cap_elem)); -+ -+ if (HECAP_PHY_SUBFME_GET(he_cap_elem.phy_cap_info)) { -+ if (HECAP_PHY_SUBFMR_GET(he_cap->he_cap_elem.phy_cap_info)) -+ hemode |= FIELD_PREP(HE_MODE_SU_TX_BFEE, HE_SU_BFEE_ENABLE); -+ if (HECAP_PHY_MUBFMR_GET(he_cap->he_cap_elem.phy_cap_info)) -+ hemode |= FIELD_PREP(HE_MODE_MU_TX_BFEE, HE_MU_BFEE_ENABLE); -+ } -+ -+ if (vif->type != NL80211_IFTYPE_MESH_POINT) { -+ hemode |= FIELD_PREP(HE_MODE_DL_OFDMA, HE_DL_MUOFDMA_ENABLE) | -+ FIELD_PREP(HE_MODE_UL_OFDMA, HE_UL_MUOFDMA_ENABLE); -+ -+ if (HECAP_PHY_ULMUMIMO_GET(he_cap_elem.phy_cap_info)) -+ if (HECAP_PHY_ULMUMIMO_GET(he_cap->he_cap_elem.phy_cap_info)) -+ hemode |= FIELD_PREP(HE_MODE_UL_MUMIMO, -+ HE_UL_MUMIMO_ENABLE); -+ -+ if (FIELD_GET(HE_MODE_MU_TX_BFEE, hemode)) -+ hemode |= FIELD_PREP(HE_MODE_SU_TX_BFEE, HE_SU_BFEE_ENABLE); -+ -+ if (FIELD_GET(HE_MODE_MU_TX_BFER, hemode)) -+ hemode |= FIELD_PREP(HE_MODE_SU_TX_BFER, HE_SU_BFER_ENABLE); -+ } -+ -+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, hemode); -+ if (ret) { -+ ath11k_warn(ar->ab, "failed to submit vdev param txbf 0x%x: %d\n", -+ hemode, ret); -+ return false; -+ } -+ -+ return true; -+} -+ - static void ath11k_bss_assoc(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf) -@@ -2709,6 +2820,7 @@ static void ath11k_bss_assoc(struct ieee - struct ieee80211_sta *ap_sta; - struct ath11k_peer *peer; - bool is_auth = false; -+ struct ieee80211_sta_he_cap he_cap; - int ret; - - lockdep_assert_held(&ar->conf_mutex); -@@ -2726,6 +2838,9 @@ static void ath11k_bss_assoc(struct ieee - return; - } - -+ /* he_cap here is updated at assoc success for sta mode only */ -+ he_cap = ap_sta->deflink.he_cap; -+ - ath11k_peer_assoc_prepare(ar, vif, ap_sta, &peer_arg, false); - - rcu_read_unlock(); -@@ -2753,6 +2868,12 @@ static void ath11k_bss_assoc(struct ieee - return; - } - -+ if (!ath11k_mac_vif_recalc_sta_he_txbf(ar, vif, &he_cap)) { -+ ath11k_warn(ar->ab, "failed to recalc he txbf for vdev %i on bss %pM\n", -+ arvif->vdev_id, bss_conf->bssid); -+ return; -+ } -+ - WARN_ON(arvif->is_up); - - arvif->aid = vif->cfg.aid; -@@ -3202,6 +3323,8 @@ static void ath11k_mac_op_bss_info_chang - ether_addr_copy(arvif->bssid, info->bssid); - - if (changed & BSS_CHANGED_BEACON_ENABLED) { -+ if (info->enable_beacon) -+ ath11k_mac_set_he_txbf_conf(arvif); - ath11k_control_beaconing(arvif, info); - - if (arvif->is_up && vif->bss_conf.he_support && -@@ -5392,6 +5515,10 @@ static int ath11k_mac_copy_he_cap(struct - - he_cap_elem->mac_cap_info[1] &= - IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK; -+ he_cap_elem->phy_cap_info[0] &= -+ ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G; -+ he_cap_elem->phy_cap_info[0] &= -+ ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G; - - he_cap_elem->phy_cap_info[5] &= - ~IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK; -@@ -6026,69 +6153,6 @@ ath11k_mac_setup_vdev_create_params(stru - } - } - --static u32 --ath11k_mac_prepare_he_mode(struct ath11k_pdev *pdev, u32 viftype) --{ -- struct ath11k_pdev_cap *pdev_cap = &pdev->cap; -- struct ath11k_band_cap *cap_band = NULL; -- u32 *hecap_phy_ptr = NULL; -- u32 hemode = 0; -- -- if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) -- cap_band = &pdev_cap->band[NL80211_BAND_2GHZ]; -- else -- cap_band = &pdev_cap->band[NL80211_BAND_5GHZ]; -- -- hecap_phy_ptr = &cap_band->he_cap_phy_info[0]; -- -- hemode = FIELD_PREP(HE_MODE_SU_TX_BFEE, HE_SU_BFEE_ENABLE) | -- FIELD_PREP(HE_MODE_SU_TX_BFER, HECAP_PHY_SUBFMR_GET(hecap_phy_ptr)) | -- FIELD_PREP(HE_MODE_UL_MUMIMO, HECAP_PHY_ULMUMIMO_GET(hecap_phy_ptr)); -- -- /* TODO WDS and other modes */ -- if (viftype == NL80211_IFTYPE_AP) { -- hemode |= FIELD_PREP(HE_MODE_MU_TX_BFER, -- HECAP_PHY_MUBFMR_GET(hecap_phy_ptr)) | -- FIELD_PREP(HE_MODE_DL_OFDMA, HE_DL_MUOFDMA_ENABLE) | -- FIELD_PREP(HE_MODE_UL_OFDMA, HE_UL_MUOFDMA_ENABLE); -- } else { -- hemode |= FIELD_PREP(HE_MODE_MU_TX_BFEE, HE_MU_BFEE_ENABLE); -- } -- -- return hemode; --} -- --static int ath11k_set_he_mu_sounding_mode(struct ath11k *ar, -- struct ath11k_vif *arvif) --{ -- u32 param_id, param_value; -- struct ath11k_base *ab = ar->ab; -- int ret = 0; -- -- param_id = WMI_VDEV_PARAM_SET_HEMU_MODE; -- param_value = ath11k_mac_prepare_he_mode(ar->pdev, arvif->vif->type); -- ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, -- param_id, param_value); -- if (ret) { -- ath11k_warn(ab, "failed to set vdev %d HE MU mode: %d param_value %x\n", -- arvif->vdev_id, ret, param_value); -- return ret; -- } -- param_id = WMI_VDEV_PARAM_SET_HE_SOUNDING_MODE; -- param_value = -- FIELD_PREP(HE_VHT_SOUNDING_MODE, HE_VHT_SOUNDING_MODE_ENABLE) | -- FIELD_PREP(HE_TRIG_NONTRIG_SOUNDING_MODE, -- HE_TRIG_NONTRIG_SOUNDING_MODE_ENABLE); -- ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, -- param_id, param_value); -- if (ret) { -- ath11k_warn(ab, "failed to set vdev %d HE MU mode: %d\n", -- arvif->vdev_id, ret); -- return ret; -- } -- return ret; --} -- - static void ath11k_mac_op_update_vif_offload(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) - { -@@ -6757,7 +6821,6 @@ ath11k_mac_vdev_start_restart(struct ath - struct ath11k_base *ab = ar->ab; - struct wmi_vdev_start_req_arg arg = {}; - const struct cfg80211_chan_def *chandef = &ctx->def; -- int he_support = arvif->vif->bss_conf.he_support; - int ret = 0; - - lockdep_assert_held(&ar->conf_mutex); -@@ -6798,15 +6861,6 @@ ath11k_mac_vdev_start_restart(struct ath - spin_lock_bh(&ab->base_lock); - arg.regdomain = ar->ab->dfs_region; - spin_unlock_bh(&ab->base_lock); -- -- if (he_support) { -- ret = ath11k_set_he_mu_sounding_mode(ar, arvif); -- if (ret) { -- ath11k_warn(ar->ab, "failed to set he mode vdev %i\n", -- arg.vdev_id); -- return ret; -- } -- } - } - - arg.channel.passive |= !!(chandef->chan->flags & IEEE80211_CHAN_NO_IR); ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2897,8 +2897,11 @@ struct rx_reorder_queue_remove_params { - #define HE_DL_MUOFDMA_ENABLE 1 - #define HE_UL_MUOFDMA_ENABLE 1 - #define HE_DL_MUMIMO_ENABLE 1 -+#define HE_UL_MUMIMO_ENABLE 1 - #define HE_MU_BFEE_ENABLE 1 - #define HE_SU_BFEE_ENABLE 1 -+#define HE_MU_BFER_ENABLE 1 -+#define HE_SU_BFER_ENABLE 1 - - #define HE_VHT_SOUNDING_MODE_ENABLE 1 - #define HE_SU_MU_SOUNDING_MODE_ENABLE 1 diff --git a/package/kernel/mac80211/patches/ath11k/0040-wifi-ath11k-move-HE-MCS-mapper-to-a-separate-functio.patch b/package/kernel/mac80211/patches/ath11k/0040-wifi-ath11k-move-HE-MCS-mapper-to-a-separate-functio.patch deleted file mode 100644 index 6bc9880e109..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0040-wifi-ath11k-move-HE-MCS-mapper-to-a-separate-functio.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 8077c1bbbc28e527fb29143c46f32c6a9d6cadf0 Mon Sep 17 00:00:00 2001 -From: Muna Sinada -Date: Fri, 24 Feb 2023 12:28:04 +0200 -Subject: [PATCH] wifi: ath11k: move HE MCS mapper to a separate function - -Move HE MCS mapper to a separate function and call new function -in ath11k_mac_copy_he_cap(). - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00356-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Muna Sinada -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/1666128501-12364-4-git-send-email-quic_msinada@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 34 +++++++++++++++++---------- - 1 file changed, 22 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5483,6 +5483,27 @@ static __le16 ath11k_mac_setup_he_6ghz_c - return cpu_to_le16(bcap->he_6ghz_capa); - } - -+static void ath11k_mac_set_hemcsmap(struct ath11k *ar, -+ struct ath11k_pdev_cap *cap, -+ struct ieee80211_sta_he_cap *he_cap, -+ int band) -+{ -+ struct ath11k_band_cap *band_cap = &cap->band[band]; -+ -+ he_cap->he_mcs_nss_supp.rx_mcs_80 = -+ cpu_to_le16(band_cap->he_mcs & 0xffff); -+ he_cap->he_mcs_nss_supp.tx_mcs_80 = -+ cpu_to_le16(band_cap->he_mcs & 0xffff); -+ he_cap->he_mcs_nss_supp.rx_mcs_160 = -+ cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ he_cap->he_mcs_nss_supp.tx_mcs_160 = -+ cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ he_cap->he_mcs_nss_supp.rx_mcs_80p80 = -+ cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ he_cap->he_mcs_nss_supp.tx_mcs_80p80 = -+ cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+} -+ - static int ath11k_mac_copy_he_cap(struct ath11k *ar, - struct ath11k_pdev_cap *cap, - struct ieee80211_sband_iftype_data *data, -@@ -5544,18 +5565,7 @@ static int ath11k_mac_copy_he_cap(struct - break; - } - -- he_cap->he_mcs_nss_supp.rx_mcs_80 = -- cpu_to_le16(band_cap->he_mcs & 0xffff); -- he_cap->he_mcs_nss_supp.tx_mcs_80 = -- cpu_to_le16(band_cap->he_mcs & 0xffff); -- he_cap->he_mcs_nss_supp.rx_mcs_160 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -- he_cap->he_mcs_nss_supp.tx_mcs_160 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -- he_cap->he_mcs_nss_supp.rx_mcs_80p80 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -- he_cap->he_mcs_nss_supp.tx_mcs_80p80 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ ath11k_mac_set_hemcsmap(ar, cap, he_cap, band); - - memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres)); - if (he_cap_elem->phy_cap_info[6] & diff --git a/package/kernel/mac80211/patches/ath11k/0041-wifi-ath11k-generate-rx-and-tx-mcs-maps-for-supporte.patch b/package/kernel/mac80211/patches/ath11k/0041-wifi-ath11k-generate-rx-and-tx-mcs-maps-for-supporte.patch deleted file mode 100644 index 5cb7801b294..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0041-wifi-ath11k-generate-rx-and-tx-mcs-maps-for-supporte.patch +++ /dev/null @@ -1,64 +0,0 @@ -From ebf82988f844dd98e6b007cffcc5e95986056995 Mon Sep 17 00:00:00 2001 -From: Muna Sinada -Date: Fri, 24 Feb 2023 12:28:04 +0200 -Subject: [PATCH] wifi: ath11k: generate rx and tx mcs maps for supported HE - mcs - -Generate rx and tx mcs maps in ath11k_mac_set_hemcsmap() and set them -in supported mcs/nss for HE capabilities. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00356-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Muna Sinada -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/1666128501-12364-5-git-send-email-quic_msinada@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 30 ++++++++++++++++++++------- - 1 file changed, 23 insertions(+), 7 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5488,20 +5488,36 @@ static void ath11k_mac_set_hemcsmap(stru - struct ieee80211_sta_he_cap *he_cap, - int band) - { -- struct ath11k_band_cap *band_cap = &cap->band[band]; -+ u16 txmcs_map, rxmcs_map; -+ u32 i; - -+ rxmcs_map = 0; -+ txmcs_map = 0; -+ for (i = 0; i < 8; i++) { -+ if (i < ar->num_tx_chains && -+ (ar->cfg_tx_chainmask >> cap->tx_chain_mask_shift) & BIT(i)) -+ txmcs_map |= IEEE80211_HE_MCS_SUPPORT_0_11 << (i * 2); -+ else -+ txmcs_map |= IEEE80211_HE_MCS_NOT_SUPPORTED << (i * 2); -+ -+ if (i < ar->num_rx_chains && -+ (ar->cfg_rx_chainmask >> cap->tx_chain_mask_shift) & BIT(i)) -+ rxmcs_map |= IEEE80211_HE_MCS_SUPPORT_0_11 << (i * 2); -+ else -+ rxmcs_map |= IEEE80211_HE_MCS_NOT_SUPPORTED << (i * 2); -+ } - he_cap->he_mcs_nss_supp.rx_mcs_80 = -- cpu_to_le16(band_cap->he_mcs & 0xffff); -+ cpu_to_le16(rxmcs_map & 0xffff); - he_cap->he_mcs_nss_supp.tx_mcs_80 = -- cpu_to_le16(band_cap->he_mcs & 0xffff); -+ cpu_to_le16(txmcs_map & 0xffff); - he_cap->he_mcs_nss_supp.rx_mcs_160 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ cpu_to_le16(rxmcs_map & 0xffff); - he_cap->he_mcs_nss_supp.tx_mcs_160 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ cpu_to_le16(txmcs_map & 0xffff); - he_cap->he_mcs_nss_supp.rx_mcs_80p80 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ cpu_to_le16(rxmcs_map & 0xffff); - he_cap->he_mcs_nss_supp.tx_mcs_80p80 = -- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); -+ cpu_to_le16(txmcs_map & 0xffff); - } - - static int ath11k_mac_copy_he_cap(struct ath11k *ar, diff --git a/package/kernel/mac80211/patches/ath11k/0042-wifi-ath11k-Add-tx-ack-signal-support-for-management.patch b/package/kernel/mac80211/patches/ath11k/0042-wifi-ath11k-Add-tx-ack-signal-support-for-management.patch deleted file mode 100644 index 8d41657311a..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0042-wifi-ath11k-Add-tx-ack-signal-support-for-management.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 01c6c9fccbd51c1d9eab0f5794b0271b026178df Mon Sep 17 00:00:00 2001 -From: Abinaya Kalaiselvan -Date: Mon, 19 Dec 2022 11:08:44 +0530 -Subject: [PATCH] wifi: ath11k: Add tx ack signal support for management - packets - -Add support to notify tx ack signal values for management -packets to userspace through nl80211 interface. - -Advertise NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT flag -to enable this feature and it will be used for data -packets as well. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Abinaya Kalaiselvan -Signed-off-by: Maharaja Kennadyrajan -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20221219053844.4084486-1-quic_mkenna@quicinc.com ---- - drivers/net/wireless/ath/ath11k/hw.c | 1 + - drivers/net/wireless/ath/ath11k/mac.c | 5 +++++ - drivers/net/wireless/ath/ath11k/wmi.c | 27 ++++++++++++++++----------- - drivers/net/wireless/ath/ath11k/wmi.h | 3 +++ - 4 files changed, 25 insertions(+), 11 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -201,6 +201,7 @@ static void ath11k_init_wmi_config_ipq80 - config->twt_ap_pdev_count = ab->num_radios; - config->twt_ap_sta_count = 1000; - config->flag1 |= WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64; -+ config->flag1 |= WMI_RSRC_CFG_FLAG1_ACK_RSSI; - } - - static int ath11k_hw_mac_id_to_pdev_id_ipq8074(struct ath11k_hw_params *hw, ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -9174,6 +9174,11 @@ static int __ath11k_mac_register(struct - goto err_free_if_combs; - } - -+ if (test_bit(WMI_TLV_SERVICE_TX_DATA_MGMT_ACK_RSSI, -+ ar->ab->wmi_ab.svc_map)) -+ wiphy_ext_feature_set(ar->hw->wiphy, -+ NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT); -+ - ar->hw->queues = ATH11K_HW_MAX_QUEUES; - ar->hw->wiphy->tx_queue_len = ATH11K_QUEUE_LEN; - 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 -@@ -5229,8 +5229,8 @@ static int ath11k_pull_mgmt_rx_params_tl - return 0; - } - --static int wmi_process_mgmt_tx_comp(struct ath11k *ar, u32 desc_id, -- u32 status) -+static int wmi_process_mgmt_tx_comp(struct ath11k *ar, -+ struct wmi_mgmt_tx_compl_event *tx_compl_param) - { - struct sk_buff *msdu; - struct ieee80211_tx_info *info; -@@ -5238,24 +5238,29 @@ static int wmi_process_mgmt_tx_comp(stru - int num_mgmt; - - spin_lock_bh(&ar->txmgmt_idr_lock); -- msdu = idr_find(&ar->txmgmt_idr, desc_id); -+ msdu = idr_find(&ar->txmgmt_idr, tx_compl_param->desc_id); - - if (!msdu) { - ath11k_warn(ar->ab, "received mgmt tx compl for invalid msdu_id: %d\n", -- desc_id); -+ tx_compl_param->desc_id); - spin_unlock_bh(&ar->txmgmt_idr_lock); - return -ENOENT; - } - -- idr_remove(&ar->txmgmt_idr, desc_id); -+ idr_remove(&ar->txmgmt_idr, tx_compl_param->desc_id); - spin_unlock_bh(&ar->txmgmt_idr_lock); - - skb_cb = ATH11K_SKB_CB(msdu); - dma_unmap_single(ar->ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); - - info = IEEE80211_SKB_CB(msdu); -- if ((!(info->flags & IEEE80211_TX_CTL_NO_ACK)) && !status) -+ if ((!(info->flags & IEEE80211_TX_CTL_NO_ACK)) && -+ !tx_compl_param->status) { - info->flags |= IEEE80211_TX_STAT_ACK; -+ if (test_bit(WMI_TLV_SERVICE_TX_DATA_MGMT_ACK_RSSI, -+ ar->ab->wmi_ab.svc_map)) -+ info->status.ack_signal = tx_compl_param->ack_rssi; -+ } - - ieee80211_tx_status_irqsafe(ar->hw, msdu); - -@@ -5267,7 +5272,7 @@ static int wmi_process_mgmt_tx_comp(stru - - ath11k_dbg(ar->ab, ATH11K_DBG_WMI, - "wmi mgmt tx comp pending %d desc id %d\n", -- num_mgmt, desc_id); -+ num_mgmt, tx_compl_param->desc_id); - - if (!num_mgmt) - wake_up(&ar->txmgmt_empty_waitq); -@@ -5300,6 +5305,7 @@ static int ath11k_pull_mgmt_tx_compl_par - param->pdev_id = ev->pdev_id; - param->desc_id = ev->desc_id; - param->status = ev->status; -+ param->ack_rssi = ev->ack_rssi; - - kfree(tb); - return 0; -@@ -7070,13 +7076,12 @@ static void ath11k_mgmt_tx_compl_event(s - goto exit; - } - -- wmi_process_mgmt_tx_comp(ar, tx_compl_param.desc_id, -- tx_compl_param.status); -+ wmi_process_mgmt_tx_comp(ar, &tx_compl_param); - - ath11k_dbg(ab, ATH11K_DBG_MGMT, -- "mgmt tx compl ev pdev_id %d, desc_id %d, status %d", -+ "mgmt tx compl ev pdev_id %d, desc_id %d, status %d ack_rssi %d", - tx_compl_param.pdev_id, tx_compl_param.desc_id, -- tx_compl_param.status); -+ tx_compl_param.status, tx_compl_param.ack_rssi); - - exit: - rcu_read_unlock(); ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2311,6 +2311,7 @@ struct wmi_init_cmd { - } __packed; - - #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 BIT(5) -+#define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18) - - struct wmi_resource_config { - u32 tlv_header; -@@ -4550,6 +4551,8 @@ struct wmi_mgmt_tx_compl_event { - u32 desc_id; - u32 status; - u32 pdev_id; -+ u32 ppdu_id; -+ u32 ack_rssi; - } __packed; - - struct wmi_scan_event { diff --git a/package/kernel/mac80211/patches/ath11k/0043-wifi-ath11k-use-proper-regulatory-reference-for-band.patch b/package/kernel/mac80211/patches/ath11k/0043-wifi-ath11k-use-proper-regulatory-reference-for-band.patch deleted file mode 100644 index 5bc195528e4..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0043-wifi-ath11k-use-proper-regulatory-reference-for-band.patch +++ /dev/null @@ -1,216 +0,0 @@ -From 25e289e1f52e1f4fb1d07622c6a24f8d8a8e420d Mon Sep 17 00:00:00 2001 -From: Aditya Kumar Singh -Date: Wed, 1 Mar 2023 16:20:58 +0200 -Subject: [PATCH] wifi: ath11k: use proper regulatory reference for bands - -Currently, during regulatory event, 2 GHz/5 GHz is referred -to as 2G/5G including variable names. However, there is no -such entity as 2G or 5G. - -Re-name such occurences to its proper name. No functional changes. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aditya Kumar Singh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230110121024.14051-2-quic_adisi@quicinc.com ---- - drivers/net/wireless/ath/ath11k/reg.c | 20 ++++----- - drivers/net/wireless/ath/ath11k/wmi.c | 58 ++++++++++++++------------- - drivers/net/wireless/ath/ath11k/wmi.h | 28 ++++++------- - 3 files changed, 54 insertions(+), 52 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/reg.c -+++ b/drivers/net/wireless/ath/ath11k/reg.c -@@ -619,7 +619,7 @@ ath11k_reg_build_regd(struct ath11k_base - u32 flags; - char alpha2[3]; - -- num_rules = reg_info->num_5g_reg_rules + reg_info->num_2g_reg_rules; -+ num_rules = reg_info->num_5ghz_reg_rules + reg_info->num_2ghz_reg_rules; - - if (!num_rules) - goto ret; -@@ -644,20 +644,20 @@ ath11k_reg_build_regd(struct ath11k_base - alpha2, ath11k_reg_get_regdom_str(tmp_regd->dfs_region), - reg_info->dfs_region, num_rules); - /* Update reg_rules[] below. Firmware is expected to -- * send these rules in order(2G rules first and then 5G) -+ * send these rules in order(2 GHz rules first and then 5 GHz) - */ - for (; i < num_rules; i++) { -- if (reg_info->num_2g_reg_rules && -- (i < reg_info->num_2g_reg_rules)) { -- reg_rule = reg_info->reg_rules_2g_ptr + i; -+ if (reg_info->num_2ghz_reg_rules && -+ (i < reg_info->num_2ghz_reg_rules)) { -+ reg_rule = reg_info->reg_rules_2ghz_ptr + i; - max_bw = min_t(u16, reg_rule->max_bw, -- reg_info->max_bw_2g); -+ reg_info->max_bw_2ghz); - flags = 0; -- } else if (reg_info->num_5g_reg_rules && -- (j < reg_info->num_5g_reg_rules)) { -- reg_rule = reg_info->reg_rules_5g_ptr + j++; -+ } else if (reg_info->num_5ghz_reg_rules && -+ (j < reg_info->num_5ghz_reg_rules)) { -+ reg_rule = reg_info->reg_rules_5ghz_ptr + j++; - max_bw = min_t(u16, reg_rule->max_bw, -- reg_info->max_bw_5g); -+ reg_info->max_bw_5ghz); - - /* FW doesn't pass NL80211_RRF_AUTO_BW flag for - * BW Auto correction, we can enable this by default ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -4959,7 +4959,7 @@ static int ath11k_pull_reg_chan_list_upd - const void **tb; - const struct wmi_reg_chan_list_cc_event *chan_list_event_hdr; - struct wmi_regulatory_rule_struct *wmi_reg_rule; -- u32 num_2g_reg_rules, num_5g_reg_rules; -+ u32 num_2ghz_reg_rules, num_5ghz_reg_rules; - int ret; - - ath11k_dbg(ab, ATH11K_DBG_WMI, "processing regulatory channel list\n"); -@@ -4978,10 +4978,10 @@ static int ath11k_pull_reg_chan_list_upd - return -EPROTO; - } - -- reg_info->num_2g_reg_rules = chan_list_event_hdr->num_2g_reg_rules; -- reg_info->num_5g_reg_rules = chan_list_event_hdr->num_5g_reg_rules; -+ reg_info->num_2ghz_reg_rules = chan_list_event_hdr->num_2ghz_reg_rules; -+ reg_info->num_5ghz_reg_rules = chan_list_event_hdr->num_5ghz_reg_rules; - -- if (!(reg_info->num_2g_reg_rules + reg_info->num_5g_reg_rules)) { -+ if (!(reg_info->num_2ghz_reg_rules + reg_info->num_5ghz_reg_rules)) { - ath11k_warn(ab, "No regulatory rules available in the event info\n"); - kfree(tb); - return -EINVAL; -@@ -5008,46 +5008,48 @@ static int ath11k_pull_reg_chan_list_upd - else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_FAIL) - reg_info->status_code = REG_SET_CC_STATUS_FAIL; - -- reg_info->min_bw_2g = chan_list_event_hdr->min_bw_2g; -- reg_info->max_bw_2g = chan_list_event_hdr->max_bw_2g; -- reg_info->min_bw_5g = chan_list_event_hdr->min_bw_5g; -- reg_info->max_bw_5g = chan_list_event_hdr->max_bw_5g; -+ reg_info->min_bw_2ghz = chan_list_event_hdr->min_bw_2ghz; -+ reg_info->max_bw_2ghz = chan_list_event_hdr->max_bw_2ghz; -+ reg_info->min_bw_5ghz = chan_list_event_hdr->min_bw_5ghz; -+ reg_info->max_bw_5ghz = chan_list_event_hdr->max_bw_5ghz; - -- num_2g_reg_rules = reg_info->num_2g_reg_rules; -- num_5g_reg_rules = reg_info->num_5g_reg_rules; -+ num_2ghz_reg_rules = reg_info->num_2ghz_reg_rules; -+ num_5ghz_reg_rules = reg_info->num_5ghz_reg_rules; - - ath11k_dbg(ab, ATH11K_DBG_WMI, -- "%s:cc %s dsf %d BW: min_2g %d max_2g %d min_5g %d max_5g %d", -+ "%s:cc %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", - __func__, reg_info->alpha2, reg_info->dfs_region, -- reg_info->min_bw_2g, reg_info->max_bw_2g, -- reg_info->min_bw_5g, reg_info->max_bw_5g); -+ reg_info->min_bw_2ghz, reg_info->max_bw_2ghz, -+ reg_info->min_bw_5ghz, reg_info->max_bw_5ghz); - - ath11k_dbg(ab, ATH11K_DBG_WMI, -- "%s: num_2g_reg_rules %d num_5g_reg_rules %d", __func__, -- num_2g_reg_rules, num_5g_reg_rules); -+ "%s: num_2ghz_reg_rules %d num_5ghz_reg_rules %d", __func__, -+ num_2ghz_reg_rules, num_5ghz_reg_rules); - - wmi_reg_rule = - (struct wmi_regulatory_rule_struct *)((u8 *)chan_list_event_hdr - + sizeof(*chan_list_event_hdr) - + sizeof(struct wmi_tlv)); - -- if (num_2g_reg_rules) { -- reg_info->reg_rules_2g_ptr = create_reg_rules_from_wmi(num_2g_reg_rules, -- wmi_reg_rule); -- if (!reg_info->reg_rules_2g_ptr) { -+ if (num_2ghz_reg_rules) { -+ reg_info->reg_rules_2ghz_ptr = -+ create_reg_rules_from_wmi(num_2ghz_reg_rules, -+ wmi_reg_rule); -+ if (!reg_info->reg_rules_2ghz_ptr) { - kfree(tb); -- ath11k_warn(ab, "Unable to Allocate memory for 2g rules\n"); -+ ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n"); - return -ENOMEM; - } - } - -- if (num_5g_reg_rules) { -- wmi_reg_rule += num_2g_reg_rules; -- reg_info->reg_rules_5g_ptr = create_reg_rules_from_wmi(num_5g_reg_rules, -- wmi_reg_rule); -- if (!reg_info->reg_rules_5g_ptr) { -+ if (num_5ghz_reg_rules) { -+ wmi_reg_rule += num_2ghz_reg_rules; -+ reg_info->reg_rules_5ghz_ptr = -+ create_reg_rules_from_wmi(num_5ghz_reg_rules, -+ wmi_reg_rule); -+ if (!reg_info->reg_rules_5ghz_ptr) { - kfree(tb); -- ath11k_warn(ab, "Unable to Allocate memory for 5g rules\n"); -+ ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n"); - return -ENOMEM; - } - } -@@ -6619,8 +6621,8 @@ fallback: - WARN_ON(1); - mem_free: - if (reg_info) { -- kfree(reg_info->reg_rules_2g_ptr); -- kfree(reg_info->reg_rules_5g_ptr); -+ kfree(reg_info->reg_rules_2ghz_ptr); -+ kfree(reg_info->reg_rules_5ghz_ptr); - kfree(reg_info); - } - return ret; ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -4129,14 +4129,14 @@ struct cur_regulatory_info { - u8 alpha2[REG_ALPHA2_LEN + 1]; - u32 dfs_region; - u32 phybitmap; -- u32 min_bw_2g; -- u32 max_bw_2g; -- u32 min_bw_5g; -- u32 max_bw_5g; -- u32 num_2g_reg_rules; -- u32 num_5g_reg_rules; -- struct cur_reg_rule *reg_rules_2g_ptr; -- struct cur_reg_rule *reg_rules_5g_ptr; -+ u32 min_bw_2ghz; -+ u32 max_bw_2ghz; -+ u32 min_bw_5ghz; -+ u32 max_bw_5ghz; -+ u32 num_2ghz_reg_rules; -+ u32 num_5ghz_reg_rules; -+ struct cur_reg_rule *reg_rules_2ghz_ptr; -+ struct cur_reg_rule *reg_rules_5ghz_ptr; - }; - - struct wmi_reg_chan_list_cc_event { -@@ -4148,12 +4148,12 @@ struct wmi_reg_chan_list_cc_event { - u32 domain_code; - u32 dfs_region; - u32 phybitmap; -- u32 min_bw_2g; -- u32 max_bw_2g; -- u32 min_bw_5g; -- u32 max_bw_5g; -- u32 num_2g_reg_rules; -- u32 num_5g_reg_rules; -+ u32 min_bw_2ghz; -+ u32 max_bw_2ghz; -+ u32 min_bw_5ghz; -+ u32 max_bw_5ghz; -+ u32 num_2ghz_reg_rules; -+ u32 num_5ghz_reg_rules; - } __packed; - - struct wmi_regulatory_rule_struct { diff --git a/package/kernel/mac80211/patches/ath11k/0044-wifi-ath11k-add-support-to-parse-new-WMI-event-for-6.patch b/package/kernel/mac80211/patches/ath11k/0044-wifi-ath11k-add-support-to-parse-new-WMI-event-for-6.patch deleted file mode 100644 index e165c09dc47..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0044-wifi-ath11k-add-support-to-parse-new-WMI-event-for-6.patch +++ /dev/null @@ -1,844 +0,0 @@ -From 91fa00fa69224aae5afb720c5e68b22e4c4f7333 Mon Sep 17 00:00:00 2001 -From: Aditya Kumar Singh -Date: Wed, 1 Mar 2023 16:20:59 +0200 -Subject: [PATCH] wifi: ath11k: add support to parse new WMI event for 6 GHz - -In order to support different power levels of 6 GHz AP and client, -new WMI event for regulatory - WMI_REG_CHAN_LIST_CC_EXT_EVENTID is -added in firmware. This event provides new parameters required for -6 GHz regulatory rules. - -Add support for parsing 2.4 GHz, 5 GHz and 6 GHz reg rules and other -parameters from WMI_REG_CHAN_LIST_CC_EXT_EVENTID. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Lavanya Suresh -Signed-off-by: Wen Gong -Signed-off-by: Aditya Kumar Singh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230110121024.14051-3-quic_adisi@quicinc.com ---- - drivers/net/wireless/ath/ath11k/reg.c | 37 ++- - drivers/net/wireless/ath/ath11k/wmi.c | 418 +++++++++++++++++++++++++- - drivers/net/wireless/ath/ath11k/wmi.h | 163 +++++++++- - 3 files changed, 584 insertions(+), 34 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/reg.c -+++ b/drivers/net/wireless/ath/ath11k/reg.c -@@ -613,7 +613,7 @@ ath11k_reg_build_regd(struct ath11k_base - { - struct ieee80211_regdomain *tmp_regd, *default_regd, *new_regd = NULL; - struct cur_reg_rule *reg_rule; -- u8 i = 0, j = 0; -+ u8 i = 0, j = 0, k = 0; - u8 num_rules; - u16 max_bw; - u32 flags; -@@ -621,6 +621,12 @@ ath11k_reg_build_regd(struct ath11k_base - - num_rules = reg_info->num_5ghz_reg_rules + reg_info->num_2ghz_reg_rules; - -+ /* FIXME: Currently taking reg rules for 6 GHz only from Indoor AP mode list. -+ * This can be updated after complete 6 GHz regulatory support is added. -+ */ -+ if (reg_info->is_ext_reg_event) -+ num_rules += reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP]; -+ - if (!num_rules) - goto ret; - -@@ -666,6 +672,14 @@ ath11k_reg_build_regd(struct ath11k_base - * per other BW rule flags we pass from here - */ - flags = NL80211_RRF_AUTO_BW; -+ } else if (reg_info->is_ext_reg_event && -+ reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP] && -+ (k < reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP])) { -+ reg_rule = reg_info->reg_rules_6ghz_ap_ptr[WMI_REG_INDOOR_AP] + -+ k++; -+ max_bw = min_t(u16, reg_rule->max_bw, -+ reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP]); -+ flags = NL80211_RRF_AUTO_BW; - } else { - break; - } -@@ -693,12 +707,21 @@ ath11k_reg_build_regd(struct ath11k_base - continue; - } - -- ath11k_dbg(ab, ATH11K_DBG_REG, -- "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", -- i + 1, reg_rule->start_freq, reg_rule->end_freq, -- max_bw, reg_rule->ant_gain, reg_rule->reg_power, -- tmp_regd->reg_rules[i].dfs_cac_ms, -- flags); -+ if (reg_info->is_ext_reg_event) { -+ ath11k_dbg(ab, ATH11K_DBG_REG, -+ "\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, -+ tmp_regd->reg_rules[i].dfs_cac_ms, flags, -+ reg_rule->psd_flag, reg_rule->psd_eirp); -+ } else { -+ ath11k_dbg(ab, ATH11K_DBG_REG, -+ "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", -+ i + 1, reg_rule->start_freq, reg_rule->end_freq, -+ max_bw, reg_rule->ant_gain, reg_rule->reg_power, -+ tmp_regd->reg_rules[i].dfs_cac_ms, -+ flags); -+ } - } - - tmp_regd->n_reg_rules = i; ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -105,6 +105,8 @@ static const struct wmi_tlv_policy wmi_t - = { .min_len = sizeof(struct wmi_vdev_stopped_event) }, - [WMI_TAG_REG_CHAN_LIST_CC_EVENT] - = { .min_len = sizeof(struct wmi_reg_chan_list_cc_event) }, -+ [WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT] -+ = { .min_len = sizeof(struct wmi_reg_chan_list_cc_ext_event) }, - [WMI_TAG_MGMT_RX_HDR] - = { .min_len = sizeof(struct wmi_mgmt_rx_hdr) }, - [WMI_TAG_MGMT_TX_COMPL_EVENT] -@@ -3974,6 +3976,10 @@ ath11k_wmi_copy_resource_config(struct w - wmi_cfg->sched_params = tg_cfg->sched_params; - wmi_cfg->twt_ap_pdev_count = tg_cfg->twt_ap_pdev_count; - wmi_cfg->twt_ap_sta_count = tg_cfg->twt_ap_sta_count; -+ wmi_cfg->host_service_flags &= -+ ~(1 << WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT); -+ wmi_cfg->host_service_flags |= (tg_cfg->is_reg_cc_ext_event_supported << -+ WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT); - } - - static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi, -@@ -4192,6 +4198,10 @@ int ath11k_wmi_cmd_init(struct ath11k_ba - - ab->hw_params.hw_ops->wmi_init_config(ab, &config); - -+ if (test_bit(WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT, -+ ab->wmi_ab.svc_map)) -+ config.is_reg_cc_ext_event_supported = 1; -+ - memcpy(&wmi_sc->wlan_resource_config, &config, sizeof(config)); - - init_param.res_cfg = &wmi_sc->wlan_resource_config; -@@ -4995,18 +5005,11 @@ static int ath11k_pull_reg_chan_list_upd - reg_info->phy_id = chan_list_event_hdr->phy_id; - reg_info->ctry_code = chan_list_event_hdr->country_id; - reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code; -- if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_PASS) -- reg_info->status_code = REG_SET_CC_STATUS_PASS; -- else if (chan_list_event_hdr->status_code == WMI_REG_CURRENT_ALPHA2_NOT_FOUND) -- reg_info->status_code = REG_CURRENT_ALPHA2_NOT_FOUND; -- else if (chan_list_event_hdr->status_code == WMI_REG_INIT_ALPHA2_NOT_FOUND) -- reg_info->status_code = REG_INIT_ALPHA2_NOT_FOUND; -- else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_CHANGE_NOT_ALLOWED) -- reg_info->status_code = REG_SET_CC_CHANGE_NOT_ALLOWED; -- else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_NO_MEMORY) -- reg_info->status_code = REG_SET_CC_STATUS_NO_MEMORY; -- else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_FAIL) -- reg_info->status_code = REG_SET_CC_STATUS_FAIL; -+ -+ reg_info->status_code = -+ ath11k_wmi_cc_setting_code_to_reg(chan_list_event_hdr->status_code); -+ -+ reg_info->is_ext_reg_event = false; - - reg_info->min_bw_2ghz = chan_list_event_hdr->min_bw_2ghz; - reg_info->max_bw_2ghz = chan_list_event_hdr->max_bw_2ghz; -@@ -5060,6 +5063,372 @@ static int ath11k_pull_reg_chan_list_upd - return 0; - } - -+static struct cur_reg_rule -+*create_ext_reg_rules_from_wmi(u32 num_reg_rules, -+ struct wmi_regulatory_ext_rule *wmi_reg_rule) -+{ -+ struct cur_reg_rule *reg_rule_ptr; -+ u32 count; -+ -+ reg_rule_ptr = kcalloc(num_reg_rules, sizeof(*reg_rule_ptr), GFP_ATOMIC); -+ -+ if (!reg_rule_ptr) -+ return NULL; -+ -+ for (count = 0; count < num_reg_rules; count++) { -+ reg_rule_ptr[count].start_freq = -+ u32_get_bits(wmi_reg_rule[count].freq_info, -+ REG_RULE_START_FREQ); -+ reg_rule_ptr[count].end_freq = -+ u32_get_bits(wmi_reg_rule[count].freq_info, -+ REG_RULE_END_FREQ); -+ reg_rule_ptr[count].max_bw = -+ u32_get_bits(wmi_reg_rule[count].bw_pwr_info, -+ REG_RULE_MAX_BW); -+ reg_rule_ptr[count].reg_power = -+ u32_get_bits(wmi_reg_rule[count].bw_pwr_info, -+ REG_RULE_REG_PWR); -+ reg_rule_ptr[count].ant_gain = -+ u32_get_bits(wmi_reg_rule[count].bw_pwr_info, -+ REG_RULE_ANT_GAIN); -+ reg_rule_ptr[count].flags = -+ u32_get_bits(wmi_reg_rule[count].flag_info, -+ REG_RULE_FLAGS); -+ reg_rule_ptr[count].psd_flag = -+ u32_get_bits(wmi_reg_rule[count].psd_power_info, -+ REG_RULE_PSD_INFO); -+ reg_rule_ptr[count].psd_eirp = -+ u32_get_bits(wmi_reg_rule[count].psd_power_info, -+ REG_RULE_PSD_EIRP); -+ } -+ -+ return reg_rule_ptr; -+} -+ -+static u8 -+ath11k_invalid_5ghz_reg_ext_rules_from_wmi(u32 num_reg_rules, -+ const struct wmi_regulatory_ext_rule *rule) -+{ -+ u8 num_invalid_5ghz_rules = 0; -+ u32 count, start_freq; -+ -+ for (count = 0; count < num_reg_rules; count++) { -+ start_freq = u32_get_bits(rule[count].freq_info, -+ REG_RULE_START_FREQ); -+ -+ if (start_freq >= ATH11K_MIN_6G_FREQ) -+ num_invalid_5ghz_rules++; -+ } -+ -+ return num_invalid_5ghz_rules; -+} -+ -+static int ath11k_pull_reg_chan_list_ext_update_ev(struct ath11k_base *ab, -+ struct sk_buff *skb, -+ struct cur_regulatory_info *reg_info) -+{ -+ const void **tb; -+ const struct wmi_reg_chan_list_cc_ext_event *ext_chan_list_event_hdr; -+ struct wmi_regulatory_ext_rule *ext_wmi_reg_rule; -+ u32 num_2ghz_reg_rules, num_5ghz_reg_rules; -+ u32 num_6ghz_reg_rules_ap[WMI_REG_CURRENT_MAX_AP_TYPE]; -+ u32 num_6ghz_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE]; -+ u32 total_reg_rules = 0; -+ int ret, i, j, num_invalid_5ghz_ext_rules = 0; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, "processing regulatory ext channel list\n"); -+ -+ tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); -+ if (IS_ERR(tb)) { -+ ret = PTR_ERR(tb); -+ ath11k_warn(ab, "failed to parse tlv: %d\n", ret); -+ return ret; -+ } -+ -+ ext_chan_list_event_hdr = tb[WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT]; -+ if (!ext_chan_list_event_hdr) { -+ ath11k_warn(ab, "failed to fetch reg chan list ext update ev\n"); -+ kfree(tb); -+ return -EPROTO; -+ } -+ -+ reg_info->num_2ghz_reg_rules = -+ ext_chan_list_event_hdr->num_2ghz_reg_rules; -+ reg_info->num_5ghz_reg_rules = -+ ext_chan_list_event_hdr->num_5ghz_reg_rules; -+ reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP] = -+ ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_lpi; -+ reg_info->num_6ghz_rules_ap[WMI_REG_STANDARD_POWER_AP] = -+ ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_sp; -+ reg_info->num_6ghz_rules_ap[WMI_REG_VERY_LOW_POWER_AP] = -+ ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_vlp; -+ -+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { -+ reg_info->num_6ghz_rules_client[WMI_REG_INDOOR_AP][i] = -+ ext_chan_list_event_hdr->num_6ghz_reg_rules_client_lpi[i]; -+ reg_info->num_6ghz_rules_client[WMI_REG_STANDARD_POWER_AP][i] = -+ ext_chan_list_event_hdr->num_6ghz_reg_rules_client_sp[i]; -+ reg_info->num_6ghz_rules_client[WMI_REG_VERY_LOW_POWER_AP][i] = -+ ext_chan_list_event_hdr->num_6ghz_reg_rules_client_vlp[i]; -+ } -+ -+ num_2ghz_reg_rules = reg_info->num_2ghz_reg_rules; -+ num_5ghz_reg_rules = reg_info->num_5ghz_reg_rules; -+ -+ total_reg_rules += num_2ghz_reg_rules; -+ total_reg_rules += num_5ghz_reg_rules; -+ -+ if ((num_2ghz_reg_rules > MAX_REG_RULES) || -+ (num_5ghz_reg_rules > MAX_REG_RULES)) { -+ ath11k_warn(ab, "Num reg rules for 2.4 GHz/5 GHz exceeds max limit (num_2ghz_reg_rules: %d num_5ghz_reg_rules: %d max_rules: %d)\n", -+ num_2ghz_reg_rules, num_5ghz_reg_rules, MAX_REG_RULES); -+ kfree(tb); -+ return -EINVAL; -+ } -+ -+ for (i = 0; i < WMI_REG_CURRENT_MAX_AP_TYPE; i++) { -+ num_6ghz_reg_rules_ap[i] = reg_info->num_6ghz_rules_ap[i]; -+ -+ if (num_6ghz_reg_rules_ap[i] > MAX_6GHZ_REG_RULES) { -+ ath11k_warn(ab, "Num 6 GHz reg rules for AP mode(%d) exceeds max limit (num_6ghz_reg_rules_ap: %d, max_rules: %d)\n", -+ i, num_6ghz_reg_rules_ap[i], MAX_6GHZ_REG_RULES); -+ kfree(tb); -+ return -EINVAL; -+ } -+ -+ total_reg_rules += num_6ghz_reg_rules_ap[i]; -+ } -+ -+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { -+ num_6ghz_client[WMI_REG_INDOOR_AP][i] = -+ reg_info->num_6ghz_rules_client[WMI_REG_INDOOR_AP][i]; -+ total_reg_rules += num_6ghz_client[WMI_REG_INDOOR_AP][i]; -+ -+ num_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -+ reg_info->num_6ghz_rules_client[WMI_REG_STANDARD_POWER_AP][i]; -+ total_reg_rules += num_6ghz_client[WMI_REG_STANDARD_POWER_AP][i]; -+ -+ num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -+ reg_info->num_6ghz_rules_client[WMI_REG_VERY_LOW_POWER_AP][i]; -+ total_reg_rules += num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i]; -+ -+ if ((num_6ghz_client[WMI_REG_INDOOR_AP][i] > MAX_6GHZ_REG_RULES) || -+ (num_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] > -+ MAX_6GHZ_REG_RULES) || -+ (num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] > -+ MAX_6GHZ_REG_RULES)) { -+ ath11k_warn(ab, -+ "Num 6 GHz client reg rules exceeds max limit, for client(type: %d)\n", -+ i); -+ kfree(tb); -+ return -EINVAL; -+ } -+ } -+ -+ if (!total_reg_rules) { -+ ath11k_warn(ab, "No reg rules available\n"); -+ kfree(tb); -+ return -EINVAL; -+ } -+ -+ memcpy(reg_info->alpha2, &ext_chan_list_event_hdr->alpha2, -+ REG_ALPHA2_LEN); -+ -+ reg_info->dfs_region = ext_chan_list_event_hdr->dfs_region; -+ reg_info->phybitmap = ext_chan_list_event_hdr->phybitmap; -+ reg_info->num_phy = ext_chan_list_event_hdr->num_phy; -+ reg_info->phy_id = ext_chan_list_event_hdr->phy_id; -+ reg_info->ctry_code = ext_chan_list_event_hdr->country_id; -+ reg_info->reg_dmn_pair = ext_chan_list_event_hdr->domain_code; -+ -+ reg_info->status_code = -+ ath11k_wmi_cc_setting_code_to_reg(ext_chan_list_event_hdr->status_code); -+ -+ reg_info->is_ext_reg_event = true; -+ -+ reg_info->min_bw_2ghz = ext_chan_list_event_hdr->min_bw_2ghz; -+ reg_info->max_bw_2ghz = ext_chan_list_event_hdr->max_bw_2ghz; -+ reg_info->min_bw_5ghz = ext_chan_list_event_hdr->min_bw_5ghz; -+ reg_info->max_bw_5ghz = ext_chan_list_event_hdr->max_bw_5ghz; -+ -+ reg_info->min_bw_6ghz_ap[WMI_REG_INDOOR_AP] = -+ ext_chan_list_event_hdr->min_bw_6ghz_ap_lpi; -+ reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP] = -+ ext_chan_list_event_hdr->max_bw_6ghz_ap_lpi; -+ reg_info->min_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] = -+ ext_chan_list_event_hdr->min_bw_6ghz_ap_sp; -+ reg_info->max_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] = -+ ext_chan_list_event_hdr->max_bw_6ghz_ap_sp; -+ reg_info->min_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] = -+ ext_chan_list_event_hdr->min_bw_6ghz_ap_vlp; -+ reg_info->max_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] = -+ ext_chan_list_event_hdr->max_bw_6ghz_ap_vlp; -+ -+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { -+ reg_info->min_bw_6ghz_client[WMI_REG_INDOOR_AP][i] = -+ ext_chan_list_event_hdr->min_bw_6ghz_client_lpi[i]; -+ reg_info->max_bw_6ghz_client[WMI_REG_INDOOR_AP][i] = -+ ext_chan_list_event_hdr->max_bw_6ghz_client_lpi[i]; -+ reg_info->min_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -+ ext_chan_list_event_hdr->min_bw_6ghz_client_sp[i]; -+ reg_info->max_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -+ ext_chan_list_event_hdr->max_bw_6ghz_client_sp[i]; -+ reg_info->min_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -+ ext_chan_list_event_hdr->min_bw_6ghz_client_vlp[i]; -+ reg_info->max_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -+ ext_chan_list_event_hdr->max_bw_6ghz_client_vlp[i]; -+ } -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "%s:cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", -+ __func__, reg_info->alpha2, reg_info->dfs_region, -+ reg_info->min_bw_2ghz, reg_info->max_bw_2ghz, -+ reg_info->min_bw_5ghz, reg_info->max_bw_5ghz); -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "num_2ghz_reg_rules %d num_5ghz_reg_rules %d", -+ num_2ghz_reg_rules, num_5ghz_reg_rules); -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "num_6ghz_reg_rules_ap_lpi: %d num_6ghz_reg_rules_ap_sp: %d num_6ghz_reg_rules_ap_vlp: %d", -+ num_6ghz_reg_rules_ap[WMI_REG_INDOOR_AP], -+ num_6ghz_reg_rules_ap[WMI_REG_STANDARD_POWER_AP], -+ num_6ghz_reg_rules_ap[WMI_REG_VERY_LOW_POWER_AP]); -+ -+ j = WMI_REG_DEFAULT_CLIENT; -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz Regular client: num_6ghz_reg_rules_lpi: %d num_6ghz_reg_rules_sp: %d num_6ghz_reg_rules_vlp: %d", -+ num_6ghz_client[WMI_REG_INDOOR_AP][j], -+ num_6ghz_client[WMI_REG_STANDARD_POWER_AP][j], -+ num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][j]); -+ -+ j = WMI_REG_SUBORDINATE_CLIENT; -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz Subordinate client: num_6ghz_reg_rules_lpi: %d num_6ghz_reg_rules_sp: %d num_6ghz_reg_rules_vlp: %d", -+ num_6ghz_client[WMI_REG_INDOOR_AP][j], -+ num_6ghz_client[WMI_REG_STANDARD_POWER_AP][j], -+ num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][j]); -+ -+ ext_wmi_reg_rule = -+ (struct wmi_regulatory_ext_rule *)((u8 *)ext_chan_list_event_hdr -+ + sizeof(*ext_chan_list_event_hdr) -+ + sizeof(struct wmi_tlv)); -+ if (num_2ghz_reg_rules) { -+ reg_info->reg_rules_2ghz_ptr = -+ create_ext_reg_rules_from_wmi(num_2ghz_reg_rules, -+ ext_wmi_reg_rule); -+ -+ if (!reg_info->reg_rules_2ghz_ptr) { -+ kfree(tb); -+ ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n"); -+ return -ENOMEM; -+ } -+ } -+ -+ ext_wmi_reg_rule += num_2ghz_reg_rules; -+ -+ /* Firmware might include 6 GHz reg rule in 5 GHz rule list -+ * for few countries along with separate 6 GHz rule. -+ * Having same 6 GHz reg rule in 5 GHz and 6 GHz rules list -+ * causes intersect check to be true, and same rules will be -+ * shown multiple times in iw cmd. -+ * Hence, avoid parsing 6 GHz rule from 5 GHz reg rule list -+ */ -+ num_invalid_5ghz_ext_rules = -+ ath11k_invalid_5ghz_reg_ext_rules_from_wmi(num_5ghz_reg_rules, -+ ext_wmi_reg_rule); -+ -+ if (num_invalid_5ghz_ext_rules) { -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "CC: %s 5 GHz reg rules number %d from fw, %d number of invalid 5 GHz rules", -+ reg_info->alpha2, reg_info->num_5ghz_reg_rules, -+ num_invalid_5ghz_ext_rules); -+ -+ num_5ghz_reg_rules = num_5ghz_reg_rules - num_invalid_5ghz_ext_rules; -+ reg_info->num_5ghz_reg_rules = num_5ghz_reg_rules; -+ } -+ -+ if (num_5ghz_reg_rules) { -+ reg_info->reg_rules_5ghz_ptr = -+ create_ext_reg_rules_from_wmi(num_5ghz_reg_rules, -+ ext_wmi_reg_rule); -+ -+ if (!reg_info->reg_rules_5ghz_ptr) { -+ kfree(tb); -+ ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n"); -+ return -ENOMEM; -+ } -+ } -+ -+ /* We have adjusted the number of 5 GHz reg rules above. But still those -+ * many rules needs to be adjusted in ext_wmi_reg_rule. -+ * -+ * NOTE: num_invalid_5ghz_ext_rules will be 0 for rest other cases. -+ */ -+ ext_wmi_reg_rule += (num_5ghz_reg_rules + num_invalid_5ghz_ext_rules); -+ -+ for (i = 0; i < WMI_REG_CURRENT_MAX_AP_TYPE; i++) { -+ reg_info->reg_rules_6ghz_ap_ptr[i] = -+ create_ext_reg_rules_from_wmi(num_6ghz_reg_rules_ap[i], -+ ext_wmi_reg_rule); -+ -+ if (!reg_info->reg_rules_6ghz_ap_ptr[i]) { -+ kfree(tb); -+ ath11k_warn(ab, "Unable to Allocate memory for 6 GHz AP rules\n"); -+ return -ENOMEM; -+ } -+ -+ ext_wmi_reg_rule += num_6ghz_reg_rules_ap[i]; -+ } -+ -+ for (j = 0; j < WMI_REG_CURRENT_MAX_AP_TYPE; j++) { -+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { -+ reg_info->reg_rules_6ghz_client_ptr[j][i] = -+ create_ext_reg_rules_from_wmi(num_6ghz_client[j][i], -+ ext_wmi_reg_rule); -+ -+ if (!reg_info->reg_rules_6ghz_client_ptr[j][i]) { -+ kfree(tb); -+ ath11k_warn(ab, "Unable to Allocate memory for 6 GHz client rules\n"); -+ return -ENOMEM; -+ } -+ -+ ext_wmi_reg_rule += num_6ghz_client[j][i]; -+ } -+ } -+ -+ reg_info->client_type = ext_chan_list_event_hdr->client_type; -+ reg_info->rnr_tpe_usable = ext_chan_list_event_hdr->rnr_tpe_usable; -+ reg_info->unspecified_ap_usable = -+ ext_chan_list_event_hdr->unspecified_ap_usable; -+ reg_info->domain_code_6ghz_ap[WMI_REG_INDOOR_AP] = -+ ext_chan_list_event_hdr->domain_code_6ghz_ap_lpi; -+ reg_info->domain_code_6ghz_ap[WMI_REG_STANDARD_POWER_AP] = -+ ext_chan_list_event_hdr->domain_code_6ghz_ap_sp; -+ reg_info->domain_code_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] = -+ ext_chan_list_event_hdr->domain_code_6ghz_ap_vlp; -+ -+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { -+ reg_info->domain_code_6ghz_client[WMI_REG_INDOOR_AP][i] = -+ ext_chan_list_event_hdr->domain_code_6ghz_client_lpi[i]; -+ reg_info->domain_code_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -+ ext_chan_list_event_hdr->domain_code_6ghz_client_sp[i]; -+ reg_info->domain_code_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -+ ext_chan_list_event_hdr->domain_code_6ghz_client_vlp[i]; -+ } -+ -+ reg_info->domain_code_6ghz_super_id = -+ ext_chan_list_event_hdr->domain_code_6ghz_super_id; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, "6 GHz client_type: %d domain_code_6ghz_super_id: %d", -+ reg_info->client_type, reg_info->domain_code_6ghz_super_id); -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, "processed regulatory ext channel list\n"); -+ -+ kfree(tb); -+ return 0; -+} -+ - static int ath11k_pull_peer_del_resp_ev(struct ath11k_base *ab, struct sk_buff *skb, - struct wmi_peer_delete_resp_event *peer_del_resp) - { -@@ -6507,12 +6876,14 @@ static bool ath11k_reg_is_world_alpha(ch - return false; - } - --static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *skb) -+static int ath11k_reg_chan_list_event(struct ath11k_base *ab, -+ struct sk_buff *skb, -+ enum wmi_reg_chan_list_cmd_type id) - { - struct cur_regulatory_info *reg_info = NULL; - struct ieee80211_regdomain *regd = NULL; - bool intersect = false; -- int ret = 0, pdev_idx; -+ int ret = 0, pdev_idx, i, j; - struct ath11k *ar; - - reg_info = kzalloc(sizeof(*reg_info), GFP_ATOMIC); -@@ -6521,7 +6892,11 @@ static int ath11k_reg_chan_list_event(st - goto fallback; - } - -- ret = ath11k_pull_reg_chan_list_update_ev(ab, skb, reg_info); -+ if (id == WMI_REG_CHAN_LIST_CC_ID) -+ ret = ath11k_pull_reg_chan_list_update_ev(ab, skb, reg_info); -+ else -+ ret = ath11k_pull_reg_chan_list_ext_update_ev(ab, skb, reg_info); -+ - if (ret) { - ath11k_warn(ab, "failed to extract regulatory info from received event\n"); - goto fallback; -@@ -6623,6 +6998,14 @@ mem_free: - if (reg_info) { - kfree(reg_info->reg_rules_2ghz_ptr); - kfree(reg_info->reg_rules_5ghz_ptr); -+ if (reg_info->is_ext_reg_event) { -+ for (i = 0; i < WMI_REG_CURRENT_MAX_AP_TYPE; i++) -+ kfree(reg_info->reg_rules_6ghz_ap_ptr[i]); -+ -+ for (j = 0; j < WMI_REG_CURRENT_MAX_AP_TYPE; j++) -+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) -+ kfree(reg_info->reg_rules_6ghz_client_ptr[j][i]); -+ } - kfree(reg_info); - } - return ret; -@@ -8054,7 +8437,10 @@ static void ath11k_wmi_tlv_op_rx(struct - ath11k_service_ready_ext2_event(ab, skb); - break; - case WMI_REG_CHAN_LIST_CC_EVENTID: -- ath11k_reg_chan_list_event(ab, skb); -+ ath11k_reg_chan_list_event(ab, skb, WMI_REG_CHAN_LIST_CC_ID); -+ break; -+ case WMI_REG_CHAN_LIST_CC_EXT_EVENTID: -+ ath11k_reg_chan_list_event(ab, skb, WMI_REG_CHAN_LIST_CC_EXT_ID); - break; - case WMI_READY_EVENTID: - ath11k_ready_event(ab, skb); ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -797,6 +797,7 @@ enum wmi_tlv_event_id { - WMI_RMC_NEW_LEADER_EVENTID = WMI_TLV_CMD(WMI_GRP_RMC), - WMI_REG_CHAN_LIST_CC_EVENTID = WMI_TLV_CMD(WMI_GRP_REGULATORY), - WMI_11D_NEW_COUNTRY_EVENTID, -+ WMI_REG_CHAN_LIST_CC_EXT_EVENTID, - WMI_NDI_CAP_RSP_EVENTID = WMI_TLV_CMD(WMI_GRP_PROTOTYPE), - WMI_NDP_INITIATOR_RSP_EVENTID, - WMI_NDP_RESPONDER_RSP_EVENTID, -@@ -1865,6 +1866,8 @@ enum wmi_tlv_tag { - WMI_TAG_PDEV_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD, - WMI_TAG_PDEV_NON_SRG_OBSS_COLOR_ENABLE_BITMAP_CMD, - 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, - WMI_TAG_PDEV_SET_BIOS_SAR_TABLE_CMD = 0x3D8, - WMI_TAG_PDEV_SET_BIOS_GEO_TABLE_CMD, - WMI_TAG_MAX -@@ -2097,6 +2100,7 @@ enum wmi_tlv_service { - - /* The second 128 bits */ - WMI_MAX_EXT_SERVICE = 256, -+ WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT = 281, - WMI_TLV_SERVICE_BIOS_SAR_SUPPORT = 326, - - /* The third 128 bits */ -@@ -2313,6 +2317,8 @@ struct wmi_init_cmd { - #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 BIT(5) - #define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18) - -+#define WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT 4 -+ - struct wmi_resource_config { - u32 tlv_header; - u32 num_vdevs; -@@ -2372,6 +2378,15 @@ struct wmi_resource_config { - u32 sched_params; - u32 twt_ap_pdev_count; - u32 twt_ap_sta_count; -+ u32 max_nlo_ssids; -+ u32 num_pkt_filters; -+ u32 num_max_sta_vdevs; -+ u32 max_bssid_indicator; -+ u32 ul_resp_config; -+ u32 msdu_flow_override_config0; -+ u32 msdu_flow_override_config1; -+ u32 flags2; -+ u32 host_service_flags; - } __packed; - - struct wmi_service_ready_event { -@@ -2854,6 +2869,8 @@ struct rx_reorder_queue_remove_params { - #define REG_RULE_MAX_BW 0x0000ffff - #define REG_RULE_REG_PWR 0x00ff0000 - #define REG_RULE_ANT_GAIN 0xff000000 -+#define REG_RULE_PSD_INFO BIT(0) -+#define REG_RULE_PSD_EIRP 0xff0000 - - #define WMI_VDEV_PARAM_TXBF_SU_TX_BFEE BIT(0) - #define WMI_VDEV_PARAM_TXBF_MU_TX_BFEE BIT(1) -@@ -4049,6 +4066,7 @@ struct wmi_he_rate_set { - - #define MAX_REG_RULES 10 - #define REG_ALPHA2_LEN 2 -+#define MAX_6GHZ_REG_RULES 5 - - enum wmi_start_event_param { - WMI_VDEV_START_RESP_EVENT = 0, -@@ -4079,16 +4097,6 @@ enum wmi_vdev_start_resp_status_code { - WMI_VDEV_START_RESPONSE_INVALID_REGDOMAIN = 4, - }; - --; --enum cc_setting_code { -- REG_SET_CC_STATUS_PASS = 0, -- REG_CURRENT_ALPHA2_NOT_FOUND = 1, -- REG_INIT_ALPHA2_NOT_FOUND = 2, -- REG_SET_CC_CHANGE_NOT_ALLOWED = 3, -- REG_SET_CC_STATUS_NO_MEMORY = 4, -- REG_SET_CC_STATUS_FAIL = 5, --}; -- - /* Regaulatory Rule Flags Passed by FW */ - #define REGULATORY_CHAN_DISABLED BIT(0) - #define REGULATORY_CHAN_NO_IR BIT(1) -@@ -4102,13 +4110,72 @@ enum cc_setting_code { - #define REGULATORY_CHAN_NO_20MHZ BIT(11) - #define REGULATORY_CHAN_NO_10MHZ BIT(12) - --enum { -+enum wmi_reg_chan_list_cmd_type { -+ WMI_REG_CHAN_LIST_CC_ID = 0, -+ WMI_REG_CHAN_LIST_CC_EXT_ID = 1, -+}; -+ -+enum wmi_reg_cc_setting_code { - WMI_REG_SET_CC_STATUS_PASS = 0, - WMI_REG_CURRENT_ALPHA2_NOT_FOUND = 1, - WMI_REG_INIT_ALPHA2_NOT_FOUND = 2, - WMI_REG_SET_CC_CHANGE_NOT_ALLOWED = 3, - WMI_REG_SET_CC_STATUS_NO_MEMORY = 4, - WMI_REG_SET_CC_STATUS_FAIL = 5, -+ -+ /* add new setting code above, update in -+ * @enum cc_setting_code as well. -+ * Also handle it in ath11k_wmi_cc_setting_code_to_reg() -+ */ -+}; -+ -+enum cc_setting_code { -+ REG_SET_CC_STATUS_PASS = 0, -+ REG_CURRENT_ALPHA2_NOT_FOUND = 1, -+ REG_INIT_ALPHA2_NOT_FOUND = 2, -+ REG_SET_CC_CHANGE_NOT_ALLOWED = 3, -+ REG_SET_CC_STATUS_NO_MEMORY = 4, -+ REG_SET_CC_STATUS_FAIL = 5, -+ -+ /* add new setting code above, update in -+ * @enum wmi_reg_cc_setting_code as well. -+ */ -+}; -+ -+static inline enum cc_setting_code -+ath11k_wmi_cc_setting_code_to_reg(enum wmi_reg_cc_setting_code status_code) -+{ -+ switch (status_code) { -+ case WMI_REG_SET_CC_STATUS_PASS: -+ return REG_SET_CC_STATUS_PASS; -+ case WMI_REG_CURRENT_ALPHA2_NOT_FOUND: -+ return REG_CURRENT_ALPHA2_NOT_FOUND; -+ case WMI_REG_INIT_ALPHA2_NOT_FOUND: -+ return REG_INIT_ALPHA2_NOT_FOUND; -+ case WMI_REG_SET_CC_CHANGE_NOT_ALLOWED: -+ return REG_SET_CC_CHANGE_NOT_ALLOWED; -+ case WMI_REG_SET_CC_STATUS_NO_MEMORY: -+ return REG_SET_CC_STATUS_NO_MEMORY; -+ case WMI_REG_SET_CC_STATUS_FAIL: -+ return REG_SET_CC_STATUS_FAIL; -+ } -+ -+ return REG_SET_CC_STATUS_FAIL; -+} -+ -+enum wmi_reg_6ghz_ap_type { -+ WMI_REG_INDOOR_AP = 0, -+ WMI_REG_STANDARD_POWER_AP = 1, -+ WMI_REG_VERY_LOW_POWER_AP = 2, -+ -+ WMI_REG_CURRENT_MAX_AP_TYPE, -+ WMI_REG_MAX_AP_TYPE = 7, -+}; -+ -+enum wmi_reg_6ghz_client_type { -+ WMI_REG_DEFAULT_CLIENT = 0, -+ WMI_REG_SUBORDINATE_CLIENT = 1, -+ WMI_REG_MAX_CLIENT_TYPE = 2, - }; - - struct cur_reg_rule { -@@ -4118,6 +4185,8 @@ struct cur_reg_rule { - u8 reg_power; - u8 ant_gain; - u16 flags; -+ bool psd_flag; -+ s8 psd_eirp; - }; - - struct cur_regulatory_info { -@@ -4137,6 +4206,22 @@ struct cur_regulatory_info { - u32 num_5ghz_reg_rules; - struct cur_reg_rule *reg_rules_2ghz_ptr; - struct cur_reg_rule *reg_rules_5ghz_ptr; -+ bool is_ext_reg_event; -+ enum wmi_reg_6ghz_client_type client_type; -+ bool rnr_tpe_usable; -+ bool unspecified_ap_usable; -+ u8 domain_code_6ghz_ap[WMI_REG_CURRENT_MAX_AP_TYPE]; -+ u8 domain_code_6ghz_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE]; -+ u32 domain_code_6ghz_super_id; -+ u32 min_bw_6ghz_ap[WMI_REG_CURRENT_MAX_AP_TYPE]; -+ u32 max_bw_6ghz_ap[WMI_REG_CURRENT_MAX_AP_TYPE]; -+ u32 min_bw_6ghz_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE]; -+ u32 max_bw_6ghz_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE]; -+ u32 num_6ghz_rules_ap[WMI_REG_CURRENT_MAX_AP_TYPE]; -+ u32 num_6ghz_rules_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE]; -+ struct cur_reg_rule *reg_rules_6ghz_ap_ptr[WMI_REG_CURRENT_MAX_AP_TYPE]; -+ struct cur_reg_rule *reg_rules_6ghz_client_ptr -+ [WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE]; - }; - - struct wmi_reg_chan_list_cc_event { -@@ -4163,6 +4248,61 @@ struct wmi_regulatory_rule_struct { - u32 flag_info; - }; - -+#define WMI_REG_CLIENT_MAX 4 -+ -+struct wmi_reg_chan_list_cc_ext_event { -+ u32 status_code; -+ u32 phy_id; -+ u32 alpha2; -+ u32 num_phy; -+ u32 country_id; -+ u32 domain_code; -+ u32 dfs_region; -+ u32 phybitmap; -+ u32 min_bw_2ghz; -+ u32 max_bw_2ghz; -+ u32 min_bw_5ghz; -+ u32 max_bw_5ghz; -+ u32 num_2ghz_reg_rules; -+ u32 num_5ghz_reg_rules; -+ u32 client_type; -+ u32 rnr_tpe_usable; -+ u32 unspecified_ap_usable; -+ u32 domain_code_6ghz_ap_lpi; -+ u32 domain_code_6ghz_ap_sp; -+ u32 domain_code_6ghz_ap_vlp; -+ u32 domain_code_6ghz_client_lpi[WMI_REG_CLIENT_MAX]; -+ u32 domain_code_6ghz_client_sp[WMI_REG_CLIENT_MAX]; -+ u32 domain_code_6ghz_client_vlp[WMI_REG_CLIENT_MAX]; -+ u32 domain_code_6ghz_super_id; -+ u32 min_bw_6ghz_ap_sp; -+ u32 max_bw_6ghz_ap_sp; -+ u32 min_bw_6ghz_ap_lpi; -+ u32 max_bw_6ghz_ap_lpi; -+ u32 min_bw_6ghz_ap_vlp; -+ u32 max_bw_6ghz_ap_vlp; -+ u32 min_bw_6ghz_client_sp[WMI_REG_CLIENT_MAX]; -+ u32 max_bw_6ghz_client_sp[WMI_REG_CLIENT_MAX]; -+ u32 min_bw_6ghz_client_lpi[WMI_REG_CLIENT_MAX]; -+ u32 max_bw_6ghz_client_lpi[WMI_REG_CLIENT_MAX]; -+ u32 min_bw_6ghz_client_vlp[WMI_REG_CLIENT_MAX]; -+ u32 max_bw_6ghz_client_vlp[WMI_REG_CLIENT_MAX]; -+ u32 num_6ghz_reg_rules_ap_sp; -+ u32 num_6ghz_reg_rules_ap_lpi; -+ u32 num_6ghz_reg_rules_ap_vlp; -+ u32 num_6ghz_reg_rules_client_sp[WMI_REG_CLIENT_MAX]; -+ u32 num_6ghz_reg_rules_client_lpi[WMI_REG_CLIENT_MAX]; -+ u32 num_6ghz_reg_rules_client_vlp[WMI_REG_CLIENT_MAX]; -+} __packed; -+ -+struct wmi_regulatory_ext_rule { -+ u32 tlv_header; -+ u32 freq_info; -+ u32 bw_pwr_info; -+ u32 flag_info; -+ u32 psd_power_info; -+} __packed; -+ - struct wmi_vdev_delete_resp_event { - u32 vdev_id; - } __packed; -@@ -5358,6 +5498,7 @@ struct target_resource_config { - u32 sched_params; - u32 twt_ap_pdev_count; - u32 twt_ap_sta_count; -+ u8 is_reg_cc_ext_event_supported; - }; - - enum wmi_debug_log_param { diff --git a/package/kernel/mac80211/patches/ath11k/0045-wifi-ath11k-add-debug-prints-in-regulatory-WMI-event.patch b/package/kernel/mac80211/patches/ath11k/0045-wifi-ath11k-add-debug-prints-in-regulatory-WMI-event.patch deleted file mode 100644 index b88e51928f7..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0045-wifi-ath11k-add-debug-prints-in-regulatory-WMI-event.patch +++ /dev/null @@ -1,567 +0,0 @@ -From e238e62ba8868a784e485eb94451c87cd1b85cee Mon Sep 17 00:00:00 2001 -From: Aditya Kumar Singh -Date: Wed, 1 Mar 2023 16:20:59 +0200 -Subject: [PATCH] wifi: ath11k: add debug prints in regulatory WMI event - processing - -Add some more debug prints in processing regulatory WMI event in order to -increase more debuggability. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aditya Kumar Singh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230110121024.14051-4-quic_adisi@quicinc.com ---- - drivers/net/wireless/ath/ath11k/reg.c | 2 +- - drivers/net/wireless/ath/ath11k/wmi.c | 207 ++++++++++++++++++-------- - drivers/net/wireless/ath/ath11k/wmi.h | 142 ++++++++++++++++++ - 3 files changed, 291 insertions(+), 60 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/reg.c -+++ b/drivers/net/wireless/ath/ath11k/reg.c -@@ -646,7 +646,7 @@ ath11k_reg_build_regd(struct ath11k_base - tmp_regd->dfs_region = ath11k_map_fw_dfs_region(reg_info->dfs_region); - - ath11k_dbg(ab, ATH11K_DBG_REG, -- "\r\nCountry %s, CFG Regdomain %s FW Regdomain %d, num_reg_rules %d\n", -+ "Country %s, CFG Regdomain %s FW Regdomain %d, num_reg_rules %d\n", - alpha2, ath11k_reg_get_regdom_str(tmp_regd->dfs_region), - reg_info->dfs_region, num_rules); - /* Update reg_rules[] below. Firmware is expected to ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -4925,6 +4925,26 @@ static int ath11k_pull_vdev_start_resp_t - return 0; - } - -+static void ath11k_print_reg_rule(struct ath11k_base *ab, const char *band, -+ u32 num_reg_rules, -+ struct cur_reg_rule *reg_rule_ptr) -+{ -+ struct cur_reg_rule *reg_rule = reg_rule_ptr; -+ u32 count; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, "number of reg rules in %s band: %d\n", -+ band, num_reg_rules); -+ -+ for (count = 0; count < num_reg_rules; count++) { -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "reg rule %d: (%d - %d @ %d) (%d, %d) (FLAGS %d)\n", -+ count + 1, reg_rule->start_freq, reg_rule->end_freq, -+ reg_rule->max_bw, reg_rule->ant_gain, -+ reg_rule->reg_power, reg_rule->flags); -+ reg_rule++; -+ } -+} -+ - static struct cur_reg_rule - *create_reg_rules_from_wmi(u32 num_reg_rules, - struct wmi_regulatory_rule_struct *wmi_reg_rule) -@@ -5006,6 +5026,10 @@ static int ath11k_pull_reg_chan_list_upd - reg_info->ctry_code = chan_list_event_hdr->country_id; - reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code; - -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "status_code %s", -+ ath11k_cc_status_to_str(reg_info->status_code)); -+ - reg_info->status_code = - ath11k_wmi_cc_setting_code_to_reg(chan_list_event_hdr->status_code); - -@@ -5020,13 +5044,13 @@ static int ath11k_pull_reg_chan_list_upd - num_5ghz_reg_rules = reg_info->num_5ghz_reg_rules; - - ath11k_dbg(ab, ATH11K_DBG_WMI, -- "%s:cc %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", -- __func__, reg_info->alpha2, reg_info->dfs_region, -+ "cc %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", -+ reg_info->alpha2, reg_info->dfs_region, - reg_info->min_bw_2ghz, reg_info->max_bw_2ghz, - reg_info->min_bw_5ghz, reg_info->max_bw_5ghz); - - ath11k_dbg(ab, ATH11K_DBG_WMI, -- "%s: num_2ghz_reg_rules %d num_5ghz_reg_rules %d", __func__, -+ "num_2ghz_reg_rules %d num_5ghz_reg_rules %d", - num_2ghz_reg_rules, num_5ghz_reg_rules); - - wmi_reg_rule = -@@ -5043,6 +5067,10 @@ static int ath11k_pull_reg_chan_list_upd - ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n"); - return -ENOMEM; - } -+ -+ ath11k_print_reg_rule(ab, "2 GHz", -+ num_2ghz_reg_rules, -+ reg_info->reg_rules_2ghz_ptr); - } - - if (num_5ghz_reg_rules) { -@@ -5055,6 +5083,10 @@ static int ath11k_pull_reg_chan_list_upd - ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n"); - return -ENOMEM; - } -+ -+ ath11k_print_reg_rule(ab, "5 GHz", -+ num_5ghz_reg_rules, -+ reg_info->reg_rules_5ghz_ptr); - } - - ath11k_dbg(ab, ATH11K_DBG_WMI, "processed regulatory channel list\n"); -@@ -5128,7 +5160,7 @@ static int ath11k_pull_reg_chan_list_ext - struct cur_regulatory_info *reg_info) - { - const void **tb; -- const struct wmi_reg_chan_list_cc_ext_event *ext_chan_list_event_hdr; -+ const struct wmi_reg_chan_list_cc_ext_event *ev; - struct wmi_regulatory_ext_rule *ext_wmi_reg_rule; - u32 num_2ghz_reg_rules, num_5ghz_reg_rules; - u32 num_6ghz_reg_rules_ap[WMI_REG_CURRENT_MAX_AP_TYPE]; -@@ -5145,31 +5177,29 @@ static int ath11k_pull_reg_chan_list_ext - return ret; - } - -- ext_chan_list_event_hdr = tb[WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT]; -- if (!ext_chan_list_event_hdr) { -+ ev = tb[WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT]; -+ if (!ev) { - ath11k_warn(ab, "failed to fetch reg chan list ext update ev\n"); - kfree(tb); - return -EPROTO; - } - -- reg_info->num_2ghz_reg_rules = -- ext_chan_list_event_hdr->num_2ghz_reg_rules; -- reg_info->num_5ghz_reg_rules = -- ext_chan_list_event_hdr->num_5ghz_reg_rules; -+ reg_info->num_2ghz_reg_rules = ev->num_2ghz_reg_rules; -+ reg_info->num_5ghz_reg_rules = ev->num_5ghz_reg_rules; - reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP] = -- ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_lpi; -+ ev->num_6ghz_reg_rules_ap_lpi; - reg_info->num_6ghz_rules_ap[WMI_REG_STANDARD_POWER_AP] = -- ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_sp; -+ ev->num_6ghz_reg_rules_ap_sp; - reg_info->num_6ghz_rules_ap[WMI_REG_VERY_LOW_POWER_AP] = -- ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_vlp; -+ ev->num_6ghz_reg_rules_ap_vlp; - - for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { - reg_info->num_6ghz_rules_client[WMI_REG_INDOOR_AP][i] = -- ext_chan_list_event_hdr->num_6ghz_reg_rules_client_lpi[i]; -+ ev->num_6ghz_reg_rules_client_lpi[i]; - reg_info->num_6ghz_rules_client[WMI_REG_STANDARD_POWER_AP][i] = -- ext_chan_list_event_hdr->num_6ghz_reg_rules_client_sp[i]; -+ ev->num_6ghz_reg_rules_client_sp[i]; - reg_info->num_6ghz_rules_client[WMI_REG_VERY_LOW_POWER_AP][i] = -- ext_chan_list_event_hdr->num_6ghz_reg_rules_client_vlp[i]; -+ ev->num_6ghz_reg_rules_client_vlp[i]; - } - - num_2ghz_reg_rules = reg_info->num_2ghz_reg_rules; -@@ -5231,57 +5261,79 @@ static int ath11k_pull_reg_chan_list_ext - return -EINVAL; - } - -- memcpy(reg_info->alpha2, &ext_chan_list_event_hdr->alpha2, -- REG_ALPHA2_LEN); -+ memcpy(reg_info->alpha2, &ev->alpha2, REG_ALPHA2_LEN); -+ -+ reg_info->dfs_region = ev->dfs_region; -+ reg_info->phybitmap = ev->phybitmap; -+ reg_info->num_phy = ev->num_phy; -+ reg_info->phy_id = ev->phy_id; -+ reg_info->ctry_code = ev->country_id; -+ reg_info->reg_dmn_pair = ev->domain_code; - -- reg_info->dfs_region = ext_chan_list_event_hdr->dfs_region; -- reg_info->phybitmap = ext_chan_list_event_hdr->phybitmap; -- reg_info->num_phy = ext_chan_list_event_hdr->num_phy; -- reg_info->phy_id = ext_chan_list_event_hdr->phy_id; -- reg_info->ctry_code = ext_chan_list_event_hdr->country_id; -- reg_info->reg_dmn_pair = ext_chan_list_event_hdr->domain_code; -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "status_code %s", -+ ath11k_cc_status_to_str(reg_info->status_code)); - - reg_info->status_code = -- ath11k_wmi_cc_setting_code_to_reg(ext_chan_list_event_hdr->status_code); -+ ath11k_wmi_cc_setting_code_to_reg(ev->status_code); - - reg_info->is_ext_reg_event = true; - -- reg_info->min_bw_2ghz = ext_chan_list_event_hdr->min_bw_2ghz; -- reg_info->max_bw_2ghz = ext_chan_list_event_hdr->max_bw_2ghz; -- reg_info->min_bw_5ghz = ext_chan_list_event_hdr->min_bw_5ghz; -- reg_info->max_bw_5ghz = ext_chan_list_event_hdr->max_bw_5ghz; -+ reg_info->min_bw_2ghz = ev->min_bw_2ghz; -+ reg_info->max_bw_2ghz = ev->max_bw_2ghz; -+ reg_info->min_bw_5ghz = ev->min_bw_5ghz; -+ reg_info->max_bw_5ghz = ev->max_bw_5ghz; - - reg_info->min_bw_6ghz_ap[WMI_REG_INDOOR_AP] = -- ext_chan_list_event_hdr->min_bw_6ghz_ap_lpi; -+ ev->min_bw_6ghz_ap_lpi; - reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP] = -- ext_chan_list_event_hdr->max_bw_6ghz_ap_lpi; -+ ev->max_bw_6ghz_ap_lpi; - reg_info->min_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] = -- ext_chan_list_event_hdr->min_bw_6ghz_ap_sp; -+ ev->min_bw_6ghz_ap_sp; - reg_info->max_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] = -- ext_chan_list_event_hdr->max_bw_6ghz_ap_sp; -+ ev->max_bw_6ghz_ap_sp; - reg_info->min_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] = -- ext_chan_list_event_hdr->min_bw_6ghz_ap_vlp; -+ ev->min_bw_6ghz_ap_vlp; - reg_info->max_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] = -- ext_chan_list_event_hdr->max_bw_6ghz_ap_vlp; -+ ev->max_bw_6ghz_ap_vlp; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz AP BW: LPI (%d - %d), SP (%d - %d), VLP (%d - %d)\n", -+ reg_info->min_bw_6ghz_ap[WMI_REG_INDOOR_AP], -+ reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP], -+ reg_info->min_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP], -+ reg_info->max_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP], -+ reg_info->min_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP], -+ reg_info->max_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP]); - - for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { - reg_info->min_bw_6ghz_client[WMI_REG_INDOOR_AP][i] = -- ext_chan_list_event_hdr->min_bw_6ghz_client_lpi[i]; -+ ev->min_bw_6ghz_client_lpi[i]; - reg_info->max_bw_6ghz_client[WMI_REG_INDOOR_AP][i] = -- ext_chan_list_event_hdr->max_bw_6ghz_client_lpi[i]; -+ ev->max_bw_6ghz_client_lpi[i]; - reg_info->min_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -- ext_chan_list_event_hdr->min_bw_6ghz_client_sp[i]; -+ ev->min_bw_6ghz_client_sp[i]; - reg_info->max_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -- ext_chan_list_event_hdr->max_bw_6ghz_client_sp[i]; -+ ev->max_bw_6ghz_client_sp[i]; - reg_info->min_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -- ext_chan_list_event_hdr->min_bw_6ghz_client_vlp[i]; -+ ev->min_bw_6ghz_client_vlp[i]; - reg_info->max_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -- ext_chan_list_event_hdr->max_bw_6ghz_client_vlp[i]; -+ ev->max_bw_6ghz_client_vlp[i]; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz %s BW: LPI (%d - %d), SP (%d - %d), VLP (%d - %d)\n", -+ ath11k_6ghz_client_type_to_str(i), -+ reg_info->min_bw_6ghz_client[WMI_REG_INDOOR_AP][i], -+ reg_info->max_bw_6ghz_client[WMI_REG_INDOOR_AP][i], -+ reg_info->min_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i], -+ reg_info->max_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i], -+ reg_info->min_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i], -+ reg_info->max_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i]); - } - - ath11k_dbg(ab, ATH11K_DBG_WMI, -- "%s:cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", -- __func__, reg_info->alpha2, reg_info->dfs_region, -+ "cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d", -+ reg_info->alpha2, reg_info->dfs_region, - reg_info->min_bw_2ghz, reg_info->max_bw_2ghz, - reg_info->min_bw_5ghz, reg_info->max_bw_5ghz); - -@@ -5310,9 +5362,8 @@ static int ath11k_pull_reg_chan_list_ext - num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][j]); - - ext_wmi_reg_rule = -- (struct wmi_regulatory_ext_rule *)((u8 *)ext_chan_list_event_hdr -- + sizeof(*ext_chan_list_event_hdr) -- + sizeof(struct wmi_tlv)); -+ (struct wmi_regulatory_ext_rule *)((u8 *)ev + sizeof(*ev) + -+ sizeof(struct wmi_tlv)); - if (num_2ghz_reg_rules) { - reg_info->reg_rules_2ghz_ptr = - create_ext_reg_rules_from_wmi(num_2ghz_reg_rules, -@@ -5323,6 +5374,10 @@ static int ath11k_pull_reg_chan_list_ext - ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n"); - return -ENOMEM; - } -+ -+ ath11k_print_reg_rule(ab, "2 GHz", -+ num_2ghz_reg_rules, -+ reg_info->reg_rules_2ghz_ptr); - } - - ext_wmi_reg_rule += num_2ghz_reg_rules; -@@ -5358,6 +5413,10 @@ static int ath11k_pull_reg_chan_list_ext - ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n"); - return -ENOMEM; - } -+ -+ ath11k_print_reg_rule(ab, "5 GHz", -+ num_5ghz_reg_rules, -+ reg_info->reg_rules_5ghz_ptr); - } - - /* We have adjusted the number of 5 GHz reg rules above. But still those -@@ -5378,10 +5437,17 @@ static int ath11k_pull_reg_chan_list_ext - return -ENOMEM; - } - -+ ath11k_print_reg_rule(ab, ath11k_6ghz_ap_type_to_str(i), -+ num_6ghz_reg_rules_ap[i], -+ reg_info->reg_rules_6ghz_ap_ptr[i]); -+ - ext_wmi_reg_rule += num_6ghz_reg_rules_ap[i]; - } - - for (j = 0; j < WMI_REG_CURRENT_MAX_AP_TYPE; j++) { -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz AP type %s", ath11k_6ghz_ap_type_to_str(j)); -+ - for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { - reg_info->reg_rules_6ghz_client_ptr[j][i] = - create_ext_reg_rules_from_wmi(num_6ghz_client[j][i], -@@ -5393,35 +5459,58 @@ static int ath11k_pull_reg_chan_list_ext - return -ENOMEM; - } - -+ ath11k_print_reg_rule(ab, -+ ath11k_6ghz_client_type_to_str(i), -+ num_6ghz_client[j][i], -+ reg_info->reg_rules_6ghz_client_ptr[j][i]); -+ - ext_wmi_reg_rule += num_6ghz_client[j][i]; - } - } - -- reg_info->client_type = ext_chan_list_event_hdr->client_type; -- reg_info->rnr_tpe_usable = ext_chan_list_event_hdr->rnr_tpe_usable; -+ reg_info->client_type = ev->client_type; -+ reg_info->rnr_tpe_usable = ev->rnr_tpe_usable; - reg_info->unspecified_ap_usable = -- ext_chan_list_event_hdr->unspecified_ap_usable; -+ ev->unspecified_ap_usable; - reg_info->domain_code_6ghz_ap[WMI_REG_INDOOR_AP] = -- ext_chan_list_event_hdr->domain_code_6ghz_ap_lpi; -+ ev->domain_code_6ghz_ap_lpi; - reg_info->domain_code_6ghz_ap[WMI_REG_STANDARD_POWER_AP] = -- ext_chan_list_event_hdr->domain_code_6ghz_ap_sp; -+ ev->domain_code_6ghz_ap_sp; - reg_info->domain_code_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] = -- ext_chan_list_event_hdr->domain_code_6ghz_ap_vlp; -+ ev->domain_code_6ghz_ap_vlp; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz reg info client type %s rnr_tpe_usable %d unspecified_ap_usable %d AP sub domain: lpi %s, sp %s, vlp %s\n", -+ ath11k_6ghz_client_type_to_str(reg_info->client_type), -+ reg_info->rnr_tpe_usable, -+ reg_info->unspecified_ap_usable, -+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_lpi), -+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_sp), -+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_vlp)); - - for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) { - reg_info->domain_code_6ghz_client[WMI_REG_INDOOR_AP][i] = -- ext_chan_list_event_hdr->domain_code_6ghz_client_lpi[i]; -+ ev->domain_code_6ghz_client_lpi[i]; - reg_info->domain_code_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] = -- ext_chan_list_event_hdr->domain_code_6ghz_client_sp[i]; -+ ev->domain_code_6ghz_client_sp[i]; - reg_info->domain_code_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] = -- ext_chan_list_event_hdr->domain_code_6ghz_client_vlp[i]; -+ ev->domain_code_6ghz_client_vlp[i]; -+ -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz client type %s client sub domain: lpi %s, sp %s, vlp %s\n", -+ ath11k_6ghz_client_type_to_str(i), -+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_lpi[i]), -+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_sp[i]), -+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_vlp[i]) -+ ); - } - -- reg_info->domain_code_6ghz_super_id = -- ext_chan_list_event_hdr->domain_code_6ghz_super_id; -+ reg_info->domain_code_6ghz_super_id = ev->domain_code_6ghz_super_id; - -- ath11k_dbg(ab, ATH11K_DBG_WMI, "6 GHz client_type: %d domain_code_6ghz_super_id: %d", -- reg_info->client_type, reg_info->domain_code_6ghz_super_id); -+ ath11k_dbg(ab, ATH11K_DBG_WMI, -+ "6 GHz client_type %s 6 GHz super domain %s", -+ ath11k_6ghz_client_type_to_str(reg_info->client_type), -+ ath11k_super_reg_6ghz_to_str(reg_info->domain_code_6ghz_super_id)); - - ath11k_dbg(ab, ATH11K_DBG_WMI, "processed regulatory ext channel list\n"); - ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -4139,6 +4139,7 @@ enum cc_setting_code { - - /* add new setting code above, update in - * @enum wmi_reg_cc_setting_code as well. -+ * Also handle it in ath11k_cc_status_to_str() - */ - }; - -@@ -4163,21 +4164,162 @@ ath11k_wmi_cc_setting_code_to_reg(enum w - return REG_SET_CC_STATUS_FAIL; - } - -+static inline const char *ath11k_cc_status_to_str(enum cc_setting_code code) -+{ -+ switch (code) { -+ case REG_SET_CC_STATUS_PASS: -+ return "REG_SET_CC_STATUS_PASS"; -+ case REG_CURRENT_ALPHA2_NOT_FOUND: -+ return "REG_CURRENT_ALPHA2_NOT_FOUND"; -+ case REG_INIT_ALPHA2_NOT_FOUND: -+ return "REG_INIT_ALPHA2_NOT_FOUND"; -+ case REG_SET_CC_CHANGE_NOT_ALLOWED: -+ return "REG_SET_CC_CHANGE_NOT_ALLOWED"; -+ case REG_SET_CC_STATUS_NO_MEMORY: -+ return "REG_SET_CC_STATUS_NO_MEMORY"; -+ case REG_SET_CC_STATUS_FAIL: -+ return "REG_SET_CC_STATUS_FAIL"; -+ } -+ -+ return "Unknown CC status"; -+} -+ - enum wmi_reg_6ghz_ap_type { - WMI_REG_INDOOR_AP = 0, - WMI_REG_STANDARD_POWER_AP = 1, - WMI_REG_VERY_LOW_POWER_AP = 2, - -+ /* add AP type above, handle in ath11k_6ghz_ap_type_to_str() -+ */ - WMI_REG_CURRENT_MAX_AP_TYPE, - WMI_REG_MAX_AP_TYPE = 7, - }; - -+static inline const char * -+ath11k_6ghz_ap_type_to_str(enum wmi_reg_6ghz_ap_type type) -+{ -+ switch (type) { -+ case WMI_REG_INDOOR_AP: -+ return "INDOOR AP"; -+ case WMI_REG_STANDARD_POWER_AP: -+ return "STANDARD POWER AP"; -+ case WMI_REG_VERY_LOW_POWER_AP: -+ return "VERY LOW POWER AP"; -+ case WMI_REG_CURRENT_MAX_AP_TYPE: -+ return "CURRENT_MAX_AP_TYPE"; -+ case WMI_REG_MAX_AP_TYPE: -+ return "MAX_AP_TYPE"; -+ } -+ -+ return "unknown 6 GHz AP type"; -+} -+ - enum wmi_reg_6ghz_client_type { - WMI_REG_DEFAULT_CLIENT = 0, - WMI_REG_SUBORDINATE_CLIENT = 1, - WMI_REG_MAX_CLIENT_TYPE = 2, -+ -+ /* add client type above, handle it in -+ * ath11k_6ghz_client_type_to_str() -+ */ -+}; -+ -+static inline const char * -+ath11k_6ghz_client_type_to_str(enum wmi_reg_6ghz_client_type type) -+{ -+ switch (type) { -+ case WMI_REG_DEFAULT_CLIENT: -+ return "DEFAULT CLIENT"; -+ case WMI_REG_SUBORDINATE_CLIENT: -+ return "SUBORDINATE CLIENT"; -+ case WMI_REG_MAX_CLIENT_TYPE: -+ return "MAX_CLIENT_TYPE"; -+ } -+ -+ return "unknown 6 GHz client type"; -+} -+ -+enum reg_subdomains_6ghz { -+ EMPTY_6GHZ = 0x0, -+ FCC1_CLIENT_LPI_REGULAR_6GHZ = 0x01, -+ FCC1_CLIENT_SP_6GHZ = 0x02, -+ FCC1_AP_LPI_6GHZ = 0x03, -+ FCC1_CLIENT_LPI_SUBORDINATE = FCC1_AP_LPI_6GHZ, -+ FCC1_AP_SP_6GHZ = 0x04, -+ ETSI1_LPI_6GHZ = 0x10, -+ ETSI1_VLP_6GHZ = 0x11, -+ ETSI2_LPI_6GHZ = 0x12, -+ ETSI2_VLP_6GHZ = 0x13, -+ APL1_LPI_6GHZ = 0x20, -+ APL1_VLP_6GHZ = 0x21, -+ -+ /* add sub-domain above, handle it in -+ * ath11k_sub_reg_6ghz_to_str() -+ */ -+}; -+ -+static inline const char * -+ath11k_sub_reg_6ghz_to_str(enum reg_subdomains_6ghz sub_id) -+{ -+ switch (sub_id) { -+ case EMPTY_6GHZ: -+ return "N/A"; -+ case FCC1_CLIENT_LPI_REGULAR_6GHZ: -+ return "FCC1_CLIENT_LPI_REGULAR_6GHZ"; -+ case FCC1_CLIENT_SP_6GHZ: -+ return "FCC1_CLIENT_SP_6GHZ"; -+ case FCC1_AP_LPI_6GHZ: -+ return "FCC1_AP_LPI_6GHZ/FCC1_CLIENT_LPI_SUBORDINATE"; -+ case FCC1_AP_SP_6GHZ: -+ return "FCC1_AP_SP_6GHZ"; -+ case ETSI1_LPI_6GHZ: -+ return "ETSI1_LPI_6GHZ"; -+ case ETSI1_VLP_6GHZ: -+ return "ETSI1_VLP_6GHZ"; -+ case ETSI2_LPI_6GHZ: -+ return "ETSI2_LPI_6GHZ"; -+ case ETSI2_VLP_6GHZ: -+ return "ETSI2_VLP_6GHZ"; -+ case APL1_LPI_6GHZ: -+ return "APL1_LPI_6GHZ"; -+ case APL1_VLP_6GHZ: -+ return "APL1_VLP_6GHZ"; -+ } -+ -+ return "unknown sub reg id"; -+} -+ -+enum reg_super_domain_6ghz { -+ FCC1_6GHZ = 0x01, -+ ETSI1_6GHZ = 0x02, -+ ETSI2_6GHZ = 0x03, -+ APL1_6GHZ = 0x04, -+ FCC1_6GHZ_CL = 0x05, -+ -+ /* add super domain above, handle it in -+ * ath11k_super_reg_6ghz_to_str() -+ */ - }; - -+static inline const char * -+ath11k_super_reg_6ghz_to_str(enum reg_super_domain_6ghz domain_id) -+{ -+ switch (domain_id) { -+ case FCC1_6GHZ: -+ return "FCC1_6GHZ"; -+ case ETSI1_6GHZ: -+ return "ETSI1_6GHZ"; -+ case ETSI2_6GHZ: -+ return "ETSI2_6GHZ"; -+ case APL1_6GHZ: -+ return "APL1_6GHZ"; -+ case FCC1_6GHZ_CL: -+ return "FCC1_6GHZ_CL"; -+ } -+ -+ return "unknown domain id"; -+} -+ - struct cur_reg_rule { - u16 start_freq; - u16 end_freq; diff --git a/package/kernel/mac80211/patches/ath11k/0046-wifi-ath11k-Replace-fake-flex-array-with-flexible-ar.patch b/package/kernel/mac80211/patches/ath11k/0046-wifi-ath11k-Replace-fake-flex-array-with-flexible-ar.patch deleted file mode 100644 index bd161785644..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0046-wifi-ath11k-Replace-fake-flex-array-with-flexible-ar.patch +++ /dev/null @@ -1,246 +0,0 @@ -From 3b1088a09ec9438523c251d8435e78988824bc0d Mon Sep 17 00:00:00 2001 -From: "Gustavo A. R. Silva" -Date: Tue, 7 Mar 2023 16:22:39 -0600 -Subject: [PATCH] wifi: ath11k: Replace fake flex-array with flexible-array - member -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Zero-length arrays as fake flexible arrays are deprecated and we are -moving towards adopting C99 flexible-array members instead. - -Address 25 of the following warnings found with GCC-13 and --fstrict-flex-arrays=3 enabled: -drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c:30:51: warning: array subscript is outside array bounds of ‘const u32[0]’ {aka ‘const unsigned int[]’} [-Warray-bounds=] - -This helps with the ongoing efforts to tighten the FORTIFY_SOURCE -routines on memcpy() and help us make progress towards globally -enabling -fstrict-flex-arrays=3 [1]. - -Link: https://github.com/KSPP/linux/issues/21 -Link: https://github.com/KSPP/linux/issues/266 -Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] -Signed-off-by: Gustavo A. R. Silva -Reviewed-by: Simon Horman -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/ZAe5L5DtmsQxzqRH@work ---- - .../wireless/ath/ath11k/debugfs_htt_stats.h | 73 +++++++++++-------- - 1 file changed, 43 insertions(+), 30 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h -+++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h -@@ -143,7 +143,8 @@ enum htt_tx_pdev_underrun_enum { - /* Bytes stored in little endian order */ - /* Length should be multiple of DWORD */ - struct htt_stats_string_tlv { -- u32 data[0]; /* Can be variable length */ -+ /* Can be variable length */ -+ DECLARE_FLEX_ARRAY(u32, data); - } __packed; - - #define HTT_STATS_MAC_ID GENMASK(7, 0) -@@ -205,27 +206,32 @@ struct htt_tx_pdev_stats_cmn_tlv { - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_pdev_stats_urrn_tlv_v { -- u32 urrn_stats[0]; /* HTT_TX_PDEV_MAX_URRN_STATS */ -+ /* HTT_TX_PDEV_MAX_URRN_STATS */ -+ DECLARE_FLEX_ARRAY(u32, urrn_stats); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_pdev_stats_flush_tlv_v { -- u32 flush_errs[0]; /* HTT_TX_PDEV_MAX_FLUSH_REASON_STATS */ -+ /* HTT_TX_PDEV_MAX_FLUSH_REASON_STATS */ -+ DECLARE_FLEX_ARRAY(u32, flush_errs); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_pdev_stats_sifs_tlv_v { -- u32 sifs_status[0]; /* HTT_TX_PDEV_MAX_SIFS_BURST_STATS */ -+ /* HTT_TX_PDEV_MAX_SIFS_BURST_STATS */ -+ DECLARE_FLEX_ARRAY(u32, sifs_status); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_pdev_stats_phy_err_tlv_v { -- u32 phy_errs[0]; /* HTT_TX_PDEV_MAX_PHY_ERR_STATS */ -+ /* HTT_TX_PDEV_MAX_PHY_ERR_STATS */ -+ DECLARE_FLEX_ARRAY(u32, phy_errs); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_pdev_stats_sifs_hist_tlv_v { -- u32 sifs_hist_status[0]; /* HTT_TX_PDEV_SIFS_BURST_HIST_STATS */ -+ /* HTT_TX_PDEV_SIFS_BURST_HIST_STATS */ -+ DECLARE_FLEX_ARRAY(u32, sifs_hist_status); - }; - - struct htt_tx_pdev_stats_tx_ppdu_stats_tlv_v { -@@ -590,20 +596,20 @@ struct htt_tx_hwq_difs_latency_stats_tlv - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_hwq_cmd_result_stats_tlv_v { -- /* Histogram of sched cmd result */ -- u32 cmd_result[0]; /* HTT_TX_HWQ_MAX_CMD_RESULT_STATS */ -+ /* Histogram of sched cmd result, HTT_TX_HWQ_MAX_CMD_RESULT_STATS */ -+ DECLARE_FLEX_ARRAY(u32, cmd_result); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_hwq_cmd_stall_stats_tlv_v { -- /* Histogram of various pause conitions */ -- u32 cmd_stall_status[0]; /* HTT_TX_HWQ_MAX_CMD_STALL_STATS */ -+ /* Histogram of various pause conitions, HTT_TX_HWQ_MAX_CMD_STALL_STATS */ -+ DECLARE_FLEX_ARRAY(u32, cmd_stall_status); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_hwq_fes_result_stats_tlv_v { -- /* Histogram of number of user fes result */ -- u32 fes_result[0]; /* HTT_TX_HWQ_MAX_FES_RESULT_STATS */ -+ /* Histogram of number of user fes result, HTT_TX_HWQ_MAX_FES_RESULT_STATS */ -+ DECLARE_FLEX_ARRAY(u32, fes_result); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size -@@ -635,8 +641,8 @@ struct htt_tx_hwq_tried_mpdu_cnt_hist_tl - * #define WAL_TXOP_USED_HISTOGRAM_INTERVAL 1000 ( 1 ms ) - */ - struct htt_tx_hwq_txop_used_cnt_hist_tlv_v { -- /* Histogram of txop used cnt */ -- u32 txop_used_cnt_hist[0]; /* HTT_TX_HWQ_TXOP_USED_CNT_HIST */ -+ /* Histogram of txop used cnt, HTT_TX_HWQ_TXOP_USED_CNT_HIST */ -+ DECLARE_FLEX_ARRAY(u32, txop_used_cnt_hist); - }; - - /* == TX SELFGEN STATS == */ -@@ -804,17 +810,20 @@ struct htt_tx_pdev_mpdu_stats_tlv { - /* == TX SCHED STATS == */ - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_sched_txq_cmd_posted_tlv_v { -- u32 sched_cmd_posted[0]; /* HTT_TX_PDEV_SCHED_TX_MODE_MAX */ -+ /* HTT_TX_PDEV_SCHED_TX_MODE_MAX */ -+ DECLARE_FLEX_ARRAY(u32, sched_cmd_posted); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_sched_txq_cmd_reaped_tlv_v { -- u32 sched_cmd_reaped[0]; /* HTT_TX_PDEV_SCHED_TX_MODE_MAX */ -+ /* HTT_TX_PDEV_SCHED_TX_MODE_MAX */ -+ DECLARE_FLEX_ARRAY(u32, sched_cmd_reaped); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_sched_txq_sched_order_su_tlv_v { -- u32 sched_order_su[0]; /* HTT_TX_PDEV_NUM_SCHED_ORDER_LOG */ -+ /* HTT_TX_PDEV_NUM_SCHED_ORDER_LOG */ -+ DECLARE_FLEX_ARRAY(u32, sched_order_su); - }; - - enum htt_sched_txq_sched_ineligibility_tlv_enum { -@@ -842,7 +851,7 @@ enum htt_sched_txq_sched_ineligibility_t - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_sched_txq_sched_ineligibility_tlv_v { - /* indexed by htt_sched_txq_sched_ineligibility_tlv_enum */ -- u32 sched_ineligibility[0]; -+ DECLARE_FLEX_ARRAY(u32, sched_ineligibility); - }; - - #define HTT_TX_PDEV_STATS_SCHED_PER_TXQ_MAC_ID GENMASK(7, 0) -@@ -888,18 +897,20 @@ struct htt_stats_tx_sched_cmn_tlv { - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_tqm_gen_mpdu_stats_tlv_v { -- u32 gen_mpdu_end_reason[0]; /* HTT_TX_TQM_MAX_GEN_MPDU_END_REASON */ -+ /* HTT_TX_TQM_MAX_GEN_MPDU_END_REASON */ -+ DECLARE_FLEX_ARRAY(u32, gen_mpdu_end_reason); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_tqm_list_mpdu_stats_tlv_v { -- u32 list_mpdu_end_reason[0]; /* HTT_TX_TQM_MAX_LIST_MPDU_END_REASON */ -+ /* HTT_TX_TQM_MAX_LIST_MPDU_END_REASON */ -+ DECLARE_FLEX_ARRAY(u32, list_mpdu_end_reason); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_tx_tqm_list_mpdu_cnt_tlv_v { -- u32 list_mpdu_cnt_hist[0]; -- /* HTT_TX_TQM_MAX_LIST_MPDU_CNT_HISTOGRAM_BINS */ -+ /* HTT_TX_TQM_MAX_LIST_MPDU_CNT_HISTOGRAM_BINS */ -+ DECLARE_FLEX_ARRAY(u32, list_mpdu_cnt_hist); - }; - - struct htt_tx_tqm_pdev_stats_tlv_v { -@@ -1098,7 +1109,7 @@ struct htt_tx_de_compl_stats_tlv { - * ENTRIES_PER_BIN_COUNT) - */ - struct htt_tx_de_fw2wbm_ring_full_hist_tlv { -- u32 fw2wbm_ring_full_hist[0]; -+ DECLARE_FLEX_ARRAY(u32, fw2wbm_ring_full_hist); - }; - - struct htt_tx_de_cmn_stats_tlv { -@@ -1151,7 +1162,7 @@ struct htt_ring_if_cmn_tlv { - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_sfm_client_user_tlv_v { - /* Number of DWORDS used per user and per client */ -- u32 dwords_used_by_user_n[0]; -+ DECLARE_FLEX_ARRAY(u32, dwords_used_by_user_n); - }; - - struct htt_sfm_client_tlv { -@@ -1436,12 +1447,14 @@ struct htt_rx_soc_fw_stats_tlv { - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_rx_soc_fw_refill_ring_empty_tlv_v { -- u32 refill_ring_empty_cnt[0]; /* HTT_RX_STATS_REFILL_MAX_RING */ -+ /* HTT_RX_STATS_REFILL_MAX_RING */ -+ DECLARE_FLEX_ARRAY(u32, refill_ring_empty_cnt); - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_rx_soc_fw_refill_ring_num_refill_tlv_v { -- u32 refill_ring_num_refill[0]; /* HTT_RX_STATS_REFILL_MAX_RING */ -+ /* HTT_RX_STATS_REFILL_MAX_RING */ -+ DECLARE_FLEX_ARRAY(u32, refill_ring_num_refill); - }; - - /* RXDMA error code from WBM released packets */ -@@ -1473,7 +1486,7 @@ enum htt_rx_rxdma_error_code_enum { - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_rx_soc_fw_refill_ring_num_rxdma_err_tlv_v { -- u32 rxdma_err[0]; /* HTT_RX_RXDMA_MAX_ERR_CODE */ -+ DECLARE_FLEX_ARRAY(u32, rxdma_err); /* HTT_RX_RXDMA_MAX_ERR_CODE */ - }; - - /* REO error code from WBM released packets */ -@@ -1505,7 +1518,7 @@ enum htt_rx_reo_error_code_enum { - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_rx_soc_fw_refill_ring_num_reo_err_tlv_v { -- u32 reo_err[0]; /* HTT_RX_REO_MAX_ERR_CODE */ -+ DECLARE_FLEX_ARRAY(u32, reo_err); /* HTT_RX_REO_MAX_ERR_CODE */ - }; - - /* == RX PDEV STATS == */ -@@ -1622,13 +1635,13 @@ struct htt_rx_pdev_fw_stats_phy_err_tlv - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_rx_pdev_fw_ring_mpdu_err_tlv_v { - /* Num error MPDU for each RxDMA error type */ -- u32 fw_ring_mpdu_err[0]; /* HTT_RX_STATS_RXDMA_MAX_ERR */ -+ DECLARE_FLEX_ARRAY(u32, fw_ring_mpdu_err); /* HTT_RX_STATS_RXDMA_MAX_ERR */ - }; - - /* NOTE: Variable length TLV, use length spec to infer array size */ - struct htt_rx_pdev_fw_mpdu_drop_tlv_v { - /* Num MPDU dropped */ -- u32 fw_mpdu_drop[0]; /* HTT_RX_STATS_FW_DROP_REASON_MAX */ -+ DECLARE_FLEX_ARRAY(u32, fw_mpdu_drop); /* HTT_RX_STATS_FW_DROP_REASON_MAX */ - }; - - #define HTT_PDEV_CCA_STATS_TX_FRAME_INFO_PRESENT (0x1) diff --git a/package/kernel/mac80211/patches/ath11k/0047-wifi-ath11k-fix-deinitialization-of-firmware-resourc.patch b/package/kernel/mac80211/patches/ath11k/0047-wifi-ath11k-fix-deinitialization-of-firmware-resourc.patch deleted file mode 100644 index eec11f50e3c..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0047-wifi-ath11k-fix-deinitialization-of-firmware-resourc.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 5a78ac33e3cb8822da64dd1af196e83664b332b0 Mon Sep 17 00:00:00 2001 -From: Aditya Kumar Singh -Date: Thu, 9 Mar 2023 15:23:08 +0530 -Subject: [PATCH] wifi: ath11k: fix deinitialization of firmware resources - -Currently, in ath11k_ahb_fw_resources_init(), iommu domain -mapping is done only for the chipsets having fixed firmware -memory. Also, for such chipsets, mapping is done only if it -does not have TrustZone support. - -During deinitialization, only if TrustZone support is not there, -iommu is unmapped back. However, for non fixed firmware memory -chipsets, TrustZone support is not there and this makes the -condition check to true and it tries to unmap the memory which -was not mapped during initialization. - -This leads to the following trace - - -[ 83.198790] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008 -[ 83.259537] Modules linked in: ath11k_ahb ath11k qmi_helpers -.. snip .. -[ 83.280286] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) -[ 83.287228] pc : __iommu_unmap+0x30/0x140 -[ 83.293907] lr : iommu_unmap+0x5c/0xa4 -[ 83.298072] sp : ffff80000b3abad0 -.. snip .. -[ 83.369175] Call trace: -[ 83.376282] __iommu_unmap+0x30/0x140 -[ 83.378541] iommu_unmap+0x5c/0xa4 -[ 83.382360] ath11k_ahb_fw_resource_deinit.part.12+0x2c/0xac [ath11k_ahb] -[ 83.385666] ath11k_ahb_free_resources+0x140/0x17c [ath11k_ahb] -[ 83.392521] ath11k_ahb_shutdown+0x34/0x40 [ath11k_ahb] -[ 83.398248] platform_shutdown+0x20/0x2c -[ 83.403455] device_shutdown+0x16c/0x1c4 -[ 83.407621] kernel_restart_prepare+0x34/0x3c -[ 83.411529] kernel_restart+0x14/0x74 -[ 83.415781] __do_sys_reboot+0x1c4/0x22c -[ 83.419427] __arm64_sys_reboot+0x1c/0x24 -[ 83.423420] invoke_syscall+0x44/0xfc -[ 83.427326] el0_svc_common.constprop.3+0xac/0xe8 -[ 83.430974] do_el0_svc+0xa0/0xa8 -[ 83.435659] el0_svc+0x1c/0x44 -[ 83.438957] el0t_64_sync_handler+0x60/0x144 -[ 83.441910] el0t_64_sync+0x15c/0x160 -[ 83.446343] Code: aa0103f4 f9400001 f90027a1 d2800001 (f94006a0) -[ 83.449903] ---[ end trace 0000000000000000 ]--- - -This can be reproduced by probing an AHB chipset which is not -having a fixed memory region. During reboot (or rmmod) trace -can be seen. - -Fix this issue by adding a condition check on firmware fixed memory -hw_param as done in the counter initialization function. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Fixes: f9eec4947add ("ath11k: Add support for targets without trustzone") -Signed-off-by: Aditya Kumar Singh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230309095308.24937-1-quic_adisi@quicinc.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 6 ++++++ - 1 file changed, 6 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -1078,6 +1078,12 @@ static int ath11k_ahb_fw_resource_deinit - struct iommu_domain *iommu; - size_t unmapped_size; - -+ /* Chipsets not requiring MSA would have not initialized -+ * MSA resources, return success in such cases. -+ */ -+ if (!ab->hw_params.fixed_fw_mem) -+ return 0; -+ - if (ab_ahb->fw.use_tz) - return 0; - diff --git a/package/kernel/mac80211/patches/ath11k/0048-wifi-ath11k-fix-BUFFER_DONE-read-on-monitor-ring-rx-.patch b/package/kernel/mac80211/patches/ath11k/0048-wifi-ath11k-fix-BUFFER_DONE-read-on-monitor-ring-rx-.patch deleted file mode 100644 index 3e22645331b..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0048-wifi-ath11k-fix-BUFFER_DONE-read-on-monitor-ring-rx-.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 68e93ac5a31d4975b25f819b2dfe914c72abc3bb Mon Sep 17 00:00:00 2001 -From: Harshitha Prem -Date: Wed, 15 Mar 2023 12:24:43 +0200 -Subject: [PATCH] wifi: ath11k: fix BUFFER_DONE read on monitor ring rx buffer - -Perform dma_sync_single_for_cpu() on monitor ring rx buffer before -reading BUFFER_DONE tag and do dma_unmap_single() only after device -had set BUFFER_DONE tag to the buffer. - -Also when BUFFER_DONE tag is not set, allow the buffer to get read -next time without freeing skb. - -This helps to fix AP+Monitor VAP with flood traffic scenario to see -monitor ring rx buffer overrun missing BUFFER_DONE tag to be set. - -Also remove redundant rx dma buf free performed on DP -rx_mon_status_refill_ring. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sathishkumar Muruganandam -Signed-off-by: Harshitha Prem -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230309164434.32660-1-quic_hprem@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 57 ++++++++++--------------- - 1 file changed, 23 insertions(+), 34 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -435,7 +435,6 @@ fail_free_skb: - static int ath11k_dp_rxdma_buf_ring_free(struct ath11k *ar, - struct dp_rxdma_ring *rx_ring) - { -- struct ath11k_pdev_dp *dp = &ar->dp; - struct sk_buff *skb; - int buf_id; - -@@ -453,28 +452,6 @@ static int ath11k_dp_rxdma_buf_ring_free - idr_destroy(&rx_ring->bufs_idr); - spin_unlock_bh(&rx_ring->idr_lock); - -- /* if rxdma1_enable is false, mon_status_refill_ring -- * isn't setup, so don't clean. -- */ -- if (!ar->ab->hw_params.rxdma1_enable) -- return 0; -- -- rx_ring = &dp->rx_mon_status_refill_ring[0]; -- -- spin_lock_bh(&rx_ring->idr_lock); -- idr_for_each_entry(&rx_ring->bufs_idr, skb, buf_id) { -- idr_remove(&rx_ring->bufs_idr, buf_id); -- /* XXX: Understand where internal driver does this dma_unmap -- * of rxdma_buffer. -- */ -- dma_unmap_single(ar->ab->dev, ATH11K_SKB_RXCB(skb)->paddr, -- skb->len + skb_tailroom(skb), DMA_BIDIRECTIONAL); -- dev_kfree_skb_any(skb); -- } -- -- idr_destroy(&rx_ring->bufs_idr); -- spin_unlock_bh(&rx_ring->idr_lock); -- - return 0; - } - -@@ -3029,39 +3006,51 @@ static int ath11k_dp_rx_reap_mon_status_ - - 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) { - ath11k_warn(ab, "rx monitor status with invalid buf_id %d\n", - buf_id); -- spin_unlock_bh(&rx_ring->idr_lock); - pmon->buf_state = DP_MON_STATUS_REPLINISH; - goto move_next; - } - -- idr_remove(&rx_ring->bufs_idr, buf_id); -- spin_unlock_bh(&rx_ring->idr_lock); -- - rxcb = ATH11K_SKB_RXCB(skb); - -- dma_unmap_single(ab->dev, rxcb->paddr, -- skb->len + skb_tailroom(skb), -- DMA_FROM_DEVICE); -+ 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) { -- ath11k_warn(ab, "mon status DONE not set %lx\n", -+ ath11k_warn(ab, "mon status DONE not set %lx, buf_id %d\n", - FIELD_GET(HAL_TLV_HDR_TAG, -- tlv->tl)); -- dev_kfree_skb_any(skb); -+ 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 -+ */ - pmon->buf_state = DP_MON_STATUS_NO_DMA; -- goto move_next; -+ break; - } - -+ spin_lock_bh(&rx_ring->idr_lock); -+ idr_remove(&rx_ring->bufs_idr, buf_id); -+ spin_unlock_bh(&rx_ring->idr_lock); - if (ab->hw_params.full_monitor_mode) { - ath11k_dp_rx_mon_update_status_buf_state(pmon, tlv); - if (paddr == pmon->mon_status_paddr) - pmon->buf_state = DP_MON_STATUS_MATCH; - } -+ -+ dma_unmap_single(ab->dev, rxcb->paddr, -+ skb->len + skb_tailroom(skb), -+ DMA_FROM_DEVICE); -+ - __skb_queue_tail(skb_list, skb); - } else { - pmon->buf_state = DP_MON_STATUS_REPLINISH; diff --git a/package/kernel/mac80211/patches/ath11k/0049-wifi-ath11k-Optimize-6-GHz-scan-time.patch b/package/kernel/mac80211/patches/ath11k/0049-wifi-ath11k-Optimize-6-GHz-scan-time.patch deleted file mode 100644 index f468990feb7..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0049-wifi-ath11k-Optimize-6-GHz-scan-time.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 8b4d2f080afbd4280ecca0f4b3ceea943a7a86d0 Mon Sep 17 00:00:00 2001 -From: Manikanta Pubbisetty -Date: Thu, 23 Mar 2023 11:39:13 +0530 -Subject: [PATCH] wifi: ath11k: Optimize 6 GHz scan time - -Currently, time taken to scan all supported channels on WCN6750 -is ~8 seconds and connection time is almost 10 seconds. WCN6750 -supports three Wi-Fi bands (i.e., 2.4/5/6 GHz) and the numbers of -channels for scan come around ~100 channels (default case). -Since the chip doesn't have support for DBS (Dual Band Simultaneous), -scans cannot be parallelized resulting in longer scan times. - -Among the 100 odd channels, ~60 channels are in 6 GHz band. Therefore, -optimizing the scan for 6 GHz channels will bring down the overall -scan time. - -WCN6750 firmware has support to scan a 6 GHz channel based on co-located -AP information i.e., RNR IE which is found in the legacy 2.4/5 GHz scan -results. When a scan request with all supported channel list is enqueued -to the firmware, then based on WMI_SCAN_CHAN_FLAG_SCAN_ONLY_IF_RNR_FOUND -scan channel flag, firmware will scan only those 6 GHz channels for which -RNR IEs are found in the legacy scan results. - -In the proposed design, based on NL80211_SCAN_FLAG_COLOCATED_6GHZ scan -flag, driver will set the WMI_SCAN_CHAN_FLAG_SCAN_ONLY_IF_RNR_FOUND flag -for non-PSC channels. Since there is high probability to find 6 GHz APs -on PSC channels, these channels are always scanned. Only non-PSC channels -are selectively scanned based on cached RNR information from the legacy -scan results. - -If NL80211_SCAN_FLAG_COLOCATED_6GHZ is not set in the scan flags, -then scan will happen on all supported channels (default behavior). - -With these optimizations, scan time is improved by 1.5-1.8 seconds on -WCN6750. Similar savings have been observed on WCN6855. - -Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 -Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.16 - -Signed-off-by: Manikanta Pubbisetty -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230323060913.10097-1-quic_mpubbise@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 25 +++++++++++++++++++++++-- - drivers/net/wireless/ath/ath11k/wmi.h | 4 ++++ - 2 files changed, 27 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3819,8 +3819,29 @@ static int ath11k_mac_op_hw_scan(struct - goto exit; - } - -- for (i = 0; i < arg->num_chan; i++) -- arg->chan_list[i] = req->channels[i]->center_freq; -+ for (i = 0; i < arg->num_chan; i++) { -+ if (test_bit(WMI_TLV_SERVICE_SCAN_CONFIG_PER_CHANNEL, -+ ar->ab->wmi_ab.svc_map)) { -+ arg->chan_list[i] = -+ u32_encode_bits(req->channels[i]->center_freq, -+ WMI_SCAN_CONFIG_PER_CHANNEL_MASK); -+ -+ /* If NL80211_SCAN_FLAG_COLOCATED_6GHZ is set in scan -+ * flags, then scan all PSC channels in 6 GHz band and -+ * those non-PSC channels where RNR IE is found during -+ * the legacy 2.4/5 GHz scan. -+ * If NL80211_SCAN_FLAG_COLOCATED_6GHZ is not set, -+ * then all channels in 6 GHz will be scanned. -+ */ -+ if (req->channels[i]->band == NL80211_BAND_6GHZ && -+ req->flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ && -+ !cfg80211_channel_is_psc(req->channels[i])) -+ arg->chan_list[i] |= -+ WMI_SCAN_CH_FLAG_SCAN_ONLY_IF_RNR_FOUND; -+ } else { -+ arg->chan_list[i] = req->channels[i]->center_freq; -+ } -+ } - } - - if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2100,6 +2100,7 @@ enum wmi_tlv_service { - - /* The second 128 bits */ - WMI_MAX_EXT_SERVICE = 256, -+ WMI_TLV_SERVICE_SCAN_CONFIG_PER_CHANNEL = 265, - WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT = 281, - WMI_TLV_SERVICE_BIOS_SAR_SUPPORT = 326, - -@@ -3249,6 +3250,9 @@ struct wmi_start_scan_cmd { - #define WMI_SCAN_DWELL_MODE_SHIFT 21 - #define WMI_SCAN_FLAG_EXT_PASSIVE_SCAN_START_TIME_ENHANCE 0x00000800 - -+#define WMI_SCAN_CONFIG_PER_CHANNEL_MASK GENMASK(19, 0) -+#define WMI_SCAN_CH_FLAG_SCAN_ONLY_IF_RNR_FOUND BIT(20) -+ - enum { - WMI_SCAN_DWELL_MODE_DEFAULT = 0, - WMI_SCAN_DWELL_MODE_CONSERVATIVE = 1, diff --git a/package/kernel/mac80211/patches/ath11k/0050-wifi-ath11k-Configure-the-FTM-responder-role-using-f.patch b/package/kernel/mac80211/patches/ath11k/0050-wifi-ath11k-Configure-the-FTM-responder-role-using-f.patch deleted file mode 100644 index bca08b177fd..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0050-wifi-ath11k-Configure-the-FTM-responder-role-using-f.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 813968c24126cc5c8320cd5db0e262069a535063 Mon Sep 17 00:00:00 2001 -From: Ganesh Babu Jothiram -Date: Fri, 24 Mar 2023 16:57:00 +0200 -Subject: [PATCH] wifi: ath11k: Configure the FTM responder role using firmware - capability flag - -Fine Time Measurement(FTM) is offloaded feature to firmware. -Hence, the configuration of FTM responder role is done using -firmware capability flag instead of hw param. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Ganesh Babu Jothiram -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230317072034.8217-1-quic_gjothira@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 8 -------- - drivers/net/wireless/ath/ath11k/hw.h | 1 - - drivers/net/wireless/ath/ath11k/mac.c | 4 ++-- - 3 files changed, 2 insertions(+), 11 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -116,7 +116,6 @@ static const struct ath11k_hw_params ath - .tcl_ring_retry = true, - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, -- .ftm_responder = true, - }, - { - .hw_rev = ATH11K_HW_IPQ6018_HW10, -@@ -199,7 +198,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -- .ftm_responder = true, - }, - { - .name = "qca6390 hw2.0", -@@ -284,7 +282,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = true, -- .ftm_responder = false, - }, - { - .name = "qcn9074 hw1.0", -@@ -366,7 +363,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -- .ftm_responder = true, - }, - { - .name = "wcn6855 hw2.0", -@@ -451,7 +447,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = true, -- .ftm_responder = false, - }, - { - .name = "wcn6855 hw2.1", -@@ -534,7 +529,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = true, -- .ftm_responder = false, - }, - { - .name = "wcn6750 hw1.0", -@@ -615,7 +609,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE_WCN6750, - .smp2p_wow_exit = true, - .support_fw_mac_sequence = true, -- .ftm_responder = false, - }, - { - .hw_rev = ATH11K_HW_IPQ5018_HW10, -@@ -695,7 +688,6 @@ static const struct ath11k_hw_params ath - .tx_ring_size = DP_TCL_DATA_RING_SIZE, - .smp2p_wow_exit = false, - .support_fw_mac_sequence = false, -- .ftm_responder = true, - }, - }; - ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -224,7 +224,6 @@ struct ath11k_hw_params { - u32 tx_ring_size; - bool smp2p_wow_exit; - bool support_fw_mac_sequence; -- bool ftm_responder; - }; - - struct ath11k_hw_ops { ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3538,7 +3538,7 @@ static void ath11k_mac_op_bss_info_chang - - if (changed & BSS_CHANGED_FTM_RESPONDER && - arvif->ftm_responder != info->ftm_responder && -- ar->ab->hw_params.ftm_responder && -+ test_bit(WMI_TLV_SERVICE_RTT, ar->ab->wmi_ab.svc_map) && - (vif->type == NL80211_IFTYPE_AP || - vif->type == NL80211_IFTYPE_MESH_POINT)) { - arvif->ftm_responder = info->ftm_responder; -@@ -9234,7 +9234,7 @@ static int __ath11k_mac_register(struct - wiphy_ext_feature_set(ar->hw->wiphy, - NL80211_EXT_FEATURE_SET_SCAN_DWELL); - -- if (ab->hw_params.ftm_responder) -+ if (test_bit(WMI_TLV_SERVICE_RTT, ar->ab->wmi_ab.svc_map)) - wiphy_ext_feature_set(ar->hw->wiphy, - NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER); - diff --git a/package/kernel/mac80211/patches/ath11k/0051-wifi-ath11k-fix-rssi-station-dump-not-updated-in-QCN.patch b/package/kernel/mac80211/patches/ath11k/0051-wifi-ath11k-fix-rssi-station-dump-not-updated-in-QCN.patch deleted file mode 100644 index 835dece1fe7..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0051-wifi-ath11k-fix-rssi-station-dump-not-updated-in-QCN.patch +++ /dev/null @@ -1,158 +0,0 @@ -From 031ffa6c2cd305a57ccc6d610f2decd956b2e7f6 Mon Sep 17 00:00:00 2001 -From: P Praneesh -Date: Fri, 24 Mar 2023 16:57:00 +0200 -Subject: [PATCH] wifi: ath11k: fix rssi station dump not updated in QCN9074 - -In QCN9074, station dump signal values display default value which -is -95 dbm, since there is firmware header change for HAL_RX_MPDU_START -between QCN9074 and IPQ8074 which cause wrong peer_id fetch from msdu. -Fix this by updating hal_rx_mpdu_info with corresponding QCN9074 tlv -format. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01695-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: P Praneesh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230320110312.20639-1-quic_ppranees@quicinc.com ---- - drivers/net/wireless/ath/ath11k/hal_rx.c | 10 ++++++++- - drivers/net/wireless/ath/ath11k/hal_rx.h | 18 +++++++++++++++- - drivers/net/wireless/ath/ath11k/hw.c | 27 ++++++++++++++++-------- - drivers/net/wireless/ath/ath11k/hw.h | 2 +- - 4 files changed, 45 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/hal_rx.c -+++ b/drivers/net/wireless/ath/ath11k/hal_rx.c -@@ -865,6 +865,12 @@ ath11k_hal_rx_populate_mu_user_info(void - ath11k_hal_rx_populate_byte_count(rx_tlv, ppdu_info, rx_user_status); - } - -+static u16 ath11k_hal_rx_mpduinfo_get_peerid(struct ath11k_base *ab, -+ struct hal_rx_mpdu_info *mpdu_info) -+{ -+ return ab->hw_params.hw_ops->mpdu_info_get_peerid(mpdu_info); -+} -+ - static enum hal_rx_mon_status - ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab, - struct hal_rx_mon_ppdu_info *ppdu_info, -@@ -1459,9 +1465,11 @@ ath11k_hal_rx_parse_mon_status_tlv(struc - break; - } - case HAL_RX_MPDU_START: { -+ struct hal_rx_mpdu_info *mpdu_info = -+ (struct hal_rx_mpdu_info *)tlv_data; - u16 peer_id; - -- peer_id = ab->hw_params.hw_ops->mpdu_info_get_peerid(tlv_data); -+ peer_id = ath11k_hal_rx_mpduinfo_get_peerid(ab, mpdu_info); - if (peer_id) - ppdu_info->peer_id = peer_id; - break; ---- a/drivers/net/wireless/ath/ath11k/hal_rx.h -+++ b/drivers/net/wireless/ath/ath11k/hal_rx.h -@@ -405,7 +405,7 @@ struct hal_rx_phyrx_rssi_legacy_info { - #define HAL_RX_MPDU_INFO_INFO0_PEERID_WCN6855 GENMASK(15, 0) - #define HAL_RX_MPDU_INFO_INFO1_MPDU_LEN GENMASK(13, 0) - --struct hal_rx_mpdu_info { -+struct hal_rx_mpdu_info_ipq8074 { - __le32 rsvd0; - __le32 info0; - __le32 rsvd1[11]; -@@ -413,12 +413,28 @@ struct hal_rx_mpdu_info { - __le32 rsvd2[9]; - } __packed; - -+struct hal_rx_mpdu_info_qcn9074 { -+ __le32 rsvd0[10]; -+ __le32 info0; -+ __le32 rsvd1[2]; -+ __le32 info1; -+ __le32 rsvd2[9]; -+} __packed; -+ - struct hal_rx_mpdu_info_wcn6855 { - __le32 rsvd0[8]; - __le32 info0; - __le32 rsvd1[14]; - } __packed; - -+struct hal_rx_mpdu_info { -+ union { -+ struct hal_rx_mpdu_info_ipq8074 ipq8074; -+ struct hal_rx_mpdu_info_qcn9074 qcn9074; -+ struct hal_rx_mpdu_info_wcn6855 wcn6855; -+ } u; -+} __packed; -+ - #define HAL_RX_PPDU_END_DURATION GENMASK(23, 0) - struct hal_rx_ppdu_end_duration { - __le32 rsvd0[9]; ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -835,26 +835,35 @@ static void ath11k_hw_ipq5018_reo_setup( - ring_hash_map); - } - --static u16 ath11k_hw_ipq8074_mpdu_info_get_peerid(u8 *tlv_data) -+static u16 -+ath11k_hw_ipq8074_mpdu_info_get_peerid(struct hal_rx_mpdu_info *mpdu_info) - { - u16 peer_id = 0; -- struct hal_rx_mpdu_info *mpdu_info = -- (struct hal_rx_mpdu_info *)tlv_data; - - peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID, -- __le32_to_cpu(mpdu_info->info0)); -+ __le32_to_cpu(mpdu_info->u.ipq8074.info0)); - - return peer_id; - } - --static u16 ath11k_hw_wcn6855_mpdu_info_get_peerid(u8 *tlv_data) -+static u16 -+ath11k_hw_qcn9074_mpdu_info_get_peerid(struct hal_rx_mpdu_info *mpdu_info) -+{ -+ u16 peer_id = 0; -+ -+ peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID, -+ __le32_to_cpu(mpdu_info->u.qcn9074.info0)); -+ -+ return peer_id; -+} -+ -+static u16 -+ath11k_hw_wcn6855_mpdu_info_get_peerid(struct hal_rx_mpdu_info *mpdu_info) - { - u16 peer_id = 0; -- struct hal_rx_mpdu_info_wcn6855 *mpdu_info = -- (struct hal_rx_mpdu_info_wcn6855 *)tlv_data; - - peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID_WCN6855, -- __le32_to_cpu(mpdu_info->info0)); -+ __le32_to_cpu(mpdu_info->u.wcn6855.info0)); - return peer_id; - } - -@@ -1042,7 +1051,7 @@ const struct ath11k_hw_ops qcn9074_ops = - .rx_desc_get_attention = ath11k_hw_qcn9074_rx_desc_get_attention, - .rx_desc_get_msdu_payload = ath11k_hw_qcn9074_rx_desc_get_msdu_payload, - .reo_setup = ath11k_hw_ipq8074_reo_setup, -- .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid, -+ .mpdu_info_get_peerid = ath11k_hw_qcn9074_mpdu_info_get_peerid, - .rx_desc_mac_addr2_valid = ath11k_hw_ipq9074_rx_desc_mac_addr2_valid, - .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq9074_rx_desc_mpdu_start_addr2, - .get_ring_selector = ath11k_hw_ipq8074_get_tcl_ring_selector, ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -263,7 +263,7 @@ struct ath11k_hw_ops { - struct rx_attention *(*rx_desc_get_attention)(struct hal_rx_desc *desc); - u8 *(*rx_desc_get_msdu_payload)(struct hal_rx_desc *desc); - void (*reo_setup)(struct ath11k_base *ab); -- u16 (*mpdu_info_get_peerid)(u8 *tlv_data); -+ u16 (*mpdu_info_get_peerid)(struct hal_rx_mpdu_info *mpdu_info); - bool (*rx_desc_mac_addr2_valid)(struct hal_rx_desc *desc); - u8* (*rx_desc_mpdu_start_addr2)(struct hal_rx_desc *desc); - u32 (*get_ring_selector)(struct sk_buff *skb); diff --git a/package/kernel/mac80211/patches/ath11k/0052-wifi-ath11k-Fix-invalid-management-rx-frame-length-i.patch b/package/kernel/mac80211/patches/ath11k/0052-wifi-ath11k-Fix-invalid-management-rx-frame-length-i.patch deleted file mode 100644 index 0c1637fb04c..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0052-wifi-ath11k-Fix-invalid-management-rx-frame-length-i.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 447b0398a9cd41ca343dfd43e555af92d6214487 Mon Sep 17 00:00:00 2001 -From: Bhagavathi Perumal S -Date: Fri, 24 Mar 2023 16:57:00 +0200 -Subject: [PATCH] wifi: ath11k: Fix invalid management rx frame length issue - -The WMI management rx event has multiple arrays of TLVs, however the common -WMI TLV parser won't handle multiple TLV tags of same type. -So the multiple array tags of WMI management rx TLV is parsed incorrectly -and the length calculated becomes wrong when the target sends multiple -array tags. - -Add separate TLV parser to handle multiple arrays for WMI management rx -TLV. This fixes invalid length issue when the target sends multiple array -tags. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Bhagavathi Perumal S -Co-developed-by: Nagarajan Maran -Signed-off-by: Nagarajan Maran -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230320133840.30162-1-quic_nmaran@quicinc.com ---- - drivers/net/wireless/ath/ath11k/wmi.c | 45 +++++++++++++++++++++------ - 1 file changed, 35 insertions(+), 10 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -82,6 +82,12 @@ struct wmi_tlv_fw_stats_parse { - bool chain_rssi_done; - }; - -+struct wmi_tlv_mgmt_rx_parse { -+ const struct wmi_mgmt_rx_hdr *fixed; -+ const u8 *frame_buf; -+ bool frame_buf_done; -+}; -+ - static const struct wmi_tlv_policy wmi_tlv_policies[] = { - [WMI_TAG_ARRAY_BYTE] - = { .min_len = 0 }, -@@ -5633,28 +5639,49 @@ static int ath11k_pull_vdev_stopped_para - return 0; - } - -+static int ath11k_wmi_tlv_mgmt_rx_parse(struct ath11k_base *ab, -+ u16 tag, u16 len, -+ const void *ptr, void *data) -+{ -+ struct wmi_tlv_mgmt_rx_parse *parse = data; -+ -+ switch (tag) { -+ case WMI_TAG_MGMT_RX_HDR: -+ parse->fixed = ptr; -+ break; -+ case WMI_TAG_ARRAY_BYTE: -+ if (!parse->frame_buf_done) { -+ parse->frame_buf = ptr; -+ parse->frame_buf_done = true; -+ } -+ break; -+ } -+ return 0; -+} -+ - static int ath11k_pull_mgmt_rx_params_tlv(struct ath11k_base *ab, - struct sk_buff *skb, - struct mgmt_rx_event_params *hdr) - { -- const void **tb; -+ struct wmi_tlv_mgmt_rx_parse parse = { }; - const struct wmi_mgmt_rx_hdr *ev; - const u8 *frame; - int ret; - -- tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); -- if (IS_ERR(tb)) { -- ret = PTR_ERR(tb); -- ath11k_warn(ab, "failed to parse tlv: %d\n", ret); -+ ret = ath11k_wmi_tlv_iter(ab, skb->data, skb->len, -+ ath11k_wmi_tlv_mgmt_rx_parse, -+ &parse); -+ if (ret) { -+ ath11k_warn(ab, "failed to parse mgmt rx tlv %d\n", -+ ret); - return ret; - } - -- ev = tb[WMI_TAG_MGMT_RX_HDR]; -- frame = tb[WMI_TAG_ARRAY_BYTE]; -+ ev = parse.fixed; -+ frame = parse.frame_buf; - - if (!ev || !frame) { - ath11k_warn(ab, "failed to fetch mgmt rx hdr"); -- kfree(tb); - return -EPROTO; - } - -@@ -5673,7 +5700,6 @@ static int ath11k_pull_mgmt_rx_params_tl - - if (skb->len < (frame - skb->data) + hdr->buf_len) { - ath11k_warn(ab, "invalid length in mgmt rx hdr ev"); -- kfree(tb); - return -EPROTO; - } - -@@ -5685,7 +5711,6 @@ static int ath11k_pull_mgmt_rx_params_tl - - ath11k_ce_byte_swap(skb->data, hdr->buf_len); - -- kfree(tb); - return 0; - } - diff --git a/package/kernel/mac80211/patches/ath11k/0053-wifi-ath11k-fix-writing-to-unintended-memory-region.patch b/package/kernel/mac80211/patches/ath11k/0053-wifi-ath11k-fix-writing-to-unintended-memory-region.patch deleted file mode 100644 index 7b8a7d45431..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0053-wifi-ath11k-fix-writing-to-unintended-memory-region.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 756a7f90878f0866fd2fe167ef37e90b47326b96 Mon Sep 17 00:00:00 2001 -From: P Praneesh -Date: Fri, 24 Mar 2023 16:57:01 +0200 -Subject: [PATCH] wifi: ath11k: fix writing to unintended memory region - -While initializing spectral, the magic value is getting written to the -invalid memory address leading to random boot-up crash. This occurs -due to the incorrect index increment in ath11k_dbring_fill_magic_value -function. Fix it by replacing the existing logic with memset32 to ensure -there is no invalid memory access. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01838-QCAHKSWPL_SILICONZ-1 - -Fixes: d3d358efc553 ("ath11k: add spectral/CFR buffer validation support") -Signed-off-by: P Praneesh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230321052900.16895-1-quic_ppranees@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dbring.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dbring.c -+++ b/drivers/net/wireless/ath/ath11k/dbring.c -@@ -26,13 +26,13 @@ int ath11k_dbring_validate_buffer(struct - static void ath11k_dbring_fill_magic_value(struct ath11k *ar, - void *buffer, u32 size) - { -- u32 *temp; -- int idx; -+ /* memset32 function fills buffer payload with the ATH11K_DB_MAGIC_VALUE -+ * and the variable size is expected to be the number of u32 values -+ * to be stored, not the number of bytes. -+ */ -+ size = size / sizeof(u32); - -- size = size >> 2; -- -- for (idx = 0, temp = buffer; idx < size; idx++, temp++) -- *temp++ = ATH11K_DB_MAGIC_VALUE; -+ memset32(buffer, ATH11K_DB_MAGIC_VALUE, size); - } - - static int ath11k_dbring_bufs_replenish(struct ath11k *ar, diff --git a/package/kernel/mac80211/patches/ath11k/0054-wifi-ath11k-Send-11d-scan-start-before-WMI_START_SCA.patch b/package/kernel/mac80211/patches/ath11k/0054-wifi-ath11k-Send-11d-scan-start-before-WMI_START_SCA.patch deleted file mode 100644 index 0f8e6375921..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0054-wifi-ath11k-Send-11d-scan-start-before-WMI_START_SCA.patch +++ /dev/null @@ -1,61 +0,0 @@ -From e89a51aedf380bc60219dc9afa96c36507060fb3 Mon Sep 17 00:00:00 2001 -From: Manikanta Pubbisetty -Date: Wed, 15 Mar 2023 21:48:17 +0530 -Subject: [PATCH] wifi: ath11k: Send 11d scan start before WMI_START_SCAN_CMDID - -Firmwares advertising the support of triggering 11d algorithm on the -scan results of a regular scan expects driver to send -WMI_11D_SCAN_START_CMDID before sending WMI_START_SCAN_CMDID. -Triggering 11d algorithm on the scan results of a normal scan helps -in completely avoiding a separate 11d scan for determining regdomain. -This indirectly helps in speeding up connections on station -interfaces on the chipsets supporting 11D scan. - -To enable this feature, send WMI_11D_SCAN_START_CMDID just before -sending WMI_START_SCAN_CMDID if the firmware advertises -WMI_TLV_SERVICE_SUPPORT_11D_FOR_HOST_SCAN service flag. - -WCN6750 & WCN6855 supports this feature. - -Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-01160-QCAMSLSWPLZ-1 -Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 - -Signed-off-by: Manikanta Pubbisetty -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230315161817.29627-1-quic_mpubbise@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 12 ++++++++++++ - drivers/net/wireless/ath/ath11k/wmi.h | 1 + - 2 files changed, 13 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3755,6 +3755,18 @@ static int ath11k_mac_op_hw_scan(struct - int i; - u32 scan_timeout; - -+ /* Firmwares advertising the support of triggering 11D algorithm -+ * on the scan results of a regular scan expects driver to send -+ * WMI_11D_SCAN_START_CMDID before sending WMI_START_SCAN_CMDID. -+ * With this feature, separate 11D scan can be avoided since -+ * regdomain can be determined with the scan results of the -+ * regular scan. -+ */ -+ if (ar->state_11d == ATH11K_11D_PREPARING && -+ test_bit(WMI_TLV_SERVICE_SUPPORT_11D_FOR_HOST_SCAN, -+ ar->ab->wmi_ab.svc_map)) -+ ath11k_mac_11d_scan_start(ar, arvif->vdev_id); -+ - mutex_lock(&ar->conf_mutex); - - spin_lock_bh(&ar->data_lock); ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2103,6 +2103,7 @@ enum wmi_tlv_service { - WMI_TLV_SERVICE_SCAN_CONFIG_PER_CHANNEL = 265, - WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT = 281, - WMI_TLV_SERVICE_BIOS_SAR_SUPPORT = 326, -+ WMI_TLV_SERVICE_SUPPORT_11D_FOR_HOST_SCAN = 357, - - /* The third 128 bits */ - WMI_MAX_EXT2_SERVICE = 384 diff --git a/package/kernel/mac80211/patches/ath11k/0055-wifi-ath11k-Remove-redundant-pci_clear_master.patch b/package/kernel/mac80211/patches/ath11k/0055-wifi-ath11k-Remove-redundant-pci_clear_master.patch deleted file mode 100644 index 0439727e72f..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0055-wifi-ath11k-Remove-redundant-pci_clear_master.patch +++ /dev/null @@ -1,58 +0,0 @@ -From f812e2a9f85d6bea78957ccb5197e4491316848b Mon Sep 17 00:00:00 2001 -From: Cai Huoqing -Date: Thu, 23 Mar 2023 19:26:09 +0800 -Subject: [PATCH] wifi: ath11k: Remove redundant pci_clear_master - -Remove pci_clear_master to simplify the code, -the bus-mastering is also cleared in do_pci_disable_device, -like this: -./drivers/pci/pci.c:2197 -static void do_pci_disable_device(struct pci_dev *dev) -{ - u16 pci_command; - - pci_read_config_word(dev, PCI_COMMAND, &pci_command); - if (pci_command & PCI_COMMAND_MASTER) { - pci_command &= ~PCI_COMMAND_MASTER; - pci_write_config_word(dev, PCI_COMMAND, pci_command); - } - - pcibios_disable_device(dev); -}. -And dev->is_busmaster is set to 0 in pci_disable_device. - -Signed-off-by: Cai Huoqing -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230323112613.7550-1-cai.huoqing@linux.dev ---- - drivers/net/wireless/ath/ath11k/pci.c | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -540,7 +540,7 @@ static int ath11k_pci_claim(struct ath11 - if (!ab->mem) { - ath11k_err(ab, "failed to map pci bar %d\n", ATH11K_PCI_BAR_NUM); - ret = -EIO; -- goto clear_master; -+ goto release_region; - } - - ab->mem_ce = ab->mem; -@@ -548,8 +548,6 @@ static int ath11k_pci_claim(struct ath11 - ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot pci_mem 0x%pK\n", ab->mem); - return 0; - --clear_master: -- pci_clear_master(pdev); - release_region: - pci_release_region(pdev, ATH11K_PCI_BAR_NUM); - disable_device: -@@ -565,7 +563,6 @@ static void ath11k_pci_free_region(struc - - pci_iounmap(pci_dev, ab->mem); - ab->mem = NULL; -- pci_clear_master(pci_dev); - pci_release_region(pci_dev, ATH11K_PCI_BAR_NUM); - if (pci_is_enabled(pci_dev)) - pci_disable_device(pci_dev); diff --git a/package/kernel/mac80211/patches/ath11k/0056-wifi-ath11k-Disable-Spectral-scan-upon-removing-inte.patch b/package/kernel/mac80211/patches/ath11k/0056-wifi-ath11k-Disable-Spectral-scan-upon-removing-inte.patch deleted file mode 100644 index 44532a4d720..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0056-wifi-ath11k-Disable-Spectral-scan-upon-removing-inte.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 5c690db63b45c6c4c4932b13173af71df369dba5 Mon Sep 17 00:00:00 2001 -From: Tamizh Chelvam Raja -Date: Tue, 28 Mar 2023 12:41:50 +0530 -Subject: [PATCH] wifi: ath11k: Disable Spectral scan upon removing interface - -Host might receive spectral events during interface -down sequence and this might create below errors. - -failed to handle dma buf release event -22 -failed to handle dma buf release event -22 - -Fix this by disabling spectral config during remove interface. - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Tamizh Chelvam Raja -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230328071150.29645-1-quic_tamizhr@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6685,6 +6685,11 @@ static void ath11k_mac_op_remove_interfa - ath11k_dbg(ab, ATH11K_DBG_MAC, "mac remove interface (vdev %d)\n", - arvif->vdev_id); - -+ ret = ath11k_spectral_vif_stop(arvif); -+ if (ret) -+ ath11k_warn(ab, "failed to stop spectral for vdev %i: %d\n", -+ arvif->vdev_id, ret); -+ - if (arvif->vdev_type == WMI_VDEV_TYPE_STA) - ath11k_mac_11d_scan_stop(ar); - diff --git a/package/kernel/mac80211/patches/ath11k/0057-wifi-ath11k-enable-SAR-support-on-WCN6750.patch b/package/kernel/mac80211/patches/ath11k/0057-wifi-ath11k-enable-SAR-support-on-WCN6750.patch deleted file mode 100644 index 5e64e552c1d..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0057-wifi-ath11k-enable-SAR-support-on-WCN6750.patch +++ /dev/null @@ -1,29 +0,0 @@ -From abf57d84973ce1abcb67504ac0df8aea1fe09a76 Mon Sep 17 00:00:00 2001 -From: Youghandhar Chintala -Date: Tue, 28 Mar 2023 17:04:55 +0530 -Subject: [PATCH] wifi: ath11k: enable SAR support on WCN6750 - -Currently, SAR is enabled only on WCN6855, enable this for WCN6750 too. This -functionality gets triggered, when the user space application calls -NL80211_CMD_SET_SAR_SPECS. - -Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 - -Signed-off-by: Youghandhar Chintala -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230328113455.11252-1-quic_youghand@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -593,7 +593,7 @@ static const struct ath11k_hw_params ath - .current_cc_support = true, - .dbr_debug_support = false, - .global_reset = false, -- .bios_sar_capa = NULL, -+ .bios_sar_capa = &ath11k_hw_sar_capa_wcn6855, - .m3_fw_support = false, - .fixed_bdf_addr = false, - .fixed_mem_region = false, diff --git a/package/kernel/mac80211/patches/ath11k/0058-wifi-ath11k-pci-Add-more-MODULE_FIRMWARE-entries.patch b/package/kernel/mac80211/patches/ath11k/0058-wifi-ath11k-pci-Add-more-MODULE_FIRMWARE-entries.patch deleted file mode 100644 index 585864eff2e..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0058-wifi-ath11k-pci-Add-more-MODULE_FIRMWARE-entries.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 06c58473969239e00d76b683edd511952060ca56 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Thu, 30 Mar 2023 16:37:18 +0200 -Subject: [PATCH] wifi: ath11k: pci: Add more MODULE_FIRMWARE() entries - -As there are a few more models supported by the driver, let's add the -missing MODULE_FIRMWARE() entries for them. The lack of them resulted -in the missing device enablement on some systems, such as the -installation image of openSUSE. - -While we are at it, use the wildcard instead of listing each firmware -files individually for each. - -Signed-off-by: Takashi Iwai -Reviewed-by: Simon Horman -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230330143718.19511-1-tiwai@suse.de ---- - drivers/net/wireless/ath/ath11k/pci.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -1036,7 +1036,8 @@ module_exit(ath11k_pci_exit); - MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11ax WLAN PCIe devices"); - MODULE_LICENSE("Dual BSD/GPL"); - --/* QCA639x 2.0 firmware files */ --MODULE_FIRMWARE(ATH11K_FW_DIR "/QCA6390/hw2.0/" ATH11K_BOARD_API2_FILE); --MODULE_FIRMWARE(ATH11K_FW_DIR "/QCA6390/hw2.0/" ATH11K_AMSS_FILE); --MODULE_FIRMWARE(ATH11K_FW_DIR "/QCA6390/hw2.0/" ATH11K_M3_FILE); -+/* firmware files */ -+MODULE_FIRMWARE(ATH11K_FW_DIR "/QCA6390/hw2.0/*"); -+MODULE_FIRMWARE(ATH11K_FW_DIR "/QCN9074/hw1.0/*"); -+MODULE_FIRMWARE(ATH11K_FW_DIR "/WCN6855/hw2.0/*"); -+MODULE_FIRMWARE(ATH11K_FW_DIR "/WCN6855/hw2.1/*"); diff --git a/package/kernel/mac80211/patches/ath11k/0059-wifi-ath11k-print-a-warning-when-crypto_alloc_shash-.patch b/package/kernel/mac80211/patches/ath11k/0059-wifi-ath11k-print-a-warning-when-crypto_alloc_shash-.patch deleted file mode 100644 index fab52a0fa7b..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0059-wifi-ath11k-print-a-warning-when-crypto_alloc_shash-.patch +++ /dev/null @@ -1,34 +0,0 @@ -From a87a9110ac0dcbfd9458b6665c141fa1c16a669d Mon Sep 17 00:00:00 2001 -From: Kalle Valo -Date: Wed, 5 Apr 2023 12:04:25 +0300 -Subject: [PATCH] wifi: ath11k: print a warning when crypto_alloc_shash() fails - -Christoph reported that ath11k failed to initialise when michael_mic.ko -module was not installed. To make it easier to notice that case print a -warning when crypto_alloc_shash() fails. - -Compile tested only. - -Reported-by: Christoph Hellwig -Link: https://lore.kernel.org/all/20221130133016.GC3055@lst.de/ -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405090425.1351-1-kvalo@kernel.org ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -3106,8 +3106,11 @@ int ath11k_peer_rx_frag_setup(struct ath - int i; - - tfm = crypto_alloc_shash("michael_mic", 0, 0); -- if (IS_ERR(tfm)) -+ if (IS_ERR(tfm)) { -+ ath11k_warn(ab, "failed to allocate michael_mic shash: %ld\n", -+ PTR_ERR(tfm)); - return PTR_ERR(tfm); -+ } - - spin_lock_bh(&ab->base_lock); - diff --git a/package/kernel/mac80211/patches/ath11k/0060-wifi-ath11k-Ignore-frags-from-uninitialized-peer-in-.patch b/package/kernel/mac80211/patches/ath11k/0060-wifi-ath11k-Ignore-frags-from-uninitialized-peer-in-.patch deleted file mode 100644 index 5bbf9e04a4d..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0060-wifi-ath11k-Ignore-frags-from-uninitialized-peer-in-.patch +++ /dev/null @@ -1,104 +0,0 @@ -From a06bfb3c9f69f303692cdae87bc0899d2ae8b2a6 Mon Sep 17 00:00:00 2001 -From: Harshitha Prem -Date: Tue, 4 Apr 2023 00:11:54 +0530 -Subject: [PATCH] wifi: ath11k: Ignore frags from uninitialized peer in dp. - -When max virtual ap interfaces are configured in all the bands with -ACS and hostapd restart is done every 60s, a crash is observed at -random times. -In this certain scenario, a fragmented packet is received for -self peer, for which rx_tid and rx_frags are not initialized in -datapath. While handling this fragment, crash is observed as the -rx_frag list is uninitialised and when we walk in -ath11k_dp_rx_h_sort_frags, skb null leads to exception. - -To address this, before processing received fragments we check -dp_setup_done flag is set to ensure that peer has completed its -dp peer setup for fragment queue, else ignore processing the -fragments. - -Call trace: - ath11k_dp_process_rx_err+0x550/0x1084 [ath11k] - ath11k_dp_service_srng+0x70/0x370 [ath11k] - 0xffffffc009693a04 - __napi_poll+0x30/0xa4 - net_rx_action+0x118/0x270 - __do_softirq+0x10c/0x244 - irq_exit+0x64/0xb4 - __handle_domain_irq+0x88/0xac - gic_handle_irq+0x74/0xbc - el1_irq+0xf0/0x1c0 - arch_cpu_idle+0x10/0x18 - do_idle+0x104/0x248 - cpu_startup_entry+0x20/0x64 - rest_init+0xd0/0xdc - arch_call_rest_init+0xc/0x14 - start_kernel+0x480/0x4b8 - Code: f9400281 f94066a2 91405021 b94a0023 (f9406401) - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Harshitha Prem -Signed-off-by: Nagarajan Maran -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403184155.8670-2-quic_nmaran@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp.c | 4 +++- - drivers/net/wireless/ath/ath11k/dp_rx.c | 8 ++++++++ - drivers/net/wireless/ath/ath11k/peer.h | 1 + - 3 files changed, 12 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/dp.c -+++ b/drivers/net/wireless/ath/ath11k/dp.c -@@ -36,6 +36,7 @@ void ath11k_dp_peer_cleanup(struct ath11 - } - - ath11k_peer_rx_tid_cleanup(ar, peer); -+ peer->dp_setup_done = false; - crypto_free_shash(peer->tfm_mmic); - spin_unlock_bh(&ab->base_lock); - } -@@ -72,7 +73,8 @@ int ath11k_dp_peer_setup(struct ath11k * - ret = ath11k_peer_rx_frag_setup(ar, addr, vdev_id); - if (ret) { - ath11k_warn(ab, "failed to setup rx defrag context\n"); -- return ret; -+ tid--; -+ goto peer_clean; - } - - /* TODO: Setup other peer specific resource used in data path */ ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -3130,6 +3130,7 @@ int ath11k_peer_rx_frag_setup(struct ath - } - - peer->tfm_mmic = tfm; -+ peer->dp_setup_done = true; - spin_unlock_bh(&ab->base_lock); - - return 0; -@@ -3575,6 +3576,13 @@ static int ath11k_dp_rx_frag_h_mpdu(stru - ret = -ENOENT; - goto out_unlock; - } -+ if (!peer->dp_setup_done) { -+ ath11k_warn(ab, "The peer %pM [%d] has uninitialized datapath\n", -+ peer->addr, peer_id); -+ ret = -ENOENT; -+ goto out_unlock; -+ } -+ - rx_tid = &peer->rx_tid[tid]; - - if ((!skb_queue_empty(&rx_tid->rx_frags) && seqno != rx_tid->cur_sn) || ---- a/drivers/net/wireless/ath/ath11k/peer.h -+++ b/drivers/net/wireless/ath/ath11k/peer.h -@@ -35,6 +35,7 @@ struct ath11k_peer { - u16 sec_type; - u16 sec_type_grp; - bool is_authorized; -+ bool dp_setup_done; - }; - - void ath11k_peer_unmap_event(struct ath11k_base *ab, u16 peer_id); diff --git a/package/kernel/mac80211/patches/ath11k/0061-wifi-ath11k-fix-undefined-behavior-with-__fls-in-dp.patch b/package/kernel/mac80211/patches/ath11k/0061-wifi-ath11k-fix-undefined-behavior-with-__fls-in-dp.patch deleted file mode 100644 index d68c19f1609..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0061-wifi-ath11k-fix-undefined-behavior-with-__fls-in-dp.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 41e02bf4ae32cf2ac47b08b4caaa9c1a032e4ce7 Mon Sep 17 00:00:00 2001 -From: Harshitha Prem -Date: Tue, 4 Apr 2023 00:11:55 +0530 -Subject: [PATCH] wifi: ath11k: fix undefined behavior with __fls in dp - -"__fls" would have an undefined behavior if the argument is passed -as "0". Hence, added changes to handle the same. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Harshitha Prem -Signed-off-by: Nagarajan Maran -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403184155.8670-3-quic_nmaran@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -3598,7 +3598,7 @@ static int ath11k_dp_rx_frag_h_mpdu(stru - goto out_unlock; - } - -- if (frag_no > __fls(rx_tid->rx_frag_bitmap)) -+ if (!rx_tid->rx_frag_bitmap || (frag_no > __fls(rx_tid->rx_frag_bitmap))) - __skb_queue_tail(&rx_tid->rx_frags, msdu); - else - ath11k_dp_rx_h_sort_frags(ar, &rx_tid->rx_frags, msdu); diff --git a/package/kernel/mac80211/patches/ath11k/0062-wifi-ath11k-fix-double-free-of-peer-rx_tid-during-re.patch b/package/kernel/mac80211/patches/ath11k/0062-wifi-ath11k-fix-double-free-of-peer-rx_tid-during-re.patch deleted file mode 100644 index dd37b1e4fa8..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0062-wifi-ath11k-fix-double-free-of-peer-rx_tid-during-re.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 93a91f40c25c3d0e61f8540a7accf105090f9995 Mon Sep 17 00:00:00 2001 -From: Harshitha Prem -Date: Mon, 17 Apr 2023 13:35:00 +0300 -Subject: [PATCH] wifi: ath11k: fix double free of peer rx_tid during reo cmd - failure - -Peer rx_tid is locally copied thrice during peer_rx_tid_cleanup to -send REO_CMD_UPDATE_RX_QUEUE followed by REO_CMD_FLUSH_CACHE to flush -all aged REO descriptors from HW cache. - -When sending REO_CMD_FLUSH_CACHE fails, we do dma unmap of already -mapped rx_tid->vaddr and free it. This is not checked during -reo_cmd_list_cleanup() and dp_reo_cmd_free() before trying to free and -unmap again. - -Fix this by setting rx_tid->vaddr NULL in rx tid delete and also -wherever freeing it to check in reo_cmd_list_cleanup() and -reo_cmd_free() before trying to free again. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sathishkumar Muruganandam -Signed-off-by: Harshitha Prem -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403182420.23375-2-quic_hprem@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 43 ++++++++++++++++++------- - 1 file changed, 31 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -668,13 +668,18 @@ void ath11k_dp_reo_cmd_list_cleanup(stru - struct ath11k_dp *dp = &ab->dp; - struct dp_reo_cmd *cmd, *tmp; - struct dp_reo_cache_flush_elem *cmd_cache, *tmp_cache; -+ struct dp_rx_tid *rx_tid; - - spin_lock_bh(&dp->reo_cmd_lock); - list_for_each_entry_safe(cmd, tmp, &dp->reo_cmd_list, list) { - list_del(&cmd->list); -- dma_unmap_single(ab->dev, cmd->data.paddr, -- cmd->data.size, DMA_BIDIRECTIONAL); -- kfree(cmd->data.vaddr); -+ rx_tid = &cmd->data; -+ if (rx_tid->vaddr) { -+ dma_unmap_single(ab->dev, rx_tid->paddr, -+ rx_tid->size, DMA_BIDIRECTIONAL); -+ kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; -+ } - kfree(cmd); - } - -@@ -682,9 +687,13 @@ void ath11k_dp_reo_cmd_list_cleanup(stru - &dp->reo_cmd_cache_flush_list, list) { - list_del(&cmd_cache->list); - dp->reo_cmd_cache_flush_count--; -- dma_unmap_single(ab->dev, cmd_cache->data.paddr, -- cmd_cache->data.size, DMA_BIDIRECTIONAL); -- kfree(cmd_cache->data.vaddr); -+ rx_tid = &cmd_cache->data; -+ if (rx_tid->vaddr) { -+ dma_unmap_single(ab->dev, rx_tid->paddr, -+ rx_tid->size, DMA_BIDIRECTIONAL); -+ kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; -+ } - kfree(cmd_cache); - } - spin_unlock_bh(&dp->reo_cmd_lock); -@@ -698,10 +707,12 @@ static void ath11k_dp_reo_cmd_free(struc - if (status != HAL_REO_CMD_SUCCESS) - ath11k_warn(dp->ab, "failed to flush rx tid hw desc, tid %d status %d\n", - rx_tid->tid, status); -- -- dma_unmap_single(dp->ab->dev, rx_tid->paddr, rx_tid->size, -- DMA_BIDIRECTIONAL); -- kfree(rx_tid->vaddr); -+ if (rx_tid->vaddr) { -+ dma_unmap_single(dp->ab->dev, rx_tid->paddr, rx_tid->size, -+ DMA_BIDIRECTIONAL); -+ kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; -+ } - } - - static void ath11k_dp_reo_cache_flush(struct ath11k_base *ab, -@@ -740,6 +751,7 @@ static void ath11k_dp_reo_cache_flush(st - dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size, - DMA_BIDIRECTIONAL); - kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; - } - } - -@@ -792,6 +804,7 @@ free_desc: - dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size, - DMA_BIDIRECTIONAL); - kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; - } - - void ath11k_peer_rx_tid_delete(struct ath11k *ar, -@@ -804,6 +817,8 @@ void ath11k_peer_rx_tid_delete(struct at - if (!rx_tid->active) - return; - -+ rx_tid->active = false; -+ - cmd.flag = HAL_REO_CMD_FLG_NEED_STATUS; - cmd.addr_lo = lower_32_bits(rx_tid->paddr); - cmd.addr_hi = upper_32_bits(rx_tid->paddr); -@@ -818,9 +833,11 @@ void ath11k_peer_rx_tid_delete(struct at - dma_unmap_single(ar->ab->dev, rx_tid->paddr, rx_tid->size, - DMA_BIDIRECTIONAL); - kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; - } - -- rx_tid->active = false; -+ rx_tid->paddr = 0; -+ rx_tid->size = 0; - } - - static int ath11k_dp_rx_link_desc_return(struct ath11k_base *ab, -@@ -967,6 +984,7 @@ static void ath11k_dp_rx_tid_mem_free(st - dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size, - DMA_BIDIRECTIONAL); - kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; - - rx_tid->active = false; - -@@ -1067,7 +1085,8 @@ int ath11k_peer_rx_tid_setup(struct ath1 - return ret; - - err_mem_free: -- kfree(vaddr); -+ kfree(rx_tid->vaddr); -+ rx_tid->vaddr = NULL; - - return ret; - } diff --git a/package/kernel/mac80211/patches/ath11k/0063-wifi-ath11k-Prevent-REO-cmd-failures.patch b/package/kernel/mac80211/patches/ath11k/0063-wifi-ath11k-Prevent-REO-cmd-failures.patch deleted file mode 100644 index 4b9af180620..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0063-wifi-ath11k-Prevent-REO-cmd-failures.patch +++ /dev/null @@ -1,43 +0,0 @@ -From a8ae833657a45746debde85c38bb7f070d344026 Mon Sep 17 00:00:00 2001 -From: Harshitha Prem -Date: Mon, 17 Apr 2023 13:35:01 +0300 -Subject: [PATCH] wifi: ath11k: Prevent REO cmd failures - -Prevent REO cmd failures causing double free by increasing REO cmd -ring size and moving REO status ring mask to IRQ group 3 from group -0 to separate from tx completion ring on IRQ group 0 which may delay -reo status processing. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sathishkumar Muruganandam -Signed-off-by: Harshitha Prem -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403182420.23375-3-quic_hprem@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp.h | 2 +- - drivers/net/wireless/ath/ath11k/hw.c | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/dp.h -+++ b/drivers/net/wireless/ath/ath11k/dp.h -@@ -214,7 +214,7 @@ struct ath11k_pdev_dp { - #define DP_REO_REINJECT_RING_SIZE 32 - #define DP_RX_RELEASE_RING_SIZE 1024 - #define DP_REO_EXCEPTION_RING_SIZE 128 --#define DP_REO_CMD_RING_SIZE 128 -+#define DP_REO_CMD_RING_SIZE 256 - #define DP_REO_STATUS_RING_SIZE 2048 - #define DP_RXDMA_BUF_RING_SIZE 4096 - #define DP_RXDMA_REFILL_RING_SIZE 2048 ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -1233,6 +1233,7 @@ const struct ath11k_hw_ring_mask ath11k_ - ATH11K_RX_WBM_REL_RING_MASK_0, - }, - .reo_status = { -+ 0, 0, 0, - ATH11K_REO_STATUS_RING_MASK_0, - }, - .rxdma2host = { diff --git a/package/kernel/mac80211/patches/ath11k/0064-wifi-ath11k-add-peer-mac-information-in-failure-case.patch b/package/kernel/mac80211/patches/ath11k/0064-wifi-ath11k-add-peer-mac-information-in-failure-case.patch deleted file mode 100644 index fbcbdfff712..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0064-wifi-ath11k-add-peer-mac-information-in-failure-case.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 20487cc3ff36bbfa9505f0a078ba98f09abfc717 Mon Sep 17 00:00:00 2001 -From: Harshitha Prem -Date: Mon, 17 Apr 2023 13:35:01 +0300 -Subject: [PATCH] wifi: ath11k: add peer mac information in failure cases - -During reo command failure, the peer mac detail for which the reo -command was not successful is unknown. Hence, to improve the -debuggability, add the peer mac information in the failure cases -which would be useful during multi client cases. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sathishkumar Muruganandam -Signed-off-by: Harshitha Prem -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403182420.23375-4-quic_hprem@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 16 ++++++++++------ - 1 file changed, 10 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -1009,7 +1009,8 @@ int ath11k_peer_rx_tid_setup(struct ath1 - - peer = ath11k_peer_find(ab, vdev_id, peer_mac); - if (!peer) { -- ath11k_warn(ab, "failed to find the peer to set up rx tid\n"); -+ ath11k_warn(ab, "failed to find the peer %pM to set up rx tid\n", -+ peer_mac); - spin_unlock_bh(&ab->base_lock); - return -ENOENT; - } -@@ -1022,7 +1023,8 @@ int ath11k_peer_rx_tid_setup(struct ath1 - ba_win_sz, ssn, true); - spin_unlock_bh(&ab->base_lock); - if (ret) { -- ath11k_warn(ab, "failed to update reo for rx tid %d\n", tid); -+ ath11k_warn(ab, "failed to update reo for peer %pM rx tid %d\n: %d", -+ peer_mac, tid, ret); - return ret; - } - -@@ -1030,8 +1032,8 @@ int ath11k_peer_rx_tid_setup(struct ath1 - peer_mac, paddr, - tid, 1, ba_win_sz); - if (ret) -- ath11k_warn(ab, "failed to send wmi command to update rx reorder queue, tid :%d (%d)\n", -- tid, ret); -+ ath11k_warn(ab, "failed to send wmi rx reorder queue for peer %pM tid %d: %d\n", -+ peer_mac, tid, ret); - return ret; - } - -@@ -1064,6 +1066,8 @@ int ath11k_peer_rx_tid_setup(struct ath1 - ret = dma_mapping_error(ab->dev, paddr); - if (ret) { - spin_unlock_bh(&ab->base_lock); -+ ath11k_warn(ab, "failed to setup dma map for peer %pM rx tid %d: %d\n", -+ peer_mac, tid, ret); - goto err_mem_free; - } - -@@ -1077,8 +1081,8 @@ int ath11k_peer_rx_tid_setup(struct ath1 - ret = ath11k_wmi_peer_rx_reorder_queue_setup(ar, vdev_id, peer_mac, - paddr, tid, 1, ba_win_sz); - if (ret) { -- ath11k_warn(ar->ab, "failed to setup rx reorder queue, tid :%d (%d)\n", -- tid, ret); -+ ath11k_warn(ar->ab, "failed to setup rx reorder queue for peer %pM tid %d: %d\n", -+ peer_mac, tid, ret); - ath11k_dp_rx_tid_mem_free(ab, peer_mac, vdev_id, tid); - } - diff --git a/package/kernel/mac80211/patches/ath11k/0065-wifi-ath11k-fix-tx-status-reporting-in-encap-offload.patch b/package/kernel/mac80211/patches/ath11k/0065-wifi-ath11k-fix-tx-status-reporting-in-encap-offload.patch deleted file mode 100644 index e2fe419158f..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0065-wifi-ath11k-fix-tx-status-reporting-in-encap-offload.patch +++ /dev/null @@ -1,119 +0,0 @@ -From 6257c702264c44d74c6b71f0c62a7665da2dc356 Mon Sep 17 00:00:00 2001 -From: Pradeep Kumar Chitrapu -Date: Mon, 17 Apr 2023 13:35:02 +0300 -Subject: [PATCH] wifi: ath11k: fix tx status reporting in encap offload mode - -ieee80211_tx_status() treats packets in 802.11 frame format and -tries to extract sta address from packet header. When tx encap -offload is enabled, this becomes invalid operation. Hence, switch -to using ieee80211_tx_status_ext() after filling in station -address for handling both 802.11 and 802.3 frames. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Pradeep Kumar Chitrapu -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403195738.25367-2-quic_pradeepc@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp.h | 4 +++ - drivers/net/wireless/ath/ath11k/dp_tx.c | 33 ++++++++++++++++++++++++- - drivers/net/wireless/ath/ath11k/dp_tx.h | 1 + - 3 files changed, 37 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/dp.h -+++ b/drivers/net/wireless/ath/ath11k/dp.h -@@ -303,12 +303,16 @@ struct ath11k_dp { - - #define HTT_TX_WBM_COMP_STATUS_OFFSET 8 - -+#define HTT_INVALID_PEER_ID 0xffff -+ - /* HTT tx completion is overlaid in wbm_release_ring */ - #define HTT_TX_WBM_COMP_INFO0_STATUS GENMASK(12, 9) - #define HTT_TX_WBM_COMP_INFO0_REINJECT_REASON GENMASK(16, 13) - #define HTT_TX_WBM_COMP_INFO0_REINJECT_REASON GENMASK(16, 13) - - #define HTT_TX_WBM_COMP_INFO1_ACK_RSSI GENMASK(31, 24) -+#define HTT_TX_WBM_COMP_INFO2_SW_PEER_ID GENMASK(15, 0) -+#define HTT_TX_WBM_COMP_INFO2_VALID BIT(21) - - struct htt_tx_wbm_completion { - u32 info0; ---- a/drivers/net/wireless/ath/ath11k/dp_tx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_tx.c -@@ -316,10 +316,12 @@ ath11k_dp_tx_htt_tx_complete_buf(struct - struct dp_tx_ring *tx_ring, - struct ath11k_dp_htt_wbm_tx_status *ts) - { -+ struct ieee80211_tx_status status = { 0 }; - struct sk_buff *msdu; - struct ieee80211_tx_info *info; - struct ath11k_skb_cb *skb_cb; - struct ath11k *ar; -+ struct ath11k_peer *peer; - - spin_lock(&tx_ring->tx_idr_lock); - msdu = idr_remove(&tx_ring->txbuf_idr, ts->msdu_id); -@@ -341,6 +343,11 @@ ath11k_dp_tx_htt_tx_complete_buf(struct - - dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); - -+ if (!skb_cb->vif) { -+ dev_kfree_skb_any(msdu); -+ return; -+ } -+ - memset(&info->status, 0, sizeof(info->status)); - - if (ts->acked) { -@@ -355,7 +362,23 @@ ath11k_dp_tx_htt_tx_complete_buf(struct - } - } - -- ieee80211_tx_status(ar->hw, msdu); -+ spin_lock_bh(&ab->base_lock); -+ peer = ath11k_peer_find_by_id(ab, ts->peer_id); -+ if (!peer || !peer->sta) { -+ ath11k_dbg(ab, ATH11K_DBG_DATA, -+ "dp_tx: failed to find the peer with peer_id %d\n", -+ ts->peer_id); -+ spin_unlock_bh(&ab->base_lock); -+ dev_kfree_skb_any(msdu); -+ return; -+ } -+ spin_unlock_bh(&ab->base_lock); -+ -+ status.sta = peer->sta; -+ status.info = info; -+ status.skb = msdu; -+ -+ ieee80211_tx_status_ext(ar->hw, &status); - } - - static void -@@ -379,7 +402,15 @@ ath11k_dp_tx_process_htt_tx_complete(str - ts.msdu_id = msdu_id; - ts.ack_rssi = FIELD_GET(HTT_TX_WBM_COMP_INFO1_ACK_RSSI, - status_desc->info1); -+ -+ if (FIELD_GET(HTT_TX_WBM_COMP_INFO2_VALID, status_desc->info2)) -+ ts.peer_id = FIELD_GET(HTT_TX_WBM_COMP_INFO2_SW_PEER_ID, -+ status_desc->info2); -+ else -+ ts.peer_id = HTT_INVALID_PEER_ID; -+ - ath11k_dp_tx_htt_tx_complete_buf(ab, tx_ring, &ts); -+ - break; - case HAL_WBM_REL_HTT_TX_COMP_STATUS_REINJ: - case HAL_WBM_REL_HTT_TX_COMP_STATUS_INSPECT: ---- a/drivers/net/wireless/ath/ath11k/dp_tx.h -+++ b/drivers/net/wireless/ath/ath11k/dp_tx.h -@@ -13,6 +13,7 @@ struct ath11k_dp_htt_wbm_tx_status { - u32 msdu_id; - bool acked; - int ack_rssi; -+ u16 peer_id; - }; - - void ath11k_dp_tx_update_txcompl(struct ath11k *ar, struct hal_tx_status *ts); diff --git a/package/kernel/mac80211/patches/ath11k/0066-wifi-ath11k-Fix-incorrect-update-of-radiotap-fields.patch b/package/kernel/mac80211/patches/ath11k/0066-wifi-ath11k-Fix-incorrect-update-of-radiotap-fields.patch deleted file mode 100644 index 4f94580100f..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0066-wifi-ath11k-Fix-incorrect-update-of-radiotap-fields.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 2f0c9ac8362da09c80f1cd422ef7fd6fa9b252b9 Mon Sep 17 00:00:00 2001 -From: Pradeep Kumar Chitrapu -Date: Mon, 17 Apr 2023 13:35:02 +0300 -Subject: [PATCH] wifi: ath11k: Fix incorrect update of radiotap fields - -Fix incorrect update of ppdu stats causing incorrect radiotap -fields. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Pradeep Kumar Chitrapu -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403195738.25367-3-quic_pradeepc@quicinc.com ---- - drivers/net/wireless/ath/ath11k/hal_rx.c | 4 ++-- - drivers/net/wireless/ath/ath11k/hal_rx.h | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/hal_rx.c -+++ b/drivers/net/wireless/ath/ath11k/hal_rx.c -@@ -1029,7 +1029,7 @@ ath11k_hal_rx_parse_mon_status_tlv(struc - info1 = __le32_to_cpu(vht_sig->info1); - - ppdu_info->ldpc = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_SU_MU_CODING, -- info0); -+ info1); - ppdu_info->mcs = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_MCS, - info1); - gi_setting = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_GI_SETTING, -@@ -1452,7 +1452,7 @@ ath11k_hal_rx_parse_mon_status_tlv(struc - * PHYRX_OTHER_RECEIVE_INFO TLV. - */ - ppdu_info->rssi_comb = -- FIELD_GET(HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB, -+ FIELD_GET(HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RSSI_COMB, - __le32_to_cpu(rssi->info0)); - - if (db2dbm) { ---- a/drivers/net/wireless/ath/ath11k/hal_rx.h -+++ b/drivers/net/wireless/ath/ath11k/hal_rx.h -@@ -385,7 +385,7 @@ struct hal_rx_he_sig_b2_ofdma_info { - __le32 info0; - } __packed; - --#define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB GENMASK(15, 8) -+#define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RSSI_COMB GENMASK(15, 8) - - #define HAL_RX_PHYRX_RSSI_PREAMBLE_PRI20 GENMASK(7, 0) - diff --git a/package/kernel/mac80211/patches/ath11k/0067-wifi-ath11k-Fix-SKB-corruption-in-REO-destination-ri.patch b/package/kernel/mac80211/patches/ath11k/0067-wifi-ath11k-Fix-SKB-corruption-in-REO-destination-ri.patch deleted file mode 100644 index 8b300f3a790..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0067-wifi-ath11k-Fix-SKB-corruption-in-REO-destination-ri.patch +++ /dev/null @@ -1,70 +0,0 @@ -From f9fff67d2d7ca6fa8066132003a3deef654c55b1 Mon Sep 17 00:00:00 2001 -From: Nagarajan Maran -Date: Mon, 17 Apr 2023 13:35:02 +0300 -Subject: [PATCH] wifi: ath11k: Fix SKB corruption in REO destination ring - -While running traffics for a long time, randomly an RX descriptor -filled with value "0" from REO destination ring is received. -This descriptor which is invalid causes the wrong SKB (SKB stored in -the IDR lookup with buffer id "0") to be fetched which in turn -causes SKB memory corruption issue and the same leads to crash -after some time. - -Changed the start id for idr allocation to "1" and the buffer id "0" -is reserved for error validation. Introduced Sanity check to validate -the descriptor, before processing the SKB. - -Crash Signature : - -Unable to handle kernel paging request at virtual address 3f004900 -PC points to "b15_dma_inv_range+0x30/0x50" -LR points to "dma_cache_maint_page+0x8c/0x128". -The Backtrace obtained is as follows: -[<8031716c>] (b15_dma_inv_range) from [<80313a4c>] (dma_cache_maint_page+0x8c/0x128) -[<80313a4c>] (dma_cache_maint_page) from [<80313b90>] (__dma_page_dev_to_cpu+0x28/0xcc) -[<80313b90>] (__dma_page_dev_to_cpu) from [<7fb5dd68>] (ath11k_dp_process_rx+0x1e8/0x4a4 [ath11k]) -[<7fb5dd68>] (ath11k_dp_process_rx [ath11k]) from [<7fb53c20>] (ath11k_dp_service_srng+0xb0/0x2ac [ath11k]) -[<7fb53c20>] (ath11k_dp_service_srng [ath11k]) from [<7f67bba4>] (ath11k_pci_ext_grp_napi_poll+0x1c/0x78 [ath11k_pci]) -[<7f67bba4>] (ath11k_pci_ext_grp_napi_poll [ath11k_pci]) from [<807d5cf4>] (__napi_poll+0x28/0xb8) -[<807d5cf4>] (__napi_poll) from [<807d5f28>] (net_rx_action+0xf0/0x280) -[<807d5f28>] (net_rx_action) from [<80302148>] (__do_softirq+0xd0/0x280) -[<80302148>] (__do_softirq) from [<80320408>] (irq_exit+0x74/0xd4) -[<80320408>] (irq_exit) from [<803638a4>] (__handle_domain_irq+0x90/0xb4) -[<803638a4>] (__handle_domain_irq) from [<805bedec>] (gic_handle_irq+0x58/0x90) -[<805bedec>] (gic_handle_irq) from [<80301a78>] (__irq_svc+0x58/0x8c) - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Nagarajan Maran -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230403191533.28114-1-quic_nmaran@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -389,10 +389,10 @@ int ath11k_dp_rxbufs_replenish(struct at - goto fail_free_skb; - - spin_lock_bh(&rx_ring->idr_lock); -- buf_id = idr_alloc(&rx_ring->bufs_idr, skb, 0, -- rx_ring->bufs_max * 3, GFP_ATOMIC); -+ buf_id = idr_alloc(&rx_ring->bufs_idr, skb, 1, -+ (rx_ring->bufs_max * 3) + 1, GFP_ATOMIC); - spin_unlock_bh(&rx_ring->idr_lock); -- if (buf_id < 0) -+ if (buf_id <= 0) - goto fail_dma_unmap; - - desc = ath11k_hal_srng_src_get_next_entry(ab, srng); -@@ -2665,6 +2665,9 @@ try_again: - cookie); - mac_id = FIELD_GET(DP_RXDMA_BUF_COOKIE_PDEV_ID, cookie); - -+ if (unlikely(buf_id == 0)) -+ continue; -+ - ar = ab->pdevs[mac_id].ar; - rx_ring = &ar->dp.rx_refill_buf_ring; - spin_lock_bh(&rx_ring->idr_lock); diff --git a/package/kernel/mac80211/patches/ath11k/0068-wifi-ath11k-Remove-disabling-of-80-80-and-160-MHz.patch b/package/kernel/mac80211/patches/ath11k/0068-wifi-ath11k-Remove-disabling-of-80-80-and-160-MHz.patch deleted file mode 100644 index ce5ffd273be..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0068-wifi-ath11k-Remove-disabling-of-80-80-and-160-MHz.patch +++ /dev/null @@ -1,49 +0,0 @@ -From b100722a777f6455d913666a376f81342b2cb995 Mon Sep 17 00:00:00 2001 -From: Muna Sinada -Date: Mon, 17 Apr 2023 13:22:27 -0700 -Subject: [PATCH] wifi: ath11k: Remove disabling of 80+80 and 160 MHz - -This is a regression fix for 80+80 and 160 MHz support bits being -cleared, therefore not adverised. Remove disable of 80+80 and 160 MHz -capability flags and assign valid center frequency 2 similar to -VHT80_80. - -Fixes: 38dfe775d0ab ("wifi: ath11k: push MU-MIMO params from hostapd to hardware") -Reported-by: Robert Marko -Tested-by: Robert Marko # IPQ8074 WLAN.HK.2.9.0.1-01385-QCAHKSWPL_SILICONZ-1 -Link: https://bugzilla.kernel.org/show_bug.cgi?id=217299 -Co-developed-by: P Praneesh -Signed-off-by: P Praneesh -Signed-off-by: Muna Sinada -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/1681762947-13882-1-git-send-email-quic_msinada@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 4 ---- - drivers/net/wireless/ath/ath11k/wmi.c | 3 ++- - 2 files changed, 2 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5585,10 +5585,6 @@ static int ath11k_mac_copy_he_cap(struct - - he_cap_elem->mac_cap_info[1] &= - IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK; -- he_cap_elem->phy_cap_info[0] &= -- ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G; -- he_cap_elem->phy_cap_info[0] &= -- ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G; - - he_cap_elem->phy_cap_info[5] &= - ~IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK; ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -871,7 +871,8 @@ static void ath11k_wmi_put_wmi_channel(s - - chan->band_center_freq2 = arg->channel.band_center_freq1; - -- } else if (arg->channel.mode == MODE_11AC_VHT80_80) { -+ } else if ((arg->channel.mode == MODE_11AC_VHT80_80) || -+ (arg->channel.mode == MODE_11AX_HE80_80)) { - chan->band_center_freq2 = arg->channel.band_center_freq2; - } else { - chan->band_center_freq2 = 0; diff --git a/package/kernel/mac80211/patches/ath11k/0069-wifi-ath11k-fix-registration-of-6Ghz-only-phy-withou.patch b/package/kernel/mac80211/patches/ath11k/0069-wifi-ath11k-fix-registration-of-6Ghz-only-phy-withou.patch deleted file mode 100644 index 32468dbc4ca..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0069-wifi-ath11k-fix-registration-of-6Ghz-only-phy-withou.patch +++ /dev/null @@ -1,61 +0,0 @@ -From e2ceb1de2f83aafd8003f0b72dfd4b7441e97d14 Mon Sep 17 00:00:00 2001 -From: Maxime Bizon -Date: Fri, 21 Apr 2023 16:54:45 +0200 -Subject: [PATCH] wifi: ath11k: fix registration of 6Ghz-only phy without the - full channel range - -Because of what seems to be a typo, a 6Ghz-only phy for which the BDF -does not allow the 7115Mhz channel will fail to register: - - WARNING: CPU: 2 PID: 106 at net/wireless/core.c:907 wiphy_register+0x914/0x954 - Modules linked in: ath11k_pci sbsa_gwdt - CPU: 2 PID: 106 Comm: kworker/u8:5 Not tainted 6.3.0-rc7-next-20230418-00549-g1e096a17625a-dirty #9 - Hardware name: Freebox V7R Board (DT) - Workqueue: ath11k_qmi_driver_event ath11k_qmi_driver_event_work - pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) - pc : wiphy_register+0x914/0x954 - lr : ieee80211_register_hw+0x67c/0xc10 - sp : ffffff800b123aa0 - x29: ffffff800b123aa0 x28: 0000000000000000 x27: 0000000000000000 - x26: 0000000000000000 x25: 0000000000000006 x24: ffffffc008d51418 - x23: ffffffc008cb0838 x22: ffffff80176c2460 x21: 0000000000000168 - x20: ffffff80176c0000 x19: ffffff80176c03e0 x18: 0000000000000014 - x17: 00000000cbef338c x16: 00000000d2a26f21 x15: 00000000ad6bb85f - x14: 0000000000000020 x13: 0000000000000020 x12: 00000000ffffffbd - x11: 0000000000000208 x10: 00000000fffffdf7 x9 : ffffffc009394718 - x8 : ffffff80176c0528 x7 : 000000007fffffff x6 : 0000000000000006 - x5 : 0000000000000005 x4 : ffffff800b304284 x3 : ffffff800b304284 - x2 : ffffff800b304d98 x1 : 0000000000000000 x0 : 0000000000000000 - Call trace: - wiphy_register+0x914/0x954 - ieee80211_register_hw+0x67c/0xc10 - ath11k_mac_register+0x7c4/0xe10 - ath11k_core_qmi_firmware_ready+0x1f4/0x570 - ath11k_qmi_driver_event_work+0x198/0x590 - process_one_work+0x1b8/0x328 - worker_thread+0x6c/0x414 - kthread+0x100/0x104 - ret_from_fork+0x10/0x20 - ---[ end trace 0000000000000000 ]--- - ath11k_pci 0002:01:00.0: ieee80211 registration failed: -22 - ath11k_pci 0002:01:00.0: failed register the radio with mac80211: -22 - ath11k_pci 0002:01:00.0: failed to create pdev core: -22 - -Signed-off-by: Maxime Bizon -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230421145445.2612280-1-mbizon@freebox.fr ---- - drivers/net/wireless/ath/ath11k/mac.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -8892,7 +8892,7 @@ static int ath11k_mac_setup_channels_rat - } - - if (supported_bands & WMI_HOST_WLAN_5G_CAP) { -- if (reg_cap->high_5ghz_chan >= ATH11K_MAX_6G_FREQ) { -+ if (reg_cap->high_5ghz_chan >= ATH11K_MIN_6G_FREQ) { - channels = kmemdup(ath11k_6ghz_channels, - sizeof(ath11k_6ghz_channels), GFP_KERNEL); - if (!channels) { diff --git a/package/kernel/mac80211/patches/ath11k/0070-wifi-ath-work-around-false-positive-stringop-overrea.patch b/package/kernel/mac80211/patches/ath11k/0070-wifi-ath-work-around-false-positive-stringop-overrea.patch deleted file mode 100644 index aa4df16a90f..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0070-wifi-ath-work-around-false-positive-stringop-overrea.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 695df2f417d25202bdac9cde3c82d2acb6492b4d Mon Sep 17 00:00:00 2001 -From: Arnd Bergmann -Date: Fri, 5 May 2023 16:11:25 +0300 -Subject: [PATCH] wifi: ath: work around false-positive stringop-overread - warning - -In a rare arm64 randconfig build, I got multiple warnings for ath11k -and ath12k: - -In function 'ath11k_peer_assoc_h_ht', - inlined from 'ath11k_peer_assoc_prepare' at drivers/net/wireless/ath/ath11k/mac.c:2665:2: -drivers/net/wireless/ath/ath11k/mac.c:1709:13: error: 'ath11k_peer_assoc_h_ht_masked' reading 10 bytes from a region of size 0 [-Werror=stringop-overread] - 1709 | if (ath11k_peer_assoc_h_ht_masked(ht_mcs_mask)) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This happens whenever gcc-13 fails to inline one of the functions -that take a fixed-length array argument but gets passed a pointer. - -Change these functions to all take a regular pointer argument -instead. - -Signed-off-by: Arnd Bergmann -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230417205447.1800912-1-arnd@kernel.org ---- - drivers/net/wireless/ath/ath11k/mac.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -433,7 +433,7 @@ u8 ath11k_mac_bitrate_to_idx(const struc - } - - static u32 --ath11k_mac_max_ht_nss(const u8 ht_mcs_mask[IEEE80211_HT_MCS_MASK_LEN]) -+ath11k_mac_max_ht_nss(const u8 *ht_mcs_mask) - { - int nss; - -@@ -445,7 +445,7 @@ ath11k_mac_max_ht_nss(const u8 ht_mcs_ma - } - - static u32 --ath11k_mac_max_vht_nss(const u16 vht_mcs_mask[NL80211_VHT_NSS_MAX]) -+ath11k_mac_max_vht_nss(const u16 *vht_mcs_mask) - { - int nss; - -@@ -457,7 +457,7 @@ ath11k_mac_max_vht_nss(const u16 vht_mcs - } - - static u32 --ath11k_mac_max_he_nss(const u16 he_mcs_mask[NL80211_HE_NSS_MAX]) -+ath11k_mac_max_he_nss(const u16 *he_mcs_mask) - { - int nss; - -@@ -1658,7 +1658,7 @@ static void ath11k_peer_assoc_h_rates(st - } - - static bool --ath11k_peer_assoc_h_ht_masked(const u8 ht_mcs_mask[IEEE80211_HT_MCS_MASK_LEN]) -+ath11k_peer_assoc_h_ht_masked(const u8 *ht_mcs_mask) - { - int nss; - -@@ -1670,7 +1670,7 @@ ath11k_peer_assoc_h_ht_masked(const u8 h - } - - static bool --ath11k_peer_assoc_h_vht_masked(const u16 vht_mcs_mask[]) -+ath11k_peer_assoc_h_vht_masked(const u16 *vht_mcs_mask) - { - int nss; - -@@ -2065,7 +2065,7 @@ static u16 ath11k_peer_assoc_h_he_limit( - } - - static bool --ath11k_peer_assoc_h_he_masked(const u16 he_mcs_mask[NL80211_HE_NSS_MAX]) -+ath11k_peer_assoc_h_he_masked(const u16 *he_mcs_mask) - { - int nss; - diff --git a/package/kernel/mac80211/patches/ath11k/0071-wifi-ath11k-driver-settings-for-MBSSID-and-EMA.patch b/package/kernel/mac80211/patches/ath11k/0071-wifi-ath11k-driver-settings-for-MBSSID-and-EMA.patch deleted file mode 100644 index bede4819ca4..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0071-wifi-ath11k-driver-settings-for-MBSSID-and-EMA.patch +++ /dev/null @@ -1,133 +0,0 @@ -From a08dbb04d7365a04d52882143cf196005bfc88c3 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:27 +0300 -Subject: [PATCH 71/77] wifi: ath11k: driver settings for MBSSID and EMA - -Advertise the driver support for multiple BSSID (MBSSID) and -enhanced multi-BSSID advertisements (EMA) by setting extended -capabilities. - -Configure mbssid_max_interfaces and ema_max_profile_periodicity -fields in structure wiphy which are used to advertise maximum number -of interfaces and profile periodicity supported by the driver. - -Add new WMI fields to configure maximum vdev count supported for -MBSSID and profile periodicity in case of EMA. -Setting WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET flag -indicates that the firmware should track and update the DTIM counts -for each non-transmitted profile. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Co-developed-by: John Crispin -Signed-off-by: John Crispin -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-2-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/hw.c | 3 +++ - drivers/net/wireless/ath/ath11k/hw.h | 1 + - drivers/net/wireless/ath/ath11k/mac.c | 7 +++++++ - drivers/net/wireless/ath/ath11k/wmi.c | 3 +++ - drivers/net/wireless/ath/ath11k/wmi.h | 6 ++++++ - 5 files changed, 20 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -202,6 +202,9 @@ static void ath11k_init_wmi_config_ipq80 - config->twt_ap_sta_count = 1000; - config->flag1 |= WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64; - config->flag1 |= WMI_RSRC_CFG_FLAG1_ACK_RSSI; -+ config->ema_max_vap_cnt = ab->num_radios; -+ config->ema_max_profile_period = TARGET_EMA_MAX_PROFILE_PERIOD; -+ config->beacon_tx_offload_max_vdev += config->ema_max_vap_cnt; - } - - static int ath11k_hw_mac_id_to_pdev_id_ipq8074(struct ath11k_hw_params *hw, ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -64,6 +64,7 @@ - #define TARGET_NUM_WDS_ENTRIES 32 - #define TARGET_DMA_BURST_SIZE 1 - #define TARGET_RX_BATCHMODE 1 -+#define TARGET_EMA_MAX_PROFILE_PERIOD 8 - - #define ATH11K_HW_MAX_QUEUES 4 - #define ATH11K_QUEUE_LEN 4096 ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -9001,19 +9001,23 @@ static int ath11k_mac_setup_iface_combin - - static const u8 ath11k_if_types_ext_capa[] = { - [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING, -+ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT, - [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF, - }; - - static const u8 ath11k_if_types_ext_capa_sta[] = { - [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING, -+ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT, - [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF, - [9] = WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT, - }; - - static const u8 ath11k_if_types_ext_capa_ap[] = { - [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING, -+ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT, - [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF, - [9] = WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT, -+ [10] = WLAN_EXT_CAPA11_EMA_SUPPORT, - }; - - static const struct wiphy_iftype_ext_capab ath11k_iftypes_ext_capa[] = { -@@ -9251,6 +9255,9 @@ static int __ath11k_mac_register(struct - wiphy_ext_feature_set(ar->hw->wiphy, - NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER); - -+ ar->hw->wiphy->mbssid_max_interfaces = TARGET_NUM_VDEVS(ab); -+ ar->hw->wiphy->ema_max_profile_periodicity = TARGET_EMA_MAX_PROFILE_PERIOD; -+ - ath11k_reg_init(ar); - - if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -3987,6 +3987,9 @@ ath11k_wmi_copy_resource_config(struct w - ~(1 << WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT); - wmi_cfg->host_service_flags |= (tg_cfg->is_reg_cc_ext_event_supported << - WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT); -+ 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; - } - - static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi, ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2317,6 +2317,7 @@ struct wmi_init_cmd { - } __packed; - - #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 BIT(5) -+#define WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET BIT(9) - #define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18) - - #define WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT 4 -@@ -2389,6 +2390,9 @@ struct wmi_resource_config { - u32 msdu_flow_override_config1; - u32 flags2; - u32 host_service_flags; -+ u32 max_rnr_neighbours; -+ u32 ema_max_vap_cnt; -+ u32 ema_max_profile_period; - } __packed; - - struct wmi_service_ready_event { -@@ -5646,6 +5650,8 @@ struct target_resource_config { - u32 twt_ap_pdev_count; - u32 twt_ap_sta_count; - u8 is_reg_cc_ext_event_supported; -+ u32 ema_max_vap_cnt; -+ u32 ema_max_profile_period; - }; - - enum wmi_debug_log_param { diff --git a/package/kernel/mac80211/patches/ath11k/0072-wifi-ath11k-MBSSID-configuration-during-vdev-create-.patch b/package/kernel/mac80211/patches/ath11k/0072-wifi-ath11k-MBSSID-configuration-during-vdev-create-.patch deleted file mode 100644 index 4ba0717319c..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0072-wifi-ath11k-MBSSID-configuration-during-vdev-create-.patch +++ /dev/null @@ -1,215 +0,0 @@ -From 5a81610acf66c4ad6e1a1fbd09f3f555fca863b1 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:27 +0300 -Subject: [PATCH 72/77] wifi: ath11k: MBSSID configuration during vdev - create/start - -Configure multiple BSSID flags and index of the transmitting interface -in vdev create/start commands depending on the service bit -WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Co-developed-by: John Crispin -Signed-off-by: John Crispin -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-3-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 70 +++++++++++++++++++++++++-- - drivers/net/wireless/ath/ath11k/wmi.c | 5 ++ - drivers/net/wireless/ath/ath11k/wmi.h | 19 ++++++++ - 3 files changed, 90 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6181,17 +6181,62 @@ static void ath11k_mac_op_stop(struct ie - atomic_set(&ar->num_pending_mgmt_tx, 0); - } - --static void --ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif, -- struct vdev_create_params *params) -+static int ath11k_mac_setup_vdev_params_mbssid(struct ath11k_vif *arvif, -+ u32 *flags, u32 *tx_vdev_id) -+{ -+ struct ath11k *ar = arvif->ar; -+ struct ath11k_vif *tx_arvif; -+ struct ieee80211_vif *tx_vif; -+ -+ *tx_vdev_id = 0; -+ tx_vif = arvif->vif->mbssid_tx_vif; -+ if (!tx_vif) { -+ *flags = WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP; -+ return 0; -+ } -+ -+ tx_arvif = (void *)tx_vif->drv_priv; -+ -+ if (arvif->vif->bss_conf.nontransmitted) { -+ if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy) -+ return -EINVAL; -+ -+ *flags = WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP; -+ *tx_vdev_id = ath11k_vif_to_arvif(tx_vif)->vdev_id; -+ } else if (tx_arvif == arvif) { -+ *flags = WMI_HOST_VDEV_FLAGS_TRANSMIT_AP; -+ } else { -+ return -EINVAL; -+ } -+ -+ if (arvif->vif->bss_conf.ema_ap) -+ *flags |= WMI_HOST_VDEV_FLAGS_EMA_MODE; -+ -+ return 0; -+} -+ -+static int ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif, -+ struct vdev_create_params *params) - { - struct ath11k *ar = arvif->ar; - struct ath11k_pdev *pdev = ar->pdev; -+ int ret; - - params->if_id = arvif->vdev_id; - params->type = arvif->vdev_type; - params->subtype = arvif->vdev_subtype; - params->pdev_id = pdev->pdev_id; -+ params->mbssid_flags = 0; -+ params->mbssid_tx_vdev_id = 0; -+ -+ if (!test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT, -+ ar->ab->wmi_ab.svc_map)) { -+ ret = ath11k_mac_setup_vdev_params_mbssid(arvif, -+ ¶ms->mbssid_flags, -+ ¶ms->mbssid_tx_vdev_id); -+ if (ret) -+ return ret; -+ } - - if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) { - params->chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains; -@@ -6206,6 +6251,7 @@ ath11k_mac_setup_vdev_create_params(stru - params->chains[NL80211_BAND_6GHZ].tx = ar->num_tx_chains; - params->chains[NL80211_BAND_6GHZ].rx = ar->num_rx_chains; - } -+ return 0; - } - - static void ath11k_mac_op_update_vif_offload(struct ieee80211_hw *hw, -@@ -6500,7 +6546,12 @@ static int ath11k_mac_op_add_interface(s - for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++) - vif->hw_queue[i] = i % (ATH11K_HW_MAX_QUEUES - 1); - -- ath11k_mac_setup_vdev_create_params(arvif, &vdev_param); -+ ret = ath11k_mac_setup_vdev_create_params(arvif, &vdev_param); -+ if (ret) { -+ ath11k_warn(ab, "failed to create vdev parameters %d: %d\n", -+ arvif->vdev_id, ret); -+ goto err; -+ } - - ret = ath11k_wmi_vdev_create(ar, vif->addr, &vdev_param); - if (ret) { -@@ -6905,6 +6956,17 @@ ath11k_mac_vdev_start_restart(struct ath - arg.pref_tx_streams = ar->num_tx_chains; - arg.pref_rx_streams = ar->num_rx_chains; - -+ arg.mbssid_flags = 0; -+ arg.mbssid_tx_vdev_id = 0; -+ if (test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT, -+ ar->ab->wmi_ab.svc_map)) { -+ ret = ath11k_mac_setup_vdev_params_mbssid(arvif, -+ &arg.mbssid_flags, -+ &arg.mbssid_tx_vdev_id); -+ if (ret) -+ return ret; -+ } -+ - if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { - arg.ssid = arvif->u.ap.ssid; - arg.ssid_len = arvif->u.ap.ssid_len; ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -724,6 +724,9 @@ int ath11k_wmi_vdev_create(struct ath11k - cmd->vdev_subtype = param->subtype; - cmd->num_cfg_txrx_streams = WMI_NUM_SUPPORTED_BAND_MAX; - cmd->pdev_id = param->pdev_id; -+ cmd->mbssid_flags = param->mbssid_flags; -+ cmd->mbssid_tx_vdev_id = param->mbssid_tx_vdev_id; -+ - ether_addr_copy(cmd->vdev_macaddr.addr, macaddr); - - ptr = skb->data + sizeof(*cmd); -@@ -941,6 +944,8 @@ int ath11k_wmi_vdev_start(struct ath11k - cmd->cac_duration_ms = arg->cac_duration_ms; - cmd->regdomain = arg->regdomain; - cmd->he_ops = arg->he_ops; -+ cmd->mbssid_flags = arg->mbssid_flags; -+ cmd->mbssid_tx_vdev_id = arg->mbssid_tx_vdev_id; - - if (!restart) { - if (arg->ssid) { ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -137,6 +137,14 @@ enum { - WMI_AUTORATE_3200NS_GI = BIT(11), - }; - -+enum { -+ WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP = 0x00000001, -+ WMI_HOST_VDEV_FLAGS_TRANSMIT_AP = 0x00000002, -+ WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP = 0x00000004, -+ WMI_HOST_VDEV_FLAGS_EMA_MODE = 0x00000008, -+ WMI_HOST_VDEV_FLAGS_SCAN_MODE_VAP = 0x00000010, -+}; -+ - /* - * wmi command groups. - */ -@@ -2096,6 +2104,7 @@ enum wmi_tlv_service { - WMI_TLV_SERVICE_EXT2_MSG = 220, - 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, - WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE = 263, - - /* The second 128 bits */ -@@ -2583,6 +2592,8 @@ struct vdev_create_params { - u8 rx; - } chains[NUM_NL80211_BANDS]; - u32 pdev_id; -+ u32 mbssid_flags; -+ u32 mbssid_tx_vdev_id; - }; - - struct wmi_vdev_create_cmd { -@@ -2593,6 +2604,8 @@ struct wmi_vdev_create_cmd { - struct wmi_mac_addr vdev_macaddr; - u32 num_cfg_txrx_streams; - u32 pdev_id; -+ u32 mbssid_flags; -+ u32 mbssid_tx_vdev_id; - } __packed; - - struct wmi_vdev_txrx_streams { -@@ -2656,6 +2669,9 @@ struct wmi_vdev_start_request_cmd { - u32 he_ops; - u32 cac_duration_ms; - u32 regdomain; -+ u32 min_data_rate; -+ u32 mbssid_flags; -+ u32 mbssid_tx_vdev_id; - } __packed; - - #define MGMT_TX_DL_FRM_LEN 64 -@@ -2825,6 +2841,9 @@ struct wmi_vdev_start_req_arg { - u32 pref_rx_streams; - u32 pref_tx_streams; - u32 num_noa_descriptors; -+ u32 min_data_rate; -+ u32 mbssid_flags; -+ u32 mbssid_tx_vdev_id; - }; - - struct peer_create_params { diff --git a/package/kernel/mac80211/patches/ath11k/0073-wifi-ath11k-rename-MBSSID-fields-in-wmi_vdev_up_cmd.patch b/package/kernel/mac80211/patches/ath11k/0073-wifi-ath11k-rename-MBSSID-fields-in-wmi_vdev_up_cmd.patch deleted file mode 100644 index 023a1dbb9fc..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0073-wifi-ath11k-rename-MBSSID-fields-in-wmi_vdev_up_cmd.patch +++ /dev/null @@ -1,52 +0,0 @@ -From cf604e72bc6e6db68c7fcaa8779b03ec14b8d2fa Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:27 +0300 -Subject: [PATCH 73/77] wifi: ath11k: rename MBSSID fields in wmi_vdev_up_cmd - -Rename trans_bssid to tx_vdev_bssid to make it similar to vdev_bssid. - -Rename profile_num to nontx_profile_cnt, and profile_idx to -nontx_profile_idx which makes it clear that these store configurations -related to MBSSID non-transmitting profiles. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-4-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/wmi.c | 6 +++--- - drivers/net/wireless/ath/ath11k/wmi.h | 6 +++--- - 2 files changed, 6 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1029,10 +1029,10 @@ int ath11k_wmi_vdev_up(struct ath11k *ar - bss_conf = &arvif->vif->bss_conf; - - if (bss_conf->nontransmitted) { -- ether_addr_copy(cmd->trans_bssid.addr, -+ ether_addr_copy(cmd->tx_vdev_bssid.addr, - bss_conf->transmitter_bssid); -- cmd->profile_idx = bss_conf->bssid_index; -- cmd->profile_num = bss_conf->bssid_indicator; -+ cmd->nontx_profile_idx = bss_conf->bssid_index; -+ cmd->nontx_profile_cnt = bss_conf->bssid_indicator; - } - } - ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2625,9 +2625,9 @@ struct wmi_vdev_up_cmd { - u32 vdev_id; - u32 vdev_assoc_id; - struct wmi_mac_addr vdev_bssid; -- struct wmi_mac_addr trans_bssid; -- u32 profile_idx; -- u32 profile_num; -+ struct wmi_mac_addr tx_vdev_bssid; -+ u32 nontx_profile_idx; -+ u32 nontx_profile_cnt; - } __packed; - - struct wmi_vdev_stop_cmd { diff --git a/package/kernel/mac80211/patches/ath11k/0074-wifi-ath11k-MBSSID-parameter-configuration-in-AP-mod.patch b/package/kernel/mac80211/patches/ath11k/0074-wifi-ath11k-MBSSID-parameter-configuration-in-AP-mod.patch deleted file mode 100644 index d93e27dd42b..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0074-wifi-ath11k-MBSSID-parameter-configuration-in-AP-mod.patch +++ /dev/null @@ -1,138 +0,0 @@ -From c82dc33f252fd8883be66f2d0230af0fd734c683 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:27 +0300 -Subject: [PATCH 74/77] wifi: ath11k: MBSSID parameter configuration in AP mode - -Include MBSSID parameters in WMI vdev up operation. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Co-developed-by: John Crispin -Signed-off-by: John Crispin -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-5-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 29 +++++++++++++++++++++------ - drivers/net/wireless/ath/ath11k/wmi.c | 8 +++++++- - drivers/net/wireless/ath/ath11k/wmi.h | 3 ++- - 3 files changed, 32 insertions(+), 8 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -964,7 +964,7 @@ static int ath11k_mac_monitor_vdev_start - return ret; - } - -- ret = ath11k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); -+ ret = ath11k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr, NULL, 0, 0); - if (ret) { - ath11k_warn(ar->ab, "failed to put up monitor vdev %i: %d\n", - vdev_id, ret); -@@ -1423,6 +1423,7 @@ static void ath11k_control_beaconing(str - struct ieee80211_bss_conf *info) - { - struct ath11k *ar = arvif->ar; -+ struct ath11k_vif *tx_arvif = NULL; - int ret = 0; - - lockdep_assert_held(&arvif->ar->conf_mutex); -@@ -1451,8 +1452,14 @@ static void ath11k_control_beaconing(str - - ether_addr_copy(arvif->bssid, info->bssid); - -+ if (arvif->vif->mbssid_tx_vif) -+ tx_arvif = (struct ath11k_vif *)arvif->vif->mbssid_tx_vif->drv_priv; -+ - ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, -- arvif->bssid); -+ arvif->bssid, -+ tx_arvif ? tx_arvif->bssid : NULL, -+ info->bssid_index, -+ 1 << info->bssid_indicator); - if (ret) { - ath11k_warn(ar->ab, "failed to bring up vdev %d: %i\n", - arvif->vdev_id, ret); -@@ -2879,7 +2886,8 @@ static void ath11k_bss_assoc(struct ieee - arvif->aid = vif->cfg.aid; - ether_addr_copy(arvif->bssid, bss_conf->bssid); - -- ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid); -+ ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid, -+ NULL, 0, 0); - if (ret) { - ath11k_warn(ar->ab, "failed to set vdev %d up: %d\n", - arvif->vdev_id, ret); -@@ -7133,7 +7141,8 @@ ath11k_mac_update_vif_chan(struct ath11k - int n_vifs) - { - struct ath11k_base *ab = ar->ab; -- struct ath11k_vif *arvif; -+ struct ath11k_vif *arvif, *tx_arvif = NULL; -+ struct ieee80211_vif *mbssid_tx_vif; - int ret; - int i; - bool monitor_vif = false; -@@ -7187,8 +7196,15 @@ ath11k_mac_update_vif_chan(struct ath11k - ath11k_warn(ab, "failed to update bcn tmpl during csa: %d\n", - ret); - -+ mbssid_tx_vif = arvif->vif->mbssid_tx_vif; -+ if (mbssid_tx_vif) -+ tx_arvif = (struct ath11k_vif *)mbssid_tx_vif->drv_priv; -+ - ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, -- arvif->bssid); -+ arvif->bssid, -+ tx_arvif ? tx_arvif->bssid : NULL, -+ arvif->vif->bss_conf.bssid_index, -+ 1 << arvif->vif->bss_conf.bssid_indicator); - if (ret) { - ath11k_warn(ab, "failed to bring vdev up %d: %d\n", - arvif->vdev_id, ret); -@@ -7306,7 +7322,8 @@ static int ath11k_start_vdev_delay(struc - } - - if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { -- ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, 0, ar->mac_addr); -+ ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, 0, ar->mac_addr, -+ NULL, 0, 0); - if (ret) { - ath11k_warn(ab, "failed put monitor up: %d\n", ret); - return ret; ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1001,7 +1001,8 @@ int ath11k_wmi_vdev_start(struct ath11k - return ret; - } - --int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, const u8 *bssid) -+int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, const u8 *bssid, -+ u8 *tx_bssid, u32 nontx_profile_idx, u32 nontx_profile_cnt) - { - struct ath11k_pdev_wmi *wmi = ar->wmi; - struct wmi_vdev_up_cmd *cmd; -@@ -1025,6 +1026,11 @@ int ath11k_wmi_vdev_up(struct ath11k *ar - - ether_addr_copy(cmd->vdev_bssid.addr, bssid); - -+ cmd->nontx_profile_idx = nontx_profile_idx; -+ cmd->nontx_profile_cnt = nontx_profile_cnt; -+ if (tx_bssid) -+ ether_addr_copy(cmd->tx_vdev_bssid.addr, tx_bssid); -+ - if (arvif && arvif->vif->type == NL80211_IFTYPE_STATION) { - bss_conf = &arvif->vif->bss_conf; - ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -6301,7 +6301,8 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a - struct sk_buff *bcn); - int ath11k_wmi_vdev_down(struct ath11k *ar, u8 vdev_id); - int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, -- const u8 *bssid); -+ const u8 *bssid, u8 *tx_bssid, u32 nontx_profile_idx, -+ u32 nontx_profile_cnt); - int ath11k_wmi_vdev_stop(struct ath11k *ar, u8 vdev_id); - int ath11k_wmi_vdev_start(struct ath11k *ar, struct wmi_vdev_start_req_arg *arg, - bool restart); diff --git a/package/kernel/mac80211/patches/ath11k/0075-wifi-ath11k-refactor-vif-parameter-configurations.patch b/package/kernel/mac80211/patches/ath11k/0075-wifi-ath11k-refactor-vif-parameter-configurations.patch deleted file mode 100644 index 8509e55978d..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0075-wifi-ath11k-refactor-vif-parameter-configurations.patch +++ /dev/null @@ -1,86 +0,0 @@ -From cb9bea773c85e372931cd7a177db4165adf29d95 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:28 +0300 -Subject: [PATCH 75/77] wifi: ath11k: refactor vif parameter configurations - -Security parameters for each non-transmitting profile can be -different when MBSSID is enabled and this information is included -in the MBSSID element in the Beacon frame. Current implementation -to set rsnie_present and wpaie_present does not parse this element -hence it applies only to the transmitting interface. - -Move the code to a separate function to make additions for -non-transmitting interfaces cleaner. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-6-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 41 ++++++++++++++++----------- - 1 file changed, 24 insertions(+), 17 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1351,28 +1351,14 @@ err_mon_del: - return ret; - } - --static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) -+static void ath11k_mac_set_vif_params(struct ath11k_vif *arvif, -+ struct sk_buff *bcn) - { -- struct ath11k *ar = arvif->ar; -- struct ath11k_base *ab = ar->ab; -- struct ieee80211_hw *hw = ar->hw; -- struct ieee80211_vif *vif = arvif->vif; -- struct ieee80211_mutable_offsets offs = {}; -- struct sk_buff *bcn; - struct ieee80211_mgmt *mgmt; - u8 *ies; -- int ret; -- -- if (arvif->vdev_type != WMI_VDEV_TYPE_AP) -- return 0; -- -- bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0); -- if (!bcn) { -- ath11k_warn(ab, "failed to get beacon template from mac80211\n"); -- return -EPERM; -- } - - ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn); -+ mgmt = (struct ieee80211_mgmt *)bcn->data; - ies += sizeof(mgmt->u.beacon); - - if (cfg80211_find_ie(WLAN_EID_RSN, ies, (skb_tail_pointer(bcn) - ies))) -@@ -1386,7 +1372,28 @@ static int ath11k_mac_setup_bcn_tmpl(str - arvif->wpaie_present = true; - else - arvif->wpaie_present = false; -+} -+ -+static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) -+{ -+ struct ath11k *ar = arvif->ar; -+ struct ath11k_base *ab = ar->ab; -+ struct ieee80211_hw *hw = ar->hw; -+ struct ieee80211_vif *vif = arvif->vif; -+ struct ieee80211_mutable_offsets offs = {}; -+ struct sk_buff *bcn; -+ int ret; -+ -+ if (arvif->vdev_type != WMI_VDEV_TYPE_AP) -+ return 0; -+ -+ bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0); -+ if (!bcn) { -+ ath11k_warn(ab, "failed to get beacon template from mac80211\n"); -+ return -EPERM; -+ } - -+ ath11k_mac_set_vif_params(arvif, bcn); - ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); - - kfree_skb(bcn); diff --git a/package/kernel/mac80211/patches/ath11k/0076-wifi-ath11k-MBSSID-beacon-support.patch b/package/kernel/mac80211/patches/ath11k/0076-wifi-ath11k-MBSSID-beacon-support.patch deleted file mode 100644 index d23ea8deead..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0076-wifi-ath11k-MBSSID-beacon-support.patch +++ /dev/null @@ -1,190 +0,0 @@ -From 335a92765d308dfe22826f5562cd4b4389b45e71 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:28 +0300 -Subject: [PATCH 76/77] wifi: ath11k: MBSSID beacon support - -- Split ath11k_mac_setup_bcn_tmpl() to move the beacon retrieval and - WMI command to a new function, ath11k_mac_setup_bcn_tmpl_legacy(). - In the original function add checks to use the transmitting interface - when MBSSID is enabled. -- Set rsnie_present and wpaie_present fields for the non-transmitting - interfaces when MBSSID is enabled. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Co-developed-by: John Crispin -Signed-off-by: John Crispin -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-7-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 116 ++++++++++++++++++++++++-- - drivers/net/wireless/ath/ath11k/wmi.c | 1 + - 2 files changed, 112 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1351,6 +1351,84 @@ err_mon_del: - return ret; - } - -+static void ath11k_mac_setup_nontx_vif_rsnie(struct ath11k_vif *arvif, -+ bool tx_arvif_rsnie_present, -+ const u8 *profile, u8 profile_len) -+{ -+ if (cfg80211_find_ie(WLAN_EID_RSN, profile, profile_len)) { -+ arvif->rsnie_present = true; -+ } else if (tx_arvif_rsnie_present) { -+ int i; -+ u8 nie_len; -+ const u8 *nie = cfg80211_find_ext_ie(WLAN_EID_EXT_NON_INHERITANCE, -+ profile, profile_len); -+ if (!nie) -+ return; -+ -+ nie_len = nie[1]; -+ nie += 2; -+ for (i = 0; i < nie_len; i++) { -+ if (nie[i] == WLAN_EID_RSN) { -+ arvif->rsnie_present = false; -+ break; -+ } -+ } -+ } -+} -+ -+static bool ath11k_mac_set_nontx_vif_params(struct ath11k_vif *tx_arvif, -+ struct ath11k_vif *arvif, -+ struct sk_buff *bcn) -+{ -+ struct ieee80211_mgmt *mgmt; -+ const u8 *ies, *profile, *next_profile; -+ int ies_len; -+ -+ ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn); -+ mgmt = (struct ieee80211_mgmt *)bcn->data; -+ ies += sizeof(mgmt->u.beacon); -+ ies_len = skb_tail_pointer(bcn) - ies; -+ -+ ies = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, ies, ies_len); -+ arvif->rsnie_present = tx_arvif->rsnie_present; -+ -+ while (ies) { -+ u8 mbssid_len; -+ -+ ies_len -= (2 + ies[1]); -+ mbssid_len = ies[1] - 1; -+ profile = &ies[3]; -+ -+ while (mbssid_len) { -+ u8 profile_len; -+ -+ profile_len = profile[1]; -+ next_profile = profile + (2 + profile_len); -+ mbssid_len -= (2 + profile_len); -+ -+ profile += 2; -+ profile_len -= (2 + profile[1]); -+ profile += (2 + profile[1]); /* nontx capabilities */ -+ profile_len -= (2 + profile[1]); -+ profile += (2 + profile[1]); /* SSID */ -+ if (profile[2] == arvif->vif->bss_conf.bssid_index) { -+ profile_len -= 5; -+ profile = profile + 5; -+ ath11k_mac_setup_nontx_vif_rsnie(arvif, -+ tx_arvif->rsnie_present, -+ profile, -+ profile_len); -+ return true; -+ } -+ profile = next_profile; -+ } -+ ies = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, profile, -+ ies_len); -+ } -+ -+ return false; -+} -+ - static void ath11k_mac_set_vif_params(struct ath11k_vif *arvif, - struct sk_buff *bcn) - { -@@ -1374,18 +1452,26 @@ static void ath11k_mac_set_vif_params(st - arvif->wpaie_present = false; - } - --static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) -+static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif) - { - struct ath11k *ar = arvif->ar; - struct ath11k_base *ab = ar->ab; -+ struct ath11k_vif *tx_arvif = arvif; - struct ieee80211_hw *hw = ar->hw; - struct ieee80211_vif *vif = arvif->vif; - struct ieee80211_mutable_offsets offs = {}; - struct sk_buff *bcn; - int ret; - -- if (arvif->vdev_type != WMI_VDEV_TYPE_AP) -- return 0; -+ if (arvif->vif->mbssid_tx_vif) { -+ tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; -+ if (tx_arvif != arvif) { -+ ar = tx_arvif->ar; -+ ab = ar->ab; -+ hw = ar->hw; -+ vif = tx_arvif->vif; -+ } -+ } - - bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0); - if (!bcn) { -@@ -1393,9 +1479,12 @@ static int ath11k_mac_setup_bcn_tmpl(str - return -EPERM; - } - -- ath11k_mac_set_vif_params(arvif, bcn); -- ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); -+ if (tx_arvif == arvif) -+ ath11k_mac_set_vif_params(tx_arvif, bcn); -+ else if (!ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, bcn)) -+ return -EINVAL; - -+ ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); - kfree_skb(bcn); - - if (ret) -@@ -1405,6 +1494,23 @@ static int ath11k_mac_setup_bcn_tmpl(str - return ret; - } - -+static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) -+{ -+ struct ieee80211_vif *vif = arvif->vif; -+ -+ if (arvif->vdev_type != WMI_VDEV_TYPE_AP) -+ return 0; -+ -+ /* Target does not expect beacon templates for the already up -+ * non-transmitting interfaces, and results in a crash if sent. -+ */ -+ if (vif->mbssid_tx_vif && -+ arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up) -+ return 0; -+ -+ return ath11k_mac_setup_bcn_tmpl_mbssid(arvif); -+} -+ - void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif) - { - struct ieee80211_vif *vif = arvif->vif; ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1737,6 +1737,7 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a - } - - cmd->buf_len = bcn->len; -+ cmd->mbssid_ie_offset = offs->mbssid_off; - - ptr = skb->data + sizeof(*cmd); - diff --git a/package/kernel/mac80211/patches/ath11k/0077-wifi-ath11k-EMA-beacon-support.patch b/package/kernel/mac80211/patches/ath11k/0077-wifi-ath11k-EMA-beacon-support.patch deleted file mode 100644 index 51353fa3e48..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0077-wifi-ath11k-EMA-beacon-support.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 87bd401138161008fdb82fbca6e213af117bfeb9 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Fri, 5 May 2023 16:11:28 +0300 -Subject: [PATCH 77/77] wifi: ath11k: EMA beacon support - -Add new function ath11k_mac_setup_bcn_tmpl_ema() which invokes the new -API provided by MAC80211 to retrieve EMA beacons. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Aloka Dixit -Co-developed-by: John Crispin -Signed-off-by: John Crispin -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230405221648.17950-8-quic_alokad@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 59 ++++++++++++++++++++++++++- - drivers/net/wireless/ath/ath11k/wmi.c | 3 +- - drivers/net/wireless/ath/ath11k/wmi.h | 11 ++++- - 3 files changed, 70 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1452,6 +1452,60 @@ static void ath11k_mac_set_vif_params(st - arvif->wpaie_present = false; - } - -+static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif) -+{ -+ struct ath11k_vif *tx_arvif; -+ struct ieee80211_ema_beacons *beacons; -+ int ret = 0; -+ bool nontx_vif_params_set = false; -+ u32 params = 0; -+ u8 i = 0; -+ -+ tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; -+ -+ beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw, -+ tx_arvif->vif, 0); -+ if (!beacons || !beacons->cnt) { -+ ath11k_warn(arvif->ar->ab, -+ "failed to get ema beacon templates from mac80211\n"); -+ return -EPERM; -+ } -+ -+ if (tx_arvif == arvif) -+ ath11k_mac_set_vif_params(tx_arvif, beacons->bcn[0].skb); -+ else -+ arvif->wpaie_present = tx_arvif->wpaie_present; -+ -+ for (i = 0; i < beacons->cnt; i++) { -+ if (tx_arvif != arvif && !nontx_vif_params_set) -+ nontx_vif_params_set = -+ ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, -+ beacons->bcn[i].skb); -+ -+ params = beacons->cnt; -+ params |= (i << WMI_EMA_TMPL_IDX_SHIFT); -+ params |= ((!i ? 1 : 0) << WMI_EMA_FIRST_TMPL_SHIFT); -+ params |= ((i + 1 == beacons->cnt ? 1 : 0) << WMI_EMA_LAST_TMPL_SHIFT); -+ -+ ret = ath11k_wmi_bcn_tmpl(tx_arvif->ar, tx_arvif->vdev_id, -+ &beacons->bcn[i].offs, -+ beacons->bcn[i].skb, params); -+ if (ret) { -+ ath11k_warn(tx_arvif->ar->ab, -+ "failed to set ema beacon template id %i error %d\n", -+ i, ret); -+ break; -+ } -+ } -+ -+ ieee80211_beacon_free_ema_list(beacons); -+ -+ if (tx_arvif != arvif && !nontx_vif_params_set) -+ return -EINVAL; /* Profile not found in the beacons */ -+ -+ return ret; -+} -+ - static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif) - { - struct ath11k *ar = arvif->ar; -@@ -1484,7 +1538,7 @@ static int ath11k_mac_setup_bcn_tmpl_mbs - else if (!ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, bcn)) - return -EINVAL; - -- ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); -+ ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn, 0); - kfree_skb(bcn); - - if (ret) -@@ -1508,6 +1562,9 @@ static int ath11k_mac_setup_bcn_tmpl(str - arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up) - return 0; - -+ if (vif->bss_conf.ema_ap && vif->mbssid_tx_vif) -+ return ath11k_mac_setup_bcn_tmpl_ema(arvif); -+ - return ath11k_mac_setup_bcn_tmpl_mbssid(arvif); - } - ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1699,7 +1699,7 @@ int ath11k_wmi_send_bcn_offload_control_ - - int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id, - struct ieee80211_mutable_offsets *offs, -- struct sk_buff *bcn) -+ struct sk_buff *bcn, u32 ema_params) - { - struct ath11k_pdev_wmi *wmi = ar->wmi; - struct wmi_bcn_tmpl_cmd *cmd; -@@ -1738,6 +1738,7 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a - - cmd->buf_len = bcn->len; - cmd->mbssid_ie_offset = offs->mbssid_off; -+ cmd->ema_params = ema_params; - - ptr = skb->data + sizeof(*cmd); - ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -3566,6 +3566,10 @@ struct wmi_get_pdev_temperature_cmd { - - #define WMI_BEACON_TX_BUFFER_SIZE 512 - -+#define WMI_EMA_TMPL_IDX_SHIFT 8 -+#define WMI_EMA_FIRST_TMPL_SHIFT 16 -+#define WMI_EMA_LAST_TMPL_SHIFT 24 -+ - struct wmi_bcn_tmpl_cmd { - u32 tlv_header; - u32 vdev_id; -@@ -3576,6 +3580,11 @@ struct wmi_bcn_tmpl_cmd { - u32 csa_event_bitmap; - u32 mbssid_ie_offset; - u32 esp_ie_offset; -+ u32 csc_switch_count_offset; -+ u32 csc_event_bitmap; -+ u32 mu_edca_ie_offset; -+ u32 feature_enable_bitmap; -+ u32 ema_params; - } __packed; - - struct wmi_key_seq_counter { -@@ -6298,7 +6307,7 @@ int ath11k_wmi_mgmt_send(struct ath11k * - struct sk_buff *frame); - int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id, - struct ieee80211_mutable_offsets *offs, -- struct sk_buff *bcn); -+ struct sk_buff *bcn, u32 ema_param); - int ath11k_wmi_vdev_down(struct ath11k *ar, u8 vdev_id); - int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, - const u8 *bssid, u8 *tx_bssid, u32 nontx_profile_idx, diff --git a/package/kernel/mac80211/patches/ath11k/0078-wifi-ath11k-Relocate-the-func-ath11k_mac_bitrate_mas.patch b/package/kernel/mac80211/patches/ath11k/0078-wifi-ath11k-Relocate-the-func-ath11k_mac_bitrate_mas.patch deleted file mode 100644 index 610bf725149..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0078-wifi-ath11k-Relocate-the-func-ath11k_mac_bitrate_mas.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 570eec3d40505c30babbe3b8f85a38496c975ab2 Mon Sep 17 00:00:00 2001 -From: Maharaja Kennadyrajan -Date: Tue, 9 May 2023 20:07:23 +0300 -Subject: [PATCH] wifi: ath11k: Relocate the func - ath11k_mac_bitrate_mask_num_ht_rates() and change hweight16 to hweight8 - -Relocate the function ath11k_mac_bitrate_mask_num_ht_rates() definition -to call this function from other functions which helps to avoid the -compilation error (function not defined). - -ht_mcs[] is 1 byte array and it is enough to use hweight8() instead -of hweight16(). Hence, fixed the same. - -Tested on: Compile tested only. - -Signed-off-by: Maharaja Kennadyrajan -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230504092033.3542456-2-quic_mkenna@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 30 +++++++++++++-------------- - 1 file changed, 15 insertions(+), 15 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.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-2022 Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -4338,6 +4338,20 @@ exit: - } - - static int -+ath11k_mac_bitrate_mask_num_ht_rates(struct ath11k *ar, -+ enum nl80211_band band, -+ const struct cfg80211_bitrate_mask *mask) -+{ -+ int num_rates = 0; -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) -+ num_rates += hweight8(mask->control[band].ht_mcs[i]); -+ -+ return num_rates; -+} -+ -+static int - ath11k_mac_bitrate_mask_num_vht_rates(struct ath11k *ar, - enum nl80211_band band, - const struct cfg80211_bitrate_mask *mask) -@@ -7791,20 +7805,6 @@ static void ath11k_mac_op_flush(struct i - ath11k_mac_flush_tx_complete(ar); - } - --static int --ath11k_mac_bitrate_mask_num_ht_rates(struct ath11k *ar, -- enum nl80211_band band, -- const struct cfg80211_bitrate_mask *mask) --{ -- int num_rates = 0; -- int i; -- -- for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) -- num_rates += hweight16(mask->control[band].ht_mcs[i]); -- -- return num_rates; --} -- - static bool - ath11k_mac_has_single_legacy_rate(struct ath11k *ar, - enum nl80211_band band, diff --git a/package/kernel/mac80211/patches/ath11k/0079-wifi-ath11k-Send-HT-fixed-rate-in-WMI-peer-fixed-par.patch b/package/kernel/mac80211/patches/ath11k/0079-wifi-ath11k-Send-HT-fixed-rate-in-WMI-peer-fixed-par.patch deleted file mode 100644 index 6282f4462e6..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0079-wifi-ath11k-Send-HT-fixed-rate-in-WMI-peer-fixed-par.patch +++ /dev/null @@ -1,141 +0,0 @@ -From df8e3729ffc0aa645839693f74ee7b6d999cdf64 Mon Sep 17 00:00:00 2001 -From: Maharaja Kennadyrajan -Date: Tue, 9 May 2023 20:07:24 +0300 -Subject: [PATCH] wifi: ath11k: Send HT fixed rate in WMI peer fixed param - -Due to the firmware behavior with HT fixed rate setting, -HT fixed rate MCS with NSS > 1 are treated as NSS = 1 -HT rates in the firmware and enables the HT fixed rate of -NSS = 1. - -This leads to HT fixed rate is always configured for NSS = 1 -even though the user sets NSS = 2 or > 1 HT fixed MCS in the -set bitrate command. - -Currently HT fixed MCS is sent via WMI peer assoc command. -Fix this issue, by sending the HT fixed rate MCS in WMI peer -fixed param instead of sending in peer assoc command. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Maharaja Kennadyrajan -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230504092033.3542456-3-quic_mkenna@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 63 ++++++++++++++++++++++++++- - 1 file changed, 61 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -4480,6 +4480,54 @@ ath11k_mac_set_peer_he_fixed_rate(struct - return ret; - } - -+static int -+ath11k_mac_set_peer_ht_fixed_rate(struct ath11k_vif *arvif, -+ struct ieee80211_sta *sta, -+ const struct cfg80211_bitrate_mask *mask, -+ enum nl80211_band band) -+{ -+ struct ath11k *ar = arvif->ar; -+ u8 ht_rate, nss = 0; -+ u32 rate_code; -+ int ret, i; -+ -+ lockdep_assert_held(&ar->conf_mutex); -+ -+ for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { -+ if (hweight8(mask->control[band].ht_mcs[i]) == 1) { -+ nss = i + 1; -+ ht_rate = ffs(mask->control[band].ht_mcs[i]) - 1; -+ } -+ } -+ -+ if (!nss) { -+ ath11k_warn(ar->ab, "No single HT Fixed rate found to set for %pM", -+ sta->addr); -+ return -EINVAL; -+ } -+ -+ /* Avoid updating invalid nss as fixed rate*/ -+ if (nss > sta->deflink.rx_nss) -+ return -EINVAL; -+ -+ ath11k_dbg(ar->ab, ATH11K_DBG_MAC, -+ "Setting Fixed HT Rate for peer %pM. Device will not switch to any other selected rates", -+ sta->addr); -+ -+ rate_code = ATH11K_HW_RATE_CODE(ht_rate, nss - 1, -+ WMI_RATE_PREAMBLE_HT); -+ ret = ath11k_wmi_set_peer_param(ar, sta->addr, -+ arvif->vdev_id, -+ WMI_PEER_PARAM_FIXED_RATE, -+ rate_code); -+ if (ret) -+ ath11k_warn(ar->ab, -+ "failed to update STA %pM HT Fixed Rate %d: %d\n", -+ sta->addr, rate_code, ret); -+ -+ return ret; -+} -+ - static int ath11k_station_assoc(struct ath11k *ar, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, -@@ -4491,7 +4539,7 @@ static int ath11k_station_assoc(struct a - struct cfg80211_chan_def def; - enum nl80211_band band; - struct cfg80211_bitrate_mask *mask; -- u8 num_vht_rates, num_he_rates; -+ u8 num_ht_rates, num_vht_rates, num_he_rates; - - lockdep_assert_held(&ar->conf_mutex); - -@@ -4519,6 +4567,7 @@ static int ath11k_station_assoc(struct a - - num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, mask); - num_he_rates = ath11k_mac_bitrate_mask_num_he_rates(ar, band, mask); -+ num_ht_rates = ath11k_mac_bitrate_mask_num_ht_rates(ar, band, mask); - - /* If single VHT/HE rate is configured (by set_bitrate_mask()), - * peer_assoc will disable VHT/HE. This is now enabled by a peer specific -@@ -4535,6 +4584,11 @@ static int ath11k_station_assoc(struct a - band); - if (ret) - return ret; -+ } else if (sta->deflink.ht_cap.ht_supported && num_ht_rates == 1) { -+ ret = ath11k_mac_set_peer_ht_fixed_rate(arvif, sta, mask, -+ band); -+ if (ret) -+ return ret; - } - - /* Re-assoc is run only to update supported rates for given station. It -@@ -4608,7 +4662,7 @@ static void ath11k_sta_rc_update_wk(stru - const u16 *vht_mcs_mask; - const u16 *he_mcs_mask; - u32 changed, bw, nss, smps, bw_prev; -- int err, num_vht_rates, num_he_rates; -+ int err, num_ht_rates, num_vht_rates, num_he_rates; - const struct cfg80211_bitrate_mask *mask; - struct peer_assoc_params peer_arg; - enum wmi_phy_mode peer_phymode; -@@ -4724,6 +4778,8 @@ static void ath11k_sta_rc_update_wk(stru - - if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) { - mask = &arvif->bitrate_mask; -+ num_ht_rates = ath11k_mac_bitrate_mask_num_ht_rates(ar, band, -+ mask); - num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, - mask); - num_he_rates = ath11k_mac_bitrate_mask_num_he_rates(ar, band, -@@ -4746,6 +4802,9 @@ static void ath11k_sta_rc_update_wk(stru - } else if (sta->deflink.he_cap.has_he && num_he_rates == 1) { - ath11k_mac_set_peer_he_fixed_rate(arvif, sta, mask, - band); -+ } else if (sta->deflink.ht_cap.ht_supported && num_ht_rates == 1) { -+ ath11k_mac_set_peer_ht_fixed_rate(arvif, sta, mask, -+ band); - } else { - /* If the peer is non-VHT/HE or no fixed VHT/HE rate - * is provided in the new bitrate mask we set the diff --git a/package/kernel/mac80211/patches/ath11k/0080-wifi-ath11k-add-support-default-regdb-while-searchin.patch b/package/kernel/mac80211/patches/ath11k/0080-wifi-ath11k-add-support-default-regdb-while-searchin.patch deleted file mode 100644 index 5ff40aac7a1..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0080-wifi-ath11k-add-support-default-regdb-while-searchin.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 88ca89202f8e8afb5225eb5244d79cd67c15d744 Mon Sep 17 00:00:00 2001 -From: Wen Gong -Date: Fri, 26 May 2023 12:41:06 +0300 -Subject: [PATCH] wifi: ath11k: add support default regdb while searching - board-2.bin for WCN6855 - -Sometimes board-2.bin does not have the regdb data which matched the -parameters such as vendor, device, subsystem-vendor, subsystem-device -and etc. Add default regdb data with 'bus=%s' into board-2.bin for -WCN6855, then ath11k use 'bus=pci' to search regdb data in board-2.bin -for WCN6855. - -kernel: [ 122.515808] ath11k_pci 0000:03:00.0: boot using board name 'bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262' -kernel: [ 122.517240] ath11k_pci 0000:03:00.0: boot firmware request ath11k/WCN6855/hw2.0/board-2.bin size 6179564 -kernel: [ 122.517280] ath11k_pci 0000:03:00.0: failed to fetch regdb data for bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262 from ath11k/WCN6855/hw2.0/board-2.bin -kernel: [ 122.517464] ath11k_pci 0000:03:00.0: boot using board name 'bus=pci' -kernel: [ 122.518901] ath11k_pci 0000:03:00.0: boot firmware request ath11k/WCN6855/hw2.0/board-2.bin size 6179564 -kernel: [ 122.518915] ath11k_pci 0000:03:00.0: board name -kernel: [ 122.518917] ath11k_pci 0000:03:00.0: 00000000: 62 75 73 3d 70 63 69 bus=pci -kernel: [ 122.518918] ath11k_pci 0000:03:00.0: boot found match regdb data for name 'bus=pci' -kernel: [ 122.518920] ath11k_pci 0000:03:00.0: boot found regdb data for 'bus=pci' -kernel: [ 122.518921] ath11k_pci 0000:03:00.0: fetched regdb - -Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 - -Signed-off-by: Wen Gong -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230517133959.8224-1-quic_wgong@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 53 +++++++++++++++++++------- - 1 file changed, 40 insertions(+), 13 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -961,7 +961,8 @@ int ath11k_core_check_dt(struct ath11k_b - } - - static int __ath11k_core_create_board_name(struct ath11k_base *ab, char *name, -- size_t name_len, bool with_variant) -+ size_t name_len, bool with_variant, -+ bool bus_type_mode) - { - /* strlen(',variant=') + strlen(ab->qmi.target.bdf_ext) */ - char variant[9 + ATH11K_QMI_BDF_EXT_STR_LENGTH] = { 0 }; -@@ -972,15 +973,20 @@ static int __ath11k_core_create_board_na - - switch (ab->id.bdf_search) { - case ATH11K_BDF_SEARCH_BUS_AND_BOARD: -- scnprintf(name, name_len, -- "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s", -- ath11k_bus_str(ab->hif.bus), -- ab->id.vendor, ab->id.device, -- ab->id.subsystem_vendor, -- ab->id.subsystem_device, -- ab->qmi.target.chip_id, -- ab->qmi.target.board_id, -- variant); -+ if (bus_type_mode) -+ scnprintf(name, name_len, -+ "bus=%s", -+ ath11k_bus_str(ab->hif.bus)); -+ else -+ scnprintf(name, name_len, -+ "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s", -+ ath11k_bus_str(ab->hif.bus), -+ ab->id.vendor, ab->id.device, -+ ab->id.subsystem_vendor, -+ ab->id.subsystem_device, -+ ab->qmi.target.chip_id, -+ ab->qmi.target.board_id, -+ variant); - break; - default: - scnprintf(name, name_len, -@@ -999,13 +1005,19 @@ static int __ath11k_core_create_board_na - static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name, - size_t name_len) - { -- return __ath11k_core_create_board_name(ab, name, name_len, true); -+ return __ath11k_core_create_board_name(ab, name, name_len, true, false); - } - - static int ath11k_core_create_fallback_board_name(struct ath11k_base *ab, char *name, - size_t name_len) - { -- return __ath11k_core_create_board_name(ab, name, name_len, false); -+ return __ath11k_core_create_board_name(ab, name, name_len, false, false); -+} -+ -+static int ath11k_core_create_bus_type_board_name(struct ath11k_base *ab, char *name, -+ size_t name_len) -+{ -+ return __ath11k_core_create_board_name(ab, name, name_len, false, true); - } - - const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab, -@@ -1309,7 +1321,7 @@ success: - - int ath11k_core_fetch_regdb(struct ath11k_base *ab, struct ath11k_board_data *bd) - { -- char boardname[BOARD_NAME_SIZE]; -+ char boardname[BOARD_NAME_SIZE], default_boardname[BOARD_NAME_SIZE]; - int ret; - - ret = ath11k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE); -@@ -1323,6 +1335,21 @@ int ath11k_core_fetch_regdb(struct ath11 - ATH11K_BD_IE_REGDB, - ATH11K_BD_IE_REGDB_NAME, - ATH11K_BD_IE_REGDB_DATA); -+ if (!ret) -+ goto exit; -+ -+ ret = ath11k_core_create_bus_type_board_name(ab, default_boardname, -+ BOARD_NAME_SIZE); -+ if (ret) { -+ ath11k_dbg(ab, ATH11K_DBG_BOOT, -+ "failed to create default board name for regdb: %d", ret); -+ goto exit; -+ } -+ -+ ret = ath11k_core_fetch_board_data_api_n(ab, bd, default_boardname, -+ ATH11K_BD_IE_REGDB, -+ ATH11K_BD_IE_REGDB_NAME, -+ ATH11K_BD_IE_REGDB_DATA); - if (!ret) - goto exit; - diff --git a/package/kernel/mac80211/patches/ath11k/0081-wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch b/package/kernel/mac80211/patches/ath11k/0081-wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch deleted file mode 100644 index b5dc83f007e..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0081-wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 86f85575a3f6a20cef1c8bb98e78585fe3a53ccc Mon Sep 17 00:00:00 2001 -From: Govindaraj Saminathan -Date: Fri, 26 May 2023 12:41:06 +0300 -Subject: [PATCH 82/84] wifi: ath11k: remove unused function - ath11k_tm_event_wmi() - -The function ath11k_tm_event_wmi() is only defined and it is not used -anywhere. Hence remove the unused. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Govindaraj Saminathan -Signed-off-by: Raj Kumar Bhagat -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230517135934.16408-2-quic_rajkbhag@quicinc.com ---- - drivers/net/wireless/ath/ath11k/testmode.c | 64 +--------------------- - drivers/net/wireless/ath/ath11k/testmode.h | 8 +-- - 2 files changed, 2 insertions(+), 70 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/testmode.c -+++ b/drivers/net/wireless/ath/ath11k/testmode.c -@@ -1,6 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include "testmode.h" -@@ -20,69 +21,6 @@ static const struct nla_policy ath11k_tm - [ATH11K_TM_ATTR_VERSION_MINOR] = { .type = NLA_U32 }, - }; - --/* Returns true if callee consumes the skb and the skb should be discarded. -- * Returns false if skb is not used. Does not sleep. -- */ --bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, struct sk_buff *skb) --{ -- struct sk_buff *nl_skb; -- bool consumed; -- int ret; -- -- ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, -- "testmode event wmi cmd_id %d skb %pK skb->len %d\n", -- cmd_id, skb, skb->len); -- -- ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", skb->data, skb->len); -- -- spin_lock_bh(&ar->data_lock); -- -- consumed = true; -- -- nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy, -- 2 * sizeof(u32) + skb->len, -- GFP_ATOMIC); -- if (!nl_skb) { -- ath11k_warn(ar->ab, -- "failed to allocate skb for testmode wmi event\n"); -- goto out; -- } -- -- ret = nla_put_u32(nl_skb, ATH11K_TM_ATTR_CMD, ATH11K_TM_CMD_WMI); -- if (ret) { -- ath11k_warn(ar->ab, -- "failed to put testmode wmi event cmd attribute: %d\n", -- ret); -- kfree_skb(nl_skb); -- goto out; -- } -- -- ret = nla_put_u32(nl_skb, ATH11K_TM_ATTR_WMI_CMDID, cmd_id); -- if (ret) { -- ath11k_warn(ar->ab, -- "failed to put testmode wmi even cmd_id: %d\n", -- ret); -- kfree_skb(nl_skb); -- goto out; -- } -- -- ret = nla_put(nl_skb, ATH11K_TM_ATTR_DATA, skb->len, skb->data); -- if (ret) { -- ath11k_warn(ar->ab, -- "failed to copy skb to testmode wmi event: %d\n", -- ret); -- kfree_skb(nl_skb); -- goto out; -- } -- -- cfg80211_testmode_event(nl_skb, GFP_ATOMIC); -- --out: -- spin_unlock_bh(&ar->data_lock); -- -- return consumed; --} -- - static int ath11k_tm_cmd_get_version(struct ath11k *ar, struct nlattr *tb[]) - { - struct sk_buff *skb; ---- a/drivers/net/wireless/ath/ath11k/testmode.h -+++ b/drivers/net/wireless/ath/ath11k/testmode.h -@@ -1,24 +1,18 @@ - /* SPDX-License-Identifier: BSD-3-Clause-Clear */ - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include "core.h" - - #ifdef CPTCFG_NL80211_TESTMODE - --bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, struct sk_buff *skb); - int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - void *data, int len); - - #else - --static inline bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, -- struct sk_buff *skb) --{ -- return false; --} -- - static inline int ath11k_tm_cmd(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - void *data, int len) diff --git a/package/kernel/mac80211/patches/ath11k/0082-wifi-ath11k-factory-test-mode-support.patch b/package/kernel/mac80211/patches/ath11k/0082-wifi-ath11k-factory-test-mode-support.patch deleted file mode 100644 index f1b262724f9..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0082-wifi-ath11k-factory-test-mode-support.patch +++ /dev/null @@ -1,850 +0,0 @@ -From b43310e44edc823a7f02af1e1e2b4e8a9abc7d91 Mon Sep 17 00:00:00 2001 -From: Govindaraj Saminathan -Date: Fri, 26 May 2023 12:41:07 +0300 -Subject: [PATCH 83/84] wifi: ath11k: factory test mode support - -Add support to process factory test mode commands (FTM) for calibration. -By default firmware start with NORMAL mode and to process the FTM commands -firmware needs to be restarted in FTM mode using module parameter ftm_mode. -The pre-request is all the radios should be down before starting the test. - -When start command ATH11K_TM_CMD_TESTMODE_START is received, ar->state -is set to Test Mode. If the FTM command or event length is greater -than 256 bytes, it will be broken down into multiple segments and -encoded with TLV header if it is segmented commands, else it is sent -to firmware as it is. - -On receiving UTF event from firmware, if it is segmented event, the driver -will wait until it receives all the segments and notify the complete -data to user application. In case the segmented sequence are missed or -lost from the firmware, driver will skip the already received partial data. - -In case of unsegmented UTF event from firmware, driver notifies the -data to the user application as it comes. Applications handles -the data further. - -Command to boot in ftm mode: - -insmod ath11k ftm_mode=1 - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Govindaraj Saminathan -Co-developed-by: Sowmiya Sree Elavalagan -Signed-off-by: Sowmiya Sree Elavalagan -Signed-off-by: Raj Kumar Bhagat -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230517135934.16408-4-quic_rajkbhag@quicinc.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 3 +- - drivers/net/wireless/ath/ath11k/core.c | 21 +- - drivers/net/wireless/ath/ath11k/core.h | 16 +- - drivers/net/wireless/ath/ath11k/debug.h | 1 + - drivers/net/wireless/ath/ath11k/mac.c | 11 +- - drivers/net/wireless/ath/ath11k/pci.c | 3 +- - drivers/net/wireless/ath/ath11k/testmode.c | 350 ++++++++++++++++++- - drivers/net/wireless/ath/ath11k/testmode.h | 6 + - drivers/net/wireless/ath/ath11k/testmode_i.h | 18 +- - drivers/net/wireless/ath/ath11k/wmi.c | 11 +- - drivers/net/wireless/ath/ath11k/wmi.h | 22 ++ - drivers/net/wireless/ath/ath11k/wow.c | 3 +- - 12 files changed, 444 insertions(+), 21 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -1155,6 +1155,7 @@ static int ath11k_ahb_probe(struct platf - ab->hif.ops = hif_ops; - ab->pdev = pdev; - ab->hw_rev = hw_rev; -+ ab->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL; - platform_set_drvdata(pdev, ab); - - ret = ath11k_pcic_register_pci_ops(ab, pci_ops); ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.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-2022 Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -32,6 +32,10 @@ module_param_named(frame_mode, ath11k_fr - MODULE_PARM_DESC(frame_mode, - "Datapath frame mode (0: raw, 1: native wifi (default), 2: ethernet)"); - -+bool ath11k_ftm_mode; -+module_param_named(ftm_mode, ath11k_ftm_mode, bool, 0444); -+MODULE_PARM_DESC(ftm_mode, "Boots up in factory test mode"); -+ - static const struct ath11k_hw_params ath11k_hw_params[] = { - { - .hw_rev = ATH11K_HW_IPQ8074, -@@ -1381,6 +1385,11 @@ static int ath11k_core_soc_create(struct - { - int ret; - -+ if (ath11k_ftm_mode) { -+ ab->fw_mode = ATH11K_FIRMWARE_MODE_FTM; -+ ath11k_info(ab, "Booting in factory test mode\n"); -+ } -+ - ret = ath11k_qmi_init_service(ab); - if (ret) { - ath11k_err(ab, "failed to initialize qmi :%d\n", ret); -@@ -1607,7 +1616,7 @@ int ath11k_core_qmi_firmware_ready(struc - { - int ret; - -- ret = ath11k_core_start_firmware(ab, ATH11K_FIRMWARE_MODE_NORMAL); -+ ret = ath11k_core_start_firmware(ab, ab->fw_mode); - if (ret) { - ath11k_err(ab, "failed to start firmware: %d\n", ret); - return ret; -@@ -1772,7 +1781,8 @@ void ath11k_core_pre_reconfigure_recover - for (i = 0; i < ab->num_radios; i++) { - pdev = &ab->pdevs[i]; - ar = pdev->ar; -- if (!ar || ar->state == ATH11K_STATE_OFF) -+ if (!ar || ar->state == ATH11K_STATE_OFF || -+ ar->state == ATH11K_STATE_FTM) - continue; - - ieee80211_stop_queues(ar->hw); -@@ -1841,7 +1851,12 @@ static void ath11k_core_post_reconfigure - ath11k_warn(ab, - "device is wedged, will not restart radio %d\n", i); - break; -+ case ATH11K_STATE_FTM: -+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, -+ "fw mode reset done radio %d\n", i); -+ break; - } -+ - mutex_unlock(&ar->conf_mutex); - } - complete(&ab->driver_recovery); ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -1,7 +1,7 @@ - /* SPDX-License-Identifier: BSD-3-Clause-Clear */ - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #ifndef ATH11K_CORE_H -@@ -52,6 +52,7 @@ - #define ATH11K_SMBIOS_BDF_EXT_MAGIC "BDF_" - - extern unsigned int ath11k_frame_mode; -+extern bool ath11k_ftm_mode; - - #define ATH11K_SCAN_TIMEOUT_HZ (20 * HZ) - -@@ -277,6 +278,7 @@ enum ath11k_dev_flags { - ATH11K_FLAG_FIXED_MEM_RGN, - ATH11K_FLAG_DEVICE_INIT_DONE, - ATH11K_FLAG_MULTI_MSI_VECTORS, -+ ATH11K_FLAG_FTM_SEGMENTED, - }; - - enum ath11k_monitor_flags { -@@ -530,6 +532,7 @@ enum ath11k_state { - ATH11K_STATE_RESTARTING, - ATH11K_STATE_RESTARTED, - ATH11K_STATE_WEDGED, -+ ATH11K_STATE_FTM, - /* Add other states as required */ - }; - -@@ -709,6 +712,8 @@ struct ath11k { - u32 last_ppdu_id; - u32 cached_ppdu_id; - int monitor_vdev_id; -+ struct completion fw_mode_reset; -+ u8 ftm_msgref; - #ifdef CPTCFG_ATH11K_DEBUGFS - struct ath11k_debug debug; - #endif -@@ -838,6 +843,7 @@ struct ath11k_msi_config { - /* Master structure to hold the hw data which may be used in core module */ - struct ath11k_base { - enum ath11k_hw_rev hw_rev; -+ enum ath11k_firmware_mode fw_mode; - struct platform_device *pdev; - struct device *dev; - struct ath11k_qmi qmi; -@@ -978,6 +984,14 @@ struct ath11k_base { - const struct ath11k_pci_ops *ops; - } pci; - -+#ifdef CPTCFG_NL80211_TESTMODE -+ struct { -+ u32 data_pos; -+ u32 expected_seq; -+ u8 *eventdata; -+ } testmode; -+#endif -+ - /* must be last */ - u8 drv_priv[] __aligned(sizeof(void *)); - }; ---- a/drivers/net/wireless/ath/ath11k/debug.h -+++ b/drivers/net/wireless/ath/ath11k/debug.h -@@ -1,6 +1,7 @@ - /* SPDX-License-Identifier: BSD-3-Clause-Clear */ - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #ifndef _ATH11K_DEBUG_H_ ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -643,7 +643,10 @@ struct ath11k *ath11k_mac_get_ar_by_pdev - return NULL; - - for (i = 0; i < ab->num_radios; i++) { -- pdev = rcu_dereference(ab->pdevs_active[i]); -+ if (ab->fw_mode == ATH11K_FIRMWARE_MODE_FTM) -+ pdev = &ab->pdevs[i]; -+ else -+ pdev = rcu_dereference(ab->pdevs_active[i]); - - if (pdev && pdev->pdev_id == pdev_id) - return (pdev->ar ? pdev->ar : NULL); -@@ -6271,6 +6274,11 @@ static int ath11k_mac_op_start(struct ie - struct ath11k_pdev *pdev = ar->pdev; - int ret; - -+ if (ath11k_ftm_mode) { -+ ath11k_warn(ab, "mac operations not supported in factory test mode\n"); -+ return -EOPNOTSUPP; -+ } -+ - ath11k_mac_drain_tx(ar); - mutex_lock(&ar->conf_mutex); - -@@ -6285,6 +6293,7 @@ static int ath11k_mac_op_start(struct ie - case ATH11K_STATE_RESTARTED: - case ATH11K_STATE_WEDGED: - case ATH11K_STATE_ON: -+ case ATH11K_STATE_FTM: - WARN_ON(1); - ret = -EINVAL; - goto err; ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. -- * Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -745,6 +745,7 @@ static int ath11k_pci_probe(struct pci_d - ab_pci->ab = ab; - ab_pci->pdev = pdev; - ab->hif.ops = &ath11k_pci_hif_ops; -+ ab->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL; - pci_set_drvdata(pdev, ab); - spin_lock_init(&ab_pci->window_lock); - ---- a/drivers/net/wireless/ath/ath11k/testmode.c -+++ b/drivers/net/wireless/ath/ath11k/testmode.c -@@ -12,6 +12,9 @@ - #include "core.h" - #include "testmode_i.h" - -+#define ATH11K_FTM_SEGHDR_CURRENT_SEQ GENMASK(3, 0) -+#define ATH11K_FTM_SEGHDR_TOTAL_SEGMENTS GENMASK(7, 4) -+ - static const struct nla_policy ath11k_tm_policy[ATH11K_TM_ATTR_MAX + 1] = { - [ATH11K_TM_ATTR_CMD] = { .type = NLA_U32 }, - [ATH11K_TM_ATTR_DATA] = { .type = NLA_BINARY, -@@ -21,13 +24,217 @@ static const struct nla_policy ath11k_tm - [ATH11K_TM_ATTR_VERSION_MINOR] = { .type = NLA_U32 }, - }; - -+static struct ath11k *ath11k_tm_get_ar(struct ath11k_base *ab) -+{ -+ struct ath11k_pdev *pdev; -+ struct ath11k *ar = NULL; -+ int i; -+ -+ for (i = 0; i < ab->num_radios; i++) { -+ pdev = &ab->pdevs[i]; -+ ar = pdev->ar; -+ -+ if (ar && ar->state == ATH11K_STATE_FTM) -+ break; -+ } -+ -+ return ar; -+} -+ -+/* This function handles unsegmented events. Data in various events are aggregated -+ * in application layer, this event is unsegmented from host perspective. -+ */ -+static void ath11k_tm_wmi_event_unsegmented(struct ath11k_base *ab, u32 cmd_id, -+ struct sk_buff *skb) -+{ -+ struct sk_buff *nl_skb; -+ struct ath11k *ar; -+ -+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, -+ "event wmi cmd_id %d skb length %d\n", -+ cmd_id, skb->len); -+ ath11k_dbg_dump(ab, ATH11K_DBG_TESTMODE, NULL, "", skb->data, skb->len); -+ -+ ar = ath11k_tm_get_ar(ab); -+ if (!ar) { -+ ath11k_warn(ab, "testmode event not handled due to invalid pdev\n"); -+ return; -+ } -+ -+ spin_lock_bh(&ar->data_lock); -+ -+ nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy, -+ 2 * nla_total_size(sizeof(u32)) + -+ nla_total_size(skb->len), -+ GFP_ATOMIC); -+ if (!nl_skb) { -+ ath11k_warn(ab, -+ "failed to allocate skb for unsegmented testmode wmi event\n"); -+ goto out; -+ } -+ -+ if (nla_put_u32(nl_skb, ATH11K_TM_ATTR_CMD, ATH11K_TM_CMD_WMI) || -+ nla_put_u32(nl_skb, ATH11K_TM_ATTR_WMI_CMDID, cmd_id) || -+ nla_put(nl_skb, ATH11K_TM_ATTR_DATA, skb->len, skb->data)) { -+ ath11k_warn(ab, "failed to populate testmode unsegmented event\n"); -+ kfree_skb(nl_skb); -+ goto out; -+ } -+ -+ cfg80211_testmode_event(nl_skb, GFP_ATOMIC); -+ spin_unlock_bh(&ar->data_lock); -+ return; -+ -+out: -+ spin_unlock_bh(&ar->data_lock); -+ ath11k_warn(ab, "Failed to send testmode event to higher layers\n"); -+} -+ -+/* This function handles segmented events. Data of various events received -+ * from firmware is aggregated and sent to application layer -+ */ -+static int ath11k_tm_process_event(struct ath11k_base *ab, u32 cmd_id, -+ const struct wmi_ftm_event_msg *ftm_msg, -+ u16 length) -+{ -+ struct sk_buff *nl_skb; -+ int ret = 0; -+ struct ath11k *ar; -+ u8 const *buf_pos; -+ u16 datalen; -+ u8 total_segments, current_seq; -+ u32 data_pos; -+ u32 pdev_id; -+ -+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, -+ "event wmi cmd_id %d ftm event msg %pK datalen %d\n", -+ cmd_id, ftm_msg, length); -+ ath11k_dbg_dump(ab, ATH11K_DBG_TESTMODE, NULL, "", ftm_msg, length); -+ pdev_id = DP_HW2SW_MACID(ftm_msg->seg_hdr.pdev_id); -+ -+ if (pdev_id >= ab->num_radios) { -+ ath11k_warn(ab, "testmode event not handled due to invalid pdev id: %d\n", -+ pdev_id); -+ return -EINVAL; -+ } -+ -+ ar = ab->pdevs[pdev_id].ar; -+ if (!ar) { -+ ath11k_warn(ab, "testmode event not handled due to absence of pdev\n"); -+ return -ENODEV; -+ } -+ -+ current_seq = FIELD_GET(ATH11K_FTM_SEGHDR_CURRENT_SEQ, -+ ftm_msg->seg_hdr.segmentinfo); -+ total_segments = FIELD_GET(ATH11K_FTM_SEGHDR_TOTAL_SEGMENTS, -+ ftm_msg->seg_hdr.segmentinfo); -+ datalen = length - (sizeof(struct wmi_ftm_seg_hdr)); -+ buf_pos = ftm_msg->data; -+ -+ spin_lock_bh(&ar->data_lock); -+ -+ if (current_seq == 0) { -+ ab->testmode.expected_seq = 0; -+ ab->testmode.data_pos = 0; -+ } -+ -+ data_pos = ab->testmode.data_pos; -+ -+ if ((data_pos + datalen) > ATH11K_FTM_EVENT_MAX_BUF_LENGTH) { -+ ath11k_warn(ab, "Invalid ftm event length at %d: %d\n", -+ data_pos, datalen); -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ memcpy(&ab->testmode.eventdata[data_pos], buf_pos, datalen); -+ data_pos += datalen; -+ -+ if (++ab->testmode.expected_seq != total_segments) { -+ ab->testmode.data_pos = data_pos; -+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, -+ "partial data received current_seq %d total_seg %d\n", -+ current_seq, total_segments); -+ goto out; -+ } -+ -+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE, -+ "total data length pos %d len %d\n", -+ data_pos, ftm_msg->seg_hdr.len); -+ nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy, -+ 2 * nla_total_size(sizeof(u32)) + -+ nla_total_size(data_pos), -+ GFP_ATOMIC); -+ if (!nl_skb) { -+ ath11k_warn(ab, -+ "failed to allocate skb for segmented testmode wmi event\n"); -+ ret = -ENOMEM; -+ goto out; -+ } -+ -+ if (nla_put_u32(nl_skb, ATH11K_TM_ATTR_CMD, -+ ATH11K_TM_CMD_WMI_FTM) || -+ nla_put_u32(nl_skb, ATH11K_TM_ATTR_WMI_CMDID, cmd_id) || -+ nla_put(nl_skb, ATH11K_TM_ATTR_DATA, data_pos, -+ &ab->testmode.eventdata[0])) { -+ ath11k_warn(ab, "failed to populate segmented testmode event"); -+ kfree_skb(nl_skb); -+ ret = -ENOBUFS; -+ goto out; -+ } -+ -+ cfg80211_testmode_event(nl_skb, GFP_ATOMIC); -+ -+out: -+ spin_unlock_bh(&ar->data_lock); -+ return ret; -+} -+ -+static void ath11k_tm_wmi_event_segmented(struct ath11k_base *ab, u32 cmd_id, -+ struct sk_buff *skb) -+{ -+ const void **tb; -+ const struct wmi_ftm_event_msg *ev; -+ u16 length; -+ int ret; -+ -+ tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); -+ if (IS_ERR(tb)) { -+ ret = PTR_ERR(tb); -+ ath11k_warn(ab, "failed to parse ftm event tlv: %d\n", ret); -+ return; -+ } -+ -+ ev = tb[WMI_TAG_ARRAY_BYTE]; -+ if (!ev) { -+ ath11k_warn(ab, "failed to fetch ftm msg\n"); -+ kfree(tb); -+ return; -+ } -+ -+ length = skb->len - TLV_HDR_SIZE; -+ ret = ath11k_tm_process_event(ab, cmd_id, ev, length); -+ if (ret) -+ ath11k_warn(ab, "Failed to process ftm event\n"); -+ -+ kfree(tb); -+} -+ -+void ath11k_tm_wmi_event(struct ath11k_base *ab, u32 cmd_id, struct sk_buff *skb) -+{ -+ if (test_bit(ATH11K_FLAG_FTM_SEGMENTED, &ab->dev_flags)) -+ ath11k_tm_wmi_event_segmented(ab, cmd_id, skb); -+ else -+ ath11k_tm_wmi_event_unsegmented(ab, cmd_id, skb); -+} -+ - static int ath11k_tm_cmd_get_version(struct ath11k *ar, struct nlattr *tb[]) - { - struct sk_buff *skb; - int ret; - - ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, -- "testmode cmd get version_major %d version_minor %d\n", -+ "cmd get version_major %d version_minor %d\n", - ATH11K_TESTMODE_VERSION_MAJOR, - ATH11K_TESTMODE_VERSION_MINOR); - -@@ -53,6 +260,43 @@ static int ath11k_tm_cmd_get_version(str - return cfg80211_testmode_reply(skb); - } - -+static int ath11k_tm_cmd_testmode_start(struct ath11k *ar, struct nlattr *tb[]) -+{ -+ int ret; -+ -+ mutex_lock(&ar->conf_mutex); -+ -+ if (ar->state == ATH11K_STATE_FTM) { -+ ret = -EALREADY; -+ goto err; -+ } -+ -+ /* start utf only when the driver is not in use */ -+ if (ar->state != ATH11K_STATE_OFF) { -+ ret = -EBUSY; -+ goto err; -+ } -+ -+ ar->ab->testmode.eventdata = kzalloc(ATH11K_FTM_EVENT_MAX_BUF_LENGTH, -+ GFP_KERNEL); -+ if (!ar->ab->testmode.eventdata) { -+ ret = -ENOMEM; -+ goto err; -+ } -+ -+ ar->state = ATH11K_STATE_FTM; -+ ar->ftm_msgref = 0; -+ -+ mutex_unlock(&ar->conf_mutex); -+ -+ ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, "cmd start\n"); -+ return 0; -+ -+err: -+ mutex_unlock(&ar->conf_mutex); -+ return ret; -+} -+ - static int ath11k_tm_cmd_wmi(struct ath11k *ar, struct nlattr *tb[]) - { - struct ath11k_pdev_wmi *wmi = ar->wmi; -@@ -63,11 +307,6 @@ static int ath11k_tm_cmd_wmi(struct ath1 - - mutex_lock(&ar->conf_mutex); - -- if (ar->state != ATH11K_STATE_ON) { -- ret = -ENETDOWN; -- goto out; -- } -- - if (!tb[ATH11K_TM_ATTR_DATA]) { - ret = -EINVAL; - goto out; -@@ -80,11 +319,17 @@ static int ath11k_tm_cmd_wmi(struct ath1 - - buf = nla_data(tb[ATH11K_TM_ATTR_DATA]); - buf_len = nla_len(tb[ATH11K_TM_ATTR_DATA]); -+ if (!buf_len) { -+ ath11k_warn(ar->ab, "No data present in testmode wmi command\n"); -+ ret = -EINVAL; -+ goto out; -+ } -+ - cmd_id = nla_get_u32(tb[ATH11K_TM_ATTR_WMI_CMDID]); - - ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, -- "testmode cmd wmi cmd_id %d buf %pK buf_len %d\n", -- cmd_id, buf, buf_len); -+ "cmd wmi cmd_id %d buf length %d\n", -+ cmd_id, buf_len); - - ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", buf, buf_len); - -@@ -111,6 +356,91 @@ out: - return ret; - } - -+static int ath11k_tm_cmd_wmi_ftm(struct ath11k *ar, struct nlattr *tb[]) -+{ -+ struct ath11k_pdev_wmi *wmi = ar->wmi; -+ struct ath11k_base *ab = ar->ab; -+ struct sk_buff *skb; -+ u32 cmd_id, buf_len, hdr_info; -+ int ret; -+ void *buf; -+ u8 segnumber = 0, seginfo; -+ u16 chunk_len, total_bytes, num_segments; -+ u8 *bufpos; -+ struct wmi_ftm_cmd *ftm_cmd; -+ -+ set_bit(ATH11K_FLAG_FTM_SEGMENTED, &ab->dev_flags); -+ -+ mutex_lock(&ar->conf_mutex); -+ -+ if (ar->state != ATH11K_STATE_FTM) { -+ ret = -ENETDOWN; -+ goto out; -+ } -+ -+ if (!tb[ATH11K_TM_ATTR_DATA]) { -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ buf = nla_data(tb[ATH11K_TM_ATTR_DATA]); -+ buf_len = nla_len(tb[ATH11K_TM_ATTR_DATA]); -+ cmd_id = WMI_PDEV_UTF_CMDID; -+ -+ ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, -+ "cmd wmi ftm cmd_id %d buffer length %d\n", -+ cmd_id, buf_len); -+ ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", buf, buf_len); -+ -+ bufpos = buf; -+ total_bytes = buf_len; -+ num_segments = total_bytes / MAX_WMI_UTF_LEN; -+ -+ if (buf_len - (num_segments * MAX_WMI_UTF_LEN)) -+ num_segments++; -+ -+ while (buf_len) { -+ chunk_len = min_t(u16, buf_len, MAX_WMI_UTF_LEN); -+ -+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, (chunk_len + -+ sizeof(struct wmi_ftm_cmd))); -+ if (!skb) { -+ ret = -ENOMEM; -+ goto out; -+ } -+ -+ ftm_cmd = (struct wmi_ftm_cmd *)skb->data; -+ hdr_info = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_BYTE) | -+ FIELD_PREP(WMI_TLV_LEN, (chunk_len + -+ sizeof(struct wmi_ftm_seg_hdr))); -+ ftm_cmd->tlv_header = hdr_info; -+ ftm_cmd->seg_hdr.len = total_bytes; -+ ftm_cmd->seg_hdr.msgref = ar->ftm_msgref; -+ seginfo = FIELD_PREP(ATH11K_FTM_SEGHDR_TOTAL_SEGMENTS, num_segments) | -+ FIELD_PREP(ATH11K_FTM_SEGHDR_CURRENT_SEQ, segnumber); -+ ftm_cmd->seg_hdr.segmentinfo = seginfo; -+ segnumber++; -+ -+ memcpy(&ftm_cmd->data, bufpos, chunk_len); -+ -+ ret = ath11k_wmi_cmd_send(wmi, skb, cmd_id); -+ if (ret) { -+ ath11k_warn(ar->ab, "failed to send wmi ftm command: %d\n", ret); -+ goto out; -+ } -+ -+ buf_len -= chunk_len; -+ bufpos += chunk_len; -+ } -+ -+ ar->ftm_msgref++; -+ ret = 0; -+ -+out: -+ mutex_unlock(&ar->conf_mutex); -+ return ret; -+} -+ - int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - void *data, int len) - { -@@ -131,6 +461,10 @@ int ath11k_tm_cmd(struct ieee80211_hw *h - return ath11k_tm_cmd_get_version(ar, tb); - case ATH11K_TM_CMD_WMI: - return ath11k_tm_cmd_wmi(ar, tb); -+ case ATH11K_TM_CMD_TESTMODE_START: -+ return ath11k_tm_cmd_testmode_start(ar, tb); -+ case ATH11K_TM_CMD_WMI_FTM: -+ return ath11k_tm_cmd_wmi_ftm(ar, tb); - default: - return -EOPNOTSUPP; - } ---- a/drivers/net/wireless/ath/ath11k/testmode.h -+++ b/drivers/net/wireless/ath/ath11k/testmode.h -@@ -8,11 +8,17 @@ - - #ifdef CPTCFG_NL80211_TESTMODE - -+void ath11k_tm_wmi_event(struct ath11k_base *ab, u32 cmd_id, struct sk_buff *skb); - int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - void *data, int len); - - #else - -+static inline void ath11k_tm_wmi_event(struct ath11k_base *ab, u32 cmd_id, -+ struct sk_buff *skb) -+{ -+} -+ - static inline int ath11k_tm_cmd(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - void *data, int len) ---- a/drivers/net/wireless/ath/ath11k/testmode_i.h -+++ b/drivers/net/wireless/ath/ath11k/testmode_i.h -@@ -1,6 +1,7 @@ - /* SPDX-License-Identifier: BSD-3-Clause-Clear */ - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - /* "API" level of the ath11k testmode interface. Bump it after every -@@ -11,9 +12,10 @@ - /* Bump this after every _compatible_ interface change, for example - * addition of a new command or an attribute. - */ --#define ATH11K_TESTMODE_VERSION_MINOR 0 -+#define ATH11K_TESTMODE_VERSION_MINOR 1 - - #define ATH11K_TM_DATA_MAX_LEN 5000 -+#define ATH11K_FTM_EVENT_MAX_BUF_LENGTH 2048 - - enum ath11k_tm_attr { - __ATH11K_TM_ATTR_INVALID = 0, -@@ -47,4 +49,18 @@ enum ath11k_tm_cmd { - * ATH11K_TM_ATTR_DATA. - */ - ATH11K_TM_CMD_WMI = 1, -+ -+ /* Boots the UTF firmware, the netdev interface must be down at the -+ * time. -+ */ -+ ATH11K_TM_CMD_TESTMODE_START = 2, -+ -+ /* The command used to transmit a FTM WMI command to the firmware -+ * and the event to receive WMI events from the firmware. The data -+ * received only contain the payload, need to add the tlv header -+ * and send the cmd to firmware with command id WMI_PDEV_UTF_CMDID. -+ * The data payload size could be large and the driver needs to -+ * send segmented data to firmware. -+ */ -+ ATH11K_TM_CMD_WMI_FTM = 3, - }; ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.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, Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2021, 2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - #include - #include -@@ -19,6 +19,7 @@ - #include "mac.h" - #include "hw.h" - #include "peer.h" -+#include "testmode.h" - - struct wmi_tlv_policy { - size_t min_len; -@@ -237,9 +238,8 @@ static int ath11k_wmi_tlv_parse(struct a - (void *)tb); - } - --static const void ** --ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void *ptr, -- size_t len, gfp_t gfp) -+const void **ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void *ptr, -+ size_t len, gfp_t gfp) - { - const void **tb; - int ret; -@@ -8628,6 +8628,9 @@ static void ath11k_wmi_tlv_op_rx(struct - case WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID: - ath11k_wmi_pdev_csa_switch_count_status_event(ab, skb); - break; -+ case WMI_PDEV_UTF_EVENTID: -+ ath11k_tm_wmi_event(ab, id, skb); -+ break; - case WMI_PDEV_TEMPERATURE_EVENTID: - ath11k_wmi_pdev_temperature_event(ab, skb); - break; ---- a/drivers/net/wireless/ath/ath11k/wmi.h -+++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -1,6 +1,7 @@ - /* SPDX-License-Identifier: BSD-3-Clause-Clear */ - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #ifndef ATH11K_WMI_H -@@ -68,6 +69,7 @@ struct wmi_tlv { - - #define WMI_APPEND_TO_EXISTING_CHAN_LIST_FLAG 1 - -+#define MAX_WMI_UTF_LEN 252 - #define WMI_BA_MODE_BUFFER_SIZE_256 3 - /* - * HW mode config type replicated from FW header -@@ -3564,6 +3566,24 @@ struct wmi_get_pdev_temperature_cmd { - u32 pdev_id; - } __packed; - -+struct wmi_ftm_seg_hdr { -+ u32 len; -+ u32 msgref; -+ u32 segmentinfo; -+ u32 pdev_id; -+} __packed; -+ -+struct wmi_ftm_cmd { -+ u32 tlv_header; -+ struct wmi_ftm_seg_hdr seg_hdr; -+ u8 data[]; -+} __packed; -+ -+struct wmi_ftm_event_msg { -+ struct wmi_ftm_seg_hdr seg_hdr; -+ u8 data[]; -+} __packed; -+ - #define WMI_BEACON_TX_BUFFER_SIZE 512 - - #define WMI_EMA_TMPL_IDX_SHIFT 8 -@@ -6300,6 +6320,8 @@ enum wmi_sta_keepalive_method { - #define WMI_STA_KEEPALIVE_INTERVAL_DEFAULT 30 - #define WMI_STA_KEEPALIVE_INTERVAL_DISABLE 0 - -+const void **ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void *ptr, -+ size_t len, gfp_t gfp); - int ath11k_wmi_cmd_send(struct ath11k_pdev_wmi *wmi, struct sk_buff *skb, - u32 cmd_id); - struct sk_buff *ath11k_wmi_alloc_skb(struct ath11k_wmi_base *wmi_sc, u32 len); ---- a/drivers/net/wireless/ath/ath11k/wow.c -+++ b/drivers/net/wireless/ath/ath11k/wow.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2020 The Linux Foundation. All rights reserved. -- * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -838,6 +838,7 @@ exit: - case ATH11K_STATE_RESTARTING: - case ATH11K_STATE_RESTARTED: - case ATH11K_STATE_WEDGED: -+ case ATH11K_STATE_FTM: - ath11k_warn(ar->ab, "encountered unexpected device state %d on resume, cannot recover\n", - ar->state); - ret = -EIO; diff --git a/package/kernel/mac80211/patches/ath11k/0083-wifi-ath11k-Allow-ath11k-to-boot-without-caldata-in-.patch b/package/kernel/mac80211/patches/ath11k/0083-wifi-ath11k-Allow-ath11k-to-boot-without-caldata-in-.patch deleted file mode 100644 index 5a1fa882948..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0083-wifi-ath11k-Allow-ath11k-to-boot-without-caldata-in-.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 8aeba427296bff6a6051686f1d139c89a0b00e4c Mon Sep 17 00:00:00 2001 -From: Sowmiya Sree Elavalagan -Date: Fri, 26 May 2023 12:41:07 +0300 -Subject: [PATCH 84/84] wifi: ath11k: Allow ath11k to boot without caldata in - ftm mode - -Currently, if ath11k is unable to load the calibration data file it will -always exit. However the calibration data may not be present in factory -test mode, so update the logic to allow the driver to execute in FTM mode -even if downloading the calibration data fails. - -Tested-on : IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Sowmiya Sree Elavalagan -Signed-off-by: Raj Kumar Bhagat -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230517135934.16408-5-quic_rajkbhag@quicinc.com ---- - drivers/net/wireless/ath/ath11k/qmi.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/qmi.c -+++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -2460,6 +2460,14 @@ static int ath11k_qmi_load_bdf_qmi(struc - - fw_entry = ath11k_core_firmware_request(ab, ATH11K_DEFAULT_CAL_FILE); - if (IS_ERR(fw_entry)) { -+ /* Caldata may not be present during first time calibration in -+ * factory hence allow to boot without loading caldata in ftm mode -+ */ -+ if (ath11k_ftm_mode) { -+ ath11k_info(ab, -+ "Booting without cal data file in factory test mode\n"); -+ return 0; -+ } - ret = PTR_ERR(fw_entry); - ath11k_warn(ab, - "qmi failed to load CAL data file:%s\n", diff --git a/package/kernel/mac80211/patches/ath11k/0084-wifi-ath11k-Add-HTT-stats-for-PHY-reset-case.patch b/package/kernel/mac80211/patches/ath11k/0084-wifi-ath11k-Add-HTT-stats-for-PHY-reset-case.patch deleted file mode 100644 index 946f5f7b578..00000000000 --- a/package/kernel/mac80211/patches/ath11k/0084-wifi-ath11k-Add-HTT-stats-for-PHY-reset-case.patch +++ /dev/null @@ -1,261 +0,0 @@ -From 2d4f9093e2d8531ad0a2bb98fe5b36dc8addf2a2 Mon Sep 17 00:00:00 2001 -From: Nidhi Jain -Date: Fri, 26 May 2023 12:41:07 +0300 -Subject: [PATCH] wifi: ath11k: Add HTT stats for PHY reset case - -New HTT stats are added with stats type 37 to -provide PHY reset stats and PHY reset counter stats. - -PHY reset stats are used to display the current -PHY-related operation information such as band, CCA -threshold, current operating channel etc., - -PHY reset counter stats are used to display the -PHY reset counter values like calibration counts, -temperature based recalibration counts etc., - -Usage: -echo 37 > /sys/kernel/debug/ieee80211/phyX/ath11k/htt_stats_type -cat /sys/kernel/debug/ieee80211/phyx/ath11k/htt_stats - -Output: - -HTT_PHY_RESET_STATS_TLV: -pdev_id = 0 -chan_mhz = 5180 -chan_band_center_freq1 = 5210 -chan_band_center_freq2 = 0 -chan_phy_mode = 18 -chan_flags = 0x8 -chan_num = 36 -reset_cause = 0x50000 -prev_reset_cause = 0x50000 -phy_warm_reset_src = 0x0 -rx_gain_tbl_mode = 0 -xbar_val = 0xfac688 -force_calibration = 0 -phyrf_mode = 0 -phy_homechan = 0 -phy_tx_ch_mask = 0x3 -phy_rx_ch_mask = 0x3 -phybb_ini_mask = 0x5 -phyrf_ini_mask = 0x0 -phy_dfs_en_mask = 0x0 -phy_sscan_en_mask = 0x0 -phy_synth_sel_mask = 0x0 -phy_adfs_freq = 0 -cck_fir_settings = 0x0 -phy_dyn_pri_chan = 6 -cca_thresh = 0x26232020 -dyn_cca_status = 0 -rxdesense_thresh_hw = 0xcfe0afe -rxdesense_thresh_sw = 0xcfe0afe - -HTT_PHY_RESET_COUNTERS_TLV: -pdev_id = 0 -cf_active_low_fail_cnt = 0 -cf_active_low_pass_cnt = 0 -phy_off_through_vreg_cnt = 0 -force_calibration_cnt = 0 -rf_mode_switch_phy_off_cnt = 0 - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Nidhi Jain -Signed-off-by: Maharaja Kennadyrajan -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230517141242.2754293-1-quic_mkenna@quicinc.com ---- - .../wireless/ath/ath11k/debugfs_htt_stats.c | 114 ++++++++++++++++++ - .../wireless/ath/ath11k/debugfs_htt_stats.h | 43 +++++++ - 2 files changed, 157 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c -+++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c -@@ -4011,6 +4011,114 @@ void htt_print_phy_stats_tlv(const void - stats_req->buf_len = len; - } - -+static inline void -+htt_print_phy_reset_counters_tlv(const void *tag_buf, -+ u16 tag_len, -+ struct debug_htt_stats_req *stats_req) -+{ -+ const struct htt_phy_reset_counters_tlv *htt_stats_buf = tag_buf; -+ u8 *buf = stats_req->buf; -+ u32 len = stats_req->buf_len; -+ u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; -+ -+ if (tag_len < sizeof(*htt_stats_buf)) -+ return; -+ -+ len += scnprintf(buf + len, buf_len - len, "HTT_PHY_RESET_COUNTERS_TLV:\n"); -+ -+ len += scnprintf(buf + len, buf_len - len, "pdev_id = %u\n", -+ htt_stats_buf->pdev_id); -+ len += scnprintf(buf + len, buf_len - len, "cf_active_low_fail_cnt = %u\n", -+ htt_stats_buf->cf_active_low_fail_cnt); -+ len += scnprintf(buf + len, buf_len - len, "cf_active_low_pass_cnt = %u\n", -+ htt_stats_buf->cf_active_low_pass_cnt); -+ len += scnprintf(buf + len, buf_len - len, "phy_off_through_vreg_cnt = %u\n", -+ htt_stats_buf->phy_off_through_vreg_cnt); -+ len += scnprintf(buf + len, buf_len - len, "force_calibration_cnt = %u\n", -+ htt_stats_buf->force_calibration_cnt); -+ len += scnprintf(buf + len, buf_len - len, "rf_mode_switch_phy_off_cnt = %u\n", -+ htt_stats_buf->rf_mode_switch_phy_off_cnt); -+ -+ stats_req->buf_len = len; -+} -+ -+static inline void -+htt_print_phy_reset_stats_tlv(const void *tag_buf, -+ u16 tag_len, -+ struct debug_htt_stats_req *stats_req) -+{ -+ const struct htt_phy_reset_stats_tlv *htt_stats_buf = tag_buf; -+ u8 *buf = stats_req->buf; -+ u32 len = stats_req->buf_len; -+ u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; -+ -+ if (tag_len < sizeof(*htt_stats_buf)) -+ return; -+ -+ len += scnprintf(buf + len, buf_len - len, "HTT_PHY_RESET_STATS_TLV:\n"); -+ -+ len += scnprintf(buf + len, buf_len - len, "pdev_id = %u\n", -+ htt_stats_buf->pdev_id); -+ len += scnprintf(buf + len, buf_len - len, "chan_mhz = %u\n", -+ htt_stats_buf->chan_mhz); -+ len += scnprintf(buf + len, buf_len - len, "chan_band_center_freq1 = %u\n", -+ htt_stats_buf->chan_band_center_freq1); -+ len += scnprintf(buf + len, buf_len - len, "chan_band_center_freq2 = %u\n", -+ htt_stats_buf->chan_band_center_freq2); -+ len += scnprintf(buf + len, buf_len - len, "chan_phy_mode = %u\n", -+ htt_stats_buf->chan_phy_mode); -+ len += scnprintf(buf + len, buf_len - len, "chan_flags = 0x%0x\n", -+ htt_stats_buf->chan_flags); -+ len += scnprintf(buf + len, buf_len - len, "chan_num = %u\n", -+ htt_stats_buf->chan_num); -+ len += scnprintf(buf + len, buf_len - len, "reset_cause = 0x%0x\n", -+ htt_stats_buf->reset_cause); -+ len += scnprintf(buf + len, buf_len - len, "prev_reset_cause = 0x%0x\n", -+ htt_stats_buf->prev_reset_cause); -+ len += scnprintf(buf + len, buf_len - len, "phy_warm_reset_src = 0x%0x\n", -+ htt_stats_buf->phy_warm_reset_src); -+ len += scnprintf(buf + len, buf_len - len, "rx_gain_tbl_mode = %d\n", -+ htt_stats_buf->rx_gain_tbl_mode); -+ len += scnprintf(buf + len, buf_len - len, "xbar_val = 0x%0x\n", -+ htt_stats_buf->xbar_val); -+ len += scnprintf(buf + len, buf_len - len, "force_calibration = %u\n", -+ htt_stats_buf->force_calibration); -+ len += scnprintf(buf + len, buf_len - len, "phyrf_mode = %u\n", -+ htt_stats_buf->phyrf_mode); -+ len += scnprintf(buf + len, buf_len - len, "phy_homechan = %u\n", -+ htt_stats_buf->phy_homechan); -+ len += scnprintf(buf + len, buf_len - len, "phy_tx_ch_mask = 0x%0x\n", -+ htt_stats_buf->phy_tx_ch_mask); -+ len += scnprintf(buf + len, buf_len - len, "phy_rx_ch_mask = 0x%0x\n", -+ htt_stats_buf->phy_rx_ch_mask); -+ len += scnprintf(buf + len, buf_len - len, "phybb_ini_mask = 0x%0x\n", -+ htt_stats_buf->phybb_ini_mask); -+ len += scnprintf(buf + len, buf_len - len, "phyrf_ini_mask = 0x%0x\n", -+ htt_stats_buf->phyrf_ini_mask); -+ len += scnprintf(buf + len, buf_len - len, "phy_dfs_en_mask = 0x%0x\n", -+ htt_stats_buf->phy_dfs_en_mask); -+ len += scnprintf(buf + len, buf_len - len, "phy_sscan_en_mask = 0x%0x\n", -+ htt_stats_buf->phy_sscan_en_mask); -+ len += scnprintf(buf + len, buf_len - len, "phy_synth_sel_mask = 0x%0x\n", -+ htt_stats_buf->phy_synth_sel_mask); -+ len += scnprintf(buf + len, buf_len - len, "phy_adfs_freq = %u\n", -+ htt_stats_buf->phy_adfs_freq); -+ len += scnprintf(buf + len, buf_len - len, "cck_fir_settings = 0x%0x\n", -+ htt_stats_buf->cck_fir_settings); -+ len += scnprintf(buf + len, buf_len - len, "phy_dyn_pri_chan = %u\n", -+ htt_stats_buf->phy_dyn_pri_chan); -+ len += scnprintf(buf + len, buf_len - len, "cca_thresh = 0x%0x\n", -+ htt_stats_buf->cca_thresh); -+ len += scnprintf(buf + len, buf_len - len, "dyn_cca_status = %u\n", -+ htt_stats_buf->dyn_cca_status); -+ len += scnprintf(buf + len, buf_len - len, "rxdesense_thresh_hw = 0x%x\n", -+ htt_stats_buf->rxdesense_thresh_hw); -+ len += scnprintf(buf + len, buf_len - len, "rxdesense_thresh_sw = 0x%x\n", -+ htt_stats_buf->rxdesense_thresh_sw); -+ -+ stats_req->buf_len = len; -+} -+ - static inline - void htt_print_peer_ctrl_path_txrx_stats_tlv(const void *tag_buf, - struct debug_htt_stats_req *stats_req) -@@ -4425,6 +4533,12 @@ static int ath11k_dbg_htt_ext_stats_pars - case HTT_STATS_PHY_STATS_TAG: - htt_print_phy_stats_tlv(tag_buf, stats_req); - break; -+ case HTT_STATS_PHY_RESET_COUNTERS_TAG: -+ htt_print_phy_reset_counters_tlv(tag_buf, len, stats_req); -+ break; -+ case HTT_STATS_PHY_RESET_STATS_TAG: -+ htt_print_phy_reset_stats_tlv(tag_buf, len, stats_req); -+ break; - case HTT_STATS_PEER_CTRL_PATH_TXRX_STATS_TAG: - htt_print_peer_ctrl_path_txrx_stats_tlv(tag_buf, stats_req); - break; ---- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h -+++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h -@@ -111,6 +111,8 @@ enum htt_tlv_tag_t { - HTT_STATS_TXBF_OFDMA_STEER_STATS_TAG = 116, - HTT_STATS_PHY_COUNTERS_TAG = 121, - HTT_STATS_PHY_STATS_TAG = 122, -+ HTT_STATS_PHY_RESET_COUNTERS_TAG = 123, -+ HTT_STATS_PHY_RESET_STATS_TAG = 124, - - HTT_STATS_MAX_TAG, - }; -@@ -1964,6 +1966,47 @@ struct htt_phy_stats_tlv { - u32 fw_run_time; - }; - -+struct htt_phy_reset_counters_tlv { -+ u32 pdev_id; -+ u32 cf_active_low_fail_cnt; -+ u32 cf_active_low_pass_cnt; -+ u32 phy_off_through_vreg_cnt; -+ u32 force_calibration_cnt; -+ u32 rf_mode_switch_phy_off_cnt; -+}; -+ -+struct htt_phy_reset_stats_tlv { -+ u32 pdev_id; -+ u32 chan_mhz; -+ u32 chan_band_center_freq1; -+ u32 chan_band_center_freq2; -+ u32 chan_phy_mode; -+ u32 chan_flags; -+ u32 chan_num; -+ u32 reset_cause; -+ u32 prev_reset_cause; -+ u32 phy_warm_reset_src; -+ u32 rx_gain_tbl_mode; -+ u32 xbar_val; -+ u32 force_calibration; -+ u32 phyrf_mode; -+ u32 phy_homechan; -+ u32 phy_tx_ch_mask; -+ u32 phy_rx_ch_mask; -+ u32 phybb_ini_mask; -+ u32 phyrf_ini_mask; -+ u32 phy_dfs_en_mask; -+ u32 phy_sscan_en_mask; -+ u32 phy_synth_sel_mask; -+ u32 phy_adfs_freq; -+ u32 cck_fir_settings; -+ u32 phy_dyn_pri_chan; -+ u32 cca_thresh; -+ u32 dyn_cca_status; -+ u32 rxdesense_thresh_hw; -+ u32 rxdesense_thresh_sw; -+}; -+ - struct htt_peer_ctrl_path_txrx_stats_tlv { - /* peer mac address */ - u8 peer_mac_addr[ETH_ALEN]; 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 60720a721e3..dcfb4b5ac8b 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 @@ -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 -@@ -174,6 +174,7 @@ ATH11K_DEBUG= +@@ -173,6 +173,7 @@ ATH11K_DEBUG= ATH11K_DEBUGFS= ATH11K_TRACING= ATH11K_SPECTRAL= +ATH11K_THERMAL= - WLAN_VENDOR_ATMEL= - ATMEL= - PCI_ATMEL= + ATH12K= + ATH12K_DEBUG= + ATH12K_TRACING= 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 22c2493ca9d..ca77748fd2b 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", -@@ -1953,7 +1953,8 @@ static void ath11k_core_reset(struct wor +@@ -1954,7 +1954,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]; -@@ -1969,7 +1970,30 @@ static int ath11k_init_hw_params(struct +@@ -1970,7 +1971,30 @@ 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 b0ceb00ba03..5b02bcba660 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 @@ -271,7 +271,7 @@ Signed-off-by: Aditya Kumar Singh #endif --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -6996,24 +6996,12 @@ static void ath11k_wmi_htc_tx_complete(s +@@ -7059,24 +7059,12 @@ static void ath11k_wmi_htc_tx_complete(s wake_up(&wmi->tx_ce_desc_wq); } @@ -296,7 +296,7 @@ Signed-off-by: Aditya Kumar Singh int ret = 0, pdev_idx, i, j; struct ath11k *ar; -@@ -7075,17 +7063,7 @@ static int ath11k_reg_chan_list_event(st +@@ -7140,17 +7128,7 @@ static int ath11k_reg_chan_list_event(st (char *)reg_info->alpha2, 2)) goto mem_free; diff --git a/package/kernel/mac80211/patches/ath9k/351-ath9k_hw-issue-external-reset-for-QCA955x.patch b/package/kernel/mac80211/patches/ath9k/351-ath9k_hw-issue-external-reset-for-QCA955x.patch index 53b7ba08bc1..aac7e139249 100644 --- a/package/kernel/mac80211/patches/ath9k/351-ath9k_hw-issue-external-reset-for-QCA955x.patch +++ b/package/kernel/mac80211/patches/ath9k/351-ath9k_hw-issue-external-reset-for-QCA955x.patch @@ -75,7 +75,7 @@ Signed-off-by: Felix Fietkau + ath_dbg(ath9k_hw_common(ah), RESET, + "reset MAC via external reset\n"); -- REG_WRITE(ah, AR_RTC_RESET, 1); +- REG_WRITE(ah, AR_RTC_RESET(ah), 1); + err = ah->external_reset(); + if (err) { + ath_err(ath9k_hw_common(ah), @@ -84,11 +84,11 @@ Signed-off-by: Felix Fietkau } + if (AR_SREV_9550(ah)) { -+ REG_WRITE(ah, AR_RTC_RESET, 0); ++ REG_WRITE(ah, AR_RTC_RESET(ah), 0); + udelay(10); + } + -+ REG_WRITE(ah, AR_RTC_RESET, 1); ++ REG_WRITE(ah, AR_RTC_RESET(ah), 1); + udelay(10); + return true; @@ -124,6 +124,6 @@ Signed-off-by: Felix Fietkau + if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) + REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ); + - REG_WRITE(ah, AR_RTC_RC, rst_flags); + REG_WRITE(ah, AR_RTC_RC(ah), rst_flags); REGWRITE_BUFFER_FLUSH(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 15b8d7b86b1..3abf16b03e3 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 -@@ -88,7 +88,7 @@ int ath_descdma_setup(struct ath_softc * +@@ -89,7 +89,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 a871e458a4e..94a191e0d80 100644 --- a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch @@ -64,7 +64,7 @@ debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h -@@ -149,6 +149,7 @@ struct ath_common { +@@ -151,6 +151,7 @@ struct ath_common { int debug_mask; enum ath_device_state state; unsigned long op_flags; 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 74506657e0f..af656b832ee 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 -@@ -843,6 +843,9 @@ static inline int ath9k_dump_btcoex(stru +@@ -844,6 +844,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) { -@@ -979,6 +982,13 @@ void ath_ant_comb_scan(struct ath_softc +@@ -980,6 +983,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; -@@ -1032,9 +1042,8 @@ struct ath_softc { +@@ -1033,9 +1043,8 @@ struct ath_softc { spinlock_t chan_lock; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch index 6acc864d1e1..00451061f2b 100644 --- a/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch +++ b/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch @@ -26,9 +26,9 @@ +{ + int i, j; + -+ REG_RMW_FIELD(ah, AR_PHY_TEST, AR_PHY_TEST_BBB_OBS_SEL, 1); -+ REG_CLR_BIT(ah, AR_PHY_TEST, AR_PHY_TEST_RX_OBS_SEL_BIT5); -+ REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS, AR_PHY_TEST_CTL_RX_OBS_SEL, 0); ++ REG_RMW_FIELD(ah, AR_PHY_TEST(ah), AR_PHY_TEST_BBB_OBS_SEL, 1); ++ REG_CLR_BIT(ah, AR_PHY_TEST(ah), AR_PHY_TEST_RX_OBS_SEL_BIT5); ++ REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS(ah), AR_PHY_TEST_CTL_RX_OBS_SEL, 0); + + memset(buf, 0, len); + for (i = 0; i < len; i++) { 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 78206d28601..643d51285b0 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 @@ -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 -@@ -24,6 +24,7 @@ +@@ -25,6 +25,7 @@ #include #include #include @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau #include "common.h" #include "debug.h" -@@ -989,6 +990,14 @@ struct ath_led { +@@ -990,6 +991,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; -@@ -1044,6 +1053,9 @@ struct ath_softc { +@@ -1045,6 +1054,9 @@ struct ath_softc { #ifdef CPTCFG_MAC80211_LEDS const char *led_default_trigger; struct list_head leds; @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau + gchip); + struct ath_hw *ah = gc->sc->sc_ah; + -+ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3); ++ return !((REG_READ(ah, AR_GPIO_OE_OUT(ah)) >> (offset * 2)) & 3); +} + +/* gpio_chip handler : get GPIO pin value */ 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 716e09f351e..83076b8ae49 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 -@@ -1055,6 +1055,7 @@ struct ath_softc { +@@ -1056,6 +1056,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 efc4b9187c0..efd2932446d 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 -@@ -129,6 +129,7 @@ ATH9K_WOW= +@@ -128,6 +128,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 57eef54e897..637e607e366 100644 --- a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch +++ b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch @@ -311,7 +311,7 @@ }; --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -25,6 +25,7 @@ +@@ -26,6 +26,7 @@ #include #include #include @@ -319,7 +319,7 @@ #include "common.h" #include "debug.h" -@@ -1011,6 +1012,9 @@ struct ath_softc { +@@ -1012,6 +1013,9 @@ struct ath_softc { struct ath_hw *sc_ah; void __iomem *mem; int irq; diff --git a/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch index b82b442a1e1..b06172ec0ef 100644 --- a/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch +++ b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch @@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -713,8 +713,36 @@ static struct wireless_dev *brcmf_cfg802 +@@ -979,8 +979,36 @@ static struct wireless_dev *brcmf_cfg802 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_pub *drvr = cfg->pub; struct wireless_dev *wdev; 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 080ab8f7efd..92e647816b4 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 -@@ -2976,6 +2976,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -3327,6 +3327,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 25191b6439e..f873528e263 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) { -@@ -106,6 +136,8 @@ void brcmf_of_probe(struct device *dev, +@@ -113,6 +143,8 @@ void brcmf_of_probe(struct device *dev, of_node_put(root); } diff --git a/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch b/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch index 8df285f8b13..22e26e76985 100644 --- a/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch +++ b/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch @@ -24,7 +24,7 @@ Signed-off-by: Phil Elwell #include "of.h" static int brcmf_of_get_country_codes(struct device *dev, -@@ -168,3 +169,38 @@ void brcmf_of_probe(struct device *dev, +@@ -175,3 +176,38 @@ void brcmf_of_probe(struct device *dev, sdio->oob_irq_nr = irq; sdio->oob_irq_flags = irqf; } @@ -96,7 +96,7 @@ Signed-off-by: Phil Elwell #define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500) #define CTL_DONE_TIMEOUT msecs_to_jiffies(2500) -@@ -634,7 +635,7 @@ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "b +@@ -632,7 +633,7 @@ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "b /* per-board firmware binaries */ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-sdio.*.bin"); @@ -105,7 +105,7 @@ Signed-off-by: Phil Elwell BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0), BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4), -@@ -662,6 +663,9 @@ static const struct brcmf_firmware_mappi +@@ -660,6 +661,9 @@ static const struct brcmf_firmware_mappi BRCMF_FW_ENTRY(CY_CC_43752_CHIP_ID, 0xFFFFFFFF, 43752) }; @@ -115,7 +115,7 @@ Signed-off-by: Phil Elwell #define TXCTL_CREDITS 2 static void pkt_align(struct sk_buff *p, int len, int align) -@@ -4193,6 +4197,9 @@ static const struct brcmf_bus_ops brcmf_ +@@ -4201,6 +4205,9 @@ static const struct brcmf_bus_ops brcmf_ #define BRCMF_SDIO_FW_NVRAM 1 #define BRCMF_SDIO_FW_CLM 2 @@ -125,7 +125,7 @@ Signed-off-by: Phil Elwell static void brcmf_sdio_firmware_callback(struct device *dev, int err, struct brcmf_fw_request *fwreq) { -@@ -4208,6 +4215,22 @@ static void brcmf_sdio_firmware_callback +@@ -4216,6 +4223,22 @@ static void brcmf_sdio_firmware_callback brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err); @@ -148,7 +148,7 @@ Signed-off-by: Phil Elwell if (err) goto fail; -@@ -4418,7 +4441,7 @@ brcmf_sdio_prepare_fw_request(struct brc +@@ -4426,7 +4449,7 @@ brcmf_sdio_prepare_fw_request(struct brc fwreq = brcmf_fw_alloc_request(bus->ci->chip, bus->ci->chiprev, brcmf_sdio_fwnames, @@ -157,7 +157,7 @@ Signed-off-by: Phil Elwell fwnames, ARRAY_SIZE(fwnames)); if (!fwreq) return NULL; -@@ -4438,6 +4461,9 @@ struct brcmf_sdio *brcmf_sdio_probe(stru +@@ -4446,6 +4469,9 @@ struct brcmf_sdio *brcmf_sdio_probe(stru struct brcmf_sdio *bus; struct workqueue_struct *wq; struct brcmf_fw_request *fwreq; @@ -167,7 +167,7 @@ Signed-off-by: Phil Elwell brcmf_dbg(TRACE, "Enter\n"); -@@ -4520,6 +4546,21 @@ struct brcmf_sdio *brcmf_sdio_probe(stru +@@ -4528,6 +4554,21 @@ struct brcmf_sdio *brcmf_sdio_probe(stru brcmf_dbg(INFO, "completed!!\n"); 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 index 4ad2ac081a6..451d0b79fcc 100644 --- a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch +++ b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -470,43 +470,6 @@ USB_VL600= +@@ -491,43 +491,6 @@ USB_VL600= USB_NET_CH9200= USB_NET_AQC111= USB_RTL8153_ECM= @@ -171,7 +171,7 @@ depends on CORDIC --- a/Kconfig.local +++ b/Kconfig.local -@@ -1414,117 +1414,6 @@ config BACKPORTED_USB_NET_AQC111 +@@ -1477,117 +1477,6 @@ config BACKPORTED_USB_NET_AQC111 config BACKPORTED_USB_RTL8153_ECM tristate default USB_RTL8153_ECM diff --git a/package/kernel/mac80211/patches/build/080-resv_start_op.patch b/package/kernel/mac80211/patches/build/080-resv_start_op.patch index 40b8e94a201..802a0e3fc8a 100644 --- a/package/kernel/mac80211/patches/build/080-resv_start_op.patch +++ b/package/kernel/mac80211/patches/build/080-resv_start_op.patch @@ -1,18 +1,18 @@ ---- a/drivers/net/wireless/mac80211_hwsim.c -+++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -5363,7 +5363,9 @@ static struct genl_family hwsim_genl_fam +--- a/drivers/net/wireless/virtual/mac80211_hwsim.c ++++ b/drivers/net/wireless/virtual/mac80211_hwsim.c +@@ -6179,7 +6179,9 @@ static struct genl_family hwsim_genl_fam .module = THIS_MODULE, .small_ops = hwsim_ops, .n_small_ops = ARRAY_SIZE(hwsim_ops), +#if LINUX_VERSION_IS_GEQ(6,1,0) - .resv_start_op = HWSIM_CMD_DEL_MAC_ADDR + 1, + .resv_start_op = HWSIM_CMD_REPORT_PMSR + 1, // match with __HWSIM_CMD_MAX +#endif .mcgrps = hwsim_mcgrps, .n_mcgrps = ARRAY_SIZE(hwsim_mcgrps), }; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -17233,7 +17233,9 @@ static struct genl_family nl80211_fam __ +@@ -17509,7 +17509,9 @@ static struct genl_family nl80211_fam __ .n_ops = ARRAY_SIZE(nl80211_ops), .small_ops = nl80211_small_ops, .n_small_ops = ARRAY_SIZE(nl80211_small_ops), diff --git a/package/kernel/mac80211/patches/build/110-backport_namepace_const.patch b/package/kernel/mac80211/patches/build/110-backport_namepace_const.patch new file mode 100644 index 00000000000..6dca708edf7 --- /dev/null +++ b/package/kernel/mac80211/patches/build/110-backport_namepace_const.patch @@ -0,0 +1,14 @@ +--- a/net/wireless/sysfs.c ++++ b/net/wireless/sysfs.c +@@ -154,7 +154,11 @@ static SIMPLE_DEV_PM_OPS(wiphy_pm_ops, w + #define WIPHY_PM_OPS NULL + #endif + ++#if LINUX_VERSION_IS_GEQ(6,2,0) + static const void *wiphy_namespace(const struct device *d) ++#else ++static const void *wiphy_namespace(struct device *d) ++#endif + { + struct wiphy *wiphy = container_of(d, struct wiphy, dev); + diff --git a/package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch b/package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch deleted file mode 100644 index 1e152feceac..00000000000 --- a/package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/backport-include/linux/skbuff.h -+++ b/backport-include/linux/skbuff.h -@@ -144,4 +144,8 @@ static inline u64 skb_get_kcov_handle(st - #define napi_build_skb build_skb - #endif - -+#if LINUX_VERSION_IS_LESS(5,11,0) -+#define napi_build_skb build_skb -+#endif -+ - #endif /* __BACKPORT_SKBUFF_H */ diff --git a/package/kernel/mac80211/patches/build/200-Revert-wifi-iwlwifi-Use-generic-thermal_zone_get_tri.patch b/package/kernel/mac80211/patches/build/200-Revert-wifi-iwlwifi-Use-generic-thermal_zone_get_tri.patch new file mode 100644 index 00000000000..3a5285d2f35 --- /dev/null +++ b/package/kernel/mac80211/patches/build/200-Revert-wifi-iwlwifi-Use-generic-thermal_zone_get_tri.patch @@ -0,0 +1,159 @@ +From: Felix Fietkau +Date: Mon, 17 Apr 2023 19:42:38 +0200 +Subject: [PATCH] Revert "wifi: iwlwifi: Use generic thermal_zone_get_trip() + function" + +This reverts commit 3d2f20ad46f83b333025f5e8e4afc34be8f13c4c. +--- + +--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +@@ -531,7 +531,7 @@ struct iwl_mvm_tt_mgmt { + * @tzone: thermal zone device data + */ + struct iwl_mvm_thermal_device { +- struct thermal_trip trips[IWL_MAX_DTS_TRIPS]; ++ s16 temp_trips[IWL_MAX_DTS_TRIPS]; + u8 fw_trips_index[IWL_MAX_DTS_TRIPS]; + struct thermal_zone_device *tzone; + }; +--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +@@ -573,11 +573,11 @@ int iwl_mvm_send_temp_report_ths_cmd(str + * and uncompressed, the FW should get it compressed and sorted + */ + +- /* compress trips to cmd array, remove uninitialized values*/ ++ /* compress temp_trips to cmd array, remove uninitialized values*/ + for (i = 0; i < IWL_MAX_DTS_TRIPS; i++) { +- if (mvm->tz_device.trips[i].temperature != INT_MIN) { ++ if (mvm->tz_device.temp_trips[i] != S16_MIN) { + cmd.thresholds[idx++] = +- cpu_to_le16((s16)(mvm->tz_device.trips[i].temperature / 1000)); ++ cpu_to_le16(mvm->tz_device.temp_trips[i]); + } + } + cmd.num_temps = cpu_to_le32(idx); +@@ -593,8 +593,8 @@ int iwl_mvm_send_temp_report_ths_cmd(str + */ + for (i = 0; i < idx; i++) { + for (j = 0; j < IWL_MAX_DTS_TRIPS; j++) { +- if ((int)(le16_to_cpu(cmd.thresholds[i]) * 1000) == +- mvm->tz_device.trips[j].temperature) ++ if (le16_to_cpu(cmd.thresholds[i]) == ++ mvm->tz_device.temp_trips[j]) + mvm->tz_device.fw_trips_index[i] = j; + } + } +@@ -638,12 +638,37 @@ out: + return ret; + } + ++static int iwl_mvm_tzone_get_trip_temp(struct thermal_zone_device *device, ++ int trip, int *temp) ++{ ++ struct iwl_mvm *mvm = (struct iwl_mvm *)device->devdata; ++ ++ if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS) ++ return -EINVAL; ++ ++ *temp = mvm->tz_device.temp_trips[trip] * 1000; ++ ++ return 0; ++} ++ ++static int iwl_mvm_tzone_get_trip_type(struct thermal_zone_device *device, ++ int trip, enum thermal_trip_type *type) ++{ ++ if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS) ++ return -EINVAL; ++ ++ *type = THERMAL_TRIP_PASSIVE; ++ ++ return 0; ++} ++ + static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device, + int trip, int temp) + { + struct iwl_mvm *mvm = thermal_zone_device_priv(device); + struct iwl_mvm_thermal_device *tzone; +- int ret; ++ int i, ret; ++ s16 temperature; + + mutex_lock(&mvm->mutex); + +@@ -653,17 +678,40 @@ static int iwl_mvm_tzone_set_trip_temp(s + goto out; + } + ++ if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS) { ++ ret = -EINVAL; ++ goto out; ++ } ++ + if ((temp / 1000) > S16_MAX) { + ret = -EINVAL; + goto out; + } + ++ temperature = (s16)(temp / 1000); + tzone = &mvm->tz_device; ++ + if (!tzone) { + ret = -EIO; + goto out; + } + ++ /* no updates*/ ++ if (tzone->temp_trips[trip] == temperature) { ++ ret = 0; ++ goto out; ++ } ++ ++ /* already existing temperature */ ++ for (i = 0; i < IWL_MAX_DTS_TRIPS; i++) { ++ if (tzone->temp_trips[i] == temperature) { ++ ret = -EINVAL; ++ goto out; ++ } ++ } ++ ++ tzone->temp_trips[trip] = temperature; ++ + ret = iwl_mvm_send_temp_report_ths_cmd(mvm); + out: + mutex_unlock(&mvm->mutex); +@@ -672,6 +720,8 @@ out: + + static struct thermal_zone_device_ops tzone_ops = { + .get_temp = iwl_mvm_tzone_get_temp, ++ .get_trip_temp = iwl_mvm_tzone_get_trip_temp, ++ .get_trip_type = iwl_mvm_tzone_get_trip_type, + .set_trip_temp = iwl_mvm_tzone_set_trip_temp, + }; + +@@ -693,8 +743,7 @@ static void iwl_mvm_thermal_zone_registe + BUILD_BUG_ON(ARRAY_SIZE(name) >= THERMAL_NAME_LENGTH); + + sprintf(name, "iwlwifi_%u", atomic_inc_return(&counter) & 0xFF); +- mvm->tz_device.tzone = thermal_zone_device_register_with_trips(name, +- mvm->tz_device.trips, ++ mvm->tz_device.tzone = thermal_zone_device_register(name, + IWL_MAX_DTS_TRIPS, + IWL_WRITABLE_TRIPS_MSK, + mvm, &tzone_ops, +@@ -717,10 +766,8 @@ static void iwl_mvm_thermal_zone_registe + /* 0 is a valid temperature, + * so initialize the array with S16_MIN which invalid temperature + */ +- for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) { +- mvm->tz_device.trips[i].temperature = INT_MIN; +- mvm->tz_device.trips[i].type = THERMAL_TRIP_PASSIVE; +- } ++ for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) ++ mvm->tz_device.temp_trips[i] = S16_MIN; + } + + static int iwl_mvm_tcool_get_max_state(struct thermal_cooling_device *cdev, diff --git a/package/kernel/mac80211/patches/build/210-revert-split-op.patch b/package/kernel/mac80211/patches/build/210-revert-split-op.patch new file mode 100644 index 00000000000..a1fae5e07da --- /dev/null +++ b/package/kernel/mac80211/patches/build/210-revert-split-op.patch @@ -0,0 +1,22 @@ +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -16400,8 +16400,7 @@ static u32 nl80211_internal_flags[] = { + #undef SELECTOR + }; + +-static int nl80211_pre_doit(const struct genl_split_ops *ops, +- struct sk_buff *skb, ++static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb, + struct genl_info *info) + { + struct cfg80211_registered_device *rdev = NULL; +@@ -16502,8 +16501,7 @@ out_unlock: + return err; + } + +-static void nl80211_post_doit(const struct genl_split_ops *ops, +- struct sk_buff *skb, ++static void nl80211_post_doit(const struct genl_ops *ops, struct sk_buff *skb, + struct genl_info *info) + { + u32 internal_flags = nl80211_internal_flags[ops->internal_flags]; 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 1dbcb1bfef3..4d9d3de4655 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 -@@ -2052,6 +2052,8 @@ struct wireless_dev *lbs_cfg_alloc(struc +@@ -2101,6 +2101,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 b47aee54908..9aa559979c3 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 -@@ -2128,6 +2128,8 @@ int lbs_cfg_register(struct lbs_private +@@ -2178,6 +2178,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/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch b/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch index 98ed9e60e98..628b9f8a123 100644 --- a/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch +++ b/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch @@ -152,7 +152,7 @@ Signed-off-by: Pali Rohár --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h -@@ -1099,6 +1099,8 @@ void mwifiex_cancel_all_pending_cmd(stru +@@ -1100,6 +1100,8 @@ void mwifiex_cancel_all_pending_cmd(stru void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter); void mwifiex_cancel_scan(struct mwifiex_adapter *adapter); diff --git a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch index ab0fa3670d6..6ef356516fb 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -347,6 +347,7 @@ RT2X00_LIB_FIRMWARE= +@@ -350,6 +350,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= @@ -127,7 +127,7 @@ DECLARE_KFIFO_PTR(txstatus_fifo, u32); --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1419,6 +1419,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de +@@ -1420,6 +1420,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); @@ -138,7 +138,7 @@ /* * Let the driver probe the device to detect the capabilities. */ -@@ -1559,6 +1563,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ +@@ -1560,6 +1564,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ * Free the driver data. */ kfree(rt2x00dev->drv_data); diff --git a/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch index acc8a8edb8c..7b50bc275e2 100644 --- a/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch +++ b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch @@ -8,7 +8,7 @@ #include "rt2x00.h" #include "rt2800lib.h" -@@ -11131,6 +11132,17 @@ static int rt2800_init_eeprom(struct rt2 +@@ -11129,6 +11130,17 @@ static int rt2800_init_eeprom(struct rt2 rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY); diff --git a/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch b/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch index 5ef5fc8def6..aa2b25ba7f5 100644 --- a/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch +++ b/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1358,7 +1358,7 @@ static inline void rt2x00lib_set_if_comb +@@ -1359,7 +1359,7 @@ static inline void rt2x00lib_set_if_comb */ if_limit = &rt2x00dev->if_limits_ap; if_limit->max = rt2x00dev->ops->max_ap_intf; 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 deaa03be6c0..4bb1cf42482 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 @@ -82,7 +82,7 @@ Signed-off-by: Daniel Golle } bbp = rt2800_bbp_read(rt2x00dev, 4); -@@ -10583,6 +10624,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10581,6 +10622,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); @@ -90,7 +90,7 @@ Signed-off-by: Daniel Golle rt2800_r_calibration(rt2x00dev); rt2800_rf_self_txdc_cal(rt2x00dev); rt2800_rxdcoc_calibration(rt2x00dev); -@@ -10590,6 +10632,22 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10588,6 +10630,22 @@ static void rt2800_init_rfcsr_6352(struc rt2800_bw_filter_calibration(rt2x00dev, false); rt2800_loft_iq_calibration(rt2x00dev); rt2800_rxiq_calibration(rt2x00dev); diff --git a/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch b/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch index dab6e05ffd2..4b3e549109d 100644 --- a/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch +++ b/package/kernel/mac80211/patches/rt2x00/996-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch @@ -192,7 +192,7 @@ /* BBP for G band GLRT function (BBP_128 ~ BBP_221) */ rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00); -@@ -10408,31 +10436,36 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10406,31 +10434,36 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write(rt2x00dev, 42, 0x5B); rt2800_rfcsr_write(rt2x00dev, 43, 0x00); @@ -254,7 +254,7 @@ /* Initialize RF channel register to default value */ rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03); -@@ -10498,63 +10531,71 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10496,63 +10529,71 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5); @@ -383,7 +383,7 @@ /* Initialize RF DC calibration register to default value */ rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47); -@@ -10617,12 +10658,17 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10615,12 +10656,17 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00); diff --git a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch index 5f6f5140d9e..ca1da8a8d28 100644 --- a/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/998-wifi-rt2x00-rework-MT7620-PA-LNA-RF-calibration.patch @@ -227,7 +227,7 @@ Signed-off-by: Shiji Yang rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX))) -@@ -10688,30 +10617,143 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10686,30 +10615,143 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); } @@ -385,7 +385,7 @@ Signed-off-by: Shiji Yang } } -@@ -10804,6 +10846,10 @@ int rt2800_enable_radio(struct rt2x00_de +@@ -10802,6 +10844,10 @@ int rt2800_enable_radio(struct rt2x00_de rt2800_init_bbp(rt2x00dev); rt2800_init_rfcsr(rt2x00dev); 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 4d4a2a8f5e8..e3349dabd0b 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 -@@ -1519,7 +1519,6 @@ static int ieee80211_stop_ap(struct wiph +@@ -1632,7 +1632,6 @@ static int ieee80211_stop_ap(struct wiph link_conf->bssid_indicator = 0; __sta_info_flush(sdata, true); diff --git a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch index 10b842d9af3..25b844a21b2 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 -@@ -2727,6 +2727,8 @@ static int ieee80211_scan(struct wiphy * +@@ -2843,6 +2843,8 @@ static int ieee80211_scan(struct wiphy * */ fallthrough; case NL80211_IFTYPE_AP: diff --git a/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch b/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch index 63b21774719..ffa5c17e487 100644 --- a/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch +++ b/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch @@ -28,7 +28,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c -@@ -554,6 +554,7 @@ __sta_info_alloc(struct ieee80211_sub_if +@@ -558,6 +558,7 @@ __sta_info_alloc(struct ieee80211_sub_if INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames); INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); mutex_init(&sta->ampdu_mlme.mtx); 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 0ac972955f0..a27925e64ee 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 -@@ -90,6 +90,8 @@ extern const u8 ieee80211_ac_to_qos_mask +@@ -92,6 +92,8 @@ extern const u8 ieee80211_ac_to_qos_mask */ #define AIRTIME_ACTIVE_DURATION (HZ / 10) @@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3984,7 +3984,7 @@ struct ieee80211_txq *ieee80211_next_txq +@@ -4059,7 +4059,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, -@@ -4127,7 +4127,8 @@ bool ieee80211_txq_may_transmit(struct i +@@ -4202,7 +4202,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]); } -@@ -4135,7 +4136,7 @@ bool ieee80211_txq_may_transmit(struct i +@@ -4210,7 +4211,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-01-v6.2-wifi-mac80211-add-internal-handler-for-wake_tx_queue.patch b/package/kernel/mac80211/patches/subsys/306-01-v6.2-wifi-mac80211-add-internal-handler-for-wake_tx_queue.patch deleted file mode 100644 index d14ba05e695..00000000000 --- a/package/kernel/mac80211/patches/subsys/306-01-v6.2-wifi-mac80211-add-internal-handler-for-wake_tx_queue.patch +++ /dev/null @@ -1,183 +0,0 @@ -From: Alexander Wetzel -Date: Sun, 9 Oct 2022 18:30:38 +0200 -Subject: [PATCH] wifi: mac80211: add internal handler for wake_tx_queue - -Start to align the TX handling to only use internal TX queues (iTXQs): - -Provide a handler for drivers not having a custom wake_tx_queue -callback and update the documentation. - -Signed-off-by: Alexander Wetzel -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -89,15 +89,13 @@ - /** - * DOC: mac80211 software tx queueing - * -- * mac80211 provides an optional intermediate queueing implementation designed -- * to allow the driver to keep hardware queues short and provide some fairness -- * between different stations/interfaces. -- * In this model, the driver pulls data frames from the mac80211 queue instead -- * of letting mac80211 push them via drv_tx(). -- * Other frames (e.g. control or management) are still pushed using drv_tx(). -+ * mac80211 uses an intermediate queueing implementation, designed to allow the -+ * driver to keep hardware queues short and to provide some fairness between -+ * different stations/interfaces. - * -- * Drivers indicate that they use this model by implementing the .wake_tx_queue -- * driver operation. -+ * Drivers must provide the .wake_tx_queue driver operation by either -+ * linking it to ieee80211_handle_wake_tx_queue() or implementing a custom -+ * handler. - * - * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with - * another per-sta for non-data/non-mgmt and bufferable management frames, and -@@ -106,9 +104,12 @@ - * The driver is expected to initialize its private per-queue data for stations - * and interfaces in the .add_interface and .sta_add ops. - * -- * The driver can't access the queue directly. To dequeue a frame from a -- * txq, it calls ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a -- * queue, it calls the .wake_tx_queue driver op. -+ * The driver can't access the internal TX queues (iTXQs) directly. -+ * Whenever mac80211 adds a new frame to a queue, it calls the .wake_tx_queue -+ * driver op. -+ * Drivers implementing a custom .wake_tx_queue op can get them by calling -+ * ieee80211_tx_dequeue(). Drivers using ieee80211_handle_wake_tx_queue() will -+ * simply get the individual frames pushed via the .tx driver operation. - * - * Drivers can optionally delegate responsibility for scheduling queues to - * mac80211, to take advantage of airtime fairness accounting. In this case, to -@@ -2248,8 +2249,8 @@ struct ieee80211_link_sta { - * For non MLO STA it will point to the deflink data. For MLO STA - * ieee80211_sta_recalc_aggregates() must be called to update it. - * @support_p2p_ps: indicates whether the STA supports P2P PS mechanism or not. -- * @txq: per-TID data TX queues (if driver uses the TXQ abstraction); note that -- * the last entry (%IEEE80211_NUM_TIDS) is used for non-data frames -+ * @txq: per-TID data TX queues; note that the last entry (%IEEE80211_NUM_TIDS) -+ * is used for non-data frames - * @deflink: This holds the default link STA information, for non MLO STA all link - * specific STA information is accessed through @deflink or through - * link[0] which points to address of @deflink. For MLO Link STA -@@ -5687,7 +5688,7 @@ void ieee80211_key_replay(struct ieee802 - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * @queue: queue number (counted from zero). - * -- * Drivers should use this function instead of netif_wake_queue. -+ * Drivers must use this function instead of netif_wake_queue. - */ - void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue); - -@@ -5696,7 +5697,7 @@ void ieee80211_wake_queue(struct ieee802 - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * @queue: queue number (counted from zero). - * -- * Drivers should use this function instead of netif_stop_queue. -+ * Drivers must use this function instead of netif_stop_queue. - */ - void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue); - -@@ -5705,7 +5706,7 @@ void ieee80211_stop_queue(struct ieee802 - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * @queue: queue number (counted from zero). - * -- * Drivers should use this function instead of netif_stop_queue. -+ * Drivers must use this function instead of netif_queue_stopped. - * - * Return: %true if the queue is stopped. %false otherwise. - */ -@@ -5716,7 +5717,7 @@ int ieee80211_queue_stopped(struct ieee8 - * ieee80211_stop_queues - stop all queues - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * -- * Drivers should use this function instead of netif_stop_queue. -+ * Drivers must use this function instead of netif_tx_stop_all_queues. - */ - void ieee80211_stop_queues(struct ieee80211_hw *hw); - -@@ -5724,7 +5725,7 @@ void ieee80211_stop_queues(struct ieee80 - * ieee80211_wake_queues - wake all queues - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * -- * Drivers should use this function instead of netif_wake_queue. -+ * Drivers must use this function instead of netif_tx_wake_all_queues. - */ - void ieee80211_wake_queues(struct ieee80211_hw *hw); - -@@ -6946,6 +6947,18 @@ static inline struct sk_buff *ieee80211_ - } - - /** -+ * ieee80211_handle_wake_tx_queue - mac80211 handler for wake_tx_queue callback -+ * -+ * @hw: pointer as obtained from wake_tx_queue() callback(). -+ * @txq: pointer as obtained from wake_tx_queue() callback(). -+ * -+ * Drivers can use this function for the mandatory mac80211 wake_tx_queue -+ * callback in struct ieee80211_ops. They should not call this function. -+ */ -+void ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw, -+ struct ieee80211_txq *txq); -+ -+/** - * ieee80211_next_txq - get next tx queue to pull packets from - * - * @hw: pointer as obtained from ieee80211_alloc_hw() ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -288,6 +288,52 @@ __le16 ieee80211_ctstoself_duration(stru - } - EXPORT_SYMBOL(ieee80211_ctstoself_duration); - -+static void wake_tx_push_queue(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_txq *queue) -+{ -+ int q = sdata->vif.hw_queue[queue->ac]; -+ struct ieee80211_tx_control control = { -+ .sta = queue->sta, -+ }; -+ struct sk_buff *skb; -+ unsigned long flags; -+ bool q_stopped; -+ -+ while (1) { -+ spin_lock_irqsave(&local->queue_stop_reason_lock, flags); -+ q_stopped = local->queue_stop_reasons[q]; -+ spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); -+ -+ if (q_stopped) -+ break; -+ -+ skb = ieee80211_tx_dequeue(&local->hw, queue); -+ if (!skb) -+ break; -+ -+ drv_tx(local, &control, skb); -+ } -+} -+ -+/* wake_tx_queue handler for driver not implementing a custom one*/ -+void ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw, -+ struct ieee80211_txq *txq) -+{ -+ struct ieee80211_local *local = hw_to_local(hw); -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif); -+ struct ieee80211_txq *queue; -+ -+ /* Use ieee80211_next_txq() for airtime fairness accounting */ -+ ieee80211_txq_schedule_start(hw, txq->ac); -+ while ((queue = ieee80211_next_txq(hw, txq->ac))) { -+ wake_tx_push_queue(local, sdata, queue); -+ ieee80211_return_txq(hw, queue, false); -+ } -+ ieee80211_txq_schedule_end(hw, txq->ac); -+} -+EXPORT_SYMBOL(ieee80211_handle_wake_tx_queue); -+ - static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) - { - struct ieee80211_local *local = sdata->local; diff --git a/package/kernel/mac80211/patches/subsys/306-02-v6.2-wifi-mac80211-add-wake_tx_queue-callback-to-drivers.patch b/package/kernel/mac80211/patches/subsys/306-02-v6.2-wifi-mac80211-add-wake_tx_queue-callback-to-drivers.patch deleted file mode 100644 index fee038d90c5..00000000000 --- a/package/kernel/mac80211/patches/subsys/306-02-v6.2-wifi-mac80211-add-wake_tx_queue-callback-to-drivers.patch +++ /dev/null @@ -1,396 +0,0 @@ -From: Alexander Wetzel -Date: Sun, 9 Oct 2022 18:30:39 +0200 -Subject: [PATCH] wifi: mac80211: add wake_tx_queue callback to drivers - -mac80211 is fully switching over to the internal TX queue (iTXQ) -implementation. Update all drivers not yet providing the now mandatory -wake_tx_queue() callback. - -As an side effect the netdev interfaces of all updated drivers will -switch to the noqueue qdisc. - -Signed-off-by: Alexander Wetzel -[add staging drivers] -Signed-off-by: Johannes Berg ---- - ---- a/drivers/net/wireless/admtek/adm8211.c -+++ b/drivers/net/wireless/admtek/adm8211.c -@@ -1760,6 +1760,7 @@ static int adm8211_alloc_rings(struct ie - - static const struct ieee80211_ops adm8211_ops = { - .tx = adm8211_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = adm8211_start, - .stop = adm8211_stop, - .add_interface = adm8211_add_interface, ---- a/drivers/net/wireless/ath/ar5523/ar5523.c -+++ b/drivers/net/wireless/ath/ar5523/ar5523.c -@@ -1361,6 +1361,7 @@ static const struct ieee80211_ops ar5523 - .start = ar5523_start, - .stop = ar5523_stop, - .tx = ar5523_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .set_rts_threshold = ar5523_set_rts_threshold, - .add_interface = ar5523_add_interface, - .remove_interface = ar5523_remove_interface, ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -8587,6 +8587,7 @@ err_fallback: - - static const struct ieee80211_ops ath11k_ops = { - .tx = ath11k_mac_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = ath11k_mac_op_start, - .stop = ath11k_mac_op_stop, - .reconfig_complete = ath11k_mac_op_reconfig_complete, ---- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c -+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c -@@ -781,6 +781,7 @@ static int ath5k_set_ringparam(struct ie - - const struct ieee80211_ops ath5k_hw_ops = { - .tx = ath5k_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = ath5k_start, - .stop = ath5k_stop, - .add_interface = ath5k_add_interface, ---- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c -+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c -@@ -1870,6 +1870,7 @@ static void ath9k_htc_channel_switch_bea - - struct ieee80211_ops ath9k_htc_ops = { - .tx = ath9k_htc_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = ath9k_htc_start, - .stop = ath9k_htc_stop, - .add_interface = ath9k_htc_add_interface, ---- a/drivers/net/wireless/ath/carl9170/main.c -+++ b/drivers/net/wireless/ath/carl9170/main.c -@@ -1715,6 +1715,7 @@ static const struct ieee80211_ops carl91 - .start = carl9170_op_start, - .stop = carl9170_op_stop, - .tx = carl9170_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .flush = carl9170_op_flush, - .add_interface = carl9170_op_add_interface, - .remove_interface = carl9170_op_remove_interface, ---- a/drivers/net/wireless/ath/wcn36xx/main.c -+++ b/drivers/net/wireless/ath/wcn36xx/main.c -@@ -1362,6 +1362,7 @@ static const struct ieee80211_ops wcn36x - .prepare_multicast = wcn36xx_prepare_multicast, - .configure_filter = wcn36xx_configure_filter, - .tx = wcn36xx_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .set_key = wcn36xx_set_key, - .hw_scan = wcn36xx_hw_scan, - .cancel_hw_scan = wcn36xx_cancel_hw_scan, ---- a/drivers/net/wireless/atmel/at76c50x-usb.c -+++ b/drivers/net/wireless/atmel/at76c50x-usb.c -@@ -2187,6 +2187,7 @@ static int at76_set_key(struct ieee80211 - - static const struct ieee80211_ops at76_ops = { - .tx = at76_mac80211_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .add_interface = at76_add_interface, - .remove_interface = at76_remove_interface, - .config = at76_config, ---- a/drivers/net/wireless/broadcom/b43/main.c -+++ b/drivers/net/wireless/broadcom/b43/main.c -@@ -5171,6 +5171,7 @@ static int b43_op_get_survey(struct ieee - - static const struct ieee80211_ops b43_hw_ops = { - .tx = b43_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .conf_tx = b43_op_conf_tx, - .add_interface = b43_op_add_interface, - .remove_interface = b43_op_remove_interface, ---- a/drivers/net/wireless/broadcom/b43legacy/main.c -+++ b/drivers/net/wireless/broadcom/b43legacy/main.c -@@ -3532,6 +3532,7 @@ static int b43legacy_op_get_survey(struc - - static const struct ieee80211_ops b43legacy_hw_ops = { - .tx = b43legacy_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .conf_tx = b43legacy_op_conf_tx, - .add_interface = b43legacy_op_add_interface, - .remove_interface = b43legacy_op_remove_interface, ---- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c -@@ -962,6 +962,7 @@ static int brcms_ops_beacon_set_tim(stru - - static const struct ieee80211_ops brcms_ops = { - .tx = brcms_ops_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = brcms_ops_start, - .stop = brcms_ops_stop, - .add_interface = brcms_ops_add_interface, ---- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c -+++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c -@@ -3439,6 +3439,7 @@ static const struct attribute_group il39 - - static struct ieee80211_ops il3945_mac_ops __ro_after_init = { - .tx = il3945_mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = il3945_mac_start, - .stop = il3945_mac_stop, - .add_interface = il_mac_add_interface, ---- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c -+++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c -@@ -6308,6 +6308,7 @@ il4965_tx_queue_set_status(struct il_pri - - static const struct ieee80211_ops il4965_mac_ops = { - .tx = il4965_mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = il4965_mac_start, - .stop = il4965_mac_stop, - .add_interface = il_mac_add_interface, ---- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c -+++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c -@@ -1571,6 +1571,7 @@ static void iwlagn_mac_sta_notify(struct - - const struct ieee80211_ops iwlagn_hw_ops = { - .tx = iwlagn_mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = iwlagn_mac_start, - .stop = iwlagn_mac_stop, - #ifdef CONFIG_PM_SLEEP ---- a/drivers/net/wireless/intersil/p54/main.c -+++ b/drivers/net/wireless/intersil/p54/main.c -@@ -705,6 +705,7 @@ static void p54_set_coverage_class(struc - - static const struct ieee80211_ops p54_ops = { - .tx = p54_tx_80211, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = p54_start, - .stop = p54_stop, - .add_interface = p54_add_interface, ---- a/drivers/net/wireless/mac80211_hwsim.c -+++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -3109,6 +3109,7 @@ static int mac80211_hwsim_change_sta_lin - - #define HWSIM_COMMON_OPS \ - .tx = mac80211_hwsim_tx, \ -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, \ - .start = mac80211_hwsim_start, \ - .stop = mac80211_hwsim_stop, \ - .add_interface = mac80211_hwsim_add_interface, \ ---- a/drivers/net/wireless/marvell/libertas_tf/main.c -+++ b/drivers/net/wireless/marvell/libertas_tf/main.c -@@ -474,6 +474,7 @@ static int lbtf_op_get_survey(struct iee - - static const struct ieee80211_ops lbtf_ops = { - .tx = lbtf_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = lbtf_op_start, - .stop = lbtf_op_stop, - .add_interface = lbtf_op_add_interface, ---- a/drivers/net/wireless/marvell/mwl8k.c -+++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -5611,6 +5611,7 @@ static void mwl8k_sw_scan_complete(struc - - static const struct ieee80211_ops mwl8k_ops = { - .tx = mwl8k_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = mwl8k_start, - .stop = mwl8k_stop, - .add_interface = mwl8k_add_interface, ---- a/drivers/net/wireless/mediatek/mt7601u/main.c -+++ b/drivers/net/wireless/mediatek/mt7601u/main.c -@@ -406,6 +406,7 @@ out: - - const struct ieee80211_ops mt7601u_ops = { - .tx = mt7601u_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = mt7601u_start, - .stop = mt7601u_stop, - .add_interface = mt7601u_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c -@@ -1706,6 +1706,7 @@ static int rt2400pci_tx_last_beacon(stru - - static const struct ieee80211_ops rt2400pci_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c -@@ -2004,6 +2004,7 @@ static int rt2500pci_tx_last_beacon(stru - - static const struct ieee80211_ops rt2500pci_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c -@@ -1795,6 +1795,7 @@ static int rt2500usb_probe_hw(struct rt2 - - static const struct ieee80211_ops rt2500usb_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c -@@ -288,6 +288,7 @@ static int rt2800pci_read_eeprom(struct - - static const struct ieee80211_ops rt2800pci_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -@@ -133,6 +133,7 @@ static int rt2800soc_write_firmware(stru - - static const struct ieee80211_ops rt2800soc_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c -@@ -630,6 +630,7 @@ static int rt2800usb_probe_hw(struct rt2 - - static const struct ieee80211_ops rt2800usb_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c -@@ -2873,6 +2873,7 @@ static u64 rt61pci_get_tsf(struct ieee80 - - static const struct ieee80211_ops rt61pci_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c -@@ -2292,6 +2292,7 @@ static u64 rt73usb_get_tsf(struct ieee80 - - static const struct ieee80211_ops rt73usb_mac80211_ops = { - .tx = rt2x00mac_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, ---- a/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c -+++ b/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c -@@ -1608,6 +1608,7 @@ static void rtl8180_configure_filter(str - - static const struct ieee80211_ops rtl8180_ops = { - .tx = rtl8180_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rtl8180_start, - .stop = rtl8180_stop, - .add_interface = rtl8180_add_interface, ---- a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c -+++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c -@@ -1378,6 +1378,7 @@ static int rtl8187_conf_tx(struct ieee80 - - static const struct ieee80211_ops rtl8187_ops = { - .tx = rtl8187_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rtl8187_start, - .stop = rtl8187_stop, - .add_interface = rtl8187_add_interface, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -6548,6 +6548,7 @@ static void rtl8xxxu_stop(struct ieee802 - - static const struct ieee80211_ops rtl8xxxu_ops = { - .tx = rtl8xxxu_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .add_interface = rtl8xxxu_add_interface, - .remove_interface = rtl8xxxu_remove_interface, - .config = rtl8xxxu_config, ---- a/drivers/net/wireless/realtek/rtlwifi/core.c -+++ b/drivers/net/wireless/realtek/rtlwifi/core.c -@@ -1912,6 +1912,7 @@ const struct ieee80211_ops rtl_ops = { - .start = rtl_op_start, - .stop = rtl_op_stop, - .tx = rtl_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .add_interface = rtl_op_add_interface, - .remove_interface = rtl_op_remove_interface, - .change_interface = rtl_op_change_interface, ---- a/drivers/net/wireless/realtek/rtw88/mac80211.c -+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c -@@ -896,6 +896,7 @@ static void rtw_ops_sta_rc_update(struct - - const struct ieee80211_ops rtw_ops = { - .tx = rtw_ops_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .wake_tx_queue = rtw_ops_wake_tx_queue, - .start = rtw_ops_start, - .stop = rtw_ops_stop, ---- a/drivers/net/wireless/realtek/rtw89/mac80211.c -+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c -@@ -918,6 +918,7 @@ static int rtw89_ops_set_tid_config(stru - - const struct ieee80211_ops rtw89_ops = { - .tx = rtw89_ops_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .wake_tx_queue = rtw89_ops_wake_tx_queue, - .start = rtw89_ops_start, - .stop = rtw89_ops_stop, ---- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c -+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c -@@ -1958,6 +1958,7 @@ static int rsi_mac80211_resume(struct ie - - static const struct ieee80211_ops mac80211_ops = { - .tx = rsi_mac80211_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = rsi_mac80211_start, - .stop = rsi_mac80211_stop, - .add_interface = rsi_mac80211_add_interface, ---- a/drivers/net/wireless/st/cw1200/main.c -+++ b/drivers/net/wireless/st/cw1200/main.c -@@ -209,6 +209,7 @@ static const struct ieee80211_ops cw1200 - .remove_interface = cw1200_remove_interface, - .change_interface = cw1200_change_interface, - .tx = cw1200_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .hw_scan = cw1200_hw_scan, - .set_tim = cw1200_set_tim, - .sta_notify = cw1200_sta_notify, ---- a/drivers/net/wireless/ti/wl1251/main.c -+++ b/drivers/net/wireless/ti/wl1251/main.c -@@ -1359,6 +1359,7 @@ static const struct ieee80211_ops wl1251 - .prepare_multicast = wl1251_op_prepare_multicast, - .configure_filter = wl1251_op_configure_filter, - .tx = wl1251_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .set_key = wl1251_op_set_key, - .hw_scan = wl1251_op_hw_scan, - .bss_info_changed = wl1251_op_bss_info_changed, ---- a/drivers/net/wireless/ti/wlcore/main.c -+++ b/drivers/net/wireless/ti/wlcore/main.c -@@ -5942,6 +5942,7 @@ static const struct ieee80211_ops wl1271 - .prepare_multicast = wl1271_op_prepare_multicast, - .configure_filter = wl1271_op_configure_filter, - .tx = wl1271_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .set_key = wlcore_op_set_key, - .hw_scan = wl1271_op_hw_scan, - .cancel_hw_scan = wl1271_op_cancel_hw_scan, ---- a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c -+++ b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c -@@ -1344,6 +1344,7 @@ static u64 zd_op_get_tsf(struct ieee8021 - - static const struct ieee80211_ops zd_ops = { - .tx = zd_op_tx, -+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .start = zd_op_start, - .stop = zd_op_stop, - .add_interface = zd_op_add_interface, diff --git a/package/kernel/mac80211/patches/subsys/306-03-v6.2-wifi-mac80211-Drop-support-for-TX-push-path.patch b/package/kernel/mac80211/patches/subsys/306-03-v6.2-wifi-mac80211-Drop-support-for-TX-push-path.patch deleted file mode 100644 index f9f9977cee5..00000000000 --- a/package/kernel/mac80211/patches/subsys/306-03-v6.2-wifi-mac80211-Drop-support-for-TX-push-path.patch +++ /dev/null @@ -1,683 +0,0 @@ -From: Alexander Wetzel -Date: Sun, 9 Oct 2022 18:30:40 +0200 -Subject: [PATCH] wifi: mac80211: Drop support for TX push path - -All drivers are now using mac80211 internal queues (iTXQs). -Drop mac80211 internal support for the old push path. - -Signed-off-by: Alexander Wetzel -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -4346,9 +4346,6 @@ static int ieee80211_get_txq_stats(struc - struct ieee80211_sub_if_data *sdata; - int ret = 0; - -- if (!local->ops->wake_tx_queue) -- return 1; -- - spin_lock_bh(&local->fq.lock); - rcu_read_lock(); - ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -663,9 +663,7 @@ void debugfs_hw_add(struct ieee80211_loc - DEBUGFS_ADD_MODE(force_tx_status, 0600); - DEBUGFS_ADD_MODE(aql_enable, 0600); - DEBUGFS_ADD(aql_pending); -- -- if (local->ops->wake_tx_queue) -- DEBUGFS_ADD_MODE(aqm, 0600); -+ DEBUGFS_ADD_MODE(aqm, 0600); - - DEBUGFS_ADD_MODE(airtime_flags, 0600); - ---- a/net/mac80211/debugfs_netdev.c -+++ b/net/mac80211/debugfs_netdev.c -@@ -677,8 +677,7 @@ static void add_common_files(struct ieee - DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_5ghz); - DEBUGFS_ADD(hw_queues); - -- if (sdata->local->ops->wake_tx_queue && -- sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && -+ if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && - sdata->vif.type != NL80211_IFTYPE_NAN) - DEBUGFS_ADD(aqm); - } ---- a/net/mac80211/debugfs_sta.c -+++ b/net/mac80211/debugfs_sta.c -@@ -1057,10 +1057,8 @@ void ieee80211_sta_debugfs_add(struct st - DEBUGFS_ADD_COUNTER(rx_fragments, deflink.rx_stats.fragments); - DEBUGFS_ADD_COUNTER(tx_filtered, deflink.status_stats.filtered); - -- if (local->ops->wake_tx_queue) { -- DEBUGFS_ADD(aqm); -- DEBUGFS_ADD(airtime); -- } -+ DEBUGFS_ADD(aqm); -+ DEBUGFS_ADD(airtime); - - if (wiphy_ext_feature_isset(local->hw.wiphy, - NL80211_EXT_FEATURE_AQL)) ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -2294,7 +2294,6 @@ void ieee80211_wake_queue_by_reason(stru - void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, - enum queue_stop_reason reason, - bool refcounted); --void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue); - void ieee80211_add_pending_skb(struct ieee80211_local *local, - struct sk_buff *skb); - void ieee80211_add_pending_skbs(struct ieee80211_local *local, ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -460,12 +460,6 @@ static void ieee80211_do_stop(struct iee - if (cancel_scan) - ieee80211_scan_cancel(local); - -- /* -- * Stop TX on this interface first. -- */ -- if (!local->ops->wake_tx_queue && sdata->dev) -- netif_tx_stop_all_queues(sdata->dev); -- - ieee80211_roc_purge(local, sdata); - - switch (sdata->vif.type) { -@@ -813,13 +807,6 @@ static void ieee80211_uninit(struct net_ - ieee80211_teardown_sdata(IEEE80211_DEV_TO_SUB_IF(dev)); - } - --static u16 ieee80211_netdev_select_queue(struct net_device *dev, -- struct sk_buff *skb, -- struct net_device *sb_dev) --{ -- return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb); --} -- - static void - ieee80211_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) - { -@@ -833,7 +820,6 @@ static const struct net_device_ops ieee8 - .ndo_start_xmit = ieee80211_subif_start_xmit, - .ndo_set_rx_mode = ieee80211_set_multicast_list, - .ndo_set_mac_address = ieee80211_change_mac, -- .ndo_select_queue = ieee80211_netdev_select_queue, - .ndo_get_stats64 = ieee80211_get_stats64, - }; - -@@ -941,7 +927,6 @@ static const struct net_device_ops ieee8 - .ndo_start_xmit = ieee80211_subif_start_xmit_8023, - .ndo_set_rx_mode = ieee80211_set_multicast_list, - .ndo_set_mac_address = ieee80211_change_mac, -- .ndo_select_queue = ieee80211_netdev_select_queue, - .ndo_get_stats64 = ieee80211_get_stats64, - .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, - }; -@@ -1443,35 +1428,6 @@ int ieee80211_do_open(struct wireless_de - - ieee80211_recalc_ps(local); - -- if (sdata->vif.type == NL80211_IFTYPE_MONITOR || -- sdata->vif.type == NL80211_IFTYPE_AP_VLAN || -- local->ops->wake_tx_queue) { -- /* XXX: for AP_VLAN, actually track AP queues */ -- if (dev) -- netif_tx_start_all_queues(dev); -- } else if (dev) { -- unsigned long flags; -- int n_acs = IEEE80211_NUM_ACS; -- int ac; -- -- if (local->hw.queues < IEEE80211_NUM_ACS) -- n_acs = 1; -- -- spin_lock_irqsave(&local->queue_stop_reason_lock, flags); -- if (sdata->vif.cab_queue == IEEE80211_INVAL_HW_QUEUE || -- (local->queue_stop_reasons[sdata->vif.cab_queue] == 0 && -- skb_queue_empty(&local->pending[sdata->vif.cab_queue]))) { -- for (ac = 0; ac < n_acs; ac++) { -- int ac_queue = sdata->vif.hw_queue[ac]; -- -- if (local->queue_stop_reasons[ac_queue] == 0 && -- skb_queue_empty(&local->pending[ac_queue])) -- netif_start_subqueue(dev, ac); -- } -- } -- spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); -- } -- - set_bit(SDATA_STATE_RUNNING, &sdata->state); - - return 0; -@@ -1501,17 +1457,12 @@ static void ieee80211_if_setup(struct ne - { - ether_setup(dev); - dev->priv_flags &= ~IFF_TX_SKB_SHARING; -+ dev->priv_flags |= IFF_NO_QUEUE; - dev->netdev_ops = &ieee80211_dataif_ops; - dev->needs_free_netdev = true; - dev->priv_destructor = ieee80211_if_free; - } - --static void ieee80211_if_setup_no_queue(struct net_device *dev) --{ -- ieee80211_if_setup(dev); -- dev->priv_flags |= IFF_NO_QUEUE; --} -- - static void ieee80211_iface_process_skb(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb) -@@ -2096,9 +2047,7 @@ int ieee80211_if_add(struct ieee80211_lo - struct net_device *ndev = NULL; - struct ieee80211_sub_if_data *sdata = NULL; - struct txq_info *txqi; -- void (*if_setup)(struct net_device *dev); - int ret, i; -- int txqs = 1; - - ASSERT_RTNL(); - -@@ -2121,30 +2070,18 @@ int ieee80211_if_add(struct ieee80211_lo - sizeof(void *)); - int txq_size = 0; - -- if (local->ops->wake_tx_queue && -- type != NL80211_IFTYPE_AP_VLAN && -+ if (type != NL80211_IFTYPE_AP_VLAN && - (type != NL80211_IFTYPE_MONITOR || - (params->flags & MONITOR_FLAG_ACTIVE))) - txq_size += sizeof(struct txq_info) + - local->hw.txq_data_size; - -- if (local->ops->wake_tx_queue) { -- if_setup = ieee80211_if_setup_no_queue; -- } else { -- if_setup = ieee80211_if_setup; -- if (local->hw.queues >= IEEE80211_NUM_ACS) -- txqs = IEEE80211_NUM_ACS; -- } -- - ndev = alloc_netdev_mqs(size + txq_size, - name, name_assign_type, -- if_setup, txqs, 1); -+ ieee80211_if_setup, 1, 1); - if (!ndev) - return -ENOMEM; - -- if (!local->ops->wake_tx_queue && local->hw.wiphy->tx_queue_len) -- ndev->tx_queue_len = local->hw.wiphy->tx_queue_len; -- - dev_net_set(ndev, wiphy_net(local->hw.wiphy)); - - ndev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -630,7 +630,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ - - if (WARN_ON(!ops->tx || !ops->start || !ops->stop || !ops->config || - !ops->add_interface || !ops->remove_interface || -- !ops->configure_filter)) -+ !ops->configure_filter || !ops->wake_tx_queue)) - return NULL; - - if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove))) -@@ -719,9 +719,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ - if (!ops->set_key) - wiphy->flags |= WIPHY_FLAG_IBSS_RSN; - -- if (ops->wake_tx_queue) -- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_TXQS); -- -+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_TXQS); - wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_RRM); - - wiphy->bss_priv_size = sizeof(struct ieee80211_bss); -@@ -834,10 +832,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ - atomic_set(&local->agg_queue_stop[i], 0); - } - tasklet_setup(&local->tx_pending_tasklet, ieee80211_tx_pending); -- -- if (ops->wake_tx_queue) -- tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs); -- -+ tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs); - tasklet_setup(&local->tasklet, ieee80211_tasklet_handler); - - skb_queue_head_init(&local->skb_queue); ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -1571,9 +1571,6 @@ static void sta_ps_start(struct sta_info - - ieee80211_clear_fast_xmit(sta); - -- if (!sta->sta.txq[0]) -- return; -- - for (tid = 0; tid < IEEE80211_NUM_TIDS; tid++) { - struct ieee80211_txq *txq = sta->sta.txq[tid]; - struct txq_info *txqi = to_txq_info(txq); ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -140,17 +140,15 @@ static void __cleanup_single_sta(struct - atomic_dec(&ps->num_sta_ps); - } - -- if (sta->sta.txq[0]) { -- for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { -- struct txq_info *txqi; -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { -+ struct txq_info *txqi; - -- if (!sta->sta.txq[i]) -- continue; -+ if (!sta->sta.txq[i]) -+ continue; - -- txqi = to_txq_info(sta->sta.txq[i]); -+ txqi = to_txq_info(sta->sta.txq[i]); - -- ieee80211_txq_purge(local, txqi); -- } -+ ieee80211_txq_purge(local, txqi); - } - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -@@ -425,8 +423,7 @@ void sta_info_free(struct ieee80211_loca - - sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr); - -- if (sta->sta.txq[0]) -- kfree(to_txq_info(sta->sta.txq[0])); -+ kfree(to_txq_info(sta->sta.txq[0])); - kfree(rcu_dereference_raw(sta->sta.rates)); - #ifdef CPTCFG_MAC80211_MESH - kfree(sta->mesh); -@@ -527,6 +524,8 @@ __sta_info_alloc(struct ieee80211_sub_if - struct ieee80211_local *local = sdata->local; - struct ieee80211_hw *hw = &local->hw; - struct sta_info *sta; -+ void *txq_data; -+ int size; - int i; - - sta = kzalloc(sizeof(*sta) + hw->sta_data_size, gfp); -@@ -597,21 +596,18 @@ __sta_info_alloc(struct ieee80211_sub_if - - sta->last_connected = ktime_get_seconds(); - -- if (local->ops->wake_tx_queue) { -- void *txq_data; -- int size = sizeof(struct txq_info) + -- ALIGN(hw->txq_data_size, sizeof(void *)); -+ size = sizeof(struct txq_info) + -+ ALIGN(hw->txq_data_size, sizeof(void *)); - -- txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp); -- if (!txq_data) -- goto free; -+ txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp); -+ if (!txq_data) -+ goto free; - -- for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { -- struct txq_info *txq = txq_data + i * size; -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { -+ struct txq_info *txq = txq_data + i * size; - -- /* might not do anything for the bufferable MMPDU TXQ */ -- ieee80211_txq_init(sdata, sta, txq, i); -- } -+ /* might not do anything for the (bufferable) MMPDU TXQ */ -+ ieee80211_txq_init(sdata, sta, txq, i); - } - - if (sta_prepare_rate_control(local, sta, gfp)) -@@ -685,8 +681,7 @@ __sta_info_alloc(struct ieee80211_sub_if - return sta; - - free_txq: -- if (sta->sta.txq[0]) -- kfree(to_txq_info(sta->sta.txq[0])); -+ kfree(to_txq_info(sta->sta.txq[0])); - free: - sta_info_free_link(&sta->deflink); - #ifdef CPTCFG_MAC80211_MESH -@@ -1960,9 +1955,6 @@ ieee80211_sta_ps_deliver_response(struct - * TIM recalculation. - */ - -- if (!sta->sta.txq[0]) -- return; -- - for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) { - if (!sta->sta.txq[tid] || - !(driver_release_tids & BIT(tid)) || -@@ -2447,7 +2439,7 @@ static void sta_set_tidstats(struct sta_ - tidstats->tx_msdu_failed = sta->deflink.status_stats.msdu_failed[tid]; - } - -- if (local->ops->wake_tx_queue && tid < IEEE80211_NUM_TIDS) { -+ if (tid < IEEE80211_NUM_TIDS) { - spin_lock_bh(&local->fq.lock); - rcu_read_lock(); - -@@ -2775,9 +2767,6 @@ unsigned long ieee80211_sta_last_active( - - static void sta_update_codel_params(struct sta_info *sta, u32 thr) - { -- if (!sta->sdata->local->ops->wake_tx_queue) -- return; -- - if (thr && thr < STA_SLOW_THRESHOLD * sta->local->num_sta) { - sta->cparams.target = MS2TIME(50); - sta->cparams.interval = MS2TIME(300); ---- a/net/mac80211/tdls.c -+++ b/net/mac80211/tdls.c -@@ -1016,7 +1016,6 @@ ieee80211_tdls_prep_mgmt_packet(struct w - skb->priority = 256 + 5; - break; - } -- skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb)); - - /* - * Set the WLAN_TDLS_TEARDOWN flag to indicate a teardown in progress. ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1600,9 +1600,6 @@ int ieee80211_txq_setup_flows(struct iee - bool supp_vht = false; - enum nl80211_band band; - -- if (!local->ops->wake_tx_queue) -- return 0; -- - ret = fq_init(fq, 4096); - if (ret) - return ret; -@@ -1650,9 +1647,6 @@ void ieee80211_txq_teardown_flows(struct - { - struct fq *fq = &local->fq; - -- if (!local->ops->wake_tx_queue) -- return; -- - kfree(local->cvars); - local->cvars = NULL; - -@@ -1669,8 +1663,7 @@ static bool ieee80211_queue_skb(struct i - struct ieee80211_vif *vif; - struct txq_info *txqi; - -- if (!local->ops->wake_tx_queue || -- sdata->vif.type == NL80211_IFTYPE_MONITOR) -+ if (sdata->vif.type == NL80211_IFTYPE_MONITOR) - return false; - - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) -@@ -4193,12 +4186,7 @@ void __ieee80211_subif_start_xmit(struct - if (IS_ERR(sta)) - sta = NULL; - -- if (local->ops->wake_tx_queue) { -- u16 queue = __ieee80211_select_queue(sdata, sta, skb); -- skb_set_queue_mapping(skb, queue); -- skb_get_hash(skb); -- } -- -+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); - ieee80211_aggr_check(sdata, sta, skb); - - sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift); -@@ -4509,11 +4497,7 @@ static void ieee80211_8023_xmit(struct i - struct tid_ampdu_tx *tid_tx; - u8 tid; - -- if (local->ops->wake_tx_queue) { -- u16 queue = __ieee80211_select_queue(sdata, sta, skb); -- skb_set_queue_mapping(skb, queue); -- skb_get_hash(skb); -- } -+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); - - if (unlikely(test_bit(SCAN_SW_SCANNING, &local->scanning)) && - test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) -@@ -4767,9 +4751,6 @@ void ieee80211_tx_pending(struct tasklet - if (!txok) - break; - } -- -- if (skb_queue_empty(&local->pending[i])) -- ieee80211_propagate_queue_wake(local, i); - } - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); - -@@ -5962,10 +5943,9 @@ int ieee80211_tx_control_port(struct wip - } - - if (!IS_ERR(sta)) { -- u16 queue = __ieee80211_select_queue(sdata, sta, skb); -+ u16 queue = ieee80211_select_queue(sdata, sta, skb); - - skb_set_queue_mapping(skb, queue); -- skb_get_hash(skb); - - /* - * for MLO STA, the SA should be the AP MLD address, but ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -444,39 +444,6 @@ void ieee80211_wake_txqs(struct tasklet_ - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); - } - --void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue) --{ -- struct ieee80211_sub_if_data *sdata; -- int n_acs = IEEE80211_NUM_ACS; -- -- if (local->ops->wake_tx_queue) -- return; -- -- if (local->hw.queues < IEEE80211_NUM_ACS) -- n_acs = 1; -- -- list_for_each_entry_rcu(sdata, &local->interfaces, list) { -- int ac; -- -- if (!sdata->dev) -- continue; -- -- if (sdata->vif.cab_queue != IEEE80211_INVAL_HW_QUEUE && -- local->queue_stop_reasons[sdata->vif.cab_queue] != 0) -- continue; -- -- for (ac = 0; ac < n_acs; ac++) { -- int ac_queue = sdata->vif.hw_queue[ac]; -- -- if (ac_queue == queue || -- (sdata->vif.cab_queue == queue && -- local->queue_stop_reasons[ac_queue] == 0 && -- skb_queue_empty(&local->pending[ac_queue]))) -- netif_wake_subqueue(sdata->dev, ac); -- } -- } --} -- - static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue, - enum queue_stop_reason reason, - bool refcounted, -@@ -507,11 +474,7 @@ static void __ieee80211_wake_queue(struc - /* someone still has this queue stopped */ - return; - -- if (skb_queue_empty(&local->pending[queue])) { -- rcu_read_lock(); -- ieee80211_propagate_queue_wake(local, queue); -- rcu_read_unlock(); -- } else -+ if (!skb_queue_empty(&local->pending[queue])) - tasklet_schedule(&local->tx_pending_tasklet); - - /* -@@ -521,12 +484,10 @@ static void __ieee80211_wake_queue(struc - * release someone's lock, but it is fine because all the callers of - * __ieee80211_wake_queue call it right before releasing the lock. - */ -- if (local->ops->wake_tx_queue) { -- if (reason == IEEE80211_QUEUE_STOP_REASON_DRIVER) -- tasklet_schedule(&local->wake_txqs_tasklet); -- else -- _ieee80211_wake_txqs(local, flags); -- } -+ if (reason == IEEE80211_QUEUE_STOP_REASON_DRIVER) -+ tasklet_schedule(&local->wake_txqs_tasklet); -+ else -+ _ieee80211_wake_txqs(local, flags); - } - - void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, -@@ -554,8 +515,6 @@ static void __ieee80211_stop_queue(struc - bool refcounted) - { - struct ieee80211_local *local = hw_to_local(hw); -- struct ieee80211_sub_if_data *sdata; -- int n_acs = IEEE80211_NUM_ACS; - - trace_stop_queue(local, queue, reason); - -@@ -567,27 +526,7 @@ static void __ieee80211_stop_queue(struc - else - local->q_stop_reasons[queue][reason]++; - -- if (__test_and_set_bit(reason, &local->queue_stop_reasons[queue])) -- return; -- -- if (local->hw.queues < IEEE80211_NUM_ACS) -- n_acs = 1; -- -- rcu_read_lock(); -- list_for_each_entry_rcu(sdata, &local->interfaces, list) { -- int ac; -- -- if (!sdata->dev) -- continue; -- -- for (ac = 0; ac < n_acs; ac++) { -- if (!local->ops->wake_tx_queue && -- (sdata->vif.hw_queue[ac] == queue || -- sdata->vif.cab_queue == queue)) -- netif_stop_subqueue(sdata->dev, ac); -- } -- } -- rcu_read_unlock(); -+ set_bit(reason, &local->queue_stop_reasons[queue]); - } - - void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, ---- a/net/mac80211/wme.c -+++ b/net/mac80211/wme.c -@@ -122,6 +122,9 @@ u16 ieee80211_select_queue_80211(struct - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - u8 *p; - -+ /* Ensure hash is set prior to potential SW encryption */ -+ skb_get_hash(skb); -+ - if ((info->control.flags & IEEE80211_TX_CTRL_DONT_REORDER) || - local->hw.queues < IEEE80211_NUM_ACS) - return 0; -@@ -141,13 +144,16 @@ u16 ieee80211_select_queue_80211(struct - return ieee80211_downgrade_queue(sdata, NULL, skb); - } - --u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, -- struct sta_info *sta, struct sk_buff *skb) -+u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, struct sk_buff *skb) - { - const struct ethhdr *eth = (void *)skb->data; - struct mac80211_qos_map *qos_map; - bool qos; - -+ /* Ensure hash is set prior to potential SW encryption */ -+ skb_get_hash(skb); -+ - /* all mesh/ocb stations are required to support WME */ - if ((sdata->vif.type == NL80211_IFTYPE_MESH_POINT && - !is_multicast_ether_addr(eth->h_dest)) || -@@ -178,59 +184,6 @@ u16 __ieee80211_select_queue(struct ieee - return ieee80211_downgrade_queue(sdata, sta, skb); - } - -- --/* Indicate which queue to use. */ --u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, -- struct sk_buff *skb) --{ -- struct ieee80211_local *local = sdata->local; -- struct sta_info *sta = NULL; -- const u8 *ra = NULL; -- u16 ret; -- -- /* when using iTXQ, we can do this later */ -- if (local->ops->wake_tx_queue) -- return 0; -- -- if (local->hw.queues < IEEE80211_NUM_ACS || skb->len < 6) { -- skb->priority = 0; /* required for correct WPA/11i MIC */ -- return 0; -- } -- -- rcu_read_lock(); -- switch (sdata->vif.type) { -- case NL80211_IFTYPE_AP_VLAN: -- sta = rcu_dereference(sdata->u.vlan.sta); -- if (sta) -- break; -- fallthrough; -- case NL80211_IFTYPE_AP: -- ra = skb->data; -- break; -- case NL80211_IFTYPE_STATION: -- /* might be a TDLS station */ -- sta = sta_info_get(sdata, skb->data); -- if (sta) -- break; -- -- ra = sdata->deflink.u.mgd.bssid; -- break; -- case NL80211_IFTYPE_ADHOC: -- ra = skb->data; -- break; -- default: -- break; -- } -- -- if (!sta && ra && !is_multicast_ether_addr(ra)) -- sta = sta_info_get(sdata, ra); -- -- ret = __ieee80211_select_queue(sdata, sta, skb); -- -- rcu_read_unlock(); -- return ret; --} -- - /** - * ieee80211_set_qos_hdr - Fill in the QoS header if there is one. - * ---- a/net/mac80211/wme.h -+++ b/net/mac80211/wme.h -@@ -13,10 +13,8 @@ - u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb, - struct ieee80211_hdr *hdr); --u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, -- struct sta_info *sta, struct sk_buff *skb); - u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, -- struct sk_buff *skb); -+ struct sta_info *sta, struct sk_buff *skb); - void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb); - diff --git a/package/kernel/mac80211/patches/subsys/306-04-v6.2-wifi-realtek-remove-duplicated-wake_tx_queue.patch b/package/kernel/mac80211/patches/subsys/306-04-v6.2-wifi-realtek-remove-duplicated-wake_tx_queue.patch deleted file mode 100644 index f0dfc75a788..00000000000 --- a/package/kernel/mac80211/patches/subsys/306-04-v6.2-wifi-realtek-remove-duplicated-wake_tx_queue.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Johannes Berg -Date: Mon, 10 Oct 2022 19:17:46 +0200 -Subject: [PATCH] wifi: realtek: remove duplicated wake_tx_queue - -By accident, the previous patch duplicated the initialization -of the wake_tx_queue callback. Fix that by removing the new -initializations. - -Fixes: a790cc3a4fad ("wifi: mac80211: add wake_tx_queue callback to drivers") -Signed-off-by: Johannes Berg ---- - ---- a/drivers/net/wireless/realtek/rtw88/mac80211.c -+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c -@@ -896,7 +896,6 @@ static void rtw_ops_sta_rc_update(struct - - const struct ieee80211_ops rtw_ops = { - .tx = rtw_ops_tx, -- .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .wake_tx_queue = rtw_ops_wake_tx_queue, - .start = rtw_ops_start, - .stop = rtw_ops_stop, ---- a/drivers/net/wireless/realtek/rtw89/mac80211.c -+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c -@@ -918,7 +918,6 @@ static int rtw89_ops_set_tid_config(stru - - const struct ieee80211_ops rtw89_ops = { - .tx = rtw89_ops_tx, -- .wake_tx_queue = ieee80211_handle_wake_tx_queue, - .wake_tx_queue = rtw89_ops_wake_tx_queue, - .start = rtw89_ops_start, - .stop = rtw89_ops_stop, diff --git a/package/kernel/mac80211/patches/subsys/338-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch b/package/kernel/mac80211/patches/subsys/310-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch similarity index 94% rename from package/kernel/mac80211/patches/subsys/338-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch rename to package/kernel/mac80211/patches/subsys/310-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch index f7391a58090..f362751e0a3 100644 --- a/package/kernel/mac80211/patches/subsys/338-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch +++ b/package/kernel/mac80211/patches/subsys/310-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch @@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c -@@ -703,6 +703,9 @@ bool ieee80211_mesh_xmit_fast(struct iee +@@ -765,6 +765,9 @@ bool ieee80211_mesh_xmit_fast(struct iee struct sk_buff *skb, u32 ctrl_flags) { struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; @@ -24,7 +24,7 @@ Signed-off-by: Felix Fietkau struct ieee80211_mesh_fast_tx *entry; struct ieee80211s_hdr *meshhdr; u8 sa[ETH_ALEN] __aligned(2); -@@ -738,7 +741,10 @@ bool ieee80211_mesh_xmit_fast(struct iee +@@ -800,7 +803,10 @@ bool ieee80211_mesh_xmit_fast(struct iee return false; } @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h -@@ -133,9 +133,33 @@ struct mesh_path { +@@ -134,9 +134,33 @@ struct mesh_path { #define MESH_FAST_TX_CACHE_TIMEOUT 8000 /* msecs */ /** @@ -73,7 +73,7 @@ Signed-off-by: Felix Fietkau * @fast_tx: base fast_tx data * @hdr: cached mesh and rfc1042 headers * @hdrlen: length of mesh + rfc1042 -@@ -146,7 +170,7 @@ struct mesh_path { +@@ -147,7 +171,7 @@ struct mesh_path { */ struct ieee80211_mesh_fast_tx { struct rhash_head rhash; @@ -82,7 +82,7 @@ Signed-off-by: Felix Fietkau struct ieee80211_fast_tx fast_tx; u8 hdr[sizeof(struct ieee80211s_hdr) + sizeof(rfc1042_header)]; -@@ -329,7 +353,8 @@ void mesh_path_tx_root_frame(struct ieee +@@ -334,7 +358,8 @@ void mesh_path_tx_root_frame(struct ieee bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt); struct ieee80211_mesh_fast_tx * @@ -189,7 +189,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -2726,7 +2726,10 @@ ieee80211_rx_mesh_fast_forward(struct ie +@@ -2727,7 +2727,10 @@ ieee80211_rx_mesh_fast_forward(struct ie struct sk_buff *skb, int hdrlen) { struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; @@ -201,7 +201,7 @@ Signed-off-by: Felix Fietkau struct ieee80211s_hdr *mesh_hdr; struct tid_ampdu_tx *tid_tx; struct sta_info *sta; -@@ -2735,9 +2738,13 @@ ieee80211_rx_mesh_fast_forward(struct ie +@@ -2736,9 +2739,13 @@ ieee80211_rx_mesh_fast_forward(struct ie mesh_hdr = (struct ieee80211s_hdr *)(skb->data + sizeof(eth)); if ((mesh_hdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) diff --git a/package/kernel/mac80211/patches/subsys/310-v6.2-mac80211-add-support-for-restricting-netdev-features.patch b/package/kernel/mac80211/patches/subsys/310-v6.2-mac80211-add-support-for-restricting-netdev-features.patch deleted file mode 100644 index 812b12189c4..00000000000 --- a/package/kernel/mac80211/patches/subsys/310-v6.2-mac80211-add-support-for-restricting-netdev-features.patch +++ /dev/null @@ -1,506 +0,0 @@ -From: Felix Fietkau -Date: Sun, 9 Oct 2022 20:15:46 +0200 -Subject: [PATCH] mac80211: add support for restricting netdev features per vif - -This can be used to selectively disable feature flags for checksum offload, -scatter/gather or GSO by changing vif->netdev_features. -Removing features from vif->netdev_features does not affect the netdev -features themselves, but instead fixes up skbs in the tx path so that the -offloads are not needed in the driver. - -Aside from making it easier to deal with vif type based hardware limitations, -this also makes it possible to optimize performance on hardware without native -GSO support by declaring GSO support in hw->netdev_features and removing it -from vif->netdev_features. This allows mac80211 to handle GSO segmentation -after the sta lookup, but before itxq enqueue, thus reducing the number of -unnecessary sta lookups, as well as some other per-packet processing. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/fq_impl.h -+++ b/include/net/fq_impl.h -@@ -200,6 +200,7 @@ static void fq_tin_enqueue(struct fq *fq - fq_skb_free_t free_func) - { - struct fq_flow *flow; -+ struct sk_buff *next; - bool oom; - - lockdep_assert_held(&fq->lock); -@@ -214,11 +215,15 @@ static void fq_tin_enqueue(struct fq *fq - } - - flow->tin = tin; -- flow->backlog += skb->len; -- tin->backlog_bytes += skb->len; -- tin->backlog_packets++; -- fq->memory_usage += skb->truesize; -- fq->backlog++; -+ skb_list_walk_safe(skb, skb, next) { -+ skb_mark_not_on_list(skb); -+ flow->backlog += skb->len; -+ tin->backlog_bytes += skb->len; -+ tin->backlog_packets++; -+ fq->memory_usage += skb->truesize; -+ fq->backlog++; -+ __skb_queue_tail(&flow->queue, skb); -+ } - - if (list_empty(&flow->flowchain)) { - flow->deficit = fq->quantum; -@@ -226,7 +231,6 @@ static void fq_tin_enqueue(struct fq *fq - &tin->new_flows); - } - -- __skb_queue_tail(&flow->queue, skb); - oom = (fq->memory_usage > fq->memory_limit); - while (fq->backlog > fq->limit || oom) { - flow = fq_find_fattest_flow(fq); ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -1807,6 +1807,10 @@ struct ieee80211_vif_cfg { - * @addr: address of this interface - * @p2p: indicates whether this AP or STA interface is a p2p - * interface, i.e. a GO or p2p-sta respectively -+ * @netdev_features: tx netdev features supported by the hardware for this -+ * vif. mac80211 initializes this to hw->netdev_features, and the driver -+ * can mask out specific tx features. mac80211 will handle software fixup -+ * for masked offloads (GSO, CSUM) - * @driver_flags: flags/capabilities the driver has for this interface, - * these need to be set (or cleared) when the interface is added - * or, if supported by the driver, the interface type is changed -@@ -1846,6 +1850,7 @@ struct ieee80211_vif { - - struct ieee80211_txq *txq; - -+ netdev_features_t netdev_features; - u32 driver_flags; - u32 offload_flags; - ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -2181,6 +2181,7 @@ int ieee80211_if_add(struct ieee80211_lo - ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE; - ndev->hw_features |= ndev->features & - MAC80211_SUPPORTED_FEATURES_TX; -+ sdata->vif.netdev_features = local->hw.netdev_features; - - netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops); - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1356,7 +1356,11 @@ static struct txq_info *ieee80211_get_tx - - static void ieee80211_set_skb_enqueue_time(struct sk_buff *skb) - { -- IEEE80211_SKB_CB(skb)->control.enqueue_time = codel_get_time(); -+ struct sk_buff *next; -+ codel_time_t now = codel_get_time(); -+ -+ skb_list_walk_safe(skb, skb, next) -+ IEEE80211_SKB_CB(skb)->control.enqueue_time = now; - } - - static u32 codel_skb_len_func(const struct sk_buff *skb) -@@ -3579,55 +3583,79 @@ ieee80211_xmit_fast_finish(struct ieee80 - return TX_CONTINUE; - } - --static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -- struct sta_info *sta, -- struct ieee80211_fast_tx *fast_tx, -- struct sk_buff *skb) -+static netdev_features_t -+ieee80211_sdata_netdev_features(struct ieee80211_sub_if_data *sdata) - { -- struct ieee80211_local *local = sdata->local; -- u16 ethertype = (skb->data[12] << 8) | skb->data[13]; -- int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); -- int hw_headroom = sdata->local->hw.extra_tx_headroom; -- struct ethhdr eth; -- struct ieee80211_tx_info *info; -- struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; -- struct ieee80211_tx_data tx; -- ieee80211_tx_result r; -- struct tid_ampdu_tx *tid_tx = NULL; -- u8 tid = IEEE80211_NUM_TIDS; -+ if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN) -+ return sdata->vif.netdev_features; - -- /* control port protocol needs a lot of special handling */ -- if (cpu_to_be16(ethertype) == sdata->control_port_protocol) -- return false; -+ if (!sdata->bss) -+ return 0; - -- /* only RFC 1042 SNAP */ -- if (ethertype < ETH_P_802_3_MIN) -- return false; -+ sdata = container_of(sdata->bss, struct ieee80211_sub_if_data, u.ap); -+ return sdata->vif.netdev_features; -+} - -- /* don't handle TX status request here either */ -- if (skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) -- return false; -+static struct sk_buff * -+ieee80211_tx_skb_fixup(struct sk_buff *skb, netdev_features_t features) -+{ -+ if (skb_is_gso(skb)) { -+ struct sk_buff *segs; - -- if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { -- tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -- tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); -- if (tid_tx) { -- if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) -- return false; -- if (tid_tx->timeout) -- tid_tx->last_tx = jiffies; -- } -+ segs = skb_gso_segment(skb, features); -+ if (!segs) -+ return skb; -+ if (IS_ERR(segs)) -+ goto free; -+ -+ consume_skb(skb); -+ return segs; - } - -- /* after this point (skb is modified) we cannot return false */ -+ if (skb_needs_linearize(skb, features) && __skb_linearize(skb)) -+ goto free; -+ -+ if (skb->ip_summed == CHECKSUM_PARTIAL) { -+ int ofs = skb_checksum_start_offset(skb); -+ -+ if (skb->encapsulation) -+ skb_set_inner_transport_header(skb, ofs); -+ else -+ skb_set_transport_header(skb, ofs); -+ -+ if (skb_csum_hwoffload_help(skb, features)) -+ goto free; -+ } -+ -+ skb_mark_not_on_list(skb); -+ return skb; -+ -+free: -+ kfree_skb(skb); -+ return NULL; -+} -+ -+static void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, -+ struct ieee80211_fast_tx *fast_tx, -+ struct sk_buff *skb, u8 tid, bool ampdu) -+{ -+ struct ieee80211_local *local = sdata->local; -+ struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; -+ struct ieee80211_tx_info *info; -+ struct ieee80211_tx_data tx; -+ ieee80211_tx_result r; -+ int hw_headroom = sdata->local->hw.extra_tx_headroom; -+ int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); -+ struct ethhdr eth; - - skb = skb_share_check(skb, GFP_ATOMIC); - if (unlikely(!skb)) -- return true; -+ return; - - if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) && - ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb)) -- return true; -+ return; - - /* will not be crypto-handled beyond what we do here, so use false - * as the may-encrypt argument for the resize to not account for -@@ -3636,10 +3664,8 @@ static bool ieee80211_xmit_fast(struct i - if (unlikely(ieee80211_skb_resize(sdata, skb, - max_t(int, extra_head + hw_headroom - - skb_headroom(skb), 0), -- ENCRYPT_NO))) { -- kfree_skb(skb); -- return true; -- } -+ ENCRYPT_NO))) -+ goto free; - - memcpy(ð, skb->data, ETH_HLEN - 2); - hdr = skb_push(skb, extra_head); -@@ -3653,7 +3679,7 @@ static bool ieee80211_xmit_fast(struct i - info->control.vif = &sdata->vif; - info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT | - IEEE80211_TX_CTL_DONTFRAG | -- (tid_tx ? IEEE80211_TX_CTL_AMPDU : 0); -+ (ampdu ? IEEE80211_TX_CTL_AMPDU : 0); - info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT | - u32_encode_bits(IEEE80211_LINK_UNSPECIFIED, - IEEE80211_TX_CTRL_MLO_LINK); -@@ -3677,16 +3703,14 @@ static bool ieee80211_xmit_fast(struct i - tx.key = fast_tx->key; - - if (ieee80211_queue_skb(local, sdata, sta, skb)) -- return true; -+ return; - - tx.skb = skb; - r = ieee80211_xmit_fast_finish(sdata, sta, fast_tx->pn_offs, - fast_tx->key, &tx); - tx.skb = NULL; -- if (r == TX_DROP) { -- kfree_skb(skb); -- return true; -- } -+ if (r == TX_DROP) -+ goto free; - - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) - sdata = container_of(sdata->bss, -@@ -3694,6 +3718,56 @@ static bool ieee80211_xmit_fast(struct i - - __skb_queue_tail(&tx.skbs, skb); - ieee80211_tx_frags(local, &sdata->vif, sta, &tx.skbs, false); -+ return; -+ -+free: -+ kfree_skb(skb); -+} -+ -+static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, -+ struct ieee80211_fast_tx *fast_tx, -+ struct sk_buff *skb) -+{ -+ u16 ethertype = (skb->data[12] << 8) | skb->data[13]; -+ struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; -+ struct tid_ampdu_tx *tid_tx = NULL; -+ struct sk_buff *next; -+ u8 tid = IEEE80211_NUM_TIDS; -+ -+ /* control port protocol needs a lot of special handling */ -+ if (cpu_to_be16(ethertype) == sdata->control_port_protocol) -+ return false; -+ -+ /* only RFC 1042 SNAP */ -+ if (ethertype < ETH_P_802_3_MIN) -+ return false; -+ -+ /* don't handle TX status request here either */ -+ if (skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) -+ return false; -+ -+ if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { -+ tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -+ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); -+ if (tid_tx) { -+ if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) -+ return false; -+ if (tid_tx->timeout) -+ tid_tx->last_tx = jiffies; -+ } -+ } -+ -+ /* after this point (skb is modified) we cannot return false */ -+ skb = ieee80211_tx_skb_fixup(skb, ieee80211_sdata_netdev_features(sdata)); -+ if (!skb) -+ return true; -+ -+ skb_list_walk_safe(skb, skb, next) { -+ skb_mark_not_on_list(skb); -+ __ieee80211_xmit_fast(sdata, sta, fast_tx, skb, tid, tid_tx); -+ } -+ - return true; - } - -@@ -4201,31 +4275,14 @@ void __ieee80211_subif_start_xmit(struct - goto out; - } - -- if (skb_is_gso(skb)) { -- struct sk_buff *segs; -- -- segs = skb_gso_segment(skb, 0); -- if (IS_ERR(segs)) { -- goto out_free; -- } else if (segs) { -- consume_skb(skb); -- skb = segs; -- } -- } else { -- /* we cannot process non-linear frames on this path */ -- if (skb_linearize(skb)) -- goto out_free; -- -- /* the frame could be fragmented, software-encrypted, and other -- * things so we cannot really handle checksum offload with it - -- * fix it up in software before we handle anything else. -- */ -- if (skb->ip_summed == CHECKSUM_PARTIAL) { -- skb_set_transport_header(skb, -- skb_checksum_start_offset(skb)); -- if (skb_checksum_help(skb)) -- goto out_free; -- } -+ /* the frame could be fragmented, software-encrypted, and other -+ * things so we cannot really handle checksum or GSO offload. -+ * fix it up in software before we handle anything else. -+ */ -+ skb = ieee80211_tx_skb_fixup(skb, 0); -+ if (!skb) { -+ len = 0; -+ goto out; - } - - skb_list_walk_safe(skb, skb, next) { -@@ -4443,9 +4500,11 @@ normal: - return NETDEV_TX_OK; - } - --static bool ieee80211_tx_8023(struct ieee80211_sub_if_data *sdata, -- struct sk_buff *skb, struct sta_info *sta, -- bool txpending) -+ -+ -+static bool __ieee80211_tx_8023(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, struct sta_info *sta, -+ bool txpending) - { - struct ieee80211_local *local = sdata->local; - struct ieee80211_tx_control control = {}; -@@ -4454,14 +4513,6 @@ static bool ieee80211_tx_8023(struct iee - unsigned long flags; - int q = info->hw_queue; - -- if (sta) -- sk_pacing_shift_update(skb->sk, local->hw.tx_sk_pacing_shift); -- -- ieee80211_tpt_led_trig_tx(local, skb->len); -- -- if (ieee80211_queue_skb(local, sdata, sta, skb)) -- return true; -- - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - - if (local->queue_stop_reasons[q] || -@@ -4488,6 +4539,26 @@ static bool ieee80211_tx_8023(struct iee - return true; - } - -+static bool ieee80211_tx_8023(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, struct sta_info *sta, -+ bool txpending) -+{ -+ struct ieee80211_local *local = sdata->local; -+ struct sk_buff *next; -+ bool ret = true; -+ -+ if (ieee80211_queue_skb(local, sdata, sta, skb)) -+ return true; -+ -+ skb_list_walk_safe(skb, skb, next) { -+ skb_mark_not_on_list(skb); -+ if (!__ieee80211_tx_8023(sdata, skb, sta, txpending)) -+ ret = false; -+ } -+ -+ return ret; -+} -+ - 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) -@@ -4495,9 +4566,13 @@ static void ieee80211_8023_xmit(struct i - struct ieee80211_tx_info *info; - struct ieee80211_local *local = sdata->local; - struct tid_ampdu_tx *tid_tx; -+ struct sk_buff *seg, *next; -+ unsigned int skbs = 0, len = 0; -+ u16 queue; - u8 tid; - -- skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); -+ queue = ieee80211_select_queue(sdata, sta, skb); -+ skb_set_queue_mapping(skb, queue); - - if (unlikely(test_bit(SCAN_SW_SCANNING, &local->scanning)) && - test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) -@@ -4507,9 +4582,6 @@ static void ieee80211_8023_xmit(struct i - if (unlikely(!skb)) - return; - -- info = IEEE80211_SKB_CB(skb); -- memset(info, 0, sizeof(*info)); -- - ieee80211_aggr_check(sdata, sta, skb); - - tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -@@ -4523,22 +4595,20 @@ static void ieee80211_8023_xmit(struct i - return; - } - -- info->flags |= IEEE80211_TX_CTL_AMPDU; - if (tid_tx->timeout) - tid_tx->last_tx = jiffies; - } - -- if (unlikely(skb->sk && -- skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) -- info->ack_frame_id = ieee80211_store_ack_skb(local, skb, -- &info->flags, NULL); -+ skb = ieee80211_tx_skb_fixup(skb, ieee80211_sdata_netdev_features(sdata)); -+ if (!skb) -+ return; - -- info->hw_queue = sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; -+ info = IEEE80211_SKB_CB(skb); -+ memset(info, 0, sizeof(*info)); -+ if (tid_tx) -+ info->flags |= IEEE80211_TX_CTL_AMPDU; - -- dev_sw_netstats_tx_add(dev, 1, skb->len); -- -- sta->deflink.tx_stats.bytes[skb_get_queue_mapping(skb)] += skb->len; -- sta->deflink.tx_stats.packets[skb_get_queue_mapping(skb)]++; -+ info->hw_queue = sdata->vif.hw_queue[queue]; - - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) - sdata = container_of(sdata->bss, -@@ -4550,6 +4620,24 @@ static void ieee80211_8023_xmit(struct i - if (key) - info->control.hw_key = &key->conf; - -+ skb_list_walk_safe(skb, seg, next) { -+ skbs++; -+ len += seg->len; -+ if (seg != skb) -+ memcpy(IEEE80211_SKB_CB(seg), info, sizeof(*info)); -+ } -+ -+ if (unlikely(skb->sk && -+ skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) -+ info->ack_frame_id = ieee80211_store_ack_skb(local, skb, -+ &info->flags, NULL); -+ -+ dev_sw_netstats_tx_add(dev, skbs, len); -+ sta->deflink.tx_stats.packets[queue] += skbs; -+ sta->deflink.tx_stats.bytes[queue] += len; -+ -+ ieee80211_tpt_led_trig_tx(local, len); -+ - ieee80211_tx_8023(sdata, skb, sta, false); - - return; -@@ -4591,6 +4679,7 @@ netdev_tx_t ieee80211_subif_start_xmit_8 - key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)) - goto skip_offload; - -+ sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift); - ieee80211_8023_xmit(sdata, dev, sta, key, skb); - goto out; - diff --git a/package/kernel/mac80211/patches/subsys/311-v6.2-wifi-mac80211-fix-and-simplify-unencrypted-drop-chec.patch b/package/kernel/mac80211/patches/subsys/311-v6.2-wifi-mac80211-fix-and-simplify-unencrypted-drop-chec.patch deleted file mode 100644 index 804b02eb306..00000000000 --- a/package/kernel/mac80211/patches/subsys/311-v6.2-wifi-mac80211-fix-and-simplify-unencrypted-drop-chec.patch +++ /dev/null @@ -1,87 +0,0 @@ -From: Felix Fietkau -Date: Thu, 1 Dec 2022 14:57:30 +0100 -Subject: [PATCH] wifi: mac80211: fix and simplify unencrypted drop check for - mesh - -ieee80211_drop_unencrypted is called from ieee80211_rx_h_mesh_fwding and -ieee80211_frame_allowed. - -Since ieee80211_rx_h_mesh_fwding can forward packets for other mesh nodes -and is called earlier, it needs to check the decryptions status and if the -packet is using the control protocol on its own, instead of deferring to -the later call from ieee80211_frame_allowed. - -Because of that, ieee80211_drop_unencrypted has a mesh specific check -that skips over the mesh header in order to check the payload protocol. -This code is invalid when called from ieee80211_frame_allowed, since that -happens after the 802.11->802.3 conversion. - -Fix this by moving the mesh specific check directly into -ieee80211_rx_h_mesh_fwding. - -Signed-off-by: Felix Fietkau -Link: https://lore.kernel.org/r/20221201135730.19723-1-nbd@nbd.name -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2403,7 +2403,6 @@ static int ieee80211_802_1x_port_control - - static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc) - { -- struct ieee80211_hdr *hdr = (void *)rx->skb->data; - struct sk_buff *skb = rx->skb; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - -@@ -2414,31 +2413,6 @@ static int ieee80211_drop_unencrypted(st - if (status->flag & RX_FLAG_DECRYPTED) - return 0; - -- /* check mesh EAPOL frames first */ -- if (unlikely(rx->sta && ieee80211_vif_is_mesh(&rx->sdata->vif) && -- ieee80211_is_data(fc))) { -- struct ieee80211s_hdr *mesh_hdr; -- u16 hdr_len = ieee80211_hdrlen(fc); -- u16 ethertype_offset; -- __be16 ethertype; -- -- if (!ether_addr_equal(hdr->addr1, rx->sdata->vif.addr)) -- goto drop_check; -- -- /* make sure fixed part of mesh header is there, also checks skb len */ -- if (!pskb_may_pull(rx->skb, hdr_len + 6)) -- goto drop_check; -- -- mesh_hdr = (struct ieee80211s_hdr *)(skb->data + hdr_len); -- ethertype_offset = hdr_len + ieee80211_get_mesh_hdrlen(mesh_hdr) + -- sizeof(rfc1042_header); -- -- if (skb_copy_bits(rx->skb, ethertype_offset, ðertype, 2) == 0 && -- ethertype == rx->sdata->control_port_protocol) -- return 0; -- } -- --drop_check: - /* Drop unencrypted frames if key is set. */ - if (unlikely(!ieee80211_has_protected(fc) && - !ieee80211_is_any_nullfunc(fc) && -@@ -2892,8 +2866,16 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 - hdr = (struct ieee80211_hdr *) skb->data; - mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); - -- if (ieee80211_drop_unencrypted(rx, hdr->frame_control)) -- return RX_DROP_MONITOR; -+ if (ieee80211_drop_unencrypted(rx, hdr->frame_control)) { -+ int offset = hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr) + -+ sizeof(rfc1042_header); -+ __be16 ethertype; -+ -+ if (!ether_addr_equal(hdr->addr1, rx->sdata->vif.addr) || -+ skb_copy_bits(rx->skb, offset, ðertype, 2) != 0 || -+ ethertype != rx->sdata->control_port_protocol) -+ return RX_DROP_MONITOR; -+ } - - /* frame is in RMC, don't forward */ - if (ieee80211_is_data(hdr->frame_control) && diff --git a/package/kernel/mac80211/patches/subsys/312-v6.3-wifi-cfg80211-move-A-MSDU-check-in-ieee80211_data_to.patch b/package/kernel/mac80211/patches/subsys/312-v6.3-wifi-cfg80211-move-A-MSDU-check-in-ieee80211_data_to.patch deleted file mode 100644 index f668905ccaa..00000000000 --- a/package/kernel/mac80211/patches/subsys/312-v6.3-wifi-cfg80211-move-A-MSDU-check-in-ieee80211_data_to.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Felix Fietkau -Date: Fri, 2 Dec 2022 13:53:11 +0100 -Subject: [PATCH] wifi: cfg80211: move A-MSDU check in - ieee80211_data_to_8023_exthdr - -When parsing the outer A-MSDU header, don't check for inner bridge tunnel -or RFC1042 headers. This is handled by ieee80211_amsdu_to_8023s already. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -631,8 +631,9 @@ int ieee80211_data_to_8023_exthdr(struct - break; - } - -- if (likely(skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 && -- ((!is_amsdu && ether_addr_equal(payload.hdr, rfc1042_header) && -+ if (likely(!is_amsdu && -+ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 && -+ ((ether_addr_equal(payload.hdr, rfc1042_header) && - payload.proto != htons(ETH_P_AARP) && - payload.proto != htons(ETH_P_IPX)) || - ether_addr_equal(payload.hdr, bridge_tunnel_header)))) { diff --git a/package/kernel/mac80211/patches/subsys/313-v6.3-wifi-cfg80211-factor-out-bridge-tunnel-RFC1042-heade.patch b/package/kernel/mac80211/patches/subsys/313-v6.3-wifi-cfg80211-factor-out-bridge-tunnel-RFC1042-heade.patch deleted file mode 100644 index 86410578694..00000000000 --- a/package/kernel/mac80211/patches/subsys/313-v6.3-wifi-cfg80211-factor-out-bridge-tunnel-RFC1042-heade.patch +++ /dev/null @@ -1,76 +0,0 @@ -From: Felix Fietkau -Date: Fri, 2 Dec 2022 13:54:15 +0100 -Subject: [PATCH] wifi: cfg80211: factor out bridge tunnel / RFC1042 header - check - -The same check is done in multiple places, unify it. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -542,6 +542,21 @@ unsigned int ieee80211_get_mesh_hdrlen(s - } - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen); - -+static bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto) -+{ -+ const __be16 *hdr_proto = hdr + ETH_ALEN; -+ -+ if (!(ether_addr_equal(hdr, rfc1042_header) && -+ *hdr_proto != htons(ETH_P_AARP) && -+ *hdr_proto != htons(ETH_P_IPX)) && -+ !ether_addr_equal(hdr, bridge_tunnel_header)) -+ return false; -+ -+ *proto = *hdr_proto; -+ -+ return true; -+} -+ - int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, - const u8 *addr, enum nl80211_iftype iftype, - u8 data_offset, bool is_amsdu) -@@ -633,14 +648,9 @@ int ieee80211_data_to_8023_exthdr(struct - - if (likely(!is_amsdu && - skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 && -- ((ether_addr_equal(payload.hdr, rfc1042_header) && -- payload.proto != htons(ETH_P_AARP) && -- payload.proto != htons(ETH_P_IPX)) || -- ether_addr_equal(payload.hdr, bridge_tunnel_header)))) { -- /* remove RFC1042 or Bridge-Tunnel encapsulation and -- * replace EtherType */ -+ ieee80211_get_8023_tunnel_proto(&payload, &tmp.h_proto))) { -+ /* remove RFC1042 or Bridge-Tunnel encapsulation */ - hdrlen += ETH_ALEN + 2; -- tmp.h_proto = payload.proto; - skb_postpull_rcsum(skb, &payload, ETH_ALEN + 2); - } else { - tmp.h_proto = htons(skb->len - hdrlen); -@@ -756,8 +766,6 @@ void ieee80211_amsdu_to_8023s(struct sk_ - { - unsigned int hlen = ALIGN(extra_headroom, 4); - struct sk_buff *frame = NULL; -- u16 ethertype; -- u8 *payload; - int offset = 0, remaining; - struct ethhdr eth; - bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb); -@@ -811,14 +819,8 @@ void ieee80211_amsdu_to_8023s(struct sk_ - frame->dev = skb->dev; - frame->priority = skb->priority; - -- payload = frame->data; -- ethertype = (payload[6] << 8) | payload[7]; -- if (likely((ether_addr_equal(payload, rfc1042_header) && -- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || -- ether_addr_equal(payload, bridge_tunnel_header))) { -- eth.h_proto = htons(ethertype); -+ if (likely(ieee80211_get_8023_tunnel_proto(frame->data, ð.h_proto))) - skb_pull(frame, ETH_ALEN + 2); -- } - - memcpy(skb_push(frame, sizeof(eth)), ð, sizeof(eth)); - __skb_queue_tail(list, frame); diff --git a/package/kernel/mac80211/patches/subsys/314-v6.3-wifi-mac80211-remove-mesh-forwarding-congestion-chec.patch b/package/kernel/mac80211/patches/subsys/314-v6.3-wifi-mac80211-remove-mesh-forwarding-congestion-chec.patch deleted file mode 100644 index 515176f0dec..00000000000 --- a/package/kernel/mac80211/patches/subsys/314-v6.3-wifi-mac80211-remove-mesh-forwarding-congestion-chec.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: Felix Fietkau -Date: Fri, 2 Dec 2022 17:01:46 +0100 -Subject: [PATCH] wifi: mac80211: remove mesh forwarding congestion check - -Now that all drivers use iTXQ, it does not make sense to check to drop -tx forwarding packets when the driver has stopped the queues. -fq_codel will take care of dropping packets when the queues fill up - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/debugfs_netdev.c -+++ b/net/mac80211/debugfs_netdev.c -@@ -603,8 +603,6 @@ IEEE80211_IF_FILE(fwded_mcast, u.mesh.ms - IEEE80211_IF_FILE(fwded_unicast, u.mesh.mshstats.fwded_unicast, DEC); - IEEE80211_IF_FILE(fwded_frames, u.mesh.mshstats.fwded_frames, DEC); - IEEE80211_IF_FILE(dropped_frames_ttl, u.mesh.mshstats.dropped_frames_ttl, DEC); --IEEE80211_IF_FILE(dropped_frames_congestion, -- u.mesh.mshstats.dropped_frames_congestion, DEC); - IEEE80211_IF_FILE(dropped_frames_no_route, - u.mesh.mshstats.dropped_frames_no_route, DEC); - -@@ -740,7 +738,6 @@ static void add_mesh_stats(struct ieee80 - MESHSTATS_ADD(fwded_frames); - MESHSTATS_ADD(dropped_frames_ttl); - MESHSTATS_ADD(dropped_frames_no_route); -- MESHSTATS_ADD(dropped_frames_congestion); - #undef MESHSTATS_ADD - } - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -329,7 +329,6 @@ struct mesh_stats { - __u32 fwded_frames; /* Mesh total forwarded frames */ - __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ - __u32 dropped_frames_no_route; /* Not transmitted, no route found */ -- __u32 dropped_frames_congestion;/* Not forwarded due to congestion */ - }; - - #define PREQ_Q_F_START 0x1 ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2926,11 +2926,6 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 - return RX_CONTINUE; - - ac = ieee802_1d_to_ac[skb->priority]; -- q = sdata->vif.hw_queue[ac]; -- if (ieee80211_queue_stopped(&local->hw, q)) { -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion); -- return RX_DROP_MONITOR; -- } - skb_set_queue_mapping(skb, ac); - - if (!--mesh_hdr->ttl) { diff --git a/package/kernel/mac80211/patches/subsys/315-v6.3-wifi-mac80211-fix-receiving-A-MSDU-frames-on-mesh-in.patch b/package/kernel/mac80211/patches/subsys/315-v6.3-wifi-mac80211-fix-receiving-A-MSDU-frames-on-mesh-in.patch deleted file mode 100644 index 59b799b6b17..00000000000 --- a/package/kernel/mac80211/patches/subsys/315-v6.3-wifi-mac80211-fix-receiving-A-MSDU-frames-on-mesh-in.patch +++ /dev/null @@ -1,762 +0,0 @@ -From 986e43b19ae9176093da35e0a844e65c8bf9ede7 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Mon, 13 Feb 2023 11:08:54 +0100 -Subject: [PATCH] wifi: mac80211: fix receiving A-MSDU frames on mesh - interfaces - -The current mac80211 mesh A-MSDU receive path fails to parse A-MSDU packets -on mesh interfaces, because it assumes that the Mesh Control field is always -directly after the 802.11 header. -802.11-2020 9.3.2.2.2 Figure 9-70 shows that the Mesh Control field is -actually part of the A-MSDU subframe header. -This makes more sense, since it allows packets for multiple different -destinations to be included in the same A-MSDU, as long as RA and TID are -still the same. -Another issue is the fact that the A-MSDU subframe length field was apparently -accidentally defined as little-endian in the standard. - -In order to fix this, the mesh forwarding path needs happen at a different -point in the receive path. - -ieee80211_data_to_8023_exthdr is changed to ignore the mesh control field -and leave it in after the ethernet header. This also affects the source/dest -MAC address fields, which now in the case of mesh point to the mesh SA/DA. - -ieee80211_amsdu_to_8023s is changed to deal with the endian difference and -to add the Mesh Control length to the subframe length, since it's not covered -by the MSDU length field. - -With these changes, the mac80211 will get the same packet structure for -converted regular data packets and unpacked A-MSDU subframes. - -The mesh forwarding checks are now only performed after the A-MSDU decap. -For locally received packets, the Mesh Control header is stripped away. -For forwarded packets, a new 802.11 header gets added. - -Signed-off-by: Felix Fietkau -Link: https://lore.kernel.org/r/20230213100855.34315-4-nbd@nbd.name -[fix fortify build error] -Signed-off-by: Johannes Berg ---- - .../wireless/marvell/mwifiex/11n_rxreorder.c | 2 +- - include/net/cfg80211.h | 27 +- - net/mac80211/rx.c | 350 ++++++++++-------- - net/wireless/util.c | 120 +++--- - 4 files changed, 297 insertions(+), 202 deletions(-) - ---- a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c -+++ b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c -@@ -33,7 +33,7 @@ static int mwifiex_11n_dispatch_amsdu_pk - skb_trim(skb, le16_to_cpu(local_rx_pd->rx_pkt_length)); - - ieee80211_amsdu_to_8023s(skb, &list, priv->curr_addr, -- priv->wdev.iftype, 0, NULL, NULL); -+ priv->wdev.iftype, 0, NULL, NULL, false); - - while (!skb_queue_empty(&list)) { - struct rx_packet_hdr *rx_hdr; ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -6208,11 +6208,36 @@ static inline int ieee80211_data_to_8023 - * @extra_headroom: The hardware extra headroom for SKBs in the @list. - * @check_da: DA to check in the inner ethernet header, or NULL - * @check_sa: SA to check in the inner ethernet header, or NULL -+ * @mesh_control: A-MSDU subframe header includes the mesh control field - */ - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, - const u8 *addr, enum nl80211_iftype iftype, - const unsigned int extra_headroom, -- const u8 *check_da, const u8 *check_sa); -+ const u8 *check_da, const u8 *check_sa, -+ bool mesh_control); -+ -+/** -+ * ieee80211_get_8023_tunnel_proto - get RFC1042 or bridge tunnel encap protocol -+ * -+ * Check for RFC1042 or bridge tunnel header and fetch the encapsulated -+ * protocol. -+ * -+ * @hdr: pointer to the MSDU payload -+ * @proto: destination pointer to store the protocol -+ * Return: true if encapsulation was found -+ */ -+bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto); -+ -+/** -+ * ieee80211_strip_8023_mesh_hdr - strip mesh header from converted 802.3 frames -+ * -+ * Strip the mesh header, which was left in by ieee80211_data_to_8023 as part -+ * of the MSDU data. Also move any source/destination addresses from the mesh -+ * header to the ethernet header (if present). -+ * -+ * @skb: The 802.3 frame with embedded mesh header -+ */ -+int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb); - - /** - * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2720,6 +2720,174 @@ ieee80211_deliver_skb(struct ieee80211_r - } - } - -+static ieee80211_rx_result -+ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta, -+ struct sk_buff *skb) -+{ -+#ifdef CPTCFG_MAC80211_MESH -+ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; -+ struct ieee80211_local *local = sdata->local; -+ uint16_t fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA; -+ struct ieee80211_hdr hdr = { -+ .frame_control = cpu_to_le16(fc) -+ }; -+ struct ieee80211_hdr *fwd_hdr; -+ struct ieee80211s_hdr *mesh_hdr; -+ struct ieee80211_tx_info *info; -+ struct sk_buff *fwd_skb; -+ struct ethhdr *eth; -+ bool multicast; -+ int tailroom = 0; -+ int hdrlen, mesh_hdrlen; -+ u8 *qos; -+ -+ if (!ieee80211_vif_is_mesh(&sdata->vif)) -+ return RX_CONTINUE; -+ -+ if (!pskb_may_pull(skb, sizeof(*eth) + 6)) -+ return RX_DROP_MONITOR; -+ -+ mesh_hdr = (struct ieee80211s_hdr *)(skb->data + sizeof(*eth)); -+ mesh_hdrlen = ieee80211_get_mesh_hdrlen(mesh_hdr); -+ -+ if (!pskb_may_pull(skb, sizeof(*eth) + mesh_hdrlen)) -+ return RX_DROP_MONITOR; -+ -+ eth = (struct ethhdr *)skb->data; -+ multicast = is_multicast_ether_addr(eth->h_dest); -+ -+ mesh_hdr = (struct ieee80211s_hdr *)(eth + 1); -+ if (!mesh_hdr->ttl) -+ return RX_DROP_MONITOR; -+ -+ /* frame is in RMC, don't forward */ -+ if (is_multicast_ether_addr(eth->h_dest) && -+ mesh_rmc_check(sdata, eth->h_source, mesh_hdr)) -+ return RX_DROP_MONITOR; -+ -+ /* Frame has reached destination. Don't forward */ -+ if (ether_addr_equal(sdata->vif.addr, eth->h_dest)) -+ goto rx_accept; -+ -+ if (!ifmsh->mshcfg.dot11MeshForwarding) { -+ if (is_multicast_ether_addr(eth->h_dest)) -+ goto rx_accept; -+ -+ return RX_DROP_MONITOR; -+ } -+ -+ /* forward packet */ -+ if (sdata->crypto_tx_tailroom_needed_cnt) -+ tailroom = IEEE80211_ENCRYPT_TAILROOM; -+ -+ if (!--mesh_hdr->ttl) { -+ if (multicast) -+ goto rx_accept; -+ -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); -+ return RX_DROP_MONITOR; -+ } -+ -+ if (mesh_hdr->flags & MESH_FLAGS_AE) { -+ struct mesh_path *mppath; -+ char *proxied_addr; -+ -+ if (multicast) -+ proxied_addr = mesh_hdr->eaddr1; -+ else if ((mesh_hdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) -+ /* has_a4 already checked in ieee80211_rx_mesh_check */ -+ proxied_addr = mesh_hdr->eaddr2; -+ else -+ return RX_DROP_MONITOR; -+ -+ rcu_read_lock(); -+ mppath = mpp_path_lookup(sdata, proxied_addr); -+ if (!mppath) { -+ mpp_path_add(sdata, proxied_addr, eth->h_source); -+ } else { -+ spin_lock_bh(&mppath->state_lock); -+ if (!ether_addr_equal(mppath->mpp, eth->h_source)) -+ memcpy(mppath->mpp, eth->h_source, ETH_ALEN); -+ mppath->exp_time = jiffies; -+ spin_unlock_bh(&mppath->state_lock); -+ } -+ rcu_read_unlock(); -+ } -+ -+ skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]); -+ -+ ieee80211_fill_mesh_addresses(&hdr, &hdr.frame_control, -+ eth->h_dest, eth->h_source); -+ hdrlen = ieee80211_hdrlen(hdr.frame_control); -+ if (multicast) { -+ int extra_head = sizeof(struct ieee80211_hdr) - sizeof(*eth); -+ -+ fwd_skb = skb_copy_expand(skb, local->tx_headroom + extra_head + -+ IEEE80211_ENCRYPT_HEADROOM, -+ tailroom, GFP_ATOMIC); -+ if (!fwd_skb) -+ goto rx_accept; -+ } else { -+ fwd_skb = skb; -+ skb = NULL; -+ -+ if (skb_cow_head(fwd_skb, hdrlen - sizeof(struct ethhdr))) -+ return RX_DROP_UNUSABLE; -+ } -+ -+ fwd_hdr = skb_push(fwd_skb, hdrlen - sizeof(struct ethhdr)); -+ memcpy(fwd_hdr, &hdr, hdrlen - 2); -+ qos = ieee80211_get_qos_ctl(fwd_hdr); -+ qos[0] = qos[1] = 0; -+ -+ skb_reset_mac_header(fwd_skb); -+ hdrlen += mesh_hdrlen; -+ if (ieee80211_get_8023_tunnel_proto(fwd_skb->data + hdrlen, -+ &fwd_skb->protocol)) -+ hdrlen += ETH_ALEN; -+ else -+ fwd_skb->protocol = htons(fwd_skb->len - hdrlen); -+ skb_set_network_header(fwd_skb, hdrlen); -+ -+ info = IEEE80211_SKB_CB(fwd_skb); -+ memset(info, 0, sizeof(*info)); -+ info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING; -+ info->control.vif = &sdata->vif; -+ info->control.jiffies = jiffies; -+ if (multicast) { -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast); -+ memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); -+ /* update power mode indication when forwarding */ -+ ieee80211_mps_set_frame_flags(sdata, NULL, fwd_hdr); -+ } else if (!mesh_nexthop_lookup(sdata, fwd_skb)) { -+ /* mesh power mode flags updated in mesh_nexthop_lookup */ -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast); -+ } else { -+ /* unable to resolve next hop */ -+ if (sta) -+ mesh_path_error_tx(sdata, ifmsh->mshcfg.element_ttl, -+ hdr.addr3, 0, -+ WLAN_REASON_MESH_PATH_NOFORWARD, -+ sta->sta.addr); -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_no_route); -+ kfree_skb(fwd_skb); -+ goto rx_accept; -+ } -+ -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); -+ fwd_skb->dev = sdata->dev; -+ ieee80211_add_pending_skb(local, fwd_skb); -+ -+rx_accept: -+ if (!skb) -+ return RX_QUEUED; -+ -+ ieee80211_strip_8023_mesh_hdr(skb); -+#endif -+ -+ return RX_CONTINUE; -+} -+ - static ieee80211_rx_result debug_noinline - __ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx, u8 data_offset) - { -@@ -2728,8 +2896,10 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - __le16 fc = hdr->frame_control; - struct sk_buff_head frame_list; -+ static ieee80211_rx_result res; - struct ethhdr ethhdr; - const u8 *check_da = ethhdr.h_dest, *check_sa = ethhdr.h_source; -+ bool mesh = false; - - if (unlikely(ieee80211_has_a4(hdr->frame_control))) { - check_da = NULL; -@@ -2746,6 +2916,8 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ - break; - case NL80211_IFTYPE_MESH_POINT: - check_sa = NULL; -+ check_da = NULL; -+ mesh = true; - break; - default: - break; -@@ -2763,17 +2935,29 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, - rx->sdata->vif.type, - rx->local->hw.extra_tx_headroom, -- check_da, check_sa); -+ check_da, check_sa, mesh); - - while (!skb_queue_empty(&frame_list)) { - rx->skb = __skb_dequeue(&frame_list); - -- if (!ieee80211_frame_allowed(rx, fc)) { -- dev_kfree_skb(rx->skb); -+ res = ieee80211_rx_mesh_data(rx->sdata, rx->sta, rx->skb); -+ switch (res) { -+ case RX_QUEUED: - continue; -+ case RX_CONTINUE: -+ break; -+ default: -+ goto free; - } - -+ if (!ieee80211_frame_allowed(rx, fc)) -+ goto free; -+ - ieee80211_deliver_skb(rx); -+ continue; -+ -+free: -+ dev_kfree_skb(rx->skb); - } - - return RX_QUEUED; -@@ -2806,6 +2990,8 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx - if (!rx->sdata->u.mgd.use_4addr) - return RX_DROP_UNUSABLE; - break; -+ case NL80211_IFTYPE_MESH_POINT: -+ break; - default: - return RX_DROP_UNUSABLE; - } -@@ -2834,155 +3020,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx - return __ieee80211_rx_h_amsdu(rx, 0); - } - --#ifdef CPTCFG_MAC80211_MESH --static ieee80211_rx_result --ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) --{ -- struct ieee80211_hdr *fwd_hdr, *hdr; -- struct ieee80211_tx_info *info; -- struct ieee80211s_hdr *mesh_hdr; -- struct sk_buff *skb = rx->skb, *fwd_skb; -- struct ieee80211_local *local = rx->local; -- struct ieee80211_sub_if_data *sdata = rx->sdata; -- struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; -- u16 ac, q, hdrlen; -- int tailroom = 0; -- -- hdr = (struct ieee80211_hdr *) skb->data; -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -- -- /* make sure fixed part of mesh header is there, also checks skb len */ -- if (!pskb_may_pull(rx->skb, hdrlen + 6)) -- return RX_DROP_MONITOR; -- -- mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); -- -- /* make sure full mesh header is there, also checks skb len */ -- if (!pskb_may_pull(rx->skb, -- hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr))) -- return RX_DROP_MONITOR; -- -- /* reload pointers */ -- hdr = (struct ieee80211_hdr *) skb->data; -- mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); -- -- if (ieee80211_drop_unencrypted(rx, hdr->frame_control)) { -- int offset = hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr) + -- sizeof(rfc1042_header); -- __be16 ethertype; -- -- if (!ether_addr_equal(hdr->addr1, rx->sdata->vif.addr) || -- skb_copy_bits(rx->skb, offset, ðertype, 2) != 0 || -- ethertype != rx->sdata->control_port_protocol) -- return RX_DROP_MONITOR; -- } -- -- /* frame is in RMC, don't forward */ -- if (ieee80211_is_data(hdr->frame_control) && -- is_multicast_ether_addr(hdr->addr1) && -- mesh_rmc_check(rx->sdata, hdr->addr3, mesh_hdr)) -- return RX_DROP_MONITOR; -- -- if (!ieee80211_is_data(hdr->frame_control)) -- return RX_CONTINUE; -- -- if (!mesh_hdr->ttl) -- return RX_DROP_MONITOR; -- -- if (mesh_hdr->flags & MESH_FLAGS_AE) { -- struct mesh_path *mppath; -- char *proxied_addr; -- char *mpp_addr; -- -- if (is_multicast_ether_addr(hdr->addr1)) { -- mpp_addr = hdr->addr3; -- proxied_addr = mesh_hdr->eaddr1; -- } else if ((mesh_hdr->flags & MESH_FLAGS_AE) == -- MESH_FLAGS_AE_A5_A6) { -- /* has_a4 already checked in ieee80211_rx_mesh_check */ -- mpp_addr = hdr->addr4; -- proxied_addr = mesh_hdr->eaddr2; -- } else { -- return RX_DROP_MONITOR; -- } -- -- rcu_read_lock(); -- mppath = mpp_path_lookup(sdata, proxied_addr); -- if (!mppath) { -- mpp_path_add(sdata, proxied_addr, mpp_addr); -- } else { -- spin_lock_bh(&mppath->state_lock); -- if (!ether_addr_equal(mppath->mpp, mpp_addr)) -- memcpy(mppath->mpp, mpp_addr, ETH_ALEN); -- mppath->exp_time = jiffies; -- spin_unlock_bh(&mppath->state_lock); -- } -- rcu_read_unlock(); -- } -- -- /* Frame has reached destination. Don't forward */ -- if (!is_multicast_ether_addr(hdr->addr1) && -- ether_addr_equal(sdata->vif.addr, hdr->addr3)) -- return RX_CONTINUE; -- -- ac = ieee802_1d_to_ac[skb->priority]; -- skb_set_queue_mapping(skb, ac); -- -- if (!--mesh_hdr->ttl) { -- if (!is_multicast_ether_addr(hdr->addr1)) -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, -- dropped_frames_ttl); -- goto out; -- } -- -- if (!ifmsh->mshcfg.dot11MeshForwarding) -- goto out; -- -- if (sdata->crypto_tx_tailroom_needed_cnt) -- tailroom = IEEE80211_ENCRYPT_TAILROOM; -- -- fwd_skb = skb_copy_expand(skb, local->tx_headroom + -- IEEE80211_ENCRYPT_HEADROOM, -- tailroom, GFP_ATOMIC); -- if (!fwd_skb) -- goto out; -- -- fwd_skb->dev = sdata->dev; -- fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; -- fwd_hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_RETRY); -- info = IEEE80211_SKB_CB(fwd_skb); -- memset(info, 0, sizeof(*info)); -- info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING; -- info->control.vif = &rx->sdata->vif; -- info->control.jiffies = jiffies; -- if (is_multicast_ether_addr(fwd_hdr->addr1)) { -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast); -- memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); -- /* update power mode indication when forwarding */ -- ieee80211_mps_set_frame_flags(sdata, NULL, fwd_hdr); -- } else if (!mesh_nexthop_lookup(sdata, fwd_skb)) { -- /* mesh power mode flags updated in mesh_nexthop_lookup */ -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast); -- } else { -- /* unable to resolve next hop */ -- mesh_path_error_tx(sdata, ifmsh->mshcfg.element_ttl, -- fwd_hdr->addr3, 0, -- WLAN_REASON_MESH_PATH_NOFORWARD, -- fwd_hdr->addr2); -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_no_route); -- kfree_skb(fwd_skb); -- return RX_DROP_MONITOR; -- } -- -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); -- ieee80211_add_pending_skb(local, fwd_skb); -- out: -- if (is_multicast_ether_addr(hdr->addr1)) -- return RX_CONTINUE; -- return RX_DROP_MONITOR; --} --#endif -- - static ieee80211_rx_result debug_noinline - ieee80211_rx_h_data(struct ieee80211_rx_data *rx) - { -@@ -2991,6 +3028,7 @@ ieee80211_rx_h_data(struct ieee80211_rx_ - struct net_device *dev = sdata->dev; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; - __le16 fc = hdr->frame_control; -+ static ieee80211_rx_result res; - bool port_control; - int err; - -@@ -3017,6 +3055,10 @@ ieee80211_rx_h_data(struct ieee80211_rx_ - if (unlikely(err)) - return RX_DROP_UNUSABLE; - -+ res = ieee80211_rx_mesh_data(rx->sdata, rx->sta, rx->skb); -+ if (res != RX_CONTINUE) -+ return res; -+ - if (!ieee80211_frame_allowed(rx, fc)) - return RX_DROP_MONITOR; - -@@ -3987,10 +4029,6 @@ static void ieee80211_rx_handlers(struct - CALL_RXH(ieee80211_rx_h_defragment); - CALL_RXH(ieee80211_rx_h_michael_mic_verify); - /* must be after MMIC verify so header is counted in MPDU mic */ --#ifdef CPTCFG_MAC80211_MESH -- if (ieee80211_vif_is_mesh(&rx->sdata->vif)) -- CALL_RXH(ieee80211_rx_h_mesh_fwding); --#endif - CALL_RXH(ieee80211_rx_h_amsdu); - CALL_RXH(ieee80211_rx_h_data); - ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -542,7 +542,7 @@ unsigned int ieee80211_get_mesh_hdrlen(s - } - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen); - --static bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto) -+bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto) - { - const __be16 *hdr_proto = hdr + ETH_ALEN; - -@@ -556,6 +556,49 @@ static bool ieee80211_get_8023_tunnel_pr - - return true; - } -+EXPORT_SYMBOL(ieee80211_get_8023_tunnel_proto); -+ -+int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb) -+{ -+ const void *mesh_addr; -+ struct { -+ struct ethhdr eth; -+ u8 flags; -+ } payload; -+ int hdrlen; -+ int ret; -+ -+ ret = skb_copy_bits(skb, 0, &payload, sizeof(payload)); -+ if (ret) -+ return ret; -+ -+ hdrlen = sizeof(payload.eth) + __ieee80211_get_mesh_hdrlen(payload.flags); -+ -+ if (likely(pskb_may_pull(skb, hdrlen + 8) && -+ ieee80211_get_8023_tunnel_proto(skb->data + hdrlen, -+ &payload.eth.h_proto))) -+ hdrlen += ETH_ALEN + 2; -+ else if (!pskb_may_pull(skb, hdrlen)) -+ return -EINVAL; -+ -+ mesh_addr = skb->data + sizeof(payload.eth) + ETH_ALEN; -+ switch (payload.flags & MESH_FLAGS_AE) { -+ case MESH_FLAGS_AE_A4: -+ memcpy(&payload.eth.h_source, mesh_addr, ETH_ALEN); -+ break; -+ case MESH_FLAGS_AE_A5_A6: -+ memcpy(&payload.eth, mesh_addr, 2 * ETH_ALEN); -+ break; -+ default: -+ break; -+ } -+ -+ pskb_pull(skb, hdrlen - sizeof(payload.eth)); -+ memcpy(skb->data, &payload.eth, sizeof(payload.eth)); -+ -+ return 0; -+} -+EXPORT_SYMBOL(ieee80211_strip_8023_mesh_hdr); - - int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, - const u8 *addr, enum nl80211_iftype iftype, -@@ -568,7 +611,6 @@ int ieee80211_data_to_8023_exthdr(struct - } payload; - struct ethhdr tmp; - u16 hdrlen; -- u8 mesh_flags = 0; - - if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) - return -1; -@@ -589,12 +631,6 @@ int ieee80211_data_to_8023_exthdr(struct - memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN); - memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN); - -- if (iftype == NL80211_IFTYPE_MESH_POINT && -- skb_copy_bits(skb, hdrlen, &mesh_flags, 1) < 0) -- return -1; -- -- mesh_flags &= MESH_FLAGS_AE; -- - switch (hdr->frame_control & - cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) { - case cpu_to_le16(IEEE80211_FCTL_TODS): -@@ -608,17 +644,6 @@ int ieee80211_data_to_8023_exthdr(struct - iftype != NL80211_IFTYPE_AP_VLAN && - iftype != NL80211_IFTYPE_STATION)) - return -1; -- if (iftype == NL80211_IFTYPE_MESH_POINT) { -- if (mesh_flags == MESH_FLAGS_AE_A4) -- return -1; -- if (mesh_flags == MESH_FLAGS_AE_A5_A6 && -- skb_copy_bits(skb, hdrlen + -- offsetof(struct ieee80211s_hdr, eaddr1), -- tmp.h_dest, 2 * ETH_ALEN) < 0) -- return -1; -- -- hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags); -- } - break; - case cpu_to_le16(IEEE80211_FCTL_FROMDS): - if ((iftype != NL80211_IFTYPE_STATION && -@@ -627,16 +652,6 @@ int ieee80211_data_to_8023_exthdr(struct - (is_multicast_ether_addr(tmp.h_dest) && - ether_addr_equal(tmp.h_source, addr))) - return -1; -- if (iftype == NL80211_IFTYPE_MESH_POINT) { -- if (mesh_flags == MESH_FLAGS_AE_A5_A6) -- return -1; -- if (mesh_flags == MESH_FLAGS_AE_A4 && -- skb_copy_bits(skb, hdrlen + -- offsetof(struct ieee80211s_hdr, eaddr1), -- tmp.h_source, ETH_ALEN) < 0) -- return -1; -- hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags); -- } - break; - case cpu_to_le16(0): - if (iftype != NL80211_IFTYPE_ADHOC && -@@ -646,7 +661,7 @@ int ieee80211_data_to_8023_exthdr(struct - break; - } - -- if (likely(!is_amsdu && -+ if (likely(!is_amsdu && iftype != NL80211_IFTYPE_MESH_POINT && - skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 && - ieee80211_get_8023_tunnel_proto(&payload, &tmp.h_proto))) { - /* remove RFC1042 or Bridge-Tunnel encapsulation */ -@@ -722,7 +737,8 @@ __ieee80211_amsdu_copy_frag(struct sk_bu - - static struct sk_buff * - __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen, -- int offset, int len, bool reuse_frag) -+ int offset, int len, bool reuse_frag, -+ int min_len) - { - struct sk_buff *frame; - int cur_len = len; -@@ -736,7 +752,7 @@ __ieee80211_amsdu_copy(struct sk_buff *s - * in the stack later. - */ - if (reuse_frag) -- cur_len = min_t(int, len, 32); -+ cur_len = min_t(int, len, min_len); - - /* - * Allocate and reserve two bytes more for payload -@@ -746,6 +762,7 @@ __ieee80211_amsdu_copy(struct sk_buff *s - if (!frame) - return NULL; - -+ frame->priority = skb->priority; - skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2); - skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len); - -@@ -762,23 +779,37 @@ __ieee80211_amsdu_copy(struct sk_buff *s - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, - const u8 *addr, enum nl80211_iftype iftype, - const unsigned int extra_headroom, -- const u8 *check_da, const u8 *check_sa) -+ const u8 *check_da, const u8 *check_sa, -+ bool mesh_control) - { - unsigned int hlen = ALIGN(extra_headroom, 4); - struct sk_buff *frame = NULL; - int offset = 0, remaining; -- struct ethhdr eth; -+ struct { -+ struct ethhdr eth; -+ uint8_t flags; -+ } hdr; - bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb); - bool reuse_skb = false; - bool last = false; -+ int copy_len = sizeof(hdr.eth); -+ -+ if (iftype == NL80211_IFTYPE_MESH_POINT) -+ copy_len = sizeof(hdr); - - while (!last) { - unsigned int subframe_len; -- int len; -+ int len, mesh_len = 0; - u8 padding; - -- skb_copy_bits(skb, offset, ð, sizeof(eth)); -- len = ntohs(eth.h_proto); -+ skb_copy_bits(skb, offset, &hdr, copy_len); -+ if (iftype == NL80211_IFTYPE_MESH_POINT) -+ mesh_len = __ieee80211_get_mesh_hdrlen(hdr.flags); -+ if (mesh_control) -+ len = le16_to_cpu(*(__le16 *)&hdr.eth.h_proto) + mesh_len; -+ else -+ len = ntohs(hdr.eth.h_proto); -+ - subframe_len = sizeof(struct ethhdr) + len; - padding = (4 - subframe_len) & 0x3; - -@@ -787,16 +818,16 @@ void ieee80211_amsdu_to_8023s(struct sk_ - if (subframe_len > remaining) - goto purge; - /* mitigate A-MSDU aggregation injection attacks */ -- if (ether_addr_equal(eth.h_dest, rfc1042_header)) -+ if (ether_addr_equal(hdr.eth.h_dest, rfc1042_header)) - goto purge; - - offset += sizeof(struct ethhdr); - last = remaining <= subframe_len + padding; - - /* FIXME: should we really accept multicast DA? */ -- if ((check_da && !is_multicast_ether_addr(eth.h_dest) && -- !ether_addr_equal(check_da, eth.h_dest)) || -- (check_sa && !ether_addr_equal(check_sa, eth.h_source))) { -+ if ((check_da && !is_multicast_ether_addr(hdr.eth.h_dest) && -+ !ether_addr_equal(check_da, hdr.eth.h_dest)) || -+ (check_sa && !ether_addr_equal(check_sa, hdr.eth.h_source))) { - offset += len + padding; - continue; - } -@@ -808,7 +839,7 @@ void ieee80211_amsdu_to_8023s(struct sk_ - reuse_skb = true; - } else { - frame = __ieee80211_amsdu_copy(skb, hlen, offset, len, -- reuse_frag); -+ reuse_frag, 32 + mesh_len); - if (!frame) - goto purge; - -@@ -819,10 +850,11 @@ void ieee80211_amsdu_to_8023s(struct sk_ - frame->dev = skb->dev; - frame->priority = skb->priority; - -- if (likely(ieee80211_get_8023_tunnel_proto(frame->data, ð.h_proto))) -+ if (likely(iftype != NL80211_IFTYPE_MESH_POINT && -+ ieee80211_get_8023_tunnel_proto(frame->data, &hdr.eth.h_proto))) - skb_pull(frame, ETH_ALEN + 2); - -- memcpy(skb_push(frame, sizeof(eth)), ð, sizeof(eth)); -+ memcpy(skb_push(frame, sizeof(hdr.eth)), &hdr.eth, sizeof(hdr.eth)); - __skb_queue_tail(list, frame); - } - diff --git a/package/kernel/mac80211/patches/subsys/316-v6.3-wifi-mac80211-add-a-workaround-for-receiving-non-sta.patch b/package/kernel/mac80211/patches/subsys/316-v6.3-wifi-mac80211-add-a-workaround-for-receiving-non-sta.patch deleted file mode 100644 index 6dc98ae16af..00000000000 --- a/package/kernel/mac80211/patches/subsys/316-v6.3-wifi-mac80211-add-a-workaround-for-receiving-non-sta.patch +++ /dev/null @@ -1,145 +0,0 @@ -From: Felix Fietkau -Date: Fri, 9 Dec 2022 21:15:04 +0100 -Subject: [PATCH] wifi: mac80211: add a workaround for receiving - non-standard mesh A-MSDU - -At least ath10k and ath11k supported hardware (maybe more) does not implement -mesh A-MSDU aggregation in a standard compliant way. -802.11-2020 9.3.2.2.2 declares that the Mesh Control field is part of the -A-MSDU header. As such, its length must not be included in the subframe -length field. -Hardware affected by this bug treats the mesh control field as part of the -MSDU data and sets the length accordingly. -In order to avoid packet loss, keep track of which stations are affected -by this and take it into account when converting A-MSDU to 802.3 + mesh control -packets. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -6194,6 +6194,19 @@ static inline int ieee80211_data_to_8023 - } - - /** -+ * ieee80211_is_valid_amsdu - check if subframe lengths of an A-MSDU are valid -+ * -+ * This is used to detect non-standard A-MSDU frames, e.g. the ones generated -+ * by ath10k and ath11k, where the subframe length includes the length of the -+ * mesh control field. -+ * -+ * @skb: The input A-MSDU frame without any headers. -+ * @mesh_hdr: use standard compliant mesh A-MSDU subframe header -+ * Returns: true if subframe header lengths are valid for the @mesh_hdr mode -+ */ -+bool ieee80211_is_valid_amsdu(struct sk_buff *skb, bool mesh_hdr); -+ -+/** - * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame - * - * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames. ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2899,7 +2899,6 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ - static ieee80211_rx_result res; - struct ethhdr ethhdr; - const u8 *check_da = ethhdr.h_dest, *check_sa = ethhdr.h_source; -- bool mesh = false; - - if (unlikely(ieee80211_has_a4(hdr->frame_control))) { - check_da = NULL; -@@ -2917,7 +2916,6 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ - case NL80211_IFTYPE_MESH_POINT: - check_sa = NULL; - check_da = NULL; -- mesh = true; - break; - default: - break; -@@ -2932,10 +2930,21 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ - data_offset, true)) - return RX_DROP_UNUSABLE; - -+ if (rx->sta && rx->sta->amsdu_mesh_control < 0) { -+ bool valid_std = ieee80211_is_valid_amsdu(skb, true); -+ bool valid_nonstd = ieee80211_is_valid_amsdu(skb, false); -+ -+ if (valid_std && !valid_nonstd) -+ rx->sta->amsdu_mesh_control = 1; -+ else if (valid_nonstd && !valid_std) -+ rx->sta->amsdu_mesh_control = 0; -+ } -+ - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, - rx->sdata->vif.type, - rx->local->hw.extra_tx_headroom, -- check_da, check_sa, mesh); -+ check_da, check_sa, -+ rx->sta->amsdu_mesh_control); - - while (!skb_queue_empty(&frame_list)) { - rx->skb = __skb_dequeue(&frame_list); ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -591,6 +591,9 @@ __sta_info_alloc(struct ieee80211_sub_if - - sta->sta_state = IEEE80211_STA_NONE; - -+ if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) -+ sta->amsdu_mesh_control = -1; -+ - /* Mark TID as unreserved */ - sta->reserved_tid = IEEE80211_TID_UNRESERVED; - ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -702,6 +702,7 @@ struct sta_info { - struct codel_params cparams; - - u8 reserved_tid; -+ s8 amsdu_mesh_control; - - struct cfg80211_chan_def tdls_chandef; - ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -776,6 +776,38 @@ __ieee80211_amsdu_copy(struct sk_buff *s - return frame; - } - -+bool ieee80211_is_valid_amsdu(struct sk_buff *skb, bool mesh_hdr) -+{ -+ int offset = 0, remaining, subframe_len, padding; -+ -+ for (offset = 0; offset < skb->len; offset += subframe_len + padding) { -+ struct { -+ __be16 len; -+ u8 mesh_flags; -+ } hdr; -+ u16 len; -+ -+ if (skb_copy_bits(skb, offset + 2 * ETH_ALEN, &hdr, sizeof(hdr)) < 0) -+ return false; -+ -+ if (mesh_hdr) -+ len = le16_to_cpu(*(__le16 *)&hdr.len) + -+ __ieee80211_get_mesh_hdrlen(hdr.mesh_flags); -+ else -+ len = ntohs(hdr.len); -+ -+ subframe_len = sizeof(struct ethhdr) + len; -+ padding = (4 - subframe_len) & 0x3; -+ remaining = skb->len - offset; -+ -+ if (subframe_len > remaining) -+ return false; -+ } -+ -+ return true; -+} -+EXPORT_SYMBOL(ieee80211_is_valid_amsdu); -+ - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, - const u8 *addr, enum nl80211_iftype iftype, - const unsigned int extra_headroom, diff --git a/package/kernel/mac80211/patches/subsys/318-wifi-mac80211-fix-race-in-mesh-sequence-number-assig.patch b/package/kernel/mac80211/patches/subsys/318-wifi-mac80211-fix-race-in-mesh-sequence-number-assig.patch deleted file mode 100644 index 7d01ffdfff0..00000000000 --- a/package/kernel/mac80211/patches/subsys/318-wifi-mac80211-fix-race-in-mesh-sequence-number-assig.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Felix Fietkau -Date: Wed, 15 Feb 2023 15:21:37 +0100 -Subject: [PATCH] wifi: mac80211: fix race in mesh sequence number - assignment - -Since the sequence number is shared across different tx queues, it needs -to be atomic in order to avoid accidental duplicate assignment - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -696,7 +696,7 @@ struct ieee80211_if_mesh { - struct mesh_stats mshstats; - struct mesh_config mshcfg; - atomic_t estab_plinks; -- u32 mesh_seqnum; -+ atomic_t mesh_seqnum; - bool accepting_plinks; - int num_gates; - struct beacon_data __rcu *beacon; ---- a/net/mac80211/mesh.c -+++ b/net/mac80211/mesh.c -@@ -752,10 +752,8 @@ unsigned int ieee80211_new_mesh_header(s - - meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL; - -- /* FIXME: racy -- TX on multiple queues can be concurrent */ -- put_unaligned(cpu_to_le32(sdata->u.mesh.mesh_seqnum), &meshhdr->seqnum); -- sdata->u.mesh.mesh_seqnum++; -- -+ put_unaligned_le32(atomic_inc_return(&sdata->u.mesh.mesh_seqnum), -+ &meshhdr->seqnum); - if (addr4or5 && !addr6) { - meshhdr->flags |= MESH_FLAGS_AE_A4; - memcpy(meshhdr->eaddr1, addr4or5, ETH_ALEN); diff --git a/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch b/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch deleted file mode 100644 index 968d2885f2a..00000000000 --- a/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch +++ /dev/null @@ -1,850 +0,0 @@ -From: Felix Fietkau -Date: Sun, 26 Feb 2023 13:53:08 +0100 -Subject: [PATCH] wifi: mac80211: mesh fast xmit support - -Previously, fast xmit only worked on interface types where initially a -sta lookup is performed, and a cached header can be attached to the sta, -requiring only some fields to be updated at runtime. - -This technique is not directly applicable for a mesh device type due -to the dynamic nature of the topology and protocol. There are more -addresses that need to be filled, and there is an extra header with a -dynamic length based on the addressing mode. - -Change the code to cache entries contain a copy of the mesh subframe header + -bridge tunnel header, as well as an embedded struct ieee80211_fast_tx, which -contains the information for building the 802.11 header. - -Add a mesh specific early fast xmit call, which looks up a cached entry and -adds only the mesh subframe header, before passing it over to the generic -fast xmit code. - -To ensure the changes in network are reflected in these cached headers, -flush affected cached entries on path changes, as well as other conditions -that currently trigger a fast xmit check in other modes (key changes etc.) - -This code is loosely based on a previous implementation by: -Sriram R - -Signed-off-by: Ryder Lee -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -37,6 +37,7 @@ - extern const struct cfg80211_ops mac80211_config_ops; - - struct ieee80211_local; -+struct ieee80211_mesh_fast_tx; - - /* Maximum number of broadcast/multicast frames to buffer when some of the - * associated stations are using power saving. */ -@@ -656,6 +657,19 @@ struct mesh_table { - atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */ - }; - -+/** -+ * struct mesh_tx_cache - mesh fast xmit header cache -+ * -+ * @rht: hash table containing struct ieee80211_mesh_fast_tx, using skb DA as key -+ * @walk_head: linked list containing all ieee80211_mesh_fast_tx objects -+ * @walk_lock: lock protecting walk_head and rht -+ */ -+struct mesh_tx_cache { -+ struct rhashtable rht; -+ struct hlist_head walk_head; -+ spinlock_t walk_lock; -+}; -+ - struct ieee80211_if_mesh { - struct timer_list housekeeping_timer; - struct timer_list mesh_path_timer; -@@ -734,6 +748,7 @@ struct ieee80211_if_mesh { - struct mesh_table mpp_paths; /* Store paths for MPP&MAP */ - int mesh_paths_generation; - int mpp_paths_generation; -+ struct mesh_tx_cache tx_cache; - }; - - #ifdef CPTCFG_MAC80211_MESH -@@ -2002,6 +2017,11 @@ int ieee80211_tx_control_port(struct wip - int link_id, u64 *cookie); - int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, - const u8 *buf, size_t len); -+void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, -+ struct ieee80211_fast_tx *fast_tx, -+ struct sk_buff *skb, bool ampdu, -+ const u8 *da, const u8 *sa); - - /* HT */ - void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, ---- a/net/mac80211/mesh.c -+++ b/net/mac80211/mesh.c -@@ -10,6 +10,7 @@ - #include - #include "ieee80211_i.h" - #include "mesh.h" -+#include "wme.h" - #include "driver-ops.h" - - static int mesh_allocated; -@@ -698,6 +699,95 @@ ieee80211_mesh_update_bss_params(struct - __le32_to_cpu(he_oper->he_oper_params); - } - -+bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, u32 ctrl_flags) -+{ -+ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; -+ struct ieee80211_mesh_fast_tx *entry; -+ struct ieee80211s_hdr *meshhdr; -+ u8 sa[ETH_ALEN] __aligned(2); -+ struct tid_ampdu_tx *tid_tx; -+ struct sta_info *sta; -+ bool copy_sa = false; -+ u16 ethertype; -+ u8 tid; -+ -+ if (ctrl_flags & IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP) -+ return false; -+ -+ if (ifmsh->mshcfg.dot11MeshNolearn) -+ return false; -+ -+ /* Add support for these cases later */ -+ if (ifmsh->ps_peers_light_sleep || ifmsh->ps_peers_deep_sleep) -+ return false; -+ -+ if (is_multicast_ether_addr(skb->data)) -+ return false; -+ -+ ethertype = (skb->data[12] << 8) | skb->data[13]; -+ if (ethertype < ETH_P_802_3_MIN) -+ return false; -+ -+ if (skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) -+ return false; -+ -+ if (skb->ip_summed == CHECKSUM_PARTIAL) { -+ skb_set_transport_header(skb, skb_checksum_start_offset(skb)); -+ if (skb_checksum_help(skb)) -+ return false; -+ } -+ -+ entry = mesh_fast_tx_get(sdata, skb->data); -+ if (!entry) -+ return false; -+ -+ if (skb_headroom(skb) < entry->hdrlen + entry->fast_tx.hdr_len) -+ return false; -+ -+ sta = rcu_dereference(entry->mpath->next_hop); -+ if (!sta) -+ return false; -+ -+ tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -+ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); -+ if (tid_tx) { -+ if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) -+ return false; -+ if (tid_tx->timeout) -+ tid_tx->last_tx = jiffies; -+ } -+ -+ skb = skb_share_check(skb, GFP_ATOMIC); -+ if (!skb) -+ return true; -+ -+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); -+ -+ meshhdr = (struct ieee80211s_hdr *)entry->hdr; -+ if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) { -+ /* preserve SA from eth header for 6-addr frames */ -+ ether_addr_copy(sa, skb->data + ETH_ALEN); -+ copy_sa = true; -+ } -+ -+ memcpy(skb_push(skb, entry->hdrlen - 2 * ETH_ALEN), entry->hdr, -+ entry->hdrlen); -+ -+ meshhdr = (struct ieee80211s_hdr *)skb->data; -+ put_unaligned_le32(atomic_inc_return(&sdata->u.mesh.mesh_seqnum), -+ &meshhdr->seqnum); -+ meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL; -+ if (copy_sa) -+ ether_addr_copy(meshhdr->eaddr2, sa); -+ -+ skb_push(skb, 2 * ETH_ALEN); -+ __ieee80211_xmit_fast(sdata, sta, &entry->fast_tx, skb, tid_tx, -+ entry->mpath->dst, sdata->vif.addr); -+ -+ return true; -+} -+ - /** - * ieee80211_fill_mesh_addresses - fill addresses of a locally originated mesh frame - * @hdr: 802.11 frame header -@@ -780,6 +870,8 @@ static void ieee80211_mesh_housekeeping( - changed = mesh_accept_plinks_update(sdata); - ieee80211_mbss_info_change_notify(sdata, changed); - -+ mesh_fast_tx_gc(sdata); -+ - mod_timer(&ifmsh->housekeeping_timer, - round_jiffies(jiffies + - IEEE80211_MESH_HOUSEKEEPING_INTERVAL)); ---- a/net/mac80211/mesh.h -+++ b/net/mac80211/mesh.h -@@ -122,11 +122,41 @@ struct mesh_path { - u8 rann_snd_addr[ETH_ALEN]; - u32 rann_metric; - unsigned long last_preq_to_root; -+ unsigned long fast_tx_check; - bool is_root; - bool is_gate; - u32 path_change_count; - }; - -+#define MESH_FAST_TX_CACHE_MAX_SIZE 512 -+#define MESH_FAST_TX_CACHE_THRESHOLD_SIZE 384 -+#define MESH_FAST_TX_CACHE_TIMEOUT 8000 /* msecs */ -+ -+/** -+ * struct ieee80211_mesh_fast_tx - cached mesh fast tx entry -+ * @rhash: rhashtable pointer -+ * @addr_key: The Ethernet DA which is the key for this entry -+ * @fast_tx: base fast_tx data -+ * @hdr: cached mesh and rfc1042 headers -+ * @hdrlen: length of mesh + rfc1042 -+ * @walk_list: list containing all the fast tx entries -+ * @mpath: mesh path corresponding to the Mesh DA -+ * @mppath: MPP entry corresponding to this DA -+ * @timestamp: Last used time of this entry -+ */ -+struct ieee80211_mesh_fast_tx { -+ struct rhash_head rhash; -+ u8 addr_key[ETH_ALEN] __aligned(2); -+ -+ struct ieee80211_fast_tx fast_tx; -+ u8 hdr[sizeof(struct ieee80211s_hdr) + sizeof(rfc1042_header)]; -+ u16 hdrlen; -+ -+ struct mesh_path *mpath, *mppath; -+ struct hlist_node walk_list; -+ unsigned long timestamp; -+}; -+ - /* Recent multicast cache */ - /* RMC_BUCKETS must be a power of 2, maximum 256 */ - #define RMC_BUCKETS 256 -@@ -298,6 +328,20 @@ void mesh_path_discard_frame(struct ieee - void mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata); - - bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt); -+struct ieee80211_mesh_fast_tx * -+mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr); -+bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, u32 ctrl_flags); -+void mesh_fast_tx_cache(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, struct mesh_path *mpath); -+void mesh_fast_tx_gc(struct ieee80211_sub_if_data *sdata); -+void mesh_fast_tx_flush_addr(struct ieee80211_sub_if_data *sdata, -+ const u8 *addr); -+void mesh_fast_tx_flush_mpath(struct mesh_path *mpath); -+void mesh_fast_tx_flush_sta(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta); -+void mesh_path_refresh(struct ieee80211_sub_if_data *sdata, -+ struct mesh_path *mpath, const u8 *addr); - - #ifdef CPTCFG_MAC80211_MESH - static inline ---- a/net/mac80211/mesh_hwmp.c -+++ b/net/mac80211/mesh_hwmp.c -@@ -394,6 +394,7 @@ static u32 hwmp_route_info_get(struct ie - u32 orig_sn, orig_metric; - unsigned long orig_lifetime, exp_time; - u32 last_hop_metric, new_metric; -+ bool flush_mpath = false; - bool process = true; - u8 hopcount; - -@@ -491,8 +492,10 @@ static u32 hwmp_route_info_get(struct ie - } - - if (fresh_info) { -- if (rcu_access_pointer(mpath->next_hop) != sta) -+ if (rcu_access_pointer(mpath->next_hop) != sta) { - mpath->path_change_count++; -+ flush_mpath = true; -+ } - mesh_path_assign_nexthop(mpath, sta); - mpath->flags |= MESH_PATH_SN_VALID; - mpath->metric = new_metric; -@@ -502,6 +505,8 @@ static u32 hwmp_route_info_get(struct ie - mpath->hop_count = hopcount; - mesh_path_activate(mpath); - spin_unlock_bh(&mpath->state_lock); -+ if (flush_mpath) -+ mesh_fast_tx_flush_mpath(mpath); - ewma_mesh_fail_avg_init(&sta->mesh->fail_avg); - /* init it at a low value - 0 start is tricky */ - ewma_mesh_fail_avg_add(&sta->mesh->fail_avg, 1); -@@ -539,8 +544,10 @@ static u32 hwmp_route_info_get(struct ie - } - - if (fresh_info) { -- if (rcu_access_pointer(mpath->next_hop) != sta) -+ if (rcu_access_pointer(mpath->next_hop) != sta) { - mpath->path_change_count++; -+ flush_mpath = true; -+ } - mesh_path_assign_nexthop(mpath, sta); - mpath->metric = last_hop_metric; - mpath->exp_time = time_after(mpath->exp_time, exp_time) -@@ -548,6 +555,8 @@ static u32 hwmp_route_info_get(struct ie - mpath->hop_count = 1; - mesh_path_activate(mpath); - spin_unlock_bh(&mpath->state_lock); -+ if (flush_mpath) -+ mesh_fast_tx_flush_mpath(mpath); - ewma_mesh_fail_avg_init(&sta->mesh->fail_avg); - /* init it at a low value - 0 start is tricky */ - ewma_mesh_fail_avg_add(&sta->mesh->fail_avg, 1); -@@ -1215,6 +1224,20 @@ static int mesh_nexthop_lookup_nolearn(s - return 0; - } - -+void mesh_path_refresh(struct ieee80211_sub_if_data *sdata, -+ struct mesh_path *mpath, const u8 *addr) -+{ -+ if (mpath->flags & (MESH_PATH_REQ_QUEUED | MESH_PATH_FIXED | -+ MESH_PATH_RESOLVING)) -+ return; -+ -+ if (time_after(jiffies, -+ mpath->exp_time - -+ msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) && -+ (!addr || ether_addr_equal(sdata->vif.addr, addr))) -+ mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); -+} -+ - /** - * mesh_nexthop_lookup - put the appropriate next hop on a mesh frame. Calling - * this function is considered "using" the associated mpath, so preempt a path -@@ -1242,19 +1265,15 @@ int mesh_nexthop_lookup(struct ieee80211 - if (!mpath || !(mpath->flags & MESH_PATH_ACTIVE)) - return -ENOENT; - -- if (time_after(jiffies, -- mpath->exp_time - -- msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) && -- ether_addr_equal(sdata->vif.addr, hdr->addr4) && -- !(mpath->flags & MESH_PATH_RESOLVING) && -- !(mpath->flags & MESH_PATH_FIXED)) -- mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); -+ mesh_path_refresh(sdata, mpath, hdr->addr4); - - next_hop = rcu_dereference(mpath->next_hop); - if (next_hop) { - memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN); - memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN); - ieee80211_mps_set_frame_flags(sdata, next_hop, hdr); -+ if (ieee80211_hw_check(&sdata->local->hw, SUPPORT_FAST_XMIT)) -+ mesh_fast_tx_cache(sdata, skb, mpath); - return 0; - } - ---- a/net/mac80211/mesh_pathtbl.c -+++ b/net/mac80211/mesh_pathtbl.c -@@ -14,6 +14,7 @@ - #include "wme.h" - #include "ieee80211_i.h" - #include "mesh.h" -+#include - - static void mesh_path_free_rcu(struct mesh_table *tbl, struct mesh_path *mpath); - -@@ -32,6 +33,41 @@ static const struct rhashtable_params me - .hashfn = mesh_table_hash, - }; - -+static const struct rhashtable_params fast_tx_rht_params = { -+ .nelem_hint = 10, -+ .automatic_shrinking = true, -+ .key_len = ETH_ALEN, -+ .key_offset = offsetof(struct ieee80211_mesh_fast_tx, addr_key), -+ .head_offset = offsetof(struct ieee80211_mesh_fast_tx, rhash), -+ .hashfn = mesh_table_hash, -+}; -+ -+static void __mesh_fast_tx_entry_free(void *ptr, void *tblptr) -+{ -+ struct ieee80211_mesh_fast_tx *entry = ptr; -+ -+ kfree_rcu(entry, fast_tx.rcu_head); -+} -+ -+static void mesh_fast_tx_deinit(struct ieee80211_sub_if_data *sdata) -+{ -+ struct mesh_tx_cache *cache; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ rhashtable_free_and_destroy(&cache->rht, -+ __mesh_fast_tx_entry_free, NULL); -+} -+ -+static void mesh_fast_tx_init(struct ieee80211_sub_if_data *sdata) -+{ -+ struct mesh_tx_cache *cache; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ rhashtable_init(&cache->rht, &fast_tx_rht_params); -+ INIT_HLIST_HEAD(&cache->walk_head); -+ spin_lock_init(&cache->walk_lock); -+} -+ - static inline bool mpath_expired(struct mesh_path *mpath) - { - return (mpath->flags & MESH_PATH_ACTIVE) && -@@ -381,6 +417,243 @@ struct mesh_path *mesh_path_new(struct i - return new_mpath; - } - -+static void mesh_fast_tx_entry_free(struct mesh_tx_cache *cache, -+ struct ieee80211_mesh_fast_tx *entry) -+{ -+ hlist_del_rcu(&entry->walk_list); -+ rhashtable_remove_fast(&cache->rht, &entry->rhash, fast_tx_rht_params); -+ kfree_rcu(entry, fast_tx.rcu_head); -+} -+ -+struct ieee80211_mesh_fast_tx * -+mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr) -+{ -+ struct ieee80211_mesh_fast_tx *entry; -+ struct mesh_tx_cache *cache; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params); -+ if (!entry) -+ return NULL; -+ -+ if (!(entry->mpath->flags & MESH_PATH_ACTIVE) || -+ mpath_expired(entry->mpath)) { -+ spin_lock_bh(&cache->walk_lock); -+ entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params); -+ if (entry) -+ mesh_fast_tx_entry_free(cache, entry); -+ spin_unlock_bh(&cache->walk_lock); -+ return NULL; -+ } -+ -+ mesh_path_refresh(sdata, entry->mpath, NULL); -+ if (entry->mppath) -+ entry->mppath->exp_time = jiffies; -+ entry->timestamp = jiffies; -+ -+ return entry; -+} -+ -+void mesh_fast_tx_cache(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, struct mesh_path *mpath) -+{ -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -+ struct ieee80211_mesh_fast_tx *entry, *prev; -+ struct ieee80211_mesh_fast_tx build = {}; -+ struct ieee80211s_hdr *meshhdr; -+ struct mesh_tx_cache *cache; -+ struct ieee80211_key *key; -+ struct mesh_path *mppath; -+ struct sta_info *sta; -+ u8 *qc; -+ -+ if (sdata->noack_map || -+ !ieee80211_is_data_qos(hdr->frame_control)) -+ return; -+ -+ build.fast_tx.hdr_len = ieee80211_hdrlen(hdr->frame_control); -+ meshhdr = (struct ieee80211s_hdr *)(skb->data + build.fast_tx.hdr_len); -+ build.hdrlen = ieee80211_get_mesh_hdrlen(meshhdr); -+ -+ cache = &sdata->u.mesh.tx_cache; -+ if (atomic_read(&cache->rht.nelems) >= MESH_FAST_TX_CACHE_MAX_SIZE) -+ return; -+ -+ sta = rcu_dereference(mpath->next_hop); -+ if (!sta) -+ return; -+ -+ if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) { -+ /* This is required to keep the mppath alive */ -+ mppath = mpp_path_lookup(sdata, meshhdr->eaddr1); -+ if (!mppath) -+ return; -+ build.mppath = mppath; -+ } else if (ieee80211_has_a4(hdr->frame_control)) { -+ mppath = mpath; -+ } else { -+ return; -+ } -+ -+ /* rate limit, in case fast xmit can't be enabled */ -+ if (mppath->fast_tx_check == jiffies) -+ return; -+ -+ mppath->fast_tx_check = jiffies; -+ -+ /* -+ * Same use of the sta lock as in ieee80211_check_fast_xmit, in order -+ * to protect against concurrent sta key updates. -+ */ -+ spin_lock_bh(&sta->lock); -+ key = rcu_access_pointer(sta->ptk[sta->ptk_idx]); -+ if (!key) -+ key = rcu_access_pointer(sdata->default_unicast_key); -+ build.fast_tx.key = key; -+ -+ if (key) { -+ bool gen_iv, iv_spc; -+ -+ gen_iv = key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV; -+ iv_spc = key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE; -+ -+ if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) || -+ (key->flags & KEY_FLAG_TAINTED)) -+ goto unlock_sta; -+ -+ switch (key->conf.cipher) { -+ case WLAN_CIPHER_SUITE_CCMP: -+ case WLAN_CIPHER_SUITE_CCMP_256: -+ if (gen_iv) -+ build.fast_tx.pn_offs = build.fast_tx.hdr_len; -+ if (gen_iv || iv_spc) -+ build.fast_tx.hdr_len += IEEE80211_CCMP_HDR_LEN; -+ break; -+ case WLAN_CIPHER_SUITE_GCMP: -+ case WLAN_CIPHER_SUITE_GCMP_256: -+ if (gen_iv) -+ build.fast_tx.pn_offs = build.fast_tx.hdr_len; -+ if (gen_iv || iv_spc) -+ build.fast_tx.hdr_len += IEEE80211_GCMP_HDR_LEN; -+ break; -+ default: -+ goto unlock_sta; -+ } -+ } -+ -+ memcpy(build.addr_key, mppath->dst, ETH_ALEN); -+ build.timestamp = jiffies; -+ build.fast_tx.band = info->band; -+ build.fast_tx.da_offs = offsetof(struct ieee80211_hdr, addr3); -+ build.fast_tx.sa_offs = offsetof(struct ieee80211_hdr, addr4); -+ build.mpath = mpath; -+ memcpy(build.hdr, meshhdr, build.hdrlen); -+ memcpy(build.hdr + build.hdrlen, rfc1042_header, sizeof(rfc1042_header)); -+ build.hdrlen += sizeof(rfc1042_header); -+ memcpy(build.fast_tx.hdr, hdr, build.fast_tx.hdr_len); -+ -+ hdr = (struct ieee80211_hdr *)build.fast_tx.hdr; -+ if (build.fast_tx.key) -+ hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); -+ -+ qc = ieee80211_get_qos_ctl(hdr); -+ qc[1] |= IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT >> 8; -+ -+ entry = kmemdup(&build, sizeof(build), GFP_ATOMIC); -+ if (!entry) -+ goto unlock_sta; -+ -+ spin_lock(&cache->walk_lock); -+ prev = rhashtable_lookup_get_insert_fast(&cache->rht, -+ &entry->rhash, -+ fast_tx_rht_params); -+ if (unlikely(IS_ERR(prev))) { -+ kfree(entry); -+ goto unlock_cache; -+ } -+ -+ /* -+ * replace any previous entry in the hash table, in case we're -+ * replacing it with a different type (e.g. mpath -> mpp) -+ */ -+ if (unlikely(prev)) { -+ rhashtable_replace_fast(&cache->rht, &prev->rhash, -+ &entry->rhash, fast_tx_rht_params); -+ hlist_del_rcu(&prev->walk_list); -+ kfree_rcu(prev, fast_tx.rcu_head); -+ } -+ -+ hlist_add_head(&entry->walk_list, &cache->walk_head); -+ -+unlock_cache: -+ spin_unlock(&cache->walk_lock); -+unlock_sta: -+ spin_unlock_bh(&sta->lock); -+} -+ -+void mesh_fast_tx_gc(struct ieee80211_sub_if_data *sdata) -+{ -+ unsigned long timeout = msecs_to_jiffies(MESH_FAST_TX_CACHE_TIMEOUT); -+ struct mesh_tx_cache *cache; -+ struct ieee80211_mesh_fast_tx *entry; -+ struct hlist_node *n; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ if (atomic_read(&cache->rht.nelems) < MESH_FAST_TX_CACHE_THRESHOLD_SIZE) -+ return; -+ -+ spin_lock_bh(&cache->walk_lock); -+ hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) -+ if (!time_is_after_jiffies(entry->timestamp + timeout)) -+ mesh_fast_tx_entry_free(cache, entry); -+ spin_unlock_bh(&cache->walk_lock); -+} -+ -+void mesh_fast_tx_flush_mpath(struct mesh_path *mpath) -+{ -+ struct ieee80211_sub_if_data *sdata = mpath->sdata; -+ struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; -+ struct ieee80211_mesh_fast_tx *entry; -+ struct hlist_node *n; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ spin_lock_bh(&cache->walk_lock); -+ hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) -+ if (entry->mpath == mpath) -+ mesh_fast_tx_entry_free(cache, entry); -+ spin_unlock_bh(&cache->walk_lock); -+} -+ -+void mesh_fast_tx_flush_sta(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta) -+{ -+ struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; -+ struct ieee80211_mesh_fast_tx *entry; -+ struct hlist_node *n; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ spin_lock_bh(&cache->walk_lock); -+ hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) -+ if (rcu_access_pointer(entry->mpath->next_hop) == sta) -+ mesh_fast_tx_entry_free(cache, entry); -+ spin_unlock_bh(&cache->walk_lock); -+} -+ -+void mesh_fast_tx_flush_addr(struct ieee80211_sub_if_data *sdata, -+ const u8 *addr) -+{ -+ struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; -+ struct ieee80211_mesh_fast_tx *entry; -+ -+ cache = &sdata->u.mesh.tx_cache; -+ spin_lock_bh(&cache->walk_lock); -+ entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params); -+ if (entry) -+ mesh_fast_tx_entry_free(cache, entry); -+ spin_unlock_bh(&cache->walk_lock); -+} -+ - /** - * mesh_path_add - allocate and add a new path to the mesh path table - * @dst: destination address of the path (ETH_ALEN length) -@@ -464,6 +737,8 @@ int mpp_path_add(struct ieee80211_sub_if - - if (ret) - kfree(new_mpath); -+ else -+ mesh_fast_tx_flush_addr(sdata, dst); - - sdata->u.mesh.mpp_paths_generation++; - return ret; -@@ -523,6 +798,10 @@ static void __mesh_path_del(struct mesh_ - { - hlist_del_rcu(&mpath->walk_list); - rhashtable_remove_fast(&tbl->rhead, &mpath->rhash, mesh_rht_params); -+ if (tbl == &mpath->sdata->u.mesh.mpp_paths) -+ mesh_fast_tx_flush_addr(mpath->sdata, mpath->dst); -+ else -+ mesh_fast_tx_flush_mpath(mpath); - mesh_path_free_rcu(tbl, mpath); - } - -@@ -747,6 +1026,7 @@ void mesh_path_fix_nexthop(struct mesh_p - mpath->exp_time = 0; - mpath->flags = MESH_PATH_FIXED | MESH_PATH_SN_VALID; - mesh_path_activate(mpath); -+ mesh_fast_tx_flush_mpath(mpath); - spin_unlock_bh(&mpath->state_lock); - ewma_mesh_fail_avg_init(&next_hop->mesh->fail_avg); - /* init it at a low value - 0 start is tricky */ -@@ -758,6 +1038,7 @@ void mesh_pathtbl_init(struct ieee80211_ - { - mesh_table_init(&sdata->u.mesh.mesh_paths); - mesh_table_init(&sdata->u.mesh.mpp_paths); -+ mesh_fast_tx_init(sdata); - } - - static -@@ -785,6 +1066,7 @@ void mesh_path_expire(struct ieee80211_s - - void mesh_pathtbl_unregister(struct ieee80211_sub_if_data *sdata) - { -+ mesh_fast_tx_deinit(sdata); - mesh_table_free(&sdata->u.mesh.mesh_paths); - mesh_table_free(&sdata->u.mesh.mpp_paths); - } ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2791,6 +2791,7 @@ ieee80211_rx_mesh_data(struct ieee80211_ - if (mesh_hdr->flags & MESH_FLAGS_AE) { - struct mesh_path *mppath; - char *proxied_addr; -+ bool update = false; - - if (multicast) - proxied_addr = mesh_hdr->eaddr1; -@@ -2806,11 +2807,18 @@ ieee80211_rx_mesh_data(struct ieee80211_ - mpp_path_add(sdata, proxied_addr, eth->h_source); - } else { - spin_lock_bh(&mppath->state_lock); -- if (!ether_addr_equal(mppath->mpp, eth->h_source)) -+ if (!ether_addr_equal(mppath->mpp, eth->h_source)) { - memcpy(mppath->mpp, eth->h_source, ETH_ALEN); -+ update = true; -+ } - mppath->exp_time = jiffies; - spin_unlock_bh(&mppath->state_lock); - } -+ -+ /* flush fast xmit cache if the address path changed */ -+ if (update) -+ mesh_fast_tx_flush_addr(sdata, proxied_addr); -+ - rcu_read_unlock(); - } - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3022,6 +3022,9 @@ void ieee80211_check_fast_xmit(struct st - if (!ieee80211_hw_check(&local->hw, SUPPORT_FAST_XMIT)) - return; - -+ if (ieee80211_vif_is_mesh(&sdata->vif)) -+ mesh_fast_tx_flush_sta(sdata, sta); -+ - /* Locking here protects both the pointer itself, and against concurrent - * invocations winning data access races to, e.g., the key pointer that - * is used. -@@ -3403,6 +3406,9 @@ static bool ieee80211_amsdu_aggregate(st - if (sdata->vif.offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED) - return false; - -+ if (ieee80211_vif_is_mesh(&sdata->vif)) -+ return false; -+ - if (skb_is_gso(skb)) - return false; - -@@ -3635,10 +3641,11 @@ free: - return NULL; - } - --static void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -- struct sta_info *sta, -- struct ieee80211_fast_tx *fast_tx, -- struct sk_buff *skb, u8 tid, bool ampdu) -+void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, -+ struct ieee80211_fast_tx *fast_tx, -+ struct sk_buff *skb, bool ampdu, -+ const u8 *da, const u8 *sa) - { - struct ieee80211_local *local = sdata->local; - struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; -@@ -3647,7 +3654,6 @@ static void __ieee80211_xmit_fast(struct - ieee80211_tx_result r; - int hw_headroom = sdata->local->hw.extra_tx_headroom; - int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); -- struct ethhdr eth; - - skb = skb_share_check(skb, GFP_ATOMIC); - if (unlikely(!skb)) -@@ -3667,11 +3673,10 @@ static void __ieee80211_xmit_fast(struct - ENCRYPT_NO))) - goto free; - -- memcpy(ð, skb->data, ETH_HLEN - 2); - hdr = skb_push(skb, extra_head); - memcpy(skb->data, fast_tx->hdr, fast_tx->hdr_len); -- memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN); -- memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN); -+ memcpy(skb->data + fast_tx->da_offs, da, ETH_ALEN); -+ memcpy(skb->data + fast_tx->sa_offs, sa, ETH_ALEN); - - info = IEEE80211_SKB_CB(skb); - memset(info, 0, sizeof(*info)); -@@ -3690,7 +3695,8 @@ static void __ieee80211_xmit_fast(struct - #endif - - if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { -- tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -+ - *ieee80211_get_qos_ctl(hdr) = tid; - } - -@@ -3733,6 +3739,7 @@ static bool ieee80211_xmit_fast(struct i - struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; - struct tid_ampdu_tx *tid_tx = NULL; - struct sk_buff *next; -+ struct ethhdr eth; - u8 tid = IEEE80211_NUM_TIDS; - - /* control port protocol needs a lot of special handling */ -@@ -3758,6 +3765,8 @@ static bool ieee80211_xmit_fast(struct i - } - } - -+ memcpy(ð, skb->data, ETH_HLEN - 2); -+ - /* after this point (skb is modified) we cannot return false */ - skb = ieee80211_tx_skb_fixup(skb, ieee80211_sdata_netdev_features(sdata)); - if (!skb) -@@ -3765,7 +3774,8 @@ static bool ieee80211_xmit_fast(struct i - - skb_list_walk_safe(skb, skb, next) { - skb_mark_not_on_list(skb); -- __ieee80211_xmit_fast(sdata, sta, fast_tx, skb, tid, tid_tx); -+ __ieee80211_xmit_fast(sdata, sta, fast_tx, skb, tid_tx, -+ eth.h_dest, eth.h_source); - } - - return true; -@@ -4252,8 +4262,15 @@ void __ieee80211_subif_start_xmit(struct - return; - } - -+ sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift); -+ - rcu_read_lock(); - -+ if (ieee80211_vif_is_mesh(&sdata->vif) && -+ ieee80211_hw_check(&local->hw, SUPPORT_FAST_XMIT) && -+ ieee80211_mesh_xmit_fast(sdata, skb, ctrl_flags)) -+ goto out; -+ - if (ieee80211_lookup_ra_sta(sdata, skb, &sta)) - goto out_free; - -@@ -4263,8 +4280,6 @@ void __ieee80211_subif_start_xmit(struct - skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); - ieee80211_aggr_check(sdata, sta, skb); - -- sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift); -- - if (sta) { - struct ieee80211_fast_tx *fast_tx; - diff --git a/package/kernel/mac80211/patches/subsys/320-wifi-mac80211-use-mesh-header-cache-to-speed-up-mesh.patch b/package/kernel/mac80211/patches/subsys/320-wifi-mac80211-use-mesh-header-cache-to-speed-up-mesh.patch deleted file mode 100644 index 28b1ff11068..00000000000 --- a/package/kernel/mac80211/patches/subsys/320-wifi-mac80211-use-mesh-header-cache-to-speed-up-mesh.patch +++ /dev/null @@ -1,132 +0,0 @@ -From: Felix Fietkau -Date: Thu, 16 Feb 2023 11:07:30 +0100 -Subject: [PATCH] wifi: mac80211: use mesh header cache to speed up mesh - forwarding - -Significantly reduces mesh forwarding path CPU usage and enables the -direct use of iTXQ. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2720,6 +2720,65 @@ ieee80211_deliver_skb(struct ieee80211_r - } - } - -+#ifdef CPTCFG_MAC80211_MESH -+static bool -+ieee80211_rx_mesh_fast_forward(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, int hdrlen) -+{ -+ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; -+ struct ieee80211_mesh_fast_tx *entry = NULL; -+ struct ieee80211s_hdr *mesh_hdr; -+ struct tid_ampdu_tx *tid_tx; -+ struct sta_info *sta; -+ struct ethhdr eth; -+ u8 tid; -+ -+ mesh_hdr = (struct ieee80211s_hdr *)(skb->data + sizeof(eth)); -+ if ((mesh_hdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) -+ entry = mesh_fast_tx_get(sdata, mesh_hdr->eaddr1); -+ else if (!(mesh_hdr->flags & MESH_FLAGS_AE)) -+ entry = mesh_fast_tx_get(sdata, skb->data); -+ if (!entry) -+ return false; -+ -+ sta = rcu_dereference(entry->mpath->next_hop); -+ if (!sta) -+ return false; -+ -+ if (skb_linearize(skb)) -+ return false; -+ -+ tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -+ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); -+ if (tid_tx) { -+ if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) -+ return false; -+ -+ if (tid_tx->timeout) -+ tid_tx->last_tx = jiffies; -+ } -+ -+ ieee80211_aggr_check(sdata, sta, skb); -+ -+ if (ieee80211_get_8023_tunnel_proto(skb->data + hdrlen, -+ &skb->protocol)) -+ hdrlen += ETH_ALEN; -+ else -+ skb->protocol = htons(skb->len - hdrlen); -+ skb_set_network_header(skb, hdrlen + 2); -+ -+ skb->dev = sdata->dev; -+ memcpy(ð, skb->data, ETH_HLEN - 2); -+ skb_pull(skb, 2); -+ __ieee80211_xmit_fast(sdata, sta, &entry->fast_tx, skb, tid_tx, -+ eth.h_dest, eth.h_source); -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast); -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); -+ -+ return true; -+} -+#endif -+ - static ieee80211_rx_result - ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta, - struct sk_buff *skb) -@@ -2824,6 +2883,10 @@ ieee80211_rx_mesh_data(struct ieee80211_ - - skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]); - -+ if (!multicast && -+ ieee80211_rx_mesh_fast_forward(sdata, skb, mesh_hdrlen)) -+ return RX_QUEUED; -+ - ieee80211_fill_mesh_addresses(&hdr, &hdr.frame_control, - eth->h_dest, eth->h_source); - hdrlen = ieee80211_hdrlen(hdr.frame_control); -@@ -2862,6 +2925,7 @@ ieee80211_rx_mesh_data(struct ieee80211_ - info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING; - info->control.vif = &sdata->vif; - info->control.jiffies = jiffies; -+ fwd_skb->dev = sdata->dev; - if (multicast) { - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast); - memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); -@@ -2883,7 +2947,6 @@ ieee80211_rx_mesh_data(struct ieee80211_ - } - - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); -- fwd_skb->dev = sdata->dev; - ieee80211_add_pending_skb(local, fwd_skb); - - rx_accept: ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -2022,6 +2022,8 @@ void __ieee80211_xmit_fast(struct ieee80 - struct ieee80211_fast_tx *fast_tx, - struct sk_buff *skb, bool ampdu, - const u8 *da, const u8 *sa); -+void ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, struct sk_buff *skb); - - /* HT */ - void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1191,10 +1191,8 @@ static bool ieee80211_tx_prep_agg(struct - return queued; - } - --static void --ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata, -- struct sta_info *sta, -- struct sk_buff *skb) -+void ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, struct sk_buff *skb) - { - struct rate_control_ref *ref = sdata->local->rate_ctrl; - u16 tid; diff --git a/package/kernel/mac80211/patches/subsys/321-mac80211-fix-mesh-forwarding.patch b/package/kernel/mac80211/patches/subsys/321-mac80211-fix-mesh-forwarding.patch deleted file mode 100644 index e2b268ae4c0..00000000000 --- a/package/kernel/mac80211/patches/subsys/321-mac80211-fix-mesh-forwarding.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Felix Fietkau -Date: Mon, 20 Feb 2023 12:50:50 +0100 -Subject: [PATCH] mac80211: fix mesh forwarding - -Linearize packets (needed for forwarding A-MSDU subframes). -Fix network header offset to fix flow dissector (and fair queueing). - -Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2904,6 +2904,9 @@ ieee80211_rx_mesh_data(struct ieee80211_ - - if (skb_cow_head(fwd_skb, hdrlen - sizeof(struct ethhdr))) - return RX_DROP_UNUSABLE; -+ -+ if (skb_linearize(fwd_skb)) -+ return RX_DROP_UNUSABLE; - } - - fwd_hdr = skb_push(fwd_skb, hdrlen - sizeof(struct ethhdr)); -@@ -2918,7 +2921,7 @@ ieee80211_rx_mesh_data(struct ieee80211_ - hdrlen += ETH_ALEN; - else - fwd_skb->protocol = htons(fwd_skb->len - hdrlen); -- skb_set_network_header(fwd_skb, hdrlen); -+ skb_set_network_header(fwd_skb, hdrlen + 2); - - info = IEEE80211_SKB_CB(fwd_skb); - memset(info, 0, sizeof(*info)); diff --git a/package/kernel/mac80211/patches/subsys/322-wifi-mac80211-fix-mesh-path-discovery-based-on-unica.patch b/package/kernel/mac80211/patches/subsys/322-wifi-mac80211-fix-mesh-path-discovery-based-on-unica.patch deleted file mode 100644 index 292a89ef921..00000000000 --- a/package/kernel/mac80211/patches/subsys/322-wifi-mac80211-fix-mesh-path-discovery-based-on-unica.patch +++ /dev/null @@ -1,52 +0,0 @@ -From: Felix Fietkau -Date: Sun, 26 Feb 2023 20:30:20 +0100 -Subject: [PATCH] wifi: mac80211: fix mesh path discovery based on unicast - packets - -If a packet has reached its intended destination, it was bumped to the code -that accepts it, without first checking if a mesh_path needs to be created -based on the discovered source. -Fix this by moving the destination address check further down - -Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2824,17 +2824,6 @@ ieee80211_rx_mesh_data(struct ieee80211_ - mesh_rmc_check(sdata, eth->h_source, mesh_hdr)) - return RX_DROP_MONITOR; - -- /* Frame has reached destination. Don't forward */ -- if (ether_addr_equal(sdata->vif.addr, eth->h_dest)) -- goto rx_accept; -- -- if (!ifmsh->mshcfg.dot11MeshForwarding) { -- if (is_multicast_ether_addr(eth->h_dest)) -- goto rx_accept; -- -- return RX_DROP_MONITOR; -- } -- - /* forward packet */ - if (sdata->crypto_tx_tailroom_needed_cnt) - tailroom = IEEE80211_ENCRYPT_TAILROOM; -@@ -2881,6 +2870,17 @@ ieee80211_rx_mesh_data(struct ieee80211_ - rcu_read_unlock(); - } - -+ /* Frame has reached destination. Don't forward */ -+ if (ether_addr_equal(sdata->vif.addr, eth->h_dest)) -+ goto rx_accept; -+ -+ if (!ifmsh->mshcfg.dot11MeshForwarding) { -+ if (is_multicast_ether_addr(eth->h_dest)) -+ goto rx_accept; -+ -+ return RX_DROP_MONITOR; -+ } -+ - skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]); - - if (!multicast && diff --git a/package/kernel/mac80211/patches/subsys/323-v6.3-wifi-mac80211-Add-VHT-MU-MIMO-related-flags-in-ieee8.patch b/package/kernel/mac80211/patches/subsys/323-v6.3-wifi-mac80211-Add-VHT-MU-MIMO-related-flags-in-ieee8.patch deleted file mode 100644 index e23dc4d226a..00000000000 --- a/package/kernel/mac80211/patches/subsys/323-v6.3-wifi-mac80211-Add-VHT-MU-MIMO-related-flags-in-ieee8.patch +++ /dev/null @@ -1,68 +0,0 @@ -From: Muna Sinada -Date: Wed, 5 Oct 2022 14:54:45 -0700 -Subject: [PATCH] wifi: mac80211: Add VHT MU-MIMO related flags in - ieee80211_bss_conf - -Adding flags for SU Beamformer, SU Beamformee, MU Beamformer and -MU Beamformee for VHT. This is utilized to pass MU-MIMO -configurations from user space to driver in AP mode. - -Signed-off-by: Muna Sinada -Link: https://lore.kernel.org/r/1665006886-23874-1-git-send-email-quic_msinada@quicinc.com -[fixed indentation, removed redundant !!] -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -653,6 +653,14 @@ struct ieee80211_fils_discovery { - * write-protected by sdata_lock and local->mtx so holding either is fine - * for read access. - * @color_change_color: the bss color that will be used after the change. -+ * @vht_su_beamformer: in AP mode, does this BSS support operation as an VHT SU -+ * beamformer -+ * @vht_su_beamformee: in AP mode, does this BSS support operation as an VHT SU -+ * beamformee -+ * @vht_mu_beamformer: in AP mode, does this BSS support operation as an VHT MU -+ * beamformer -+ * @vht_mu_beamformee: in AP mode, does this BSS support operation as an VHT MU -+ * beamformee - */ - struct ieee80211_bss_conf { - const u8 *bssid; -@@ -726,6 +734,11 @@ struct ieee80211_bss_conf { - - bool color_change_active; - u8 color_change_color; -+ -+ bool vht_su_beamformer; -+ bool vht_su_beamformee; -+ bool vht_mu_beamformer; -+ bool vht_mu_beamformee; - }; - - /** ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1252,6 +1252,21 @@ static int ieee80211_start_ap(struct wip - prev_beacon_int = link_conf->beacon_int; - link_conf->beacon_int = params->beacon_interval; - -+ if (params->vht_cap) { -+ link_conf->vht_su_beamformer = -+ params->vht_cap->vht_cap_info & -+ cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE); -+ link_conf->vht_su_beamformee = -+ params->vht_cap->vht_cap_info & -+ cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE); -+ link_conf->vht_mu_beamformer = -+ params->vht_cap->vht_cap_info & -+ cpu_to_le32(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE); -+ link_conf->vht_mu_beamformee = -+ params->vht_cap->vht_cap_info & -+ cpu_to_le32(IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE); -+ } -+ - if (params->he_cap && params->he_oper) { - link_conf->he_support = true; - link_conf->htc_trig_based_pkt_ext = diff --git a/package/kernel/mac80211/patches/subsys/324-v6.3-wifi-mac80211-Add-HE-MU-MIMO-related-flags-in-ieee80.patch b/package/kernel/mac80211/patches/subsys/324-v6.3-wifi-mac80211-Add-HE-MU-MIMO-related-flags-in-ieee80.patch deleted file mode 100644 index f843dba1235..00000000000 --- a/package/kernel/mac80211/patches/subsys/324-v6.3-wifi-mac80211-Add-HE-MU-MIMO-related-flags-in-ieee80.patch +++ /dev/null @@ -1,68 +0,0 @@ -From: Muna Sinada -Date: Wed, 5 Oct 2022 14:54:46 -0700 -Subject: [PATCH] wifi: mac80211: Add HE MU-MIMO related flags in - ieee80211_bss_conf - -Adding flags for SU Beamformer, SU Beamformee, MU Beamformer and Full -Bandwidth UL MU-MIMO for HE. This is utilized to pass MU-MIMO -configurations from user space to driver in AP mode. - -Signed-off-by: Muna Sinada -Link: https://lore.kernel.org/r/1665006886-23874-2-git-send-email-quic_msinada@quicinc.com -[fixed indentation, removed redundant !!] -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -661,6 +661,15 @@ struct ieee80211_fils_discovery { - * beamformer - * @vht_mu_beamformee: in AP mode, does this BSS support operation as an VHT MU - * beamformee -+ * @he_su_beamformer: in AP-mode, does this BSS support operation as an HE SU -+ * beamformer -+ * @he_su_beamformee: in AP-mode, does this BSS support operation as an HE SU -+ * beamformee -+ * @he_mu_beamformer: in AP-mode, does this BSS support operation as an HE MU -+ * beamformer -+ * @he_full_ul_mumimo: does this BSS support the reception (AP) or transmission -+ * (non-AP STA) of an HE TB PPDU on an RU that spans the entire PPDU -+ * bandwidth - */ - struct ieee80211_bss_conf { - const u8 *bssid; -@@ -739,6 +748,10 @@ struct ieee80211_bss_conf { - bool vht_su_beamformee; - bool vht_mu_beamformer; - bool vht_mu_beamformee; -+ bool he_su_beamformer; -+ bool he_su_beamformee; -+ bool he_mu_beamformer; -+ bool he_full_ul_mumimo; - }; - - /** ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1281,6 +1281,21 @@ static int ieee80211_start_ap(struct wip - changed |= BSS_CHANGED_HE_BSS_COLOR; - } - -+ if (params->he_cap) { -+ link_conf->he_su_beamformer = -+ params->he_cap->phy_cap_info[3] & -+ IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER; -+ link_conf->he_su_beamformee = -+ params->he_cap->phy_cap_info[4] & -+ IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE; -+ link_conf->he_mu_beamformer = -+ params->he_cap->phy_cap_info[4] & -+ IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER; -+ link_conf->he_full_ul_mumimo = -+ params->he_cap->phy_cap_info[2] & -+ IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO; -+ } -+ - if (sdata->vif.type == NL80211_IFTYPE_AP && - params->mbssid_config.tx_wdev) { - err = ieee80211_set_ap_mbssid_options(sdata, diff --git a/package/kernel/mac80211/patches/subsys/325-wifi-mac80211-introduce-ieee80211_refresh_tx_agg_ses.patch b/package/kernel/mac80211/patches/subsys/325-wifi-mac80211-introduce-ieee80211_refresh_tx_agg_ses.patch deleted file mode 100644 index 1be5fcfbfa1..00000000000 --- a/package/kernel/mac80211/patches/subsys/325-wifi-mac80211-introduce-ieee80211_refresh_tx_agg_ses.patch +++ /dev/null @@ -1,60 +0,0 @@ -From: Ryder Lee -Date: Sat, 18 Feb 2023 01:50:05 +0800 -Subject: [PATCH] wifi: mac80211: introduce - ieee80211_refresh_tx_agg_session_timer() - -This allows low level drivers to refresh the tx agg session timer, based on -querying stats from the firmware usually. Especially for some mt76 devices -support .net_fill_forward_path would bypass mac80211, which leads to tx BA -session timeout for certain clients. - -Signed-off-by: Ryder Lee ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -5964,6 +5964,18 @@ void ieee80211_queue_delayed_work(struct - unsigned long delay); - - /** -+ * ieee80211_refresh_tx_agg_session_timer - Refresh a tx agg session timer. -+ * @sta: the station for which to start a BA session -+ * @tid: the TID to BA on. -+ * -+ * This function allows low level driver to refresh tx agg session timer -+ * to maintain BA session, the session level will still be managed by the -+ * mac80211. -+ */ -+void ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *sta, -+ u16 tid); -+ -+/** - * ieee80211_start_tx_ba_session - Start a tx Block Ack session. - * @sta: the station for which to start a BA session - * @tid: the TID to BA on. ---- a/net/mac80211/agg-tx.c -+++ b/net/mac80211/agg-tx.c -@@ -554,6 +554,23 @@ void ieee80211_tx_ba_session_handle_star - ieee80211_send_addba_with_timeout(sta, tid_tx); - } - -+void ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *pubsta, -+ u16 tid) -+{ -+ struct sta_info *sta = container_of(pubsta, struct sta_info, sta); -+ struct tid_ampdu_tx *tid_tx; -+ -+ if (WARN_ON_ONCE(tid >= IEEE80211_NUM_TIDS)) -+ return; -+ -+ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); -+ if (!tid_tx) -+ return; -+ -+ tid_tx->last_tx = jiffies; -+} -+EXPORT_SYMBOL(ieee80211_refresh_tx_agg_session_timer); -+ - /* - * After accepting the AddBA Response we activated a timer, - * resetting it after each frame that we send. diff --git a/package/kernel/mac80211/patches/subsys/326-wifi-mac80211-add-mesh-fast-rx-support.patch b/package/kernel/mac80211/patches/subsys/326-wifi-mac80211-add-mesh-fast-rx-support.patch deleted file mode 100644 index 11f39c2d109..00000000000 --- a/package/kernel/mac80211/patches/subsys/326-wifi-mac80211-add-mesh-fast-rx-support.patch +++ /dev/null @@ -1,77 +0,0 @@ -From: Felix Fietkau -Date: Thu, 2 Mar 2023 13:52:29 +0100 -Subject: [PATCH] wifi: mac80211: add mesh fast-rx support - -This helps bring down rx CPU usage by avoiding calls to the rx handlers in -the slow path. Supports forwarding and local rx, including A-MSDU. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -4564,6 +4564,12 @@ void ieee80211_check_fast_rx(struct sta_ - } - - break; -+ case NL80211_IFTYPE_MESH_POINT: -+ fastrx.expected_ds_bits = cpu_to_le16(IEEE80211_FCTL_FROMDS | -+ IEEE80211_FCTL_TODS); -+ fastrx.da_offs = offsetof(struct ieee80211_hdr, addr3); -+ fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr4); -+ break; - default: - goto clear; - } -@@ -4772,6 +4778,7 @@ static bool ieee80211_invoke_fast_rx(str - struct sk_buff *skb = rx->skb; - struct ieee80211_hdr *hdr = (void *)skb->data; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); -+ static ieee80211_rx_result res; - int orig_len = skb->len; - int hdrlen = ieee80211_hdrlen(hdr->frame_control); - int snap_offs = hdrlen; -@@ -4833,7 +4840,8 @@ static bool ieee80211_invoke_fast_rx(str - snap_offs += IEEE80211_CCMP_HDR_LEN; - } - -- if (!(status->rx_flags & IEEE80211_RX_AMSDU)) { -+ if (!ieee80211_vif_is_mesh(&rx->sdata->vif) && -+ !(status->rx_flags & IEEE80211_RX_AMSDU)) { - if (!pskb_may_pull(skb, snap_offs + sizeof(*payload))) - return false; - -@@ -4872,13 +4880,29 @@ static bool ieee80211_invoke_fast_rx(str - /* do the header conversion - first grab the addresses */ - ether_addr_copy(addrs.da, skb->data + fast_rx->da_offs); - ether_addr_copy(addrs.sa, skb->data + fast_rx->sa_offs); -- skb_postpull_rcsum(skb, skb->data + snap_offs, -- sizeof(rfc1042_header) + 2); -- /* remove the SNAP but leave the ethertype */ -- skb_pull(skb, snap_offs + sizeof(rfc1042_header)); -+ if (ieee80211_vif_is_mesh(&rx->sdata->vif)) { -+ skb_pull(skb, snap_offs - 2); -+ put_unaligned_be16(skb->len - 2, skb->data); -+ } else { -+ skb_postpull_rcsum(skb, skb->data + snap_offs, -+ sizeof(rfc1042_header) + 2); -+ -+ /* remove the SNAP but leave the ethertype */ -+ skb_pull(skb, snap_offs + sizeof(rfc1042_header)); -+ } - /* push the addresses in front */ - memcpy(skb_push(skb, sizeof(addrs)), &addrs, sizeof(addrs)); - -+ res = ieee80211_rx_mesh_data(rx->sdata, rx->sta, rx->skb); -+ switch (res) { -+ case RX_QUEUED: -+ return true; -+ case RX_CONTINUE: -+ break; -+ default: -+ goto drop; -+ } -+ - ieee80211_rx_8023(rx, fast_rx, orig_len); - - return true; diff --git a/package/kernel/mac80211/patches/subsys/327-wifi-mac80211-add-support-for-letting-drivers-regist.patch b/package/kernel/mac80211/patches/subsys/327-wifi-mac80211-add-support-for-letting-drivers-regist.patch deleted file mode 100644 index ac290b5360a..00000000000 --- a/package/kernel/mac80211/patches/subsys/327-wifi-mac80211-add-support-for-letting-drivers-regist.patch +++ /dev/null @@ -1,149 +0,0 @@ -From: Felix Fietkau -Date: Mon, 20 Mar 2023 14:28:08 +0100 -Subject: [PATCH] wifi: mac80211: add support for letting drivers register tc - offload support - -On newer MediaTek SoCs (e.g. MT7986), WLAN->WLAN or WLAN->Ethernet flows can -be offloaded by the SoC. In order to support that, the .ndo_setup_tc op is -needed. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -4192,6 +4192,10 @@ struct ieee80211_prep_tx_info { - * Note that a sta can also be inserted or removed with valid links, - * i.e. passed to @sta_add/@sta_state with sta->valid_links not zero. - * In fact, cannot change from having valid_links and not having them. -+ * @net_setup_tc: Called from .ndo_setup_tc in order to prepare hardware -+ * flow offloading for flows originating from the vif. -+ * Note that the driver must not assume that the vif driver_data is valid -+ * at this point, since the callback can be called during netdev teardown. - */ - struct ieee80211_ops { - void (*tx)(struct ieee80211_hw *hw, -@@ -4547,6 +4551,11 @@ struct ieee80211_ops { - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - u16 old_links, u16 new_links); -+ int (*net_setup_tc)(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct net_device *dev, -+ enum tc_setup_type type, -+ void *type_data); - }; - - /** ---- a/net/mac80211/driver-ops.h -+++ b/net/mac80211/driver-ops.h -@@ -1470,6 +1470,23 @@ static inline int drv_net_fill_forward_p - return ret; - } - -+static inline int drv_net_setup_tc(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct net_device *dev, -+ enum tc_setup_type type, void *type_data) -+{ -+ int ret = -EOPNOTSUPP; -+ -+ sdata = get_bss_sdata(sdata); -+ trace_drv_net_setup_tc(local, sdata, type); -+ if (local->ops->net_setup_tc) -+ ret = local->ops->net_setup_tc(&local->hw, &sdata->vif, dev, -+ type, type_data); -+ trace_drv_return_int(local, ret); -+ -+ return ret; -+} -+ - int drv_change_vif_links(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - u16 old_links, u16 new_links, ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1939,7 +1939,8 @@ void ieee80211_color_collision_detection - /* interface handling */ - #define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \ - NETIF_F_HW_CSUM | NETIF_F_SG | \ -- NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE) -+ NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE | \ -+ NETIF_F_HW_TC) - #define MAC80211_SUPPORTED_FEATURES_RX (NETIF_F_RXCSUM) - #define MAC80211_SUPPORTED_FEATURES (MAC80211_SUPPORTED_FEATURES_TX | \ - MAC80211_SUPPORTED_FEATURES_RX) ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -813,6 +813,21 @@ ieee80211_get_stats64(struct net_device - dev_fetch_sw_netstats(stats, dev->tstats); - } - -+static int ieee80211_netdev_setup_tc(struct net_device *dev, -+ enum tc_setup_type type, void *type_data) -+{ -+ struct ieee80211_sub_if_data *sdata; -+ struct ieee80211_local *local; -+ -+ sdata = IEEE80211_DEV_TO_SUB_IF(dev); -+ local = sdata->local; -+ -+ if (!local->ops->net_setup_tc) -+ return -EOPNOTSUPP; -+ -+ return drv_net_setup_tc(local, sdata, dev, type, type_data); -+} -+ - static const struct net_device_ops ieee80211_dataif_ops = { - .ndo_open = ieee80211_open, - .ndo_stop = ieee80211_stop, -@@ -821,6 +836,7 @@ static const struct net_device_ops ieee8 - .ndo_set_rx_mode = ieee80211_set_multicast_list, - .ndo_set_mac_address = ieee80211_change_mac, - .ndo_get_stats64 = ieee80211_get_stats64, -+ .ndo_setup_tc = ieee80211_netdev_setup_tc, - }; - - static u16 ieee80211_monitor_select_queue(struct net_device *dev, -@@ -929,6 +945,7 @@ static const struct net_device_ops ieee8 - .ndo_set_mac_address = ieee80211_change_mac, - .ndo_get_stats64 = ieee80211_get_stats64, - .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path, -+ .ndo_setup_tc = ieee80211_netdev_setup_tc, - }; - - static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype) ---- a/net/mac80211/trace.h -+++ b/net/mac80211/trace.h -@@ -2478,6 +2478,31 @@ DEFINE_EVENT(sta_event, drv_net_fill_for - TP_ARGS(local, sdata, sta) - ); - -+TRACE_EVENT(drv_net_setup_tc, -+ TP_PROTO(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ u8 type), -+ -+ TP_ARGS(local, sdata, type), -+ -+ TP_STRUCT__entry( -+ LOCAL_ENTRY -+ VIF_ENTRY -+ __field(u8, type) -+ ), -+ -+ TP_fast_assign( -+ LOCAL_ASSIGN; -+ VIF_ASSIGN; -+ __entry->type = type; -+ ), -+ -+ TP_printk( -+ LOCAL_PR_FMT VIF_PR_FMT " type:%d\n", -+ LOCAL_PR_ARG, VIF_PR_ARG, __entry->type -+ ) -+); -+ - TRACE_EVENT(drv_change_vif_links, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, diff --git a/package/kernel/mac80211/patches/subsys/329-wifi-mac80211-fix-receiving-mesh-packets-in-forwardi.patch b/package/kernel/mac80211/patches/subsys/329-wifi-mac80211-fix-receiving-mesh-packets-in-forwardi.patch deleted file mode 100644 index 6882694da8e..00000000000 --- a/package/kernel/mac80211/patches/subsys/329-wifi-mac80211-fix-receiving-mesh-packets-in-forwardi.patch +++ /dev/null @@ -1,50 +0,0 @@ -From: Felix Fietkau -Date: Sun, 26 Mar 2023 17:11:34 +0200 -Subject: [PATCH] wifi: mac80211: fix receiving mesh packets in forwarding=0 - networks -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When forwarding is set to 0, frames are typically sent with ttl=1. -Move the ttl decrement check below the check for local receive in order to -fix packet drops. - -Reported-by: Thomas Hühn -Reported-by: Nick Hainke -Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2828,14 +2828,6 @@ ieee80211_rx_mesh_data(struct ieee80211_ - if (sdata->crypto_tx_tailroom_needed_cnt) - tailroom = IEEE80211_ENCRYPT_TAILROOM; - -- if (!--mesh_hdr->ttl) { -- if (multicast) -- goto rx_accept; -- -- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); -- return RX_DROP_MONITOR; -- } -- - if (mesh_hdr->flags & MESH_FLAGS_AE) { - struct mesh_path *mppath; - char *proxied_addr; -@@ -2874,6 +2866,14 @@ ieee80211_rx_mesh_data(struct ieee80211_ - if (ether_addr_equal(sdata->vif.addr, eth->h_dest)) - goto rx_accept; - -+ if (!--mesh_hdr->ttl) { -+ if (multicast) -+ goto rx_accept; -+ -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); -+ return RX_DROP_MONITOR; -+ } -+ - if (!ifmsh->mshcfg.dot11MeshForwarding) { - if (is_multicast_ether_addr(eth->h_dest)) - goto rx_accept; diff --git a/package/kernel/mac80211/patches/subsys/330-wifi-ieee80211-correctly-mark-FTM-frames-non-buffera.patch b/package/kernel/mac80211/patches/subsys/330-wifi-ieee80211-correctly-mark-FTM-frames-non-buffera.patch deleted file mode 100644 index 079dd2a8686..00000000000 --- a/package/kernel/mac80211/patches/subsys/330-wifi-ieee80211-correctly-mark-FTM-frames-non-buffera.patch +++ /dev/null @@ -1,134 +0,0 @@ -From: Johannes Berg -Date: Wed, 29 Mar 2023 16:46:26 +0200 -Subject: [PATCH] wifi: ieee80211: correctly mark FTM frames non-bufferable - -The checks of whether or not a frame is bufferable were not -taking into account that some action frames aren't, such as -FTM. Check this, which requires some changes to the function -ieee80211_is_bufferable_mmpdu() since we need the whole skb -for the checks now. - -Signed-off-by: Johannes Berg -Reviewed-by: Greenman, Gregory -Reviewed-by: Peer, Ilan ---- - ---- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c -@@ -601,8 +601,9 @@ static void iwl_mvm_skb_prepare_status(s - - static int iwl_mvm_get_ctrl_vif_queue(struct iwl_mvm *mvm, - struct ieee80211_tx_info *info, -- struct ieee80211_hdr *hdr) -+ struct sk_buff *skb) - { -+ struct ieee80211_hdr *hdr = (void *)skb->data; - struct iwl_mvm_vif *mvmvif = - iwl_mvm_vif_from_mac80211(info->control.vif); - __le16 fc = hdr->frame_control; -@@ -621,7 +622,7 @@ static int iwl_mvm_get_ctrl_vif_queue(st - * reason 7 ("Class 3 frame received from nonassociated STA"). - */ - if (ieee80211_is_mgmt(fc) && -- (!ieee80211_is_bufferable_mmpdu(fc) || -+ (!ieee80211_is_bufferable_mmpdu(skb) || - ieee80211_is_deauth(fc) || ieee80211_is_disassoc(fc))) - return mvm->probe_queue; - -@@ -740,7 +741,7 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mv - else - sta_id = mvmvif->mcast_sta.sta_id; - -- queue = iwl_mvm_get_ctrl_vif_queue(mvm, &info, hdr); -+ queue = iwl_mvm_get_ctrl_vif_queue(mvm, &info, skb); - } else if (info.control.vif->type == NL80211_IFTYPE_MONITOR) { - queue = mvm->snif_queue; - sta_id = mvm->snif_sta.sta_id; ---- a/include/linux/ieee80211.h -+++ b/include/linux/ieee80211.h -@@ -772,20 +772,6 @@ static inline bool ieee80211_is_any_null - } - - /** -- * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU -- * @fc: frame control field in little-endian byteorder -- */ --static inline bool ieee80211_is_bufferable_mmpdu(__le16 fc) --{ -- /* IEEE 802.11-2012, definition of "bufferable management frame"; -- * note that this ignores the IBSS special case. */ -- return ieee80211_is_mgmt(fc) && -- (ieee80211_is_action(fc) || -- ieee80211_is_disassoc(fc) || -- ieee80211_is_deauth(fc)); --} -- --/** - * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set - * @seq_ctrl: frame sequence control bytes in little-endian byteorder - */ -@@ -4121,6 +4107,44 @@ static inline u8 *ieee80211_get_DA(struc - } - - /** -+ * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU -+ * @skb: the skb to check, starting with the 802.11 header -+ */ -+static inline bool ieee80211_is_bufferable_mmpdu(struct sk_buff *skb) -+{ -+ struct ieee80211_mgmt *mgmt = (void *)skb->data; -+ __le16 fc = mgmt->frame_control; -+ -+ /* -+ * IEEE 802.11 REVme D2.0 definition of bufferable MMPDU; -+ * note that this ignores the IBSS special case. -+ */ -+ if (!ieee80211_is_mgmt(fc)) -+ return false; -+ -+ if (ieee80211_is_disassoc(fc) || ieee80211_is_deauth(fc)) -+ return true; -+ -+ if (!ieee80211_is_action(fc)) -+ return false; -+ -+ if (skb->len < offsetofend(typeof(*mgmt), u.action.u.ftm.action_code)) -+ return true; -+ -+ /* action frame - additionally check for non-bufferable FTM */ -+ -+ if (mgmt->u.action.category != WLAN_CATEGORY_PUBLIC && -+ mgmt->u.action.category != WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION) -+ return true; -+ -+ if (mgmt->u.action.u.ftm.action_code == WLAN_PUB_ACTION_FTM_REQUEST || -+ mgmt->u.action.u.ftm.action_code == WLAN_PUBLIC_ACTION_FTM_RESPONSE) -+ return false; -+ -+ return true; -+} -+ -+/** - * _ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame - * @hdr: the frame (buffer must include at least the first octet of payload) - */ ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -488,7 +488,7 @@ ieee80211_tx_h_unicast_ps_buf(struct iee - int ac = skb_get_queue_mapping(tx->skb); - - if (ieee80211_is_mgmt(hdr->frame_control) && -- !ieee80211_is_bufferable_mmpdu(hdr->frame_control)) { -+ !ieee80211_is_bufferable_mmpdu(tx->skb)) { - info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER; - return TX_CONTINUE; - } -@@ -1326,7 +1326,7 @@ static struct txq_info *ieee80211_get_tx - if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) && - unlikely(!ieee80211_is_data_present(hdr->frame_control))) { - if ((!ieee80211_is_mgmt(hdr->frame_control) || -- ieee80211_is_bufferable_mmpdu(hdr->frame_control) || -+ ieee80211_is_bufferable_mmpdu(skb) || - vif->type == NL80211_IFTYPE_STATION) && - sta && sta->uploaded) { - /* diff --git a/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-flush-queues-on-STA-removal.patch b/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-flush-queues-on-STA-removal.patch deleted file mode 100644 index 00232ec1b9e..00000000000 --- a/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-flush-queues-on-STA-removal.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Johannes Berg -Date: Mon, 13 Mar 2023 11:42:12 +0100 -Subject: [PATCH] wifi: mac80211: flush queues on STA removal - -When we remove a station, we first make it unreachable, -then we (must) remove its keys, and then remove the -station itself. Depending on the hardware design, if -we have hardware crypto at all, frames still sitting -on hardware queues may then be transmitted without a -valid key, possibly unencrypted or with a fixed key. - -Fix this by flushing the queues when removing stations -so this cannot happen. - -Cc: stable@vger.kernel.org -Signed-off-by: Johannes Berg -Reviewed-by: Greenman, Gregory ---- - ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -1271,6 +1271,14 @@ static void __sta_info_destroy_part2(str - WARN_ON_ONCE(ret); - } - -+ /* Flush queues before removing keys, as that might remove them -+ * from hardware, and then depending on the offload method, any -+ * frames sitting on hardware queues might be sent out without -+ * any encryption at all. -+ */ -+ if (local->ops->set_key) -+ ieee80211_flush_queues(local, sta->sdata, false); -+ - /* now keys can no longer be reached */ - ieee80211_free_sta_keys(local, sta); - diff --git a/package/kernel/mac80211/patches/subsys/332-wifi-iwlwifi-mvm-support-flush-on-AP-interfaces.patch b/package/kernel/mac80211/patches/subsys/332-wifi-iwlwifi-mvm-support-flush-on-AP-interfaces.patch deleted file mode 100644 index 3c31dfeddc8..00000000000 --- a/package/kernel/mac80211/patches/subsys/332-wifi-iwlwifi-mvm-support-flush-on-AP-interfaces.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Johannes Berg -Date: Mon, 13 Mar 2023 12:02:58 +0100 -Subject: [PATCH] wifi: iwlwifi: mvm: support flush on AP interfaces - -Support TX flush on AP interfaces so that we will do a -proper flush for frames on the queue before keys are -removed. - -Signed-off-by: Johannes Berg -Reviewed-by: Greenman, Gregory ---- - ---- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -@@ -4854,9 +4854,6 @@ static void iwl_mvm_mac_flush(struct iee - return; - } - -- if (vif->type != NL80211_IFTYPE_STATION) -- return; -- - /* Make sure we're done with the deferred traffic before flushing */ - flush_work(&mvm->add_stream_wk); - -@@ -4874,9 +4871,6 @@ static void iwl_mvm_mac_flush(struct iee - if (mvmsta->vif != vif) - continue; - -- /* make sure only TDLS peers or the AP are flushed */ -- WARN_ON(i != mvmvif->ap_sta_id && !sta->tdls); -- - if (drop) { - if (iwl_mvm_flush_sta(mvm, mvmsta, false)) - IWL_ERR(mvm, "flush request fail\n"); diff --git a/package/kernel/mac80211/patches/subsys/333-wifi-mac80211-add-flush_sta-method.patch b/package/kernel/mac80211/patches/subsys/333-wifi-mac80211-add-flush_sta-method.patch deleted file mode 100644 index 3bba0b7e66f..00000000000 --- a/package/kernel/mac80211/patches/subsys/333-wifi-mac80211-add-flush_sta-method.patch +++ /dev/null @@ -1,91 +0,0 @@ -From: Johannes Berg -Date: Mon, 13 Mar 2023 11:53:51 +0100 -Subject: [PATCH] wifi: mac80211: add flush_sta method - -Some drivers like iwlwifi might have per-STA queues, so we -may want to flush/drop just those queues rather than all -when removing a station. Add a separate method for that. - -Signed-off-by: Johannes Berg -Reviewed-by: Greenman, Gregory ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -3918,6 +3918,10 @@ struct ieee80211_prep_tx_info { - * Note that vif can be NULL. - * The callback can sleep. - * -+ * @flush_sta: Flush or drop all pending frames from the hardware queue(s) for -+ * the given station, as it's about to be removed. -+ * The callback can sleep. -+ * - * @channel_switch: Drivers that need (or want) to offload the channel - * switch operation for CSAs received from the AP may implement this - * callback. They must then call ieee80211_chswitch_done() to indicate -@@ -4372,6 +4376,8 @@ struct ieee80211_ops { - #endif - void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - u32 queues, bool drop); -+ void (*flush_sta)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, -+ struct ieee80211_sta *sta); - void (*channel_switch)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_channel_switch *ch_switch); ---- a/net/mac80211/driver-ops.h -+++ b/net/mac80211/driver-ops.h -@@ -617,6 +617,21 @@ static inline void drv_flush(struct ieee - trace_drv_return_void(local); - } - -+static inline void drv_flush_sta(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta) -+{ -+ might_sleep(); -+ -+ if (sdata && !check_sdata_in_driver(sdata)) -+ return; -+ -+ trace_drv_flush_sta(local, sdata, &sta->sta); -+ if (local->ops->flush_sta) -+ local->ops->flush_sta(&local->hw, &sdata->vif, &sta->sta); -+ trace_drv_return_void(local); -+} -+ - static inline void drv_channel_switch(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_channel_switch *ch_switch) ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -1276,8 +1276,12 @@ static void __sta_info_destroy_part2(str - * frames sitting on hardware queues might be sent out without - * any encryption at all. - */ -- if (local->ops->set_key) -- ieee80211_flush_queues(local, sta->sdata, false); -+ if (local->ops->set_key) { -+ if (local->ops->flush_sta) -+ drv_flush_sta(local, sta->sdata, sta); -+ else -+ ieee80211_flush_queues(local, sta->sdata, false); -+ } - - /* now keys can no longer be reached */ - ieee80211_free_sta_keys(local, sta); ---- a/net/mac80211/trace.h -+++ b/net/mac80211/trace.h -@@ -1177,6 +1177,13 @@ TRACE_EVENT(drv_flush, - ) - ); - -+DEFINE_EVENT(sta_event, drv_flush_sta, -+ TP_PROTO(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_sta *sta), -+ TP_ARGS(local, sdata, sta) -+); -+ - TRACE_EVENT(drv_channel_switch, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, diff --git a/package/kernel/mac80211/patches/subsys/334-wifi-iwlwifi-mvm-support-new-flush_sta-method.patch b/package/kernel/mac80211/patches/subsys/334-wifi-iwlwifi-mvm-support-new-flush_sta-method.patch deleted file mode 100644 index 18f39d505fe..00000000000 --- a/package/kernel/mac80211/patches/subsys/334-wifi-iwlwifi-mvm-support-new-flush_sta-method.patch +++ /dev/null @@ -1,53 +0,0 @@ -From: Johannes Berg -Date: Mon, 13 Mar 2023 12:05:35 +0100 -Subject: [PATCH] wifi: iwlwifi: mvm: support new flush_sta method - -For iwlwifi this is simple to implement, and on newer hardware -it's an improvement since we have per-station queues. - -Signed-off-by: Johannes Berg -Reviewed-by: Greenman, Gregory ---- - ---- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -@@ -4890,6 +4890,31 @@ static void iwl_mvm_mac_flush(struct iee - iwl_trans_wait_tx_queues_empty(mvm->trans, msk); - } - -+static void iwl_mvm_mac_flush_sta(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_sta *sta) -+{ -+ struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); -+ int i; -+ -+ mutex_lock(&mvm->mutex); -+ for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { -+ struct iwl_mvm_sta *mvmsta; -+ struct ieee80211_sta *tmp; -+ -+ tmp = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], -+ lockdep_is_held(&mvm->mutex)); -+ if (tmp != sta) -+ continue; -+ -+ mvmsta = iwl_mvm_sta_from_mac80211(sta); -+ -+ if (iwl_mvm_flush_sta(mvm, mvmsta, false)) -+ IWL_ERR(mvm, "flush request fail\n"); -+ } -+ mutex_unlock(&mvm->mutex); -+} -+ - static int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey) - { -@@ -5417,6 +5442,7 @@ const struct ieee80211_ops iwl_mvm_hw_op - .mgd_complete_tx = iwl_mvm_mac_mgd_complete_tx, - .mgd_protect_tdls_discover = iwl_mvm_mac_mgd_protect_tdls_discover, - .flush = iwl_mvm_mac_flush, -+ .flush_sta = iwl_mvm_mac_flush_sta, - .sched_scan_start = iwl_mvm_mac_sched_scan_start, - .sched_scan_stop = iwl_mvm_mac_sched_scan_stop, - .set_key = iwl_mvm_mac_set_key, diff --git a/package/kernel/mac80211/patches/subsys/335-wifi-mac80211-add-LDPC-related-flags-in-ieee80211_bs.patch b/package/kernel/mac80211/patches/subsys/335-wifi-mac80211-add-LDPC-related-flags-in-ieee80211_bs.patch deleted file mode 100644 index 1b379b76ae9..00000000000 --- a/package/kernel/mac80211/patches/subsys/335-wifi-mac80211-add-LDPC-related-flags-in-ieee80211_bs.patch +++ /dev/null @@ -1,62 +0,0 @@ -From: Ryder Lee -Date: Sat, 18 Feb 2023 01:49:25 +0800 -Subject: [PATCH] wifi: mac80211: add LDPC related flags in ieee80211_bss_conf - -This is utilized to pass LDPC configurations from user space -(i.e. hostapd) to driver. - -Signed-off-by: Ryder Lee -Link: https://lore.kernel.org/r/1de696aaa34efd77a926eb657b8c0fda05aaa177.1676628065.git.ryder.lee@mediatek.com -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -653,6 +653,9 @@ struct ieee80211_fils_discovery { - * write-protected by sdata_lock and local->mtx so holding either is fine - * for read access. - * @color_change_color: the bss color that will be used after the change. -+ * @ht_ldpc: in AP mode, indicates interface has HT LDPC capability. -+ * @vht_ldpc: in AP mode, indicates interface has VHT LDPC capability. -+ * @he_ldpc: in AP mode, indicates interface has HE LDPC capability. - * @vht_su_beamformer: in AP mode, does this BSS support operation as an VHT SU - * beamformer - * @vht_su_beamformee: in AP mode, does this BSS support operation as an VHT SU -@@ -744,6 +747,9 @@ struct ieee80211_bss_conf { - bool color_change_active; - u8 color_change_color; - -+ bool ht_ldpc; -+ bool vht_ldpc; -+ bool he_ldpc; - bool vht_su_beamformer; - bool vht_su_beamformee; - bool vht_mu_beamformer; ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1252,7 +1252,15 @@ static int ieee80211_start_ap(struct wip - prev_beacon_int = link_conf->beacon_int; - link_conf->beacon_int = params->beacon_interval; - -+ if (params->ht_cap) -+ link_conf->ht_ldpc = -+ params->ht_cap->cap_info & -+ cpu_to_le16(IEEE80211_HT_CAP_LDPC_CODING); -+ - if (params->vht_cap) { -+ link_conf->vht_ldpc = -+ params->vht_cap->vht_cap_info & -+ cpu_to_le32(IEEE80211_VHT_CAP_RXLDPC); - link_conf->vht_su_beamformer = - params->vht_cap->vht_cap_info & - cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE); -@@ -1282,6 +1290,9 @@ static int ieee80211_start_ap(struct wip - } - - if (params->he_cap) { -+ link_conf->he_ldpc = -+ params->he_cap->phy_cap_info[1] & -+ IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD; - link_conf->he_su_beamformer = - params->he_cap->phy_cap_info[3] & - IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER; diff --git a/package/kernel/mac80211/patches/subsys/336-v6.4-wifi-mac80211-generate-EMA-beacons-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/336-v6.4-wifi-mac80211-generate-EMA-beacons-in-AP-mode.patch deleted file mode 100644 index 088f468e372..00000000000 --- a/package/kernel/mac80211/patches/subsys/336-v6.4-wifi-mac80211-generate-EMA-beacons-in-AP-mode.patch +++ /dev/null @@ -1,372 +0,0 @@ -From bd54f3c29077f23dad92ef82a78061b40be30c65 Mon Sep 17 00:00:00 2001 -From: Aloka Dixit -Date: Mon, 5 Dec 2022 16:50:37 -0800 -Subject: [PATCH] wifi: mac80211: generate EMA beacons in AP mode - -Add APIs to generate an array of beacons for an EMA AP (enhanced -multiple BSSID advertisements), each including a single MBSSID element. -EMA profile periodicity equals the count of elements. - -- ieee80211_beacon_get_template_ema_list() - Generate and return all -EMA beacon templates. Drivers must call ieee80211_beacon_free_ema_list() -to free the memory. No change in the prototype for the existing API, -ieee80211_beacon_get_template(), which should be used for non-EMA AP. - -- ieee80211_beacon_get_template_ema_index() - Generate a beacon which -includes the multiple BSSID element at the given index. Drivers can use -this function in a loop until NULL is returned which indicates end of -available MBSSID elements. - -- ieee80211_beacon_free_ema_list() - free the memory allocated for the -list of EMA beacon templates. - -Modify existing functions ieee80211_beacon_get_ap(), -ieee80211_get_mbssid_beacon_len() and ieee80211_beacon_add_mbssid() -to accept a new parameter for EMA index. - -Signed-off-by: Aloka Dixit -Co-developed-by: John Crispin -Signed-off-by: John Crispin -Link: https://lore.kernel.org/r/20221206005040.3177-2-quic_alokad@quicinc.com -Signed-off-by: Johannes Berg ---- - include/net/mac80211.h | 68 +++++++++++++++++++ - net/mac80211/cfg.c | 11 +-- - net/mac80211/ieee80211_i.h | 10 ++- - net/mac80211/tx.c | 134 ++++++++++++++++++++++++++++++++++--- - 4 files changed, 205 insertions(+), 18 deletions(-) - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -5252,6 +5252,74 @@ ieee80211_beacon_get_template(struct iee - unsigned int link_id); - - /** -+ * ieee80211_beacon_get_template_ema_index - EMA beacon template generation -+ * @hw: pointer obtained from ieee80211_alloc_hw(). -+ * @vif: &struct ieee80211_vif pointer from the add_interface callback. -+ * @offs: &struct ieee80211_mutable_offsets pointer to struct that will -+ * receive the offsets that may be updated by the driver. -+ * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP). -+ * @ema_index: index of the beacon in the EMA set. -+ * -+ * This function follows the same rules as ieee80211_beacon_get_template() -+ * but returns a beacon template which includes multiple BSSID element at the -+ * requested index. -+ * -+ * Return: The beacon template. %NULL indicates the end of EMA templates. -+ */ -+struct sk_buff * -+ieee80211_beacon_get_template_ema_index(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_mutable_offsets *offs, -+ unsigned int link_id, u8 ema_index); -+ -+/** -+ * struct ieee80211_ema_beacons - List of EMA beacons -+ * @cnt: count of EMA beacons. -+ * -+ * @bcn: array of EMA beacons. -+ * @bcn.skb: the skb containing this specific beacon -+ * @bcn.offs: &struct ieee80211_mutable_offsets pointer to struct that will -+ * receive the offsets that may be updated by the driver. -+ */ -+struct ieee80211_ema_beacons { -+ u8 cnt; -+ struct { -+ struct sk_buff *skb; -+ struct ieee80211_mutable_offsets offs; -+ } bcn[]; -+}; -+ -+/** -+ * ieee80211_beacon_get_template_ema_list - EMA beacon template generation -+ * @hw: pointer obtained from ieee80211_alloc_hw(). -+ * @vif: &struct ieee80211_vif pointer from the add_interface callback. -+ * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP) -+ * -+ * This function follows the same rules as ieee80211_beacon_get_template() -+ * but allocates and returns a pointer to list of all beacon templates required -+ * to cover all profiles in the multiple BSSID set. Each template includes only -+ * one multiple BSSID element. -+ * -+ * Driver must call ieee80211_beacon_free_ema_list() to free the memory. -+ * -+ * Return: EMA beacon templates of type struct ieee80211_ema_beacons *. -+ * %NULL on error. -+ */ -+struct ieee80211_ema_beacons * -+ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ unsigned int link_id); -+ -+/** -+ * ieee80211_beacon_free_ema_list - free an EMA beacon template list -+ * @ema_beacons: list of EMA beacons of type &struct ieee80211_ema_beacons pointers. -+ * -+ * This function will free a list previously acquired by calling -+ * ieee80211_beacon_get_template_ema_list() -+ */ -+void ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *ema_beacons); -+ -+/** - * ieee80211_beacon_get_tim - beacon generation function - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1122,11 +1122,11 @@ static int ieee80211_assign_beacon(struc - if (params->mbssid_ies) { - mbssid = params->mbssid_ies; - size += struct_size(new->mbssid_ies, elem, mbssid->cnt); -- size += ieee80211_get_mbssid_beacon_len(mbssid); -+ size += ieee80211_get_mbssid_beacon_len(mbssid, mbssid->cnt); - } else if (old && old->mbssid_ies) { - mbssid = old->mbssid_ies; - size += struct_size(new->mbssid_ies, elem, mbssid->cnt); -- size += ieee80211_get_mbssid_beacon_len(mbssid); -+ size += ieee80211_get_mbssid_beacon_len(mbssid, mbssid->cnt); - } - - new = kzalloc(size, GFP_KERNEL); -@@ -3384,8 +3384,11 @@ cfg80211_beacon_dup(struct cfg80211_beac - - len = beacon->head_len + beacon->tail_len + beacon->beacon_ies_len + - beacon->proberesp_ies_len + beacon->assocresp_ies_len + -- beacon->probe_resp_len + beacon->lci_len + beacon->civicloc_len + -- ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies); -+ beacon->probe_resp_len + beacon->lci_len + beacon->civicloc_len; -+ -+ if (beacon->mbssid_ies) -+ len += ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies, -+ beacon->mbssid_ies->cnt); - - new_beacon = kzalloc(sizeof(*new_beacon) + len, GFP_KERNEL); - if (!new_beacon) ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1182,13 +1182,17 @@ ieee80211_vif_get_shift(struct ieee80211 - } - - static inline int --ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems) -+ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems, u8 i) - { -- int i, len = 0; -+ int len = 0; - -- if (!elems) -+ if (!elems || !elems->cnt || i > elems->cnt) - return 0; - -+ if (i < elems->cnt) -+ return elems->elem[i].len; -+ -+ /* i == elems->cnt, calculate total length of all MBSSID elements */ - for (i = 0; i < elems->cnt; i++) - len += elems->elem[i].len; - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -5205,13 +5205,20 @@ ieee80211_beacon_get_finish(struct ieee8 - } - - static void --ieee80211_beacon_add_mbssid(struct sk_buff *skb, struct beacon_data *beacon) -+ieee80211_beacon_add_mbssid(struct sk_buff *skb, struct beacon_data *beacon, -+ u8 i) - { -- int i; -+ if (!beacon->mbssid_ies || !beacon->mbssid_ies->cnt || -+ i > beacon->mbssid_ies->cnt) -+ return; - -- if (!beacon->mbssid_ies) -+ if (i < beacon->mbssid_ies->cnt) { -+ skb_put_data(skb, beacon->mbssid_ies->elem[i].data, -+ beacon->mbssid_ies->elem[i].len); - return; -+ } - -+ /* i == beacon->mbssid_ies->cnt, include all MBSSID elements */ - for (i = 0; i < beacon->mbssid_ies->cnt; i++) - skb_put_data(skb, beacon->mbssid_ies->elem[i].data, - beacon->mbssid_ies->elem[i].len); -@@ -5224,7 +5231,8 @@ ieee80211_beacon_get_ap(struct ieee80211 - struct ieee80211_mutable_offsets *offs, - bool is_template, - struct beacon_data *beacon, -- struct ieee80211_chanctx_conf *chanctx_conf) -+ struct ieee80211_chanctx_conf *chanctx_conf, -+ u8 ema_index) - { - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); -@@ -5243,7 +5251,9 @@ ieee80211_beacon_get_ap(struct ieee80211 - /* headroom, head length, - * tail length, maximum TIM length and multiple BSSID length - */ -- mbssid_len = ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies); -+ mbssid_len = ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies, -+ ema_index); -+ - skb = dev_alloc_skb(local->tx_headroom + beacon->head_len + - beacon->tail_len + 256 + - local->hw.extra_beacon_tailroom + mbssid_len); -@@ -5261,7 +5271,7 @@ ieee80211_beacon_get_ap(struct ieee80211 - offs->cntdwn_counter_offs[0] = beacon->cntdwn_counter_offsets[0]; - - if (mbssid_len) { -- ieee80211_beacon_add_mbssid(skb, beacon); -+ ieee80211_beacon_add_mbssid(skb, beacon, ema_index); - offs->mbssid_off = skb->len - mbssid_len; - } - -@@ -5280,12 +5290,51 @@ ieee80211_beacon_get_ap(struct ieee80211 - return skb; - } - -+static struct ieee80211_ema_beacons * -+ieee80211_beacon_get_ap_ema_list(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_link_data *link, -+ struct ieee80211_mutable_offsets *offs, -+ bool is_template, struct beacon_data *beacon, -+ struct ieee80211_chanctx_conf *chanctx_conf) -+{ -+ struct ieee80211_ema_beacons *ema = NULL; -+ -+ if (!beacon->mbssid_ies || !beacon->mbssid_ies->cnt) -+ return NULL; -+ -+ ema = kzalloc(struct_size(ema, bcn, beacon->mbssid_ies->cnt), -+ GFP_ATOMIC); -+ if (!ema) -+ return NULL; -+ -+ for (ema->cnt = 0; ema->cnt < beacon->mbssid_ies->cnt; ema->cnt++) { -+ ema->bcn[ema->cnt].skb = -+ ieee80211_beacon_get_ap(hw, vif, link, -+ &ema->bcn[ema->cnt].offs, -+ is_template, beacon, -+ chanctx_conf, ema->cnt); -+ if (!ema->bcn[ema->cnt].skb) -+ break; -+ } -+ -+ if (ema->cnt == beacon->mbssid_ies->cnt) -+ return ema; -+ -+ ieee80211_beacon_free_ema_list(ema); -+ return NULL; -+} -+ -+#define IEEE80211_INCLUDE_ALL_MBSSID_ELEMS -1 -+ - static struct sk_buff * - __ieee80211_beacon_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_mutable_offsets *offs, - bool is_template, -- unsigned int link_id) -+ unsigned int link_id, -+ int ema_index, -+ struct ieee80211_ema_beacons **ema_beacons) - { - struct ieee80211_local *local = hw_to_local(hw); - struct beacon_data *beacon = NULL; -@@ -5314,8 +5363,29 @@ __ieee80211_beacon_get(struct ieee80211_ - if (!beacon) - goto out; - -- skb = ieee80211_beacon_get_ap(hw, vif, link, offs, is_template, -- beacon, chanctx_conf); -+ if (ema_beacons) { -+ *ema_beacons = -+ ieee80211_beacon_get_ap_ema_list(hw, vif, link, -+ offs, -+ is_template, -+ beacon, -+ chanctx_conf); -+ } else { -+ if (beacon->mbssid_ies && beacon->mbssid_ies->cnt) { -+ if (ema_index >= beacon->mbssid_ies->cnt) -+ goto out; /* End of MBSSID elements */ -+ -+ if (ema_index <= IEEE80211_INCLUDE_ALL_MBSSID_ELEMS) -+ ema_index = beacon->mbssid_ies->cnt; -+ } else { -+ ema_index = 0; -+ } -+ -+ skb = ieee80211_beacon_get_ap(hw, vif, link, offs, -+ is_template, beacon, -+ chanctx_conf, -+ ema_index); -+ } - } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - struct ieee80211_hdr *hdr; -@@ -5403,10 +5473,50 @@ ieee80211_beacon_get_template(struct iee - struct ieee80211_mutable_offsets *offs, - unsigned int link_id) - { -- return __ieee80211_beacon_get(hw, vif, offs, true, link_id); -+ return __ieee80211_beacon_get(hw, vif, offs, true, link_id, -+ IEEE80211_INCLUDE_ALL_MBSSID_ELEMS, NULL); - } - EXPORT_SYMBOL(ieee80211_beacon_get_template); - -+struct sk_buff * -+ieee80211_beacon_get_template_ema_index(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_mutable_offsets *offs, -+ unsigned int link_id, u8 ema_index) -+{ -+ return __ieee80211_beacon_get(hw, vif, offs, true, link_id, ema_index, -+ NULL); -+} -+EXPORT_SYMBOL(ieee80211_beacon_get_template_ema_index); -+ -+void ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *ema_beacons) -+{ -+ u8 i; -+ -+ if (!ema_beacons) -+ return; -+ -+ for (i = 0; i < ema_beacons->cnt; i++) -+ kfree_skb(ema_beacons->bcn[i].skb); -+ -+ kfree(ema_beacons); -+} -+EXPORT_SYMBOL(ieee80211_beacon_free_ema_list); -+ -+struct ieee80211_ema_beacons * -+ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ unsigned int link_id) -+{ -+ struct ieee80211_ema_beacons *ema_beacons = NULL; -+ -+ WARN_ON(__ieee80211_beacon_get(hw, vif, NULL, false, link_id, 0, -+ &ema_beacons)); -+ -+ return ema_beacons; -+} -+EXPORT_SYMBOL(ieee80211_beacon_get_template_ema_list); -+ - struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - u16 *tim_offset, u16 *tim_length, -@@ -5414,7 +5524,9 @@ struct sk_buff *ieee80211_beacon_get_tim - { - struct ieee80211_mutable_offsets offs = {}; - struct sk_buff *bcn = __ieee80211_beacon_get(hw, vif, &offs, false, -- link_id); -+ link_id, -+ IEEE80211_INCLUDE_ALL_MBSSID_ELEMS, -+ NULL); - struct sk_buff *copy; - int shift; - diff --git a/package/kernel/mac80211/patches/subsys/337-mac80211-fix-sband-iftype-data-lookup-for-AP_VLAN.patch b/package/kernel/mac80211/patches/subsys/337-mac80211-fix-sband-iftype-data-lookup-for-AP_VLAN.patch deleted file mode 100644 index 67b42849496..00000000000 --- a/package/kernel/mac80211/patches/subsys/337-mac80211-fix-sband-iftype-data-lookup-for-AP_VLAN.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Felix Fietkau -Date: Thu, 22 Jun 2023 18:02:25 +0200 -Subject: [PATCH] mac80211: fix sband iftype data lookup for AP_VLAN - -AP_VLAN interfaces are virtual, so doesn't really exist as a type for -capabilities. When passed in as a type, AP is the one that's really intended. - -Fixes: c4cbaf7973a7 ("cfg80211: Add support for HE") -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -567,6 +567,9 @@ ieee80211_get_sband_iftype_data(const st - if (WARN_ON(iftype >= NL80211_IFTYPE_MAX)) - return NULL; - -+ if (iftype == NL80211_IFTYPE_AP_VLAN) -+ iftype = NL80211_IFTYPE_AP; -+ - for (i = 0; i < sband->n_iftype_data; i++) { - const struct ieee80211_sband_iftype_data *data = - &sband->iftype_data[i]; diff --git a/package/kernel/mac80211/patches/subsys/339-wifi-cfg80211-fix-receving-mesh-packets-without-RFC1.patch b/package/kernel/mac80211/patches/subsys/339-wifi-cfg80211-fix-receving-mesh-packets-without-RFC1.patch deleted file mode 100644 index e32c6ae1f36..00000000000 --- a/package/kernel/mac80211/patches/subsys/339-wifi-cfg80211-fix-receving-mesh-packets-without-RFC1.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Felix Fietkau -Date: Tue, 11 Jul 2023 13:30:12 +0200 -Subject: [PATCH] wifi: cfg80211: fix receving mesh packets without RFC1042 - header - -Fix ethernet header length field after stripping the mesh header - -Cc: stable@vger.kernel.org -Link: https://lore.kernel.org/all/CT5GNZSK28AI.2K6M69OXM9RW5@syracuse/ -Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces") -Reported-by: Nicolas Escande -Signed-off-by: Felix Fietkau ---- - ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -580,6 +580,8 @@ int ieee80211_strip_8023_mesh_hdr(struct - hdrlen += ETH_ALEN + 2; - else if (!pskb_may_pull(skb, hdrlen)) - return -EINVAL; -+ else -+ payload.eth.h_proto = htons(skb->len - hdrlen); - - mesh_addr = skb->data + sizeof(payload.eth) + ETH_ALEN; - switch (payload.flags & MESH_FLAGS_AE) { diff --git a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch index c38fa13f03d..ad24dfda5a7 100644 --- a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch +++ b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch @@ -16,7 +16,7 @@ and we should ignore this. --- a/net/wireless/core.c +++ b/net/wireless/core.c -@@ -614,21 +614,6 @@ static int wiphy_verify_combinations(str +@@ -649,21 +649,6 @@ static int wiphy_verify_combinations(str c->limits[j].max > 1)) return -EINVAL; From 3b86c1f9290f5e186d68eb79816a2e3b8289c91d Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 11 Sep 2023 12:50:38 +0100 Subject: [PATCH 21/32] kernel: backport two fixes for MediaTek Ethernet driver Fix PSE port assignment for 3rd GMAC on MT7988 and make sure dma_addr is always initialized to prevent potentially accessing uninitialized stack memory in the error path. Signed-off-by: Daniel Golle --- ...k_eth_soc-fix-uninitialized-variable.patch | 44 +++++++++++++++++++ ..._eth_soc-fix-pse_port-configuration-.patch | 33 ++++++++++++++ ...k_eth_soc-fix-uninitialized-variable.patch | 44 +++++++++++++++++++ ..._eth_soc-fix-pse_port-configuration-.patch | 33 ++++++++++++++ ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 6 +-- ..._eth_soc-fix-remaining-throughput-re.patch | 2 +- ..._eth_soc-add-code-for-offloading-flo.patch | 8 ++-- ...iatek-fix-ppe-flow-accounting-for-L2.patch | 2 +- ..._eth_soc-add-paths-and-SerDes-modes-.patch | 4 +- ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 6 +-- ..._eth_soc-fix-remaining-throughput-re.patch | 2 +- ..._eth_soc-add-code-for-offloading-flo.patch | 8 ++-- ...iatek-fix-ppe-flow-accounting-for-L2.patch | 2 +- ..._eth_soc-add-paths-and-SerDes-modes-.patch | 4 +- ...ethernet-mediatek-support-net-labels.patch | 4 +- 15 files changed, 178 insertions(+), 24 deletions(-) create mode 100644 target/linux/generic/backport-5.15/750-v6.5-20-net-ethernet-mtk_eth_soc-fix-uninitialized-variable.patch create mode 100644 target/linux/generic/backport-5.15/750-v6.5-21-net-ethernet-mtk_eth_soc-fix-pse_port-configuration-.patch create mode 100644 target/linux/generic/backport-6.1/750-v6.5-20-net-ethernet-mtk_eth_soc-fix-uninitialized-variable.patch create mode 100644 target/linux/generic/backport-6.1/750-v6.5-21-net-ethernet-mtk_eth_soc-fix-pse_port-configuration-.patch diff --git a/target/linux/generic/backport-5.15/750-v6.5-20-net-ethernet-mtk_eth_soc-fix-uninitialized-variable.patch b/target/linux/generic/backport-5.15/750-v6.5-20-net-ethernet-mtk_eth_soc-fix-uninitialized-variable.patch new file mode 100644 index 00000000000..7ea0707d9d0 --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-20-net-ethernet-mtk_eth_soc-fix-uninitialized-variable.patch @@ -0,0 +1,44 @@ +From e10a35abb3da12b812cfb6fc6137926a0c81e39a Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sun, 10 Sep 2023 22:40:30 +0100 +Subject: [PATCH] net: ethernet: mtk_eth_soc: fix uninitialized variable + +Variable dma_addr in function mtk_poll_rx can be uninitialized on +some of the error paths. In practise this doesn't matter, even random +data present in uninitialized stack memory can safely be used in the +way it happens in the error path. + +However, in order to make Smatch happy make sure the variable is +always initialized. + +Signed-off-by: Daniel Golle +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -1941,11 +1941,11 @@ static int mtk_poll_rx(struct napi_struc + u8 *data, *new_data; + struct mtk_rx_dma_v2 *rxd, trxd; + int done = 0, bytes = 0; ++ dma_addr_t dma_addr = DMA_MAPPING_ERROR; + + while (done < budget) { + unsigned int pktlen, *rxdcsum; + struct net_device *netdev; +- dma_addr_t dma_addr; + u32 hash, reason; + int mac = 0; + +@@ -2122,7 +2122,8 @@ release_desc: + else + rxd->rxd2 = RX_DMA_PREP_PLEN0(ring->buf_size); + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA) && ++ likely(dma_addr != DMA_MAPPING_ERROR)) + rxd->rxd2 |= RX_DMA_PREP_ADDR64(dma_addr); + + ring->calc_idx = idx; diff --git a/target/linux/generic/backport-5.15/750-v6.5-21-net-ethernet-mtk_eth_soc-fix-pse_port-configuration-.patch b/target/linux/generic/backport-5.15/750-v6.5-21-net-ethernet-mtk_eth_soc-fix-pse_port-configuration-.patch new file mode 100644 index 00000000000..ac3e3a3e676 --- /dev/null +++ b/target/linux/generic/backport-5.15/750-v6.5-21-net-ethernet-mtk_eth_soc-fix-pse_port-configuration-.patch @@ -0,0 +1,33 @@ +From 5a124b1fd3e6cb15a943f0cdfe96aa8f6d3d2f39 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Sat, 9 Sep 2023 20:41:56 +0200 +Subject: [PATCH] net: ethernet: mtk_eth_soc: fix pse_port configuration for + MT7988 + +MT7988 SoC support 3 NICs. Fix pse_port configuration in +mtk_flow_set_output_device routine if the traffic is offloaded to eth2. +Rely on mtk_pse_port definitions. + +Fixes: 88efedf517e6 ("net: ethernet: mtk_eth_soc: enable nft hw flowtable_offload for MT7988 SoC") +Signed-off-by: Lorenzo Bianconi +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/mediatek/mtk_ppe_offload.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c ++++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +@@ -214,9 +214,11 @@ mtk_flow_set_output_device(struct mtk_et + dsa_port = mtk_flow_get_dsa_port(&dev); + + if (dev == eth->netdev[0]) +- pse_port = 1; ++ pse_port = PSE_GDM1_PORT; + else if (dev == eth->netdev[1]) +- pse_port = 2; ++ pse_port = PSE_GDM2_PORT; ++ else if (dev == eth->netdev[2]) ++ pse_port = PSE_GDM3_PORT; + else + return -EOPNOTSUPP; + diff --git a/target/linux/generic/backport-6.1/750-v6.5-20-net-ethernet-mtk_eth_soc-fix-uninitialized-variable.patch b/target/linux/generic/backport-6.1/750-v6.5-20-net-ethernet-mtk_eth_soc-fix-uninitialized-variable.patch new file mode 100644 index 00000000000..697c2db1451 --- /dev/null +++ b/target/linux/generic/backport-6.1/750-v6.5-20-net-ethernet-mtk_eth_soc-fix-uninitialized-variable.patch @@ -0,0 +1,44 @@ +From e10a35abb3da12b812cfb6fc6137926a0c81e39a Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Sun, 10 Sep 2023 22:40:30 +0100 +Subject: [PATCH] net: ethernet: mtk_eth_soc: fix uninitialized variable + +Variable dma_addr in function mtk_poll_rx can be uninitialized on +some of the error paths. In practise this doesn't matter, even random +data present in uninitialized stack memory can safely be used in the +way it happens in the error path. + +However, in order to make Smatch happy make sure the variable is +always initialized. + +Signed-off-by: Daniel Golle +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -1989,11 +1989,11 @@ static int mtk_poll_rx(struct napi_struc + u8 *data, *new_data; + struct mtk_rx_dma_v2 *rxd, trxd; + int done = 0, bytes = 0; ++ dma_addr_t dma_addr = DMA_MAPPING_ERROR; + + while (done < budget) { + unsigned int pktlen, *rxdcsum; + struct net_device *netdev; +- dma_addr_t dma_addr; + u32 hash, reason; + int mac = 0; + +@@ -2170,7 +2170,8 @@ release_desc: + else + rxd->rxd2 = RX_DMA_PREP_PLEN0(ring->buf_size); + +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA) && ++ likely(dma_addr != DMA_MAPPING_ERROR)) + rxd->rxd2 |= RX_DMA_PREP_ADDR64(dma_addr); + + ring->calc_idx = idx; diff --git a/target/linux/generic/backport-6.1/750-v6.5-21-net-ethernet-mtk_eth_soc-fix-pse_port-configuration-.patch b/target/linux/generic/backport-6.1/750-v6.5-21-net-ethernet-mtk_eth_soc-fix-pse_port-configuration-.patch new file mode 100644 index 00000000000..ac3e3a3e676 --- /dev/null +++ b/target/linux/generic/backport-6.1/750-v6.5-21-net-ethernet-mtk_eth_soc-fix-pse_port-configuration-.patch @@ -0,0 +1,33 @@ +From 5a124b1fd3e6cb15a943f0cdfe96aa8f6d3d2f39 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Sat, 9 Sep 2023 20:41:56 +0200 +Subject: [PATCH] net: ethernet: mtk_eth_soc: fix pse_port configuration for + MT7988 + +MT7988 SoC support 3 NICs. Fix pse_port configuration in +mtk_flow_set_output_device routine if the traffic is offloaded to eth2. +Rely on mtk_pse_port definitions. + +Fixes: 88efedf517e6 ("net: ethernet: mtk_eth_soc: enable nft hw flowtable_offload for MT7988 SoC") +Signed-off-by: Lorenzo Bianconi +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/mediatek/mtk_ppe_offload.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c ++++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +@@ -214,9 +214,11 @@ mtk_flow_set_output_device(struct mtk_et + dsa_port = mtk_flow_get_dsa_port(&dev); + + if (dev == eth->netdev[0]) +- pse_port = 1; ++ pse_port = PSE_GDM1_PORT; + else if (dev == eth->netdev[1]) +- pse_port = 2; ++ pse_port = PSE_GDM2_PORT; ++ else if (dev == eth->netdev[2]) ++ pse_port = PSE_GDM3_PORT; + else + return -EOPNOTSUPP; + diff --git a/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch b/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch index 9a1c26e7aeb..2eb6dc133cf 100644 --- a/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch +++ b/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3095,8 +3095,8 @@ static irqreturn_t mtk_handle_irq_rx(int +@@ -3096,8 +3096,8 @@ static irqreturn_t mtk_handle_irq_rx(int eth->rx_events++; if (likely(napi_schedule_prep(ð->rx_napi))) { @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau } return IRQ_HANDLED; -@@ -3108,8 +3108,8 @@ static irqreturn_t mtk_handle_irq_tx(int +@@ -3109,8 +3109,8 @@ static irqreturn_t mtk_handle_irq_tx(int eth->tx_events++; if (likely(napi_schedule_prep(ð->tx_napi))) { @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau } return IRQ_HANDLED; -@@ -4883,6 +4883,8 @@ static int mtk_probe(struct platform_dev +@@ -4884,6 +4884,8 @@ static int mtk_probe(struct platform_dev * for NAPI to work */ init_dummy_netdev(ð->dummy_dev); diff --git a/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch b/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch index 452e486e896..305d63d5b73 100644 --- a/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch +++ b/target/linux/generic/pending-5.15/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau switch (speed) { case SPEED_2500: case SPEED_1000: -@@ -3288,6 +3289,9 @@ found: +@@ -3289,6 +3290,9 @@ found: if (dp->index >= MTK_QDMA_NUM_QUEUES) return NOTIFY_DONE; diff --git a/target/linux/generic/pending-5.15/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch b/target/linux/generic/pending-5.15/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch index d648ba4dc7f..caee22d2e9e 100644 --- a/target/linux/generic/pending-5.15/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch +++ b/target/linux/generic/pending-5.15/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch @@ -26,7 +26,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c -@@ -235,7 +235,8 @@ out: +@@ -237,7 +237,8 @@ out: } static int @@ -36,7 +36,7 @@ Signed-off-by: Felix Fietkau { struct flow_rule *rule = flow_cls_offload_flow_rule(f); struct flow_action_entry *act; -@@ -452,6 +453,7 @@ mtk_flow_offload_replace(struct mtk_eth +@@ -454,6 +455,7 @@ mtk_flow_offload_replace(struct mtk_eth entry->cookie = f->cookie; memcpy(&entry->data, &foe, sizeof(entry->data)); entry->wed_index = wed_index; @@ -44,7 +44,7 @@ Signed-off-by: Felix Fietkau err = mtk_foe_entry_commit(eth->ppe[entry->ppe_index], entry); if (err < 0) -@@ -520,25 +522,15 @@ mtk_flow_offload_stats(struct mtk_eth *e +@@ -522,25 +524,15 @@ mtk_flow_offload_stats(struct mtk_eth *e static DEFINE_MUTEX(mtk_flow_offload_mutex); @@ -73,7 +73,7 @@ Signed-off-by: Felix Fietkau break; case FLOW_CLS_DESTROY: err = mtk_flow_offload_destroy(eth, cls); -@@ -556,6 +548,23 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_ +@@ -558,6 +550,23 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_ } static int diff --git a/target/linux/generic/pending-5.15/736-04-net-ethernet-mediatek-fix-ppe-flow-accounting-for-L2.patch b/target/linux/generic/pending-5.15/736-04-net-ethernet-mediatek-fix-ppe-flow-accounting-for-L2.patch index 7f04fd9fa86..983b77d6097 100644 --- a/target/linux/generic/pending-5.15/736-04-net-ethernet-mediatek-fix-ppe-flow-accounting-for-L2.patch +++ b/target/linux/generic/pending-5.15/736-04-net-ethernet-mediatek-fix-ppe-flow-accounting-for-L2.patch @@ -308,7 +308,7 @@ Signed-off-by: Felix Fietkau seq_printf(m, "%05x %s %7s", i, --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c -@@ -499,24 +499,21 @@ static int +@@ -501,24 +501,21 @@ static int mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f) { struct mtk_flow_entry *entry; diff --git a/target/linux/generic/pending-5.15/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch b/target/linux/generic/pending-5.15/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch index 5b7591e2273..cc5cf935fd9 100644 --- a/target/linux/generic/pending-5.15/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch +++ b/target/linux/generic/pending-5.15/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch @@ -478,7 +478,7 @@ Signed-off-by: Daniel Golle static const struct phylink_mac_ops mtk_phylink_ops = { .validate = phylink_generic_validate, .mac_select_pcs = mtk_mac_select_pcs, -@@ -4558,8 +4672,21 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4559,8 +4673,21 @@ static int mtk_add_mac(struct mtk_eth *e phy_interface_zero(mac->phylink_config.supported_interfaces); __set_bit(PHY_INTERFACE_MODE_INTERNAL, mac->phylink_config.supported_interfaces); @@ -500,7 +500,7 @@ Signed-off-by: Daniel Golle phylink = phylink_create(&mac->phylink_config, of_fwnode_handle(mac->of_node), phy_mode, &mtk_phylink_ops); -@@ -4752,6 +4879,13 @@ static int mtk_probe(struct platform_dev +@@ -4753,6 +4880,13 @@ static int mtk_probe(struct platform_dev if (err) return err; diff --git a/target/linux/generic/pending-6.1/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch b/target/linux/generic/pending-6.1/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch index da7389689e5..c29aa970944 100644 --- a/target/linux/generic/pending-6.1/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch +++ b/target/linux/generic/pending-6.1/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3151,8 +3151,8 @@ static irqreturn_t mtk_handle_irq_rx(int +@@ -3152,8 +3152,8 @@ static irqreturn_t mtk_handle_irq_rx(int eth->rx_events++; if (likely(napi_schedule_prep(ð->rx_napi))) { @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau } return IRQ_HANDLED; -@@ -3164,8 +3164,8 @@ static irqreturn_t mtk_handle_irq_tx(int +@@ -3165,8 +3165,8 @@ static irqreturn_t mtk_handle_irq_tx(int eth->tx_events++; if (likely(napi_schedule_prep(ð->tx_napi))) { @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau } return IRQ_HANDLED; -@@ -4937,6 +4937,8 @@ static int mtk_probe(struct platform_dev +@@ -4938,6 +4938,8 @@ static int mtk_probe(struct platform_dev * for NAPI to work */ init_dummy_netdev(ð->dummy_dev); diff --git a/target/linux/generic/pending-6.1/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch b/target/linux/generic/pending-6.1/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch index 6790ebd94cf..bd883502d3f 100644 --- a/target/linux/generic/pending-6.1/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch +++ b/target/linux/generic/pending-6.1/732-03-net-ethernet-mtk_eth_soc-fix-remaining-throughput-re.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau switch (speed) { case SPEED_2500: case SPEED_1000: -@@ -3344,6 +3345,9 @@ found: +@@ -3345,6 +3346,9 @@ found: if (dp->index >= MTK_QDMA_NUM_QUEUES) return NOTIFY_DONE; diff --git a/target/linux/generic/pending-6.1/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch b/target/linux/generic/pending-6.1/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch index c29c63bb1da..4b97b3d47cb 100644 --- a/target/linux/generic/pending-6.1/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch +++ b/target/linux/generic/pending-6.1/736-01-net-ethernet-mtk_eth_soc-add-code-for-offloading-flo.patch @@ -31,7 +31,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c -@@ -235,7 +235,8 @@ out: +@@ -237,7 +237,8 @@ out: } static int @@ -41,7 +41,7 @@ Signed-off-by: Felix Fietkau { struct flow_rule *rule = flow_cls_offload_flow_rule(f); struct flow_action_entry *act; -@@ -452,6 +453,7 @@ mtk_flow_offload_replace(struct mtk_eth +@@ -454,6 +455,7 @@ mtk_flow_offload_replace(struct mtk_eth entry->cookie = f->cookie; memcpy(&entry->data, &foe, sizeof(entry->data)); entry->wed_index = wed_index; @@ -49,7 +49,7 @@ Signed-off-by: Felix Fietkau err = mtk_foe_entry_commit(eth->ppe[entry->ppe_index], entry); if (err < 0) -@@ -520,25 +522,15 @@ mtk_flow_offload_stats(struct mtk_eth *e +@@ -522,25 +524,15 @@ mtk_flow_offload_stats(struct mtk_eth *e static DEFINE_MUTEX(mtk_flow_offload_mutex); @@ -78,7 +78,7 @@ Signed-off-by: Felix Fietkau break; case FLOW_CLS_DESTROY: err = mtk_flow_offload_destroy(eth, cls); -@@ -556,6 +548,23 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_ +@@ -558,6 +550,23 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_ } static int diff --git a/target/linux/generic/pending-6.1/736-04-net-ethernet-mediatek-fix-ppe-flow-accounting-for-L2.patch b/target/linux/generic/pending-6.1/736-04-net-ethernet-mediatek-fix-ppe-flow-accounting-for-L2.patch index e323baeb184..d1c153c086b 100644 --- a/target/linux/generic/pending-6.1/736-04-net-ethernet-mediatek-fix-ppe-flow-accounting-for-L2.patch +++ b/target/linux/generic/pending-6.1/736-04-net-ethernet-mediatek-fix-ppe-flow-accounting-for-L2.patch @@ -308,7 +308,7 @@ Signed-off-by: Felix Fietkau seq_printf(m, "%05x %s %7s", i, --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c -@@ -499,24 +499,21 @@ static int +@@ -501,24 +501,21 @@ static int mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f) { struct mtk_flow_entry *entry; diff --git a/target/linux/generic/pending-6.1/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch b/target/linux/generic/pending-6.1/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch index 4a9b0889982..500fb550ba8 100644 --- a/target/linux/generic/pending-6.1/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch +++ b/target/linux/generic/pending-6.1/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch @@ -478,7 +478,7 @@ Signed-off-by: Daniel Golle static const struct phylink_mac_ops mtk_phylink_ops = { .validate = phylink_generic_validate, .mac_select_pcs = mtk_mac_select_pcs, -@@ -4612,8 +4726,21 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4613,8 +4727,21 @@ static int mtk_add_mac(struct mtk_eth *e phy_interface_zero(mac->phylink_config.supported_interfaces); __set_bit(PHY_INTERFACE_MODE_INTERNAL, mac->phylink_config.supported_interfaces); @@ -500,7 +500,7 @@ Signed-off-by: Daniel Golle phylink = phylink_create(&mac->phylink_config, of_fwnode_handle(mac->of_node), phy_mode, &mtk_phylink_ops); -@@ -4806,6 +4933,13 @@ static int mtk_probe(struct platform_dev +@@ -4807,6 +4934,13 @@ static int mtk_probe(struct platform_dev if (err) return err; diff --git a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch index c458237f390..632e66eab47 100644 --- a/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch +++ b/target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch @@ -14,7 +14,7 @@ Signed-off-by: René van Dorst --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4553,6 +4553,7 @@ static const struct net_device_ops mtk_n +@@ -4554,6 +4554,7 @@ static const struct net_device_ops mtk_n static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { @@ -22,7 +22,7 @@ Signed-off-by: René van Dorst const __be32 *_id = of_get_property(np, "reg", NULL); phy_interface_t phy_mode; struct phylink *phylink; -@@ -4724,6 +4725,9 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4725,6 +4726,9 @@ static int mtk_add_mac(struct mtk_eth *e register_netdevice_notifier(&mac->device_notifier); } From e648e3ccf9f9f468fc7534c2fb4aa2f381011af1 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 11 Sep 2023 18:54:04 +0200 Subject: [PATCH 22/32] mac80211: fix build regressions on linux 6.1 Signed-off-by: Felix Fietkau --- .../build/120-headers_version_fix.patch | 25 ++++++++++++++++++ .../patches/build/130-iommu_backport.patch | 26 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 package/kernel/mac80211/patches/build/120-headers_version_fix.patch create mode 100644 package/kernel/mac80211/patches/build/130-iommu_backport.patch diff --git a/package/kernel/mac80211/patches/build/120-headers_version_fix.patch b/package/kernel/mac80211/patches/build/120-headers_version_fix.patch new file mode 100644 index 00000000000..9a8c4749b2f --- /dev/null +++ b/package/kernel/mac80211/patches/build/120-headers_version_fix.patch @@ -0,0 +1,25 @@ +--- a/backport-include/linux/random.h ++++ b/backport-include/linux/random.h +@@ -23,7 +23,7 @@ static inline u16 get_random_u16(void) + } + #endif + +-#if LINUX_VERSION_IS_LESS(6,2,0) ++#if LINUX_VERSION_IS_LESS(6,1,4) + static inline u32 __get_random_u32_below(u32 ceil) + { + /* +--- a/backport-include/net/dropreason.h ++++ b/backport-include/net/dropreason.h +@@ -3,10 +3,9 @@ + + #include + ++#include + #if LINUX_VERSION_IS_GEQ(6,0,0) + #include_next +-#else +-#include + #endif + + #if LINUX_VERSION_IS_LESS(6,4,0) diff --git a/package/kernel/mac80211/patches/build/130-iommu_backport.patch b/package/kernel/mac80211/patches/build/130-iommu_backport.patch new file mode 100644 index 00000000000..2d3ef88d645 --- /dev/null +++ b/package/kernel/mac80211/patches/build/130-iommu_backport.patch @@ -0,0 +1,26 @@ +--- /dev/null ++++ b/backport-include/linux/iommu.h +@@ -0,0 +1,23 @@ ++#ifndef __BACKPORT_LINUX_IOMMU_H ++#define __BACKPORT_LINUX_IOMMU_H ++ ++#include_next ++#include ++ ++#if LINUX_VERSION_IS_LESS(6,3,0) ++ ++static inline int LINUX_BACKPORT(iommu_map)(struct iommu_domain *domain, ++ unsigned long iova, ++ phys_addr_t paddr, size_t size, ++ int prot, gfp_t gfp) ++{ ++ if (gfp == GFP_ATOMIC) ++ return iommu_map_atomic(domain, iova, paddr, size, prot); ++ ++ return iommu_map(domain, iova, paddr, size, prot); ++} ++#define iommu_map LINUX_BACKPORT(iommu_map) ++ ++#endif /* < 6.3 */ ++ ++#endif From 09d13cd8d87cc50fde67bbe81c6cca4b799b2724 Mon Sep 17 00:00:00 2001 From: Jonas Gorski Date: Sat, 9 Sep 2023 12:44:42 +0200 Subject: [PATCH 23/32] x86: geode: fix hwrng register accesses When the membase and pci_dev pointer were moved to a new struct in priv, the actual membase users were left untouched, and they started reading out arbitrary memory behind the struct instead of registers. This unfortunately turned the RNG into a constant number generator, depending on the content of what was at that offset. To fix this, update geode_rng_data_{read,present}() to also get the membase via amd_geode_priv, and properly read from the right addresses again. Closes #13417. Reported-by: Timur I. Davletshin Tested-by: Timur I. Davletshin Suggested-by: Jo-Philipp Wich Signed-off-by: Jonas Gorski --- ...-hwrng-geode-fix-accessing-registers.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 target/linux/x86/patches-5.15/120-hwrng-geode-fix-accessing-registers.patch diff --git a/target/linux/x86/patches-5.15/120-hwrng-geode-fix-accessing-registers.patch b/target/linux/x86/patches-5.15/120-hwrng-geode-fix-accessing-registers.patch new file mode 100644 index 00000000000..4c8015013bc --- /dev/null +++ b/target/linux/x86/patches-5.15/120-hwrng-geode-fix-accessing-registers.patch @@ -0,0 +1,47 @@ +From 859bd2e0c0052967536f3f902716f204d5a978b1 Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Fri, 8 Sep 2023 22:48:33 +0200 +Subject: [PATCH] hwrng: geode: fix accessing registers + +When the membase and pci_dev pointer were moved to a new struct in priv, +the actual membase users were left untouched, and they started reading +out arbitrary memory behind the struct instead of registers. This +unfortunately turned the RNG into a constant number generator, depending +on the content of what was at that offset. + +To fix this, update geode_rng_data_{read,present}() to also get the +membase via amd_geode_priv, and properly read from the right addresses +again. + +Fixes: 9f6ec8dc574e ("hwrng: geode - Fix PCI device refcount leak") +Reported-by: Timur I. Davletshin +Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217882 +Tested-by: Timur I. Davletshin +Suggested-by: Jo-Philipp Wich +Signed-off-by: Jonas Gorski +--- + drivers/char/hw_random/geode-rng.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/char/hw_random/geode-rng.c ++++ b/drivers/char/hw_random/geode-rng.c +@@ -58,7 +58,8 @@ struct amd_geode_priv { + + static int geode_rng_data_read(struct hwrng *rng, u32 *data) + { +- void __iomem *mem = (void __iomem *)rng->priv; ++ struct amd_geode_priv *priv = (struct amd_geode_priv *)rng->priv; ++ void __iomem *mem = priv->membase; + + *data = readl(mem + GEODE_RNG_DATA_REG); + +@@ -67,7 +68,8 @@ static int geode_rng_data_read(struct hw + + static int geode_rng_data_present(struct hwrng *rng, int wait) + { +- void __iomem *mem = (void __iomem *)rng->priv; ++ struct amd_geode_priv *priv = (struct amd_geode_priv *)rng->priv; ++ void __iomem *mem = priv->membase; + int data, i; + + for (i = 0; i < 20; i++) { From 42fda2f64ee072d9515da4cd2853240c45d8aaef Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 12 Sep 2023 11:18:35 +0200 Subject: [PATCH 24/32] mac80211: add missing dependency for iwlwifi Signed-off-by: Felix Fietkau --- package/kernel/mac80211/intel.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/mac80211/intel.mk b/package/kernel/mac80211/intel.mk index 8d374d73e74..f2aceb96cd5 100644 --- a/package/kernel/mac80211/intel.mk +++ b/package/kernel/mac80211/intel.mk @@ -6,7 +6,7 @@ config-$(CONFIG_PACKAGE_IWLWIFI_DEBUGFS)+= IWLWIFI_DEBUGFS define KernelPackage/iwlwifi $(call KernelPackage/mac80211/Default) - DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11AX_SUPPORT + DEPENDS:= +kmod-mac80211 +kmod-ptp @PCI_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11AX_SUPPORT TITLE:=Intel AGN Wireless support FILES:= \ $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \ From 36a9f8449c8c892dada8d313af4fcfc38a1ba08b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 12 Sep 2023 12:57:52 +0200 Subject: [PATCH 25/32] hostapd: fix applying gratuitous ARP settings with bridge-vlan The arp_accept setting needs to be applied to the snoop_iface Signed-off-by: Felix Fietkau --- .../hostapd/patches/740-snoop_iface.patch | 85 +++++++++++++++++-- 1 file changed, 79 insertions(+), 6 deletions(-) diff --git a/package/network/services/hostapd/patches/740-snoop_iface.patch b/package/network/services/hostapd/patches/740-snoop_iface.patch index 6b6cc0fad79..004b8a0d392 100644 --- a/package/network/services/hostapd/patches/740-snoop_iface.patch +++ b/package/network/services/hostapd/patches/740-snoop_iface.patch @@ -10,7 +10,7 @@ int bridge_hairpin; /* hairpin_mode on bridge members */ --- a/src/ap/x_snoop.c +++ b/src/ap/x_snoop.c -@@ -33,14 +33,16 @@ int x_snoop_init(struct hostapd_data *ha +@@ -33,28 +33,31 @@ int x_snoop_init(struct hostapd_data *ha hapd->x_snoop_initialized = true; @@ -29,13 +29,20 @@ wpa_printf(MSG_DEBUG, "x_snoop: Failed to enable proxyarp on the bridge port"); return -1; -@@ -54,7 +56,8 @@ int x_snoop_init(struct hostapd_data *ha + } + + if (hostapd_drv_br_set_net_param(hapd, DRV_BR_NET_PARAM_GARP_ACCEPT, +- 1)) { ++ conf->snoop_iface[0] ? conf->snoop_iface : NULL, 1)) { + wpa_printf(MSG_DEBUG, + "x_snoop: Failed to enable accepting gratuitous ARP on the bridge"); + return -1; } #ifdef CONFIG_IPV6 - if (hostapd_drv_br_set_net_param(hapd, DRV_BR_MULTICAST_SNOOPING, 1)) { + if (!conf->snoop_iface[0] && -+ hostapd_drv_br_set_net_param(hapd, DRV_BR_MULTICAST_SNOOPING, 1)) { ++ hostapd_drv_br_set_net_param(hapd, DRV_BR_MULTICAST_SNOOPING, NULL, 1)) { wpa_printf(MSG_DEBUG, "x_snoop: Failed to enable multicast snooping on the bridge"); return -1; @@ -44,15 +51,29 @@ struct hostapd_bss_config *conf = hapd->conf; struct l2_packet_data *l2; + const char *ifname = conf->bridge; - -- l2 = l2_packet_init(conf->bridge, NULL, ETH_P_ALL, handler, hapd, 1); ++ + if (conf->snoop_iface[0]) + ifname = conf->snoop_iface; -+ + +- l2 = l2_packet_init(conf->bridge, NULL, ETH_P_ALL, handler, hapd, 1); + l2 = l2_packet_init(ifname, NULL, ETH_P_ALL, handler, hapd, 1); if (l2 == NULL) { wpa_printf(MSG_DEBUG, "x_snoop: Failed to initialize L2 packet processing %s", +@@ -127,9 +134,12 @@ void x_snoop_mcast_to_ucast_convert_send + + void x_snoop_deinit(struct hostapd_data *hapd) + { ++ struct hostapd_bss_config *conf = hapd->conf; ++ + if (!hapd->x_snoop_initialized) + return; +- hostapd_drv_br_set_net_param(hapd, DRV_BR_NET_PARAM_GARP_ACCEPT, 0); ++ hostapd_drv_br_set_net_param(hapd, DRV_BR_NET_PARAM_GARP_ACCEPT, ++ conf->snoop_iface[0] ? conf->snoop_iface : NULL, 0); + hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_PROXYARP, 0); + hostapd_drv_br_port_set_attr(hapd, DRV_BR_PORT_ATTR_HAIRPIN_MODE, 0); + hapd->x_snoop_initialized = false; --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -2322,6 +2322,8 @@ static int hostapd_config_fill(struct ho @@ -64,3 +85,55 @@ } else if (os_strcmp(buf, "vlan_bridge") == 0) { os_strlcpy(bss->vlan_bridge, pos, sizeof(bss->vlan_bridge)); } else if (os_strcmp(buf, "wds_bridge") == 0) { +--- a/src/ap/ap_drv_ops.h ++++ b/src/ap/ap_drv_ops.h +@@ -366,12 +366,12 @@ static inline int hostapd_drv_br_port_se + + static inline int hostapd_drv_br_set_net_param(struct hostapd_data *hapd, + enum drv_br_net_param param, +- unsigned int val) ++ const char *ifname, unsigned int val) + { + if (hapd->driver == NULL || hapd->drv_priv == NULL || + hapd->driver->br_set_net_param == NULL) + return -1; +- return hapd->driver->br_set_net_param(hapd->drv_priv, param, val); ++ return hapd->driver->br_set_net_param(hapd->drv_priv, param, ifname, val); + } + + static inline int hostapd_drv_vendor_cmd(struct hostapd_data *hapd, +--- a/src/drivers/driver.h ++++ b/src/drivers/driver.h +@@ -4206,7 +4206,7 @@ struct wpa_driver_ops { + * Returns: 0 on success, negative (<0) on failure + */ + int (*br_set_net_param)(void *priv, enum drv_br_net_param param, +- unsigned int val); ++ const char *ifname, unsigned int val); + + /** + * get_wowlan - Get wake-on-wireless status +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -12127,7 +12127,7 @@ static const char * drv_br_net_param_str + + + static int wpa_driver_br_set_net_param(void *priv, enum drv_br_net_param param, +- unsigned int val) ++ const char *ifname, unsigned int val) + { + struct i802_bss *bss = priv; + char path[128]; +@@ -12153,8 +12153,11 @@ static int wpa_driver_br_set_net_param(v + return -EINVAL; + } + ++ if (!ifname) ++ ifname = bss->brname; ++ + os_snprintf(path, sizeof(path), "/proc/sys/net/ipv%d/conf/%s/%s", +- ip_version, bss->brname, param_txt); ++ ip_version, ifname, param_txt); + + set_val: + if (linux_write_system_file(path, val)) From ea1787b7bcf537ffddad9aae3aab8381942c24cc Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 12 Sep 2023 13:32:40 +0200 Subject: [PATCH 26/32] hostapd: clear ucode interface/bss resource pointers Avoids potential use-after-free bugs Signed-off-by: Felix Fietkau --- package/network/services/hostapd/src/src/utils/ucode.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/package/network/services/hostapd/src/src/utils/ucode.c b/package/network/services/hostapd/src/src/utils/ucode.c index 896ef46e1f6..2beeb9a7ff6 100644 --- a/package/network/services/hostapd/src/src/utils/ucode.c +++ b/package/network/services/hostapd/src/src/utils/ucode.c @@ -298,9 +298,15 @@ uc_value_t *wpa_ucode_registry_get(uc_value_t *reg, int idx) uc_value_t *wpa_ucode_registry_remove(uc_value_t *reg, int idx) { uc_value_t *val = wpa_ucode_registry_get(reg, idx); + void **dataptr; - if (val) - ucv_array_set(reg, idx - 1, NULL); + if (!val) + return NULL; + + ucv_array_set(reg, idx - 1, NULL); + dataptr = ucv_resource_dataptr(val, NULL); + if (dataptr) + *dataptr = NULL; return val; } From 499ca4cbe0ca2ee126c18a294f11d4c07a1699b4 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 12 Sep 2023 14:09:26 +0200 Subject: [PATCH 27/32] hostapd: fix bringing up AP in AP+mesh configurations Pass the correct frequency + secondary channel offset to hostapd Signed-off-by: Felix Fietkau --- .../services/hostapd/src/wpa_supplicant/ucode.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/package/network/services/hostapd/src/wpa_supplicant/ucode.c b/package/network/services/hostapd/src/wpa_supplicant/ucode.c index d120ed6217d..55d22584ff4 100644 --- a/package/network/services/hostapd/src/wpa_supplicant/ucode.c +++ b/package/network/services/hostapd/src/wpa_supplicant/ucode.c @@ -2,6 +2,7 @@ #include "utils/common.h" #include "utils/ucode.h" #include "drivers/driver.h" +#include "ap/hostapd.h" #include "wpa_supplicant_i.h" #include "wps_supplicant.h" #include "bss.h" @@ -225,6 +226,15 @@ uc_wpas_iface_status(uc_vm_t *vm, size_t nargs) ucv_object_add(ret, "frequency", ucv_int64_new(bss->freq)); } +#ifdef CONFIG_MESH + if (wpa_s->ifmsh) { + struct hostapd_iface *ifmsh = wpa_s->ifmsh; + + ucv_object_add(ret, "sec_chan_offset", ucv_int64_new(ifmsh->conf->secondary_channel)); + ucv_object_add(ret, "frequency", ucv_int64_new(ifmsh->freq)); + } +#endif + return ret; } From 47d56ae5463f1965750d3f75390c96d69f969145 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Fri, 8 Sep 2023 19:47:01 +0300 Subject: [PATCH 28/32] base-files: sysupgrade: Add 2 sec sleep into process KILL loop Add 2 seconds sleep after each forcibly killed/tried-to-kill process in the final process termination loop in sysupgrade stage2. This is needed especially for qualcommax/ipq807x, where ath11k wireless driver may have a long 10-20 seconds delay after termination before actually getting killed. This often breaks sysupgrade. The current KILL loop in kill_remaining does all 10 kill attempts consecutively without any delay, as evidenced here in a failing sysupgrade. It does not allow any time for the process to finalize its internal termination. Sat Sep 2 19:05:56 EEST 2023 upgrade: Sending TERM to remaining processes ... Sat Sep 2 19:05:56 EEST 2023 upgrade: Sending signal TERM to hostapd (2122) Sat Sep 2 19:05:56 EEST 2023 upgrade: Sending signal TERM to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending KILL to remaining processes ... Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2122) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Sending signal KILL to hostapd (2138) Sat Sep 2 19:06:00 EEST 2023 upgrade: Failed to kill all processes. sysupgrade aborted with return code: 256 The change in this commit adds a 2 seconds delay after each kill attempt in order to allow some processes to more gracefully handle their internal termination. The result is like this: Sun Sep 3 11:15:10 EEST 2023 upgrade: Sending TERM to remaining processes ... Sun Sep 3 11:15:10 EEST 2023 upgrade: Sending signal TERM to hostapd (2309) Sun Sep 3 11:15:10 EEST 2023 upgrade: Sending signal TERM to hostapd (2324) Sun Sep 3 11:15:14 EEST 2023 upgrade: Sending KILL to remaining processes ... Sun Sep 3 11:15:14 EEST 2023 upgrade: Sending signal KILL to hostapd (2309) [ 699.827521] br-lan: port 7(hn5wpa2r) entered disabled state [ 699.908673] device hn5wpa2r left promiscuous mode [ 699.908721] br-lan: port 7(hn5wpa2r) entered disabled state [ 701.038029] br-lan: port 6(hn5wpa3) entered disabled state Sun Sep 3 11:15:16 EEST 2023 upgrade: Sending signal KILL to hostapd (2324) [ 702.058256] br-lan: port 5(hn2wlan) entered disabled state [ 709.250063] stage2 (8237): drop_caches: 3 Sun Sep 3 11:15:25 EEST 2023 upgrade: Switching to ramdisk... The delay introduced here only kicks in if there is some process that does not get terminated by the first TERM call. Then there is at least one 2 sec wait after the first KILL loop round. This commit is related to discussion in PRs #12235 and #12632 Signed-off-by: Hannu Nyman Reviewed-by: Robert Marko --- package/base-files/files/lib/upgrade/stage2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2 index f4db88d31ea..5ce0b3549cf 100755 --- a/package/base-files/files/lib/upgrade/stage2 +++ b/package/base-files/files/lib/upgrade/stage2 @@ -121,7 +121,7 @@ kill_remaining() { # [ [ ] ] v "Sending signal $sig to $name ($pid)" kill -$sig $pid 2>/dev/null - [ $loop -eq 1 ] && run=true + [ $loop -eq 1 ] && sleep 2 && run=true done let loop_limit-- From 46d673033b7f6974d0bf5696ff8365fd412cd646 Mon Sep 17 00:00:00 2001 From: Aviana Cruz Date: Mon, 20 Jun 2022 21:55:45 +0800 Subject: [PATCH 29/32] ramips: add support for mtk eip93 crypto engine Mediatek EIP93 Crypto engine is a crypto accelerator which is available in the Mediatek MT7621 SoC. Signed-off-by: Aviana Cruz Co-authored-by: Richard van Schagen Co-authored-by: Chukun Pan --- package/kernel/linux/modules/crypto.mk | 29 + target/linux/ramips/dts/mt7621.dtsi | 8 + target/linux/ramips/mt7621/target.mk | 2 +- .../860-ramips-add-eip93-driver.patch | 3276 +++++++++++++++++ 4 files changed, 3314 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/patches-5.15/860-ramips-add-eip93-driver.patch diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index 248b4d68f9e..501be4b0a02 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -463,6 +463,35 @@ endef $(eval $(call KernelPackage,crypto-hw-talitos)) +define KernelPackage/crypto-hw-eip93 + TITLE:=MTK EIP93 crypto module + DEPENDS:=@TARGET_ramips_mt7621 \ + +kmod-crypto-authenc \ + +kmod-crypto-des \ + +kmod-crypto-md5 \ + +kmod-crypto-sha1 \ + +kmod-crypto-sha256 + KCONFIG:= \ + CONFIG_CRYPTO_HW=y \ + CONFIG_CRYPTO_DEV_EIP93 \ + CONFIG_CRYPTO_DEV_EIP93_AES=y \ + CONFIG_CRYPTO_DEV_EIP93_DES=y \ + CONFIG_CRYPTO_DEV_EIP93_AEAD=y \ + CONFIG_CRYPTO_DEV_EIP93_GENERIC_SW_MAX_LEN=256 \ + CONFIG_CRYPTO_DEV_EIP93_AES_128_SW_MAX_LEN=512 + FILES:=$(LINUX_DIR)/drivers/crypto/mtk-eip93/crypto-hw-eip93.ko + AUTOLOAD:=$(call AutoLoad,09,crypto-hw-eip93) + $(call AddDepends/crypto) +endef + +define KernelPackage/crypto-hw-eip93/description +Kernel module to enable EIP-93 Crypto engine as found +in the Mediatek MT7621 SoC. +It enables DES/3DES/AES ECB/CBC/CTR and +IPSEC offload with authenc(hmac(sha1/sha256), aes/cbc/rfc3686) +endef + +$(eval $(call KernelPackage,crypto-hw-eip93)) define KernelPackage/crypto-kpp TITLE:=Key-agreement Protocol Primitives diff --git a/target/linux/ramips/dts/mt7621.dtsi b/target/linux/ramips/dts/mt7621.dtsi index f1f77282b24..4d82aa327b5 100644 --- a/target/linux/ramips/dts/mt7621.dtsi +++ b/target/linux/ramips/dts/mt7621.dtsi @@ -423,6 +423,14 @@ clock-names = "nfi_clk"; }; + crypto: crypto@1e004000 { + compatible = "mediatek,mtk-eip93"; + reg = <0x1e004000 0x1000>; + + interrupt-parent = <&gic>; + interrupts = ; + }; + ethernet: ethernet@1e100000 { compatible = "mediatek,mt7621-eth"; reg = <0x1e100000 0x10000>; diff --git a/target/linux/ramips/mt7621/target.mk b/target/linux/ramips/mt7621/target.mk index 153ff08421d..2b9a1312af0 100644 --- a/target/linux/ramips/mt7621/target.mk +++ b/target/linux/ramips/mt7621/target.mk @@ -10,7 +10,7 @@ KERNELNAME:=vmlinux vmlinuz # make Kernel/CopyImage use $LINUX_DIR/vmlinuz IMAGES_DIR:=../../.. -DEFAULT_PACKAGES += wpad-basic-mbedtls uboot-envtools +DEFAULT_PACKAGES += wpad-basic-mbedtls uboot-envtools kmod-crypto-hw-eip93 define Target/Description Build firmware images for Ralink MT7621 based boards. diff --git a/target/linux/ramips/patches-5.15/860-ramips-add-eip93-driver.patch b/target/linux/ramips/patches-5.15/860-ramips-add-eip93-driver.patch new file mode 100644 index 00000000000..4008d5fe7c2 --- /dev/null +++ b/target/linux/ramips/patches-5.15/860-ramips-add-eip93-driver.patch @@ -0,0 +1,3276 @@ +--- /dev/null ++++ b/drivers/crypto/mtk-eip93/Kconfig +@@ -0,0 +1,64 @@ ++# SPDX-License-Identifier: GPL-2.0 ++config CRYPTO_DEV_EIP93_SKCIPHER ++ tristate ++ ++config CRYPTO_DEV_EIP93_HMAC ++ tristate ++ ++config CRYPTO_DEV_EIP93 ++ tristate "Support for EIP93 crypto HW accelerators" ++ depends on SOC_MT7621 || COMPILE_TEST ++ help ++ EIP93 have various crypto HW accelerators. Select this if ++ you want to use the EIP93 modules for any of the crypto algorithms. ++ ++if CRYPTO_DEV_EIP93 ++ ++config CRYPTO_DEV_EIP93_AES ++ bool "Register AES algorithm implementations with the Crypto API" ++ default y ++ select CRYPTO_DEV_EIP93_SKCIPHER ++ select CRYPTO_LIB_AES ++ select CRYPTO_SKCIPHER ++ help ++ Selecting this will offload AES - ECB, CBC and CTR crypto ++ to the EIP-93 crypto engine. ++ ++config CRYPTO_DEV_EIP93_DES ++ bool "Register legacy DES / 3DES algorithm with the Crypto API" ++ default y ++ select CRYPTO_DEV_EIP93_SKCIPHER ++ select CRYPTO_LIB_DES ++ select CRYPTO_SKCIPHER ++ help ++ Selecting this will offload DES and 3DES ECB and CBC ++ crypto to the EIP-93 crypto engine. ++ ++config CRYPTO_DEV_EIP93_AEAD ++ bool "Register AEAD algorithm with the Crypto API" ++ default y ++ select CRYPTO_DEV_EIP93_HMAC ++ select CRYPTO_AEAD ++ select CRYPTO_AUTHENC ++ select CRYPTO_MD5 ++ select CRYPTO_SHA1 ++ select CRYPTO_SHA256 ++ help ++ Selecting this will offload AEAD authenc(hmac(x), cipher(y)) ++ crypto to the EIP-93 crypto engine. ++ ++config CRYPTO_DEV_EIP93_GENERIC_SW_MAX_LEN ++ int "Max skcipher software fallback length" ++ default 256 ++ help ++ Max length of crypt request which ++ will fallback to software crypt of skcipher *except* AES-128. ++ ++config CRYPTO_DEV_EIP93_AES_128_SW_MAX_LEN ++ int "Max AES-128 skcipher software fallback length" ++ default 512 ++ help ++ Max length of crypt request which ++ will fallback to software crypt of AES-128 skcipher. ++ ++endif +--- /dev/null ++++ b/drivers/crypto/mtk-eip93/Makefile +@@ -0,0 +1,7 @@ ++obj-$(CONFIG_CRYPTO_DEV_EIP93) += crypto-hw-eip93.o ++ ++crypto-hw-eip93-y += eip93-main.o eip93-common.o ++ ++crypto-hw-eip93-$(CONFIG_CRYPTO_DEV_EIP93_SKCIPHER) += eip93-cipher.o ++crypto-hw-eip93-$(CONFIG_CRYPTO_DEV_EIP93_AEAD) += eip93-aead.o ++ +--- /dev/null ++++ b/drivers/crypto/mtk-eip93/eip93-aead.c +@@ -0,0 +1,768 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2019 - 2021 ++ * ++ * Richard van Schagen ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_DES) ++#include ++#endif ++ ++#include ++#include ++ ++#include "eip93-aead.h" ++#include "eip93-cipher.h" ++#include "eip93-common.h" ++#include "eip93-regs.h" ++ ++void mtk_aead_handle_result(struct crypto_async_request *async, int err) ++{ ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(async->tfm); ++ struct mtk_device *mtk = ctx->mtk; ++ struct aead_request *req = aead_request_cast(async); ++ struct mtk_cipher_reqctx *rctx = aead_request_ctx(req); ++ ++ mtk_unmap_dma(mtk, rctx, req->src, req->dst); ++ mtk_handle_result(mtk, rctx, req->iv); ++ ++ if (err == 1) ++ err = -EBADMSG; ++ /* let software handle anti-replay errors */ ++ if (err == 4) ++ err = 0; ++ ++ aead_request_complete(req, err); ++} ++ ++static int mtk_aead_send_req(struct crypto_async_request *async) ++{ ++ struct aead_request *req = aead_request_cast(async); ++ struct mtk_cipher_reqctx *rctx = aead_request_ctx(req); ++ int err; ++ ++ err = check_valid_request(rctx); ++ if (err) { ++ aead_request_complete(req, err); ++ return err; ++ } ++ ++ return mtk_send_req(async, req->iv, rctx); ++} ++ ++/* Crypto aead API functions */ ++static int mtk_aead_cra_init(struct crypto_tfm *tfm) ++{ ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(tfm); ++ struct mtk_alg_template *tmpl = container_of(tfm->__crt_alg, ++ struct mtk_alg_template, alg.aead.base); ++ u32 flags = tmpl->flags; ++ char *alg_base; ++ ++ crypto_aead_set_reqsize(__crypto_aead_cast(tfm), ++ sizeof(struct mtk_cipher_reqctx)); ++ ++ ctx->mtk = tmpl->mtk; ++ ctx->in_first = true; ++ ctx->out_first = true; ++ ++ ctx->sa_in = kzalloc(sizeof(struct saRecord_s), GFP_KERNEL); ++ if (!ctx->sa_in) ++ return -ENOMEM; ++ ++ ctx->sa_base_in = dma_map_single(ctx->mtk->dev, ctx->sa_in, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ ++ ctx->sa_out = kzalloc(sizeof(struct saRecord_s), GFP_KERNEL); ++ if (!ctx->sa_out) ++ return -ENOMEM; ++ ++ ctx->sa_base_out = dma_map_single(ctx->mtk->dev, ctx->sa_out, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ ++ /* software workaround for now */ ++ if (IS_HASH_MD5(flags)) ++ alg_base = "md5"; ++ if (IS_HASH_SHA1(flags)) ++ alg_base = "sha1"; ++ if (IS_HASH_SHA224(flags)) ++ alg_base = "sha224"; ++ if (IS_HASH_SHA256(flags)) ++ alg_base = "sha256"; ++ ++ ctx->shash = crypto_alloc_shash(alg_base, 0, CRYPTO_ALG_NEED_FALLBACK); ++ ++ if (IS_ERR(ctx->shash)) { ++ dev_err(ctx->mtk->dev, "base driver %s could not be loaded.\n", ++ alg_base); ++ return PTR_ERR(ctx->shash); ++ } ++ ++ return 0; ++} ++ ++static void mtk_aead_cra_exit(struct crypto_tfm *tfm) ++{ ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(tfm); ++ ++ if (ctx->shash) ++ crypto_free_shash(ctx->shash); ++ ++ dma_unmap_single(ctx->mtk->dev, ctx->sa_base_in, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ dma_unmap_single(ctx->mtk->dev, ctx->sa_base_out, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ kfree(ctx->sa_in); ++ kfree(ctx->sa_out); ++} ++ ++static int mtk_aead_setkey(struct crypto_aead *ctfm, const u8 *key, ++ unsigned int len) ++{ ++ struct crypto_tfm *tfm = crypto_aead_tfm(ctfm); ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(tfm); ++ struct mtk_alg_template *tmpl = container_of(tfm->__crt_alg, ++ struct mtk_alg_template, alg.skcipher.base); ++ u32 flags = tmpl->flags; ++ u32 nonce = 0; ++ struct crypto_authenc_keys keys; ++ struct crypto_aes_ctx aes; ++ struct saRecord_s *saRecord = ctx->sa_out; ++ int sa_size = sizeof(struct saRecord_s); ++ int err = -EINVAL; ++ ++ ++ if (crypto_authenc_extractkeys(&keys, key, len)) ++ return err; ++ ++ if (IS_RFC3686(flags)) { ++ if (keys.enckeylen < CTR_RFC3686_NONCE_SIZE) ++ return err; ++ ++ keys.enckeylen -= CTR_RFC3686_NONCE_SIZE; ++ memcpy(&nonce, keys.enckey + keys.enckeylen, ++ CTR_RFC3686_NONCE_SIZE); ++ } ++ ++ switch ((flags & MTK_ALG_MASK)) { ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_DES) ++ case MTK_ALG_DES: ++ err = verify_aead_des_key(ctfm, keys.enckey, keys.enckeylen); ++ break; ++ case MTK_ALG_3DES: ++ if (keys.enckeylen != DES3_EDE_KEY_SIZE) ++ return -EINVAL; ++ ++ err = verify_aead_des3_key(ctfm, keys.enckey, keys.enckeylen); ++ break; ++#endif ++ case MTK_ALG_AES: ++ err = aes_expandkey(&aes, keys.enckey, keys.enckeylen); ++ } ++ if (err) ++ return err; ++ ++ ctx->blksize = crypto_aead_blocksize(ctfm); ++ dma_unmap_single(ctx->mtk->dev, ctx->sa_base_in, sa_size, ++ DMA_TO_DEVICE); ++ ++ dma_unmap_single(ctx->mtk->dev, ctx->sa_base_out, sa_size, ++ DMA_TO_DEVICE); ++ /* Encryption key */ ++ mtk_set_saRecord(saRecord, keys.enckeylen, flags); ++ saRecord->saCmd0.bits.opCode = 1; ++ saRecord->saCmd0.bits.digestLength = ctx->authsize >> 2; ++ ++ memcpy(saRecord->saKey, keys.enckey, keys.enckeylen); ++ ctx->saNonce = nonce; ++ saRecord->saNonce = nonce; ++ ++ /* authentication key */ ++ err = mtk_authenc_setkey(ctx->shash, saRecord, keys.authkey, ++ keys.authkeylen); ++ ++ saRecord->saCmd0.bits.direction = 0; ++ memcpy(ctx->sa_in, saRecord, sa_size); ++ ctx->sa_in->saCmd0.bits.direction = 1; ++ ctx->sa_in->saCmd1.bits.copyDigest = 0; ++ ++ ctx->sa_base_out = dma_map_single(ctx->mtk->dev, ctx->sa_out, sa_size, ++ DMA_TO_DEVICE); ++ ctx->sa_base_in = dma_map_single(ctx->mtk->dev, ctx->sa_in, sa_size, ++ DMA_TO_DEVICE); ++ ctx->in_first = true; ++ ctx->out_first = true; ++ ++ return err; ++} ++ ++static int mtk_aead_setauthsize(struct crypto_aead *ctfm, ++ unsigned int authsize) ++{ ++ struct crypto_tfm *tfm = crypto_aead_tfm(ctfm); ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(tfm); ++ ++ dma_unmap_single(ctx->mtk->dev, ctx->sa_base_in, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ ++ dma_unmap_single(ctx->mtk->dev, ctx->sa_base_out, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ ++ ctx->authsize = authsize; ++ ctx->sa_in->saCmd0.bits.digestLength = ctx->authsize >> 2; ++ ctx->sa_out->saCmd0.bits.digestLength = ctx->authsize >> 2; ++ ++ ctx->sa_base_out = dma_map_single(ctx->mtk->dev, ctx->sa_out, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ ctx->sa_base_in = dma_map_single(ctx->mtk->dev, ctx->sa_in, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ return 0; ++} ++ ++static void mtk_aead_setassoc(struct mtk_crypto_ctx *ctx, ++ struct aead_request *req, bool in) ++{ ++ struct saRecord_s *saRecord; ++ ++ if (in) { ++ dma_unmap_single(ctx->mtk->dev, ctx->sa_base_in, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ saRecord = ctx->sa_in; ++ saRecord->saCmd1.bits.hashCryptOffset = req->assoclen >> 2; ++ ++ ctx->sa_base_in = dma_map_single(ctx->mtk->dev, ctx->sa_in, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ ctx->assoclen_in = req->assoclen; ++ } else { ++ dma_unmap_single(ctx->mtk->dev, ctx->sa_base_out, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ saRecord = ctx->sa_out; ++ saRecord->saCmd1.bits.hashCryptOffset = req->assoclen >> 2; ++ ++ ctx->sa_base_out = dma_map_single(ctx->mtk->dev, ctx->sa_out, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ ctx->assoclen_out = req->assoclen; ++ } ++} ++ ++static int mtk_aead_crypt(struct aead_request *req) ++{ ++ struct mtk_cipher_reqctx *rctx = aead_request_ctx(req); ++ struct crypto_async_request *async = &req->base; ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(req->base.tfm); ++ struct crypto_aead *aead = crypto_aead_reqtfm(req); ++ ++ rctx->textsize = req->cryptlen; ++ rctx->blksize = ctx->blksize; ++ rctx->assoclen = req->assoclen; ++ rctx->authsize = ctx->authsize; ++ rctx->sg_src = req->src; ++ rctx->sg_dst = req->dst; ++ rctx->ivsize = crypto_aead_ivsize(aead); ++ rctx->flags |= MTK_DESC_AEAD; ++ ++ if IS_DECRYPT(rctx->flags) ++ rctx->textsize -= rctx->authsize; ++ ++ return mtk_aead_send_req(async); ++} ++ ++static int mtk_aead_encrypt(struct aead_request *req) ++{ ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(req->base.tfm); ++ struct mtk_cipher_reqctx *rctx = aead_request_ctx(req); ++ struct mtk_alg_template *tmpl = container_of(req->base.tfm->__crt_alg, ++ struct mtk_alg_template, alg.aead.base); ++ ++ rctx->flags = tmpl->flags; ++ rctx->flags |= MTK_ENCRYPT; ++ if (ctx->out_first) { ++ mtk_aead_setassoc(ctx, req, false); ++ ctx->out_first = false; ++ } ++ ++ if (req->assoclen != ctx->assoclen_out) { ++ dev_err(ctx->mtk->dev, "Request AAD length error\n"); ++ return -EINVAL; ++ } ++ ++ rctx->saRecord_base = ctx->sa_base_out; ++ ++ return mtk_aead_crypt(req); ++} ++ ++static int mtk_aead_decrypt(struct aead_request *req) ++{ ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(req->base.tfm); ++ struct mtk_cipher_reqctx *rctx = aead_request_ctx(req); ++ struct mtk_alg_template *tmpl = container_of(req->base.tfm->__crt_alg, ++ struct mtk_alg_template, alg.aead.base); ++ ++ rctx->flags = tmpl->flags; ++ rctx->flags |= MTK_DECRYPT; ++ if (ctx->in_first) { ++ mtk_aead_setassoc(ctx, req, true); ++ ctx->in_first = false; ++ } ++ ++ if (req->assoclen != ctx->assoclen_in) { ++ dev_err(ctx->mtk->dev, "Request AAD length error\n"); ++ return -EINVAL; ++ } ++ ++ rctx->saRecord_base = ctx->sa_base_in; ++ ++ return mtk_aead_crypt(req); ++} ++ ++/* Available authenc algorithms in this module */ ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_AES) ++struct mtk_alg_template mtk_alg_authenc_hmac_md5_cbc_aes = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_MD5 | MTK_MODE_CBC | MTK_ALG_AES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = AES_BLOCK_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = MD5_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(md5),cbc(aes))", ++ .cra_driver_name = ++ "authenc(hmac(md5-eip93), cbc(aes-eip93))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = AES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_sha1_cbc_aes = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_SHA1 | MTK_MODE_CBC | MTK_ALG_AES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = AES_BLOCK_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = SHA1_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(sha1),cbc(aes))", ++ .cra_driver_name = ++ "authenc(hmac(sha1-eip93),cbc(aes-eip93))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = AES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_sha224_cbc_aes = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_SHA224 | MTK_MODE_CBC | MTK_ALG_AES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = AES_BLOCK_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = SHA224_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(sha224),cbc(aes))", ++ .cra_driver_name = ++ "authenc(hmac(sha224-eip93),cbc(aes-eip93))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = AES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_sha256_cbc_aes = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_SHA256 | MTK_MODE_CBC | MTK_ALG_AES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = AES_BLOCK_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = SHA256_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(sha256),cbc(aes))", ++ .cra_driver_name = ++ "authenc(hmac(sha256-eip93),cbc(aes-eip93))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = AES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_md5_rfc3686_aes = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_MD5 | ++ MTK_MODE_CTR | MTK_MODE_RFC3686 | MTK_ALG_AES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = CTR_RFC3686_IV_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = MD5_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(md5),rfc3686(ctr(aes)))", ++ .cra_driver_name = ++ "authenc(hmac(md5-eip93),rfc3686(ctr(aes-eip93)))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = 1, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_sha1_rfc3686_aes = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_SHA1 | ++ MTK_MODE_CTR | MTK_MODE_RFC3686 | MTK_ALG_AES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = CTR_RFC3686_IV_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = SHA1_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(sha1),rfc3686(ctr(aes)))", ++ .cra_driver_name = ++ "authenc(hmac(sha1-eip93),rfc3686(ctr(aes-eip93)))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = 1, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_sha224_rfc3686_aes = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_SHA224 | ++ MTK_MODE_CTR | MTK_MODE_RFC3686 | MTK_ALG_AES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = CTR_RFC3686_IV_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = SHA224_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(sha224),rfc3686(ctr(aes)))", ++ .cra_driver_name = ++ "authenc(hmac(sha224-eip93),rfc3686(ctr(aes-eip93)))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = 1, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_sha256_rfc3686_aes = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_SHA256 | ++ MTK_MODE_CTR | MTK_MODE_RFC3686 | MTK_ALG_AES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = CTR_RFC3686_IV_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = SHA256_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(sha256),rfc3686(ctr(aes)))", ++ .cra_driver_name = ++ "authenc(hmac(sha256-eip93),rfc3686(ctr(aes-eip93)))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = 1, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_DES) ++struct mtk_alg_template mtk_alg_authenc_hmac_md5_cbc_des = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_MD5 | MTK_MODE_CBC | MTK_ALG_DES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = DES_BLOCK_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = MD5_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(md5),cbc(des))", ++ .cra_driver_name = ++ "authenc(hmac(md5-eip93),cbc(des-eip93))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = DES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_sha1_cbc_des = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_SHA1 | MTK_MODE_CBC | MTK_ALG_DES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = DES_BLOCK_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = SHA1_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(sha1),cbc(des))", ++ .cra_driver_name = ++ "authenc(hmac(sha1-eip93),cbc(des-eip93))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = DES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_sha224_cbc_des = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_SHA224 | MTK_MODE_CBC | MTK_ALG_DES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = DES_BLOCK_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = SHA224_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(sha224),cbc(des))", ++ .cra_driver_name = ++ "authenc(hmac(sha224-eip93),cbc(des-eip93))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = DES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_sha256_cbc_des = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_SHA256 | MTK_MODE_CBC | MTK_ALG_DES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = DES_BLOCK_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = SHA256_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(sha256),cbc(des))", ++ .cra_driver_name = ++ "authenc(hmac(sha256-eip93),cbc(des-eip93))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = DES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_md5_cbc_des3_ede = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_MD5 | MTK_MODE_CBC | MTK_ALG_3DES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = DES3_EDE_BLOCK_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = MD5_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(md5),cbc(des3_ede))", ++ .cra_driver_name = ++ "authenc(hmac(md5-eip93),cbc(des3_ede-eip93))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = DES3_EDE_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0x0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_sha1_cbc_des3_ede = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_SHA1 | MTK_MODE_CBC | MTK_ALG_3DES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = DES3_EDE_BLOCK_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = SHA1_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(sha1),cbc(des3_ede))", ++ .cra_driver_name = ++ "authenc(hmac(sha1-eip93),cbc(des3_ede-eip93))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = DES3_EDE_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0x0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_sha224_cbc_des3_ede = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_SHA224 | MTK_MODE_CBC | MTK_ALG_3DES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = DES3_EDE_BLOCK_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = SHA224_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(sha224),cbc(des3_ede))", ++ .cra_driver_name = ++ "authenc(hmac(sha224-eip93),cbc(des3_ede-eip93))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = DES3_EDE_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0x0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_authenc_hmac_sha256_cbc_des3_ede = { ++ .type = MTK_ALG_TYPE_AEAD, ++ .flags = MTK_HASH_HMAC | MTK_HASH_SHA256 | MTK_MODE_CBC | MTK_ALG_3DES, ++ .alg.aead = { ++ .setkey = mtk_aead_setkey, ++ .encrypt = mtk_aead_encrypt, ++ .decrypt = mtk_aead_decrypt, ++ .ivsize = DES3_EDE_BLOCK_SIZE, ++ .setauthsize = mtk_aead_setauthsize, ++ .maxauthsize = SHA256_DIGEST_SIZE, ++ .base = { ++ .cra_name = "authenc(hmac(sha256),cbc(des3_ede))", ++ .cra_driver_name = ++ "authenc(hmac(sha256-eip93),cbc(des3_ede-eip93))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = DES3_EDE_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0x0, ++ .cra_init = mtk_aead_cra_init, ++ .cra_exit = mtk_aead_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++#endif +--- /dev/null ++++ b/drivers/crypto/mtk-eip93/eip93-aead.h +@@ -0,0 +1,31 @@ ++/* SPDX-License-Identifier: GPL-2.0 ++ * ++ * Copyright (C) 2019 - 2021 ++ * ++ * Richard van Schagen ++ */ ++#ifndef _EIP93_AEAD_H_ ++#define _EIP93_AEAD_H_ ++ ++extern struct mtk_alg_template mtk_alg_authenc_hmac_md5_cbc_aes; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_sha1_cbc_aes; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_sha224_cbc_aes; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_sha256_cbc_aes; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_md5_rfc3686_aes; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_sha1_rfc3686_aes; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_sha224_rfc3686_aes; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_sha256_rfc3686_aes; ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_DES) ++extern struct mtk_alg_template mtk_alg_authenc_hmac_md5_cbc_des; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_sha1_cbc_des; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_sha224_cbc_des; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_sha256_cbc_des; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_md5_cbc_des3_ede; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_sha1_cbc_des3_ede; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_sha224_cbc_des3_ede; ++extern struct mtk_alg_template mtk_alg_authenc_hmac_sha256_cbc_des3_ede; ++#endif ++ ++void mtk_aead_handle_result(struct crypto_async_request *async, int err); ++ ++#endif /* _EIP93_AEAD_H_ */ +--- /dev/null ++++ b/drivers/crypto/mtk-eip93/eip93-aes.h +@@ -0,0 +1,15 @@ ++/* SPDX-License-Identifier: GPL-2.0 ++ * ++ * Copyright (C) 2019 - 2021 ++ * ++ * Richard van Schagen ++ */ ++#ifndef _EIP93_AES_H_ ++#define _EIP93_AES_H_ ++ ++extern struct mtk_alg_template mtk_alg_ecb_aes; ++extern struct mtk_alg_template mtk_alg_cbc_aes; ++extern struct mtk_alg_template mtk_alg_ctr_aes; ++extern struct mtk_alg_template mtk_alg_rfc3686_aes; ++ ++#endif /* _EIP93_AES_H_ */ +--- /dev/null ++++ b/drivers/crypto/mtk-eip93/eip93-cipher.c +@@ -0,0 +1,483 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2019 - 2021 ++ * ++ * Richard van Schagen ++ */ ++ ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_AES) ++#include ++#include ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_DES) ++#include ++#endif ++#include ++ ++#include "eip93-cipher.h" ++#include "eip93-common.h" ++#include "eip93-regs.h" ++ ++void mtk_skcipher_handle_result(struct crypto_async_request *async, int err) ++{ ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(async->tfm); ++ struct mtk_device *mtk = ctx->mtk; ++ struct skcipher_request *req = skcipher_request_cast(async); ++ struct mtk_cipher_reqctx *rctx = skcipher_request_ctx(req); ++ ++ mtk_unmap_dma(mtk, rctx, req->src, req->dst); ++ mtk_handle_result(mtk, rctx, req->iv); ++ ++ skcipher_request_complete(req, err); ++} ++ ++static inline bool mtk_skcipher_is_fallback(const struct crypto_tfm *tfm, ++ u32 flags) ++{ ++ return (tfm->__crt_alg->cra_flags & CRYPTO_ALG_NEED_FALLBACK) && ++ !IS_RFC3686(flags); ++} ++ ++static int mtk_skcipher_send_req(struct crypto_async_request *async) ++{ ++ struct skcipher_request *req = skcipher_request_cast(async); ++ struct mtk_cipher_reqctx *rctx = skcipher_request_ctx(req); ++ int err; ++ ++ err = check_valid_request(rctx); ++ ++ if (err) { ++ skcipher_request_complete(req, err); ++ return err; ++ } ++ ++ return mtk_send_req(async, req->iv, rctx); ++} ++ ++/* Crypto skcipher API functions */ ++static int mtk_skcipher_cra_init(struct crypto_tfm *tfm) ++{ ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(tfm); ++ struct mtk_alg_template *tmpl = container_of(tfm->__crt_alg, ++ struct mtk_alg_template, alg.skcipher.base); ++ bool fallback = mtk_skcipher_is_fallback(tfm, tmpl->flags); ++ ++ if (fallback) { ++ ctx->fallback = crypto_alloc_skcipher( ++ crypto_tfm_alg_name(tfm), 0, CRYPTO_ALG_NEED_FALLBACK); ++ if (IS_ERR(ctx->fallback)) ++ return PTR_ERR(ctx->fallback); ++ } ++ ++ crypto_skcipher_set_reqsize( ++ __crypto_skcipher_cast(tfm), ++ sizeof(struct mtk_cipher_reqctx) + ++ (fallback ? crypto_skcipher_reqsize(ctx->fallback) : ++ 0)); ++ ++ ctx->mtk = tmpl->mtk; ++ ++ ctx->sa_in = kzalloc(sizeof(struct saRecord_s), GFP_KERNEL); ++ if (!ctx->sa_in) ++ return -ENOMEM; ++ ++ ctx->sa_base_in = dma_map_single(ctx->mtk->dev, ctx->sa_in, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ ++ ctx->sa_out = kzalloc(sizeof(struct saRecord_s), GFP_KERNEL); ++ if (!ctx->sa_out) ++ return -ENOMEM; ++ ++ ctx->sa_base_out = dma_map_single(ctx->mtk->dev, ctx->sa_out, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ return 0; ++} ++ ++static void mtk_skcipher_cra_exit(struct crypto_tfm *tfm) ++{ ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(tfm); ++ ++ dma_unmap_single(ctx->mtk->dev, ctx->sa_base_in, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ dma_unmap_single(ctx->mtk->dev, ctx->sa_base_out, ++ sizeof(struct saRecord_s), DMA_TO_DEVICE); ++ kfree(ctx->sa_in); ++ kfree(ctx->sa_out); ++ ++ crypto_free_skcipher(ctx->fallback); ++} ++ ++static int mtk_skcipher_setkey(struct crypto_skcipher *ctfm, const u8 *key, ++ unsigned int len) ++{ ++ struct crypto_tfm *tfm = crypto_skcipher_tfm(ctfm); ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(tfm); ++ struct mtk_alg_template *tmpl = container_of(tfm->__crt_alg, ++ struct mtk_alg_template, alg.skcipher.base); ++ struct saRecord_s *saRecord = ctx->sa_out; ++ u32 flags = tmpl->flags; ++ u32 nonce = 0; ++ unsigned int keylen = len; ++ int sa_size = sizeof(struct saRecord_s); ++ int err = -EINVAL; ++ ++ if (!key || !keylen) ++ return err; ++ ++ ctx->keylen = keylen; ++ ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_AES) ++ if (IS_RFC3686(flags)) { ++ if (len < CTR_RFC3686_NONCE_SIZE) ++ return err; ++ ++ keylen = len - CTR_RFC3686_NONCE_SIZE; ++ memcpy(&nonce, key + keylen, CTR_RFC3686_NONCE_SIZE); ++ } ++#endif ++ ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_DES) ++ if (flags & MTK_ALG_DES) { ++ ctx->blksize = DES_BLOCK_SIZE; ++ err = verify_skcipher_des_key(ctfm, key); ++ } ++ if (flags & MTK_ALG_3DES) { ++ ctx->blksize = DES3_EDE_BLOCK_SIZE; ++ err = verify_skcipher_des3_key(ctfm, key); ++ } ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_AES) ++ if (flags & MTK_ALG_AES) { ++ struct crypto_aes_ctx aes; ++ bool fallback = mtk_skcipher_is_fallback(tfm, flags); ++ ++ if (fallback && !IS_RFC3686(flags)) { ++ err = crypto_skcipher_setkey(ctx->fallback, key, ++ keylen); ++ if (err) ++ return err; ++ } ++ ++ ctx->blksize = AES_BLOCK_SIZE; ++ err = aes_expandkey(&aes, key, keylen); ++ } ++#endif ++ if (err) ++ return err; ++ ++ dma_unmap_single(ctx->mtk->dev, ctx->sa_base_in, sa_size, ++ DMA_TO_DEVICE); ++ ++ dma_unmap_single(ctx->mtk->dev, ctx->sa_base_out, sa_size, ++ DMA_TO_DEVICE); ++ ++ mtk_set_saRecord(saRecord, keylen, flags); ++ ++ memcpy(saRecord->saKey, key, keylen); ++ ctx->saNonce = nonce; ++ saRecord->saNonce = nonce; ++ saRecord->saCmd0.bits.direction = 0; ++ ++ memcpy(ctx->sa_in, saRecord, sa_size); ++ ctx->sa_in->saCmd0.bits.direction = 1; ++ ++ ctx->sa_base_out = dma_map_single(ctx->mtk->dev, ctx->sa_out, sa_size, ++ DMA_TO_DEVICE); ++ ++ ctx->sa_base_in = dma_map_single(ctx->mtk->dev, ctx->sa_in, sa_size, ++ DMA_TO_DEVICE); ++ return err; ++} ++ ++static int mtk_skcipher_crypt(struct skcipher_request *req, bool encrypt) ++{ ++ struct mtk_cipher_reqctx *rctx = skcipher_request_ctx(req); ++ struct crypto_async_request *async = &req->base; ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(req->base.tfm); ++ struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req); ++ bool fallback = mtk_skcipher_is_fallback(req->base.tfm, rctx->flags); ++ ++ if (!req->cryptlen) ++ return 0; ++ ++ /* ++ * ECB and CBC algorithms require message lengths to be ++ * multiples of block size. ++ */ ++ if (IS_ECB(rctx->flags) || IS_CBC(rctx->flags)) ++ if (!IS_ALIGNED(req->cryptlen, ++ crypto_skcipher_blocksize(skcipher))) ++ return -EINVAL; ++ ++ if (fallback && ++ req->cryptlen <= (AES_KEYSIZE_128 ? ++ CONFIG_CRYPTO_DEV_EIP93_AES_128_SW_MAX_LEN : ++ CONFIG_CRYPTO_DEV_EIP93_GENERIC_SW_MAX_LEN)) { ++ skcipher_request_set_tfm(&rctx->fallback_req, ctx->fallback); ++ skcipher_request_set_callback(&rctx->fallback_req, ++ req->base.flags, ++ req->base.complete, ++ req->base.data); ++ skcipher_request_set_crypt(&rctx->fallback_req, req->src, ++ req->dst, req->cryptlen, req->iv); ++ return encrypt ? crypto_skcipher_encrypt(&rctx->fallback_req) : ++ crypto_skcipher_decrypt(&rctx->fallback_req); ++ } ++ ++ rctx->assoclen = 0; ++ rctx->textsize = req->cryptlen; ++ rctx->authsize = 0; ++ rctx->sg_src = req->src; ++ rctx->sg_dst = req->dst; ++ rctx->ivsize = crypto_skcipher_ivsize(skcipher); ++ rctx->blksize = ctx->blksize; ++ rctx->flags |= MTK_DESC_SKCIPHER; ++ if (!IS_ECB(rctx->flags)) ++ rctx->flags |= MTK_DESC_DMA_IV; ++ ++ return mtk_skcipher_send_req(async); ++} ++ ++static int mtk_skcipher_encrypt(struct skcipher_request *req) ++{ ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(req->base.tfm); ++ struct mtk_cipher_reqctx *rctx = skcipher_request_ctx(req); ++ struct mtk_alg_template *tmpl = container_of(req->base.tfm->__crt_alg, ++ struct mtk_alg_template, alg.skcipher.base); ++ ++ rctx->flags = tmpl->flags; ++ rctx->flags |= MTK_ENCRYPT; ++ rctx->saRecord_base = ctx->sa_base_out; ++ ++ return mtk_skcipher_crypt(req, true); ++} ++ ++static int mtk_skcipher_decrypt(struct skcipher_request *req) ++{ ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(req->base.tfm); ++ struct mtk_cipher_reqctx *rctx = skcipher_request_ctx(req); ++ struct mtk_alg_template *tmpl = container_of(req->base.tfm->__crt_alg, ++ struct mtk_alg_template, alg.skcipher.base); ++ ++ rctx->flags = tmpl->flags; ++ rctx->flags |= MTK_DECRYPT; ++ rctx->saRecord_base = ctx->sa_base_in; ++ ++ return mtk_skcipher_crypt(req, false); ++} ++ ++/* Available algorithms in this module */ ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_AES) ++struct mtk_alg_template mtk_alg_ecb_aes = { ++ .type = MTK_ALG_TYPE_SKCIPHER, ++ .flags = MTK_MODE_ECB | MTK_ALG_AES, ++ .alg.skcipher = { ++ .setkey = mtk_skcipher_setkey, ++ .encrypt = mtk_skcipher_encrypt, ++ .decrypt = mtk_skcipher_decrypt, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ .ivsize = 0, ++ .base = { ++ .cra_name = "ecb(aes)", ++ .cra_driver_name = "ecb(aes-eip93)", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_NEED_FALLBACK | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = AES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0xf, ++ .cra_init = mtk_skcipher_cra_init, ++ .cra_exit = mtk_skcipher_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_cbc_aes = { ++ .type = MTK_ALG_TYPE_SKCIPHER, ++ .flags = MTK_MODE_CBC | MTK_ALG_AES, ++ .alg.skcipher = { ++ .setkey = mtk_skcipher_setkey, ++ .encrypt = mtk_skcipher_encrypt, ++ .decrypt = mtk_skcipher_decrypt, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ .ivsize = AES_BLOCK_SIZE, ++ .base = { ++ .cra_name = "cbc(aes)", ++ .cra_driver_name = "cbc(aes-eip93)", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_NEED_FALLBACK | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = AES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0xf, ++ .cra_init = mtk_skcipher_cra_init, ++ .cra_exit = mtk_skcipher_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_ctr_aes = { ++ .type = MTK_ALG_TYPE_SKCIPHER, ++ .flags = MTK_MODE_CTR | MTK_ALG_AES, ++ .alg.skcipher = { ++ .setkey = mtk_skcipher_setkey, ++ .encrypt = mtk_skcipher_encrypt, ++ .decrypt = mtk_skcipher_decrypt, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ .ivsize = AES_BLOCK_SIZE, ++ .base = { ++ .cra_name = "ctr(aes)", ++ .cra_driver_name = "ctr(aes-eip93)", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_NEED_FALLBACK | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = 1, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0xf, ++ .cra_init = mtk_skcipher_cra_init, ++ .cra_exit = mtk_skcipher_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_rfc3686_aes = { ++ .type = MTK_ALG_TYPE_SKCIPHER, ++ .flags = MTK_MODE_CTR | MTK_MODE_RFC3686 | MTK_ALG_AES, ++ .alg.skcipher = { ++ .setkey = mtk_skcipher_setkey, ++ .encrypt = mtk_skcipher_encrypt, ++ .decrypt = mtk_skcipher_decrypt, ++ .min_keysize = AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE + CTR_RFC3686_NONCE_SIZE, ++ .ivsize = CTR_RFC3686_IV_SIZE, ++ .base = { ++ .cra_name = "rfc3686(ctr(aes))", ++ .cra_driver_name = "rfc3686(ctr(aes-eip93))", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_NEED_FALLBACK | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = 1, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0xf, ++ .cra_init = mtk_skcipher_cra_init, ++ .cra_exit = mtk_skcipher_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_DES) ++struct mtk_alg_template mtk_alg_ecb_des = { ++ .type = MTK_ALG_TYPE_SKCIPHER, ++ .flags = MTK_MODE_ECB | MTK_ALG_DES, ++ .alg.skcipher = { ++ .setkey = mtk_skcipher_setkey, ++ .encrypt = mtk_skcipher_encrypt, ++ .decrypt = mtk_skcipher_decrypt, ++ .min_keysize = DES_KEY_SIZE, ++ .max_keysize = DES_KEY_SIZE, ++ .ivsize = 0, ++ .base = { ++ .cra_name = "ecb(des)", ++ .cra_driver_name = "ebc(des-eip93)", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = DES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_skcipher_cra_init, ++ .cra_exit = mtk_skcipher_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_cbc_des = { ++ .type = MTK_ALG_TYPE_SKCIPHER, ++ .flags = MTK_MODE_CBC | MTK_ALG_DES, ++ .alg.skcipher = { ++ .setkey = mtk_skcipher_setkey, ++ .encrypt = mtk_skcipher_encrypt, ++ .decrypt = mtk_skcipher_decrypt, ++ .min_keysize = DES_KEY_SIZE, ++ .max_keysize = DES_KEY_SIZE, ++ .ivsize = DES_BLOCK_SIZE, ++ .base = { ++ .cra_name = "cbc(des)", ++ .cra_driver_name = "cbc(des-eip93)", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = DES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_skcipher_cra_init, ++ .cra_exit = mtk_skcipher_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_ecb_des3_ede = { ++ .type = MTK_ALG_TYPE_SKCIPHER, ++ .flags = MTK_MODE_ECB | MTK_ALG_3DES, ++ .alg.skcipher = { ++ .setkey = mtk_skcipher_setkey, ++ .encrypt = mtk_skcipher_encrypt, ++ .decrypt = mtk_skcipher_decrypt, ++ .min_keysize = DES3_EDE_KEY_SIZE, ++ .max_keysize = DES3_EDE_KEY_SIZE, ++ .ivsize = 0, ++ .base = { ++ .cra_name = "ecb(des3_ede)", ++ .cra_driver_name = "ecb(des3_ede-eip93)", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = DES3_EDE_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_skcipher_cra_init, ++ .cra_exit = mtk_skcipher_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++ ++struct mtk_alg_template mtk_alg_cbc_des3_ede = { ++ .type = MTK_ALG_TYPE_SKCIPHER, ++ .flags = MTK_MODE_CBC | MTK_ALG_3DES, ++ .alg.skcipher = { ++ .setkey = mtk_skcipher_setkey, ++ .encrypt = mtk_skcipher_encrypt, ++ .decrypt = mtk_skcipher_decrypt, ++ .min_keysize = DES3_EDE_KEY_SIZE, ++ .max_keysize = DES3_EDE_KEY_SIZE, ++ .ivsize = DES3_EDE_BLOCK_SIZE, ++ .base = { ++ .cra_name = "cbc(des3_ede)", ++ .cra_driver_name = "cbc(des3_ede-eip93)", ++ .cra_priority = MTK_CRA_PRIORITY, ++ .cra_flags = CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = DES3_EDE_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct mtk_crypto_ctx), ++ .cra_alignmask = 0, ++ .cra_init = mtk_skcipher_cra_init, ++ .cra_exit = mtk_skcipher_cra_exit, ++ .cra_module = THIS_MODULE, ++ }, ++ }, ++}; ++#endif +--- /dev/null ++++ b/drivers/crypto/mtk-eip93/eip93-cipher.h +@@ -0,0 +1,66 @@ ++/* SPDX-License-Identifier: GPL-2.0 ++ * ++ * Copyright (C) 2019 - 2021 ++ * ++ * Richard van Schagen ++ */ ++#ifndef _EIP93_CIPHER_H_ ++#define _EIP93_CIPHER_H_ ++ ++#include "eip93-main.h" ++ ++struct mtk_crypto_ctx { ++ struct mtk_device *mtk; ++ struct saRecord_s *sa_in; ++ dma_addr_t sa_base_in; ++ struct saRecord_s *sa_out; ++ dma_addr_t sa_base_out; ++ uint32_t saNonce; ++ int blksize; ++ /* AEAD specific */ ++ unsigned int authsize; ++ unsigned int assoclen_in; ++ unsigned int assoclen_out; ++ bool in_first; ++ bool out_first; ++ struct crypto_shash *shash; ++ unsigned int keylen; ++ struct crypto_skcipher *fallback; ++}; ++ ++struct mtk_cipher_reqctx { ++ unsigned long flags; ++ unsigned int blksize; ++ unsigned int ivsize; ++ unsigned int textsize; ++ unsigned int assoclen; ++ unsigned int authsize; ++ dma_addr_t saRecord_base; ++ struct saState_s *saState; ++ dma_addr_t saState_base; ++ uint32_t saState_idx; ++ struct eip93_descriptor_s *cdesc; ++ struct scatterlist *sg_src; ++ struct scatterlist *sg_dst; ++ int src_nents; ++ int dst_nents; ++ struct saState_s *saState_ctr; ++ dma_addr_t saState_base_ctr; ++ uint32_t saState_ctr_idx; ++ struct skcipher_request fallback_req; // keep at the end ++}; ++ ++int check_valid_request(struct mtk_cipher_reqctx *rctx); ++ ++void mtk_unmap_dma(struct mtk_device *mtk, struct mtk_cipher_reqctx *rctx, ++ struct scatterlist *reqsrc, struct scatterlist *reqdst); ++ ++void mtk_skcipher_handle_result(struct crypto_async_request *async, int err); ++ ++int mtk_send_req(struct crypto_async_request *async, ++ const u8 *reqiv, struct mtk_cipher_reqctx *rctx); ++ ++void mtk_handle_result(struct mtk_device *mtk, struct mtk_cipher_reqctx *rctx, ++ u8 *reqiv); ++ ++#endif /* _EIP93_CIPHER_H_ */ +--- /dev/null ++++ b/drivers/crypto/mtk-eip93/eip93-common.c +@@ -0,0 +1,749 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2019 - 2021 ++ * ++ * Richard van Schagen ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "eip93-cipher.h" ++#include "eip93-common.h" ++#include "eip93-main.h" ++#include "eip93-regs.h" ++ ++inline void *mtk_ring_next_wptr(struct mtk_device *mtk, ++ struct mtk_desc_ring *ring) ++{ ++ void *ptr = ring->write; ++ ++ if ((ring->write == ring->read - ring->offset) || ++ (ring->read == ring->base && ring->write == ring->base_end)) ++ return ERR_PTR(-ENOMEM); ++ ++ if (ring->write == ring->base_end) ++ ring->write = ring->base; ++ else ++ ring->write += ring->offset; ++ ++ return ptr; ++} ++ ++inline void *mtk_ring_next_rptr(struct mtk_device *mtk, ++ struct mtk_desc_ring *ring) ++{ ++ void *ptr = ring->read; ++ ++ if (ring->write == ring->read) ++ return ERR_PTR(-ENOENT); ++ ++ if (ring->read == ring->base_end) ++ ring->read = ring->base; ++ else ++ ring->read += ring->offset; ++ ++ return ptr; ++} ++ ++inline int mtk_put_descriptor(struct mtk_device *mtk, ++ struct eip93_descriptor_s *desc) ++{ ++ struct eip93_descriptor_s *cdesc; ++ struct eip93_descriptor_s *rdesc; ++ unsigned long irqflags; ++ ++ spin_lock_irqsave(&mtk->ring->write_lock, irqflags); ++ ++ rdesc = mtk_ring_next_wptr(mtk, &mtk->ring->rdr); ++ ++ if (IS_ERR(rdesc)) { ++ spin_unlock_irqrestore(&mtk->ring->write_lock, irqflags); ++ return -ENOENT; ++ } ++ ++ cdesc = mtk_ring_next_wptr(mtk, &mtk->ring->cdr); ++ ++ if (IS_ERR(cdesc)) { ++ spin_unlock_irqrestore(&mtk->ring->write_lock, irqflags); ++ return -ENOENT; ++ } ++ ++ memset(rdesc, 0, sizeof(struct eip93_descriptor_s)); ++ memcpy(cdesc, desc, sizeof(struct eip93_descriptor_s)); ++ ++ atomic_dec(&mtk->ring->free); ++ spin_unlock_irqrestore(&mtk->ring->write_lock, irqflags); ++ ++ return 0; ++} ++ ++inline void *mtk_get_descriptor(struct mtk_device *mtk) ++{ ++ struct eip93_descriptor_s *cdesc; ++ void *ptr; ++ unsigned long irqflags; ++ ++ spin_lock_irqsave(&mtk->ring->read_lock, irqflags); ++ ++ cdesc = mtk_ring_next_rptr(mtk, &mtk->ring->cdr); ++ ++ if (IS_ERR(cdesc)) { ++ spin_unlock_irqrestore(&mtk->ring->read_lock, irqflags); ++ return ERR_PTR(-ENOENT); ++ } ++ ++ memset(cdesc, 0, sizeof(struct eip93_descriptor_s)); ++ ++ ptr = mtk_ring_next_rptr(mtk, &mtk->ring->rdr); ++ if (IS_ERR(ptr)) { ++ spin_unlock_irqrestore(&mtk->ring->read_lock, irqflags); ++ return ERR_PTR(-ENOENT); ++ } ++ ++ atomic_inc(&mtk->ring->free); ++ spin_unlock_irqrestore(&mtk->ring->read_lock, irqflags); ++ ++ return ptr; ++} ++ ++inline int mtk_get_free_saState(struct mtk_device *mtk) ++{ ++ struct mtk_state_pool *saState_pool; ++ int i; ++ ++ for (i = 0; i < MTK_RING_SIZE; i++) { ++ saState_pool = &mtk->ring->saState_pool[i]; ++ if (saState_pool->in_use == false) { ++ saState_pool->in_use = true; ++ return i; ++ } ++ ++ } ++ ++ return -ENOENT; ++} ++ ++static inline void mtk_free_sg_copy(const int len, struct scatterlist **sg) ++{ ++ if (!*sg || !len) ++ return; ++ ++ free_pages((unsigned long)sg_virt(*sg), get_order(len)); ++ kfree(*sg); ++ *sg = NULL; ++} ++ ++static inline int mtk_make_sg_copy(struct scatterlist *src, ++ struct scatterlist **dst, ++ const uint32_t len, const bool copy) ++{ ++ void *pages; ++ ++ *dst = kmalloc(sizeof(**dst), GFP_KERNEL); ++ if (!*dst) ++ return -ENOMEM; ++ ++ ++ pages = (void *)__get_free_pages(GFP_KERNEL | GFP_DMA, ++ get_order(len)); ++ ++ if (!pages) { ++ kfree(*dst); ++ *dst = NULL; ++ return -ENOMEM; ++ } ++ ++ sg_init_table(*dst, 1); ++ sg_set_buf(*dst, pages, len); ++ ++ /* copy only as requested */ ++ if (copy) ++ sg_copy_to_buffer(src, sg_nents(src), pages, len); ++ ++ return 0; ++} ++ ++static inline bool mtk_is_sg_aligned(struct scatterlist *sg, u32 len, ++ const int blksize) ++{ ++ int nents; ++ ++ for (nents = 0; sg; sg = sg_next(sg), ++nents) { ++ if (!IS_ALIGNED(sg->offset, 4)) ++ return false; ++ ++ if (len <= sg->length) { ++ if (!IS_ALIGNED(len, blksize)) ++ return false; ++ ++ return true; ++ } ++ ++ if (!IS_ALIGNED(sg->length, blksize)) ++ return false; ++ ++ len -= sg->length; ++ } ++ return false; ++} ++ ++int check_valid_request(struct mtk_cipher_reqctx *rctx) ++{ ++ struct scatterlist *src = rctx->sg_src; ++ struct scatterlist *dst = rctx->sg_dst; ++ uint32_t src_nents, dst_nents; ++ u32 textsize = rctx->textsize; ++ u32 authsize = rctx->authsize; ++ u32 blksize = rctx->blksize; ++ u32 totlen_src = rctx->assoclen + rctx->textsize; ++ u32 totlen_dst = rctx->assoclen + rctx->textsize; ++ u32 copy_len; ++ bool src_align, dst_align; ++ int err = -EINVAL; ++ ++ if (!IS_CTR(rctx->flags)) { ++ if (!IS_ALIGNED(textsize, blksize)) ++ return err; ++ } ++ ++ if (authsize) { ++ if (IS_ENCRYPT(rctx->flags)) ++ totlen_dst += authsize; ++ else ++ totlen_src += authsize; ++ } ++ ++ src_nents = sg_nents_for_len(src, totlen_src); ++ dst_nents = sg_nents_for_len(dst, totlen_dst); ++ ++ if (src == dst) { ++ src_nents = max(src_nents, dst_nents); ++ dst_nents = src_nents; ++ if (unlikely((totlen_src || totlen_dst) && (src_nents <= 0))) ++ return err; ++ ++ } else { ++ if (unlikely(totlen_src && (src_nents <= 0))) ++ return err; ++ ++ if (unlikely(totlen_dst && (dst_nents <= 0))) ++ return err; ++ } ++ ++ if (authsize) { ++ if (dst_nents == 1 && src_nents == 1) { ++ src_align = mtk_is_sg_aligned(src, totlen_src, blksize); ++ if (src == dst) ++ dst_align = src_align; ++ else ++ dst_align = mtk_is_sg_aligned(dst, ++ totlen_dst, blksize); ++ } else { ++ src_align = false; ++ dst_align = false; ++ } ++ } else { ++ src_align = mtk_is_sg_aligned(src, totlen_src, blksize); ++ if (src == dst) ++ dst_align = src_align; ++ else ++ dst_align = mtk_is_sg_aligned(dst, totlen_dst, blksize); ++ } ++ ++ copy_len = max(totlen_src, totlen_dst); ++ if (!src_align) { ++ err = mtk_make_sg_copy(src, &rctx->sg_src, copy_len, true); ++ if (err) ++ return err; ++ } ++ ++ if (!dst_align) { ++ err = mtk_make_sg_copy(dst, &rctx->sg_dst, copy_len, false); ++ if (err) ++ return err; ++ } ++ ++ rctx->src_nents = sg_nents_for_len(rctx->sg_src, totlen_src); ++ rctx->dst_nents = sg_nents_for_len(rctx->sg_dst, totlen_dst); ++ ++ return 0; ++} ++/* ++ * Set saRecord function: ++ * Even saRecord is set to "0", keep " = 0" for readability. ++ */ ++void mtk_set_saRecord(struct saRecord_s *saRecord, const unsigned int keylen, ++ const u32 flags) ++{ ++ saRecord->saCmd0.bits.ivSource = 2; ++ if (IS_ECB(flags)) ++ saRecord->saCmd0.bits.saveIv = 0; ++ else ++ saRecord->saCmd0.bits.saveIv = 1; ++ ++ saRecord->saCmd0.bits.opGroup = 0; ++ saRecord->saCmd0.bits.opCode = 0; ++ ++ switch ((flags & MTK_ALG_MASK)) { ++ case MTK_ALG_AES: ++ saRecord->saCmd0.bits.cipher = 3; ++ saRecord->saCmd1.bits.aesKeyLen = keylen >> 3; ++ break; ++ case MTK_ALG_3DES: ++ saRecord->saCmd0.bits.cipher = 1; ++ break; ++ case MTK_ALG_DES: ++ saRecord->saCmd0.bits.cipher = 0; ++ break; ++ default: ++ saRecord->saCmd0.bits.cipher = 15; ++ } ++ ++ switch ((flags & MTK_HASH_MASK)) { ++ case MTK_HASH_SHA256: ++ saRecord->saCmd0.bits.hash = 3; ++ break; ++ case MTK_HASH_SHA224: ++ saRecord->saCmd0.bits.hash = 2; ++ break; ++ case MTK_HASH_SHA1: ++ saRecord->saCmd0.bits.hash = 1; ++ break; ++ case MTK_HASH_MD5: ++ saRecord->saCmd0.bits.hash = 0; ++ break; ++ default: ++ saRecord->saCmd0.bits.hash = 15; ++ } ++ ++ saRecord->saCmd0.bits.hdrProc = 0; ++ saRecord->saCmd0.bits.padType = 3; ++ saRecord->saCmd0.bits.extPad = 0; ++ saRecord->saCmd0.bits.scPad = 0; ++ ++ switch ((flags & MTK_MODE_MASK)) { ++ case MTK_MODE_CBC: ++ saRecord->saCmd1.bits.cipherMode = 1; ++ break; ++ case MTK_MODE_CTR: ++ saRecord->saCmd1.bits.cipherMode = 2; ++ break; ++ case MTK_MODE_ECB: ++ saRecord->saCmd1.bits.cipherMode = 0; ++ break; ++ } ++ ++ saRecord->saCmd1.bits.byteOffset = 0; ++ saRecord->saCmd1.bits.hashCryptOffset = 0; ++ saRecord->saCmd0.bits.digestLength = 0; ++ saRecord->saCmd1.bits.copyPayload = 0; ++ ++ if (IS_HMAC(flags)) { ++ saRecord->saCmd1.bits.hmac = 1; ++ saRecord->saCmd1.bits.copyDigest = 1; ++ saRecord->saCmd1.bits.copyHeader = 1; ++ } else { ++ saRecord->saCmd1.bits.hmac = 0; ++ saRecord->saCmd1.bits.copyDigest = 0; ++ saRecord->saCmd1.bits.copyHeader = 0; ++ } ++ ++ saRecord->saCmd1.bits.seqNumCheck = 0; ++ saRecord->saSpi = 0x0; ++ saRecord->saSeqNumMask[0] = 0xFFFFFFFF; ++ saRecord->saSeqNumMask[1] = 0x0; ++} ++ ++/* ++ * Poor mans Scatter/gather function: ++ * Create a Descriptor for every segment to avoid copying buffers. ++ * For performance better to wait for hardware to perform multiple DMA ++ * ++ */ ++static inline int mtk_scatter_combine(struct mtk_device *mtk, ++ struct mtk_cipher_reqctx *rctx, ++ u32 datalen, u32 split, int offsetin) ++{ ++ struct eip93_descriptor_s *cdesc = rctx->cdesc; ++ struct scatterlist *sgsrc = rctx->sg_src; ++ struct scatterlist *sgdst = rctx->sg_dst; ++ unsigned int remainin = sg_dma_len(sgsrc); ++ unsigned int remainout = sg_dma_len(sgdst); ++ dma_addr_t saddr = sg_dma_address(sgsrc); ++ dma_addr_t daddr = sg_dma_address(sgdst); ++ dma_addr_t stateAddr; ++ u32 srcAddr, dstAddr, len, n; ++ bool nextin = false; ++ bool nextout = false; ++ int offsetout = 0; ++ int ndesc_cdr = 0, err; ++ ++ if (IS_ECB(rctx->flags)) ++ rctx->saState_base = 0; ++ ++ if (split < datalen) { ++ stateAddr = rctx->saState_base_ctr; ++ n = split; ++ } else { ++ stateAddr = rctx->saState_base; ++ n = datalen; ++ } ++ ++ do { ++ if (nextin) { ++ sgsrc = sg_next(sgsrc); ++ remainin = sg_dma_len(sgsrc); ++ if (remainin == 0) ++ continue; ++ ++ saddr = sg_dma_address(sgsrc); ++ offsetin = 0; ++ nextin = false; ++ } ++ ++ if (nextout) { ++ sgdst = sg_next(sgdst); ++ remainout = sg_dma_len(sgdst); ++ if (remainout == 0) ++ continue; ++ ++ daddr = sg_dma_address(sgdst); ++ offsetout = 0; ++ nextout = false; ++ } ++ srcAddr = saddr + offsetin; ++ dstAddr = daddr + offsetout; ++ ++ if (remainin == remainout) { ++ len = remainin; ++ if (len > n) { ++ len = n; ++ remainin -= n; ++ remainout -= n; ++ offsetin += n; ++ offsetout += n; ++ } else { ++ nextin = true; ++ nextout = true; ++ } ++ } else if (remainin < remainout) { ++ len = remainin; ++ if (len > n) { ++ len = n; ++ remainin -= n; ++ remainout -= n; ++ offsetin += n; ++ offsetout += n; ++ } else { ++ offsetout += len; ++ remainout -= len; ++ nextin = true; ++ } ++ } else { ++ len = remainout; ++ if (len > n) { ++ len = n; ++ remainin -= n; ++ remainout -= n; ++ offsetin += n; ++ offsetout += n; ++ } else { ++ offsetin += len; ++ remainin -= len; ++ nextout = true; ++ } ++ } ++ n -= len; ++ ++ cdesc->srcAddr = srcAddr; ++ cdesc->dstAddr = dstAddr; ++ cdesc->stateAddr = stateAddr; ++ cdesc->peLength.bits.peReady = 0; ++ cdesc->peLength.bits.byPass = 0; ++ cdesc->peLength.bits.length = len; ++ cdesc->peLength.bits.hostReady = 1; ++ ++ if (n == 0) { ++ n = datalen - split; ++ split = datalen; ++ stateAddr = rctx->saState_base; ++ } ++ ++ if (n == 0) ++ cdesc->userId |= MTK_DESC_LAST; ++ ++ /* Loop - Delay - No need to rollback ++ * Maybe refine by slowing down at MTK_RING_BUSY ++ */ ++again: ++ err = mtk_put_descriptor(mtk, cdesc); ++ if (err) { ++ udelay(500); ++ goto again; ++ } ++ /* Writing new descriptor count starts DMA action */ ++ writel(1, mtk->base + EIP93_REG_PE_CD_COUNT); ++ ++ ndesc_cdr++; ++ } while (n); ++ ++ return -EINPROGRESS; ++} ++ ++int mtk_send_req(struct crypto_async_request *async, ++ const u8 *reqiv, struct mtk_cipher_reqctx *rctx) ++{ ++ struct mtk_crypto_ctx *ctx = crypto_tfm_ctx(async->tfm); ++ struct mtk_device *mtk = ctx->mtk; ++ struct scatterlist *src = rctx->sg_src; ++ struct scatterlist *dst = rctx->sg_dst; ++ struct saState_s *saState; ++ struct mtk_state_pool *saState_pool; ++ struct eip93_descriptor_s cdesc; ++ u32 flags = rctx->flags; ++ int idx; ++ int offsetin = 0, err = -ENOMEM; ++ u32 datalen = rctx->assoclen + rctx->textsize; ++ u32 split = datalen; ++ u32 start, end, ctr, blocks; ++ u32 iv[AES_BLOCK_SIZE / sizeof(u32)]; ++ ++ rctx->saState_ctr = NULL; ++ rctx->saState = NULL; ++ ++ if (IS_ECB(flags)) ++ goto skip_iv; ++ ++ memcpy(iv, reqiv, rctx->ivsize); ++ ++ if (!IS_ALIGNED((u32)reqiv, rctx->ivsize) || IS_RFC3686(flags)) { ++ rctx->flags &= ~MTK_DESC_DMA_IV; ++ flags = rctx->flags; ++ } ++ ++ if (IS_DMA_IV(flags)) { ++ rctx->saState = (void *)reqiv; ++ } else { ++ idx = mtk_get_free_saState(mtk); ++ if (idx < 0) ++ goto send_err; ++ saState_pool = &mtk->ring->saState_pool[idx]; ++ rctx->saState_idx = idx; ++ rctx->saState = saState_pool->base; ++ rctx->saState_base = saState_pool->base_dma; ++ memcpy(rctx->saState->stateIv, iv, rctx->ivsize); ++ } ++ ++ saState = rctx->saState; ++ ++ if (IS_RFC3686(flags)) { ++ saState->stateIv[0] = ctx->saNonce; ++ saState->stateIv[1] = iv[0]; ++ saState->stateIv[2] = iv[1]; ++ saState->stateIv[3] = cpu_to_be32(1); ++ } else if (!IS_HMAC(flags) && IS_CTR(flags)) { ++ /* Compute data length. */ ++ blocks = DIV_ROUND_UP(rctx->textsize, AES_BLOCK_SIZE); ++ ctr = be32_to_cpu(iv[3]); ++ /* Check 32bit counter overflow. */ ++ start = ctr; ++ end = start + blocks - 1; ++ if (end < start) { ++ split = AES_BLOCK_SIZE * -start; ++ /* ++ * Increment the counter manually to cope with ++ * the hardware counter overflow. ++ */ ++ iv[3] = 0xffffffff; ++ crypto_inc((u8 *)iv, AES_BLOCK_SIZE); ++ idx = mtk_get_free_saState(mtk); ++ if (idx < 0) ++ goto free_state; ++ saState_pool = &mtk->ring->saState_pool[idx]; ++ rctx->saState_ctr_idx = idx; ++ rctx->saState_ctr = saState_pool->base; ++ rctx->saState_base_ctr = saState_pool->base_dma; ++ ++ memcpy(rctx->saState_ctr->stateIv, reqiv, rctx->ivsize); ++ memcpy(saState->stateIv, iv, rctx->ivsize); ++ } ++ } ++ ++ if (IS_DMA_IV(flags)) { ++ rctx->saState_base = dma_map_single(mtk->dev, (void *)reqiv, ++ rctx->ivsize, DMA_TO_DEVICE); ++ if (dma_mapping_error(mtk->dev, rctx->saState_base)) ++ goto free_state; ++ } ++skip_iv: ++ cdesc.peCrtlStat.bits.hostReady = 1; ++ cdesc.peCrtlStat.bits.prngMode = 0; ++ cdesc.peCrtlStat.bits.hashFinal = 0; ++ cdesc.peCrtlStat.bits.padCrtlStat = 0; ++ cdesc.peCrtlStat.bits.peReady = 0; ++ cdesc.saAddr = rctx->saRecord_base; ++ cdesc.arc4Addr = (uint32_t)async; ++ cdesc.userId = flags; ++ rctx->cdesc = &cdesc; ++ ++ /* map DMA_BIDIRECTIONAL to invalidate cache on destination ++ * implies __dma_cache_wback_inv ++ */ ++ dma_map_sg(mtk->dev, dst, rctx->dst_nents, DMA_BIDIRECTIONAL); ++ if (src != dst) ++ dma_map_sg(mtk->dev, src, rctx->src_nents, DMA_TO_DEVICE); ++ ++ err = mtk_scatter_combine(mtk, rctx, datalen, split, offsetin); ++ ++ return err; ++ ++free_state: ++ if (rctx->saState) { ++ saState_pool = &mtk->ring->saState_pool[rctx->saState_idx]; ++ saState_pool->in_use = false; ++ } ++ ++ if (rctx->saState_ctr) { ++ saState_pool = &mtk->ring->saState_pool[rctx->saState_ctr_idx]; ++ saState_pool->in_use = false; ++ } ++send_err: ++ return err; ++} ++ ++void mtk_unmap_dma(struct mtk_device *mtk, struct mtk_cipher_reqctx *rctx, ++ struct scatterlist *reqsrc, struct scatterlist *reqdst) ++{ ++ u32 len = rctx->assoclen + rctx->textsize; ++ u32 authsize = rctx->authsize; ++ u32 flags = rctx->flags; ++ u32 *otag; ++ int i; ++ ++ if (rctx->sg_src == rctx->sg_dst) { ++ dma_unmap_sg(mtk->dev, rctx->sg_dst, rctx->dst_nents, ++ DMA_BIDIRECTIONAL); ++ goto process_tag; ++ } ++ ++ dma_unmap_sg(mtk->dev, rctx->sg_src, rctx->src_nents, ++ DMA_TO_DEVICE); ++ ++ if (rctx->sg_src != reqsrc) ++ mtk_free_sg_copy(len + rctx->authsize, &rctx->sg_src); ++ ++ dma_unmap_sg(mtk->dev, rctx->sg_dst, rctx->dst_nents, ++ DMA_BIDIRECTIONAL); ++ ++ /* SHA tags need conversion from net-to-host */ ++process_tag: ++ if (IS_DECRYPT(flags)) ++ authsize = 0; ++ ++ if (authsize) { ++ if (!IS_HASH_MD5(flags)) { ++ otag = sg_virt(rctx->sg_dst) + len; ++ for (i = 0; i < (authsize / 4); i++) ++ otag[i] = ntohl(otag[i]); ++ } ++ } ++ ++ if (rctx->sg_dst != reqdst) { ++ sg_copy_from_buffer(reqdst, sg_nents(reqdst), ++ sg_virt(rctx->sg_dst), len + authsize); ++ mtk_free_sg_copy(len + rctx->authsize, &rctx->sg_dst); ++ } ++} ++ ++void mtk_handle_result(struct mtk_device *mtk, struct mtk_cipher_reqctx *rctx, ++ u8 *reqiv) ++{ ++ struct mtk_state_pool *saState_pool; ++ ++ if (IS_DMA_IV(rctx->flags)) ++ dma_unmap_single(mtk->dev, rctx->saState_base, rctx->ivsize, ++ DMA_TO_DEVICE); ++ ++ if (!IS_ECB(rctx->flags)) ++ memcpy(reqiv, rctx->saState->stateIv, rctx->ivsize); ++ ++ if ((rctx->saState) && !(IS_DMA_IV(rctx->flags))) { ++ saState_pool = &mtk->ring->saState_pool[rctx->saState_idx]; ++ saState_pool->in_use = false; ++ } ++ ++ if (rctx->saState_ctr) { ++ saState_pool = &mtk->ring->saState_pool[rctx->saState_ctr_idx]; ++ saState_pool->in_use = false; ++ } ++} ++ ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_HMAC) ++/* basically this is set hmac - key */ ++int mtk_authenc_setkey(struct crypto_shash *cshash, struct saRecord_s *sa, ++ const u8 *authkey, unsigned int authkeylen) ++{ ++ int bs = crypto_shash_blocksize(cshash); ++ int ds = crypto_shash_digestsize(cshash); ++ int ss = crypto_shash_statesize(cshash); ++ u8 *ipad, *opad; ++ unsigned int i, err; ++ ++ SHASH_DESC_ON_STACK(shash, cshash); ++ ++ shash->tfm = cshash; ++ ++ /* auth key ++ * ++ * EIP93 can only authenticate with hash of the key ++ * do software shash until EIP93 hash function complete. ++ */ ++ ipad = kcalloc(2, SHA256_BLOCK_SIZE + ss, GFP_KERNEL); ++ if (!ipad) ++ return -ENOMEM; ++ ++ opad = ipad + SHA256_BLOCK_SIZE + ss; ++ ++ if (authkeylen > bs) { ++ err = crypto_shash_digest(shash, authkey, ++ authkeylen, ipad); ++ if (err) ++ return err; ++ ++ authkeylen = ds; ++ } else ++ memcpy(ipad, authkey, authkeylen); ++ ++ memset(ipad + authkeylen, 0, bs - authkeylen); ++ memcpy(opad, ipad, bs); ++ ++ for (i = 0; i < bs; i++) { ++ ipad[i] ^= HMAC_IPAD_VALUE; ++ opad[i] ^= HMAC_OPAD_VALUE; ++ } ++ ++ err = crypto_shash_init(shash) ?: ++ crypto_shash_update(shash, ipad, bs) ?: ++ crypto_shash_export(shash, ipad) ?: ++ crypto_shash_init(shash) ?: ++ crypto_shash_update(shash, opad, bs) ?: ++ crypto_shash_export(shash, opad); ++ ++ if (err) ++ return err; ++ ++ /* add auth key */ ++ memcpy(&sa->saIDigest, ipad, SHA256_DIGEST_SIZE); ++ memcpy(&sa->saODigest, opad, SHA256_DIGEST_SIZE); ++ ++ kfree(ipad); ++ return 0; ++} ++#endif +--- /dev/null ++++ b/drivers/crypto/mtk-eip93/eip93-common.h +@@ -0,0 +1,28 @@ ++/* SPDX-License-Identifier: GPL-2.0 ++ * ++ * Copyright (C) 2019 - 2021 ++ * ++ * Richard van Schagen ++ */ ++ ++#ifndef _EIP93_COMMON_H_ ++#define _EIP93_COMMON_H_ ++ ++#include "eip93-main.h" ++ ++inline int mtk_put_descriptor(struct mtk_device *mtk, ++ struct eip93_descriptor_s *desc); ++ ++inline void *mtk_get_descriptor(struct mtk_device *mtk); ++ ++inline int mtk_get_free_saState(struct mtk_device *mtk); ++ ++void mtk_set_saRecord(struct saRecord_s *saRecord, const unsigned int keylen, ++ const u32 flags); ++ ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_HMAC) ++int mtk_authenc_setkey(struct crypto_shash *cshash, struct saRecord_s *sa, ++ const u8 *authkey, unsigned int authkeylen); ++#endif ++ ++#endif /* _EIP93_COMMON_H_ */ +--- /dev/null ++++ b/drivers/crypto/mtk-eip93/eip93-des.h +@@ -0,0 +1,15 @@ ++/* SPDX-License-Identifier: GPL-2.0 ++ * ++ * Copyright (C) 2019 - 2021 ++ * ++ * Richard van Schagen ++ */ ++#ifndef _EIP93_DES_H_ ++#define _EIP93_DES_H_ ++ ++extern struct mtk_alg_template mtk_alg_ecb_des; ++extern struct mtk_alg_template mtk_alg_cbc_des; ++extern struct mtk_alg_template mtk_alg_ecb_des3_ede; ++extern struct mtk_alg_template mtk_alg_cbc_des3_ede; ++ ++#endif /* _EIP93_DES_H_ */ +--- /dev/null ++++ b/drivers/crypto/mtk-eip93/eip93-main.c +@@ -0,0 +1,467 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2019 - 2021 ++ * ++ * Richard van Schagen ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "eip93-main.h" ++#include "eip93-regs.h" ++#include "eip93-common.h" ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_SKCIPHER) ++#include "eip93-cipher.h" ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_AES) ++#include "eip93-aes.h" ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_DES) ++#include "eip93-des.h" ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_AEAD) ++#include "eip93-aead.h" ++#endif ++ ++static struct mtk_alg_template *mtk_algs[] = { ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_DES) ++ &mtk_alg_ecb_des, ++ &mtk_alg_cbc_des, ++ &mtk_alg_ecb_des3_ede, ++ &mtk_alg_cbc_des3_ede, ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_AES) ++ &mtk_alg_ecb_aes, ++ &mtk_alg_cbc_aes, ++ &mtk_alg_ctr_aes, ++ &mtk_alg_rfc3686_aes, ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_AEAD) ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_DES) ++ &mtk_alg_authenc_hmac_md5_cbc_des, ++ &mtk_alg_authenc_hmac_sha1_cbc_des, ++ &mtk_alg_authenc_hmac_sha224_cbc_des, ++ &mtk_alg_authenc_hmac_sha256_cbc_des, ++ &mtk_alg_authenc_hmac_md5_cbc_des3_ede, ++ &mtk_alg_authenc_hmac_sha1_cbc_des3_ede, ++ &mtk_alg_authenc_hmac_sha224_cbc_des3_ede, ++ &mtk_alg_authenc_hmac_sha256_cbc_des3_ede, ++#endif ++ &mtk_alg_authenc_hmac_md5_cbc_aes, ++ &mtk_alg_authenc_hmac_sha1_cbc_aes, ++ &mtk_alg_authenc_hmac_sha224_cbc_aes, ++ &mtk_alg_authenc_hmac_sha256_cbc_aes, ++ &mtk_alg_authenc_hmac_md5_rfc3686_aes, ++ &mtk_alg_authenc_hmac_sha1_rfc3686_aes, ++ &mtk_alg_authenc_hmac_sha224_rfc3686_aes, ++ &mtk_alg_authenc_hmac_sha256_rfc3686_aes, ++#endif ++}; ++ ++inline void mtk_irq_disable(struct mtk_device *mtk, u32 mask) ++{ ++ __raw_writel(mask, mtk->base + EIP93_REG_MASK_DISABLE); ++} ++ ++inline void mtk_irq_enable(struct mtk_device *mtk, u32 mask) ++{ ++ __raw_writel(mask, mtk->base + EIP93_REG_MASK_ENABLE); ++} ++ ++inline void mtk_irq_clear(struct mtk_device *mtk, u32 mask) ++{ ++ __raw_writel(mask, mtk->base + EIP93_REG_INT_CLR); ++} ++ ++static void mtk_unregister_algs(unsigned int i) ++{ ++ unsigned int j; ++ ++ for (j = 0; j < i; j++) { ++ switch (mtk_algs[j]->type) { ++ case MTK_ALG_TYPE_SKCIPHER: ++ crypto_unregister_skcipher(&mtk_algs[j]->alg.skcipher); ++ break; ++ case MTK_ALG_TYPE_AEAD: ++ crypto_unregister_aead(&mtk_algs[j]->alg.aead); ++ break; ++ } ++ } ++} ++ ++static int mtk_register_algs(struct mtk_device *mtk) ++{ ++ unsigned int i; ++ int err = 0; ++ ++ for (i = 0; i < ARRAY_SIZE(mtk_algs); i++) { ++ mtk_algs[i]->mtk = mtk; ++ ++ switch (mtk_algs[i]->type) { ++ case MTK_ALG_TYPE_SKCIPHER: ++ err = crypto_register_skcipher(&mtk_algs[i]->alg.skcipher); ++ break; ++ case MTK_ALG_TYPE_AEAD: ++ err = crypto_register_aead(&mtk_algs[i]->alg.aead); ++ break; ++ } ++ if (err) ++ goto fail; ++ } ++ ++ return 0; ++ ++fail: ++ mtk_unregister_algs(i); ++ ++ return err; ++} ++ ++static void mtk_handle_result_descriptor(struct mtk_device *mtk) ++{ ++ struct crypto_async_request *async; ++ struct eip93_descriptor_s *rdesc; ++ bool last_entry; ++ u32 flags; ++ int handled, ready, err; ++ union peCrtlStat_w done1; ++ union peLength_w done2; ++ ++get_more: ++ handled = 0; ++ ++ ready = readl(mtk->base + EIP93_REG_PE_RD_COUNT) & GENMASK(10, 0); ++ ++ if (!ready) { ++ mtk_irq_clear(mtk, EIP93_INT_PE_RDRTHRESH_REQ); ++ mtk_irq_enable(mtk, EIP93_INT_PE_RDRTHRESH_REQ); ++ return; ++ } ++ ++ last_entry = false; ++ ++ while (ready) { ++ rdesc = mtk_get_descriptor(mtk); ++ if (IS_ERR(rdesc)) { ++ dev_err(mtk->dev, "Ndesc: %d nreq: %d\n", ++ handled, ready); ++ err = -EIO; ++ break; ++ } ++ /* make sure DMA is finished writing */ ++ do { ++ done1.word = READ_ONCE(rdesc->peCrtlStat.word); ++ done2.word = READ_ONCE(rdesc->peLength.word); ++ } while ((!done1.bits.peReady) || (!done2.bits.peReady)); ++ ++ err = rdesc->peCrtlStat.bits.errStatus; ++ ++ flags = rdesc->userId; ++ async = (struct crypto_async_request *)rdesc->arc4Addr; ++ ++ writel(1, mtk->base + EIP93_REG_PE_RD_COUNT); ++ mtk_irq_clear(mtk, EIP93_INT_PE_RDRTHRESH_REQ); ++ ++ handled++; ++ ready--; ++ ++ if (flags & MTK_DESC_LAST) { ++ last_entry = true; ++ break; ++ } ++ } ++ ++ if (!last_entry) ++ goto get_more; ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_SKCIPHER) ++ if (flags & MTK_DESC_SKCIPHER) ++ mtk_skcipher_handle_result(async, err); ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_AEAD) ++ if (flags & MTK_DESC_AEAD) ++ mtk_aead_handle_result(async, err); ++#endif ++ goto get_more; ++} ++ ++static void mtk_done_task(unsigned long data) ++{ ++ struct mtk_device *mtk = (struct mtk_device *)data; ++ ++ mtk_handle_result_descriptor(mtk); ++} ++ ++static irqreturn_t mtk_irq_handler(int irq, void *dev_id) ++{ ++ struct mtk_device *mtk = (struct mtk_device *)dev_id; ++ u32 irq_status; ++ ++ irq_status = readl(mtk->base + EIP93_REG_INT_MASK_STAT); ++ ++ if (irq_status & EIP93_INT_PE_RDRTHRESH_REQ) { ++ mtk_irq_disable(mtk, EIP93_INT_PE_RDRTHRESH_REQ); ++ tasklet_schedule(&mtk->ring->done_task); ++ return IRQ_HANDLED; ++ } ++ ++ mtk_irq_clear(mtk, irq_status); ++ if (irq_status) ++ mtk_irq_disable(mtk, irq_status); ++ ++ return IRQ_NONE; ++} ++ ++static void mtk_initialize(struct mtk_device *mtk) ++{ ++ union peConfig_w peConfig; ++ union peEndianCfg_w peEndianCfg; ++ union peIntCfg_w peIntCfg; ++ union peClockCfg_w peClockCfg; ++ union peBufThresh_w peBufThresh; ++ union peRingThresh_w peRingThresh; ++ ++ /* Reset Engine and setup Mode */ ++ peConfig.word = 0; ++ peConfig.bits.resetPE = 1; ++ peConfig.bits.resetRing = 1; ++ peConfig.bits.peMode = 3; ++ peConfig.bits.enCDRupdate = 1; ++ ++ writel(peConfig.word, mtk->base + EIP93_REG_PE_CONFIG); ++ ++ udelay(10); ++ ++ peConfig.bits.resetPE = 0; ++ peConfig.bits.resetRing = 0; ++ ++ writel(peConfig.word, mtk->base + EIP93_REG_PE_CONFIG); ++ ++ /* Initialize the BYTE_ORDER_CFG register */ ++ peEndianCfg.word = 0; ++ writel(peEndianCfg.word, mtk->base + EIP93_REG_PE_ENDIAN_CONFIG); ++ ++ /* Initialize the INT_CFG register */ ++ peIntCfg.word = 0; ++ writel(peIntCfg.word, mtk->base + EIP93_REG_INT_CFG); ++ ++ /* Config Clocks */ ++ peClockCfg.word = 0; ++ peClockCfg.bits.enPEclk = 1; ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_DES) ++ peClockCfg.bits.enDESclk = 1; ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_AES) ++ peClockCfg.bits.enAESclk = 1; ++#endif ++#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_HMAC) ++ peClockCfg.bits.enHASHclk = 1; ++#endif ++ writel(peClockCfg.word, mtk->base + EIP93_REG_PE_CLOCK_CTRL); ++ ++ /* Config DMA thresholds */ ++ peBufThresh.word = 0; ++ peBufThresh.bits.inputBuffer = 128; ++ peBufThresh.bits.outputBuffer = 128; ++ ++ writel(peBufThresh.word, mtk->base + EIP93_REG_PE_BUF_THRESH); ++ ++ /* Clear/ack all interrupts before disable all */ ++ mtk_irq_clear(mtk, 0xFFFFFFFF); ++ mtk_irq_disable(mtk, 0xFFFFFFFF); ++ ++ /* Config Ring Threshold */ ++ peRingThresh.word = 0; ++ peRingThresh.bits.CDRThresh = MTK_RING_SIZE - MTK_RING_BUSY; ++ peRingThresh.bits.RDRThresh = 0; ++ peRingThresh.bits.RDTimeout = 5; ++ peRingThresh.bits.enTimeout = 1; ++ ++ writel(peRingThresh.word, mtk->base + EIP93_REG_PE_RING_THRESH); ++} ++ ++static void mtk_desc_free(struct mtk_device *mtk) ++{ ++ writel(0, mtk->base + EIP93_REG_PE_RING_CONFIG); ++ writel(0, mtk->base + EIP93_REG_PE_CDR_BASE); ++ writel(0, mtk->base + EIP93_REG_PE_RDR_BASE); ++} ++ ++static int mtk_set_ring(struct mtk_device *mtk, struct mtk_desc_ring *ring, ++ int Offset) ++{ ++ ring->offset = Offset; ++ ring->base = dmam_alloc_coherent(mtk->dev, Offset * MTK_RING_SIZE, ++ &ring->base_dma, GFP_KERNEL); ++ if (!ring->base) ++ return -ENOMEM; ++ ++ ring->write = ring->base; ++ ring->base_end = ring->base + Offset * (MTK_RING_SIZE - 1); ++ ring->read = ring->base; ++ ++ return 0; ++} ++ ++static int mtk_desc_init(struct mtk_device *mtk) ++{ ++ struct mtk_state_pool *saState_pool; ++ struct mtk_desc_ring *cdr = &mtk->ring->cdr; ++ struct mtk_desc_ring *rdr = &mtk->ring->rdr; ++ union peRingCfg_w peRingCfg; ++ int RingOffset, err, i; ++ ++ RingOffset = sizeof(struct eip93_descriptor_s); ++ ++ err = mtk_set_ring(mtk, cdr, RingOffset); ++ if (err) ++ return err; ++ ++ err = mtk_set_ring(mtk, rdr, RingOffset); ++ if (err) ++ return err; ++ ++ writel((u32)cdr->base_dma, mtk->base + EIP93_REG_PE_CDR_BASE); ++ writel((u32)rdr->base_dma, mtk->base + EIP93_REG_PE_RDR_BASE); ++ ++ peRingCfg.word = 0; ++ peRingCfg.bits.ringSize = MTK_RING_SIZE - 1; ++ peRingCfg.bits.ringOffset = RingOffset / 4; ++ ++ writel(peRingCfg.word, mtk->base + EIP93_REG_PE_RING_CONFIG); ++ ++ atomic_set(&mtk->ring->free, MTK_RING_SIZE - 1); ++ /* Create State record DMA pool */ ++ RingOffset = sizeof(struct saState_s); ++ mtk->ring->saState = dmam_alloc_coherent(mtk->dev, ++ RingOffset * MTK_RING_SIZE, ++ &mtk->ring->saState_dma, GFP_KERNEL); ++ if (!mtk->ring->saState) ++ return -ENOMEM; ++ ++ mtk->ring->saState_pool = devm_kcalloc(mtk->dev, 1, ++ sizeof(struct mtk_state_pool) * MTK_RING_SIZE, ++ GFP_KERNEL); ++ ++ for (i = 0; i < MTK_RING_SIZE; i++) { ++ saState_pool = &mtk->ring->saState_pool[i]; ++ saState_pool->base = mtk->ring->saState + (i * RingOffset); ++ saState_pool->base_dma = mtk->ring->saState_dma + (i * RingOffset); ++ saState_pool->in_use = false; ++ } ++ ++ return 0; ++} ++ ++static void mtk_cleanup(struct mtk_device *mtk) ++{ ++ tasklet_kill(&mtk->ring->done_task); ++ ++ /* Clear/ack all interrupts before disable all */ ++ mtk_irq_clear(mtk, 0xFFFFFFFF); ++ mtk_irq_disable(mtk, 0xFFFFFFFF); ++ ++ writel(0, mtk->base + EIP93_REG_PE_CLOCK_CTRL); ++ ++ mtk_desc_free(mtk); ++} ++ ++static int mtk_crypto_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct mtk_device *mtk; ++ struct resource *res; ++ int err; ++ ++ mtk = devm_kzalloc(dev, sizeof(*mtk), GFP_KERNEL); ++ if (!mtk) ++ return -ENOMEM; ++ ++ mtk->dev = dev; ++ platform_set_drvdata(pdev, mtk); ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ mtk->base = devm_ioremap_resource(&pdev->dev, res); ++ ++ if (IS_ERR(mtk->base)) ++ return PTR_ERR(mtk->base); ++ ++ mtk->irq = platform_get_irq(pdev, 0); ++ ++ if (mtk->irq < 0) ++ return mtk->irq; ++ ++ err = devm_request_threaded_irq(mtk->dev, mtk->irq, mtk_irq_handler, ++ NULL, IRQF_ONESHOT, ++ dev_name(mtk->dev), mtk); ++ ++ mtk->ring = devm_kcalloc(mtk->dev, 1, sizeof(*mtk->ring), GFP_KERNEL); ++ ++ if (!mtk->ring) ++ return -ENOMEM; ++ ++ err = mtk_desc_init(mtk); ++ if (err) ++ return err; ++ ++ tasklet_init(&mtk->ring->done_task, mtk_done_task, (unsigned long)mtk); ++ ++ spin_lock_init(&mtk->ring->read_lock); ++ spin_lock_init(&mtk->ring->write_lock); ++ ++ mtk_initialize(mtk); ++ ++ /* Init. finished, enable RDR interupt */ ++ mtk_irq_enable(mtk, EIP93_INT_PE_RDRTHRESH_REQ); ++ ++ err = mtk_register_algs(mtk); ++ if (err) { ++ mtk_cleanup(mtk); ++ return err; ++ } ++ ++ dev_info(mtk->dev, "EIP93 Crypto Engine Initialized."); ++ ++ return 0; ++} ++ ++static int mtk_crypto_remove(struct platform_device *pdev) ++{ ++ struct mtk_device *mtk = platform_get_drvdata(pdev); ++ ++ mtk_unregister_algs(ARRAY_SIZE(mtk_algs)); ++ mtk_cleanup(mtk); ++ dev_info(mtk->dev, "EIP93 removed.\n"); ++ ++ return 0; ++} ++ ++#if defined(CONFIG_OF) ++static const struct of_device_id mtk_crypto_of_match[] = { ++ { .compatible = "mediatek,mtk-eip93", }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, mtk_crypto_of_match); ++#endif ++ ++static struct platform_driver mtk_crypto_driver = { ++ .probe = mtk_crypto_probe, ++ .remove = mtk_crypto_remove, ++ .driver = { ++ .name = "mtk-eip93", ++ .of_match_table = of_match_ptr(mtk_crypto_of_match), ++ }, ++}; ++module_platform_driver(mtk_crypto_driver); ++ ++MODULE_AUTHOR("Richard van Schagen "); ++MODULE_ALIAS("platform:" KBUILD_MODNAME); ++MODULE_DESCRIPTION("Mediatek EIP-93 crypto engine driver"); ++MODULE_LICENSE("GPL v2"); +--- /dev/null ++++ b/drivers/crypto/mtk-eip93/eip93-main.h +@@ -0,0 +1,146 @@ ++/* SPDX-License-Identifier: GPL-2.0 ++ * ++ * Copyright (C) 2019 - 2021 ++ * ++ * Richard van Schagen ++ */ ++#ifndef _EIP93_MAIN_H_ ++#define _EIP93_MAIN_H_ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MTK_RING_SIZE 512 ++#define MTK_RING_BUSY 32 ++#define MTK_CRA_PRIORITY 1500 ++ ++/* cipher algorithms */ ++#define MTK_ALG_DES BIT(0) ++#define MTK_ALG_3DES BIT(1) ++#define MTK_ALG_AES BIT(2) ++#define MTK_ALG_MASK GENMASK(2, 0) ++/* hash and hmac algorithms */ ++#define MTK_HASH_MD5 BIT(3) ++#define MTK_HASH_SHA1 BIT(4) ++#define MTK_HASH_SHA224 BIT(5) ++#define MTK_HASH_SHA256 BIT(6) ++#define MTK_HASH_HMAC BIT(7) ++#define MTK_HASH_MASK GENMASK(6, 3) ++/* cipher modes */ ++#define MTK_MODE_CBC BIT(8) ++#define MTK_MODE_ECB BIT(9) ++#define MTK_MODE_CTR BIT(10) ++#define MTK_MODE_RFC3686 BIT(11) ++#define MTK_MODE_MASK GENMASK(10, 8) ++ ++/* cipher encryption/decryption operations */ ++#define MTK_ENCRYPT BIT(12) ++#define MTK_DECRYPT BIT(13) ++ ++#define MTK_BUSY BIT(14) ++ ++/* descriptor flags */ ++#define MTK_DESC_ASYNC BIT(31) ++#define MTK_DESC_SKCIPHER BIT(30) ++#define MTK_DESC_AEAD BIT(29) ++#define MTK_DESC_AHASH BIT(28) ++#define MTK_DESC_PRNG BIT(27) ++#define MTK_DESC_FAKE_HMAC BIT(26) ++#define MTK_DESC_LAST BIT(25) ++#define MTK_DESC_FINISH BIT(24) ++#define MTK_DESC_IPSEC BIT(23) ++#define MTK_DESC_DMA_IV BIT(22) ++ ++#define IS_DES(flags) (flags & MTK_ALG_DES) ++#define IS_3DES(flags) (flags & MTK_ALG_3DES) ++#define IS_AES(flags) (flags & MTK_ALG_AES) ++ ++#define IS_HASH_MD5(flags) (flags & MTK_HASH_MD5) ++#define IS_HASH_SHA1(flags) (flags & MTK_HASH_SHA1) ++#define IS_HASH_SHA224(flags) (flags & MTK_HASH_SHA224) ++#define IS_HASH_SHA256(flags) (flags & MTK_HASH_SHA256) ++#define IS_HMAC(flags) (flags & MTK_HASH_HMAC) ++ ++#define IS_CBC(mode) (mode & MTK_MODE_CBC) ++#define IS_ECB(mode) (mode & MTK_MODE_ECB) ++#define IS_CTR(mode) (mode & MTK_MODE_CTR) ++#define IS_RFC3686(mode) (mode & MTK_MODE_RFC3686) ++ ++#define IS_BUSY(flags) (flags & MTK_BUSY) ++#define IS_DMA_IV(flags) (flags & MTK_DESC_DMA_IV) ++ ++#define IS_ENCRYPT(dir) (dir & MTK_ENCRYPT) ++#define IS_DECRYPT(dir) (dir & MTK_DECRYPT) ++ ++#define IS_CIPHER(flags) (flags & (MTK_ALG_DES || \ ++ MTK_ALG_3DES || \ ++ MTK_ALG_AES)) ++ ++#define IS_HASH(flags) (flags & (MTK_HASH_MD5 || \ ++ MTK_HASH_SHA1 || \ ++ MTK_HASH_SHA224 || \ ++ MTK_HASH_SHA256)) ++ ++/** ++ * struct mtk_device - crypto engine device structure ++ */ ++struct mtk_device { ++ void __iomem *base; ++ struct device *dev; ++ struct clk *clk; ++ int irq; ++ struct mtk_ring *ring; ++ struct mtk_state_pool *saState_pool; ++}; ++ ++struct mtk_desc_ring { ++ void *base; ++ void *base_end; ++ dma_addr_t base_dma; ++ /* write and read pointers */ ++ void *read; ++ void *write; ++ /* descriptor element offset */ ++ u32 offset; ++}; ++ ++struct mtk_state_pool { ++ void *base; ++ dma_addr_t base_dma; ++ bool in_use; ++}; ++ ++struct mtk_ring { ++ struct tasklet_struct done_task; ++ /* command/result rings */ ++ struct mtk_desc_ring cdr; ++ struct mtk_desc_ring rdr; ++ spinlock_t write_lock; ++ spinlock_t read_lock; ++ atomic_t free; ++ /* saState */ ++ struct mtk_state_pool *saState_pool; ++ void *saState; ++ dma_addr_t saState_dma; ++}; ++ ++enum mtk_alg_type { ++ MTK_ALG_TYPE_AEAD, ++ MTK_ALG_TYPE_SKCIPHER, ++}; ++ ++struct mtk_alg_template { ++ struct mtk_device *mtk; ++ enum mtk_alg_type type; ++ u32 flags; ++ union { ++ struct aead_alg aead; ++ struct skcipher_alg skcipher; ++ } alg; ++}; ++ ++#endif /* _EIP93_MAIN_H_ */ +--- /dev/null ++++ b/drivers/crypto/mtk-eip93/eip93-regs.h +@@ -0,0 +1,382 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Copyright (C) 2019 - 2021 ++ * ++ * Richard van Schagen ++ */ ++#ifndef REG_EIP93_H ++#define REG_EIP93_H ++ ++#define EIP93_REG_WIDTH 4 ++/*----------------------------------------------------------------------------- ++ * Register Map ++ */ ++#define DESP_BASE 0x0000000 ++#define EIP93_REG_PE_CTRL_STAT ((DESP_BASE)+(0x00 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_SOURCE_ADDR ((DESP_BASE)+(0x01 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_DEST_ADDR ((DESP_BASE)+(0x02 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_SA_ADDR ((DESP_BASE)+(0x03 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_ADDR ((DESP_BASE)+(0x04 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_USER_ID ((DESP_BASE)+(0x06 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_LENGTH ((DESP_BASE)+(0x07 * EIP93_REG_WIDTH)) ++ ++//PACKET ENGINE RING configuration registers ++#define PE_RNG_BASE 0x0000080 ++ ++#define EIP93_REG_PE_CDR_BASE ((PE_RNG_BASE)+(0x00 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_RDR_BASE ((PE_RNG_BASE)+(0x01 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_RING_CONFIG ((PE_RNG_BASE)+(0x02 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_RING_THRESH ((PE_RNG_BASE)+(0x03 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_CD_COUNT ((PE_RNG_BASE)+(0x04 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_RD_COUNT ((PE_RNG_BASE)+(0x05 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_RING_RW_PNTR ((PE_RNG_BASE)+(0x06 * EIP93_REG_WIDTH)) ++ ++//PACKET ENGINE configuration registers ++#define PE_CFG_BASE 0x0000100 ++#define EIP93_REG_PE_CONFIG ((PE_CFG_BASE)+(0x00 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_STATUS ((PE_CFG_BASE)+(0x01 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_BUF_THRESH ((PE_CFG_BASE)+(0x03 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_INBUF_COUNT ((PE_CFG_BASE)+(0x04 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_OUTBUF_COUNT ((PE_CFG_BASE)+(0x05 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_BUF_RW_PNTR ((PE_CFG_BASE)+(0x06 * EIP93_REG_WIDTH)) ++ ++//PACKET ENGINE endian config ++#define EN_CFG_BASE 0x00001CC ++#define EIP93_REG_PE_ENDIAN_CONFIG ((EN_CFG_BASE)+(0x00 * EIP93_REG_WIDTH)) ++ ++//EIP93 CLOCK control registers ++#define CLOCK_BASE 0x01E8 ++#define EIP93_REG_PE_CLOCK_CTRL ((CLOCK_BASE)+(0x00 * EIP93_REG_WIDTH)) ++ ++//EIP93 Device Option and Revision Register ++#define REV_BASE 0x01F4 ++#define EIP93_REG_PE_OPTION_1 ((REV_BASE)+(0x00 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_OPTION_0 ((REV_BASE)+(0x01 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PE_REVISION ((REV_BASE)+(0x02 * EIP93_REG_WIDTH)) ++ ++//EIP93 Interrupt Control Register ++#define INT_BASE 0x0200 ++#define EIP93_REG_INT_UNMASK_STAT ((INT_BASE)+(0x00 * EIP93_REG_WIDTH)) ++#define EIP93_REG_INT_MASK_STAT ((INT_BASE)+(0x01 * EIP93_REG_WIDTH)) ++#define EIP93_REG_INT_CLR ((INT_BASE)+(0x01 * EIP93_REG_WIDTH)) ++#define EIP93_REG_INT_MASK ((INT_BASE)+(0x02 * EIP93_REG_WIDTH)) ++#define EIP93_REG_INT_CFG ((INT_BASE)+(0x03 * EIP93_REG_WIDTH)) ++#define EIP93_REG_MASK_ENABLE ((INT_BASE)+(0X04 * EIP93_REG_WIDTH)) ++#define EIP93_REG_MASK_DISABLE ((INT_BASE)+(0X05 * EIP93_REG_WIDTH)) ++ ++//EIP93 SA Record register ++#define SA_BASE 0x0400 ++#define EIP93_REG_SA_CMD_0 ((SA_BASE)+(0x00 * EIP93_REG_WIDTH)) ++#define EIP93_REG_SA_CMD_1 ((SA_BASE)+(0x01 * EIP93_REG_WIDTH)) ++ ++//#define EIP93_REG_SA_READY ((SA_BASE)+(31 * EIP93_REG_WIDTH)) ++ ++//State save register ++#define STATE_BASE 0x0500 ++#define EIP93_REG_STATE_IV_0 ((STATE_BASE)+(0x00 * EIP93_REG_WIDTH)) ++#define EIP93_REG_STATE_IV_1 ((STATE_BASE)+(0x01 * EIP93_REG_WIDTH)) ++ ++#define EIP93_PE_ARC4STATE_BASEADDR_REG 0x0700 ++ ++//RAM buffer start address ++#define EIP93_INPUT_BUFFER 0x0800 ++#define EIP93_OUTPUT_BUFFER 0x0800 ++ ++//EIP93 PRNG Configuration Register ++#define PRNG_BASE 0x0300 ++#define EIP93_REG_PRNG_STAT ((PRNG_BASE)+(0x00 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_CTRL ((PRNG_BASE)+(0x01 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_SEED_0 ((PRNG_BASE)+(0x02 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_SEED_1 ((PRNG_BASE)+(0x03 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_SEED_2 ((PRNG_BASE)+(0x04 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_SEED_3 ((PRNG_BASE)+(0x05 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_KEY_0 ((PRNG_BASE)+(0x06 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_KEY_1 ((PRNG_BASE)+(0x07 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_KEY_2 ((PRNG_BASE)+(0x08 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_KEY_3 ((PRNG_BASE)+(0x09 * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_RES_0 ((PRNG_BASE)+(0x0A * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_RES_1 ((PRNG_BASE)+(0x0B * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_RES_2 ((PRNG_BASE)+(0x0C * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_RES_3 ((PRNG_BASE)+(0x0D * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_LFSR_0 ((PRNG_BASE)+(0x0E * EIP93_REG_WIDTH)) ++#define EIP93_REG_PRNG_LFSR_1 ((PRNG_BASE)+(0x0F * EIP93_REG_WIDTH)) ++ ++/*----------------------------------------------------------------------------- ++ * Constants & masks ++ */ ++ ++#define EIP93_SUPPORTED_INTERRUPTS_MASK 0xffff7f00 ++#define EIP93_PRNG_DT_TEXT_LOWERHALF 0xDEAD ++#define EIP93_PRNG_DT_TEXT_UPPERHALF 0xC0DE ++#define EIP93_10BITS_MASK 0X3FF ++#define EIP93_12BITS_MASK 0XFFF ++#define EIP93_4BITS_MASK 0X04 ++#define EIP93_20BITS_MASK 0xFFFFF ++ ++#define EIP93_MIN_DESC_DONE_COUNT 0 ++#define EIP93_MAX_DESC_DONE_COUNT 15 ++ ++#define EIP93_MIN_DESC_PENDING_COUNT 0 ++#define EIP93_MAX_DESC_PENDING_COUNT 1023 ++ ++#define EIP93_MIN_TIMEOUT_COUNT 0 ++#define EIP93_MAX_TIMEOUT_COUNT 15 ++ ++#define EIP93_MIN_PE_INPUT_THRESHOLD 1 ++#define EIP93_MAX_PE_INPUT_THRESHOLD 511 ++ ++#define EIP93_MIN_PE_OUTPUT_THRESHOLD 1 ++#define EIP93_MAX_PE_OUTPUT_THRESHOLD 432 ++ ++#define EIP93_MIN_PE_RING_SIZE 1 ++#define EIP93_MAX_PE_RING_SIZE 1023 ++ ++#define EIP93_MIN_PE_DESCRIPTOR_SIZE 7 ++#define EIP93_MAX_PE_DESCRIPTOR_SIZE 15 ++ ++//3DES keys,seed,known data and its result ++#define EIP93_KEY_0 0x133b3454 ++#define EIP93_KEY_1 0x5e5b890b ++#define EIP93_KEY_2 0x5eb30757 ++#define EIP93_KEY_3 0x93ab15f7 ++#define EIP93_SEED_0 0x62c4bf5e ++#define EIP93_SEED_1 0x972667c8 ++#define EIP93_SEED_2 0x6345bf67 ++#define EIP93_SEED_3 0xcb3482bf ++#define EIP93_LFSR_0 0xDEADC0DE ++#define EIP93_LFSR_1 0xBEEFF00D ++ ++/*----------------------------------------------------------------------------- ++ * EIP93 device initialization specifics ++ */ ++ ++/*---------------------------------------------------------------------------- ++ * Byte Order Reversal Mechanisms Supported in EIP93 ++ * EIP93_BO_REVERSE_HALF_WORD : reverse the byte order within a half-word ++ * EIP93_BO_REVERSE_WORD : reverse the byte order within a word ++ * EIP93_BO_REVERSE_DUAL_WORD : reverse the byte order within a dual-word ++ * EIP93_BO_REVERSE_QUAD_WORD : reverse the byte order within a quad-word ++ */ ++enum EIP93_Byte_Order_Value_t { ++ EIP93_BO_REVERSE_HALF_WORD = 1, ++ EIP93_BO_REVERSE_WORD = 2, ++ EIP93_BO_REVERSE_DUAL_WORD = 4, ++ EIP93_BO_REVERSE_QUAD_WORD = 8, ++}; ++ ++/*---------------------------------------------------------------------------- ++ * Byte Order Reversal Mechanisms Supported in EIP93 for Target Data ++ * EIP93_BO_REVERSE_HALF_WORD : reverse the byte order within a half-word ++ * EIP93_BO_REVERSE_WORD : reverse the byte order within a word ++ */ ++enum EIP93_Byte_Order_Value_TD_t { ++ EIP93_BO_REVERSE_HALF_WORD_TD = 1, ++ EIP93_BO_REVERSE_WORD_TD = 2, ++}; ++ ++// BYTE_ORDER_CFG register values ++#define EIP93_BYTE_ORDER_PD EIP93_BO_REVERSE_WORD ++#define EIP93_BYTE_ORDER_SA EIP93_BO_REVERSE_WORD ++#define EIP93_BYTE_ORDER_DATA EIP93_BO_REVERSE_WORD ++#define EIP93_BYTE_ORDER_TD EIP93_BO_REVERSE_WORD_TD ++ ++// INT_CFG register values ++#define EIP93_INT_HOST_OUTPUT_TYPE 0 ++#define EIP93_INT_PULSE_CLEAR 0 ++ ++/* ++ * Interrupts of EIP93 ++ */ ++ ++enum EIP93_InterruptSource_t { ++ EIP93_INT_PE_CDRTHRESH_REQ = BIT(0), ++ EIP93_INT_PE_RDRTHRESH_REQ = BIT(1), ++ EIP93_INT_PE_OPERATION_DONE = BIT(9), ++ EIP93_INT_PE_INBUFTHRESH_REQ = BIT(10), ++ EIP93_INT_PE_OUTBURTHRSH_REQ = BIT(11), ++ EIP93_INT_PE_PRNG_IRQ = BIT(12), ++ EIP93_INT_PE_ERR_REG = BIT(13), ++ EIP93_INT_PE_RD_DONE_IRQ = BIT(16), ++}; ++ ++union peConfig_w { ++ u32 word; ++ struct { ++ u32 resetPE :1; ++ u32 resetRing :1; ++ u32 reserved :6; ++ u32 peMode :2; ++ u32 enCDRupdate :1; ++ u32 reserved2 :5; ++ u32 swapCDRD :1; ++ u32 swapSA :1; ++ u32 swapData :1; ++ u32 reserved3 :13; ++ } bits; ++} __packed; ++ ++union peEndianCfg_w { ++ u32 word; ++ struct { ++ u32 masterByteSwap :8; ++ u32 reserved :8; ++ u32 targetByteSwap :8; ++ u32 reserved2 :8; ++ } bits; ++} __packed; ++ ++union peIntCfg_w { ++ u32 word; ++ struct { ++ u32 PulseClear :1; ++ u32 IntType :1; ++ u32 reserved :30; ++ } bits; ++} __packed; ++ ++union peClockCfg_w { ++ u32 word; ++ struct { ++ u32 enPEclk :1; ++ u32 enDESclk :1; ++ u32 enAESclk :1; ++ u32 reserved :1; ++ u32 enHASHclk :1; ++ u32 reserved2 :27; ++ } bits; ++} __packed; ++ ++union peBufThresh_w { ++ u32 word; ++ struct { ++ u32 inputBuffer :8; ++ u32 reserved :8; ++ u32 outputBuffer :8; ++ u32 reserved2 :8; ++ } bits; ++} __packed; ++ ++union peRingThresh_w { ++ u32 word; ++ struct { ++ u32 CDRThresh :10; ++ u32 reserved :6; ++ u32 RDRThresh :10; ++ u32 RDTimeout :4; ++ u32 reserved2 :1; ++ u32 enTimeout :1; ++ } bits; ++} __packed; ++ ++union peRingCfg_w { ++ u32 word; ++ struct { ++ u32 ringSize :10; ++ u32 reserved :6; ++ u32 ringOffset :8; ++ u32 reserved2 :8; ++ } bits; ++} __packed; ++ ++union saCmd0 { ++ u32 word; ++ struct { ++ u32 opCode :3; ++ u32 direction :1; ++ u32 opGroup :2; ++ u32 padType :2; ++ u32 cipher :4; ++ u32 hash :4; ++ u32 reserved2 :1; ++ u32 scPad :1; ++ u32 extPad :1; ++ u32 hdrProc :1; ++ u32 digestLength :4; ++ u32 ivSource :2; ++ u32 hashSource :2; ++ u32 saveIv :1; ++ u32 saveHash :1; ++ u32 reserved1 :2; ++ } bits; ++} __packed; ++ ++union saCmd1 { ++ u32 word; ++ struct { ++ u32 copyDigest :1; ++ u32 copyHeader :1; ++ u32 copyPayload :1; ++ u32 copyPad :1; ++ u32 reserved4 :4; ++ u32 cipherMode :2; ++ u32 reserved3 :1; ++ u32 sslMac :1; ++ u32 hmac :1; ++ u32 byteOffset :1; ++ u32 reserved2 :2; ++ u32 hashCryptOffset :8; ++ u32 aesKeyLen :3; ++ u32 reserved1 :1; ++ u32 aesDecKey :1; ++ u32 seqNumCheck :1; ++ u32 reserved0 :2; ++ } bits; ++} __packed; ++ ++struct saRecord_s { ++ union saCmd0 saCmd0; ++ union saCmd1 saCmd1; ++ u32 saKey[8]; ++ u32 saIDigest[8]; ++ u32 saODigest[8]; ++ u32 saSpi; ++ u32 saSeqNum[2]; ++ u32 saSeqNumMask[2]; ++ u32 saNonce; ++} __packed; ++ ++struct saState_s { ++ u32 stateIv[4]; ++ u32 stateByteCnt[2]; ++ u32 stateIDigest[8]; ++} __packed; ++ ++union peCrtlStat_w { ++ u32 word; ++ struct { ++ u32 hostReady :1; ++ u32 peReady :1; ++ u32 reserved :1; ++ u32 initArc4 :1; ++ u32 hashFinal :1; ++ u32 haltMode :1; ++ u32 prngMode :2; ++ u32 padValue :8; ++ u32 errStatus :8; ++ u32 padCrtlStat :8; ++ } bits; ++} __packed; ++ ++union peLength_w { ++ u32 word; ++ struct { ++ u32 length :20; ++ u32 reserved :2; ++ u32 hostReady :1; ++ u32 peReady :1; ++ u32 byPass :8; ++ } bits; ++} __packed; ++ ++struct eip93_descriptor_s { ++ union peCrtlStat_w peCrtlStat; ++ u32 srcAddr; ++ u32 dstAddr; ++ u32 saAddr; ++ u32 stateAddr; ++ u32 arc4Addr; ++ u32 userId; ++ union peLength_w peLength; ++} __packed; ++ ++#endif +--- a/drivers/crypto/Kconfig ++++ b/drivers/crypto/Kconfig +@@ -918,4 +918,6 @@ config CRYPTO_DEV_SA2UL + + source "drivers/crypto/keembay/Kconfig" + ++source "drivers/crypto/mtk-eip93/Kconfig" ++ + endif # CRYPTO_HW +--- a/drivers/crypto/Makefile ++++ b/drivers/crypto/Makefile +@@ -51,3 +51,4 @@ obj-$(CONFIG_CRYPTO_DEV_ZYNQMP_AES) += x + obj-y += hisilicon/ + obj-$(CONFIG_CRYPTO_DEV_AMLOGIC_GXL) += amlogic/ + obj-y += keembay/ ++obj-$(CONFIG_CRYPTO_DEV_EIP93) += mtk-eip93/ From 20bd3502d3a841457cc06b3aa45646258fdcba9e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 12 Sep 2023 15:17:23 +0200 Subject: [PATCH 30/32] mac80211: fix mesh id corruption on 32 bit systems increase size of ifmsh->mbss_changed Signed-off-by: Felix Fietkau --- ...mesh-id-corruption-on-32-bit-systems.patch | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 package/kernel/mac80211/patches/subsys/311-mac80211-fix-mesh-id-corruption-on-32-bit-systems.patch diff --git a/package/kernel/mac80211/patches/subsys/311-mac80211-fix-mesh-id-corruption-on-32-bit-systems.patch b/package/kernel/mac80211/patches/subsys/311-mac80211-fix-mesh-id-corruption-on-32-bit-systems.patch new file mode 100644 index 00000000000..c0c774a89d5 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/311-mac80211-fix-mesh-id-corruption-on-32-bit-systems.patch @@ -0,0 +1,62 @@ +From: Felix Fietkau +Date: Tue, 12 Sep 2023 15:09:27 +0200 +Subject: [PATCH] mac80211: fix mesh id corruption on 32 bit systems +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since the changed field size was increased to u64, mesh_bss_info_changed +pulls invalid bits from the first 3 bytes of the mesh id, clears them, and +passes them on to ieee80211_link_info_change_notify, because +ifmsh->mbss_changed was not updated to match its size. +Fix this by turning into ifmsh->mbss_changed into an unsigned long array with +64 bit size. + +Fixes: 15ddba5f4311 ("wifi: mac80211: consistently use u64 for BSS changes") +Reported-by: Thomas Hühn +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -678,7 +678,7 @@ struct ieee80211_if_mesh { + struct timer_list mesh_path_root_timer; + + unsigned long wrkq_flags; +- unsigned long mbss_changed; ++ unsigned long mbss_changed[64 / BITS_PER_LONG]; + + bool userspace_handles_dfs; + +--- a/net/mac80211/mesh.c ++++ b/net/mac80211/mesh.c +@@ -1181,7 +1181,7 @@ void ieee80211_mbss_info_change_notify(s + + /* if we race with running work, worst case this work becomes a noop */ + for_each_set_bit(bit, &bits, sizeof(changed) * BITS_PER_BYTE) +- set_bit(bit, &ifmsh->mbss_changed); ++ set_bit(bit, ifmsh->mbss_changed); + set_bit(MESH_WORK_MBSS_CHANGED, &ifmsh->wrkq_flags); + wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work); + } +@@ -1263,7 +1263,7 @@ void ieee80211_stop_mesh(struct ieee8021 + + /* clear any mesh work (for next join) we may have accrued */ + ifmsh->wrkq_flags = 0; +- ifmsh->mbss_changed = 0; ++ memset(ifmsh->mbss_changed, 0, sizeof(ifmsh->mbss_changed)); + + local->fif_other_bss--; + atomic_dec(&local->iff_allmultis); +@@ -1730,9 +1730,9 @@ static void mesh_bss_info_changed(struct + u32 bit; + u64 changed = 0; + +- for_each_set_bit(bit, &ifmsh->mbss_changed, ++ for_each_set_bit(bit, ifmsh->mbss_changed, + sizeof(changed) * BITS_PER_BYTE) { +- clear_bit(bit, &ifmsh->mbss_changed); ++ clear_bit(bit, ifmsh->mbss_changed); + changed |= BIT(bit); + } + From 7b78a19e6a16f5c05bfc6d7925b9981048c508d7 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Sun, 10 Sep 2023 14:10:50 -0700 Subject: [PATCH 31/32] ipq806x: Correct OnHub sysupgrade config logic There's a typo in here: board_name is a function, not a variable. This issue was pointed out on the OpenWrt forum. Closes: #13409 Reviewed-by: Robert Marko Signed-off-by: Brian Norris --- target/linux/ipq806x/base-files/lib/upgrade/platform.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh index 108b0b76307..8eda75b7188 100644 --- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh @@ -82,7 +82,7 @@ platform_do_upgrade() { } platform_copy_config() { - case "${board_name}" in + case "$(board_name)" in asus,onhub |\ tplink,onhub) emmc_copy_config From 03306969f5a0cadfb60341d26f5658d6745cc2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kwiatek?= Date: Thu, 24 Aug 2023 12:18:02 +0200 Subject: [PATCH 32/32] ath11k-firmware: update to stable WLAN.HK.2.9.0.1-01890 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog from quic: Bug fixes, stability improvements from previous releases are present. There are no backward comatibility issues with this release. Known issues: IPV6 connectivity problem, see: https://github.com/openwrt/openwrt/pull/13203#issuecomment-1666947749 Tested-by: Michał Kwiatek # Xiaomi AX3600 Signed-off-by: Michał Kwiatek --- package/firmware/ath11k-firmware/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package/firmware/ath11k-firmware/Makefile b/package/firmware/ath11k-firmware/Makefile index 41178b25ff9..ea4977aa68c 100644 --- a/package/firmware/ath11k-firmware/Makefile +++ b/package/firmware/ath11k-firmware/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath11k-firmware -PKG_SOURCE_DATE:=2023-07-28 -PKG_SOURCE_VERSION:=006a4e2a23a6cf9e7a28d8349025a4418e39cb1d -PKG_MIRROR_HASH:=1043b8c01d28cad2a34e4586e4e6a3949bd1aed9f9afd5b71f527b6b23835e81 +PKG_SOURCE_DATE:=2023-08-22 +PKG_SOURCE_VERSION:=d8f82a98ff1aef330d65d8b5660b46d1a9809ee3 +PKG_MIRROR_HASH:=3dba19449758c3b17f117990d7ad4086554e012b579f1de16e9d9196a7fbaaa7 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git @@ -60,14 +60,14 @@ $(eval $(call Download,qcn9074-board)) define Package/ath11k-firmware-ipq8074/install $(INSTALL_DIR) $(1)/lib/firmware/IPQ8074 $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath11k-firmware/IPQ8074/hw2.0/2.9.0.1/WLAN.HK.2.9.0.1-01862-QCAHKSWPL_SILICONZ-1/* \ + $(PKG_BUILD_DIR)/ath11k-firmware/IPQ8074/hw2.0/2.9.0.1/WLAN.HK.2.9.0.1-01890-QCAHKSWPL_SILICONZ-1/* \ $(1)/lib/firmware/IPQ8074/ 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-01862-QCAHKSWPL_SILICONZ-1/* \ + $(PKG_BUILD_DIR)/ath11k-firmware/QCN9074/hw1.0/2.9.0.1/WLAN.HK.2.9.0.1-01890-QCAHKSWPL_SILICONZ-1/* \ $(1)/lib/firmware/ath11k/QCN9074/hw1.0/ $(INSTALL_BIN) \ $(DL_DIR)/$(QCN9074_BOARD_FILE) $(1)/lib/firmware/ath11k/QCN9074/hw1.0/board-2.bin