From 68d91f08edd0efd47841a2e53d3437d570a61612 Mon Sep 17 00:00:00 2001 From: Roger Pueyo Centelles Date: Tue, 31 Aug 2021 16:45:17 +0200 Subject: [PATCH 01/54] ath79: mikrotik: use 64 KiB SPI NOR erase sectors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch removes CONFIG_MTD_SPI_NOR_USE_4K_SECTORS from the default symbols for the ath79/mikrotik target. MikroTik devices hold some of their user-configurable settings in the soft_config partition, which is typically sized 4 KiB, of the SPI NOR flash memory. Previously, in the ar71xx target, it was possible to use 64 KiB erase sectors but also smaller 4 KiB ones when needed. This is no longer the case in ath79 with newer kernels so, to be able to write to these 4 KiB small partitions without erasing 60 KiB around, the CONFIG_MTD_SPI_NOR_USE_4K_SECTORS symbol was added to the defaults. However, this ended up making sysupgrade images which were built with 64 KiB size blocks not to keep settings (e.g., the files under /etc/config/) over the flashing process. Using 4 KiB erase sector size on the sysupgrade images (by setting BLOCKSIZE = 4k) allows keeping settings over a flashing process, but renders the process terribly slow, possibly causing a user to mistakenly force a manual device reboot while the process is still on- going. Instead, ditching the 4 KiB erase sectors for the default 64 KiB erase size provides normal SPI write speed and sysupgrade times, at the expense of not being able to modify the soft_config partition (which is rarely a required thing). An OpenWrt patch for MTD_SPI_NOR_USE_4K_SECTORS_LIMIT may once have allowed to use different per-partition erase sector sizes. Due to changes on recent kernels it now only works on a per-device basis. Also, partial eraseblock write can be performed in ath79 with kernels 5.4 and lower, by copying the blocks from the 64 KiB, erasing the whole sector and restoring those blocks not meant to be modified. A kernel bump had that patch broken for a long time, but got fixed in bf2870c. Note: the settings in the soft_config partition can be reset to their defaults by holding the reset button for 5 seconds (and less than 10 seconds) at device boot. Fixes: FS#3492 (sysupgrade […] loses settings...) Fixes: a66eee63368e (ath79: add mikrotik subtarget) Signed-off-by: Roger Pueyo Centelles --- target/linux/ath79/mikrotik/config-default | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/ath79/mikrotik/config-default b/target/linux/ath79/mikrotik/config-default index efea74a239..74cfdf0423 100644 --- a/target/linux/ath79/mikrotik/config-default +++ b/target/linux/ath79/mikrotik/config-default @@ -19,7 +19,6 @@ CONFIG_MTD_NAND_RB91X=y CONFIG_MTD_RAW_NAND=y CONFIG_MTD_ROUTERBOOT_PARTS=y CONFIG_MTD_SPI_NAND=y -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y CONFIG_MTD_SPLIT_MINOR_FW=y CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BLOCK=y From bbb38524011b44ff683638d66c3d197078727df1 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Fri, 15 Oct 2021 21:30:58 +0200 Subject: [PATCH 02/54] apm821xx: MBL: HDD regulators overhaul for MBL DUO Takimata reported on the OpenWrt forum in thread [0], that his MyBook Live Duo wasn't booting OpenWrt 21.02 after upgrading from the previous OpenWrt 19.07. The last logged entries on his console |[ 0.531599] sata1-regulator GPIO handle specifies active low - ignored |[ 0.538391] sata0-regulator GPIO handle specifies active low - ignored |[ 0.759791] ata2: SATA link down (SStatus 0 SControl 300) |[ 0.765251] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300) |[ 5.909555] ata1.00: qc timeout (cmd 0xec) |[ 5.913656] ata1.00: failed to IDENTIFY (I/O error, err_mask=0x4) |[ 6.231757] ata1: SATA link down (SStatus 0 SControl 300) This extract clearly showed that the HDD on which OpenWrt is installed, simply disappeared after the SATA power regulators had been initialized. The reason why this worked with OpenWrt 19.07 was because the kernel config symbol CONFIG_REGULATOR=y was not set in the target's config-4.14. (This shows that the MBL Single does differ from the DUO in that it does not have programmable power regulators for the HDDs.) [0] Reported-by: Takimata (forum) Tested-by: Takimata (forum) Signed-off-by: Christian Lamparter --- target/linux/apm821xx/dts/wd-mybooklive.dts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/target/linux/apm821xx/dts/wd-mybooklive.dts b/target/linux/apm821xx/dts/wd-mybooklive.dts index dcb8078050..bccf82fbaa 100644 --- a/target/linux/apm821xx/dts/wd-mybooklive.dts +++ b/target/linux/apm821xx/dts/wd-mybooklive.dts @@ -127,19 +127,23 @@ sata1pwr: sata1-regulator { compatible = "regulator-fixed"; regulator-name = "Power Drive Port 1"; - gpios = <&GPIO1 3 GPIO_ACTIVE_LOW>; + gpios = <&GPIO1 3 GPIO_ACTIVE_HIGH>; regulator-min-microvolt = <12000000>; regulator-max-microvolt = <12000000>; + regulator-boot-on; /* uboot sets this */ regulator-always-on; /* needed to read OS from HDD */ + enable-active-high; }; sata0pwr: sata0-regulator { compatible = "regulator-fixed"; regulator-name = "Power Drive Port 0"; - gpios = <&GPIO1 7 GPIO_ACTIVE_LOW>; + gpios = <&GPIO1 7 GPIO_ACTIVE_HIGH>; regulator-min-microvolt = <12000000>; regulator-max-microvolt = <12000000>; + regulator-boot-on; /* uboot sets this */ regulator-always-on; /* needed to read OS from HDD */ + enable-active-high; }; }; From 8a042450d8fd4e2916fb0e87d65bbbd7e3a97130 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Fri, 1 Oct 2021 21:53:26 +0200 Subject: [PATCH 03/54] apm821xx: MX60(W): re-enable + allow bigger future kernels The MX60's kernel is limited to 0x3EFC00 by the values in mkmerakifw.c. Since the initramfs method of loading the kernel seems to be working, this patch does away with the use of the mkmerakifw tool for the MX60(W). But this will go along with a change in u-boot as well. So before you upgrade, please attach the serial cable and perform: | setenv owrt510_boot run meraki_ubi owrt_bootargs\; run owrt_load1 owrt_bootkernel\; run owrt_load2 owrt_bootkernel | setenv bootcmd run owrt510_boot | saveenv Note: You won't be able to use older OpenWrt releases without switching the bootcmd back to owrt_boot! Note2: We are no longer compatible with older OpenWrt MX60 installs. the legacy BOARD_NAME and SUPPORTED_DEVICES can be dropped. This is because upgrades from older images are not possible without uboot env changes anymore. Also the bogus BLOCKSIZE value (which was set to 63k back then, in order to get the kernel properly aligned after the fdt + meraki header) can be set to the NANDs real value. The FDT size (which was needed for alignment) can now be slimmed down as well. Co-developed-by: Martin Kennedy Signed-off-by: Martin Kennedy Signed-off-by: Christian Lamparter --- .../etc/uci-defaults/05_fix-compat-version | 10 ++++++++++ target/linux/apm821xx/image/nand.mk | 14 ++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version diff --git a/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version new file mode 100644 index 0000000000..67664abc75 --- /dev/null +++ b/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version @@ -0,0 +1,10 @@ +. /lib/functions.sh + +case "$(board_name)" in +meraki,mx60) + uci set system.@system[0].compat_version="2.0" + uci commit system + ;; +esac + +exit 0 diff --git a/target/linux/apm821xx/image/nand.mk b/target/linux/apm821xx/image/nand.mk index b48bff7924..fa3ad6de20 100644 --- a/target/linux/apm821xx/image/nand.mk +++ b/target/linux/apm821xx/image/nand.mk @@ -41,22 +41,20 @@ endef TARGET_DEVICES += meraki_mr24 define Device/meraki_mx60 - DEFAULT := n DEVICE_VENDOR := Cisco Meraki DEVICE_MODEL := MX60/MX60W DEVICE_PACKAGES := kmod-spi-gpio kmod-usb-ledtrig-usbport kmod-usb-dwc2 \ kmod-usb-storage block-mount - BOARD_NAME := mx60 - BLOCKSIZE := 63k + BLOCKSIZE := 128k IMAGES := sysupgrade.bin - DTB_SIZE := 64512 + DTB_SIZE := 20480 IMAGE_SIZE := 1021m - KERNEL_SIZE := 4031k - KERNEL := kernel-bin | gzip | uImage gzip | MerakiAdd-dtb | MerakiNAND - KERNEL_INITRAMFS := kernel-bin | gzip | dtb | MuImage-initramfs gzip + KERNEL := kernel-bin | gzip | dtb | MuImage-initramfs gzip IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata UBINIZE_OPTS := -E 5 - SUPPORTED_DEVICES += mx60 + DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_MESSAGE := uboot's bootcmd has to be updated to support standard multi-image uImages. \ + Upgrade via sysupgrade mechanism is not possible. endef TARGET_DEVICES += meraki_mx60 From e9335c292003e15901ef5f665750f9493132eb28 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 31 Jul 2021 22:56:29 +0200 Subject: [PATCH 04/54] ath79: lzma-loader: fix & re-enable per-board CONFIG_BOARD_DEV Back in the AR71XX days, the lzma-loader code could be customized based on the $BOARD variable. These would be passed as a compile-time -DCONFIG_BOARD_$DEVICE_MODEL flag to the compiler. Hence, the lzma-loader would be able to include device-specific fixups. Note: There's still a fixup for the TpLink TL-WR1043ND V1 found in the lzma-loader's board.c code. But since the days of AR71XX I couldn't find a forum post or bug reported. So, I left it as is to not break anything by enabling it. => If you have a TL-WR1043ND V1 and you have problem with the ethernet: let me know. Because otherwise, the fixup might simply no longer needed with ath79 and it can be removed. Signed-off-by: Christian Lamparter --- target/linux/ath79/image/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile index 38c623bf27..768ec57044 100644 --- a/target/linux/ath79/image/Makefile +++ b/target/linux/ath79/image/Makefile @@ -27,14 +27,17 @@ define Build/loader-common endef define Build/loader-kernel - $(call Build/loader-common,LOADER_DATA="$@") + $(call Build/loader-common, \ + LOADER_DATA="$@" \ + BOARD="$(DEVICE_NAME)" ) endef define Build/loader-okli-compile $(call Build/loader-common, \ FLASH_OFFS=$(LOADER_FLASH_OFFS) \ FLASH_MAX=$(LOADER_FLASH_MAX) \ - KERNEL_MAGIC=$(LOADER_KERNEL_MAGIC) ) + KERNEL_MAGIC=$(LOADER_KERNEL_MAGIC) \ + BOARD="$(DEVICE_NAME)" ) endef # Arguments: From 8b0c053671e5fb7f36c123a281c51a8071bf96e3 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Thu, 13 Aug 2020 18:26:19 +0200 Subject: [PATCH 05/54] apm821xx: implement new LED label naming scheme This patch updates all current APM82181 devices over to that "new LED naming scheme". This includes many updates to the device-tree: - dropped the deprecated, but beloved "label" property. - rename all DT leds node names to led-#. - add function and color properties. - utilized panic-indicator property. - dropped led- aliases (see below). migration scripts for all devices are included. For more information. See: For the future: It looks like the color+function properties won over the dt-alias / label. This will need to be wired up into openwrt eventually. For APM821xx the situation is that all devices have a dedicated power and fault indicator. Signed-off-by: Christian Lamparter --- .../apm821xx/base-files/etc/board.d/01_leds | 44 +++++++-------- target/linux/apm821xx/base-files/etc/diag.sh | 50 +++++++++++++++++ .../etc/uci-defaults/04_led_migration | 56 +++++++++++++++++++ target/linux/apm821xx/dts/meraki-mr24.dts | 45 +++++++++------ target/linux/apm821xx/dts/meraki-mx60.dts | 50 ++++++++++------- .../linux/apm821xx/dts/netgear-wndap620.dts | 11 ++-- .../linux/apm821xx/dts/netgear-wndap660.dts | 24 +++++--- .../linux/apm821xx/dts/netgear-wndap6x0.dtsi | 34 ++++++----- .../linux/apm821xx/dts/netgear-wndr4700.dts | 55 ++++++++++-------- target/linux/apm821xx/dts/wd-mybooklive.dts | 26 +++++---- 10 files changed, 273 insertions(+), 122 deletions(-) create mode 100644 target/linux/apm821xx/base-files/etc/diag.sh create mode 100644 target/linux/apm821xx/base-files/etc/uci-defaults/04_led_migration diff --git a/target/linux/apm821xx/base-files/etc/board.d/01_leds b/target/linux/apm821xx/base-files/etc/board.d/01_leds index c6f855cd2d..0b203fd8a7 100644 --- a/target/linux/apm821xx/base-files/etc/board.d/01_leds +++ b/target/linux/apm821xx/base-files/etc/board.d/01_leds @@ -7,40 +7,40 @@ board=$(board_name) case "$board" in meraki,mr24) - ucidef_set_led_netdev "wan" "WAN" "mr24:green:wan" "eth0" - ucidef_set_led_wlan "wlan5g_1" "WIFI 5GHz-1" "mr24:green:wifi1" "phy1tpt" - ucidef_set_led_wlan "wlan5g_0" "WIFI 5GHz-0" "mr24:green:wifi2" "phy1radio" - ucidef_set_led_wlan "wlan2g_1" "WIFI 2.4GHz-1" "mr24:green:wifi3" "phy0tpt" - ucidef_set_led_wlan "wlan2g_0" "WIFI 2.4GHz-0" "mr24:green:wifi4" "phy0radio" + ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0" + ucidef_set_led_wlan "wlan5g_1" "WIFI 5GHz-1" "green:wlan-0" "phy1tpt" + ucidef_set_led_wlan "wlan5g_0" "WIFI 5GHz-0" "green:wlan-1" "phy1radio" + ucidef_set_led_wlan "wlan2g_1" "WIFI 2.4GHz-1" "green:wlan-2" "phy0tpt" + ucidef_set_led_wlan "wlan2g_0" "WIFI 2.4GHz-0" "green:wlan-3" "phy0radio" ;; meraki,mx60) - ucidef_set_led_switch "wan" "WAN" "mx60:green:wan" "switch0" "0x20" - ucidef_set_led_switch "lan1" "LAN1" "mx60:green:lan1" "switch0" "0x10" - ucidef_set_led_switch "lan2" "LAN2" "mx60:green:lan2" "switch0" "0x08" - ucidef_set_led_switch "lan3" "LAN3" "mx60:green:lan3" "switch0" "0x04" - ucidef_set_led_switch "lan4" "LAN4" "mx60:green:lan4" "switch0" "0x02" + ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x20" + ucidef_set_led_switch "lan1" "LAN1" "green:lan-0" "switch0" "0x10" + ucidef_set_led_switch "lan2" "LAN2" "green:lan-1" "switch0" "0x08" + ucidef_set_led_switch "lan3" "LAN3" "green:lan-2" "switch0" "0x04" + ucidef_set_led_switch "lan4" "LAN4" "green:lan-3" "switch0" "0x02" ;; netgear,wndap620) - ucidef_set_led_switch "lan_act" "LAN (Activity)" "wndap6x0:green:activity" "switch0" "0x04" "0x0f" "rx tx" - ucidef_set_led_switch "lan_100" "LAN 100Mbps" "wndap620:amber:link100" "switch0" "0x04" "0x04" "link" - ucidef_set_led_switch "lan_1000" "LAN 1000Mbps" "wndap620:green:link1000" "switch0" "0x04" "0x08" "link" + ucidef_set_led_switch "lan_act" "LAN (Activity)" "green:activity" "switch0" "0x04" "0x0f" "rx tx" + ucidef_set_led_switch "lan_100" "LAN 100Mbps" "amber:lan" "switch0" "0x04" "0x04" "link" + ucidef_set_led_switch "lan_1000" "LAN 1000Mbps" "green:lan" "switch0" "0x04" "0x08" "link" ;; netgear,wndap660) - ucidef_set_led_netdev "lan_act" "LAN (Activity)" "wndap6x0:green:activity" "eth0" - ucidef_set_led_switch "lan1_100" "LAN 100Mbps" "wndap660:amber:lan1-link100" "switch0" "0x04" "0x04" "link" - ucidef_set_led_switch "lan1_1000" "LAN 1000Mbps" "wndap660:green:lan1-link1000" "switch0" "0x04" "0x08" "link" - ucidef_set_led_switch "lan2_100" "LAN 100Mbps" "wndap660:amber:lan2-link100" "switch0" "0x02" "0x04" "link" - ucidef_set_led_switch "lan2_1000" "LAN 1000Mbps" "wndap660:green:lan2-link1000" "switch0" "0x02" "0x08" "link" - ucidef_set_led_wlan "wlan2g" "WLAN2G" "wndap6x0:green:wlan2g" "phy0tpt" - ucidef_set_led_wlan "wlan5g" "WLAN5G" "wndap6x0:green:wlan5g" "phy1tpt" + ucidef_set_led_netdev "lan_act" "LAN (Activity)" "green:activity" "eth0" + ucidef_set_led_switch "lan1_100" "LAN 100Mbps" "amber:lan-0" "switch0" "0x04" "0x04" "link" + ucidef_set_led_switch "lan1_1000" "LAN 1000Mbps" "green:lan-0" "switch0" "0x04" "0x08" "link" + ucidef_set_led_switch "lan2_100" "LAN 100Mbps" "amber:lan-1" "switch0" "0x02" "0x04" "link" + ucidef_set_led_switch "lan2_1000" "LAN 1000Mbps" "green:lan-1" "switch0" "0x02" "0x08" "link" + ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan-0" "phy0tpt" + ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan-1" "phy1tpt" ;; netgear,wndr4700) - ucidef_set_led_switch "wan_green" "WAN (green)" "wndr4700:green:wan" "switch0" "0x20" - ucidef_set_led_netdev "wan_yellow" "WAN (yellow)" "wndr4700:yellow:wan" "eth0.2" "tx rx" + ucidef_set_led_switch "wan_green" "WAN (green)" "green:wan" "switch0" "0x20" + ucidef_set_led_netdev "wan_yellow" "WAN (yellow)" "yellow:wan" "eth0.2" "tx rx" ;; esac diff --git a/target/linux/apm821xx/base-files/etc/diag.sh b/target/linux/apm821xx/base-files/etc/diag.sh new file mode 100644 index 0000000000..9a2f4202bb --- /dev/null +++ b/target/linux/apm821xx/base-files/etc/diag.sh @@ -0,0 +1,50 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-only + +. /lib/functions/leds.sh + +get_status_led() { + local status_led_file + + status_led_file=$(find /sys/class/leds/ -name "*:power" | head -n1) + if [ -d "$status_led_file" ]; then + basename $status_led_file + return + fi; +} + +get_failsafe_led() { + local status_led_file + + status_led_file=$(find /sys/class/leds/ -name "*:fault" | head -n1) + if [ -d "$status_led_file" ]; then + basename $status_led_file + return + fi; +} + +set_state() { + status_led=$(get_status_led) + + [ -z "$status_led" ] && return + + case "$1" in + preinit) + status_led_blink_preinit + ;; + failsafe) + status_led_off + status_led=$(get_failsafe_led) + status_led_blink_failsafe + ;; + preinit_regular) + status_led_blink_preinit_regular + ;; + upgrade) + status_led_blink_preinit_regular + ;; + done) + status_led_on + ;; + esac +} diff --git a/target/linux/apm821xx/base-files/etc/uci-defaults/04_led_migration b/target/linux/apm821xx/base-files/etc/uci-defaults/04_led_migration new file mode 100644 index 0000000000..b15ffa34af --- /dev/null +++ b/target/linux/apm821xx/base-files/etc/uci-defaults/04_led_migration @@ -0,0 +1,56 @@ +. /lib/functions.sh +. /lib/functions/migrations.sh + +board=$(board_name) + +case "$board" in +meraki,mr24) + migrate_leds "orange:power=amber:fault" \ + ":wifi1=:wlan-0" \ + ":wifi2=:wlan-1" \ + ":wifi3=:wlan-2" \ + ":wifi4=:wlan-3" + ;; +meraki,mx60) + migrate_leds ":lan1=:lan-0" \ + ":lan2=:lan-1" \ + ":lan3=:lan-2" \ + ":lan4=:lan-3" \ + "orange:power=amber:power" \ + "orange:wan=amber:wan" + ;; +netgear,wndap620) + migrate_leds ":activity=:lan-0" \ + ":test=:fault" \ + ":wlan2g=:wlan-0" \ + ":wlan5g=:wlan-1" \ + ":link100=:lan" \ + ":link1000=:lan-1" + ;; +netgear,wndap660) + migrate_leds ":activity=:lan-0" \ + ":test=:fault" \ + ":wlan2g=:wlan-0" \ + ":wlan5g=:wlan-1" \ + ":lan1-link100=:lan-0" \ + ":lan1-link1000=:lan-1" \ + ":lan2-link100=:lan-1" \ + ":lan2-link1000=:lan-2" + ;; +netgear,wndr4700) + migrate_leds "orange:power=amber:fault" \ + "white:logo=white:indicator" \ + "green:hd=green:disk" \ + "red:hd=red:disk-err" + ;; +wd,mybooklive) + migrate_leds "red:power=red:fault" \ + "blue:power=blue:disk" + ;; +esac + +remove_devicename_leds + +migrations_apply system + +exit 0 diff --git a/target/linux/apm821xx/dts/meraki-mr24.dts b/target/linux/apm821xx/dts/meraki-mr24.dts index 2f797f8352..e20d4f1fa9 100644 --- a/target/linux/apm821xx/dts/meraki-mr24.dts +++ b/target/linux/apm821xx/dts/meraki-mr24.dts @@ -9,6 +9,7 @@ /dts-v1/; +#include #include "apm82181.dtsi" / { @@ -17,10 +18,6 @@ aliases { serial0 = &UART1; - led-boot = &status; - led-failsafe = &failsafe; - led-running = &status; - led-upgrade = &status; }; chosen { @@ -128,38 +125,50 @@ leds { compatible = "gpio-leds"; - status: power-green { - label = "mr24:green:power"; + led-0 { + color = ; + function = LED_FUNCTION_POWER; gpios = <&GPIO0 18 GPIO_ACTIVE_LOW>; }; - failsafe: power-orange { - label = "mr24:orange:power"; + led-1 { + color = ; + function = LED_FUNCTION_FAULT; gpios = <&GPIO0 19 GPIO_ACTIVE_LOW>; + panic-indicator; }; - lan { - label = "mr24:green:wan"; + led-2 { + color = ; + function = LED_FUNCTION_WAN; gpios = <&GPIO0 17 GPIO_ACTIVE_LOW>; }; - ssi-0 { - label = "mr24:green:wifi1"; + led-3 { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <0>; gpios = <&GPIO0 23 GPIO_ACTIVE_LOW>; }; - ssi-1 { - label = "mr24:green:wifi2"; + led-4 { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <1>; gpios = <&GPIO0 22 GPIO_ACTIVE_LOW>; }; - ssi-2 { - label = "mr24:green:wifi3"; + led-5 { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <2>; gpios = <&GPIO0 21 GPIO_ACTIVE_LOW>; }; - ssi-3 { - label = "mr24:green:wifi4"; + led-6 { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <3>; gpios = <&GPIO0 20 GPIO_ACTIVE_LOW>; }; }; diff --git a/target/linux/apm821xx/dts/meraki-mx60.dts b/target/linux/apm821xx/dts/meraki-mx60.dts index fd5464f8a1..06dfa07965 100644 --- a/target/linux/apm821xx/dts/meraki-mx60.dts +++ b/target/linux/apm821xx/dts/meraki-mx60.dts @@ -9,6 +9,7 @@ /dts-v1/; +#include #include "apm82181.dtsi" / { @@ -17,10 +18,6 @@ aliases { serial0 = &UART1; - led-boot = &status; - led-failsafe = &failsafe; - led-running = &status; - led-upgrade = &status; }; chosen { @@ -116,43 +113,56 @@ leds { compatible = "gpio-leds"; - status: power-green { - label = "mx60:green:power"; + led-0 { + color = ; + function = LED_FUNCTION_POWER; gpios = <&GPIO0 18 GPIO_ACTIVE_LOW>; }; - failsafe: power-orange { - label = "mx60:orange:power"; + led-1 { + color = ; + function = LED_FUNCTION_FAULT; gpios = <&GPIO0 19 GPIO_ACTIVE_LOW>; + panic-indicator; }; - wan-green { - label = "mx60:green:wan"; + led-2 { + color = ; + function = LED_FUNCTION_WAN; gpios = <&GPIO0 17 GPIO_ACTIVE_LOW>; }; - wan-orange { - label = "mx60:orange:wan"; + led-3 { + color = ; + function = LED_FUNCTION_WAN; gpios = <&GPIO0 15 GPIO_ACTIVE_LOW>; }; - lan1 { - label = "mx60:green:lan1"; + led-4 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <0>; gpios = <&GPIO0 20 GPIO_ACTIVE_LOW>; }; - lan2 { - label = "mx60:green:lan2"; + led-5 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; gpios = <&GPIO0 21 GPIO_ACTIVE_LOW>; }; - lan3 { - label = "mx60:green:lan3"; + led-6 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; gpios = <&GPIO0 22 GPIO_ACTIVE_LOW>; }; - lan4 { - label = "mx60:green:lan4"; + led-7 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <3>; gpios = <&GPIO0 23 GPIO_ACTIVE_LOW>; }; }; diff --git a/target/linux/apm821xx/dts/netgear-wndap620.dts b/target/linux/apm821xx/dts/netgear-wndap620.dts index d72aef4def..50e1d0cf17 100644 --- a/target/linux/apm821xx/dts/netgear-wndap620.dts +++ b/target/linux/apm821xx/dts/netgear-wndap620.dts @@ -10,13 +10,16 @@ }; &LEDS { - link1000 { - label = "wndap620:green:link1000"; + led-5 { + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + color = ; gpios = <&GPIO0 9 GPIO_ACTIVE_HIGH>; }; - link100 { - label = "wndap620:amber:link100"; + led-6 { + function = LED_FUNCTION_LAN; + color = ; gpios = <&GPIO0 10 GPIO_ACTIVE_HIGH>; }; }; diff --git a/target/linux/apm821xx/dts/netgear-wndap660.dts b/target/linux/apm821xx/dts/netgear-wndap660.dts index e9f45abe0e..f01d1b3be0 100644 --- a/target/linux/apm821xx/dts/netgear-wndap660.dts +++ b/target/linux/apm821xx/dts/netgear-wndap660.dts @@ -10,23 +10,31 @@ }; &LEDS { - lan1-link1000 { - label = "wndap660:green:lan1-link1000"; + led-5 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; gpios = <&GPIO0 22 GPIO_ACTIVE_HIGH>; }; - lan1-link100 { - label = "wndap660:amber:lan1-link100"; + led-6 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <0>; gpios = <&GPIO0 23 GPIO_ACTIVE_HIGH>; }; - lan2-link1000 { - label = "wndap660:green:lan2-link1000"; + led-7 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; gpios = <&GPIO0 9 GPIO_ACTIVE_HIGH>; }; - lan2-link100 { - label = "wndap660:amber:lan2-link100"; + led-8 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; gpios = <&GPIO0 10 GPIO_ACTIVE_HIGH>; }; }; diff --git a/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi b/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi index 88284d0237..910817e5ed 100644 --- a/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi +++ b/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi @@ -3,15 +3,12 @@ * Device Tree Source for Netgear WNDAP620 and WNDAP660 */ +#include #include "apm82181.dtsi" / { aliases { serial0 = &UART0; - led-boot = &status; - led-failsafe = &failsafe; - led-running = &status; - led-upgrade = &status; }; chosen { @@ -137,29 +134,37 @@ LEDS: leds { compatible = "gpio-leds"; - status: power { - label = "wndap6x0:green:power"; + led-0 { + color = ; + function = LED_FUNCTION_POWER; gpios = <&GPIO0 18 GPIO_ACTIVE_HIGH>; }; - failsafe: test { - label = "wndap6x0:amber:test"; + led-1 { + color = ; + function = LED_FUNCTION_FAULT; gpios = <&GPIO0 17 GPIO_ACTIVE_HIGH>; panic-indicator; }; - activity { - label = "wndap6x0:green:activity"; + led-2 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <0>; gpios = <&GPIO0 21 GPIO_ACTIVE_HIGH>; }; - wlan2g { - label = "wndap6x0:green:wlan2g"; + led-3 { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <0>; gpios = <&GPIO0 19 GPIO_ACTIVE_HIGH>; }; - wlan5g { - label = "wndap6x0:green:wlan5g"; + led-4 { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <1>; gpios = <&GPIO0 20 GPIO_ACTIVE_HIGH>; }; }; @@ -216,4 +221,3 @@ read-only; }; }; - diff --git a/target/linux/apm821xx/dts/netgear-wndr4700.dts b/target/linux/apm821xx/dts/netgear-wndr4700.dts index ad23e8b441..286eba203b 100644 --- a/target/linux/apm821xx/dts/netgear-wndr4700.dts +++ b/target/linux/apm821xx/dts/netgear-wndr4700.dts @@ -7,8 +7,9 @@ /dts-v1/; -#include "apm82181.dtsi" #include +#include +#include "apm82181.dtsi" / { model = "Netgear WNDR4700/WNDR4720 Series"; @@ -16,10 +17,6 @@ aliases { serial0 = &UART0; - led-boot = &status; - led-failsafe = &failsafe; - led-running = &status; - led-upgrade = &status; }; chosen { @@ -367,53 +364,63 @@ leds { compatible = "gpio-leds"; - status: power-green { - label = "wndr4700:green:power"; + + led-0 { + color = ; + function = LED_FUNCTION_POWER; gpios = <&GPIO0 8 GPIO_ACTIVE_HIGH>; }; - failsafe: power-orange { - label = "wndr4700:orange:power"; + led-1 { + color = ; + function = LED_FUNCTION_FAULT; gpios = <&GPIO0 9 GPIO_ACTIVE_LOW>; - linux,default-trigger = "panic"; + panic-indicator; }; - usb-blue { - label = "wndr4700:blue:usb"; + led-2 { + color = ; + function = LED_FUNCTION_USB; gpios = <&GPIO0 10 GPIO_ACTIVE_HIGH>; trigger-sources = <&usb2_port 1>, <&usb2_port 2>, <&usb3_port 1>, <&usb3_port 2>; linux,default-trigger = "usbport"; }; - logo-white { - label = "wndr4700:white:logo"; + led-3 { + color = ; + function = LED_FUNCTION_INDICATOR; gpios = <&GPIO0 11 GPIO_ACTIVE_HIGH>; }; - wan-yellow { - label = "wndr4700:yellow:wan"; + led-4 { + color = ; + function = LED_FUNCTION_WAN; gpios = <&GPIO0 3 GPIO_ACTIVE_HIGH>; }; - wan-green { - label = "wndr4700:green:wan"; + led-5 { + color = ; + function = LED_FUNCTION_WAN; gpios = <&GPIO0 12 GPIO_ACTIVE_HIGH>; }; - hd-green { - label = "wndr4700:green:hd"; + led-6 { + color = ; + function = LED_FUNCTION_DISK; gpios = <&GPIO0 14 GPIO_ACTIVE_HIGH>; linux,default-trigger = "disk-activity"; }; - hd-red { - label = "wndr4700:red:hd"; + led-7 { + color = ; + function = LED_FUNCTION_DISK_ERR; gpios = <&GPIO0 17 GPIO_ACTIVE_HIGH>; }; - wlan-blue { - label = "wndr4700:blue:wlan"; + led-8 { + color = ; + function = LED_FUNCTION_WLAN; gpios = <&GPIO0 18 GPIO_ACTIVE_HIGH>; linux,default-trigger = "phy0tpt"; }; diff --git a/target/linux/apm821xx/dts/wd-mybooklive.dts b/target/linux/apm821xx/dts/wd-mybooklive.dts index bccf82fbaa..c96e7f75e9 100644 --- a/target/linux/apm821xx/dts/wd-mybooklive.dts +++ b/target/linux/apm821xx/dts/wd-mybooklive.dts @@ -6,6 +6,7 @@ /dts-v1/; +#include #include "apm82181.dtsi" / { @@ -14,10 +15,6 @@ aliases { serial0 = &UART0; - led-boot = &status; - led-failsafe = &status; - led-running = &status; - led-upgrade = &status; }; }; @@ -86,19 +83,26 @@ leds { compatible = "gpio-leds"; - failsafe: power-red { - label = "mbl:red:power"; + /* There's just one tri-color LED with three separate pins. + * One pin for each color (red, green and blue). Each has + * a different meaning. + */ + led-0 { + color = ; + function = LED_FUNCTION_FAULT; gpios = <&GPIO1 4 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "panic"; + panic-indicator; }; - status: power-green { - label = "mbl:green:power"; + led-1 { + color = ; + function = LED_FUNCTION_POWER; gpios = <&GPIO1 5 GPIO_ACTIVE_HIGH>; }; - power-blue { - label = "mbl:blue:power"; + led-2 { + color = ; + function = LED_FUNCTION_DISK; gpios = <&GPIO1 6 GPIO_ACTIVE_HIGH>; linux,default-trigger = "disk-activity"; }; From 9fcb5c367e8587c9626798ce3814a3ae2948e397 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Wed, 20 Oct 2021 21:04:43 +0200 Subject: [PATCH 06/54] apm821xx: WNDAP6X0: add missed uci-default for compat This should have been included in the previous patch that resized the kernel partition to fit bigger kernels. Fixes: 7a6a3494450c ("apm821xx: WNDAP620 + WNDAP660: reorganize partitions for 5.10") Signed-off-by: Christian Lamparter --- .../base-files/etc/uci-defaults/05_fix-compat-version | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version index 67664abc75..0be0b6112a 100644 --- a/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version +++ b/target/linux/apm821xx/base-files/etc/uci-defaults/05_fix-compat-version @@ -1,7 +1,9 @@ . /lib/functions.sh case "$(board_name)" in -meraki,mx60) +meraki,mx60|\ +netgear,wndap620|\ +netgear,wndap660) uci set system.@system[0].compat_version="2.0" uci commit system ;; From 9501ce909f54b87dab95f17c0408a4962365e130 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Fri, 22 Oct 2021 22:09:16 +0200 Subject: [PATCH 07/54] layerscape: Fix build in dtb This fixes a kernel build problem. The removed parts of the patch are already applied upstream. Fixes: 9ad3ef27b9ce ("kernel: bump 5.4 to 5.4.153") Signed-off-by: Hauke Mehrtens --- ...m64-dts-fsl-ls1028a-add-flexcan-node.patch | 27 ------------------- ...-0066-arm64-dts-ls1028a-add-gpu-node.patch | 2 +- ...64-dts-fsl-add-optee-node-for-ls1028.patch | 2 +- ...4-dts-ls1028a-Add-ftm_alarm0-DT-node.patch | 2 +- ...s1028a-Add-Felix-switch-port-DT-node.patch | 4 +-- ...28a-support-Felix-PF5-INTB-interrupt.patch | 4 +-- ...a-Add-ethernet-property-for-l2switch.patch | 4 +-- ...078-arm64-dts-fix-endianness-of-rcpm.patch | 2 +- ...a-Fix-interrupt-map-property-of-PCIe.patch | 4 +-- ...64-dts-ls1028a-fix-dwc-pci-over-smmu.patch | 4 +-- ...a-Update-the-clock-providers-for-the.patch | 2 +- ...28a-Update-clock-cells-of-dpclk-node.patch | 2 +- ...a-Add-properties-for-HD-Display-cont.patch | 2 +- ...s-fsl-Specify-phy-mode-for-CPU-ports.patch | 4 +-- ...op-compatible-string-from-Felix-swit.patch | 2 +- ...1028a-Specify-that-the-Felix-port-4-.patch | 2 +- ...1028a-Disable-eno3-and-make-swp5-the.patch | 8 +++--- ...-fsl-Add-clock-names-mclk0-for-SAI-n.patch | 6 ++--- ...cape-apply-dma-coherent-for-dwc3-nod.patch | 4 +-- ...a-Update-edma-compatible-to-fit-eDMA.patch | 2 +- ...-dts-ls1028a-Disable-swp5-by-default.patch | 4 +-- ...-fsl-ls1028a-prepare-dts-for-overlay.patch | 6 ++--- ...1028a-add-labels-to-Ethernet-switch-.patch | 2 +- 23 files changed, 37 insertions(+), 64 deletions(-) diff --git a/target/linux/layerscape/patches-5.4/302-dts-0058-arm64-dts-fsl-ls1028a-add-flexcan-node.patch b/target/linux/layerscape/patches-5.4/302-dts-0058-arm64-dts-fsl-ls1028a-add-flexcan-node.patch index 28dd5675ea..8ca0801422 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0058-arm64-dts-fsl-ls1028a-add-flexcan-node.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0058-arm64-dts-fsl-ls1028a-add-flexcan-node.patch @@ -85,30 +85,3 @@ Signed-off-by: Pankaj Bansal * * Harninder Rai * -@@ -301,6 +301,26 @@ - reg = <0x0 0x2190000 0x0 0x10000>; - interrupts = ; - clocks = <&sysclk>, <&clockgen 4 1>; -+ clock-names = "ipg", "per"; -+ status = "disabled"; -+ }; -+ -+ can0: can@2180000 { -+ compatible = "fsl,ls1028ar1-flexcan", -+ "fsl,lx2160ar1-flexcan"; -+ reg = <0x0 0x2180000 0x0 0x10000>; -+ interrupts = ; -+ clocks = <&sysclk>, <&clockgen 4 1>; -+ clock-names = "ipg", "per"; -+ status = "disabled"; -+ }; -+ -+ can1: can@2190000 { -+ compatible = "fsl,ls1028ar1-flexcan", -+ "fsl,lx2160ar1-flexcan"; -+ reg = <0x0 0x2190000 0x0 0x10000>; -+ interrupts = ; -+ clocks = <&sysclk>, <&clockgen 4 1>; - clock-names = "ipg", "per"; - status = "disabled"; - }; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0066-arm64-dts-ls1028a-add-gpu-node.patch b/target/linux/layerscape/patches-5.4/302-dts-0066-arm64-dts-ls1028a-add-gpu-node.patch index 24db800a11..c429b7ca1e 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0066-arm64-dts-ls1028a-add-gpu-node.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0066-arm64-dts-ls1028a-add-gpu-node.patch @@ -12,7 +12,7 @@ Signed-off-by: Yuantian Tang --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -556,6 +556,16 @@ +@@ -536,6 +536,16 @@ clock-names = "wdog_clk", "apb_pclk"; }; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0067-arm64-dts-fsl-add-optee-node-for-ls1028.patch b/target/linux/layerscape/patches-5.4/302-dts-0067-arm64-dts-fsl-add-optee-node-for-ls1028.patch index aa7bf3a34c..570a010bb0 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0067-arm64-dts-fsl-add-optee-node-for-ls1028.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0067-arm64-dts-fsl-add-optee-node-for-ls1028.patch @@ -13,7 +13,7 @@ Signed-off-by: Sahil Malhotra --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -789,6 +789,13 @@ +@@ -769,6 +769,13 @@ }; }; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0069-arm64-dts-ls1028a-Add-ftm_alarm0-DT-node.patch b/target/linux/layerscape/patches-5.4/302-dts-0069-arm64-dts-ls1028a-Add-ftm_alarm0-DT-node.patch index 38434cc8e7..b5193a5310 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0069-arm64-dts-ls1028a-Add-ftm_alarm0-DT-node.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0069-arm64-dts-ls1028a-Add-ftm_alarm0-DT-node.patch @@ -24,7 +24,7 @@ Signed-off-by: Biwen Li cpus { #address-cells = <1>; #size-cells = <0>; -@@ -787,6 +791,19 @@ +@@ -767,6 +771,19 @@ little-endian; }; }; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0074-arm64-dts-fsl-ls1028a-Add-Felix-switch-port-DT-node.patch b/target/linux/layerscape/patches-5.4/302-dts-0074-arm64-dts-fsl-ls1028a-Add-Felix-switch-port-DT-node.patch index 9d041feb14..3ed283edfd 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0074-arm64-dts-fsl-ls1028a-Add-Felix-switch-port-DT-node.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0074-arm64-dts-fsl-ls1028a-Add-Felix-switch-port-DT-node.patch @@ -22,7 +22,7 @@ Signed-off-by: Claudiu Manoil --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -768,7 +768,9 @@ +@@ -748,7 +748,9 @@ /* PF1: VF0-1 BAR0 - non-prefetchable memory */ 0x82000000 0x0 0x00000000 0x1 0xf8210000 0x0 0x020000 /* PF1: VF0-1 BAR2 - prefetchable memory */ @@ -33,7 +33,7 @@ Signed-off-by: Claudiu Manoil enetc_port0: ethernet@0,0 { compatible = "fsl,enetc"; -@@ -784,12 +786,66 @@ +@@ -764,12 +766,66 @@ #address-cells = <1>; #size-cells = <0>; }; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0076-arm64-dts-ls1028a-support-Felix-PF5-INTB-interrupt.patch b/target/linux/layerscape/patches-5.4/302-dts-0076-arm64-dts-ls1028a-support-Felix-PF5-INTB-interrupt.patch index 338764d486..2fd0819014 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0076-arm64-dts-ls1028a-support-Felix-PF5-INTB-interrupt.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0076-arm64-dts-ls1028a-support-Felix-PF5-INTB-interrupt.patch @@ -15,7 +15,7 @@ Signed-off-by: Yangbo Lu --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -750,7 +750,6 @@ +@@ -730,7 +730,6 @@ reg = <0x01 0xf0000000 0x0 0x100000>; #address-cells = <3>; #size-cells = <2>; @@ -23,7 +23,7 @@ Signed-off-by: Yangbo Lu msi-parent = <&its>; device_type = "pci"; bus-range = <0x0 0x0>; -@@ -803,6 +802,8 @@ +@@ -783,6 +782,8 @@ switch@0,5 { compatible = "mscc,felix-switch"; reg = <0x000500 0 0 0 0>; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0077-arm64-dts-ls1028a-Add-ethernet-property-for-l2switch.patch b/target/linux/layerscape/patches-5.4/302-dts-0077-arm64-dts-ls1028a-Add-ethernet-property-for-l2switch.patch index 0417cd7b61..9589af90ea 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0077-arm64-dts-ls1028a-Add-ethernet-property-for-l2switch.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0077-arm64-dts-ls1028a-Add-ethernet-property-for-l2switch.patch @@ -14,7 +14,7 @@ Signed-off-by: Claudiu Manoil --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -832,6 +832,7 @@ +@@ -812,6 +812,7 @@ }; port@5 { reg = <5>; @@ -22,7 +22,7 @@ Signed-off-by: Claudiu Manoil fixed-link { speed = <1000>; full-duplex; -@@ -839,7 +840,7 @@ +@@ -819,7 +820,7 @@ }; }; }; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0078-arm64-dts-fix-endianness-of-rcpm.patch b/target/linux/layerscape/patches-5.4/302-dts-0078-arm64-dts-fix-endianness-of-rcpm.patch index 23aabe8c27..0f57b17f3d 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0078-arm64-dts-fix-endianness-of-rcpm.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0078-arm64-dts-fix-endianness-of-rcpm.patch @@ -14,7 +14,7 @@ Signed-off-by: Biwen Li --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -854,6 +854,7 @@ +@@ -834,6 +834,7 @@ compatible = "fsl,ls1028a-rcpm", "fsl,qoriq-rcpm-2.1+"; reg = <0x0 0x1e34040 0x0 0x1c>; #fsl,rcpm-wakeup-cells = <7>; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0079-arm64-dts-ls1028a-Fix-interrupt-map-property-of-PCIe.patch b/target/linux/layerscape/patches-5.4/302-dts-0079-arm64-dts-ls1028a-Fix-interrupt-map-property-of-PCIe.patch index 6114b3ecca..9f1fcc6a60 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0079-arm64-dts-ls1028a-Fix-interrupt-map-property-of-PCIe.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0079-arm64-dts-ls1028a-Fix-interrupt-map-property-of-PCIe.patch @@ -13,7 +13,7 @@ Signed-off-by: Hou Zhiqiang --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -713,10 +713,10 @@ +@@ -693,10 +693,10 @@ msi-parent = <&its>; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 7>; @@ -28,7 +28,7 @@ Signed-off-by: Hou Zhiqiang status = "disabled"; }; -@@ -738,10 +738,10 @@ +@@ -718,10 +718,10 @@ msi-parent = <&its>; #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 7>; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0088-arm64-dts-ls1028a-fix-dwc-pci-over-smmu.patch b/target/linux/layerscape/patches-5.4/302-dts-0088-arm64-dts-ls1028a-fix-dwc-pci-over-smmu.patch index 205b46f7bd..82d6b4c043 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0088-arm64-dts-ls1028a-fix-dwc-pci-over-smmu.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0088-arm64-dts-ls1028a-fix-dwc-pci-over-smmu.patch @@ -16,7 +16,7 @@ Signed-off-by: Laurentiu Tudor --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -707,6 +707,7 @@ +@@ -687,6 +687,7 @@ #size-cells = <2>; device_type = "pci"; dma-coherent; @@ -24,7 +24,7 @@ Signed-off-by: Laurentiu Tudor bus-range = <0x0 0xff>; ranges = <0x81000000 0x0 0x00000000 0x80 0x00010000 0x0 0x00010000 /* downstream I/O */ 0x82000000 0x0 0x40000000 0x80 0x40000000 0x0 0x40000000>; /* non-prefetchable memory */ -@@ -732,6 +733,7 @@ +@@ -712,6 +713,7 @@ #size-cells = <2>; device_type = "pci"; dma-coherent; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0089-arm64-dts-ls1028a-Update-the-clock-providers-for-the.patch b/target/linux/layerscape/patches-5.4/302-dts-0089-arm64-dts-ls1028a-Update-the-clock-providers-for-the.patch index bcb3d7b5f0..8c2d085665 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0089-arm64-dts-ls1028a-Update-the-clock-providers-for-the.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0089-arm64-dts-ls1028a-Update-the-clock-providers-for-the.patch @@ -43,7 +43,7 @@ Signed-off-by: Shawn Guo reboot { compatible ="syscon-reboot"; regmap = <&rst>; -@@ -880,7 +866,8 @@ +@@ -860,7 +846,8 @@ interrupts = <0 222 IRQ_TYPE_LEVEL_HIGH>, <0 223 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "DE", "SE"; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0090-arm64-dts-ls1028a-Update-clock-cells-of-dpclk-node.patch b/target/linux/layerscape/patches-5.4/302-dts-0090-arm64-dts-ls1028a-Update-clock-cells-of-dpclk-node.patch index 62a506ae3d..b84ba01fb5 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0090-arm64-dts-ls1028a-Update-clock-cells-of-dpclk-node.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0090-arm64-dts-ls1028a-Update-clock-cells-of-dpclk-node.patch @@ -24,7 +24,7 @@ Signed-off-by: Shawn Guo clocks = <&osc_27m>; }; -@@ -866,7 +866,7 @@ +@@ -846,7 +846,7 @@ interrupts = <0 222 IRQ_TYPE_LEVEL_HIGH>, <0 223 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "DE", "SE"; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0091-arm64-dts-ls1028a-Add-properties-for-HD-Display-cont.patch b/target/linux/layerscape/patches-5.4/302-dts-0091-arm64-dts-ls1028a-Add-properties-for-HD-Display-cont.patch index f28eacbcf4..07620e57c9 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0091-arm64-dts-ls1028a-Add-properties-for-HD-Display-cont.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0091-arm64-dts-ls1028a-Add-properties-for-HD-Display-cont.patch @@ -17,7 +17,7 @@ Signed-off-by: Wen He --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -874,7 +874,23 @@ +@@ -854,7 +854,23 @@ port { dp0_out: endpoint { diff --git a/target/linux/layerscape/patches-5.4/302-dts-0093-arm64-dts-fsl-Specify-phy-mode-for-CPU-ports.patch b/target/linux/layerscape/patches-5.4/302-dts-0093-arm64-dts-fsl-Specify-phy-mode-for-CPU-ports.patch index 119a9b00c2..cf99f33251 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0093-arm64-dts-fsl-Specify-phy-mode-for-CPU-ports.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0093-arm64-dts-fsl-Specify-phy-mode-for-CPU-ports.patch @@ -15,7 +15,7 @@ Signed-off-by: Vladimir Oltean --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -813,6 +813,8 @@ +@@ -793,6 +793,8 @@ /* internal to-cpu ports */ port@4 { reg = <4>; @@ -24,7 +24,7 @@ Signed-off-by: Vladimir Oltean fixed-link { speed = <1000>; full-duplex; -@@ -821,6 +823,8 @@ +@@ -801,6 +803,8 @@ port@5 { reg = <5>; ethernet = <&enetc_port3>; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0094-arm64-dts-fsl-Drop-compatible-string-from-Felix-swit.patch b/target/linux/layerscape/patches-5.4/302-dts-0094-arm64-dts-fsl-Drop-compatible-string-from-Felix-swit.patch index 5c75c52aed..ff9a05d3cc 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0094-arm64-dts-fsl-Drop-compatible-string-from-Felix-swit.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0094-arm64-dts-fsl-Drop-compatible-string-from-Felix-swit.patch @@ -14,7 +14,7 @@ Signed-off-by: Vladimir Oltean --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -788,7 +788,6 @@ +@@ -768,7 +768,6 @@ little-endian; }; switch@0,5 { diff --git a/target/linux/layerscape/patches-5.4/302-dts-0095-arm64-dts-fsl-ls1028a-Specify-that-the-Felix-port-4-.patch b/target/linux/layerscape/patches-5.4/302-dts-0095-arm64-dts-fsl-ls1028a-Specify-that-the-Felix-port-4-.patch index 5aa96470ad..195f28754d 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0095-arm64-dts-fsl-ls1028a-Specify-that-the-Felix-port-4-.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0095-arm64-dts-fsl-ls1028a-Specify-that-the-Felix-port-4-.patch @@ -22,7 +22,7 @@ Signed-off-by: Vladimir Oltean --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -815,7 +815,7 @@ +@@ -805,7 +805,7 @@ phy-mode = "gmii"; fixed-link { diff --git a/target/linux/layerscape/patches-5.4/302-dts-0096-arm64-dts-fsl-ls1028a-Disable-eno3-and-make-swp5-the.patch b/target/linux/layerscape/patches-5.4/302-dts-0096-arm64-dts-fsl-ls1028a-Disable-eno3-and-make-swp5-the.patch index af0933aca5..a1c50bcefb 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0096-arm64-dts-fsl-ls1028a-Disable-eno3-and-make-swp5-the.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0096-arm64-dts-fsl-ls1028a-Disable-eno3-and-make-swp5-the.patch @@ -27,7 +27,7 @@ Signed-off-by: Vladimir Oltean --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -773,7 +773,7 @@ +@@ -753,7 +753,7 @@ #address-cells = <1>; #size-cells = <0>; }; @@ -36,7 +36,7 @@ Signed-off-by: Vladimir Oltean compatible = "fsl,enetc"; reg = <0x000200 0 0 0 0>; fixed-link { -@@ -812,6 +812,7 @@ +@@ -792,6 +792,7 @@ /* internal to-cpu ports */ port@4 { reg = <4>; @@ -44,7 +44,7 @@ Signed-off-by: Vladimir Oltean phy-mode = "gmii"; fixed-link { -@@ -821,7 +822,6 @@ +@@ -801,7 +802,6 @@ }; port@5 { reg = <5>; @@ -52,7 +52,7 @@ Signed-off-by: Vladimir Oltean phy-mode = "gmii"; fixed-link { -@@ -834,6 +834,8 @@ +@@ -814,6 +814,8 @@ enetc_port3: ethernet@0,6 { compatible = "fsl,enetc"; reg = <0x000600 0 0 0 0>; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0098-LF-403-ARM64-dts-fsl-Add-clock-names-mclk0-for-SAI-n.patch b/target/linux/layerscape/patches-5.4/302-dts-0098-LF-403-ARM64-dts-fsl-Add-clock-names-mclk0-for-SAI-n.patch index 0133ea009d..a6611b0b12 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0098-LF-403-ARM64-dts-fsl-Add-clock-names-mclk0-for-SAI-n.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0098-LF-403-ARM64-dts-fsl-Add-clock-names-mclk0-for-SAI-n.patch @@ -67,7 +67,7 @@ Signed-off-by: Alison Wang <&edma0 1 44>; --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -562,8 +562,9 @@ +@@ -542,8 +542,9 @@ reg = <0x0 0xf100000 0x0 0x10000>; interrupts = ; clocks = <&clockgen 4 1>, <&clockgen 4 1>, @@ -79,7 +79,7 @@ Signed-off-by: Alison Wang dma-names = "tx", "rx"; dmas = <&edma0 1 4>, <&edma0 1 3>; -@@ -576,8 +577,9 @@ +@@ -556,8 +557,9 @@ reg = <0x0 0xf110000 0x0 0x10000>; interrupts = ; clocks = <&clockgen 4 1>, <&clockgen 4 1>, @@ -91,7 +91,7 @@ Signed-off-by: Alison Wang dma-names = "tx", "rx"; dmas = <&edma0 1 6>, <&edma0 1 5>; -@@ -590,8 +592,9 @@ +@@ -570,8 +572,9 @@ reg = <0x0 0xf130000 0x0 0x10000>; interrupts = ; clocks = <&clockgen 4 1>, <&clockgen 4 1>, diff --git a/target/linux/layerscape/patches-5.4/302-dts-0099-arm64-dts-layerscape-apply-dma-coherent-for-dwc3-nod.patch b/target/linux/layerscape/patches-5.4/302-dts-0099-arm64-dts-layerscape-apply-dma-coherent-for-dwc3-nod.patch index 96003800f1..0db177972f 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0099-arm64-dts-layerscape-apply-dma-coherent-for-dwc3-nod.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0099-arm64-dts-layerscape-apply-dma-coherent-for-dwc3-nod.patch @@ -34,7 +34,7 @@ Signed-off-by: Ran Wang sata: sata@3200000 { --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -399,6 +399,7 @@ +@@ -379,6 +379,7 @@ snps,dis_rxdet_inp3_quirk; snps,quirk-frame-length-adjustment = <0x20>; snps,incr-burst-type-adjustment = <1>, <4>, <8>, <16>; @@ -42,7 +42,7 @@ Signed-off-by: Ran Wang }; usb1: usb@3110000 { -@@ -409,6 +410,7 @@ +@@ -389,6 +390,7 @@ snps,dis_rxdet_inp3_quirk; snps,quirk-frame-length-adjustment = <0x20>; snps,incr-burst-type-adjustment = <1>, <4>, <8>, <16>; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0103-arm64-dts-ls1028a-Update-edma-compatible-to-fit-eDMA.patch b/target/linux/layerscape/patches-5.4/302-dts-0103-arm64-dts-ls1028a-Update-edma-compatible-to-fit-eDMA.patch index 303b7d42f3..f2dccd7ac4 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0103-arm64-dts-ls1028a-Update-edma-compatible-to-fit-eDMA.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0103-arm64-dts-ls1028a-Update-edma-compatible-to-fit-eDMA.patch @@ -14,7 +14,7 @@ Signed-off-by: Peng Ma --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -345,7 +345,7 @@ +@@ -325,7 +325,7 @@ edma0: dma-controller@22c0000 { #dma-cells = <2>; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0110-arm64-dts-ls1028a-Disable-swp5-by-default.patch b/target/linux/layerscape/patches-5.4/302-dts-0110-arm64-dts-ls1028a-Disable-swp5-by-default.patch index 098f760dcf..8c81a4560c 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0110-arm64-dts-ls1028a-Disable-swp5-by-default.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0110-arm64-dts-ls1028a-Disable-swp5-by-default.patch @@ -12,11 +12,11 @@ Signed-off-by: Vladimir Oltean --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -828,6 +828,7 @@ +@@ -808,6 +808,7 @@ port@5 { reg = <5>; phy-mode = "gmii"; + status = "disabled"; fixed-link { - speed = <1000>; + speed = <2500>; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0112-arm64-dts-fsl-ls1028a-prepare-dts-for-overlay.patch b/target/linux/layerscape/patches-5.4/302-dts-0112-arm64-dts-fsl-ls1028a-prepare-dts-for-overlay.patch index 1db8c542ba..4b20e42794 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0112-arm64-dts-fsl-ls1028a-prepare-dts-for-overlay.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0112-arm64-dts-fsl-ls1028a-prepare-dts-for-overlay.patch @@ -385,7 +385,7 @@ Signed-off-by: Alex Marginean &sai4 { --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -792,30 +792,39 @@ +@@ -772,30 +772,39 @@ clocks = <&clockgen 2 3>; little-endian; }; @@ -432,7 +432,7 @@ Signed-off-by: Alex Marginean reg = <4>; ethernet = <&enetc_port2>; phy-mode = "gmii"; -@@ -825,7 +834,8 @@ +@@ -805,7 +814,8 @@ full-duplex; }; }; @@ -442,7 +442,7 @@ Signed-off-by: Alex Marginean reg = <5>; phy-mode = "gmii"; status = "disabled"; -@@ -837,6 +847,7 @@ +@@ -817,6 +827,7 @@ }; }; }; diff --git a/target/linux/layerscape/patches-5.4/302-dts-0114-arm64-dts-fsl-ls1028a-add-labels-to-Ethernet-switch-.patch b/target/linux/layerscape/patches-5.4/302-dts-0114-arm64-dts-fsl-ls1028a-add-labels-to-Ethernet-switch-.patch index 9faacc7228..e4d5449d08 100644 --- a/target/linux/layerscape/patches-5.4/302-dts-0114-arm64-dts-fsl-ls1028a-add-labels-to-Ethernet-switch-.patch +++ b/target/linux/layerscape/patches-5.4/302-dts-0114-arm64-dts-fsl-ls1028a-add-labels-to-Ethernet-switch-.patch @@ -13,7 +13,7 @@ Signed-off-by: Alex Marginean --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi -@@ -806,21 +806,25 @@ +@@ -786,21 +786,25 @@ mscc_felix_port0: port@0 { reg = <0>; status = "disabled"; From 0ca81ff047963782ba940d87389e544235272ee7 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Fri, 22 Oct 2021 23:48:24 +0200 Subject: [PATCH 08/54] procd: update to git HEAD jail: Fix build with glibc Signed-off-by: Hauke Mehrtens --- package/system/procd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index e5f4c2a50a..2ce86062dc 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git -PKG_SOURCE_DATE:=2021-10-17 -PKG_SOURCE_VERSION:=59f769920276229a3ee2dcbe75ea54095cf14ffe -PKG_MIRROR_HASH:=2514d914bf317c5965ef90440e2c6bd8c409805db02348af4ed4aa58a0496fcf +PKG_SOURCE_DATE:=2021-10-22 +PKG_SOURCE_VERSION:=1c36d3d0a8fc87b97e236269f5104e139f1d641d +PKG_MIRROR_HASH:=a5d64ab80c53bf3cb77e796aa673c2ba7d0a578fd443b802688ce91ee96a3f0d CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From eeeb9b7496780f76c724b77a04ac4ddbeac2372c Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Fri, 22 Oct 2021 23:51:05 +0200 Subject: [PATCH 09/54] uci: update to git HEAD cmake: Allow override of install directories Signed-off-by: Hauke Mehrtens --- package/system/uci/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/uci/Makefile b/package/system/uci/Makefile index 0c18033e06..48e5bcc4da 100644 --- a/package/system/uci/Makefile +++ b/package/system/uci/Makefile @@ -13,9 +13,9 @@ PKG_RELEASE:=6 PKG_SOURCE_URL=$(PROJECT_GIT)/project/uci.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE=2021-04-14 -PKG_SOURCE_VERSION:=4b3db1179747b6a6779029407984bacef851325c -PKG_MIRROR_HASH:=9d00b5056a0dd4094c7e19f1a0ecaffa90409f22ea28f164d0e36febd06e37d1 +PKG_SOURCE_DATE=2021-10-22 +PKG_SOURCE_VERSION:=f84f49f00fb70364f58b4cce72f1796a7190d370 +PKG_MIRROR_HASH:=9f4747a029976b43fcea9919643ce71e587e515edc21b280163f7262360d847f PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:= From 66cbf5fd4e9c0eb33234ee0378cd1036a18e00fe Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 23 Oct 2021 07:31:07 +0200 Subject: [PATCH 10/54] mt76: update to the latest version 9d288d7c0c73 mt76: mt7615: apply cached RF data for DBDC 4d2e81d9ecab mt76: mt7915: remove mt7915_mcu_add_he() 2c8c3bcd766c mt76: mt7915: rework .set_bitrate_mask() to support more options 577d45f6e4a0 mt76: mt7915: rework debugfs fixed-rate knob b68af355f707 mt76: mt7915: fix endiannes warning mt7915_mcu_beacon_check_caps b52adf981561 mt76: mt7915: add WA firmware log support ed3d8569c400 mt76: mt7915: add debugfs knobs for MCU utilization 0f49a22314a5 mt76: mt7921: disable 4addr capability 754d4a37ab71 mt76: mt7921: fix mt7921s Kconfig f81f42fe875f mt76: Print error message when reading EEPROM from mtd failed fd25a550965d mt76: Make use of the helper macro kthread_run() 1d01257662a6 wireless: mediatek: mt7921: fix Wformat build warning Signed-off-by: Felix Fietkau --- package/kernel/mt76/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 7bd3b5d3d3..09110e1289 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2021-10-20 -PKG_SOURCE_VERSION:=b649678c18cac4b7c85d7d7d86d17e9e4c9b7641 -PKG_MIRROR_HASH:=83bfe5c5e820bc8f2cbe95fa140a232336ac69c86c6df226738e910b3df525ed +PKG_SOURCE_DATE:=2021-10-23 +PKG_SOURCE_VERSION:=1d01257662a6874e78b65c5e721ee1731ab006b3 +PKG_MIRROR_HASH:=666ac5a6dfb3e73ace107815922766d661a2e2ea914a264c453ff8cae7839d3d PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 94c41ef2ef3e443e21ac099d4f38b790db4d9ccf Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 23 Oct 2021 13:31:08 +0200 Subject: [PATCH 11/54] mt76: update to the latest version f6bde7ba82ee mt76: connac: fix unresolved symbols when CONFIG_PM is unset Signed-off-by: Felix Fietkau --- package/kernel/mt76/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 09110e1289..ccb252d753 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2021-10-23 -PKG_SOURCE_VERSION:=1d01257662a6874e78b65c5e721ee1731ab006b3 -PKG_MIRROR_HASH:=666ac5a6dfb3e73ace107815922766d661a2e2ea914a264c453ff8cae7839d3d +PKG_SOURCE_DATE:=2021-10-23.1 +PKG_SOURCE_VERSION:=f6bde7ba82eebfbcba952bc436c5ab680fe754f1 +PKG_MIRROR_HASH:=2790686b4c1320950bf653c1fe23814f133b37971a31fc79cc88b352999c1ea4 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 85a42fa9cb9431728efde4252b61de423f2ca12c Mon Sep 17 00:00:00 2001 From: Tan Zien Date: Sat, 23 Oct 2021 04:15:08 +0800 Subject: [PATCH 12/54] ipq40xx: MR33: Fix LP5562 LED driver probe Add the reg and color property to each channel node. This update is to accommodate the multicolor framework. Refer to: Signed-off-by: Tan Zien [replaced links to lore, wrote something of a commit message] Signed-off-by: Christian Lamparter --- .../arch/arm/boot/dts/qcom-ipq4029-mr33.dts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-mr33.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-mr33.dts index 36a01e5053..9f311b1973 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-mr33.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-mr33.dts @@ -16,6 +16,7 @@ #include #include #include +#include / { model = "Meraki MR33 Access Point"; @@ -166,30 +167,40 @@ reg = <0x30>; clock-mode = /bits/8 <2>; enable-gpio = <&tlmm 48 GPIO_ACTIVE_HIGH>; + #address-cells = <1>; + #size-cells = <0>; /* RGB led */ - status_red: chan0 { + status_red: chan@0 { chan-name = "red:status"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; + reg = <0>; + color = ; }; - status_green: chan1 { + status_green: chan@1 { chan-name = "green:status"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; + reg = <1>; + color = ; }; - chan2 { + chan@2 { chan-name = "blue:status"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; + reg = <2>; + color = ; }; - chan3 { + chan@3 { chan-name = "white:status"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; + reg = <3>; + color = ; }; }; }; From 360c181dd747f033cb61f83915ce277c6497720f Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 22 Sep 2021 19:16:32 -0700 Subject: [PATCH 13/54] kernel: backport GPIO LED patch for MT7530 This allows to specify and control switch LEDs on devices using mt7530 (typically mediatek and ramips targets). Normally these LED GPIOs are 0, 3, 6, 9, and 12. wan/lan assignment is per device. GPIO 9 is normally inverted. so GPIO_ACTIVE_HIGH instead of GPIO_ACTIVE_LOW. Tested on Linksys E7350. Refreshed all patches. Signed-off-by: Rosen Penev --- ...-mt7530-MT7530-optional-GPIO-support.patch | 181 ++++++++++++++++++ ...-mt7530-Add-support-for-EEE-features.patch | 6 +- 2 files changed, 184 insertions(+), 3 deletions(-) create mode 100644 target/linux/generic/backport-5.10/781-v5.12-net-dsa-mt7530-MT7530-optional-GPIO-support.patch diff --git a/target/linux/generic/backport-5.10/781-v5.12-net-dsa-mt7530-MT7530-optional-GPIO-support.patch b/target/linux/generic/backport-5.10/781-v5.12-net-dsa-mt7530-MT7530-optional-GPIO-support.patch new file mode 100644 index 0000000000..6931500c44 --- /dev/null +++ b/target/linux/generic/backport-5.10/781-v5.12-net-dsa-mt7530-MT7530-optional-GPIO-support.patch @@ -0,0 +1,181 @@ +From 429a0edeefd88cbfca5c417dfb8561047bb50769 Mon Sep 17 00:00:00 2001 +From: DENG Qingfang +Date: Mon, 25 Jan 2021 12:43:22 +0800 +Subject: [PATCH] net: dsa: mt7530: MT7530 optional GPIO support + +MT7530's LED controller can drive up to 15 LED/GPIOs. + +Add support for GPIO control and allow users to use its GPIOs by +setting gpio-controller property in device tree. + +Signed-off-by: DENG Qingfang +Reviewed-by: Linus Walleij +Reviewed-by: Andrew Lunn +Signed-off-by: Jakub Kicinski +--- + drivers/net/dsa/mt7530.c | 110 +++++++++++++++++++++++++++++++++++++++ + drivers/net/dsa/mt7530.h | 20 +++++++ + 2 files changed, 130 insertions(+) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + + #include "mt7530.h" +@@ -1540,6 +1541,109 @@ mtk_get_tag_protocol(struct dsa_switch * + } + } + ++static inline u32 ++mt7530_gpio_to_bit(unsigned int offset) ++{ ++ /* Map GPIO offset to register bit ++ * [ 2: 0] port 0 LED 0..2 as GPIO 0..2 ++ * [ 6: 4] port 1 LED 0..2 as GPIO 3..5 ++ * [10: 8] port 2 LED 0..2 as GPIO 6..8 ++ * [14:12] port 3 LED 0..2 as GPIO 9..11 ++ * [18:16] port 4 LED 0..2 as GPIO 12..14 ++ */ ++ return BIT(offset + offset / 3); ++} ++ ++static int ++mt7530_gpio_get(struct gpio_chip *gc, unsigned int offset) ++{ ++ struct mt7530_priv *priv = gpiochip_get_data(gc); ++ u32 bit = mt7530_gpio_to_bit(offset); ++ ++ return !!(mt7530_read(priv, MT7530_LED_GPIO_DATA) & bit); ++} ++ ++static void ++mt7530_gpio_set(struct gpio_chip *gc, unsigned int offset, int value) ++{ ++ struct mt7530_priv *priv = gpiochip_get_data(gc); ++ u32 bit = mt7530_gpio_to_bit(offset); ++ ++ if (value) ++ mt7530_set(priv, MT7530_LED_GPIO_DATA, bit); ++ else ++ mt7530_clear(priv, MT7530_LED_GPIO_DATA, bit); ++} ++ ++static int ++mt7530_gpio_get_direction(struct gpio_chip *gc, unsigned int offset) ++{ ++ struct mt7530_priv *priv = gpiochip_get_data(gc); ++ u32 bit = mt7530_gpio_to_bit(offset); ++ ++ return (mt7530_read(priv, MT7530_LED_GPIO_DIR) & bit) ? ++ GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN; ++} ++ ++static int ++mt7530_gpio_direction_input(struct gpio_chip *gc, unsigned int offset) ++{ ++ struct mt7530_priv *priv = gpiochip_get_data(gc); ++ u32 bit = mt7530_gpio_to_bit(offset); ++ ++ mt7530_clear(priv, MT7530_LED_GPIO_OE, bit); ++ mt7530_clear(priv, MT7530_LED_GPIO_DIR, bit); ++ ++ return 0; ++} ++ ++static int ++mt7530_gpio_direction_output(struct gpio_chip *gc, unsigned int offset, int value) ++{ ++ struct mt7530_priv *priv = gpiochip_get_data(gc); ++ u32 bit = mt7530_gpio_to_bit(offset); ++ ++ mt7530_set(priv, MT7530_LED_GPIO_DIR, bit); ++ ++ if (value) ++ mt7530_set(priv, MT7530_LED_GPIO_DATA, bit); ++ else ++ mt7530_clear(priv, MT7530_LED_GPIO_DATA, bit); ++ ++ mt7530_set(priv, MT7530_LED_GPIO_OE, bit); ++ ++ return 0; ++} ++ ++static int ++mt7530_setup_gpio(struct mt7530_priv *priv) ++{ ++ struct device *dev = priv->dev; ++ struct gpio_chip *gc; ++ ++ gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL); ++ if (!gc) ++ return -ENOMEM; ++ ++ mt7530_write(priv, MT7530_LED_GPIO_OE, 0); ++ mt7530_write(priv, MT7530_LED_GPIO_DIR, 0); ++ mt7530_write(priv, MT7530_LED_IO_MODE, 0); ++ ++ gc->label = "mt7530"; ++ gc->parent = dev; ++ gc->owner = THIS_MODULE; ++ gc->get_direction = mt7530_gpio_get_direction; ++ gc->direction_input = mt7530_gpio_direction_input; ++ gc->direction_output = mt7530_gpio_direction_output; ++ gc->get = mt7530_gpio_get; ++ gc->set = mt7530_gpio_set; ++ gc->base = -1; ++ gc->ngpio = 15; ++ gc->can_sleep = true; ++ ++ return devm_gpiochip_add_data(dev, gc, priv); ++} ++ + static int + mt7530_setup(struct dsa_switch *ds) + { +@@ -1681,6 +1785,12 @@ mt7530_setup(struct dsa_switch *ds) + } + } + ++ if (of_property_read_bool(priv->dev->of_node, "gpio-controller")) { ++ ret = mt7530_setup_gpio(priv); ++ if (ret) ++ return ret; ++ } ++ + mt7530_setup_port5(ds, interface); + + /* Flush the FDB table */ +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -529,6 +529,26 @@ enum mt7531_clk_skew { + #define MT7531_GPIO12_RG_RXD3_MASK GENMASK(19, 16) + #define MT7531_EXT_P_MDIO_12 (2 << 16) + ++/* Registers for LED GPIO control (MT7530 only) ++ * All registers follow this pattern: ++ * [ 2: 0] port 0 ++ * [ 6: 4] port 1 ++ * [10: 8] port 2 ++ * [14:12] port 3 ++ * [18:16] port 4 ++ */ ++ ++/* LED enable, 0: Disable, 1: Enable (Default) */ ++#define MT7530_LED_EN 0x7d00 ++/* LED mode, 0: GPIO mode, 1: PHY mode (Default) */ ++#define MT7530_LED_IO_MODE 0x7d04 ++/* GPIO direction, 0: Input, 1: Output */ ++#define MT7530_LED_GPIO_DIR 0x7d10 ++/* GPIO output enable, 0: Disable, 1: Enable */ ++#define MT7530_LED_GPIO_OE 0x7d14 ++/* GPIO value, 0: Low, 1: High */ ++#define MT7530_LED_GPIO_DATA 0x7d18 ++ + #define MT7530_CREV 0x7ffc + #define CHIP_NAME_SHIFT 16 + #define MT7530_ID 0x7530 diff --git a/target/linux/generic/backport-5.10/781-v5.13-net-dsa-mt7530-Add-support-for-EEE-features.patch b/target/linux/generic/backport-5.10/781-v5.13-net-dsa-mt7530-Add-support-for-EEE-features.patch index ae4270391d..4952abdb1e 100644 --- a/target/linux/generic/backport-5.10/781-v5.13-net-dsa-mt7530-Add-support-for-EEE-features.patch +++ b/target/linux/generic/backport-5.10/781-v5.13-net-dsa-mt7530-Add-support-for-EEE-features.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c -@@ -2267,6 +2267,17 @@ static void mt753x_phylink_mac_link_up(s +@@ -2377,6 +2377,17 @@ static void mt753x_phylink_mac_link_up(s mcr |= PMCR_RX_FC_EN; } @@ -35,7 +35,7 @@ Signed-off-by: David S. Miller mt7530_set(priv, MT7530_PMCR_P(port), mcr); } -@@ -2497,6 +2508,36 @@ mt753x_phy_write(struct dsa_switch *ds, +@@ -2607,6 +2618,36 @@ mt753x_phy_write(struct dsa_switch *ds, return priv->info->phy_write(ds, port, regnum, val); } @@ -72,7 +72,7 @@ Signed-off-by: David S. Miller static const struct dsa_switch_ops mt7530_switch_ops = { .get_tag_protocol = mtk_get_tag_protocol, .setup = mt753x_setup, -@@ -2525,6 +2566,8 @@ static const struct dsa_switch_ops mt753 +@@ -2635,6 +2676,8 @@ static const struct dsa_switch_ops mt753 .phylink_mac_an_restart = mt753x_phylink_mac_an_restart, .phylink_mac_link_down = mt753x_phylink_mac_link_down, .phylink_mac_link_up = mt753x_phylink_mac_link_up, From ac4a21141a0e091ff1e5f8e1f03dded082582f37 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Sat, 23 Oct 2021 11:27:35 +0200 Subject: [PATCH 14/54] ath79: ag71xx: Disable napi related interrupts during probe ag71xx_probe is registering ag71xx_interrupt as handler for the gmac0/gmac1 interrupts. The handler is trying to use napi_schedule to handle the processing of packets. But the netif_napi_add for this device is called a lot later in ag71xx_probe. It can therefore happen that a still running gmac0/gmac1 is triggering the interrupt handler with a bit from AG71XX_INT_POLL set in AG71XX_REG_INT_STATUS. The handler will then call napi_schedule and the napi code will crash the system because the ag->napi is not yet initialized: libphy: Fixed MDIO Bus: probed CPU 0 Unable to handle kernel paging request at virtual address 00000000, epc == 00000000, ra == 81373408 Oops[#1]: CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.152 #0 $ 0 : 00000000 00000001 00000000 8280bf28 $ 4 : 82a98cb0 00000000 81620000 00200140 $ 8 : 00000000 00000000 74657272 7570743a $12 : 0000005b 8280bdb9 ffffffff ffffffff $16 : 00000001 82a98cb0 00000000 8280bf27 $20 : 8280bf28 81620000 ffff8b00 8280bf30 $24 : 00000000 8125af9c $28 : 82828000 8280bed8 81610000 81373408 Hi : 00005fff Lo : 2e48f657 epc : 00000000 0x0 ra : 81373408 __napi_poll+0x3c/0x11c Status: 1100dc03 KERNEL EXL IE Cause : 00800008 (ExcCode 02) BadVA : 00000000 PrId : 00019750 (MIPS 74Kc) Modules linked in: Process swapper (pid: 1, threadinfo=(ptrval), task=(ptrval), tls=00000000) Stack : ffff8afb ffff8afa 81620000 00200140 00000000 82a98cb0 00000008 0000012c 81625620 81373684 ffffffff ffffffff ffffffef 00000008 816153d8 81620000 815b0d60 815bbd54 00000000 81753700 8280bf28 8280bf28 8280bf30 8280bf30 81753748 00000008 00000003 00000004 0000000c 00000100 3fffffff 8175373c 816059f0 814ddb48 00000001 8160ab30 81615488 810618bc 00000006 00000000 ... Call Trace: [<81373684>] net_rx_action+0xfc/0x26c [<814ddb48>] __do_softirq+0x118/0x2ec [<810618bc>] handle_percpu_irq+0x50/0x80 [<8125ab8c>] plat_irq_dispatch+0x94/0xc8 [<81004e98>] handle_int+0x138/0x144 Code: (Bad address in epc) ---[ end trace a60d797432b656b2 ]--- The gmcc0/gmac1 must be brought in a state in which it doesn't signal a AG71XX_INT_POLL related status bits as interrupt before registering the interrupt handler. ag71xx_hw_start will take care of re-initializing the AG71XX_REG_INT_ENABLE. Fixes: f529a3742043 ("surprise :p") Signed-off-by: Sven Eckelmann --- .../files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 607cc0b934..a38b336a8d 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 @@ -1600,6 +1600,12 @@ static int ag71xx_probe(struct platform_device *pdev) return -ENOMEM; } + /* ensure that HW is in manual polling mode before interrupts are + * activated. Otherwise ag71xx_interrupt might call napi_schedule + * before it is initialized by netif_napi_add. + */ + ag71xx_int_disable(ag, AG71XX_INT_POLL); + dev->irq = platform_get_irq(pdev, 0); err = devm_request_irq(&pdev->dev, dev->irq, ag71xx_interrupt, 0x0, dev_name(&pdev->dev), dev); From 430f69194388ad6a7826a51e0e2b2dd478e27f0f Mon Sep 17 00:00:00 2001 From: Deomid Ryabkov Date: Sat, 23 Oct 2021 16:22:39 +0300 Subject: [PATCH 15/54] base-files: chmod 1777 /var/lock Per FHS 3.0, /var/lock is the location for lock files [1]. However its current permissions (755) are too restrictive for use by unprivileged processes. Debian and Ubuntu set them to 1777, and now so do we. [1] Signed-off-by: Deomid Ryabkov [fixed typo in commit message, had to remove "rojer" due to git hooks] Signed-off-by: Christian Lamparter --- package/base-files/files/etc/init.d/boot | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index a1e8e828dd..e1c60c1c2f 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -21,9 +21,10 @@ boot() { [ -f /proc/mounts ] || /sbin/mount_root [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc - mkdir -p /var/run - mkdir -p /var/log mkdir -p /var/lock + chmod 1777 /var/lock + mkdir -p /var/log + mkdir -p /var/run mkdir -p /var/state mkdir -p /var/tmp mkdir -p /tmp/.uci From dbb4c47798b17112cb1eed2a309cdefd33b5f193 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 23 Oct 2021 18:08:51 +0200 Subject: [PATCH 16/54] wireless-regdb: update to version 2021.08.28 e983a25 Update regulatory rules for Ecuador (EC) a0bcb88 wireless-regdb: Update regulatory rules for Norway (NO) on 6 and 60 GHz cdf854d wireless-regdb: Update regulatory rules for Germany (DE) on 6GHz 86cba52 wireless-regdb: reduce bandwidth for 5730-5850 and 5850-5895 MHz in US 6fa2384 wireless-regdb: remove PTMP-ONLY from 5850-5895 MHz for US 9839e1e wireless-regdb: recent FCC report and order allows 5850-5895 immediately 42dfaf4 wireless-regdb: update 5725-5850 MHz rule for GB Signed-off-by: Christian Lamparter --- package/firmware/wireless-regdb/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/firmware/wireless-regdb/Makefile b/package/firmware/wireless-regdb/Makefile index c209d802e4..2346de8578 100644 --- a/package/firmware/wireless-regdb/Makefile +++ b/package/firmware/wireless-regdb/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wireless-regdb -PKG_VERSION:=2021.04.21 +PKG_VERSION:=2021.08.28 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/wireless-regdb/ -PKG_HASH:=9e4c02b2a9710df4dbdb327c39612e8cbbae6495987afeddaebab28c1ea3d8fa +PKG_HASH:=cff370c410d1e6d316ae0a7fa8ac6278fdf1efca5d3d664aca7cfd2aafa54446 PKG_MAINTAINER:=Felix Fietkau From 40c18e95dc0dfb16f248e2caa152910dbcf14d74 Mon Sep 17 00:00:00 2001 From: Michael Peleshenko Date: Thu, 21 Oct 2021 18:14:05 -0400 Subject: [PATCH 17/54] umdns: add missing syscall to seccomp filter The 'clock_gettime64', syscall is missing. Found with 'utrace /usr/sbin/umdns' on an R7800. Signed-off-by: Michael Peleshenko --- package/network/services/umdns/files/umdns.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package/network/services/umdns/files/umdns.json b/package/network/services/umdns/files/umdns.json index aa9f49fa32..e941b223a8 100644 --- a/package/network/services/umdns/files/umdns.json +++ b/package/network/services/umdns/files/umdns.json @@ -6,6 +6,7 @@ "bind", "brk", "clock_gettime", + "clock_gettime64", "close", "connect", "epoll_create", From 7630001427fa266fa61da0b2533e2c1054eababe Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Sat, 23 Oct 2021 21:30:55 +0200 Subject: [PATCH 18/54] ethtool: update to v5.14 Update to newly released version 5.14 Signed-off-by: Hans Dedecker --- package/network/utils/ethtool/Makefile | 6 +++--- scripts/qemustart | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile index 9889677a16..d34dc96b98 100644 --- a/package/network/utils/ethtool/Makefile +++ b/package/network/utils/ethtool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ethtool -PKG_VERSION:=5.13 -PKG_RELEASE:=2 +PKG_VERSION:=5.14 +PKG_RELEASE:=1 PKG_MAINTAINER:=Felix Fietkau PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/ethtool -PKG_HASH:=e63a7254c6cf2e443d9989c8c34a94e136d789ae1cf5da55397439b055e48cf3 +PKG_HASH:=bb13db91915cacd7a492b65b65df07a67e4b974ddbeaf76205b1945a23d27686 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/scripts/qemustart b/scripts/qemustart index f0ddefb839..879f1834f9 100755 --- a/scripts/qemustart +++ b/scripts/qemustart @@ -203,7 +203,7 @@ start_qemu_armvirt() { ) } - "$qemu_exe" -machine "$mach" -cpu "$cpu" -nographic \ + sudo "$qemu_exe" -machine "$mach" -cpu "$cpu" -nographic \ -kernel "$kernel" \ "${o_qemu_extra[@]}" } From abc7a97e9c29bcb1e74c3d443d46fefa7517699c Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Sat, 23 Oct 2021 21:37:27 +0200 Subject: [PATCH 19/54] Revert "ethtool: update to v5.14" This reverts commit 7630001427fa266fa61da0b2533e2c1054eababe Signed-off-by: Hans Dedecker --- package/network/utils/ethtool/Makefile | 6 +++--- scripts/qemustart | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile index d34dc96b98..9889677a16 100644 --- a/package/network/utils/ethtool/Makefile +++ b/package/network/utils/ethtool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ethtool -PKG_VERSION:=5.14 -PKG_RELEASE:=1 +PKG_VERSION:=5.13 +PKG_RELEASE:=2 PKG_MAINTAINER:=Felix Fietkau PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/ethtool -PKG_HASH:=bb13db91915cacd7a492b65b65df07a67e4b974ddbeaf76205b1945a23d27686 +PKG_HASH:=e63a7254c6cf2e443d9989c8c34a94e136d789ae1cf5da55397439b055e48cf3 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/scripts/qemustart b/scripts/qemustart index 879f1834f9..f0ddefb839 100755 --- a/scripts/qemustart +++ b/scripts/qemustart @@ -203,7 +203,7 @@ start_qemu_armvirt() { ) } - sudo "$qemu_exe" -machine "$mach" -cpu "$cpu" -nographic \ + "$qemu_exe" -machine "$mach" -cpu "$cpu" -nographic \ -kernel "$kernel" \ "${o_qemu_extra[@]}" } From a1d3796efebd6685ad34c9f95b67eca3486ebf3e Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Sat, 23 Oct 2021 21:39:41 +0200 Subject: [PATCH 20/54] ethtool: update to v5.14 Update to newly released version 5.14 Signed-off-by: Hans Dedecker --- package/network/utils/ethtool/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile index 9889677a16..d34dc96b98 100644 --- a/package/network/utils/ethtool/Makefile +++ b/package/network/utils/ethtool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ethtool -PKG_VERSION:=5.13 -PKG_RELEASE:=2 +PKG_VERSION:=5.14 +PKG_RELEASE:=1 PKG_MAINTAINER:=Felix Fietkau PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/ethtool -PKG_HASH:=e63a7254c6cf2e443d9989c8c34a94e136d789ae1cf5da55397439b055e48cf3 +PKG_HASH:=bb13db91915cacd7a492b65b65df07a67e4b974ddbeaf76205b1945a23d27686 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING From e185080c871a712a41ef02f6b20f1d07d2f1ab87 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Mon, 4 Oct 2021 23:48:20 +0200 Subject: [PATCH 21/54] mac80211: Update to version 5.11.22-1 The removed patches were applied upstream. This backports version 5.11.22 and later does not support kernel versions < 4.4, this allows us to remove some patches too. Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 6 +- .../patches/ath/400-ath_move_debug_code.patch | 2 +- .../patches/ath/402-ath_regd_optional.patch | 8 +- .../patches/ath/404-regd_no_assoc_hints.patch | 4 +- .../ath/406-ath_relax_default_regd.patch | 2 +- .../ath10k/080-ath10k_thermal_config.patch | 4 +- ...21-ath10k_init_devices_synchronously.patch | 2 +- ...h10k-increase-rx-buffer-size-to-2048.patch | 2 +- .../930-ath10k_add_tpt_led_trigger.patch | 4 +- ...rolling-support-for-various-chipsets.patch | 10 +- ...75-ath10k-use-tpt-trigger-by-default.patch | 4 +- ...h10k-Try-to-get-mac-address-from-dts.patch | 2 +- ...erpret-requested-txpower-in-EIRP-dom.patch | 4 +- ...power-reduction-for-US-regulatory-do.patch | 2 +- .../ath9k/410-ath9k_allow_adhoc_and_ap.patch | 2 +- ...abled-MFP-capability-unconditionally.patch | 4 +- .../patches/ath9k/501-ath9k_ahb_init.patch | 2 +- .../patches/ath9k/530-ath9k_extra_leds.patch | 8 +- .../ath9k/542-ath9k_debugfs_diag.patch | 8 +- .../ath9k/543-ath9k_entropy_from_adc.patch | 8 +- ...544-ath9k-ar933x-usb-hang-workaround.patch | 4 +- .../ath9k/545-ath9k_ani_ws_detect.patch | 2 +- .../ath9k/548-ath9k_enable_gpio_chip.patch | 4 +- .../ath9k/549-ath9k_enable_gpio_buttons.patch | 2 +- .../ath9k/551-ath9k_ubnt_uap_plus_hsr.patch | 6 +- .../patches/ath9k/552-ath9k-ahb_of.patch | 2 +- .../brcm/812-b43-add-antenna-control.patch | 8 +- ...62-brcmfmac-Disable-power-management.patch | 2 +- .../mac80211/patches/brcm/998-survey.patch | 8 +- .../build/003-remove_bogus_modparams.patch | 2 +- .../build/004-kconfig_backport_fix.patch | 28 -- .../patches/build/010-disable_rfkill.patch | 15 - .../patches/build/050-lib80211_option.patch | 4 +- .../patches/build/060-no_local_ssb_bcma.patch | 10 +- ...700-mwl8k-missing-pci-id-for-WNR854T.patch | 2 +- ...940-mwl8k_init_devices_synchronously.patch | 4 +- ...define-RF5592-in-init_eeprom-routine.patch | 2 +- .../602-rt2x00-introduce-rt2x00eeprom.patch | 10 +- ...isabling_bands_through_platform_data.patch | 4 +- ...07-rt2x00-add_platform_data_mac_addr.patch | 2 +- ...00-allow_disabling_bands_through_dts.patch | 2 +- ...0-rt2x00-change-led-polarity-from-OF.patch | 2 +- .../611-rt2x00-add-AP+STA-support.patch | 2 +- .../612-rt2x00-led-tpt-trigger-support.patch | 4 +- ...dd-support-for-external-PA-on-MT7620.patch | 6 +- ...-rt2x00-add-rf-self-txdc-calibration.patch | 4 +- .../rt2x00/983-rt2x00-add-r-calibration.patch | 4 +- .../984-rt2x00-add-rxdcoc-calibration.patch | 4 +- .../985-rt2x00-add-rxiq-calibration.patch | 4 +- .../986-rt2x00-add-TX-LOFT-calibration.patch | 4 +- ...-differentiate-based-on-SoC-CHIP_VER.patch | 16 +- ...ave-survey-for-every-channel-visited.patch | 183 -------- ...ent-set_tim-by-update-beacon-content.patch | 4 +- .../patches/subsys/010-sync-nl80211_h.patch | 223 +--------- .../110-mac80211_keep_keys_on_stop_ap.patch | 2 +- .../subsys/150-disable_addr_notifier.patch | 6 +- .../mac80211/patches/subsys/210-ap_scan.patch | 2 +- ...ort-immediate-reconnect-request-hint.patch | 279 ------------ ...-driver-based-disconnect-with-reconn.patch | 271 ------------ ...port-to-configure-SAE-PWE-value-to-d.patch | 74 ---- ...-get_default_func-move-default-flow-.patch | 14 +- ...ot-maintain-a-backlog-sorted-list-of.patch | 2 +- ...add-rx-decapsulation-offload-support.patch | 75 ++-- ...le-QoS-support-for-nl80211-ctrl-port.patch | 8 +- ...320-mac80211_hwsim-add-6GHz-channels.patch | 4 +- ...211_hwsim-make-6-GHz-channels-usable.patch | 8 +- ...pply-flow-control-on-management-fram.patch | 4 +- ...set-sk_pacing_shift-for-802.3-txpath.patch | 2 +- ...-Rx-timestamp-calculation-for-all-pr.patch | 134 ------ ...MPDU-session-check-from-minstrel_ht-.patch | 8 +- ...eee80211_tx_h_rate_ctrl-when-dequeue.patch | 12 +- ...te-control-support-for-encap-offload.patch | 12 +- ...rting-aggregation-sessions-on-mesh-i.patch | 10 +- ...introduce-aql_enable-node-in-debugfs.patch | 6 +- ...ange-struct-txq_info-for-fewer-holes.patch | 2 +- ...to-a-virtual-time-based-airtime-sche.patch | 78 ++-- ...on-API-to-configure-SAR-power-limita.patch | 398 ------------------ ...mac80211-add-ieee80211_set_sar_specs.patch | 51 --- ...eck-per-vif-offload_flags-in-Tx-path.patch | 2 +- ...nl80211-add-support-for-BSS-coloring.patch | 31 +- ...211-add-support-for-BSS-color-change.patch | 50 +-- ...eee80211-add-TWT-element-definitions.patch | 6 +- ...ce-individual-TWT-support-in-AP-mode.patch | 26 +- ...n-some-HE-capabilities-with-the-spec.patch | 26 +- ...pelling-of-A-MSDU-in-HE-capabilities.patch | 18 +- ...E-capabilities-A-MPDU-Length-Exponen.patch | 18 +- .../500-mac80211_configure_antenna_gain.patch | 32 +- ...the-dst-buffer-to-of_get_mac_address.patch | 17 +- 88 files changed, 365 insertions(+), 1994 deletions(-) delete mode 100644 package/kernel/mac80211/patches/build/004-kconfig_backport_fix.patch delete mode 100644 package/kernel/mac80211/patches/build/010-disable_rfkill.patch delete mode 100644 package/kernel/mac80211/patches/rt2x00/992-rt2x00-save-survey-for-every-channel-visited.patch delete mode 100644 package/kernel/mac80211/patches/subsys/300-cfg80211-support-immediate-reconnect-request-hint.patch delete mode 100644 package/kernel/mac80211/patches/subsys/301-mac80211-support-driver-based-disconnect-with-reconn.patch delete mode 100644 package/kernel/mac80211/patches/subsys/302-cfg80211-Add-support-to-configure-SAE-PWE-value-to-d.patch delete mode 100644 package/kernel/mac80211/patches/subsys/373-mac80211-support-Rx-timestamp-calculation-for-all-pr.patch delete mode 100644 package/kernel/mac80211/patches/subsys/384-nl80211-add-common-API-to-configure-SAR-power-limita.patch delete mode 100644 package/kernel/mac80211/patches/subsys/385-mac80211-add-ieee80211_set_sar_specs.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 0cbcc03d64..99e96e64d0 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.10.68-1 +PKG_VERSION:=5.11.22-1 PKG_RELEASE:=1 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.10.68/ -PKG_HASH:=bba161b0084590c677a84b80993709e388a3c478f29ed0c475d4fce1b9162968 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.11.22/ +PKG_HASH:=35c23dd182711a3a6f671a673c2e0ace2ffdd25bbd1fb917e428d04924141299 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) 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 eacc72776e..db10c45104 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 @@ -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, +@@ -316,14 +316,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 bf87d3551a..506beb79c3 100644 --- a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch +++ b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch @@ -37,7 +37,7 @@ for (band = 0; band < NUM_NL80211_BANDS; band++) { if (!wiphy->bands[band]) continue; -@@ -378,6 +387,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip +@@ -379,6 +388,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip { struct ieee80211_supported_band *sband; @@ -47,7 +47,7 @@ sband = wiphy->bands[NL80211_BAND_2GHZ]; if (!sband) return; -@@ -407,6 +419,9 @@ static void ath_reg_apply_radar_flags(st +@@ -408,6 +420,9 @@ static void ath_reg_apply_radar_flags(st struct ieee80211_channel *ch; unsigned int i; @@ -57,7 +57,7 @@ if (!wiphy->bands[NL80211_BAND_5GHZ]) return; -@@ -639,6 +654,10 @@ ath_regd_init_wiphy(struct ath_regulator +@@ -640,6 +655,10 @@ ath_regd_init_wiphy(struct ath_regulator const struct ieee80211_regdomain *regd; wiphy->reg_notifier = reg_notifier; @@ -82,7 +82,7 @@ help --- a/local-symbols +++ b/local-symbols -@@ -85,6 +85,7 @@ ADM8211= +@@ -76,6 +76,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 c6dc184e28..bbbd8403e4 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 -@@ -3252,6 +3252,8 @@ void regulatory_hint_country_ie(struct w +@@ -3269,6 +3269,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; -@@ -3503,6 +3505,7 @@ static bool is_wiphy_all_set_reg_flag(en +@@ -3520,6 +3522,7 @@ static bool is_wiphy_all_set_reg_flag(en void regulatory_hint_disconnect(void) { diff --git a/package/kernel/mac80211/patches/ath/406-ath_relax_default_regd.patch b/package/kernel/mac80211/patches/ath/406-ath_relax_default_regd.patch index 35b0f2b76e..ee4e461342 100644 --- a/package/kernel/mac80211/patches/ath/406-ath_relax_default_regd.patch +++ b/package/kernel/mac80211/patches/ath/406-ath_relax_default_regd.patch @@ -39,7 +39,7 @@ bool ath_is_world_regd(struct ath_regulatory *reg) { return is_wwr_sku(ath_regd_get_eepromRD(reg)); -@@ -658,6 +666,9 @@ ath_regd_init_wiphy(struct ath_regulator +@@ -659,6 +667,9 @@ ath_regd_init_wiphy(struct ath_regulator if (IS_ENABLED(CPTCFG_ATH_USER_REGD)) return 0; 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 d183419a47..c17001eecb 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 +@@ -85,6 +85,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 -@@ -144,6 +144,7 @@ ATH10K_SNOC= +@@ -135,6 +135,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 e004acc340..cca65be25b 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 -@@ -3189,6 +3189,16 @@ int ath10k_core_register(struct ath10k * +@@ -3329,6 +3329,16 @@ int ath10k_core_register(struct ath10k * queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/ath10k/922-ath10k-increase-rx-buffer-size-to-2048.patch b/package/kernel/mac80211/patches/ath10k/922-ath10k-increase-rx-buffer-size-to-2048.patch index 8f7a60eec8..333131edc5 100644 --- a/package/kernel/mac80211/patches/ath10k/922-ath10k-increase-rx-buffer-size-to-2048.patch +++ b/package/kernel/mac80211/patches/ath10k/922-ath10k-increase-rx-buffer-size-to-2048.patch @@ -26,7 +26,7 @@ Forwarded: https://patchwork.kernel.org/patch/11367055/ --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h -@@ -2243,7 +2243,7 @@ struct htt_rx_chan_info { +@@ -2241,7 +2241,7 @@ struct htt_rx_chan_info { * Should be: sizeof(struct htt_host_rx_desc) + max rx MSDU size, * rounded up to a cache line size. */ 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 517a98206d..74b3292e0c 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 -@@ -9709,6 +9709,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -9708,6 +9708,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[] = { -@@ -10058,6 +10073,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -10057,6 +10072,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 ce8effe3c3..6e1c13b15d 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 @@ -114,7 +114,7 @@ v13: ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o --- a/local-symbols +++ b/local-symbols -@@ -145,6 +145,7 @@ ATH10K_DEBUG= +@@ -136,6 +136,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, -@@ -2904,6 +2910,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -3044,6 +3050,10 @@ int ath10k_core_start(struct ath10k *ar, goto err_hif_stop; } @@ -183,7 +183,7 @@ v13: return 0; err_hif_stop: -@@ -3162,9 +3172,18 @@ static void ath10k_core_register_work(st +@@ -3302,9 +3312,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: -@@ -3210,6 +3229,8 @@ void ath10k_core_unregister(struct ath10 +@@ -3350,6 +3369,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" -@@ -1237,6 +1238,13 @@ struct ath10k { +@@ -1251,6 +1252,13 @@ struct ath10k { } testmode; struct { 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 975d9a88a8..eb7c0f9af5 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 -@@ -1290,6 +1290,10 @@ struct ath10k { +@@ -1304,6 +1304,10 @@ struct ath10k { bool coex_support; int coex_gpio_pin; @@ -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 -@@ -10075,7 +10075,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -10074,7 +10074,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 2e3c5c30e3..1186ea8e06 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 -@@ -3080,6 +3081,8 @@ static int ath10k_core_probe_fw(struct a +@@ -3220,6 +3221,8 @@ static int ath10k_core_probe_fw(struct a device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr)); diff --git a/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch index 406d03e2fe..aa8a808170 100644 --- a/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch +++ b/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch @@ -8,7 +8,7 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2979,7 +2979,8 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2976,7 +2976,8 @@ void ath9k_hw_apply_txpower(struct ath_h { struct ath_regulatory *reg = ath9k_hw_regulatory(ah); struct ieee80211_channel *channel; @@ -18,7 +18,7 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. u16 ctl = NO_CTL; if (!chan) -@@ -2991,9 +2992,14 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2988,9 +2989,14 @@ void ath9k_hw_apply_txpower(struct ath_h channel = chan->chan; chan_pwr = min_t(int, channel->max_power * 2, MAX_COMBINED_POWER); new_pwr = min_t(int, chan_pwr, reg->power_limit); diff --git a/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch b/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch index 12cbd27e1a..288d4e478c 100644 --- a/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch +++ b/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2998,6 +2998,10 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2995,6 +2995,10 @@ void ath9k_hw_apply_txpower(struct ath_h if (ant_gain > max_gain) ant_reduction = ant_gain - max_gain; diff --git a/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch b/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch index 0d06ed2434..b936d04180 100644 --- a/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch +++ b/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch @@ -7,4 +7,4 @@ + { .max = 1, .types = BIT(NL80211_IFTYPE_ADHOC) }, }; - #ifdef CPTCFG_WIRELESS_WDS + #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT diff --git a/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch b/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch index fd17f13560..5556d4bb8a 100644 --- a/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch +++ b/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch @@ -14,7 +14,7 @@ Signed-off-by: David Bauer --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -924,6 +924,7 @@ static void ath9k_set_hw_capab(struct at +@@ -908,6 +908,7 @@ static void ath9k_set_hw_capab(struct at ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING); ieee80211_hw_set(hw, SUPPORT_FAST_XMIT); ieee80211_hw_set(hw, SUPPORTS_CLONED_SKBS); @@ -22,7 +22,7 @@ Signed-off-by: David Bauer if (ath9k_ps_enable) ieee80211_hw_set(hw, SUPPORTS_PS); -@@ -936,9 +937,6 @@ static void ath9k_set_hw_capab(struct at +@@ -920,9 +921,6 @@ static void ath9k_set_hw_capab(struct at IEEE80211_RADIOTAP_MCS_HAVE_STBC; } diff --git a/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch index f5c62e3baa..7d8294243e 100644 --- a/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch +++ b/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1140,25 +1140,25 @@ static int __init ath9k_init(void) +@@ -1121,25 +1121,25 @@ static int __init ath9k_init(void) { int error; 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 884593e24a..8e8ce414a8 100644 --- a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -844,6 +844,9 @@ static inline int ath9k_dump_btcoex(stru +@@ -843,6 +843,9 @@ static inline int ath9k_dump_btcoex(stru #ifdef CPTCFG_MAC80211_LEDS void ath_init_leds(struct ath_softc *sc); void ath_deinit_leds(struct ath_softc *sc); @@ -10,7 +10,7 @@ #else static inline void ath_init_leds(struct ath_softc *sc) { -@@ -980,6 +983,13 @@ void ath_ant_comb_scan(struct ath_softc +@@ -979,6 +982,13 @@ void ath_ant_comb_scan(struct ath_softc #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */ @@ -24,7 +24,7 @@ struct ath_softc { struct ieee80211_hw *hw; struct device *dev; -@@ -1033,9 +1043,8 @@ struct ath_softc { +@@ -1032,9 +1042,8 @@ struct ath_softc { spinlock_t chan_lock; #ifdef CPTCFG_MAC80211_LEDS @@ -181,7 +181,7 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1052,7 +1052,7 @@ int ath9k_init_device(u16 devid, struct +@@ -1033,7 +1033,7 @@ int ath9k_init_device(u16 devid, struct #ifdef CPTCFG_MAC80211_LEDS /* must be initialized before ieee80211_register_hw */ diff --git a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch index 0e75b86cbf..f93a6fe5cd 100644 --- a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch @@ -84,7 +84,7 @@ bool reset_power_on; bool htc_reset_init; -@@ -1077,6 +1085,7 @@ void ath9k_hw_check_nav(struct ath_hw *a +@@ -1076,6 +1084,7 @@ void ath9k_hw_check_nav(struct ath_hw *a bool ath9k_hw_check_alive(struct ath_hw *ah); bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); @@ -94,7 +94,7 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1882,6 +1882,20 @@ u32 ath9k_hw_get_tsf_offset(struct times +@@ -1883,6 +1883,20 @@ u32 ath9k_hw_get_tsf_offset(struct times } EXPORT_SYMBOL(ath9k_hw_get_tsf_offset); @@ -115,7 +115,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, struct ath9k_hw_cal_data *caldata, bool fastcc) { -@@ -2090,6 +2104,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2091,6 +2105,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st ar9003_hw_disable_phy_restart(ah); ath9k_hw_apply_gpio_override(ah); @@ -125,7 +125,7 @@ REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON); --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -536,6 +536,11 @@ irqreturn_t ath_isr(int irq, void *dev) +@@ -531,6 +531,11 @@ irqreturn_t ath_isr(int irq, void *dev) if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) return IRQ_HANDLED; 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 0b0d4d30c4..88b75a7b6f 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 @@ -65,7 +65,7 @@ } static const struct ieee80211_iface_limit if_limits[] = { -@@ -1012,6 +1013,18 @@ static void ath9k_set_hw_capab(struct at +@@ -993,6 +994,18 @@ static void ath9k_set_hw_capab(struct at wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0); } @@ -84,7 +84,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, const struct ath_bus_ops *bus_ops) { -@@ -1057,6 +1070,8 @@ int ath9k_init_device(u16 devid, struct +@@ -1038,6 +1051,8 @@ int ath9k_init_device(u16 devid, struct ARRAY_SIZE(ath9k_tpt_blink)); #endif @@ -110,7 +110,7 @@ static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable) --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c -@@ -1349,9 +1349,30 @@ void ar5008_hw_init_rate_txpower(struct +@@ -1340,9 +1340,30 @@ void ar5008_hw_init_rate_txpower(struct } } @@ -141,7 +141,7 @@ static const u32 ar5416_cca_regs[6] = { AR_PHY_CCA, AR_PHY_CH1_CCA, -@@ -1366,6 +1387,8 @@ int ar5008_hw_attach_phy_ops(struct ath_ +@@ -1357,6 +1378,8 @@ int ar5008_hw_attach_phy_ops(struct ath_ if (ret) return ret; diff --git a/package/kernel/mac80211/patches/ath9k/544-ath9k-ar933x-usb-hang-workaround.patch b/package/kernel/mac80211/patches/ath9k/544-ath9k-ar933x-usb-hang-workaround.patch index 2d2b837072..93eee34b64 100644 --- a/package/kernel/mac80211/patches/ath9k/544-ath9k-ar933x-usb-hang-workaround.patch +++ b/package/kernel/mac80211/patches/ath9k/544-ath9k-ar933x-usb-hang-workaround.patch @@ -40,7 +40,7 @@ return true; } -@@ -1860,8 +1879,14 @@ static int ath9k_hw_do_fastcc(struct ath +@@ -1861,8 +1880,14 @@ static int ath9k_hw_do_fastcc(struct ath if (AR_SREV_9271(ah)) ar9002_hw_load_ani_reg(ah, chan); @@ -55,7 +55,7 @@ return -EINVAL; } -@@ -2115,6 +2140,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2116,6 +2141,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st ath9k_hw_set_radar_params(ah); } diff --git a/package/kernel/mac80211/patches/ath9k/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/ath9k/545-ath9k_ani_ws_detect.patch index 466767adb9..854bb3659a 100644 --- a/package/kernel/mac80211/patches/ath9k/545-ath9k_ani_ws_detect.patch +++ b/package/kernel/mac80211/patches/ath9k/545-ath9k_ani_ws_detect.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c -@@ -978,55 +978,6 @@ static bool ar5008_hw_ani_control_new(st +@@ -969,55 +969,6 @@ static bool ar5008_hw_ani_control_new(st * on == 0 means more noise imm */ u32 on = param ? 1 : 0; 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 88198a4562..78206d2860 100644 --- a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch +++ b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau #include "common.h" #include "debug.h" -@@ -990,6 +991,14 @@ struct ath_led { +@@ -989,6 +990,14 @@ struct ath_led { struct led_classdev cdev; }; @@ -33,7 +33,7 @@ Signed-off-by: Felix Fietkau struct ath_softc { struct ieee80211_hw *hw; struct device *dev; -@@ -1045,6 +1054,9 @@ struct ath_softc { +@@ -1044,6 +1053,9 @@ struct ath_softc { #ifdef CPTCFG_MAC80211_LEDS const char *led_default_trigger; struct list_head leds; diff --git a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch index 83076b8ae4..716e09f351 100644 --- a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch +++ b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -1056,6 +1056,7 @@ struct ath_softc { +@@ -1055,6 +1055,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 c98222781d..a41eb55f74 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 @@ -339,7 +339,7 @@ static void ath9k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, bool drop); -@@ -657,6 +658,7 @@ void ath_reset_work(struct work_struct * +@@ -652,6 +653,7 @@ void ath_reset_work(struct work_struct * static int ath9k_start(struct ieee80211_hw *hw) { struct ath_softc *sc = hw->priv; @@ -347,7 +347,7 @@ struct ath_hw *ah = sc->sc_ah; struct ath_common *common = ath9k_hw_common(ah); struct ieee80211_channel *curchan = sc->cur_chan->chandef.chan; -@@ -735,6 +737,11 @@ static int ath9k_start(struct ieee80211_ +@@ -730,6 +732,11 @@ static int ath9k_start(struct ieee80211_ AR_GPIO_OUTPUT_MUX_AS_OUTPUT); } @@ -371,7 +371,7 @@ --- a/local-symbols +++ b/local-symbols -@@ -112,6 +112,7 @@ ATH9K_WOW= +@@ -103,6 +103,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 8fd6e4409b..2552bbc7a1 100644 --- a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch +++ b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch @@ -325,7 +325,7 @@ #include "common.h" #include "debug.h" -@@ -1012,6 +1013,9 @@ struct ath_softc { +@@ -1011,6 +1012,9 @@ struct ath_softc { struct ath_hw *sc_ah; void __iomem *mem; int irq; diff --git a/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch index 52ae7a8eba..5dc04ecc88 100644 --- a/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch +++ b/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch @@ -42,7 +42,7 @@ if (wl->radio_enabled != phy->radio_on) { if (wl->radio_enabled) { -@@ -5176,6 +5173,47 @@ static int b43_op_get_survey(struct ieee +@@ -5175,6 +5172,47 @@ static int b43_op_get_survey(struct ieee return 0; } @@ -90,7 +90,7 @@ static const struct ieee80211_ops b43_hw_ops = { .tx = b43_op_tx, .conf_tx = b43_op_conf_tx, -@@ -5197,6 +5235,8 @@ static const struct ieee80211_ops b43_hw +@@ -5196,6 +5234,8 @@ static const struct ieee80211_ops b43_hw .sw_scan_complete = b43_op_sw_scan_complete_notifier, .get_survey = b43_op_get_survey, .rfkill_poll = b43_rfkill_poll, @@ -99,7 +99,7 @@ }; /* Hard-reset the chip. Do not call this directly. -@@ -5498,6 +5538,8 @@ static int b43_one_core_attach(struct b4 +@@ -5497,6 +5537,8 @@ static int b43_one_core_attach(struct b4 if (!wldev) goto out; @@ -108,7 +108,7 @@ wldev->use_pio = b43_modparam_pio; wldev->dev = dev; wldev->wl = wl; -@@ -5592,6 +5634,9 @@ static struct b43_wl *b43_wireless_init( +@@ -5588,6 +5630,9 @@ static struct b43_wl *b43_wireless_init( wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); 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 774656f1fd..e640849e6a 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 -@@ -2961,6 +2961,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -2958,6 +2958,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/998-survey.patch b/package/kernel/mac80211/patches/brcm/998-survey.patch index 25a12c783e..9e9f4bbf8f 100644 --- a/package/kernel/mac80211/patches/brcm/998-survey.patch +++ b/package/kernel/mac80211/patches/brcm/998-survey.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2913,6 +2913,63 @@ done: +@@ -2910,6 +2910,63 @@ done: } static int @@ -64,7 +64,7 @@ brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev, int idx, u8 *mac, struct station_info *sinfo) { -@@ -3008,6 +3065,7 @@ static s32 brcmf_inform_single_bss(struc +@@ -3005,6 +3062,7 @@ static s32 brcmf_inform_single_bss(struc struct brcmu_chan ch; u16 channel; u32 freq; @@ -72,7 +72,7 @@ u16 notify_capability; u16 notify_interval; u8 *notify_ie; -@@ -3032,6 +3090,17 @@ static s32 brcmf_inform_single_bss(struc +@@ -3029,6 +3087,17 @@ static s32 brcmf_inform_single_bss(struc band = NL80211_BAND_5GHZ; freq = ieee80211_channel_to_frequency(channel, band); @@ -90,7 +90,7 @@ bss_data.chan = ieee80211_get_channel(wiphy, freq); bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20; bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime()); -@@ -5518,6 +5587,7 @@ static struct cfg80211_ops brcmf_cfg8021 +@@ -5515,6 +5584,7 @@ static struct cfg80211_ops brcmf_cfg8021 .leave_ibss = brcmf_cfg80211_leave_ibss, .get_station = brcmf_cfg80211_get_station, .dump_station = brcmf_cfg80211_dump_station, diff --git a/package/kernel/mac80211/patches/build/003-remove_bogus_modparams.patch b/package/kernel/mac80211/patches/build/003-remove_bogus_modparams.patch index 8fa465a7e1..aa26c8cb2a 100644 --- a/package/kernel/mac80211/patches/build/003-remove_bogus_modparams.patch +++ b/package/kernel/mac80211/patches/build/003-remove_bogus_modparams.patch @@ -1,6 +1,6 @@ --- a/compat/main.c +++ b/compat/main.c -@@ -20,31 +20,6 @@ MODULE_LICENSE("GPL"); +@@ -19,31 +19,6 @@ MODULE_LICENSE("GPL"); #error "You need a CPTCFG_VERSION" #endif diff --git a/package/kernel/mac80211/patches/build/004-kconfig_backport_fix.patch b/package/kernel/mac80211/patches/build/004-kconfig_backport_fix.patch deleted file mode 100644 index 2c9572ec93..0000000000 --- a/package/kernel/mac80211/patches/build/004-kconfig_backport_fix.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/backport-include/linux/kconfig.h -+++ b/backport-include/linux/kconfig.h -@@ -5,6 +5,8 @@ - #include_next - #endif - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0) -+ - #ifndef __ARG_PLACEHOLDER_1 - #define __ARG_PLACEHOLDER_1 0, - #define config_enabled(cfg) _config_enabled(cfg) -@@ -16,6 +18,7 @@ - * 3.1 - 3.3 had a broken version of this, so undef - * (they didn't have __ARG_PLACEHOLDER_1) - */ -+ - #undef IS_ENABLED - #define IS_ENABLED(option) \ - (config_enabled(option) || config_enabled(option##_MODULE)) -@@ -31,6 +34,8 @@ - #undef IS_BUILTIN - #define IS_BUILTIN(option) config_enabled(option) - -+#endif -+ - #ifndef IS_REACHABLE - /* - * IS_REACHABLE(CONFIG_FOO) evaluates to 1 if the currently compiled diff --git a/package/kernel/mac80211/patches/build/010-disable_rfkill.patch b/package/kernel/mac80211/patches/build/010-disable_rfkill.patch deleted file mode 100644 index d5253063ce..0000000000 --- a/package/kernel/mac80211/patches/build/010-disable_rfkill.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/backport-include/linux/rfkill.h -+++ b/backport-include/linux/rfkill.h -@@ -2,6 +2,12 @@ - #define __COMPAT_RFKILL_H - #include - -+#undef CONFIG_RFKILL -+#undef CONFIG_RFKILL_FULL -+#undef CONFIG_RFKILL_LEDS -+#undef CONFIG_RFKILL_MODULE -+#undef CONFIG_RFKILL_FULL_MODULE -+ - #if LINUX_VERSION_IS_GEQ(3,10,0) - #include_next - #else diff --git a/package/kernel/mac80211/patches/build/050-lib80211_option.patch b/package/kernel/mac80211/patches/build/050-lib80211_option.patch index c1b1bc757f..b2465b0d7e 100644 --- a/package/kernel/mac80211/patches/build/050-lib80211_option.patch +++ b/package/kernel/mac80211/patches/build/050-lib80211_option.patch @@ -1,6 +1,6 @@ --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig -@@ -188,7 +188,7 @@ config CFG80211_WEXT_EXPORT +@@ -187,7 +187,7 @@ config CFG80211_WEXT_EXPORT endif # CFG80211 config LIB80211 @@ -9,7 +9,7 @@ depends on m default n help -@@ -198,19 +198,19 @@ config LIB80211 +@@ -197,19 +197,19 @@ config LIB80211 Drivers should select this themselves if needed. config LIB80211_CRYPT_WEP 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 ff2ce2071f..f51ddd8d71 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,9 +1,9 @@ --- a/local-symbols +++ b/local-symbols -@@ -437,43 +437,6 @@ USB_SIERRA_NET= - USB_VL600= +@@ -429,43 +429,6 @@ USB_VL600= USB_NET_CH9200= USB_NET_AQC111= + USB_RTL8153_ECM= -SSB_POSSIBLE= -SSB= -SSB_SPROM= @@ -192,10 +192,10 @@ select BRCMUTIL --- a/Kconfig.local +++ b/Kconfig.local -@@ -1315,117 +1315,6 @@ config BACKPORTED_USB_NET_CH9200 - config BACKPORTED_USB_NET_AQC111 +@@ -1291,117 +1291,6 @@ config BACKPORTED_USB_NET_AQC111 + config BACKPORTED_USB_RTL8153_ECM tristate - default USB_NET_AQC111 + default USB_RTL8153_ECM -config BACKPORTED_SSB_POSSIBLE - tristate - default SSB_POSSIBLE diff --git a/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch b/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch index d358cfe367..87bb42dce5 100644 --- a/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch +++ b/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -5695,6 +5695,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw") +@@ -5700,6 +5700,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw") MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API)); static const struct pci_device_id mwl8k_pci_id_table[] = { diff --git a/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch index a35cf1875a..ff12950e5f 100644 --- a/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -6280,6 +6280,8 @@ static int mwl8k_probe(struct pci_dev *p +@@ -6286,6 +6286,8 @@ static int mwl8k_probe(struct pci_dev *p priv->running_bsses = 0; @@ -9,7 +9,7 @@ return rc; err_stop_firmware: -@@ -6313,8 +6315,6 @@ static void mwl8k_remove(struct pci_dev +@@ -6319,8 +6321,6 @@ static void mwl8k_remove(struct pci_dev return; priv = hw->priv; diff --git a/package/kernel/mac80211/patches/rt2x00/002-rt2x00-define-RF5592-in-init_eeprom-routine.patch b/package/kernel/mac80211/patches/rt2x00/002-rt2x00-define-RF5592-in-init_eeprom-routine.patch index a50a195285..96eeb37dc6 100644 --- a/package/kernel/mac80211/patches/rt2x00/002-rt2x00-define-RF5592-in-init_eeprom-routine.patch +++ b/package/kernel/mac80211/patches/rt2x00/002-rt2x00-define-RF5592-in-init_eeprom-routine.patch @@ -40,7 +40,7 @@ Signed-off-by: Tomislav Požega --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9416,6 +9416,8 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9435,6 +9435,8 @@ static int rt2800_init_eeprom(struct rt2 rf = RF3853; else if (rt2x00_rt(rt2x00dev, RT5350)) rf = RF5350; 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 8628c1063a..1930885ccf 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 -@@ -332,6 +332,7 @@ RT2X00_LIB_FIRMWARE= +@@ -323,6 +323,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= @@ -105,7 +105,7 @@ .drv_init_registers = rt2800mmio_init_registers, --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -694,6 +694,7 @@ enum rt2x00_capability_flags { +@@ -703,6 +703,7 @@ enum rt2x00_capability_flags { REQUIRE_HT_TX_DESC, REQUIRE_PS_AUTOWAKE, REQUIRE_DELAYED_RFKILL, @@ -113,7 +113,7 @@ /* * Capabilities -@@ -970,6 +971,11 @@ struct rt2x00_dev { +@@ -980,6 +981,11 @@ struct rt2x00_dev { const struct firmware *fw; /* @@ -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 -@@ -1402,6 +1402,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de +@@ -1401,6 +1401,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. */ -@@ -1545,6 +1549,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ +@@ -1541,6 +1545,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ * Free the driver data. */ kfree(rt2x00dev->drv_data); diff --git a/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch b/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch index e12f074669..ffee2189d2 100644 --- a/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch +++ b/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch @@ -12,7 +12,7 @@ #endif /* _RT2X00_PLATFORM_H */ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1008,6 +1008,22 @@ static int rt2x00lib_probe_hw_modes(stru +@@ -1007,6 +1007,22 @@ static int rt2x00lib_probe_hw_modes(stru unsigned int num_rates; unsigned int i; @@ -37,7 +37,7 @@ num_rates += 4; --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -399,6 +399,7 @@ struct hw_mode_spec { +@@ -408,6 +408,7 @@ struct hw_mode_spec { unsigned int supported_bands; #define SUPPORT_BAND_2GHZ 0x00000001 #define SUPPORT_BAND_5GHZ 0x00000002 diff --git a/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch b/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch index 79f99ffdf4..37553bb80a 100644 --- a/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch +++ b/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -990,6 +990,12 @@ static void rt2x00lib_rate(struct ieee80 +@@ -989,6 +989,12 @@ static void rt2x00lib_rate(struct ieee80 void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr) { diff --git a/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch b/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch index 31f2f0261f..6211809c0a 100644 --- a/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch +++ b/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1013,6 +1013,16 @@ static int rt2x00lib_probe_hw_modes(stru +@@ -1012,6 +1012,16 @@ static int rt2x00lib_probe_hw_modes(stru struct ieee80211_rate *rates; unsigned int num_rates; unsigned int i; 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 039c6f6afc..d78b76d7f5 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" -@@ -9530,6 +9531,17 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9549,6 +9550,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 01a3851fcc..0da9356e0c 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 -@@ -1341,7 +1341,7 @@ static inline void rt2x00lib_set_if_comb +@@ -1340,7 +1340,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/612-rt2x00-led-tpt-trigger-support.patch b/package/kernel/mac80211/patches/rt2x00/612-rt2x00-led-tpt-trigger-support.patch index 079c87e33c..6e6564f870 100644 --- a/package/kernel/mac80211/patches/rt2x00/612-rt2x00-led-tpt-trigger-support.patch +++ b/package/kernel/mac80211/patches/rt2x00/612-rt2x00-led-tpt-trigger-support.patch @@ -11,7 +11,7 @@ Tested-by: Christoph Krapp --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1126,6 +1126,19 @@ static void rt2x00lib_remove_hw(struct r +@@ -1125,6 +1125,19 @@ static void rt2x00lib_remove_hw(struct r kfree(rt2x00dev->spec.channels_info); } @@ -31,7 +31,7 @@ Tested-by: Christoph Krapp static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) { struct hw_mode_spec *spec = &rt2x00dev->spec; -@@ -1207,6 +1220,10 @@ static int rt2x00lib_probe_hw(struct rt2 +@@ -1206,6 +1219,10 @@ static int rt2x00lib_probe_hw(struct rt2 #undef RT2X00_TASKLET_INIT diff --git a/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch index 20452cd8a7..8814c02532 100644 --- a/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch @@ -30,7 +30,7 @@ Signed-off-by: Tomislav Po=C5=BEega * EEPROM LNA --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -4356,6 +4356,45 @@ static void rt2800_config_channel(struct +@@ -4369,6 +4369,45 @@ static void rt2800_config_channel(struct rt2800_iq_calibrate(rt2x00dev, rf->channel); } @@ -76,7 +76,7 @@ Signed-off-by: Tomislav Po=C5=BEega bbp = rt2800_bbp_read(rt2x00dev, 4); rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf)); rt2800_bbp_write(rt2x00dev, 4, bbp); -@@ -9559,7 +9598,8 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9578,7 +9617,8 @@ static int rt2800_init_eeprom(struct rt2 */ eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); @@ -86,7 +86,7 @@ Signed-off-by: Tomislav Po=C5=BEega if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352)) __set_bit(CAPABILITY_EXTERNAL_PA_TX0, -@@ -9570,6 +9610,18 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9589,6 +9629,18 @@ static int rt2800_init_eeprom(struct rt2 &rt2x00dev->cap_flags); } diff --git a/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch index 6be847478e..b798dcc6d8 100644 --- a/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8419,6 +8419,56 @@ static void rt2800_init_rfcsr_5592(struc +@@ -8438,6 +8438,56 @@ static void rt2800_init_rfcsr_5592(struc rt2800_led_open_drain_enable(rt2x00dev); } @@ -57,7 +57,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9026,6 +9076,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9045,6 +9095,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); diff --git a/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch index 3ed0ff7ef5..cf21c39a6c 100644 --- a/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8469,6 +8469,155 @@ static void rt2800_rf_self_txdc_cal(stru +@@ -8488,6 +8488,155 @@ static void rt2800_rf_self_txdc_cal(stru rt2x00_info(rt2x00dev, "RF Tx self calibration end\n"); } @@ -156,7 +156,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9076,6 +9225,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9095,6 +9244,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); diff --git a/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch index 77be986d18..1f8684b0bf 100644 --- a/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8618,6 +8618,70 @@ static void rt2800_r_calibration(struct +@@ -8637,6 +8637,70 @@ static void rt2800_r_calibration(struct rt2800_register_write(rt2x00dev, PWR_PIN_CFG, MAC_PWR_PIN_CFG); } @@ -71,7 +71,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9227,6 +9291,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9246,6 +9310,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_r_calibration(rt2x00dev); rt2800_rf_self_txdc_cal(rt2x00dev); diff --git a/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch index 7352ad036c..98f2e245ce 100644 --- a/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8682,6 +8682,384 @@ static void rt2800_rxdcoc_calibration(st +@@ -8701,6 +8701,384 @@ static void rt2800_rxdcoc_calibration(st rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, saverfb0r2); } @@ -385,7 +385,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9294,6 +9672,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9313,6 +9691,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); diff --git a/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch index fe0961baa7..6a685f80ab 100644 --- a/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch +++ b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9060,6 +9060,943 @@ restore_value: +@@ -9079,6 +9079,943 @@ restore_value: rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); } @@ -944,7 +944,7 @@ static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, bool set_bw, bool is_ht40) { -@@ -9672,6 +10609,7 @@ static void rt2800_init_rfcsr_6352(struc +@@ -9691,6 +10628,7 @@ static void rt2800_init_rfcsr_6352(struc rt2800_rxdcoc_calibration(rt2x00dev); rt2800_bw_filter_calibration(rt2x00dev, true); rt2800_bw_filter_calibration(rt2x00dev, false); diff --git a/package/kernel/mac80211/patches/rt2x00/991-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch b/package/kernel/mac80211/patches/rt2x00/991-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch index 3de00b2267..40b20ec594 100644 --- a/package/kernel/mac80211/patches/rt2x00/991-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch +++ b/package/kernel/mac80211/patches/rt2x00/991-rt2x00-mt7620-differentiate-based-on-SoC-CHIP_VER.patch @@ -14,7 +14,7 @@ */ --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3685,14 +3685,16 @@ static void rt2800_config_channel_rf7620 +@@ -3698,14 +3698,16 @@ static void rt2800_config_channel_rf7620 rt2x00_set_field8(&rfcsr, RFCSR19_K, rf->rf4); rt2800_rfcsr_write(rt2x00dev, 19, rfcsr); @@ -39,7 +39,7 @@ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); rt2x00_set_field8(&rfcsr, RFCSR1_TX2_EN_MT7620, -@@ -3726,18 +3728,23 @@ static void rt2800_config_channel_rf7620 +@@ -3739,18 +3741,23 @@ static void rt2800_config_channel_rf7620 rt2800_rfcsr_write_dccal(rt2x00dev, 59, 0x20); } @@ -73,7 +73,7 @@ if (!test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) { if (conf_is_ht40(conf)) { -@@ -3837,25 +3844,29 @@ static void rt2800_config_alc(struct rt2 +@@ -3850,25 +3857,29 @@ static void rt2800_config_alc(struct rt2 if (i == 10000) rt2x00_warn(rt2x00dev, "Wait MAC Status to MAX !!!\n"); @@ -121,7 +121,7 @@ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, mac_sys_ctrl); rt2800_vco_calibration(rt2x00dev); -@@ -5887,18 +5898,33 @@ static int rt2800_init_registers(struct +@@ -5906,18 +5917,33 @@ static int rt2800_init_registers(struct } else if (rt2x00_rt(rt2x00dev, RT5350)) { rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); } else if (rt2x00_rt(rt2x00dev, RT6352)) { @@ -167,7 +167,7 @@ reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_1); rt2x00_set_field32(®, TX_ALC_CFG_1_ROS_BUSY_EN, 0); rt2800_register_write(rt2x00dev, TX_ALC_CFG_1, reg); -@@ -7042,14 +7068,16 @@ static void rt2800_init_bbp_6352(struct +@@ -7061,14 +7087,16 @@ static void rt2800_init_bbp_6352(struct rt2800_bbp_write(rt2x00dev, 188, 0x00); rt2800_bbp_write(rt2x00dev, 189, 0x00); @@ -192,7 +192,7 @@ /* BBP for G band GLRT function (BBP_128 ~ BBP_221) */ rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00); -@@ -10388,31 +10416,36 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10407,31 +10435,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); -@@ -10478,63 +10511,71 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10497,63 +10530,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); -@@ -10597,12 +10638,17 @@ static void rt2800_init_rfcsr_6352(struc +@@ -10616,12 +10657,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/992-rt2x00-save-survey-for-every-channel-visited.patch b/package/kernel/mac80211/patches/rt2x00/992-rt2x00-save-survey-for-every-channel-visited.patch deleted file mode 100644 index 80e2a2f6ae..0000000000 --- a/package/kernel/mac80211/patches/rt2x00/992-rt2x00-save-survey-for-every-channel-visited.patch +++ /dev/null @@ -1,183 +0,0 @@ ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -1238,6 +1238,8 @@ void rt2800_watchdog(struct rt2x00_dev * - if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) - return; - -+ rt2800_update_survey(rt2x00dev); -+ - queue_for_each(rt2x00dev, queue) { - switch (queue->qid) { - case QID_AC_VO: -@@ -1274,6 +1276,18 @@ void rt2800_watchdog(struct rt2x00_dev * - } - EXPORT_SYMBOL_GPL(rt2800_watchdog); - -+void rt2800_update_survey(struct rt2x00_dev *rt2x00dev) -+{ -+ struct ieee80211_channel *chan = rt2x00dev->hw->conf.chandef.chan; -+ struct rt2x00_chan_survey *chan_survey = -+ &rt2x00dev->chan_survey[chan->hw_value]; -+ -+ chan_survey->time_idle += rt2800_register_read(rt2x00dev, CH_IDLE_STA); -+ chan_survey->time_busy += rt2800_register_read(rt2x00dev, CH_BUSY_STA); -+ chan_survey->time_ext_busy += rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC); -+} -+EXPORT_SYMBOL_GPL(rt2800_update_survey); -+ - static unsigned int rt2800_hw_beacon_base(struct rt2x00_dev *rt2x00dev, - unsigned int index) - { -@@ -12199,26 +12213,30 @@ int rt2800_get_survey(struct ieee80211_h - { - struct rt2x00_dev *rt2x00dev = hw->priv; - struct ieee80211_conf *conf = &hw->conf; -- u32 idle, busy, busy_ext; -+ struct rt2x00_chan_survey *chan_survey = -+ &rt2x00dev->chan_survey[idx]; -+ enum nl80211_band band = NL80211_BAND_2GHZ; - -- if (idx != 0) -+ if (idx >= rt2x00dev->bands[band].n_channels) { -+ idx -= rt2x00dev->bands[band].n_channels; -+ band = NL80211_BAND_5GHZ; -+ } -+ -+ if (idx >= rt2x00dev->bands[band].n_channels) - return -ENOENT; - -- survey->channel = conf->chandef.chan; -+ if (idx == 0) -+ rt2800_update_survey(rt2x00dev); - -- idle = rt2800_register_read(rt2x00dev, CH_IDLE_STA); -- busy = rt2800_register_read(rt2x00dev, CH_BUSY_STA); -- busy_ext = rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC); -- -- if (idle || busy) { -- survey->filled = SURVEY_INFO_TIME | -- SURVEY_INFO_TIME_BUSY | -- SURVEY_INFO_TIME_EXT_BUSY; -- -- survey->time = (idle + busy) / 1000; -- survey->time_busy = busy / 1000; -- survey->time_ext_busy = busy_ext / 1000; -- } -+ survey->channel = &rt2x00dev->bands[band].channels[idx]; -+ -+ survey->filled = SURVEY_INFO_TIME | -+ SURVEY_INFO_TIME_BUSY | -+ SURVEY_INFO_TIME_EXT_BUSY; -+ -+ survey->time = div_u64(chan_survey->time_idle + chan_survey->time_busy, 1000); -+ survey->time_busy = div_u64(chan_survey->time_busy, 1000); -+ survey->time_ext_busy = div_u64(chan_survey->time_ext_busy, 1000); - - if (!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) - survey->filled |= SURVEY_INFO_IN_USE; ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h -@@ -243,6 +243,7 @@ bool rt2800_txstatus_timeout(struct rt2x - bool rt2800_txstatus_pending(struct rt2x00_dev *rt2x00dev); - - void rt2800_watchdog(struct rt2x00_dev *rt2x00dev); -+void rt2800_update_survey(struct rt2x00_dev *rt2x00dev); - - void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc); - void rt2800_clear_beacon(struct queue_entry *entry); ---- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c -@@ -360,6 +360,7 @@ static const struct rt2x00lib_ops rt2800 - .gain_calibration = rt2800_gain_calibration, - .vco_calibration = rt2800_vco_calibration, - .watchdog = rt2800_watchdog, -+ .update_survey = rt2800_update_survey, - .start_queue = rt2800mmio_start_queue, - .kick_queue = rt2800mmio_kick_queue, - .stop_queue = rt2800mmio_stop_queue, ---- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -@@ -214,6 +214,7 @@ static const struct rt2x00lib_ops rt2800 - .gain_calibration = rt2800_gain_calibration, - .vco_calibration = rt2800_vco_calibration, - .watchdog = rt2800_watchdog, -+ .update_survey = rt2800_update_survey, - .start_queue = rt2800mmio_start_queue, - .kick_queue = rt2800mmio_kick_queue, - .stop_queue = rt2800mmio_stop_queue, ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -183,6 +183,15 @@ struct rf_channel { - }; - - /* -+ * Information structure for channel survey. -+ */ -+struct rt2x00_chan_survey { -+ u64 time_idle; -+ u64 time_busy; -+ u64 time_ext_busy; -+}; -+ -+/* - * Channel information structure - */ - struct channel_info { -@@ -567,6 +576,7 @@ struct rt2x00lib_ops { - * Data queue handlers. - */ - void (*watchdog) (struct rt2x00_dev *rt2x00dev); -+ void (*update_survey) (struct rt2x00_dev *rt2x00dev); - void (*start_queue) (struct data_queue *queue); - void (*kick_queue) (struct data_queue *queue); - void (*stop_queue) (struct data_queue *queue); -@@ -755,6 +765,7 @@ struct rt2x00_dev { - */ - struct ieee80211_hw *hw; - struct ieee80211_supported_band bands[NUM_NL80211_BANDS]; -+ struct rt2x00_chan_survey *chan_survey; - enum nl80211_band curr_band; - int curr_freq; - ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1054,6 +1054,12 @@ static int rt2x00lib_probe_hw_modes(stru - if (!rates) - goto exit_free_channels; - -+ rt2x00dev->chan_survey = -+ kcalloc(spec->num_channels, sizeof(struct rt2x00_chan_survey), -+ GFP_KERNEL); -+ if (!rt2x00dev->chan_survey) -+ goto exit_free_rates; -+ - /* - * Initialize Rate list. - */ -@@ -1105,6 +1111,8 @@ static int rt2x00lib_probe_hw_modes(stru - - return 0; - -+ exit_free_rates: -+ kfree(rates); - exit_free_channels: - kfree(channels); - rt2x00_err(rt2x00dev, "Allocation ieee80211 modes failed\n"); ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c -@@ -317,6 +317,15 @@ int rt2x00mac_config(struct ieee80211_hw - return 0; - - /* -+ * To provide correct survey data for survey-based ACS algorithm -+ * we have to save survey data for current channel before switching. -+ */ -+ if (rt2x00dev->ops->lib->update_survey && -+ (changed & IEEE80211_CONF_CHANGE_CHANNEL)) { -+ rt2x00dev->ops->lib->update_survey(rt2x00dev); -+ } -+ -+ /* - * Some configuration parameters (e.g. channel and antenna values) can - * only be set when the radio is enabled, but do require the RX to - * be off. During this period we should keep link tuning enabled, diff --git a/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch b/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch index 3daf65e967..d82dfec05b 100644 --- a/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch +++ b/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch @@ -89,7 +89,7 @@ Tested-by: Maciej S. Szmigiero #endif --- a/drivers/net/wireless/realtek/rtlwifi/usb.c +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c -@@ -807,6 +807,7 @@ static void rtl_usb_stop(struct ieee8021 +@@ -806,6 +806,7 @@ static void rtl_usb_stop(struct ieee8021 tasklet_kill(&rtlusb->rx_work_tasklet); cancel_work_sync(&rtlpriv->works.lps_change_work); @@ -97,7 +97,7 @@ Tested-by: Maciej S. Szmigiero flush_workqueue(rtlpriv->works.rtl_wq); -@@ -1033,6 +1034,8 @@ int rtl_usb_probe(struct usb_interface * +@@ -1032,6 +1033,8 @@ int rtl_usb_probe(struct usb_interface * rtl_fill_h2c_cmd_work_callback); INIT_WORK(&rtlpriv->works.lps_change_work, rtl_lps_change_work_callback); diff --git a/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch b/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch index e1f66ac1c3..f521846a3b 100644 --- a/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch +++ b/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch @@ -10,49 +10,7 @@ * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify * userspace that a connection was dropped by the AP or due to other * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and -@@ -757,7 +760,8 @@ - * of any other interfaces, and other interfaces will again take - * precedence when they are used. - * -- * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface. -+ * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface -+ * (no longer supported). - * - * @NL80211_CMD_SET_MULTICAST_TO_UNICAST: Configure if this AP should perform - * multicast to unicast conversion. When enabled, all multicast packets -@@ -1177,6 +1181,10 @@ - * includes the contents of the frame. %NL80211_ATTR_ACK flag is included - * if the recipient acknowledged the frame. - * -+ * @NL80211_CMD_SET_SAR_SPECS: SAR power limitation configuration is -+ * passed using %NL80211_ATTR_SAR_SPEC. %NL80211_ATTR_WIPHY is used to -+ * specify the wiphy index to be applied to. -+ * - * @NL80211_CMD_MAX: highest used command number - * @__NL80211_CMD_AFTER_LAST: internal use - */ -@@ -1407,6 +1415,8 @@ enum nl80211_commands { - - NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS, - -+ NL80211_CMD_SET_SAR_SPECS, -+ - /* add new commands above here */ - - /* used to define NL80211_CMD_MAX below */ -@@ -1750,8 +1760,9 @@ enum nl80211_commands { - * specify just a single bitrate, which is to be used for the beacon. - * The driver must also specify support for this with the extended - * features NL80211_EXT_FEATURE_BEACON_RATE_LEGACY, -- * NL80211_EXT_FEATURE_BEACON_RATE_HT and -- * NL80211_EXT_FEATURE_BEACON_RATE_VHT. -+ * NL80211_EXT_FEATURE_BEACON_RATE_HT, -+ * NL80211_EXT_FEATURE_BEACON_RATE_VHT and -+ * NL80211_EXT_FEATURE_BEACON_RATE_HE. - * - * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain - * at least one byte, currently used with @NL80211_CMD_REGISTER_FRAME. -@@ -1955,8 +1966,15 @@ enum nl80211_commands { +@@ -1963,8 +1966,15 @@ enum nl80211_commands { * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire * probe-response frame. The DA field in the 802.11 header is zero-ed out, * to be filled by the FW. @@ -70,59 +28,19 @@ * @NL80211_ATTR_HT_CAPABILITY_MASK: Specify which bits of the * ATTR_HT_CAPABILITY to which attention should be paid. * Currently, only mac80211 NICs support this feature. -@@ -2077,7 +2095,8 @@ enum nl80211_commands { - * until the channel switch event. - * @NL80211_ATTR_CH_SWITCH_BLOCK_TX: flag attribute specifying that transmission - * must be blocked on the current channel (before the channel switch -- * operation). -+ * operation). Also included in the channel switch started event if quiet -+ * was requested by the AP. - * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information - * for the time while performing a channel switch. - * @NL80211_ATTR_CNTDWN_OFFS_BEACON: An array of offsets (u16) to the channel -@@ -2527,6 +2546,20 @@ enum nl80211_commands { - * override mask. Used with NL80211_ATTR_S1G_CAPABILITY in - * NL80211_CMD_ASSOCIATE or NL80211_CMD_CONNECT. - * -+ * @NL80211_ATTR_SAE_PWE: Indicates the mechanism(s) allowed for SAE PWE -+ * derivation in WPA3-Personal networks which are using SAE authentication. -+ * This is a u8 attribute that encapsulates one of the values from -+ * &enum nl80211_sae_pwe_mechanism. -+ * -+ * @NL80211_ATTR_SAR_SPEC: SAR power limitation specification when -+ * used with %NL80211_CMD_SET_SAR_SPECS. The message contains fields -+ * of %nl80211_sar_attrs which specifies the sar type and related -+ * sar specs. Sar specs contains array of %nl80211_sar_specs_attrs. -+ * -+ * @NL80211_ATTR_RECONNECT_REQUESTED: flag attribute, used with deauth and -+ * disassoc events to indicate that an immediate reconnect to the AP -+ * is desired. -+ * - * @NUM_NL80211_ATTR: total number of nl80211_attrs available - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -3016,6 +3049,14 @@ enum nl80211_attrs { - NL80211_ATTR_S1G_CAPABILITY, - NL80211_ATTR_S1G_CAPABILITY_MASK, +@@ -3045,6 +3055,8 @@ enum nl80211_attrs { + + NL80211_ATTR_SAR_SPEC, -+ NL80211_ATTR_SAE_PWE, -+ -+ NL80211_ATTR_RECONNECT_REQUESTED, -+ -+ NL80211_ATTR_SAR_SPEC, -+ + NL80211_ATTR_DISABLE_HE, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, -@@ -5896,6 +5937,19 @@ enum nl80211_feature_flags { - * @NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP: Driver/device supports - * unsolicited broadcast probe response transmission +@@ -5928,6 +5940,16 @@ enum nl80211_feature_flags { + * @NL80211_EXT_FEATURE_BEACON_RATE_HE: Driver supports beacon rate + * configuration (AP/mesh) with HE rates. * -+ * @NL80211_EXT_FEATURE_BEACON_RATE_HE: Driver supports beacon rate -+ * configuration (AP/mesh) with HE rates. -+ * + * @NL80211_EXT_FEATURE_SECURE_LTF: Device supports secure LTF measurement + * exchange protocol. + * @@ -136,18 +54,17 @@ * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ -@@ -5956,6 +6010,10 @@ enum nl80211_ext_feature_index { - NL80211_EXT_FEATURE_SAE_OFFLOAD_AP, +@@ -5989,6 +6011,9 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_FILS_DISCOVERY, NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP, -+ NL80211_EXT_FEATURE_BEACON_RATE_HE, + NL80211_EXT_FEATURE_BEACON_RATE_HE, + NL80211_EXT_FEATURE_SECURE_LTF, + NL80211_EXT_FEATURE_SECURE_RTT, + NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, -@@ -6253,11 +6311,13 @@ struct nl80211_vendor_cmd_info { +@@ -6286,11 +6311,13 @@ struct nl80211_vendor_cmd_info { * @NL80211_TDLS_PEER_HT: TDLS peer is HT capable. * @NL80211_TDLS_PEER_VHT: TDLS peer is VHT capable. * @NL80211_TDLS_PEER_WMM: TDLS peer is WMM capable. @@ -161,7 +78,7 @@ }; /** -@@ -6849,6 +6909,9 @@ enum nl80211_peer_measurement_ftm_capa { +@@ -6882,6 +6909,9 @@ enum nl80211_peer_measurement_ftm_capa { * if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based * ranging will be used. @@ -171,7 +88,7 @@ * * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number -@@ -6867,6 +6930,7 @@ enum nl80211_peer_measurement_ftm_req { +@@ -6900,6 +6930,7 @@ enum nl80211_peer_measurement_ftm_req { NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC, NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED, NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED, @@ -179,119 +96,3 @@ /* keep last */ NUM_NL80211_PMSR_FTM_REQ_ATTR, -@@ -7124,4 +7188,115 @@ enum nl80211_unsol_bcast_probe_resp_attr - NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_MAX = - __NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_LAST - 1 - }; -+ -+/** -+ * enum nl80211_sae_pwe_mechanism - The mechanism(s) allowed for SAE PWE -+ * derivation. Applicable only when WPA3-Personal SAE authentication is -+ * used. -+ * -+ * @NL80211_SAE_PWE_UNSPECIFIED: not specified, used internally to indicate that -+ * attribute is not present from userspace. -+ * @NL80211_SAE_PWE_HUNT_AND_PECK: hunting-and-pecking loop only -+ * @NL80211_SAE_PWE_HASH_TO_ELEMENT: hash-to-element only -+ * @NL80211_SAE_PWE_BOTH: both hunting-and-pecking loop and hash-to-element -+ * can be used. -+ */ -+enum nl80211_sae_pwe_mechanism { -+ NL80211_SAE_PWE_UNSPECIFIED, -+ NL80211_SAE_PWE_HUNT_AND_PECK, -+ NL80211_SAE_PWE_HASH_TO_ELEMENT, -+ NL80211_SAE_PWE_BOTH, -+}; -+ -+/** -+ * enum nl80211_sar_type - type of SAR specs -+ * -+ * @NL80211_SAR_TYPE_POWER: power limitation specified in 0.25dBm unit -+ * -+ */ -+enum nl80211_sar_type { -+ NL80211_SAR_TYPE_POWER, -+ -+ /* add new type here */ -+ -+ /* Keep last */ -+ NUM_NL80211_SAR_TYPE, -+}; -+ -+/** -+ * enum nl80211_sar_attrs - Attributes for SAR spec -+ * -+ * @NL80211_SAR_ATTR_TYPE: the SAR type as defined in &enum nl80211_sar_type. -+ * -+ * @NL80211_SAR_ATTR_SPECS: Nested array of SAR power -+ * limit specifications. Each specification contains a set -+ * of %nl80211_sar_specs_attrs. -+ * -+ * For SET operation, it contains array of %NL80211_SAR_ATTR_SPECS_POWER -+ * and %NL80211_SAR_ATTR_SPECS_RANGE_INDEX. -+ * -+ * For sar_capa dump, it contains array of -+ * %NL80211_SAR_ATTR_SPECS_START_FREQ -+ * and %NL80211_SAR_ATTR_SPECS_END_FREQ. -+ * -+ * @__NL80211_SAR_ATTR_LAST: Internal -+ * @NL80211_SAR_ATTR_MAX: highest sar attribute -+ * -+ * These attributes are used with %NL80211_CMD_SET_SAR_SPEC -+ */ -+enum nl80211_sar_attrs { -+ __NL80211_SAR_ATTR_INVALID, -+ -+ NL80211_SAR_ATTR_TYPE, -+ NL80211_SAR_ATTR_SPECS, -+ -+ __NL80211_SAR_ATTR_LAST, -+ NL80211_SAR_ATTR_MAX = __NL80211_SAR_ATTR_LAST - 1, -+}; -+ -+/** -+ * enum nl80211_sar_specs_attrs - Attributes for SAR power limit specs -+ * -+ * @NL80211_SAR_ATTR_SPECS_POWER: Required (s32)value to specify the actual -+ * power limit value in units of 0.25 dBm if type is -+ * NL80211_SAR_TYPE_POWER. (i.e., a value of 44 represents 11 dBm). -+ * 0 means userspace doesn't have SAR limitation on this associated range. -+ * -+ * @NL80211_SAR_ATTR_SPECS_RANGE_INDEX: Required (u32) value to specify the -+ * index of exported freq range table and the associated power limitation -+ * is applied to this range. -+ * -+ * Userspace isn't required to set all the ranges advertised by WLAN driver, -+ * and userspace can skip some certain ranges. These skipped ranges don't -+ * have SAR limitations, and they are same as setting the -+ * %NL80211_SAR_ATTR_SPECS_POWER to any unreasonable high value because any -+ * value higher than regulatory allowed value just means SAR power -+ * limitation is removed, but it's required to set at least one range. -+ * It's not allowed to set duplicated range in one SET operation. -+ * -+ * Every SET operation overwrites previous SET operation. -+ * -+ * @NL80211_SAR_ATTR_SPECS_START_FREQ: Required (u32) value to specify the start -+ * frequency of this range edge when registering SAR capability to wiphy. -+ * It's not a channel center frequency. The unit is kHz. -+ * -+ * @NL80211_SAR_ATTR_SPECS_END_FREQ: Required (u32) value to specify the end -+ * frequency of this range edge when registering SAR capability to wiphy. -+ * It's not a channel center frequency. The unit is kHz. -+ * -+ * @__NL80211_SAR_ATTR_SPECS_LAST: Internal -+ * @NL80211_SAR_ATTR_SPECS_MAX: highest sar specs attribute -+ */ -+enum nl80211_sar_specs_attrs { -+ __NL80211_SAR_ATTR_SPECS_INVALID, -+ -+ NL80211_SAR_ATTR_SPECS_POWER, -+ NL80211_SAR_ATTR_SPECS_RANGE_INDEX, -+ NL80211_SAR_ATTR_SPECS_START_FREQ, -+ NL80211_SAR_ATTR_SPECS_END_FREQ, -+ -+ __NL80211_SAR_ATTR_SPECS_LAST, -+ NL80211_SAR_ATTR_SPECS_MAX = __NL80211_SAR_ATTR_SPECS_LAST - 1, -+}; -+ - #endif /* __LINUX_NL80211_H */ 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 c6fafb77b1..a63a2e2ee6 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 @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1307,7 +1307,6 @@ static int ieee80211_stop_ap(struct wiph +@@ -1287,7 +1287,6 @@ static int ieee80211_stop_ap(struct wiph sdata->vif.bss_conf.ftmr_params = NULL; __sta_info_flush(sdata, true); diff --git a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch index 8d086625e4..8a717558a7 100644 --- a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +++ b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch @@ -18,7 +18,7 @@ static int ieee80211_ifa6_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -1315,14 +1315,14 @@ int ieee80211_register_hw(struct ieee802 +@@ -1301,14 +1301,14 @@ int ieee80211_register_hw(struct ieee802 rtnl_unlock(); @@ -35,7 +35,7 @@ local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; result = register_inet6addr_notifier(&local->ifa6_notifier); if (result) -@@ -1331,13 +1331,13 @@ int ieee80211_register_hw(struct ieee802 +@@ -1317,13 +1317,13 @@ int ieee80211_register_hw(struct ieee802 return 0; @@ -52,7 +52,7 @@ fail_ifa: #endif wiphy_unregister(local->hw.wiphy); -@@ -1365,10 +1365,10 @@ void ieee80211_unregister_hw(struct ieee +@@ -1351,10 +1351,10 @@ void ieee80211_unregister_hw(struct ieee tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); diff --git a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch index f8c3821c51..96e6195a29 100644 --- a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch +++ b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2463,7 +2463,7 @@ static int ieee80211_scan(struct wiphy * +@@ -2443,7 +2443,7 @@ static int ieee80211_scan(struct wiphy * * the frames sent while scanning on other channel will be * lost) */ diff --git a/package/kernel/mac80211/patches/subsys/300-cfg80211-support-immediate-reconnect-request-hint.patch b/package/kernel/mac80211/patches/subsys/300-cfg80211-support-immediate-reconnect-request-hint.patch deleted file mode 100644 index 425b6895b1..0000000000 --- a/package/kernel/mac80211/patches/subsys/300-cfg80211-support-immediate-reconnect-request-hint.patch +++ /dev/null @@ -1,279 +0,0 @@ -From: Johannes Berg -Date: Sun, 6 Dec 2020 14:54:42 +0200 -Subject: [PATCH] cfg80211: support immediate reconnect request hint - -There are cases where it's necessary to disconnect, but an -immediate reconnection is desired. Support a hint to userspace -that this is the case, by including a new attribute in the -deauth or disassoc event. - -Signed-off-by: Luca Coelho -Link: https://lore.kernel.org/r/iwlwifi.20201206145305.58d33941fb9d.I0e7168c205c7949529c8e3b86f3c9b12c01a7017@changeid -Signed-off-by: Johannes Berg ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -6410,13 +6410,15 @@ void cfg80211_abandon_assoc(struct net_d - * @dev: network device - * @buf: 802.11 frame (header + body) - * @len: length of the frame data -+ * @reconnect: immediate reconnect is desired (include the nl80211 attribute) - * - * This function is called whenever deauthentication has been processed in - * station mode. This includes both received deauthentication frames and - * locally generated ones. This function may sleep. The caller must hold the - * corresponding wdev's mutex. - */ --void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len); -+void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len, -+ bool reconnect); - - /** - * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame ---- a/net/mac80211/mlme.c -+++ b/net/mac80211/mlme.c -@@ -2725,7 +2725,7 @@ static void ieee80211_report_disconnect( - }; - - if (tx) -- cfg80211_tx_mlme_mgmt(sdata->dev, buf, len); -+ cfg80211_tx_mlme_mgmt(sdata->dev, buf, len, false); - else - cfg80211_rx_mlme_mgmt(sdata->dev, buf, len); - -@@ -4719,7 +4719,8 @@ void ieee80211_mgd_quiesce(struct ieee80 - if (ifmgd->auth_data) - ieee80211_destroy_auth_data(sdata, false); - cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, -- IEEE80211_DEAUTH_FRAME_LEN); -+ IEEE80211_DEAUTH_FRAME_LEN, -+ false); - } - - /* This is a bit of a hack - we should find a better and more generic ---- a/net/wireless/mlme.c -+++ b/net/wireless/mlme.c -@@ -4,7 +4,7 @@ - * - * Copyright (c) 2009, Jouni Malinen - * Copyright (c) 2015 Intel Deutschland GmbH -- * Copyright (C) 2019 Intel Corporation -+ * Copyright (C) 2019-2020 Intel Corporation - */ - - #include -@@ -81,7 +81,8 @@ static void cfg80211_process_auth(struct - } - - static void cfg80211_process_deauth(struct wireless_dev *wdev, -- const u8 *buf, size_t len) -+ const u8 *buf, size_t len, -+ bool reconnect) - { - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; -@@ -89,7 +90,7 @@ static void cfg80211_process_deauth(stru - u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); - bool from_ap = !ether_addr_equal(mgmt->sa, wdev->netdev->dev_addr); - -- nl80211_send_deauth(rdev, wdev->netdev, buf, len, GFP_KERNEL); -+ nl80211_send_deauth(rdev, wdev->netdev, buf, len, reconnect, GFP_KERNEL); - - if (!wdev->current_bss || - !ether_addr_equal(wdev->current_bss->pub.bssid, bssid)) -@@ -100,7 +101,8 @@ static void cfg80211_process_deauth(stru - } - - static void cfg80211_process_disassoc(struct wireless_dev *wdev, -- const u8 *buf, size_t len) -+ const u8 *buf, size_t len, -+ bool reconnect) - { - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; -@@ -108,7 +110,8 @@ static void cfg80211_process_disassoc(st - u16 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); - bool from_ap = !ether_addr_equal(mgmt->sa, wdev->netdev->dev_addr); - -- nl80211_send_disassoc(rdev, wdev->netdev, buf, len, GFP_KERNEL); -+ nl80211_send_disassoc(rdev, wdev->netdev, buf, len, reconnect, -+ GFP_KERNEL); - - if (WARN_ON(!wdev->current_bss || - !ether_addr_equal(wdev->current_bss->pub.bssid, bssid))) -@@ -133,9 +136,9 @@ void cfg80211_rx_mlme_mgmt(struct net_de - if (ieee80211_is_auth(mgmt->frame_control)) - cfg80211_process_auth(wdev, buf, len); - else if (ieee80211_is_deauth(mgmt->frame_control)) -- cfg80211_process_deauth(wdev, buf, len); -+ cfg80211_process_deauth(wdev, buf, len, false); - else if (ieee80211_is_disassoc(mgmt->frame_control)) -- cfg80211_process_disassoc(wdev, buf, len); -+ cfg80211_process_disassoc(wdev, buf, len, false); - } - EXPORT_SYMBOL(cfg80211_rx_mlme_mgmt); - -@@ -180,22 +183,23 @@ void cfg80211_abandon_assoc(struct net_d - } - EXPORT_SYMBOL(cfg80211_abandon_assoc); - --void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len) -+void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len, -+ bool reconnect) - { - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct ieee80211_mgmt *mgmt = (void *)buf; - - ASSERT_WDEV_LOCK(wdev); - -- trace_cfg80211_tx_mlme_mgmt(dev, buf, len); -+ trace_cfg80211_tx_mlme_mgmt(dev, buf, len, reconnect); - - if (WARN_ON(len < 2)) - return; - - if (ieee80211_is_deauth(mgmt->frame_control)) -- cfg80211_process_deauth(wdev, buf, len); -+ cfg80211_process_deauth(wdev, buf, len, reconnect); - else -- cfg80211_process_disassoc(wdev, buf, len); -+ cfg80211_process_disassoc(wdev, buf, len, reconnect); - } - EXPORT_SYMBOL(cfg80211_tx_mlme_mgmt); - ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -736,6 +736,7 @@ static const struct nla_policy nl80211_p - NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN), - [NL80211_ATTR_S1G_CAPABILITY_MASK] = - NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN), -+ [NL80211_ATTR_RECONNECT_REQUESTED] = { .type = NLA_REJECT }, - }; - - /* policy for the key attributes */ -@@ -15902,7 +15903,7 @@ static void nl80211_send_mlme_event(stru - const u8 *buf, size_t len, - enum nl80211_commands cmd, gfp_t gfp, - int uapsd_queues, const u8 *req_ies, -- size_t req_ies_len) -+ size_t req_ies_len, bool reconnect) - { - struct sk_buff *msg; - void *hdr; -@@ -15924,6 +15925,9 @@ static void nl80211_send_mlme_event(stru - nla_put(msg, NL80211_ATTR_REQ_IE, req_ies_len, req_ies))) - goto nla_put_failure; - -+ if (reconnect && nla_put_flag(msg, NL80211_ATTR_RECONNECT_REQUESTED)) -+ goto nla_put_failure; -+ - if (uapsd_queues >= 0) { - struct nlattr *nla_wmm = - nla_nest_start_noflag(msg, NL80211_ATTR_STA_WME); -@@ -15952,7 +15956,8 @@ void nl80211_send_rx_auth(struct cfg8021 - size_t len, gfp_t gfp) - { - nl80211_send_mlme_event(rdev, netdev, buf, len, -- NL80211_CMD_AUTHENTICATE, gfp, -1, NULL, 0); -+ NL80211_CMD_AUTHENTICATE, gfp, -1, NULL, 0, -+ false); - } - - void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev, -@@ -15962,23 +15967,25 @@ void nl80211_send_rx_assoc(struct cfg802 - { - nl80211_send_mlme_event(rdev, netdev, buf, len, - NL80211_CMD_ASSOCIATE, gfp, uapsd_queues, -- req_ies, req_ies_len); -+ req_ies, req_ies_len, false); - } - - void nl80211_send_deauth(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *buf, -- size_t len, gfp_t gfp) -+ size_t len, bool reconnect, gfp_t gfp) - { - nl80211_send_mlme_event(rdev, netdev, buf, len, -- NL80211_CMD_DEAUTHENTICATE, gfp, -1, NULL, 0); -+ NL80211_CMD_DEAUTHENTICATE, gfp, -1, NULL, 0, -+ reconnect); - } - - void nl80211_send_disassoc(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *buf, -- size_t len, gfp_t gfp) -+ size_t len, bool reconnect, gfp_t gfp) - { - nl80211_send_mlme_event(rdev, netdev, buf, len, -- NL80211_CMD_DISASSOCIATE, gfp, -1, NULL, 0); -+ NL80211_CMD_DISASSOCIATE, gfp, -1, NULL, 0, -+ reconnect); - } - - void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, const u8 *buf, -@@ -16009,7 +16016,7 @@ void cfg80211_rx_unprot_mlme_mgmt(struct - - trace_cfg80211_rx_unprot_mlme_mgmt(dev, buf, len); - nl80211_send_mlme_event(rdev, dev, buf, len, cmd, GFP_ATOMIC, -1, -- NULL, 0); -+ NULL, 0, false); - } - EXPORT_SYMBOL(cfg80211_rx_unprot_mlme_mgmt); - ---- a/net/wireless/nl80211.h -+++ b/net/wireless/nl80211.h -@@ -1,7 +1,7 @@ - /* SPDX-License-Identifier: GPL-2.0 */ - /* - * Portions of this file -- * Copyright (C) 2018 Intel Corporation -+ * Copyright (C) 2018, 2020 Intel Corporation - */ - #ifndef __NET_WIRELESS_NL80211_H - #define __NET_WIRELESS_NL80211_H -@@ -69,10 +69,12 @@ void nl80211_send_rx_assoc(struct cfg802 - const u8 *req_ies, size_t req_ies_len); - void nl80211_send_deauth(struct cfg80211_registered_device *rdev, - struct net_device *netdev, -- const u8 *buf, size_t len, gfp_t gfp); -+ const u8 *buf, size_t len, -+ bool reconnect, gfp_t gfp); - void nl80211_send_disassoc(struct cfg80211_registered_device *rdev, - struct net_device *netdev, -- const u8 *buf, size_t len, gfp_t gfp); -+ const u8 *buf, size_t len, -+ bool reconnect, gfp_t gfp); - void nl80211_send_auth_timeout(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - const u8 *addr, gfp_t gfp); ---- a/net/wireless/trace.h -+++ b/net/wireless/trace.h -@@ -2684,19 +2684,23 @@ DEFINE_EVENT(netdev_frame_event, cfg8021 - ); - - TRACE_EVENT(cfg80211_tx_mlme_mgmt, -- TP_PROTO(struct net_device *netdev, const u8 *buf, int len), -- TP_ARGS(netdev, buf, len), -+ TP_PROTO(struct net_device *netdev, const u8 *buf, int len, -+ bool reconnect), -+ TP_ARGS(netdev, buf, len, reconnect), - TP_STRUCT__entry( - NETDEV_ENTRY - __dynamic_array(u8, frame, len) -+ __field(int, reconnect) - ), - TP_fast_assign( - NETDEV_ASSIGN; - memcpy(__get_dynamic_array(frame), buf, len); -+ __entry->reconnect = reconnect; - ), -- TP_printk(NETDEV_PR_FMT ", ftype:0x%.2x", -+ TP_printk(NETDEV_PR_FMT ", ftype:0x%.2x reconnect:%d", - NETDEV_PR_ARG, -- le16_to_cpup((__le16 *)__get_dynamic_array(frame))) -+ le16_to_cpup((__le16 *)__get_dynamic_array(frame)), -+ __entry->reconnect) - ); - - DECLARE_EVENT_CLASS(netdev_mac_evt, diff --git a/package/kernel/mac80211/patches/subsys/301-mac80211-support-driver-based-disconnect-with-reconn.patch b/package/kernel/mac80211/patches/subsys/301-mac80211-support-driver-based-disconnect-with-reconn.patch deleted file mode 100644 index cc9602df71..0000000000 --- a/package/kernel/mac80211/patches/subsys/301-mac80211-support-driver-based-disconnect-with-reconn.patch +++ /dev/null @@ -1,271 +0,0 @@ -From: Johannes Berg -Date: Sun, 6 Dec 2020 14:54:43 +0200 -Subject: [PATCH] mac80211: support driver-based disconnect with reconnect hint - -Support the driver indicating that a disconnection needs -to be performed, and pass through the reconnect hint in -this case. - -Signed-off-by: Johannes Berg -Signed-off-by: Luca Coelho -Link: https://lore.kernel.org/r/iwlwifi.20201206145305.5c8dab7a22a0.I58459fdf6968b16c90cab9c574f0f04ca22b0c79@changeid -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -5885,6 +5885,17 @@ void ieee80211_beacon_loss(struct ieee80 - void ieee80211_connection_loss(struct ieee80211_vif *vif); - - /** -+ * ieee80211_disconnect - request disconnection -+ * -+ * @vif: &struct ieee80211_vif pointer from the add_interface callback. -+ * @reconnect: immediate reconnect is desired -+ * -+ * Request disconnection from the current network and, if enabled, send a -+ * hint to the higher layers that immediate reconnect is desired. -+ */ -+void ieee80211_disconnect(struct ieee80211_vif *vif, bool reconnect); -+ -+/** - * ieee80211_resume_disconnect - disconnect from AP after resume - * - * @vif: &struct ieee80211_vif pointer from the add_interface callback. ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -450,7 +450,9 @@ struct ieee80211_if_managed { - unsigned long probe_timeout; - int probe_send_count; - bool nullfunc_failed; -- bool connection_loss; -+ u8 connection_loss:1, -+ driver_disconnect:1, -+ reconnect:1; - - struct cfg80211_bss *associated; - struct ieee80211_mgd_auth_data *auth_data; ---- a/net/mac80211/mlme.c -+++ b/net/mac80211/mlme.c -@@ -2716,7 +2716,7 @@ EXPORT_SYMBOL(ieee80211_ap_probereq_get) - - static void ieee80211_report_disconnect(struct ieee80211_sub_if_data *sdata, - const u8 *buf, size_t len, bool tx, -- u16 reason) -+ u16 reason, bool reconnect) - { - struct ieee80211_event event = { - .type = MLME_EVENT, -@@ -2725,7 +2725,7 @@ static void ieee80211_report_disconnect( - }; - - if (tx) -- cfg80211_tx_mlme_mgmt(sdata->dev, buf, len, false); -+ cfg80211_tx_mlme_mgmt(sdata->dev, buf, len, reconnect); - else - cfg80211_rx_mlme_mgmt(sdata->dev, buf, len); - -@@ -2747,13 +2747,18 @@ static void __ieee80211_disconnect(struc - - tx = !sdata->csa_block_tx; - -- /* AP is probably out of range (or not reachable for another reason) so -- * remove the bss struct for that AP. -- */ -- cfg80211_unlink_bss(local->hw.wiphy, ifmgd->associated); -+ if (!ifmgd->driver_disconnect) { -+ /* -+ * AP is probably out of range (or not reachable for another -+ * reason) so remove the bss struct for that AP. -+ */ -+ cfg80211_unlink_bss(local->hw.wiphy, ifmgd->associated); -+ } - - ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, -- WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, -+ ifmgd->driver_disconnect ? -+ WLAN_REASON_DEAUTH_LEAVING : -+ WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, - tx, frame_buf); - mutex_lock(&local->mtx); - sdata->vif.csa_active = false; -@@ -2766,7 +2771,9 @@ static void __ieee80211_disconnect(struc - mutex_unlock(&local->mtx); - - ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), tx, -- WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); -+ WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, -+ ifmgd->reconnect); -+ ifmgd->reconnect = false; - - sdata_unlock(sdata); - } -@@ -2785,6 +2792,13 @@ static void ieee80211_beacon_connection_ - sdata_info(sdata, "Connection to AP %pM lost\n", - ifmgd->bssid); - __ieee80211_disconnect(sdata); -+ ifmgd->connection_loss = false; -+ } else if (ifmgd->driver_disconnect) { -+ sdata_info(sdata, -+ "Driver requested disconnection from AP %pM\n", -+ ifmgd->bssid); -+ __ieee80211_disconnect(sdata); -+ ifmgd->driver_disconnect = false; - } else { - ieee80211_mgd_probe_ap(sdata, true); - } -@@ -2823,6 +2837,21 @@ void ieee80211_connection_loss(struct ie - } - EXPORT_SYMBOL(ieee80211_connection_loss); - -+void ieee80211_disconnect(struct ieee80211_vif *vif, bool reconnect) -+{ -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); -+ struct ieee80211_hw *hw = &sdata->local->hw; -+ -+ trace_api_disconnect(sdata, reconnect); -+ -+ if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) -+ return; -+ -+ sdata->u.mgd.driver_disconnect = true; -+ sdata->u.mgd.reconnect = reconnect; -+ ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work); -+} -+EXPORT_SYMBOL(ieee80211_disconnect); - - static void ieee80211_destroy_auth_data(struct ieee80211_sub_if_data *sdata, - bool assoc) -@@ -3126,7 +3155,7 @@ static void ieee80211_rx_mgmt_deauth(str - ieee80211_set_disassoc(sdata, 0, 0, false, NULL); - - ieee80211_report_disconnect(sdata, (u8 *)mgmt, len, false, -- reason_code); -+ reason_code, false); - return; - } - -@@ -3175,7 +3204,8 @@ static void ieee80211_rx_mgmt_disassoc(s - - ieee80211_set_disassoc(sdata, 0, 0, false, NULL); - -- ieee80211_report_disconnect(sdata, (u8 *)mgmt, len, false, reason_code); -+ ieee80211_report_disconnect(sdata, (u8 *)mgmt, len, false, reason_code, -+ false); - } - - static void ieee80211_get_rates(struct ieee80211_supported_band *sband, -@@ -4199,7 +4229,8 @@ static void ieee80211_rx_mgmt_beacon(str - true, deauth_buf); - ieee80211_report_disconnect(sdata, deauth_buf, - sizeof(deauth_buf), true, -- WLAN_REASON_DEAUTH_LEAVING); -+ WLAN_REASON_DEAUTH_LEAVING, -+ false); - return; - } - -@@ -4344,7 +4375,7 @@ static void ieee80211_sta_connection_los - tx, frame_buf); - - ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), true, -- reason); -+ reason, false); - } - - static int ieee80211_auth(struct ieee80211_sub_if_data *sdata) -@@ -5434,7 +5465,8 @@ int ieee80211_mgd_auth(struct ieee80211_ - - ieee80211_report_disconnect(sdata, frame_buf, - sizeof(frame_buf), true, -- WLAN_REASON_UNSPECIFIED); -+ WLAN_REASON_UNSPECIFIED, -+ false); - } - - sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid); -@@ -5506,7 +5538,8 @@ int ieee80211_mgd_assoc(struct ieee80211 - - ieee80211_report_disconnect(sdata, frame_buf, - sizeof(frame_buf), true, -- WLAN_REASON_UNSPECIFIED); -+ WLAN_REASON_UNSPECIFIED, -+ false); - } - - if (ifmgd->auth_data && !ifmgd->auth_data->done) { -@@ -5809,7 +5842,7 @@ int ieee80211_mgd_deauth(struct ieee8021 - ieee80211_destroy_auth_data(sdata, false); - ieee80211_report_disconnect(sdata, frame_buf, - sizeof(frame_buf), true, -- req->reason_code); -+ req->reason_code, false); - - return 0; - } -@@ -5829,7 +5862,7 @@ int ieee80211_mgd_deauth(struct ieee8021 - ieee80211_destroy_assoc_data(sdata, false, true); - ieee80211_report_disconnect(sdata, frame_buf, - sizeof(frame_buf), true, -- req->reason_code); -+ req->reason_code, false); - return 0; - } - -@@ -5844,7 +5877,7 @@ int ieee80211_mgd_deauth(struct ieee8021 - req->reason_code, tx, frame_buf); - ieee80211_report_disconnect(sdata, frame_buf, - sizeof(frame_buf), true, -- req->reason_code); -+ req->reason_code, false); - return 0; - } - -@@ -5877,7 +5910,7 @@ int ieee80211_mgd_disassoc(struct ieee80 - frame_buf); - - ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), true, -- req->reason_code); -+ req->reason_code, false); - - return 0; - } ---- a/net/mac80211/trace.h -+++ b/net/mac80211/trace.h -@@ -2,7 +2,7 @@ - /* - * Portions of this file - * Copyright(c) 2016-2017 Intel Deutschland GmbH --* Copyright (C) 2018 - 2019 Intel Corporation -+* Copyright (C) 2018 - 2020 Intel Corporation - */ - - #if !defined(__MAC80211_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ) -@@ -2086,6 +2086,27 @@ TRACE_EVENT(api_connection_loss, - ) - ); - -+TRACE_EVENT(api_disconnect, -+ TP_PROTO(struct ieee80211_sub_if_data *sdata, bool reconnect), -+ -+ TP_ARGS(sdata, reconnect), -+ -+ TP_STRUCT__entry( -+ VIF_ENTRY -+ __field(int, reconnect) -+ ), -+ -+ TP_fast_assign( -+ VIF_ASSIGN; -+ __entry->reconnect = reconnect; -+ ), -+ -+ TP_printk( -+ VIF_PR_FMT " reconnect:%d", -+ VIF_PR_ARG, __entry->reconnect -+ ) -+); -+ - TRACE_EVENT(api_cqm_rssi_notify, - TP_PROTO(struct ieee80211_sub_if_data *sdata, - enum nl80211_cqm_rssi_threshold_event rssi_event, diff --git a/package/kernel/mac80211/patches/subsys/302-cfg80211-Add-support-to-configure-SAE-PWE-value-to-d.patch b/package/kernel/mac80211/patches/subsys/302-cfg80211-Add-support-to-configure-SAE-PWE-value-to-d.patch deleted file mode 100644 index da88d1413d..0000000000 --- a/package/kernel/mac80211/patches/subsys/302-cfg80211-Add-support-to-configure-SAE-PWE-value-to-d.patch +++ /dev/null @@ -1,74 +0,0 @@ -From: Rohan Dutta -Date: Tue, 27 Oct 2020 12:09:10 +0200 -Subject: [PATCH] cfg80211: Add support to configure SAE PWE value to drivers - -Add support to configure SAE PWE preference from userspace to drivers in -both AP and STA modes. This is needed for cases where the driver takes -care of Authentication frame processing (SME in the driver) so that -correct enforcement of the acceptable PWE derivation mechanism can be -performed. - -The userspace applications can pass the sae_pwe value using the -NL80211_ATTR_SAE_PWE attribute in the NL80211_CMD_CONNECT and -NL80211_CMD_START_AP commands to the driver. This allows selection -between the hunting-and-pecking loop and hash-to-element options for PWE -derivation. For backwards compatibility, this new attribute is optional -and if not included, the driver is notified of the value being -unspecified. - -Signed-off-by: Rohan Dutta -Signed-off-by: Jouni Malinen -Link: https://lore.kernel.org/r/20201027100910.22283-1-jouni@codeaurora.org -Signed-off-by: Johannes Berg ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -1009,6 +1009,14 @@ struct survey_info { - * @sae_pwd: password for SAE authentication (for devices supporting SAE - * offload) - * @sae_pwd_len: length of SAE password (for devices supporting SAE offload) -+ * @sae_pwe: The mechanisms allowed for SAE PWE derivation -+ * NL80211_SAE_PWE_UNSPECIFIED: Not-specified, used to indicate userspace -+ * did not specify any preference. The driver should follow its -+ * internal policy in such a scenario. -+ * NL80211_SAE_PWE_HUNT_AND_PECK: Allow hunting-and-pecking loop only -+ * NL80211_SAE_PWE_HASH_TO_ELEMENT: Allow hash-to-element only -+ * NL80211_SAE_PWE_BOTH: Allow either hunting-and-pecking loop -+ * or hash-to-element - */ - struct cfg80211_crypto_settings { - u32 wpa_versions; -@@ -1027,6 +1035,7 @@ struct cfg80211_crypto_settings { - const u8 *psk; - const u8 *sae_pwd; - u8 sae_pwd_len; -+ enum nl80211_sae_pwe_mechanism sae_pwe; - }; - - /** ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -736,6 +736,9 @@ static const struct nla_policy nl80211_p - NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN), - [NL80211_ATTR_S1G_CAPABILITY_MASK] = - NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN), -+ [NL80211_ATTR_SAE_PWE] = -+ NLA_POLICY_RANGE(NLA_U8, NL80211_SAE_PWE_HUNT_AND_PECK, -+ NL80211_SAE_PWE_BOTH), - [NL80211_ATTR_RECONNECT_REQUESTED] = { .type = NLA_REJECT }, - }; - -@@ -9763,6 +9766,12 @@ static int nl80211_crypto_settings(struc - nla_len(info->attrs[NL80211_ATTR_SAE_PASSWORD]); - } - -+ if (info->attrs[NL80211_ATTR_SAE_PWE]) -+ settings->sae_pwe = -+ nla_get_u8(info->attrs[NL80211_ATTR_SAE_PWE]); -+ else -+ settings->sae_pwe = NL80211_SAE_PWE_UNSPECIFIED; -+ - return 0; - } - diff --git a/package/kernel/mac80211/patches/subsys/311-net-fq_impl-drop-get_default_func-move-default-flow-.patch b/package/kernel/mac80211/patches/subsys/311-net-fq_impl-drop-get_default_func-move-default-flow-.patch index 6adca7d70d..2d7db8be36 100644 --- a/package/kernel/mac80211/patches/subsys/311-net-fq_impl-drop-get_default_func-move-default-flow-.patch +++ b/package/kernel/mac80211/patches/subsys/311-net-fq_impl-drop-get_default_func-move-default-flow-.patch @@ -68,7 +68,7 @@ Signed-off-by: Felix Fietkau static int fq_init(struct fq *fq, int flows_cnt) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -846,7 +846,6 @@ enum txq_info_flags { +@@ -852,7 +852,6 @@ enum txq_info_flags { */ struct txq_info { struct fq_tin tin; @@ -78,7 +78,7 @@ Signed-off-by: Felix Fietkau struct sk_buff_head frags; --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -1322,7 +1322,7 @@ static struct sk_buff *codel_dequeue_fun +@@ -1309,7 +1309,7 @@ static struct sk_buff *codel_dequeue_fun fq = &local->fq; if (cvars == &txqi->def_cvars) @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau else flow = &fq->flows[cvars - local->cvars]; -@@ -1365,7 +1365,7 @@ static struct sk_buff *fq_tin_dequeue_fu +@@ -1352,7 +1352,7 @@ static struct sk_buff *fq_tin_dequeue_fu cparams = &local->cparams; } @@ -96,7 +96,7 @@ Signed-off-by: Felix Fietkau cvars = &txqi->def_cvars; else cvars = &local->cvars[flow - fq->flows]; -@@ -1392,17 +1392,6 @@ static void fq_skb_free_func(struct fq * +@@ -1379,17 +1379,6 @@ static void fq_skb_free_func(struct fq * ieee80211_free_txskb(&local->hw, skb); } @@ -114,7 +114,7 @@ Signed-off-by: Felix Fietkau static void ieee80211_txq_enqueue(struct ieee80211_local *local, struct txq_info *txqi, struct sk_buff *skb) -@@ -1415,8 +1404,7 @@ static void ieee80211_txq_enqueue(struct +@@ -1402,8 +1391,7 @@ static void ieee80211_txq_enqueue(struct spin_lock_bh(&fq->lock); fq_tin_enqueue(fq, tin, flow_idx, skb, @@ -124,7 +124,7 @@ Signed-off-by: Felix Fietkau spin_unlock_bh(&fq->lock); } -@@ -1459,7 +1447,6 @@ void ieee80211_txq_init(struct ieee80211 +@@ -1446,7 +1434,6 @@ void ieee80211_txq_init(struct ieee80211 struct txq_info *txqi, int tid) { fq_tin_init(&txqi->tin); @@ -132,7 +132,7 @@ Signed-off-by: Felix Fietkau codel_vars_init(&txqi->def_cvars); codel_stats_init(&txqi->cstats); __skb_queue_head_init(&txqi->frags); -@@ -3332,8 +3319,7 @@ static bool ieee80211_amsdu_aggregate(st +@@ -3281,8 +3268,7 @@ static bool ieee80211_amsdu_aggregate(st */ tin = &txqi->tin; diff --git a/package/kernel/mac80211/patches/subsys/312-net-fq_impl-do-not-maintain-a-backlog-sorted-list-of.patch b/package/kernel/mac80211/patches/subsys/312-net-fq_impl-do-not-maintain-a-backlog-sorted-list-of.patch index 793c76abec..2fa2ba41ac 100644 --- a/package/kernel/mac80211/patches/subsys/312-net-fq_impl-do-not-maintain-a-backlog-sorted-list-of.patch +++ b/package/kernel/mac80211/patches/subsys/312-net-fq_impl-do-not-maintain-a-backlog-sorted-list-of.patch @@ -306,7 +306,7 @@ Signed-off-by: Felix Fietkau #endif --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3386,8 +3386,6 @@ out_recalc: +@@ -3335,8 +3335,6 @@ out_recalc: if (head->len != orig_len) { flow->backlog += head->len - orig_len; tin->backlog_bytes += head->len - orig_len; diff --git a/package/kernel/mac80211/patches/subsys/315-mac80211-add-rx-decapsulation-offload-support.patch b/package/kernel/mac80211/patches/subsys/315-mac80211-add-rx-decapsulation-offload-support.patch index 49af25eb1d..4f0e5fb31a 100644 --- a/package/kernel/mac80211/patches/subsys/315-mac80211-add-rx-decapsulation-offload-support.patch +++ b/package/kernel/mac80211/patches/subsys/315-mac80211-add-rx-decapsulation-offload-support.patch @@ -26,7 +26,7 @@ Signed-off-by: Felix Fietkau --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -1297,6 +1297,8 @@ ieee80211_tx_info_clear_status(struct ie +@@ -1300,6 +1300,8 @@ ieee80211_tx_info_clear_status(struct ie * the "0-length PSDU" field included there. The value for it is * in &struct ieee80211_rx_status. Note that if this value isn't * known the frame shouldn't be reported. @@ -35,7 +35,7 @@ Signed-off-by: Felix Fietkau */ enum mac80211_rx_flags { RX_FLAG_MMIC_ERROR = BIT(0), -@@ -1329,6 +1331,7 @@ enum mac80211_rx_flags { +@@ -1332,6 +1334,7 @@ enum mac80211_rx_flags { RX_FLAG_RADIOTAP_HE_MU = BIT(27), RX_FLAG_RADIOTAP_LSIG = BIT(28), RX_FLAG_NO_PSDU = BIT(29), @@ -43,7 +43,7 @@ Signed-off-by: Felix Fietkau }; /** -@@ -1650,11 +1653,15 @@ enum ieee80211_vif_flags { +@@ -1653,11 +1656,15 @@ enum ieee80211_vif_flags { * The driver supports sending frames passed as 802.3 frames by mac80211. * It must also support sending 802.11 packets for the same interface. * @IEEE80211_OFFLOAD_ENCAP_4ADDR: support 4-address mode encapsulation offload @@ -59,7 +59,7 @@ Signed-off-by: Felix Fietkau }; /** -@@ -2390,6 +2397,9 @@ struct ieee80211_txq { +@@ -2393,6 +2400,9 @@ struct ieee80211_txq { * @IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD: Hardware supports tx encapsulation * offload * @@ -69,7 +69,7 @@ Signed-off-by: Felix Fietkau * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays */ enum ieee80211_hw_flags { -@@ -2443,6 +2453,7 @@ enum ieee80211_hw_flags { +@@ -2446,6 +2456,7 @@ enum ieee80211_hw_flags { IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID, IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT, IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD, @@ -77,10 +77,10 @@ Signed-off-by: Felix Fietkau /* keep last, obviously */ NUM_IEEE80211_HW_FLAGS -@@ -4196,6 +4207,9 @@ struct ieee80211_ops { - struct ieee80211_vif *vif); - void (*sta_set_4addr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, +@@ -4202,6 +4213,9 @@ struct ieee80211_ops { struct ieee80211_sta *sta, bool enabled); + int (*set_sar_specs)(struct ieee80211_hw *hw, + const struct cfg80211_sar_specs *sar); + void (*sta_set_decap_offload)(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, bool enabled); @@ -132,7 +132,7 @@ Signed-off-by: Felix Fietkau #endif /* __MAC80211_DRIVER_OPS */ --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -856,7 +856,7 @@ static const struct net_device_ops ieee8 +@@ -815,7 +815,7 @@ static const struct net_device_ops ieee8 }; @@ -141,7 +141,7 @@ Signed-off-by: Felix Fietkau { switch (iftype) { /* P2P GO and client are mapped to AP/STATION types */ -@@ -876,7 +876,7 @@ static bool ieee80211_set_sdata_offload_ +@@ -835,7 +835,7 @@ static bool ieee80211_set_sdata_offload_ flags = sdata->vif.offload_flags; if (ieee80211_hw_check(&local->hw, SUPPORTS_TX_ENCAP_OFFLOAD) && @@ -150,7 +150,7 @@ Signed-off-by: Felix Fietkau flags |= IEEE80211_OFFLOAD_ENCAP_ENABLED; if (!ieee80211_hw_check(&local->hw, SUPPORTS_TX_FRAG) && -@@ -889,10 +889,21 @@ static bool ieee80211_set_sdata_offload_ +@@ -848,10 +848,21 @@ static bool ieee80211_set_sdata_offload_ flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED; } @@ -172,7 +172,7 @@ Signed-off-by: Felix Fietkau return true; } -@@ -910,7 +921,7 @@ static void ieee80211_set_vif_encap_ops( +@@ -869,7 +880,7 @@ static void ieee80211_set_vif_encap_ops( } if (!ieee80211_hw_check(&local->hw, SUPPORTS_TX_ENCAP_OFFLOAD) || @@ -183,7 +183,7 @@ Signed-off-by: Felix Fietkau enabled = bss->vif.offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED; --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -4195,7 +4195,9 @@ void ieee80211_check_fast_rx(struct sta_ +@@ -4099,7 +4099,9 @@ void ieee80211_check_fast_rx(struct sta_ .vif_type = sdata->vif.type, .control_port_protocol = sdata->control_port_protocol, }, *old, *new = NULL; @@ -193,7 +193,7 @@ Signed-off-by: Felix Fietkau /* use sparse to check that we don't return without updating */ __acquire(check_fast_rx); -@@ -4308,6 +4310,17 @@ void ieee80211_check_fast_rx(struct sta_ +@@ -4212,6 +4214,17 @@ void ieee80211_check_fast_rx(struct sta_ if (assign) new = kmemdup(&fastrx, sizeof(fastrx), GFP_KERNEL); @@ -211,7 +211,7 @@ Signed-off-by: Felix Fietkau spin_lock_bh(&sta->lock); old = rcu_dereference_protected(sta->fast_rx, true); rcu_assign_pointer(sta->fast_rx, new); -@@ -4354,6 +4367,108 @@ void ieee80211_check_fast_rx_iface(struc +@@ -4258,6 +4271,108 @@ void ieee80211_check_fast_rx_iface(struc mutex_unlock(&local->sta_mtx); } @@ -264,7 +264,7 @@ Signed-off-by: Felix Fietkau + + skb->dev = fast_rx->dev; + -+ ieee80211_rx_stats(fast_rx->dev, skb->len); ++ dev_sw_netstats_rx_add(fast_rx->dev, skb->len); + + /* The seqno index has the same property as needed + * for the rx_msdu field, i.e. it is IEEE80211_NUM_TIDS @@ -320,7 +320,7 @@ Signed-off-by: Felix Fietkau static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, struct ieee80211_fast_rx *fast_rx) { -@@ -4374,9 +4489,6 @@ static bool ieee80211_invoke_fast_rx(str +@@ -4278,9 +4393,6 @@ static bool ieee80211_invoke_fast_rx(str } addrs __aligned(2); struct ieee80211_sta_rx_stats *stats = &sta->rx_stats; @@ -330,7 +330,7 @@ Signed-off-by: Felix Fietkau /* for parallel-rx, we need to have DUP_VALIDATED, otherwise we write * to a common data structure; drivers can implement that per queue * but we don't have that information in mac80211 -@@ -4450,32 +4562,6 @@ static bool ieee80211_invoke_fast_rx(str +@@ -4354,32 +4466,6 @@ static bool ieee80211_invoke_fast_rx(str pskb_trim(skb, skb->len - fast_rx->icv_len)) goto drop; @@ -363,7 +363,7 @@ Signed-off-by: Felix Fietkau if (rx->key && !ieee80211_has_protected(hdr->frame_control)) goto drop; -@@ -4487,12 +4573,6 @@ static bool ieee80211_invoke_fast_rx(str +@@ -4391,12 +4477,6 @@ static bool ieee80211_invoke_fast_rx(str return true; } @@ -376,13 +376,13 @@ Signed-off-by: Felix Fietkau /* 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); -@@ -4501,62 +4581,14 @@ static bool ieee80211_invoke_fast_rx(str +@@ -4405,62 +4485,14 @@ static bool ieee80211_invoke_fast_rx(str /* push the addresses in front */ memcpy(skb_push(skb, sizeof(addrs)), &addrs, sizeof(addrs)); - skb->dev = fast_rx->dev; - -- ieee80211_rx_stats(fast_rx->dev, skb->len); +- dev_sw_netstats_rx_add(fast_rx->dev, skb->len); - - /* The seqno index has the same property as needed - * for the rx_msdu field, i.e. it is IEEE80211_NUM_TIDS @@ -443,7 +443,7 @@ Signed-off-by: Felix Fietkau stats->dropped++; return true; } -@@ -4610,6 +4642,47 @@ static bool ieee80211_prepare_and_rx_han +@@ -4514,6 +4546,47 @@ static bool ieee80211_prepare_and_rx_han return true; } @@ -491,31 +491,26 @@ Signed-off-by: Felix Fietkau /* * This is the actual Rx frames handler. as it belongs to Rx path it must * be called with rcu_read_lock protection. -@@ -4847,15 +4920,20 @@ void ieee80211_rx_list(struct ieee80211_ +@@ -4753,13 +4826,17 @@ void ieee80211_rx_list(struct ieee80211_ * if it was previously present. * Also, frames with less than 16 bytes are dropped. */ - skb = ieee80211_rx_monitor(local, skb, rate); -- if (!skb) -- return; -+ if (!(status->flag & RX_FLAG_8023)) { ++ if (!(status->flag & RX_FLAG_8023)) + skb = ieee80211_rx_monitor(local, skb, rate); -+ if (!skb) -+ return; -+ } + if (skb) { + ieee80211_tpt_led_trig_rx(local, + ((struct ieee80211_hdr *)skb->data)->frame_control, + skb->len); - ieee80211_tpt_led_trig_rx(local, - ((struct ieee80211_hdr *)skb->data)->frame_control, - skb->len); +- __ieee80211_rx_handle_packet(hw, pubsta, skb, list); ++ if (status->flag & RX_FLAG_8023) ++ __ieee80211_rx_handle_8023(hw, pubsta, skb, list); ++ else ++ __ieee80211_rx_handle_packet(hw, pubsta, skb, list); + } -- __ieee80211_rx_handle_packet(hw, pubsta, skb, list); -+ if (status->flag & RX_FLAG_8023) -+ __ieee80211_rx_handle_8023(hw, pubsta, skb, list); -+ else -+ __ieee80211_rx_handle_packet(hw, pubsta, skb, list); - - return; - drop: + kcov_remote_stop(); --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h @@ -71,6 +71,7 @@ diff --git a/package/kernel/mac80211/patches/subsys/316-mac80211-enable-QoS-support-for-nl80211-ctrl-port.patch b/package/kernel/mac80211/patches/subsys/316-mac80211-enable-QoS-support-for-nl80211-ctrl-port.patch index 43ac9a0cef..a9352ce3ab 100644 --- a/package/kernel/mac80211/patches/subsys/316-mac80211-enable-QoS-support-for-nl80211-ctrl-port.patch +++ b/package/kernel/mac80211/patches/subsys/316-mac80211-enable-QoS-support-for-nl80211-ctrl-port.patch @@ -58,7 +58,7 @@ Signed-off-by: Johannes Berg skb->data, --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -1195,9 +1195,7 @@ ieee80211_tx_prepare(struct ieee80211_su +@@ -1182,9 +1182,7 @@ ieee80211_tx_prepare(struct ieee80211_su tx->sta = rcu_dereference(sdata->u.vlan.sta); if (!tx->sta && sdata->wdev.use_4addr) return TX_DROP; @@ -69,7 +69,7 @@ Signed-off-by: Johannes Berg tx->sta = sta_info_get_bss(sdata, hdr->addr1); } if (!tx->sta && !is_multicast_ether_addr(hdr->addr1)) -@@ -5443,6 +5441,7 @@ int ieee80211_tx_control_port(struct wip +@@ -5393,6 +5391,7 @@ int ieee80211_tx_control_port(struct wip { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_local *local = sdata->local; @@ -77,7 +77,7 @@ Signed-off-by: Johannes Berg struct sk_buff *skb; struct ethhdr *ehdr; u32 ctrl_flags = 0; -@@ -5465,8 +5464,7 @@ int ieee80211_tx_control_port(struct wip +@@ -5415,8 +5414,7 @@ int ieee80211_tx_control_port(struct wip if (cookie) ctrl_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; @@ -87,7 +87,7 @@ Signed-off-by: Johannes Berg skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(struct ethhdr) + len); -@@ -5483,10 +5481,25 @@ int ieee80211_tx_control_port(struct wip +@@ -5433,10 +5431,25 @@ int ieee80211_tx_control_port(struct wip ehdr->h_proto = proto; skb->dev = dev; diff --git a/package/kernel/mac80211/patches/subsys/320-mac80211_hwsim-add-6GHz-channels.patch b/package/kernel/mac80211/patches/subsys/320-mac80211_hwsim-add-6GHz-channels.patch index cbc55c9381..a7c09f00bc 100644 --- a/package/kernel/mac80211/patches/subsys/320-mac80211_hwsim-add-6GHz-channels.patch +++ b/package/kernel/mac80211/patches/subsys/320-mac80211_hwsim-add-6GHz-channels.patch @@ -102,7 +102,7 @@ Signed-off-by: Johannes Berg struct ieee80211_channel channels_s1g[ARRAY_SIZE(hwsim_channels_s1g)]; struct ieee80211_rate rates[ARRAY_SIZE(hwsim_rates)]; struct ieee80211_iface_combination if_combination; -@@ -579,7 +648,8 @@ struct mac80211_hwsim_data { +@@ -578,7 +647,8 @@ struct mac80211_hwsim_data { struct ieee80211_channel *channel; unsigned long next_start, start, end; } survey_data[ARRAY_SIZE(hwsim_channels_2ghz) + @@ -112,7 +112,7 @@ Signed-off-by: Johannes Berg struct ieee80211_channel *channel; u64 beacon_int /* beacon interval in us */; -@@ -3172,6 +3242,8 @@ static int mac80211_hwsim_new_radio(stru +@@ -3149,6 +3219,8 @@ static int mac80211_hwsim_new_radio(stru sizeof(hwsim_channels_2ghz)); memcpy(data->channels_5ghz, hwsim_channels_5ghz, sizeof(hwsim_channels_5ghz)); diff --git a/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch b/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch index c21d4446ab..4bac10eefe 100644 --- a/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch +++ b/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2990,15 +2990,19 @@ static void mac80211_hwsim_he_capab(stru +@@ -2968,15 +2968,19 @@ static void mac80211_hwsim_he_capab(stru { u16 n_iftype_data; @@ -34,7 +34,7 @@ Signed-off-by: Felix Fietkau return; } -@@ -3288,6 +3292,12 @@ static int mac80211_hwsim_new_radio(stru +@@ -3265,6 +3269,12 @@ static int mac80211_hwsim_new_radio(stru sband->vht_cap.vht_mcs.tx_mcs_map = sband->vht_cap.vht_mcs.rx_mcs_map; break; @@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau case NL80211_BAND_S1GHZ: memcpy(&sband->s1g_cap, &hwsim_s1g_cap, sizeof(sband->s1g_cap)); -@@ -3298,6 +3308,13 @@ static int mac80211_hwsim_new_radio(stru +@@ -3275,6 +3285,13 @@ static int mac80211_hwsim_new_radio(stru continue; } @@ -61,7 +61,7 @@ Signed-off-by: Felix Fietkau sband->ht_cap.ht_supported = true; sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD | -@@ -3311,10 +3328,6 @@ static int mac80211_hwsim_new_radio(stru +@@ -3288,10 +3305,6 @@ static int mac80211_hwsim_new_radio(stru sband->ht_cap.mcs.rx_mask[0] = 0xff; sband->ht_cap.mcs.rx_mask[1] = 0xff; sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; diff --git a/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch b/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch index 3ce6ceacd5..cabe4f4561 100644 --- a/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch +++ b/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch @@ -28,7 +28,7 @@ Signed-off-by: Johannes Berg * * Transmit and frame generation functions. */ -@@ -1401,8 +1401,17 @@ static void ieee80211_txq_enqueue(struct +@@ -1388,8 +1388,17 @@ static void ieee80211_txq_enqueue(struct ieee80211_set_skb_enqueue_time(skb); spin_lock_bh(&fq->lock); @@ -48,7 +48,7 @@ Signed-off-by: Johannes Berg spin_unlock_bh(&fq->lock); } -@@ -3866,6 +3875,9 @@ bool ieee80211_txq_airtime_check(struct +@@ -3815,6 +3824,9 @@ bool ieee80211_txq_airtime_check(struct if (!txq->sta) return true; diff --git a/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch b/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch index c8f3047a34..40aa76f2df 100644 --- a/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch +++ b/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch @@ -9,7 +9,7 @@ Signed-off-by: Lorenzo Bianconi --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4193,6 +4193,9 @@ static bool ieee80211_tx_8023(struct iee +@@ -4142,6 +4142,9 @@ static bool ieee80211_tx_8023(struct iee unsigned long flags; int q = info->hw_queue; diff --git a/package/kernel/mac80211/patches/subsys/373-mac80211-support-Rx-timestamp-calculation-for-all-pr.patch b/package/kernel/mac80211/patches/subsys/373-mac80211-support-Rx-timestamp-calculation-for-all-pr.patch deleted file mode 100644 index 117fb35fcf..0000000000 --- a/package/kernel/mac80211/patches/subsys/373-mac80211-support-Rx-timestamp-calculation-for-all-pr.patch +++ /dev/null @@ -1,134 +0,0 @@ -From: Avraham Stern -Date: Sun, 6 Dec 2020 14:54:45 +0200 -Subject: [PATCH] mac80211: support Rx timestamp calculation for all preamble - types - -Add support for calculating the Rx timestamp for HE frames. -Since now all frame types are supported, allow setting the Rx -timestamp regardless of the frame type. - -Signed-off-by: Avraham Stern -Signed-off-by: Luca Coelho -Link: https://lore.kernel.org/r/iwlwifi.20201206145305.4786559af475.Ia54486bb0a12e5351f9d5c60ef6fcda7c9e7141c@changeid -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1587,13 +1587,8 @@ ieee80211_have_rx_timestamp(struct ieee8 - { - WARN_ON_ONCE(status->flag & RX_FLAG_MACTIME_START && - status->flag & RX_FLAG_MACTIME_END); -- if (status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END)) -- return true; -- /* can't handle non-legacy preamble yet */ -- if (status->flag & RX_FLAG_MACTIME_PLCP_START && -- status->encoding == RX_ENC_LEGACY) -- return true; -- return false; -+ return !!(status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END | -+ RX_FLAG_MACTIME_PLCP_START)); - } - - void ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata); ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -3665,6 +3665,7 @@ u64 ieee80211_calculate_rx_timestamp(str - u64 ts = status->mactime; - struct rate_info ri; - u16 rate; -+ u8 n_ltf; - - if (WARN_ON(!ieee80211_have_rx_timestamp(status))) - return 0; -@@ -3675,11 +3676,58 @@ u64 ieee80211_calculate_rx_timestamp(str - - /* Fill cfg80211 rate info */ - switch (status->encoding) { -+ case RX_ENC_HE: -+ ri.flags |= RATE_INFO_FLAGS_HE_MCS; -+ ri.mcs = status->rate_idx; -+ ri.nss = status->nss; -+ ri.he_ru_alloc = status->he_ru; -+ if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) -+ ri.flags |= RATE_INFO_FLAGS_SHORT_GI; -+ -+ /* -+ * See P802.11ax_D6.0, section 27.3.4 for -+ * VHT PPDU format. -+ */ -+ if (status->flag & RX_FLAG_MACTIME_PLCP_START) { -+ mpdu_offset += 2; -+ ts += 36; -+ -+ /* -+ * TODO: -+ * For HE MU PPDU, add the HE-SIG-B. -+ * For HE ER PPDU, add 8us for the HE-SIG-A. -+ * For HE TB PPDU, add 4us for the HE-STF. -+ * Add the HE-LTF durations - variable. -+ */ -+ } -+ -+ break; - case RX_ENC_HT: - ri.mcs = status->rate_idx; - ri.flags |= RATE_INFO_FLAGS_MCS; - if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) - ri.flags |= RATE_INFO_FLAGS_SHORT_GI; -+ -+ /* -+ * See P802.11REVmd_D3.0, section 19.3.2 for -+ * HT PPDU format. -+ */ -+ if (status->flag & RX_FLAG_MACTIME_PLCP_START) { -+ mpdu_offset += 2; -+ if (status->enc_flags & RX_ENC_FLAG_HT_GF) -+ ts += 24; -+ else -+ ts += 32; -+ -+ /* -+ * Add Data HT-LTFs per streams -+ * TODO: add Extension HT-LTFs, 4us per LTF -+ */ -+ n_ltf = ((ri.mcs >> 3) & 3) + 1; -+ n_ltf = n_ltf == 3 ? 4 : n_ltf; -+ ts += n_ltf * 4; -+ } -+ - break; - case RX_ENC_VHT: - ri.flags |= RATE_INFO_FLAGS_VHT_MCS; -@@ -3687,6 +3735,23 @@ u64 ieee80211_calculate_rx_timestamp(str - ri.nss = status->nss; - if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) - ri.flags |= RATE_INFO_FLAGS_SHORT_GI; -+ -+ /* -+ * See P802.11REVmd_D3.0, section 21.3.2 for -+ * VHT PPDU format. -+ */ -+ if (status->flag & RX_FLAG_MACTIME_PLCP_START) { -+ mpdu_offset += 2; -+ ts += 36; -+ -+ /* -+ * Add VHT-LTFs per streams -+ */ -+ n_ltf = (ri.nss != 1) && (ri.nss % 2) ? -+ ri.nss + 1 : ri.nss; -+ ts += 4 * n_ltf; -+ } -+ - break; - default: - WARN_ON(1); -@@ -3710,7 +3775,6 @@ u64 ieee80211_calculate_rx_timestamp(str - ri.legacy = DIV_ROUND_UP(bitrate, (1 << shift)); - - if (status->flag & RX_FLAG_MACTIME_PLCP_START) { -- /* TODO: handle HT/VHT preambles */ - if (status->band == NL80211_BAND_5GHZ) { - ts += 20 << shift; - mpdu_offset += 2; diff --git a/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch b/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch index 07f5bb5263..2b64b55018 100644 --- a/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch +++ b/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -6160,6 +6160,11 @@ enum rate_control_capabilities { +@@ -6186,6 +6186,11 @@ enum rate_control_capabilities { * otherwise the NSS difference doesn't bother us. */ RATE_CTRL_CAPA_VHT_EXT_NSS_BW = BIT(0), @@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau .rate_init = minstrel_ht_rate_init, --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3953,6 +3953,29 @@ void ieee80211_txq_schedule_start(struct +@@ -3902,6 +3902,29 @@ void ieee80211_txq_schedule_start(struct } EXPORT_SYMBOL(ieee80211_txq_schedule_start); @@ -106,7 +106,7 @@ Signed-off-by: Felix Fietkau void __ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev, u32 info_flags, -@@ -3983,6 +4006,8 @@ void __ieee80211_subif_start_xmit(struct +@@ -3932,6 +3955,8 @@ void __ieee80211_subif_start_xmit(struct skb_get_hash(skb); } @@ -115,7 +115,7 @@ Signed-off-by: Felix Fietkau if (sta) { struct ieee80211_fast_tx *fast_tx; -@@ -4246,6 +4271,8 @@ static void ieee80211_8023_xmit(struct i +@@ -4195,6 +4220,8 @@ static void ieee80211_8023_xmit(struct i memset(info, 0, sizeof(*info)); diff --git a/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch b/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch index 26f7f59296..ab16576bcd 100644 --- a/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch +++ b/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch @@ -10,7 +10,7 @@ Signed-off-by: Ryder Lee --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -1778,8 +1778,6 @@ static int invoke_tx_handlers_early(stru +@@ -1765,8 +1765,6 @@ static int invoke_tx_handlers_early(stru CALL_TXH(ieee80211_tx_h_ps_buf); CALL_TXH(ieee80211_tx_h_check_control_port_protocol); CALL_TXH(ieee80211_tx_h_select_key); @@ -19,7 +19,7 @@ Signed-off-by: Ryder Lee txh_done: if (unlikely(res == TX_DROP)) { -@@ -1812,6 +1810,9 @@ static int invoke_tx_handlers_late(struc +@@ -1799,6 +1797,9 @@ static int invoke_tx_handlers_late(struc goto txh_done; } @@ -29,7 +29,7 @@ Signed-off-by: Ryder Lee CALL_TXH(ieee80211_tx_h_michael_mic_add); CALL_TXH(ieee80211_tx_h_sequence); CALL_TXH(ieee80211_tx_h_fragment); -@@ -3404,15 +3405,21 @@ out: +@@ -3353,15 +3354,21 @@ out: * Can be called while the sta lock is held. Anything that can cause packets to * be generated will cause deadlock! */ @@ -55,7 +55,7 @@ Signed-off-by: Ryder Lee if (key) info->control.hw_key = &key->conf; -@@ -3461,6 +3468,8 @@ static void ieee80211_xmit_fast_finish(s +@@ -3410,6 +3417,8 @@ static void ieee80211_xmit_fast_finish(s break; } } @@ -64,7 +64,7 @@ Signed-off-by: Ryder Lee } static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -@@ -3564,24 +3573,17 @@ static bool ieee80211_xmit_fast(struct i +@@ -3513,24 +3522,17 @@ static bool ieee80211_xmit_fast(struct i tx.sta = sta; tx.key = fast_tx->key; @@ -97,7 +97,7 @@ Signed-off-by: Ryder Lee if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) sdata = container_of(sdata->bss, -@@ -3692,8 +3694,12 @@ begin: +@@ -3641,8 +3643,12 @@ begin: (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) pn_offs = ieee80211_hdrlen(hdr->frame_control); diff --git a/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch b/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch index 5d390990cd..6acb814b28 100644 --- a/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch +++ b/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch @@ -45,7 +45,7 @@ Signed-off-by: Ryder Lee if (dest[0].idx < 0) --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -679,6 +679,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 +@@ -666,6 +666,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 u32 len; struct ieee80211_tx_rate_control txrc; struct ieee80211_sta_rates *ratetbl = NULL; @@ -53,7 +53,7 @@ Signed-off-by: Ryder Lee bool assoc = false; memset(&txrc, 0, sizeof(txrc)); -@@ -720,7 +721,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 +@@ -707,7 +708,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 * just wants a probe response. */ if (tx->sdata->vif.bss_conf.use_short_preamble && @@ -62,7 +62,7 @@ Signed-off-by: Ryder Lee (tx->sta && test_sta_flag(tx->sta, WLAN_STA_SHORT_PREAMBLE)))) txrc.short_preamble = true; -@@ -742,7 +743,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 +@@ -729,7 +730,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 "%s: Dropped data frame as no usable bitrate found while " "scanning and associated. Target station: " "%pM on %d GHz band\n", @@ -72,7 +72,7 @@ Signed-off-by: Ryder Lee info->band ? 5 : 2)) return TX_DROP; -@@ -776,7 +778,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 +@@ -763,7 +765,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 if (txrc.reported_rate.idx < 0) { txrc.reported_rate = tx->rate; @@ -81,7 +81,7 @@ Signed-off-by: Ryder Lee tx->sta->tx_stats.last_rate = txrc.reported_rate; } else if (tx->sta) tx->sta->tx_stats.last_rate = txrc.reported_rate; -@@ -3682,8 +3684,16 @@ begin: +@@ -3631,8 +3633,16 @@ begin: else info->flags &= ~IEEE80211_TX_CTL_AMPDU; @@ -101,7 +101,7 @@ Signed-off-by: Ryder Lee struct sta_info *sta = container_of(txq->sta, struct sta_info, --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -6733,4 +6733,22 @@ struct sk_buff *ieee80211_get_fils_disco +@@ -6754,4 +6754,22 @@ struct sk_buff *ieee80211_get_fils_disco struct sk_buff * ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw, struct ieee80211_vif *vif); diff --git a/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch b/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch index c7902d6542..3ba611b3aa 100644 --- a/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch +++ b/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch @@ -16,7 +16,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -1159,6 +1159,29 @@ static bool ieee80211_tx_prep_agg(struct +@@ -1146,6 +1146,29 @@ static bool ieee80211_tx_prep_agg(struct return queued; } @@ -46,7 +46,7 @@ Signed-off-by: Felix Fietkau /* * initialises @tx * pass %NULL for the station if unknown, a valid pointer if known -@@ -1172,6 +1195,7 @@ ieee80211_tx_prepare(struct ieee80211_su +@@ -1159,6 +1182,7 @@ ieee80211_tx_prepare(struct ieee80211_su struct ieee80211_local *local = sdata->local; struct ieee80211_hdr *hdr; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); @@ -54,7 +54,7 @@ Signed-off-by: Felix Fietkau int tid; memset(tx, 0, sizeof(*tx)); -@@ -1200,8 +1224,10 @@ ieee80211_tx_prepare(struct ieee80211_su +@@ -1187,8 +1211,10 @@ ieee80211_tx_prepare(struct ieee80211_su } else if (tx->sdata->control_port_protocol == tx->skb->protocol) { tx->sta = sta_info_get_bss(sdata, hdr->addr1); } @@ -66,7 +66,7 @@ Signed-off-by: Felix Fietkau } if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) && -@@ -1211,8 +1237,12 @@ ieee80211_tx_prepare(struct ieee80211_su +@@ -1198,8 +1224,12 @@ ieee80211_tx_prepare(struct ieee80211_su struct tid_ampdu_tx *tid_tx; tid = ieee80211_get_tid(hdr); @@ -80,7 +80,7 @@ Signed-off-by: Felix Fietkau if (tid_tx) { bool queued; -@@ -3969,29 +3999,6 @@ void ieee80211_txq_schedule_start(struct +@@ -3918,29 +3948,6 @@ void ieee80211_txq_schedule_start(struct } EXPORT_SYMBOL(ieee80211_txq_schedule_start); diff --git a/package/kernel/mac80211/patches/subsys/380-mac80211-introduce-aql_enable-node-in-debugfs.patch b/package/kernel/mac80211/patches/subsys/380-mac80211-introduce-aql_enable-node-in-debugfs.patch index 073782188a..b8a87a7cc1 100644 --- a/package/kernel/mac80211/patches/subsys/380-mac80211-introduce-aql_enable-node-in-debugfs.patch +++ b/package/kernel/mac80211/patches/subsys/380-mac80211-introduce-aql_enable-node-in-debugfs.patch @@ -79,7 +79,7 @@ Signed-off-by: Johannes Berg DEBUGFS_ADD_MODE(aqm, 0600); --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1140,6 +1140,8 @@ enum mac80211_scan_state { +@@ -1147,6 +1147,8 @@ enum mac80211_scan_state { SCAN_ABORT, }; @@ -90,7 +90,7 @@ Signed-off-by: Johannes Berg * don't cast (use the static inlines below), but we keep --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3909,6 +3909,8 @@ void __ieee80211_schedule_txq(struct iee +@@ -3858,6 +3858,8 @@ void __ieee80211_schedule_txq(struct iee } EXPORT_SYMBOL(__ieee80211_schedule_txq); @@ -99,7 +99,7 @@ Signed-off-by: Johannes Berg bool ieee80211_txq_airtime_check(struct ieee80211_hw *hw, struct ieee80211_txq *txq) { -@@ -3918,6 +3920,9 @@ bool ieee80211_txq_airtime_check(struct +@@ -3867,6 +3869,9 @@ bool ieee80211_txq_airtime_check(struct if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) return true; diff --git a/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch b/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch index 708ad6f460..8033b0d0d4 100644 --- a/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch +++ b/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch @@ -22,7 +22,7 @@ Signed-off-by: Johannes Berg */ #ifndef IEEE80211_I_H -@@ -848,9 +848,12 @@ struct txq_info { +@@ -854,9 +854,12 @@ struct txq_info { struct fq_tin tin; struct codel_vars def_cvars; struct codel_stats cstats; diff --git a/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch b/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch index 2fe12771c0..475715a2f9 100644 --- a/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch +++ b/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch @@ -50,7 +50,7 @@ Signed-off-by: Johannes Berg --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -6557,9 +6557,6 @@ static inline void ieee80211_txq_schedul +@@ -6578,9 +6578,6 @@ static inline void ieee80211_txq_schedul { } @@ -60,7 +60,7 @@ Signed-off-by: Johannes Berg /** * ieee80211_schedule_txq - schedule a TXQ for transmission * -@@ -6572,11 +6569,7 @@ void __ieee80211_schedule_txq(struct iee +@@ -6593,11 +6590,7 @@ void __ieee80211_schedule_txq(struct iee * The driver may call this function if it has buffered packets for * this TXQ internally. */ @@ -73,7 +73,7 @@ Signed-off-by: Johannes Berg /** * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() -@@ -6588,12 +6581,8 @@ ieee80211_schedule_txq(struct ieee80211_ +@@ -6609,12 +6602,8 @@ ieee80211_schedule_txq(struct ieee80211_ * The driver may set force=true if it has buffered packets for this TXQ * internally. */ @@ -90,7 +90,7 @@ Signed-off-by: Johannes Berg * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1461,6 +1461,38 @@ static void sta_apply_mesh_params(struct +@@ -1441,6 +1441,38 @@ static void sta_apply_mesh_params(struct #endif } @@ -129,7 +129,7 @@ Signed-off-by: Johannes Berg static int sta_apply_parameters(struct ieee80211_local *local, struct sta_info *sta, struct station_parameters *params) -@@ -1648,7 +1680,8 @@ static int sta_apply_parameters(struct i +@@ -1628,7 +1660,8 @@ static int sta_apply_parameters(struct i sta_apply_mesh_params(local, sta, params); if (params->airtime_weight) @@ -277,7 +277,7 @@ Signed-off-by: Johannes Berg IEEE80211_IF_FILE(multicast_to_unicast, u.ap.multicast_to_unicast, HEX); /* IBSS attributes */ -@@ -661,8 +689,10 @@ static void add_common_files(struct ieee +@@ -658,8 +686,10 @@ static void add_common_files(struct ieee if (sdata->local->ops->wake_tx_queue && sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && @@ -355,7 +355,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -840,20 +840,16 @@ enum txq_info_flags { +@@ -846,20 +846,16 @@ enum txq_info_flags { * @def_flow: used as a fallback flow when a packet destined to @tin hashes to * a fq_flow which is already owned by a different tin * @def_cvars: codel vars for @def_flow @@ -378,7 +378,7 @@ Signed-off-by: Johannes Berg unsigned long flags; /* keep last! */ -@@ -930,6 +926,8 @@ struct ieee80211_sub_if_data { +@@ -938,6 +934,8 @@ struct ieee80211_sub_if_data { struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS]; struct mac80211_qos_map __rcu *qos_map; @@ -387,7 +387,7 @@ Signed-off-by: Johannes Berg struct work_struct csa_finalize_work; bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */ struct cfg80211_chan_def csa_chandef; -@@ -1143,6 +1141,44 @@ enum mac80211_scan_state { +@@ -1150,6 +1148,44 @@ enum mac80211_scan_state { SCAN_ABORT, }; @@ -432,7 +432,7 @@ Signed-off-by: Johannes Berg DECLARE_STATIC_KEY_FALSE(aql_disable); struct ieee80211_local { -@@ -1156,13 +1192,8 @@ struct ieee80211_local { +@@ -1163,13 +1199,8 @@ struct ieee80211_local { struct codel_params cparams; /* protects active_txqs and txqi->schedule_order */ @@ -447,7 +447,7 @@ Signed-off-by: Johannes Berg u32 aql_threshold; atomic_t aql_total_pending_airtime; -@@ -1581,6 +1612,125 @@ static inline bool txq_has_queue(struct +@@ -1587,6 +1618,125 @@ static inline bool txq_has_queue(struct return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets); } @@ -573,7 +573,7 @@ Signed-off-by: Johannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) { return ether_addr_equal(raddr, addr) || -@@ -1821,6 +1971,14 @@ int ieee80211_tx_control_port(struct wip +@@ -1827,6 +1977,14 @@ int ieee80211_tx_control_port(struct wip u64 *cookie); int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, const u8 *buf, size_t len); @@ -590,7 +590,7 @@ Signed-off-by: Johannes Berg void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -2088,6 +2088,9 @@ int ieee80211_if_add(struct ieee80211_lo +@@ -2013,6 +2013,9 @@ int ieee80211_if_add(struct ieee80211_lo } } @@ -602,7 +602,7 @@ Signed-off-by: Johannes Berg sdata->ap_power_level = IEEE80211_UNSET_POWER_LEVEL; --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -693,10 +693,13 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -691,10 +691,13 @@ struct ieee80211_hw *ieee80211_alloc_hw_ spin_lock_init(&local->queue_stop_reason_lock); for (i = 0; i < IEEE80211_NUM_ACS; i++) { @@ -622,7 +622,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -1573,12 +1573,8 @@ static void sta_ps_start(struct sta_info +@@ -1562,12 +1562,8 @@ static void sta_ps_start(struct sta_info for (tid = 0; tid < IEEE80211_NUM_TIDS; tid++) { struct ieee80211_txq *txq = sta->sta.txq[tid]; @@ -638,7 +638,7 @@ Signed-off-by: Johannes Berg set_bit(tid, &sta->txq_buffered_tids); --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c -@@ -426,15 +426,11 @@ struct sta_info *sta_info_alloc(struct i +@@ -424,15 +424,11 @@ struct sta_info *sta_info_alloc(struct i if (sta_prepare_rate_control(local, sta, gfp)) goto free_txq; @@ -655,7 +655,7 @@ Signed-off-by: Johannes Berg } for (i = 0; i < IEEE80211_NUM_TIDS; i++) -@@ -1893,24 +1889,59 @@ void ieee80211_sta_set_buffered(struct i +@@ -1894,24 +1890,59 @@ void ieee80211_sta_set_buffered(struct i } EXPORT_SYMBOL(ieee80211_sta_set_buffered); @@ -727,7 +727,7 @@ Signed-off-by: Johannes Berg } EXPORT_SYMBOL(ieee80211_sta_register_airtime); -@@ -2354,7 +2385,7 @@ void sta_set_sinfo(struct sta_info *sta, +@@ -2360,7 +2391,7 @@ void sta_set_sinfo(struct sta_info *sta, } if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT))) { @@ -765,7 +765,7 @@ Signed-off-by: Johannes Berg struct sta_info; -@@ -515,7 +522,6 @@ struct ieee80211_fragment_cache { +@@ -487,7 +494,6 @@ struct ieee80211_sta_rx_stats { * @tid_seq: per-TID sequence numbers for sending to this STA * @airtime: per-AC struct airtime_info describing airtime statistics for this * station @@ -773,7 +773,7 @@ Signed-off-by: Johannes Berg * @ampdu_mlme: A-MPDU state machine state * @mesh: mesh STA information * @debugfs_dir: debug filesystem directory dentry -@@ -646,7 +652,6 @@ struct sta_info { +@@ -617,7 +623,6 @@ struct sta_info { u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; struct airtime_info airtime[IEEE80211_NUM_ACS]; @@ -783,7 +783,7 @@ Signed-off-by: Johannes Berg * Aggregation information, locked with lock. --- a/net/mac80211/status.c +++ b/net/mac80211/status.c -@@ -972,6 +972,25 @@ static void __ieee80211_tx_status(struct +@@ -970,6 +970,25 @@ static void __ieee80211_tx_status(struct if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked) ieee80211_frame_acked(sta, skb); @@ -819,7 +819,7 @@ Signed-off-by: Johannes Berg #include #include #include -@@ -1489,7 +1490,7 @@ void ieee80211_txq_init(struct ieee80211 +@@ -1476,7 +1477,7 @@ void ieee80211_txq_init(struct ieee80211 codel_vars_init(&txqi->def_cvars); codel_stats_init(&txqi->cstats); __skb_queue_head_init(&txqi->frags); @@ -828,7 +828,7 @@ Signed-off-by: Johannes Berg txqi->txq.vif = &sdata->vif; -@@ -1533,9 +1534,7 @@ void ieee80211_txq_purge(struct ieee8021 +@@ -1520,9 +1521,7 @@ void ieee80211_txq_purge(struct ieee8021 ieee80211_purge_tx_queue(&local->hw, &txqi->frags); spin_unlock_bh(&fq->lock); @@ -839,7 +839,7 @@ Signed-off-by: Johannes Berg } void ieee80211_txq_set_params(struct ieee80211_local *local) -@@ -3819,102 +3818,259 @@ EXPORT_SYMBOL(ieee80211_tx_dequeue); +@@ -3768,102 +3767,259 @@ EXPORT_SYMBOL(ieee80211_tx_dequeue); struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) { struct ieee80211_local *local = hw_to_local(hw); @@ -999,7 +999,7 @@ Signed-off-by: Johannes Berg +{ + struct airtime_info *air_info, *tmp; + u64 weight_sum = 0; -+ + + if (unlikely(!now)) + now = ktime_get_boottime_ns(); + @@ -1008,7 +1008,8 @@ Signed-off-by: Johannes Berg + if (!force && (air_sched->last_weight_update < + now - AIRTIME_ACTIVE_DURATION)) + return; -+ + +- if (txqi->schedule_round == local->schedule_round[ac]) + list_for_each_entry_safe(air_info, tmp, + &air_sched->active_list, list) { + if (airtime_is_active(air_info, now)) @@ -1019,7 +1020,7 @@ Signed-off-by: Johannes Berg + airtime_weight_sum_set(air_sched, weight_sum); + air_sched->last_weight_update = now; +} - ++ +void ieee80211_schedule_txq(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) + __acquires(txq_lock) __releases(txq_lock) @@ -1031,8 +1032,7 @@ Signed-off-by: Johannes Berg + struct airtime_info *air_info; + u8 ac = txq->ac; + bool was_active; - -- if (txqi->schedule_round == local->schedule_round[ac]) ++ + air_sched = &local->airtime[ac]; + air_info = to_airtime_info(txq); + @@ -1161,7 +1161,7 @@ Signed-off-by: Johannes Berg struct ieee80211_local *local = hw_to_local(hw); if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) -@@ -3929,15 +4085,12 @@ bool ieee80211_txq_airtime_check(struct +@@ -3878,15 +4034,12 @@ bool ieee80211_txq_airtime_check(struct if (unlikely(txq->tid == IEEE80211_NUM_TIDS)) return true; @@ -1179,7 +1179,7 @@ Signed-off-by: Johannes Berg return true; return false; -@@ -3947,60 +4100,59 @@ EXPORT_SYMBOL(ieee80211_txq_airtime_chec +@@ -3896,60 +4049,59 @@ EXPORT_SYMBOL(ieee80211_txq_airtime_chec bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq) { @@ -1200,11 +1200,11 @@ Signed-off-by: Johannes Berg - goto out; + if (!ieee80211_txq_airtime_check(hw, txq)) + return false; -+ -+ air_sched = &local->airtime[txq->ac]; -+ spin_lock_bh(&air_sched->lock); - if (list_empty(&txqi->schedule_order)) ++ air_sched = &local->airtime[txq->ac]; ++ spin_lock_bh(&air_sched->lock); ++ + if (RB_EMPTY_NODE(&txqi->schedule_order)) goto out; @@ -1223,6 +1223,7 @@ Signed-off-by: Johannes Berg - if (sta->airtime[ac].deficit < 0) - sta->airtime[ac].deficit += sta->airtime_weight; - list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); +- } + /* Like in ieee80211_next_txq(), make sure the first station in the + * scheduling order is eligible for transmission to avoid starvation. + */ @@ -1231,15 +1232,14 @@ Signed-off-by: Johannes Berg + first_txqi = container_of(node, struct txq_info, + schedule_order); + air_info = to_airtime_info(&first_txqi->txq); -+ -+ if (air_sched->v_t < air_info->v_t) -+ airtime_catchup_v_t(air_sched, air_info->v_t, now); - } - sta = container_of(txqi->txq.sta, struct sta_info, sta); - if (sta->airtime[ac].deficit >= 0) - goto out; -- ++ if (air_sched->v_t < air_info->v_t) ++ airtime_catchup_v_t(air_sched, air_info->v_t, now); ++ } + - sta->airtime[ac].deficit += sta->airtime_weight; - list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]); - spin_unlock_bh(&local->active_txq_lock[ac]); diff --git a/package/kernel/mac80211/patches/subsys/384-nl80211-add-common-API-to-configure-SAR-power-limita.patch b/package/kernel/mac80211/patches/subsys/384-nl80211-add-common-API-to-configure-SAR-power-limita.patch deleted file mode 100644 index a47e29794c..0000000000 --- a/package/kernel/mac80211/patches/subsys/384-nl80211-add-common-API-to-configure-SAR-power-limita.patch +++ /dev/null @@ -1,398 +0,0 @@ -From: Carl Huang -Date: Thu, 3 Dec 2020 05:37:26 -0500 -Subject: [PATCH] nl80211: add common API to configure SAR power limitations - -NL80211_CMD_SET_SAR_SPECS is added to configure SAR from -user space. NL80211_ATTR_SAR_SPEC is used to pass the SAR -power specification when used with NL80211_CMD_SET_SAR_SPECS. - -Wireless driver needs to register SAR type, supported frequency -ranges to wiphy, so user space can query it. The index in -frequency range is used to specify which sub band the power -limitation applies to. The SAR type is for compatibility, so later -other SAR mechanism can be implemented without breaking the user -space SAR applications. - -Normal process is user space queries the SAR capability, and -gets the index of supported frequency ranges and associates the -power limitation with this index and sends to kernel. - -Here is an example of message send to kernel: -8c 00 00 00 08 00 01 00 00 00 00 00 38 00 2b 81 -08 00 01 00 00 00 00 00 2c 00 02 80 14 00 00 80 -08 00 02 00 00 00 00 00 08 00 01 00 38 00 00 00 -14 00 01 80 08 00 02 00 01 00 00 00 08 00 01 00 -48 00 00 00 - -NL80211_CMD_SET_SAR_SPECS: 0x8c -NL80211_ATTR_WIPHY: 0x01(phy idx is 0) -NL80211_ATTR_SAR_SPEC: 0x812b (NLA_NESTED) -NL80211_SAR_ATTR_TYPE: 0x00 (NL80211_SAR_TYPE_POWER) -NL80211_SAR_ATTR_SPECS: 0x8002 (NLA_NESTED) -freq range 0 power: 0x38 in 0.25dbm unit (14dbm) -freq range 1 power: 0x48 in 0.25dbm unit (18dbm) - -Signed-off-by: Carl Huang -Reviewed-by: Brian Norris -Reviewed-by: Abhishek Kumar -Link: https://lore.kernel.org/r/20201203103728.3034-2-cjhuang@codeaurora.org -[minor edits, NLA parse cleanups] -Signed-off-by: Johannes Berg ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -1737,6 +1737,54 @@ struct station_info { - u8 connected_to_as; - }; - -+/** -+ * struct cfg80211_sar_sub_specs - sub specs limit -+ * @power: power limitation in 0.25dbm -+ * @freq_range_index: index the power limitation applies to -+ */ -+struct cfg80211_sar_sub_specs { -+ s32 power; -+ u32 freq_range_index; -+}; -+ -+/** -+ * struct cfg80211_sar_specs - sar limit specs -+ * @type: it's set with power in 0.25dbm or other types -+ * @num_sub_specs: number of sar sub specs -+ * @sub_specs: memory to hold the sar sub specs -+ */ -+struct cfg80211_sar_specs { -+ enum nl80211_sar_type type; -+ u32 num_sub_specs; -+ struct cfg80211_sar_sub_specs sub_specs[]; -+}; -+ -+ -+/** -+ * @struct cfg80211_sar_chan_ranges - sar frequency ranges -+ * @start_freq: start range edge frequency -+ * @end_freq: end range edge frequency -+ */ -+struct cfg80211_sar_freq_ranges { -+ u32 start_freq; -+ u32 end_freq; -+}; -+ -+/** -+ * struct cfg80211_sar_capa - sar limit capability -+ * @type: it's set via power in 0.25dbm or other types -+ * @num_freq_ranges: number of frequency ranges -+ * @freq_ranges: memory to hold the freq ranges. -+ * -+ * Note: WLAN driver may append new ranges or split an existing -+ * range to small ones and then append them. -+ */ -+struct cfg80211_sar_capa { -+ enum nl80211_sar_type type; -+ u32 num_freq_ranges; -+ const struct cfg80211_sar_freq_ranges *freq_ranges; -+}; -+ - #if IS_ENABLED(CPTCFG_CFG80211) - /** - * cfg80211_get_station - retrieve information about a given station -@@ -4259,6 +4307,8 @@ struct cfg80211_ops { - struct cfg80211_tid_config *tid_conf); - int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev, - const u8 *peer, u8 tids); -+ int (*set_sar_specs)(struct wiphy *wiphy, -+ struct cfg80211_sar_specs *sar); - }; - - /* -@@ -5030,6 +5080,8 @@ struct wiphy { - - u8 max_data_retry_count; - -+ const struct cfg80211_sar_capa *sar_capa; -+ - char priv[] __aligned(NETDEV_ALIGN); - }; - ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -405,6 +405,18 @@ nl80211_unsol_bcast_probe_resp_policy[NL - .len = IEEE80211_MAX_DATA_LEN } - }; - -+static const struct nla_policy -+sar_specs_policy[NL80211_SAR_ATTR_SPECS_MAX + 1] = { -+ [NL80211_SAR_ATTR_SPECS_POWER] = { .type = NLA_S32 }, -+ [NL80211_SAR_ATTR_SPECS_RANGE_INDEX] = {.type = NLA_U32 }, -+}; -+ -+static const struct nla_policy -+sar_policy[NL80211_SAR_ATTR_MAX + 1] = { -+ [NL80211_SAR_ATTR_TYPE] = NLA_POLICY_MAX(NLA_U32, NUM_NL80211_SAR_TYPE), -+ [NL80211_SAR_ATTR_SPECS] = NLA_POLICY_NESTED_ARRAY(sar_specs_policy), -+}; -+ - static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { - [0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD }, - [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, -@@ -739,6 +751,7 @@ static const struct nla_policy nl80211_p - [NL80211_ATTR_SAE_PWE] = - NLA_POLICY_RANGE(NLA_U8, NL80211_SAE_PWE_HUNT_AND_PECK, - NL80211_SAE_PWE_BOTH), -+ [NL80211_ATTR_SAR_SPEC] = NLA_POLICY_NESTED(sar_policy), - [NL80211_ATTR_RECONNECT_REQUESTED] = { .type = NLA_REJECT }, - }; - -@@ -2117,6 +2130,56 @@ fail: - return -ENOBUFS; - } - -+static int -+nl80211_put_sar_specs(struct cfg80211_registered_device *rdev, -+ struct sk_buff *msg) -+{ -+ struct nlattr *sar_capa, *specs, *sub_freq_range; -+ u8 num_freq_ranges; -+ int i; -+ -+ if (!rdev->wiphy.sar_capa) -+ return 0; -+ -+ num_freq_ranges = rdev->wiphy.sar_capa->num_freq_ranges; -+ -+ sar_capa = nla_nest_start(msg, NL80211_ATTR_SAR_SPEC); -+ if (!sar_capa) -+ return -ENOSPC; -+ -+ if (nla_put_u32(msg, NL80211_SAR_ATTR_TYPE, rdev->wiphy.sar_capa->type)) -+ goto fail; -+ -+ specs = nla_nest_start(msg, NL80211_SAR_ATTR_SPECS); -+ if (!specs) -+ goto fail; -+ -+ /* report supported freq_ranges */ -+ for (i = 0; i < num_freq_ranges; i++) { -+ sub_freq_range = nla_nest_start(msg, i + 1); -+ if (!sub_freq_range) -+ goto fail; -+ -+ if (nla_put_u32(msg, NL80211_SAR_ATTR_SPECS_START_FREQ, -+ rdev->wiphy.sar_capa->freq_ranges[i].start_freq)) -+ goto fail; -+ -+ if (nla_put_u32(msg, NL80211_SAR_ATTR_SPECS_END_FREQ, -+ rdev->wiphy.sar_capa->freq_ranges[i].end_freq)) -+ goto fail; -+ -+ nla_nest_end(msg, sub_freq_range); -+ } -+ -+ nla_nest_end(msg, specs); -+ nla_nest_end(msg, sar_capa); -+ -+ return 0; -+fail: -+ nla_nest_cancel(msg, sar_capa); -+ return -ENOBUFS; -+} -+ - struct nl80211_dump_wiphy_state { - s64 filter_wiphy; - long start; -@@ -2366,6 +2429,8 @@ static int nl80211_send_wiphy(struct cfg - CMD(set_multicast_to_unicast, SET_MULTICAST_TO_UNICAST); - CMD(update_connect_params, UPDATE_CONNECT_PARAMS); - CMD(update_ft_ies, UPDATE_FT_IES); -+ if (rdev->wiphy.sar_capa) -+ CMD(set_sar_specs, SET_SAR_SPECS); - } - #undef CMD - -@@ -2691,6 +2756,11 @@ static int nl80211_send_wiphy(struct cfg - - if (nl80211_put_tid_config_support(rdev, msg)) - goto nla_put_failure; -+ state->split_start++; -+ break; -+ case 16: -+ if (nl80211_put_sar_specs(rdev, msg)) -+ goto nla_put_failure; - - /* done */ - state->split_start = 0; -@@ -14712,6 +14782,111 @@ static void nl80211_post_doit(__genl_con - } - } - -+static int nl80211_set_sar_sub_specs(struct cfg80211_registered_device *rdev, -+ struct cfg80211_sar_specs *sar_specs, -+ struct nlattr *spec[], int index) -+{ -+ u32 range_index, i; -+ -+ if (!sar_specs || !spec) -+ return -EINVAL; -+ -+ if (!spec[NL80211_SAR_ATTR_SPECS_POWER] || -+ !spec[NL80211_SAR_ATTR_SPECS_RANGE_INDEX]) -+ return -EINVAL; -+ -+ range_index = nla_get_u32(spec[NL80211_SAR_ATTR_SPECS_RANGE_INDEX]); -+ -+ /* check if range_index exceeds num_freq_ranges */ -+ if (range_index >= rdev->wiphy.sar_capa->num_freq_ranges) -+ return -EINVAL; -+ -+ /* check if range_index duplicates */ -+ for (i = 0; i < index; i++) { -+ if (sar_specs->sub_specs[i].freq_range_index == range_index) -+ return -EINVAL; -+ } -+ -+ sar_specs->sub_specs[index].power = -+ nla_get_s32(spec[NL80211_SAR_ATTR_SPECS_POWER]); -+ -+ sar_specs->sub_specs[index].freq_range_index = range_index; -+ -+ return 0; -+} -+ -+static int nl80211_set_sar_specs(struct sk_buff *skb, struct genl_info *info) -+{ -+ struct cfg80211_registered_device *rdev = info->user_ptr[0]; -+ struct nlattr *spec[NL80211_SAR_ATTR_SPECS_MAX + 1]; -+ struct nlattr *tb[NL80211_SAR_ATTR_MAX + 1]; -+ struct cfg80211_sar_specs *sar_spec; -+ enum nl80211_sar_type type; -+ struct nlattr *spec_list; -+ u32 specs; -+ int rem, err; -+ -+ if (!rdev->wiphy.sar_capa || !rdev->ops->set_sar_specs) -+ return -EOPNOTSUPP; -+ -+ if (!info->attrs[NL80211_ATTR_SAR_SPEC]) -+ return -EINVAL; -+ -+ nla_parse_nested(tb, NL80211_SAR_ATTR_MAX, -+ info->attrs[NL80211_ATTR_SAR_SPEC], -+ NULL, NULL); -+ -+ if (!tb[NL80211_SAR_ATTR_TYPE] || !tb[NL80211_SAR_ATTR_SPECS]) -+ return -EINVAL; -+ -+ type = nla_get_u32(tb[NL80211_SAR_ATTR_TYPE]); -+ if (type != rdev->wiphy.sar_capa->type) -+ return -EINVAL; -+ -+ specs = 0; -+ nla_for_each_nested(spec_list, tb[NL80211_SAR_ATTR_SPECS], rem) -+ specs++; -+ -+ if (specs > rdev->wiphy.sar_capa->num_freq_ranges) -+ return -EINVAL; -+ -+ sar_spec = kzalloc(sizeof(*sar_spec) + -+ specs * sizeof(struct cfg80211_sar_sub_specs), -+ GFP_KERNEL); -+ if (!sar_spec) -+ return -ENOMEM; -+ -+ sar_spec->type = type; -+ specs = 0; -+ nla_for_each_nested(spec_list, tb[NL80211_SAR_ATTR_SPECS], rem) { -+ nla_parse_nested(spec, NL80211_SAR_ATTR_SPECS_MAX, -+ spec_list, NULL, NULL); -+ -+ switch (type) { -+ case NL80211_SAR_TYPE_POWER: -+ if (nl80211_set_sar_sub_specs(rdev, sar_spec, -+ spec, specs)) { -+ err = -EINVAL; -+ goto error; -+ } -+ break; -+ default: -+ err = -EINVAL; -+ goto error; -+ } -+ specs++; -+ } -+ -+ sar_spec->num_sub_specs = specs; -+ -+ rdev->cur_cmd_info = info; -+ err = rdev_set_sar_specs(rdev, sar_spec); -+ rdev->cur_cmd_info = NULL; -+error: -+ kfree(sar_spec); -+ return err; -+} -+ - static __genl_const struct genl_ops nl80211_ops[] = { - { - .cmd = NL80211_CMD_GET_WIPHY, -@@ -15575,6 +15750,14 @@ static const struct genl_small_ops nl802 - .internal_flags = NL80211_FLAG_NEED_NETDEV | - NL80211_FLAG_NEED_RTNL, - }, -+ { -+ .cmd = NL80211_CMD_SET_SAR_SPECS, -+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, -+ .doit = nl80211_set_sar_specs, -+ .flags = GENL_UNS_ADMIN_PERM, -+ .internal_flags = NL80211_FLAG_NEED_WIPHY | -+ NL80211_FLAG_NEED_RTNL, -+ }, - }; - - static struct genl_family nl80211_fam __genl_ro_after_init = { ---- a/net/wireless/rdev-ops.h -+++ b/net/wireless/rdev-ops.h -@@ -1356,4 +1356,16 @@ static inline int rdev_reset_tid_config( - return ret; - } - -+static inline int rdev_set_sar_specs(struct cfg80211_registered_device *rdev, -+ struct cfg80211_sar_specs *sar) -+{ -+ int ret; -+ -+ trace_rdev_set_sar_specs(&rdev->wiphy, sar); -+ ret = rdev->ops->set_sar_specs(&rdev->wiphy, sar); -+ trace_rdev_return_int(&rdev->wiphy, ret); -+ -+ return ret; -+} -+ - #endif /* __CFG80211_RDEV_OPS */ ---- a/net/wireless/trace.h -+++ b/net/wireless/trace.h -@@ -3551,6 +3551,25 @@ TRACE_EVENT(rdev_reset_tid_config, - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", peer: " MAC_PR_FMT ", tids: 0x%x", - WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer), __entry->tids) - ); -+ -+TRACE_EVENT(rdev_set_sar_specs, -+ TP_PROTO(struct wiphy *wiphy, struct cfg80211_sar_specs *sar), -+ TP_ARGS(wiphy, sar), -+ TP_STRUCT__entry( -+ WIPHY_ENTRY -+ __field(u16, type) -+ __field(u16, num) -+ ), -+ TP_fast_assign( -+ WIPHY_ASSIGN; -+ __entry->type = sar->type; -+ __entry->num = sar->num_sub_specs; -+ -+ ), -+ TP_printk(WIPHY_PR_FMT ", Set type:%d, num_specs:%d", -+ WIPHY_PR_ARG, __entry->type, __entry->num) -+); -+ - #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ - - #undef TRACE_INCLUDE_PATH diff --git a/package/kernel/mac80211/patches/subsys/385-mac80211-add-ieee80211_set_sar_specs.patch b/package/kernel/mac80211/patches/subsys/385-mac80211-add-ieee80211_set_sar_specs.patch deleted file mode 100644 index c351bc812a..0000000000 --- a/package/kernel/mac80211/patches/subsys/385-mac80211-add-ieee80211_set_sar_specs.patch +++ /dev/null @@ -1,51 +0,0 @@ -From: Carl Huang -Date: Thu, 3 Dec 2020 05:37:27 -0500 -Subject: [PATCH] mac80211: add ieee80211_set_sar_specs - -This change registers ieee80211_set_sar_specs to -mac80211_config_ops, so cfg80211 can call it. - -Signed-off-by: Carl Huang -Reviewed-by: Brian Norris -Reviewed-by: Abhishek Kumar -Link: https://lore.kernel.org/r/20201203103728.3034-3-cjhuang@codeaurora.org -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -4207,6 +4207,8 @@ struct ieee80211_ops { - struct ieee80211_vif *vif); - void (*sta_set_4addr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, bool enabled); -+ int (*set_sar_specs)(struct ieee80211_hw *hw, -+ const struct cfg80211_sar_specs *sar); - void (*sta_set_decap_offload)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, bool enabled); ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -4136,6 +4136,17 @@ static int ieee80211_reset_tid_config(st - return ret; - } - -+static int ieee80211_set_sar_specs(struct wiphy *wiphy, -+ struct cfg80211_sar_specs *sar) -+{ -+ struct ieee80211_local *local = wiphy_priv(wiphy); -+ -+ if (!local->ops->set_sar_specs) -+ return -EOPNOTSUPP; -+ -+ return local->ops->set_sar_specs(&local->hw, sar); -+} -+ - const struct cfg80211_ops mac80211_config_ops = { - .add_virtual_intf = ieee80211_add_iface, - .del_virtual_intf = ieee80211_del_iface, -@@ -4239,4 +4250,5 @@ const struct cfg80211_ops mac80211_confi - .probe_mesh_link = ieee80211_probe_mesh_link, - .set_tid_config = ieee80211_set_tid_config, - .reset_tid_config = ieee80211_reset_tid_config, -+ .set_sar_specs = ieee80211_set_sar_specs, - }; diff --git a/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch b/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch index c2cc16cd48..8aec8cedf4 100644 --- a/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch +++ b/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch @@ -14,7 +14,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3331,6 +3331,9 @@ static bool ieee80211_amsdu_aggregate(st +@@ -3280,6 +3280,9 @@ static bool ieee80211_amsdu_aggregate(st if (!ieee80211_hw_check(&local->hw, TX_AMSDU)) return false; diff --git a/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch b/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch index 36b705de12..6a1757a38a 100644 --- a/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch +++ b/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch @@ -1,3 +1,4 @@ +From 0d2ab3aea50bb02ff0c9c3d53c7b2b4b21cdd59d Mon Sep 17 00:00:00 2001 From: John Crispin Date: Fri, 2 Jul 2021 19:44:07 +0200 Subject: [PATCH] nl80211: add support for BSS coloring @@ -13,10 +14,16 @@ Link: https://lore.kernel.org/r/500b3582aec8fe2c42ef46f3117b148cb7cbceb5.1625247 [remove unnecessary NULL initialisation] Signed-off-by: Johannes Berg --- + include/net/cfg80211.h | 92 ++++++++++++++++++++ + include/uapi/linux/nl80211.h | 43 ++++++++++ + net/wireless/nl80211.c | 157 +++++++++++++++++++++++++++++++++++ + net/wireless/rdev-ops.h | 13 +++ + net/wireless/trace.h | 46 ++++++++++ + 5 files changed, 351 insertions(+) --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -1252,6 +1252,27 @@ struct cfg80211_csa_settings { +@@ -1248,6 +1248,27 @@ struct cfg80211_csa_settings { #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10 /** @@ -44,16 +51,16 @@ Signed-off-by: Johannes Berg * struct iface_combination_params - input parameters for interface combinations * * Used to pass interface combination parameters -@@ -3979,6 +4000,8 @@ struct mgmt_frame_regs { - * This callback may sleep. - * @reset_tid_config: Reset TID specific configuration for the peer, for the +@@ -3975,6 +3996,8 @@ struct mgmt_frame_regs { * given TIDs. This callback may sleep. + * + * @set_sar_specs: Update the SAR (TX power) settings. + * + * @color_change: Initiate a color change. */ struct cfg80211_ops { int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); -@@ -4309,6 +4332,9 @@ struct cfg80211_ops { +@@ -4302,6 +4325,9 @@ struct cfg80211_ops { const u8 *peer, u8 tids); int (*set_sar_specs)(struct wiphy *wiphy, struct cfg80211_sar_specs *sar); @@ -63,7 +70,7 @@ Signed-off-by: Johannes Berg }; /* -@@ -8094,4 +8120,70 @@ void cfg80211_update_owe_info_event(stru +@@ -8089,4 +8115,70 @@ void cfg80211_update_owe_info_event(stru */ void cfg80211_bss_flush(struct wiphy *wiphy); @@ -225,8 +232,8 @@ Signed-off-by: Johannes Berg +++ b/net/wireless/nl80211.c @@ -753,6 +753,10 @@ static const struct nla_policy nl80211_p NL80211_SAE_PWE_BOTH), - [NL80211_ATTR_SAR_SPEC] = NLA_POLICY_NESTED(sar_policy), [NL80211_ATTR_RECONNECT_REQUESTED] = { .type = NLA_REJECT }, + [NL80211_ATTR_SAR_SPEC] = NLA_POLICY_NESTED(sar_policy), + [NL80211_ATTR_OBSS_COLOR_BITMAP] = { .type = NLA_U64 }, + [NL80211_ATTR_COLOR_CHANGE_COUNT] = { .type = NLA_U8 }, + [NL80211_ATTR_COLOR_CHANGE_COLOR] = { .type = NLA_U8 }, @@ -234,7 +241,7 @@ Signed-off-by: Johannes Berg }; /* policy for the key attributes */ -@@ -14677,6 +14681,106 @@ bad_tid_conf: +@@ -14659,6 +14663,106 @@ bad_tid_conf: return ret; } @@ -341,7 +348,7 @@ Signed-off-by: Johannes Berg #define NL80211_FLAG_NEED_WIPHY 0x01 #define NL80211_FLAG_NEED_NETDEV 0x02 #define NL80211_FLAG_NEED_RTNL 0x04 -@@ -15758,6 +15862,14 @@ static const struct genl_small_ops nl802 +@@ -15730,6 +15834,14 @@ static const struct genl_small_ops nl802 .internal_flags = NL80211_FLAG_NEED_WIPHY | NL80211_FLAG_NEED_RTNL, }, @@ -356,7 +363,7 @@ Signed-off-by: Johannes Berg }; static struct genl_family nl80211_fam __genl_ro_after_init = { -@@ -17384,6 +17496,51 @@ void cfg80211_ch_switch_started_notify(s +@@ -17361,6 +17473,51 @@ void cfg80211_ch_switch_started_notify(s } EXPORT_SYMBOL(cfg80211_ch_switch_started_notify); @@ -410,7 +417,7 @@ Signed-off-by: Johannes Berg const struct cfg80211_chan_def *chandef, --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h -@@ -1368,4 +1368,17 @@ static inline int rdev_set_sar_specs(str +@@ -1358,4 +1358,17 @@ static inline int rdev_set_sar_specs(str return ret; } @@ -430,7 +437,7 @@ Signed-off-by: Johannes Berg #endif /* __CFG80211_RDEV_OPS */ --- a/net/wireless/trace.h +++ b/net/wireless/trace.h -@@ -3570,6 +3570,52 @@ TRACE_EVENT(rdev_set_sar_specs, +@@ -3565,6 +3565,52 @@ TRACE_EVENT(rdev_set_sar_specs, WIPHY_PR_ARG, __entry->type, __entry->num) ); diff --git a/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch b/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch index 0a3118545f..fc99b36c5d 100644 --- a/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch +++ b/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch @@ -19,7 +19,7 @@ Signed-off-by: Johannes Berg --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -1710,6 +1710,10 @@ enum ieee80211_offload_flags { +@@ -1713,6 +1713,10 @@ enum ieee80211_offload_flags { * protected by fq->lock. * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see * &enum ieee80211_offload_flags. @@ -30,7 +30,7 @@ Signed-off-by: Johannes Berg */ struct ieee80211_vif { enum nl80211_iftype type; -@@ -1738,6 +1742,9 @@ struct ieee80211_vif { +@@ -1741,6 +1745,9 @@ struct ieee80211_vif { bool txqs_stopped[IEEE80211_NUM_ACS]; @@ -40,7 +40,7 @@ Signed-off-by: Johannes Berg /* must be last */ u8 drv_priv[] __aligned(sizeof(void *)); }; -@@ -4982,6 +4989,16 @@ void ieee80211_csa_finish(struct ieee802 +@@ -4986,6 +4993,16 @@ void ieee80211_csa_finish(struct ieee802 bool ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif); /** @@ -57,7 +57,7 @@ Signed-off-by: Johannes Berg * ieee80211_proberesp_get - retrieve a Probe Response template * @hw: pointer obtained from ieee80211_alloc_hw(). * @vif: &struct ieee80211_vif pointer from the add_interface callback. -@@ -6726,6 +6743,18 @@ ieee80211_get_unsol_bcast_probe_resp_tmp +@@ -6745,6 +6762,18 @@ ieee80211_get_unsol_bcast_probe_resp_tmp struct ieee80211_vif *vif); /** @@ -78,7 +78,7 @@ Signed-off-by: Johannes Berg * The function is used to check if a frame is a data frame. Frames with --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -827,9 +827,11 @@ static int ieee80211_set_monitor_channel +@@ -809,9 +809,11 @@ static int ieee80211_set_monitor_channel return ret; } @@ -93,7 +93,7 @@ Signed-off-by: Johannes Berg { struct probe_resp *new, *old; -@@ -849,6 +851,8 @@ static int ieee80211_set_probe_resp(stru +@@ -831,6 +833,8 @@ static int ieee80211_set_probe_resp(stru memcpy(new->cntdwn_counter_offsets, csa->counter_offsets_presp, csa->n_counter_offsets_presp * sizeof(new->cntdwn_counter_offsets[0])); @@ -102,7 +102,7 @@ Signed-off-by: Johannes Berg rcu_assign_pointer(sdata->u.ap.probe_resp, new); if (old) -@@ -954,7 +958,8 @@ static int ieee80211_set_ftm_responder_p +@@ -936,7 +940,8 @@ static int ieee80211_set_ftm_responder_p static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, struct cfg80211_beacon_data *params, @@ -112,7 +112,7 @@ Signed-off-by: Johannes Berg { struct beacon_data *new, *old; int new_head_len, new_tail_len; -@@ -1003,6 +1008,9 @@ static int ieee80211_assign_beacon(struc +@@ -985,6 +990,9 @@ static int ieee80211_assign_beacon(struc memcpy(new->cntdwn_counter_offsets, csa->counter_offsets_beacon, csa->n_counter_offsets_beacon * sizeof(new->cntdwn_counter_offsets[0])); @@ -122,7 +122,7 @@ Signed-off-by: Johannes Berg } /* copy in head */ -@@ -1019,7 +1027,7 @@ static int ieee80211_assign_beacon(struc +@@ -1001,7 +1009,7 @@ static int ieee80211_assign_beacon(struc memcpy(new->tail, old->tail, new_tail_len); err = ieee80211_set_probe_resp(sdata, params->probe_resp, @@ -131,7 +131,7 @@ Signed-off-by: Johannes Berg if (err < 0) { kfree(new); return err; -@@ -1176,7 +1184,7 @@ static int ieee80211_start_ap(struct wip +@@ -1156,7 +1164,7 @@ static int ieee80211_start_ap(struct wip if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) sdata->vif.bss_conf.beacon_tx_rate = params->beacon_rate; @@ -140,7 +140,7 @@ Signed-off-by: Johannes Berg if (err < 0) goto error; changed |= err; -@@ -1231,17 +1239,17 @@ static int ieee80211_change_beacon(struc +@@ -1211,17 +1219,17 @@ static int ieee80211_change_beacon(struc sdata = IEEE80211_DEV_TO_SUB_IF(dev); sdata_assert_lock(sdata); @@ -161,7 +161,7 @@ Signed-off-by: Johannes Berg if (err < 0) return err; ieee80211_bss_info_change_notify(sdata, err); -@@ -3174,7 +3182,7 @@ static int ieee80211_set_after_csa_beaco +@@ -3144,7 +3152,7 @@ static int ieee80211_set_after_csa_beaco switch (sdata->vif.type) { case NL80211_IFTYPE_AP: err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon, @@ -170,7 +170,7 @@ Signed-off-by: Johannes Berg kfree(sdata->u.ap.next_beacon); sdata->u.ap.next_beacon = NULL; -@@ -3340,7 +3348,7 @@ static int ieee80211_set_csa_beacon(stru +@@ -3310,7 +3318,7 @@ static int ieee80211_set_csa_beacon(stru csa.n_counter_offsets_presp = params->n_counter_offsets_presp; csa.count = params->count; @@ -179,7 +179,7 @@ Signed-off-by: Johannes Berg if (err < 0) { kfree(sdata->u.ap.next_beacon); return err; -@@ -3428,6 +3436,15 @@ static int ieee80211_set_csa_beacon(stru +@@ -3399,6 +3407,15 @@ static int ieee80211_set_csa_beacon(stru return 0; } @@ -195,7 +195,7 @@ Signed-off-by: Johannes Berg static int __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_csa_settings *params) -@@ -3496,6 +3513,10 @@ __ieee80211_channel_switch(struct wiphy +@@ -3467,6 +3484,10 @@ __ieee80211_channel_switch(struct wiphy goto out; } @@ -206,7 +206,7 @@ Signed-off-by: Johannes Berg err = ieee80211_set_csa_beacon(sdata, params, &changed); if (err) { ieee80211_vif_unreserve_chanctx(sdata); -@@ -4147,6 +4168,196 @@ static int ieee80211_set_sar_specs(struc +@@ -4118,6 +4139,196 @@ static int ieee80211_set_sar_specs(struc return local->ops->set_sar_specs(&local->hw, sar); } @@ -403,7 +403,7 @@ Signed-off-by: Johannes Berg const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface, -@@ -4251,4 +4462,5 @@ const struct cfg80211_ops mac80211_confi +@@ -4221,4 +4432,5 @@ const struct cfg80211_ops mac80211_confi .set_tid_config = ieee80211_set_tid_config, .reset_tid_config = ieee80211_reset_tid_config, .set_sar_specs = ieee80211_set_sar_specs, @@ -411,7 +411,7 @@ Signed-off-by: Johannes Berg }; --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -248,6 +248,12 @@ struct ieee80211_csa_settings { +@@ -259,6 +259,12 @@ struct ieee80211_csa_settings { u8 count; }; @@ -424,7 +424,7 @@ Signed-off-by: Johannes Berg struct beacon_data { u8 *head, *tail; int head_len, tail_len; -@@ -932,6 +938,8 @@ struct ieee80211_sub_if_data { +@@ -940,6 +946,8 @@ struct ieee80211_sub_if_data { bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */ struct cfg80211_chan_def csa_chandef; @@ -433,7 +433,7 @@ Signed-off-by: Johannes Berg struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */ struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */ -@@ -1900,6 +1908,9 @@ void ieee80211_csa_finalize_work(struct +@@ -1906,6 +1914,9 @@ void ieee80211_csa_finalize_work(struct int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_csa_settings *params); @@ -445,7 +445,7 @@ Signed-off-by: Johannes Berg NETIF_F_HW_CSUM | NETIF_F_SG | \ --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -465,6 +465,7 @@ static void ieee80211_do_stop(struct iee +@@ -458,6 +458,7 @@ static void ieee80211_do_stop(struct iee sdata_unlock(sdata); cancel_work_sync(&sdata->csa_finalize_work); @@ -453,7 +453,7 @@ Signed-off-by: Johannes Berg cancel_delayed_work_sync(&sdata->dfs_cac_timer_work); -@@ -1639,6 +1640,7 @@ static void ieee80211_setup_sdata(struct +@@ -1569,6 +1570,7 @@ static void ieee80211_setup_sdata(struct INIT_WORK(&sdata->work, ieee80211_iface_work); INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work); INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); @@ -463,7 +463,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4790,11 +4790,11 @@ static int ieee80211_beacon_add_tim(stru +@@ -4740,11 +4740,11 @@ static int ieee80211_beacon_add_tim(stru static void ieee80211_set_beacon_cntdwn(struct ieee80211_sub_if_data *sdata, struct beacon_data *beacon) { @@ -477,7 +477,7 @@ Signed-off-by: Johannes Berg switch (sdata->vif.type) { case NL80211_IFTYPE_AP: -@@ -4814,21 +4814,27 @@ static void ieee80211_set_beacon_cntdwn( +@@ -4764,21 +4764,27 @@ static void ieee80211_set_beacon_cntdwn( } rcu_read_lock(); @@ -514,7 +514,7 @@ Signed-off-by: Johannes Berg } rcu_read_unlock(); } -@@ -5038,6 +5044,7 @@ __ieee80211_beacon_get(struct ieee80211_ +@@ -4988,6 +4994,7 @@ __ieee80211_beacon_get(struct ieee80211_ if (offs) { offs->tim_offset = beacon->head_len; offs->tim_length = skb->len - beacon->head_len; diff --git a/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch b/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch index 369619938e..d2b1881ddc 100644 --- a/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch +++ b/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch @@ -73,7 +73,7 @@ Signed-off-by: Johannes Berg } u; } __packed action; } u; -@@ -2880,6 +2926,7 @@ enum ieee80211_eid { +@@ -2881,6 +2927,7 @@ enum ieee80211_eid { WLAN_EID_AID_RESPONSE = 211, WLAN_EID_S1G_BCN_COMPAT = 213, WLAN_EID_S1G_SHORT_BCN_INTERVAL = 214, @@ -81,7 +81,7 @@ Signed-off-by: Johannes Berg WLAN_EID_S1G_CAPABILITIES = 217, WLAN_EID_VENDOR_SPECIFIC = 221, WLAN_EID_QOS_PARAMETER = 222, -@@ -2948,6 +2995,7 @@ enum ieee80211_category { +@@ -2949,6 +2996,7 @@ enum ieee80211_category { WLAN_CATEGORY_FST = 18, WLAN_CATEGORY_UNPROT_DMG = 20, WLAN_CATEGORY_VHT = 21, @@ -89,7 +89,7 @@ Signed-off-by: Johannes Berg WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, WLAN_CATEGORY_VENDOR_SPECIFIC = 127, }; -@@ -3021,6 +3069,20 @@ enum ieee80211_key_len { +@@ -3022,6 +3070,20 @@ enum ieee80211_key_len { WLAN_KEY_LEN_BIP_GMAC_256 = 32, }; diff --git a/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch index cdee132f15..c502d69616 100644 --- a/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch +++ b/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch @@ -27,7 +27,7 @@ Signed-off-by: Johannes Berg --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -4219,6 +4219,11 @@ struct ieee80211_ops { +@@ -4223,6 +4223,11 @@ struct ieee80211_ops { void (*sta_set_decap_offload)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, bool enabled); @@ -84,7 +84,7 @@ Signed-off-by: Johannes Berg #endif /* __MAC80211_DRIVER_OPS */ --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -954,6 +954,7 @@ struct ieee80211_sub_if_data { +@@ -962,6 +962,7 @@ struct ieee80211_sub_if_data { struct work_struct work; struct sk_buff_head skb_queue; @@ -92,7 +92,7 @@ Signed-off-by: Johannes Berg u8 needed_rx_chains; enum ieee80211_smps_mode smps_mode; -@@ -2093,6 +2094,11 @@ ieee80211_he_op_ie_to_bss_conf(struct ie +@@ -2099,6 +2100,11 @@ ieee80211_he_op_ie_to_bss_conf(struct ie /* S1G */ void ieee80211_s1g_sta_rate_init(struct sta_info *sta); @@ -106,7 +106,7 @@ Signed-off-by: Johannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -563,6 +563,7 @@ static void ieee80211_do_stop(struct iee +@@ -555,6 +555,7 @@ static void ieee80211_do_stop(struct iee */ ieee80211_free_keys(sdata, true); skb_queue_purge(&sdata->skb_queue); @@ -114,7 +114,7 @@ Signed-off-by: Johannes Berg } spin_lock_irqsave(&local->queue_stop_reason_lock, flags); -@@ -1070,6 +1071,7 @@ int ieee80211_add_virtual_monitor(struct +@@ -1029,6 +1030,7 @@ int ieee80211_add_virtual_monitor(struct } skb_queue_head_init(&sdata->skb_queue); @@ -122,8 +122,8 @@ Signed-off-by: Johannes Berg INIT_WORK(&sdata->work, ieee80211_iface_work); return 0; -@@ -1442,6 +1444,24 @@ static void ieee80211_if_setup_no_queue( - #endif +@@ -1370,6 +1372,24 @@ static void ieee80211_if_setup_no_queue( + dev->priv_flags |= IFF_NO_QUEUE; } +static void ieee80211_iface_process_status(struct ieee80211_sub_if_data *sdata, @@ -147,7 +147,7 @@ Signed-off-by: Johannes Berg static void ieee80211_iface_work(struct work_struct *work) { struct ieee80211_sub_if_data *sdata = -@@ -1519,6 +1539,16 @@ static void ieee80211_iface_work(struct +@@ -1448,6 +1468,16 @@ static void ieee80211_iface_work(struct WARN_ON(1); break; } @@ -164,8 +164,8 @@ Signed-off-by: Johannes Berg } else if (ieee80211_is_ext(mgmt->frame_control)) { if (sdata->vif.type == NL80211_IFTYPE_STATION) ieee80211_sta_rx_queued_ext(sdata, skb); -@@ -1574,6 +1604,12 @@ static void ieee80211_iface_work(struct - kfree_skb(skb); +@@ -1504,6 +1534,12 @@ static void ieee80211_iface_work(struct + kcov_remote_stop(); } + /* process status queue */ @@ -177,7 +177,7 @@ Signed-off-by: Johannes Berg /* then other type-dependent work */ switch (sdata->vif.type) { case NL80211_IFTYPE_STATION: -@@ -1637,6 +1677,7 @@ static void ieee80211_setup_sdata(struct +@@ -1567,6 +1603,7 @@ static void ieee80211_setup_sdata(struct } skb_queue_head_init(&sdata->skb_queue); @@ -187,7 +187,7 @@ Signed-off-by: Johannes Berg INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -3208,6 +3208,68 @@ ieee80211_rx_h_mgmt_check(struct ieee802 +@@ -3116,6 +3116,68 @@ ieee80211_rx_h_mgmt_check(struct ieee802 return RX_CONTINUE; } @@ -256,7 +256,7 @@ Signed-off-by: Johannes Berg static ieee80211_rx_result debug_noinline ieee80211_rx_h_action(struct ieee80211_rx_data *rx) { -@@ -3487,6 +3549,17 @@ ieee80211_rx_h_action(struct ieee80211_r +@@ -3395,6 +3457,17 @@ ieee80211_rx_h_action(struct ieee80211_r !mesh_path_sel_is_hwmp(sdata)) break; goto queue; diff --git a/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch b/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch index eb32c49890..33cd29bd45 100644 --- a/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch +++ b/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch @@ -12,7 +12,7 @@ Signed-off-by: Johannes Berg --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3627,7 +3627,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee +@@ -3656,7 +3656,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee IEEE80211_HE_MAC_CAP4_BQR; he_cap_elem->mac_cap_info[4] &= ~m; @@ -21,7 +21,7 @@ Signed-off-by: Johannes Berg IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU | IEEE80211_HE_MAC_CAP5_PUNCTURED_SOUNDING | IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX; -@@ -3637,7 +3637,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee +@@ -3666,7 +3666,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO; he_cap_elem->phy_cap_info[2] &= ~m; @@ -30,7 +30,7 @@ Signed-off-by: Johannes Berg IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK | IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK; he_cap_elem->phy_cap_info[3] &= ~m; -@@ -3649,13 +3649,13 @@ ath11k_mac_filter_he_cap_mesh(struct iee +@@ -3678,13 +3678,13 @@ ath11k_mac_filter_he_cap_mesh(struct iee he_cap_elem->phy_cap_info[5] &= ~m; m = IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU | @@ -49,7 +49,7 @@ Signed-off-by: Johannes Berg he_cap_elem->phy_cap_info[7] &= ~m; --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c -@@ -307,8 +307,8 @@ mt7915_set_stream_he_txbf_caps(struct ie +@@ -423,8 +423,8 @@ mt7915_set_stream_he_txbf_caps(struct ie IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK; elem->phy_cap_info[5] &= ~c; @@ -60,8 +60,8 @@ Signed-off-by: Johannes Berg elem->phy_cap_info[6] &= ~c; elem->phy_cap_info[7] &= ~IEEE80211_HE_PHY_CAP7_MAX_NC_MASK; -@@ -348,8 +348,8 @@ mt7915_set_stream_he_txbf_caps(struct ie - c = (nss - 1) | (max_t(int, mcs->tx_mcs_160, 1) << 3); +@@ -461,8 +461,8 @@ mt7915_set_stream_he_txbf_caps(struct ie + c = (nss - 1) | (max_t(int, le16_to_cpu(mcs->tx_mcs_160), 1) << 3); elem->phy_cap_info[5] |= c; - c = IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB | @@ -69,9 +69,9 @@ Signed-off-by: Johannes Berg + c = IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB | + IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB; elem->phy_cap_info[6] |= c; - } -@@ -484,7 +484,7 @@ mt7915_init_he_caps(struct mt7915_phy *p + /* the maximum cap is 4 x 3, (Nr, Nc) = (3, 2) */ +@@ -589,7 +589,7 @@ mt7915_init_he_caps(struct mt7915_phy *p IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE | IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT; he_cap_elem->phy_cap_info[7] |= @@ -82,7 +82,7 @@ Signed-off-by: Johannes Berg IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G | --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h -@@ -2065,7 +2065,7 @@ int ieee80211_get_vht_max_nss(struct iee +@@ -2066,7 +2066,7 @@ int ieee80211_get_vht_max_nss(struct iee #define IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG 0x01 #define IEEE80211_HE_MAC_CAP4_QTP 0x02 #define IEEE80211_HE_MAC_CAP4_BQR 0x04 @@ -91,7 +91,7 @@ Signed-off-by: Johannes Berg #define IEEE80211_HE_MAC_CAP4_NDP_FB_REP 0x10 #define IEEE80211_HE_MAC_CAP4_OPS 0x20 #define IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU 0x40 -@@ -2076,7 +2076,7 @@ int ieee80211_get_vht_max_nss(struct iee +@@ -2077,7 +2077,7 @@ int ieee80211_get_vht_max_nss(struct iee #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40 0x01 #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41 0x02 @@ -100,7 +100,7 @@ Signed-off-by: Johannes Berg #define IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU 0x08 #define IEEE80211_HE_MAC_CAP5_OM_CTRL_UL_MU_DATA_DIS_RX 0x10 #define IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS 0x20 -@@ -2134,7 +2134,7 @@ int ieee80211_get_vht_max_nss(struct iee +@@ -2135,7 +2135,7 @@ int ieee80211_get_vht_max_nss(struct iee #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK 0x18 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 0x00 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_2 0x20 @@ -109,7 +109,7 @@ Signed-off-by: Johannes Berg #define IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER 0x80 #define IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE 0x01 -@@ -2181,15 +2181,15 @@ int ieee80211_get_vht_max_nss(struct iee +@@ -2182,15 +2182,15 @@ int ieee80211_get_vht_max_nss(struct iee #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU 0x01 #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU 0x02 @@ -185,7 +185,7 @@ Signed-off-by: Johannes Berg PFLAG_RANGE(PHY, 7, MAX_NC, 0, 1, 1, "MAX-NC-%d"); --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -@@ -631,7 +631,7 @@ static struct ieee80211_sband_iftype_dat +@@ -587,7 +587,7 @@ static const struct ieee80211_sband_ifty .phy_cap_info[6] = IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT, .phy_cap_info[7] = diff --git a/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch b/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch index 75aecf06c7..f932fa63d7 100644 --- a/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch +++ b/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch @@ -11,7 +11,7 @@ Signed-off-by: Johannes Berg --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -@@ -598,7 +598,7 @@ static struct ieee80211_sband_iftype_dat +@@ -554,7 +554,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, .mac_cap_info[4] = @@ -20,7 +20,7 @@ Signed-off-by: Johannes Berg IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39, .mac_cap_info[5] = IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40 | -@@ -682,7 +682,7 @@ static struct ieee80211_sband_iftype_dat +@@ -638,7 +638,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, .mac_cap_info[4] = @@ -31,7 +31,7 @@ Signed-off-by: Johannes Berg .phy_cap_info[0] = --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c -@@ -427,7 +427,7 @@ mt7915_init_he_caps(struct mt7915_phy *p +@@ -532,7 +532,7 @@ mt7915_init_he_caps(struct mt7915_phy *p IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_RESERVED; he_cap_elem->mac_cap_info[4] = @@ -42,7 +42,7 @@ Signed-off-by: Johannes Berg he_cap_elem->phy_cap_info[0] = --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c -@@ -1353,7 +1353,7 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *sk +@@ -1325,7 +1325,7 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *sk if (elem->mac_cap_info[3] & IEEE80211_HE_MAC_CAP3_OMI_CONTROL) cap |= STA_REC_HE_CAP_OM; @@ -53,7 +53,7 @@ Signed-off-by: Johannes Berg if (elem->mac_cap_info[4] & IEEE80211_HE_MAC_CAP4_BQR) --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h -@@ -2068,7 +2068,7 @@ int ieee80211_get_vht_max_nss(struct iee +@@ -2069,7 +2069,7 @@ int ieee80211_get_vht_max_nss(struct iee #define IEEE80211_HE_MAC_CAP4_PSR_RESP 0x08 #define IEEE80211_HE_MAC_CAP4_NDP_FB_REP 0x10 #define IEEE80211_HE_MAC_CAP4_OPS 0x20 @@ -75,7 +75,7 @@ Signed-off-by: Johannes Berg --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2818,7 +2818,7 @@ static const struct ieee80211_sband_ifty +@@ -2796,7 +2796,7 @@ static const struct ieee80211_sband_ifty .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, @@ -84,7 +84,7 @@ Signed-off-by: Johannes Berg .phy_cap_info[1] = IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | -@@ -2862,7 +2862,7 @@ static const struct ieee80211_sband_ifty +@@ -2840,7 +2840,7 @@ static const struct ieee80211_sband_ifty .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, @@ -93,7 +93,7 @@ Signed-off-by: Johannes Berg .phy_cap_info[1] = IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | -@@ -2908,7 +2908,7 @@ static const struct ieee80211_sband_ifty +@@ -2886,7 +2886,7 @@ static const struct ieee80211_sband_ifty .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, @@ -102,7 +102,7 @@ Signed-off-by: Johannes Berg .phy_cap_info[0] = IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G | -@@ -2956,7 +2956,7 @@ static const struct ieee80211_sband_ifty +@@ -2934,7 +2934,7 @@ static const struct ieee80211_sband_ifty .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, diff --git a/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch b/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch index adb89f6390..dc927a683c 100644 --- a/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch +++ b/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch @@ -13,7 +13,7 @@ Signed-off-by: Johannes Berg --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1290,9 +1290,8 @@ static void ath11k_peer_assoc_h_he(struc +@@ -1265,9 +1265,8 @@ static void ath11k_peer_assoc_h_he(struc * request, then use MAX_AMPDU_LEN_FACTOR as 16 to calculate max_ampdu * length. */ @@ -27,7 +27,7 @@ Signed-off-by: Johannes Berg if (sta->vht_cap.vht_supported) --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -@@ -596,7 +596,7 @@ static struct ieee80211_sband_iftype_dat +@@ -552,7 +552,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -36,7 +36,7 @@ Signed-off-by: Johannes Berg .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU | IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39, -@@ -680,7 +680,7 @@ static struct ieee80211_sband_iftype_dat +@@ -636,7 +636,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_BSR, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -47,7 +47,7 @@ Signed-off-by: Johannes Berg .mac_cap_info[5] = --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2817,7 +2817,7 @@ static const struct ieee80211_sband_ifty +@@ -2795,7 +2795,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_ACK_EN, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -56,7 +56,7 @@ Signed-off-by: Johannes Berg .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, .phy_cap_info[1] = IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | -@@ -2861,7 +2861,7 @@ static const struct ieee80211_sband_ifty +@@ -2839,7 +2839,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_ACK_EN, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -65,7 +65,7 @@ Signed-off-by: Johannes Berg .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, .phy_cap_info[1] = IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | -@@ -2907,7 +2907,7 @@ static const struct ieee80211_sband_ifty +@@ -2885,7 +2885,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_ACK_EN, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -74,7 +74,7 @@ Signed-off-by: Johannes Berg .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, .phy_cap_info[0] = IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | -@@ -2955,7 +2955,7 @@ static const struct ieee80211_sband_ifty +@@ -2933,7 +2933,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_ACK_EN, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -85,7 +85,7 @@ Signed-off-by: Johannes Berg IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c -@@ -425,7 +425,7 @@ mt7915_init_he_caps(struct mt7915_phy *p +@@ -530,7 +530,7 @@ mt7915_init_he_caps(struct mt7915_phy *p IEEE80211_HE_MAC_CAP0_HTC_HE; he_cap_elem->mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -96,7 +96,7 @@ Signed-off-by: Johannes Berg --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h -@@ -2051,17 +2051,15 @@ int ieee80211_get_vht_max_nss(struct iee +@@ -2052,17 +2052,15 @@ int ieee80211_get_vht_max_nss(struct iee * A-MDPU Length Exponent field in the HT capabilities, VHT capabilities and the * same field in the HE capabilities. */ diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index 6f13f64208..fb0106bac1 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -1,24 +1,24 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -3814,6 +3814,7 @@ struct mgmt_frame_regs { +@@ -3810,6 +3810,7 @@ struct mgmt_frame_regs { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful + * @set_antenna_gain: set antenna gain to reduce maximum tx power if necessary * - * @set_wds_peer: set the WDS peer for a WDS interface - * -@@ -4138,6 +4139,7 @@ struct cfg80211_ops { + * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting + * functions to adjust rfkill hw state +@@ -4134,6 +4135,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); + int (*set_antenna_gain)(struct wiphy *wiphy, int dbi); - int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, - const u8 *addr); + void (*rfkill_poll)(struct wiphy *wiphy); + --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -1561,6 +1561,7 @@ enum ieee80211_smps_mode { +@@ -1564,6 +1564,7 @@ enum ieee80211_smps_mode { * * @power_level: requested transmit power (in dBm), backward compatibility * value only that is set to the minimum of all interfaces @@ -26,7 +26,7 @@ * * @chandef: the channel definition to tune to * @radar_enabled: whether radar detection is enabled -@@ -1581,6 +1582,7 @@ enum ieee80211_smps_mode { +@@ -1584,6 +1585,7 @@ enum ieee80211_smps_mode { struct ieee80211_conf { u32 flags; int power_level, dynamic_ps_timeout; @@ -57,7 +57,7 @@ __NL80211_ATTR_AFTER_LAST, --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2769,6 +2769,19 @@ static int ieee80211_get_tx_power(struct +@@ -2749,6 +2749,19 @@ static int ieee80211_get_tx_power(struct return 0; } @@ -74,20 +74,20 @@ + return 0; +} + - static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev, - const u8 *addr) + static void ieee80211_rfkill_poll(struct wiphy *wiphy) { -@@ -4413,6 +4426,7 @@ const struct cfg80211_ops mac80211_confi + struct ieee80211_local *local = wiphy_priv(wiphy); +@@ -4384,6 +4397,7 @@ const struct cfg80211_ops mac80211_confi .set_wiphy_params = ieee80211_set_wiphy_params, .set_tx_power = ieee80211_set_tx_power, .get_tx_power = ieee80211_get_tx_power, + .set_antenna_gain = ieee80211_set_antenna_gain, - .set_wds_peer = ieee80211_set_wds_peer, .rfkill_poll = ieee80211_rfkill_poll, CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) + CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1435,6 +1435,7 @@ struct ieee80211_local { +@@ -1441,6 +1441,7 @@ struct ieee80211_local { int dynamic_ps_forced_timeout; int user_power_level; /* in dBm, for all interfaces */ @@ -119,7 +119,7 @@ if (local->hw.conf.power_level != power) { changed |= IEEE80211_CONF_CHANGE_POWER; local->hw.conf.power_level = power; -@@ -665,6 +671,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -663,6 +669,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ IEEE80211_RADIOTAP_MCS_HAVE_BW; local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; @@ -137,7 +137,7 @@ }; /* policy for the key attributes */ -@@ -3322,6 +3323,20 @@ static int nl80211_set_wiphy(struct sk_b +@@ -3296,6 +3297,20 @@ static int nl80211_set_wiphy(struct sk_b if (result) return result; } diff --git a/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch b/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch index 5d94362155..ea6e6974ca 100644 --- a/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch +++ b/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch @@ -203,10 +203,11 @@ Signed-off-by: David S. Miller } --- a/drivers/net/wireless/mediatek/mt76/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/eeprom.c -@@ -90,15 +90,9 @@ out_put_node: - void - mt76_eeprom_override(struct mt76_dev *dev) +@@ -91,16 +91,9 @@ void + mt76_eeprom_override(struct mt76_phy *phy) { + struct mt76_dev *dev = phy->dev; +- -#ifdef CONFIG_OF struct device_node *np = dev->dev->of_node; - const u8 *mac = NULL; @@ -214,15 +215,15 @@ Signed-off-by: David S. Miller - if (np) - mac = of_get_mac_address(np); - if (!IS_ERR_OR_NULL(mac)) -- ether_addr_copy(dev->macaddr, mac); +- ether_addr_copy(phy->macaddr, mac); -#endif -+ of_get_mac_address(np, dev->macaddr); ++ of_get_mac_address(np, phy->macaddr); - if (!is_valid_ether_addr(dev->macaddr)) { - eth_random_addr(dev->macaddr); + if (!is_valid_ether_addr(phy->macaddr)) { + eth_random_addr(phy->macaddr); --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -990,11 +990,7 @@ static void rt2x00lib_rate(struct ieee80 +@@ -989,11 +989,7 @@ static void rt2x00lib_rate(struct ieee80 void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr) { From b96c2569ac76b5d3a936c94970210cdb9accf815 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 9 Oct 2021 16:25:30 +0200 Subject: [PATCH 22/54] mac80211: Update to version 5.12.19-1 The removed patches were applied upstream. Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 6 +- .../patches/ath/400-ath_move_debug_code.patch | 2 +- .../patches/ath/404-regd_no_assoc_hints.patch | 4 +- ...21-ath10k_init_devices_synchronously.patch | 2 +- ...h10k-increase-rx-buffer-size-to-2048.patch | 37 - .../930-ath10k_add_tpt_led_trigger.patch | 4 +- ...rolling-support-for-various-chipsets.patch | 16 +- ...75-ath10k-use-tpt-trigger-by-default.patch | 8 +- ...980-ath10k-fix-max-antenna-gain-unit.patch | 6 +- ...-power-reduction-for-US-regulatory-d.patch | 8 +- ...h10k-Try-to-get-mac-address-from-dts.patch | 2 +- .../ath5k/411-ath5k_allow_adhoc_and_ap.patch | 6 +- .../ath5k/440-ath5k_channel_bw_debugfs.patch | 2 +- ...w-reset-AHB-WMAC-interface-on-AR91xx.patch | 2 +- ..._hw-issue-external-reset-for-QCA955x.patch | 4 +- ...erpret-requested-txpower-in-EIRP-dom.patch | 4 +- ...power-reduction-for-US-regulatory-do.patch | 2 +- .../ath9k/401-ath9k_blink_default.patch | 2 +- .../ath9k/410-ath9k_allow_adhoc_and_ap.patch | 2 +- ...abled-MFP-capability-unconditionally.patch | 4 +- .../patches/ath9k/501-ath9k_ahb_init.patch | 2 +- .../510-ath9k_intr_mitigation_tweak.patch | 2 +- .../patches/ath9k/513-ath9k_add_pci_ids.patch | 2 +- .../patches/ath9k/530-ath9k_extra_leds.patch | 2 +- .../ath9k/542-ath9k_debugfs_diag.patch | 8 +- .../ath9k/543-ath9k_entropy_from_adc.patch | 6 +- ...544-ath9k-ar933x-usb-hang-workaround.patch | 10 +- .../550-ath9k-disable-bands-via-dt.patch | 2 +- .../ath9k/551-ath9k_ubnt_uap_plus_hsr.patch | 4 +- .../ath9k/553-ath9k_of_gpio_mask.patch | 4 +- ...-register-wiphy-s-during-module_init.patch | 10 +- ...62-brcmfmac-Disable-power-management.patch | 2 +- .../mac80211/patches/brcm/998-survey.patch | 8 +- .../patches/build/050-lib80211_option.patch | 4 +- .../patches/build/060-no_local_ssb_bcma.patch | 4 +- ...700-mwl8k-missing-pci-id-for-WNR854T.patch | 2 +- ...940-mwl8k_init_devices_synchronously.patch | 4 +- .../602-rt2x00-introduce-rt2x00eeprom.patch | 2 +- ...ent-set_tim-by-update-beacon-content.patch | 4 +- .../patches/subsys/010-sync-nl80211_h.patch | 37 +- .../120-cfg80211_allow_perm_addr_change.patch | 2 +- .../subsys/150-disable_addr_notifier.patch | 12 +- ...-free-packets-from-a-flow-on-overmem.patch | 95 -- ...-get_default_func-move-default-flow-.patch | 144 -- ...ot-maintain-a-backlog-sorted-list-of.patch | 317 ---- ...add-rx-decapsulation-offload-support.patch | 565 ------- ...le-QoS-support-for-nl80211-ctrl-port.patch | 116 -- ...320-mac80211_hwsim-add-6GHz-channels.patch | 123 -- ...211_hwsim-make-6-GHz-channels-usable.patch | 8 +- ...c80211-minstrel_ht-clean-up-CCK-code.patch | 166 --- ...l_ht-add-support-for-OFDM-rates-on-n.patch | 762 ---------- ...-remove-legacy-minstrel-rate-control.patch | 1328 ----------------- ...l_ht-remove-old-ewma-based-rate-aver.patch | 96 -- ...l_ht-improve-ampdu-length-estimation.patch | 67 - ...rel_ht-improve-sample-rate-selection.patch | 31 - ...l_ht-fix-max-probability-rate-select.patch | 124 -- ...el_ht-increase-stats-update-interval.patch | 20 - ...l_ht-fix-rounding-error-in-throughpu.patch | 34 - ...l_ht-use-bitfields-to-encode-rate-in.patch | 412 ----- ...l_ht-update-total-packets-counter-in.patch | 54 - ...l_ht-reduce-the-need-to-sample-slowe.patch | 102 -- ...l_ht-significantly-redesign-the-rate.patch | 767 ---------- ...el_ht-show-sampling-rates-in-debugfs.patch | 58 - ...l_ht-remove-sample-rate-switching-co.patch | 279 ---- ...l_ht-fix-regression-in-the-max_prob_.patch | 23 - ...l_ht-rework-rate-downgrade-code-and-.patch | 10 +- ...pply-flow-control-on-management-fram.patch | 2 +- ...set-sk_pacing_shift-for-802.3-txpath.patch | 2 +- ...MPDU-session-check-from-minstrel_ht-.patch | 14 +- ...eee80211_tx_h_rate_ctrl-when-dequeue.patch | 8 +- ...te-control-support-for-encap-offload.patch | 4 +- ...11-minstrel_ht-fix-sample-time-check.patch | 23 - ...rting-aggregation-sessions-on-mesh-i.patch | 2 +- ...introduce-aql_enable-node-in-debugfs.patch | 111 -- ...ange-struct-txq_info-for-fewer-holes.patch | 2 +- ...to-a-virtual-time-based-airtime-sche.patch | 66 +- ...eck-per-vif-offload_flags-in-Tx-path.patch | 2 +- ...nl80211-add-support-for-BSS-coloring.patch | 16 +- ...211-add-support-for-BSS-color-change.patch | 20 +- ...ce-individual-TWT-support-in-AP-mode.patch | 22 +- ...n-some-HE-capabilities-with-the-spec.patch | 45 +- ...pelling-of-A-MSDU-in-HE-capabilities.patch | 12 +- ...E-capabilities-A-MPDU-Length-Exponen.patch | 10 +- .../patches/subsys/400-allow-ibss-mixed.patch | 2 +- .../500-mac80211_configure_antenna_gain.patch | 24 +- ...the-dst-buffer-to-of_get_mac_address.patch | 4 +- 86 files changed, 249 insertions(+), 6099 deletions(-) delete mode 100644 package/kernel/mac80211/patches/ath10k/922-ath10k-increase-rx-buffer-size-to-2048.patch delete mode 100644 package/kernel/mac80211/patches/subsys/310-net-fq_impl-bulk-free-packets-from-a-flow-on-overmem.patch delete mode 100644 package/kernel/mac80211/patches/subsys/311-net-fq_impl-drop-get_default_func-move-default-flow-.patch delete mode 100644 package/kernel/mac80211/patches/subsys/312-net-fq_impl-do-not-maintain-a-backlog-sorted-list-of.patch delete mode 100644 package/kernel/mac80211/patches/subsys/315-mac80211-add-rx-decapsulation-offload-support.patch delete mode 100644 package/kernel/mac80211/patches/subsys/316-mac80211-enable-QoS-support-for-nl80211-ctrl-port.patch delete mode 100644 package/kernel/mac80211/patches/subsys/320-mac80211_hwsim-add-6GHz-channels.patch delete mode 100644 package/kernel/mac80211/patches/subsys/337-mac80211-minstrel_ht-clean-up-CCK-code.patch delete mode 100644 package/kernel/mac80211/patches/subsys/338-mac80211-minstrel_ht-add-support-for-OFDM-rates-on-n.patch delete mode 100644 package/kernel/mac80211/patches/subsys/339-mac80211-remove-legacy-minstrel-rate-control.patch delete mode 100644 package/kernel/mac80211/patches/subsys/340-mac80211-minstrel_ht-remove-old-ewma-based-rate-aver.patch delete mode 100644 package/kernel/mac80211/patches/subsys/341-mac80211-minstrel_ht-improve-ampdu-length-estimation.patch delete mode 100644 package/kernel/mac80211/patches/subsys/342-mac80211-minstrel_ht-improve-sample-rate-selection.patch delete mode 100644 package/kernel/mac80211/patches/subsys/343-mac80211-minstrel_ht-fix-max-probability-rate-select.patch delete mode 100644 package/kernel/mac80211/patches/subsys/344-mac80211-minstrel_ht-increase-stats-update-interval.patch delete mode 100644 package/kernel/mac80211/patches/subsys/345-mac80211-minstrel_ht-fix-rounding-error-in-throughpu.patch delete mode 100644 package/kernel/mac80211/patches/subsys/346-mac80211-minstrel_ht-use-bitfields-to-encode-rate-in.patch delete mode 100644 package/kernel/mac80211/patches/subsys/347-mac80211-minstrel_ht-update-total-packets-counter-in.patch delete mode 100644 package/kernel/mac80211/patches/subsys/348-mac80211-minstrel_ht-reduce-the-need-to-sample-slowe.patch delete mode 100644 package/kernel/mac80211/patches/subsys/349-mac80211-minstrel_ht-significantly-redesign-the-rate.patch delete mode 100644 package/kernel/mac80211/patches/subsys/350-mac80211-minstrel_ht-show-sampling-rates-in-debugfs.patch delete mode 100644 package/kernel/mac80211/patches/subsys/351-mac80211-minstrel_ht-remove-sample-rate-switching-co.patch delete mode 100644 package/kernel/mac80211/patches/subsys/352-mac80211-minstrel_ht-fix-regression-in-the-max_prob_.patch delete mode 100644 package/kernel/mac80211/patches/subsys/377-mac80211-minstrel_ht-fix-sample-time-check.patch delete mode 100644 package/kernel/mac80211/patches/subsys/380-mac80211-introduce-aql_enable-node-in-debugfs.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 99e96e64d0..c30d292a43 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.11.22-1 +PKG_VERSION:=5.12.19-1 PKG_RELEASE:=1 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.11.22/ -PKG_HASH:=35c23dd182711a3a6f671a673c2e0ace2ffdd25bbd1fb917e428d04924141299 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.12.19/ +PKG_HASH:=4233002bcf26237783cd517d93c27807e534234cef64def7e550c5f06b779d18 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) 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 db10c45104..eacc72776e 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 @@ -14,7 +14,7 @@ CFLAGS_trace.o := -I$(src) --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h -@@ -316,14 +316,7 @@ void _ath_dbg(struct ath_common *common, +@@ -317,14 +317,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/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch index bbbd8403e4..bda710d5c0 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 -@@ -3269,6 +3269,8 @@ void regulatory_hint_country_ie(struct w +@@ -3292,6 +3292,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; -@@ -3520,6 +3522,7 @@ static bool is_wiphy_all_set_reg_flag(en +@@ -3543,6 +3545,7 @@ static bool is_wiphy_all_set_reg_flag(en void regulatory_hint_disconnect(void) { 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 cca65be25b..7648ec3b7a 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 -@@ -3329,6 +3329,16 @@ int ath10k_core_register(struct ath10k * +@@ -3345,6 +3345,16 @@ int ath10k_core_register(struct ath10k * queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/ath10k/922-ath10k-increase-rx-buffer-size-to-2048.patch b/package/kernel/mac80211/patches/ath10k/922-ath10k-increase-rx-buffer-size-to-2048.patch deleted file mode 100644 index 333131edc5..0000000000 --- a/package/kernel/mac80211/patches/ath10k/922-ath10k-increase-rx-buffer-size-to-2048.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Linus Lüssing -Date: Wed, 5 Feb 2020 20:10:43 +0100 -Subject: ath10k: increase rx buffer size to 2048 - -Before, only frames with a maximum size of 1528 bytes could be -transmitted between two 802.11s nodes. - -For batman-adv for instance, which adds its own header to each frame, -we typically need an MTU of at least 1532 bytes to be able to transmit -without fragmentation. - -This patch now increases the maxmimum frame size from 1528 to 1656 -bytes. - -Tested with two ath10k devices in 802.11s mode, as well as with -batman-adv on top of 802.11s with forwarding disabled. - -Fix originally found and developed by Ben Greear. - -Link: https://github.com/greearb/ath10k-ct/issues/89 -Link: https://github.com/greearb/ath10k-ct/commit/9e5ab25027e0971fa24ccf93373324c08c4e992d -Cc: Ben Greear -Signed-off-by: Linus Lüssing - -Forwarded: https://patchwork.kernel.org/patch/11367055/ - ---- a/drivers/net/wireless/ath/ath10k/htt.h -+++ b/drivers/net/wireless/ath/ath10k/htt.h -@@ -2241,7 +2241,7 @@ struct htt_rx_chan_info { - * Should be: sizeof(struct htt_host_rx_desc) + max rx MSDU size, - * rounded up to a cache line size. - */ --#define HTT_RX_BUF_SIZE 1920 -+#define HTT_RX_BUF_SIZE 2048 - #define HTT_RX_MSDU_SIZE (HTT_RX_BUF_SIZE - (int)sizeof(struct htt_rx_desc)) - - /* Refill a bunch of RX buffers for each refill round so that FW/HW can handle 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 74b3292e0c..c3a28a361c 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 -@@ -9708,6 +9708,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -9818,6 +9818,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[] = { -@@ -10057,6 +10072,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -10170,6 +10185,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 6e1c13b15d..c8d7632900 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 @@ -140,7 +140,7 @@ v13: .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -130,6 +132,7 @@ static const struct ath10k_hw_params ath +@@ -132,6 +134,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9887_1_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9887 hw1.0", @@ -148,7 +148,7 @@ v13: .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -335,6 +338,7 @@ static const struct ath10k_hw_params ath +@@ -343,6 +346,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA99X0_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca99x0 hw2.0", @@ -156,7 +156,7 @@ v13: .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .otp_exe_param = 0x00000700, -@@ -375,6 +379,7 @@ static const struct ath10k_hw_params ath +@@ -384,6 +388,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9984_1_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9984/qca9994 hw1.0", @@ -164,7 +164,7 @@ v13: .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -422,6 +427,7 @@ static const struct ath10k_hw_params ath +@@ -432,6 +437,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9888_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9888 hw2.0", @@ -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, -@@ -3044,6 +3050,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -3060,6 +3066,10 @@ int ath10k_core_start(struct ath10k *ar, goto err_hif_stop; } @@ -183,7 +183,7 @@ v13: return 0; err_hif_stop: -@@ -3302,9 +3312,18 @@ static void ath10k_core_register_work(st +@@ -3318,9 +3328,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: -@@ -3350,6 +3369,8 @@ void ath10k_core_unregister(struct ath10 +@@ -3366,6 +3385,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" -@@ -1251,6 +1252,13 @@ struct ath10k { +@@ -1250,6 +1251,13 @@ struct ath10k { } testmode; struct { 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 eb7c0f9af5..e4699f323b 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,9 +16,9 @@ Signed-off-by: Mathias Kresin --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h -@@ -1304,6 +1304,10 @@ struct ath10k { - bool coex_support; - int coex_gpio_pin; +@@ -1306,6 +1306,10 @@ struct ath10k { + s32 tx_power_2g_limit; + s32 tx_power_5g_limit; +#ifdef CPTCFG_MAC80211_LEDS + const char *led_default_trigger; @@ -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 -@@ -10074,7 +10074,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -10187,7 +10187,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/980-ath10k-fix-max-antenna-gain-unit.patch b/package/kernel/mac80211/patches/ath10k/980-ath10k-fix-max-antenna-gain-unit.patch index e951e011e6..f3f3b1b921 100644 --- a/package/kernel/mac80211/patches/ath10k/980-ath10k-fix-max-antenna-gain-unit.patch +++ b/package/kernel/mac80211/patches/ath10k/980-ath10k-fix-max-antenna-gain-unit.patch @@ -20,7 +20,7 @@ Forwarded: https://patchwork.kernel.org/patch/10986723/ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -1038,7 +1038,7 @@ static int ath10k_monitor_vdev_start(str +@@ -1049,7 +1049,7 @@ static int ath10k_monitor_vdev_start(str arg.channel.min_power = 0; arg.channel.max_power = channel->max_power * 2; arg.channel.max_reg_power = channel->max_reg_power * 2; @@ -29,7 +29,7 @@ Forwarded: https://patchwork.kernel.org/patch/10986723/ reinit_completion(&ar->vdev_setup_done); reinit_completion(&ar->vdev_delete_done); -@@ -1484,7 +1484,7 @@ static int ath10k_vdev_start_restart(str +@@ -1495,7 +1495,7 @@ static int ath10k_vdev_start_restart(str arg.channel.min_power = 0; arg.channel.max_power = chandef->chan->max_power * 2; arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; @@ -38,7 +38,7 @@ Forwarded: https://patchwork.kernel.org/patch/10986723/ if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { arg.ssid = arvif->u.ap.ssid; -@@ -3255,7 +3255,7 @@ static int ath10k_update_channel_list(st +@@ -3423,7 +3423,7 @@ static int ath10k_update_channel_list(st ch->min_power = 0; ch->max_power = channel->max_power * 2; ch->max_reg_power = channel->max_reg_power * 2; diff --git a/package/kernel/mac80211/patches/ath10k/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch b/package/kernel/mac80211/patches/ath10k/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch index a149ce1216..9f7ac903eb 100644 --- a/package/kernel/mac80211/patches/ath10k/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch +++ b/package/kernel/mac80211/patches/ath10k/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch @@ -28,7 +28,7 @@ Forwarded: no --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -1006,6 +1006,40 @@ static inline int ath10k_vdev_setup_sync +@@ -1017,6 +1017,40 @@ static inline int ath10k_vdev_setup_sync return ar->last_wmi_vdev_start_status; } @@ -69,7 +69,7 @@ Forwarded: no static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) { struct cfg80211_chan_def *chandef = NULL; -@@ -1038,7 +1072,8 @@ static int ath10k_monitor_vdev_start(str +@@ -1049,7 +1083,8 @@ static int ath10k_monitor_vdev_start(str arg.channel.min_power = 0; arg.channel.max_power = channel->max_power * 2; arg.channel.max_reg_power = channel->max_reg_power * 2; @@ -79,7 +79,7 @@ Forwarded: no reinit_completion(&ar->vdev_setup_done); reinit_completion(&ar->vdev_delete_done); -@@ -1484,7 +1519,8 @@ static int ath10k_vdev_start_restart(str +@@ -1495,7 +1530,8 @@ static int ath10k_vdev_start_restart(str arg.channel.min_power = 0; arg.channel.max_power = chandef->chan->max_power * 2; arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; @@ -89,7 +89,7 @@ Forwarded: no if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { arg.ssid = arvif->u.ap.ssid; -@@ -3255,7 +3291,8 @@ static int ath10k_update_channel_list(st +@@ -3423,7 +3459,8 @@ static int ath10k_update_channel_list(st ch->min_power = 0; ch->max_power = channel->max_power * 2; ch->max_reg_power = channel->max_reg_power * 2; 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 1186ea8e06..e9d3ac6560 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 -@@ -3220,6 +3221,8 @@ static int ath10k_core_probe_fw(struct a +@@ -3236,6 +3237,8 @@ static int ath10k_core_probe_fw(struct a device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr)); diff --git a/package/kernel/mac80211/patches/ath5k/411-ath5k_allow_adhoc_and_ap.patch b/package/kernel/mac80211/patches/ath5k/411-ath5k_allow_adhoc_and_ap.patch index 9dbe047c9a..35ed6ea555 100644 --- a/package/kernel/mac80211/patches/ath5k/411-ath5k_allow_adhoc_and_ap.patch +++ b/package/kernel/mac80211/patches/ath5k/411-ath5k_allow_adhoc_and_ap.patch @@ -18,7 +18,7 @@ goto end; --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c -@@ -1964,7 +1964,7 @@ ath5k_beacon_send(struct ath5k_hw *ah) +@@ -1963,7 +1963,7 @@ ath5k_beacon_send(struct ath5k_hw *ah) } if ((ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs + @@ -27,7 +27,7 @@ ah->opmode == NL80211_IFTYPE_MESH_POINT) { u64 tsf = ath5k_hw_get_tsf64(ah); u32 tsftu = TSF_TO_TU(tsf); -@@ -2050,7 +2050,7 @@ ath5k_beacon_update_timers(struct ath5k_ +@@ -2049,7 +2049,7 @@ ath5k_beacon_update_timers(struct ath5k_ intval = ah->bintval & AR5K_BEACON_PERIOD; if (ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs @@ -36,7 +36,7 @@ intval /= ATH_BCBUF; /* staggered multi-bss beacons */ if (intval < 15) ATH5K_WARN(ah, "intval %u is too low, min 15\n", -@@ -2516,6 +2516,7 @@ static const struct ieee80211_iface_limi +@@ -2515,6 +2515,7 @@ static const struct ieee80211_iface_limi BIT(NL80211_IFTYPE_MESH_POINT) | #endif BIT(NL80211_IFTYPE_AP) }, diff --git a/package/kernel/mac80211/patches/ath5k/440-ath5k_channel_bw_debugfs.patch b/package/kernel/mac80211/patches/ath5k/440-ath5k_channel_bw_debugfs.patch index 92fb90c165..a63f0c881b 100644 --- a/package/kernel/mac80211/patches/ath5k/440-ath5k_channel_bw_debugfs.patch +++ b/package/kernel/mac80211/patches/ath5k/440-ath5k_channel_bw_debugfs.patch @@ -130,7 +130,7 @@ drivers/net/wireless/ath/ath5k/debug.c | 86 ++++++++++++++++++++++++++++++++ /* Antenna Control */ --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c -@@ -466,6 +466,9 @@ ath5k_chan_set(struct ath5k_hw *ah, stru +@@ -465,6 +465,9 @@ ath5k_chan_set(struct ath5k_hw *ah, stru return -EINVAL; } diff --git a/package/kernel/mac80211/patches/ath9k/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch b/package/kernel/mac80211/patches/ath9k/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch index d648a3a3e5..3a0171d4a2 100644 --- a/package/kernel/mac80211/patches/ath9k/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch +++ b/package/kernel/mac80211/patches/ath9k/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1435,8 +1435,12 @@ static bool ath9k_hw_set_reset(struct at +@@ -1434,8 +1434,12 @@ static bool ath9k_hw_set_reset(struct at if (!AR_SREV_9100(ah)) REG_WRITE(ah, AR_RC, 0); 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 5f265b84c2..53b7ba08bc 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 @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1312,39 +1312,56 @@ void ath9k_hw_get_delta_slope_vals(struc +@@ -1311,39 +1311,56 @@ void ath9k_hw_get_delta_slope_vals(struc *coef_exponent = coef_exp - 16; } @@ -94,7 +94,7 @@ Signed-off-by: Felix Fietkau return true; } -@@ -1397,24 +1414,24 @@ static bool ath9k_hw_set_reset(struct at +@@ -1396,24 +1413,24 @@ static bool ath9k_hw_set_reset(struct at rst_flags |= AR_RTC_RC_MAC_COLD; } diff --git a/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch index aa8a808170..9016da963b 100644 --- a/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch +++ b/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch @@ -8,7 +8,7 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2976,7 +2976,8 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2975,7 +2975,8 @@ void ath9k_hw_apply_txpower(struct ath_h { struct ath_regulatory *reg = ath9k_hw_regulatory(ah); struct ieee80211_channel *channel; @@ -18,7 +18,7 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. u16 ctl = NO_CTL; if (!chan) -@@ -2988,9 +2989,14 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2987,9 +2988,14 @@ void ath9k_hw_apply_txpower(struct ath_h channel = chan->chan; chan_pwr = min_t(int, channel->max_power * 2, MAX_COMBINED_POWER); new_pwr = min_t(int, chan_pwr, reg->power_limit); diff --git a/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch b/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch index 288d4e478c..5e5f3e4f10 100644 --- a/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch +++ b/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2995,6 +2995,10 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2994,6 +2994,10 @@ void ath9k_hw_apply_txpower(struct ath_h if (ant_gain > max_gain) ant_reduction = ant_gain - max_gain; diff --git a/package/kernel/mac80211/patches/ath9k/401-ath9k_blink_default.patch b/package/kernel/mac80211/patches/ath9k/401-ath9k_blink_default.patch index 3eb57bb1cf..7405e594fe 100644 --- a/package/kernel/mac80211/patches/ath9k/401-ath9k_blink_default.patch +++ b/package/kernel/mac80211/patches/ath9k/401-ath9k_blink_default.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -48,7 +48,7 @@ int ath9k_modparam_nohwcrypt; +@@ -47,7 +47,7 @@ int ath9k_modparam_nohwcrypt; module_param_named(nohwcrypt, ath9k_modparam_nohwcrypt, int, 0444); MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption"); diff --git a/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch b/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch index b936d04180..b355e8372f 100644 --- a/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch +++ b/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -827,6 +827,7 @@ static const struct ieee80211_iface_limi +@@ -826,6 +826,7 @@ static const struct ieee80211_iface_limi BIT(NL80211_IFTYPE_AP) }, { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO) }, diff --git a/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch b/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch index 5556d4bb8a..284c88ff49 100644 --- a/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch +++ b/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch @@ -14,7 +14,7 @@ Signed-off-by: David Bauer --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -908,6 +908,7 @@ static void ath9k_set_hw_capab(struct at +@@ -907,6 +907,7 @@ static void ath9k_set_hw_capab(struct at ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING); ieee80211_hw_set(hw, SUPPORT_FAST_XMIT); ieee80211_hw_set(hw, SUPPORTS_CLONED_SKBS); @@ -22,7 +22,7 @@ Signed-off-by: David Bauer if (ath9k_ps_enable) ieee80211_hw_set(hw, SUPPORTS_PS); -@@ -920,9 +921,6 @@ static void ath9k_set_hw_capab(struct at +@@ -919,9 +920,6 @@ static void ath9k_set_hw_capab(struct at IEEE80211_RADIOTAP_MCS_HAVE_STBC; } diff --git a/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch index 7d8294243e..ed78d1f9b4 100644 --- a/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch +++ b/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1121,25 +1121,25 @@ static int __init ath9k_init(void) +@@ -1120,25 +1120,25 @@ static int __init ath9k_init(void) { int error; diff --git a/package/kernel/mac80211/patches/ath9k/510-ath9k_intr_mitigation_tweak.patch b/package/kernel/mac80211/patches/ath9k/510-ath9k_intr_mitigation_tweak.patch index 75b48b480e..fda050a8f2 100644 --- a/package/kernel/mac80211/patches/ath9k/510-ath9k_intr_mitigation_tweak.patch +++ b/package/kernel/mac80211/patches/ath9k/510-ath9k_intr_mitigation_tweak.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -403,13 +403,8 @@ static void ath9k_hw_init_config(struct +@@ -402,13 +402,8 @@ static void ath9k_hw_init_config(struct ah->config.rx_intr_mitigation = true; diff --git a/package/kernel/mac80211/patches/ath9k/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/ath9k/513-ath9k_add_pci_ids.patch index 113c35625f..a085e3a1fb 100644 --- a/package/kernel/mac80211/patches/ath9k/513-ath9k_add_pci_ids.patch +++ b/package/kernel/mac80211/patches/ath9k/513-ath9k_add_pci_ids.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -663,6 +663,7 @@ int ath9k_hw_init(struct ath_hw *ah) +@@ -662,6 +662,7 @@ int ath9k_hw_init(struct ath_hw *ah) /* These are all the AR5008/AR9001/AR9002/AR9003 hardware family of chipsets */ switch (ah->hw_version.devid) { 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 8e8ce414a8..c161237827 100644 --- a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch @@ -181,7 +181,7 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1033,7 +1033,7 @@ int ath9k_init_device(u16 devid, struct +@@ -1032,7 +1032,7 @@ int ath9k_init_device(u16 devid, struct #ifdef CPTCFG_MAC80211_LEDS /* must be initialized before ieee80211_register_hw */ diff --git a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch index f93a6fe5cd..0e75b86cbf 100644 --- a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch @@ -84,7 +84,7 @@ bool reset_power_on; bool htc_reset_init; -@@ -1076,6 +1084,7 @@ void ath9k_hw_check_nav(struct ath_hw *a +@@ -1077,6 +1085,7 @@ void ath9k_hw_check_nav(struct ath_hw *a bool ath9k_hw_check_alive(struct ath_hw *ah); bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); @@ -94,7 +94,7 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1883,6 +1883,20 @@ u32 ath9k_hw_get_tsf_offset(struct times +@@ -1882,6 +1882,20 @@ u32 ath9k_hw_get_tsf_offset(struct times } EXPORT_SYMBOL(ath9k_hw_get_tsf_offset); @@ -115,7 +115,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, struct ath9k_hw_cal_data *caldata, bool fastcc) { -@@ -2091,6 +2105,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2090,6 +2104,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st ar9003_hw_disable_phy_restart(ah); ath9k_hw_apply_gpio_override(ah); @@ -125,7 +125,7 @@ REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON); --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -531,6 +531,11 @@ irqreturn_t ath_isr(int irq, void *dev) +@@ -536,6 +536,11 @@ irqreturn_t ath_isr(int irq, void *dev) if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) return IRQ_HANDLED; 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 88b75a7b6f..806e136159 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 @@ -55,7 +55,7 @@ ops->spectral_scan_config = ar9003_hw_spectral_scan_config; --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -815,7 +815,8 @@ static void ath9k_init_txpower_limits(st +@@ -814,7 +814,8 @@ static void ath9k_init_txpower_limits(st if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ); @@ -65,7 +65,7 @@ } static const struct ieee80211_iface_limit if_limits[] = { -@@ -993,6 +994,18 @@ static void ath9k_set_hw_capab(struct at +@@ -992,6 +993,18 @@ static void ath9k_set_hw_capab(struct at wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0); } @@ -84,7 +84,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, const struct ath_bus_ops *bus_ops) { -@@ -1038,6 +1051,8 @@ int ath9k_init_device(u16 devid, struct +@@ -1037,6 +1050,8 @@ int ath9k_init_device(u16 devid, struct ARRAY_SIZE(ath9k_tpt_blink)); #endif diff --git a/package/kernel/mac80211/patches/ath9k/544-ath9k-ar933x-usb-hang-workaround.patch b/package/kernel/mac80211/patches/ath9k/544-ath9k-ar933x-usb-hang-workaround.patch index 93eee34b64..6e2c252b23 100644 --- a/package/kernel/mac80211/patches/ath9k/544-ath9k-ar933x-usb-hang-workaround.patch +++ b/package/kernel/mac80211/patches/ath9k/544-ath9k-ar933x-usb-hang-workaround.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -248,6 +248,19 @@ void ath9k_hw_get_channel_centers(struct +@@ -247,6 +247,19 @@ void ath9k_hw_get_channel_centers(struct centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT); } @@ -20,7 +20,7 @@ /******************/ /* Chip Revisions */ /******************/ -@@ -1455,6 +1468,9 @@ static bool ath9k_hw_set_reset(struct at +@@ -1454,6 +1467,9 @@ static bool ath9k_hw_set_reset(struct at udelay(50); } @@ -30,7 +30,7 @@ return true; } -@@ -1554,6 +1570,9 @@ static bool ath9k_hw_chip_reset(struct a +@@ -1553,6 +1569,9 @@ static bool ath9k_hw_chip_reset(struct a ar9003_hw_internal_regulator_apply(ah); ath9k_hw_init_pll(ah, chan); @@ -40,7 +40,7 @@ return true; } -@@ -1861,8 +1880,14 @@ static int ath9k_hw_do_fastcc(struct ath +@@ -1860,8 +1879,14 @@ static int ath9k_hw_do_fastcc(struct ath if (AR_SREV_9271(ah)) ar9002_hw_load_ani_reg(ah, chan); @@ -55,7 +55,7 @@ return -EINVAL; } -@@ -2116,6 +2141,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2115,6 +2140,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st ath9k_hw_set_radar_params(ah); } diff --git a/package/kernel/mac80211/patches/ath9k/550-ath9k-disable-bands-via-dt.patch b/package/kernel/mac80211/patches/ath9k/550-ath9k-disable-bands-via-dt.patch index db9a09c98b..d1593339d2 100644 --- a/package/kernel/mac80211/patches/ath9k/550-ath9k-disable-bands-via-dt.patch +++ b/package/kernel/mac80211/patches/ath9k/550-ath9k-disable-bands-via-dt.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -626,6 +626,12 @@ static int ath9k_of_init(struct ath_soft +@@ -625,6 +625,12 @@ static int ath9k_of_init(struct ath_soft ath_dbg(common, CONFIG, "parsing configuration from OF node\n"); 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 a41eb55f74..1010f75807 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 @@ -339,7 +339,7 @@ static void ath9k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, bool drop); -@@ -652,6 +653,7 @@ void ath_reset_work(struct work_struct * +@@ -657,6 +658,7 @@ void ath_reset_work(struct work_struct * static int ath9k_start(struct ieee80211_hw *hw) { struct ath_softc *sc = hw->priv; @@ -347,7 +347,7 @@ struct ath_hw *ah = sc->sc_ah; struct ath_common *common = ath9k_hw_common(ah); struct ieee80211_channel *curchan = sc->cur_chan->chandef.chan; -@@ -730,6 +732,11 @@ static int ath9k_start(struct ieee80211_ +@@ -735,6 +737,11 @@ static int ath9k_start(struct ieee80211_ AR_GPIO_OUTPUT_MUX_AS_OUTPUT); } diff --git a/package/kernel/mac80211/patches/ath9k/553-ath9k_of_gpio_mask.patch b/package/kernel/mac80211/patches/ath9k/553-ath9k_of_gpio_mask.patch index f015913588..f11742d66e 100644 --- a/package/kernel/mac80211/patches/ath9k/553-ath9k_of_gpio_mask.patch +++ b/package/kernel/mac80211/patches/ath9k/553-ath9k_of_gpio_mask.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -651,6 +651,12 @@ static int ath9k_of_init(struct ath_soft +@@ -650,6 +650,12 @@ static int ath9k_of_init(struct ath_soft return 0; } @@ -13,7 +13,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, const struct ath_bus_ops *bus_ops) { -@@ -754,6 +760,9 @@ static int ath9k_init_softc(u16 devid, s +@@ -753,6 +759,9 @@ static int ath9k_init_softc(u16 devid, s if (ret) goto err_hw; diff --git a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch index c9730e29fd..7c76699c44 100644 --- a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch +++ b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch @@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -431,6 +431,7 @@ struct brcmf_fw { +@@ -429,6 +429,7 @@ struct brcmf_fw { struct brcmf_fw_request *req; u32 curpos; void (*done)(struct device *dev, int err, struct brcmf_fw_request *req); @@ -21,7 +21,7 @@ Signed-off-by: Rafał Miłecki }; static void brcmf_fw_request_done(const struct firmware *fw, void *ctx); -@@ -638,6 +639,8 @@ static void brcmf_fw_request_done(const +@@ -636,6 +637,8 @@ static void brcmf_fw_request_done(const fwctx->req = NULL; } fwctx->done(fwctx->dev, ret, fwctx->req); @@ -30,7 +30,7 @@ Signed-off-by: Rafał Miłecki kfree(fwctx); } -@@ -662,6 +665,8 @@ int brcmf_fw_get_firmwares(struct device +@@ -660,6 +663,8 @@ int brcmf_fw_get_firmwares(struct device { struct brcmf_fw_item *first = &req->items[0]; struct brcmf_fw *fwctx; @@ -39,7 +39,7 @@ Signed-off-by: Rafał Miłecki int ret; brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev)); -@@ -678,6 +683,9 @@ int brcmf_fw_get_firmwares(struct device +@@ -676,6 +681,9 @@ int brcmf_fw_get_firmwares(struct device fwctx->dev = dev; fwctx->req = req; fwctx->done = fw_cb; @@ -49,7 +49,7 @@ Signed-off-by: Rafał Miłecki ret = request_firmware_nowait(THIS_MODULE, true, first->path, fwctx->dev, GFP_KERNEL, fwctx, -@@ -685,6 +693,12 @@ int brcmf_fw_get_firmwares(struct device +@@ -683,6 +691,12 @@ int brcmf_fw_get_firmwares(struct device if (ret < 0) brcmf_fw_request_done(NULL, fwctx); 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 e640849e6a..774656f1fd 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 -@@ -2958,6 +2958,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -2961,6 +2961,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/998-survey.patch b/package/kernel/mac80211/patches/brcm/998-survey.patch index 9e9f4bbf8f..2c11ed696d 100644 --- a/package/kernel/mac80211/patches/brcm/998-survey.patch +++ b/package/kernel/mac80211/patches/brcm/998-survey.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2910,6 +2910,63 @@ done: +@@ -2913,6 +2913,63 @@ done: } static int @@ -64,7 +64,7 @@ brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev, int idx, u8 *mac, struct station_info *sinfo) { -@@ -3005,6 +3062,7 @@ static s32 brcmf_inform_single_bss(struc +@@ -3008,6 +3065,7 @@ static s32 brcmf_inform_single_bss(struc struct brcmu_chan ch; u16 channel; u32 freq; @@ -72,7 +72,7 @@ u16 notify_capability; u16 notify_interval; u8 *notify_ie; -@@ -3029,6 +3087,17 @@ static s32 brcmf_inform_single_bss(struc +@@ -3032,6 +3090,17 @@ static s32 brcmf_inform_single_bss(struc band = NL80211_BAND_5GHZ; freq = ieee80211_channel_to_frequency(channel, band); @@ -90,7 +90,7 @@ bss_data.chan = ieee80211_get_channel(wiphy, freq); bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20; bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime()); -@@ -5515,6 +5584,7 @@ static struct cfg80211_ops brcmf_cfg8021 +@@ -5560,6 +5629,7 @@ static struct cfg80211_ops brcmf_cfg8021 .leave_ibss = brcmf_cfg80211_leave_ibss, .get_station = brcmf_cfg80211_get_station, .dump_station = brcmf_cfg80211_dump_station, diff --git a/package/kernel/mac80211/patches/build/050-lib80211_option.patch b/package/kernel/mac80211/patches/build/050-lib80211_option.patch index b2465b0d7e..c1b1bc757f 100644 --- a/package/kernel/mac80211/patches/build/050-lib80211_option.patch +++ b/package/kernel/mac80211/patches/build/050-lib80211_option.patch @@ -1,6 +1,6 @@ --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig -@@ -187,7 +187,7 @@ config CFG80211_WEXT_EXPORT +@@ -188,7 +188,7 @@ config CFG80211_WEXT_EXPORT endif # CFG80211 config LIB80211 @@ -9,7 +9,7 @@ depends on m default n help -@@ -197,19 +197,19 @@ config LIB80211 +@@ -198,19 +198,19 @@ config LIB80211 Drivers should select this themselves if needed. config LIB80211_CRYPT_WEP 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 f51ddd8d71..0bfc2860f1 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 -@@ -429,43 +429,6 @@ USB_VL600= +@@ -431,43 +431,6 @@ USB_VL600= USB_NET_CH9200= USB_NET_AQC111= USB_RTL8153_ECM= @@ -192,7 +192,7 @@ select BRCMUTIL --- a/Kconfig.local +++ b/Kconfig.local -@@ -1291,117 +1291,6 @@ config BACKPORTED_USB_NET_AQC111 +@@ -1297,117 +1297,6 @@ config BACKPORTED_USB_NET_AQC111 config BACKPORTED_USB_RTL8153_ECM tristate default USB_RTL8153_ECM diff --git a/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch b/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch index 87bb42dce5..140949f9a8 100644 --- a/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch +++ b/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -5700,6 +5700,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw") +@@ -5699,6 +5699,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw") MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API)); static const struct pci_device_id mwl8k_pci_id_table[] = { diff --git a/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch index ff12950e5f..96b1ce77e9 100644 --- a/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -6286,6 +6286,8 @@ static int mwl8k_probe(struct pci_dev *p +@@ -6285,6 +6285,8 @@ static int mwl8k_probe(struct pci_dev *p priv->running_bsses = 0; @@ -9,7 +9,7 @@ return rc; err_stop_firmware: -@@ -6319,8 +6321,6 @@ static void mwl8k_remove(struct pci_dev +@@ -6318,8 +6320,6 @@ static void mwl8k_remove(struct pci_dev return; priv = hw->priv; 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 1930885ccf..5cbbf12462 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 -@@ -323,6 +323,7 @@ RT2X00_LIB_FIRMWARE= +@@ -325,6 +325,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= diff --git a/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch b/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch index d82dfec05b..0e734233f0 100644 --- a/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch +++ b/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch @@ -89,7 +89,7 @@ Tested-by: Maciej S. Szmigiero #endif --- a/drivers/net/wireless/realtek/rtlwifi/usb.c +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c -@@ -806,6 +806,7 @@ static void rtl_usb_stop(struct ieee8021 +@@ -805,6 +805,7 @@ static void rtl_usb_stop(struct ieee8021 tasklet_kill(&rtlusb->rx_work_tasklet); cancel_work_sync(&rtlpriv->works.lps_change_work); @@ -97,7 +97,7 @@ Tested-by: Maciej S. Szmigiero flush_workqueue(rtlpriv->works.rtl_wq); -@@ -1032,6 +1033,8 @@ int rtl_usb_probe(struct usb_interface * +@@ -1031,6 +1032,8 @@ int rtl_usb_probe(struct usb_interface * rtl_fill_h2c_cmd_work_callback); INIT_WORK(&rtlpriv->works.lps_change_work, rtl_lps_change_work_callback); diff --git a/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch b/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch index f521846a3b..4ee448bdf3 100644 --- a/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch +++ b/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch @@ -10,34 +10,7 @@ * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify * userspace that a connection was dropped by the AP or due to other * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and -@@ -1963,8 +1966,15 @@ enum nl80211_commands { - * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire - * probe-response frame. The DA field in the 802.11 header is zero-ed out, - * to be filled by the FW. -- * @NL80211_ATTR_DISABLE_HT: Force HT capable interfaces to disable -- * this feature. Currently, only supported in mac80211 drivers. -+ * @NL80211_ATTR_DISABLE_HT: Force HT capable interfaces to disable -+ * this feature during association. This is a flag attribute. -+ * Currently only supported in mac80211 drivers. -+ * @NL80211_ATTR_DISABLE_VHT: Force VHT capable interfaces to disable -+ * this feature during association. This is a flag attribute. -+ * Currently only supported in mac80211 drivers. -+ * @NL80211_ATTR_DISABLE_HE: Force HE capable interfaces to disable -+ * this feature during association. This is a flag attribute. -+ * Currently only supported in mac80211 drivers. - * @NL80211_ATTR_HT_CAPABILITY_MASK: Specify which bits of the - * ATTR_HT_CAPABILITY to which attention should be paid. - * Currently, only mac80211 NICs support this feature. -@@ -3045,6 +3055,8 @@ enum nl80211_attrs { - - NL80211_ATTR_SAR_SPEC, - -+ NL80211_ATTR_DISABLE_HE, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, -@@ -5928,6 +5940,16 @@ enum nl80211_feature_flags { +@@ -5937,6 +5940,16 @@ enum nl80211_feature_flags { * @NL80211_EXT_FEATURE_BEACON_RATE_HE: Driver supports beacon rate * configuration (AP/mesh) with HE rates. * @@ -54,7 +27,7 @@ * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ -@@ -5989,6 +6011,9 @@ enum nl80211_ext_feature_index { +@@ -5998,6 +6011,9 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_FILS_DISCOVERY, NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP, NL80211_EXT_FEATURE_BEACON_RATE_HE, @@ -64,7 +37,7 @@ /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, -@@ -6286,11 +6311,13 @@ struct nl80211_vendor_cmd_info { +@@ -6295,11 +6311,13 @@ struct nl80211_vendor_cmd_info { * @NL80211_TDLS_PEER_HT: TDLS peer is HT capable. * @NL80211_TDLS_PEER_VHT: TDLS peer is VHT capable. * @NL80211_TDLS_PEER_WMM: TDLS peer is WMM capable. @@ -78,7 +51,7 @@ }; /** -@@ -6882,6 +6909,9 @@ enum nl80211_peer_measurement_ftm_capa { +@@ -6891,6 +6909,9 @@ enum nl80211_peer_measurement_ftm_capa { * if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based * ranging will be used. @@ -88,7 +61,7 @@ * * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number -@@ -6900,6 +6930,7 @@ enum nl80211_peer_measurement_ftm_req { +@@ -6909,6 +6930,7 @@ enum nl80211_peer_measurement_ftm_req { NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC, NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED, NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED, diff --git a/package/kernel/mac80211/patches/subsys/120-cfg80211_allow_perm_addr_change.patch b/package/kernel/mac80211/patches/subsys/120-cfg80211_allow_perm_addr_change.patch index 172e5b04fd..ffd8807ccc 100644 --- a/package/kernel/mac80211/patches/subsys/120-cfg80211_allow_perm_addr_change.patch +++ b/package/kernel/mac80211/patches/subsys/120-cfg80211_allow_perm_addr_change.patch @@ -1,6 +1,6 @@ --- a/net/wireless/sysfs.c +++ b/net/wireless/sysfs.c -@@ -23,18 +23,35 @@ static inline struct cfg80211_registered +@@ -24,18 +24,35 @@ static inline struct cfg80211_registered return container_of(dev, struct cfg80211_registered_device, wiphy.dev); } diff --git a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch index 8a717558a7..b149031da0 100644 --- a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +++ b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -321,7 +321,7 @@ void ieee80211_restart_hw(struct ieee802 +@@ -328,7 +328,7 @@ void ieee80211_restart_hw(struct ieee802 } EXPORT_SYMBOL(ieee80211_restart_hw); @@ -9,7 +9,7 @@ static int ieee80211_ifa_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -380,7 +380,7 @@ static int ieee80211_ifa_changed(struct +@@ -387,7 +387,7 @@ static int ieee80211_ifa_changed(struct } #endif @@ -18,8 +18,8 @@ static int ieee80211_ifa6_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -1301,14 +1301,14 @@ int ieee80211_register_hw(struct ieee802 - +@@ -1310,14 +1310,14 @@ int ieee80211_register_hw(struct ieee802 + wiphy_unlock(hw->wiphy); rtnl_unlock(); -#ifdef CONFIG_INET @@ -35,7 +35,7 @@ local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; result = register_inet6addr_notifier(&local->ifa6_notifier); if (result) -@@ -1317,13 +1317,13 @@ int ieee80211_register_hw(struct ieee802 +@@ -1326,13 +1326,13 @@ int ieee80211_register_hw(struct ieee802 return 0; @@ -52,7 +52,7 @@ fail_ifa: #endif wiphy_unregister(local->hw.wiphy); -@@ -1351,10 +1351,10 @@ void ieee80211_unregister_hw(struct ieee +@@ -1360,10 +1360,10 @@ void ieee80211_unregister_hw(struct ieee tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); diff --git a/package/kernel/mac80211/patches/subsys/310-net-fq_impl-bulk-free-packets-from-a-flow-on-overmem.patch b/package/kernel/mac80211/patches/subsys/310-net-fq_impl-bulk-free-packets-from-a-flow-on-overmem.patch deleted file mode 100644 index 05a888006e..0000000000 --- a/package/kernel/mac80211/patches/subsys/310-net-fq_impl-bulk-free-packets-from-a-flow-on-overmem.patch +++ /dev/null @@ -1,95 +0,0 @@ -From: Felix Fietkau -Date: Wed, 25 Nov 2020 18:03:46 +0100 -Subject: [PATCH] net/fq_impl: bulk-free packets from a flow on overmemory - -This is similar to what sch_fq_codel does. It also amortizes the worst -case cost of a follow-up patch that changes the selection of the biggest -flow for dropping packets - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/fq_impl.h -+++ b/include/net/fq_impl.h -@@ -11,17 +11,25 @@ - - /* functions that are embedded into includer */ - -+ -+static void -+__fq_adjust_removal(struct fq *fq, struct fq_flow *flow, unsigned int packets, -+ unsigned int bytes, unsigned int truesize) -+{ -+ struct fq_tin *tin = flow->tin; -+ -+ tin->backlog_bytes -= bytes; -+ tin->backlog_packets -= packets; -+ flow->backlog -= bytes; -+ fq->backlog -= packets; -+ fq->memory_usage -= truesize; -+} -+ - static void fq_adjust_removal(struct fq *fq, - struct fq_flow *flow, - struct sk_buff *skb) - { -- struct fq_tin *tin = flow->tin; -- -- tin->backlog_bytes -= skb->len; -- tin->backlog_packets--; -- flow->backlog -= skb->len; -- fq->backlog--; -- fq->memory_usage -= skb->truesize; -+ __fq_adjust_removal(fq, flow, 1, skb->len, skb->truesize); - } - - static void fq_rejigger_backlog(struct fq *fq, struct fq_flow *flow) -@@ -59,6 +67,34 @@ static struct sk_buff *fq_flow_dequeue(s - return skb; - } - -+static int fq_flow_drop(struct fq *fq, struct fq_flow *flow, -+ fq_skb_free_t free_func) -+{ -+ unsigned int packets = 0, bytes = 0, truesize = 0; -+ struct fq_tin *tin = flow->tin; -+ struct sk_buff *skb; -+ int pending; -+ -+ lockdep_assert_held(&fq->lock); -+ -+ pending = min_t(int, 32, skb_queue_len(&flow->queue) / 2); -+ do { -+ skb = __skb_dequeue(&flow->queue); -+ if (!skb) -+ break; -+ -+ packets++; -+ bytes += skb->len; -+ truesize += skb->truesize; -+ free_func(fq, tin, flow, skb); -+ } while (packets < pending); -+ -+ __fq_adjust_removal(fq, flow, packets, bytes, truesize); -+ fq_rejigger_backlog(fq, flow); -+ -+ return packets; -+} -+ - static struct sk_buff *fq_tin_dequeue(struct fq *fq, - struct fq_tin *tin, - fq_tin_dequeue_t dequeue_func) -@@ -190,12 +226,9 @@ static void fq_tin_enqueue(struct fq *fq - if (!flow) - return; - -- skb = fq_flow_dequeue(fq, flow); -- if (!skb) -+ if (!fq_flow_drop(fq, flow, free_func)) - return; - -- free_func(fq, flow->tin, flow, skb); -- - flow->tin->overlimit++; - fq->overlimit++; - if (oom) { diff --git a/package/kernel/mac80211/patches/subsys/311-net-fq_impl-drop-get_default_func-move-default-flow-.patch b/package/kernel/mac80211/patches/subsys/311-net-fq_impl-drop-get_default_func-move-default-flow-.patch deleted file mode 100644 index 2d7db8be36..0000000000 --- a/package/kernel/mac80211/patches/subsys/311-net-fq_impl-drop-get_default_func-move-default-flow-.patch +++ /dev/null @@ -1,144 +0,0 @@ -From: Felix Fietkau -Date: Wed, 25 Nov 2020 18:09:10 +0100 -Subject: [PATCH] net/fq_impl: drop get_default_func, move default flow to - fq_tin - -Simplifies the code and prepares for a rework of scanning for flows on -overmemory drop. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/fq.h -+++ b/include/net/fq.h -@@ -47,6 +47,7 @@ struct fq_flow { - struct fq_tin { - struct list_head new_flows; - struct list_head old_flows; -+ struct fq_flow default_flow; - u32 backlog_bytes; - u32 backlog_packets; - u32 overlimit; ---- a/include/net/fq_impl.h -+++ b/include/net/fq_impl.h -@@ -151,8 +151,7 @@ static u32 fq_flow_idx(struct fq *fq, st - - static struct fq_flow *fq_flow_classify(struct fq *fq, - struct fq_tin *tin, u32 idx, -- struct sk_buff *skb, -- fq_flow_get_default_t get_default_func) -+ struct sk_buff *skb) - { - struct fq_flow *flow; - -@@ -160,7 +159,7 @@ static struct fq_flow *fq_flow_classify( - - flow = &fq->flows[idx]; - if (flow->tin && flow->tin != tin) { -- flow = get_default_func(fq, tin, idx, skb); -+ flow = &tin->default_flow; - tin->collisions++; - fq->collisions++; - } -@@ -192,15 +191,14 @@ static void fq_recalc_backlog(struct fq - static void fq_tin_enqueue(struct fq *fq, - struct fq_tin *tin, u32 idx, - struct sk_buff *skb, -- fq_skb_free_t free_func, -- fq_flow_get_default_t get_default_func) -+ fq_skb_free_t free_func) - { - struct fq_flow *flow; - bool oom; - - lockdep_assert_held(&fq->lock); - -- flow = fq_flow_classify(fq, tin, idx, skb, get_default_func); -+ flow = fq_flow_classify(fq, tin, idx, skb); - - flow->tin = tin; - flow->backlog += skb->len; -@@ -331,6 +329,7 @@ static void fq_tin_init(struct fq_tin *t - { - INIT_LIST_HEAD(&tin->new_flows); - INIT_LIST_HEAD(&tin->old_flows); -+ fq_flow_init(&tin->default_flow); - } - - static int fq_init(struct fq *fq, int flows_cnt) ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -852,7 +852,6 @@ enum txq_info_flags { - */ - struct txq_info { - struct fq_tin tin; -- struct fq_flow def_flow; - struct codel_vars def_cvars; - struct codel_stats cstats; - struct sk_buff_head frags; ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1309,7 +1309,7 @@ static struct sk_buff *codel_dequeue_fun - fq = &local->fq; - - if (cvars == &txqi->def_cvars) -- flow = &txqi->def_flow; -+ flow = &txqi->tin.default_flow; - else - flow = &fq->flows[cvars - local->cvars]; - -@@ -1352,7 +1352,7 @@ static struct sk_buff *fq_tin_dequeue_fu - cparams = &local->cparams; - } - -- if (flow == &txqi->def_flow) -+ if (flow == &tin->default_flow) - cvars = &txqi->def_cvars; - else - cvars = &local->cvars[flow - fq->flows]; -@@ -1379,17 +1379,6 @@ static void fq_skb_free_func(struct fq * - ieee80211_free_txskb(&local->hw, skb); - } - --static struct fq_flow *fq_flow_get_default_func(struct fq *fq, -- struct fq_tin *tin, -- int idx, -- struct sk_buff *skb) --{ -- struct txq_info *txqi; -- -- txqi = container_of(tin, struct txq_info, tin); -- return &txqi->def_flow; --} -- - static void ieee80211_txq_enqueue(struct ieee80211_local *local, - struct txq_info *txqi, - struct sk_buff *skb) -@@ -1402,8 +1391,7 @@ static void ieee80211_txq_enqueue(struct - - spin_lock_bh(&fq->lock); - fq_tin_enqueue(fq, tin, flow_idx, skb, -- fq_skb_free_func, -- fq_flow_get_default_func); -+ fq_skb_free_func); - spin_unlock_bh(&fq->lock); - } - -@@ -1446,7 +1434,6 @@ void ieee80211_txq_init(struct ieee80211 - struct txq_info *txqi, int tid) - { - fq_tin_init(&txqi->tin); -- fq_flow_init(&txqi->def_flow); - codel_vars_init(&txqi->def_cvars); - codel_stats_init(&txqi->cstats); - __skb_queue_head_init(&txqi->frags); -@@ -3281,8 +3268,7 @@ static bool ieee80211_amsdu_aggregate(st - */ - - tin = &txqi->tin; -- flow = fq_flow_classify(fq, tin, flow_idx, skb, -- fq_flow_get_default_func); -+ flow = fq_flow_classify(fq, tin, flow_idx, skb); - head = skb_peek_tail(&flow->queue); - if (!head || skb_is_gso(head)) - goto out; diff --git a/package/kernel/mac80211/patches/subsys/312-net-fq_impl-do-not-maintain-a-backlog-sorted-list-of.patch b/package/kernel/mac80211/patches/subsys/312-net-fq_impl-do-not-maintain-a-backlog-sorted-list-of.patch deleted file mode 100644 index 2fa2ba41ac..0000000000 --- a/package/kernel/mac80211/patches/subsys/312-net-fq_impl-do-not-maintain-a-backlog-sorted-list-of.patch +++ /dev/null @@ -1,317 +0,0 @@ -From: Felix Fietkau -Date: Wed, 25 Nov 2020 18:10:34 +0100 -Subject: [PATCH] net/fq_impl: do not maintain a backlog-sorted list of - flows - -A sorted flow list is only needed to drop packets in the biggest flow when -hitting the overmemory condition. -By scanning flows only when needed, we can avoid paying the cost of -maintaining the list under normal conditions -In order to avoid scanning lots of empty flows and touching too many cold -cache lines, a bitmap of flows with backlog is maintained - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/fq.h -+++ b/include/net/fq.h -@@ -19,8 +19,6 @@ struct fq_tin; - * @flowchain: can be linked to fq_tin's new_flows or old_flows. Used for DRR++ - * (deficit round robin) based round robin queuing similar to the one - * found in net/sched/sch_fq_codel.c -- * @backlogchain: can be linked to other fq_flow and fq. Used to keep track of -- * fat flows and efficient head-dropping if packet limit is reached - * @queue: sk_buff queue to hold packets - * @backlog: number of bytes pending in the queue. The number of packets can be - * found in @queue.qlen -@@ -29,7 +27,6 @@ struct fq_tin; - struct fq_flow { - struct fq_tin *tin; - struct list_head flowchain; -- struct list_head backlogchain; - struct sk_buff_head queue; - u32 backlog; - int deficit; -@@ -47,6 +44,7 @@ struct fq_flow { - struct fq_tin { - struct list_head new_flows; - struct list_head old_flows; -+ struct list_head tin_list; - struct fq_flow default_flow; - u32 backlog_bytes; - u32 backlog_packets; -@@ -60,14 +58,14 @@ struct fq_tin { - /** - * struct fq - main container for fair queuing purposes - * -- * @backlogs: linked to fq_flows. Used to maintain fat flows for efficient -- * head-dropping when @backlog reaches @limit - * @limit: max number of packets that can be queued across all flows - * @backlog: number of packets queued across all flows - */ - struct fq { - struct fq_flow *flows; -- struct list_head backlogs; -+ unsigned long *flows_bitmap; -+ -+ struct list_head tin_backlog; - spinlock_t lock; - u32 flows_cnt; - u32 limit; ---- a/include/net/fq_impl.h -+++ b/include/net/fq_impl.h -@@ -17,12 +17,24 @@ __fq_adjust_removal(struct fq *fq, struc - unsigned int bytes, unsigned int truesize) - { - struct fq_tin *tin = flow->tin; -+ int idx; - - tin->backlog_bytes -= bytes; - tin->backlog_packets -= packets; - flow->backlog -= bytes; - fq->backlog -= packets; - fq->memory_usage -= truesize; -+ -+ if (flow->backlog) -+ return; -+ -+ if (flow == &tin->default_flow) { -+ list_del_init(&tin->tin_list); -+ return; -+ } -+ -+ idx = flow - fq->flows; -+ __clear_bit(idx, fq->flows_bitmap); - } - - static void fq_adjust_removal(struct fq *fq, -@@ -32,24 +44,6 @@ static void fq_adjust_removal(struct fq - __fq_adjust_removal(fq, flow, 1, skb->len, skb->truesize); - } - --static void fq_rejigger_backlog(struct fq *fq, struct fq_flow *flow) --{ -- struct fq_flow *i; -- -- if (flow->backlog == 0) { -- list_del_init(&flow->backlogchain); -- } else { -- i = flow; -- -- list_for_each_entry_continue(i, &fq->backlogs, backlogchain) -- if (i->backlog < flow->backlog) -- break; -- -- list_move_tail(&flow->backlogchain, -- &i->backlogchain); -- } --} -- - static struct sk_buff *fq_flow_dequeue(struct fq *fq, - struct fq_flow *flow) - { -@@ -62,7 +56,6 @@ static struct sk_buff *fq_flow_dequeue(s - return NULL; - - fq_adjust_removal(fq, flow, skb); -- fq_rejigger_backlog(fq, flow); - - return skb; - } -@@ -90,7 +83,6 @@ static int fq_flow_drop(struct fq *fq, s - } while (packets < pending); - - __fq_adjust_removal(fq, flow, packets, bytes, truesize); -- fq_rejigger_backlog(fq, flow); - - return packets; - } -@@ -170,22 +162,36 @@ static struct fq_flow *fq_flow_classify( - return flow; - } - --static void fq_recalc_backlog(struct fq *fq, -- struct fq_tin *tin, -- struct fq_flow *flow) --{ -- struct fq_flow *i; -- -- if (list_empty(&flow->backlogchain)) -- list_add_tail(&flow->backlogchain, &fq->backlogs); -- -- i = flow; -- list_for_each_entry_continue_reverse(i, &fq->backlogs, -- backlogchain) -- if (i->backlog > flow->backlog) -- break; -+static struct fq_flow *fq_find_fattest_flow(struct fq *fq) -+{ -+ struct fq_tin *tin; -+ struct fq_flow *flow = NULL; -+ u32 len = 0; -+ int i; -+ -+ for_each_set_bit(i, fq->flows_bitmap, fq->flows_cnt) { -+ struct fq_flow *cur = &fq->flows[i]; -+ unsigned int cur_len; -+ -+ cur_len = cur->backlog; -+ if (cur_len <= len) -+ continue; -+ -+ flow = cur; -+ len = cur_len; -+ } - -- list_move(&flow->backlogchain, &i->backlogchain); -+ list_for_each_entry(tin, &fq->tin_backlog, tin_list) { -+ unsigned int cur_len = tin->default_flow.backlog; -+ -+ if (cur_len <= len) -+ continue; -+ -+ flow = &tin->default_flow; -+ len = cur_len; -+ } -+ -+ return flow; - } - - static void fq_tin_enqueue(struct fq *fq, -@@ -200,6 +206,13 @@ static void fq_tin_enqueue(struct fq *fq - - flow = fq_flow_classify(fq, tin, idx, skb); - -+ if (!flow->backlog) { -+ if (flow != &tin->default_flow) -+ __set_bit(idx, fq->flows_bitmap); -+ else if (list_empty(&tin->tin_list)) -+ list_add(&tin->tin_list, &fq->tin_backlog); -+ } -+ - flow->tin = tin; - flow->backlog += skb->len; - tin->backlog_bytes += skb->len; -@@ -207,8 +220,6 @@ static void fq_tin_enqueue(struct fq *fq - fq->memory_usage += skb->truesize; - fq->backlog++; - -- fq_recalc_backlog(fq, tin, flow); -- - if (list_empty(&flow->flowchain)) { - flow->deficit = fq->quantum; - list_add_tail(&flow->flowchain, -@@ -218,9 +229,7 @@ static void fq_tin_enqueue(struct fq *fq - __skb_queue_tail(&flow->queue, skb); - oom = (fq->memory_usage > fq->memory_limit); - while (fq->backlog > fq->limit || oom) { -- flow = list_first_entry_or_null(&fq->backlogs, -- struct fq_flow, -- backlogchain); -+ flow = fq_find_fattest_flow(fq); - if (!flow) - return; - -@@ -255,8 +264,6 @@ static void fq_flow_filter(struct fq *fq - fq_adjust_removal(fq, flow, skb); - free_func(fq, tin, flow, skb); - } -- -- fq_rejigger_backlog(fq, flow); - } - - static void fq_tin_filter(struct fq *fq, -@@ -279,16 +286,18 @@ static void fq_flow_reset(struct fq *fq, - struct fq_flow *flow, - fq_skb_free_t free_func) - { -+ struct fq_tin *tin = flow->tin; - struct sk_buff *skb; - - while ((skb = fq_flow_dequeue(fq, flow))) -- free_func(fq, flow->tin, flow, skb); -+ free_func(fq, tin, flow, skb); - -- if (!list_empty(&flow->flowchain)) -+ if (!list_empty(&flow->flowchain)) { - list_del_init(&flow->flowchain); -- -- if (!list_empty(&flow->backlogchain)) -- list_del_init(&flow->backlogchain); -+ if (list_empty(&tin->new_flows) && -+ list_empty(&tin->old_flows)) -+ list_del_init(&tin->tin_list); -+ } - - flow->tin = NULL; - -@@ -314,6 +323,7 @@ static void fq_tin_reset(struct fq *fq, - fq_flow_reset(fq, flow, free_func); - } - -+ WARN_ON_ONCE(!list_empty(&tin->tin_list)); - WARN_ON_ONCE(tin->backlog_bytes); - WARN_ON_ONCE(tin->backlog_packets); - } -@@ -321,7 +331,6 @@ static void fq_tin_reset(struct fq *fq, - static void fq_flow_init(struct fq_flow *flow) - { - INIT_LIST_HEAD(&flow->flowchain); -- INIT_LIST_HEAD(&flow->backlogchain); - __skb_queue_head_init(&flow->queue); - } - -@@ -329,6 +338,7 @@ static void fq_tin_init(struct fq_tin *t - { - INIT_LIST_HEAD(&tin->new_flows); - INIT_LIST_HEAD(&tin->old_flows); -+ INIT_LIST_HEAD(&tin->tin_list); - fq_flow_init(&tin->default_flow); - } - -@@ -337,8 +347,8 @@ static int fq_init(struct fq *fq, int fl - int i; - - memset(fq, 0, sizeof(fq[0])); -- INIT_LIST_HEAD(&fq->backlogs); - spin_lock_init(&fq->lock); -+ INIT_LIST_HEAD(&fq->tin_backlog); - fq->flows_cnt = max_t(u32, flows_cnt, 1); - fq->quantum = 300; - fq->limit = 8192; -@@ -348,6 +358,14 @@ static int fq_init(struct fq *fq, int fl - if (!fq->flows) - return -ENOMEM; - -+ fq->flows_bitmap = kcalloc(BITS_TO_LONGS(fq->flows_cnt), sizeof(long), -+ GFP_KERNEL); -+ if (!fq->flows_bitmap) { -+ kvfree(fq->flows); -+ fq->flows = NULL; -+ return -ENOMEM; -+ } -+ - for (i = 0; i < fq->flows_cnt; i++) - fq_flow_init(&fq->flows[i]); - -@@ -364,6 +382,9 @@ static void fq_reset(struct fq *fq, - - kvfree(fq->flows); - fq->flows = NULL; -+ -+ kfree(fq->flows_bitmap); -+ fq->flows_bitmap = NULL; - } - - #endif ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3335,8 +3335,6 @@ out_recalc: - if (head->len != orig_len) { - flow->backlog += head->len - orig_len; - tin->backlog_bytes += head->len - orig_len; -- -- fq_recalc_backlog(fq, tin, flow); - } - out: - spin_unlock_bh(&fq->lock); diff --git a/package/kernel/mac80211/patches/subsys/315-mac80211-add-rx-decapsulation-offload-support.patch b/package/kernel/mac80211/patches/subsys/315-mac80211-add-rx-decapsulation-offload-support.patch deleted file mode 100644 index 4f0e5fb31a..0000000000 --- a/package/kernel/mac80211/patches/subsys/315-mac80211-add-rx-decapsulation-offload-support.patch +++ /dev/null @@ -1,565 +0,0 @@ -From: Felix Fietkau -Date: Wed, 16 Dec 2020 21:34:03 +0100 -Subject: [PATCH] mac80211: add rx decapsulation offload support - -This allows drivers to pass 802.3 frames to mac80211, with some restrictions: - -- the skb must be passed with a valid sta -- fast-rx needs to be active for the sta -- monitor mode needs to be disabled - -mac80211 will tell the driver when it is safe to enable rx decap offload for -a particular station. - -In order to implement support, a driver must: - -- call ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD) -- implement ops->sta_set_decap_offload -- mark 802.3 frames with RX_FLAG_8023 - -If it doesn't want to enable offload for some vif types, it can mask out -IEEE80211_OFFLOAD_DECAP_ENABLED in vif->offload_flags from within the -.add_interface or .update_vif_offload driver ops - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -1300,6 +1300,8 @@ ieee80211_tx_info_clear_status(struct ie - * the "0-length PSDU" field included there. The value for it is - * in &struct ieee80211_rx_status. Note that if this value isn't - * known the frame shouldn't be reported. -+ * @RX_FLAG_8023: the frame has an 802.3 header (decap offload performed by -+ * hardware or driver) - */ - enum mac80211_rx_flags { - RX_FLAG_MMIC_ERROR = BIT(0), -@@ -1332,6 +1334,7 @@ enum mac80211_rx_flags { - RX_FLAG_RADIOTAP_HE_MU = BIT(27), - RX_FLAG_RADIOTAP_LSIG = BIT(28), - RX_FLAG_NO_PSDU = BIT(29), -+ RX_FLAG_8023 = BIT(30), - }; - - /** -@@ -1653,11 +1656,15 @@ enum ieee80211_vif_flags { - * The driver supports sending frames passed as 802.3 frames by mac80211. - * It must also support sending 802.11 packets for the same interface. - * @IEEE80211_OFFLOAD_ENCAP_4ADDR: support 4-address mode encapsulation offload -+ * @IEEE80211_OFFLOAD_DECAP_ENABLED: rx encapsulation offload is enabled -+ * The driver supports passing received 802.11 frames as 802.3 frames to -+ * mac80211. - */ - - enum ieee80211_offload_flags { - IEEE80211_OFFLOAD_ENCAP_ENABLED = BIT(0), - IEEE80211_OFFLOAD_ENCAP_4ADDR = BIT(1), -+ IEEE80211_OFFLOAD_DECAP_ENABLED = BIT(2), - }; - - /** -@@ -2393,6 +2400,9 @@ struct ieee80211_txq { - * @IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD: Hardware supports tx encapsulation - * offload - * -+ * @IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD: Hardware supports rx decapsulation -+ * offload -+ * - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays - */ - enum ieee80211_hw_flags { -@@ -2446,6 +2456,7 @@ enum ieee80211_hw_flags { - IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID, - IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT, - IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD, -+ IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD, - - /* keep last, obviously */ - NUM_IEEE80211_HW_FLAGS -@@ -4202,6 +4213,9 @@ struct ieee80211_ops { - struct ieee80211_sta *sta, bool enabled); - int (*set_sar_specs)(struct ieee80211_hw *hw, - const struct cfg80211_sar_specs *sar); -+ void (*sta_set_decap_offload)(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_sta *sta, bool enabled); - }; - - /** ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -405,6 +405,7 @@ static const char *hw_flag_names[] = { - FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID), - FLAG(AMPDU_KEYBORDER_SUPPORT), - FLAG(SUPPORTS_TX_ENCAP_OFFLOAD), -+ FLAG(SUPPORTS_RX_DECAP_OFFLOAD), - #undef FLAG - }; - ---- a/net/mac80211/debugfs_sta.c -+++ b/net/mac80211/debugfs_sta.c -@@ -79,6 +79,7 @@ static const char * const sta_flag_names - FLAG(MPSP_RECIPIENT), - FLAG(PS_DELIVER), - FLAG(USES_ENCRYPTION), -+ FLAG(DECAP_OFFLOAD), - #undef FLAG - }; - ---- a/net/mac80211/driver-ops.h -+++ b/net/mac80211/driver-ops.h -@@ -1413,4 +1413,20 @@ static inline void drv_sta_set_4addr(str - trace_drv_return_void(local); - } - -+static inline void drv_sta_set_decap_offload(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_sta *sta, -+ bool enabled) -+{ -+ sdata = get_bss_sdata(sdata); -+ if (!check_sdata_in_driver(sdata)) -+ return; -+ -+ trace_drv_sta_set_decap_offload(local, sdata, sta, enabled); -+ if (local->ops->sta_set_decap_offload) -+ local->ops->sta_set_decap_offload(&local->hw, &sdata->vif, sta, -+ enabled); -+ trace_drv_return_void(local); -+} -+ - #endif /* __MAC80211_DRIVER_OPS */ ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -815,7 +815,7 @@ static const struct net_device_ops ieee8 - - }; - --static bool ieee80211_iftype_supports_encap_offload(enum nl80211_iftype iftype) -+static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype) - { - switch (iftype) { - /* P2P GO and client are mapped to AP/STATION types */ -@@ -835,7 +835,7 @@ static bool ieee80211_set_sdata_offload_ - flags = sdata->vif.offload_flags; - - if (ieee80211_hw_check(&local->hw, SUPPORTS_TX_ENCAP_OFFLOAD) && -- ieee80211_iftype_supports_encap_offload(sdata->vif.type)) { -+ ieee80211_iftype_supports_hdr_offload(sdata->vif.type)) { - flags |= IEEE80211_OFFLOAD_ENCAP_ENABLED; - - if (!ieee80211_hw_check(&local->hw, SUPPORTS_TX_FRAG) && -@@ -848,10 +848,21 @@ static bool ieee80211_set_sdata_offload_ - flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED; - } - -+ if (ieee80211_hw_check(&local->hw, SUPPORTS_RX_DECAP_OFFLOAD) && -+ ieee80211_iftype_supports_hdr_offload(sdata->vif.type)) { -+ flags |= IEEE80211_OFFLOAD_DECAP_ENABLED; -+ -+ if (local->monitors) -+ flags &= ~IEEE80211_OFFLOAD_DECAP_ENABLED; -+ } else { -+ flags &= ~IEEE80211_OFFLOAD_DECAP_ENABLED; -+ } -+ - if (sdata->vif.offload_flags == flags) - return false; - - sdata->vif.offload_flags = flags; -+ ieee80211_check_fast_rx_iface(sdata); - return true; - } - -@@ -869,7 +880,7 @@ static void ieee80211_set_vif_encap_ops( - } - - if (!ieee80211_hw_check(&local->hw, SUPPORTS_TX_ENCAP_OFFLOAD) || -- !ieee80211_iftype_supports_encap_offload(bss->vif.type)) -+ !ieee80211_iftype_supports_hdr_offload(bss->vif.type)) - return; - - enabled = bss->vif.offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED; ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -4099,7 +4099,9 @@ void ieee80211_check_fast_rx(struct sta_ - .vif_type = sdata->vif.type, - .control_port_protocol = sdata->control_port_protocol, - }, *old, *new = NULL; -+ bool set_offload = false; - bool assign = false; -+ bool offload; - - /* use sparse to check that we don't return without updating */ - __acquire(check_fast_rx); -@@ -4212,6 +4214,17 @@ void ieee80211_check_fast_rx(struct sta_ - if (assign) - new = kmemdup(&fastrx, sizeof(fastrx), GFP_KERNEL); - -+ offload = assign && -+ (sdata->vif.offload_flags & IEEE80211_OFFLOAD_DECAP_ENABLED); -+ -+ if (offload) -+ set_offload = !test_and_set_sta_flag(sta, WLAN_STA_DECAP_OFFLOAD); -+ else -+ set_offload = test_and_clear_sta_flag(sta, WLAN_STA_DECAP_OFFLOAD); -+ -+ if (set_offload) -+ drv_sta_set_decap_offload(local, sdata, &sta->sta, assign); -+ - spin_lock_bh(&sta->lock); - old = rcu_dereference_protected(sta->fast_rx, true); - rcu_assign_pointer(sta->fast_rx, new); -@@ -4258,6 +4271,108 @@ void ieee80211_check_fast_rx_iface(struc - mutex_unlock(&local->sta_mtx); - } - -+static void ieee80211_rx_8023(struct ieee80211_rx_data *rx, -+ struct ieee80211_fast_rx *fast_rx, -+ int orig_len) -+{ -+ struct ieee80211_sta_rx_stats *stats; -+ struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); -+ struct sta_info *sta = rx->sta; -+ struct sk_buff *skb = rx->skb; -+ void *sa = skb->data + ETH_ALEN; -+ void *da = skb->data; -+ -+ stats = &sta->rx_stats; -+ if (fast_rx->uses_rss) -+ stats = this_cpu_ptr(sta->pcpu_rx_stats); -+ -+ /* statistics part of ieee80211_rx_h_sta_process() */ -+ if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) { -+ stats->last_signal = status->signal; -+ if (!fast_rx->uses_rss) -+ ewma_signal_add(&sta->rx_stats_avg.signal, -+ -status->signal); -+ } -+ -+ if (status->chains) { -+ int i; -+ -+ stats->chains = status->chains; -+ for (i = 0; i < ARRAY_SIZE(status->chain_signal); i++) { -+ int signal = status->chain_signal[i]; -+ -+ if (!(status->chains & BIT(i))) -+ continue; -+ -+ stats->chain_signal_last[i] = signal; -+ if (!fast_rx->uses_rss) -+ ewma_signal_add(&sta->rx_stats_avg.chain_signal[i], -+ -signal); -+ } -+ } -+ /* end of statistics */ -+ -+ stats->last_rx = jiffies; -+ stats->last_rate = sta_stats_encode_rate(status); -+ -+ stats->fragments++; -+ stats->packets++; -+ -+ skb->dev = fast_rx->dev; -+ -+ dev_sw_netstats_rx_add(fast_rx->dev, skb->len); -+ -+ /* The seqno index has the same property as needed -+ * for the rx_msdu field, i.e. it is IEEE80211_NUM_TIDS -+ * for non-QoS-data frames. Here we know it's a data -+ * frame, so count MSDUs. -+ */ -+ u64_stats_update_begin(&stats->syncp); -+ stats->msdu[rx->seqno_idx]++; -+ stats->bytes += orig_len; -+ u64_stats_update_end(&stats->syncp); -+ -+ if (fast_rx->internal_forward) { -+ struct sk_buff *xmit_skb = NULL; -+ if (is_multicast_ether_addr(da)) { -+ xmit_skb = skb_copy(skb, GFP_ATOMIC); -+ } else if (!ether_addr_equal(da, sa) && -+ sta_info_get(rx->sdata, da)) { -+ xmit_skb = skb; -+ skb = NULL; -+ } -+ -+ if (xmit_skb) { -+ /* -+ * Send to wireless media and increase priority by 256 -+ * to keep the received priority instead of -+ * reclassifying the frame (see cfg80211_classify8021d). -+ */ -+ xmit_skb->priority += 256; -+ xmit_skb->protocol = htons(ETH_P_802_3); -+ skb_reset_network_header(xmit_skb); -+ skb_reset_mac_header(xmit_skb); -+ dev_queue_xmit(xmit_skb); -+ } -+ -+ if (!skb) -+ return; -+ } -+ -+ /* deliver to local stack */ -+ skb->protocol = eth_type_trans(skb, fast_rx->dev); -+ memset(skb->cb, 0, sizeof(skb->cb)); -+ if (rx->list) -+#if LINUX_VERSION_IS_GEQ(4,19,0) -+ list_add_tail(&skb->list, rx->list); -+#else -+ __skb_queue_tail(rx->list, skb); -+#endif -+ else -+ netif_receive_skb(skb); -+ -+} -+ - static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, - struct ieee80211_fast_rx *fast_rx) - { -@@ -4278,9 +4393,6 @@ static bool ieee80211_invoke_fast_rx(str - } addrs __aligned(2); - struct ieee80211_sta_rx_stats *stats = &sta->rx_stats; - -- if (fast_rx->uses_rss) -- stats = this_cpu_ptr(sta->pcpu_rx_stats); -- - /* for parallel-rx, we need to have DUP_VALIDATED, otherwise we write - * to a common data structure; drivers can implement that per queue - * but we don't have that information in mac80211 -@@ -4354,32 +4466,6 @@ static bool ieee80211_invoke_fast_rx(str - pskb_trim(skb, skb->len - fast_rx->icv_len)) - goto drop; - -- /* statistics part of ieee80211_rx_h_sta_process() */ -- if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) { -- stats->last_signal = status->signal; -- if (!fast_rx->uses_rss) -- ewma_signal_add(&sta->rx_stats_avg.signal, -- -status->signal); -- } -- -- if (status->chains) { -- int i; -- -- stats->chains = status->chains; -- for (i = 0; i < ARRAY_SIZE(status->chain_signal); i++) { -- int signal = status->chain_signal[i]; -- -- if (!(status->chains & BIT(i))) -- continue; -- -- stats->chain_signal_last[i] = signal; -- if (!fast_rx->uses_rss) -- ewma_signal_add(&sta->rx_stats_avg.chain_signal[i], -- -signal); -- } -- } -- /* end of statistics */ -- - if (rx->key && !ieee80211_has_protected(hdr->frame_control)) - goto drop; - -@@ -4391,12 +4477,6 @@ static bool ieee80211_invoke_fast_rx(str - return true; - } - -- stats->last_rx = jiffies; -- stats->last_rate = sta_stats_encode_rate(status); -- -- stats->fragments++; -- stats->packets++; -- - /* 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); -@@ -4405,62 +4485,14 @@ static bool ieee80211_invoke_fast_rx(str - /* push the addresses in front */ - memcpy(skb_push(skb, sizeof(addrs)), &addrs, sizeof(addrs)); - -- skb->dev = fast_rx->dev; -- -- dev_sw_netstats_rx_add(fast_rx->dev, skb->len); -- -- /* The seqno index has the same property as needed -- * for the rx_msdu field, i.e. it is IEEE80211_NUM_TIDS -- * for non-QoS-data frames. Here we know it's a data -- * frame, so count MSDUs. -- */ -- u64_stats_update_begin(&stats->syncp); -- stats->msdu[rx->seqno_idx]++; -- stats->bytes += orig_len; -- u64_stats_update_end(&stats->syncp); -- -- if (fast_rx->internal_forward) { -- struct sk_buff *xmit_skb = NULL; -- if (is_multicast_ether_addr(addrs.da)) { -- xmit_skb = skb_copy(skb, GFP_ATOMIC); -- } else if (!ether_addr_equal(addrs.da, addrs.sa) && -- sta_info_get(rx->sdata, addrs.da)) { -- xmit_skb = skb; -- skb = NULL; -- } -- -- if (xmit_skb) { -- /* -- * Send to wireless media and increase priority by 256 -- * to keep the received priority instead of -- * reclassifying the frame (see cfg80211_classify8021d). -- */ -- xmit_skb->priority += 256; -- xmit_skb->protocol = htons(ETH_P_802_3); -- skb_reset_network_header(xmit_skb); -- skb_reset_mac_header(xmit_skb); -- dev_queue_xmit(xmit_skb); -- } -- -- if (!skb) -- return true; -- } -- -- /* deliver to local stack */ -- skb->protocol = eth_type_trans(skb, fast_rx->dev); -- memset(skb->cb, 0, sizeof(skb->cb)); -- if (rx->list) --#if LINUX_VERSION_IS_GEQ(4,19,0) -- list_add_tail(&skb->list, rx->list); --#else -- __skb_queue_tail(rx->list, skb); --#endif -- else -- netif_receive_skb(skb); -+ ieee80211_rx_8023(rx, fast_rx, orig_len); - - return true; - drop: - dev_kfree_skb(skb); -+ if (fast_rx->uses_rss) -+ stats = this_cpu_ptr(sta->pcpu_rx_stats); -+ - stats->dropped++; - return true; - } -@@ -4514,6 +4546,47 @@ static bool ieee80211_prepare_and_rx_han - return true; - } - -+static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw, -+ struct ieee80211_sta *pubsta, -+ struct sk_buff *skb, -+#if LINUX_VERSION_IS_GEQ(4,19,0) -+ struct list_head *list) -+#else -+ struct sk_buff_head *list) -+#endif -+{ -+ struct ieee80211_local *local = hw_to_local(hw); -+ struct ieee80211_fast_rx *fast_rx; -+ struct ieee80211_rx_data rx; -+ -+ memset(&rx, 0, sizeof(rx)); -+ rx.skb = skb; -+ rx.local = local; -+ rx.list = list; -+ -+ I802_DEBUG_INC(local->dot11ReceivedFragmentCount); -+ -+ /* drop frame if too short for header */ -+ if (skb->len < sizeof(struct ethhdr)) -+ goto drop; -+ -+ if (!pubsta) -+ goto drop; -+ -+ rx.sta = container_of(pubsta, struct sta_info, sta); -+ rx.sdata = rx.sta->sdata; -+ -+ fast_rx = rcu_dereference(rx.sta->fast_rx); -+ if (!fast_rx) -+ goto drop; -+ -+ ieee80211_rx_8023(&rx, fast_rx, skb->len); -+ return; -+ -+drop: -+ dev_kfree_skb(skb); -+} -+ - /* - * This is the actual Rx frames handler. as it belongs to Rx path it must - * be called with rcu_read_lock protection. -@@ -4753,13 +4826,17 @@ void ieee80211_rx_list(struct ieee80211_ - * if it was previously present. - * Also, frames with less than 16 bytes are dropped. - */ -- skb = ieee80211_rx_monitor(local, skb, rate); -+ if (!(status->flag & RX_FLAG_8023)) -+ skb = ieee80211_rx_monitor(local, skb, rate); - if (skb) { - ieee80211_tpt_led_trig_rx(local, - ((struct ieee80211_hdr *)skb->data)->frame_control, - skb->len); - -- __ieee80211_rx_handle_packet(hw, pubsta, skb, list); -+ if (status->flag & RX_FLAG_8023) -+ __ieee80211_rx_handle_8023(hw, pubsta, skb, list); -+ else -+ __ieee80211_rx_handle_packet(hw, pubsta, skb, list); - } - - kcov_remote_stop(); ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -71,6 +71,7 @@ - * until pending frames are delivered - * @WLAN_STA_USES_ENCRYPTION: This station was configured for encryption, - * so drop all packets without a key later. -+ * @WLAN_STA_DECAP_OFFLOAD: This station uses rx decap offload - * - * @NUM_WLAN_STA_FLAGS: number of defined flags - */ -@@ -102,6 +103,7 @@ enum ieee80211_sta_info_flags { - WLAN_STA_MPSP_RECIPIENT, - WLAN_STA_PS_DELIVER, - WLAN_STA_USES_ENCRYPTION, -+ WLAN_STA_DECAP_OFFLOAD, - - NUM_WLAN_STA_FLAGS, - }; ---- a/net/mac80211/trace.h -+++ b/net/mac80211/trace.h -@@ -2761,7 +2761,7 @@ DEFINE_EVENT(local_sdata_addr_evt, drv_u - TP_ARGS(local, sdata) - ); - --TRACE_EVENT(drv_sta_set_4addr, -+DECLARE_EVENT_CLASS(sta_flag_evt, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_sta *sta, bool enabled), -@@ -2788,6 +2788,22 @@ TRACE_EVENT(drv_sta_set_4addr, - ) - ); - -+DEFINE_EVENT(sta_flag_evt, drv_sta_set_4addr, -+ TP_PROTO(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_sta *sta, bool enabled), -+ -+ TP_ARGS(local, sdata, sta, enabled) -+); -+ -+DEFINE_EVENT(sta_flag_evt, drv_sta_set_decap_offload, -+ TP_PROTO(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_sta *sta, bool enabled), -+ -+ TP_ARGS(local, sdata, sta, enabled) -+); -+ - #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ - - #undef TRACE_INCLUDE_PATH diff --git a/package/kernel/mac80211/patches/subsys/316-mac80211-enable-QoS-support-for-nl80211-ctrl-port.patch b/package/kernel/mac80211/patches/subsys/316-mac80211-enable-QoS-support-for-nl80211-ctrl-port.patch deleted file mode 100644 index a9352ce3ab..0000000000 --- a/package/kernel/mac80211/patches/subsys/316-mac80211-enable-QoS-support-for-nl80211-ctrl-port.patch +++ /dev/null @@ -1,116 +0,0 @@ -From: Markus Theil -Date: Sat, 6 Feb 2021 12:51:12 +0100 -Subject: [PATCH] mac80211: enable QoS support for nl80211 ctrl port - -This patch unifies sending control port frames -over nl80211 and AF_PACKET sockets a little more. - -Before this patch, EAPOL frames got QoS prioritization -only when using AF_PACKET sockets. - -__ieee80211_select_queue only selects a QoS-enabled queue -for control port frames, when the control port protocol -is set correctly on the skb. For the AF_PACKET path this -works, but the nl80211 path used ETH_P_802_3. - -Another check for injected frames in wme.c then prevented -the QoS TID to be copied in the frame. - -In order to fix this, get rid of the frame injection marking -for nl80211 ctrl port and set the correct ethernet protocol. - -Please note: -An erlier version of this path tried to prevent -frame aggregation for control port frames in order to speed up -the initial connection setup a little. This seemed to cause -issues on my older Intel dvm-based hardware, and was therefore -removed again. Future commits which try to reintroduce this -have to check carefully how hw behaves with aggregated and -non-aggregated traffic for the same TID. -My NIC: Intel(R) Centrino(R) Ultimate-N 6300 AGN, REV=0x74 - -Reported-by: kernel test robot -Signed-off-by: Markus Theil -Link: https://lore.kernel.org/r/20210206115112.567881-1-markus.theil@tu-ilmenau.de -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -628,16 +628,12 @@ static void ieee80211_report_ack_skb(str - u64 cookie = IEEE80211_SKB_CB(skb)->ack.cookie; - struct ieee80211_sub_if_data *sdata; - struct ieee80211_hdr *hdr = (void *)skb->data; -- __be16 ethertype = 0; -- -- if (skb->len >= ETH_HLEN && skb->protocol == cpu_to_be16(ETH_P_802_3)) -- skb_copy_bits(skb, 2 * ETH_ALEN, ðertype, ETH_TLEN); - - rcu_read_lock(); - sdata = ieee80211_sdata_from_skb(local, skb); - if (sdata) { -- if (ethertype == sdata->control_port_protocol || -- ethertype == cpu_to_be16(ETH_P_PREAUTH)) -+ if (skb->protocol == sdata->control_port_protocol || -+ skb->protocol == cpu_to_be16(ETH_P_PREAUTH)) - cfg80211_control_port_tx_status(&sdata->wdev, - cookie, - skb->data, ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1182,9 +1182,7 @@ ieee80211_tx_prepare(struct ieee80211_su - tx->sta = rcu_dereference(sdata->u.vlan.sta); - if (!tx->sta && sdata->wdev.use_4addr) - return TX_DROP; -- } else if (info->flags & (IEEE80211_TX_INTFL_NL80211_FRAME_TX | -- IEEE80211_TX_CTL_INJECTED) || -- tx->sdata->control_port_protocol == tx->skb->protocol) { -+ } else if (tx->sdata->control_port_protocol == tx->skb->protocol) { - tx->sta = sta_info_get_bss(sdata, hdr->addr1); - } - if (!tx->sta && !is_multicast_ether_addr(hdr->addr1)) -@@ -5393,6 +5391,7 @@ int ieee80211_tx_control_port(struct wip - { - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; -+ struct sta_info *sta; - struct sk_buff *skb; - struct ethhdr *ehdr; - u32 ctrl_flags = 0; -@@ -5415,8 +5414,7 @@ int ieee80211_tx_control_port(struct wip - if (cookie) - ctrl_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; - -- flags |= IEEE80211_TX_INTFL_NL80211_FRAME_TX | -- IEEE80211_TX_CTL_INJECTED; -+ flags |= IEEE80211_TX_INTFL_NL80211_FRAME_TX; - - skb = dev_alloc_skb(local->hw.extra_tx_headroom + - sizeof(struct ethhdr) + len); -@@ -5433,10 +5431,25 @@ int ieee80211_tx_control_port(struct wip - ehdr->h_proto = proto; - - skb->dev = dev; -- skb->protocol = htons(ETH_P_802_3); -+ skb->protocol = proto; - skb_reset_network_header(skb); - skb_reset_mac_header(skb); - -+ /* update QoS header to prioritize control port frames if possible, -+ * priorization also happens for control port frames send over -+ * AF_PACKET -+ */ -+ rcu_read_lock(); -+ -+ if (ieee80211_lookup_ra_sta(sdata, skb, &sta) == 0 && !IS_ERR(sta)) { -+ u16 queue = __ieee80211_select_queue(sdata, sta, skb); -+ -+ skb_set_queue_mapping(skb, queue); -+ skb_get_hash(skb); -+ } -+ -+ rcu_read_unlock(); -+ - /* mutex lock is only needed for incrementing the cookie counter */ - mutex_lock(&local->mtx); - diff --git a/package/kernel/mac80211/patches/subsys/320-mac80211_hwsim-add-6GHz-channels.patch b/package/kernel/mac80211/patches/subsys/320-mac80211_hwsim-add-6GHz-channels.patch deleted file mode 100644 index a7c09f00bc..0000000000 --- a/package/kernel/mac80211/patches/subsys/320-mac80211_hwsim-add-6GHz-channels.patch +++ /dev/null @@ -1,123 +0,0 @@ -From: Ramon Fontes -Date: Sun, 27 Dec 2020 00:11:55 -0300 -Subject: [PATCH] mac80211_hwsim: add 6GHz channels - -Advertise 6GHz channels to mac80211. - -Signed-off-by: Ramon Fontes -Link: https://lore.kernel.org/r/20201227031155.81161-1-ramonreisfontes@gmail.com -[reword commit message] -Signed-off-by: Johannes Berg ---- - ---- a/drivers/net/wireless/mac80211_hwsim.c -+++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -311,6 +311,12 @@ static struct net_device *hwsim_mon; /* - .hw_value = (_freq), \ - } - -+#define CHAN6G(_freq) { \ -+ .band = NL80211_BAND_6GHZ, \ -+ .center_freq = (_freq), \ -+ .hw_value = (_freq), \ -+} -+ - static const struct ieee80211_channel hwsim_channels_2ghz[] = { - CHAN2G(2412), /* Channel 1 */ - CHAN2G(2417), /* Channel 2 */ -@@ -377,6 +383,68 @@ static const struct ieee80211_channel hw - CHAN5G(5925), /* Channel 185 */ - }; - -+static const struct ieee80211_channel hwsim_channels_6ghz[] = { -+ CHAN6G(5955), /* Channel 1 */ -+ CHAN6G(5975), /* Channel 5 */ -+ CHAN6G(5995), /* Channel 9 */ -+ CHAN6G(6015), /* Channel 13 */ -+ CHAN6G(6035), /* Channel 17 */ -+ CHAN6G(6055), /* Channel 21 */ -+ CHAN6G(6075), /* Channel 25 */ -+ CHAN6G(6095), /* Channel 29 */ -+ CHAN6G(6115), /* Channel 33 */ -+ CHAN6G(6135), /* Channel 37 */ -+ CHAN6G(6155), /* Channel 41 */ -+ CHAN6G(6175), /* Channel 45 */ -+ CHAN6G(6195), /* Channel 49 */ -+ CHAN6G(6215), /* Channel 53 */ -+ CHAN6G(6235), /* Channel 57 */ -+ CHAN6G(6255), /* Channel 61 */ -+ CHAN6G(6275), /* Channel 65 */ -+ CHAN6G(6295), /* Channel 69 */ -+ CHAN6G(6315), /* Channel 73 */ -+ CHAN6G(6335), /* Channel 77 */ -+ CHAN6G(6355), /* Channel 81 */ -+ CHAN6G(6375), /* Channel 85 */ -+ CHAN6G(6395), /* Channel 89 */ -+ CHAN6G(6415), /* Channel 93 */ -+ CHAN6G(6435), /* Channel 97 */ -+ CHAN6G(6455), /* Channel 181 */ -+ CHAN6G(6475), /* Channel 105 */ -+ CHAN6G(6495), /* Channel 109 */ -+ CHAN6G(6515), /* Channel 113 */ -+ CHAN6G(6535), /* Channel 117 */ -+ CHAN6G(6555), /* Channel 121 */ -+ CHAN6G(6575), /* Channel 125 */ -+ CHAN6G(6595), /* Channel 129 */ -+ CHAN6G(6615), /* Channel 133 */ -+ CHAN6G(6635), /* Channel 137 */ -+ CHAN6G(6655), /* Channel 141 */ -+ CHAN6G(6675), /* Channel 145 */ -+ CHAN6G(6695), /* Channel 149 */ -+ CHAN6G(6715), /* Channel 153 */ -+ CHAN6G(6735), /* Channel 157 */ -+ CHAN6G(6755), /* Channel 161 */ -+ CHAN6G(6775), /* Channel 165 */ -+ CHAN6G(6795), /* Channel 169 */ -+ CHAN6G(6815), /* Channel 173 */ -+ CHAN6G(6835), /* Channel 177 */ -+ CHAN6G(6855), /* Channel 181 */ -+ CHAN6G(6875), /* Channel 185 */ -+ CHAN6G(6895), /* Channel 189 */ -+ CHAN6G(6915), /* Channel 193 */ -+ CHAN6G(6935), /* Channel 197 */ -+ CHAN6G(6955), /* Channel 201 */ -+ CHAN6G(6975), /* Channel 205 */ -+ CHAN6G(6995), /* Channel 209 */ -+ CHAN6G(7015), /* Channel 213 */ -+ CHAN6G(7035), /* Channel 217 */ -+ CHAN6G(7055), /* Channel 221 */ -+ CHAN6G(7075), /* Channel 225 */ -+ CHAN6G(7095), /* Channel 229 */ -+ CHAN6G(7115), /* Channel 233 */ -+}; -+ - #define NUM_S1G_CHANS_US 51 - static struct ieee80211_channel hwsim_channels_s1g[NUM_S1G_CHANS_US]; - -@@ -548,6 +616,7 @@ struct mac80211_hwsim_data { - struct ieee80211_supported_band bands[NUM_NL80211_BANDS]; - struct ieee80211_channel channels_2ghz[ARRAY_SIZE(hwsim_channels_2ghz)]; - struct ieee80211_channel channels_5ghz[ARRAY_SIZE(hwsim_channels_5ghz)]; -+ struct ieee80211_channel channels_6ghz[ARRAY_SIZE(hwsim_channels_6ghz)]; - struct ieee80211_channel channels_s1g[ARRAY_SIZE(hwsim_channels_s1g)]; - struct ieee80211_rate rates[ARRAY_SIZE(hwsim_rates)]; - struct ieee80211_iface_combination if_combination; -@@ -578,7 +647,8 @@ struct mac80211_hwsim_data { - struct ieee80211_channel *channel; - unsigned long next_start, start, end; - } survey_data[ARRAY_SIZE(hwsim_channels_2ghz) + -- ARRAY_SIZE(hwsim_channels_5ghz)]; -+ ARRAY_SIZE(hwsim_channels_5ghz) + -+ ARRAY_SIZE(hwsim_channels_6ghz)]; - - struct ieee80211_channel *channel; - u64 beacon_int /* beacon interval in us */; -@@ -3149,6 +3219,8 @@ static int mac80211_hwsim_new_radio(stru - sizeof(hwsim_channels_2ghz)); - memcpy(data->channels_5ghz, hwsim_channels_5ghz, - sizeof(hwsim_channels_5ghz)); -+ memcpy(data->channels_6ghz, hwsim_channels_6ghz, -+ sizeof(hwsim_channels_6ghz)); - memcpy(data->channels_s1g, hwsim_channels_s1g, - sizeof(hwsim_channels_s1g)); - memcpy(data->rates, hwsim_rates, sizeof(hwsim_rates)); diff --git a/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch b/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch index 4bac10eefe..c21d4446ab 100644 --- a/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch +++ b/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2968,15 +2968,19 @@ static void mac80211_hwsim_he_capab(stru +@@ -2990,15 +2990,19 @@ static void mac80211_hwsim_he_capab(stru { u16 n_iftype_data; @@ -34,7 +34,7 @@ Signed-off-by: Felix Fietkau return; } -@@ -3265,6 +3269,12 @@ static int mac80211_hwsim_new_radio(stru +@@ -3288,6 +3292,12 @@ static int mac80211_hwsim_new_radio(stru sband->vht_cap.vht_mcs.tx_mcs_map = sband->vht_cap.vht_mcs.rx_mcs_map; break; @@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau case NL80211_BAND_S1GHZ: memcpy(&sband->s1g_cap, &hwsim_s1g_cap, sizeof(sband->s1g_cap)); -@@ -3275,6 +3285,13 @@ static int mac80211_hwsim_new_radio(stru +@@ -3298,6 +3308,13 @@ static int mac80211_hwsim_new_radio(stru continue; } @@ -61,7 +61,7 @@ Signed-off-by: Felix Fietkau sband->ht_cap.ht_supported = true; sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD | -@@ -3288,10 +3305,6 @@ static int mac80211_hwsim_new_radio(stru +@@ -3311,10 +3328,6 @@ static int mac80211_hwsim_new_radio(stru sband->ht_cap.mcs.rx_mask[0] = 0xff; sband->ht_cap.mcs.rx_mask[1] = 0xff; sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; diff --git a/package/kernel/mac80211/patches/subsys/337-mac80211-minstrel_ht-clean-up-CCK-code.patch b/package/kernel/mac80211/patches/subsys/337-mac80211-minstrel_ht-clean-up-CCK-code.patch deleted file mode 100644 index f667d2c94e..0000000000 --- a/package/kernel/mac80211/patches/subsys/337-mac80211-minstrel_ht-clean-up-CCK-code.patch +++ /dev/null @@ -1,166 +0,0 @@ -From: Felix Fietkau -Date: Fri, 25 Dec 2020 16:22:52 +0100 -Subject: [PATCH] mac80211: minstrel_ht: clean up CCK code - -- move ack overhead out of rate duration table -- remove cck_supported, cck_supported_short - -Preparation for adding OFDM legacy rates support - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -136,20 +136,16 @@ - __VHT_GROUP(_streams, _sgi, _bw, \ - VHT_GROUP_SHIFT(_streams, _sgi, _bw)) - --#define CCK_DURATION(_bitrate, _short, _len) \ -+#define CCK_DURATION(_bitrate, _short) \ - (1000 * (10 /* SIFS */ + \ - (_short ? 72 + 24 : 144 + 48) + \ -- (8 * (_len + 4) * 10) / (_bitrate))) -- --#define CCK_ACK_DURATION(_bitrate, _short) \ -- (CCK_DURATION((_bitrate > 10 ? 20 : 10), false, 60) + \ -- CCK_DURATION(_bitrate, _short, AVG_PKT_SIZE)) -+ (8 * (AVG_PKT_SIZE + 4) * 10) / (_bitrate))) - - #define CCK_DURATION_LIST(_short, _s) \ -- CCK_ACK_DURATION(10, _short) >> _s, \ -- CCK_ACK_DURATION(20, _short) >> _s, \ -- CCK_ACK_DURATION(55, _short) >> _s, \ -- CCK_ACK_DURATION(110, _short) >> _s -+ CCK_DURATION(10, _short) >> _s, \ -+ CCK_DURATION(20, _short) >> _s, \ -+ CCK_DURATION(55, _short) >> _s, \ -+ CCK_DURATION(110, _short) >> _s - - #define __CCK_GROUP(_s) \ - [MINSTREL_CCK_GROUP] = { \ -@@ -163,7 +159,7 @@ - } - - #define CCK_GROUP_SHIFT \ -- GROUP_SHIFT(CCK_ACK_DURATION(10, false)) -+ GROUP_SHIFT(CCK_DURATION(10, false)) - - #define CCK_GROUP __CCK_GROUP(CCK_GROUP_SHIFT) - -@@ -349,15 +345,19 @@ int - minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate, - int prob_avg) - { -- unsigned int nsecs = 0; -+ unsigned int nsecs = 0, overhead = mi->overhead; -+ unsigned int ampdu_len = 1; - - /* do not account throughput if sucess prob is below 10% */ - if (prob_avg < MINSTREL_FRAC(10, 100)) - return 0; - -- if (group != MINSTREL_CCK_GROUP) -- nsecs = 1000 * mi->overhead / minstrel_ht_avg_ampdu_len(mi); -+ if (group == MINSTREL_CCK_GROUP) -+ overhead = mi->overhead_legacy; -+ else -+ ampdu_len = minstrel_ht_avg_ampdu_len(mi); - -+ nsecs = 1000 * overhead / ampdu_len; - nsecs += minstrel_mcs_groups[group].duration[rate] << - minstrel_mcs_groups[group].shift; - -@@ -1031,7 +1031,10 @@ minstrel_calc_retransmit(struct minstrel - ctime += (t_slot * cw) >> 1; - cw = min((cw << 1) | 1, mp->cw_max); - -- if (index / MCS_GROUP_RATES != MINSTREL_CCK_GROUP) { -+ if (index / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) { -+ overhead = mi->overhead_legacy; -+ overhead_rtscts = mi->overhead_legacy_rtscts; -+ } else { - overhead = mi->overhead; - overhead_rtscts = mi->overhead_rtscts; - } -@@ -1369,18 +1372,14 @@ minstrel_ht_update_cck(struct minstrel_p - if (!ieee80211_hw_check(mp->hw, SUPPORTS_HT_CCK_RATES)) - return; - -- mi->cck_supported = 0; -- mi->cck_supported_short = 0; - for (i = 0; i < 4; i++) { - if (!rate_supported(sta, sband->band, mp->cck_rates[i])) - continue; - -- mi->cck_supported |= BIT(i); -+ mi->supported[MINSTREL_CCK_GROUP] |= BIT(i); - if (sband->bitrates[i].flags & IEEE80211_RATE_SHORT_PREAMBLE) -- mi->cck_supported_short |= BIT(i); -+ mi->supported[MINSTREL_CCK_GROUP] |= BIT(i + 4); - } -- -- mi->supported[MINSTREL_CCK_GROUP] = mi->cck_supported; - } - - static void -@@ -1394,12 +1393,13 @@ minstrel_ht_update_caps(void *priv, stru - struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs; - u16 ht_cap = sta->ht_cap.cap; - struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; -+ const struct ieee80211_rate *ctl_rate; -+ bool ldpc, erp; - int use_vht; - int n_supported = 0; - int ack_dur; - int stbc; - int i; -- bool ldpc; - - /* fall back to the old minstrel for legacy stations */ - if (!sta->ht_cap.ht_supported) -@@ -1423,6 +1423,14 @@ minstrel_ht_update_caps(void *priv, stru - mi->overhead += ack_dur; - mi->overhead_rtscts = mi->overhead + 2 * ack_dur; - -+ ctl_rate = &sband->bitrates[rate_lowest_index(sband, sta)]; -+ erp = ctl_rate->flags & IEEE80211_RATE_ERP_G; -+ ack_dur = ieee80211_frame_duration(sband->band, 10, -+ ctl_rate->bitrate, erp, 1, -+ ieee80211_chandef_get_shift(chandef)); -+ mi->overhead_legacy = ack_dur; -+ mi->overhead_legacy_rtscts = mi->overhead_legacy + 2 * ack_dur; -+ - mi->avg_ampdu_len = MINSTREL_FRAC(1, 1); - - /* When using MRR, sample more on the first attempt, without delay */ -@@ -1523,8 +1531,6 @@ minstrel_ht_update_caps(void *priv, stru - if (!n_supported) - goto use_legacy; - -- mi->supported[MINSTREL_CCK_GROUP] |= mi->cck_supported_short << 4; -- - /* create an initial rate table with the lowest supported rates */ - minstrel_ht_update_stats(mp, mi, true); - minstrel_ht_update_rates(mp, mi); ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -77,6 +77,8 @@ struct minstrel_ht_sta { - /* overhead time in usec for each frame */ - unsigned int overhead; - unsigned int overhead_rtscts; -+ unsigned int overhead_legacy; -+ unsigned int overhead_legacy_rtscts; - - unsigned int total_packets_last; - unsigned int total_packets_cur; -@@ -97,9 +99,6 @@ struct minstrel_ht_sta { - /* current MCS group to be sampled */ - u8 sample_group; - -- u8 cck_supported; -- u8 cck_supported_short; -- - /* Bitfield of supported MCS rates of all groups */ - u16 supported[MINSTREL_GROUPS_NB]; - diff --git a/package/kernel/mac80211/patches/subsys/338-mac80211-minstrel_ht-add-support-for-OFDM-rates-on-n.patch b/package/kernel/mac80211/patches/subsys/338-mac80211-minstrel_ht-add-support-for-OFDM-rates-on-n.patch deleted file mode 100644 index abefde7109..0000000000 --- a/package/kernel/mac80211/patches/subsys/338-mac80211-minstrel_ht-add-support-for-OFDM-rates-on-n.patch +++ /dev/null @@ -1,762 +0,0 @@ -From: Felix Fietkau -Date: Sat, 26 Dec 2020 13:56:42 +0100 -Subject: [PATCH] mac80211: minstrel_ht: add support for OFDM rates on - non-HT clients - -The legacy minstrel code is essentially unmaintained and receives only very -little testing. In order to bring the significant algorithm improvements from -minstrel_ht to legacy clients, this patch adds support for OFDM rates to -minstrel_ht and removes the fallback to the legacy codepath. -This also makes it work much better on hardware with rate selection constraints, -e.g. mt76. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel.h -+++ b/net/mac80211/rc80211_minstrel.h -@@ -152,6 +152,7 @@ struct minstrel_priv { - unsigned int lookaround_rate_mrr; - - u8 cck_rates[4]; -+ u8 ofdm_rates[NUM_NL80211_BANDS][8]; - - #ifdef CPTCFG_MAC80211_DEBUGFS - /* ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -163,6 +163,38 @@ - - #define CCK_GROUP __CCK_GROUP(CCK_GROUP_SHIFT) - -+#define OFDM_DURATION(_bitrate) \ -+ (1000 * (16 /* SIFS + signal ext */ + \ -+ 16 /* T_PREAMBLE */ + \ -+ 4 /* T_SIGNAL */ + \ -+ 4 * (((16 + 80 * (AVG_PKT_SIZE + 4) + 6) / \ -+ ((_bitrate) * 4))))) -+ -+#define OFDM_DURATION_LIST(_s) \ -+ OFDM_DURATION(60) >> _s, \ -+ OFDM_DURATION(90) >> _s, \ -+ OFDM_DURATION(120) >> _s, \ -+ OFDM_DURATION(180) >> _s, \ -+ OFDM_DURATION(240) >> _s, \ -+ OFDM_DURATION(360) >> _s, \ -+ OFDM_DURATION(480) >> _s, \ -+ OFDM_DURATION(540) >> _s -+ -+#define __OFDM_GROUP(_s) \ -+ [MINSTREL_OFDM_GROUP] = { \ -+ .streams = 1, \ -+ .flags = 0, \ -+ .shift = _s, \ -+ .duration = { \ -+ OFDM_DURATION_LIST(_s), \ -+ } \ -+ } -+ -+#define OFDM_GROUP_SHIFT \ -+ GROUP_SHIFT(OFDM_DURATION(60)) -+ -+#define OFDM_GROUP __OFDM_GROUP(OFDM_GROUP_SHIFT) -+ - - static bool minstrel_vht_only = true; - module_param(minstrel_vht_only, bool, 0644); -@@ -199,6 +231,7 @@ const struct mcs_group minstrel_mcs_grou - MCS_GROUP(4, 1, BW_40), - - CCK_GROUP, -+ OFDM_GROUP, - - VHT_GROUP(1, 0, BW_20), - VHT_GROUP(2, 0, BW_20), -@@ -231,6 +264,8 @@ const struct mcs_group minstrel_mcs_grou - VHT_GROUP(4, 1, BW_80), - }; - -+const s16 minstrel_cck_bitrates[4] = { 10, 20, 55, 110 }; -+const s16 minstrel_ofdm_bitrates[8] = { 60, 90, 120, 180, 240, 360, 480, 540 }; - static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; - - static void -@@ -275,6 +310,13 @@ minstrel_get_valid_vht_rates(int bw, int - return 0x3ff & ~mask; - } - -+static bool -+minstrel_ht_is_legacy_group(int group) -+{ -+ return group == MINSTREL_CCK_GROUP || -+ group == MINSTREL_OFDM_GROUP; -+} -+ - /* - * Look up an MCS group index based on mac80211 rate information - */ -@@ -304,21 +346,34 @@ minstrel_ht_get_stats(struct minstrel_pr - if (rate->flags & IEEE80211_TX_RC_MCS) { - group = minstrel_ht_get_group_idx(rate); - idx = rate->idx % 8; -- } else if (rate->flags & IEEE80211_TX_RC_VHT_MCS) { -+ goto out; -+ } -+ -+ if (rate->flags & IEEE80211_TX_RC_VHT_MCS) { - group = minstrel_vht_get_group_idx(rate); - idx = ieee80211_rate_get_vht_mcs(rate); -- } else { -- group = MINSTREL_CCK_GROUP; -+ goto out; -+ } - -- for (idx = 0; idx < ARRAY_SIZE(mp->cck_rates); idx++) -- if (rate->idx == mp->cck_rates[idx]) -- break; -+ group = MINSTREL_CCK_GROUP; -+ for (idx = 0; idx < ARRAY_SIZE(mp->cck_rates); idx++) { -+ if (rate->idx != mp->cck_rates[idx]) -+ continue; - - /* short preamble */ - if ((mi->supported[group] & BIT(idx + 4)) && - (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)) -- idx += 4; -+ idx += 4; -+ goto out; - } -+ -+ group = MINSTREL_OFDM_GROUP; -+ for (idx = 0; idx < ARRAY_SIZE(mp->ofdm_rates[0]); idx++) -+ if (rate->idx == mp->ofdm_rates[mi->band][idx]) -+ goto out; -+ -+ idx = 0; -+out: - return &mi->groups[group].rates[idx]; - } - -@@ -352,7 +407,7 @@ minstrel_ht_get_tp_avg(struct minstrel_h - if (prob_avg < MINSTREL_FRAC(10, 100)) - return 0; - -- if (group == MINSTREL_CCK_GROUP) -+ if (minstrel_ht_is_legacy_group(group)) - overhead = mi->overhead_legacy; - else - ampdu_len = minstrel_ht_avg_ampdu_len(mi); -@@ -439,8 +494,8 @@ minstrel_ht_set_best_prob_rate(struct mi - /* if max_tp_rate[0] is from MCS_GROUP max_prob_rate get selected from - * MCS_GROUP as well as CCK_GROUP rates do not allow aggregation */ - max_tp_group = mi->max_tp_rate[0] / MCS_GROUP_RATES; -- if((index / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) && -- (max_tp_group != MINSTREL_CCK_GROUP)) -+ if (minstrel_ht_is_legacy_group(index / MCS_GROUP_RATES) && -+ !minstrel_ht_is_legacy_group(max_tp_group)) - return; - - max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES; -@@ -476,13 +531,13 @@ minstrel_ht_set_best_prob_rate(struct mi - static void - minstrel_ht_assign_best_tp_rates(struct minstrel_ht_sta *mi, - u16 tmp_mcs_tp_rate[MAX_THR_RATES], -- u16 tmp_cck_tp_rate[MAX_THR_RATES]) -+ u16 tmp_legacy_tp_rate[MAX_THR_RATES]) - { - unsigned int tmp_group, tmp_idx, tmp_cck_tp, tmp_mcs_tp, tmp_prob; - int i; - -- tmp_group = tmp_cck_tp_rate[0] / MCS_GROUP_RATES; -- tmp_idx = tmp_cck_tp_rate[0] % MCS_GROUP_RATES; -+ tmp_group = tmp_legacy_tp_rate[0] / MCS_GROUP_RATES; -+ tmp_idx = tmp_legacy_tp_rate[0] % MCS_GROUP_RATES; - tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; - tmp_cck_tp = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); - -@@ -493,7 +548,7 @@ minstrel_ht_assign_best_tp_rates(struct - - if (tmp_cck_tp > tmp_mcs_tp) { - for(i = 0; i < MAX_THR_RATES; i++) { -- minstrel_ht_sort_best_tp_rates(mi, tmp_cck_tp_rate[i], -+ minstrel_ht_sort_best_tp_rates(mi, tmp_legacy_tp_rate[i], - tmp_mcs_tp_rate); - } - } -@@ -511,6 +566,9 @@ minstrel_ht_prob_rate_reduce_streams(str - int tmp_max_streams, group, tmp_idx, tmp_prob; - int tmp_tp = 0; - -+ if (!mi->sta->ht_cap.ht_supported) -+ return; -+ - tmp_max_streams = minstrel_mcs_groups[mi->max_tp_rate[0] / - MCS_GROUP_RATES].streams; - for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { -@@ -675,7 +733,8 @@ minstrel_ht_update_stats(struct minstrel - struct minstrel_rate_stats *mrs; - int group, i, j, cur_prob; - u16 tmp_mcs_tp_rate[MAX_THR_RATES], tmp_group_tp_rate[MAX_THR_RATES]; -- u16 tmp_cck_tp_rate[MAX_THR_RATES], index; -+ u16 tmp_legacy_tp_rate[MAX_THR_RATES], index; -+ bool ht_supported = mi->sta->ht_cap.ht_supported; - - mi->sample_mode = MINSTREL_SAMPLE_IDLE; - -@@ -704,21 +763,29 @@ minstrel_ht_update_stats(struct minstrel - mi->sample_count = 0; - - memset(tmp_mcs_tp_rate, 0, sizeof(tmp_mcs_tp_rate)); -- memset(tmp_cck_tp_rate, 0, sizeof(tmp_cck_tp_rate)); -+ memset(tmp_legacy_tp_rate, 0, sizeof(tmp_legacy_tp_rate)); - if (mi->supported[MINSTREL_CCK_GROUP]) -- for (j = 0; j < ARRAY_SIZE(tmp_cck_tp_rate); j++) -- tmp_cck_tp_rate[j] = MINSTREL_CCK_GROUP * MCS_GROUP_RATES; -+ for (j = 0; j < ARRAY_SIZE(tmp_legacy_tp_rate); j++) -+ tmp_legacy_tp_rate[j] = MINSTREL_CCK_GROUP * MCS_GROUP_RATES; -+ else if (mi->supported[MINSTREL_OFDM_GROUP]) -+ for (j = 0; j < ARRAY_SIZE(tmp_legacy_tp_rate); j++) -+ tmp_legacy_tp_rate[j] = MINSTREL_OFDM_GROUP * MCS_GROUP_RATES; - - if (mi->supported[MINSTREL_VHT_GROUP_0]) - index = MINSTREL_VHT_GROUP_0 * MCS_GROUP_RATES; -- else -+ else if (ht_supported) - index = MINSTREL_HT_GROUP_0 * MCS_GROUP_RATES; -+ else if (mi->supported[MINSTREL_CCK_GROUP]) -+ index = MINSTREL_CCK_GROUP * MCS_GROUP_RATES; -+ else -+ index = MINSTREL_OFDM_GROUP * MCS_GROUP_RATES; - - for (j = 0; j < ARRAY_SIZE(tmp_mcs_tp_rate); j++) - tmp_mcs_tp_rate[j] = index; - - /* Find best rate sets within all MCS groups*/ - for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { -+ u16 *tp_rate = tmp_mcs_tp_rate; - - mg = &mi->groups[group]; - if (!mi->supported[group]) -@@ -730,6 +797,9 @@ minstrel_ht_update_stats(struct minstrel - for(j = 0; j < MAX_THR_RATES; j++) - tmp_group_tp_rate[j] = MCS_GROUP_RATES * group; - -+ if (group == MINSTREL_CCK_GROUP && ht_supported) -+ tp_rate = tmp_legacy_tp_rate; -+ - for (i = 0; i < MCS_GROUP_RATES; i++) { - if (!(mi->supported[group] & BIT(i))) - continue; -@@ -745,13 +815,7 @@ minstrel_ht_update_stats(struct minstrel - continue; - - /* Find max throughput rate set */ -- if (group != MINSTREL_CCK_GROUP) { -- minstrel_ht_sort_best_tp_rates(mi, index, -- tmp_mcs_tp_rate); -- } else if (group == MINSTREL_CCK_GROUP) { -- minstrel_ht_sort_best_tp_rates(mi, index, -- tmp_cck_tp_rate); -- } -+ minstrel_ht_sort_best_tp_rates(mi, index, tp_rate); - - /* Find max throughput rate set within a group */ - minstrel_ht_sort_best_tp_rates(mi, index, -@@ -766,7 +830,8 @@ minstrel_ht_update_stats(struct minstrel - } - - /* Assign new rate set per sta */ -- minstrel_ht_assign_best_tp_rates(mi, tmp_mcs_tp_rate, tmp_cck_tp_rate); -+ minstrel_ht_assign_best_tp_rates(mi, tmp_mcs_tp_rate, -+ tmp_legacy_tp_rate); - memcpy(mi->max_tp_rate, tmp_mcs_tp_rate, sizeof(mi->max_tp_rate)); - - /* Try to increase robustness of max_prob_rate*/ -@@ -795,8 +860,11 @@ minstrel_ht_update_stats(struct minstrel - } - - static bool --minstrel_ht_txstat_valid(struct minstrel_priv *mp, struct ieee80211_tx_rate *rate) -+minstrel_ht_txstat_valid(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, -+ struct ieee80211_tx_rate *rate) - { -+ int i; -+ - if (rate->idx < 0) - return false; - -@@ -807,10 +875,15 @@ minstrel_ht_txstat_valid(struct minstrel - rate->flags & IEEE80211_TX_RC_VHT_MCS) - return true; - -- return rate->idx == mp->cck_rates[0] || -- rate->idx == mp->cck_rates[1] || -- rate->idx == mp->cck_rates[2] || -- rate->idx == mp->cck_rates[3]; -+ for (i = 0; i < ARRAY_SIZE(mp->cck_rates); i++) -+ if (rate->idx == mp->cck_rates[i]) -+ return true; -+ -+ for (i = 0; i < ARRAY_SIZE(mp->ofdm_rates[0]); i++) -+ if (rate->idx == mp->ofdm_rates[mi->band][i]) -+ return true; -+ -+ return false; - } - - static void -@@ -897,11 +970,6 @@ minstrel_ht_tx_status(void *priv, struct - bool sample_status = false; - int i; - -- if (!msp->is_ht) -- return mac80211_minstrel.tx_status_ext(priv, sband, -- &msp->legacy, st); -- -- - /* This packet was aggregated but doesn't carry status info */ - if ((info->flags & IEEE80211_TX_CTL_AMPDU) && - !(info->flags & IEEE80211_TX_STAT_AMPDU)) -@@ -930,10 +998,10 @@ minstrel_ht_tx_status(void *priv, struct - if (mi->sample_mode != MINSTREL_SAMPLE_IDLE) - rate_sample = minstrel_get_ratestats(mi, mi->sample_rate); - -- last = !minstrel_ht_txstat_valid(mp, &ar[0]); -+ last = !minstrel_ht_txstat_valid(mp, mi, &ar[0]); - for (i = 0; !last; i++) { - last = (i == IEEE80211_TX_MAX_RATES - 1) || -- !minstrel_ht_txstat_valid(mp, &ar[i + 1]); -+ !minstrel_ht_txstat_valid(mp, mi, &ar[i + 1]); - - rate = minstrel_ht_get_stats(mp, mi, &ar[i]); - if (rate == rate_sample) -@@ -1031,7 +1099,7 @@ minstrel_calc_retransmit(struct minstrel - ctime += (t_slot * cw) >> 1; - cw = min((cw << 1) | 1, mp->cw_max); - -- if (index / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) { -+ if (minstrel_ht_is_legacy_group(index / MCS_GROUP_RATES)) { - overhead = mi->overhead_legacy; - overhead_rtscts = mi->overhead_legacy_rtscts; - } else { -@@ -1064,7 +1132,8 @@ static void - minstrel_ht_set_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, - struct ieee80211_sta_rates *ratetbl, int offset, int index) - { -- const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; -+ int group_idx = index / MCS_GROUP_RATES; -+ const struct mcs_group *group = &minstrel_mcs_groups[group_idx]; - struct minstrel_rate_stats *mrs; - u8 idx; - u16 flags = group->flags; -@@ -1083,13 +1152,17 @@ minstrel_ht_set_rate(struct minstrel_pri - ratetbl->rate[offset].count_rts = mrs->retry_count_rtscts; - } - -- if (index / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) -+ index %= MCS_GROUP_RATES; -+ if (group_idx == MINSTREL_CCK_GROUP) - idx = mp->cck_rates[index % ARRAY_SIZE(mp->cck_rates)]; -+ else if (group_idx == MINSTREL_OFDM_GROUP) -+ idx = mp->ofdm_rates[mi->band][index % -+ ARRAY_SIZE(mp->ofdm_rates[0])]; - else if (flags & IEEE80211_TX_RC_VHT_MCS) - idx = ((group->streams - 1) << 4) | -- ((index % MCS_GROUP_RATES) & 0xF); -+ (index & 0xF); - else -- idx = index % MCS_GROUP_RATES + (group->streams - 1) * 8; -+ idx = index + (group->streams - 1) * 8; - - /* enable RTS/CTS if needed: - * - if station is in dynamic SMPS (and streams > 1) -@@ -1304,11 +1377,8 @@ minstrel_ht_get_rate(void *priv, struct - struct minstrel_priv *mp = priv; - int sample_idx; - -- if (!msp->is_ht) -- return mac80211_minstrel.get_rate(priv, sta, &msp->legacy, txrc); -- - if (!(info->flags & IEEE80211_TX_CTL_AMPDU) && -- mi->max_prob_rate / MCS_GROUP_RATES != MINSTREL_CCK_GROUP) -+ !minstrel_ht_is_legacy_group(mi->max_prob_rate / MCS_GROUP_RATES)) - minstrel_aggr_check(sta, txrc->skb); - - info->flags |= mi->tx_flags; -@@ -1349,6 +1419,9 @@ minstrel_ht_get_rate(void *priv, struct - if (sample_group == &minstrel_mcs_groups[MINSTREL_CCK_GROUP]) { - int idx = sample_idx % ARRAY_SIZE(mp->cck_rates); - rate->idx = mp->cck_rates[idx]; -+ } else if (sample_group == &minstrel_mcs_groups[MINSTREL_OFDM_GROUP]) { -+ int idx = sample_idx % ARRAY_SIZE(mp->ofdm_rates[0]); -+ rate->idx = mp->ofdm_rates[mi->band][idx]; - } else if (sample_group->flags & IEEE80211_TX_RC_VHT_MCS) { - ieee80211_rate_set_vht(rate, sample_idx % MCS_GROUP_RATES, - sample_group->streams); -@@ -1369,11 +1442,13 @@ minstrel_ht_update_cck(struct minstrel_p - if (sband->band != NL80211_BAND_2GHZ) - return; - -- if (!ieee80211_hw_check(mp->hw, SUPPORTS_HT_CCK_RATES)) -+ if (sta->ht_cap.ht_supported && -+ !ieee80211_hw_check(mp->hw, SUPPORTS_HT_CCK_RATES)) - return; - - for (i = 0; i < 4; i++) { -- if (!rate_supported(sta, sband->band, mp->cck_rates[i])) -+ if (mp->cck_rates[i] == 0xff || -+ !rate_supported(sta, sband->band, mp->cck_rates[i])) - continue; - - mi->supported[MINSTREL_CCK_GROUP] |= BIT(i); -@@ -1383,9 +1458,30 @@ minstrel_ht_update_cck(struct minstrel_p - } - - static void -+minstrel_ht_update_ofdm(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, -+ struct ieee80211_supported_band *sband, -+ struct ieee80211_sta *sta) -+{ -+ const u8 *rates; -+ int i; -+ -+ if (sta->ht_cap.ht_supported) -+ return; -+ -+ rates = mp->ofdm_rates[sband->band]; -+ for (i = 0; i < ARRAY_SIZE(mp->ofdm_rates[0]); i++) { -+ if (rates[i] == 0xff || -+ !rate_supported(sta, sband->band, rates[i])) -+ continue; -+ -+ mi->supported[MINSTREL_OFDM_GROUP] |= BIT(i); -+ } -+} -+ -+static void - minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, - struct cfg80211_chan_def *chandef, -- struct ieee80211_sta *sta, void *priv_sta) -+ struct ieee80211_sta *sta, void *priv_sta) - { - struct minstrel_priv *mp = priv; - struct minstrel_ht_sta_priv *msp = priv_sta; -@@ -1401,10 +1497,6 @@ minstrel_ht_update_caps(void *priv, stru - int stbc; - int i; - -- /* fall back to the old minstrel for legacy stations */ -- if (!sta->ht_cap.ht_supported) -- goto use_legacy; -- - BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) != MINSTREL_GROUPS_NB); - - if (vht_cap->vht_supported) -@@ -1412,10 +1504,10 @@ minstrel_ht_update_caps(void *priv, stru - else - use_vht = 0; - -- msp->is_ht = true; - memset(mi, 0, sizeof(*mi)); - - mi->sta = sta; -+ mi->band = sband->band; - mi->last_stats_update = jiffies; - - ack_dur = ieee80211_frame_duration(sband->band, 10, 60, 1, 1, 0); -@@ -1464,10 +1556,8 @@ minstrel_ht_update_caps(void *priv, stru - int bw, nss; - - mi->supported[i] = 0; -- if (i == MINSTREL_CCK_GROUP) { -- minstrel_ht_update_cck(mp, mi, sband, sta); -+ if (minstrel_ht_is_legacy_group(i)) - continue; -- } - - if (gflags & IEEE80211_TX_RC_SHORT_GI) { - if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) { -@@ -1528,22 +1618,12 @@ minstrel_ht_update_caps(void *priv, stru - n_supported++; - } - -- if (!n_supported) -- goto use_legacy; -+ minstrel_ht_update_cck(mp, mi, sband, sta); -+ minstrel_ht_update_ofdm(mp, mi, sband, sta); - - /* create an initial rate table with the lowest supported rates */ - minstrel_ht_update_stats(mp, mi, true); - minstrel_ht_update_rates(mp, mi); -- -- return; -- --use_legacy: -- msp->is_ht = false; -- memset(&msp->legacy, 0, sizeof(msp->legacy)); -- msp->legacy.r = msp->ratelist; -- msp->legacy.sample_table = msp->sample_table; -- return mac80211_minstrel.rate_init(priv, sband, chandef, sta, -- &msp->legacy); - } - - static void -@@ -1611,40 +1691,70 @@ minstrel_ht_free_sta(void *priv, struct - } - - static void --minstrel_ht_init_cck_rates(struct minstrel_priv *mp) -+minstrel_ht_fill_rate_array(u8 *dest, struct ieee80211_supported_band *sband, -+ const s16 *bitrates, int n_rates, u32 rate_flags) - { -- static const int bitrates[4] = { 10, 20, 55, 110 }; -- struct ieee80211_supported_band *sband; -- u32 rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef); - int i, j; - -- sband = mp->hw->wiphy->bands[NL80211_BAND_2GHZ]; -- if (!sband) -- return; -- - for (i = 0; i < sband->n_bitrates; i++) { - struct ieee80211_rate *rate = &sband->bitrates[i]; - -- if (rate->flags & IEEE80211_RATE_ERP_G) -- continue; -- - if ((rate_flags & sband->bitrates[i].flags) != rate_flags) - continue; - -- for (j = 0; j < ARRAY_SIZE(bitrates); j++) { -+ for (j = 0; j < n_rates; j++) { - if (rate->bitrate != bitrates[j]) - continue; - -- mp->cck_rates[j] = i; -+ dest[j] = i; - break; - } - } - } - -+static void -+minstrel_ht_init_cck_rates(struct minstrel_priv *mp) -+{ -+ static const s16 bitrates[4] = { 10, 20, 55, 110 }; -+ struct ieee80211_supported_band *sband; -+ u32 rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef); -+ -+ memset(mp->cck_rates, 0xff, sizeof(mp->cck_rates)); -+ sband = mp->hw->wiphy->bands[NL80211_BAND_2GHZ]; -+ if (!sband) -+ return; -+ -+ BUILD_BUG_ON(ARRAY_SIZE(mp->cck_rates) != ARRAY_SIZE(bitrates)); -+ minstrel_ht_fill_rate_array(mp->cck_rates, sband, -+ minstrel_cck_bitrates, -+ ARRAY_SIZE(minstrel_cck_bitrates), -+ rate_flags); -+} -+ -+static void -+minstrel_ht_init_ofdm_rates(struct minstrel_priv *mp, enum nl80211_band band) -+{ -+ static const s16 bitrates[8] = { 60, 90, 120, 180, 240, 360, 480, 540 }; -+ struct ieee80211_supported_band *sband; -+ u32 rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef); -+ -+ memset(mp->ofdm_rates[band], 0xff, sizeof(mp->ofdm_rates[band])); -+ sband = mp->hw->wiphy->bands[band]; -+ if (!sband) -+ return; -+ -+ BUILD_BUG_ON(ARRAY_SIZE(mp->ofdm_rates[band]) != ARRAY_SIZE(bitrates)); -+ minstrel_ht_fill_rate_array(mp->ofdm_rates[band], sband, -+ minstrel_ofdm_bitrates, -+ ARRAY_SIZE(minstrel_ofdm_bitrates), -+ rate_flags); -+} -+ - static void * - minstrel_ht_alloc(struct ieee80211_hw *hw) - { - struct minstrel_priv *mp; -+ int i; - - mp = kzalloc(sizeof(struct minstrel_priv), GFP_ATOMIC); - if (!mp) -@@ -1681,6 +1791,8 @@ minstrel_ht_alloc(struct ieee80211_hw *h - mp->new_avg = true; - - minstrel_ht_init_cck_rates(mp); -+ for (i = 0; i < ARRAY_SIZE(mp->hw->wiphy->bands); i++) -+ minstrel_ht_init_ofdm_rates(mp, i); - - return mp; - } -@@ -1713,9 +1825,6 @@ static u32 minstrel_ht_get_expected_thro - struct minstrel_ht_sta *mi = &msp->ht; - int i, j, prob, tp_avg; - -- if (!msp->is_ht) -- return mac80211_minstrel.get_expected_throughput(priv_sta); -- - i = mi->max_tp_rate[0] / MCS_GROUP_RATES; - j = mi->max_tp_rate[0] % MCS_GROUP_RATES; - prob = mi->groups[i].rates[j].prob_avg; ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -18,14 +18,15 @@ - MINSTREL_HT_STREAM_GROUPS) - #define MINSTREL_VHT_GROUPS_NB (MINSTREL_MAX_STREAMS * \ - MINSTREL_VHT_STREAM_GROUPS) --#define MINSTREL_CCK_GROUPS_NB 1 -+#define MINSTREL_LEGACY_GROUPS_NB 2 - #define MINSTREL_GROUPS_NB (MINSTREL_HT_GROUPS_NB + \ - MINSTREL_VHT_GROUPS_NB + \ -- MINSTREL_CCK_GROUPS_NB) -+ MINSTREL_LEGACY_GROUPS_NB) - - #define MINSTREL_HT_GROUP_0 0 - #define MINSTREL_CCK_GROUP (MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB) --#define MINSTREL_VHT_GROUP_0 (MINSTREL_CCK_GROUP + 1) -+#define MINSTREL_OFDM_GROUP (MINSTREL_CCK_GROUP + 1) -+#define MINSTREL_VHT_GROUP_0 (MINSTREL_OFDM_GROUP + 1) - - #define MCS_GROUP_RATES 10 - -@@ -37,6 +38,8 @@ struct mcs_group { - u16 duration[MCS_GROUP_RATES]; - }; - -+extern const s16 minstrel_cck_bitrates[4]; -+extern const s16 minstrel_ofdm_bitrates[8]; - extern const struct mcs_group minstrel_mcs_groups[]; - - struct minstrel_mcs_group_data { -@@ -99,6 +102,8 @@ struct minstrel_ht_sta { - /* current MCS group to be sampled */ - u8 sample_group; - -+ u8 band; -+ - /* Bitfield of supported MCS rates of all groups */ - u16 supported[MINSTREL_GROUPS_NB]; - -@@ -107,13 +112,9 @@ struct minstrel_ht_sta { - }; - - struct minstrel_ht_sta_priv { -- union { -- struct minstrel_ht_sta ht; -- struct minstrel_sta_info legacy; -- }; -+ struct minstrel_ht_sta ht; - void *ratelist; - void *sample_table; -- bool is_ht; - }; - - void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); ---- a/net/mac80211/rc80211_minstrel_ht_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c -@@ -52,7 +52,6 @@ minstrel_ht_stats_dump(struct minstrel_h - - for (j = 0; j < MCS_GROUP_RATES; j++) { - struct minstrel_rate_stats *mrs = &mi->groups[i].rates[j]; -- static const int bitrates[4] = { 10, 20, 55, 110 }; - int idx = i * MCS_GROUP_RATES + j; - unsigned int duration; - -@@ -67,6 +66,9 @@ minstrel_ht_stats_dump(struct minstrel_h - p += sprintf(p, "VHT%c0 ", htmode); - p += sprintf(p, "%cGI ", gimode); - p += sprintf(p, "%d ", mg->streams); -+ } else if (i == MINSTREL_OFDM_GROUP) { -+ p += sprintf(p, "OFDM "); -+ p += sprintf(p, "1 "); - } else { - p += sprintf(p, "CCK "); - p += sprintf(p, "%cP ", j < 4 ? 'L' : 'S'); -@@ -84,7 +86,12 @@ minstrel_ht_stats_dump(struct minstrel_h - } else if (gflags & IEEE80211_TX_RC_VHT_MCS) { - p += sprintf(p, " MCS%-1u/%1u", j, mg->streams); - } else { -- int r = bitrates[j % 4]; -+ int r; -+ -+ if (i == MINSTREL_OFDM_GROUP) -+ r = minstrel_ofdm_bitrates[j % 8]; -+ else -+ r = minstrel_cck_bitrates[j % 4]; - - p += sprintf(p, " %2u.%1uM", r / 10, r % 10); - } -@@ -124,16 +131,8 @@ minstrel_ht_stats_open(struct inode *ino - struct minstrel_ht_sta *mi = &msp->ht; - struct minstrel_debugfs_info *ms; - unsigned int i; -- int ret; - char *p; - -- if (!msp->is_ht) { -- inode->i_private = &msp->legacy; -- ret = minstrel_stats_open(inode, file); -- inode->i_private = msp; -- return ret; -- } -- - ms = kmalloc(32768, GFP_KERNEL); - if (!ms) - return -ENOMEM; -@@ -199,7 +198,6 @@ minstrel_ht_stats_csv_dump(struct minstr - - for (j = 0; j < MCS_GROUP_RATES; j++) { - struct minstrel_rate_stats *mrs = &mi->groups[i].rates[j]; -- static const int bitrates[4] = { 10, 20, 55, 110 }; - int idx = i * MCS_GROUP_RATES + j; - unsigned int duration; - -@@ -214,6 +212,8 @@ minstrel_ht_stats_csv_dump(struct minstr - p += sprintf(p, "VHT%c0,", htmode); - p += sprintf(p, "%cGI,", gimode); - p += sprintf(p, "%d,", mg->streams); -+ } else if (i == MINSTREL_OFDM_GROUP) { -+ p += sprintf(p, "OFDM,,1,"); - } else { - p += sprintf(p, "CCK,"); - p += sprintf(p, "%cP,", j < 4 ? 'L' : 'S'); -@@ -231,7 +231,13 @@ minstrel_ht_stats_csv_dump(struct minstr - } else if (gflags & IEEE80211_TX_RC_VHT_MCS) { - p += sprintf(p, ",MCS%-1u/%1u,", j, mg->streams); - } else { -- int r = bitrates[j % 4]; -+ int r; -+ -+ if (i == MINSTREL_OFDM_GROUP) -+ r = minstrel_ofdm_bitrates[j % 8]; -+ else -+ r = minstrel_cck_bitrates[j % 4]; -+ - p += sprintf(p, ",%2u.%1uM,", r / 10, r % 10); - } - -@@ -274,18 +280,9 @@ minstrel_ht_stats_csv_open(struct inode - struct minstrel_ht_sta *mi = &msp->ht; - struct minstrel_debugfs_info *ms; - unsigned int i; -- int ret; - char *p; - -- if (!msp->is_ht) { -- inode->i_private = &msp->legacy; -- ret = minstrel_stats_csv_open(inode, file); -- inode->i_private = msp; -- return ret; -- } -- - ms = kmalloc(32768, GFP_KERNEL); -- - if (!ms) - return -ENOMEM; - diff --git a/package/kernel/mac80211/patches/subsys/339-mac80211-remove-legacy-minstrel-rate-control.patch b/package/kernel/mac80211/patches/subsys/339-mac80211-remove-legacy-minstrel-rate-control.patch deleted file mode 100644 index 1cab2eb194..0000000000 --- a/package/kernel/mac80211/patches/subsys/339-mac80211-remove-legacy-minstrel-rate-control.patch +++ /dev/null @@ -1,1328 +0,0 @@ -From: Felix Fietkau -Date: Sat, 26 Dec 2020 14:23:47 +0100 -Subject: [PATCH] mac80211: remove legacy minstrel rate control - -Now that minstrel_ht supports legacy rates, it is no longer needed - -Signed-off-by: Felix Fietkau ---- - delete mode 100644 net/mac80211/rc80211_minstrel.c - delete mode 100644 net/mac80211/rc80211_minstrel.h - delete mode 100644 net/mac80211/rc80211_minstrel_debugfs.c - ---- a/net/mac80211/Makefile -+++ b/net/mac80211/Makefile -@@ -56,11 +56,9 @@ mac80211-$(CONFIG_PM) += pm.o - CFLAGS_trace.o := -I$(src) - - rc80211_minstrel-y := \ -- rc80211_minstrel.o \ - rc80211_minstrel_ht.o - - rc80211_minstrel-$(CPTCFG_MAC80211_DEBUGFS) += \ -- rc80211_minstrel_debugfs.o \ - rc80211_minstrel_ht_debugfs.o - - mac80211-$(CPTCFG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y) ---- a/net/mac80211/rc80211_minstrel.c -+++ /dev/null -@@ -1,574 +0,0 @@ --/* -- * Copyright (C) 2008 Felix Fietkau -- * -- * 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. -- * -- * Based on minstrel.c: -- * Copyright (C) 2005-2007 Derek Smithies -- * Sponsored by Indranet Technologies Ltd -- * -- * Based on sample.c: -- * Copyright (c) 2005 John Bicket -- * All rights reserved. -- * -- * Redistribution and use in source and binary forms, with or without -- * modification, are permitted provided that the following conditions -- * are met: -- * 1. Redistributions of source code must retain the above copyright -- * notice, this list of conditions and the following disclaimer, -- * without modification. -- * 2. Redistributions in binary form must reproduce at minimum a disclaimer -- * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any -- * redistribution must be conditioned upon including a substantially -- * similar Disclaimer requirement for further binary redistribution. -- * 3. Neither the names of the above-listed copyright holders nor the names -- * of any contributors may be used to endorse or promote products derived -- * from this software without specific prior written permission. -- * -- * Alternatively, this software may be distributed under the terms of the -- * GNU General Public License ("GPL") version 2 as published by the Free -- * Software Foundation. -- * -- * NO WARRANTY -- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY -- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -- * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, -- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -- * THE POSSIBILITY OF SUCH DAMAGES. -- */ --#include --#include --#include --#include --#include --#include --#include --#include --#include "rate.h" --#include "rc80211_minstrel.h" -- --#define SAMPLE_TBL(_mi, _idx, _col) \ -- _mi->sample_table[(_idx * SAMPLE_COLUMNS) + _col] -- --/* convert mac80211 rate index to local array index */ --static inline int --rix_to_ndx(struct minstrel_sta_info *mi, int rix) --{ -- int i = rix; -- for (i = rix; i >= 0; i--) -- if (mi->r[i].rix == rix) -- break; -- return i; --} -- --/* return current EMWA throughput */ --int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_avg) --{ -- int usecs; -- -- usecs = mr->perfect_tx_time; -- if (!usecs) -- usecs = 1000000; -- -- /* reset thr. below 10% success */ -- if (mr->stats.prob_avg < MINSTREL_FRAC(10, 100)) -- return 0; -- -- if (prob_avg > MINSTREL_FRAC(90, 100)) -- return MINSTREL_TRUNC(100000 * (MINSTREL_FRAC(90, 100) / usecs)); -- else -- return MINSTREL_TRUNC(100000 * (prob_avg / usecs)); --} -- --/* find & sort topmost throughput rates */ --static inline void --minstrel_sort_best_tp_rates(struct minstrel_sta_info *mi, int i, u8 *tp_list) --{ -- int j; -- struct minstrel_rate_stats *tmp_mrs; -- struct minstrel_rate_stats *cur_mrs = &mi->r[i].stats; -- -- for (j = MAX_THR_RATES; j > 0; --j) { -- tmp_mrs = &mi->r[tp_list[j - 1]].stats; -- if (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_avg) <= -- minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_avg)) -- break; -- } -- -- if (j < MAX_THR_RATES - 1) -- memmove(&tp_list[j + 1], &tp_list[j], MAX_THR_RATES - (j + 1)); -- if (j < MAX_THR_RATES) -- tp_list[j] = i; --} -- --static void --minstrel_set_rate(struct minstrel_sta_info *mi, struct ieee80211_sta_rates *ratetbl, -- int offset, int idx) --{ -- struct minstrel_rate *r = &mi->r[idx]; -- -- ratetbl->rate[offset].idx = r->rix; -- ratetbl->rate[offset].count = r->adjusted_retry_count; -- ratetbl->rate[offset].count_cts = r->retry_count_cts; -- ratetbl->rate[offset].count_rts = r->stats.retry_count_rtscts; --} -- --static void --minstrel_update_rates(struct minstrel_priv *mp, struct minstrel_sta_info *mi) --{ -- struct ieee80211_sta_rates *ratetbl; -- int i = 0; -- -- ratetbl = kzalloc(sizeof(*ratetbl), GFP_ATOMIC); -- if (!ratetbl) -- return; -- -- /* Start with max_tp_rate */ -- minstrel_set_rate(mi, ratetbl, i++, mi->max_tp_rate[0]); -- -- if (mp->hw->max_rates >= 3) { -- /* At least 3 tx rates supported, use max_tp_rate2 next */ -- minstrel_set_rate(mi, ratetbl, i++, mi->max_tp_rate[1]); -- } -- -- if (mp->hw->max_rates >= 2) { -- /* At least 2 tx rates supported, use max_prob_rate next */ -- minstrel_set_rate(mi, ratetbl, i++, mi->max_prob_rate); -- } -- -- /* Use lowest rate last */ -- ratetbl->rate[i].idx = mi->lowest_rix; -- ratetbl->rate[i].count = mp->max_retry; -- ratetbl->rate[i].count_cts = mp->max_retry; -- ratetbl->rate[i].count_rts = mp->max_retry; -- -- rate_control_set_rates(mp->hw, mi->sta, ratetbl); --} -- --/* --* Recalculate statistics and counters of a given rate --*/ --void --minstrel_calc_rate_stats(struct minstrel_priv *mp, -- struct minstrel_rate_stats *mrs) --{ -- unsigned int cur_prob; -- -- if (unlikely(mrs->attempts > 0)) { -- mrs->sample_skipped = 0; -- cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); -- if (mp->new_avg) { -- minstrel_filter_avg_add(&mrs->prob_avg, -- &mrs->prob_avg_1, cur_prob); -- } else if (unlikely(!mrs->att_hist)) { -- mrs->prob_avg = cur_prob; -- } else { -- /*update exponential weighted moving avarage */ -- mrs->prob_avg = minstrel_ewma(mrs->prob_avg, -- cur_prob, -- EWMA_LEVEL); -- } -- mrs->att_hist += mrs->attempts; -- mrs->succ_hist += mrs->success; -- } else { -- mrs->sample_skipped++; -- } -- -- mrs->last_success = mrs->success; -- mrs->last_attempts = mrs->attempts; -- mrs->success = 0; -- mrs->attempts = 0; --} -- --static void --minstrel_update_stats(struct minstrel_priv *mp, struct minstrel_sta_info *mi) --{ -- u8 tmp_tp_rate[MAX_THR_RATES]; -- u8 tmp_prob_rate = 0; -- int i, tmp_cur_tp, tmp_prob_tp; -- -- for (i = 0; i < MAX_THR_RATES; i++) -- tmp_tp_rate[i] = 0; -- -- for (i = 0; i < mi->n_rates; i++) { -- struct minstrel_rate *mr = &mi->r[i]; -- struct minstrel_rate_stats *mrs = &mi->r[i].stats; -- struct minstrel_rate_stats *tmp_mrs = &mi->r[tmp_prob_rate].stats; -- -- /* Update statistics of success probability per rate */ -- minstrel_calc_rate_stats(mp, mrs); -- -- /* Sample less often below the 10% chance of success. -- * Sample less often above the 95% chance of success. */ -- if (mrs->prob_avg > MINSTREL_FRAC(95, 100) || -- mrs->prob_avg < MINSTREL_FRAC(10, 100)) { -- mr->adjusted_retry_count = mrs->retry_count >> 1; -- if (mr->adjusted_retry_count > 2) -- mr->adjusted_retry_count = 2; -- mr->sample_limit = 4; -- } else { -- mr->sample_limit = -1; -- mr->adjusted_retry_count = mrs->retry_count; -- } -- if (!mr->adjusted_retry_count) -- mr->adjusted_retry_count = 2; -- -- minstrel_sort_best_tp_rates(mi, i, tmp_tp_rate); -- -- /* To determine the most robust rate (max_prob_rate) used at -- * 3rd mmr stage we distinct between two cases: -- * (1) if any success probabilitiy >= 95%, out of those rates -- * choose the maximum throughput rate as max_prob_rate -- * (2) if all success probabilities < 95%, the rate with -- * highest success probability is chosen as max_prob_rate */ -- if (mrs->prob_avg >= MINSTREL_FRAC(95, 100)) { -- tmp_cur_tp = minstrel_get_tp_avg(mr, mrs->prob_avg); -- tmp_prob_tp = minstrel_get_tp_avg(&mi->r[tmp_prob_rate], -- tmp_mrs->prob_avg); -- if (tmp_cur_tp >= tmp_prob_tp) -- tmp_prob_rate = i; -- } else { -- if (mrs->prob_avg >= tmp_mrs->prob_avg) -- tmp_prob_rate = i; -- } -- } -- -- /* Assign the new rate set */ -- memcpy(mi->max_tp_rate, tmp_tp_rate, sizeof(mi->max_tp_rate)); -- mi->max_prob_rate = tmp_prob_rate; -- --#ifdef CPTCFG_MAC80211_DEBUGFS -- /* use fixed index if set */ -- if (mp->fixed_rate_idx != -1) { -- mi->max_tp_rate[0] = mp->fixed_rate_idx; -- mi->max_tp_rate[1] = mp->fixed_rate_idx; -- mi->max_prob_rate = mp->fixed_rate_idx; -- } --#endif -- -- /* Reset update timer */ -- mi->last_stats_update = jiffies; -- -- minstrel_update_rates(mp, mi); --} -- --static void --minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband, -- void *priv_sta, struct ieee80211_tx_status *st) --{ -- struct ieee80211_tx_info *info = st->info; -- struct minstrel_priv *mp = priv; -- struct minstrel_sta_info *mi = priv_sta; -- struct ieee80211_tx_rate *ar = info->status.rates; -- int i, ndx; -- int success; -- -- success = !!(info->flags & IEEE80211_TX_STAT_ACK); -- -- for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { -- if (ar[i].idx < 0 || !ar[i].count) -- break; -- -- ndx = rix_to_ndx(mi, ar[i].idx); -- if (ndx < 0) -- continue; -- -- mi->r[ndx].stats.attempts += ar[i].count; -- -- if ((i != IEEE80211_TX_MAX_RATES - 1) && (ar[i + 1].idx < 0)) -- mi->r[ndx].stats.success += success; -- } -- -- if (time_after(jiffies, mi->last_stats_update + -- mp->update_interval / (mp->new_avg ? 2 : 1))) -- minstrel_update_stats(mp, mi); --} -- -- --static inline unsigned int --minstrel_get_retry_count(struct minstrel_rate *mr, -- struct ieee80211_tx_info *info) --{ -- u8 retry = mr->adjusted_retry_count; -- -- if (info->control.use_rts) -- retry = max_t(u8, 2, min(mr->stats.retry_count_rtscts, retry)); -- else if (info->control.use_cts_prot) -- retry = max_t(u8, 2, min(mr->retry_count_cts, retry)); -- return retry; --} -- -- --static int --minstrel_get_next_sample(struct minstrel_sta_info *mi) --{ -- unsigned int sample_ndx; -- sample_ndx = SAMPLE_TBL(mi, mi->sample_row, mi->sample_column); -- mi->sample_row++; -- if ((int) mi->sample_row >= mi->n_rates) { -- mi->sample_row = 0; -- mi->sample_column++; -- if (mi->sample_column >= SAMPLE_COLUMNS) -- mi->sample_column = 0; -- } -- return sample_ndx; --} -- --static void --minstrel_get_rate(void *priv, struct ieee80211_sta *sta, -- void *priv_sta, struct ieee80211_tx_rate_control *txrc) --{ -- struct sk_buff *skb = txrc->skb; -- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -- struct minstrel_sta_info *mi = priv_sta; -- struct minstrel_priv *mp = priv; -- struct ieee80211_tx_rate *rate = &info->control.rates[0]; -- struct minstrel_rate *msr, *mr; -- unsigned int ndx; -- bool mrr_capable; -- bool prev_sample; -- int delta; -- int sampling_ratio; -- -- /* check multi-rate-retry capabilities & adjust lookaround_rate */ -- mrr_capable = mp->has_mrr && -- !txrc->rts && -- !txrc->bss_conf->use_cts_prot; -- if (mrr_capable) -- sampling_ratio = mp->lookaround_rate_mrr; -- else -- sampling_ratio = mp->lookaround_rate; -- -- /* increase sum packet counter */ -- mi->total_packets++; -- --#ifdef CPTCFG_MAC80211_DEBUGFS -- if (mp->fixed_rate_idx != -1) -- return; --#endif -- -- /* Don't use EAPOL frames for sampling on non-mrr hw */ -- if (mp->hw->max_rates == 1 && -- (info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) -- return; -- -- delta = (mi->total_packets * sampling_ratio / 100) - -- mi->sample_packets; -- -- /* delta < 0: no sampling required */ -- prev_sample = mi->prev_sample; -- mi->prev_sample = false; -- if (delta < 0 || (!mrr_capable && prev_sample)) -- return; -- -- if (mi->total_packets >= 10000) { -- mi->sample_packets = 0; -- mi->total_packets = 0; -- } else if (delta > mi->n_rates * 2) { -- /* With multi-rate retry, not every planned sample -- * attempt actually gets used, due to the way the retry -- * chain is set up - [max_tp,sample,prob,lowest] for -- * sample_rate < max_tp. -- * -- * If there's too much sampling backlog and the link -- * starts getting worse, minstrel would start bursting -- * out lots of sampling frames, which would result -- * in a large throughput loss. */ -- mi->sample_packets += (delta - mi->n_rates * 2); -- } -- -- /* get next random rate sample */ -- ndx = minstrel_get_next_sample(mi); -- msr = &mi->r[ndx]; -- mr = &mi->r[mi->max_tp_rate[0]]; -- -- /* Decide if direct ( 1st mrr stage) or indirect (2nd mrr stage) -- * rate sampling method should be used. -- * Respect such rates that are not sampled for 20 interations. -- */ -- if (msr->perfect_tx_time < mr->perfect_tx_time || -- msr->stats.sample_skipped >= 20) { -- if (!msr->sample_limit) -- return; -- -- mi->sample_packets++; -- if (msr->sample_limit > 0) -- msr->sample_limit--; -- } -- -- /* If we're not using MRR and the sampling rate already -- * has a probability of >95%, we shouldn't be attempting -- * to use it, as this only wastes precious airtime */ -- if (!mrr_capable && -- (mi->r[ndx].stats.prob_avg > MINSTREL_FRAC(95, 100))) -- return; -- -- mi->prev_sample = true; -- -- rate->idx = mi->r[ndx].rix; -- rate->count = minstrel_get_retry_count(&mi->r[ndx], info); -- info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; --} -- -- --static void --calc_rate_durations(enum nl80211_band band, -- struct minstrel_rate *d, -- struct ieee80211_rate *rate, -- struct cfg80211_chan_def *chandef) --{ -- int erp = !!(rate->flags & IEEE80211_RATE_ERP_G); -- int shift = ieee80211_chandef_get_shift(chandef); -- -- d->perfect_tx_time = ieee80211_frame_duration(band, 1200, -- DIV_ROUND_UP(rate->bitrate, 1 << shift), erp, 1, -- shift); -- d->ack_time = ieee80211_frame_duration(band, 10, -- DIV_ROUND_UP(rate->bitrate, 1 << shift), erp, 1, -- shift); --} -- --static void --init_sample_table(struct minstrel_sta_info *mi) --{ -- unsigned int i, col, new_idx; -- u8 rnd[8]; -- -- mi->sample_column = 0; -- mi->sample_row = 0; -- memset(mi->sample_table, 0xff, SAMPLE_COLUMNS * mi->n_rates); -- -- for (col = 0; col < SAMPLE_COLUMNS; col++) { -- prandom_bytes(rnd, sizeof(rnd)); -- for (i = 0; i < mi->n_rates; i++) { -- new_idx = (i + rnd[i & 7]) % mi->n_rates; -- while (SAMPLE_TBL(mi, new_idx, col) != 0xff) -- new_idx = (new_idx + 1) % mi->n_rates; -- -- SAMPLE_TBL(mi, new_idx, col) = i; -- } -- } --} -- --static void --minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband, -- struct cfg80211_chan_def *chandef, -- struct ieee80211_sta *sta, void *priv_sta) --{ -- struct minstrel_sta_info *mi = priv_sta; -- struct minstrel_priv *mp = priv; -- struct ieee80211_rate *ctl_rate; -- unsigned int i, n = 0; -- unsigned int t_slot = 9; /* FIXME: get real slot time */ -- u32 rate_flags; -- -- mi->sta = sta; -- mi->lowest_rix = rate_lowest_index(sband, sta); -- ctl_rate = &sband->bitrates[mi->lowest_rix]; -- mi->sp_ack_dur = ieee80211_frame_duration(sband->band, 10, -- ctl_rate->bitrate, -- !!(ctl_rate->flags & IEEE80211_RATE_ERP_G), 1, -- ieee80211_chandef_get_shift(chandef)); -- -- rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef); -- memset(mi->max_tp_rate, 0, sizeof(mi->max_tp_rate)); -- mi->max_prob_rate = 0; -- -- for (i = 0; i < sband->n_bitrates; i++) { -- struct minstrel_rate *mr = &mi->r[n]; -- struct minstrel_rate_stats *mrs = &mi->r[n].stats; -- unsigned int tx_time = 0, tx_time_cts = 0, tx_time_rtscts = 0; -- unsigned int tx_time_single; -- unsigned int cw = mp->cw_min; -- int shift; -- -- if (!rate_supported(sta, sband->band, i)) -- continue; -- if ((rate_flags & sband->bitrates[i].flags) != rate_flags) -- continue; -- -- n++; -- memset(mr, 0, sizeof(*mr)); -- memset(mrs, 0, sizeof(*mrs)); -- -- mr->rix = i; -- shift = ieee80211_chandef_get_shift(chandef); -- mr->bitrate = DIV_ROUND_UP(sband->bitrates[i].bitrate, -- (1 << shift) * 5); -- calc_rate_durations(sband->band, mr, &sband->bitrates[i], -- chandef); -- -- /* calculate maximum number of retransmissions before -- * fallback (based on maximum segment size) */ -- mr->sample_limit = -1; -- mrs->retry_count = 1; -- mr->retry_count_cts = 1; -- mrs->retry_count_rtscts = 1; -- tx_time = mr->perfect_tx_time + mi->sp_ack_dur; -- do { -- /* add one retransmission */ -- tx_time_single = mr->ack_time + mr->perfect_tx_time; -- -- /* contention window */ -- tx_time_single += (t_slot * cw) >> 1; -- cw = min((cw << 1) | 1, mp->cw_max); -- -- tx_time += tx_time_single; -- tx_time_cts += tx_time_single + mi->sp_ack_dur; -- tx_time_rtscts += tx_time_single + 2 * mi->sp_ack_dur; -- if ((tx_time_cts < mp->segment_size) && -- (mr->retry_count_cts < mp->max_retry)) -- mr->retry_count_cts++; -- if ((tx_time_rtscts < mp->segment_size) && -- (mrs->retry_count_rtscts < mp->max_retry)) -- mrs->retry_count_rtscts++; -- } while ((tx_time < mp->segment_size) && -- (++mr->stats.retry_count < mp->max_retry)); -- mr->adjusted_retry_count = mrs->retry_count; -- if (!(sband->bitrates[i].flags & IEEE80211_RATE_ERP_G)) -- mr->retry_count_cts = mrs->retry_count; -- } -- -- for (i = n; i < sband->n_bitrates; i++) { -- struct minstrel_rate *mr = &mi->r[i]; -- mr->rix = -1; -- } -- -- mi->n_rates = n; -- mi->last_stats_update = jiffies; -- -- init_sample_table(mi); -- minstrel_update_rates(mp, mi); --} -- --static u32 minstrel_get_expected_throughput(void *priv_sta) --{ -- struct minstrel_sta_info *mi = priv_sta; -- struct minstrel_rate_stats *tmp_mrs; -- int idx = mi->max_tp_rate[0]; -- int tmp_cur_tp; -- -- /* convert pkt per sec in kbps (1200 is the average pkt size used for -- * computing cur_tp -- */ -- tmp_mrs = &mi->r[idx].stats; -- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_avg) * 10; -- tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024; -- -- return tmp_cur_tp; --} -- --const struct rate_control_ops mac80211_minstrel = { -- .tx_status_ext = minstrel_tx_status, -- .get_rate = minstrel_get_rate, -- .rate_init = minstrel_rate_init, -- .get_expected_throughput = minstrel_get_expected_throughput, --}; ---- a/net/mac80211/rc80211_minstrel.h -+++ /dev/null -@@ -1,185 +0,0 @@ --/* SPDX-License-Identifier: GPL-2.0-only */ --/* -- * Copyright (C) 2008 Felix Fietkau -- */ -- --#ifndef __RC_MINSTREL_H --#define __RC_MINSTREL_H -- --#define EWMA_LEVEL 96 /* ewma weighting factor [/EWMA_DIV] */ --#define EWMA_DIV 128 --#define SAMPLE_COLUMNS 10 /* number of columns in sample table */ -- --/* scaled fraction values */ --#define MINSTREL_SCALE 12 --#define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / div) --#define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE) -- --/* number of highest throughput rates to consider*/ --#define MAX_THR_RATES 4 -- --/* -- * Coefficients for moving average with noise filter (period=16), -- * scaled by 10 bits -- * -- * a1 = exp(-pi * sqrt(2) / period) -- * coeff2 = 2 * a1 * cos(sqrt(2) * 2 * pi / period) -- * coeff3 = -sqr(a1) -- * coeff1 = 1 - coeff2 - coeff3 -- */ --#define MINSTREL_AVG_COEFF1 (MINSTREL_FRAC(1, 1) - \ -- MINSTREL_AVG_COEFF2 - \ -- MINSTREL_AVG_COEFF3) --#define MINSTREL_AVG_COEFF2 0x00001499 --#define MINSTREL_AVG_COEFF3 -0x0000092e -- --/* -- * Perform EWMA (Exponentially Weighted Moving Average) calculation -- */ --static inline int --minstrel_ewma(int old, int new, int weight) --{ -- int diff, incr; -- -- diff = new - old; -- incr = (EWMA_DIV - weight) * diff / EWMA_DIV; -- -- return old + incr; --} -- --static inline int minstrel_filter_avg_add(u16 *prev_1, u16 *prev_2, s32 in) --{ -- s32 out_1 = *prev_1; -- s32 out_2 = *prev_2; -- s32 val; -- -- if (!in) -- in += 1; -- -- if (!out_1) { -- val = out_1 = in; -- goto out; -- } -- -- val = MINSTREL_AVG_COEFF1 * in; -- val += MINSTREL_AVG_COEFF2 * out_1; -- val += MINSTREL_AVG_COEFF3 * out_2; -- val >>= MINSTREL_SCALE; -- -- if (val > 1 << MINSTREL_SCALE) -- val = 1 << MINSTREL_SCALE; -- if (val < 0) -- val = 1; -- --out: -- *prev_2 = out_1; -- *prev_1 = val; -- -- return val; --} -- --struct minstrel_rate_stats { -- /* current / last sampling period attempts/success counters */ -- u16 attempts, last_attempts; -- u16 success, last_success; -- -- /* total attempts/success counters */ -- u32 att_hist, succ_hist; -- -- /* prob_avg - moving average of prob */ -- u16 prob_avg; -- u16 prob_avg_1; -- -- /* maximum retry counts */ -- u8 retry_count; -- u8 retry_count_rtscts; -- -- u8 sample_skipped; -- bool retry_updated; --}; -- --struct minstrel_rate { -- int bitrate; -- -- s8 rix; -- u8 retry_count_cts; -- u8 adjusted_retry_count; -- -- unsigned int perfect_tx_time; -- unsigned int ack_time; -- -- int sample_limit; -- -- struct minstrel_rate_stats stats; --}; -- --struct minstrel_sta_info { -- struct ieee80211_sta *sta; -- -- unsigned long last_stats_update; -- unsigned int sp_ack_dur; -- unsigned int rate_avg; -- -- unsigned int lowest_rix; -- -- u8 max_tp_rate[MAX_THR_RATES]; -- u8 max_prob_rate; -- unsigned int total_packets; -- unsigned int sample_packets; -- -- unsigned int sample_row; -- unsigned int sample_column; -- -- int n_rates; -- struct minstrel_rate *r; -- bool prev_sample; -- -- /* sampling table */ -- u8 *sample_table; --}; -- --struct minstrel_priv { -- struct ieee80211_hw *hw; -- bool has_mrr; -- bool new_avg; -- u32 sample_switch; -- unsigned int cw_min; -- unsigned int cw_max; -- unsigned int max_retry; -- unsigned int segment_size; -- unsigned int update_interval; -- unsigned int lookaround_rate; -- unsigned int lookaround_rate_mrr; -- -- u8 cck_rates[4]; -- u8 ofdm_rates[NUM_NL80211_BANDS][8]; -- --#ifdef CPTCFG_MAC80211_DEBUGFS -- /* -- * enable fixed rate processing per RC -- * - write static index to debugfs:ieee80211/phyX/rc/fixed_rate_idx -- * - write -1 to enable RC processing again -- * - setting will be applied on next update -- */ -- u32 fixed_rate_idx; --#endif --}; -- --struct minstrel_debugfs_info { -- size_t len; -- char buf[]; --}; -- --extern const struct rate_control_ops mac80211_minstrel; --void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); -- --/* Recalculate success probabilities and counters for a given rate using EWMA */ --void minstrel_calc_rate_stats(struct minstrel_priv *mp, -- struct minstrel_rate_stats *mrs); --int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_avg); -- --/* debugfs */ --int minstrel_stats_open(struct inode *inode, struct file *file); --int minstrel_stats_csv_open(struct inode *inode, struct file *file); -- --#endif ---- a/net/mac80211/rc80211_minstrel_debugfs.c -+++ /dev/null -@@ -1,172 +0,0 @@ --/* -- * Copyright (C) 2008 Felix Fietkau -- * -- * 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. -- * -- * Based on minstrel.c: -- * Copyright (C) 2005-2007 Derek Smithies -- * Sponsored by Indranet Technologies Ltd -- * -- * Based on sample.c: -- * Copyright (c) 2005 John Bicket -- * All rights reserved. -- * -- * Redistribution and use in source and binary forms, with or without -- * modification, are permitted provided that the following conditions -- * are met: -- * 1. Redistributions of source code must retain the above copyright -- * notice, this list of conditions and the following disclaimer, -- * without modification. -- * 2. Redistributions in binary form must reproduce at minimum a disclaimer -- * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any -- * redistribution must be conditioned upon including a substantially -- * similar Disclaimer requirement for further binary redistribution. -- * 3. Neither the names of the above-listed copyright holders nor the names -- * of any contributors may be used to endorse or promote products derived -- * from this software without specific prior written permission. -- * -- * Alternatively, this software may be distributed under the terms of the -- * GNU General Public License ("GPL") version 2 as published by the Free -- * Software Foundation. -- * -- * NO WARRANTY -- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY -- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -- * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, -- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -- * THE POSSIBILITY OF SUCH DAMAGES. -- */ --#include --#include --#include --#include --#include --#include --#include --#include --#include "rc80211_minstrel.h" -- --int --minstrel_stats_open(struct inode *inode, struct file *file) --{ -- struct minstrel_sta_info *mi = inode->i_private; -- struct minstrel_debugfs_info *ms; -- unsigned int i, tp_max, tp_avg, eprob; -- char *p; -- -- ms = kmalloc(2048, GFP_KERNEL); -- if (!ms) -- return -ENOMEM; -- -- file->private_data = ms; -- p = ms->buf; -- p += sprintf(p, "\n"); -- p += sprintf(p, -- "best __________rate_________ ____statistics___ ____last_____ ______sum-of________\n"); -- p += sprintf(p, -- "rate [name idx airtime max_tp] [avg(tp) avg(prob)] [retry|suc|att] [#success | #attempts]\n"); -- -- for (i = 0; i < mi->n_rates; i++) { -- struct minstrel_rate *mr = &mi->r[i]; -- struct minstrel_rate_stats *mrs = &mi->r[i].stats; -- -- *(p++) = (i == mi->max_tp_rate[0]) ? 'A' : ' '; -- *(p++) = (i == mi->max_tp_rate[1]) ? 'B' : ' '; -- *(p++) = (i == mi->max_tp_rate[2]) ? 'C' : ' '; -- *(p++) = (i == mi->max_tp_rate[3]) ? 'D' : ' '; -- *(p++) = (i == mi->max_prob_rate) ? 'P' : ' '; -- -- p += sprintf(p, " %3u%s ", mr->bitrate / 2, -- (mr->bitrate & 1 ? ".5" : " ")); -- p += sprintf(p, "%3u ", i); -- p += sprintf(p, "%6u ", mr->perfect_tx_time); -- -- tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); -- tp_avg = minstrel_get_tp_avg(mr, mrs->prob_avg); -- eprob = MINSTREL_TRUNC(mrs->prob_avg * 1000); -- -- p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u" -- " %3u %3u %-3u " -- "%9llu %-9llu\n", -- tp_max / 10, tp_max % 10, -- tp_avg / 10, tp_avg % 10, -- eprob / 10, eprob % 10, -- mrs->retry_count, -- mrs->last_success, -- mrs->last_attempts, -- (unsigned long long)mrs->succ_hist, -- (unsigned long long)mrs->att_hist); -- } -- p += sprintf(p, "\nTotal packet count:: ideal %d " -- "lookaround %d\n\n", -- mi->total_packets - mi->sample_packets, -- mi->sample_packets); -- ms->len = p - ms->buf; -- -- WARN_ON(ms->len + sizeof(*ms) > 2048); -- -- return 0; --} -- --int --minstrel_stats_csv_open(struct inode *inode, struct file *file) --{ -- struct minstrel_sta_info *mi = inode->i_private; -- struct minstrel_debugfs_info *ms; -- unsigned int i, tp_max, tp_avg, eprob; -- char *p; -- -- ms = kmalloc(2048, GFP_KERNEL); -- if (!ms) -- return -ENOMEM; -- -- file->private_data = ms; -- p = ms->buf; -- -- for (i = 0; i < mi->n_rates; i++) { -- struct minstrel_rate *mr = &mi->r[i]; -- struct minstrel_rate_stats *mrs = &mi->r[i].stats; -- -- p += sprintf(p, "%s" ,((i == mi->max_tp_rate[0]) ? "A" : "")); -- p += sprintf(p, "%s" ,((i == mi->max_tp_rate[1]) ? "B" : "")); -- p += sprintf(p, "%s" ,((i == mi->max_tp_rate[2]) ? "C" : "")); -- p += sprintf(p, "%s" ,((i == mi->max_tp_rate[3]) ? "D" : "")); -- p += sprintf(p, "%s" ,((i == mi->max_prob_rate) ? "P" : "")); -- -- p += sprintf(p, ",%u%s", mr->bitrate / 2, -- (mr->bitrate & 1 ? ".5," : ",")); -- p += sprintf(p, "%u,", i); -- p += sprintf(p, "%u,",mr->perfect_tx_time); -- -- tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); -- tp_avg = minstrel_get_tp_avg(mr, mrs->prob_avg); -- eprob = MINSTREL_TRUNC(mrs->prob_avg * 1000); -- -- p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u,%u,%u," -- "%llu,%llu,%d,%d\n", -- tp_max / 10, tp_max % 10, -- tp_avg / 10, tp_avg % 10, -- eprob / 10, eprob % 10, -- mrs->retry_count, -- mrs->last_success, -- mrs->last_attempts, -- (unsigned long long)mrs->succ_hist, -- (unsigned long long)mrs->att_hist, -- mi->total_packets - mi->sample_packets, -- mi->sample_packets); -- -- } -- ms->len = p - ms->buf; -- -- WARN_ON(ms->len + sizeof(*ms) > 2048); -- -- return 0; --} ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -13,7 +13,6 @@ - #include - #include "rate.h" - #include "sta_info.h" --#include "rc80211_minstrel.h" - #include "rc80211_minstrel_ht.h" - - #define AVG_AMPDU_SIZE 16 -@@ -716,6 +715,83 @@ out: - mi->sample_mode = MINSTREL_SAMPLE_ACTIVE; - } - -+static inline int -+minstrel_ewma(int old, int new, int weight) -+{ -+ int diff, incr; -+ -+ diff = new - old; -+ incr = (EWMA_DIV - weight) * diff / EWMA_DIV; -+ -+ return old + incr; -+} -+ -+static inline int minstrel_filter_avg_add(u16 *prev_1, u16 *prev_2, s32 in) -+{ -+ s32 out_1 = *prev_1; -+ s32 out_2 = *prev_2; -+ s32 val; -+ -+ if (!in) -+ in += 1; -+ -+ if (!out_1) { -+ val = out_1 = in; -+ goto out; -+ } -+ -+ val = MINSTREL_AVG_COEFF1 * in; -+ val += MINSTREL_AVG_COEFF2 * out_1; -+ val += MINSTREL_AVG_COEFF3 * out_2; -+ val >>= MINSTREL_SCALE; -+ -+ if (val > 1 << MINSTREL_SCALE) -+ val = 1 << MINSTREL_SCALE; -+ if (val < 0) -+ val = 1; -+ -+out: -+ *prev_2 = out_1; -+ *prev_1 = val; -+ -+ return val; -+} -+ -+/* -+* Recalculate statistics and counters of a given rate -+*/ -+static void -+minstrel_ht_calc_rate_stats(struct minstrel_priv *mp, -+ struct minstrel_rate_stats *mrs) -+{ -+ unsigned int cur_prob; -+ -+ if (unlikely(mrs->attempts > 0)) { -+ mrs->sample_skipped = 0; -+ cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); -+ if (mp->new_avg) { -+ minstrel_filter_avg_add(&mrs->prob_avg, -+ &mrs->prob_avg_1, cur_prob); -+ } else if (unlikely(!mrs->att_hist)) { -+ mrs->prob_avg = cur_prob; -+ } else { -+ /*update exponential weighted moving avarage */ -+ mrs->prob_avg = minstrel_ewma(mrs->prob_avg, -+ cur_prob, -+ EWMA_LEVEL); -+ } -+ mrs->att_hist += mrs->attempts; -+ mrs->succ_hist += mrs->success; -+ } else { -+ mrs->sample_skipped++; -+ } -+ -+ mrs->last_success = mrs->success; -+ mrs->last_attempts = mrs->attempts; -+ mrs->success = 0; -+ mrs->attempts = 0; -+} -+ - /* - * Update rate statistics and select new primary rates - * -@@ -808,7 +884,7 @@ minstrel_ht_update_stats(struct minstrel - - mrs = &mg->rates[i]; - mrs->retry_updated = false; -- minstrel_calc_rate_stats(mp, mrs); -+ minstrel_ht_calc_rate_stats(mp, mrs); - cur_prob = mrs->prob_avg; - - if (minstrel_ht_get_tp_avg(mi, group, i, cur_prob) == 0) -@@ -960,8 +1036,7 @@ minstrel_ht_tx_status(void *priv, struct - void *priv_sta, struct ieee80211_tx_status *st) - { - struct ieee80211_tx_info *info = st->info; -- struct minstrel_ht_sta_priv *msp = priv_sta; -- struct minstrel_ht_sta *mi = &msp->ht; -+ struct minstrel_ht_sta *mi = priv_sta; - struct ieee80211_tx_rate *ar = info->status.rates; - struct minstrel_rate_stats *rate, *rate2, *rate_sample = NULL; - struct minstrel_priv *mp = priv; -@@ -1372,8 +1447,7 @@ minstrel_ht_get_rate(void *priv, struct - const struct mcs_group *sample_group; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb); - struct ieee80211_tx_rate *rate = &info->status.rates[0]; -- struct minstrel_ht_sta_priv *msp = priv_sta; -- struct minstrel_ht_sta *mi = &msp->ht; -+ struct minstrel_ht_sta *mi = priv_sta; - struct minstrel_priv *mp = priv; - int sample_idx; - -@@ -1484,8 +1558,7 @@ minstrel_ht_update_caps(void *priv, stru - struct ieee80211_sta *sta, void *priv_sta) - { - struct minstrel_priv *mp = priv; -- struct minstrel_ht_sta_priv *msp = priv_sta; -- struct minstrel_ht_sta *mi = &msp->ht; -+ struct minstrel_ht_sta *mi = priv_sta; - struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs; - u16 ht_cap = sta->ht_cap.cap; - struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; -@@ -1647,7 +1720,7 @@ static void * - minstrel_ht_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) - { - struct ieee80211_supported_band *sband; -- struct minstrel_ht_sta_priv *msp; -+ struct minstrel_ht_sta *mi; - struct minstrel_priv *mp = priv; - struct ieee80211_hw *hw = mp->hw; - int max_rates = 0; -@@ -1659,35 +1732,13 @@ minstrel_ht_alloc_sta(void *priv, struct - max_rates = sband->n_bitrates; - } - -- msp = kzalloc(sizeof(*msp), gfp); -- if (!msp) -- return NULL; -- -- msp->ratelist = kcalloc(max_rates, sizeof(struct minstrel_rate), gfp); -- if (!msp->ratelist) -- goto error; -- -- msp->sample_table = kmalloc_array(max_rates, SAMPLE_COLUMNS, gfp); -- if (!msp->sample_table) -- goto error1; -- -- return msp; -- --error1: -- kfree(msp->ratelist); --error: -- kfree(msp); -- return NULL; -+ return kzalloc(sizeof(*mi), gfp); - } - - static void - minstrel_ht_free_sta(void *priv, struct ieee80211_sta *sta, void *priv_sta) - { -- struct minstrel_ht_sta_priv *msp = priv_sta; -- -- kfree(msp->sample_table); -- kfree(msp->ratelist); -- kfree(msp); -+ kfree(priv_sta); - } - - static void -@@ -1768,12 +1819,6 @@ minstrel_ht_alloc(struct ieee80211_hw *h - mp->cw_min = 15; - mp->cw_max = 1023; - -- /* number of packets (in %) to use for sampling other rates -- * sample less often for non-mrr packets, because the overhead -- * is much higher than with mrr */ -- mp->lookaround_rate = 5; -- mp->lookaround_rate_mrr = 10; -- - /* maximum time that the hw is allowed to stay in one MRR segment */ - mp->segment_size = 6000; - -@@ -1821,8 +1866,7 @@ minstrel_ht_free(void *priv) - - static u32 minstrel_ht_get_expected_throughput(void *priv_sta) - { -- struct minstrel_ht_sta_priv *msp = priv_sta; -- struct minstrel_ht_sta *mi = &msp->ht; -+ struct minstrel_ht_sta *mi = priv_sta; - int i, j, prob, tp_avg; - - i = mi->max_tp_rate[0] / MCS_GROUP_RATES; ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -6,6 +6,33 @@ - #ifndef __RC_MINSTREL_HT_H - #define __RC_MINSTREL_HT_H - -+/* number of highest throughput rates to consider*/ -+#define MAX_THR_RATES 4 -+#define SAMPLE_COLUMNS 10 /* number of columns in sample table */ -+ -+/* scaled fraction values */ -+#define MINSTREL_SCALE 12 -+#define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / div) -+#define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE) -+ -+#define EWMA_LEVEL 96 /* ewma weighting factor [/EWMA_DIV] */ -+#define EWMA_DIV 128 -+ -+/* -+ * Coefficients for moving average with noise filter (period=16), -+ * scaled by 10 bits -+ * -+ * a1 = exp(-pi * sqrt(2) / period) -+ * coeff2 = 2 * a1 * cos(sqrt(2) * 2 * pi / period) -+ * coeff3 = -sqr(a1) -+ * coeff1 = 1 - coeff2 - coeff3 -+ */ -+#define MINSTREL_AVG_COEFF1 (MINSTREL_FRAC(1, 1) - \ -+ MINSTREL_AVG_COEFF2 - \ -+ MINSTREL_AVG_COEFF3) -+#define MINSTREL_AVG_COEFF2 0x00001499 -+#define MINSTREL_AVG_COEFF3 -0x0000092e -+ - /* - * The number of streams can be changed to 2 to reduce code - * size and memory footprint. -@@ -30,6 +57,32 @@ - - #define MCS_GROUP_RATES 10 - -+struct minstrel_priv { -+ struct ieee80211_hw *hw; -+ bool has_mrr; -+ bool new_avg; -+ u32 sample_switch; -+ unsigned int cw_min; -+ unsigned int cw_max; -+ unsigned int max_retry; -+ unsigned int segment_size; -+ unsigned int update_interval; -+ -+ u8 cck_rates[4]; -+ u8 ofdm_rates[NUM_NL80211_BANDS][8]; -+ -+#ifdef CPTCFG_MAC80211_DEBUGFS -+ /* -+ * enable fixed rate processing per RC -+ * - write static index to debugfs:ieee80211/phyX/rc/fixed_rate_idx -+ * - write -1 to enable RC processing again -+ * - setting will be applied on next update -+ */ -+ u32 fixed_rate_idx; -+#endif -+}; -+ -+ - struct mcs_group { - u16 flags; - u8 streams; -@@ -42,6 +95,26 @@ extern const s16 minstrel_cck_bitrates[4 - extern const s16 minstrel_ofdm_bitrates[8]; - extern const struct mcs_group minstrel_mcs_groups[]; - -+struct minstrel_rate_stats { -+ /* current / last sampling period attempts/success counters */ -+ u16 attempts, last_attempts; -+ u16 success, last_success; -+ -+ /* total attempts/success counters */ -+ u32 att_hist, succ_hist; -+ -+ /* prob_avg - moving average of prob */ -+ u16 prob_avg; -+ u16 prob_avg_1; -+ -+ /* maximum retry counts */ -+ u8 retry_count; -+ u8 retry_count_rtscts; -+ -+ u8 sample_skipped; -+ bool retry_updated; -+}; -+ - struct minstrel_mcs_group_data { - u8 index; - u8 column; -@@ -111,12 +184,6 @@ struct minstrel_ht_sta { - struct minstrel_mcs_group_data groups[MINSTREL_GROUPS_NB]; - }; - --struct minstrel_ht_sta_priv { -- struct minstrel_ht_sta ht; -- void *ratelist; -- void *sample_table; --}; -- - void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); - int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate, - int prob_avg); ---- a/net/mac80211/rc80211_minstrel_ht_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c -@@ -9,9 +9,13 @@ - #include - #include - #include --#include "rc80211_minstrel.h" - #include "rc80211_minstrel_ht.h" - -+struct minstrel_debugfs_info { -+ size_t len; -+ char buf[]; -+}; -+ - static ssize_t - minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) - { -@@ -127,8 +131,7 @@ minstrel_ht_stats_dump(struct minstrel_h - static int - minstrel_ht_stats_open(struct inode *inode, struct file *file) - { -- struct minstrel_ht_sta_priv *msp = inode->i_private; -- struct minstrel_ht_sta *mi = &msp->ht; -+ struct minstrel_ht_sta *mi = inode->i_private; - struct minstrel_debugfs_info *ms; - unsigned int i; - char *p; -@@ -276,8 +279,7 @@ minstrel_ht_stats_csv_dump(struct minstr - static int - minstrel_ht_stats_csv_open(struct inode *inode, struct file *file) - { -- struct minstrel_ht_sta_priv *msp = inode->i_private; -- struct minstrel_ht_sta *mi = &msp->ht; -+ struct minstrel_ht_sta *mi = inode->i_private; - struct minstrel_debugfs_info *ms; - unsigned int i; - char *p; -@@ -313,10 +315,8 @@ static const struct file_operations mins - void - minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir) - { -- struct minstrel_ht_sta_priv *msp = priv_sta; -- -- debugfs_create_file("rc_stats", 0444, dir, msp, -+ debugfs_create_file("rc_stats", 0444, dir, priv_sta, - &minstrel_ht_stat_fops); -- debugfs_create_file("rc_stats_csv", 0444, dir, msp, -+ debugfs_create_file("rc_stats_csv", 0444, dir, priv_sta, - &minstrel_ht_stat_csv_fops); - } diff --git a/package/kernel/mac80211/patches/subsys/340-mac80211-minstrel_ht-remove-old-ewma-based-rate-aver.patch b/package/kernel/mac80211/patches/subsys/340-mac80211-minstrel_ht-remove-old-ewma-based-rate-aver.patch deleted file mode 100644 index 9b6a614aa8..0000000000 --- a/package/kernel/mac80211/patches/subsys/340-mac80211-minstrel_ht-remove-old-ewma-based-rate-aver.patch +++ /dev/null @@ -1,96 +0,0 @@ -From: Felix Fietkau -Date: Sat, 26 Dec 2020 14:34:30 +0100 -Subject: [PATCH] mac80211: minstrel_ht: remove old ewma based rate average - code - -The new noise filter has been the default for a while now with no reported -downside and significant improvement compared to the old code. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -769,17 +769,8 @@ minstrel_ht_calc_rate_stats(struct minst - if (unlikely(mrs->attempts > 0)) { - mrs->sample_skipped = 0; - cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); -- if (mp->new_avg) { -- minstrel_filter_avg_add(&mrs->prob_avg, -- &mrs->prob_avg_1, cur_prob); -- } else if (unlikely(!mrs->att_hist)) { -- mrs->prob_avg = cur_prob; -- } else { -- /*update exponential weighted moving avarage */ -- mrs->prob_avg = minstrel_ewma(mrs->prob_avg, -- cur_prob, -- EWMA_LEVEL); -- } -+ minstrel_filter_avg_add(&mrs->prob_avg, -+ &mrs->prob_avg_1, cur_prob); - mrs->att_hist += mrs->attempts; - mrs->succ_hist += mrs->success; - } else { -@@ -913,10 +904,8 @@ minstrel_ht_update_stats(struct minstrel - /* Try to increase robustness of max_prob_rate*/ - minstrel_ht_prob_rate_reduce_streams(mi); - -- /* try to sample all available rates during each interval */ -- mi->sample_count *= 8; -- if (mp->new_avg) -- mi->sample_count /= 2; -+ /* try to sample half of all available rates during each interval */ -+ mi->sample_count *= 4; - - if (sample) - minstrel_ht_rate_sample_switch(mp, mi); -@@ -1040,7 +1029,7 @@ minstrel_ht_tx_status(void *priv, struct - struct ieee80211_tx_rate *ar = info->status.rates; - struct minstrel_rate_stats *rate, *rate2, *rate_sample = NULL; - struct minstrel_priv *mp = priv; -- u32 update_interval = mp->update_interval / 2; -+ u32 update_interval = mp->update_interval; - bool last, update = false; - bool sample_status = false; - int i; -@@ -1090,9 +1079,8 @@ minstrel_ht_tx_status(void *priv, struct - - switch (mi->sample_mode) { - case MINSTREL_SAMPLE_IDLE: -- if (mp->new_avg && -- (mp->hw->max_rates > 1 || -- mi->total_packets_cur < SAMPLE_SWITCH_THR)) -+ if (mp->hw->max_rates > 1 || -+ mi->total_packets_cur < SAMPLE_SWITCH_THR) - update_interval /= 2; - break; - -@@ -1832,8 +1820,7 @@ minstrel_ht_alloc(struct ieee80211_hw *h - mp->has_mrr = true; - - mp->hw = hw; -- mp->update_interval = HZ / 10; -- mp->new_avg = true; -+ mp->update_interval = HZ / 20; - - minstrel_ht_init_cck_rates(mp); - for (i = 0; i < ARRAY_SIZE(mp->hw->wiphy->bands); i++) -@@ -1853,8 +1840,6 @@ static void minstrel_ht_add_debugfs(stru - &mp->fixed_rate_idx); - debugfs_create_u32("sample_switch", S_IRUGO | S_IWUSR, debugfsdir, - &mp->sample_switch); -- debugfs_create_bool("new_avg", S_IRUGO | S_IWUSR, debugfsdir, -- &mp->new_avg); - } - #endif - ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -60,7 +60,6 @@ - struct minstrel_priv { - struct ieee80211_hw *hw; - bool has_mrr; -- bool new_avg; - u32 sample_switch; - unsigned int cw_min; - unsigned int cw_max; diff --git a/package/kernel/mac80211/patches/subsys/341-mac80211-minstrel_ht-improve-ampdu-length-estimation.patch b/package/kernel/mac80211/patches/subsys/341-mac80211-minstrel_ht-improve-ampdu-length-estimation.patch deleted file mode 100644 index a8e6e89954..0000000000 --- a/package/kernel/mac80211/patches/subsys/341-mac80211-minstrel_ht-improve-ampdu-length-estimation.patch +++ /dev/null @@ -1,67 +0,0 @@ -From: Felix Fietkau -Date: Sat, 26 Dec 2020 19:08:19 +0100 -Subject: [PATCH] mac80211: minstrel_ht: improve ampdu length estimation - -If the driver does not report A-MPDU length, estimate it based on the rate. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -382,13 +382,37 @@ minstrel_get_ratestats(struct minstrel_h - return &mi->groups[index / MCS_GROUP_RATES].rates[index % MCS_GROUP_RATES]; - } - -+static inline int -+minstrel_get_duration(int index) -+{ -+ const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; -+ unsigned int duration = group->duration[index % MCS_GROUP_RATES]; -+ return duration << group->shift; -+} -+ - static unsigned int - minstrel_ht_avg_ampdu_len(struct minstrel_ht_sta *mi) - { -- if (!mi->avg_ampdu_len) -- return AVG_AMPDU_SIZE; -+ int duration; -+ -+ if (mi->avg_ampdu_len) -+ return MINSTREL_TRUNC(mi->avg_ampdu_len); -+ -+ if (minstrel_ht_is_legacy_group(mi->max_tp_rate[0] / MCS_GROUP_RATES)) -+ return 1; -+ -+ duration = minstrel_get_duration(mi->max_tp_rate[0]); - -- return MINSTREL_TRUNC(mi->avg_ampdu_len); -+ if (duration > 400 * 1000) -+ return 2; -+ -+ if (duration > 250 * 1000) -+ return 4; -+ -+ if (duration > 150 * 1000) -+ return 8; -+ -+ return 16; - } - - /* -@@ -588,14 +612,6 @@ minstrel_ht_prob_rate_reduce_streams(str - } - } - --static inline int --minstrel_get_duration(int index) --{ -- const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; -- unsigned int duration = group->duration[index % MCS_GROUP_RATES]; -- return duration << group->shift; --} -- - static bool - minstrel_ht_probe_group(struct minstrel_ht_sta *mi, const struct mcs_group *tp_group, - int tp_idx, const struct mcs_group *group) diff --git a/package/kernel/mac80211/patches/subsys/342-mac80211-minstrel_ht-improve-sample-rate-selection.patch b/package/kernel/mac80211/patches/subsys/342-mac80211-minstrel_ht-improve-sample-rate-selection.patch deleted file mode 100644 index e084525235..0000000000 --- a/package/kernel/mac80211/patches/subsys/342-mac80211-minstrel_ht-improve-sample-rate-selection.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Felix Fietkau -Date: Sat, 26 Dec 2020 19:12:22 +0100 -Subject: [PATCH] mac80211: minstrel_ht: improve sample rate selection - -Always allow sampling of rates faster than the primary max throughput rate. -When the second max_tp_rate is higher than the first one, sample attempts were -previously skipped, potentially causing rate control to get stuck at a slightly -lower rate - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1379,13 +1379,13 @@ minstrel_get_sample_rate(struct minstrel - mrs = &mg->rates[sample_idx]; - sample_idx += sample_group * MCS_GROUP_RATES; - -- /* Set tp_rate1, tp_rate2 to the highest / second highest max_tp_rate */ -+ tp_rate1 = mi->max_tp_rate[0]; -+ -+ /* Set tp_rate2 to the second highest max_tp_rate */ - if (minstrel_get_duration(mi->max_tp_rate[0]) > - minstrel_get_duration(mi->max_tp_rate[1])) { -- tp_rate1 = mi->max_tp_rate[1]; - tp_rate2 = mi->max_tp_rate[0]; - } else { -- tp_rate1 = mi->max_tp_rate[0]; - tp_rate2 = mi->max_tp_rate[1]; - } - diff --git a/package/kernel/mac80211/patches/subsys/343-mac80211-minstrel_ht-fix-max-probability-rate-select.patch b/package/kernel/mac80211/patches/subsys/343-mac80211-minstrel_ht-fix-max-probability-rate-select.patch deleted file mode 100644 index 0dbfa9d4fb..0000000000 --- a/package/kernel/mac80211/patches/subsys/343-mac80211-minstrel_ht-fix-max-probability-rate-select.patch +++ /dev/null @@ -1,124 +0,0 @@ -From: Felix Fietkau -Date: Sat, 26 Dec 2020 19:09:08 +0100 -Subject: [PATCH] mac80211: minstrel_ht: fix max probability rate selection - -- do not select rates faster than the max throughput rate if probability is lower -- reset previous rate before sorting again - -This ensures that the max prob rate gets set to a more reliable rate - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -495,12 +495,13 @@ minstrel_ht_sort_best_tp_rates(struct mi - * Find and set the topmost probability rate per sta and per group - */ - static void --minstrel_ht_set_best_prob_rate(struct minstrel_ht_sta *mi, u16 index) -+minstrel_ht_set_best_prob_rate(struct minstrel_ht_sta *mi, u16 *dest, u16 index) - { - struct minstrel_mcs_group_data *mg; - struct minstrel_rate_stats *mrs; - int tmp_group, tmp_idx, tmp_tp_avg, tmp_prob; -- int max_tp_group, cur_tp_avg, cur_group, cur_idx; -+ int max_tp_group, max_tp_idx, max_tp_prob; -+ int cur_tp_avg, cur_group, cur_idx; - int max_gpr_group, max_gpr_idx; - int max_gpr_tp_avg, max_gpr_prob; - -@@ -509,18 +510,26 @@ minstrel_ht_set_best_prob_rate(struct mi - mg = &mi->groups[index / MCS_GROUP_RATES]; - mrs = &mg->rates[index % MCS_GROUP_RATES]; - -- tmp_group = mi->max_prob_rate / MCS_GROUP_RATES; -- tmp_idx = mi->max_prob_rate % MCS_GROUP_RATES; -+ tmp_group = *dest / MCS_GROUP_RATES; -+ tmp_idx = *dest % MCS_GROUP_RATES; - tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; - tmp_tp_avg = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); - - /* if max_tp_rate[0] is from MCS_GROUP max_prob_rate get selected from - * MCS_GROUP as well as CCK_GROUP rates do not allow aggregation */ - max_tp_group = mi->max_tp_rate[0] / MCS_GROUP_RATES; -+ max_tp_idx = mi->max_tp_rate[0] % MCS_GROUP_RATES; -+ max_tp_prob = mi->groups[max_tp_group].rates[max_tp_idx].prob_avg; -+ - if (minstrel_ht_is_legacy_group(index / MCS_GROUP_RATES) && - !minstrel_ht_is_legacy_group(max_tp_group)) - return; - -+ /* skip rates faster than max tp rate with lower prob */ -+ if (minstrel_get_duration(mi->max_tp_rate[0]) > minstrel_get_duration(index) && -+ mrs->prob_avg < max_tp_prob) -+ return; -+ - max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES; - max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES; - max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_avg; -@@ -538,7 +547,7 @@ minstrel_ht_set_best_prob_rate(struct mi - mg->max_group_prob_rate = index; - } else { - if (mrs->prob_avg > tmp_prob) -- mi->max_prob_rate = index; -+ *dest = index; - if (mrs->prob_avg > max_gpr_prob) - mg->max_group_prob_rate = index; - } -@@ -816,7 +825,8 @@ minstrel_ht_update_stats(struct minstrel - struct minstrel_rate_stats *mrs; - int group, i, j, cur_prob; - u16 tmp_mcs_tp_rate[MAX_THR_RATES], tmp_group_tp_rate[MAX_THR_RATES]; -- u16 tmp_legacy_tp_rate[MAX_THR_RATES], index; -+ u16 tmp_legacy_tp_rate[MAX_THR_RATES], tmp_max_prob_rate; -+ u16 index; - bool ht_supported = mi->sta->ht_cap.ht_supported; - - mi->sample_mode = MINSTREL_SAMPLE_IDLE; -@@ -863,6 +873,7 @@ minstrel_ht_update_stats(struct minstrel - else - index = MINSTREL_OFDM_GROUP * MCS_GROUP_RATES; - -+ tmp_max_prob_rate = index; - for (j = 0; j < ARRAY_SIZE(tmp_mcs_tp_rate); j++) - tmp_mcs_tp_rate[j] = index; - -@@ -903,9 +914,6 @@ minstrel_ht_update_stats(struct minstrel - /* Find max throughput rate set within a group */ - minstrel_ht_sort_best_tp_rates(mi, index, - tmp_group_tp_rate); -- -- /* Find max probability rate per group and global */ -- minstrel_ht_set_best_prob_rate(mi, index); - } - - memcpy(mg->max_group_tp_rate, tmp_group_tp_rate, -@@ -917,6 +925,27 @@ minstrel_ht_update_stats(struct minstrel - tmp_legacy_tp_rate); - memcpy(mi->max_tp_rate, tmp_mcs_tp_rate, sizeof(mi->max_tp_rate)); - -+ for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { -+ if (!mi->supported[group]) -+ continue; -+ -+ mg = &mi->groups[group]; -+ mg->max_group_prob_rate = MCS_GROUP_RATES * group; -+ -+ for (i = 0; i < MCS_GROUP_RATES; i++) { -+ if (!(mi->supported[group] & BIT(i))) -+ continue; -+ -+ index = MCS_GROUP_RATES * group + i; -+ -+ /* Find max probability rate per group and global */ -+ minstrel_ht_set_best_prob_rate(mi, &tmp_max_prob_rate, -+ index); -+ } -+ } -+ -+ mi->max_prob_rate = tmp_max_prob_rate; -+ - /* Try to increase robustness of max_prob_rate*/ - minstrel_ht_prob_rate_reduce_streams(mi); - diff --git a/package/kernel/mac80211/patches/subsys/344-mac80211-minstrel_ht-increase-stats-update-interval.patch b/package/kernel/mac80211/patches/subsys/344-mac80211-minstrel_ht-increase-stats-update-interval.patch deleted file mode 100644 index 9972a9414e..0000000000 --- a/package/kernel/mac80211/patches/subsys/344-mac80211-minstrel_ht-increase-stats-update-interval.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Felix Fietkau -Date: Sat, 26 Dec 2020 19:14:58 +0100 -Subject: [PATCH] mac80211: minstrel_ht: increase stats update interval - -The shorter interval was leading to too many frames being used for probing - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1865,7 +1865,7 @@ minstrel_ht_alloc(struct ieee80211_hw *h - mp->has_mrr = true; - - mp->hw = hw; -- mp->update_interval = HZ / 20; -+ mp->update_interval = HZ / 10; - - minstrel_ht_init_cck_rates(mp); - for (i = 0; i < ARRAY_SIZE(mp->hw->wiphy->bands); i++) diff --git a/package/kernel/mac80211/patches/subsys/345-mac80211-minstrel_ht-fix-rounding-error-in-throughpu.patch b/package/kernel/mac80211/patches/subsys/345-mac80211-minstrel_ht-fix-rounding-error-in-throughpu.patch deleted file mode 100644 index 1df5dec039..0000000000 --- a/package/kernel/mac80211/patches/subsys/345-mac80211-minstrel_ht-fix-rounding-error-in-throughpu.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Felix Fietkau -Date: Fri, 15 Jan 2021 12:15:06 +0100 -Subject: [PATCH] mac80211: minstrel_ht: fix rounding error in throughput - calculation - -On lower data rates, the throughput calculation has a significant rounding -error, causing rates like 48M and 54M OFDM to share the same throughput -value with >= 90% success probablity. - -This is because the result of the division (prob_avg * 1000) / nsecs -is really small (8 in this example). - -Improve accuracy by moving over some zeroes, making better use of the full -range of u32 before the division. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -445,10 +445,9 @@ minstrel_ht_get_tp_avg(struct minstrel_h - * (prob is scaled - see MINSTREL_FRAC above) - */ - if (prob_avg > MINSTREL_FRAC(90, 100)) -- return MINSTREL_TRUNC(100000 * ((MINSTREL_FRAC(90, 100) * 1000) -- / nsecs)); -- else -- return MINSTREL_TRUNC(100000 * ((prob_avg * 1000) / nsecs)); -+ prob_avg = MINSTREL_FRAC(90, 100); -+ -+ return MINSTREL_TRUNC(100 * ((prob_avg * 1000000) / nsecs)); - } - - /* diff --git a/package/kernel/mac80211/patches/subsys/346-mac80211-minstrel_ht-use-bitfields-to-encode-rate-in.patch b/package/kernel/mac80211/patches/subsys/346-mac80211-minstrel_ht-use-bitfields-to-encode-rate-in.patch deleted file mode 100644 index 6aa6f0ed93..0000000000 --- a/package/kernel/mac80211/patches/subsys/346-mac80211-minstrel_ht-use-bitfields-to-encode-rate-in.patch +++ /dev/null @@ -1,412 +0,0 @@ -From: Felix Fietkau -Date: Thu, 21 Jan 2021 18:29:30 +0100 -Subject: [PATCH] mac80211: minstrel_ht: use bitfields to encode rate - indexes - -Get rid of a lot of divisions and modulo operations -Reduces code size and improves performance - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -379,14 +379,14 @@ out: - static inline struct minstrel_rate_stats * - minstrel_get_ratestats(struct minstrel_ht_sta *mi, int index) - { -- return &mi->groups[index / MCS_GROUP_RATES].rates[index % MCS_GROUP_RATES]; -+ return &mi->groups[MI_RATE_GROUP(index)].rates[MI_RATE_IDX(index)]; - } - --static inline int --minstrel_get_duration(int index) -+static inline int minstrel_get_duration(int index) - { -- const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; -- unsigned int duration = group->duration[index % MCS_GROUP_RATES]; -+ const struct mcs_group *group = &minstrel_mcs_groups[MI_RATE_GROUP(index)]; -+ unsigned int duration = group->duration[MI_RATE_IDX(index)]; -+ - return duration << group->shift; - } - -@@ -398,7 +398,7 @@ minstrel_ht_avg_ampdu_len(struct minstre - if (mi->avg_ampdu_len) - return MINSTREL_TRUNC(mi->avg_ampdu_len); - -- if (minstrel_ht_is_legacy_group(mi->max_tp_rate[0] / MCS_GROUP_RATES)) -+ if (minstrel_ht_is_legacy_group(MI_RATE_GROUP(mi->max_tp_rate[0]))) - return 1; - - duration = minstrel_get_duration(mi->max_tp_rate[0]); -@@ -465,14 +465,14 @@ minstrel_ht_sort_best_tp_rates(struct mi - int tmp_group, tmp_idx, tmp_tp_avg, tmp_prob; - int j = MAX_THR_RATES; - -- cur_group = index / MCS_GROUP_RATES; -- cur_idx = index % MCS_GROUP_RATES; -+ cur_group = MI_RATE_GROUP(index); -+ cur_idx = MI_RATE_IDX(index); - cur_prob = mi->groups[cur_group].rates[cur_idx].prob_avg; - cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx, cur_prob); - - do { -- tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; -- tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; -+ tmp_group = MI_RATE_GROUP(tp_list[j - 1]); -+ tmp_idx = MI_RATE_IDX(tp_list[j - 1]); - tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; - tmp_tp_avg = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, - tmp_prob); -@@ -504,23 +504,23 @@ minstrel_ht_set_best_prob_rate(struct mi - int max_gpr_group, max_gpr_idx; - int max_gpr_tp_avg, max_gpr_prob; - -- cur_group = index / MCS_GROUP_RATES; -- cur_idx = index % MCS_GROUP_RATES; -- mg = &mi->groups[index / MCS_GROUP_RATES]; -- mrs = &mg->rates[index % MCS_GROUP_RATES]; -+ cur_group = MI_RATE_GROUP(index); -+ cur_idx = MI_RATE_IDX(index); -+ mg = &mi->groups[cur_group]; -+ mrs = &mg->rates[cur_idx]; - -- tmp_group = *dest / MCS_GROUP_RATES; -- tmp_idx = *dest % MCS_GROUP_RATES; -+ tmp_group = MI_RATE_GROUP(*dest); -+ tmp_idx = MI_RATE_IDX(*dest); - tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; - tmp_tp_avg = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); - - /* if max_tp_rate[0] is from MCS_GROUP max_prob_rate get selected from - * MCS_GROUP as well as CCK_GROUP rates do not allow aggregation */ -- max_tp_group = mi->max_tp_rate[0] / MCS_GROUP_RATES; -- max_tp_idx = mi->max_tp_rate[0] % MCS_GROUP_RATES; -+ max_tp_group = MI_RATE_GROUP(mi->max_tp_rate[0]); -+ max_tp_idx = MI_RATE_IDX(mi->max_tp_rate[0]); - max_tp_prob = mi->groups[max_tp_group].rates[max_tp_idx].prob_avg; - -- if (minstrel_ht_is_legacy_group(index / MCS_GROUP_RATES) && -+ if (minstrel_ht_is_legacy_group(MI_RATE_GROUP(index)) && - !minstrel_ht_is_legacy_group(max_tp_group)) - return; - -@@ -529,8 +529,8 @@ minstrel_ht_set_best_prob_rate(struct mi - mrs->prob_avg < max_tp_prob) - return; - -- max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES; -- max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES; -+ max_gpr_group = MI_RATE_GROUP(mg->max_group_prob_rate); -+ max_gpr_idx = MI_RATE_IDX(mg->max_group_prob_rate); - max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_avg; - - if (mrs->prob_avg > MINSTREL_FRAC(75, 100)) { -@@ -567,13 +567,13 @@ minstrel_ht_assign_best_tp_rates(struct - unsigned int tmp_group, tmp_idx, tmp_cck_tp, tmp_mcs_tp, tmp_prob; - int i; - -- tmp_group = tmp_legacy_tp_rate[0] / MCS_GROUP_RATES; -- tmp_idx = tmp_legacy_tp_rate[0] % MCS_GROUP_RATES; -+ tmp_group = MI_RATE_GROUP(tmp_legacy_tp_rate[0]); -+ tmp_idx = MI_RATE_IDX(tmp_legacy_tp_rate[0]); - tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; - tmp_cck_tp = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); - -- tmp_group = tmp_mcs_tp_rate[0] / MCS_GROUP_RATES; -- tmp_idx = tmp_mcs_tp_rate[0] % MCS_GROUP_RATES; -+ tmp_group = MI_RATE_GROUP(tmp_mcs_tp_rate[0]); -+ tmp_idx = MI_RATE_IDX(tmp_mcs_tp_rate[0]); - tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; - tmp_mcs_tp = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); - -@@ -600,14 +600,14 @@ minstrel_ht_prob_rate_reduce_streams(str - if (!mi->sta->ht_cap.ht_supported) - return; - -- tmp_max_streams = minstrel_mcs_groups[mi->max_tp_rate[0] / -- MCS_GROUP_RATES].streams; -+ group = MI_RATE_GROUP(mi->max_tp_rate[0]); -+ tmp_max_streams = minstrel_mcs_groups[group].streams; - for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { - mg = &mi->groups[group]; - if (!mi->supported[group] || group == MINSTREL_CCK_GROUP) - continue; - -- tmp_idx = mg->max_group_prob_rate % MCS_GROUP_RATES; -+ tmp_idx = MI_RATE_IDX(mg->max_group_prob_rate); - tmp_prob = mi->groups[group].rates[tmp_idx].prob_avg; - - if (tmp_tp < minstrel_ht_get_tp_avg(mi, group, tmp_idx, tmp_prob) && -@@ -644,8 +644,8 @@ minstrel_ht_find_probe_rates(struct mins - int i, g, max_dur; - int tp_idx; - -- tp_group = &minstrel_mcs_groups[mi->max_tp_rate[0] / MCS_GROUP_RATES]; -- tp_idx = mi->max_tp_rate[0] % MCS_GROUP_RATES; -+ tp_group = &minstrel_mcs_groups[MI_RATE_GROUP(mi->max_tp_rate[0])]; -+ tp_idx = MI_RATE_IDX(mi->max_tp_rate[0]); - - max_dur = minstrel_get_duration(mi->max_tp_rate[0]); - if (faster_rate) -@@ -670,7 +670,7 @@ minstrel_ht_find_probe_rates(struct mins - if ((group->duration[i] << group->shift) > max_dur) - continue; - -- idx = g * MCS_GROUP_RATES + i; -+ idx = MI_RATE(g, i); - if (idx == mi->max_tp_rate[0]) - continue; - -@@ -712,10 +712,10 @@ minstrel_ht_rate_sample_switch(struct mi - - /* If no suitable rate was found, try to pick the next one in the group */ - if (!n_rates) { -- int g_idx = mi->max_tp_rate[0] / MCS_GROUP_RATES; -+ int g_idx = MI_RATE_GROUP(mi->max_tp_rate[0]); - u16 supported = mi->supported[g_idx]; - -- supported >>= mi->max_tp_rate[0] % MCS_GROUP_RATES; -+ supported >>= MI_RATE_IDX(mi->max_tp_rate[0]); - for (i = 0; supported; supported >>= 1, i++) { - if (!(supported & 1)) - continue; -@@ -854,24 +854,27 @@ minstrel_ht_update_stats(struct minstrel - mi->sample_slow = 0; - mi->sample_count = 0; - -- memset(tmp_mcs_tp_rate, 0, sizeof(tmp_mcs_tp_rate)); -- memset(tmp_legacy_tp_rate, 0, sizeof(tmp_legacy_tp_rate)); - if (mi->supported[MINSTREL_CCK_GROUP]) -- for (j = 0; j < ARRAY_SIZE(tmp_legacy_tp_rate); j++) -- tmp_legacy_tp_rate[j] = MINSTREL_CCK_GROUP * MCS_GROUP_RATES; -+ group = MINSTREL_CCK_GROUP; - else if (mi->supported[MINSTREL_OFDM_GROUP]) -- for (j = 0; j < ARRAY_SIZE(tmp_legacy_tp_rate); j++) -- tmp_legacy_tp_rate[j] = MINSTREL_OFDM_GROUP * MCS_GROUP_RATES; -+ group = MINSTREL_OFDM_GROUP; -+ else -+ group = 0; -+ -+ index = MI_RATE(group, 0); -+ for (j = 0; j < ARRAY_SIZE(tmp_legacy_tp_rate); j++) -+ tmp_legacy_tp_rate[j] = index; - - if (mi->supported[MINSTREL_VHT_GROUP_0]) -- index = MINSTREL_VHT_GROUP_0 * MCS_GROUP_RATES; -+ group = MINSTREL_VHT_GROUP_0; - else if (ht_supported) -- index = MINSTREL_HT_GROUP_0 * MCS_GROUP_RATES; -+ group = MINSTREL_HT_GROUP_0; - else if (mi->supported[MINSTREL_CCK_GROUP]) -- index = MINSTREL_CCK_GROUP * MCS_GROUP_RATES; -+ group = MINSTREL_CCK_GROUP; - else -- index = MINSTREL_OFDM_GROUP * MCS_GROUP_RATES; -+ group = MINSTREL_OFDM_GROUP; - -+ index = MI_RATE(group, 0); - tmp_max_prob_rate = index; - for (j = 0; j < ARRAY_SIZE(tmp_mcs_tp_rate); j++) - tmp_mcs_tp_rate[j] = index; -@@ -888,7 +891,7 @@ minstrel_ht_update_stats(struct minstrel - - /* (re)Initialize group rate indexes */ - for(j = 0; j < MAX_THR_RATES; j++) -- tmp_group_tp_rate[j] = MCS_GROUP_RATES * group; -+ tmp_group_tp_rate[j] = MI_RATE(group, 0); - - if (group == MINSTREL_CCK_GROUP && ht_supported) - tp_rate = tmp_legacy_tp_rate; -@@ -897,7 +900,7 @@ minstrel_ht_update_stats(struct minstrel - if (!(mi->supported[group] & BIT(i))) - continue; - -- index = MCS_GROUP_RATES * group + i; -+ index = MI_RATE(group, i); - - mrs = &mg->rates[i]; - mrs->retry_updated = false; -@@ -929,13 +932,13 @@ minstrel_ht_update_stats(struct minstrel - continue; - - mg = &mi->groups[group]; -- mg->max_group_prob_rate = MCS_GROUP_RATES * group; -+ mg->max_group_prob_rate = MI_RATE(group, 0); - - for (i = 0; i < MCS_GROUP_RATES; i++) { - if (!(mi->supported[group] & BIT(i))) - continue; - -- index = MCS_GROUP_RATES * group + i; -+ index = MI_RATE(group, i); - - /* Find max probability rate per group and global */ - minstrel_ht_set_best_prob_rate(mi, &tmp_max_prob_rate, -@@ -1022,7 +1025,7 @@ minstrel_downgrade_rate(struct minstrel_ - { - int group, orig_group; - -- orig_group = group = *idx / MCS_GROUP_RATES; -+ orig_group = group = MI_RATE_GROUP(*idx); - while (group > 0) { - group--; - -@@ -1206,7 +1209,7 @@ minstrel_calc_retransmit(struct minstrel - ctime += (t_slot * cw) >> 1; - cw = min((cw << 1) | 1, mp->cw_max); - -- if (minstrel_ht_is_legacy_group(index / MCS_GROUP_RATES)) { -+ if (minstrel_ht_is_legacy_group(MI_RATE_GROUP(index))) { - overhead = mi->overhead_legacy; - overhead_rtscts = mi->overhead_legacy_rtscts; - } else { -@@ -1239,7 +1242,7 @@ static void - minstrel_ht_set_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, - struct ieee80211_sta_rates *ratetbl, int offset, int index) - { -- int group_idx = index / MCS_GROUP_RATES; -+ int group_idx = MI_RATE_GROUP(index); - const struct mcs_group *group = &minstrel_mcs_groups[group_idx]; - struct minstrel_rate_stats *mrs; - u8 idx; -@@ -1259,7 +1262,7 @@ minstrel_ht_set_rate(struct minstrel_pri - ratetbl->rate[offset].count_rts = mrs->retry_count_rtscts; - } - -- index %= MCS_GROUP_RATES; -+ index = MI_RATE_IDX(index); - if (group_idx == MINSTREL_CCK_GROUP) - idx = mp->cck_rates[index % ARRAY_SIZE(mp->cck_rates)]; - else if (group_idx == MINSTREL_OFDM_GROUP) -@@ -1289,17 +1292,17 @@ minstrel_ht_set_rate(struct minstrel_pri - static inline int - minstrel_ht_get_prob_avg(struct minstrel_ht_sta *mi, int rate) - { -- int group = rate / MCS_GROUP_RATES; -- rate %= MCS_GROUP_RATES; -+ int group = MI_RATE_GROUP(rate); -+ rate = MI_RATE_IDX(rate); - return mi->groups[group].rates[rate].prob_avg; - } - - static int - minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi) - { -- int group = mi->max_prob_rate / MCS_GROUP_RATES; -+ int group = MI_RATE_GROUP(mi->max_prob_rate); - const struct mcs_group *g = &minstrel_mcs_groups[group]; -- int rate = mi->max_prob_rate % MCS_GROUP_RATES; -+ int rate = MI_RATE_IDX(mi->max_prob_rate); - unsigned int duration; - - /* Disable A-MSDU if max_prob_rate is bad */ -@@ -1405,7 +1408,7 @@ minstrel_get_sample_rate(struct minstrel - return -1; - - mrs = &mg->rates[sample_idx]; -- sample_idx += sample_group * MCS_GROUP_RATES; -+ sample_idx += MI_RATE(sample_group, 0); - - tp_rate1 = mi->max_tp_rate[0]; - -@@ -1455,8 +1458,7 @@ minstrel_get_sample_rate(struct minstrel - * if the link is working perfectly. - */ - -- cur_max_tp_streams = minstrel_mcs_groups[tp_rate1 / -- MCS_GROUP_RATES].streams; -+ cur_max_tp_streams = minstrel_mcs_groups[MI_RATE_GROUP(tp_rate1)].streams; - if (sample_dur >= minstrel_get_duration(tp_rate2) && - (cur_max_tp_streams - 1 < - minstrel_mcs_groups[sample_group].streams || -@@ -1484,7 +1486,7 @@ minstrel_ht_get_rate(void *priv, struct - int sample_idx; - - if (!(info->flags & IEEE80211_TX_CTL_AMPDU) && -- !minstrel_ht_is_legacy_group(mi->max_prob_rate / MCS_GROUP_RATES)) -+ !minstrel_ht_is_legacy_group(MI_RATE_GROUP(mi->max_prob_rate))) - minstrel_aggr_check(sta, txrc->skb); - - info->flags |= mi->tx_flags; -@@ -1512,8 +1514,8 @@ minstrel_ht_get_rate(void *priv, struct - if (sample_idx < 0) - return; - -- sample_group = &minstrel_mcs_groups[sample_idx / MCS_GROUP_RATES]; -- sample_idx %= MCS_GROUP_RATES; -+ sample_group = &minstrel_mcs_groups[MI_RATE_GROUP(sample_idx)]; -+ sample_idx = MI_RATE_IDX(sample_idx); - - if (sample_group == &minstrel_mcs_groups[MINSTREL_CCK_GROUP] && - (sample_idx >= 4) != txrc->short_preamble) -@@ -1529,7 +1531,7 @@ minstrel_ht_get_rate(void *priv, struct - int idx = sample_idx % ARRAY_SIZE(mp->ofdm_rates[0]); - rate->idx = mp->ofdm_rates[mi->band][idx]; - } else if (sample_group->flags & IEEE80211_TX_RC_VHT_MCS) { -- ieee80211_rate_set_vht(rate, sample_idx % MCS_GROUP_RATES, -+ ieee80211_rate_set_vht(rate, MI_RATE_IDX(sample_idx), - sample_group->streams); - } else { - rate->idx = sample_idx + (sample_group->streams - 1) * 8; -@@ -1898,8 +1900,8 @@ static u32 minstrel_ht_get_expected_thro - struct minstrel_ht_sta *mi = priv_sta; - int i, j, prob, tp_avg; - -- i = mi->max_tp_rate[0] / MCS_GROUP_RATES; -- j = mi->max_tp_rate[0] % MCS_GROUP_RATES; -+ i = MI_RATE_GROUP(mi->max_tp_rate[0]); -+ j = MI_RATE_IDX(mi->max_tp_rate[0]); - prob = mi->groups[i].rates[j].prob_avg; - - /* convert tp_avg from pkt per second in kbps */ ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -6,6 +6,8 @@ - #ifndef __RC_MINSTREL_HT_H - #define __RC_MINSTREL_HT_H - -+#include -+ - /* number of highest throughput rates to consider*/ - #define MAX_THR_RATES 4 - #define SAMPLE_COLUMNS 10 /* number of columns in sample table */ -@@ -57,6 +59,17 @@ - - #define MCS_GROUP_RATES 10 - -+#define MI_RATE_IDX_MASK GENMASK(3, 0) -+#define MI_RATE_GROUP_MASK GENMASK(15, 4) -+ -+#define MI_RATE(_group, _idx) \ -+ (FIELD_PREP(MI_RATE_GROUP_MASK, _group) | \ -+ FIELD_PREP(MI_RATE_IDX_MASK, _idx)) -+ -+#define MI_RATE_IDX(_rate) FIELD_GET(MI_RATE_IDX_MASK, _rate) -+#define MI_RATE_GROUP(_rate) FIELD_GET(MI_RATE_GROUP_MASK, _rate) -+ -+ - struct minstrel_priv { - struct ieee80211_hw *hw; - bool has_mrr; ---- a/net/mac80211/rc80211_minstrel_ht_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c -@@ -56,7 +56,7 @@ minstrel_ht_stats_dump(struct minstrel_h - - for (j = 0; j < MCS_GROUP_RATES; j++) { - struct minstrel_rate_stats *mrs = &mi->groups[i].rates[j]; -- int idx = i * MCS_GROUP_RATES + j; -+ int idx = MI_RATE(i, j); - unsigned int duration; - - if (!(mi->supported[i] & BIT(j))) -@@ -201,7 +201,7 @@ minstrel_ht_stats_csv_dump(struct minstr - - for (j = 0; j < MCS_GROUP_RATES; j++) { - struct minstrel_rate_stats *mrs = &mi->groups[i].rates[j]; -- int idx = i * MCS_GROUP_RATES + j; -+ int idx = MI_RATE(i, j); - unsigned int duration; - - if (!(mi->supported[i] & BIT(j))) diff --git a/package/kernel/mac80211/patches/subsys/347-mac80211-minstrel_ht-update-total-packets-counter-in.patch b/package/kernel/mac80211/patches/subsys/347-mac80211-minstrel_ht-update-total-packets-counter-in.patch deleted file mode 100644 index dce8104934..0000000000 --- a/package/kernel/mac80211/patches/subsys/347-mac80211-minstrel_ht-update-total-packets-counter-in.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: Felix Fietkau -Date: Fri, 22 Jan 2021 18:21:13 +0100 -Subject: [PATCH] mac80211: minstrel_ht: update total packets counter in tx - status path - -Keep the update in one place and prepare for further rework - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1092,6 +1092,16 @@ minstrel_ht_tx_status(void *priv, struct - info->status.ampdu_len = 1; - } - -+ /* wraparound */ -+ if (mi->total_packets >= ~0 - info->status.ampdu_len) { -+ mi->total_packets = 0; -+ mi->sample_packets = 0; -+ } -+ -+ mi->total_packets += info->status.ampdu_len; -+ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) -+ mi->sample_packets += info->status.ampdu_len; -+ - mi->ampdu_packets++; - mi->ampdu_len += info->status.ampdu_len; - -@@ -1103,9 +1113,6 @@ minstrel_ht_tx_status(void *priv, struct - mi->sample_count--; - } - -- if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) -- mi->sample_packets += info->status.ampdu_len; -- - if (mi->sample_mode != MINSTREL_SAMPLE_IDLE) - rate_sample = minstrel_get_ratestats(mi, mi->sample_rate); - -@@ -1503,14 +1510,6 @@ minstrel_ht_get_rate(void *priv, struct - else - sample_idx = minstrel_get_sample_rate(mp, mi); - -- mi->total_packets++; -- -- /* wraparound */ -- if (mi->total_packets == ~0) { -- mi->total_packets = 0; -- mi->sample_packets = 0; -- } -- - if (sample_idx < 0) - return; - diff --git a/package/kernel/mac80211/patches/subsys/348-mac80211-minstrel_ht-reduce-the-need-to-sample-slowe.patch b/package/kernel/mac80211/patches/subsys/348-mac80211-minstrel_ht-reduce-the-need-to-sample-slowe.patch deleted file mode 100644 index dc6f11e4b9..0000000000 --- a/package/kernel/mac80211/patches/subsys/348-mac80211-minstrel_ht-reduce-the-need-to-sample-slowe.patch +++ /dev/null @@ -1,102 +0,0 @@ -From: Felix Fietkau -Date: Fri, 22 Jan 2021 19:24:59 +0100 -Subject: [PATCH] mac80211: minstrel_ht: reduce the need to sample slower - rates - -In order to more gracefully be able to fall back to lower rates without too -much throughput fluctuations, initialize all untested rates below tested ones -to the maximum probabilty of higher rates. -Usually this leads to untested lower rates getting initialized with a -probability value of 100%, making them better candidates for fallback without -having to rely on random probing - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -791,14 +791,11 @@ minstrel_ht_calc_rate_stats(struct minst - unsigned int cur_prob; - - if (unlikely(mrs->attempts > 0)) { -- mrs->sample_skipped = 0; - cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); - minstrel_filter_avg_add(&mrs->prob_avg, - &mrs->prob_avg_1, cur_prob); - mrs->att_hist += mrs->attempts; - mrs->succ_hist += mrs->success; -- } else { -- mrs->sample_skipped++; - } - - mrs->last_success = mrs->success; -@@ -851,7 +848,6 @@ minstrel_ht_update_stats(struct minstrel - mi->ampdu_packets = 0; - } - -- mi->sample_slow = 0; - mi->sample_count = 0; - - if (mi->supported[MINSTREL_CCK_GROUP]) -@@ -882,6 +878,7 @@ minstrel_ht_update_stats(struct minstrel - /* Find best rate sets within all MCS groups*/ - for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { - u16 *tp_rate = tmp_mcs_tp_rate; -+ u16 last_prob = 0; - - mg = &mi->groups[group]; - if (!mi->supported[group]) -@@ -896,7 +893,7 @@ minstrel_ht_update_stats(struct minstrel - if (group == MINSTREL_CCK_GROUP && ht_supported) - tp_rate = tmp_legacy_tp_rate; - -- for (i = 0; i < MCS_GROUP_RATES; i++) { -+ for (i = MCS_GROUP_RATES - 1; i >= 0; i--) { - if (!(mi->supported[group] & BIT(i))) - continue; - -@@ -905,6 +902,11 @@ minstrel_ht_update_stats(struct minstrel - mrs = &mg->rates[i]; - mrs->retry_updated = false; - minstrel_ht_calc_rate_stats(mp, mrs); -+ -+ if (mrs->att_hist) -+ last_prob = max(last_prob, mrs->prob_avg); -+ else -+ mrs->prob_avg = max(last_prob, mrs->prob_avg); - cur_prob = mrs->prob_avg; - - if (minstrel_ht_get_tp_avg(mi, group, i, cur_prob) == 0) -@@ -1469,13 +1471,9 @@ minstrel_get_sample_rate(struct minstrel - if (sample_dur >= minstrel_get_duration(tp_rate2) && - (cur_max_tp_streams - 1 < - minstrel_mcs_groups[sample_group].streams || -- sample_dur >= minstrel_get_duration(mi->max_prob_rate))) { -- if (mrs->sample_skipped < 20) -+ sample_dur >= minstrel_get_duration(mi->max_prob_rate))) - return -1; - -- if (mi->sample_slow++ > 2) -- return -1; -- } - mi->sample_tries--; - - return sample_idx; ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -123,7 +123,6 @@ struct minstrel_rate_stats { - u8 retry_count; - u8 retry_count_rtscts; - -- u8 sample_skipped; - bool retry_updated; - }; - -@@ -179,7 +178,6 @@ struct minstrel_ht_sta { - u8 sample_wait; - u8 sample_tries; - u8 sample_count; -- u8 sample_slow; - - enum minstrel_sample_mode sample_mode; - u16 sample_rate; diff --git a/package/kernel/mac80211/patches/subsys/349-mac80211-minstrel_ht-significantly-redesign-the-rate.patch b/package/kernel/mac80211/patches/subsys/349-mac80211-minstrel_ht-significantly-redesign-the-rate.patch deleted file mode 100644 index 09f6fd2214..0000000000 --- a/package/kernel/mac80211/patches/subsys/349-mac80211-minstrel_ht-significantly-redesign-the-rate.patch +++ /dev/null @@ -1,767 +0,0 @@ -From: Felix Fietkau -Date: Fri, 22 Jan 2021 23:57:50 +0100 -Subject: [PATCH] mac80211: minstrel_ht: significantly redesign the rate - probing strategy - -The biggest flaw in current minstrel_ht is the fact that it needs way too -many probing packets to be able to quickly find the best rate. -Depending on the wifi hardware and operating mode, this can significantly -reduce throughput when not operating at the highest available data rate. - -In order to be able to significantly reduce the amount of rate sampling, -we need a much smarter selection of probing rates. - -The new approach introduced by this patch maintains a limited set of -available rates to be tested during a statistics window. - -They are split into distinct categories: -- MINSTREL_SAMPLE_TYPE_INC - incremental rate upgrade: - Pick the next rate group and find the first rate that is faster than - the current max. throughput rate -- MINSTREL_SAMPLE_TYPE_JUMP - random testing of higher rates: - Pick a random rate from the next group that is faster than the current - max throughput rate. This allows faster adaptation when the link changes - significantly -- MINSTREL_SAMPLE_TYPE_SLOW - test a rate between max_prob, max_tp2 and - max_tp in order to reduce the gap between them - -In order to prioritize sampling, every 6 attempts are split into 3x INC, -2x JUMP, 1x SLOW. - -Available rates are checked and refilled on every stats window update. - -With this approach, we finally get a very small delta in throughput when -comparing setting the optimal data rate as a fixed rate vs normal rate -control operation. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -266,6 +266,14 @@ const struct mcs_group minstrel_mcs_grou - const s16 minstrel_cck_bitrates[4] = { 10, 20, 55, 110 }; - const s16 minstrel_ofdm_bitrates[8] = { 60, 90, 120, 180, 240, 360, 480, 540 }; - static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; -+static const u8 minstrel_sample_seq[] = { -+ MINSTREL_SAMPLE_TYPE_INC, -+ MINSTREL_SAMPLE_TYPE_JUMP, -+ MINSTREL_SAMPLE_TYPE_INC, -+ MINSTREL_SAMPLE_TYPE_JUMP, -+ MINSTREL_SAMPLE_TYPE_INC, -+ MINSTREL_SAMPLE_TYPE_SLOW, -+}; - - static void - minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi); -@@ -620,77 +628,31 @@ minstrel_ht_prob_rate_reduce_streams(str - } - } - --static bool --minstrel_ht_probe_group(struct minstrel_ht_sta *mi, const struct mcs_group *tp_group, -- int tp_idx, const struct mcs_group *group) --{ -- if (group->bw < tp_group->bw) -- return false; -- -- if (group->streams == tp_group->streams) -- return true; -- -- if (tp_idx < 4 && group->streams == tp_group->streams - 1) -- return true; -- -- return group->streams == tp_group->streams + 1; --} -- --static void --minstrel_ht_find_probe_rates(struct minstrel_ht_sta *mi, u16 *rates, int *n_rates, -- bool faster_rate) -+static u16 -+__minstrel_ht_get_sample_rate(struct minstrel_ht_sta *mi, -+ enum minstrel_sample_type type) - { -- const struct mcs_group *group, *tp_group; -- int i, g, max_dur; -- int tp_idx; -- -- tp_group = &minstrel_mcs_groups[MI_RATE_GROUP(mi->max_tp_rate[0])]; -- tp_idx = MI_RATE_IDX(mi->max_tp_rate[0]); -- -- max_dur = minstrel_get_duration(mi->max_tp_rate[0]); -- if (faster_rate) -- max_dur -= max_dur / 16; -- -- for (g = 0; g < MINSTREL_GROUPS_NB; g++) { -- u16 supported = mi->supported[g]; -- -- if (!supported) -- continue; -+ u16 *rates = mi->sample[type].sample_rates; -+ u16 cur; -+ int i; - -- group = &minstrel_mcs_groups[g]; -- if (!minstrel_ht_probe_group(mi, tp_group, tp_idx, group)) -+ for (i = 0; i < MINSTREL_SAMPLE_RATES; i++) { -+ if (!rates[i]) - continue; - -- for (i = 0; supported; supported >>= 1, i++) { -- int idx; -- -- if (!(supported & 1)) -- continue; -- -- if ((group->duration[i] << group->shift) > max_dur) -- continue; -- -- idx = MI_RATE(g, i); -- if (idx == mi->max_tp_rate[0]) -- continue; -- -- rates[(*n_rates)++] = idx; -- break; -- } -+ cur = rates[i]; -+ rates[i] = 0; -+ return cur; - } -+ -+ return 0; - } - - static void - minstrel_ht_rate_sample_switch(struct minstrel_priv *mp, - struct minstrel_ht_sta *mi) - { -- struct minstrel_rate_stats *mrs; -- u16 rates[MINSTREL_GROUPS_NB]; -- int n_rates = 0; -- int probe_rate = 0; -- bool faster_rate; -- int i; -- u8 random; -+ u16 rate; - - /* - * Use rate switching instead of probing packets for devices with -@@ -699,43 +661,11 @@ minstrel_ht_rate_sample_switch(struct mi - if (mp->hw->max_rates > 1) - return; - -- /* -- * If the current EWMA prob is >75%, look for a rate that's 6.25% -- * faster than the max tp rate. -- * If that fails, look again for a rate that is at least as fast -- */ -- mrs = minstrel_get_ratestats(mi, mi->max_tp_rate[0]); -- faster_rate = mrs->prob_avg > MINSTREL_FRAC(75, 100); -- minstrel_ht_find_probe_rates(mi, rates, &n_rates, faster_rate); -- if (!n_rates && faster_rate) -- minstrel_ht_find_probe_rates(mi, rates, &n_rates, false); -- -- /* If no suitable rate was found, try to pick the next one in the group */ -- if (!n_rates) { -- int g_idx = MI_RATE_GROUP(mi->max_tp_rate[0]); -- u16 supported = mi->supported[g_idx]; -- -- supported >>= MI_RATE_IDX(mi->max_tp_rate[0]); -- for (i = 0; supported; supported >>= 1, i++) { -- if (!(supported & 1)) -- continue; -- -- probe_rate = mi->max_tp_rate[0] + i; -- goto out; -- } -- -+ rate = __minstrel_ht_get_sample_rate(mi, MINSTREL_SAMPLE_TYPE_INC); -+ if (!rate) - return; -- } -- -- i = 0; -- if (n_rates > 1) { -- random = prandom_u32(); -- i = random % n_rates; -- } -- probe_rate = rates[i]; - --out: -- mi->sample_rate = probe_rate; -+ mi->sample_rate = rate; - mi->sample_mode = MINSTREL_SAMPLE_ACTIVE; - } - -@@ -804,6 +734,274 @@ minstrel_ht_calc_rate_stats(struct minst - mrs->attempts = 0; - } - -+static bool -+minstrel_ht_find_sample_rate(struct minstrel_ht_sta *mi, int type, int idx) -+{ -+ int i; -+ -+ for (i = 0; i < MINSTREL_SAMPLE_RATES; i++) { -+ u16 cur = mi->sample[type].sample_rates[i]; -+ -+ if (cur == idx) -+ return true; -+ -+ if (!cur) -+ break; -+ } -+ -+ return false; -+} -+ -+static int -+minstrel_ht_move_sample_rates(struct minstrel_ht_sta *mi, int type, -+ u32 fast_rate_dur, u32 slow_rate_dur) -+{ -+ u16 *rates = mi->sample[type].sample_rates; -+ int i, j; -+ -+ for (i = 0, j = 0; i < MINSTREL_SAMPLE_RATES; i++) { -+ u32 duration; -+ bool valid = false; -+ u16 cur; -+ -+ cur = rates[i]; -+ if (!cur) -+ continue; -+ -+ duration = minstrel_get_duration(cur); -+ switch (type) { -+ case MINSTREL_SAMPLE_TYPE_SLOW: -+ valid = duration > fast_rate_dur && -+ duration < slow_rate_dur; -+ break; -+ case MINSTREL_SAMPLE_TYPE_INC: -+ case MINSTREL_SAMPLE_TYPE_JUMP: -+ valid = duration < fast_rate_dur; -+ break; -+ default: -+ valid = false; -+ break; -+ } -+ -+ if (!valid) { -+ rates[i] = 0; -+ continue; -+ } -+ -+ if (i == j) -+ continue; -+ -+ rates[j++] = cur; -+ rates[i] = 0; -+ } -+ -+ return j; -+} -+ -+static int -+minstrel_ht_group_min_rate_offset(struct minstrel_ht_sta *mi, int group, -+ u32 max_duration) -+{ -+ u16 supported = mi->supported[group]; -+ int i; -+ -+ for (i = 0; i < MCS_GROUP_RATES && supported; i++, supported >>= 1) { -+ if (!(supported & BIT(0))) -+ continue; -+ -+ if (minstrel_get_duration(MI_RATE(group, i)) >= max_duration) -+ continue; -+ -+ return i; -+ } -+ -+ return -1; -+} -+ -+/* -+ * Incremental update rates: -+ * Flip through groups and pick the first group rate that is faster than the -+ * highest currently selected rate -+ */ -+static u16 -+minstrel_ht_next_inc_rate(struct minstrel_ht_sta *mi, u32 fast_rate_dur) -+{ -+ struct minstrel_mcs_group_data *mg; -+ u8 type = MINSTREL_SAMPLE_TYPE_INC; -+ int i, index = 0; -+ u8 group; -+ -+ group = mi->sample[type].sample_group; -+ for (i = 0; i < ARRAY_SIZE(minstrel_mcs_groups); i++) { -+ group = (group + 1) % ARRAY_SIZE(minstrel_mcs_groups); -+ mg = &mi->groups[group]; -+ -+ index = minstrel_ht_group_min_rate_offset(mi, group, -+ fast_rate_dur); -+ if (index < 0) -+ continue; -+ -+ index = MI_RATE(group, index & 0xf); -+ if (!minstrel_ht_find_sample_rate(mi, type, index)) -+ goto out; -+ } -+ index = 0; -+ -+out: -+ mi->sample[type].sample_group = group; -+ -+ return index; -+} -+ -+static int -+minstrel_ht_next_group_sample_rate(struct minstrel_ht_sta *mi, int group, -+ u16 supported, int offset) -+{ -+ struct minstrel_mcs_group_data *mg = &mi->groups[group]; -+ u16 idx; -+ int i; -+ -+ for (i = 0; i < MCS_GROUP_RATES; i++) { -+ idx = sample_table[mg->column][mg->index]; -+ if (++mg->index >= MCS_GROUP_RATES) { -+ mg->index = 0; -+ if (++mg->column >= ARRAY_SIZE(sample_table)) -+ mg->column = 0; -+ } -+ -+ if (idx < offset) -+ continue; -+ -+ if (!(supported & BIT(idx))) -+ continue; -+ -+ return MI_RATE(group, idx); -+ } -+ -+ return -1; -+} -+ -+/* -+ * Jump rates: -+ * Sample random rates, use those that are faster than the highest -+ * currently selected rate. Rates between the fastest and the slowest -+ * get sorted into the slow sample bucket, but only if it has room -+ */ -+static u16 -+minstrel_ht_next_jump_rate(struct minstrel_ht_sta *mi, u32 fast_rate_dur, -+ u32 slow_rate_dur, int *slow_rate_ofs) -+{ -+ struct minstrel_mcs_group_data *mg; -+ struct minstrel_rate_stats *mrs; -+ u32 max_duration = slow_rate_dur; -+ int i, index, offset; -+ u16 *slow_rates; -+ u16 supported; -+ u32 duration; -+ u8 group; -+ -+ if (*slow_rate_ofs >= MINSTREL_SAMPLE_RATES) -+ max_duration = fast_rate_dur; -+ -+ slow_rates = mi->sample[MINSTREL_SAMPLE_TYPE_SLOW].sample_rates; -+ group = mi->sample[MINSTREL_SAMPLE_TYPE_JUMP].sample_group; -+ for (i = 0; i < ARRAY_SIZE(minstrel_mcs_groups); i++) { -+ u8 type; -+ -+ group = (group + 1) % ARRAY_SIZE(minstrel_mcs_groups); -+ mg = &mi->groups[group]; -+ -+ supported = mi->supported[group]; -+ if (!supported) -+ continue; -+ -+ offset = minstrel_ht_group_min_rate_offset(mi, group, -+ max_duration); -+ if (offset < 0) -+ continue; -+ -+ index = minstrel_ht_next_group_sample_rate(mi, group, supported, -+ offset); -+ if (index < 0) -+ continue; -+ -+ duration = minstrel_get_duration(index); -+ if (duration < fast_rate_dur) -+ type = MINSTREL_SAMPLE_TYPE_JUMP; -+ else -+ type = MINSTREL_SAMPLE_TYPE_SLOW; -+ -+ if (minstrel_ht_find_sample_rate(mi, type, index)) -+ continue; -+ -+ if (type == MINSTREL_SAMPLE_TYPE_JUMP) -+ goto found; -+ -+ if (*slow_rate_ofs >= MINSTREL_SAMPLE_RATES) -+ continue; -+ -+ if (duration >= slow_rate_dur) -+ continue; -+ -+ /* skip slow rates with high success probability */ -+ mrs = minstrel_get_ratestats(mi, index); -+ if (mrs->prob_avg > MINSTREL_FRAC(95, 100)) -+ continue; -+ -+ slow_rates[(*slow_rate_ofs)++] = index; -+ if (*slow_rate_ofs >= MINSTREL_SAMPLE_RATES) -+ max_duration = fast_rate_dur; -+ } -+ index = 0; -+ -+found: -+ mi->sample[MINSTREL_SAMPLE_TYPE_JUMP].sample_group = group; -+ -+ return index; -+} -+ -+static void -+minstrel_ht_refill_sample_rates(struct minstrel_ht_sta *mi) -+{ -+ u32 prob_dur = minstrel_get_duration(mi->max_prob_rate); -+ u32 tp_dur = minstrel_get_duration(mi->max_tp_rate[0]); -+ u32 tp2_dur = minstrel_get_duration(mi->max_tp_rate[1]); -+ u32 fast_rate_dur = min(min(tp_dur, tp2_dur), prob_dur); -+ u32 slow_rate_dur = max(max(tp_dur, tp2_dur), prob_dur); -+ u16 *rates; -+ int i, j; -+ -+ rates = mi->sample[MINSTREL_SAMPLE_TYPE_INC].sample_rates; -+ i = minstrel_ht_move_sample_rates(mi, MINSTREL_SAMPLE_TYPE_INC, -+ fast_rate_dur, slow_rate_dur); -+ while (i < MINSTREL_SAMPLE_RATES) { -+ rates[i] = minstrel_ht_next_inc_rate(mi, tp_dur); -+ if (!rates[i]) -+ break; -+ -+ i++; -+ } -+ -+ rates = mi->sample[MINSTREL_SAMPLE_TYPE_JUMP].sample_rates; -+ i = minstrel_ht_move_sample_rates(mi, MINSTREL_SAMPLE_TYPE_JUMP, -+ fast_rate_dur, slow_rate_dur); -+ j = minstrel_ht_move_sample_rates(mi, MINSTREL_SAMPLE_TYPE_SLOW, -+ fast_rate_dur, slow_rate_dur); -+ while (i < MINSTREL_SAMPLE_RATES) { -+ rates[i] = minstrel_ht_next_jump_rate(mi, fast_rate_dur, -+ slow_rate_dur, &j); -+ if (!rates[i]) -+ break; -+ -+ i++; -+ } -+ -+ for (i = 0; i < ARRAY_SIZE(mi->sample); i++) -+ memcpy(mi->sample[i].cur_sample_rates, mi->sample[i].sample_rates, -+ sizeof(mi->sample[i].cur_sample_rates)); -+} -+ -+ - /* - * Update rate statistics and select new primary rates - * -@@ -848,8 +1046,6 @@ minstrel_ht_update_stats(struct minstrel - mi->ampdu_packets = 0; - } - -- mi->sample_count = 0; -- - if (mi->supported[MINSTREL_CCK_GROUP]) - group = MINSTREL_CCK_GROUP; - else if (mi->supported[MINSTREL_OFDM_GROUP]) -@@ -884,8 +1080,6 @@ minstrel_ht_update_stats(struct minstrel - if (!mi->supported[group]) - continue; - -- mi->sample_count++; -- - /* (re)Initialize group rate indexes */ - for(j = 0; j < MAX_THR_RATES; j++) - tmp_group_tp_rate[j] = MI_RATE(group, 0); -@@ -952,9 +1146,7 @@ minstrel_ht_update_stats(struct minstrel - - /* Try to increase robustness of max_prob_rate*/ - minstrel_ht_prob_rate_reduce_streams(mi); -- -- /* try to sample half of all available rates during each interval */ -- mi->sample_count *= 4; -+ minstrel_ht_refill_sample_rates(mi); - - if (sample) - minstrel_ht_rate_sample_switch(mp, mi); -@@ -971,6 +1163,7 @@ minstrel_ht_update_stats(struct minstrel - - /* Reset update timer */ - mi->last_stats_update = jiffies; -+ mi->sample_time = jiffies; - } - - static bool -@@ -1001,28 +1194,6 @@ minstrel_ht_txstat_valid(struct minstrel - } - - static void --minstrel_set_next_sample_idx(struct minstrel_ht_sta *mi) --{ -- struct minstrel_mcs_group_data *mg; -- -- for (;;) { -- mi->sample_group++; -- mi->sample_group %= ARRAY_SIZE(minstrel_mcs_groups); -- mg = &mi->groups[mi->sample_group]; -- -- if (!mi->supported[mi->sample_group]) -- continue; -- -- if (++mg->index >= MCS_GROUP_RATES) { -- mg->index = 0; -- if (++mg->column >= ARRAY_SIZE(sample_table)) -- mg->column = 0; -- } -- break; -- } --} -- --static void - minstrel_downgrade_rate(struct minstrel_ht_sta *mi, u16 *idx, bool primary) - { - int group, orig_group; -@@ -1107,14 +1278,6 @@ minstrel_ht_tx_status(void *priv, struct - mi->ampdu_packets++; - mi->ampdu_len += info->status.ampdu_len; - -- if (!mi->sample_wait && !mi->sample_tries && mi->sample_count > 0) { -- int avg_ampdu_len = minstrel_ht_avg_ampdu_len(mi); -- -- mi->sample_wait = 16 + 2 * avg_ampdu_len; -- mi->sample_tries = 1; -- mi->sample_count--; -- } -- - if (mi->sample_mode != MINSTREL_SAMPLE_IDLE) - rate_sample = minstrel_get_ratestats(mi, mi->sample_rate); - -@@ -1386,97 +1549,20 @@ minstrel_ht_update_rates(struct minstrel - rate_control_set_rates(mp->hw, mi->sta, rates); - } - --static int --minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) -+static u16 -+minstrel_ht_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) - { -- struct minstrel_rate_stats *mrs; -- struct minstrel_mcs_group_data *mg; -- unsigned int sample_dur, sample_group, cur_max_tp_streams; -- int tp_rate1, tp_rate2; -- int sample_idx = 0; -- -- if (mp->hw->max_rates == 1 && mp->sample_switch && -- (mi->total_packets_cur >= SAMPLE_SWITCH_THR || -- mp->sample_switch == 1)) -- return -1; -- -- if (mi->sample_wait > 0) { -- mi->sample_wait--; -- return -1; -- } -- -- if (!mi->sample_tries) -- return -1; -- -- sample_group = mi->sample_group; -- mg = &mi->groups[sample_group]; -- sample_idx = sample_table[mg->column][mg->index]; -- minstrel_set_next_sample_idx(mi); -- -- if (!(mi->supported[sample_group] & BIT(sample_idx))) -- return -1; -+ u8 seq; - -- mrs = &mg->rates[sample_idx]; -- sample_idx += MI_RATE(sample_group, 0); -- -- tp_rate1 = mi->max_tp_rate[0]; -- -- /* Set tp_rate2 to the second highest max_tp_rate */ -- if (minstrel_get_duration(mi->max_tp_rate[0]) > -- minstrel_get_duration(mi->max_tp_rate[1])) { -- tp_rate2 = mi->max_tp_rate[0]; -+ if (mp->hw->max_rates > 1) { -+ seq = mi->sample_seq; -+ mi->sample_seq = (seq + 1) % ARRAY_SIZE(minstrel_sample_seq); -+ seq = minstrel_sample_seq[seq]; - } else { -- tp_rate2 = mi->max_tp_rate[1]; -+ seq = MINSTREL_SAMPLE_TYPE_INC; - } - -- /* -- * Sampling might add some overhead (RTS, no aggregation) -- * to the frame. Hence, don't use sampling for the highest currently -- * used highest throughput or probability rate. -- */ -- if (sample_idx == mi->max_tp_rate[0] || sample_idx == mi->max_prob_rate) -- return -1; -- -- /* -- * Do not sample if the probability is already higher than 95%, -- * or if the rate is 3 times slower than the current max probability -- * rate, to avoid wasting airtime. -- */ -- sample_dur = minstrel_get_duration(sample_idx); -- if (mrs->prob_avg > MINSTREL_FRAC(95, 100) || -- minstrel_get_duration(mi->max_prob_rate) * 3 < sample_dur) -- return -1; -- -- -- /* -- * For devices with no configurable multi-rate retry, skip sampling -- * below the per-group max throughput rate, and only use one sampling -- * attempt per rate -- */ -- if (mp->hw->max_rates == 1 && -- (minstrel_get_duration(mg->max_group_tp_rate[0]) < sample_dur || -- mrs->attempts)) -- return -1; -- -- /* Skip already sampled slow rates */ -- if (sample_dur >= minstrel_get_duration(tp_rate1) && mrs->attempts) -- return -1; -- -- /* -- * Make sure that lower rates get sampled only occasionally, -- * if the link is working perfectly. -- */ -- -- cur_max_tp_streams = minstrel_mcs_groups[MI_RATE_GROUP(tp_rate1)].streams; -- if (sample_dur >= minstrel_get_duration(tp_rate2) && -- (cur_max_tp_streams - 1 < -- minstrel_mcs_groups[sample_group].streams || -- sample_dur >= minstrel_get_duration(mi->max_prob_rate))) -- return -1; -- -- mi->sample_tries--; -- -- return sample_idx; -+ return __minstrel_ht_get_sample_rate(mi, seq); - } - - static void -@@ -1488,7 +1574,7 @@ minstrel_ht_get_rate(void *priv, struct - struct ieee80211_tx_rate *rate = &info->status.rates[0]; - struct minstrel_ht_sta *mi = priv_sta; - struct minstrel_priv *mp = priv; -- int sample_idx; -+ u16 sample_idx; - - if (!(info->flags & IEEE80211_TX_CTL_AMPDU) && - !minstrel_ht_is_legacy_group(MI_RATE_GROUP(mi->max_prob_rate))) -@@ -1504,11 +1590,19 @@ minstrel_ht_get_rate(void *priv, struct - /* Don't use EAPOL frames for sampling on non-mrr hw */ - if (mp->hw->max_rates == 1 && - (info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) -- sample_idx = -1; -- else -- sample_idx = minstrel_get_sample_rate(mp, mi); -+ return; -+ -+ if (mp->hw->max_rates == 1 && mp->sample_switch && -+ (mi->total_packets_cur >= SAMPLE_SWITCH_THR || -+ mp->sample_switch == 1)) -+ return; -+ -+ if (time_is_before_jiffies(mi->sample_time)) -+ return; - -- if (sample_idx < 0) -+ mi->sample_time = jiffies + MINSTREL_SAMPLE_INTERVAL; -+ sample_idx = minstrel_ht_get_sample_rate(mp, mi); -+ if (!sample_idx) - return; - - sample_group = &minstrel_mcs_groups[MI_RATE_GROUP(sample_idx)]; -@@ -1629,16 +1723,6 @@ minstrel_ht_update_caps(void *priv, stru - - mi->avg_ampdu_len = MINSTREL_FRAC(1, 1); - -- /* When using MRR, sample more on the first attempt, without delay */ -- if (mp->has_mrr) { -- mi->sample_count = 16; -- mi->sample_wait = 0; -- } else { -- mi->sample_count = 8; -- mi->sample_wait = 8; -- } -- mi->sample_tries = 4; -- - if (!use_vht) { - stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >> - IEEE80211_HT_CAP_RX_STBC_SHIFT; ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -69,6 +69,8 @@ - #define MI_RATE_IDX(_rate) FIELD_GET(MI_RATE_IDX_MASK, _rate) - #define MI_RATE_GROUP(_rate) FIELD_GET(MI_RATE_GROUP_MASK, _rate) - -+#define MINSTREL_SAMPLE_RATES 5 /* rates per sample type */ -+#define MINSTREL_SAMPLE_INTERVAL (HZ / 50) - - struct minstrel_priv { - struct ieee80211_hw *hw; -@@ -126,6 +128,13 @@ struct minstrel_rate_stats { - bool retry_updated; - }; - -+enum minstrel_sample_type { -+ MINSTREL_SAMPLE_TYPE_INC, -+ MINSTREL_SAMPLE_TYPE_JUMP, -+ MINSTREL_SAMPLE_TYPE_SLOW, -+ __MINSTREL_SAMPLE_TYPE_MAX -+}; -+ - struct minstrel_mcs_group_data { - u8 index; - u8 column; -@@ -144,6 +153,12 @@ enum minstrel_sample_mode { - MINSTREL_SAMPLE_PENDING, - }; - -+struct minstrel_sample_category { -+ u8 sample_group; -+ u16 sample_rates[MINSTREL_SAMPLE_RATES]; -+ u16 cur_sample_rates[MINSTREL_SAMPLE_RATES]; -+}; -+ - struct minstrel_ht_sta { - struct ieee80211_sta *sta; - -@@ -175,16 +190,14 @@ struct minstrel_ht_sta { - /* tx flags to add for frames for this sta */ - u32 tx_flags; - -- u8 sample_wait; -- u8 sample_tries; -- u8 sample_count; -+ unsigned long sample_time; -+ struct minstrel_sample_category sample[__MINSTREL_SAMPLE_TYPE_MAX]; -+ -+ u8 sample_seq; - - enum minstrel_sample_mode sample_mode; - u16 sample_rate; - -- /* current MCS group to be sampled */ -- u8 sample_group; -- - u8 band; - - /* Bitfield of supported MCS rates of all groups */ diff --git a/package/kernel/mac80211/patches/subsys/350-mac80211-minstrel_ht-show-sampling-rates-in-debugfs.patch b/package/kernel/mac80211/patches/subsys/350-mac80211-minstrel_ht-show-sampling-rates-in-debugfs.patch deleted file mode 100644 index 041ba31a37..0000000000 --- a/package/kernel/mac80211/patches/subsys/350-mac80211-minstrel_ht-show-sampling-rates-in-debugfs.patch +++ /dev/null @@ -1,58 +0,0 @@ -From: Felix Fietkau -Date: Sat, 23 Jan 2021 00:10:34 +0100 -Subject: [PATCH] mac80211: minstrel_ht: show sampling rates in debugfs - -This makes it easier to see what rates are going to be tested next - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c -@@ -32,6 +32,18 @@ minstrel_stats_release(struct inode *ino - return 0; - } - -+static bool -+minstrel_ht_is_sample_rate(struct minstrel_ht_sta *mi, int idx) -+{ -+ int type, i; -+ -+ for (type = 0; type < ARRAY_SIZE(mi->sample); type++) -+ for (i = 0; i < MINSTREL_SAMPLE_RATES; i++) -+ if (mi->sample[type].cur_sample_rates[i] == idx) -+ return true; -+ return false; -+} -+ - static char * - minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) - { -@@ -84,6 +96,7 @@ minstrel_ht_stats_dump(struct minstrel_h - *(p++) = (idx == mi->max_tp_rate[2]) ? 'C' : ' '; - *(p++) = (idx == mi->max_tp_rate[3]) ? 'D' : ' '; - *(p++) = (idx == mi->max_prob_rate) ? 'P' : ' '; -+ *(p++) = minstrel_ht_is_sample_rate(mi, idx) ? 'S' : ' '; - - if (gflags & IEEE80211_TX_RC_MCS) { - p += sprintf(p, " MCS%-2u", (mg->streams - 1) * 8 + j); -@@ -145,9 +158,9 @@ minstrel_ht_stats_open(struct inode *ino - - p += sprintf(p, "\n"); - p += sprintf(p, -- " best ____________rate__________ ____statistics___ _____last____ ______sum-of________\n"); -+ " best ____________rate__________ ____statistics___ _____last____ ______sum-of________\n"); - p += sprintf(p, -- "mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob)] [retry|suc|att] [#success | #attempts]\n"); -+ "mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob)] [retry|suc|att] [#success | #attempts]\n"); - - p = minstrel_ht_stats_dump(mi, MINSTREL_CCK_GROUP, p); - for (i = 0; i < MINSTREL_CCK_GROUP; i++) -@@ -228,6 +241,7 @@ minstrel_ht_stats_csv_dump(struct minstr - p += sprintf(p, "%s" ,((idx == mi->max_tp_rate[2]) ? "C" : "")); - p += sprintf(p, "%s" ,((idx == mi->max_tp_rate[3]) ? "D" : "")); - p += sprintf(p, "%s" ,((idx == mi->max_prob_rate) ? "P" : "")); -+ p += sprintf(p, "%s", (minstrel_ht_is_sample_rate(mi, idx) ? "S" : "")); - - if (gflags & IEEE80211_TX_RC_MCS) { - p += sprintf(p, ",MCS%-2u,", (mg->streams - 1) * 8 + j); diff --git a/package/kernel/mac80211/patches/subsys/351-mac80211-minstrel_ht-remove-sample-rate-switching-co.patch b/package/kernel/mac80211/patches/subsys/351-mac80211-minstrel_ht-remove-sample-rate-switching-co.patch deleted file mode 100644 index 8170ff85f8..0000000000 --- a/package/kernel/mac80211/patches/subsys/351-mac80211-minstrel_ht-remove-sample-rate-switching-co.patch +++ /dev/null @@ -1,279 +0,0 @@ -From: Felix Fietkau -Date: Sat, 23 Jan 2021 07:18:26 +0100 -Subject: [PATCH] mac80211: minstrel_ht: remove sample rate switching code for - constrained devices - -This was added to mitigate the effects of too much sampling on devices that -use a static global fallback table instead of configurable multi-rate retry. -Now that the sampling algorithm is improved, this code path no longer performs -any better than the standard probing on affected devices. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -648,27 +648,6 @@ __minstrel_ht_get_sample_rate(struct min - return 0; - } - --static void --minstrel_ht_rate_sample_switch(struct minstrel_priv *mp, -- struct minstrel_ht_sta *mi) --{ -- u16 rate; -- -- /* -- * Use rate switching instead of probing packets for devices with -- * little control over retry fallback behavior -- */ -- if (mp->hw->max_rates > 1) -- return; -- -- rate = __minstrel_ht_get_sample_rate(mi, MINSTREL_SAMPLE_TYPE_INC); -- if (!rate) -- return; -- -- mi->sample_rate = rate; -- mi->sample_mode = MINSTREL_SAMPLE_ACTIVE; --} -- - static inline int - minstrel_ewma(int old, int new, int weight) - { -@@ -1012,8 +991,7 @@ minstrel_ht_refill_sample_rates(struct m - * higher throughput rates, even if the probablity is a bit lower - */ - static void --minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, -- bool sample) -+minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) - { - struct minstrel_mcs_group_data *mg; - struct minstrel_rate_stats *mrs; -@@ -1023,18 +1001,6 @@ minstrel_ht_update_stats(struct minstrel - u16 index; - bool ht_supported = mi->sta->ht_cap.ht_supported; - -- mi->sample_mode = MINSTREL_SAMPLE_IDLE; -- -- if (sample) { -- mi->total_packets_cur = mi->total_packets - -- mi->total_packets_last; -- mi->total_packets_last = mi->total_packets; -- } -- if (!mp->sample_switch) -- sample = false; -- if (mi->total_packets_cur < SAMPLE_SWITCH_THR && mp->sample_switch != 1) -- sample = false; -- - if (mi->ampdu_packets > 0) { - if (!ieee80211_hw_check(mp->hw, TX_STATUS_NO_AMPDU_LEN)) - mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len, -@@ -1148,16 +1114,12 @@ minstrel_ht_update_stats(struct minstrel - minstrel_ht_prob_rate_reduce_streams(mi); - minstrel_ht_refill_sample_rates(mi); - -- if (sample) -- minstrel_ht_rate_sample_switch(mp, mi); -- - #ifdef CPTCFG_MAC80211_DEBUGFS - /* use fixed index if set */ - if (mp->fixed_rate_idx != -1) { - for (i = 0; i < 4; i++) - mi->max_tp_rate[i] = mp->fixed_rate_idx; - mi->max_prob_rate = mp->fixed_rate_idx; -- mi->sample_mode = MINSTREL_SAMPLE_IDLE; - } - #endif - -@@ -1247,11 +1209,10 @@ minstrel_ht_tx_status(void *priv, struct - struct ieee80211_tx_info *info = st->info; - struct minstrel_ht_sta *mi = priv_sta; - struct ieee80211_tx_rate *ar = info->status.rates; -- struct minstrel_rate_stats *rate, *rate2, *rate_sample = NULL; -+ struct minstrel_rate_stats *rate, *rate2; - struct minstrel_priv *mp = priv; - u32 update_interval = mp->update_interval; - bool last, update = false; -- bool sample_status = false; - int i; - - /* This packet was aggregated but doesn't carry status info */ -@@ -1278,49 +1239,18 @@ minstrel_ht_tx_status(void *priv, struct - mi->ampdu_packets++; - mi->ampdu_len += info->status.ampdu_len; - -- if (mi->sample_mode != MINSTREL_SAMPLE_IDLE) -- rate_sample = minstrel_get_ratestats(mi, mi->sample_rate); -- - last = !minstrel_ht_txstat_valid(mp, mi, &ar[0]); - for (i = 0; !last; i++) { - last = (i == IEEE80211_TX_MAX_RATES - 1) || - !minstrel_ht_txstat_valid(mp, mi, &ar[i + 1]); - - rate = minstrel_ht_get_stats(mp, mi, &ar[i]); -- if (rate == rate_sample) -- sample_status = true; -- - if (last) - rate->success += info->status.ampdu_ack_len; - - rate->attempts += ar[i].count * info->status.ampdu_len; - } - -- switch (mi->sample_mode) { -- case MINSTREL_SAMPLE_IDLE: -- if (mp->hw->max_rates > 1 || -- mi->total_packets_cur < SAMPLE_SWITCH_THR) -- update_interval /= 2; -- break; -- -- case MINSTREL_SAMPLE_ACTIVE: -- if (!sample_status) -- break; -- -- mi->sample_mode = MINSTREL_SAMPLE_PENDING; -- update = true; -- break; -- -- case MINSTREL_SAMPLE_PENDING: -- if (sample_status) -- break; -- -- update = true; -- minstrel_ht_update_stats(mp, mi, false); -- break; -- } -- -- - if (mp->hw->max_rates > 1) { - /* - * check for sudden death of spatial multiplexing, -@@ -1343,7 +1273,7 @@ minstrel_ht_tx_status(void *priv, struct - - if (time_after(jiffies, mi->last_stats_update + update_interval)) { - update = true; -- minstrel_ht_update_stats(mp, mi, true); -+ minstrel_ht_update_stats(mp, mi); - } - - if (update) -@@ -1522,18 +1452,14 @@ static void - minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) - { - struct ieee80211_sta_rates *rates; -- u16 first_rate = mi->max_tp_rate[0]; - int i = 0; - -- if (mi->sample_mode == MINSTREL_SAMPLE_ACTIVE) -- first_rate = mi->sample_rate; -- - rates = kzalloc(sizeof(*rates), GFP_ATOMIC); - if (!rates) - return; - - /* Start with max_tp_rate[0] */ -- minstrel_ht_set_rate(mp, mi, rates, i++, first_rate); -+ minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_tp_rate[0]); - - if (mp->hw->max_rates >= 3) { - /* At least 3 tx rates supported, use max_tp_rate[1] next */ -@@ -1592,11 +1518,6 @@ minstrel_ht_get_rate(void *priv, struct - (info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) - return; - -- if (mp->hw->max_rates == 1 && mp->sample_switch && -- (mi->total_packets_cur >= SAMPLE_SWITCH_THR || -- mp->sample_switch == 1)) -- return; -- - if (time_is_before_jiffies(mi->sample_time)) - return; - -@@ -1810,7 +1731,7 @@ minstrel_ht_update_caps(void *priv, stru - minstrel_ht_update_ofdm(mp, mi, sband, sta); - - /* create an initial rate table with the lowest supported rates */ -- minstrel_ht_update_stats(mp, mi, true); -+ minstrel_ht_update_stats(mp, mi); - minstrel_ht_update_rates(mp, mi); - } - -@@ -1926,8 +1847,6 @@ minstrel_ht_alloc(struct ieee80211_hw *h - if (!mp) - return NULL; - -- mp->sample_switch = -1; -- - /* contention window settings - * Just an approximation. Using the per-queue values would complicate - * the calculations and is probably unnecessary */ -@@ -1947,7 +1866,7 @@ minstrel_ht_alloc(struct ieee80211_hw *h - mp->has_mrr = true; - - mp->hw = hw; -- mp->update_interval = HZ / 10; -+ mp->update_interval = HZ / 20; - - minstrel_ht_init_cck_rates(mp); - for (i = 0; i < ARRAY_SIZE(mp->hw->wiphy->bands); i++) -@@ -1965,8 +1884,6 @@ static void minstrel_ht_add_debugfs(stru - mp->fixed_rate_idx = (u32) -1; - debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, - &mp->fixed_rate_idx); -- debugfs_create_u32("sample_switch", S_IRUGO | S_IWUSR, debugfsdir, -- &mp->sample_switch); - } - #endif - ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -75,7 +75,6 @@ - struct minstrel_priv { - struct ieee80211_hw *hw; - bool has_mrr; -- u32 sample_switch; - unsigned int cw_min; - unsigned int cw_max; - unsigned int max_retry; -@@ -147,12 +146,6 @@ struct minstrel_mcs_group_data { - struct minstrel_rate_stats rates[MCS_GROUP_RATES]; - }; - --enum minstrel_sample_mode { -- MINSTREL_SAMPLE_IDLE, -- MINSTREL_SAMPLE_ACTIVE, -- MINSTREL_SAMPLE_PENDING, --}; -- - struct minstrel_sample_category { - u8 sample_group; - u16 sample_rates[MINSTREL_SAMPLE_RATES]; -@@ -182,23 +175,19 @@ struct minstrel_ht_sta { - unsigned int overhead_legacy; - unsigned int overhead_legacy_rtscts; - -- unsigned int total_packets_last; -- unsigned int total_packets_cur; - unsigned int total_packets; - unsigned int sample_packets; - - /* tx flags to add for frames for this sta */ - u32 tx_flags; - -- unsigned long sample_time; -- struct minstrel_sample_category sample[__MINSTREL_SAMPLE_TYPE_MAX]; -+ u8 band; - - u8 sample_seq; -- -- enum minstrel_sample_mode sample_mode; - u16 sample_rate; - -- u8 band; -+ unsigned long sample_time; -+ struct minstrel_sample_category sample[__MINSTREL_SAMPLE_TYPE_MAX]; - - /* Bitfield of supported MCS rates of all groups */ - u16 supported[MINSTREL_GROUPS_NB]; diff --git a/package/kernel/mac80211/patches/subsys/352-mac80211-minstrel_ht-fix-regression-in-the-max_prob_.patch b/package/kernel/mac80211/patches/subsys/352-mac80211-minstrel_ht-fix-regression-in-the-max_prob_.patch deleted file mode 100644 index a366a921d4..0000000000 --- a/package/kernel/mac80211/patches/subsys/352-mac80211-minstrel_ht-fix-regression-in-the-max_prob_.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Felix Fietkau -Date: Tue, 26 Jan 2021 16:40:52 +0100 -Subject: [PATCH] mac80211: minstrel_ht: fix regression in the max_prob_rate - fix - -Since mi->max_prob_rate is overwritten after the loop that calls -minstrel_ht_set_best_prob_rate, the new best rate needs to be written to *dest - -Fixes: a7fca4e4037f ("mac80211: minstrel_ht: fix max probability rate selection") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -545,7 +545,7 @@ minstrel_ht_set_best_prob_rate(struct mi - cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx, - mrs->prob_avg); - if (cur_tp_avg > tmp_tp_avg) -- mi->max_prob_rate = index; -+ *dest = index; - - max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group, - max_gpr_idx, diff --git a/package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch b/package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch index aec2e07781..63cb6834cf 100644 --- a/package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch +++ b/package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch @@ -86,7 +86,7 @@ Signed-off-by: Felix Fietkau static u16 __minstrel_ht_get_sample_rate(struct minstrel_ht_sta *mi, enum minstrel_sample_type type) -@@ -1111,8 +1080,6 @@ minstrel_ht_update_stats(struct minstrel +@@ -1109,8 +1078,6 @@ minstrel_ht_update_stats(struct minstrel mi->max_prob_rate = tmp_max_prob_rate; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau minstrel_ht_refill_sample_rates(mi); #ifdef CPTCFG_MAC80211_DEBUGFS -@@ -1157,7 +1124,7 @@ minstrel_ht_txstat_valid(struct minstrel +@@ -1155,7 +1122,7 @@ minstrel_ht_txstat_valid(struct minstrel } static void @@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau { int group, orig_group; -@@ -1172,11 +1139,7 @@ minstrel_downgrade_rate(struct minstrel_ +@@ -1170,11 +1137,7 @@ minstrel_downgrade_rate(struct minstrel_ minstrel_mcs_groups[orig_group].streams) continue; @@ -117,7 +117,7 @@ Signed-off-by: Felix Fietkau } } -@@ -1210,7 +1173,7 @@ minstrel_ht_tx_status(void *priv, struct +@@ -1208,7 +1171,7 @@ minstrel_ht_tx_status(void *priv, struct struct ieee80211_tx_info *info = st->info; struct minstrel_ht_sta *mi = priv_sta; struct ieee80211_tx_rate *ar = info->status.rates; @@ -126,7 +126,7 @@ Signed-off-by: Felix Fietkau struct minstrel_priv *mp = priv; u32 update_interval = mp->update_interval; bool last, update = false; -@@ -1256,18 +1219,13 @@ minstrel_ht_tx_status(void *priv, struct +@@ -1254,18 +1217,13 @@ minstrel_ht_tx_status(void *priv, struct /* * check for sudden death of spatial multiplexing, * downgrade to a lower number of streams if necessary. diff --git a/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch b/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch index cabe4f4561..26f295e680 100644 --- a/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch +++ b/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch @@ -48,7 +48,7 @@ Signed-off-by: Johannes Berg spin_unlock_bh(&fq->lock); } -@@ -3815,6 +3824,9 @@ bool ieee80211_txq_airtime_check(struct +@@ -3853,6 +3862,9 @@ bool ieee80211_txq_airtime_check(struct if (!txq->sta) return true; diff --git a/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch b/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch index 40aa76f2df..98bbed5afc 100644 --- a/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch +++ b/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch @@ -9,7 +9,7 @@ Signed-off-by: Lorenzo Bianconi --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4142,6 +4142,9 @@ static bool ieee80211_tx_8023(struct iee +@@ -4180,6 +4180,9 @@ static bool ieee80211_tx_8023(struct iee unsigned long flags; int q = info->hw_queue; diff --git a/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch b/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch index 2b64b55018..1e70d778b8 100644 --- a/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch +++ b/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -6186,6 +6186,11 @@ enum rate_control_capabilities { +@@ -6188,6 +6188,11 @@ enum rate_control_capabilities { * otherwise the NSS difference doesn't bother us. */ RATE_CTRL_CAPA_VHT_EXT_NSS_BW = BIT(0), @@ -25,7 +25,7 @@ Signed-off-by: Felix Fietkau struct rate_control_ops { --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1144,29 +1144,6 @@ minstrel_downgrade_prob_rate(struct mins +@@ -1142,29 +1142,6 @@ minstrel_downgrade_prob_rate(struct mins } static void @@ -55,7 +55,7 @@ Signed-off-by: Felix Fietkau minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband, void *priv_sta, struct ieee80211_tx_status *st) { -@@ -1461,10 +1438,6 @@ minstrel_ht_get_rate(void *priv, struct +@@ -1459,10 +1436,6 @@ minstrel_ht_get_rate(void *priv, struct struct minstrel_priv *mp = priv; u16 sample_idx; @@ -66,7 +66,7 @@ Signed-off-by: Felix Fietkau info->flags |= mi->tx_flags; #ifdef CPTCFG_MAC80211_DEBUGFS -@@ -1870,6 +1843,7 @@ static u32 minstrel_ht_get_expected_thro +@@ -1868,6 +1841,7 @@ static u32 minstrel_ht_get_expected_thro static const struct rate_control_ops mac80211_minstrel_ht = { .name = "minstrel_ht", @@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau .rate_init = minstrel_ht_rate_init, --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3902,6 +3902,29 @@ void ieee80211_txq_schedule_start(struct +@@ -3940,6 +3940,29 @@ void ieee80211_txq_schedule_start(struct } EXPORT_SYMBOL(ieee80211_txq_schedule_start); @@ -106,7 +106,7 @@ Signed-off-by: Felix Fietkau void __ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev, u32 info_flags, -@@ -3932,6 +3955,8 @@ void __ieee80211_subif_start_xmit(struct +@@ -3970,6 +3993,8 @@ void __ieee80211_subif_start_xmit(struct skb_get_hash(skb); } @@ -115,7 +115,7 @@ Signed-off-by: Felix Fietkau if (sta) { struct ieee80211_fast_tx *fast_tx; -@@ -4195,6 +4220,8 @@ static void ieee80211_8023_xmit(struct i +@@ -4233,6 +4258,8 @@ static void ieee80211_8023_xmit(struct i memset(info, 0, sizeof(*info)); diff --git a/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch b/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch index ab16576bcd..a09d97cab3 100644 --- a/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch +++ b/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch @@ -29,7 +29,7 @@ Signed-off-by: Ryder Lee CALL_TXH(ieee80211_tx_h_michael_mic_add); CALL_TXH(ieee80211_tx_h_sequence); CALL_TXH(ieee80211_tx_h_fragment); -@@ -3353,15 +3354,21 @@ out: +@@ -3386,15 +3387,21 @@ out: * Can be called while the sta lock is held. Anything that can cause packets to * be generated will cause deadlock! */ @@ -55,7 +55,7 @@ Signed-off-by: Ryder Lee if (key) info->control.hw_key = &key->conf; -@@ -3410,6 +3417,8 @@ static void ieee80211_xmit_fast_finish(s +@@ -3443,6 +3450,8 @@ static void ieee80211_xmit_fast_finish(s break; } } @@ -64,7 +64,7 @@ Signed-off-by: Ryder Lee } static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -@@ -3513,24 +3522,17 @@ static bool ieee80211_xmit_fast(struct i +@@ -3546,24 +3555,17 @@ static bool ieee80211_xmit_fast(struct i tx.sta = sta; tx.key = fast_tx->key; @@ -97,7 +97,7 @@ Signed-off-by: Ryder Lee if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) sdata = container_of(sdata->bss, -@@ -3641,8 +3643,12 @@ begin: +@@ -3674,8 +3676,12 @@ begin: (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) pn_offs = ieee80211_hdrlen(hdr->frame_control); diff --git a/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch b/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch index 6acb814b28..01bbde045b 100644 --- a/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch +++ b/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch @@ -81,7 +81,7 @@ Signed-off-by: Ryder Lee tx->sta->tx_stats.last_rate = txrc.reported_rate; } else if (tx->sta) tx->sta->tx_stats.last_rate = txrc.reported_rate; -@@ -3631,8 +3633,16 @@ begin: +@@ -3664,8 +3666,16 @@ begin: else info->flags &= ~IEEE80211_TX_CTL_AMPDU; @@ -101,7 +101,7 @@ Signed-off-by: Ryder Lee struct sta_info *sta = container_of(txq->sta, struct sta_info, --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -6754,4 +6754,22 @@ struct sk_buff *ieee80211_get_fils_disco +@@ -6761,4 +6761,22 @@ struct sk_buff *ieee80211_get_fils_disco struct sk_buff * ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw, struct ieee80211_vif *vif); diff --git a/package/kernel/mac80211/patches/subsys/377-mac80211-minstrel_ht-fix-sample-time-check.patch b/package/kernel/mac80211/patches/subsys/377-mac80211-minstrel_ht-fix-sample-time-check.patch deleted file mode 100644 index 054662f3ef..0000000000 --- a/package/kernel/mac80211/patches/subsys/377-mac80211-minstrel_ht-fix-sample-time-check.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Felix Fietkau -Date: Thu, 17 Jun 2021 12:05:54 +0200 -Subject: [PATCH] mac80211: minstrel_ht: fix sample time check - -We need to skip sampling if the next sample time is after jiffies, not before. -This patch fixes an issue where in some cases only very little sampling (or none -at all) is performed, leading to really bad data rates - -Fixes: 80d55154b2f8 ("mac80211: minstrel_ht: significantly redesign the rate probing strategy") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1450,7 +1450,7 @@ minstrel_ht_get_rate(void *priv, struct - (info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) - return; - -- if (time_is_before_jiffies(mi->sample_time)) -+ if (time_is_after_jiffies(mi->sample_time)) - return; - - mi->sample_time = jiffies + MINSTREL_SAMPLE_INTERVAL; diff --git a/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch b/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch index 3ba611b3aa..234ca67624 100644 --- a/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch +++ b/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch @@ -80,7 +80,7 @@ Signed-off-by: Felix Fietkau if (tid_tx) { bool queued; -@@ -3918,29 +3948,6 @@ void ieee80211_txq_schedule_start(struct +@@ -3956,29 +3986,6 @@ void ieee80211_txq_schedule_start(struct } EXPORT_SYMBOL(ieee80211_txq_schedule_start); diff --git a/package/kernel/mac80211/patches/subsys/380-mac80211-introduce-aql_enable-node-in-debugfs.patch b/package/kernel/mac80211/patches/subsys/380-mac80211-introduce-aql_enable-node-in-debugfs.patch deleted file mode 100644 index b8a87a7cc1..0000000000 --- a/package/kernel/mac80211/patches/subsys/380-mac80211-introduce-aql_enable-node-in-debugfs.patch +++ /dev/null @@ -1,111 +0,0 @@ -From: Lorenzo Bianconi -Date: Sat, 9 Jan 2021 18:57:51 +0100 -Subject: [PATCH] mac80211: introduce aql_enable node in debugfs - -Introduce aql_enable node in debugfs in order to enable/disable aql. -This is useful for debugging purpose. - -Signed-off-by: Lorenzo Bianconi -Link: https://lore.kernel.org/r/e7a934d5d84e4796c4f97ea5de4e66c824296b07.1610214851.git.lorenzo@kernel.org -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -281,6 +281,56 @@ static const struct file_operations aql_ - .llseek = default_llseek, - }; - -+static ssize_t aql_enable_read(struct file *file, char __user *user_buf, -+ size_t count, loff_t *ppos) -+{ -+ char buf[3]; -+ int len; -+ -+ len = scnprintf(buf, sizeof(buf), "%d\n", -+ !static_key_false(&aql_disable.key)); -+ -+ return simple_read_from_buffer(user_buf, count, ppos, buf, len); -+} -+ -+static ssize_t aql_enable_write(struct file *file, const char __user *user_buf, -+ size_t count, loff_t *ppos) -+{ -+ bool aql_disabled = static_key_false(&aql_disable.key); -+ char buf[3]; -+ size_t len; -+ -+ if (count > sizeof(buf)) -+ return -EINVAL; -+ -+ if (copy_from_user(buf, user_buf, count)) -+ return -EFAULT; -+ -+ buf[sizeof(buf) - 1] = '\0'; -+ len = strlen(buf); -+ if (len > 0 && buf[len - 1] == '\n') -+ buf[len - 1] = 0; -+ -+ if (buf[0] == '0' && buf[1] == '\0') { -+ if (!aql_disabled) -+ static_branch_inc(&aql_disable); -+ } else if (buf[0] == '1' && buf[1] == '\0') { -+ if (aql_disabled) -+ static_branch_dec(&aql_disable); -+ } else { -+ return -EINVAL; -+ } -+ -+ return count; -+} -+ -+static const struct file_operations aql_enable_ops = { -+ .write = aql_enable_write, -+ .read = aql_enable_read, -+ .open = simple_open, -+ .llseek = default_llseek, -+}; -+ - static ssize_t force_tx_status_read(struct file *file, - char __user *user_buf, - size_t count, -@@ -569,6 +619,7 @@ void debugfs_hw_add(struct ieee80211_loc - DEBUGFS_ADD(power); - DEBUGFS_ADD(hw_conf); - DEBUGFS_ADD_MODE(force_tx_status, 0600); -+ DEBUGFS_ADD_MODE(aql_enable, 0600); - - if (local->ops->wake_tx_queue) - DEBUGFS_ADD_MODE(aqm, 0600); ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1147,6 +1147,8 @@ enum mac80211_scan_state { - SCAN_ABORT, - }; - -+DECLARE_STATIC_KEY_FALSE(aql_disable); -+ - struct ieee80211_local { - /* embed the driver visible part. - * don't cast (use the static inlines below), but we keep ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3858,6 +3858,8 @@ void __ieee80211_schedule_txq(struct iee - } - EXPORT_SYMBOL(__ieee80211_schedule_txq); - -+DEFINE_STATIC_KEY_FALSE(aql_disable); -+ - bool ieee80211_txq_airtime_check(struct ieee80211_hw *hw, - struct ieee80211_txq *txq) - { -@@ -3867,6 +3869,9 @@ bool ieee80211_txq_airtime_check(struct - if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) - return true; - -+ if (static_branch_unlikely(&aql_disable)) -+ return true; -+ - if (!txq->sta) - return true; - diff --git a/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch b/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch index 8033b0d0d4..6a561b2a08 100644 --- a/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch +++ b/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch @@ -22,7 +22,7 @@ Signed-off-by: Johannes Berg */ #ifndef IEEE80211_I_H -@@ -854,9 +854,12 @@ struct txq_info { +@@ -843,9 +843,12 @@ struct txq_info { struct fq_tin tin; struct codel_vars def_cvars; struct codel_stats cstats; diff --git a/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch b/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch index 475715a2f9..d99ca5961c 100644 --- a/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch +++ b/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch @@ -50,7 +50,7 @@ Signed-off-by: Johannes Berg --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -6578,9 +6578,6 @@ static inline void ieee80211_txq_schedul +@@ -6585,9 +6585,6 @@ static inline void ieee80211_txq_schedul { } @@ -60,7 +60,7 @@ Signed-off-by: Johannes Berg /** * ieee80211_schedule_txq - schedule a TXQ for transmission * -@@ -6593,11 +6590,7 @@ void __ieee80211_schedule_txq(struct iee +@@ -6600,11 +6597,7 @@ void __ieee80211_schedule_txq(struct iee * The driver may call this function if it has buffered packets for * this TXQ internally. */ @@ -73,7 +73,7 @@ Signed-off-by: Johannes Berg /** * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() -@@ -6609,12 +6602,8 @@ ieee80211_schedule_txq(struct ieee80211_ +@@ -6616,12 +6609,8 @@ ieee80211_schedule_txq(struct ieee80211_ * The driver may set force=true if it has buffered packets for this TXQ * internally. */ @@ -227,7 +227,7 @@ Signed-off-by: Johannes Berg #ifdef CONFIG_PM static ssize_t reset_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) -@@ -624,7 +664,11 @@ void debugfs_hw_add(struct ieee80211_loc +@@ -631,7 +671,11 @@ void debugfs_hw_add(struct ieee80211_loc if (local->ops->wake_tx_queue) DEBUGFS_ADD_MODE(aqm, 0600); @@ -355,7 +355,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -846,20 +846,16 @@ enum txq_info_flags { +@@ -835,20 +835,16 @@ enum txq_info_flags { * @def_flow: used as a fallback flow when a packet destined to @tin hashes to * a fq_flow which is already owned by a different tin * @def_cvars: codel vars for @def_flow @@ -378,7 +378,7 @@ Signed-off-by: Johannes Berg unsigned long flags; /* keep last! */ -@@ -938,6 +934,8 @@ struct ieee80211_sub_if_data { +@@ -925,6 +921,8 @@ struct ieee80211_sub_if_data { struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS]; struct mac80211_qos_map __rcu *qos_map; @@ -387,7 +387,7 @@ Signed-off-by: Johannes Berg struct work_struct csa_finalize_work; bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */ struct cfg80211_chan_def csa_chandef; -@@ -1150,6 +1148,44 @@ enum mac80211_scan_state { +@@ -1137,6 +1135,44 @@ enum mac80211_scan_state { SCAN_ABORT, }; @@ -432,7 +432,7 @@ Signed-off-by: Johannes Berg DECLARE_STATIC_KEY_FALSE(aql_disable); struct ieee80211_local { -@@ -1163,13 +1199,8 @@ struct ieee80211_local { +@@ -1150,13 +1186,8 @@ struct ieee80211_local { struct codel_params cparams; /* protects active_txqs and txqi->schedule_order */ @@ -447,7 +447,7 @@ Signed-off-by: Johannes Berg u32 aql_threshold; atomic_t aql_total_pending_airtime; -@@ -1587,6 +1618,125 @@ static inline bool txq_has_queue(struct +@@ -1574,6 +1605,125 @@ static inline bool txq_has_queue(struct return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets); } @@ -573,7 +573,7 @@ Signed-off-by: Johannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) { return ether_addr_equal(raddr, addr) || -@@ -1827,6 +1977,14 @@ int ieee80211_tx_control_port(struct wip +@@ -1814,6 +1964,14 @@ int ieee80211_tx_control_port(struct wip u64 *cookie); int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, const u8 *buf, size_t len); @@ -590,7 +590,7 @@ Signed-off-by: Johannes Berg void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -2013,6 +2013,9 @@ int ieee80211_if_add(struct ieee80211_lo +@@ -2018,6 +2018,9 @@ int ieee80211_if_add(struct ieee80211_lo } } @@ -602,7 +602,7 @@ Signed-off-by: Johannes Berg sdata->ap_power_level = IEEE80211_UNSET_POWER_LEVEL; --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -691,10 +691,13 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -698,10 +698,13 @@ struct ieee80211_hw *ieee80211_alloc_hw_ spin_lock_init(&local->queue_stop_reason_lock); for (i = 0; i < IEEE80211_NUM_ACS; i++) { @@ -638,7 +638,7 @@ Signed-off-by: Johannes Berg set_bit(tid, &sta->txq_buffered_tids); --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c -@@ -424,15 +424,11 @@ struct sta_info *sta_info_alloc(struct i +@@ -426,15 +426,11 @@ struct sta_info *sta_info_alloc(struct i if (sta_prepare_rate_control(local, sta, gfp)) goto free_txq; @@ -655,7 +655,7 @@ Signed-off-by: Johannes Berg } for (i = 0; i < IEEE80211_NUM_TIDS; i++) -@@ -1894,24 +1890,59 @@ void ieee80211_sta_set_buffered(struct i +@@ -1893,24 +1889,59 @@ void ieee80211_sta_set_buffered(struct i } EXPORT_SYMBOL(ieee80211_sta_set_buffered); @@ -727,7 +727,7 @@ Signed-off-by: Johannes Berg } EXPORT_SYMBOL(ieee80211_sta_register_airtime); -@@ -2360,7 +2391,7 @@ void sta_set_sinfo(struct sta_info *sta, +@@ -2354,7 +2385,7 @@ void sta_set_sinfo(struct sta_info *sta, } if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT))) { @@ -765,7 +765,7 @@ Signed-off-by: Johannes Berg struct sta_info; -@@ -487,7 +494,6 @@ struct ieee80211_sta_rx_stats { +@@ -515,7 +522,6 @@ struct ieee80211_fragment_cache { * @tid_seq: per-TID sequence numbers for sending to this STA * @airtime: per-AC struct airtime_info describing airtime statistics for this * station @@ -773,7 +773,7 @@ Signed-off-by: Johannes Berg * @ampdu_mlme: A-MPDU state machine state * @mesh: mesh STA information * @debugfs_dir: debug filesystem directory dentry -@@ -617,7 +623,6 @@ struct sta_info { +@@ -646,7 +652,6 @@ struct sta_info { u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; struct airtime_info airtime[IEEE80211_NUM_ACS]; @@ -839,7 +839,7 @@ Signed-off-by: Johannes Berg } void ieee80211_txq_set_params(struct ieee80211_local *local) -@@ -3768,102 +3767,259 @@ EXPORT_SYMBOL(ieee80211_tx_dequeue); +@@ -3801,102 +3800,259 @@ EXPORT_SYMBOL(ieee80211_tx_dequeue); struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) { struct ieee80211_local *local = hw_to_local(hw); @@ -999,7 +999,7 @@ Signed-off-by: Johannes Berg +{ + struct airtime_info *air_info, *tmp; + u64 weight_sum = 0; - ++ + if (unlikely(!now)) + now = ktime_get_boottime_ns(); + @@ -1008,8 +1008,7 @@ Signed-off-by: Johannes Berg + if (!force && (air_sched->last_weight_update < + now - AIRTIME_ACTIVE_DURATION)) + return; - -- if (txqi->schedule_round == local->schedule_round[ac]) ++ + list_for_each_entry_safe(air_info, tmp, + &air_sched->active_list, list) { + if (airtime_is_active(air_info, now)) @@ -1020,7 +1019,7 @@ Signed-off-by: Johannes Berg + airtime_weight_sum_set(air_sched, weight_sum); + air_sched->last_weight_update = now; +} -+ + +void ieee80211_schedule_txq(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) + __acquires(txq_lock) __releases(txq_lock) @@ -1032,7 +1031,8 @@ Signed-off-by: Johannes Berg + struct airtime_info *air_info; + u8 ac = txq->ac; + bool was_active; -+ + +- if (txqi->schedule_round == local->schedule_round[ac]) + air_sched = &local->airtime[ac]; + air_info = to_airtime_info(txq); + @@ -1161,7 +1161,7 @@ Signed-off-by: Johannes Berg struct ieee80211_local *local = hw_to_local(hw); if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) -@@ -3878,15 +4034,12 @@ bool ieee80211_txq_airtime_check(struct +@@ -3911,15 +4067,12 @@ bool ieee80211_txq_airtime_check(struct if (unlikely(txq->tid == IEEE80211_NUM_TIDS)) return true; @@ -1179,7 +1179,7 @@ Signed-off-by: Johannes Berg return true; return false; -@@ -3896,60 +4049,59 @@ EXPORT_SYMBOL(ieee80211_txq_airtime_chec +@@ -3929,60 +4082,59 @@ EXPORT_SYMBOL(ieee80211_txq_airtime_chec bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq) { @@ -1200,11 +1200,11 @@ Signed-off-by: Johannes Berg - goto out; + if (!ieee80211_txq_airtime_check(hw, txq)) + return false; - -- if (list_empty(&txqi->schedule_order)) ++ + air_sched = &local->airtime[txq->ac]; + spin_lock_bh(&air_sched->lock); -+ + +- if (list_empty(&txqi->schedule_order)) + if (RB_EMPTY_NODE(&txqi->schedule_order)) goto out; @@ -1223,7 +1223,6 @@ Signed-off-by: Johannes Berg - if (sta->airtime[ac].deficit < 0) - sta->airtime[ac].deficit += sta->airtime_weight; - list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); -- } + /* Like in ieee80211_next_txq(), make sure the first station in the + * scheduling order is eligible for transmission to avoid starvation. + */ @@ -1232,14 +1231,15 @@ Signed-off-by: Johannes Berg + first_txqi = container_of(node, struct txq_info, + schedule_order); + air_info = to_airtime_info(&first_txqi->txq); ++ ++ if (air_sched->v_t < air_info->v_t) ++ airtime_catchup_v_t(air_sched, air_info->v_t, now); + } - sta = container_of(txqi->txq.sta, struct sta_info, sta); - if (sta->airtime[ac].deficit >= 0) - goto out; -+ if (air_sched->v_t < air_info->v_t) -+ airtime_catchup_v_t(air_sched, air_info->v_t, now); -+ } - +- - sta->airtime[ac].deficit += sta->airtime_weight; - list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]); - spin_unlock_bh(&local->active_txq_lock[ac]); diff --git a/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch b/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch index 8aec8cedf4..5973b426b6 100644 --- a/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch +++ b/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch @@ -14,7 +14,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3280,6 +3280,9 @@ static bool ieee80211_amsdu_aggregate(st +@@ -3313,6 +3313,9 @@ static bool ieee80211_amsdu_aggregate(st if (!ieee80211_hw_check(&local->hw, TX_AMSDU)) return false; diff --git a/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch b/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch index 6a1757a38a..3ed4543adb 100644 --- a/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch +++ b/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch @@ -51,7 +51,7 @@ Signed-off-by: Johannes Berg * struct iface_combination_params - input parameters for interface combinations * * Used to pass interface combination parameters -@@ -3975,6 +3996,8 @@ struct mgmt_frame_regs { +@@ -3983,6 +4004,8 @@ struct mgmt_frame_regs { * given TIDs. This callback may sleep. * * @set_sar_specs: Update the SAR (TX power) settings. @@ -60,7 +60,7 @@ Signed-off-by: Johannes Berg */ struct cfg80211_ops { int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); -@@ -4302,6 +4325,9 @@ struct cfg80211_ops { +@@ -4310,6 +4333,9 @@ struct cfg80211_ops { const u8 *peer, u8 tids); int (*set_sar_specs)(struct wiphy *wiphy, struct cfg80211_sar_specs *sar); @@ -70,7 +70,7 @@ Signed-off-by: Johannes Berg }; /* -@@ -8089,4 +8115,70 @@ void cfg80211_update_owe_info_event(stru +@@ -8193,4 +8219,70 @@ void cfg80211_update_owe_info_event(stru */ void cfg80211_bss_flush(struct wiphy *wiphy); @@ -230,10 +230,10 @@ Signed-off-by: Johannes Berg NUM_NL80211_EXT_FEATURES, --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -753,6 +753,10 @@ static const struct nla_policy nl80211_p - NL80211_SAE_PWE_BOTH), +@@ -774,6 +774,10 @@ static const struct nla_policy nl80211_p [NL80211_ATTR_RECONNECT_REQUESTED] = { .type = NLA_REJECT }, [NL80211_ATTR_SAR_SPEC] = NLA_POLICY_NESTED(sar_policy), + [NL80211_ATTR_DISABLE_HE] = { .type = NLA_FLAG }, + [NL80211_ATTR_OBSS_COLOR_BITMAP] = { .type = NLA_U64 }, + [NL80211_ATTR_COLOR_CHANGE_COUNT] = { .type = NLA_U8 }, + [NL80211_ATTR_COLOR_CHANGE_COLOR] = { .type = NLA_U8 }, @@ -241,7 +241,7 @@ Signed-off-by: Johannes Berg }; /* policy for the key attributes */ -@@ -14659,6 +14663,106 @@ bad_tid_conf: +@@ -14813,6 +14817,106 @@ bad_tid_conf: return ret; } @@ -348,7 +348,7 @@ Signed-off-by: Johannes Berg #define NL80211_FLAG_NEED_WIPHY 0x01 #define NL80211_FLAG_NEED_NETDEV 0x02 #define NL80211_FLAG_NEED_RTNL 0x04 -@@ -15730,6 +15834,14 @@ static const struct genl_small_ops nl802 +@@ -15813,6 +15917,14 @@ static const struct genl_small_ops nl802 .internal_flags = NL80211_FLAG_NEED_WIPHY | NL80211_FLAG_NEED_RTNL, }, @@ -363,7 +363,7 @@ Signed-off-by: Johannes Berg }; static struct genl_family nl80211_fam __genl_ro_after_init = { -@@ -17361,6 +17473,51 @@ void cfg80211_ch_switch_started_notify(s +@@ -17444,6 +17556,51 @@ void cfg80211_ch_switch_started_notify(s } EXPORT_SYMBOL(cfg80211_ch_switch_started_notify); diff --git a/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch b/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch index fc99b36c5d..7957239627 100644 --- a/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch +++ b/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch @@ -40,7 +40,7 @@ Signed-off-by: Johannes Berg /* must be last */ u8 drv_priv[] __aligned(sizeof(void *)); }; -@@ -4986,6 +4993,16 @@ void ieee80211_csa_finish(struct ieee802 +@@ -4988,6 +4995,16 @@ void ieee80211_csa_finish(struct ieee802 bool ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif); /** @@ -57,7 +57,7 @@ Signed-off-by: Johannes Berg * ieee80211_proberesp_get - retrieve a Probe Response template * @hw: pointer obtained from ieee80211_alloc_hw(). * @vif: &struct ieee80211_vif pointer from the add_interface callback. -@@ -6745,6 +6762,18 @@ ieee80211_get_unsol_bcast_probe_resp_tmp +@@ -6752,6 +6769,18 @@ ieee80211_get_unsol_bcast_probe_resp_tmp struct ieee80211_vif *vif); /** @@ -411,7 +411,7 @@ Signed-off-by: Johannes Berg }; --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -259,6 +259,12 @@ struct ieee80211_csa_settings { +@@ -248,6 +248,12 @@ struct ieee80211_csa_settings { u8 count; }; @@ -424,7 +424,7 @@ Signed-off-by: Johannes Berg struct beacon_data { u8 *head, *tail; int head_len, tail_len; -@@ -940,6 +946,8 @@ struct ieee80211_sub_if_data { +@@ -927,6 +933,8 @@ struct ieee80211_sub_if_data { bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */ struct cfg80211_chan_def csa_chandef; @@ -433,7 +433,7 @@ Signed-off-by: Johannes Berg struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */ struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */ -@@ -1906,6 +1914,9 @@ void ieee80211_csa_finalize_work(struct +@@ -1893,6 +1901,9 @@ void ieee80211_csa_finalize_work(struct int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_csa_settings *params); @@ -445,7 +445,7 @@ Signed-off-by: Johannes Berg NETIF_F_HW_CSUM | NETIF_F_SG | \ --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -458,6 +458,7 @@ static void ieee80211_do_stop(struct iee +@@ -461,6 +461,7 @@ static void ieee80211_do_stop(struct iee sdata_unlock(sdata); cancel_work_sync(&sdata->csa_finalize_work); @@ -453,7 +453,7 @@ Signed-off-by: Johannes Berg cancel_delayed_work_sync(&sdata->dfs_cac_timer_work); -@@ -1569,6 +1570,7 @@ static void ieee80211_setup_sdata(struct +@@ -1572,6 +1573,7 @@ static void ieee80211_setup_sdata(struct INIT_WORK(&sdata->work, ieee80211_iface_work); INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work); INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); @@ -463,7 +463,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4740,11 +4740,11 @@ static int ieee80211_beacon_add_tim(stru +@@ -4773,11 +4773,11 @@ static int ieee80211_beacon_add_tim(stru static void ieee80211_set_beacon_cntdwn(struct ieee80211_sub_if_data *sdata, struct beacon_data *beacon) { @@ -477,7 +477,7 @@ Signed-off-by: Johannes Berg switch (sdata->vif.type) { case NL80211_IFTYPE_AP: -@@ -4764,21 +4764,27 @@ static void ieee80211_set_beacon_cntdwn( +@@ -4797,21 +4797,27 @@ static void ieee80211_set_beacon_cntdwn( } rcu_read_lock(); @@ -514,7 +514,7 @@ Signed-off-by: Johannes Berg } rcu_read_unlock(); } -@@ -4988,6 +4994,7 @@ __ieee80211_beacon_get(struct ieee80211_ +@@ -5021,6 +5027,7 @@ __ieee80211_beacon_get(struct ieee80211_ if (offs) { offs->tim_offset = beacon->head_len; offs->tim_length = skb->len - beacon->head_len; diff --git a/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch index c502d69616..cdb88255f5 100644 --- a/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch +++ b/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch @@ -27,7 +27,7 @@ Signed-off-by: Johannes Berg --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -4223,6 +4223,11 @@ struct ieee80211_ops { +@@ -4225,6 +4225,11 @@ struct ieee80211_ops { void (*sta_set_decap_offload)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, bool enabled); @@ -84,7 +84,7 @@ Signed-off-by: Johannes Berg #endif /* __MAC80211_DRIVER_OPS */ --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -962,6 +962,7 @@ struct ieee80211_sub_if_data { +@@ -949,6 +949,7 @@ struct ieee80211_sub_if_data { struct work_struct work; struct sk_buff_head skb_queue; @@ -92,7 +92,7 @@ Signed-off-by: Johannes Berg u8 needed_rx_chains; enum ieee80211_smps_mode smps_mode; -@@ -2099,6 +2100,11 @@ ieee80211_he_op_ie_to_bss_conf(struct ie +@@ -2086,6 +2087,11 @@ ieee80211_he_op_ie_to_bss_conf(struct ie /* S1G */ void ieee80211_s1g_sta_rate_init(struct sta_info *sta); @@ -106,7 +106,7 @@ Signed-off-by: Johannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -555,6 +555,7 @@ static void ieee80211_do_stop(struct iee +@@ -551,6 +551,7 @@ static void ieee80211_do_stop(struct iee */ ieee80211_free_keys(sdata, true); skb_queue_purge(&sdata->skb_queue); @@ -114,7 +114,7 @@ Signed-off-by: Johannes Berg } spin_lock_irqsave(&local->queue_stop_reason_lock, flags); -@@ -1029,6 +1030,7 @@ int ieee80211_add_virtual_monitor(struct +@@ -1032,6 +1033,7 @@ int ieee80211_add_virtual_monitor(struct } skb_queue_head_init(&sdata->skb_queue); @@ -122,7 +122,7 @@ Signed-off-by: Johannes Berg INIT_WORK(&sdata->work, ieee80211_iface_work); return 0; -@@ -1370,6 +1372,24 @@ static void ieee80211_if_setup_no_queue( +@@ -1373,6 +1375,24 @@ static void ieee80211_if_setup_no_queue( dev->priv_flags |= IFF_NO_QUEUE; } @@ -147,7 +147,7 @@ Signed-off-by: Johannes Berg static void ieee80211_iface_work(struct work_struct *work) { struct ieee80211_sub_if_data *sdata = -@@ -1448,6 +1468,16 @@ static void ieee80211_iface_work(struct +@@ -1451,6 +1471,16 @@ static void ieee80211_iface_work(struct WARN_ON(1); break; } @@ -164,7 +164,7 @@ Signed-off-by: Johannes Berg } else if (ieee80211_is_ext(mgmt->frame_control)) { if (sdata->vif.type == NL80211_IFTYPE_STATION) ieee80211_sta_rx_queued_ext(sdata, skb); -@@ -1504,6 +1534,12 @@ static void ieee80211_iface_work(struct +@@ -1507,6 +1537,12 @@ static void ieee80211_iface_work(struct kcov_remote_stop(); } @@ -177,7 +177,7 @@ Signed-off-by: Johannes Berg /* then other type-dependent work */ switch (sdata->vif.type) { case NL80211_IFTYPE_STATION: -@@ -1567,6 +1603,7 @@ static void ieee80211_setup_sdata(struct +@@ -1570,6 +1606,7 @@ static void ieee80211_setup_sdata(struct } skb_queue_head_init(&sdata->skb_queue); @@ -187,7 +187,7 @@ Signed-off-by: Johannes Berg INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -3116,6 +3116,68 @@ ieee80211_rx_h_mgmt_check(struct ieee802 +@@ -3197,6 +3197,68 @@ ieee80211_rx_h_mgmt_check(struct ieee802 return RX_CONTINUE; } @@ -256,7 +256,7 @@ Signed-off-by: Johannes Berg static ieee80211_rx_result debug_noinline ieee80211_rx_h_action(struct ieee80211_rx_data *rx) { -@@ -3395,6 +3457,17 @@ ieee80211_rx_h_action(struct ieee80211_r +@@ -3476,6 +3538,17 @@ ieee80211_rx_h_action(struct ieee80211_r !mesh_path_sel_is_hwmp(sdata)) break; goto queue; diff --git a/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch b/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch index 33cd29bd45..ea1091bb99 100644 --- a/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch +++ b/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch @@ -12,7 +12,7 @@ Signed-off-by: Johannes Berg --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3656,7 +3656,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee +@@ -3813,7 +3813,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee IEEE80211_HE_MAC_CAP4_BQR; he_cap_elem->mac_cap_info[4] &= ~m; @@ -21,7 +21,7 @@ Signed-off-by: Johannes Berg IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU | IEEE80211_HE_MAC_CAP5_PUNCTURED_SOUNDING | IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX; -@@ -3666,7 +3666,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee +@@ -3823,7 +3823,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO; he_cap_elem->phy_cap_info[2] &= ~m; @@ -30,7 +30,7 @@ Signed-off-by: Johannes Berg IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK | IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK; he_cap_elem->phy_cap_info[3] &= ~m; -@@ -3678,13 +3678,13 @@ ath11k_mac_filter_he_cap_mesh(struct iee +@@ -3835,13 +3835,13 @@ ath11k_mac_filter_he_cap_mesh(struct iee he_cap_elem->phy_cap_info[5] &= ~m; m = IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU | @@ -49,7 +49,7 @@ Signed-off-by: Johannes Berg he_cap_elem->phy_cap_info[7] &= ~m; --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c -@@ -423,8 +423,8 @@ mt7915_set_stream_he_txbf_caps(struct ie +@@ -424,8 +424,8 @@ mt7915_set_stream_he_txbf_caps(struct ie IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK; elem->phy_cap_info[5] &= ~c; @@ -60,7 +60,7 @@ Signed-off-by: Johannes Berg elem->phy_cap_info[6] &= ~c; elem->phy_cap_info[7] &= ~IEEE80211_HE_PHY_CAP7_MAX_NC_MASK; -@@ -461,8 +461,8 @@ mt7915_set_stream_he_txbf_caps(struct ie +@@ -465,8 +465,8 @@ mt7915_set_stream_he_txbf_caps(struct ie c = (nss - 1) | (max_t(int, le16_to_cpu(mcs->tx_mcs_160), 1) << 3); elem->phy_cap_info[5] |= c; @@ -69,13 +69,38 @@ Signed-off-by: Johannes Berg + c = IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB | + IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB; elem->phy_cap_info[6] |= c; + } - /* the maximum cap is 4 x 3, (Nr, Nc) = (3, 2) */ @@ -589,7 +589,7 @@ mt7915_init_he_caps(struct mt7915_phy *p IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE | IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT; he_cap_elem->phy_cap_info[7] |= - IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR | ++ IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP | + IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI; + he_cap_elem->phy_cap_info[8] |= + IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G | +--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +@@ -1840,9 +1840,9 @@ mt7915_mcu_sta_bfer_he(struct ieee80211_ + + bf->tx_mode = MT_PHY_TYPE_HE_SU; + mt7915_mcu_sta_sounding_rate(bf); +- bf->trigger_su = HE_PHY(CAP6_TRIG_SU_BEAMFORMER_FB, ++ bf->trigger_su = HE_PHY(CAP6_TRIG_SU_BEAMFORMING_FB, + pe->phy_cap_info[6]); +- bf->trigger_mu = HE_PHY(CAP6_TRIG_MU_BEAMFORMER_FB, ++ bf->trigger_mu = HE_PHY(CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB, + pe->phy_cap_info[6]); + bfer_nr = HE_PHY(CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK, + ve->phy_cap_info[5]); +--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c +@@ -107,7 +107,7 @@ mt7921_init_he_caps(struct mt7921_phy *p + IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE | + IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT; + he_cap_elem->phy_cap_info[7] |= +- IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR | + IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP | IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI; he_cap_elem->phy_cap_info[8] |= @@ -185,8 +210,14 @@ Signed-off-by: Johannes Berg PFLAG_RANGE(PHY, 7, MAX_NC, 0, 1, 1, "MAX-NC-%d"); --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -@@ -587,7 +587,7 @@ static const struct ieee80211_sband_ifty +@@ -583,11 +583,11 @@ static const struct ieee80211_sband_ifty + IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2 | + IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2, .phy_cap_info[6] = +- IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB | +- IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB | ++ IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB | ++ IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB | IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT, .phy_cap_info[7] = - IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR | diff --git a/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch b/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch index f932fa63d7..9c5ba68390 100644 --- a/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch +++ b/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch @@ -11,7 +11,7 @@ Signed-off-by: Johannes Berg --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -@@ -554,7 +554,7 @@ static const struct ieee80211_sband_ifty +@@ -552,7 +552,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, .mac_cap_info[4] = @@ -42,7 +42,7 @@ Signed-off-by: Johannes Berg he_cap_elem->phy_cap_info[0] = --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c -@@ -1325,7 +1325,7 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *sk +@@ -1343,7 +1343,7 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *sk if (elem->mac_cap_info[3] & IEEE80211_HE_MAC_CAP3_OMI_CONTROL) cap |= STA_REC_HE_CAP_OM; @@ -75,7 +75,7 @@ Signed-off-by: Johannes Berg --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2796,7 +2796,7 @@ static const struct ieee80211_sband_ifty +@@ -2818,7 +2818,7 @@ static const struct ieee80211_sband_ifty .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, @@ -84,7 +84,7 @@ Signed-off-by: Johannes Berg .phy_cap_info[1] = IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | -@@ -2840,7 +2840,7 @@ static const struct ieee80211_sband_ifty +@@ -2862,7 +2862,7 @@ static const struct ieee80211_sband_ifty .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, @@ -93,7 +93,7 @@ Signed-off-by: Johannes Berg .phy_cap_info[1] = IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | -@@ -2886,7 +2886,7 @@ static const struct ieee80211_sband_ifty +@@ -2908,7 +2908,7 @@ static const struct ieee80211_sband_ifty .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, @@ -102,7 +102,7 @@ Signed-off-by: Johannes Berg .phy_cap_info[0] = IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G | -@@ -2934,7 +2934,7 @@ static const struct ieee80211_sband_ifty +@@ -2956,7 +2956,7 @@ static const struct ieee80211_sband_ifty .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, diff --git a/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch b/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch index dc927a683c..34829a7462 100644 --- a/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch +++ b/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch @@ -27,7 +27,7 @@ Signed-off-by: Johannes Berg if (sta->vht_cap.vht_supported) --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -@@ -552,7 +552,7 @@ static const struct ieee80211_sband_ifty +@@ -550,7 +550,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -47,7 +47,7 @@ Signed-off-by: Johannes Berg .mac_cap_info[5] = --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2795,7 +2795,7 @@ static const struct ieee80211_sband_ifty +@@ -2817,7 +2817,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_ACK_EN, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -56,7 +56,7 @@ Signed-off-by: Johannes Berg .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, .phy_cap_info[1] = IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | -@@ -2839,7 +2839,7 @@ static const struct ieee80211_sband_ifty +@@ -2861,7 +2861,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_ACK_EN, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -65,7 +65,7 @@ Signed-off-by: Johannes Berg .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, .phy_cap_info[1] = IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | -@@ -2885,7 +2885,7 @@ static const struct ieee80211_sband_ifty +@@ -2907,7 +2907,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_ACK_EN, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | @@ -74,7 +74,7 @@ Signed-off-by: Johannes Berg .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, .phy_cap_info[0] = IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | -@@ -2933,7 +2933,7 @@ static const struct ieee80211_sband_ifty +@@ -2955,7 +2955,7 @@ static const struct ieee80211_sband_ifty IEEE80211_HE_MAC_CAP2_ACK_EN, .mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | 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 f9c4caa51c..870d6283b7 100644 --- a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch +++ b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch @@ -5,7 +5,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 +@@ -637,21 +637,6 @@ static int wiphy_verify_combinations(str c->limits[j].max > 1)) return -EINVAL; diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index fb0106bac1..f341fb399e 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -3810,6 +3810,7 @@ struct mgmt_frame_regs { +@@ -3818,6 +3818,7 @@ struct mgmt_frame_regs { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting * functions to adjust rfkill hw state -@@ -4134,6 +4135,7 @@ struct cfg80211_ops { +@@ -4142,6 +4143,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); @@ -87,7 +87,7 @@ CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1441,6 +1441,7 @@ struct ieee80211_local { +@@ -1428,6 +1428,7 @@ struct ieee80211_local { int dynamic_ps_forced_timeout; int user_power_level; /* in dBm, for all interfaces */ @@ -119,7 +119,7 @@ if (local->hw.conf.power_level != power) { changed |= IEEE80211_CONF_CHANGE_POWER; local->hw.conf.power_level = power; -@@ -663,6 +669,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -670,6 +676,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ IEEE80211_RADIOTAP_MCS_HAVE_BW; local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; @@ -129,7 +129,7 @@ local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -757,6 +757,7 @@ static const struct nla_policy nl80211_p +@@ -778,6 +778,7 @@ static const struct nla_policy nl80211_p [NL80211_ATTR_COLOR_CHANGE_COUNT] = { .type = NLA_U8 }, [NL80211_ATTR_COLOR_CHANGE_COLOR] = { .type = NLA_U8 }, [NL80211_ATTR_COLOR_CHANGE_ELEMS] = NLA_POLICY_NESTED(nl80211_policy), @@ -137,11 +137,10 @@ }; /* policy for the key attributes */ -@@ -3296,6 +3297,20 @@ static int nl80211_set_wiphy(struct sk_b - if (result) - return result; +@@ -3315,6 +3316,20 @@ static int nl80211_set_wiphy(struct sk_b + goto out; } -+ + + if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_GAIN]) { + int idx, dbi = 0; + @@ -155,6 +154,7 @@ + if (result) + return result; + } - - if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX] && - info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]) { ++ + if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) { + struct wireless_dev *txp_wdev = wdev; + enum nl80211_tx_power_setting type; diff --git a/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch b/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch index ea6e6974ca..3724013146 100644 --- a/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch +++ b/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch @@ -182,7 +182,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -618,7 +618,6 @@ static int ath9k_of_init(struct ath_soft +@@ -617,7 +617,6 @@ static int ath9k_of_init(struct ath_soft struct ath_hw *ah = sc->sc_ah; struct ath_common *common = ath9k_hw_common(ah); enum ath_bus_type bus_type = common->bus_ops->ath_bus_type; @@ -190,7 +190,7 @@ Signed-off-by: David S. Miller char eeprom_name[100]; int ret; -@@ -641,9 +640,7 @@ static int ath9k_of_init(struct ath_soft +@@ -640,9 +639,7 @@ static int ath9k_of_init(struct ath_soft ah->ah_flags |= AH_NO_EEP_SWAP; } From 1c0d5ee8e695ce63310259a7cf3107d9f77206ea Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 9 Oct 2021 19:25:36 +0200 Subject: [PATCH 23/54] mac80211: Update to version 5.13.19-1 The removed patches were applied upstream. of_get_mac_address() was backported in our OpenWrt kernel, remove the change from backports. Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 6 +- .../930-ath10k_add_tpt_led_trigger.patch | 4 +- ...75-ath10k-use-tpt-trigger-by-default.patch | 2 +- ...erpret-requested-txpower-in-EIRP-dom.patch | 4 +- ...power-reduction-for-US-regulatory-do.patch | 2 +- .../ath9k/542-ath9k_debugfs_diag.patch | 4 +- ...544-ath9k-ar933x-usb-hang-workaround.patch | 4 +- ...ent-set_tim-by-update-beacon-content.patch | 118 -------- .../patches/subsys/010-sync-nl80211_h.patch | 71 ----- .../110-mac80211_keep_keys_on_stop_ap.patch | 2 +- .../subsys/150-disable_addr_notifier.patch | 10 +- .../mac80211/patches/subsys/210-ap_scan.patch | 2 +- ...l_ht-rework-rate-downgrade-code-and-.patch | 10 +- ...pply-flow-control-on-management-fram.patch | 60 ---- ...set-sk_pacing_shift-for-802.3-txpath.patch | 21 -- ...MPDU-session-check-from-minstrel_ht-.patch | 14 +- ...eee80211_tx_h_rate_ctrl-when-dequeue.patch | 12 +- ...te-control-support-for-encap-offload.patch | 4 +- ...rting-aggregation-sessions-on-mesh-i.patch | 2 +- ...to-a-virtual-time-based-airtime-sche.patch | 30 +- ...eck-per-vif-offload_flags-in-Tx-path.patch | 2 +- ...nl80211-add-support-for-BSS-coloring.patch | 16 +- ...211-add-support-for-BSS-color-change.patch | 42 +-- ...eee80211-add-TWT-element-definitions.patch | 6 +- ...ce-individual-TWT-support-in-AP-mode.patch | 20 +- ...n-some-HE-capabilities-with-the-spec.patch | 227 --------------- ...pelling-of-A-MSDU-in-HE-capabilities.patch | 113 -------- ...E-capabilities-A-MPDU-Length-Exponen.patch | 148 ---------- .../500-mac80211_configure_antenna_gain.patch | 14 +- ...the-dst-buffer-to-of_get_mac_address.patch | 263 ++---------------- 30 files changed, 133 insertions(+), 1100 deletions(-) delete mode 100644 package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch delete mode 100644 package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch delete mode 100644 package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch delete mode 100644 package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch delete mode 100644 package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch delete mode 100644 package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch delete mode 100644 package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index c30d292a43..b3a8960fe8 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.12.19-1 +PKG_VERSION:=5.13.19-1 PKG_RELEASE:=1 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.12.19/ -PKG_HASH:=4233002bcf26237783cd517d93c27807e534234cef64def7e550c5f06b779d18 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.13.19/ +PKG_HASH:=1eb761c1664d59a0a2d52847f240c9d02fc2e56fb27d862d2949bfb275187eef PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) 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 c3a28a361c..e4e72786fe 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 -@@ -9818,6 +9818,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -9820,6 +9820,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[] = { -@@ -10170,6 +10185,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -10172,6 +10187,12 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; 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 e4699f323b..1f1e8d958d 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 @@ -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 -@@ -10187,7 +10187,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -10189,7 +10189,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/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch index 9016da963b..385eea0116 100644 --- a/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch +++ b/package/kernel/mac80211/patches/ath9k/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch @@ -8,7 +8,7 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2975,7 +2975,8 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2977,7 +2977,8 @@ void ath9k_hw_apply_txpower(struct ath_h { struct ath_regulatory *reg = ath9k_hw_regulatory(ah); struct ieee80211_channel *channel; @@ -18,7 +18,7 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. u16 ctl = NO_CTL; if (!chan) -@@ -2987,9 +2988,14 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2989,9 +2990,14 @@ void ath9k_hw_apply_txpower(struct ath_h channel = chan->chan; chan_pwr = min_t(int, channel->max_power * 2, MAX_COMBINED_POWER); new_pwr = min_t(int, chan_pwr, reg->power_limit); diff --git a/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch b/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch index 5e5f3e4f10..0c3edc1260 100644 --- a/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch +++ b/package/kernel/mac80211/patches/ath9k/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2994,6 +2994,10 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2996,6 +2996,10 @@ void ath9k_hw_apply_txpower(struct ath_h if (ant_gain > max_gain) ant_reduction = ant_gain - max_gain; diff --git a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch index 0e75b86cbf..85c5a9deb6 100644 --- a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch @@ -94,7 +94,7 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1882,6 +1882,20 @@ u32 ath9k_hw_get_tsf_offset(struct times +@@ -1881,6 +1881,20 @@ u32 ath9k_hw_get_tsf_offset(struct times } EXPORT_SYMBOL(ath9k_hw_get_tsf_offset); @@ -115,7 +115,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, struct ath9k_hw_cal_data *caldata, bool fastcc) { -@@ -2090,6 +2104,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2089,6 +2103,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st ar9003_hw_disable_phy_restart(ah); ath9k_hw_apply_gpio_override(ah); diff --git a/package/kernel/mac80211/patches/ath9k/544-ath9k-ar933x-usb-hang-workaround.patch b/package/kernel/mac80211/patches/ath9k/544-ath9k-ar933x-usb-hang-workaround.patch index 6e2c252b23..23a81864fa 100644 --- a/package/kernel/mac80211/patches/ath9k/544-ath9k-ar933x-usb-hang-workaround.patch +++ b/package/kernel/mac80211/patches/ath9k/544-ath9k-ar933x-usb-hang-workaround.patch @@ -40,7 +40,7 @@ return true; } -@@ -1860,8 +1879,14 @@ static int ath9k_hw_do_fastcc(struct ath +@@ -1859,8 +1878,14 @@ static int ath9k_hw_do_fastcc(struct ath if (AR_SREV_9271(ah)) ar9002_hw_load_ani_reg(ah, chan); @@ -55,7 +55,7 @@ return -EINVAL; } -@@ -2115,6 +2140,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2114,6 +2139,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st ath9k_hw_set_radar_params(ah); } diff --git a/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch b/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch deleted file mode 100644 index 0e734233f0..0000000000 --- a/package/kernel/mac80211/patches/rtl/002-v5.13-rtlwifi-implement-set_tim-by-update-beacon-content.patch +++ /dev/null @@ -1,118 +0,0 @@ -Date: Mon, 19 Apr 2021 14:59:56 +0800 -From: Ping-Ke Shih -To: -CC: , , - -Subject: [PATCH] rtlwifi: implement set_tim by update beacon content - -Once beacon content is changed, we update the content to wifi card by -send_beacon_frame(). Then, STA with PS can wake up properly to receive its -packets. - -Since we update beacon content to PCI wifi devices every beacon interval, -the only one usb device, 8192CU, needs to update beacon content when -mac80211 calling set_tim. - -Reported-by: Maciej S. Szmigiero -Signed-off-by: Ping-Ke Shih -Tested-by: Maciej S. Szmigiero ---- - drivers/net/wireless/realtek/rtlwifi/core.c | 32 +++++++++++++++++++++ - drivers/net/wireless/realtek/rtlwifi/core.h | 1 + - drivers/net/wireless/realtek/rtlwifi/usb.c | 3 ++ - drivers/net/wireless/realtek/rtlwifi/wifi.h | 1 + - 4 files changed, 37 insertions(+) - ---- a/drivers/net/wireless/realtek/rtlwifi/core.c -+++ b/drivers/net/wireless/realtek/rtlwifi/core.c -@@ -1018,6 +1018,25 @@ static void send_beacon_frame(struct iee - } - } - -+void rtl_update_beacon_work_callback(struct work_struct *work) -+{ -+ struct rtl_works *rtlworks = -+ container_of(work, struct rtl_works, update_beacon_work); -+ struct ieee80211_hw *hw = rtlworks->hw; -+ struct rtl_priv *rtlpriv = rtl_priv(hw); -+ struct ieee80211_vif *vif = rtlpriv->mac80211.vif; -+ -+ if (!vif) { -+ WARN_ONCE(true, "no vif to update beacon\n"); -+ return; -+ } -+ -+ mutex_lock(&rtlpriv->locks.conf_mutex); -+ send_beacon_frame(hw, vif); -+ mutex_unlock(&rtlpriv->locks.conf_mutex); -+} -+EXPORT_SYMBOL_GPL(rtl_update_beacon_work_callback); -+ - static void rtl_op_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, -@@ -1747,6 +1766,18 @@ static void rtl_op_flush(struct ieee8021 - rtlpriv->intf_ops->flush(hw, queues, drop); - } - -+static int rtl_op_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, -+ bool set) -+{ -+ struct rtl_priv *rtlpriv = rtl_priv(hw); -+ struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); -+ -+ if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CU) -+ schedule_work(&rtlpriv->works.update_beacon_work); -+ -+ return 0; -+} -+ - /* Description: - * This routine deals with the Power Configuration CMD - * parsing for RTL8723/RTL8188E Series IC. -@@ -1903,6 +1934,7 @@ const struct ieee80211_ops rtl_ops = { - .sta_add = rtl_op_sta_add, - .sta_remove = rtl_op_sta_remove, - .flush = rtl_op_flush, -+ .set_tim = rtl_op_set_tim, - }; - EXPORT_SYMBOL_GPL(rtl_ops); - ---- a/drivers/net/wireless/realtek/rtlwifi/core.h -+++ b/drivers/net/wireless/realtek/rtlwifi/core.h -@@ -60,5 +60,6 @@ void rtl_bb_delay(struct ieee80211_hw *h - bool rtl_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb); - bool rtl_btc_status_false(void); - void rtl_dm_diginit(struct ieee80211_hw *hw, u32 cur_igval); -+void rtl_update_beacon_work_callback(struct work_struct *work); - - #endif ---- a/drivers/net/wireless/realtek/rtlwifi/usb.c -+++ b/drivers/net/wireless/realtek/rtlwifi/usb.c -@@ -805,6 +805,7 @@ static void rtl_usb_stop(struct ieee8021 - - tasklet_kill(&rtlusb->rx_work_tasklet); - cancel_work_sync(&rtlpriv->works.lps_change_work); -+ cancel_work_sync(&rtlpriv->works.update_beacon_work); - - flush_workqueue(rtlpriv->works.rtl_wq); - -@@ -1031,6 +1032,8 @@ int rtl_usb_probe(struct usb_interface * - rtl_fill_h2c_cmd_work_callback); - INIT_WORK(&rtlpriv->works.lps_change_work, - rtl_lps_change_work_callback); -+ INIT_WORK(&rtlpriv->works.update_beacon_work, -+ rtl_update_beacon_work_callback); - - rtlpriv->usb_data_index = 0; - init_completion(&rtlpriv->firmware_loading_complete); ---- a/drivers/net/wireless/realtek/rtlwifi/wifi.h -+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h -@@ -2487,6 +2487,7 @@ struct rtl_works { - - struct work_struct lps_change_work; - struct work_struct fill_h2c_cmd; -+ struct work_struct update_beacon_work; - }; - - struct rtl_debug { diff --git a/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch b/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch deleted file mode 100644 index 4ee448bdf3..0000000000 --- a/package/kernel/mac80211/patches/subsys/010-sync-nl80211_h.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/include/uapi/linux/nl80211.h -+++ b/include/uapi/linux/nl80211.h -@@ -655,6 +655,9 @@ - * When a security association was established on an 802.1X network using - * fast transition, this event should be followed by an - * %NL80211_CMD_PORT_AUTHORIZED event. -+ * Following a %NL80211_CMD_ROAM event userspace can issue -+ * %NL80211_CMD_GET_SCAN in order to obtain the scan information for the -+ * new BSS the card/driver roamed to. - * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify - * userspace that a connection was dropped by the AP or due to other - * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and -@@ -5937,6 +5940,16 @@ enum nl80211_feature_flags { - * @NL80211_EXT_FEATURE_BEACON_RATE_HE: Driver supports beacon rate - * configuration (AP/mesh) with HE rates. - * -+ * @NL80211_EXT_FEATURE_SECURE_LTF: Device supports secure LTF measurement -+ * exchange protocol. -+ * -+ * @NL80211_EXT_FEATURE_SECURE_RTT: Device supports secure RTT measurement -+ * exchange protocol. -+ * -+ * @NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE: Device supports management -+ * frame protection for all management frames exchanged during the -+ * negotiation and range measurement procedure. -+ * - * @NUM_NL80211_EXT_FEATURES: number of extended features. - * @MAX_NL80211_EXT_FEATURES: highest extended feature index. - */ -@@ -5998,6 +6011,9 @@ enum nl80211_ext_feature_index { - NL80211_EXT_FEATURE_FILS_DISCOVERY, - NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP, - NL80211_EXT_FEATURE_BEACON_RATE_HE, -+ NL80211_EXT_FEATURE_SECURE_LTF, -+ NL80211_EXT_FEATURE_SECURE_RTT, -+ NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, - - /* add new features before the definition below */ - NUM_NL80211_EXT_FEATURES, -@@ -6295,11 +6311,13 @@ struct nl80211_vendor_cmd_info { - * @NL80211_TDLS_PEER_HT: TDLS peer is HT capable. - * @NL80211_TDLS_PEER_VHT: TDLS peer is VHT capable. - * @NL80211_TDLS_PEER_WMM: TDLS peer is WMM capable. -+ * @NL80211_TDLS_PEER_HE: TDLS peer is HE capable. - */ - enum nl80211_tdls_peer_capability { - NL80211_TDLS_PEER_HT = 1<<0, - NL80211_TDLS_PEER_VHT = 1<<1, - NL80211_TDLS_PEER_WMM = 1<<2, -+ NL80211_TDLS_PEER_HE = 1<<3, - }; - - /** -@@ -6891,6 +6909,9 @@ enum nl80211_peer_measurement_ftm_capa { - * if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor - * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based - * ranging will be used. -+ * @NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK: negotiate for LMR feedback. Only -+ * valid if either %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED or -+ * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set. - * - * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal - * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number -@@ -6909,6 +6930,7 @@ enum nl80211_peer_measurement_ftm_req { - NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC, - NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED, - NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED, -+ NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK, - - /* keep last */ - NUM_NL80211_PMSR_FTM_REQ_ATTR, 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 a63a2e2ee6..227eacf49a 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 @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1287,7 +1287,6 @@ static int ieee80211_stop_ap(struct wiph +@@ -1306,7 +1306,6 @@ static int ieee80211_stop_ap(struct wiph sdata->vif.bss_conf.ftmr_params = NULL; __sta_info_flush(sdata, true); diff --git a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch index b149031da0..0cd1cfdd31 100644 --- a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +++ b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -328,7 +328,7 @@ void ieee80211_restart_hw(struct ieee802 +@@ -337,7 +337,7 @@ void ieee80211_restart_hw(struct ieee802 } EXPORT_SYMBOL(ieee80211_restart_hw); @@ -9,7 +9,7 @@ static int ieee80211_ifa_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -387,7 +387,7 @@ static int ieee80211_ifa_changed(struct +@@ -396,7 +396,7 @@ static int ieee80211_ifa_changed(struct } #endif @@ -18,7 +18,7 @@ static int ieee80211_ifa6_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -1310,14 +1310,14 @@ int ieee80211_register_hw(struct ieee802 +@@ -1319,14 +1319,14 @@ int ieee80211_register_hw(struct ieee802 wiphy_unlock(hw->wiphy); rtnl_unlock(); @@ -35,7 +35,7 @@ local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; result = register_inet6addr_notifier(&local->ifa6_notifier); if (result) -@@ -1326,13 +1326,13 @@ int ieee80211_register_hw(struct ieee802 +@@ -1335,13 +1335,13 @@ int ieee80211_register_hw(struct ieee802 return 0; @@ -52,7 +52,7 @@ fail_ifa: #endif wiphy_unregister(local->hw.wiphy); -@@ -1360,10 +1360,10 @@ void ieee80211_unregister_hw(struct ieee +@@ -1369,10 +1369,10 @@ void ieee80211_unregister_hw(struct ieee tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); diff --git a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch index 96e6195a29..708cf7b0d5 100644 --- a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch +++ b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2443,7 +2443,7 @@ static int ieee80211_scan(struct wiphy * +@@ -2462,7 +2462,7 @@ static int ieee80211_scan(struct wiphy * * the frames sent while scanning on other channel will be * lost) */ diff --git a/package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch b/package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch index 63cb6834cf..7cbc8c01d0 100644 --- a/package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch +++ b/package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch @@ -86,7 +86,7 @@ Signed-off-by: Felix Fietkau static u16 __minstrel_ht_get_sample_rate(struct minstrel_ht_sta *mi, enum minstrel_sample_type type) -@@ -1109,8 +1078,6 @@ minstrel_ht_update_stats(struct minstrel +@@ -1107,8 +1076,6 @@ minstrel_ht_update_stats(struct minstrel mi->max_prob_rate = tmp_max_prob_rate; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau minstrel_ht_refill_sample_rates(mi); #ifdef CPTCFG_MAC80211_DEBUGFS -@@ -1155,7 +1122,7 @@ minstrel_ht_txstat_valid(struct minstrel +@@ -1153,7 +1120,7 @@ minstrel_ht_txstat_valid(struct minstrel } static void @@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau { int group, orig_group; -@@ -1170,11 +1137,7 @@ minstrel_downgrade_rate(struct minstrel_ +@@ -1168,11 +1135,7 @@ minstrel_downgrade_rate(struct minstrel_ minstrel_mcs_groups[orig_group].streams) continue; @@ -117,7 +117,7 @@ Signed-off-by: Felix Fietkau } } -@@ -1208,7 +1171,7 @@ minstrel_ht_tx_status(void *priv, struct +@@ -1206,7 +1169,7 @@ minstrel_ht_tx_status(void *priv, struct struct ieee80211_tx_info *info = st->info; struct minstrel_ht_sta *mi = priv_sta; struct ieee80211_tx_rate *ar = info->status.rates; @@ -126,7 +126,7 @@ Signed-off-by: Felix Fietkau struct minstrel_priv *mp = priv; u32 update_interval = mp->update_interval; bool last, update = false; -@@ -1254,18 +1217,13 @@ minstrel_ht_tx_status(void *priv, struct +@@ -1252,18 +1215,13 @@ minstrel_ht_tx_status(void *priv, struct /* * check for sudden death of spatial multiplexing, * downgrade to a lower number of streams if necessary. diff --git a/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch b/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch deleted file mode 100644 index 26f295e680..0000000000 --- a/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch +++ /dev/null @@ -1,60 +0,0 @@ -From: Johannes Berg -Date: Fri, 19 Mar 2021 23:28:01 +0100 -Subject: [PATCH] mac80211: don't apply flow control on management frames - -In some cases (depending on the driver, but it's true e.g. for -iwlwifi) we're using an internal TXQ for management packets, -mostly to simplify the code and to have a place to queue them. -However, it appears that in certain cases we can confuse the -code and management frames are dropped, which is certainly not -what we want. - -Short-circuit the processing of management frames. To keep the -impact minimal, only put them on the frags queue and check the -tid == management only for doing that and to skip the airtime -fairness checks, if applicable. - -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -5,7 +5,7 @@ - * Copyright 2006-2007 Jiri Benc - * Copyright 2007 Johannes Berg - * Copyright 2013-2014 Intel Mobile Communications GmbH -- * Copyright (C) 2018-2020 Intel Corporation -+ * Copyright (C) 2018-2021 Intel Corporation - * - * Transmit and frame generation functions. - */ -@@ -1388,8 +1388,17 @@ static void ieee80211_txq_enqueue(struct - ieee80211_set_skb_enqueue_time(skb); - - spin_lock_bh(&fq->lock); -- fq_tin_enqueue(fq, tin, flow_idx, skb, -- fq_skb_free_func); -+ /* -+ * For management frames, don't really apply codel etc., -+ * we don't want to apply any shaping or anything we just -+ * want to simplify the driver API by having them on the -+ * txqi. -+ */ -+ if (unlikely(txqi->txq.tid == IEEE80211_NUM_TIDS)) -+ __skb_queue_tail(&txqi->frags, skb); -+ else -+ fq_tin_enqueue(fq, tin, flow_idx, skb, -+ fq_skb_free_func); - spin_unlock_bh(&fq->lock); - } - -@@ -3853,6 +3862,9 @@ bool ieee80211_txq_airtime_check(struct - if (!txq->sta) - return true; - -+ if (unlikely(txq->tid == IEEE80211_NUM_TIDS)) -+ return true; -+ - sta = container_of(txq->sta, struct sta_info, sta); - if (atomic_read(&sta->airtime[txq->ac].aql_tx_pending) < - sta->airtime[txq->ac].aql_limit_low) diff --git a/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch b/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch deleted file mode 100644 index 98bbed5afc..0000000000 --- a/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Lorenzo Bianconi -Date: Mon, 8 Mar 2021 23:01:49 +0100 -Subject: [PATCH] mac80211: set sk_pacing_shift for 802.3 txpath - -Similar to 802.11 txpath, set socket sk_pacing_shift for 802.3 tx path. - -Signed-off-by: Lorenzo Bianconi ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -4180,6 +4180,9 @@ 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); -+ - if (ieee80211_queue_skb(local, sdata, sta, skb)) - return true; - diff --git a/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch b/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch index 1e70d778b8..dc511880e5 100644 --- a/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch +++ b/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -6188,6 +6188,11 @@ enum rate_control_capabilities { +@@ -6192,6 +6192,11 @@ enum rate_control_capabilities { * otherwise the NSS difference doesn't bother us. */ RATE_CTRL_CAPA_VHT_EXT_NSS_BW = BIT(0), @@ -25,7 +25,7 @@ Signed-off-by: Felix Fietkau struct rate_control_ops { --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1142,29 +1142,6 @@ minstrel_downgrade_prob_rate(struct mins +@@ -1140,29 +1140,6 @@ minstrel_downgrade_prob_rate(struct mins } static void @@ -55,7 +55,7 @@ Signed-off-by: Felix Fietkau minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband, void *priv_sta, struct ieee80211_tx_status *st) { -@@ -1459,10 +1436,6 @@ minstrel_ht_get_rate(void *priv, struct +@@ -1457,10 +1434,6 @@ minstrel_ht_get_rate(void *priv, struct struct minstrel_priv *mp = priv; u16 sample_idx; @@ -66,7 +66,7 @@ Signed-off-by: Felix Fietkau info->flags |= mi->tx_flags; #ifdef CPTCFG_MAC80211_DEBUGFS -@@ -1868,6 +1841,7 @@ static u32 minstrel_ht_get_expected_thro +@@ -1866,6 +1839,7 @@ static u32 minstrel_ht_get_expected_thro static const struct rate_control_ops mac80211_minstrel_ht = { .name = "minstrel_ht", @@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau .rate_init = minstrel_ht_rate_init, --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3940,6 +3940,29 @@ void ieee80211_txq_schedule_start(struct +@@ -3951,6 +3951,29 @@ void ieee80211_txq_schedule_start(struct } EXPORT_SYMBOL(ieee80211_txq_schedule_start); @@ -106,7 +106,7 @@ Signed-off-by: Felix Fietkau void __ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev, u32 info_flags, -@@ -3970,6 +3993,8 @@ void __ieee80211_subif_start_xmit(struct +@@ -3981,6 +4004,8 @@ void __ieee80211_subif_start_xmit(struct skb_get_hash(skb); } @@ -115,7 +115,7 @@ Signed-off-by: Felix Fietkau if (sta) { struct ieee80211_fast_tx *fast_tx; -@@ -4233,6 +4258,8 @@ static void ieee80211_8023_xmit(struct i +@@ -4244,6 +4269,8 @@ static void ieee80211_8023_xmit(struct i memset(info, 0, sizeof(*info)); diff --git a/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch b/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch index a09d97cab3..346c6468f8 100644 --- a/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch +++ b/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch @@ -10,7 +10,7 @@ Signed-off-by: Ryder Lee --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -1765,8 +1765,6 @@ static int invoke_tx_handlers_early(stru +@@ -1768,8 +1768,6 @@ static int invoke_tx_handlers_early(stru CALL_TXH(ieee80211_tx_h_ps_buf); CALL_TXH(ieee80211_tx_h_check_control_port_protocol); CALL_TXH(ieee80211_tx_h_select_key); @@ -19,7 +19,7 @@ Signed-off-by: Ryder Lee txh_done: if (unlikely(res == TX_DROP)) { -@@ -1799,6 +1797,9 @@ static int invoke_tx_handlers_late(struc +@@ -1802,6 +1800,9 @@ static int invoke_tx_handlers_late(struc goto txh_done; } @@ -29,7 +29,7 @@ Signed-off-by: Ryder Lee CALL_TXH(ieee80211_tx_h_michael_mic_add); CALL_TXH(ieee80211_tx_h_sequence); CALL_TXH(ieee80211_tx_h_fragment); -@@ -3386,15 +3387,21 @@ out: +@@ -3391,15 +3392,21 @@ out: * Can be called while the sta lock is held. Anything that can cause packets to * be generated will cause deadlock! */ @@ -55,7 +55,7 @@ Signed-off-by: Ryder Lee if (key) info->control.hw_key = &key->conf; -@@ -3443,6 +3450,8 @@ static void ieee80211_xmit_fast_finish(s +@@ -3448,6 +3455,8 @@ static void ieee80211_xmit_fast_finish(s break; } } @@ -64,7 +64,7 @@ Signed-off-by: Ryder Lee } static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -@@ -3546,24 +3555,17 @@ static bool ieee80211_xmit_fast(struct i +@@ -3551,24 +3560,17 @@ static bool ieee80211_xmit_fast(struct i tx.sta = sta; tx.key = fast_tx->key; @@ -97,7 +97,7 @@ Signed-off-by: Ryder Lee if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) sdata = container_of(sdata->bss, -@@ -3674,8 +3676,12 @@ begin: +@@ -3685,8 +3687,12 @@ begin: (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) pn_offs = ieee80211_hdrlen(hdr->frame_control); diff --git a/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch b/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch index 01bbde045b..b9f34213d5 100644 --- a/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch +++ b/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch @@ -81,7 +81,7 @@ Signed-off-by: Ryder Lee tx->sta->tx_stats.last_rate = txrc.reported_rate; } else if (tx->sta) tx->sta->tx_stats.last_rate = txrc.reported_rate; -@@ -3664,8 +3666,16 @@ begin: +@@ -3675,8 +3677,16 @@ begin: else info->flags &= ~IEEE80211_TX_CTL_AMPDU; @@ -101,7 +101,7 @@ Signed-off-by: Ryder Lee struct sta_info *sta = container_of(txq->sta, struct sta_info, --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -6761,4 +6761,22 @@ struct sk_buff *ieee80211_get_fils_disco +@@ -6765,4 +6765,22 @@ struct sk_buff *ieee80211_get_fils_disco struct sk_buff * ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw, struct ieee80211_vif *vif); diff --git a/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch b/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch index 234ca67624..74947348bc 100644 --- a/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch +++ b/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch @@ -80,7 +80,7 @@ Signed-off-by: Felix Fietkau if (tid_tx) { bool queued; -@@ -3956,29 +3986,6 @@ void ieee80211_txq_schedule_start(struct +@@ -3967,29 +3997,6 @@ void ieee80211_txq_schedule_start(struct } EXPORT_SYMBOL(ieee80211_txq_schedule_start); diff --git a/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch b/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch index d99ca5961c..49f9349ec8 100644 --- a/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch +++ b/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch @@ -50,7 +50,7 @@ Signed-off-by: Johannes Berg --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -6585,9 +6585,6 @@ static inline void ieee80211_txq_schedul +@@ -6589,9 +6589,6 @@ static inline void ieee80211_txq_schedul { } @@ -60,7 +60,7 @@ Signed-off-by: Johannes Berg /** * ieee80211_schedule_txq - schedule a TXQ for transmission * -@@ -6600,11 +6597,7 @@ void __ieee80211_schedule_txq(struct iee +@@ -6604,11 +6601,7 @@ void __ieee80211_schedule_txq(struct iee * The driver may call this function if it has buffered packets for * this TXQ internally. */ @@ -73,7 +73,7 @@ Signed-off-by: Johannes Berg /** * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() -@@ -6616,12 +6609,8 @@ ieee80211_schedule_txq(struct ieee80211_ +@@ -6620,12 +6613,8 @@ ieee80211_schedule_txq(struct ieee80211_ * The driver may set force=true if it has buffered packets for this TXQ * internally. */ @@ -90,7 +90,7 @@ Signed-off-by: Johannes Berg * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1441,6 +1441,38 @@ static void sta_apply_mesh_params(struct +@@ -1460,6 +1460,38 @@ static void sta_apply_mesh_params(struct #endif } @@ -129,7 +129,7 @@ Signed-off-by: Johannes Berg static int sta_apply_parameters(struct ieee80211_local *local, struct sta_info *sta, struct station_parameters *params) -@@ -1628,7 +1660,8 @@ static int sta_apply_parameters(struct i +@@ -1647,7 +1679,8 @@ static int sta_apply_parameters(struct i sta_apply_mesh_params(local, sta, params); if (params->airtime_weight) @@ -227,7 +227,7 @@ Signed-off-by: Johannes Berg #ifdef CONFIG_PM static ssize_t reset_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) -@@ -631,7 +671,11 @@ void debugfs_hw_add(struct ieee80211_loc +@@ -632,7 +672,11 @@ void debugfs_hw_add(struct ieee80211_loc if (local->ops->wake_tx_queue) DEBUGFS_ADD_MODE(aqm, 0600); @@ -573,7 +573,7 @@ Signed-off-by: Johannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) { return ether_addr_equal(raddr, addr) || -@@ -1814,6 +1964,14 @@ int ieee80211_tx_control_port(struct wip +@@ -1816,6 +1966,14 @@ int ieee80211_tx_control_port(struct wip u64 *cookie); int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, const u8 *buf, size_t len); @@ -590,7 +590,7 @@ Signed-off-by: Johannes Berg void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -2018,6 +2018,9 @@ int ieee80211_if_add(struct ieee80211_lo +@@ -2041,6 +2041,9 @@ int ieee80211_if_add(struct ieee80211_lo } } @@ -602,7 +602,7 @@ Signed-off-by: Johannes Berg sdata->ap_power_level = IEEE80211_UNSET_POWER_LEVEL; --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -698,10 +698,13 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -707,10 +707,13 @@ struct ieee80211_hw *ieee80211_alloc_hw_ spin_lock_init(&local->queue_stop_reason_lock); for (i = 0; i < IEEE80211_NUM_ACS; i++) { @@ -622,7 +622,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -1562,12 +1562,8 @@ static void sta_ps_start(struct sta_info +@@ -1563,12 +1563,8 @@ static void sta_ps_start(struct sta_info for (tid = 0; tid < IEEE80211_NUM_TIDS; tid++) { struct ieee80211_txq *txq = sta->sta.txq[tid]; @@ -819,7 +819,7 @@ Signed-off-by: Johannes Berg #include #include #include -@@ -1476,7 +1477,7 @@ void ieee80211_txq_init(struct ieee80211 +@@ -1479,7 +1480,7 @@ void ieee80211_txq_init(struct ieee80211 codel_vars_init(&txqi->def_cvars); codel_stats_init(&txqi->cstats); __skb_queue_head_init(&txqi->frags); @@ -828,7 +828,7 @@ Signed-off-by: Johannes Berg txqi->txq.vif = &sdata->vif; -@@ -1520,9 +1521,7 @@ void ieee80211_txq_purge(struct ieee8021 +@@ -1523,9 +1524,7 @@ void ieee80211_txq_purge(struct ieee8021 ieee80211_purge_tx_queue(&local->hw, &txqi->frags); spin_unlock_bh(&fq->lock); @@ -839,7 +839,7 @@ Signed-off-by: Johannes Berg } void ieee80211_txq_set_params(struct ieee80211_local *local) -@@ -3801,102 +3800,259 @@ EXPORT_SYMBOL(ieee80211_tx_dequeue); +@@ -3812,102 +3811,259 @@ EXPORT_SYMBOL(ieee80211_tx_dequeue); struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) { struct ieee80211_local *local = hw_to_local(hw); @@ -1161,7 +1161,7 @@ Signed-off-by: Johannes Berg struct ieee80211_local *local = hw_to_local(hw); if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) -@@ -3911,15 +4067,12 @@ bool ieee80211_txq_airtime_check(struct +@@ -3922,15 +4078,12 @@ bool ieee80211_txq_airtime_check(struct if (unlikely(txq->tid == IEEE80211_NUM_TIDS)) return true; @@ -1179,7 +1179,7 @@ Signed-off-by: Johannes Berg return true; return false; -@@ -3929,60 +4082,59 @@ EXPORT_SYMBOL(ieee80211_txq_airtime_chec +@@ -3940,60 +4093,59 @@ EXPORT_SYMBOL(ieee80211_txq_airtime_chec bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq) { diff --git a/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch b/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch index 5973b426b6..e195d0bcad 100644 --- a/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch +++ b/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch @@ -14,7 +14,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3313,6 +3313,9 @@ static bool ieee80211_amsdu_aggregate(st +@@ -3318,6 +3318,9 @@ static bool ieee80211_amsdu_aggregate(st if (!ieee80211_hw_check(&local->hw, TX_AMSDU)) return false; diff --git a/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch b/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch index 3ed4543adb..6989375180 100644 --- a/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch +++ b/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch @@ -23,7 +23,7 @@ Signed-off-by: Johannes Berg --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -1248,6 +1248,27 @@ struct cfg80211_csa_settings { +@@ -1253,6 +1253,27 @@ struct cfg80211_csa_settings { #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10 /** @@ -51,7 +51,7 @@ Signed-off-by: Johannes Berg * struct iface_combination_params - input parameters for interface combinations * * Used to pass interface combination parameters -@@ -3983,6 +4004,8 @@ struct mgmt_frame_regs { +@@ -3991,6 +4012,8 @@ struct mgmt_frame_regs { * given TIDs. This callback may sleep. * * @set_sar_specs: Update the SAR (TX power) settings. @@ -60,7 +60,7 @@ Signed-off-by: Johannes Berg */ struct cfg80211_ops { int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); -@@ -4310,6 +4333,9 @@ struct cfg80211_ops { +@@ -4318,6 +4341,9 @@ struct cfg80211_ops { const u8 *peer, u8 tids); int (*set_sar_specs)(struct wiphy *wiphy, struct cfg80211_sar_specs *sar); @@ -70,7 +70,7 @@ Signed-off-by: Johannes Berg }; /* -@@ -8193,4 +8219,70 @@ void cfg80211_update_owe_info_event(stru +@@ -8209,4 +8235,70 @@ void cfg80211_update_owe_info_event(stru */ void cfg80211_bss_flush(struct wiphy *wiphy); @@ -230,7 +230,7 @@ Signed-off-by: Johannes Berg NUM_NL80211_EXT_FEATURES, --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -774,6 +774,10 @@ static const struct nla_policy nl80211_p +@@ -776,6 +776,10 @@ static const struct nla_policy nl80211_p [NL80211_ATTR_RECONNECT_REQUESTED] = { .type = NLA_REJECT }, [NL80211_ATTR_SAR_SPEC] = NLA_POLICY_NESTED(sar_policy), [NL80211_ATTR_DISABLE_HE] = { .type = NLA_FLAG }, @@ -241,7 +241,7 @@ Signed-off-by: Johannes Berg }; /* policy for the key attributes */ -@@ -14813,6 +14817,106 @@ bad_tid_conf: +@@ -14815,6 +14819,106 @@ bad_tid_conf: return ret; } @@ -348,7 +348,7 @@ Signed-off-by: Johannes Berg #define NL80211_FLAG_NEED_WIPHY 0x01 #define NL80211_FLAG_NEED_NETDEV 0x02 #define NL80211_FLAG_NEED_RTNL 0x04 -@@ -15813,6 +15917,14 @@ static const struct genl_small_ops nl802 +@@ -15815,6 +15919,14 @@ static const struct genl_small_ops nl802 .internal_flags = NL80211_FLAG_NEED_WIPHY | NL80211_FLAG_NEED_RTNL, }, @@ -363,7 +363,7 @@ Signed-off-by: Johannes Berg }; static struct genl_family nl80211_fam __genl_ro_after_init = { -@@ -17444,6 +17556,51 @@ void cfg80211_ch_switch_started_notify(s +@@ -17446,6 +17558,51 @@ void cfg80211_ch_switch_started_notify(s } EXPORT_SYMBOL(cfg80211_ch_switch_started_notify); diff --git a/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch b/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch index 7957239627..320570d034 100644 --- a/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch +++ b/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch @@ -40,7 +40,7 @@ Signed-off-by: Johannes Berg /* must be last */ u8 drv_priv[] __aligned(sizeof(void *)); }; -@@ -4988,6 +4995,16 @@ void ieee80211_csa_finish(struct ieee802 +@@ -4992,6 +4999,16 @@ void ieee80211_csa_finish(struct ieee802 bool ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif); /** @@ -57,7 +57,7 @@ Signed-off-by: Johannes Berg * ieee80211_proberesp_get - retrieve a Probe Response template * @hw: pointer obtained from ieee80211_alloc_hw(). * @vif: &struct ieee80211_vif pointer from the add_interface callback. -@@ -6752,6 +6769,18 @@ ieee80211_get_unsol_bcast_probe_resp_tmp +@@ -6756,6 +6773,18 @@ ieee80211_get_unsol_bcast_probe_resp_tmp struct ieee80211_vif *vif); /** @@ -78,7 +78,7 @@ Signed-off-by: Johannes Berg * The function is used to check if a frame is a data frame. Frames with --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -809,9 +809,11 @@ static int ieee80211_set_monitor_channel +@@ -828,9 +828,11 @@ static int ieee80211_set_monitor_channel return ret; } @@ -93,7 +93,7 @@ Signed-off-by: Johannes Berg { struct probe_resp *new, *old; -@@ -831,6 +833,8 @@ static int ieee80211_set_probe_resp(stru +@@ -850,6 +852,8 @@ static int ieee80211_set_probe_resp(stru memcpy(new->cntdwn_counter_offsets, csa->counter_offsets_presp, csa->n_counter_offsets_presp * sizeof(new->cntdwn_counter_offsets[0])); @@ -102,7 +102,7 @@ Signed-off-by: Johannes Berg rcu_assign_pointer(sdata->u.ap.probe_resp, new); if (old) -@@ -936,7 +940,8 @@ static int ieee80211_set_ftm_responder_p +@@ -955,7 +959,8 @@ static int ieee80211_set_ftm_responder_p static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, struct cfg80211_beacon_data *params, @@ -112,7 +112,7 @@ Signed-off-by: Johannes Berg { struct beacon_data *new, *old; int new_head_len, new_tail_len; -@@ -985,6 +990,9 @@ static int ieee80211_assign_beacon(struc +@@ -1004,6 +1009,9 @@ static int ieee80211_assign_beacon(struc memcpy(new->cntdwn_counter_offsets, csa->counter_offsets_beacon, csa->n_counter_offsets_beacon * sizeof(new->cntdwn_counter_offsets[0])); @@ -122,7 +122,7 @@ Signed-off-by: Johannes Berg } /* copy in head */ -@@ -1001,7 +1009,7 @@ static int ieee80211_assign_beacon(struc +@@ -1020,7 +1028,7 @@ static int ieee80211_assign_beacon(struc memcpy(new->tail, old->tail, new_tail_len); err = ieee80211_set_probe_resp(sdata, params->probe_resp, @@ -131,7 +131,7 @@ Signed-off-by: Johannes Berg if (err < 0) { kfree(new); return err; -@@ -1156,7 +1164,7 @@ static int ieee80211_start_ap(struct wip +@@ -1175,7 +1183,7 @@ static int ieee80211_start_ap(struct wip if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) sdata->vif.bss_conf.beacon_tx_rate = params->beacon_rate; @@ -140,7 +140,7 @@ Signed-off-by: Johannes Berg if (err < 0) goto error; changed |= err; -@@ -1211,17 +1219,17 @@ static int ieee80211_change_beacon(struc +@@ -1230,17 +1238,17 @@ static int ieee80211_change_beacon(struc sdata = IEEE80211_DEV_TO_SUB_IF(dev); sdata_assert_lock(sdata); @@ -161,7 +161,7 @@ Signed-off-by: Johannes Berg if (err < 0) return err; ieee80211_bss_info_change_notify(sdata, err); -@@ -3144,7 +3152,7 @@ static int ieee80211_set_after_csa_beaco +@@ -3163,7 +3171,7 @@ static int ieee80211_set_after_csa_beaco switch (sdata->vif.type) { case NL80211_IFTYPE_AP: err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon, @@ -170,7 +170,7 @@ Signed-off-by: Johannes Berg kfree(sdata->u.ap.next_beacon); sdata->u.ap.next_beacon = NULL; -@@ -3310,7 +3318,7 @@ static int ieee80211_set_csa_beacon(stru +@@ -3329,7 +3337,7 @@ static int ieee80211_set_csa_beacon(stru csa.n_counter_offsets_presp = params->n_counter_offsets_presp; csa.count = params->count; @@ -179,7 +179,7 @@ Signed-off-by: Johannes Berg if (err < 0) { kfree(sdata->u.ap.next_beacon); return err; -@@ -3399,6 +3407,15 @@ static int ieee80211_set_csa_beacon(stru +@@ -3418,6 +3426,15 @@ static int ieee80211_set_csa_beacon(stru return 0; } @@ -195,7 +195,7 @@ Signed-off-by: Johannes Berg static int __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_csa_settings *params) -@@ -3467,6 +3484,10 @@ __ieee80211_channel_switch(struct wiphy +@@ -3486,6 +3503,10 @@ __ieee80211_channel_switch(struct wiphy goto out; } @@ -206,7 +206,7 @@ Signed-off-by: Johannes Berg err = ieee80211_set_csa_beacon(sdata, params, &changed); if (err) { ieee80211_vif_unreserve_chanctx(sdata); -@@ -4118,6 +4139,196 @@ static int ieee80211_set_sar_specs(struc +@@ -4137,6 +4158,196 @@ static int ieee80211_set_sar_specs(struc return local->ops->set_sar_specs(&local->hw, sar); } @@ -403,7 +403,7 @@ Signed-off-by: Johannes Berg const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface, -@@ -4221,4 +4432,5 @@ const struct cfg80211_ops mac80211_confi +@@ -4240,4 +4451,5 @@ const struct cfg80211_ops mac80211_confi .set_tid_config = ieee80211_set_tid_config, .reset_tid_config = ieee80211_reset_tid_config, .set_sar_specs = ieee80211_set_sar_specs, @@ -433,7 +433,7 @@ Signed-off-by: Johannes Berg struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */ struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */ -@@ -1893,6 +1901,9 @@ void ieee80211_csa_finalize_work(struct +@@ -1895,6 +1903,9 @@ void ieee80211_csa_finalize_work(struct int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_csa_settings *params); @@ -445,7 +445,7 @@ Signed-off-by: Johannes Berg NETIF_F_HW_CSUM | NETIF_F_SG | \ --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -461,6 +461,7 @@ static void ieee80211_do_stop(struct iee +@@ -462,6 +462,7 @@ static void ieee80211_do_stop(struct iee sdata_unlock(sdata); cancel_work_sync(&sdata->csa_finalize_work); @@ -453,7 +453,7 @@ Signed-off-by: Johannes Berg cancel_delayed_work_sync(&sdata->dfs_cac_timer_work); -@@ -1572,6 +1573,7 @@ static void ieee80211_setup_sdata(struct +@@ -1595,6 +1596,7 @@ static void ieee80211_setup_sdata(struct INIT_WORK(&sdata->work, ieee80211_iface_work); INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work); INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); @@ -463,7 +463,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4773,11 +4773,11 @@ static int ieee80211_beacon_add_tim(stru +@@ -4784,11 +4784,11 @@ static int ieee80211_beacon_add_tim(stru static void ieee80211_set_beacon_cntdwn(struct ieee80211_sub_if_data *sdata, struct beacon_data *beacon) { @@ -477,7 +477,7 @@ Signed-off-by: Johannes Berg switch (sdata->vif.type) { case NL80211_IFTYPE_AP: -@@ -4797,21 +4797,27 @@ static void ieee80211_set_beacon_cntdwn( +@@ -4808,21 +4808,27 @@ static void ieee80211_set_beacon_cntdwn( } rcu_read_lock(); @@ -514,7 +514,7 @@ Signed-off-by: Johannes Berg } rcu_read_unlock(); } -@@ -5021,6 +5027,7 @@ __ieee80211_beacon_get(struct ieee80211_ +@@ -5032,6 +5038,7 @@ __ieee80211_beacon_get(struct ieee80211_ if (offs) { offs->tim_offset = beacon->head_len; offs->tim_length = skb->len - beacon->head_len; diff --git a/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch b/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch index d2b1881ddc..cf45c6d072 100644 --- a/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch +++ b/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch @@ -73,7 +73,7 @@ Signed-off-by: Johannes Berg } u; } __packed action; } u; -@@ -2881,6 +2927,7 @@ enum ieee80211_eid { +@@ -2879,6 +2925,7 @@ enum ieee80211_eid { WLAN_EID_AID_RESPONSE = 211, WLAN_EID_S1G_BCN_COMPAT = 213, WLAN_EID_S1G_SHORT_BCN_INTERVAL = 214, @@ -81,7 +81,7 @@ Signed-off-by: Johannes Berg WLAN_EID_S1G_CAPABILITIES = 217, WLAN_EID_VENDOR_SPECIFIC = 221, WLAN_EID_QOS_PARAMETER = 222, -@@ -2949,6 +2996,7 @@ enum ieee80211_category { +@@ -2947,6 +2994,7 @@ enum ieee80211_category { WLAN_CATEGORY_FST = 18, WLAN_CATEGORY_UNPROT_DMG = 20, WLAN_CATEGORY_VHT = 21, @@ -89,7 +89,7 @@ Signed-off-by: Johannes Berg WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, WLAN_CATEGORY_VENDOR_SPECIFIC = 127, }; -@@ -3022,6 +3070,20 @@ enum ieee80211_key_len { +@@ -3020,6 +3068,20 @@ enum ieee80211_key_len { WLAN_KEY_LEN_BIP_GMAC_256 = 32, }; diff --git a/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch index cdb88255f5..2b7bdabfe3 100644 --- a/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch +++ b/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch @@ -27,7 +27,7 @@ Signed-off-by: Johannes Berg --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -4225,6 +4225,11 @@ struct ieee80211_ops { +@@ -4229,6 +4229,11 @@ struct ieee80211_ops { void (*sta_set_decap_offload)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, bool enabled); @@ -92,7 +92,7 @@ Signed-off-by: Johannes Berg u8 needed_rx_chains; enum ieee80211_smps_mode smps_mode; -@@ -2086,6 +2087,11 @@ ieee80211_he_op_ie_to_bss_conf(struct ie +@@ -2088,6 +2089,11 @@ ieee80211_he_op_ie_to_bss_conf(struct ie /* S1G */ void ieee80211_s1g_sta_rate_init(struct sta_info *sta); @@ -106,7 +106,7 @@ Signed-off-by: Johannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -551,6 +551,7 @@ static void ieee80211_do_stop(struct iee +@@ -552,6 +552,7 @@ static void ieee80211_do_stop(struct iee */ ieee80211_free_keys(sdata, true); skb_queue_purge(&sdata->skb_queue); @@ -114,7 +114,7 @@ Signed-off-by: Johannes Berg } spin_lock_irqsave(&local->queue_stop_reason_lock, flags); -@@ -1032,6 +1033,7 @@ int ieee80211_add_virtual_monitor(struct +@@ -1055,6 +1056,7 @@ int ieee80211_add_virtual_monitor(struct } skb_queue_head_init(&sdata->skb_queue); @@ -122,7 +122,7 @@ Signed-off-by: Johannes Berg INIT_WORK(&sdata->work, ieee80211_iface_work); return 0; -@@ -1373,6 +1375,24 @@ static void ieee80211_if_setup_no_queue( +@@ -1396,6 +1398,24 @@ static void ieee80211_if_setup_no_queue( dev->priv_flags |= IFF_NO_QUEUE; } @@ -147,7 +147,7 @@ Signed-off-by: Johannes Berg static void ieee80211_iface_work(struct work_struct *work) { struct ieee80211_sub_if_data *sdata = -@@ -1451,6 +1471,16 @@ static void ieee80211_iface_work(struct +@@ -1474,6 +1494,16 @@ static void ieee80211_iface_work(struct WARN_ON(1); break; } @@ -164,7 +164,7 @@ Signed-off-by: Johannes Berg } else if (ieee80211_is_ext(mgmt->frame_control)) { if (sdata->vif.type == NL80211_IFTYPE_STATION) ieee80211_sta_rx_queued_ext(sdata, skb); -@@ -1507,6 +1537,12 @@ static void ieee80211_iface_work(struct +@@ -1530,6 +1560,12 @@ static void ieee80211_iface_work(struct kcov_remote_stop(); } @@ -177,7 +177,7 @@ Signed-off-by: Johannes Berg /* then other type-dependent work */ switch (sdata->vif.type) { case NL80211_IFTYPE_STATION: -@@ -1570,6 +1606,7 @@ static void ieee80211_setup_sdata(struct +@@ -1593,6 +1629,7 @@ static void ieee80211_setup_sdata(struct } skb_queue_head_init(&sdata->skb_queue); @@ -187,7 +187,7 @@ Signed-off-by: Johannes Berg INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -3197,6 +3197,68 @@ ieee80211_rx_h_mgmt_check(struct ieee802 +@@ -3198,6 +3198,68 @@ ieee80211_rx_h_mgmt_check(struct ieee802 return RX_CONTINUE; } @@ -256,7 +256,7 @@ Signed-off-by: Johannes Berg static ieee80211_rx_result debug_noinline ieee80211_rx_h_action(struct ieee80211_rx_data *rx) { -@@ -3476,6 +3538,17 @@ ieee80211_rx_h_action(struct ieee80211_r +@@ -3477,6 +3539,17 @@ ieee80211_rx_h_action(struct ieee80211_r !mesh_path_sel_is_hwmp(sdata)) break; goto queue; diff --git a/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch b/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch deleted file mode 100644 index ea1091bb99..0000000000 --- a/package/kernel/mac80211/patches/subsys/391-wireless-align-some-HE-capabilities-with-the-spec.patch +++ /dev/null @@ -1,227 +0,0 @@ -From: Johannes Berg -Date: Fri, 9 Apr 2021 12:40:17 +0300 -Subject: [PATCH] wireless: align some HE capabilities with the spec - -Some names were changed, align that with the spec as of -802.11ax-D6.1. - -Signed-off-by: Luca Coelho -Link: https://lore.kernel.org/r/iwlwifi.20210409123755.b1e5fbab0d8c.I3eb6076cb0714ec6aec6b8f9dee613ce4a05d825@changeid -Signed-off-by: Johannes Berg ---- - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3813,7 +3813,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee - IEEE80211_HE_MAC_CAP4_BQR; - he_cap_elem->mac_cap_info[4] &= ~m; - -- m = IEEE80211_HE_MAC_CAP5_SUBCHAN_SELECVITE_TRANSMISSION | -+ m = IEEE80211_HE_MAC_CAP5_SUBCHAN_SELECTIVE_TRANSMISSION | - IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU | - IEEE80211_HE_MAC_CAP5_PUNCTURED_SOUNDING | - IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX; -@@ -3823,7 +3823,7 @@ ath11k_mac_filter_he_cap_mesh(struct iee - IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO; - he_cap_elem->phy_cap_info[2] &= ~m; - -- m = IEEE80211_HE_PHY_CAP3_RX_HE_MU_PPDU_FROM_NON_AP_STA | -+ m = IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU | - IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK | - IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK; - he_cap_elem->phy_cap_info[3] &= ~m; -@@ -3835,13 +3835,13 @@ ath11k_mac_filter_he_cap_mesh(struct iee - he_cap_elem->phy_cap_info[5] &= ~m; - - m = IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU | -- IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB | -+ IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB | - IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB | - IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO; - he_cap_elem->phy_cap_info[6] &= ~m; - -- m = IEEE80211_HE_PHY_CAP7_SRP_BASED_SR | -- IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR | -+ m = IEEE80211_HE_PHY_CAP7_PSR_BASED_SR | -+ IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP | - IEEE80211_HE_PHY_CAP7_STBC_TX_ABOVE_80MHZ | - IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ; - he_cap_elem->phy_cap_info[7] &= ~m; ---- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c -+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c -@@ -424,8 +424,8 @@ mt7915_set_stream_he_txbf_caps(struct ie - IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK; - elem->phy_cap_info[5] &= ~c; - -- c = IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB | -- IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB; -+ c = IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB | -+ IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB; - elem->phy_cap_info[6] &= ~c; - - elem->phy_cap_info[7] &= ~IEEE80211_HE_PHY_CAP7_MAX_NC_MASK; -@@ -465,8 +465,8 @@ mt7915_set_stream_he_txbf_caps(struct ie - c = (nss - 1) | (max_t(int, le16_to_cpu(mcs->tx_mcs_160), 1) << 3); - elem->phy_cap_info[5] |= c; - -- c = IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB | -- IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB; -+ c = IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB | -+ IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB; - elem->phy_cap_info[6] |= c; - } - -@@ -589,7 +589,7 @@ mt7915_init_he_caps(struct mt7915_phy *p - IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE | - IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT; - he_cap_elem->phy_cap_info[7] |= -- IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR | -+ IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP | - IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI; - he_cap_elem->phy_cap_info[8] |= - IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G | ---- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c -+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c -@@ -1840,9 +1840,9 @@ mt7915_mcu_sta_bfer_he(struct ieee80211_ - - bf->tx_mode = MT_PHY_TYPE_HE_SU; - mt7915_mcu_sta_sounding_rate(bf); -- bf->trigger_su = HE_PHY(CAP6_TRIG_SU_BEAMFORMER_FB, -+ bf->trigger_su = HE_PHY(CAP6_TRIG_SU_BEAMFORMING_FB, - pe->phy_cap_info[6]); -- bf->trigger_mu = HE_PHY(CAP6_TRIG_MU_BEAMFORMER_FB, -+ bf->trigger_mu = HE_PHY(CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB, - pe->phy_cap_info[6]); - bfer_nr = HE_PHY(CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK, - ve->phy_cap_info[5]); ---- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c -+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c -@@ -107,7 +107,7 @@ mt7921_init_he_caps(struct mt7921_phy *p - IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE | - IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT; - he_cap_elem->phy_cap_info[7] |= -- IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR | -+ IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP | - IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI; - he_cap_elem->phy_cap_info[8] |= - IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G | ---- a/include/linux/ieee80211.h -+++ b/include/linux/ieee80211.h -@@ -2066,7 +2066,7 @@ int ieee80211_get_vht_max_nss(struct iee - #define IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG 0x01 - #define IEEE80211_HE_MAC_CAP4_QTP 0x02 - #define IEEE80211_HE_MAC_CAP4_BQR 0x04 --#define IEEE80211_HE_MAC_CAP4_SRP_RESP 0x08 -+#define IEEE80211_HE_MAC_CAP4_PSR_RESP 0x08 - #define IEEE80211_HE_MAC_CAP4_NDP_FB_REP 0x10 - #define IEEE80211_HE_MAC_CAP4_OPS 0x20 - #define IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU 0x40 -@@ -2077,7 +2077,7 @@ int ieee80211_get_vht_max_nss(struct iee - - #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40 0x01 - #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41 0x02 --#define IEEE80211_HE_MAC_CAP5_SUBCHAN_SELECVITE_TRANSMISSION 0x04 -+#define IEEE80211_HE_MAC_CAP5_SUBCHAN_SELECTIVE_TRANSMISSION 0x04 - #define IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU 0x08 - #define IEEE80211_HE_MAC_CAP5_OM_CTRL_UL_MU_DATA_DIS_RX 0x10 - #define IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS 0x20 -@@ -2135,7 +2135,7 @@ int ieee80211_get_vht_max_nss(struct iee - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK 0x18 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 0x00 - #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_2 0x20 --#define IEEE80211_HE_PHY_CAP3_RX_HE_MU_PPDU_FROM_NON_AP_STA 0x40 -+#define IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU 0x40 - #define IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER 0x80 - - #define IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE 0x01 -@@ -2182,15 +2182,15 @@ int ieee80211_get_vht_max_nss(struct iee - - #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU 0x01 - #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU 0x02 --#define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB 0x04 --#define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB 0x08 -+#define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB 0x04 -+#define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB 0x08 - #define IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB 0x10 - #define IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE 0x20 - #define IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO 0x40 - #define IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT 0x80 - --#define IEEE80211_HE_PHY_CAP7_SRP_BASED_SR 0x01 --#define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR 0x02 -+#define IEEE80211_HE_PHY_CAP7_PSR_BASED_SR 0x01 -+#define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP 0x02 - #define IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI 0x04 - #define IEEE80211_HE_PHY_CAP7_MAX_NC_1 0x08 - #define IEEE80211_HE_PHY_CAP7_MAX_NC_2 0x10 ---- a/net/mac80211/debugfs_sta.c -+++ b/net/mac80211/debugfs_sta.c -@@ -732,15 +732,15 @@ static ssize_t sta_he_capa_read(struct f - PFLAG(MAC, 4, BSRP_BQRP_A_MPDU_AGG, "BSRP-BQRP-A-MPDU-AGG"); - PFLAG(MAC, 4, QTP, "QTP"); - PFLAG(MAC, 4, BQR, "BQR"); -- PFLAG(MAC, 4, SRP_RESP, "SRP-RESP"); -+ PFLAG(MAC, 4, PSR_RESP, "PSR-RESP"); - PFLAG(MAC, 4, NDP_FB_REP, "NDP-FB-REP"); - PFLAG(MAC, 4, OPS, "OPS"); - PFLAG(MAC, 4, AMDSU_IN_AMPDU, "AMSDU-IN-AMPDU"); - - PRINT("MULTI-TID-AGG-TX-QOS-%d", ((cap[5] << 1) | (cap[4] >> 7)) & 0x7); - -- PFLAG(MAC, 5, SUBCHAN_SELECVITE_TRANSMISSION, -- "SUBCHAN-SELECVITE-TRANSMISSION"); -+ PFLAG(MAC, 5, SUBCHAN_SELECTIVE_TRANSMISSION, -+ "SUBCHAN-SELECTIVE-TRANSMISSION"); - PFLAG(MAC, 5, UL_2x996_TONE_RU, "UL-2x996-TONE-RU"); - PFLAG(MAC, 5, OM_CTRL_UL_MU_DATA_DIS_RX, "OM-CTRL-UL-MU-DATA-DIS-RX"); - PFLAG(MAC, 5, HE_DYNAMIC_SM_PS, "HE-DYNAMIC-SM-PS"); -@@ -832,8 +832,8 @@ static ssize_t sta_he_capa_read(struct f - - PFLAG(PHY, 3, DCM_MAX_RX_NSS_1, "DCM-MAX-RX-NSS-1"); - PFLAG(PHY, 3, DCM_MAX_RX_NSS_2, "DCM-MAX-RX-NSS-2"); -- PFLAG(PHY, 3, RX_HE_MU_PPDU_FROM_NON_AP_STA, -- "RX-HE-MU-PPDU-FROM-NON-AP-STA"); -+ PFLAG(PHY, 3, RX_PARTIAL_BW_SU_IN_20MHZ_MU, -+ "RX-PARTIAL-BW-SU-IN-20MHZ-MU"); - PFLAG(PHY, 3, SU_BEAMFORMER, "SU-BEAMFORMER"); - - PFLAG(PHY, 4, SU_BEAMFORMEE, "SU-BEAMFORMEE"); -@@ -853,16 +853,17 @@ static ssize_t sta_he_capa_read(struct f - - PFLAG(PHY, 6, CODEBOOK_SIZE_42_SU, "CODEBOOK-SIZE-42-SU"); - PFLAG(PHY, 6, CODEBOOK_SIZE_75_MU, "CODEBOOK-SIZE-75-MU"); -- PFLAG(PHY, 6, TRIG_SU_BEAMFORMER_FB, "TRIG-SU-BEAMFORMER-FB"); -- PFLAG(PHY, 6, TRIG_MU_BEAMFORMER_FB, "TRIG-MU-BEAMFORMER-FB"); -+ PFLAG(PHY, 6, TRIG_SU_BEAMFORMING_FB, "TRIG-SU-BEAMFORMING-FB"); -+ PFLAG(PHY, 6, TRIG_MU_BEAMFORMING_PARTIAL_BW_FB, -+ "MU-BEAMFORMING-PARTIAL-BW-FB"); - PFLAG(PHY, 6, TRIG_CQI_FB, "TRIG-CQI-FB"); - PFLAG(PHY, 6, PARTIAL_BW_EXT_RANGE, "PARTIAL-BW-EXT-RANGE"); - PFLAG(PHY, 6, PARTIAL_BANDWIDTH_DL_MUMIMO, - "PARTIAL-BANDWIDTH-DL-MUMIMO"); - PFLAG(PHY, 6, PPE_THRESHOLD_PRESENT, "PPE-THRESHOLD-PRESENT"); - -- PFLAG(PHY, 7, SRP_BASED_SR, "SRP-BASED-SR"); -- PFLAG(PHY, 7, POWER_BOOST_FACTOR_AR, "POWER-BOOST-FACTOR-AR"); -+ PFLAG(PHY, 7, PSR_BASED_SR, "PSR-BASED-SR"); -+ PFLAG(PHY, 7, POWER_BOOST_FACTOR_SUPP, "POWER-BOOST-FACTOR-SUPP"); - PFLAG(PHY, 7, HE_SU_MU_PPDU_4XLTF_AND_08_US_GI, - "HE-SU-MU-PPDU-4XLTF-AND-08-US-GI"); - PFLAG_RANGE(PHY, 7, MAX_NC, 0, 1, 1, "MAX-NC-%d"); ---- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -@@ -583,11 +583,11 @@ static const struct ieee80211_sband_ifty - IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2 | - IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2, - .phy_cap_info[6] = -- IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB | -- IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB | -+ IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB | -+ IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB | - IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT, - .phy_cap_info[7] = -- IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR | -+ IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP | - IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI | - IEEE80211_HE_PHY_CAP7_MAX_NC_1, - .phy_cap_info[8] = diff --git a/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch b/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch deleted file mode 100644 index 9c5ba68390..0000000000 --- a/package/kernel/mac80211/patches/subsys/392-wireless-fix-spelling-of-A-MSDU-in-HE-capabilities.patch +++ /dev/null @@ -1,113 +0,0 @@ -From: Johannes Berg -Date: Fri, 9 Apr 2021 12:40:24 +0300 -Subject: [PATCH] wireless: fix spelling of A-MSDU in HE capabilities - -In the HE capabilities, spell A-MSDU correctly, not "A-MDSU". - -Signed-off-by: Luca Coelho -Link: https://lore.kernel.org/r/iwlwifi.20210409123755.9e6ff1af1181.If6868bc6902ccd9a95c74c78f716c4b41473ef14@changeid -Signed-off-by: Johannes Berg ---- - ---- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -@@ -552,7 +552,7 @@ static const struct ieee80211_sband_ifty - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | - IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, - .mac_cap_info[4] = -- IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU | -+ IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU | - IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39, - .mac_cap_info[5] = - IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40 | -@@ -638,7 +638,7 @@ static const struct ieee80211_sband_ifty - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | - IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, - .mac_cap_info[4] = -- IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU, -+ IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, - .mac_cap_info[5] = - IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU, - .phy_cap_info[0] = ---- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c -+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c -@@ -532,7 +532,7 @@ mt7915_init_he_caps(struct mt7915_phy *p - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | - IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_RESERVED; - he_cap_elem->mac_cap_info[4] = -- IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU; -+ IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU; - - if (band == NL80211_BAND_2GHZ) - he_cap_elem->phy_cap_info[0] = ---- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c -+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c -@@ -1343,7 +1343,7 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *sk - if (elem->mac_cap_info[3] & IEEE80211_HE_MAC_CAP3_OMI_CONTROL) - cap |= STA_REC_HE_CAP_OM; - -- if (elem->mac_cap_info[4] & IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU) -+ if (elem->mac_cap_info[4] & IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU) - cap |= STA_REC_HE_CAP_AMSDU_IN_AMPDU; - - if (elem->mac_cap_info[4] & IEEE80211_HE_MAC_CAP4_BQR) ---- a/include/linux/ieee80211.h -+++ b/include/linux/ieee80211.h -@@ -2069,7 +2069,7 @@ int ieee80211_get_vht_max_nss(struct iee - #define IEEE80211_HE_MAC_CAP4_PSR_RESP 0x08 - #define IEEE80211_HE_MAC_CAP4_NDP_FB_REP 0x10 - #define IEEE80211_HE_MAC_CAP4_OPS 0x20 --#define IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU 0x40 -+#define IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU 0x40 - /* Multi TID agg TX is split between byte #4 and #5 - * The value is a combination of B39,B40,B41 - */ ---- a/net/mac80211/debugfs_sta.c -+++ b/net/mac80211/debugfs_sta.c -@@ -735,7 +735,7 @@ static ssize_t sta_he_capa_read(struct f - PFLAG(MAC, 4, PSR_RESP, "PSR-RESP"); - PFLAG(MAC, 4, NDP_FB_REP, "NDP-FB-REP"); - PFLAG(MAC, 4, OPS, "OPS"); -- PFLAG(MAC, 4, AMDSU_IN_AMPDU, "AMSDU-IN-AMPDU"); -+ PFLAG(MAC, 4, AMSDU_IN_AMPDU, "AMSDU-IN-AMPDU"); - - PRINT("MULTI-TID-AGG-TX-QOS-%d", ((cap[5] << 1) | (cap[4] >> 7)) & 0x7); - ---- a/drivers/net/wireless/mac80211_hwsim.c -+++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2818,7 +2818,7 @@ static const struct ieee80211_sband_ifty - .mac_cap_info[3] = - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | - IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, -- .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU, -+ .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, - .phy_cap_info[1] = - IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | - IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | -@@ -2862,7 +2862,7 @@ static const struct ieee80211_sband_ifty - .mac_cap_info[3] = - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | - IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, -- .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU, -+ .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, - .phy_cap_info[1] = - IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | - IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | -@@ -2908,7 +2908,7 @@ static const struct ieee80211_sband_ifty - .mac_cap_info[3] = - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | - IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, -- .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU, -+ .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, - .phy_cap_info[0] = - IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | - IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G | -@@ -2956,7 +2956,7 @@ static const struct ieee80211_sband_ifty - .mac_cap_info[3] = - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | - IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, -- .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU, -+ .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, - .phy_cap_info[0] = - IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | - IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G | diff --git a/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch b/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch deleted file mode 100644 index 34829a7462..0000000000 --- a/package/kernel/mac80211/patches/subsys/393-wireless-align-HE-capabilities-A-MPDU-Length-Exponen.patch +++ /dev/null @@ -1,148 +0,0 @@ -From: Johannes Berg -Date: Fri, 9 Apr 2021 12:40:20 +0300 -Subject: [PATCH] wireless: align HE capabilities A-MPDU Length Exponent - Extension - -The A-MPDU length exponent extension is defined differently in -802.11ax D6.1, align with that. - -Signed-off-by: Luca Coelho -Link: https://lore.kernel.org/r/iwlwifi.20210409123755.c2a257d3e2df.I3455245d388c52c61dace7e7958dbed7e807cfb6@changeid -Signed-off-by: Johannes Berg ---- - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1265,9 +1265,8 @@ static void ath11k_peer_assoc_h_he(struc - * request, then use MAX_AMPDU_LEN_FACTOR as 16 to calculate max_ampdu - * length. - */ -- ampdu_factor = (he_cap->he_cap_elem.mac_cap_info[3] & -- IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK) >> -- IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_SHIFT; -+ ampdu_factor = u8_get_bits(he_cap->he_cap_elem.mac_cap_info[3], -+ IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK); - - if (ampdu_factor) { - if (sta->vht_cap.vht_supported) ---- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -@@ -550,7 +550,7 @@ static const struct ieee80211_sband_ifty - IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP, - .mac_cap_info[3] = - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | -- IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, -+ IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2, - .mac_cap_info[4] = - IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU | - IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39, -@@ -636,7 +636,7 @@ static const struct ieee80211_sband_ifty - IEEE80211_HE_MAC_CAP2_BSR, - .mac_cap_info[3] = - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | -- IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, -+ IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2, - .mac_cap_info[4] = - IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, - .mac_cap_info[5] = ---- a/drivers/net/wireless/mac80211_hwsim.c -+++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2817,7 +2817,7 @@ static const struct ieee80211_sband_ifty - IEEE80211_HE_MAC_CAP2_ACK_EN, - .mac_cap_info[3] = - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | -- IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, -+ IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3, - .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, - .phy_cap_info[1] = - IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | -@@ -2861,7 +2861,7 @@ static const struct ieee80211_sband_ifty - IEEE80211_HE_MAC_CAP2_ACK_EN, - .mac_cap_info[3] = - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | -- IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, -+ IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3, - .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, - .phy_cap_info[1] = - IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | -@@ -2907,7 +2907,7 @@ static const struct ieee80211_sband_ifty - IEEE80211_HE_MAC_CAP2_ACK_EN, - .mac_cap_info[3] = - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | -- IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, -+ IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3, - .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, - .phy_cap_info[0] = - IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | -@@ -2955,7 +2955,7 @@ static const struct ieee80211_sband_ifty - IEEE80211_HE_MAC_CAP2_ACK_EN, - .mac_cap_info[3] = - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | -- IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, -+ IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3, - .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, - .phy_cap_info[0] = - IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | ---- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c -+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c -@@ -530,7 +530,7 @@ mt7915_init_he_caps(struct mt7915_phy *p - IEEE80211_HE_MAC_CAP0_HTC_HE; - he_cap_elem->mac_cap_info[3] = - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | -- IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_RESERVED; -+ IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3; - he_cap_elem->mac_cap_info[4] = - IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU; - ---- a/include/linux/ieee80211.h -+++ b/include/linux/ieee80211.h -@@ -2052,17 +2052,15 @@ int ieee80211_get_vht_max_nss(struct iee - * A-MDPU Length Exponent field in the HT capabilities, VHT capabilities and the - * same field in the HE capabilities. - */ --#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_USE_VHT 0x00 --#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_1 0x08 --#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2 0x10 --#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_RESERVED 0x18 -+#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_0 0x00 -+#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1 0x08 -+#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2 0x10 -+#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3 0x18 - #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK 0x18 - #define IEEE80211_HE_MAC_CAP3_AMSDU_FRAG 0x20 - #define IEEE80211_HE_MAC_CAP3_FLEX_TWT_SCHED 0x40 - #define IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS 0x80 - --#define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_SHIFT 3 -- - #define IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG 0x01 - #define IEEE80211_HE_MAC_CAP4_QTP 0x02 - #define IEEE80211_HE_MAC_CAP4_BQR 0x04 ---- a/net/mac80211/debugfs_sta.c -+++ b/net/mac80211/debugfs_sta.c -@@ -711,17 +711,17 @@ static ssize_t sta_he_capa_read(struct f - PFLAG(MAC, 3, OFDMA_RA, "OFDMA-RA"); - - switch (cap[3] & IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK) { -- case IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_USE_VHT: -- PRINT("MAX-AMPDU-LEN-EXP-USE-VHT"); -+ case IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_0: -+ PRINT("MAX-AMPDU-LEN-EXP-USE-EXT-0"); - break; -- case IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_1: -- PRINT("MAX-AMPDU-LEN-EXP-VHT-1"); -+ case IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1: -+ PRINT("MAX-AMPDU-LEN-EXP-VHT-EXT-1"); - break; -- case IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2: -- PRINT("MAX-AMPDU-LEN-EXP-VHT-2"); -+ case IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2: -+ PRINT("MAX-AMPDU-LEN-EXP-VHT-EXT-2"); - break; -- case IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_RESERVED: -- PRINT("MAX-AMPDU-LEN-EXP-RESERVED"); -+ case IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3: -+ PRINT("MAX-AMPDU-LEN-EXP-VHT-EXT-3"); - break; - } - diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index f341fb399e..6d4a9c21a5 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -3818,6 +3818,7 @@ struct mgmt_frame_regs { +@@ -3826,6 +3826,7 @@ struct mgmt_frame_regs { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting * functions to adjust rfkill hw state -@@ -4142,6 +4143,7 @@ struct cfg80211_ops { +@@ -4150,6 +4151,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); @@ -57,7 +57,7 @@ __NL80211_ATTR_AFTER_LAST, --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2749,6 +2749,19 @@ static int ieee80211_get_tx_power(struct +@@ -2768,6 +2768,19 @@ static int ieee80211_get_tx_power(struct return 0; } @@ -77,7 +77,7 @@ static void ieee80211_rfkill_poll(struct wiphy *wiphy) { struct ieee80211_local *local = wiphy_priv(wiphy); -@@ -4384,6 +4397,7 @@ const struct cfg80211_ops mac80211_confi +@@ -4403,6 +4416,7 @@ const struct cfg80211_ops mac80211_confi .set_wiphy_params = ieee80211_set_wiphy_params, .set_tx_power = ieee80211_set_tx_power, .get_tx_power = ieee80211_get_tx_power, @@ -119,7 +119,7 @@ if (local->hw.conf.power_level != power) { changed |= IEEE80211_CONF_CHANGE_POWER; local->hw.conf.power_level = power; -@@ -670,6 +676,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -679,6 +685,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ IEEE80211_RADIOTAP_MCS_HAVE_BW; local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; @@ -129,7 +129,7 @@ local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -778,6 +778,7 @@ static const struct nla_policy nl80211_p +@@ -780,6 +780,7 @@ static const struct nla_policy nl80211_p [NL80211_ATTR_COLOR_CHANGE_COUNT] = { .type = NLA_U8 }, [NL80211_ATTR_COLOR_CHANGE_COLOR] = { .type = NLA_U8 }, [NL80211_ATTR_COLOR_CHANGE_ELEMS] = NLA_POLICY_NESTED(nl80211_policy), @@ -137,7 +137,7 @@ }; /* policy for the key attributes */ -@@ -3315,6 +3316,20 @@ static int nl80211_set_wiphy(struct sk_b +@@ -3317,6 +3318,20 @@ static int nl80211_set_wiphy(struct sk_b goto out; } diff --git a/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch b/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch index 3724013146..26af6a2fb9 100644 --- a/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch +++ b/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch @@ -1,238 +1,29 @@ -From 83216e3988cd196183542937c9bd58b279f946af Mon Sep 17 00:00:00 2001 -From: Michael Walle -Date: Mon, 12 Apr 2021 19:47:17 +0200 -Subject: of: net: pass the dst buffer to of_get_mac_address() - -of_get_mac_address() returns a "const void*" pointer to a MAC address. -Lately, support to fetch the MAC address by an NVMEM provider was added. -But this will only work with platform devices. It will not work with -PCI devices (e.g. of an integrated root complex) and esp. not with DSA -ports. - -There is an of_* variant of the nvmem binding which works without -devices. The returned data of a nvmem_cell_read() has to be freed after -use. On the other hand the return of_get_mac_address() points to some -static data without a lifetime. The trick for now, was to allocate a -device resource managed buffer which is then returned. This will only -work if we have an actual device. - -Change it, so that the caller of of_get_mac_address() has to supply a -buffer where the MAC address is written to. Unfortunately, this will -touch all drivers which use the of_get_mac_address(). - -Usually the code looks like: - - const char *addr; - addr = of_get_mac_address(np); - if (!IS_ERR(addr)) - ether_addr_copy(ndev->dev_addr, addr); - -This can then be simply rewritten as: - - of_get_mac_address(np, ndev->dev_addr); - -Sometimes is_valid_ether_addr() is used to test the MAC address. -of_get_mac_address() already makes sure, it just returns a valid MAC -address. Thus we can just test its return code. But we have to be -careful if there are still other sources for the MAC address before the -of_get_mac_address(). In this case we have to keep the -is_valid_ether_addr() call. - -The following coccinelle patch was used to convert common cases to the -new style. Afterwards, I've manually gone over the drivers and fixed the -return code variable: either used a new one or if one was already -available use that. Mansour Moufid, thanks for that coccinelle patch! - - -@a@ -identifier x; -expression y, z; -@@ -- x = of_get_mac_address(y); -+ x = of_get_mac_address(y, z); - <... -- ether_addr_copy(z, x); - ...> - -@@ -identifier a.x; -@@ -- if (<+... x ...+>) {} - -@@ -identifier a.x; -@@ - if (<+... x ...+>) { - ... - } -- else {} - -@@ -identifier a.x; -expression e; -@@ -- if (<+... x ...+>@e) -- {} -- else -+ if (!(e)) - {...} - -@@ -expression x, y, z; -@@ -- x = of_get_mac_address(y, z); -+ of_get_mac_address(y, z); - ... when != x - - -All drivers, except drivers/net/ethernet/aeroflex/greth.c, were -compile-time tested. - -Suggested-by: Andrew Lunn -Signed-off-by: Michael Walle -Reviewed-by: Andrew Lunn -Signed-off-by: David S. Miller ---- - arch/arm/mach-mvebu/kirkwood.c | 3 +- - arch/powerpc/sysdev/tsi108_dev.c | 5 +- - drivers/net/ethernet/aeroflex/greth.c | 6 +-- - drivers/net/ethernet/allwinner/sun4i-emac.c | 10 ++-- - drivers/net/ethernet/altera/altera_tse_main.c | 7 +-- - drivers/net/ethernet/arc/emac_main.c | 8 +-- - drivers/net/ethernet/atheros/ag71xx.c | 7 +-- - drivers/net/ethernet/broadcom/bcm4908_enet.c | 7 +-- - drivers/net/ethernet/broadcom/bcmsysport.c | 7 +-- - drivers/net/ethernet/broadcom/bgmac-bcma.c | 10 ++-- - drivers/net/ethernet/broadcom/bgmac-platform.c | 11 ++-- - drivers/net/ethernet/cadence/macb_main.c | 11 ++-- - drivers/net/ethernet/cavium/octeon/octeon_mgmt.c | 8 +-- - drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 5 +- - drivers/net/ethernet/davicom/dm9000.c | 10 ++-- - drivers/net/ethernet/ethoc.c | 6 +-- - drivers/net/ethernet/ezchip/nps_enet.c | 7 +-- - drivers/net/ethernet/freescale/fec_main.c | 7 +-- - drivers/net/ethernet/freescale/fec_mpc52xx.c | 7 +-- - drivers/net/ethernet/freescale/fman/mac.c | 9 ++-- - .../net/ethernet/freescale/fs_enet/fs_enet-main.c | 5 +- - drivers/net/ethernet/freescale/gianfar.c | 8 +-- - drivers/net/ethernet/freescale/ucc_geth.c | 5 +- - drivers/net/ethernet/hisilicon/hisi_femac.c | 7 +-- - drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 7 +-- - drivers/net/ethernet/lantiq_xrx200.c | 7 +-- - drivers/net/ethernet/marvell/mv643xx_eth.c | 5 +- - drivers/net/ethernet/marvell/mvneta.c | 6 +-- - .../net/ethernet/marvell/prestera/prestera_main.c | 11 ++-- - drivers/net/ethernet/marvell/pxa168_eth.c | 9 +--- - drivers/net/ethernet/marvell/sky2.c | 8 ++- - drivers/net/ethernet/mediatek/mtk_eth_soc.c | 11 ++-- - drivers/net/ethernet/micrel/ks8851_common.c | 7 ++- - drivers/net/ethernet/microchip/lan743x_main.c | 5 +- - drivers/net/ethernet/nxp/lpc_eth.c | 4 +- - drivers/net/ethernet/qualcomm/qca_spi.c | 10 ++-- - drivers/net/ethernet/qualcomm/qca_uart.c | 9 +--- - drivers/net/ethernet/renesas/ravb_main.c | 12 +++-- - drivers/net/ethernet/renesas/sh_eth.c | 5 +- - .../net/ethernet/samsung/sxgbe/sxgbe_platform.c | 13 ++--- - drivers/net/ethernet/socionext/sni_ave.c | 10 ++-- - .../net/ethernet/stmicro/stmmac/dwmac-anarion.c | 2 +- - .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 2 +- - .../net/ethernet/stmicro/stmmac/dwmac-generic.c | 2 +- - drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +- - .../net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 2 +- - .../net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 2 +- - .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c | 2 +- - .../net/ethernet/stmicro/stmmac/dwmac-mediatek.c | 2 +- - drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | 2 +- - .../net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +- - drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c | 2 +- - .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +- - drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 2 +- - .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 2 +- - drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | 2 +- - drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | 2 +- - drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +- - drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 2 +- - .../net/ethernet/stmicro/stmmac/dwmac-visconti.c | 2 +- - drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +- - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- - .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 14 ++--- - .../net/ethernet/stmicro/stmmac/stmmac_platform.h | 2 +- - drivers/net/ethernet/ti/am65-cpsw-nuss.c | 19 ++++--- - drivers/net/ethernet/ti/cpsw.c | 7 +-- - drivers/net/ethernet/ti/cpsw_new.c | 7 +-- - drivers/net/ethernet/ti/davinci_emac.c | 8 +-- - drivers/net/ethernet/ti/netcp_core.c | 7 +-- - drivers/net/ethernet/wiznet/w5100-spi.c | 8 ++- - drivers/net/ethernet/wiznet/w5100.c | 2 +- - drivers/net/ethernet/xilinx/ll_temac_main.c | 8 +-- - drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 15 +++--- - drivers/net/ethernet/xilinx/xilinx_emaclite.c | 8 +-- - drivers/net/wireless/ath/ath9k/init.c | 5 +- - drivers/net/wireless/mediatek/mt76/eeprom.c | 9 +--- - drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 6 +-- - drivers/of/of_net.c | 60 ++++++++++------------ - drivers/staging/octeon/ethernet.c | 10 ++-- - drivers/staging/wfx/main.c | 7 ++- - include/linux/of_net.h | 6 +-- - include/net/dsa.h | 2 +- - net/dsa/dsa2.c | 2 +- - net/dsa/slave.c | 2 +- - net/ethernet/eth.c | 11 ++-- - 85 files changed, 218 insertions(+), 364 deletions(-) - ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -617,7 +617,6 @@ static int ath9k_of_init(struct ath_soft - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - enum ath_bus_type bus_type = common->bus_ops->ath_bus_type; -- const char *mac; - char eeprom_name[100]; - int ret; - -@@ -640,9 +639,7 @@ static int ath9k_of_init(struct ath_soft - ah->ah_flags |= AH_NO_EEP_SWAP; - } - -- mac = of_get_mac_address(np); -- if (!IS_ERR(mac)) -- ether_addr_copy(common->macaddr, mac); -+ of_get_mac_address(np, common->macaddr); - - return 0; - } ---- a/drivers/net/wireless/mediatek/mt76/eeprom.c -+++ b/drivers/net/wireless/mediatek/mt76/eeprom.c -@@ -91,16 +91,9 @@ void - mt76_eeprom_override(struct mt76_phy *phy) - { - struct mt76_dev *dev = phy->dev; +--- a/backport-include/linux/of_net.h ++++ /dev/null +@@ -1,26 +0,0 @@ +-#ifndef _BP_OF_NET_H +-#define _BP_OF_NET_H +-#include_next +-#include +-#include - --#ifdef CONFIG_OF - struct device_node *np = dev->dev->of_node; -- const u8 *mac = NULL; - -- if (np) -- mac = of_get_mac_address(np); -- if (!IS_ERR_OR_NULL(mac)) -- ether_addr_copy(phy->macaddr, mac); --#endif -+ of_get_mac_address(np, phy->macaddr); - - if (!is_valid_ether_addr(phy->macaddr)) { - eth_random_addr(phy->macaddr); ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -989,11 +989,7 @@ static void rt2x00lib_rate(struct ieee80 - - void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr) - { -- const char *mac_addr; +-/* The behavior of of_get_mac_address() changed in kernel 5.2, it now +- * returns an error code and not NULL in case of an error. +- */ +-#if LINUX_VERSION_IS_LESS(5,13,0) +-static inline int backport_of_get_mac_address(struct device_node *np, u8 *mac_out) +-{ +- const void *mac = of_get_mac_address(np); - -- mac_addr = of_get_mac_address(rt2x00dev->dev->of_node); -- if (!IS_ERR(mac_addr)) -- ether_addr_copy(eeprom_mac_addr, mac_addr); -+ of_get_mac_address(rt2x00dev->dev->of_node, eeprom_mac_addr); - - if (!is_valid_ether_addr(eeprom_mac_addr)) { - eth_random_addr(eeprom_mac_addr); +- if (!mac) +- return -ENODEV; +- if (IS_ERR(mac)) +- return PTR_ERR(mac); +- ether_addr_copy(mac_out, mac); +- +- return 0; +-} +-#define of_get_mac_address LINUX_BACKPORT(of_get_mac_address) +-#endif /* < 5.2 */ +- +-#endif /* _BP_OF_NET_H */ From cfe0eb7485d82dd3acf2ba2b95a31e63557d59bd Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 10 Oct 2021 21:24:14 +0200 Subject: [PATCH 24/54] mac80211: Update to version 5.14.13-1 The removed patches were applied upstream. Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 6 +- ...62-brcmfmac-Disable-power-management.patch | 2 +- ...-in-driver-tables-with-country-codes.patch | 12 +- .../mac80211/patches/brcm/998-survey.patch | 10 +- .../subsys/150-disable_addr_notifier.patch | 6 +- .../mac80211/patches/subsys/210-ap_scan.patch | 2 +- ...211_hwsim-make-6-GHz-channels-usable.patch | 8 +- ...l_ht-rework-rate-downgrade-code-and-.patch | 4 +- ...MPDU-session-check-from-minstrel_ht-.patch | 126 -- ...eee80211_tx_h_rate_ctrl-when-dequeue.patch | 114 -- ...te-control-support-for-encap-offload.patch | 126 -- ...rting-aggregation-sessions-on-mesh-i.patch | 112 -- ...ange-struct-txq_info-for-fewer-holes.patch | 39 - ...to-a-virtual-time-based-airtime-sche.patch | 1277 ----------------- ...eck-per-vif-offload_flags-in-Tx-path.patch | 26 - ...nl80211-add-support-for-BSS-coloring.patch | 24 +- ...211-add-support-for-BSS-color-change.patch | 30 +- ...eee80211-add-TWT-element-definitions.patch | 6 +- ...ce-individual-TWT-support-in-AP-mode.patch | 82 +- .../patches/subsys/400-allow-ibss-mixed.patch | 2 +- .../500-mac80211_configure_antenna_gain.patch | 14 +- .../utils/iw/patches/001-nl80211_h_sync.patch | 42 +- 22 files changed, 154 insertions(+), 1916 deletions(-) delete mode 100644 package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch delete mode 100644 package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch delete mode 100644 package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch delete mode 100644 package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch delete mode 100644 package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch delete mode 100644 package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch delete mode 100644 package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index b3a8960fe8..1fc9dc4c48 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.13.19-1 +PKG_VERSION:=5.14.13-1 PKG_RELEASE:=1 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.13.19/ -PKG_HASH:=1eb761c1664d59a0a2d52847f240c9d02fc2e56fb27d862d2949bfb275187eef +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.14.13/ +PKG_HASH:=042aef20caf17ef649502d5f2e744a7676abe7faed18de83c96f37bc029635fe PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) 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 774656f1fd..2e22ec793b 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 -@@ -2961,6 +2961,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -2966,6 +2966,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 9658bda1c1..835c870a65 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 @@ -12,9 +12,9 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c -@@ -12,6 +12,36 @@ - #include "common.h" - #include "of.h" +@@ -58,6 +58,36 @@ static int brcmf_of_get_country_codes(st + return 0; + } +/* TODO: FIXME: Use DT */ +static void brcmf_of_probe_cc(struct device *dev, @@ -49,12 +49,12 @@ Signed-off-by: Rafał Miłecki void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, struct brcmf_mp_device *settings) { -@@ -43,6 +73,8 @@ void brcmf_of_probe(struct device *dev, +@@ -90,6 +120,8 @@ void brcmf_of_probe(struct device *dev, of_node_put(root); } + brcmf_of_probe_cc(dev, settings); + - if (!np || bus_type != BRCMF_BUSTYPE_SDIO || - !of_device_is_compatible(np, "brcm,bcm4329-fmac")) + if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac")) return; + diff --git a/package/kernel/mac80211/patches/brcm/998-survey.patch b/package/kernel/mac80211/patches/brcm/998-survey.patch index 2c11ed696d..1479c67156 100644 --- a/package/kernel/mac80211/patches/brcm/998-survey.patch +++ b/package/kernel/mac80211/patches/brcm/998-survey.patch @@ -64,7 +64,7 @@ brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev, int idx, u8 *mac, struct station_info *sinfo) { -@@ -3008,6 +3065,7 @@ static s32 brcmf_inform_single_bss(struc +@@ -3013,6 +3070,7 @@ static s32 brcmf_inform_single_bss(struc struct brcmu_chan ch; u16 channel; u32 freq; @@ -72,7 +72,7 @@ u16 notify_capability; u16 notify_interval; u8 *notify_ie; -@@ -3032,6 +3090,17 @@ static s32 brcmf_inform_single_bss(struc +@@ -3037,6 +3095,17 @@ static s32 brcmf_inform_single_bss(struc band = NL80211_BAND_5GHZ; freq = ieee80211_channel_to_frequency(channel, band); @@ -90,7 +90,7 @@ bss_data.chan = ieee80211_get_channel(wiphy, freq); bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20; bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime()); -@@ -5560,6 +5629,7 @@ static struct cfg80211_ops brcmf_cfg8021 +@@ -5565,6 +5634,7 @@ static struct cfg80211_ops brcmf_cfg8021 .leave_ibss = brcmf_cfg80211_leave_ibss, .get_station = brcmf_cfg80211_get_station, .dump_station = brcmf_cfg80211_dump_station, @@ -100,7 +100,7 @@ .add_key = brcmf_cfg80211_add_key, --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1356,6 +1356,8 @@ int brcmf_attach(struct device *dev) +@@ -1361,6 +1361,8 @@ int brcmf_attach(struct device *dev) /* Link to bus module */ drvr->hdrlen = 0; @@ -109,7 +109,7 @@ /* Attach and link in the protocol */ ret = brcmf_proto_attach(drvr); -@@ -1438,6 +1440,12 @@ void brcmf_detach(struct device *dev) +@@ -1443,6 +1445,12 @@ void brcmf_detach(struct device *dev) if (drvr == NULL) return; diff --git a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch index 0cd1cfdd31..e93efa4429 100644 --- a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +++ b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch @@ -18,7 +18,7 @@ static int ieee80211_ifa6_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -1319,14 +1319,14 @@ int ieee80211_register_hw(struct ieee802 +@@ -1324,14 +1324,14 @@ int ieee80211_register_hw(struct ieee802 wiphy_unlock(hw->wiphy); rtnl_unlock(); @@ -35,7 +35,7 @@ local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; result = register_inet6addr_notifier(&local->ifa6_notifier); if (result) -@@ -1335,13 +1335,13 @@ int ieee80211_register_hw(struct ieee802 +@@ -1340,13 +1340,13 @@ int ieee80211_register_hw(struct ieee802 return 0; @@ -52,7 +52,7 @@ fail_ifa: #endif wiphy_unregister(local->hw.wiphy); -@@ -1369,10 +1369,10 @@ void ieee80211_unregister_hw(struct ieee +@@ -1374,10 +1374,10 @@ void ieee80211_unregister_hw(struct ieee tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); diff --git a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch index 708cf7b0d5..1efa336d0c 100644 --- a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch +++ b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2462,7 +2462,7 @@ static int ieee80211_scan(struct wiphy * +@@ -2487,7 +2487,7 @@ static int ieee80211_scan(struct wiphy * * the frames sent while scanning on other channel will be * lost) */ diff --git a/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch b/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch index c21d4446ab..9c7417e5fc 100644 --- a/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch +++ b/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-GHz-channels-usable.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2990,15 +2990,19 @@ static void mac80211_hwsim_he_capab(stru +@@ -2992,15 +2992,19 @@ static void mac80211_hwsim_he_capab(stru { u16 n_iftype_data; @@ -34,7 +34,7 @@ Signed-off-by: Felix Fietkau return; } -@@ -3288,6 +3292,12 @@ static int mac80211_hwsim_new_radio(stru +@@ -3290,6 +3294,12 @@ static int mac80211_hwsim_new_radio(stru sband->vht_cap.vht_mcs.tx_mcs_map = sband->vht_cap.vht_mcs.rx_mcs_map; break; @@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau case NL80211_BAND_S1GHZ: memcpy(&sband->s1g_cap, &hwsim_s1g_cap, sizeof(sband->s1g_cap)); -@@ -3298,6 +3308,13 @@ static int mac80211_hwsim_new_radio(stru +@@ -3300,6 +3310,13 @@ static int mac80211_hwsim_new_radio(stru continue; } @@ -61,7 +61,7 @@ Signed-off-by: Felix Fietkau sband->ht_cap.ht_supported = true; sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD | -@@ -3311,10 +3328,6 @@ static int mac80211_hwsim_new_radio(stru +@@ -3313,10 +3330,6 @@ static int mac80211_hwsim_new_radio(stru sband->ht_cap.mcs.rx_mask[0] = 0xff; sband->ht_cap.mcs.rx_mask[1] = 0xff; sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; diff --git a/package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch b/package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch index 7cbc8c01d0..a6817bd4a6 100644 --- a/package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch +++ b/package/kernel/mac80211/patches/subsys/355-mac80211-minstrel_ht-rework-rate-downgrade-code-and-.patch @@ -117,7 +117,7 @@ Signed-off-by: Felix Fietkau } } -@@ -1206,7 +1169,7 @@ minstrel_ht_tx_status(void *priv, struct +@@ -1183,7 +1146,7 @@ minstrel_ht_tx_status(void *priv, struct struct ieee80211_tx_info *info = st->info; struct minstrel_ht_sta *mi = priv_sta; struct ieee80211_tx_rate *ar = info->status.rates; @@ -126,7 +126,7 @@ Signed-off-by: Felix Fietkau struct minstrel_priv *mp = priv; u32 update_interval = mp->update_interval; bool last, update = false; -@@ -1252,18 +1215,13 @@ minstrel_ht_tx_status(void *priv, struct +@@ -1233,18 +1196,13 @@ minstrel_ht_tx_status(void *priv, struct /* * check for sudden death of spatial multiplexing, * downgrade to a lower number of streams if necessary. diff --git a/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch b/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch deleted file mode 100644 index dc511880e5..0000000000 --- a/package/kernel/mac80211/patches/subsys/374-mac80211-move-A-MPDU-session-check-from-minstrel_ht-.patch +++ /dev/null @@ -1,126 +0,0 @@ -From: Felix Fietkau -Date: Thu, 17 Jun 2021 17:56:54 +0200 -Subject: [PATCH] mac80211: move A-MPDU session check from minstrel_ht to - mac80211 - -This avoids calling back into tx handlers from within the rate control module. -Preparation for deferring rate control until tx dequeue - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -6192,6 +6192,11 @@ enum rate_control_capabilities { - * otherwise the NSS difference doesn't bother us. - */ - RATE_CTRL_CAPA_VHT_EXT_NSS_BW = BIT(0), -+ /** -+ * @RATE_CTRL_CAPA_AMPDU_TRIGGER: -+ * mac80211 should start A-MPDU sessions on tx -+ */ -+ RATE_CTRL_CAPA_AMPDU_TRIGGER = BIT(1), - }; - - struct rate_control_ops { ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1140,29 +1140,6 @@ minstrel_downgrade_prob_rate(struct mins - } - - static void --minstrel_aggr_check(struct ieee80211_sta *pubsta, struct sk_buff *skb) --{ -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; -- struct sta_info *sta = container_of(pubsta, struct sta_info, sta); -- u16 tid; -- -- if (skb_get_queue_mapping(skb) == IEEE80211_AC_VO) -- return; -- -- if (unlikely(!ieee80211_is_data_qos(hdr->frame_control))) -- return; -- -- if (unlikely(skb->protocol == cpu_to_be16(ETH_P_PAE))) -- return; -- -- tid = ieee80211_get_tid(hdr); -- if (likely(sta->ampdu_mlme.tid_tx[tid])) -- return; -- -- ieee80211_start_tx_ba_session(pubsta, tid, 0); --} -- --static void - minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband, - void *priv_sta, struct ieee80211_tx_status *st) - { -@@ -1457,10 +1434,6 @@ minstrel_ht_get_rate(void *priv, struct - struct minstrel_priv *mp = priv; - u16 sample_idx; - -- if (!(info->flags & IEEE80211_TX_CTL_AMPDU) && -- !minstrel_ht_is_legacy_group(MI_RATE_GROUP(mi->max_prob_rate))) -- minstrel_aggr_check(sta, txrc->skb); -- - info->flags |= mi->tx_flags; - - #ifdef CPTCFG_MAC80211_DEBUGFS -@@ -1866,6 +1839,7 @@ static u32 minstrel_ht_get_expected_thro - - static const struct rate_control_ops mac80211_minstrel_ht = { - .name = "minstrel_ht", -+ .capa = RATE_CTRL_CAPA_AMPDU_TRIGGER, - .tx_status_ext = minstrel_ht_tx_status, - .get_rate = minstrel_ht_get_rate, - .rate_init = minstrel_ht_rate_init, ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3951,6 +3951,29 @@ void ieee80211_txq_schedule_start(struct - } - EXPORT_SYMBOL(ieee80211_txq_schedule_start); - -+static 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; -+ -+ if (!ref || !(ref->ops->capa & RATE_CTRL_CAPA_AMPDU_TRIGGER)) -+ return; -+ -+ if (!sta || !sta->sta.ht_cap.ht_supported || -+ !sta->sta.wme || skb_get_queue_mapping(skb) == IEEE80211_AC_VO || -+ skb->protocol == sdata->control_port_protocol) -+ return; -+ -+ tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; -+ if (likely(sta->ampdu_mlme.tid_tx[tid])) -+ return; -+ -+ ieee80211_start_tx_ba_session(&sta->sta, tid, 0); -+} -+ - void __ieee80211_subif_start_xmit(struct sk_buff *skb, - struct net_device *dev, - u32 info_flags, -@@ -3981,6 +4004,8 @@ void __ieee80211_subif_start_xmit(struct - skb_get_hash(skb); - } - -+ ieee80211_aggr_check(sdata, sta, skb); -+ - if (sta) { - struct ieee80211_fast_tx *fast_tx; - -@@ -4244,6 +4269,8 @@ static void ieee80211_8023_xmit(struct i - - memset(info, 0, sizeof(*info)); - -+ ieee80211_aggr_check(sdata, sta, skb); -+ - tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; - tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); - if (tid_tx) { diff --git a/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch b/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch deleted file mode 100644 index 346c6468f8..0000000000 --- a/package/kernel/mac80211/patches/subsys/375-mac80211-call-ieee80211_tx_h_rate_ctrl-when-dequeue.patch +++ /dev/null @@ -1,114 +0,0 @@ -From: Ryder Lee -Date: Fri, 28 May 2021 14:05:41 +0800 -Subject: [PATCH] mac80211: call ieee80211_tx_h_rate_ctrl() when dequeue - -Make ieee80211_tx_h_rate_ctrl() get called on dequeue to improve -performance since it reduces the turnaround time for rate control. - -Signed-off-by: Ryder Lee ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1768,8 +1768,6 @@ static int invoke_tx_handlers_early(stru - CALL_TXH(ieee80211_tx_h_ps_buf); - CALL_TXH(ieee80211_tx_h_check_control_port_protocol); - CALL_TXH(ieee80211_tx_h_select_key); -- if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) -- CALL_TXH(ieee80211_tx_h_rate_ctrl); - - txh_done: - if (unlikely(res == TX_DROP)) { -@@ -1802,6 +1800,9 @@ static int invoke_tx_handlers_late(struc - goto txh_done; - } - -+ if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) -+ CALL_TXH(ieee80211_tx_h_rate_ctrl); -+ - CALL_TXH(ieee80211_tx_h_michael_mic_add); - CALL_TXH(ieee80211_tx_h_sequence); - CALL_TXH(ieee80211_tx_h_fragment); -@@ -3391,15 +3392,21 @@ out: - * Can be called while the sta lock is held. Anything that can cause packets to - * be generated will cause deadlock! - */ --static void ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata, -- struct sta_info *sta, u8 pn_offs, -- struct ieee80211_key *key, -- struct sk_buff *skb) -+static ieee80211_tx_result -+ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, u8 pn_offs, -+ struct ieee80211_key *key, -+ struct ieee80211_tx_data *tx) - { -+ struct sk_buff *skb = tx->skb; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (void *)skb->data; - u8 tid = IEEE80211_NUM_TIDS; - -+ if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL) && -+ ieee80211_tx_h_rate_ctrl(tx) != TX_CONTINUE) -+ return TX_DROP; -+ - if (key) - info->control.hw_key = &key->conf; - -@@ -3448,6 +3455,8 @@ static void ieee80211_xmit_fast_finish(s - break; - } - } -+ -+ return TX_CONTINUE; - } - - static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, -@@ -3551,24 +3560,17 @@ static bool ieee80211_xmit_fast(struct i - tx.sta = sta; - tx.key = fast_tx->key; - -- if (!ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) { -- tx.skb = skb; -- r = ieee80211_tx_h_rate_ctrl(&tx); -- skb = tx.skb; -- tx.skb = NULL; -- -- if (r != TX_CONTINUE) { -- if (r != TX_QUEUED) -- kfree_skb(skb); -- return true; -- } -- } -- - if (ieee80211_queue_skb(local, sdata, sta, skb)) - return true; - -- ieee80211_xmit_fast_finish(sdata, sta, fast_tx->pn_offs, -- fast_tx->key, skb); -+ 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 (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) - sdata = container_of(sdata->bss, -@@ -3685,8 +3687,12 @@ begin: - (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) - pn_offs = ieee80211_hdrlen(hdr->frame_control); - -- ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs, -- tx.key, skb); -+ r = ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs, -+ tx.key, &tx); -+ if (r != TX_CONTINUE) { -+ ieee80211_free_txskb(&local->hw, skb); -+ goto begin; -+ } - } else { - if (invoke_tx_handlers_late(&tx)) - goto begin; diff --git a/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch b/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch deleted file mode 100644 index b9f34213d5..0000000000 --- a/package/kernel/mac80211/patches/subsys/376-mac80211-add-rate-control-support-for-encap-offload.patch +++ /dev/null @@ -1,126 +0,0 @@ -From: Ryder Lee -Date: Fri, 28 May 2021 14:05:43 +0800 -Subject: [PATCH] mac80211: add rate control support for encap offload - -The software rate control cannot deal with encap offload, so fix it. - -Signed-off-by: Ryder Lee ---- - ---- a/net/mac80211/rate.c -+++ b/net/mac80211/rate.c -@@ -297,15 +297,11 @@ void ieee80211_check_rate_mask(struct ie - static bool rc_no_data_or_no_ack_use_min(struct ieee80211_tx_rate_control *txrc) - { - struct sk_buff *skb = txrc->skb; -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -- __le16 fc; -- -- fc = hdr->frame_control; - - return (info->flags & (IEEE80211_TX_CTL_NO_ACK | - IEEE80211_TX_CTL_USE_MINRATE)) || -- !ieee80211_is_data(fc); -+ !ieee80211_is_tx_data(skb); - } - - static void rc_send_low_basicrate(struct ieee80211_tx_rate *rate, -@@ -870,7 +866,6 @@ void ieee80211_get_tx_rates(struct ieee8 - int max_rates) - { - struct ieee80211_sub_if_data *sdata; -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_supported_band *sband; - -@@ -882,7 +877,7 @@ void ieee80211_get_tx_rates(struct ieee8 - sdata = vif_to_sdata(vif); - sband = sdata->local->hw.wiphy->bands[info->band]; - -- if (ieee80211_is_data(hdr->frame_control)) -+ if (ieee80211_is_tx_data(skb)) - rate_control_apply_mask(sdata, sta, sband, dest, max_rates); - - if (dest[0].idx < 0) ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -666,6 +666,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 - u32 len; - struct ieee80211_tx_rate_control txrc; - struct ieee80211_sta_rates *ratetbl = NULL; -+ bool encap = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP; - bool assoc = false; - - memset(&txrc, 0, sizeof(txrc)); -@@ -707,7 +708,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 - * just wants a probe response. - */ - if (tx->sdata->vif.bss_conf.use_short_preamble && -- (ieee80211_is_data(hdr->frame_control) || -+ (ieee80211_is_tx_data(tx->skb) || - (tx->sta && test_sta_flag(tx->sta, WLAN_STA_SHORT_PREAMBLE)))) - txrc.short_preamble = true; - -@@ -729,7 +730,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 - "%s: Dropped data frame as no usable bitrate found while " - "scanning and associated. Target station: " - "%pM on %d GHz band\n", -- tx->sdata->name, hdr->addr1, -+ tx->sdata->name, -+ encap ? ((struct ethhdr *)hdr)->h_dest : hdr->addr1, - info->band ? 5 : 2)) - return TX_DROP; - -@@ -763,7 +765,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 - - if (txrc.reported_rate.idx < 0) { - txrc.reported_rate = tx->rate; -- if (tx->sta && ieee80211_is_data(hdr->frame_control)) -+ if (tx->sta && ieee80211_is_tx_data(tx->skb)) - tx->sta->tx_stats.last_rate = txrc.reported_rate; - } else if (tx->sta) - tx->sta->tx_stats.last_rate = txrc.reported_rate; -@@ -3675,8 +3677,16 @@ begin: - else - info->flags &= ~IEEE80211_TX_CTL_AMPDU; - -- if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) -+ if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { -+ if (!ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) { -+ r = ieee80211_tx_h_rate_ctrl(&tx); -+ if (r != TX_CONTINUE) { -+ ieee80211_free_txskb(&local->hw, skb); -+ goto begin; -+ } -+ } - goto encap_out; -+ } - - if (info->control.flags & IEEE80211_TX_CTRL_FAST_XMIT) { - struct sta_info *sta = container_of(txq->sta, struct sta_info, ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -6765,4 +6765,22 @@ struct sk_buff *ieee80211_get_fils_disco - struct sk_buff * - ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw, - struct ieee80211_vif *vif); -+ -+/** -+ * ieee80211_is_tx_data - check if frame is a data frame -+ * -+ * The function is used to check if a frame is a data frame. Frames with -+ * hardware encapsulation enabled are data frames. -+ * -+ * @skb: the frame to be transmitted. -+ */ -+static inline bool ieee80211_is_tx_data(struct sk_buff *skb) -+{ -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -+ struct ieee80211_hdr *hdr = (void *) skb->data; -+ -+ return info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP || -+ ieee80211_is_data(hdr->frame_control); -+} -+ - #endif /* MAC80211_H */ diff --git a/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch b/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch deleted file mode 100644 index 74947348bc..0000000000 --- a/package/kernel/mac80211/patches/subsys/379-mac80211-fix-starting-aggregation-sessions-on-mesh-i.patch +++ /dev/null @@ -1,112 +0,0 @@ -From: Felix Fietkau -Date: Tue, 29 Jun 2021 13:25:09 +0200 -Subject: [PATCH] mac80211: fix starting aggregation sessions on mesh - interfaces - -The logic for starting aggregation sessions was recently moved from minstrel_ht -to mac80211, into the subif tx handler just after the sta lookup. -Unfortunately this didn't work for mesh interfaces, since the sta lookup is -deferred until a much later point in time on those. -Fix this by also calling the aggregation check right after the deferred sta -lookup. - -Fixes: 08a46c642001 ("mac80211: move A-MPDU session check from minstrel_ht to mac80211") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1146,6 +1146,29 @@ 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) -+{ -+ struct rate_control_ref *ref = sdata->local->rate_ctrl; -+ u16 tid; -+ -+ if (!ref || !(ref->ops->capa & RATE_CTRL_CAPA_AMPDU_TRIGGER)) -+ return; -+ -+ if (!sta || !sta->sta.ht_cap.ht_supported || -+ !sta->sta.wme || skb_get_queue_mapping(skb) == IEEE80211_AC_VO || -+ skb->protocol == sdata->control_port_protocol) -+ return; -+ -+ tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; -+ if (likely(sta->ampdu_mlme.tid_tx[tid])) -+ return; -+ -+ ieee80211_start_tx_ba_session(&sta->sta, tid, 0); -+} -+ - /* - * initialises @tx - * pass %NULL for the station if unknown, a valid pointer if known -@@ -1159,6 +1182,7 @@ ieee80211_tx_prepare(struct ieee80211_su - struct ieee80211_local *local = sdata->local; - struct ieee80211_hdr *hdr; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -+ bool aggr_check = false; - int tid; - - memset(tx, 0, sizeof(*tx)); -@@ -1187,8 +1211,10 @@ ieee80211_tx_prepare(struct ieee80211_su - } else if (tx->sdata->control_port_protocol == tx->skb->protocol) { - tx->sta = sta_info_get_bss(sdata, hdr->addr1); - } -- if (!tx->sta && !is_multicast_ether_addr(hdr->addr1)) -+ if (!tx->sta && !is_multicast_ether_addr(hdr->addr1)) { - tx->sta = sta_info_get(sdata, hdr->addr1); -+ aggr_check = true; -+ } - } - - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) && -@@ -1198,8 +1224,12 @@ ieee80211_tx_prepare(struct ieee80211_su - struct tid_ampdu_tx *tid_tx; - - tid = ieee80211_get_tid(hdr); -- - tid_tx = rcu_dereference(tx->sta->ampdu_mlme.tid_tx[tid]); -+ if (!tid_tx && aggr_check) { -+ ieee80211_aggr_check(sdata, tx->sta, skb); -+ tid_tx = rcu_dereference(tx->sta->ampdu_mlme.tid_tx[tid]); -+ } -+ - if (tid_tx) { - bool queued; - -@@ -3967,29 +3997,6 @@ void ieee80211_txq_schedule_start(struct - } - EXPORT_SYMBOL(ieee80211_txq_schedule_start); - --static 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; -- -- if (!ref || !(ref->ops->capa & RATE_CTRL_CAPA_AMPDU_TRIGGER)) -- return; -- -- if (!sta || !sta->sta.ht_cap.ht_supported || -- !sta->sta.wme || skb_get_queue_mapping(skb) == IEEE80211_AC_VO || -- skb->protocol == sdata->control_port_protocol) -- return; -- -- tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; -- if (likely(sta->ampdu_mlme.tid_tx[tid])) -- return; -- -- ieee80211_start_tx_ba_session(&sta->sta, tid, 0); --} -- - void __ieee80211_subif_start_xmit(struct sk_buff *skb, - struct net_device *dev, - u32 info_flags, diff --git a/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch b/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch deleted file mode 100644 index 6a561b2a08..0000000000 --- a/package/kernel/mac80211/patches/subsys/381-mac80211-rearrange-struct-txq_info-for-fewer-holes.patch +++ /dev/null @@ -1,39 +0,0 @@ -From: Johannes Berg -Date: Fri, 18 Jun 2021 13:41:44 +0300 -Subject: [PATCH] mac80211: rearrange struct txq_info for fewer holes - -We can slightly decrease the size of struct txq_info by -rearranging some fields for fewer holes, so do that. - -Signed-off-by: Johannes Berg -Signed-off-by: Luca Coelho -Link: https://lore.kernel.org/r/iwlwifi.20210618133832.1bf019a1fe2e.Ib54622b8d6dc1a9a7dc484e573c073119450538b@changeid -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -5,7 +5,7 @@ - * Copyright 2006-2007 Jiri Benc - * Copyright 2007-2010 Johannes Berg - * Copyright 2013-2015 Intel Mobile Communications GmbH -- * Copyright (C) 2018-2020 Intel Corporation -+ * Copyright (C) 2018-2021 Intel Corporation - */ - - #ifndef IEEE80211_I_H -@@ -843,9 +843,12 @@ struct txq_info { - struct fq_tin tin; - struct codel_vars def_cvars; - struct codel_stats cstats; -- struct sk_buff_head frags; -- struct list_head schedule_order; -+ - u16 schedule_round; -+ struct list_head schedule_order; -+ -+ struct sk_buff_head frags; -+ - unsigned long flags; - - /* keep last! */ diff --git a/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch b/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch deleted file mode 100644 index 49f9349ec8..0000000000 --- a/package/kernel/mac80211/patches/subsys/382-mac80211-Switch-to-a-virtual-time-based-airtime-sche.patch +++ /dev/null @@ -1,1277 +0,0 @@ -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Wed, 23 Jun 2021 15:47:55 +0200 -Subject: [PATCH] mac80211: Switch to a virtual time-based airtime scheduler -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This switches the airtime scheduler in mac80211 to use a virtual -time-based scheduler instead of the round-robin scheduler used before. -This has a couple of advantages: - -- No need to sync up the round-robin scheduler in firmware/hardware with - the round-robin airtime scheduler. - -- If several stations are eligible for transmission we can schedule both - of them; no need to hard-block the scheduling rotation until the head - of the queue has used up its quantum. - -- The check of whether a station is eligible for transmission becomes - simpler (in ieee80211_txq_may_transmit()). - -The drawback is that scheduling becomes slightly more expensive, as we -need to maintain an rbtree of TXQs sorted by virtual time. This means -that ieee80211_register_airtime() becomes O(logN) in the number of -currently scheduled TXQs because it can change the order of the -scheduled stations. We mitigate this overhead by only resorting when a -station changes position in the tree, and hopefully N rarely grows too -big (it's only TXQs currently backlogged, not all associated stations), -so it shouldn't be too big of an issue. - -To prevent divisions in the fast path, we maintain both station sums and -pre-computed reciprocals of the sums. This turns the fast-path operation -into a multiplication, with divisions only happening as the number of -active stations change (to re-compute the current sum of all active -station weights). To prevent this re-computation of the reciprocal from -happening too frequently, we use a time-based notion of station -activity, instead of updating the weight every time a station gets -scheduled or de-scheduled. As queues can oscillate between empty and -occupied quite frequently, this can significantly cut down on the number -of re-computations. It also has the added benefit of making the station -airtime calculation independent on whether the queue happened to have -drained at the time an airtime value was accounted. - -Co-developed-by: Yibo Zhao -Signed-off-by: Yibo Zhao -Signed-off-by: Toke Høiland-Jørgensen -Link: https://lore.kernel.org/r/20210623134755.235545-1-toke@redhat.com -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -6589,9 +6589,6 @@ static inline void ieee80211_txq_schedul - { - } - --void __ieee80211_schedule_txq(struct ieee80211_hw *hw, -- struct ieee80211_txq *txq, bool force); -- - /** - * ieee80211_schedule_txq - schedule a TXQ for transmission - * -@@ -6604,11 +6601,7 @@ void __ieee80211_schedule_txq(struct iee - * The driver may call this function if it has buffered packets for - * this TXQ internally. - */ --static inline void --ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) --{ -- __ieee80211_schedule_txq(hw, txq, true); --} -+void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq); - - /** - * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() -@@ -6620,12 +6613,8 @@ ieee80211_schedule_txq(struct ieee80211_ - * The driver may set force=true if it has buffered packets for this TXQ - * internally. - */ --static inline void --ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, -- bool force) --{ -- __ieee80211_schedule_txq(hw, txq, force); --} -+void ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, -+ bool force); - - /** - * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1460,6 +1460,38 @@ static void sta_apply_mesh_params(struct - #endif - } - -+static void sta_apply_airtime_params(struct ieee80211_local *local, -+ struct sta_info *sta, -+ struct station_parameters *params) -+{ -+ u8 ac; -+ -+ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -+ struct airtime_sched_info *air_sched = &local->airtime[ac]; -+ struct airtime_info *air_info = &sta->airtime[ac]; -+ struct txq_info *txqi; -+ u8 tid; -+ -+ spin_lock_bh(&air_sched->lock); -+ for (tid = 0; tid < IEEE80211_NUM_TIDS + 1; tid++) { -+ if (air_info->weight == params->airtime_weight || -+ !sta->sta.txq[tid] || -+ ac != ieee80211_ac_from_tid(tid)) -+ continue; -+ -+ airtime_weight_set(air_info, params->airtime_weight); -+ -+ txqi = to_txq_info(sta->sta.txq[tid]); -+ if (RB_EMPTY_NODE(&txqi->schedule_order)) -+ continue; -+ -+ ieee80211_update_airtime_weight(local, air_sched, -+ 0, true); -+ } -+ spin_unlock_bh(&air_sched->lock); -+ } -+} -+ - static int sta_apply_parameters(struct ieee80211_local *local, - struct sta_info *sta, - struct station_parameters *params) -@@ -1647,7 +1679,8 @@ static int sta_apply_parameters(struct i - sta_apply_mesh_params(local, sta, params); - - if (params->airtime_weight) -- sta->airtime_weight = params->airtime_weight; -+ sta_apply_airtime_params(local, sta, params); -+ - - /* set the STA state after all sta info from usermode has been set */ - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) || ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -216,14 +216,14 @@ static ssize_t aql_txq_limit_read(struct - "VI %u %u\n" - "BE %u %u\n" - "BK %u %u\n", -- local->aql_txq_limit_low[IEEE80211_AC_VO], -- local->aql_txq_limit_high[IEEE80211_AC_VO], -- local->aql_txq_limit_low[IEEE80211_AC_VI], -- local->aql_txq_limit_high[IEEE80211_AC_VI], -- local->aql_txq_limit_low[IEEE80211_AC_BE], -- local->aql_txq_limit_high[IEEE80211_AC_BE], -- local->aql_txq_limit_low[IEEE80211_AC_BK], -- local->aql_txq_limit_high[IEEE80211_AC_BK]); -+ local->airtime[IEEE80211_AC_VO].aql_txq_limit_low, -+ local->airtime[IEEE80211_AC_VO].aql_txq_limit_high, -+ local->airtime[IEEE80211_AC_VI].aql_txq_limit_low, -+ local->airtime[IEEE80211_AC_VI].aql_txq_limit_high, -+ local->airtime[IEEE80211_AC_BE].aql_txq_limit_low, -+ local->airtime[IEEE80211_AC_BE].aql_txq_limit_high, -+ local->airtime[IEEE80211_AC_BK].aql_txq_limit_low, -+ local->airtime[IEEE80211_AC_BK].aql_txq_limit_high); - return simple_read_from_buffer(user_buf, count, ppos, - buf, len); - } -@@ -255,11 +255,11 @@ static ssize_t aql_txq_limit_write(struc - if (ac >= IEEE80211_NUM_ACS) - return -EINVAL; - -- q_limit_low_old = local->aql_txq_limit_low[ac]; -- q_limit_high_old = local->aql_txq_limit_high[ac]; -+ q_limit_low_old = local->airtime[ac].aql_txq_limit_low; -+ q_limit_high_old = local->airtime[ac].aql_txq_limit_high; - -- local->aql_txq_limit_low[ac] = q_limit_low; -- local->aql_txq_limit_high[ac] = q_limit_high; -+ local->airtime[ac].aql_txq_limit_low = q_limit_low; -+ local->airtime[ac].aql_txq_limit_high = q_limit_high; - - mutex_lock(&local->sta_mtx); - list_for_each_entry(sta, &local->sta_list, list) { -@@ -382,6 +382,46 @@ static const struct file_operations forc - .llseek = default_llseek, - }; - -+static ssize_t airtime_read(struct file *file, -+ char __user *user_buf, -+ size_t count, -+ loff_t *ppos) -+{ -+ struct ieee80211_local *local = file->private_data; -+ char buf[200]; -+ u64 v_t[IEEE80211_NUM_ACS]; -+ u64 wt[IEEE80211_NUM_ACS]; -+ int len = 0, ac; -+ -+ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -+ spin_lock_bh(&local->airtime[ac].lock); -+ v_t[ac] = local->airtime[ac].v_t; -+ wt[ac] = local->airtime[ac].weight_sum; -+ spin_unlock_bh(&local->airtime[ac].lock); -+ } -+ len = scnprintf(buf, sizeof(buf), -+ "\tVO VI BE BK\n" -+ "Virt-t\t%-10llu %-10llu %-10llu %-10llu\n" -+ "Weight\t%-10llu %-10llu %-10llu %-10llu\n", -+ v_t[0], -+ v_t[1], -+ v_t[2], -+ v_t[3], -+ wt[0], -+ wt[1], -+ wt[2], -+ wt[3]); -+ -+ return simple_read_from_buffer(user_buf, count, ppos, -+ buf, len); -+} -+ -+static const struct file_operations airtime_ops = { -+ .read = airtime_read, -+ .open = simple_open, -+ .llseek = default_llseek, -+}; -+ - #ifdef CONFIG_PM - static ssize_t reset_write(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -@@ -632,7 +672,11 @@ void debugfs_hw_add(struct ieee80211_loc - if (local->ops->wake_tx_queue) - DEBUGFS_ADD_MODE(aqm, 0600); - -- DEBUGFS_ADD_MODE(airtime_flags, 0600); -+ if (wiphy_ext_feature_isset(local->hw.wiphy, -+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) { -+ DEBUGFS_ADD_MODE(airtime, 0600); -+ DEBUGFS_ADD_MODE(airtime_flags, 0600); -+ } - - DEBUGFS_ADD(aql_txq_limit); - debugfs_create_u32("aql_threshold", 0600, ---- a/net/mac80211/debugfs_netdev.c -+++ b/net/mac80211/debugfs_netdev.c -@@ -513,6 +513,34 @@ static ssize_t ieee80211_if_fmt_aqm( - } - IEEE80211_IF_FILE_R(aqm); - -+static ssize_t ieee80211_if_fmt_airtime( -+ const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) -+{ -+ struct ieee80211_local *local = sdata->local; -+ struct ieee80211_txq *txq = sdata->vif.txq; -+ struct airtime_info *air_info; -+ int len; -+ -+ if (!txq) -+ return 0; -+ -+ spin_lock_bh(&local->airtime[txq->ac].lock); -+ air_info = to_airtime_info(txq); -+ len = scnprintf(buf, -+ buflen, -+ "RX: %llu us\nTX: %llu us\nWeight: %u\n" -+ "Virt-T: %lld us\n", -+ air_info->rx_airtime, -+ air_info->tx_airtime, -+ air_info->weight, -+ air_info->v_t); -+ spin_unlock_bh(&local->airtime[txq->ac].lock); -+ -+ return len; -+} -+ -+IEEE80211_IF_FILE_R(airtime); -+ - IEEE80211_IF_FILE(multicast_to_unicast, u.ap.multicast_to_unicast, HEX); - - /* IBSS attributes */ -@@ -658,8 +686,10 @@ static void add_common_files(struct ieee - - if (sdata->local->ops->wake_tx_queue && - sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && -- sdata->vif.type != NL80211_IFTYPE_NAN) -+ sdata->vif.type != NL80211_IFTYPE_NAN) { - DEBUGFS_ADD(aqm); -+ DEBUGFS_ADD(airtime); -+ } - } - - static void add_sta_files(struct ieee80211_sub_if_data *sdata) ---- a/net/mac80211/debugfs_sta.c -+++ b/net/mac80211/debugfs_sta.c -@@ -202,7 +202,7 @@ static ssize_t sta_airtime_read(struct f - size_t bufsz = 400; - char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; - u64 rx_airtime = 0, tx_airtime = 0; -- s64 deficit[IEEE80211_NUM_ACS]; -+ u64 v_t[IEEE80211_NUM_ACS]; - ssize_t rv; - int ac; - -@@ -210,18 +210,18 @@ static ssize_t sta_airtime_read(struct f - return -ENOMEM; - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -- spin_lock_bh(&local->active_txq_lock[ac]); -+ spin_lock_bh(&local->airtime[ac].lock); - rx_airtime += sta->airtime[ac].rx_airtime; - tx_airtime += sta->airtime[ac].tx_airtime; -- deficit[ac] = sta->airtime[ac].deficit; -- spin_unlock_bh(&local->active_txq_lock[ac]); -+ v_t[ac] = sta->airtime[ac].v_t; -+ spin_unlock_bh(&local->airtime[ac].lock); - } - - p += scnprintf(p, bufsz + buf - p, - "RX: %llu us\nTX: %llu us\nWeight: %u\n" -- "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n", -- rx_airtime, tx_airtime, sta->airtime_weight, -- deficit[0], deficit[1], deficit[2], deficit[3]); -+ "Virt-T: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n", -+ rx_airtime, tx_airtime, sta->airtime[0].weight, -+ v_t[0], v_t[1], v_t[2], v_t[3]); - - rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); - kfree(buf); -@@ -236,11 +236,11 @@ static ssize_t sta_airtime_write(struct - int ac; - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -- spin_lock_bh(&local->active_txq_lock[ac]); -+ spin_lock_bh(&local->airtime[ac].lock); - sta->airtime[ac].rx_airtime = 0; - sta->airtime[ac].tx_airtime = 0; -- sta->airtime[ac].deficit = sta->airtime_weight; -- spin_unlock_bh(&local->active_txq_lock[ac]); -+ sta->airtime[ac].v_t = 0; -+ spin_unlock_bh(&local->airtime[ac].lock); - } - - return count; -@@ -263,10 +263,10 @@ static ssize_t sta_aql_read(struct file - return -ENOMEM; - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { -- spin_lock_bh(&local->active_txq_lock[ac]); -+ spin_lock_bh(&local->airtime[ac].lock); - q_limit_l[ac] = sta->airtime[ac].aql_limit_low; - q_limit_h[ac] = sta->airtime[ac].aql_limit_high; -- spin_unlock_bh(&local->active_txq_lock[ac]); -+ spin_unlock_bh(&local->airtime[ac].lock); - q_depth[ac] = atomic_read(&sta->airtime[ac].aql_tx_pending); - } - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -835,20 +835,16 @@ enum txq_info_flags { - * @def_flow: used as a fallback flow when a packet destined to @tin hashes to - * a fq_flow which is already owned by a different tin - * @def_cvars: codel vars for @def_flow -- * @frags: used to keep fragments created after dequeue - * @schedule_order: used with ieee80211_local->active_txqs -- * @schedule_round: counter to prevent infinite loops on TXQ scheduling -+ * @frags: used to keep fragments created after dequeue - */ - struct txq_info { - struct fq_tin tin; - struct codel_vars def_cvars; - struct codel_stats cstats; -- -- u16 schedule_round; -- struct list_head schedule_order; -+ struct rb_node schedule_order; - - struct sk_buff_head frags; -- - unsigned long flags; - - /* keep last! */ -@@ -925,6 +921,8 @@ struct ieee80211_sub_if_data { - struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS]; - struct mac80211_qos_map __rcu *qos_map; - -+ struct airtime_info airtime[IEEE80211_NUM_ACS]; -+ - struct work_struct csa_finalize_work; - bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */ - struct cfg80211_chan_def csa_chandef; -@@ -1137,6 +1135,44 @@ enum mac80211_scan_state { - SCAN_ABORT, - }; - -+/** -+ * struct airtime_sched_info - state used for airtime scheduling and AQL -+ * -+ * @lock: spinlock that protects all the fields in this struct -+ * @active_txqs: rbtree of currently backlogged queues, sorted by virtual time -+ * @schedule_pos: the current position maintained while a driver walks the tree -+ * with ieee80211_next_txq() -+ * @active_list: list of struct airtime_info structs that were active within -+ * the last AIRTIME_ACTIVE_DURATION (100 ms), used to compute -+ * weight_sum -+ * @last_weight_update: used for rate limiting walking active_list -+ * @last_schedule_time: tracks the last time a transmission was scheduled; used -+ * for catching up v_t if no stations are eligible for -+ * transmission. -+ * @v_t: global virtual time; queues with v_t < this are eligible for -+ * transmission -+ * @weight_sum: total sum of all active stations used for dividing airtime -+ * @weight_sum_reciprocal: reciprocal of weight_sum (to avoid divisions in fast -+ * path - see comment above -+ * IEEE80211_RECIPROCAL_DIVISOR_64) -+ * @aql_txq_limit_low: AQL limit when total outstanding airtime -+ * is < IEEE80211_AQL_THRESHOLD -+ * @aql_txq_limit_high: AQL limit when total outstanding airtime -+ * is > IEEE80211_AQL_THRESHOLD -+ */ -+struct airtime_sched_info { -+ spinlock_t lock; -+ struct rb_root_cached active_txqs; -+ struct rb_node *schedule_pos; -+ struct list_head active_list; -+ u64 last_weight_update; -+ u64 last_schedule_activity; -+ u64 v_t; -+ u64 weight_sum; -+ u64 weight_sum_reciprocal; -+ u32 aql_txq_limit_low; -+ u32 aql_txq_limit_high; -+}; - DECLARE_STATIC_KEY_FALSE(aql_disable); - - struct ieee80211_local { -@@ -1150,13 +1186,8 @@ struct ieee80211_local { - struct codel_params cparams; - - /* protects active_txqs and txqi->schedule_order */ -- spinlock_t active_txq_lock[IEEE80211_NUM_ACS]; -- struct list_head active_txqs[IEEE80211_NUM_ACS]; -- u16 schedule_round[IEEE80211_NUM_ACS]; -- -+ struct airtime_sched_info airtime[IEEE80211_NUM_ACS]; - u16 airtime_flags; -- u32 aql_txq_limit_low[IEEE80211_NUM_ACS]; -- u32 aql_txq_limit_high[IEEE80211_NUM_ACS]; - u32 aql_threshold; - atomic_t aql_total_pending_airtime; - -@@ -1574,6 +1605,125 @@ static inline bool txq_has_queue(struct - return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets); - } - -+static inline struct airtime_info *to_airtime_info(struct ieee80211_txq *txq) -+{ -+ struct ieee80211_sub_if_data *sdata; -+ struct sta_info *sta; -+ -+ if (txq->sta) { -+ sta = container_of(txq->sta, struct sta_info, sta); -+ return &sta->airtime[txq->ac]; -+ } -+ -+ sdata = vif_to_sdata(txq->vif); -+ return &sdata->airtime[txq->ac]; -+} -+ -+/* To avoid divisions in the fast path, we keep pre-computed reciprocals for -+ * airtime weight calculations. There are two different weights to keep track -+ * of: The per-station weight and the sum of weights per phy. -+ * -+ * For the per-station weights (kept in airtime_info below), we use 32-bit -+ * reciprocals with a devisor of 2^19. This lets us keep the multiplications and -+ * divisions for the station weights as 32-bit operations at the cost of a bit -+ * of rounding error for high weights; but the choice of divisor keeps rounding -+ * errors <10% for weights <2^15, assuming no more than 8ms of airtime is -+ * reported at a time. -+ * -+ * For the per-phy sum of weights the values can get higher, so we use 64-bit -+ * operations for those with a 32-bit divisor, which should avoid any -+ * significant rounding errors. -+ */ -+#define IEEE80211_RECIPROCAL_DIVISOR_64 0x100000000ULL -+#define IEEE80211_RECIPROCAL_SHIFT_64 32 -+#define IEEE80211_RECIPROCAL_DIVISOR_32 0x80000U -+#define IEEE80211_RECIPROCAL_SHIFT_32 19 -+ -+static inline void airtime_weight_set(struct airtime_info *air_info, u16 weight) -+{ -+ if (air_info->weight == weight) -+ return; -+ -+ air_info->weight = weight; -+ if (weight) { -+ air_info->weight_reciprocal = -+ IEEE80211_RECIPROCAL_DIVISOR_32 / weight; -+ } else { -+ air_info->weight_reciprocal = 0; -+ } -+} -+ -+static inline void airtime_weight_sum_set(struct airtime_sched_info *air_sched, -+ int weight_sum) -+{ -+ if (air_sched->weight_sum == weight_sum) -+ return; -+ -+ air_sched->weight_sum = weight_sum; -+ if (air_sched->weight_sum) { -+ air_sched->weight_sum_reciprocal = IEEE80211_RECIPROCAL_DIVISOR_64; -+ do_div(air_sched->weight_sum_reciprocal, air_sched->weight_sum); -+ } else { -+ air_sched->weight_sum_reciprocal = 0; -+ } -+} -+ -+/* A problem when trying to enforce airtime fairness is that we want to divide -+ * the airtime between the currently *active* stations. However, basing this on -+ * the instantaneous queue state of stations doesn't work, as queues tend to -+ * oscillate very quickly between empty and occupied, leading to the scheduler -+ * thinking only a single station is active when deciding whether to allow -+ * transmission (and thus not throttling correctly). -+ * -+ * To fix this we use a timer-based notion of activity: a station is considered -+ * active if it has been scheduled within the last 100 ms; we keep a separate -+ * list of all the stations considered active in this manner, and lazily update -+ * the total weight of active stations from this list (filtering the stations in -+ * the list by their 'last active' time). -+ * -+ * We add one additional safeguard to guard against stations that manage to get -+ * scheduled every 100 ms but don't transmit a lot of data, and thus don't use -+ * up any airtime. Such stations would be able to get priority for an extended -+ * period of time if they do start transmitting at full capacity again, and so -+ * we add an explicit maximum for how far behind a station is allowed to fall in -+ * the virtual airtime domain. This limit is set to a relatively high value of -+ * 20 ms because the main mechanism for catching up idle stations is the active -+ * state as described above; i.e., the hard limit should only be hit in -+ * pathological cases. -+ */ -+#define AIRTIME_ACTIVE_DURATION (100 * NSEC_PER_MSEC) -+#define AIRTIME_MAX_BEHIND 20000 /* 20 ms */ -+ -+static inline bool airtime_is_active(struct airtime_info *air_info, u64 now) -+{ -+ return air_info->last_scheduled >= now - AIRTIME_ACTIVE_DURATION; -+} -+ -+static inline void airtime_set_active(struct airtime_sched_info *air_sched, -+ struct airtime_info *air_info, u64 now) -+{ -+ air_info->last_scheduled = now; -+ air_sched->last_schedule_activity = now; -+ list_move_tail(&air_info->list, &air_sched->active_list); -+} -+ -+static inline bool airtime_catchup_v_t(struct airtime_sched_info *air_sched, -+ u64 v_t, u64 now) -+{ -+ air_sched->v_t = v_t; -+ return true; -+} -+ -+static inline void init_airtime_info(struct airtime_info *air_info, -+ struct airtime_sched_info *air_sched) -+{ -+ atomic_set(&air_info->aql_tx_pending, 0); -+ air_info->aql_limit_low = air_sched->aql_txq_limit_low; -+ air_info->aql_limit_high = air_sched->aql_txq_limit_high; -+ airtime_weight_set(air_info, IEEE80211_DEFAULT_AIRTIME_WEIGHT); -+ INIT_LIST_HEAD(&air_info->list); -+} -+ - static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) - { - return ether_addr_equal(raddr, addr) || -@@ -1816,6 +1966,14 @@ int ieee80211_tx_control_port(struct wip - u64 *cookie); - int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, - const u8 *buf, size_t len); -+void ieee80211_resort_txq(struct ieee80211_hw *hw, -+ struct ieee80211_txq *txq); -+void ieee80211_unschedule_txq(struct ieee80211_hw *hw, -+ struct ieee80211_txq *txq, -+ bool purge); -+void ieee80211_update_airtime_weight(struct ieee80211_local *local, -+ struct airtime_sched_info *air_sched, -+ u64 now, bool force); - - /* HT */ - void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -2041,6 +2041,9 @@ int ieee80211_if_add(struct ieee80211_lo - } - } - -+ for (i = 0; i < IEEE80211_NUM_ACS; i++) -+ init_airtime_info(&sdata->airtime[i], &local->airtime[i]); -+ - ieee80211_set_default_queues(sdata); - - sdata->ap_power_level = IEEE80211_UNSET_POWER_LEVEL; ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -707,10 +707,13 @@ struct ieee80211_hw *ieee80211_alloc_hw_ - spin_lock_init(&local->queue_stop_reason_lock); - - for (i = 0; i < IEEE80211_NUM_ACS; i++) { -- INIT_LIST_HEAD(&local->active_txqs[i]); -- spin_lock_init(&local->active_txq_lock[i]); -- local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L; -- local->aql_txq_limit_high[i] = -+ struct airtime_sched_info *air_sched = &local->airtime[i]; -+ -+ air_sched->active_txqs = RB_ROOT_CACHED; -+ INIT_LIST_HEAD(&air_sched->active_list); -+ spin_lock_init(&air_sched->lock); -+ air_sched->aql_txq_limit_low = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L; -+ air_sched->aql_txq_limit_high = - IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H; - } - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -1563,12 +1563,8 @@ static void sta_ps_start(struct sta_info - - for (tid = 0; tid < IEEE80211_NUM_TIDS; tid++) { - struct ieee80211_txq *txq = sta->sta.txq[tid]; -- struct txq_info *txqi = to_txq_info(txq); - -- spin_lock(&local->active_txq_lock[txq->ac]); -- if (!list_empty(&txqi->schedule_order)) -- list_del_init(&txqi->schedule_order); -- spin_unlock(&local->active_txq_lock[txq->ac]); -+ ieee80211_unschedule_txq(&local->hw, txq, false); - - if (txq_has_queue(txq)) - set_bit(tid, &sta->txq_buffered_tids); ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -426,15 +426,11 @@ struct sta_info *sta_info_alloc(struct i - if (sta_prepare_rate_control(local, sta, gfp)) - goto free_txq; - -- sta->airtime_weight = IEEE80211_DEFAULT_AIRTIME_WEIGHT; - - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - skb_queue_head_init(&sta->ps_tx_buf[i]); - skb_queue_head_init(&sta->tx_filtered[i]); -- sta->airtime[i].deficit = sta->airtime_weight; -- atomic_set(&sta->airtime[i].aql_tx_pending, 0); -- sta->airtime[i].aql_limit_low = local->aql_txq_limit_low[i]; -- sta->airtime[i].aql_limit_high = local->aql_txq_limit_high[i]; -+ init_airtime_info(&sta->airtime[i], &local->airtime[i]); - } - - for (i = 0; i < IEEE80211_NUM_TIDS; i++) -@@ -1893,24 +1889,59 @@ void ieee80211_sta_set_buffered(struct i - } - EXPORT_SYMBOL(ieee80211_sta_set_buffered); - --void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, -- u32 tx_airtime, u32 rx_airtime) -+void ieee80211_register_airtime(struct ieee80211_txq *txq, -+ u32 tx_airtime, u32 rx_airtime) - { -- struct sta_info *sta = container_of(pubsta, struct sta_info, sta); -- struct ieee80211_local *local = sta->sdata->local; -- u8 ac = ieee80211_ac_from_tid(tid); -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif); -+ struct ieee80211_local *local = sdata->local; -+ u64 weight_sum, weight_sum_reciprocal; -+ struct airtime_sched_info *air_sched; -+ struct airtime_info *air_info; - u32 airtime = 0; - -- if (sta->local->airtime_flags & AIRTIME_USE_TX) -+ air_sched = &local->airtime[txq->ac]; -+ air_info = to_airtime_info(txq); -+ -+ if (local->airtime_flags & AIRTIME_USE_TX) - airtime += tx_airtime; -- if (sta->local->airtime_flags & AIRTIME_USE_RX) -+ if (local->airtime_flags & AIRTIME_USE_RX) - airtime += rx_airtime; - -- spin_lock_bh(&local->active_txq_lock[ac]); -- sta->airtime[ac].tx_airtime += tx_airtime; -- sta->airtime[ac].rx_airtime += rx_airtime; -- sta->airtime[ac].deficit -= airtime; -- spin_unlock_bh(&local->active_txq_lock[ac]); -+ /* Weights scale so the unit weight is 256 */ -+ airtime <<= 8; -+ -+ spin_lock_bh(&air_sched->lock); -+ -+ air_info->tx_airtime += tx_airtime; -+ air_info->rx_airtime += rx_airtime; -+ -+ if (air_sched->weight_sum) { -+ weight_sum = air_sched->weight_sum; -+ weight_sum_reciprocal = air_sched->weight_sum_reciprocal; -+ } else { -+ weight_sum = air_info->weight; -+ weight_sum_reciprocal = air_info->weight_reciprocal; -+ } -+ -+ /* Round the calculation of global vt */ -+ air_sched->v_t += (u64)((airtime + (weight_sum >> 1)) * -+ weight_sum_reciprocal) >> IEEE80211_RECIPROCAL_SHIFT_64; -+ air_info->v_t += (u32)((airtime + (air_info->weight >> 1)) * -+ air_info->weight_reciprocal) >> IEEE80211_RECIPROCAL_SHIFT_32; -+ ieee80211_resort_txq(&local->hw, txq); -+ -+ spin_unlock_bh(&air_sched->lock); -+} -+ -+void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, -+ u32 tx_airtime, u32 rx_airtime) -+{ -+ struct ieee80211_txq *txq = pubsta->txq[tid]; -+ -+ if (!txq) -+ return; -+ -+ ieee80211_register_airtime(txq, tx_airtime, rx_airtime); - } - EXPORT_SYMBOL(ieee80211_sta_register_airtime); - -@@ -2354,7 +2385,7 @@ void sta_set_sinfo(struct sta_info *sta, - } - - if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT))) { -- sinfo->airtime_weight = sta->airtime_weight; -+ sinfo->airtime_weight = sta->airtime[0].weight; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT); - } - ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -135,18 +135,25 @@ enum ieee80211_agg_stop_reason { - #define AIRTIME_USE_TX BIT(0) - #define AIRTIME_USE_RX BIT(1) - -+ - struct airtime_info { - u64 rx_airtime; - u64 tx_airtime; -- s64 deficit; -+ u64 v_t; -+ u64 last_scheduled; -+ struct list_head list; - atomic_t aql_tx_pending; /* Estimated airtime for frames pending */ - u32 aql_limit_low; - u32 aql_limit_high; -+ u32 weight_reciprocal; -+ u16 weight; - }; - - void ieee80211_sta_update_pending_airtime(struct ieee80211_local *local, - struct sta_info *sta, u8 ac, - u16 tx_airtime, bool tx_completed); -+void ieee80211_register_airtime(struct ieee80211_txq *txq, -+ u32 tx_airtime, u32 rx_airtime); - - struct sta_info; - -@@ -515,7 +522,6 @@ struct ieee80211_fragment_cache { - * @tid_seq: per-TID sequence numbers for sending to this STA - * @airtime: per-AC struct airtime_info describing airtime statistics for this - * station -- * @airtime_weight: station weight for airtime fairness calculation purposes - * @ampdu_mlme: A-MPDU state machine state - * @mesh: mesh STA information - * @debugfs_dir: debug filesystem directory dentry -@@ -646,7 +652,6 @@ struct sta_info { - u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; - - struct airtime_info airtime[IEEE80211_NUM_ACS]; -- u16 airtime_weight; - - /* - * Aggregation information, locked with lock. ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -970,6 +970,25 @@ static void __ieee80211_tx_status(struct - if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked) - ieee80211_frame_acked(sta, skb); - -+ } else if (wiphy_ext_feature_isset(local->hw.wiphy, -+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) { -+ struct ieee80211_sub_if_data *sdata; -+ struct ieee80211_txq *txq; -+ u32 airtime; -+ -+ /* Account airtime to multicast queue */ -+ sdata = ieee80211_sdata_from_skb(local, skb); -+ -+ if (sdata && (txq = sdata->vif.txq)) { -+ airtime = info->status.tx_time ?: -+ ieee80211_calc_expected_tx_airtime(hw, -+ &sdata->vif, -+ NULL, -+ skb->len, -+ false); -+ -+ ieee80211_register_airtime(txq, airtime, 0); -+ } - } - - /* SNMP counters ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -18,6 +18,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1479,7 +1480,7 @@ void ieee80211_txq_init(struct ieee80211 - codel_vars_init(&txqi->def_cvars); - codel_stats_init(&txqi->cstats); - __skb_queue_head_init(&txqi->frags); -- INIT_LIST_HEAD(&txqi->schedule_order); -+ RB_CLEAR_NODE(&txqi->schedule_order); - - txqi->txq.vif = &sdata->vif; - -@@ -1523,9 +1524,7 @@ void ieee80211_txq_purge(struct ieee8021 - ieee80211_purge_tx_queue(&local->hw, &txqi->frags); - spin_unlock_bh(&fq->lock); - -- spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]); -- list_del_init(&txqi->schedule_order); -- spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]); -+ ieee80211_unschedule_txq(&local->hw, &txqi->txq, true); - } - - void ieee80211_txq_set_params(struct ieee80211_local *local) -@@ -3812,102 +3811,259 @@ EXPORT_SYMBOL(ieee80211_tx_dequeue); - struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) - { - struct ieee80211_local *local = hw_to_local(hw); -+ struct airtime_sched_info *air_sched; -+ u64 now = ktime_get_boottime_ns(); - struct ieee80211_txq *ret = NULL; -- struct txq_info *txqi = NULL, *head = NULL; -- bool found_eligible_txq = false; -+ struct airtime_info *air_info; -+ struct txq_info *txqi = NULL; -+ struct rb_node *node; -+ bool first = false; - -- spin_lock_bh(&local->active_txq_lock[ac]); -+ air_sched = &local->airtime[ac]; -+ spin_lock_bh(&air_sched->lock); - -- begin: -- txqi = list_first_entry_or_null(&local->active_txqs[ac], -- struct txq_info, -- schedule_order); -- if (!txqi) -+ node = air_sched->schedule_pos; -+ -+begin: -+ if (!node) { -+ node = rb_first_cached(&air_sched->active_txqs); -+ first = true; -+ } else { -+ node = rb_next(node); -+ } -+ -+ if (!node) - goto out; - -- if (txqi == head) { -- if (!found_eligible_txq) -- goto out; -- else -- found_eligible_txq = false; -+ txqi = container_of(node, struct txq_info, schedule_order); -+ air_info = to_airtime_info(&txqi->txq); -+ -+ if (air_info->v_t > air_sched->v_t && -+ (!first || !airtime_catchup_v_t(air_sched, air_info->v_t, now))) -+ goto out; -+ -+ if (!ieee80211_txq_airtime_check(hw, &txqi->txq)) { -+ first = false; -+ goto begin; - } - -- if (!head) -- head = txqi; -+ air_sched->schedule_pos = node; -+ air_sched->last_schedule_activity = now; -+ ret = &txqi->txq; -+out: -+ spin_unlock_bh(&air_sched->lock); -+ return ret; -+} -+EXPORT_SYMBOL(ieee80211_next_txq); - -- if (txqi->txq.sta) { -- struct sta_info *sta = container_of(txqi->txq.sta, -- struct sta_info, sta); -- bool aql_check = ieee80211_txq_airtime_check(hw, &txqi->txq); -- s64 deficit = sta->airtime[txqi->txq.ac].deficit; -+static void __ieee80211_insert_txq(struct rb_root_cached *root, -+ struct txq_info *txqi) -+{ -+ struct rb_node **new = &root->rb_root.rb_node; -+ struct airtime_info *old_air, *new_air; -+ struct rb_node *parent = NULL; -+ struct txq_info *__txqi; -+ bool leftmost = true; -+ -+ while (*new) { -+ parent = *new; -+ __txqi = rb_entry(parent, struct txq_info, schedule_order); -+ old_air = to_airtime_info(&__txqi->txq); -+ new_air = to_airtime_info(&txqi->txq); - -- if (aql_check) -- found_eligible_txq = true; -+ if (new_air->v_t <= old_air->v_t) { -+ new = &parent->rb_left; -+ } else { -+ new = &parent->rb_right; -+ leftmost = false; -+ } -+ } - -- if (deficit < 0) -- sta->airtime[txqi->txq.ac].deficit += -- sta->airtime_weight; -- -- if (deficit < 0 || !aql_check) { -- list_move_tail(&txqi->schedule_order, -- &local->active_txqs[txqi->txq.ac]); -- goto begin; -+ rb_link_node(&txqi->schedule_order, parent, new); -+ rb_insert_color_cached(&txqi->schedule_order, root, leftmost); -+} -+ -+void ieee80211_resort_txq(struct ieee80211_hw *hw, -+ struct ieee80211_txq *txq) -+{ -+ struct airtime_info *air_info = to_airtime_info(txq); -+ struct ieee80211_local *local = hw_to_local(hw); -+ struct txq_info *txqi = to_txq_info(txq); -+ struct airtime_sched_info *air_sched; -+ -+ air_sched = &local->airtime[txq->ac]; -+ -+ lockdep_assert_held(&air_sched->lock); -+ -+ if (!RB_EMPTY_NODE(&txqi->schedule_order)) { -+ struct airtime_info *a_prev = NULL, *a_next = NULL; -+ struct txq_info *t_prev, *t_next; -+ struct rb_node *n_prev, *n_next; -+ -+ /* Erasing a node can cause an expensive rebalancing operation, -+ * so we check the previous and next nodes first and only remove -+ * and re-insert if the current node is not already in the -+ * correct position. -+ */ -+ if ((n_prev = rb_prev(&txqi->schedule_order)) != NULL) { -+ t_prev = container_of(n_prev, struct txq_info, -+ schedule_order); -+ a_prev = to_airtime_info(&t_prev->txq); -+ } -+ -+ if ((n_next = rb_next(&txqi->schedule_order)) != NULL) { -+ t_next = container_of(n_next, struct txq_info, -+ schedule_order); -+ a_next = to_airtime_info(&t_next->txq); - } -+ -+ if ((!a_prev || a_prev->v_t <= air_info->v_t) && -+ (!a_next || a_next->v_t > air_info->v_t)) -+ return; -+ -+ if (air_sched->schedule_pos == &txqi->schedule_order) -+ air_sched->schedule_pos = n_prev; -+ -+ rb_erase_cached(&txqi->schedule_order, -+ &air_sched->active_txqs); -+ RB_CLEAR_NODE(&txqi->schedule_order); -+ __ieee80211_insert_txq(&air_sched->active_txqs, txqi); - } -+} -+ -+void ieee80211_update_airtime_weight(struct ieee80211_local *local, -+ struct airtime_sched_info *air_sched, -+ u64 now, bool force) -+{ -+ struct airtime_info *air_info, *tmp; -+ u64 weight_sum = 0; -+ -+ if (unlikely(!now)) -+ now = ktime_get_boottime_ns(); -+ -+ lockdep_assert_held(&air_sched->lock); -+ -+ if (!force && (air_sched->last_weight_update < -+ now - AIRTIME_ACTIVE_DURATION)) -+ return; -+ -+ list_for_each_entry_safe(air_info, tmp, -+ &air_sched->active_list, list) { -+ if (airtime_is_active(air_info, now)) -+ weight_sum += air_info->weight; -+ else -+ list_del_init(&air_info->list); -+ } -+ airtime_weight_sum_set(air_sched, weight_sum); -+ air_sched->last_weight_update = now; -+} - -+void ieee80211_schedule_txq(struct ieee80211_hw *hw, -+ struct ieee80211_txq *txq) -+ __acquires(txq_lock) __releases(txq_lock) -+{ -+ struct ieee80211_local *local = hw_to_local(hw); -+ struct txq_info *txqi = to_txq_info(txq); -+ struct airtime_sched_info *air_sched; -+ u64 now = ktime_get_boottime_ns(); -+ struct airtime_info *air_info; -+ u8 ac = txq->ac; -+ bool was_active; - -- if (txqi->schedule_round == local->schedule_round[ac]) -+ air_sched = &local->airtime[ac]; -+ air_info = to_airtime_info(txq); -+ -+ spin_lock_bh(&air_sched->lock); -+ was_active = airtime_is_active(air_info, now); -+ airtime_set_active(air_sched, air_info, now); -+ -+ if (!RB_EMPTY_NODE(&txqi->schedule_order)) - goto out; - -- list_del_init(&txqi->schedule_order); -- txqi->schedule_round = local->schedule_round[ac]; -- ret = &txqi->txq; -+ /* If the station has been inactive for a while, catch up its v_t so it -+ * doesn't get indefinite priority; see comment above the definition of -+ * AIRTIME_MAX_BEHIND. -+ */ -+ if ((!was_active && air_info->v_t < air_sched->v_t) || -+ air_info->v_t < air_sched->v_t - AIRTIME_MAX_BEHIND) -+ air_info->v_t = air_sched->v_t; -+ -+ ieee80211_update_airtime_weight(local, air_sched, now, !was_active); -+ __ieee80211_insert_txq(&air_sched->active_txqs, txqi); - - out: -- spin_unlock_bh(&local->active_txq_lock[ac]); -- return ret; -+ spin_unlock_bh(&air_sched->lock); - } --EXPORT_SYMBOL(ieee80211_next_txq); -+EXPORT_SYMBOL(ieee80211_schedule_txq); - --void __ieee80211_schedule_txq(struct ieee80211_hw *hw, -- struct ieee80211_txq *txq, -- bool force) -+static void __ieee80211_unschedule_txq(struct ieee80211_hw *hw, -+ struct ieee80211_txq *txq, -+ bool purge) - { - struct ieee80211_local *local = hw_to_local(hw); - struct txq_info *txqi = to_txq_info(txq); -+ struct airtime_sched_info *air_sched; -+ struct airtime_info *air_info; - -- spin_lock_bh(&local->active_txq_lock[txq->ac]); -+ air_sched = &local->airtime[txq->ac]; -+ air_info = to_airtime_info(&txqi->txq); - -- if (list_empty(&txqi->schedule_order) && -- (force || !skb_queue_empty(&txqi->frags) || -- txqi->tin.backlog_packets)) { -- /* If airtime accounting is active, always enqueue STAs at the -- * head of the list to ensure that they only get moved to the -- * back by the airtime DRR scheduler once they have a negative -- * deficit. A station that already has a negative deficit will -- * get immediately moved to the back of the list on the next -- * call to ieee80211_next_txq(). -- */ -- if (txqi->txq.sta && local->airtime_flags && -- wiphy_ext_feature_isset(local->hw.wiphy, -- NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) -- list_add(&txqi->schedule_order, -- &local->active_txqs[txq->ac]); -- else -- list_add_tail(&txqi->schedule_order, -- &local->active_txqs[txq->ac]); -+ lockdep_assert_held(&air_sched->lock); -+ -+ if (purge) { -+ list_del_init(&air_info->list); -+ ieee80211_update_airtime_weight(local, air_sched, 0, true); - } - -- spin_unlock_bh(&local->active_txq_lock[txq->ac]); -+ if (RB_EMPTY_NODE(&txqi->schedule_order)) -+ return; -+ -+ if (air_sched->schedule_pos == &txqi->schedule_order) -+ air_sched->schedule_pos = rb_prev(&txqi->schedule_order); -+ -+ if (!purge) -+ airtime_set_active(air_sched, air_info, -+ ktime_get_boottime_ns()); -+ -+ rb_erase_cached(&txqi->schedule_order, -+ &air_sched->active_txqs); -+ RB_CLEAR_NODE(&txqi->schedule_order); -+} -+ -+void ieee80211_unschedule_txq(struct ieee80211_hw *hw, -+ struct ieee80211_txq *txq, -+ bool purge) -+ __acquires(txq_lock) __releases(txq_lock) -+{ -+ struct ieee80211_local *local = hw_to_local(hw); -+ -+ spin_lock_bh(&local->airtime[txq->ac].lock); -+ __ieee80211_unschedule_txq(hw, txq, purge); -+ spin_unlock_bh(&local->airtime[txq->ac].lock); -+} -+ -+void ieee80211_return_txq(struct ieee80211_hw *hw, -+ struct ieee80211_txq *txq, bool force) -+{ -+ struct ieee80211_local *local = hw_to_local(hw); -+ struct txq_info *txqi = to_txq_info(txq); -+ -+ spin_lock_bh(&local->airtime[txq->ac].lock); -+ -+ if (!RB_EMPTY_NODE(&txqi->schedule_order) && !force && -+ !txq_has_queue(txq)) -+ __ieee80211_unschedule_txq(hw, txq, false); -+ -+ spin_unlock_bh(&local->airtime[txq->ac].lock); - } --EXPORT_SYMBOL(__ieee80211_schedule_txq); -+EXPORT_SYMBOL(ieee80211_return_txq); - - DEFINE_STATIC_KEY_FALSE(aql_disable); - - bool ieee80211_txq_airtime_check(struct ieee80211_hw *hw, - struct ieee80211_txq *txq) - { -- struct sta_info *sta; -+ struct airtime_info *air_info = to_airtime_info(txq); - struct ieee80211_local *local = hw_to_local(hw); - - if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) -@@ -3922,15 +4078,12 @@ bool ieee80211_txq_airtime_check(struct - if (unlikely(txq->tid == IEEE80211_NUM_TIDS)) - return true; - -- sta = container_of(txq->sta, struct sta_info, sta); -- if (atomic_read(&sta->airtime[txq->ac].aql_tx_pending) < -- sta->airtime[txq->ac].aql_limit_low) -+ if (atomic_read(&air_info->aql_tx_pending) < air_info->aql_limit_low) - return true; - - if (atomic_read(&local->aql_total_pending_airtime) < - local->aql_threshold && -- atomic_read(&sta->airtime[txq->ac].aql_tx_pending) < -- sta->airtime[txq->ac].aql_limit_high) -+ atomic_read(&air_info->aql_tx_pending) < air_info->aql_limit_high) - return true; - - return false; -@@ -3940,60 +4093,59 @@ EXPORT_SYMBOL(ieee80211_txq_airtime_chec - bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, - struct ieee80211_txq *txq) - { -+ struct txq_info *first_txqi = NULL, *txqi = to_txq_info(txq); - struct ieee80211_local *local = hw_to_local(hw); -- struct txq_info *iter, *tmp, *txqi = to_txq_info(txq); -- struct sta_info *sta; -- u8 ac = txq->ac; -+ struct airtime_sched_info *air_sched; -+ struct airtime_info *air_info; -+ struct rb_node *node = NULL; -+ bool ret = false; -+ u64 now; - -- spin_lock_bh(&local->active_txq_lock[ac]); - -- if (!txqi->txq.sta) -- goto out; -+ if (!ieee80211_txq_airtime_check(hw, txq)) -+ return false; -+ -+ air_sched = &local->airtime[txq->ac]; -+ spin_lock_bh(&air_sched->lock); - -- if (list_empty(&txqi->schedule_order)) -+ if (RB_EMPTY_NODE(&txqi->schedule_order)) - goto out; - -- list_for_each_entry_safe(iter, tmp, &local->active_txqs[ac], -- schedule_order) { -- if (iter == txqi) -- break; -+ now = ktime_get_boottime_ns(); - -- if (!iter->txq.sta) { -- list_move_tail(&iter->schedule_order, -- &local->active_txqs[ac]); -- continue; -- } -- sta = container_of(iter->txq.sta, struct sta_info, sta); -- if (sta->airtime[ac].deficit < 0) -- sta->airtime[ac].deficit += sta->airtime_weight; -- list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); -+ /* Like in ieee80211_next_txq(), make sure the first station in the -+ * scheduling order is eligible for transmission to avoid starvation. -+ */ -+ node = rb_first_cached(&air_sched->active_txqs); -+ if (node) { -+ first_txqi = container_of(node, struct txq_info, -+ schedule_order); -+ air_info = to_airtime_info(&first_txqi->txq); -+ -+ if (air_sched->v_t < air_info->v_t) -+ airtime_catchup_v_t(air_sched, air_info->v_t, now); - } - -- sta = container_of(txqi->txq.sta, struct sta_info, sta); -- if (sta->airtime[ac].deficit >= 0) -- goto out; -- -- sta->airtime[ac].deficit += sta->airtime_weight; -- list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]); -- spin_unlock_bh(&local->active_txq_lock[ac]); -+ air_info = to_airtime_info(&txqi->txq); -+ if (air_info->v_t <= air_sched->v_t) { -+ air_sched->last_schedule_activity = now; -+ ret = true; -+ } - -- return false; - out: -- if (!list_empty(&txqi->schedule_order)) -- list_del_init(&txqi->schedule_order); -- spin_unlock_bh(&local->active_txq_lock[ac]); -- -- return true; -+ spin_unlock_bh(&air_sched->lock); -+ return ret; - } - EXPORT_SYMBOL(ieee80211_txq_may_transmit); - - void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) - { - struct ieee80211_local *local = hw_to_local(hw); -+ struct airtime_sched_info *air_sched = &local->airtime[ac]; - -- spin_lock_bh(&local->active_txq_lock[ac]); -- local->schedule_round[ac]++; -- spin_unlock_bh(&local->active_txq_lock[ac]); -+ spin_lock_bh(&air_sched->lock); -+ air_sched->schedule_pos = NULL; -+ spin_unlock_bh(&air_sched->lock); - } - EXPORT_SYMBOL(ieee80211_txq_schedule_start); - diff --git a/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch b/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch deleted file mode 100644 index e195d0bcad..0000000000 --- a/package/kernel/mac80211/patches/subsys/386-mac80211-check-per-vif-offload_flags-in-Tx-path.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Ryder Lee -Date: Fri, 18 Jun 2021 04:38:59 +0800 -Subject: [PATCH] mac80211: check per vif offload_flags in Tx path - -offload_flags has been introduced to indicate encap status of each interface. -An interface can encap offload at runtime, or if it has some extra limitations -it can simply override the flags, so it's more flexible to check offload_flags -in Tx path. - -Signed-off-by: Ryder Lee -Link: https://lore.kernel.org/r/177785418cf407808bf3a44760302d0647076990.1623961575.git.ryder.lee@mediatek.com -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3318,6 +3318,9 @@ static bool ieee80211_amsdu_aggregate(st - if (!ieee80211_hw_check(&local->hw, TX_AMSDU)) - return false; - -+ if (sdata->vif.offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED) -+ return false; -+ - if (skb_is_gso(skb)) - return false; - diff --git a/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch b/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch index 6989375180..f2ebede15a 100644 --- a/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch +++ b/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch @@ -23,8 +23,8 @@ Signed-off-by: Johannes Berg --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -1253,6 +1253,27 @@ struct cfg80211_csa_settings { - #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10 +@@ -1258,6 +1258,27 @@ struct cfg80211_csa_settings { + }; /** + * struct cfg80211_color_change_settings - color change settings @@ -51,7 +51,7 @@ Signed-off-by: Johannes Berg * struct iface_combination_params - input parameters for interface combinations * * Used to pass interface combination parameters -@@ -3991,6 +4012,8 @@ struct mgmt_frame_regs { +@@ -4000,6 +4021,8 @@ struct mgmt_frame_regs { * given TIDs. This callback may sleep. * * @set_sar_specs: Update the SAR (TX power) settings. @@ -60,7 +60,7 @@ Signed-off-by: Johannes Berg */ struct cfg80211_ops { int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); -@@ -4318,6 +4341,9 @@ struct cfg80211_ops { +@@ -4327,6 +4350,9 @@ struct cfg80211_ops { const u8 *peer, u8 tids); int (*set_sar_specs)(struct wiphy *wiphy, struct cfg80211_sar_specs *sar); @@ -70,7 +70,7 @@ Signed-off-by: Johannes Berg }; /* -@@ -8209,4 +8235,70 @@ void cfg80211_update_owe_info_event(stru +@@ -8226,4 +8252,70 @@ void cfg80211_update_owe_info_event(stru */ void cfg80211_bss_flush(struct wiphy *wiphy); @@ -210,7 +210,7 @@ Signed-off-by: Johannes Berg /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, -@@ -5950,6 +5989,9 @@ enum nl80211_feature_flags { +@@ -5953,6 +5992,9 @@ enum nl80211_feature_flags { * frame protection for all management frames exchanged during the * negotiation and range measurement procedure. * @@ -220,7 +220,7 @@ Signed-off-by: Johannes Berg * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ -@@ -6014,6 +6056,7 @@ enum nl80211_ext_feature_index { +@@ -6017,6 +6059,7 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_SECURE_LTF, NL80211_EXT_FEATURE_SECURE_RTT, NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, @@ -241,7 +241,7 @@ Signed-off-by: Johannes Berg }; /* policy for the key attributes */ -@@ -14815,6 +14819,106 @@ bad_tid_conf: +@@ -14823,6 +14827,106 @@ bad_tid_conf: return ret; } @@ -348,7 +348,7 @@ Signed-off-by: Johannes Berg #define NL80211_FLAG_NEED_WIPHY 0x01 #define NL80211_FLAG_NEED_NETDEV 0x02 #define NL80211_FLAG_NEED_RTNL 0x04 -@@ -15815,6 +15919,14 @@ static const struct genl_small_ops nl802 +@@ -15823,6 +15927,14 @@ static const struct genl_small_ops nl802 .internal_flags = NL80211_FLAG_NEED_WIPHY | NL80211_FLAG_NEED_RTNL, }, @@ -363,7 +363,7 @@ Signed-off-by: Johannes Berg }; static struct genl_family nl80211_fam __genl_ro_after_init = { -@@ -17446,6 +17558,51 @@ void cfg80211_ch_switch_started_notify(s +@@ -17454,6 +17566,51 @@ void cfg80211_ch_switch_started_notify(s } EXPORT_SYMBOL(cfg80211_ch_switch_started_notify); @@ -417,7 +417,7 @@ Signed-off-by: Johannes Berg const struct cfg80211_chan_def *chandef, --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h -@@ -1358,4 +1358,17 @@ static inline int rdev_set_sar_specs(str +@@ -1368,4 +1368,17 @@ static inline int rdev_set_sar_specs(str return ret; } @@ -437,7 +437,7 @@ Signed-off-by: Johannes Berg #endif /* __CFG80211_RDEV_OPS */ --- a/net/wireless/trace.h +++ b/net/wireless/trace.h -@@ -3565,6 +3565,52 @@ TRACE_EVENT(rdev_set_sar_specs, +@@ -3597,6 +3597,52 @@ TRACE_EVENT(rdev_set_sar_specs, WIPHY_PR_ARG, __entry->type, __entry->num) ); diff --git a/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch b/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch index 320570d034..196c8e10af 100644 --- a/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch +++ b/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch @@ -19,7 +19,7 @@ Signed-off-by: Johannes Berg --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -1713,6 +1713,10 @@ enum ieee80211_offload_flags { +@@ -1715,6 +1715,10 @@ enum ieee80211_offload_flags { * protected by fq->lock. * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see * &enum ieee80211_offload_flags. @@ -30,7 +30,7 @@ Signed-off-by: Johannes Berg */ struct ieee80211_vif { enum nl80211_iftype type; -@@ -1741,6 +1745,9 @@ struct ieee80211_vif { +@@ -1743,6 +1747,9 @@ struct ieee80211_vif { bool txqs_stopped[IEEE80211_NUM_ACS]; @@ -40,7 +40,7 @@ Signed-off-by: Johannes Berg /* must be last */ u8 drv_priv[] __aligned(sizeof(void *)); }; -@@ -4992,6 +4999,16 @@ void ieee80211_csa_finish(struct ieee802 +@@ -5016,6 +5023,16 @@ void ieee80211_csa_finish(struct ieee802 bool ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif); /** @@ -57,7 +57,7 @@ Signed-off-by: Johannes Berg * ieee80211_proberesp_get - retrieve a Probe Response template * @hw: pointer obtained from ieee80211_alloc_hw(). * @vif: &struct ieee80211_vif pointer from the add_interface callback. -@@ -6756,6 +6773,18 @@ ieee80211_get_unsol_bcast_probe_resp_tmp +@@ -6780,6 +6797,18 @@ ieee80211_get_unsol_bcast_probe_resp_tmp struct ieee80211_vif *vif); /** @@ -161,7 +161,7 @@ Signed-off-by: Johannes Berg if (err < 0) return err; ieee80211_bss_info_change_notify(sdata, err); -@@ -3163,7 +3171,7 @@ static int ieee80211_set_after_csa_beaco +@@ -3155,7 +3163,7 @@ static int ieee80211_set_after_csa_beaco switch (sdata->vif.type) { case NL80211_IFTYPE_AP: err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon, @@ -170,7 +170,7 @@ Signed-off-by: Johannes Berg kfree(sdata->u.ap.next_beacon); sdata->u.ap.next_beacon = NULL; -@@ -3329,7 +3337,7 @@ static int ieee80211_set_csa_beacon(stru +@@ -3321,7 +3329,7 @@ static int ieee80211_set_csa_beacon(stru csa.n_counter_offsets_presp = params->n_counter_offsets_presp; csa.count = params->count; @@ -179,7 +179,7 @@ Signed-off-by: Johannes Berg if (err < 0) { kfree(sdata->u.ap.next_beacon); return err; -@@ -3418,6 +3426,15 @@ static int ieee80211_set_csa_beacon(stru +@@ -3410,6 +3418,15 @@ static int ieee80211_set_csa_beacon(stru return 0; } @@ -195,7 +195,7 @@ Signed-off-by: Johannes Berg static int __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_csa_settings *params) -@@ -3486,6 +3503,10 @@ __ieee80211_channel_switch(struct wiphy +@@ -3478,6 +3495,10 @@ __ieee80211_channel_switch(struct wiphy goto out; } @@ -206,7 +206,7 @@ Signed-off-by: Johannes Berg err = ieee80211_set_csa_beacon(sdata, params, &changed); if (err) { ieee80211_vif_unreserve_chanctx(sdata); -@@ -4137,6 +4158,196 @@ static int ieee80211_set_sar_specs(struc +@@ -4129,6 +4150,196 @@ static int ieee80211_set_sar_specs(struc return local->ops->set_sar_specs(&local->hw, sar); } @@ -403,7 +403,7 @@ Signed-off-by: Johannes Berg const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface, -@@ -4240,4 +4451,5 @@ const struct cfg80211_ops mac80211_confi +@@ -4232,4 +4443,5 @@ const struct cfg80211_ops mac80211_confi .set_tid_config = ieee80211_set_tid_config, .reset_tid_config = ieee80211_reset_tid_config, .set_sar_specs = ieee80211_set_sar_specs, @@ -433,7 +433,7 @@ Signed-off-by: Johannes Berg struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */ struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */ -@@ -1895,6 +1903,9 @@ void ieee80211_csa_finalize_work(struct +@@ -1891,6 +1899,9 @@ void ieee80211_csa_finalize_work(struct int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_csa_settings *params); @@ -453,7 +453,7 @@ Signed-off-by: Johannes Berg cancel_delayed_work_sync(&sdata->dfs_cac_timer_work); -@@ -1595,6 +1596,7 @@ static void ieee80211_setup_sdata(struct +@@ -1608,6 +1609,7 @@ static void ieee80211_setup_sdata(struct INIT_WORK(&sdata->work, ieee80211_iface_work); INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work); INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); @@ -463,7 +463,7 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4784,11 +4784,11 @@ static int ieee80211_beacon_add_tim(stru +@@ -4796,11 +4796,11 @@ static int ieee80211_beacon_add_tim(stru static void ieee80211_set_beacon_cntdwn(struct ieee80211_sub_if_data *sdata, struct beacon_data *beacon) { @@ -477,7 +477,7 @@ Signed-off-by: Johannes Berg switch (sdata->vif.type) { case NL80211_IFTYPE_AP: -@@ -4808,21 +4808,27 @@ static void ieee80211_set_beacon_cntdwn( +@@ -4820,21 +4820,27 @@ static void ieee80211_set_beacon_cntdwn( } rcu_read_lock(); @@ -514,7 +514,7 @@ Signed-off-by: Johannes Berg } rcu_read_unlock(); } -@@ -5032,6 +5038,7 @@ __ieee80211_beacon_get(struct ieee80211_ +@@ -5044,6 +5050,7 @@ __ieee80211_beacon_get(struct ieee80211_ if (offs) { offs->tim_offset = beacon->head_len; offs->tim_length = skb->len - beacon->head_len; diff --git a/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch b/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch index cf45c6d072..6bb7dd7df4 100644 --- a/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch +++ b/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch @@ -73,7 +73,7 @@ Signed-off-by: Johannes Berg } u; } __packed action; } u; -@@ -2879,6 +2925,7 @@ enum ieee80211_eid { +@@ -2881,6 +2927,7 @@ enum ieee80211_eid { WLAN_EID_AID_RESPONSE = 211, WLAN_EID_S1G_BCN_COMPAT = 213, WLAN_EID_S1G_SHORT_BCN_INTERVAL = 214, @@ -81,7 +81,7 @@ Signed-off-by: Johannes Berg WLAN_EID_S1G_CAPABILITIES = 217, WLAN_EID_VENDOR_SPECIFIC = 221, WLAN_EID_QOS_PARAMETER = 222, -@@ -2947,6 +2994,7 @@ enum ieee80211_category { +@@ -2950,6 +2997,7 @@ enum ieee80211_category { WLAN_CATEGORY_FST = 18, WLAN_CATEGORY_UNPROT_DMG = 20, WLAN_CATEGORY_VHT = 21, @@ -89,7 +89,7 @@ Signed-off-by: Johannes Berg WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, WLAN_CATEGORY_VENDOR_SPECIFIC = 127, }; -@@ -3020,6 +3068,20 @@ enum ieee80211_key_len { +@@ -3023,6 +3071,20 @@ enum ieee80211_key_len { WLAN_KEY_LEN_BIP_GMAC_256 = 32, }; diff --git a/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch index 2b7bdabfe3..f0f864c7e7 100644 --- a/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch +++ b/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch @@ -1,3 +1,4 @@ +From f5a4c24e689f54e66201f04d343bdd2e8a1d7923 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi Date: Mon, 23 Aug 2021 20:02:39 +0200 Subject: [PATCH] mac80211: introduce individual TWT support in AP mode @@ -24,10 +25,33 @@ Link: https://lore.kernel.org/r/257512f2e22ba42b9f2624942a128dd8f141de4b.1629741 fix to use ieee80211_get_he_iftype_cap() correctly] Signed-off-by: Johannes Berg --- + include/net/mac80211.h | 12 +++ + net/mac80211/driver-ops.h | 36 ++++++++ + net/mac80211/ieee80211_i.h | 6 ++ + net/mac80211/iface.c | 41 +++++++++ + net/mac80211/rx.c | 73 +++++++++++++++ + net/mac80211/s1g.c | 180 +++++++++++++++++++++++++++++++++++++ + net/mac80211/status.c | 17 +++- + net/mac80211/trace.h | 67 ++++++++++++++ + 8 files changed, 430 insertions(+), 2 deletions(-) --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -4229,6 +4229,11 @@ struct ieee80211_ops { +@@ -3930,6 +3930,13 @@ struct ieee80211_prep_tx_info { + * @set_sar_specs: Update the SAR (TX power) settings. + * @sta_set_decap_offload: Called to notify the driver when a station is allowed + * to use rx decapsulation offload ++ * @add_twt_setup: Update hw with TWT agreement parameters received from the peer. ++ * This callback allows the hw to check if requested parameters ++ * are supported and if there is enough room for a new agreement. ++ * The hw is expected to set agreement result in the req_type field of ++ * twt structure. ++ * @twt_teardown_request: Update the hw with TWT teardown request received ++ * from the peer. + */ + struct ieee80211_ops { + void (*tx)(struct ieee80211_hw *hw, +@@ -4253,6 +4260,11 @@ struct ieee80211_ops { void (*sta_set_decap_offload)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, bool enabled); @@ -41,7 +65,7 @@ Signed-off-by: Johannes Berg /** --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h -@@ -1429,4 +1429,40 @@ static inline void drv_sta_set_decap_off +@@ -1447,4 +1447,40 @@ static inline void drv_sta_set_decap_off trace_drv_return_void(local); } @@ -92,7 +116,7 @@ Signed-off-by: Johannes Berg u8 needed_rx_chains; enum ieee80211_smps_mode smps_mode; -@@ -2088,6 +2089,11 @@ ieee80211_he_op_ie_to_bss_conf(struct ie +@@ -2083,6 +2084,11 @@ ieee80211_he_op_ie_to_bss_conf(struct ie /* S1G */ void ieee80211_s1g_sta_rate_init(struct sta_info *sta); @@ -122,8 +146,25 @@ Signed-off-by: Johannes Berg INIT_WORK(&sdata->work, ieee80211_iface_work); return 0; -@@ -1396,6 +1398,24 @@ static void ieee80211_if_setup_no_queue( - dev->priv_flags |= IFF_NO_QUEUE; +@@ -1459,6 +1461,16 @@ static void ieee80211_iface_process_skb( + WARN_ON(1); + break; + } ++ } else if (ieee80211_is_action(mgmt->frame_control) && ++ mgmt->u.action.category == WLAN_CATEGORY_S1G) { ++ switch (mgmt->u.action.u.s1g.action_code) { ++ case WLAN_S1G_TWT_TEARDOWN: ++ case WLAN_S1G_TWT_SETUP: ++ ieee80211_s1g_rx_twt_action(sdata, skb); ++ break; ++ default: ++ break; ++ } + } else if (ieee80211_is_ext(mgmt->frame_control)) { + if (sdata->vif.type == NL80211_IFTYPE_STATION) + ieee80211_sta_rx_queued_ext(sdata, skb); +@@ -1514,6 +1526,24 @@ static void ieee80211_iface_process_skb( + } } +static void ieee80211_iface_process_status(struct ieee80211_sub_if_data *sdata, @@ -147,37 +188,24 @@ Signed-off-by: Johannes Berg static void ieee80211_iface_work(struct work_struct *work) { struct ieee80211_sub_if_data *sdata = -@@ -1474,6 +1494,16 @@ static void ieee80211_iface_work(struct - WARN_ON(1); - break; - } -+ } else if (ieee80211_is_action(mgmt->frame_control) && -+ mgmt->u.action.category == WLAN_CATEGORY_S1G) { -+ switch (mgmt->u.action.u.s1g.action_code) { -+ case WLAN_S1G_TWT_TEARDOWN: -+ case WLAN_S1G_TWT_SETUP: -+ ieee80211_s1g_rx_twt_action(sdata, skb); -+ break; -+ default: -+ break; -+ } - } else if (ieee80211_is_ext(mgmt->frame_control)) { - if (sdata->vif.type == NL80211_IFTYPE_STATION) - ieee80211_sta_rx_queued_ext(sdata, skb); -@@ -1530,6 +1560,12 @@ static void ieee80211_iface_work(struct +@@ -1543,6 +1573,16 @@ static void ieee80211_iface_work(struct kcov_remote_stop(); } + /* process status queue */ + while ((skb = skb_dequeue(&sdata->status_queue))) { ++ kcov_remote_start_common(skb_get_kcov_handle(skb)); ++ + ieee80211_iface_process_status(sdata, skb); + kfree_skb(skb); ++ ++ kcov_remote_stop(); + } + /* then other type-dependent work */ switch (sdata->vif.type) { case NL80211_IFTYPE_STATION: -@@ -1593,6 +1629,7 @@ static void ieee80211_setup_sdata(struct +@@ -1606,6 +1646,7 @@ static void ieee80211_setup_sdata(struct } skb_queue_head_init(&sdata->skb_queue); @@ -187,7 +215,7 @@ Signed-off-by: Johannes Berg INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -3198,6 +3198,68 @@ ieee80211_rx_h_mgmt_check(struct ieee802 +@@ -3211,6 +3211,68 @@ ieee80211_rx_h_mgmt_check(struct ieee802 return RX_CONTINUE; } @@ -256,7 +284,7 @@ Signed-off-by: Johannes Berg static ieee80211_rx_result debug_noinline ieee80211_rx_h_action(struct ieee80211_rx_data *rx) { -@@ -3477,6 +3539,17 @@ ieee80211_rx_h_action(struct ieee80211_r +@@ -3490,6 +3552,17 @@ ieee80211_rx_h_action(struct ieee80211_r !mesh_path_sel_is_hwmp(sdata)) break; goto queue; @@ -500,7 +528,7 @@ Signed-off-by: Johannes Berg rcu_read_unlock(); --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h -@@ -2804,6 +2804,73 @@ DEFINE_EVENT(sta_flag_evt, drv_sta_set_d +@@ -2825,6 +2825,73 @@ DEFINE_EVENT(sta_flag_evt, drv_sta_set_d TP_ARGS(local, sdata, sta, enabled) ); 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 870d6283b7..b9fd8e3ea2 100644 --- a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch +++ b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch @@ -5,7 +5,7 @@ and we should ignore this. --- a/net/wireless/core.c +++ b/net/wireless/core.c -@@ -637,21 +637,6 @@ static int wiphy_verify_combinations(str +@@ -629,21 +629,6 @@ static int wiphy_verify_combinations(str c->limits[j].max > 1)) return -EINVAL; diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index 6d4a9c21a5..1775dc44b1 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -3826,6 +3826,7 @@ struct mgmt_frame_regs { +@@ -3835,6 +3835,7 @@ struct mgmt_frame_regs { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting * functions to adjust rfkill hw state -@@ -4150,6 +4151,7 @@ struct cfg80211_ops { +@@ -4159,6 +4160,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); @@ -18,7 +18,7 @@ --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -1564,6 +1564,7 @@ enum ieee80211_smps_mode { +@@ -1566,6 +1566,7 @@ enum ieee80211_smps_mode { * * @power_level: requested transmit power (in dBm), backward compatibility * value only that is set to the minimum of all interfaces @@ -26,7 +26,7 @@ * * @chandef: the channel definition to tune to * @radar_enabled: whether radar detection is enabled -@@ -1584,6 +1585,7 @@ enum ieee80211_smps_mode { +@@ -1586,6 +1587,7 @@ enum ieee80211_smps_mode { struct ieee80211_conf { u32 flags; int power_level, dynamic_ps_timeout; @@ -57,7 +57,7 @@ __NL80211_ATTR_AFTER_LAST, --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2768,6 +2768,19 @@ static int ieee80211_get_tx_power(struct +@@ -2760,6 +2760,19 @@ static int ieee80211_get_tx_power(struct return 0; } @@ -77,7 +77,7 @@ static void ieee80211_rfkill_poll(struct wiphy *wiphy) { struct ieee80211_local *local = wiphy_priv(wiphy); -@@ -4403,6 +4416,7 @@ const struct cfg80211_ops mac80211_confi +@@ -4395,6 +4408,7 @@ const struct cfg80211_ops mac80211_confi .set_wiphy_params = ieee80211_set_wiphy_params, .set_tx_power = ieee80211_set_tx_power, .get_tx_power = ieee80211_get_tx_power, @@ -137,7 +137,7 @@ }; /* policy for the key attributes */ -@@ -3317,6 +3318,20 @@ static int nl80211_set_wiphy(struct sk_b +@@ -3325,6 +3326,20 @@ static int nl80211_set_wiphy(struct sk_b goto out; } diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch index 2f724b61ff..f788e6915f 100644 --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch @@ -1,5 +1,14 @@ --- a/nl80211.h +++ b/nl80211.h +@@ -11,7 +11,7 @@ + * Copyright 2008 Jouni Malinen + * Copyright 2008 Colin McCabe + * Copyright 2015-2017 Intel Deutschland GmbH +- * Copyright (C) 2018-2020 Intel Corporation ++ * Copyright (C) 2018-2021 Intel Corporation + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above @@ -655,6 +655,9 @@ * When a security association was established on an 802.1X network using * fast transition, this event should be followed by an @@ -160,7 +169,24 @@ /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, -@@ -5896,6 +5981,22 @@ enum nl80211_feature_flags { +@@ -3613,6 +3698,8 @@ enum nl80211_mpath_info { + * defined + * @NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA: HE 6GHz band capabilities (__le16), + * given for all 6 GHz band channels ++ * @NL80211_BAND_IFTYPE_ATTR_VENDOR_ELEMS: vendor element capabilities that are ++ * advertised on this band/for this iftype (binary) + * @__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST: internal use + */ + enum nl80211_band_iftype_attr { +@@ -3624,6 +3711,7 @@ enum nl80211_band_iftype_attr { + NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET, + NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE, + NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA, ++ NL80211_BAND_IFTYPE_ATTR_VENDOR_ELEMS, + + /* keep last */ + __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST, +@@ -5896,6 +5984,22 @@ enum nl80211_feature_flags { * @NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP: Driver/device supports * unsolicited broadcast probe response transmission * @@ -183,7 +209,7 @@ * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ -@@ -5956,6 +6057,11 @@ enum nl80211_ext_feature_index { +@@ -5956,6 +6060,11 @@ enum nl80211_ext_feature_index { NL80211_EXT_FEATURE_SAE_OFFLOAD_AP, NL80211_EXT_FEATURE_FILS_DISCOVERY, NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP, @@ -195,7 +221,7 @@ /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, -@@ -6253,11 +6359,13 @@ struct nl80211_vendor_cmd_info { +@@ -6253,11 +6362,13 @@ struct nl80211_vendor_cmd_info { * @NL80211_TDLS_PEER_HT: TDLS peer is HT capable. * @NL80211_TDLS_PEER_VHT: TDLS peer is VHT capable. * @NL80211_TDLS_PEER_WMM: TDLS peer is WMM capable. @@ -209,25 +235,29 @@ }; /** -@@ -6849,6 +6957,9 @@ enum nl80211_peer_measurement_ftm_capa { +@@ -6849,6 +6960,12 @@ enum nl80211_peer_measurement_ftm_capa { * if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based * ranging will be used. + * @NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK: negotiate for LMR feedback. Only + * valid if either %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED or + * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set. ++ * @NL80211_PMSR_FTM_REQ_ATTR_BSS_COLOR: optional. The BSS color of the ++ * responder. Only valid if %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED ++ * or %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED is set. * * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number -@@ -6867,6 +6978,7 @@ enum nl80211_peer_measurement_ftm_req { +@@ -6867,6 +6984,8 @@ enum nl80211_peer_measurement_ftm_req { NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC, NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED, NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED, + NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK, ++ NL80211_PMSR_FTM_REQ_ATTR_BSS_COLOR, /* keep last */ NUM_NL80211_PMSR_FTM_REQ_ATTR, -@@ -7124,4 +7236,115 @@ enum nl80211_unsol_bcast_probe_resp_attr +@@ -7124,4 +7243,115 @@ enum nl80211_unsol_bcast_probe_resp_attr NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_MAX = __NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_LAST - 1 }; From 0a274d67b8bd422b32cc5fd81451babbc7da2aab Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 19 Oct 2021 00:44:43 +0200 Subject: [PATCH 25/54] mac80211: Update to version 5.15-rc6-1 The removed patches were applied upstream. The Cisco Aironet 802.11b driver was removed from backports, remove it also from OpenWrt. Signed-off-by: Hauke Mehrtens --- package/kernel/mac80211/Makefile | 21 +- .../patches/ath/404-regd_no_assoc_hints.patch | 4 +- .../ath10k/080-ath10k_thermal_config.patch | 2 +- ...rolling-support-for-various-chipsets.patch | 2 +- ...-register-wiphy-s-during-module_init.patch | 16 +- ...62-brcmfmac-Disable-power-management.patch | 2 +- .../mac80211/patches/brcm/998-survey.patch | 8 +- .../patches/build/060-no_local_ssb_bcma.patch | 4 +- .../602-rt2x00-introduce-rt2x00eeprom.patch | 2 +- .../110-mac80211_keep_keys_on_stop_ap.patch | 2 +- .../mac80211/patches/subsys/210-ap_scan.patch | 2 +- ...nl80211-add-support-for-BSS-coloring.patch | 492 -------------- ...211-add-support-for-BSS-color-change.patch | 524 --------------- ...eee80211-add-TWT-element-definitions.patch | 112 ---- ...ce-individual-TWT-support-in-AP-mode.patch | 604 ------------------ .../500-mac80211_configure_antenna_gain.patch | 2 +- 16 files changed, 26 insertions(+), 1773 deletions(-) delete mode 100644 package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch delete mode 100644 package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch delete mode 100644 package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch delete mode 100644 package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 1fc9dc4c48..89e078b0c3 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.14.13-1 +PKG_VERSION:=5.15-rc6-1 PKG_RELEASE:=1 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.14.13/ -PKG_HASH:=042aef20caf17ef649502d5f2e744a7676abe7faed18de83c96f37bc029635fe +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15-rc6/ +PKG_HASH:=9282612c4c02ef9fc9d74405303033f6b53914cd63d631eef0f43155fcd38932 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) @@ -23,7 +23,6 @@ PKG_MAINTAINER:=Felix Fietkau PKG_DRIVERS = \ adm8211 \ - airo \ hermes hermes-pci hermes-pcmcia hermes-plx\ lib80211 \ mac80211-hwsim \ @@ -174,18 +173,6 @@ define KernelPackage/adm8211 AUTOLOAD:=$(call AutoProbe,adm8211) endef -define KernelPackage/airo - $(call KernelPackage/mac80211/Default) - TITLE:=Cisco Aironet driver - DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86 @BROKEN - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko - AUTOLOAD:=$(call AutoProbe,airo) -endef - -define KernelPackage/airo/description - Kernel support for Cisco Aironet cards -endef - define KernelPackage/hermes $(call KernelPackage/mac80211/Default) TITLE:=Hermes 802.11b chipset support @@ -406,8 +393,6 @@ endif config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP -config-$(call config_package,airo) += AIRO - config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM config-$(call config_package,mt7601u) += MT7601U config-y += WL_MEDIATEK 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 bda710d5c0..833e2411c4 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 -@@ -3292,6 +3292,8 @@ void regulatory_hint_country_ie(struct w +@@ -3299,6 +3299,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; -@@ -3543,6 +3545,7 @@ static bool is_wiphy_all_set_reg_flag(en +@@ -3550,6 +3552,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 c17001eecb..0886fd688a 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 -@@ -85,6 +85,12 @@ config ATH10K_TRACING +@@ -86,6 +86,12 @@ config ATH10K_TRACING help Select this to ath10k use tracing infrastructure. 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 c8d7632900..d815ba2742 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 -@@ -70,6 +70,16 @@ config ATH10K_DEBUGFS +@@ -71,6 +71,16 @@ config ATH10K_DEBUGFS If unsure, say Y to make it easier to debug problems. diff --git a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch index 7c76699c44..aa890ce0f3 100644 --- a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch +++ b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch @@ -20,8 +20,8 @@ Signed-off-by: Rafał Miłecki + struct completion *completion; }; - static void brcmf_fw_request_done(const struct firmware *fw, void *ctx); -@@ -636,6 +637,8 @@ static void brcmf_fw_request_done(const + #ifdef CONFIG_EFI +@@ -653,6 +654,8 @@ static void brcmf_fw_request_done(const fwctx->req = NULL; } fwctx->done(fwctx->dev, ret, fwctx->req); @@ -30,16 +30,16 @@ Signed-off-by: Rafał Miłecki kfree(fwctx); } -@@ -660,6 +663,8 @@ int brcmf_fw_get_firmwares(struct device +@@ -693,6 +696,8 @@ int brcmf_fw_get_firmwares(struct device { struct brcmf_fw_item *first = &req->items[0]; struct brcmf_fw *fwctx; + struct completion completion; + unsigned long time_left; + char *alt_path; int ret; - brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev)); -@@ -676,6 +681,9 @@ int brcmf_fw_get_firmwares(struct device +@@ -710,6 +715,9 @@ int brcmf_fw_get_firmwares(struct device fwctx->dev = dev; fwctx->req = req; fwctx->done = fw_cb; @@ -47,9 +47,9 @@ Signed-off-by: Rafał Miłecki + init_completion(&completion); + fwctx->completion = &completion; - ret = request_firmware_nowait(THIS_MODULE, true, first->path, - fwctx->dev, GFP_KERNEL, fwctx, -@@ -683,6 +691,12 @@ int brcmf_fw_get_firmwares(struct device + /* First try alternative board-specific path if any */ + alt_path = brcm_alt_fw_path(first->path, fwctx->req->board_type); +@@ -726,6 +734,12 @@ int brcmf_fw_get_firmwares(struct device if (ret < 0) brcmf_fw_request_done(NULL, fwctx); 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 2e22ec793b..88465f256b 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 -@@ -2966,6 +2966,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -2974,6 +2974,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/998-survey.patch b/package/kernel/mac80211/patches/brcm/998-survey.patch index 1479c67156..a5efc08015 100644 --- a/package/kernel/mac80211/patches/brcm/998-survey.patch +++ b/package/kernel/mac80211/patches/brcm/998-survey.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2913,6 +2913,63 @@ done: +@@ -2921,6 +2921,63 @@ done: } static int @@ -64,7 +64,7 @@ brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev, int idx, u8 *mac, struct station_info *sinfo) { -@@ -3013,6 +3070,7 @@ static s32 brcmf_inform_single_bss(struc +@@ -3021,6 +3078,7 @@ static s32 brcmf_inform_single_bss(struc struct brcmu_chan ch; u16 channel; u32 freq; @@ -72,7 +72,7 @@ u16 notify_capability; u16 notify_interval; u8 *notify_ie; -@@ -3037,6 +3095,17 @@ static s32 brcmf_inform_single_bss(struc +@@ -3045,6 +3103,17 @@ static s32 brcmf_inform_single_bss(struc band = NL80211_BAND_5GHZ; freq = ieee80211_channel_to_frequency(channel, band); @@ -90,7 +90,7 @@ bss_data.chan = ieee80211_get_channel(wiphy, freq); bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20; bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime()); -@@ -5565,6 +5634,7 @@ static struct cfg80211_ops brcmf_cfg8021 +@@ -5573,6 +5642,7 @@ static struct cfg80211_ops brcmf_cfg8021 .leave_ibss = brcmf_cfg80211_leave_ibss, .get_station = brcmf_cfg80211_get_station, .dump_station = brcmf_cfg80211_dump_station, 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 0bfc2860f1..3967d73fad 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 -@@ -431,43 +431,6 @@ USB_VL600= +@@ -421,43 +421,6 @@ USB_VL600= USB_NET_CH9200= USB_NET_AQC111= USB_RTL8153_ECM= @@ -192,7 +192,7 @@ select BRCMUTIL --- a/Kconfig.local +++ b/Kconfig.local -@@ -1297,117 +1297,6 @@ config BACKPORTED_USB_NET_AQC111 +@@ -1267,117 +1267,6 @@ config BACKPORTED_USB_NET_AQC111 config BACKPORTED_USB_RTL8153_ECM tristate default USB_RTL8153_ECM 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 5cbbf12462..5bc55cc90b 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 -@@ -325,6 +325,7 @@ RT2X00_LIB_FIRMWARE= +@@ -315,6 +315,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= 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 227eacf49a..02b2947ebf 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 @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1306,7 +1306,6 @@ static int ieee80211_stop_ap(struct wiph +@@ -1314,7 +1314,6 @@ static int ieee80211_stop_ap(struct wiph sdata->vif.bss_conf.ftmr_params = NULL; __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 1efa336d0c..5d1823e5c6 100644 --- a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch +++ b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2487,7 +2487,7 @@ static int ieee80211_scan(struct wiphy * +@@ -2495,7 +2495,7 @@ static int ieee80211_scan(struct wiphy * * the frames sent while scanning on other channel will be * lost) */ diff --git a/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch b/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch deleted file mode 100644 index f2ebede15a..0000000000 --- a/package/kernel/mac80211/patches/subsys/387-nl80211-add-support-for-BSS-coloring.patch +++ /dev/null @@ -1,492 +0,0 @@ -From 0d2ab3aea50bb02ff0c9c3d53c7b2b4b21cdd59d Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Fri, 2 Jul 2021 19:44:07 +0200 -Subject: [PATCH] nl80211: add support for BSS coloring - -This patch adds support for BSS color collisions to the wireless subsystem. -Add the required functionality to nl80211 that will notify about color -collisions, triggering the color change and notifying when it is completed. - -Co-developed-by: Lorenzo Bianconi -Signed-off-by: Lorenzo Bianconi -Signed-off-by: John Crispin -Link: https://lore.kernel.org/r/500b3582aec8fe2c42ef46f3117b148cb7cbceb5.1625247619.git.lorenzo@kernel.org -[remove unnecessary NULL initialisation] -Signed-off-by: Johannes Berg ---- - include/net/cfg80211.h | 92 ++++++++++++++++++++ - include/uapi/linux/nl80211.h | 43 ++++++++++ - net/wireless/nl80211.c | 157 +++++++++++++++++++++++++++++++++++ - net/wireless/rdev-ops.h | 13 +++ - net/wireless/trace.h | 46 ++++++++++ - 5 files changed, 351 insertions(+) - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -1258,6 +1258,27 @@ struct cfg80211_csa_settings { - }; - - /** -+ * struct cfg80211_color_change_settings - color change settings -+ * -+ * Used for bss color change -+ * -+ * @beacon_color_change: beacon data while performing the color countdown -+ * @counter_offsets_beacon: offsets of the counters within the beacon (tail) -+ * @counter_offsets_presp: offsets of the counters within the probe response -+ * @beacon_next: beacon data to be used after the color change -+ * @count: number of beacons until the color change -+ * @color: the color used after the change -+ */ -+struct cfg80211_color_change_settings { -+ struct cfg80211_beacon_data beacon_color_change; -+ u16 counter_offset_beacon; -+ u16 counter_offset_presp; -+ struct cfg80211_beacon_data beacon_next; -+ u8 count; -+ u8 color; -+}; -+ -+/** - * struct iface_combination_params - input parameters for interface combinations - * - * Used to pass interface combination parameters -@@ -4000,6 +4021,8 @@ struct mgmt_frame_regs { - * given TIDs. This callback may sleep. - * - * @set_sar_specs: Update the SAR (TX power) settings. -+ * -+ * @color_change: Initiate a color change. - */ - struct cfg80211_ops { - int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); -@@ -4327,6 +4350,9 @@ struct cfg80211_ops { - const u8 *peer, u8 tids); - int (*set_sar_specs)(struct wiphy *wiphy, - struct cfg80211_sar_specs *sar); -+ int (*color_change)(struct wiphy *wiphy, -+ struct net_device *dev, -+ struct cfg80211_color_change_settings *params); - }; - - /* -@@ -8226,4 +8252,70 @@ void cfg80211_update_owe_info_event(stru - */ - void cfg80211_bss_flush(struct wiphy *wiphy); - -+/** -+ * cfg80211_bss_color_notify - notify about bss color event -+ * @dev: network device -+ * @gfp: allocation flags -+ * @cmd: the actual event we want to notify -+ * @count: the number of TBTTs until the color change happens -+ * @color_bitmap: representations of the colors that the local BSS is aware of -+ */ -+int cfg80211_bss_color_notify(struct net_device *dev, gfp_t gfp, -+ enum nl80211_commands cmd, u8 count, -+ u64 color_bitmap); -+ -+/** -+ * cfg80211_obss_color_collision_notify - notify about bss color collision -+ * @dev: network device -+ * @color_bitmap: representations of the colors that the local BSS is aware of -+ */ -+static inline int cfg80211_obss_color_collision_notify(struct net_device *dev, -+ u64 color_bitmap) -+{ -+ return cfg80211_bss_color_notify(dev, GFP_KERNEL, -+ NL80211_CMD_OBSS_COLOR_COLLISION, -+ 0, color_bitmap); -+} -+ -+/** -+ * cfg80211_color_change_started_notify - notify color change start -+ * @dev: the device on which the color is switched -+ * @count: the number of TBTTs until the color change happens -+ * -+ * Inform the userspace about the color change that has started. -+ */ -+static inline int cfg80211_color_change_started_notify(struct net_device *dev, -+ u8 count) -+{ -+ return cfg80211_bss_color_notify(dev, GFP_KERNEL, -+ NL80211_CMD_COLOR_CHANGE_STARTED, -+ count, 0); -+} -+ -+/** -+ * cfg80211_color_change_aborted_notify - notify color change abort -+ * @dev: the device on which the color is switched -+ * -+ * Inform the userspace about the color change that has aborted. -+ */ -+static inline int cfg80211_color_change_aborted_notify(struct net_device *dev) -+{ -+ return cfg80211_bss_color_notify(dev, GFP_KERNEL, -+ NL80211_CMD_COLOR_CHANGE_ABORTED, -+ 0, 0); -+} -+ -+/** -+ * cfg80211_color_change_notify - notify color change completion -+ * @dev: the device on which the color was switched -+ * -+ * Inform the userspace about the color change that has completed. -+ */ -+static inline int cfg80211_color_change_notify(struct net_device *dev) -+{ -+ return cfg80211_bss_color_notify(dev, GFP_KERNEL, -+ NL80211_CMD_COLOR_CHANGE_COMPLETED, -+ 0, 0); -+} -+ - #endif /* __NET_CFG80211_H */ ---- a/include/uapi/linux/nl80211.h -+++ b/include/uapi/linux/nl80211.h -@@ -1185,6 +1185,21 @@ - * passed using %NL80211_ATTR_SAR_SPEC. %NL80211_ATTR_WIPHY is used to - * specify the wiphy index to be applied to. - * -+ * @NL80211_CMD_OBSS_COLOR_COLLISION: This notification is sent out whenever -+ * mac80211/drv detects a bss color collision. -+ * -+ * @NL80211_CMD_COLOR_CHANGE_REQUEST: This command is used to indicate that -+ * userspace wants to change the BSS color. -+ * -+ * @NL80211_CMD_COLOR_CHANGE_STARTED: Notify userland, that a color change has -+ * started -+ * -+ * @NL80211_CMD_COLOR_CHANGE_ABORTED: Notify userland, that the color change has -+ * been aborted -+ * -+ * @NL80211_CMD_COLOR_CHANGE_COMPLETED: Notify userland that the color change -+ * has completed -+ * - * @NL80211_CMD_MAX: highest used command number - * @__NL80211_CMD_AFTER_LAST: internal use - */ -@@ -1417,6 +1432,14 @@ enum nl80211_commands { - - NL80211_CMD_SET_SAR_SPECS, - -+ NL80211_CMD_OBSS_COLOR_COLLISION, -+ -+ NL80211_CMD_COLOR_CHANGE_REQUEST, -+ -+ NL80211_CMD_COLOR_CHANGE_STARTED, -+ NL80211_CMD_COLOR_CHANGE_ABORTED, -+ NL80211_CMD_COLOR_CHANGE_COMPLETED, -+ - /* add new commands above here */ - - /* used to define NL80211_CMD_MAX below */ -@@ -2560,6 +2583,16 @@ enum nl80211_commands { - * disassoc events to indicate that an immediate reconnect to the AP - * is desired. - * -+ * @NL80211_ATTR_OBSS_COLOR_BITMAP: bitmap of the u64 BSS colors for the -+ * %NL80211_CMD_OBSS_COLOR_COLLISION event. -+ * -+ * @NL80211_ATTR_COLOR_CHANGE_COUNT: u8 attribute specifying the number of TBTT's -+ * until the color switch event. -+ * @NL80211_ATTR_COLOR_CHANGE_COLOR: u8 attribute specifying the color that we are -+ * switching to -+ * @NL80211_ATTR_COLOR_CHANGE_ELEMS: Nested set of attributes containing the IE -+ * information for the time while performing a color switch. -+ * - * @NUM_NL80211_ATTR: total number of nl80211_attrs available - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -3057,6 +3090,12 @@ enum nl80211_attrs { - - NL80211_ATTR_DISABLE_HE, - -+ NL80211_ATTR_OBSS_COLOR_BITMAP, -+ -+ NL80211_ATTR_COLOR_CHANGE_COUNT, -+ NL80211_ATTR_COLOR_CHANGE_COLOR, -+ NL80211_ATTR_COLOR_CHANGE_ELEMS, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, -@@ -5953,6 +5992,9 @@ enum nl80211_feature_flags { - * frame protection for all management frames exchanged during the - * negotiation and range measurement procedure. - * -+ * @NL80211_EXT_FEATURE_BSS_COLOR: The driver supports BSS color collision -+ * detection and change announcemnts. -+ * - * @NUM_NL80211_EXT_FEATURES: number of extended features. - * @MAX_NL80211_EXT_FEATURES: highest extended feature index. - */ -@@ -6017,6 +6059,7 @@ enum nl80211_ext_feature_index { - NL80211_EXT_FEATURE_SECURE_LTF, - NL80211_EXT_FEATURE_SECURE_RTT, - NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, -+ NL80211_EXT_FEATURE_BSS_COLOR, - - /* add new features before the definition below */ - NUM_NL80211_EXT_FEATURES, ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -776,6 +776,10 @@ static const struct nla_policy nl80211_p - [NL80211_ATTR_RECONNECT_REQUESTED] = { .type = NLA_REJECT }, - [NL80211_ATTR_SAR_SPEC] = NLA_POLICY_NESTED(sar_policy), - [NL80211_ATTR_DISABLE_HE] = { .type = NLA_FLAG }, -+ [NL80211_ATTR_OBSS_COLOR_BITMAP] = { .type = NLA_U64 }, -+ [NL80211_ATTR_COLOR_CHANGE_COUNT] = { .type = NLA_U8 }, -+ [NL80211_ATTR_COLOR_CHANGE_COLOR] = { .type = NLA_U8 }, -+ [NL80211_ATTR_COLOR_CHANGE_ELEMS] = NLA_POLICY_NESTED(nl80211_policy), - }; - - /* policy for the key attributes */ -@@ -14823,6 +14827,106 @@ bad_tid_conf: - return ret; - } - -+static int nl80211_color_change(struct sk_buff *skb, struct genl_info *info) -+{ -+ struct cfg80211_registered_device *rdev = info->user_ptr[0]; -+ struct cfg80211_color_change_settings params = {}; -+ struct net_device *dev = info->user_ptr[1]; -+ struct wireless_dev *wdev = dev->ieee80211_ptr; -+ struct nlattr **tb; -+ u16 offset; -+ int err; -+ -+ if (!rdev->ops->color_change) -+ return -EOPNOTSUPP; -+ -+ if (!wiphy_ext_feature_isset(&rdev->wiphy, -+ NL80211_EXT_FEATURE_BSS_COLOR)) -+ return -EOPNOTSUPP; -+ -+ if (wdev->iftype != NL80211_IFTYPE_AP) -+ return -EOPNOTSUPP; -+ -+ if (!info->attrs[NL80211_ATTR_COLOR_CHANGE_COUNT] || -+ !info->attrs[NL80211_ATTR_COLOR_CHANGE_COLOR] || -+ !info->attrs[NL80211_ATTR_COLOR_CHANGE_ELEMS]) -+ return -EINVAL; -+ -+ params.count = nla_get_u8(info->attrs[NL80211_ATTR_COLOR_CHANGE_COUNT]); -+ params.color = nla_get_u8(info->attrs[NL80211_ATTR_COLOR_CHANGE_COLOR]); -+ -+ err = nl80211_parse_beacon(rdev, info->attrs, ¶ms.beacon_next); -+ if (err) -+ return err; -+ -+ tb = kcalloc(NL80211_ATTR_MAX + 1, sizeof(*tb), GFP_KERNEL); -+ if (!tb) -+ return -ENOMEM; -+ -+ err = nla_parse_nested(tb, NL80211_ATTR_MAX, -+ info->attrs[NL80211_ATTR_COLOR_CHANGE_ELEMS], -+ nl80211_policy, info->extack); -+ if (err) -+ goto out; -+ -+ err = nl80211_parse_beacon(rdev, tb, ¶ms.beacon_color_change); -+ if (err) -+ goto out; -+ -+ if (!tb[NL80211_ATTR_CNTDWN_OFFS_BEACON]) { -+ err = -EINVAL; -+ goto out; -+ } -+ -+ if (nla_len(tb[NL80211_ATTR_CNTDWN_OFFS_BEACON]) != sizeof(u16)) { -+ err = -EINVAL; -+ goto out; -+ } -+ -+ offset = nla_get_u16(tb[NL80211_ATTR_CNTDWN_OFFS_BEACON]); -+ if (offset >= params.beacon_color_change.tail_len) { -+ err = -EINVAL; -+ goto out; -+ } -+ -+ if (params.beacon_color_change.tail[offset] != params.count) { -+ err = -EINVAL; -+ goto out; -+ } -+ -+ params.counter_offset_beacon = offset; -+ -+ if (tb[NL80211_ATTR_CNTDWN_OFFS_PRESP]) { -+ if (nla_len(tb[NL80211_ATTR_CNTDWN_OFFS_PRESP]) != -+ sizeof(u16)) { -+ err = -EINVAL; -+ goto out; -+ } -+ -+ offset = nla_get_u16(tb[NL80211_ATTR_CNTDWN_OFFS_PRESP]); -+ if (offset >= params.beacon_color_change.probe_resp_len) { -+ err = -EINVAL; -+ goto out; -+ } -+ -+ if (params.beacon_color_change.probe_resp[offset] != -+ params.count) { -+ err = -EINVAL; -+ goto out; -+ } -+ -+ params.counter_offset_presp = offset; -+ } -+ -+ wdev_lock(wdev); -+ err = rdev_color_change(rdev, dev, ¶ms); -+ wdev_unlock(wdev); -+ -+out: -+ kfree(tb); -+ return err; -+} -+ - #define NL80211_FLAG_NEED_WIPHY 0x01 - #define NL80211_FLAG_NEED_NETDEV 0x02 - #define NL80211_FLAG_NEED_RTNL 0x04 -@@ -15823,6 +15927,14 @@ static const struct genl_small_ops nl802 - .internal_flags = NL80211_FLAG_NEED_WIPHY | - NL80211_FLAG_NEED_RTNL, - }, -+ { -+ .cmd = NL80211_CMD_COLOR_CHANGE_REQUEST, -+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, -+ .doit = nl80211_color_change, -+ .flags = GENL_UNS_ADMIN_PERM, -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | -+ NL80211_FLAG_NEED_RTNL, -+ }, - }; - - static struct genl_family nl80211_fam __genl_ro_after_init = { -@@ -17454,6 +17566,51 @@ void cfg80211_ch_switch_started_notify(s - } - EXPORT_SYMBOL(cfg80211_ch_switch_started_notify); - -+int cfg80211_bss_color_notify(struct net_device *dev, gfp_t gfp, -+ enum nl80211_commands cmd, u8 count, -+ u64 color_bitmap) -+{ -+ struct wireless_dev *wdev = dev->ieee80211_ptr; -+ struct wiphy *wiphy = wdev->wiphy; -+ struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); -+ struct sk_buff *msg; -+ void *hdr; -+ -+ ASSERT_WDEV_LOCK(wdev); -+ -+ trace_cfg80211_bss_color_notify(dev, cmd, count, color_bitmap); -+ -+ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); -+ if (!msg) -+ return -ENOMEM; -+ -+ hdr = nl80211hdr_put(msg, 0, 0, 0, cmd); -+ if (!hdr) -+ goto nla_put_failure; -+ -+ if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) -+ goto nla_put_failure; -+ -+ if (cmd == NL80211_CMD_COLOR_CHANGE_STARTED && -+ nla_put_u32(msg, NL80211_ATTR_COLOR_CHANGE_COUNT, count)) -+ goto nla_put_failure; -+ -+ if (cmd == NL80211_CMD_OBSS_COLOR_COLLISION && -+ nla_put_u64_64bit(msg, NL80211_ATTR_OBSS_COLOR_BITMAP, -+ color_bitmap, NL80211_ATTR_PAD)) -+ goto nla_put_failure; -+ -+ genlmsg_end(msg, hdr); -+ -+ return genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), -+ msg, 0, NL80211_MCGRP_MLME, gfp); -+ -+nla_put_failure: -+ nlmsg_free(msg); -+ return -EINVAL; -+} -+EXPORT_SYMBOL(cfg80211_bss_color_notify); -+ - void - nl80211_radar_notify(struct cfg80211_registered_device *rdev, - const struct cfg80211_chan_def *chandef, ---- a/net/wireless/rdev-ops.h -+++ b/net/wireless/rdev-ops.h -@@ -1368,4 +1368,17 @@ static inline int rdev_set_sar_specs(str - return ret; - } - -+static inline int rdev_color_change(struct cfg80211_registered_device *rdev, -+ struct net_device *dev, -+ struct cfg80211_color_change_settings *params) -+{ -+ int ret; -+ -+ trace_rdev_color_change(&rdev->wiphy, dev, params); -+ ret = rdev->ops->color_change(&rdev->wiphy, dev, params); -+ trace_rdev_return_int(&rdev->wiphy, ret); -+ -+ return ret; -+} -+ - #endif /* __CFG80211_RDEV_OPS */ ---- a/net/wireless/trace.h -+++ b/net/wireless/trace.h -@@ -3597,6 +3597,52 @@ TRACE_EVENT(rdev_set_sar_specs, - WIPHY_PR_ARG, __entry->type, __entry->num) - ); - -+TRACE_EVENT(rdev_color_change, -+ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, -+ struct cfg80211_color_change_settings *params), -+ TP_ARGS(wiphy, netdev, params), -+ TP_STRUCT__entry( -+ WIPHY_ENTRY -+ NETDEV_ENTRY -+ __field(u8, count) -+ __field(u16, bcn_ofs) -+ __field(u16, pres_ofs) -+ ), -+ TP_fast_assign( -+ WIPHY_ASSIGN; -+ NETDEV_ASSIGN; -+ __entry->count = params->count; -+ __entry->bcn_ofs = params->counter_offset_beacon; -+ __entry->pres_ofs = params->counter_offset_presp; -+ ), -+ TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT -+ ", count: %u", -+ WIPHY_PR_ARG, NETDEV_PR_ARG, -+ __entry->count) -+); -+ -+TRACE_EVENT(cfg80211_bss_color_notify, -+ TP_PROTO(struct net_device *netdev, -+ enum nl80211_commands cmd, -+ u8 count, u64 color_bitmap), -+ TP_ARGS(netdev, cmd, count, color_bitmap), -+ TP_STRUCT__entry( -+ NETDEV_ENTRY -+ __field(enum nl80211_bss_scan_width, cmd) -+ __field(u8, count) -+ __field(u64, color_bitmap) -+ ), -+ TP_fast_assign( -+ NETDEV_ASSIGN; -+ __entry->cmd = cmd; -+ __entry->count = count; -+ __entry->color_bitmap = color_bitmap; -+ ), -+ TP_printk(NETDEV_PR_FMT ", cmd: %x, count: %u, bitmap: %llx", -+ NETDEV_PR_ARG, __entry->cmd, __entry->count, -+ __entry->color_bitmap) -+); -+ - #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ - - #undef TRACE_INCLUDE_PATH diff --git a/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch b/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch deleted file mode 100644 index 196c8e10af..0000000000 --- a/package/kernel/mac80211/patches/subsys/388-mac80211-add-support-for-BSS-color-change.patch +++ /dev/null @@ -1,524 +0,0 @@ -From: John Crispin -Date: Fri, 2 Jul 2021 19:44:08 +0200 -Subject: [PATCH] mac80211: add support for BSS color change - -The color change announcement is very similar to how CSA works where -we have an IE that includes a counter. When the counter hits 0, the new -color is applied via an updated beacon. - -This patch makes the CSA counter functionality reusable, rather than -implementing it again. This also allows for future reuse incase support -for other counter IEs gets added. - -Co-developed-by: Lorenzo Bianconi -Signed-off-by: Lorenzo Bianconi -Signed-off-by: John Crispin -Link: https://lore.kernel.org/r/057c1e67b82bee561ea44ce6a45a8462d3da6995.1625247619.git.lorenzo@kernel.org -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -1715,6 +1715,10 @@ enum ieee80211_offload_flags { - * protected by fq->lock. - * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see - * &enum ieee80211_offload_flags. -+ * @color_change_active: marks whether a color change is ongoing. Internally it is -+ * 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. - */ - struct ieee80211_vif { - enum nl80211_iftype type; -@@ -1743,6 +1747,9 @@ struct ieee80211_vif { - - bool txqs_stopped[IEEE80211_NUM_ACS]; - -+ bool color_change_active; -+ u8 color_change_color; -+ - /* must be last */ - u8 drv_priv[] __aligned(sizeof(void *)); - }; -@@ -5016,6 +5023,16 @@ void ieee80211_csa_finish(struct ieee802 - bool ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif); - - /** -+ * ieee80211_color_change_finish - notify mac80211 about color change -+ * @vif: &struct ieee80211_vif pointer from the add_interface callback. -+ * -+ * After a color change announcement was scheduled and the counter in this -+ * announcement hits 1, this function must be called by the driver to -+ * notify mac80211 that the color can be changed -+ */ -+void ieee80211_color_change_finish(struct ieee80211_vif *vif); -+ -+/** - * ieee80211_proberesp_get - retrieve a Probe Response template - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. -@@ -6780,6 +6797,18 @@ ieee80211_get_unsol_bcast_probe_resp_tmp - struct ieee80211_vif *vif); - - /** -+ * ieeee80211_obss_color_collision_notify - notify userland about a BSS color -+ * collision. -+ * -+ * @vif: &struct ieee80211_vif pointer from the add_interface callback. -+ * @color_bitmap: a 64 bit bitmap representing the colors that the local BSS is -+ * aware of. -+ */ -+void -+ieeee80211_obss_color_collision_notify(struct ieee80211_vif *vif, -+ u64 color_bitmap); -+ -+/** - * ieee80211_is_tx_data - check if frame is a data frame - * - * The function is used to check if a frame is a data frame. Frames with ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -828,9 +828,11 @@ static int ieee80211_set_monitor_channel - return ret; - } - --static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, -- const u8 *resp, size_t resp_len, -- const struct ieee80211_csa_settings *csa) -+static int -+ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, -+ const u8 *resp, size_t resp_len, -+ const struct ieee80211_csa_settings *csa, -+ const struct ieee80211_color_change_settings *cca) - { - struct probe_resp *new, *old; - -@@ -850,6 +852,8 @@ static int ieee80211_set_probe_resp(stru - memcpy(new->cntdwn_counter_offsets, csa->counter_offsets_presp, - csa->n_counter_offsets_presp * - sizeof(new->cntdwn_counter_offsets[0])); -+ else if (cca) -+ new->cntdwn_counter_offsets[0] = cca->counter_offset_presp; - - rcu_assign_pointer(sdata->u.ap.probe_resp, new); - if (old) -@@ -955,7 +959,8 @@ static int ieee80211_set_ftm_responder_p - - static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, - struct cfg80211_beacon_data *params, -- const struct ieee80211_csa_settings *csa) -+ const struct ieee80211_csa_settings *csa, -+ const struct ieee80211_color_change_settings *cca) - { - struct beacon_data *new, *old; - int new_head_len, new_tail_len; -@@ -1004,6 +1009,9 @@ static int ieee80211_assign_beacon(struc - memcpy(new->cntdwn_counter_offsets, csa->counter_offsets_beacon, - csa->n_counter_offsets_beacon * - sizeof(new->cntdwn_counter_offsets[0])); -+ } else if (cca) { -+ new->cntdwn_current_counter = cca->count; -+ new->cntdwn_counter_offsets[0] = cca->counter_offset_beacon; - } - - /* copy in head */ -@@ -1020,7 +1028,7 @@ static int ieee80211_assign_beacon(struc - memcpy(new->tail, old->tail, new_tail_len); - - err = ieee80211_set_probe_resp(sdata, params->probe_resp, -- params->probe_resp_len, csa); -+ params->probe_resp_len, csa, cca); - if (err < 0) { - kfree(new); - return err; -@@ -1175,7 +1183,7 @@ static int ieee80211_start_ap(struct wip - if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) - sdata->vif.bss_conf.beacon_tx_rate = params->beacon_rate; - -- err = ieee80211_assign_beacon(sdata, ¶ms->beacon, NULL); -+ err = ieee80211_assign_beacon(sdata, ¶ms->beacon, NULL, NULL); - if (err < 0) - goto error; - changed |= err; -@@ -1230,17 +1238,17 @@ static int ieee80211_change_beacon(struc - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - sdata_assert_lock(sdata); - -- /* don't allow changing the beacon while CSA is in place - offset -+ /* don't allow changing the beacon while a countdown is in place - offset - * of channel switch counter may change - */ -- if (sdata->vif.csa_active) -+ if (sdata->vif.csa_active || sdata->vif.color_change_active) - return -EBUSY; - - old = sdata_dereference(sdata->u.ap.beacon, sdata); - if (!old) - return -ENOENT; - -- err = ieee80211_assign_beacon(sdata, params, NULL); -+ err = ieee80211_assign_beacon(sdata, params, NULL, NULL); - if (err < 0) - return err; - ieee80211_bss_info_change_notify(sdata, err); -@@ -3155,7 +3163,7 @@ static int ieee80211_set_after_csa_beaco - switch (sdata->vif.type) { - case NL80211_IFTYPE_AP: - err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon, -- NULL); -+ NULL, NULL); - kfree(sdata->u.ap.next_beacon); - sdata->u.ap.next_beacon = NULL; - -@@ -3321,7 +3329,7 @@ static int ieee80211_set_csa_beacon(stru - csa.n_counter_offsets_presp = params->n_counter_offsets_presp; - csa.count = params->count; - -- err = ieee80211_assign_beacon(sdata, ¶ms->beacon_csa, &csa); -+ err = ieee80211_assign_beacon(sdata, ¶ms->beacon_csa, &csa, NULL); - if (err < 0) { - kfree(sdata->u.ap.next_beacon); - return err; -@@ -3410,6 +3418,15 @@ static int ieee80211_set_csa_beacon(stru - return 0; - } - -+static void ieee80211_color_change_abort(struct ieee80211_sub_if_data *sdata) -+{ -+ sdata->vif.color_change_active = false; -+ kfree(sdata->u.ap.next_beacon); -+ sdata->u.ap.next_beacon = NULL; -+ -+ cfg80211_color_change_aborted_notify(sdata->dev); -+} -+ - static int - __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_csa_settings *params) -@@ -3478,6 +3495,10 @@ __ieee80211_channel_switch(struct wiphy - goto out; - } - -+ /* if there is a color change in progress, abort it */ -+ if (sdata->vif.color_change_active) -+ ieee80211_color_change_abort(sdata); -+ - err = ieee80211_set_csa_beacon(sdata, params, &changed); - if (err) { - ieee80211_vif_unreserve_chanctx(sdata); -@@ -4129,6 +4150,196 @@ static int ieee80211_set_sar_specs(struc - return local->ops->set_sar_specs(&local->hw, sar); - } - -+static int -+ieee80211_set_after_color_change_beacon(struct ieee80211_sub_if_data *sdata, -+ u32 *changed) -+{ -+ switch (sdata->vif.type) { -+ case NL80211_IFTYPE_AP: { -+ int ret; -+ -+ ret = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon, -+ NULL, NULL); -+ kfree(sdata->u.ap.next_beacon); -+ sdata->u.ap.next_beacon = NULL; -+ -+ if (ret < 0) -+ return ret; -+ -+ *changed |= ret; -+ break; -+ } -+ default: -+ WARN_ON_ONCE(1); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int -+ieee80211_set_color_change_beacon(struct ieee80211_sub_if_data *sdata, -+ struct cfg80211_color_change_settings *params, -+ u32 *changed) -+{ -+ struct ieee80211_color_change_settings color_change = {}; -+ int err; -+ -+ switch (sdata->vif.type) { -+ case NL80211_IFTYPE_AP: -+ sdata->u.ap.next_beacon = -+ cfg80211_beacon_dup(¶ms->beacon_next); -+ if (!sdata->u.ap.next_beacon) -+ return -ENOMEM; -+ -+ if (params->count <= 1) -+ break; -+ -+ color_change.counter_offset_beacon = -+ params->counter_offset_beacon; -+ color_change.counter_offset_presp = -+ params->counter_offset_presp; -+ color_change.count = params->count; -+ -+ err = ieee80211_assign_beacon(sdata, ¶ms->beacon_color_change, -+ NULL, &color_change); -+ if (err < 0) { -+ kfree(sdata->u.ap.next_beacon); -+ return err; -+ } -+ *changed |= err; -+ break; -+ default: -+ return -EOPNOTSUPP; -+ } -+ -+ return 0; -+} -+ -+static void -+ieee80211_color_change_bss_config_notify(struct ieee80211_sub_if_data *sdata, -+ u8 color, int enable, u32 changed) -+{ -+ sdata->vif.bss_conf.he_bss_color.color = color; -+ sdata->vif.bss_conf.he_bss_color.enabled = enable; -+ changed |= BSS_CHANGED_HE_BSS_COLOR; -+ -+ ieee80211_bss_info_change_notify(sdata, changed); -+} -+ -+static int ieee80211_color_change_finalize(struct ieee80211_sub_if_data *sdata) -+{ -+ struct ieee80211_local *local = sdata->local; -+ u32 changed = 0; -+ int err; -+ -+ sdata_assert_lock(sdata); -+ lockdep_assert_held(&local->mtx); -+ -+ sdata->vif.color_change_active = false; -+ -+ err = ieee80211_set_after_color_change_beacon(sdata, &changed); -+ if (err) { -+ cfg80211_color_change_aborted_notify(sdata->dev); -+ return err; -+ } -+ -+ ieee80211_color_change_bss_config_notify(sdata, -+ sdata->vif.color_change_color, -+ 1, changed); -+ cfg80211_color_change_notify(sdata->dev); -+ -+ return 0; -+} -+ -+void ieee80211_color_change_finalize_work(struct work_struct *work) -+{ -+ struct ieee80211_sub_if_data *sdata = -+ container_of(work, struct ieee80211_sub_if_data, -+ color_change_finalize_work); -+ struct ieee80211_local *local = sdata->local; -+ -+ sdata_lock(sdata); -+ mutex_lock(&local->mtx); -+ -+ /* AP might have been stopped while waiting for the lock. */ -+ if (!sdata->vif.color_change_active) -+ goto unlock; -+ -+ if (!ieee80211_sdata_running(sdata)) -+ goto unlock; -+ -+ ieee80211_color_change_finalize(sdata); -+ -+unlock: -+ mutex_unlock(&local->mtx); -+ sdata_unlock(sdata); -+} -+ -+void ieee80211_color_change_finish(struct ieee80211_vif *vif) -+{ -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); -+ -+ ieee80211_queue_work(&sdata->local->hw, -+ &sdata->color_change_finalize_work); -+} -+EXPORT_SYMBOL_GPL(ieee80211_color_change_finish); -+ -+void -+ieeee80211_obss_color_collision_notify(struct ieee80211_vif *vif, -+ u64 color_bitmap) -+{ -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); -+ -+ if (sdata->vif.color_change_active || sdata->vif.csa_active) -+ return; -+ -+ cfg80211_obss_color_collision_notify(sdata->dev, color_bitmap); -+} -+EXPORT_SYMBOL_GPL(ieeee80211_obss_color_collision_notify); -+ -+static int -+ieee80211_color_change(struct wiphy *wiphy, struct net_device *dev, -+ struct cfg80211_color_change_settings *params) -+{ -+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); -+ struct ieee80211_local *local = sdata->local; -+ u32 changed = 0; -+ int err; -+ -+ sdata_assert_lock(sdata); -+ -+ mutex_lock(&local->mtx); -+ -+ /* don't allow another color change if one is already active or if csa -+ * is active -+ */ -+ if (sdata->vif.color_change_active || sdata->vif.csa_active) { -+ err = -EBUSY; -+ goto out; -+ } -+ -+ err = ieee80211_set_color_change_beacon(sdata, params, &changed); -+ if (err) -+ goto out; -+ -+ sdata->vif.color_change_active = true; -+ sdata->vif.color_change_color = params->color; -+ -+ cfg80211_color_change_started_notify(sdata->dev, params->count); -+ -+ if (changed) -+ ieee80211_color_change_bss_config_notify(sdata, 0, 0, changed); -+ else -+ /* if the beacon didn't change, we can finalize immediately */ -+ ieee80211_color_change_finalize(sdata); -+ -+out: -+ mutex_unlock(&local->mtx); -+ -+ return err; -+} -+ - const struct cfg80211_ops mac80211_config_ops = { - .add_virtual_intf = ieee80211_add_iface, - .del_virtual_intf = ieee80211_del_iface, -@@ -4232,4 +4443,5 @@ const struct cfg80211_ops mac80211_confi - .set_tid_config = ieee80211_set_tid_config, - .reset_tid_config = ieee80211_reset_tid_config, - .set_sar_specs = ieee80211_set_sar_specs, -+ .color_change = ieee80211_color_change, - }; ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -248,6 +248,12 @@ struct ieee80211_csa_settings { - u8 count; - }; - -+struct ieee80211_color_change_settings { -+ u16 counter_offset_beacon; -+ u16 counter_offset_presp; -+ u8 count; -+}; -+ - struct beacon_data { - u8 *head, *tail; - int head_len, tail_len; -@@ -927,6 +933,8 @@ struct ieee80211_sub_if_data { - bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */ - struct cfg80211_chan_def csa_chandef; - -+ struct work_struct color_change_finalize_work; -+ - struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */ - struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */ - -@@ -1891,6 +1899,9 @@ void ieee80211_csa_finalize_work(struct - int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_csa_settings *params); - -+/* color change handling */ -+void ieee80211_color_change_finalize_work(struct work_struct *work); -+ - /* interface handling */ - #define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \ - NETIF_F_HW_CSUM | NETIF_F_SG | \ ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -462,6 +462,7 @@ static void ieee80211_do_stop(struct iee - sdata_unlock(sdata); - - cancel_work_sync(&sdata->csa_finalize_work); -+ cancel_work_sync(&sdata->color_change_finalize_work); - - cancel_delayed_work_sync(&sdata->dfs_cac_timer_work); - -@@ -1608,6 +1609,7 @@ static void ieee80211_setup_sdata(struct - INIT_WORK(&sdata->work, ieee80211_iface_work); - INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work); - INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); -+ INIT_WORK(&sdata->color_change_finalize_work, ieee80211_color_change_finalize_work); - INIT_LIST_HEAD(&sdata->assigned_chanctx_list); - INIT_LIST_HEAD(&sdata->reserved_chanctx_list); - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -4796,11 +4796,11 @@ static int ieee80211_beacon_add_tim(stru - static void ieee80211_set_beacon_cntdwn(struct ieee80211_sub_if_data *sdata, - struct beacon_data *beacon) - { -+ u8 *beacon_data, count, max_count = 1; - struct probe_resp *resp; -- u8 *beacon_data; - size_t beacon_data_len; -+ u16 *bcn_offsets; - int i; -- u8 count = beacon->cntdwn_current_counter; - - switch (sdata->vif.type) { - case NL80211_IFTYPE_AP: -@@ -4820,21 +4820,27 @@ static void ieee80211_set_beacon_cntdwn( - } - - rcu_read_lock(); -- for (i = 0; i < IEEE80211_MAX_CNTDWN_COUNTERS_NUM; ++i) { -- resp = rcu_dereference(sdata->u.ap.probe_resp); -+ resp = rcu_dereference(sdata->u.ap.probe_resp); - -- if (beacon->cntdwn_counter_offsets[i]) { -- if (WARN_ON_ONCE(beacon->cntdwn_counter_offsets[i] >= -- beacon_data_len)) { -+ bcn_offsets = beacon->cntdwn_counter_offsets; -+ count = beacon->cntdwn_current_counter; -+ if (sdata->vif.csa_active) -+ max_count = IEEE80211_MAX_CNTDWN_COUNTERS_NUM; -+ -+ for (i = 0; i < max_count; ++i) { -+ if (bcn_offsets[i]) { -+ if (WARN_ON_ONCE(bcn_offsets[i] >= beacon_data_len)) { - rcu_read_unlock(); - return; - } -- -- beacon_data[beacon->cntdwn_counter_offsets[i]] = count; -+ beacon_data[bcn_offsets[i]] = count; - } - -- if (sdata->vif.type == NL80211_IFTYPE_AP && resp) -- resp->data[resp->cntdwn_counter_offsets[i]] = count; -+ if (sdata->vif.type == NL80211_IFTYPE_AP && resp) { -+ u16 *resp_offsets = resp->cntdwn_counter_offsets; -+ -+ resp->data[resp_offsets[i]] = count; -+ } - } - rcu_read_unlock(); - } -@@ -5044,6 +5050,7 @@ __ieee80211_beacon_get(struct ieee80211_ - if (offs) { - offs->tim_offset = beacon->head_len; - offs->tim_length = skb->len - beacon->head_len; -+ offs->cntdwn_counter_offs[0] = beacon->cntdwn_counter_offsets[0]; - - /* for AP the csa offsets are from tail */ - csa_off_base = skb->len; diff --git a/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch b/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch deleted file mode 100644 index 6bb7dd7df4..0000000000 --- a/package/kernel/mac80211/patches/subsys/389-ieee80211-add-TWT-element-definitions.patch +++ /dev/null @@ -1,112 +0,0 @@ -From: Lorenzo Bianconi -Date: Mon, 23 Aug 2021 20:02:38 +0200 -Subject: [PATCH] ieee80211: add TWT element definitions - -Introduce TWT definitions and TWT Information element structure -in ieee80211.h - -Tested-by: Peter Chiu -Signed-off-by: Lorenzo Bianconi -Link: https://lore.kernel.org/r/71d8b581fe4b5abc5b92f8d77ac2de3e2f7591b6.1629741512.git.lorenzo@kernel.org -Signed-off-by: Johannes Berg ---- - ---- a/include/linux/ieee80211.h -+++ b/include/linux/ieee80211.h -@@ -1088,6 +1088,48 @@ struct ieee80211_ext { - } u; - } __packed __aligned(2); - -+#define IEEE80211_TWT_CONTROL_NDP BIT(0) -+#define IEEE80211_TWT_CONTROL_RESP_MODE BIT(1) -+#define IEEE80211_TWT_CONTROL_NEG_TYPE_BROADCAST BIT(3) -+#define IEEE80211_TWT_CONTROL_RX_DISABLED BIT(4) -+#define IEEE80211_TWT_CONTROL_WAKE_DUR_UNIT BIT(5) -+ -+#define IEEE80211_TWT_REQTYPE_REQUEST BIT(0) -+#define IEEE80211_TWT_REQTYPE_SETUP_CMD GENMASK(3, 1) -+#define IEEE80211_TWT_REQTYPE_TRIGGER BIT(4) -+#define IEEE80211_TWT_REQTYPE_IMPLICIT BIT(5) -+#define IEEE80211_TWT_REQTYPE_FLOWTYPE BIT(6) -+#define IEEE80211_TWT_REQTYPE_FLOWID GENMASK(9, 7) -+#define IEEE80211_TWT_REQTYPE_WAKE_INT_EXP GENMASK(14, 10) -+#define IEEE80211_TWT_REQTYPE_PROTECTION BIT(15) -+ -+enum ieee80211_twt_setup_cmd { -+ TWT_SETUP_CMD_REQUEST, -+ TWT_SETUP_CMD_SUGGEST, -+ TWT_SETUP_CMD_DEMAND, -+ TWT_SETUP_CMD_GROUPING, -+ TWT_SETUP_CMD_ACCEPT, -+ TWT_SETUP_CMD_ALTERNATE, -+ TWT_SETUP_CMD_DICTATE, -+ TWT_SETUP_CMD_REJECT, -+}; -+ -+struct ieee80211_twt_params { -+ __le16 req_type; -+ __le64 twt; -+ u8 min_twt_dur; -+ __le16 mantissa; -+ u8 channel; -+} __packed; -+ -+struct ieee80211_twt_setup { -+ u8 dialog_token; -+ u8 element_id; -+ u8 length; -+ u8 control; -+ u8 params[]; -+} __packed; -+ - struct ieee80211_mgmt { - __le16 frame_control; - __le16 duration; -@@ -1252,6 +1294,10 @@ struct ieee80211_mgmt { - __le16 toa_error; - u8 variable[0]; - } __packed ftm; -+ struct { -+ u8 action_code; -+ u8 variable[]; -+ } __packed s1g; - } u; - } __packed action; - } u; -@@ -2881,6 +2927,7 @@ enum ieee80211_eid { - WLAN_EID_AID_RESPONSE = 211, - WLAN_EID_S1G_BCN_COMPAT = 213, - WLAN_EID_S1G_SHORT_BCN_INTERVAL = 214, -+ WLAN_EID_S1G_TWT = 216, - WLAN_EID_S1G_CAPABILITIES = 217, - WLAN_EID_VENDOR_SPECIFIC = 221, - WLAN_EID_QOS_PARAMETER = 222, -@@ -2950,6 +2997,7 @@ enum ieee80211_category { - WLAN_CATEGORY_FST = 18, - WLAN_CATEGORY_UNPROT_DMG = 20, - WLAN_CATEGORY_VHT = 21, -+ WLAN_CATEGORY_S1G = 22, - WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, - WLAN_CATEGORY_VENDOR_SPECIFIC = 127, - }; -@@ -3023,6 +3071,20 @@ enum ieee80211_key_len { - WLAN_KEY_LEN_BIP_GMAC_256 = 32, - }; - -+enum ieee80211_s1g_actioncode { -+ WLAN_S1G_AID_SWITCH_REQUEST, -+ WLAN_S1G_AID_SWITCH_RESPONSE, -+ WLAN_S1G_SYNC_CONTROL, -+ WLAN_S1G_STA_INFO_ANNOUNCE, -+ WLAN_S1G_EDCA_PARAM_SET, -+ WLAN_S1G_EL_OPERATION, -+ WLAN_S1G_TWT_SETUP, -+ WLAN_S1G_TWT_TEARDOWN, -+ WLAN_S1G_SECT_GROUP_ID_LIST, -+ WLAN_S1G_SECT_ID_FEEDBACK, -+ WLAN_S1G_TWT_INFORMATION = 11, -+}; -+ - #define IEEE80211_WEP_IV_LEN 4 - #define IEEE80211_WEP_ICV_LEN 4 - #define IEEE80211_CCMP_HDR_LEN 8 diff --git a/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch deleted file mode 100644 index f0f864c7e7..0000000000 --- a/package/kernel/mac80211/patches/subsys/390-mac80211-introduce-individual-TWT-support-in-AP-mode.patch +++ /dev/null @@ -1,604 +0,0 @@ -From f5a4c24e689f54e66201f04d343bdd2e8a1d7923 Mon Sep 17 00:00:00 2001 -From: Lorenzo Bianconi -Date: Mon, 23 Aug 2021 20:02:39 +0200 -Subject: [PATCH] mac80211: introduce individual TWT support in AP mode - -Introduce TWT action frames parsing support to mac80211. -Currently just individual TWT agreement are support in AP mode. -Whenever the AP receives a TWT action frame from an associated client, -after performing sanity checks, it will notify the underlay driver with -requested parameters in order to check if they are supported and if there -is enough room for a new agreement. The driver is expected to set the -agreement result and report it to mac80211. - -Drivers supporting this have two new callbacks: - - add_twt_setup (mandatory) - - twt_teardown_request (optional) - -mac80211 will send an action frame reply according to the result -reported by the driver. - -Tested-by: Peter Chiu -Signed-off-by: Lorenzo Bianconi -Link: https://lore.kernel.org/r/257512f2e22ba42b9f2624942a128dd8f141de4b.1629741512.git.lorenzo@kernel.org -[use le16p_replace_bits(), minor cleanups, use (void *) casts, - fix to use ieee80211_get_he_iftype_cap() correctly] -Signed-off-by: Johannes Berg ---- - include/net/mac80211.h | 12 +++ - net/mac80211/driver-ops.h | 36 ++++++++ - net/mac80211/ieee80211_i.h | 6 ++ - net/mac80211/iface.c | 41 +++++++++ - net/mac80211/rx.c | 73 +++++++++++++++ - net/mac80211/s1g.c | 180 +++++++++++++++++++++++++++++++++++++ - net/mac80211/status.c | 17 +++- - net/mac80211/trace.h | 67 ++++++++++++++ - 8 files changed, 430 insertions(+), 2 deletions(-) - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -3930,6 +3930,13 @@ struct ieee80211_prep_tx_info { - * @set_sar_specs: Update the SAR (TX power) settings. - * @sta_set_decap_offload: Called to notify the driver when a station is allowed - * to use rx decapsulation offload -+ * @add_twt_setup: Update hw with TWT agreement parameters received from the peer. -+ * This callback allows the hw to check if requested parameters -+ * are supported and if there is enough room for a new agreement. -+ * The hw is expected to set agreement result in the req_type field of -+ * twt structure. -+ * @twt_teardown_request: Update the hw with TWT teardown request received -+ * from the peer. - */ - struct ieee80211_ops { - void (*tx)(struct ieee80211_hw *hw, -@@ -4253,6 +4260,11 @@ struct ieee80211_ops { - void (*sta_set_decap_offload)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, bool enabled); -+ void (*add_twt_setup)(struct ieee80211_hw *hw, -+ struct ieee80211_sta *sta, -+ struct ieee80211_twt_setup *twt); -+ void (*twt_teardown_request)(struct ieee80211_hw *hw, -+ struct ieee80211_sta *sta, u8 flowid); - }; - - /** ---- a/net/mac80211/driver-ops.h -+++ b/net/mac80211/driver-ops.h -@@ -1447,4 +1447,40 @@ static inline void drv_sta_set_decap_off - trace_drv_return_void(local); - } - -+static inline void drv_add_twt_setup(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_sta *sta, -+ struct ieee80211_twt_setup *twt) -+{ -+ struct ieee80211_twt_params *twt_agrt; -+ -+ might_sleep(); -+ -+ if (!check_sdata_in_driver(sdata)) -+ return; -+ -+ twt_agrt = (void *)twt->params; -+ -+ trace_drv_add_twt_setup(local, sta, twt, twt_agrt); -+ local->ops->add_twt_setup(&local->hw, sta, twt); -+ trace_drv_return_void(local); -+} -+ -+static inline void drv_twt_teardown_request(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_sta *sta, -+ u8 flowid) -+{ -+ might_sleep(); -+ if (!check_sdata_in_driver(sdata)) -+ return; -+ -+ if (!local->ops->twt_teardown_request) -+ return; -+ -+ trace_drv_twt_teardown_request(local, sta, flowid); -+ local->ops->twt_teardown_request(&local->hw, sta, flowid); -+ trace_drv_return_void(local); -+} -+ - #endif /* __MAC80211_DRIVER_OPS */ ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -949,6 +949,7 @@ struct ieee80211_sub_if_data { - - struct work_struct work; - struct sk_buff_head skb_queue; -+ struct sk_buff_head status_queue; - - u8 needed_rx_chains; - enum ieee80211_smps_mode smps_mode; -@@ -2083,6 +2084,11 @@ ieee80211_he_op_ie_to_bss_conf(struct ie - - /* S1G */ - void ieee80211_s1g_sta_rate_init(struct sta_info *sta); -+bool ieee80211_s1g_is_twt_setup(struct sk_buff *skb); -+void ieee80211_s1g_rx_twt_action(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb); -+void ieee80211_s1g_status_twt_action(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb); - - /* Spectrum management */ - void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -552,6 +552,7 @@ static void ieee80211_do_stop(struct iee - */ - ieee80211_free_keys(sdata, true); - skb_queue_purge(&sdata->skb_queue); -+ skb_queue_purge(&sdata->status_queue); - } - - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); -@@ -1055,6 +1056,7 @@ int ieee80211_add_virtual_monitor(struct - } - - skb_queue_head_init(&sdata->skb_queue); -+ skb_queue_head_init(&sdata->status_queue); - INIT_WORK(&sdata->work, ieee80211_iface_work); - - return 0; -@@ -1459,6 +1461,16 @@ static void ieee80211_iface_process_skb( - WARN_ON(1); - break; - } -+ } else if (ieee80211_is_action(mgmt->frame_control) && -+ mgmt->u.action.category == WLAN_CATEGORY_S1G) { -+ switch (mgmt->u.action.u.s1g.action_code) { -+ case WLAN_S1G_TWT_TEARDOWN: -+ case WLAN_S1G_TWT_SETUP: -+ ieee80211_s1g_rx_twt_action(sdata, skb); -+ break; -+ default: -+ break; -+ } - } else if (ieee80211_is_ext(mgmt->frame_control)) { - if (sdata->vif.type == NL80211_IFTYPE_STATION) - ieee80211_sta_rx_queued_ext(sdata, skb); -@@ -1514,6 +1526,24 @@ static void ieee80211_iface_process_skb( - } - } - -+static void ieee80211_iface_process_status(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb) -+{ -+ struct ieee80211_mgmt *mgmt = (void *)skb->data; -+ -+ if (ieee80211_is_action(mgmt->frame_control) && -+ mgmt->u.action.category == WLAN_CATEGORY_S1G) { -+ switch (mgmt->u.action.u.s1g.action_code) { -+ case WLAN_S1G_TWT_TEARDOWN: -+ case WLAN_S1G_TWT_SETUP: -+ ieee80211_s1g_status_twt_action(sdata, skb); -+ break; -+ default: -+ break; -+ } -+ } -+} -+ - static void ieee80211_iface_work(struct work_struct *work) - { - struct ieee80211_sub_if_data *sdata = -@@ -1543,6 +1573,16 @@ static void ieee80211_iface_work(struct - kcov_remote_stop(); - } - -+ /* process status queue */ -+ while ((skb = skb_dequeue(&sdata->status_queue))) { -+ kcov_remote_start_common(skb_get_kcov_handle(skb)); -+ -+ ieee80211_iface_process_status(sdata, skb); -+ kfree_skb(skb); -+ -+ kcov_remote_stop(); -+ } -+ - /* then other type-dependent work */ - switch (sdata->vif.type) { - case NL80211_IFTYPE_STATION: -@@ -1606,6 +1646,7 @@ static void ieee80211_setup_sdata(struct - } - - skb_queue_head_init(&sdata->skb_queue); -+ skb_queue_head_init(&sdata->status_queue); - INIT_WORK(&sdata->work, ieee80211_iface_work); - INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work); - INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -3211,6 +3211,68 @@ ieee80211_rx_h_mgmt_check(struct ieee802 - return RX_CONTINUE; - } - -+static bool -+ieee80211_process_rx_twt_action(struct ieee80211_rx_data *rx) -+{ -+ struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)rx->skb->data; -+ struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); -+ struct ieee80211_sub_if_data *sdata = rx->sdata; -+ const struct ieee80211_sta_he_cap *hecap; -+ struct ieee80211_supported_band *sband; -+ -+ /* TWT actions are only supported in AP for the moment */ -+ if (sdata->vif.type != NL80211_IFTYPE_AP) -+ return false; -+ -+ if (!rx->local->ops->add_twt_setup) -+ return false; -+ -+ sband = rx->local->hw.wiphy->bands[status->band]; -+ hecap = ieee80211_get_he_iftype_cap(sband, -+ ieee80211_vif_type_p2p(&sdata->vif)); -+ if (!hecap) -+ return false; -+ -+ if (!(hecap->he_cap_elem.mac_cap_info[0] & -+ IEEE80211_HE_MAC_CAP0_TWT_RES)) -+ return false; -+ -+ if (!rx->sta) -+ return false; -+ -+ switch (mgmt->u.action.u.s1g.action_code) { -+ case WLAN_S1G_TWT_SETUP: { -+ struct ieee80211_twt_setup *twt; -+ -+ if (rx->skb->len < IEEE80211_MIN_ACTION_SIZE + -+ 1 + /* action code */ -+ sizeof(struct ieee80211_twt_setup) + -+ 2 /* TWT req_type agrt */) -+ break; -+ -+ twt = (void *)mgmt->u.action.u.s1g.variable; -+ if (twt->element_id != WLAN_EID_S1G_TWT) -+ break; -+ -+ if (rx->skb->len < IEEE80211_MIN_ACTION_SIZE + -+ 4 + /* action code + token + tlv */ -+ twt->length) -+ break; -+ -+ return true; /* queue the frame */ -+ } -+ case WLAN_S1G_TWT_TEARDOWN: -+ if (rx->skb->len < IEEE80211_MIN_ACTION_SIZE + 2) -+ break; -+ -+ return true; /* queue the frame */ -+ default: -+ break; -+ } -+ -+ return false; -+} -+ - static ieee80211_rx_result debug_noinline - ieee80211_rx_h_action(struct ieee80211_rx_data *rx) - { -@@ -3490,6 +3552,17 @@ ieee80211_rx_h_action(struct ieee80211_r - !mesh_path_sel_is_hwmp(sdata)) - break; - goto queue; -+ case WLAN_CATEGORY_S1G: -+ switch (mgmt->u.action.u.s1g.action_code) { -+ case WLAN_S1G_TWT_SETUP: -+ case WLAN_S1G_TWT_TEARDOWN: -+ if (ieee80211_process_rx_twt_action(rx)) -+ goto queue; -+ break; -+ default: -+ break; -+ } -+ break; - } - - return RX_CONTINUE; ---- a/net/mac80211/s1g.c -+++ b/net/mac80211/s1g.c -@@ -6,6 +6,7 @@ - #include - #include - #include "ieee80211_i.h" -+#include "driver-ops.h" - - void ieee80211_s1g_sta_rate_init(struct sta_info *sta) - { -@@ -14,3 +15,182 @@ void ieee80211_s1g_sta_rate_init(struct - sta->rx_stats.last_rate = - STA_STATS_FIELD(TYPE, STA_STATS_RATE_TYPE_S1G); - } -+ -+bool ieee80211_s1g_is_twt_setup(struct sk_buff *skb) -+{ -+ struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; -+ -+ if (likely(!ieee80211_is_action(mgmt->frame_control))) -+ return false; -+ -+ if (likely(mgmt->u.action.category != WLAN_CATEGORY_S1G)) -+ return false; -+ -+ return mgmt->u.action.u.s1g.action_code == WLAN_S1G_TWT_SETUP; -+} -+ -+static void -+ieee80211_s1g_send_twt_setup(struct ieee80211_sub_if_data *sdata, const u8 *da, -+ const u8 *bssid, struct ieee80211_twt_setup *twt) -+{ -+ int len = IEEE80211_MIN_ACTION_SIZE + 4 + twt->length; -+ struct ieee80211_local *local = sdata->local; -+ struct ieee80211_mgmt *mgmt; -+ struct sk_buff *skb; -+ -+ skb = dev_alloc_skb(local->hw.extra_tx_headroom + len); -+ if (!skb) -+ return; -+ -+ skb_reserve(skb, local->hw.extra_tx_headroom); -+ mgmt = skb_put_zero(skb, len); -+ mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | -+ IEEE80211_STYPE_ACTION); -+ memcpy(mgmt->da, da, ETH_ALEN); -+ memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); -+ memcpy(mgmt->bssid, bssid, ETH_ALEN); -+ -+ mgmt->u.action.category = WLAN_CATEGORY_S1G; -+ mgmt->u.action.u.s1g.action_code = WLAN_S1G_TWT_SETUP; -+ memcpy(mgmt->u.action.u.s1g.variable, twt, 3 + twt->length); -+ -+ IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | -+ IEEE80211_TX_INTFL_MLME_CONN_TX | -+ IEEE80211_TX_CTL_REQ_TX_STATUS; -+ ieee80211_tx_skb(sdata, skb); -+} -+ -+static void -+ieee80211_s1g_send_twt_teardown(struct ieee80211_sub_if_data *sdata, -+ const u8 *da, const u8 *bssid, u8 flowid) -+{ -+ struct ieee80211_local *local = sdata->local; -+ struct ieee80211_mgmt *mgmt; -+ struct sk_buff *skb; -+ u8 *id; -+ -+ skb = dev_alloc_skb(local->hw.extra_tx_headroom + -+ IEEE80211_MIN_ACTION_SIZE + 2); -+ if (!skb) -+ return; -+ -+ skb_reserve(skb, local->hw.extra_tx_headroom); -+ mgmt = skb_put_zero(skb, IEEE80211_MIN_ACTION_SIZE + 2); -+ mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | -+ IEEE80211_STYPE_ACTION); -+ memcpy(mgmt->da, da, ETH_ALEN); -+ memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); -+ memcpy(mgmt->bssid, bssid, ETH_ALEN); -+ -+ mgmt->u.action.category = WLAN_CATEGORY_S1G; -+ mgmt->u.action.u.s1g.action_code = WLAN_S1G_TWT_TEARDOWN; -+ id = (u8 *)mgmt->u.action.u.s1g.variable; -+ *id = flowid; -+ -+ IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | -+ IEEE80211_TX_CTL_REQ_TX_STATUS; -+ ieee80211_tx_skb(sdata, skb); -+} -+ -+static void -+ieee80211_s1g_rx_twt_setup(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, struct sk_buff *skb) -+{ -+ struct ieee80211_mgmt *mgmt = (void *)skb->data; -+ struct ieee80211_twt_setup *twt = (void *)mgmt->u.action.u.s1g.variable; -+ struct ieee80211_twt_params *twt_agrt = (void *)twt->params; -+ -+ twt_agrt->req_type &= cpu_to_le16(~IEEE80211_TWT_REQTYPE_REQUEST); -+ -+ /* broadcast TWT not supported yet */ -+ if (twt->control & IEEE80211_TWT_CONTROL_NEG_TYPE_BROADCAST) { -+ le16p_replace_bits(&twt_agrt->req_type, -+ TWT_SETUP_CMD_REJECT, -+ IEEE80211_TWT_REQTYPE_SETUP_CMD); -+ goto out; -+ } -+ -+ drv_add_twt_setup(sdata->local, sdata, &sta->sta, twt); -+out: -+ ieee80211_s1g_send_twt_setup(sdata, mgmt->sa, sdata->vif.addr, twt); -+} -+ -+static void -+ieee80211_s1g_rx_twt_teardown(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, struct sk_buff *skb) -+{ -+ struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; -+ -+ drv_twt_teardown_request(sdata->local, sdata, &sta->sta, -+ mgmt->u.action.u.s1g.variable[0]); -+} -+ -+static void -+ieee80211_s1g_tx_twt_setup_fail(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta, struct sk_buff *skb) -+{ -+ struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; -+ struct ieee80211_twt_setup *twt = (void *)mgmt->u.action.u.s1g.variable; -+ struct ieee80211_twt_params *twt_agrt = (void *)twt->params; -+ u8 flowid = le16_get_bits(twt_agrt->req_type, -+ IEEE80211_TWT_REQTYPE_FLOWID); -+ -+ drv_twt_teardown_request(sdata->local, sdata, &sta->sta, flowid); -+ -+ ieee80211_s1g_send_twt_teardown(sdata, mgmt->sa, sdata->vif.addr, -+ flowid); -+} -+ -+void ieee80211_s1g_rx_twt_action(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb) -+{ -+ struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; -+ struct ieee80211_local *local = sdata->local; -+ struct sta_info *sta; -+ -+ mutex_lock(&local->sta_mtx); -+ -+ sta = sta_info_get_bss(sdata, mgmt->sa); -+ if (!sta) -+ goto out; -+ -+ switch (mgmt->u.action.u.s1g.action_code) { -+ case WLAN_S1G_TWT_SETUP: -+ ieee80211_s1g_rx_twt_setup(sdata, sta, skb); -+ break; -+ case WLAN_S1G_TWT_TEARDOWN: -+ ieee80211_s1g_rx_twt_teardown(sdata, sta, skb); -+ break; -+ default: -+ break; -+ } -+ -+out: -+ mutex_unlock(&local->sta_mtx); -+} -+ -+void ieee80211_s1g_status_twt_action(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb) -+{ -+ struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; -+ struct ieee80211_local *local = sdata->local; -+ struct sta_info *sta; -+ -+ mutex_lock(&local->sta_mtx); -+ -+ sta = sta_info_get_bss(sdata, mgmt->da); -+ if (!sta) -+ goto out; -+ -+ switch (mgmt->u.action.u.s1g.action_code) { -+ case WLAN_S1G_TWT_SETUP: -+ /* process failed twt setup frames */ -+ ieee80211_s1g_tx_twt_setup_fail(sdata, sta, skb); -+ break; -+ default: -+ break; -+ } -+ -+out: -+ mutex_unlock(&local->sta_mtx); -+} ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -705,13 +705,26 @@ static void ieee80211_report_used_skb(st - /* Check to see if packet is a TDLS teardown packet */ - if (ieee80211_is_data(hdr->frame_control) && - (ieee80211_get_tdls_action(skb, hdr_size) == -- WLAN_TDLS_TEARDOWN)) -+ WLAN_TDLS_TEARDOWN)) { - ieee80211_tdls_td_tx_handle(local, sdata, skb, - info->flags); -- else -+ } else if (ieee80211_s1g_is_twt_setup(skb)) { -+ if (!acked) { -+ struct sk_buff *qskb; -+ -+ qskb = skb_clone(skb, GFP_ATOMIC); -+ if (qskb) { -+ skb_queue_tail(&sdata->status_queue, -+ qskb); -+ ieee80211_queue_work(&local->hw, -+ &sdata->work); -+ } -+ } -+ } else { - ieee80211_mgd_conn_tx_status(sdata, - hdr->frame_control, - acked); -+ } - } - - rcu_read_unlock(); ---- a/net/mac80211/trace.h -+++ b/net/mac80211/trace.h -@@ -2825,6 +2825,73 @@ DEFINE_EVENT(sta_flag_evt, drv_sta_set_d - TP_ARGS(local, sdata, sta, enabled) - ); - -+TRACE_EVENT(drv_add_twt_setup, -+ TP_PROTO(struct ieee80211_local *local, -+ struct ieee80211_sta *sta, -+ struct ieee80211_twt_setup *twt, -+ struct ieee80211_twt_params *twt_agrt), -+ -+ TP_ARGS(local, sta, twt, twt_agrt), -+ -+ TP_STRUCT__entry( -+ LOCAL_ENTRY -+ STA_ENTRY -+ __field(u8, dialog_token) -+ __field(u8, control) -+ __field(__le16, req_type) -+ __field(__le64, twt) -+ __field(u8, duration) -+ __field(__le16, mantissa) -+ __field(u8, channel) -+ ), -+ -+ TP_fast_assign( -+ LOCAL_ASSIGN; -+ STA_ASSIGN; -+ __entry->dialog_token = twt->dialog_token; -+ __entry->control = twt->control; -+ __entry->req_type = twt_agrt->req_type; -+ __entry->twt = twt_agrt->twt; -+ __entry->duration = twt_agrt->min_twt_dur; -+ __entry->mantissa = twt_agrt->mantissa; -+ __entry->channel = twt_agrt->channel; -+ ), -+ -+ TP_printk( -+ LOCAL_PR_FMT STA_PR_FMT -+ " token:%d control:0x%02x req_type:0x%04x" -+ " twt:%llu duration:%d mantissa:%d channel:%d", -+ LOCAL_PR_ARG, STA_PR_ARG, __entry->dialog_token, -+ __entry->control, le16_to_cpu(__entry->req_type), -+ le64_to_cpu(__entry->twt), __entry->duration, -+ le16_to_cpu(__entry->mantissa), __entry->channel -+ ) -+); -+ -+TRACE_EVENT(drv_twt_teardown_request, -+ TP_PROTO(struct ieee80211_local *local, -+ struct ieee80211_sta *sta, u8 flowid), -+ -+ TP_ARGS(local, sta, flowid), -+ -+ TP_STRUCT__entry( -+ LOCAL_ENTRY -+ STA_ENTRY -+ __field(u8, flowid) -+ ), -+ -+ TP_fast_assign( -+ LOCAL_ASSIGN; -+ STA_ASSIGN; -+ __entry->flowid = flowid; -+ ), -+ -+ TP_printk( -+ LOCAL_PR_FMT STA_PR_FMT " flowid:%d", -+ LOCAL_PR_ARG, STA_PR_ARG, __entry->flowid -+ ) -+); -+ - #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ - - #undef TRACE_INCLUDE_PATH diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index 1775dc44b1..3f2cc18253 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -87,7 +87,7 @@ CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1428,6 +1428,7 @@ struct ieee80211_local { +@@ -1429,6 +1429,7 @@ struct ieee80211_local { int dynamic_ps_forced_timeout; int user_power_level; /* in dBm, for all interfaces */ From cb11eaf5dd2f443f46f1f73109a16c15551c2f3a Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 23 Oct 2021 21:01:24 +0200 Subject: [PATCH 26/54] image: define DEVICE_DTS_DELIMITER as per-device variable DEVICE_DTS_DELIMITER needs to be in the DEFAULT_DEVICE_VARS list to work as expected. This was missing from the original version and got overlooked. Fixes: fd6790864739 ("scripts: mkits.sh: Allow legacy @ mode for dts creation") Signed-off-by: Christian Lamparter --- include/image.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/image.mk b/include/image.mk index 1150f84ce5..275a0adcac 100644 --- a/include/image.mk +++ b/include/image.mk @@ -394,6 +394,7 @@ define Device/Init DEVICE_DTS := DEVICE_DTS_CONFIG := + DEVICE_DTS_DELIMITER := DEVICE_DTS_DIR := DEVICE_DTS_OVERLAY := DEVICE_FDT_NUM := @@ -419,8 +420,8 @@ DEFAULT_DEVICE_VARS := \ DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \ CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \ VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \ - DEVICE_DTS_CONFIG DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_FDT_NUM \ - DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \ + DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER DEVICE_DTS_DIR DEVICE_DTS_OVERLAY \ + DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \ SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \ UBOOT_PATH IMAGE_SIZE \ DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \ From 36104dc51f5a4fef961b97aaaa8dfe753dfb5e04 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sun, 24 Oct 2021 02:45:25 +0200 Subject: [PATCH 27/54] kernel: 5.10: silence bogus "Missing #address-cells in interrupt provider" warnings Rosen reported strange dtc warnings that had their origin in an upstream patch to 5.8-rc1. Upon further digging this revealed an ongoing thread [0] discussing the topic: > [...]I don't think we need a bunch of warning fix patches to add > these everywhere. Also, the need for #address-cells pretty much makes > no sense on any modern system. It is a relic from days when the bus > (address) topology and interrupt topology were related. and later on: > So really, we only need to be checking for #address-cells in nodes > with interrupt-map. This patch backports just the patch which removed the warning message (this is from the upstream dtc project [1] - but not the kernel). the patch does not add the checking of the #address-cells in nodes with interrupt-map. [0] [1] Link: Reported-by: Rosen Penev Signed-off-by: Christian Lamparter --- ...terrupt-provider-address-cells-check.patch | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 target/linux/generic/pending-5.10/050-dtc-checks-Drop-interrupt-provider-address-cells-check.patch diff --git a/target/linux/generic/pending-5.10/050-dtc-checks-Drop-interrupt-provider-address-cells-check.patch b/target/linux/generic/pending-5.10/050-dtc-checks-Drop-interrupt-provider-address-cells-check.patch new file mode 100644 index 0000000000..75f63728ec --- /dev/null +++ b/target/linux/generic/pending-5.10/050-dtc-checks-Drop-interrupt-provider-address-cells-check.patch @@ -0,0 +1,28 @@ +From d8d1a9a77863a8c7031ae82a1d461aa78eb72a7b Mon Sep 17 00:00:00 2001 +From: Rob Herring +Date: Mon, 11 Oct 2021 14:12:43 -0500 +Subject: [PATCH] checks: Drop interrupt provider '#address-cells' check + +'#address-cells' is only needed when parsing 'interrupt-map' properties, so +remove it from the common interrupt-provider test. + +Cc: Andre Przywara +Reviewed-by: David Gibson +Signed-off-by: Rob Herring +Message-Id: <20211011191245.1009682-3-robh@kernel.org> +Signed-off-by: David Gibson +--- +--- a/scripts/dtc/checks.c ++++ b/scripts/dtc/checks.c +@@ -1569,11 +1569,6 @@ static void check_interrupt_provider(str + if (!prop) + FAIL(c, dti, node, + "Missing #interrupt-cells in interrupt provider"); +- +- prop = get_property(node, "#address-cells"); +- if (!prop) +- FAIL(c, dti, node, +- "Missing #address-cells in interrupt provider"); + } + WARNING(interrupt_provider, check_interrupt_provider, NULL); + From 6a1284cfa87489db1e73b598a2b7aacb00df9f37 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 24 Oct 2021 15:03:20 +0200 Subject: [PATCH 28/54] mac80211: Add devm_platform_get_and_ioremap_resource() This function is missing in kernel 5.4, but it is sued by ath10k. This fixes the build of ath10k on some targets. Fixes: cfe0eb7485d8 ("mac80211: Update to version 5.14.13-1") Signed-off-by: Hauke Mehrtens --- ...vm_platform_get_and_ioremap_resource.patch | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 package/kernel/mac80211/patches/build/010-headers-Add-devm_platform_get_and_ioremap_resource.patch diff --git a/package/kernel/mac80211/patches/build/010-headers-Add-devm_platform_get_and_ioremap_resource.patch b/package/kernel/mac80211/patches/build/010-headers-Add-devm_platform_get_and_ioremap_resource.patch new file mode 100644 index 0000000000..a06c619471 --- /dev/null +++ b/package/kernel/mac80211/patches/build/010-headers-Add-devm_platform_get_and_ioremap_resource.patch @@ -0,0 +1,79 @@ +From d49395058c6bd4fb7b8bcc5ff7b4d7fbd9b6f97b Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sun, 24 Oct 2021 14:49:55 +0200 +Subject: [PATCH] headers: Add devm_platform_get_and_ioremap_resource() + +This function is copied from kernel 5.7 and used by mt76, ath10k and +ath11k. devm_platform_ioremap_resource() was changed to make sue of +this new function. + +Signed-off-by: Hauke Mehrtens +--- + .../backport-include/linux/platform_device.h | 45 ++++++++++++++++--- + 1 file changed, 38 insertions(+), 7 deletions(-) + +--- a/backport-include/linux/platform_device.h ++++ b/backport-include/linux/platform_device.h +@@ -33,7 +33,39 @@ module_exit(__platform_driver##_exit); + platform_driver_unregister) + #endif + ++#if LINUX_VERSION_IS_LESS(5,7,0) ++#ifdef CONFIG_HAS_IOMEM ++#define devm_platform_get_and_ioremap_resource LINUX_BACKPORT(devm_platform_get_and_ioremap_resource) ++/** ++ * devm_platform_get_and_ioremap_resource - call devm_ioremap_resource() for a ++ * platform device and get resource ++ * ++ * @pdev: platform device to use both for memory resource lookup as well as ++ * resource management ++ * @index: resource index ++ * @res: optional output parameter to store a pointer to the obtained resource. ++ * ++ * Return: a pointer to the remapped memory or an ERR_PTR() encoded error code ++ * on failure. ++ */ ++static inline void __iomem * ++devm_platform_get_and_ioremap_resource(struct platform_device *pdev, ++ unsigned int index, struct resource **res) ++{ ++ struct resource *r; ++ ++ r = platform_get_resource(pdev, IORESOURCE_MEM, index); ++ if (res) ++ *res = r; ++ return devm_ioremap_resource(&pdev->dev, r); ++} ++#endif /* CONFIG_HAS_IOMEM */ ++#endif /* < 5.7 */ ++ + #if LINUX_VERSION_IS_LESS(5,1,0) ++ ++#ifdef CONFIG_HAS_IOMEM ++#define devm_platform_ioremap_resource LINUX_BACKPORT(devm_platform_ioremap_resource) + /** + * devm_platform_ioremap_resource - call devm_ioremap_resource() for a platform + * device +@@ -41,16 +73,15 @@ module_exit(__platform_driver##_exit); + * @pdev: platform device to use both for memory resource lookup as well as + * resource management + * @index: resource index ++ * ++ * Return: a pointer to the remapped memory or an ERR_PTR() encoded error code ++ * on failure. + */ +-#ifdef CONFIG_HAS_IOMEM +-#define devm_platform_ioremap_resource LINUX_BACKPORT(devm_platform_ioremap_resource) +-static inline void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev, ++static inline void __iomem * ++devm_platform_ioremap_resource(struct platform_device *pdev, + unsigned int index) + { +- struct resource *res; +- +- res = platform_get_resource(pdev, IORESOURCE_MEM, index); +- return devm_ioremap_resource(&pdev->dev, res); ++ return devm_platform_get_and_ioremap_resource(pdev, index, NULL); + } + #endif /* CONFIG_HAS_IOMEM */ + #endif From e3c47ff90d765c1fe683b5422006ab1fe3ab718d Mon Sep 17 00:00:00 2001 From: Matthew Hagan Date: Thu, 9 Sep 2021 17:12:30 +0000 Subject: [PATCH 29/54] kernel: 5.10: backport qca8k stability improvements This is a backport of Ansuel Smith's "Multiple improvement to qca8k stability" series. The QCA8337 switch is available on multiple platforms including ipq806x, ath79 and bcm53xx. Signed-off-by: Ansuel Smith Signed-off-by: Matthew Hagan --- ...k-change-simple-print-to-dev-variant.patch | 35 +++ ...use-iopoll-macro-for-qca8k_busy_wait.patch | 61 ++++ ...prove-qca8k-read-write-rmw-bus-acces.patch | 86 ++++++ ...a-qca8k-handle-qca8k_set_page-errors.patch | 101 +++++++ ...ndle-error-with-qca8k_read-operation.patch | 207 ++++++++++++++ ...ndle-error-with-qca8k_write-operatio.patch | 263 +++++++++++++++++ ...andle-error-with-qca8k_rmw-operation.patch | 226 +++++++++++++++ ...8k-handle-error-from-qca8k_busy_wait.patch | 66 +++++ ...qca8k-add-support-for-qca8327-switch.patch | 96 +++++++ ...sa-qca8k-Document-new-compatible-qca.patch | 26 ++ ...add-priority-tweak-to-qca8337-switch.patch | 130 +++++++++ ...a-qca8k-limit-port5-delay-to-qca8337.patch | 31 ++ ...d-GLOBAL_FC-settings-needed-for-qca8.patch | 48 ++++ ...dsa-qca8k-add-support-for-switch-rev.patch | 114 ++++++++ ...d-ethernet-ports-fallback-to-setup_m.patch | 28 ++ ...-qca8k-make-rgmii-delay-configurable.patch | 188 ++++++++++++ ...clear-MASTER_EN-after-phy-read-write.patch | 50 ++++ ...a-qca8k-protect-MASTER-busy_wait-wit.patch | 128 +++++++++ ...qca8k-enlarge-mdio-delay-and-timeout.patch | 39 +++ ...d-support-for-internal-phy-and-inter.patch | 267 ++++++++++++++++++ ...ngs-dsa-qca8k-Document-internal-mdio.patch | 93 ++++++ ...prove-internal-mdio-read-write-bus-a.patch | 95 +++++++ ...ss-switch_revision-info-to-phy-dev_f.patch | 48 ++++ ...ort-for-qca8k-switch-internal-PHY-in.patch | 229 +++++++++++++++ ...net-phy-at803x-fix-feature-detection.patch | 4 +- ...7-net-phy-Add-Qualcom-QCA807x-driver.patch | 6 +- 26 files changed, 2660 insertions(+), 5 deletions(-) create mode 100644 target/linux/generic/backport-5.10/785-v5.14-01-net-dsa-qca8k-change-simple-print-to-dev-variant.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-02-net-dsa-qca8k-use-iopoll-macro-for-qca8k_busy_wait.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-03-net-dsa-qca8k-improve-qca8k-read-write-rmw-bus-acces.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-04-net-dsa-qca8k-handle-qca8k_set_page-errors.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-05-net-dsa-qca8k-handle-error-with-qca8k_read-operation.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-06-net-dsa-qca8k-handle-error-with-qca8k_write-operatio.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-07-net-dsa-qca8k-handle-error-with-qca8k_rmw-operation.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-08-net-dsa-qca8k-handle-error-from-qca8k_busy_wait.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-09-net-dsa-qca8k-add-support-for-qca8327-switch.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-10-devicetree-net-dsa-qca8k-Document-new-compatible-qca.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-11-net-dsa-qca8k-add-priority-tweak-to-qca8337-switch.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-12-net-dsa-qca8k-limit-port5-delay-to-qca8337.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-13-net-dsa-qca8k-add-GLOBAL_FC-settings-needed-for-qca8.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-14-net-dsa-qca8k-add-support-for-switch-rev.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-15-net-dsa-qca8k-add-ethernet-ports-fallback-to-setup_m.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-16-net-dsa-qca8k-make-rgmii-delay-configurable.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-17-net-dsa-qca8k-clear-MASTER_EN-after-phy-read-write.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-18-net-dsa-qca8k-dsa-qca8k-protect-MASTER-busy_wait-wit.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-19-net-dsa-qca8k-enlarge-mdio-delay-and-timeout.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-20-net-dsa-qca8k-add-support-for-internal-phy-and-inter.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-21-devicetree-bindings-dsa-qca8k-Document-internal-mdio.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-22-net-dsa-qca8k-improve-internal-mdio-read-write-bus-a.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-23-net-dsa-qca8k-pass-switch_revision-info-to-phy-dev_f.patch create mode 100644 target/linux/generic/backport-5.10/785-v5.14-25-net-phy-add-support-for-qca8k-switch-internal-PHY-in.patch diff --git a/target/linux/generic/backport-5.10/785-v5.14-01-net-dsa-qca8k-change-simple-print-to-dev-variant.patch b/target/linux/generic/backport-5.10/785-v5.14-01-net-dsa-qca8k-change-simple-print-to-dev-variant.patch new file mode 100644 index 0000000000..b8e6d9b613 --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-01-net-dsa-qca8k-change-simple-print-to-dev-variant.patch @@ -0,0 +1,35 @@ +From 5d9e068402dcf7354cc8ee66c2152845306d2ccb Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 22:59:51 +0200 +Subject: [PATCH] net: dsa: qca8k: change simple print to dev variant + +Change pr_err and pr_warn to dev variant. + +Signed-off-by: Ansuel Smith +Reviewed-by: Florian Fainelli +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -701,7 +701,7 @@ qca8k_setup(struct dsa_switch *ds) + + /* Make sure that port 0 is the cpu port */ + if (!dsa_is_cpu_port(ds, 0)) { +- pr_err("port 0 is not the CPU port\n"); ++ dev_err(priv->dev, "port 0 is not the CPU port"); + return -EINVAL; + } + +@@ -711,7 +711,7 @@ qca8k_setup(struct dsa_switch *ds) + priv->regmap = devm_regmap_init(ds->dev, NULL, priv, + &qca8k_regmap_config); + if (IS_ERR(priv->regmap)) +- pr_warn("regmap initialization failed"); ++ dev_warn(priv->dev, "regmap initialization failed"); + + ret = qca8k_setup_mdio_bus(priv); + if (ret) diff --git a/target/linux/generic/backport-5.10/785-v5.14-02-net-dsa-qca8k-use-iopoll-macro-for-qca8k_busy_wait.patch b/target/linux/generic/backport-5.10/785-v5.14-02-net-dsa-qca8k-use-iopoll-macro-for-qca8k_busy_wait.patch new file mode 100644 index 0000000000..ff8288d484 --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-02-net-dsa-qca8k-use-iopoll-macro-for-qca8k_busy_wait.patch @@ -0,0 +1,61 @@ +From 2ad255f2faaffb3af786031fba2e7955454b558a Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 22:59:52 +0200 +Subject: [PATCH] net: dsa: qca8k: use iopoll macro for qca8k_busy_wait + +Use iopoll macro instead of while loop. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 23 +++++++++++------------ + drivers/net/dsa/qca8k.h | 2 ++ + 2 files changed, 13 insertions(+), 12 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -262,21 +262,20 @@ static struct regmap_config qca8k_regmap + static int + qca8k_busy_wait(struct qca8k_priv *priv, u32 reg, u32 mask) + { +- unsigned long timeout; ++ u32 val; ++ int ret; + +- timeout = jiffies + msecs_to_jiffies(20); ++ ret = read_poll_timeout(qca8k_read, val, !(val & mask), ++ 0, QCA8K_BUSY_WAIT_TIMEOUT * USEC_PER_MSEC, false, ++ priv, reg); + +- /* loop until the busy flag has cleared */ +- do { +- u32 val = qca8k_read(priv, reg); +- int busy = val & mask; ++ /* Check if qca8k_read has failed for a different reason ++ * before returning -ETIMEDOUT ++ */ ++ if (ret < 0 && val < 0) ++ return val; + +- if (!busy) +- break; +- cond_resched(); +- } while (!time_after_eq(jiffies, timeout)); +- +- return time_after_eq(jiffies, timeout); ++ return ret; + } + + static void +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -18,6 +18,8 @@ + #define PHY_ID_QCA8337 0x004dd036 + #define QCA8K_ID_QCA8337 0x13 + ++#define QCA8K_BUSY_WAIT_TIMEOUT 20 ++ + #define QCA8K_NUM_FDB_RECORDS 2048 + + #define QCA8K_CPU_PORT 0 diff --git a/target/linux/generic/backport-5.10/785-v5.14-03-net-dsa-qca8k-improve-qca8k-read-write-rmw-bus-acces.patch b/target/linux/generic/backport-5.10/785-v5.14-03-net-dsa-qca8k-improve-qca8k-read-write-rmw-bus-acces.patch new file mode 100644 index 0000000000..c403589874 --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-03-net-dsa-qca8k-improve-qca8k-read-write-rmw-bus-acces.patch @@ -0,0 +1,86 @@ +From 504bf65931824eda83494e5b5d75686e27ace03e Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 22:59:53 +0200 +Subject: [PATCH] net: dsa: qca8k: improve qca8k read/write/rmw bus access + +Put bus in local variable to improve faster access to the mdio bus. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 29 ++++++++++++++++------------- + 1 file changed, 16 insertions(+), 13 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -142,17 +142,18 @@ qca8k_set_page(struct mii_bus *bus, u16 + static u32 + qca8k_read(struct qca8k_priv *priv, u32 reg) + { ++ struct mii_bus *bus = priv->bus; + u16 r1, r2, page; + u32 val; + + qca8k_split_addr(reg, &r1, &r2, &page); + +- mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); + +- qca8k_set_page(priv->bus, page); +- val = qca8k_mii_read32(priv->bus, 0x10 | r2, r1); ++ qca8k_set_page(bus, page); ++ val = qca8k_mii_read32(bus, 0x10 | r2, r1); + +- mutex_unlock(&priv->bus->mdio_lock); ++ mutex_unlock(&bus->mdio_lock); + + return val; + } +@@ -160,35 +161,37 @@ qca8k_read(struct qca8k_priv *priv, u32 + static void + qca8k_write(struct qca8k_priv *priv, u32 reg, u32 val) + { ++ struct mii_bus *bus = priv->bus; + u16 r1, r2, page; + + qca8k_split_addr(reg, &r1, &r2, &page); + +- mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); + +- qca8k_set_page(priv->bus, page); +- qca8k_mii_write32(priv->bus, 0x10 | r2, r1, val); ++ qca8k_set_page(bus, page); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, val); + +- mutex_unlock(&priv->bus->mdio_lock); ++ mutex_unlock(&bus->mdio_lock); + } + + static u32 + qca8k_rmw(struct qca8k_priv *priv, u32 reg, u32 mask, u32 val) + { ++ struct mii_bus *bus = priv->bus; + u16 r1, r2, page; + u32 ret; + + qca8k_split_addr(reg, &r1, &r2, &page); + +- mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); + +- qca8k_set_page(priv->bus, page); +- ret = qca8k_mii_read32(priv->bus, 0x10 | r2, r1); ++ qca8k_set_page(bus, page); ++ ret = qca8k_mii_read32(bus, 0x10 | r2, r1); + ret &= ~mask; + ret |= val; +- qca8k_mii_write32(priv->bus, 0x10 | r2, r1, ret); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, ret); + +- mutex_unlock(&priv->bus->mdio_lock); ++ mutex_unlock(&bus->mdio_lock); + + return ret; + } diff --git a/target/linux/generic/backport-5.10/785-v5.14-04-net-dsa-qca8k-handle-qca8k_set_page-errors.patch b/target/linux/generic/backport-5.10/785-v5.14-04-net-dsa-qca8k-handle-qca8k_set_page-errors.patch new file mode 100644 index 0000000000..6be494a8c7 --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-04-net-dsa-qca8k-handle-qca8k_set_page-errors.patch @@ -0,0 +1,101 @@ +From ba5707ec58cfb6853dff41c2aae72deb6a03d389 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 22:59:54 +0200 +Subject: [PATCH] net: dsa: qca8k: handle qca8k_set_page errors + +With a remote possibility, the set_page function can fail. Since this is +a critical part of the write/read qca8k regs, propagate the error and +terminate any read/write operation. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 33 ++++++++++++++++++++++++++------- + 1 file changed, 26 insertions(+), 7 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -127,16 +127,23 @@ qca8k_mii_write32(struct mii_bus *bus, i + "failed to write qca8k 32bit register\n"); + } + +-static void ++static int + qca8k_set_page(struct mii_bus *bus, u16 page) + { ++ int ret; ++ + if (page == qca8k_current_page) +- return; ++ return 0; + +- if (bus->write(bus, 0x18, 0, page) < 0) ++ ret = bus->write(bus, 0x18, 0, page); ++ if (ret < 0) { + dev_err_ratelimited(&bus->dev, + "failed to set qca8k page\n"); ++ return ret; ++ } ++ + qca8k_current_page = page; ++ return 0; + } + + static u32 +@@ -150,11 +157,14 @@ qca8k_read(struct qca8k_priv *priv, u32 + + mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); + +- qca8k_set_page(bus, page); ++ val = qca8k_set_page(bus, page); ++ if (val < 0) ++ goto exit; ++ + val = qca8k_mii_read32(bus, 0x10 | r2, r1); + ++exit: + mutex_unlock(&bus->mdio_lock); +- + return val; + } + +@@ -163,14 +173,19 @@ qca8k_write(struct qca8k_priv *priv, u32 + { + struct mii_bus *bus = priv->bus; + u16 r1, r2, page; ++ int ret; + + qca8k_split_addr(reg, &r1, &r2, &page); + + mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); + +- qca8k_set_page(bus, page); ++ ret = qca8k_set_page(bus, page); ++ if (ret < 0) ++ goto exit; ++ + qca8k_mii_write32(bus, 0x10 | r2, r1, val); + ++exit: + mutex_unlock(&bus->mdio_lock); + } + +@@ -185,12 +200,16 @@ qca8k_rmw(struct qca8k_priv *priv, u32 r + + mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); + +- qca8k_set_page(bus, page); ++ ret = qca8k_set_page(bus, page); ++ if (ret < 0) ++ goto exit; ++ + ret = qca8k_mii_read32(bus, 0x10 | r2, r1); + ret &= ~mask; + ret |= val; + qca8k_mii_write32(bus, 0x10 | r2, r1, ret); + ++exit: + mutex_unlock(&bus->mdio_lock); + + return ret; diff --git a/target/linux/generic/backport-5.10/785-v5.14-05-net-dsa-qca8k-handle-error-with-qca8k_read-operation.patch b/target/linux/generic/backport-5.10/785-v5.14-05-net-dsa-qca8k-handle-error-with-qca8k_read-operation.patch new file mode 100644 index 0000000000..3349b7897a --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-05-net-dsa-qca8k-handle-error-with-qca8k_read-operation.patch @@ -0,0 +1,207 @@ +From 028f5f8ef44fcf87a456772cbb9f0d90a0a22884 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 22:59:55 +0200 +Subject: [PATCH] net: dsa: qca8k: handle error with qca8k_read operation + +qca8k_read can fail. Rework any user to handle error values and +correctly return. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 73 ++++++++++++++++++++++++++++++++--------- + 1 file changed, 58 insertions(+), 15 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -231,8 +231,13 @@ static int + qca8k_regmap_read(void *ctx, uint32_t reg, uint32_t *val) + { + struct qca8k_priv *priv = (struct qca8k_priv *)ctx; ++ int ret; ++ ++ ret = qca8k_read(priv, reg); ++ if (ret < 0) ++ return ret; + +- *val = qca8k_read(priv, reg); ++ *val = ret; + + return 0; + } +@@ -300,15 +305,20 @@ qca8k_busy_wait(struct qca8k_priv *priv, + return ret; + } + +-static void ++static int + qca8k_fdb_read(struct qca8k_priv *priv, struct qca8k_fdb *fdb) + { +- u32 reg[4]; ++ u32 reg[4], val; + int i; + + /* load the ARL table into an array */ +- for (i = 0; i < 4; i++) +- reg[i] = qca8k_read(priv, QCA8K_REG_ATU_DATA0 + (i * 4)); ++ for (i = 0; i < 4; i++) { ++ val = qca8k_read(priv, QCA8K_REG_ATU_DATA0 + (i * 4)); ++ if (val < 0) ++ return val; ++ ++ reg[i] = val; ++ } + + /* vid - 83:72 */ + fdb->vid = (reg[2] >> QCA8K_ATU_VID_S) & QCA8K_ATU_VID_M; +@@ -323,6 +333,8 @@ qca8k_fdb_read(struct qca8k_priv *priv, + fdb->mac[3] = (reg[0] >> QCA8K_ATU_ADDR3_S) & 0xff; + fdb->mac[4] = (reg[0] >> QCA8K_ATU_ADDR4_S) & 0xff; + fdb->mac[5] = reg[0] & 0xff; ++ ++ return 0; + } + + static void +@@ -374,6 +386,8 @@ qca8k_fdb_access(struct qca8k_priv *priv + /* Check for table full violation when adding an entry */ + if (cmd == QCA8K_FDB_LOAD) { + reg = qca8k_read(priv, QCA8K_REG_ATU_FUNC); ++ if (reg < 0) ++ return reg; + if (reg & QCA8K_ATU_FUNC_FULL) + return -1; + } +@@ -388,10 +402,10 @@ qca8k_fdb_next(struct qca8k_priv *priv, + + qca8k_fdb_write(priv, fdb->vid, fdb->port_mask, fdb->mac, fdb->aging); + ret = qca8k_fdb_access(priv, QCA8K_FDB_NEXT, port); +- if (ret >= 0) +- qca8k_fdb_read(priv, fdb); ++ if (ret < 0) ++ return ret; + +- return ret; ++ return qca8k_fdb_read(priv, fdb); + } + + static int +@@ -449,6 +463,8 @@ qca8k_vlan_access(struct qca8k_priv *pri + /* Check for table full violation when adding an entry */ + if (cmd == QCA8K_VLAN_LOAD) { + reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC1); ++ if (reg < 0) ++ return reg; + if (reg & QCA8K_VTU_FUNC1_FULL) + return -ENOMEM; + } +@@ -475,6 +491,8 @@ qca8k_vlan_add(struct qca8k_priv *priv, + goto out; + + reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0); ++ if (reg < 0) ++ return reg; + reg |= QCA8K_VTU_FUNC0_VALID | QCA8K_VTU_FUNC0_IVL_EN; + reg &= ~(QCA8K_VTU_FUNC0_EG_MODE_MASK << QCA8K_VTU_FUNC0_EG_MODE_S(port)); + if (untagged) +@@ -506,6 +524,8 @@ qca8k_vlan_del(struct qca8k_priv *priv, + goto out; + + reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0); ++ if (reg < 0) ++ return reg; + reg &= ~(3 << QCA8K_VTU_FUNC0_EG_MODE_S(port)); + reg |= QCA8K_VTU_FUNC0_EG_MODE_NOT << + QCA8K_VTU_FUNC0_EG_MODE_S(port); +@@ -621,8 +641,11 @@ qca8k_mdio_read(struct qca8k_priv *priv, + QCA8K_MDIO_MASTER_BUSY)) + return -ETIMEDOUT; + +- val = (qca8k_read(priv, QCA8K_MDIO_MASTER_CTRL) & +- QCA8K_MDIO_MASTER_DATA_MASK); ++ val = qca8k_read(priv, QCA8K_MDIO_MASTER_CTRL); ++ if (val < 0) ++ return val; ++ ++ val &= QCA8K_MDIO_MASTER_DATA_MASK; + + return val; + } +@@ -978,6 +1001,8 @@ qca8k_phylink_mac_link_state(struct dsa_ + u32 reg; + + reg = qca8k_read(priv, QCA8K_REG_PORT_STATUS(port)); ++ if (reg < 0) ++ return reg; + + state->link = !!(reg & QCA8K_PORT_STATUS_LINK_UP); + state->an_complete = state->link; +@@ -1078,18 +1103,26 @@ qca8k_get_ethtool_stats(struct dsa_switc + { + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; + const struct qca8k_mib_desc *mib; +- u32 reg, i; ++ u32 reg, i, val; + u64 hi; + + for (i = 0; i < ARRAY_SIZE(ar8327_mib); i++) { + mib = &ar8327_mib[i]; + reg = QCA8K_PORT_MIB_COUNTER(port) + mib->offset; + +- data[i] = qca8k_read(priv, reg); ++ val = qca8k_read(priv, reg); ++ if (val < 0) ++ continue; ++ + if (mib->size == 2) { + hi = qca8k_read(priv, reg + 4); +- data[i] |= hi << 32; ++ if (hi < 0) ++ continue; + } ++ ++ data[i] = val; ++ if (mib->size == 2) ++ data[i] |= hi << 32; + } + } + +@@ -1107,18 +1140,25 @@ qca8k_set_mac_eee(struct dsa_switch *ds, + { + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; + u32 lpi_en = QCA8K_REG_EEE_CTRL_LPI_EN(port); ++ int ret = 0; + u32 reg; + + mutex_lock(&priv->reg_mutex); + reg = qca8k_read(priv, QCA8K_REG_EEE_CTRL); ++ if (reg < 0) { ++ ret = reg; ++ goto exit; ++ } ++ + if (eee->eee_enabled) + reg |= lpi_en; + else + reg &= ~lpi_en; + qca8k_write(priv, QCA8K_REG_EEE_CTRL, reg); +- mutex_unlock(&priv->reg_mutex); + +- return 0; ++exit: ++ mutex_unlock(&priv->reg_mutex); ++ return ret; + } + + static int +@@ -1456,6 +1496,9 @@ qca8k_sw_probe(struct mdio_device *mdiod + + /* read the switches ID register */ + id = qca8k_read(priv, QCA8K_REG_MASK_CTRL); ++ if (id < 0) ++ return id; ++ + id >>= QCA8K_MASK_CTRL_ID_S; + id &= QCA8K_MASK_CTRL_ID_M; + if (id != QCA8K_ID_QCA8337) diff --git a/target/linux/generic/backport-5.10/785-v5.14-06-net-dsa-qca8k-handle-error-with-qca8k_write-operatio.patch b/target/linux/generic/backport-5.10/785-v5.14-06-net-dsa-qca8k-handle-error-with-qca8k_write-operatio.patch new file mode 100644 index 0000000000..1e0e224c39 --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-06-net-dsa-qca8k-handle-error-with-qca8k_write-operatio.patch @@ -0,0 +1,263 @@ +From d7805757c75c76e9518fc1023a29f0c4eed5b581 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 22:59:56 +0200 +Subject: [PATCH] net: dsa: qca8k: handle error with qca8k_write operation + +qca8k_write can fail. Rework any user to handle error values and +correctly return. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 102 ++++++++++++++++++++++++++-------------- + 1 file changed, 67 insertions(+), 35 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -168,7 +168,7 @@ exit: + return val; + } + +-static void ++static int + qca8k_write(struct qca8k_priv *priv, u32 reg, u32 val) + { + struct mii_bus *bus = priv->bus; +@@ -187,6 +187,7 @@ qca8k_write(struct qca8k_priv *priv, u32 + + exit: + mutex_unlock(&bus->mdio_lock); ++ return ret; + } + + static u32 +@@ -247,9 +248,7 @@ qca8k_regmap_write(void *ctx, uint32_t r + { + struct qca8k_priv *priv = (struct qca8k_priv *)ctx; + +- qca8k_write(priv, reg, val); +- +- return 0; ++ return qca8k_write(priv, reg, val); + } + + static const struct regmap_range qca8k_readable_ranges[] = { +@@ -367,6 +366,7 @@ static int + qca8k_fdb_access(struct qca8k_priv *priv, enum qca8k_fdb_cmd cmd, int port) + { + u32 reg; ++ int ret; + + /* Set the command and FDB index */ + reg = QCA8K_ATU_FUNC_BUSY; +@@ -377,7 +377,9 @@ qca8k_fdb_access(struct qca8k_priv *priv + } + + /* Write the function register triggering the table access */ +- qca8k_write(priv, QCA8K_REG_ATU_FUNC, reg); ++ ret = qca8k_write(priv, QCA8K_REG_ATU_FUNC, reg); ++ if (ret) ++ return ret; + + /* wait for completion */ + if (qca8k_busy_wait(priv, QCA8K_REG_ATU_FUNC, QCA8K_ATU_FUNC_BUSY)) +@@ -447,6 +449,7 @@ static int + qca8k_vlan_access(struct qca8k_priv *priv, enum qca8k_vlan_cmd cmd, u16 vid) + { + u32 reg; ++ int ret; + + /* Set the command and VLAN index */ + reg = QCA8K_VTU_FUNC1_BUSY; +@@ -454,7 +457,9 @@ qca8k_vlan_access(struct qca8k_priv *pri + reg |= vid << QCA8K_VTU_FUNC1_VID_S; + + /* Write the function register triggering the table access */ +- qca8k_write(priv, QCA8K_REG_VTU_FUNC1, reg); ++ ret = qca8k_write(priv, QCA8K_REG_VTU_FUNC1, reg); ++ if (ret) ++ return ret; + + /* wait for completion */ + if (qca8k_busy_wait(priv, QCA8K_REG_VTU_FUNC1, QCA8K_VTU_FUNC1_BUSY)) +@@ -502,7 +507,9 @@ qca8k_vlan_add(struct qca8k_priv *priv, + reg |= QCA8K_VTU_FUNC0_EG_MODE_TAG << + QCA8K_VTU_FUNC0_EG_MODE_S(port); + +- qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg); ++ ret = qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg); ++ if (ret) ++ return ret; + ret = qca8k_vlan_access(priv, QCA8K_VLAN_LOAD, vid); + + out: +@@ -545,7 +552,9 @@ qca8k_vlan_del(struct qca8k_priv *priv, + if (del) { + ret = qca8k_vlan_access(priv, QCA8K_VLAN_PURGE, vid); + } else { +- qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg); ++ ret = qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg); ++ if (ret) ++ return ret; + ret = qca8k_vlan_access(priv, QCA8K_VLAN_LOAD, vid); + } + +@@ -555,15 +564,20 @@ out: + return ret; + } + +-static void ++static int + qca8k_mib_init(struct qca8k_priv *priv) + { ++ int ret; ++ + mutex_lock(&priv->reg_mutex); + qca8k_reg_set(priv, QCA8K_REG_MIB, QCA8K_MIB_FLUSH | QCA8K_MIB_BUSY); + qca8k_busy_wait(priv, QCA8K_REG_MIB, QCA8K_MIB_BUSY); + qca8k_reg_set(priv, QCA8K_REG_MIB, QCA8K_MIB_CPU_KEEP); +- qca8k_write(priv, QCA8K_REG_MODULE_EN, QCA8K_MODULE_EN_MIB); ++ ++ ret = qca8k_write(priv, QCA8K_REG_MODULE_EN, QCA8K_MODULE_EN_MIB); ++ + mutex_unlock(&priv->reg_mutex); ++ return ret; + } + + static void +@@ -600,6 +614,7 @@ static int + qca8k_mdio_write(struct qca8k_priv *priv, int port, u32 regnum, u16 data) + { + u32 phy, val; ++ int ret; + + if (regnum >= QCA8K_MDIO_MASTER_MAX_REG) + return -EINVAL; +@@ -613,7 +628,9 @@ qca8k_mdio_write(struct qca8k_priv *priv + QCA8K_MDIO_MASTER_REG_ADDR(regnum) | + QCA8K_MDIO_MASTER_DATA(data); + +- qca8k_write(priv, QCA8K_MDIO_MASTER_CTRL, val); ++ ret = qca8k_write(priv, QCA8K_MDIO_MASTER_CTRL, val); ++ if (ret) ++ return ret; + + return qca8k_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_BUSY); +@@ -623,6 +640,7 @@ static int + qca8k_mdio_read(struct qca8k_priv *priv, int port, u32 regnum) + { + u32 phy, val; ++ int ret; + + if (regnum >= QCA8K_MDIO_MASTER_MAX_REG) + return -EINVAL; +@@ -635,7 +653,9 @@ qca8k_mdio_read(struct qca8k_priv *priv, + QCA8K_MDIO_MASTER_READ | QCA8K_MDIO_MASTER_PHY_ADDR(phy) | + QCA8K_MDIO_MASTER_REG_ADDR(regnum); + +- qca8k_write(priv, QCA8K_MDIO_MASTER_CTRL, val); ++ ret = qca8k_write(priv, QCA8K_MDIO_MASTER_CTRL, val); ++ if (ret) ++ return ret; + + if (qca8k_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_BUSY)) +@@ -766,12 +786,18 @@ qca8k_setup(struct dsa_switch *ds) + QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN); + + /* Enable MIB counters */ +- qca8k_mib_init(priv); ++ ret = qca8k_mib_init(priv); ++ if (ret) ++ dev_warn(priv->dev, "mib init failed"); + + /* Enable QCA header mode on the cpu port */ +- qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(QCA8K_CPU_PORT), +- QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_TX_S | +- QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_RX_S); ++ ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(QCA8K_CPU_PORT), ++ QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_TX_S | ++ QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_RX_S); ++ if (ret) { ++ dev_err(priv->dev, "failed enabling QCA header mode"); ++ return ret; ++ } + + /* Disable forwarding by default on all ports */ + for (i = 0; i < QCA8K_NUM_PORTS; i++) +@@ -783,11 +809,13 @@ qca8k_setup(struct dsa_switch *ds) + qca8k_port_set_status(priv, i, 0); + + /* Forward all unknown frames to CPU port for Linux processing */ +- qca8k_write(priv, QCA8K_REG_GLOBAL_FW_CTRL1, +- BIT(0) << QCA8K_GLOBAL_FW_CTRL1_IGMP_DP_S | +- BIT(0) << QCA8K_GLOBAL_FW_CTRL1_BC_DP_S | +- BIT(0) << QCA8K_GLOBAL_FW_CTRL1_MC_DP_S | +- BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S); ++ ret = qca8k_write(priv, QCA8K_REG_GLOBAL_FW_CTRL1, ++ BIT(0) << QCA8K_GLOBAL_FW_CTRL1_IGMP_DP_S | ++ BIT(0) << QCA8K_GLOBAL_FW_CTRL1_BC_DP_S | ++ BIT(0) << QCA8K_GLOBAL_FW_CTRL1_MC_DP_S | ++ BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S); ++ if (ret) ++ return ret; + + /* Setup connection between CPU port & user ports */ + for (i = 0; i < QCA8K_NUM_PORTS; i++) { +@@ -815,16 +843,20 @@ qca8k_setup(struct dsa_switch *ds) + qca8k_rmw(priv, QCA8K_EGRESS_VLAN(i), + 0xfff << shift, + QCA8K_PORT_VID_DEF << shift); +- qca8k_write(priv, QCA8K_REG_PORT_VLAN_CTRL0(i), +- QCA8K_PORT_VLAN_CVID(QCA8K_PORT_VID_DEF) | +- QCA8K_PORT_VLAN_SVID(QCA8K_PORT_VID_DEF)); ++ ret = qca8k_write(priv, QCA8K_REG_PORT_VLAN_CTRL0(i), ++ QCA8K_PORT_VLAN_CVID(QCA8K_PORT_VID_DEF) | ++ QCA8K_PORT_VLAN_SVID(QCA8K_PORT_VID_DEF)); ++ if (ret) ++ return ret; + } + } + + /* Setup our port MTUs to match power on defaults */ + for (i = 0; i < QCA8K_NUM_PORTS; i++) + priv->port_mtu[i] = ETH_FRAME_LEN + ETH_FCS_LEN; +- qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, ETH_FRAME_LEN + ETH_FCS_LEN); ++ ret = qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, ETH_FRAME_LEN + ETH_FCS_LEN); ++ if (ret) ++ dev_warn(priv->dev, "failed setting MTU settings"); + + /* Flush the FDB table */ + qca8k_fdb_flush(priv); +@@ -1140,8 +1172,8 @@ qca8k_set_mac_eee(struct dsa_switch *ds, + { + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; + u32 lpi_en = QCA8K_REG_EEE_CTRL_LPI_EN(port); +- int ret = 0; + u32 reg; ++ int ret; + + mutex_lock(&priv->reg_mutex); + reg = qca8k_read(priv, QCA8K_REG_EEE_CTRL); +@@ -1154,7 +1186,7 @@ qca8k_set_mac_eee(struct dsa_switch *ds, + reg |= lpi_en; + else + reg &= ~lpi_en; +- qca8k_write(priv, QCA8K_REG_EEE_CTRL, reg); ++ ret = qca8k_write(priv, QCA8K_REG_EEE_CTRL, reg); + + exit: + mutex_unlock(&priv->reg_mutex); +@@ -1284,9 +1316,7 @@ qca8k_port_change_mtu(struct dsa_switch + mtu = priv->port_mtu[i]; + + /* Include L2 header / FCS length */ +- qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, mtu + ETH_HLEN + ETH_FCS_LEN); +- +- return 0; ++ return qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, mtu + ETH_HLEN + ETH_FCS_LEN); + } + + static int diff --git a/target/linux/generic/backport-5.10/785-v5.14-07-net-dsa-qca8k-handle-error-with-qca8k_rmw-operation.patch b/target/linux/generic/backport-5.10/785-v5.14-07-net-dsa-qca8k-handle-error-with-qca8k_rmw-operation.patch new file mode 100644 index 0000000000..506966f1af --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-07-net-dsa-qca8k-handle-error-with-qca8k_rmw-operation.patch @@ -0,0 +1,226 @@ +From aaf421425cbdec4eb6fd75a29e65c2867b0b7bbd Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 22:59:57 +0200 +Subject: [PATCH] net: dsa: qca8k: handle error with qca8k_rmw operation + +qca8k_rmw can fail. Rework any user to handle error values and +correctly return. Change qca8k_rmw to return the error code or 0 instead +of the reg value. The reg returned by qca8k_rmw wasn't used anywhere, +so this doesn't cause any functional change. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 133 +++++++++++++++++++++++++--------------- + 1 file changed, 83 insertions(+), 50 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -190,12 +190,13 @@ exit: + return ret; + } + +-static u32 +-qca8k_rmw(struct qca8k_priv *priv, u32 reg, u32 mask, u32 val) ++static int ++qca8k_rmw(struct qca8k_priv *priv, u32 reg, u32 mask, u32 write_val) + { + struct mii_bus *bus = priv->bus; + u16 r1, r2, page; +- u32 ret; ++ u32 val; ++ int ret; + + qca8k_split_addr(reg, &r1, &r2, &page); + +@@ -205,10 +206,15 @@ qca8k_rmw(struct qca8k_priv *priv, u32 r + if (ret < 0) + goto exit; + +- ret = qca8k_mii_read32(bus, 0x10 | r2, r1); +- ret &= ~mask; +- ret |= val; +- qca8k_mii_write32(bus, 0x10 | r2, r1, ret); ++ val = qca8k_mii_read32(bus, 0x10 | r2, r1); ++ if (val < 0) { ++ ret = val; ++ goto exit; ++ } ++ ++ val &= ~mask; ++ val |= write_val; ++ qca8k_mii_write32(bus, 0x10 | r2, r1, val); + + exit: + mutex_unlock(&bus->mdio_lock); +@@ -216,16 +222,16 @@ exit: + return ret; + } + +-static void ++static int + qca8k_reg_set(struct qca8k_priv *priv, u32 reg, u32 val) + { +- qca8k_rmw(priv, reg, 0, val); ++ return qca8k_rmw(priv, reg, 0, val); + } + +-static void ++static int + qca8k_reg_clear(struct qca8k_priv *priv, u32 reg, u32 val) + { +- qca8k_rmw(priv, reg, val, 0); ++ return qca8k_rmw(priv, reg, val, 0); + } + + static int +@@ -570,12 +576,19 @@ qca8k_mib_init(struct qca8k_priv *priv) + int ret; + + mutex_lock(&priv->reg_mutex); +- qca8k_reg_set(priv, QCA8K_REG_MIB, QCA8K_MIB_FLUSH | QCA8K_MIB_BUSY); ++ ret = qca8k_reg_set(priv, QCA8K_REG_MIB, QCA8K_MIB_FLUSH | QCA8K_MIB_BUSY); ++ if (ret) ++ goto exit; ++ + qca8k_busy_wait(priv, QCA8K_REG_MIB, QCA8K_MIB_BUSY); +- qca8k_reg_set(priv, QCA8K_REG_MIB, QCA8K_MIB_CPU_KEEP); ++ ++ ret = qca8k_reg_set(priv, QCA8K_REG_MIB, QCA8K_MIB_CPU_KEEP); ++ if (ret) ++ goto exit; + + ret = qca8k_write(priv, QCA8K_REG_MODULE_EN, QCA8K_MODULE_EN_MIB); + ++exit: + mutex_unlock(&priv->reg_mutex); + return ret; + } +@@ -747,9 +760,8 @@ qca8k_setup_mdio_bus(struct qca8k_priv * + * a dt-overlay and driver reload changed the configuration + */ + +- qca8k_reg_clear(priv, QCA8K_MDIO_MASTER_CTRL, +- QCA8K_MDIO_MASTER_EN); +- return 0; ++ return qca8k_reg_clear(priv, QCA8K_MDIO_MASTER_CTRL, ++ QCA8K_MDIO_MASTER_EN); + } + + priv->ops.phy_read = qca8k_phy_read; +@@ -782,8 +794,12 @@ qca8k_setup(struct dsa_switch *ds) + return ret; + + /* Enable CPU Port */ +- qca8k_reg_set(priv, QCA8K_REG_GLOBAL_FW_CTRL0, +- QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN); ++ ret = qca8k_reg_set(priv, QCA8K_REG_GLOBAL_FW_CTRL0, ++ QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN); ++ if (ret) { ++ dev_err(priv->dev, "failed enabling CPU port"); ++ return ret; ++ } + + /* Enable MIB counters */ + ret = qca8k_mib_init(priv); +@@ -800,9 +816,12 @@ qca8k_setup(struct dsa_switch *ds) + } + + /* Disable forwarding by default on all ports */ +- for (i = 0; i < QCA8K_NUM_PORTS; i++) +- qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i), +- QCA8K_PORT_LOOKUP_MEMBER, 0); ++ for (i = 0; i < QCA8K_NUM_PORTS; i++) { ++ ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i), ++ QCA8K_PORT_LOOKUP_MEMBER, 0); ++ if (ret) ++ return ret; ++ } + + /* Disable MAC by default on all ports */ + for (i = 1; i < QCA8K_NUM_PORTS; i++) +@@ -821,28 +840,37 @@ qca8k_setup(struct dsa_switch *ds) + for (i = 0; i < QCA8K_NUM_PORTS; i++) { + /* CPU port gets connected to all user ports of the switch */ + if (dsa_is_cpu_port(ds, i)) { +- qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT), +- QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds)); ++ ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT), ++ QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds)); ++ if (ret) ++ return ret; + } + + /* Individual user ports get connected to CPU port only */ + if (dsa_is_user_port(ds, i)) { + int shift = 16 * (i % 2); + +- qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i), +- QCA8K_PORT_LOOKUP_MEMBER, +- BIT(QCA8K_CPU_PORT)); ++ ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i), ++ QCA8K_PORT_LOOKUP_MEMBER, ++ BIT(QCA8K_CPU_PORT)); ++ if (ret) ++ return ret; + + /* Enable ARP Auto-learning by default */ +- qca8k_reg_set(priv, QCA8K_PORT_LOOKUP_CTRL(i), +- QCA8K_PORT_LOOKUP_LEARN); ++ ret = qca8k_reg_set(priv, QCA8K_PORT_LOOKUP_CTRL(i), ++ QCA8K_PORT_LOOKUP_LEARN); ++ if (ret) ++ return ret; + + /* For port based vlans to work we need to set the + * default egress vid + */ +- qca8k_rmw(priv, QCA8K_EGRESS_VLAN(i), +- 0xfff << shift, +- QCA8K_PORT_VID_DEF << shift); ++ ret = qca8k_rmw(priv, QCA8K_EGRESS_VLAN(i), ++ 0xfff << shift, ++ QCA8K_PORT_VID_DEF << shift); ++ if (ret) ++ return ret; ++ + ret = qca8k_write(priv, QCA8K_REG_PORT_VLAN_CTRL0(i), + QCA8K_PORT_VLAN_CVID(QCA8K_PORT_VID_DEF) | + QCA8K_PORT_VLAN_SVID(QCA8K_PORT_VID_DEF)); +@@ -1234,7 +1262,7 @@ qca8k_port_bridge_join(struct dsa_switch + { + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; + int port_mask = BIT(QCA8K_CPU_PORT); +- int i; ++ int i, ret; + + for (i = 1; i < QCA8K_NUM_PORTS; i++) { + if (dsa_to_port(ds, i)->bridge_dev != br) +@@ -1242,17 +1270,20 @@ qca8k_port_bridge_join(struct dsa_switch + /* Add this port to the portvlan mask of the other ports + * in the bridge + */ +- qca8k_reg_set(priv, +- QCA8K_PORT_LOOKUP_CTRL(i), +- BIT(port)); ++ ret = qca8k_reg_set(priv, ++ QCA8K_PORT_LOOKUP_CTRL(i), ++ BIT(port)); ++ if (ret) ++ return ret; + if (i != port) + port_mask |= BIT(i); + } ++ + /* Add all other ports to this ports portvlan mask */ +- qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port), +- QCA8K_PORT_LOOKUP_MEMBER, port_mask); ++ ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port), ++ QCA8K_PORT_LOOKUP_MEMBER, port_mask); + +- return 0; ++ return ret; + } + + static void diff --git a/target/linux/generic/backport-5.10/785-v5.14-08-net-dsa-qca8k-handle-error-from-qca8k_busy_wait.patch b/target/linux/generic/backport-5.10/785-v5.14-08-net-dsa-qca8k-handle-error-from-qca8k_busy_wait.patch new file mode 100644 index 0000000000..360ce1d947 --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-08-net-dsa-qca8k-handle-error-from-qca8k_busy_wait.patch @@ -0,0 +1,66 @@ +From b7c818d194927bdc60ed15db55bb8654496a36b7 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 22:59:58 +0200 +Subject: [PATCH] net: dsa: qca8k: handle error from qca8k_busy_wait + +Propagate errors from qca8k_busy_wait instead of hardcoding return +value. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 21 +++++++++++++-------- + 1 file changed, 13 insertions(+), 8 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -388,8 +388,9 @@ qca8k_fdb_access(struct qca8k_priv *priv + return ret; + + /* wait for completion */ +- if (qca8k_busy_wait(priv, QCA8K_REG_ATU_FUNC, QCA8K_ATU_FUNC_BUSY)) +- return -1; ++ ret = qca8k_busy_wait(priv, QCA8K_REG_ATU_FUNC, QCA8K_ATU_FUNC_BUSY); ++ if (ret) ++ return ret; + + /* Check for table full violation when adding an entry */ + if (cmd == QCA8K_FDB_LOAD) { +@@ -468,8 +469,9 @@ qca8k_vlan_access(struct qca8k_priv *pri + return ret; + + /* wait for completion */ +- if (qca8k_busy_wait(priv, QCA8K_REG_VTU_FUNC1, QCA8K_VTU_FUNC1_BUSY)) +- return -ETIMEDOUT; ++ ret = qca8k_busy_wait(priv, QCA8K_REG_VTU_FUNC1, QCA8K_VTU_FUNC1_BUSY); ++ if (ret) ++ return ret; + + /* Check for table full violation when adding an entry */ + if (cmd == QCA8K_VLAN_LOAD) { +@@ -580,7 +582,9 @@ qca8k_mib_init(struct qca8k_priv *priv) + if (ret) + goto exit; + +- qca8k_busy_wait(priv, QCA8K_REG_MIB, QCA8K_MIB_BUSY); ++ ret = qca8k_busy_wait(priv, QCA8K_REG_MIB, QCA8K_MIB_BUSY); ++ if (ret) ++ goto exit; + + ret = qca8k_reg_set(priv, QCA8K_REG_MIB, QCA8K_MIB_CPU_KEEP); + if (ret) +@@ -670,9 +674,10 @@ qca8k_mdio_read(struct qca8k_priv *priv, + if (ret) + return ret; + +- if (qca8k_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, +- QCA8K_MDIO_MASTER_BUSY)) +- return -ETIMEDOUT; ++ ret = qca8k_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, ++ QCA8K_MDIO_MASTER_BUSY); ++ if (ret) ++ return ret; + + val = qca8k_read(priv, QCA8K_MDIO_MASTER_CTRL); + if (val < 0) diff --git a/target/linux/generic/backport-5.10/785-v5.14-09-net-dsa-qca8k-add-support-for-qca8327-switch.patch b/target/linux/generic/backport-5.10/785-v5.14-09-net-dsa-qca8k-add-support-for-qca8327-switch.patch new file mode 100644 index 0000000000..72305850ca --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-09-net-dsa-qca8k-add-support-for-qca8327-switch.patch @@ -0,0 +1,96 @@ +From 6e82a457e06252b59102486767539cc9c2aba60b Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 22:59:59 +0200 +Subject: [PATCH] net: dsa: qca8k: add support for qca8327 switch + +qca8327 switch is a low tier version of the more recent qca8337. +It does share the same regs used by the qca8k driver and can be +supported with minimal change. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Reviewed-by: Vladimir Oltean +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 23 ++++++++++++++++++++--- + drivers/net/dsa/qca8k.h | 6 ++++++ + 2 files changed, 26 insertions(+), 3 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1533,6 +1533,7 @@ static const struct dsa_switch_ops qca8k + static int + qca8k_sw_probe(struct mdio_device *mdiodev) + { ++ const struct qca8k_match_data *data; + struct qca8k_priv *priv; + u32 id; + +@@ -1560,6 +1561,11 @@ qca8k_sw_probe(struct mdio_device *mdiod + gpiod_set_value_cansleep(priv->reset_gpio, 0); + } + ++ /* get the switches ID from the compatible */ ++ data = of_device_get_match_data(&mdiodev->dev); ++ if (!data) ++ return -ENODEV; ++ + /* read the switches ID register */ + id = qca8k_read(priv, QCA8K_REG_MASK_CTRL); + if (id < 0) +@@ -1567,8 +1573,10 @@ qca8k_sw_probe(struct mdio_device *mdiod + + id >>= QCA8K_MASK_CTRL_ID_S; + id &= QCA8K_MASK_CTRL_ID_M; +- if (id != QCA8K_ID_QCA8337) ++ if (id != data->id) { ++ dev_err(&mdiodev->dev, "Switch id detected %x but expected %x", id, data->id); + return -ENODEV; ++ } + + priv->ds = devm_kzalloc(&mdiodev->dev, sizeof(*priv->ds), GFP_KERNEL); + if (!priv->ds) +@@ -1634,9 +1642,18 @@ static int qca8k_resume(struct device *d + static SIMPLE_DEV_PM_OPS(qca8k_pm_ops, + qca8k_suspend, qca8k_resume); + ++static const struct qca8k_match_data qca832x = { ++ .id = QCA8K_ID_QCA8327, ++}; ++ ++static const struct qca8k_match_data qca833x = { ++ .id = QCA8K_ID_QCA8337, ++}; ++ + static const struct of_device_id qca8k_of_match[] = { +- { .compatible = "qca,qca8334" }, +- { .compatible = "qca,qca8337" }, ++ { .compatible = "qca,qca8327", .data = &qca832x }, ++ { .compatible = "qca,qca8334", .data = &qca833x }, ++ { .compatible = "qca,qca8337", .data = &qca833x }, + { /* sentinel */ }, + }; + +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -15,6 +15,8 @@ + #define QCA8K_NUM_PORTS 7 + #define QCA8K_MAX_MTU 9000 + ++#define PHY_ID_QCA8327 0x004dd034 ++#define QCA8K_ID_QCA8327 0x12 + #define PHY_ID_QCA8337 0x004dd036 + #define QCA8K_ID_QCA8337 0x13 + +@@ -213,6 +215,10 @@ struct ar8xxx_port_status { + int enabled; + }; + ++struct qca8k_match_data { ++ u8 id; ++}; ++ + struct qca8k_priv { + struct regmap *regmap; + struct mii_bus *bus; diff --git a/target/linux/generic/backport-5.10/785-v5.14-10-devicetree-net-dsa-qca8k-Document-new-compatible-qca.patch b/target/linux/generic/backport-5.10/785-v5.14-10-devicetree-net-dsa-qca8k-Document-new-compatible-qca.patch new file mode 100644 index 0000000000..3c4a14bd0b --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-10-devicetree-net-dsa-qca8k-Document-new-compatible-qca.patch @@ -0,0 +1,26 @@ +From 227a9ffc1bc77037339530607fe129af3824620e Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:00 +0200 +Subject: [PATCH] devicetree: net: dsa: qca8k: Document new compatible qca8327 + +Add support for qca8327 in the compatible list. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Acked-by: Rob Herring +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + Documentation/devicetree/bindings/net/dsa/qca8k.txt | 1 + + 1 file changed, 1 insertion(+) + +--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt ++++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt +@@ -3,6 +3,7 @@ + Required properties: + + - compatible: should be one of: ++ "qca,qca8327" + "qca,qca8334" + "qca,qca8337" + diff --git a/target/linux/generic/backport-5.10/785-v5.14-11-net-dsa-qca8k-add-priority-tweak-to-qca8337-switch.patch b/target/linux/generic/backport-5.10/785-v5.14-11-net-dsa-qca8k-add-priority-tweak-to-qca8337-switch.patch new file mode 100644 index 0000000000..cd3050ef71 --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-11-net-dsa-qca8k-add-priority-tweak-to-qca8337-switch.patch @@ -0,0 +1,130 @@ +From 83a3ceb39b2495171aabe9446271b94c678354f3 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:01 +0200 +Subject: [PATCH] net: dsa: qca8k: add priority tweak to qca8337 switch + +The port 5 of the qca8337 have some problem in flood condition. The +original legacy driver had some specific buffer and priority settings +for the different port suggested by the QCA switch team. Add this +missing settings to improve switch stability under load condition. +The packet priority tweak is only needed for the qca8337 switch and +other qca8k switch are not affected. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 47 +++++++++++++++++++++++++++++++++++++++++ + drivers/net/dsa/qca8k.h | 25 ++++++++++++++++++++++ + 2 files changed, 72 insertions(+) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -779,6 +779,7 @@ qca8k_setup(struct dsa_switch *ds) + { + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; + int ret, i; ++ u32 mask; + + /* Make sure that port 0 is the cpu port */ + if (!dsa_is_cpu_port(ds, 0)) { +@@ -884,6 +885,51 @@ qca8k_setup(struct dsa_switch *ds) + } + } + ++ /* The port 5 of the qca8337 have some problem in flood condition. The ++ * original legacy driver had some specific buffer and priority settings ++ * for the different port suggested by the QCA switch team. Add this ++ * missing settings to improve switch stability under load condition. ++ * This problem is limited to qca8337 and other qca8k switch are not affected. ++ */ ++ if (priv->switch_id == QCA8K_ID_QCA8337) { ++ for (i = 0; i < QCA8K_NUM_PORTS; i++) { ++ switch (i) { ++ /* The 2 CPU port and port 5 requires some different ++ * priority than any other ports. ++ */ ++ case 0: ++ case 5: ++ case 6: ++ mask = QCA8K_PORT_HOL_CTRL0_EG_PRI0(0x3) | ++ QCA8K_PORT_HOL_CTRL0_EG_PRI1(0x4) | ++ QCA8K_PORT_HOL_CTRL0_EG_PRI2(0x4) | ++ QCA8K_PORT_HOL_CTRL0_EG_PRI3(0x4) | ++ QCA8K_PORT_HOL_CTRL0_EG_PRI4(0x6) | ++ QCA8K_PORT_HOL_CTRL0_EG_PRI5(0x8) | ++ QCA8K_PORT_HOL_CTRL0_EG_PORT(0x1e); ++ break; ++ default: ++ mask = QCA8K_PORT_HOL_CTRL0_EG_PRI0(0x3) | ++ QCA8K_PORT_HOL_CTRL0_EG_PRI1(0x4) | ++ QCA8K_PORT_HOL_CTRL0_EG_PRI2(0x6) | ++ QCA8K_PORT_HOL_CTRL0_EG_PRI3(0x8) | ++ QCA8K_PORT_HOL_CTRL0_EG_PORT(0x19); ++ } ++ qca8k_write(priv, QCA8K_REG_PORT_HOL_CTRL0(i), mask); ++ ++ mask = QCA8K_PORT_HOL_CTRL1_ING(0x6) | ++ QCA8K_PORT_HOL_CTRL1_EG_PRI_BUF_EN | ++ QCA8K_PORT_HOL_CTRL1_EG_PORT_BUF_EN | ++ QCA8K_PORT_HOL_CTRL1_WRED_EN; ++ qca8k_rmw(priv, QCA8K_REG_PORT_HOL_CTRL1(i), ++ QCA8K_PORT_HOL_CTRL1_ING_BUF | ++ QCA8K_PORT_HOL_CTRL1_EG_PRI_BUF_EN | ++ QCA8K_PORT_HOL_CTRL1_EG_PORT_BUF_EN | ++ QCA8K_PORT_HOL_CTRL1_WRED_EN, ++ mask); ++ } ++ } ++ + /* Setup our port MTUs to match power on defaults */ + for (i = 0; i < QCA8K_NUM_PORTS; i++) + priv->port_mtu[i] = ETH_FRAME_LEN + ETH_FCS_LEN; +@@ -1578,6 +1624,7 @@ qca8k_sw_probe(struct mdio_device *mdiod + return -ENODEV; + } + ++ priv->switch_id = id; + priv->ds = devm_kzalloc(&mdiodev->dev, sizeof(*priv->ds), GFP_KERNEL); + if (!priv->ds) + return -ENOMEM; +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -168,6 +168,30 @@ + #define QCA8K_PORT_LOOKUP_STATE GENMASK(18, 16) + #define QCA8K_PORT_LOOKUP_LEARN BIT(20) + ++#define QCA8K_REG_PORT_HOL_CTRL0(_i) (0x970 + (_i) * 0x8) ++#define QCA8K_PORT_HOL_CTRL0_EG_PRI0_BUF GENMASK(3, 0) ++#define QCA8K_PORT_HOL_CTRL0_EG_PRI0(x) ((x) << 0) ++#define QCA8K_PORT_HOL_CTRL0_EG_PRI1_BUF GENMASK(7, 4) ++#define QCA8K_PORT_HOL_CTRL0_EG_PRI1(x) ((x) << 4) ++#define QCA8K_PORT_HOL_CTRL0_EG_PRI2_BUF GENMASK(11, 8) ++#define QCA8K_PORT_HOL_CTRL0_EG_PRI2(x) ((x) << 8) ++#define QCA8K_PORT_HOL_CTRL0_EG_PRI3_BUF GENMASK(15, 12) ++#define QCA8K_PORT_HOL_CTRL0_EG_PRI3(x) ((x) << 12) ++#define QCA8K_PORT_HOL_CTRL0_EG_PRI4_BUF GENMASK(19, 16) ++#define QCA8K_PORT_HOL_CTRL0_EG_PRI4(x) ((x) << 16) ++#define QCA8K_PORT_HOL_CTRL0_EG_PRI5_BUF GENMASK(23, 20) ++#define QCA8K_PORT_HOL_CTRL0_EG_PRI5(x) ((x) << 20) ++#define QCA8K_PORT_HOL_CTRL0_EG_PORT_BUF GENMASK(29, 24) ++#define QCA8K_PORT_HOL_CTRL0_EG_PORT(x) ((x) << 24) ++ ++#define QCA8K_REG_PORT_HOL_CTRL1(_i) (0x974 + (_i) * 0x8) ++#define QCA8K_PORT_HOL_CTRL1_ING_BUF GENMASK(3, 0) ++#define QCA8K_PORT_HOL_CTRL1_ING(x) ((x) << 0) ++#define QCA8K_PORT_HOL_CTRL1_EG_PRI_BUF_EN BIT(6) ++#define QCA8K_PORT_HOL_CTRL1_EG_PORT_BUF_EN BIT(7) ++#define QCA8K_PORT_HOL_CTRL1_WRED_EN BIT(8) ++#define QCA8K_PORT_HOL_CTRL1_EG_MIRROR_EN BIT(16) ++ + /* Pkt edit registers */ + #define QCA8K_EGRESS_VLAN(x) (0x0c70 + (4 * (x / 2))) + +@@ -220,6 +244,7 @@ struct qca8k_match_data { + }; + + struct qca8k_priv { ++ u8 switch_id; + struct regmap *regmap; + struct mii_bus *bus; + struct ar8xxx_port_status port_sts[QCA8K_NUM_PORTS]; diff --git a/target/linux/generic/backport-5.10/785-v5.14-12-net-dsa-qca8k-limit-port5-delay-to-qca8337.patch b/target/linux/generic/backport-5.10/785-v5.14-12-net-dsa-qca8k-limit-port5-delay-to-qca8337.patch new file mode 100644 index 0000000000..d25edbb1aa --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-12-net-dsa-qca8k-limit-port5-delay-to-qca8337.patch @@ -0,0 +1,31 @@ +From 5bf9ff3b9fb5ecb67a1a3517b26db3a00f2a2f11 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:02 +0200 +Subject: [PATCH] net: dsa: qca8k: limit port5 delay to qca8337 + +Limit port5 rx delay to qca8337. This is taken from the legacy QSDK code +that limits the rx delay on port5 to only this particular switch version, +on other switch only the tx and rx delay for port0 are needed. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1003,8 +1003,10 @@ qca8k_phylink_mac_config(struct dsa_swit + QCA8K_PORT_PAD_RGMII_EN | + QCA8K_PORT_PAD_RGMII_TX_DELAY(QCA8K_MAX_DELAY) | + QCA8K_PORT_PAD_RGMII_RX_DELAY(QCA8K_MAX_DELAY)); +- qca8k_write(priv, QCA8K_REG_PORT5_PAD_CTRL, +- QCA8K_PORT_PAD_RGMII_RX_DELAY_EN); ++ /* QCA8337 requires to set rgmii rx delay */ ++ if (priv->switch_id == QCA8K_ID_QCA8337) ++ qca8k_write(priv, QCA8K_REG_PORT5_PAD_CTRL, ++ QCA8K_PORT_PAD_RGMII_RX_DELAY_EN); + break; + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: diff --git a/target/linux/generic/backport-5.10/785-v5.14-13-net-dsa-qca8k-add-GLOBAL_FC-settings-needed-for-qca8.patch b/target/linux/generic/backport-5.10/785-v5.14-13-net-dsa-qca8k-add-GLOBAL_FC-settings-needed-for-qca8.patch new file mode 100644 index 0000000000..2b393d242a --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-13-net-dsa-qca8k-add-GLOBAL_FC-settings-needed-for-qca8.patch @@ -0,0 +1,48 @@ +From 0fc57e4b5e39461fc0a54aae0afe4241363a7267 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:03 +0200 +Subject: [PATCH] net: dsa: qca8k: add GLOBAL_FC settings needed for qca8327 + +Switch qca8327 needs special settings for the GLOBAL_FC_THRES regs. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 10 ++++++++++ + drivers/net/dsa/qca8k.h | 6 ++++++ + 2 files changed, 16 insertions(+) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -930,6 +930,16 @@ qca8k_setup(struct dsa_switch *ds) + } + } + ++ /* Special GLOBAL_FC_THRESH value are needed for ar8327 switch */ ++ if (priv->switch_id == QCA8K_ID_QCA8327) { ++ mask = QCA8K_GLOBAL_FC_GOL_XON_THRES(288) | ++ QCA8K_GLOBAL_FC_GOL_XOFF_THRES(496); ++ qca8k_rmw(priv, QCA8K_REG_GLOBAL_FC_THRESH, ++ QCA8K_GLOBAL_FC_GOL_XON_THRES_S | ++ QCA8K_GLOBAL_FC_GOL_XOFF_THRES_S, ++ mask); ++ } ++ + /* Setup our port MTUs to match power on defaults */ + for (i = 0; i < QCA8K_NUM_PORTS; i++) + priv->port_mtu[i] = ETH_FRAME_LEN + ETH_FCS_LEN; +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -168,6 +168,12 @@ + #define QCA8K_PORT_LOOKUP_STATE GENMASK(18, 16) + #define QCA8K_PORT_LOOKUP_LEARN BIT(20) + ++#define QCA8K_REG_GLOBAL_FC_THRESH 0x800 ++#define QCA8K_GLOBAL_FC_GOL_XON_THRES(x) ((x) << 16) ++#define QCA8K_GLOBAL_FC_GOL_XON_THRES_S GENMASK(24, 16) ++#define QCA8K_GLOBAL_FC_GOL_XOFF_THRES(x) ((x) << 0) ++#define QCA8K_GLOBAL_FC_GOL_XOFF_THRES_S GENMASK(8, 0) ++ + #define QCA8K_REG_PORT_HOL_CTRL0(_i) (0x970 + (_i) * 0x8) + #define QCA8K_PORT_HOL_CTRL0_EG_PRI0_BUF GENMASK(3, 0) + #define QCA8K_PORT_HOL_CTRL0_EG_PRI0(x) ((x) << 0) diff --git a/target/linux/generic/backport-5.10/785-v5.14-14-net-dsa-qca8k-add-support-for-switch-rev.patch b/target/linux/generic/backport-5.10/785-v5.14-14-net-dsa-qca8k-add-support-for-switch-rev.patch new file mode 100644 index 0000000000..ed9b8188de --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-14-net-dsa-qca8k-add-support-for-switch-rev.patch @@ -0,0 +1,114 @@ +From 95ffeaf18b3bb90eeef52cbf7d79ccc9d0345ff5 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:04 +0200 +Subject: [PATCH] net: dsa: qca8k: add support for switch rev + +qca8k internal phy driver require some special debug value to be set +based on the switch revision. Rework the switch id read function to +also read the chip revision. + +Signed-off-by: Ansuel Smith +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 53 ++++++++++++++++++++++++++--------------- + drivers/net/dsa/qca8k.h | 7 ++++-- + 2 files changed, 39 insertions(+), 21 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1588,12 +1588,40 @@ static const struct dsa_switch_ops qca8k + .phylink_mac_link_up = qca8k_phylink_mac_link_up, + }; + ++static int qca8k_read_switch_id(struct qca8k_priv *priv) ++{ ++ const struct qca8k_match_data *data; ++ u32 val; ++ u8 id; ++ ++ /* get the switches ID from the compatible */ ++ data = of_device_get_match_data(priv->dev); ++ if (!data) ++ return -ENODEV; ++ ++ val = qca8k_read(priv, QCA8K_REG_MASK_CTRL); ++ if (val < 0) ++ return -ENODEV; ++ ++ id = QCA8K_MASK_CTRL_DEVICE_ID(val & QCA8K_MASK_CTRL_DEVICE_ID_MASK); ++ if (id != data->id) { ++ dev_err(priv->dev, "Switch id detected %x but expected %x", id, data->id); ++ return -ENODEV; ++ } ++ ++ priv->switch_id = id; ++ ++ /* Save revision to communicate to the internal PHY driver */ ++ priv->switch_revision = (val & QCA8K_MASK_CTRL_REV_ID_MASK); ++ ++ return 0; ++} ++ + static int + qca8k_sw_probe(struct mdio_device *mdiodev) + { +- const struct qca8k_match_data *data; + struct qca8k_priv *priv; +- u32 id; ++ int ret; + + /* allocate the private data struct so that we can probe the switches + * ID register +@@ -1619,24 +1647,11 @@ qca8k_sw_probe(struct mdio_device *mdiod + gpiod_set_value_cansleep(priv->reset_gpio, 0); + } + +- /* get the switches ID from the compatible */ +- data = of_device_get_match_data(&mdiodev->dev); +- if (!data) +- return -ENODEV; ++ /* Check the detected switch id */ ++ ret = qca8k_read_switch_id(priv); ++ if (ret) ++ return ret; + +- /* read the switches ID register */ +- id = qca8k_read(priv, QCA8K_REG_MASK_CTRL); +- if (id < 0) +- return id; +- +- id >>= QCA8K_MASK_CTRL_ID_S; +- id &= QCA8K_MASK_CTRL_ID_M; +- if (id != data->id) { +- dev_err(&mdiodev->dev, "Switch id detected %x but expected %x", id, data->id); +- return -ENODEV; +- } +- +- priv->switch_id = id; + priv->ds = devm_kzalloc(&mdiodev->dev, sizeof(*priv->ds), GFP_KERNEL); + if (!priv->ds) + return -ENOMEM; +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -30,8 +30,10 @@ + + /* Global control registers */ + #define QCA8K_REG_MASK_CTRL 0x000 +-#define QCA8K_MASK_CTRL_ID_M 0xff +-#define QCA8K_MASK_CTRL_ID_S 8 ++#define QCA8K_MASK_CTRL_REV_ID_MASK GENMASK(7, 0) ++#define QCA8K_MASK_CTRL_REV_ID(x) ((x) >> 0) ++#define QCA8K_MASK_CTRL_DEVICE_ID_MASK GENMASK(15, 8) ++#define QCA8K_MASK_CTRL_DEVICE_ID(x) ((x) >> 8) + #define QCA8K_REG_PORT0_PAD_CTRL 0x004 + #define QCA8K_REG_PORT5_PAD_CTRL 0x008 + #define QCA8K_REG_PORT6_PAD_CTRL 0x00c +@@ -251,6 +253,7 @@ struct qca8k_match_data { + + struct qca8k_priv { + u8 switch_id; ++ u8 switch_revision; + struct regmap *regmap; + struct mii_bus *bus; + struct ar8xxx_port_status port_sts[QCA8K_NUM_PORTS]; diff --git a/target/linux/generic/backport-5.10/785-v5.14-15-net-dsa-qca8k-add-ethernet-ports-fallback-to-setup_m.patch b/target/linux/generic/backport-5.10/785-v5.14-15-net-dsa-qca8k-add-ethernet-ports-fallback-to-setup_m.patch new file mode 100644 index 0000000000..629cb324e0 --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-15-net-dsa-qca8k-add-ethernet-ports-fallback-to-setup_m.patch @@ -0,0 +1,28 @@ +From 1ee0591a1093c2448642c33433483e9260275f7b Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:05 +0200 +Subject: [PATCH] net: dsa: qca8k: add ethernet-ports fallback to + setup_mdio_bus + +Dsa now also supports ethernet-ports. Add this new binding as a fallback +if the ports node can't be found. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -719,6 +719,9 @@ qca8k_setup_mdio_bus(struct qca8k_priv * + + ports = of_get_child_by_name(priv->dev->of_node, "ports"); + if (!ports) ++ ports = of_get_child_by_name(priv->dev->of_node, "ethernet-ports"); ++ ++ if (!ports) + return -EINVAL; + + for_each_available_child_of_node(ports, port) { diff --git a/target/linux/generic/backport-5.10/785-v5.14-16-net-dsa-qca8k-make-rgmii-delay-configurable.patch b/target/linux/generic/backport-5.10/785-v5.14-16-net-dsa-qca8k-make-rgmii-delay-configurable.patch new file mode 100644 index 0000000000..6dc2dc6e3e --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-16-net-dsa-qca8k-make-rgmii-delay-configurable.patch @@ -0,0 +1,188 @@ +From e4b9977cee1583da38a6e9118078bb728aaccf7b Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:06 +0200 +Subject: [PATCH] net: dsa: qca8k: make rgmii delay configurable + +The legacy qsdk code used a different delay instead of the max value. +Qsdk use 1 ns for rx and 2 ns for tx. Make these values configurable +using the standard rx/tx-internal-delay-ps ethernet binding and apply +qsdk values by default. The connected gmac doesn't add any delay so no +additional delay is added to tx/rx. +On this switch the delay is actually in ns so value should be in the +1000 order. Any value converted from ps to ns by dividing it by 1000 +as the switch max value for delay is 3ns. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 82 ++++++++++++++++++++++++++++++++++++++++- + drivers/net/dsa/qca8k.h | 11 +++--- + 2 files changed, 86 insertions(+), 7 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -778,6 +778,68 @@ qca8k_setup_mdio_bus(struct qca8k_priv * + } + + static int ++qca8k_setup_of_rgmii_delay(struct qca8k_priv *priv) ++{ ++ struct device_node *port_dn; ++ phy_interface_t mode; ++ struct dsa_port *dp; ++ u32 val; ++ ++ /* CPU port is already checked */ ++ dp = dsa_to_port(priv->ds, 0); ++ ++ port_dn = dp->dn; ++ ++ /* Check if port 0 is set to the correct type */ ++ of_get_phy_mode(port_dn, &mode); ++ if (mode != PHY_INTERFACE_MODE_RGMII_ID && ++ mode != PHY_INTERFACE_MODE_RGMII_RXID && ++ mode != PHY_INTERFACE_MODE_RGMII_TXID) { ++ return 0; ++ } ++ ++ switch (mode) { ++ case PHY_INTERFACE_MODE_RGMII_ID: ++ case PHY_INTERFACE_MODE_RGMII_RXID: ++ if (of_property_read_u32(port_dn, "rx-internal-delay-ps", &val)) ++ val = 2; ++ else ++ /* Switch regs accept value in ns, convert ps to ns */ ++ val = val / 1000; ++ ++ if (val > QCA8K_MAX_DELAY) { ++ dev_err(priv->dev, "rgmii rx delay is limited to a max value of 3ns, setting to the max value"); ++ val = 3; ++ } ++ ++ priv->rgmii_rx_delay = val; ++ /* Stop here if we need to check only for rx delay */ ++ if (mode != PHY_INTERFACE_MODE_RGMII_ID) ++ break; ++ ++ fallthrough; ++ case PHY_INTERFACE_MODE_RGMII_TXID: ++ if (of_property_read_u32(port_dn, "tx-internal-delay-ps", &val)) ++ val = 1; ++ else ++ /* Switch regs accept value in ns, convert ps to ns */ ++ val = val / 1000; ++ ++ if (val > QCA8K_MAX_DELAY) { ++ dev_err(priv->dev, "rgmii tx delay is limited to a max value of 3ns, setting to the max value"); ++ val = 3; ++ } ++ ++ priv->rgmii_tx_delay = val; ++ break; ++ default: ++ return 0; ++ } ++ ++ return 0; ++} ++ ++static int + qca8k_setup(struct dsa_switch *ds) + { + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; +@@ -802,6 +864,10 @@ qca8k_setup(struct dsa_switch *ds) + if (ret) + return ret; + ++ ret = qca8k_setup_of_rgmii_delay(priv); ++ if (ret) ++ return ret; ++ + /* Enable CPU Port */ + ret = qca8k_reg_set(priv, QCA8K_REG_GLOBAL_FW_CTRL0, + QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN); +@@ -970,6 +1036,8 @@ qca8k_phylink_mac_config(struct dsa_swit + case 0: /* 1st CPU port */ + if (state->interface != PHY_INTERFACE_MODE_RGMII && + state->interface != PHY_INTERFACE_MODE_RGMII_ID && ++ state->interface != PHY_INTERFACE_MODE_RGMII_TXID && ++ state->interface != PHY_INTERFACE_MODE_RGMII_RXID && + state->interface != PHY_INTERFACE_MODE_SGMII) + return; + +@@ -985,6 +1053,8 @@ qca8k_phylink_mac_config(struct dsa_swit + case 6: /* 2nd CPU port / external PHY */ + if (state->interface != PHY_INTERFACE_MODE_RGMII && + state->interface != PHY_INTERFACE_MODE_RGMII_ID && ++ state->interface != PHY_INTERFACE_MODE_RGMII_TXID && ++ state->interface != PHY_INTERFACE_MODE_RGMII_RXID && + state->interface != PHY_INTERFACE_MODE_SGMII && + state->interface != PHY_INTERFACE_MODE_1000BASEX) + return; +@@ -1008,14 +1078,18 @@ qca8k_phylink_mac_config(struct dsa_swit + qca8k_write(priv, reg, QCA8K_PORT_PAD_RGMII_EN); + break; + case PHY_INTERFACE_MODE_RGMII_ID: ++ case PHY_INTERFACE_MODE_RGMII_TXID: ++ case PHY_INTERFACE_MODE_RGMII_RXID: + /* RGMII_ID needs internal delay. This is enabled through + * PORT5_PAD_CTRL for all ports, rather than individual port + * registers + */ + qca8k_write(priv, reg, + QCA8K_PORT_PAD_RGMII_EN | +- QCA8K_PORT_PAD_RGMII_TX_DELAY(QCA8K_MAX_DELAY) | +- QCA8K_PORT_PAD_RGMII_RX_DELAY(QCA8K_MAX_DELAY)); ++ QCA8K_PORT_PAD_RGMII_TX_DELAY(priv->rgmii_tx_delay) | ++ QCA8K_PORT_PAD_RGMII_RX_DELAY(priv->rgmii_rx_delay) | ++ QCA8K_PORT_PAD_RGMII_TX_DELAY_EN | ++ QCA8K_PORT_PAD_RGMII_RX_DELAY_EN); + /* QCA8337 requires to set rgmii rx delay */ + if (priv->switch_id == QCA8K_ID_QCA8337) + qca8k_write(priv, QCA8K_REG_PORT5_PAD_CTRL, +@@ -1073,6 +1147,8 @@ qca8k_phylink_validate(struct dsa_switch + if (state->interface != PHY_INTERFACE_MODE_NA && + state->interface != PHY_INTERFACE_MODE_RGMII && + state->interface != PHY_INTERFACE_MODE_RGMII_ID && ++ state->interface != PHY_INTERFACE_MODE_RGMII_TXID && ++ state->interface != PHY_INTERFACE_MODE_RGMII_RXID && + state->interface != PHY_INTERFACE_MODE_SGMII) + goto unsupported; + break; +@@ -1090,6 +1166,8 @@ qca8k_phylink_validate(struct dsa_switch + if (state->interface != PHY_INTERFACE_MODE_NA && + state->interface != PHY_INTERFACE_MODE_RGMII && + state->interface != PHY_INTERFACE_MODE_RGMII_ID && ++ state->interface != PHY_INTERFACE_MODE_RGMII_TXID && ++ state->interface != PHY_INTERFACE_MODE_RGMII_RXID && + state->interface != PHY_INTERFACE_MODE_SGMII && + state->interface != PHY_INTERFACE_MODE_1000BASEX) + goto unsupported; +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -38,12 +38,11 @@ + #define QCA8K_REG_PORT5_PAD_CTRL 0x008 + #define QCA8K_REG_PORT6_PAD_CTRL 0x00c + #define QCA8K_PORT_PAD_RGMII_EN BIT(26) +-#define QCA8K_PORT_PAD_RGMII_TX_DELAY(x) \ +- ((0x8 + (x & 0x3)) << 22) +-#define QCA8K_PORT_PAD_RGMII_RX_DELAY(x) \ +- ((0x10 + (x & 0x3)) << 20) +-#define QCA8K_MAX_DELAY 3 ++#define QCA8K_PORT_PAD_RGMII_TX_DELAY(x) ((x) << 22) ++#define QCA8K_PORT_PAD_RGMII_RX_DELAY(x) ((x) << 20) ++#define QCA8K_PORT_PAD_RGMII_TX_DELAY_EN BIT(25) + #define QCA8K_PORT_PAD_RGMII_RX_DELAY_EN BIT(24) ++#define QCA8K_MAX_DELAY 3 + #define QCA8K_PORT_PAD_SGMII_EN BIT(7) + #define QCA8K_REG_PWS 0x010 + #define QCA8K_PWS_SERDES_AEN_DIS BIT(7) +@@ -254,6 +253,8 @@ struct qca8k_match_data { + struct qca8k_priv { + u8 switch_id; + u8 switch_revision; ++ u8 rgmii_tx_delay; ++ u8 rgmii_rx_delay; + struct regmap *regmap; + struct mii_bus *bus; + struct ar8xxx_port_status port_sts[QCA8K_NUM_PORTS]; diff --git a/target/linux/generic/backport-5.10/785-v5.14-17-net-dsa-qca8k-clear-MASTER_EN-after-phy-read-write.patch b/target/linux/generic/backport-5.10/785-v5.14-17-net-dsa-qca8k-clear-MASTER_EN-after-phy-read-write.patch new file mode 100644 index 0000000000..4593da032b --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-17-net-dsa-qca8k-clear-MASTER_EN-after-phy-read-write.patch @@ -0,0 +1,50 @@ +From 63c33bbfeb6842a956a0eb12901e28eb335bdb18 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:07 +0200 +Subject: [PATCH] net: dsa: qca8k: clear MASTER_EN after phy read/write + +Clear MDIO_MASTER_EN bit from MDIO_MASTER_CTRL after read/write +operation. The MDIO_MASTER_EN bit is not reset after read/write +operation and the next operation can be wrongly interpreted by the +switch as a mdio operation. This cause a production of wrong/garbage +data from the switch and underfined bheavior. (random port drop, +unplugged port flagged with link up, wrong port speed) +Also on driver remove the MASTER_CTRL can be left set and cause the +malfunction of any next driver using the mdio device. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -649,8 +649,14 @@ qca8k_mdio_write(struct qca8k_priv *priv + if (ret) + return ret; + +- return qca8k_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, +- QCA8K_MDIO_MASTER_BUSY); ++ ret = qca8k_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, ++ QCA8K_MDIO_MASTER_BUSY); ++ ++ /* even if the busy_wait timeouts try to clear the MASTER_EN */ ++ qca8k_reg_clear(priv, QCA8K_MDIO_MASTER_CTRL, ++ QCA8K_MDIO_MASTER_EN); ++ ++ return ret; + } + + static int +@@ -685,6 +691,10 @@ qca8k_mdio_read(struct qca8k_priv *priv, + + val &= QCA8K_MDIO_MASTER_DATA_MASK; + ++ /* even if the busy_wait timeouts try to clear the MASTER_EN */ ++ qca8k_reg_clear(priv, QCA8K_MDIO_MASTER_CTRL, ++ QCA8K_MDIO_MASTER_EN); ++ + return val; + } + diff --git a/target/linux/generic/backport-5.10/785-v5.14-18-net-dsa-qca8k-dsa-qca8k-protect-MASTER-busy_wait-wit.patch b/target/linux/generic/backport-5.10/785-v5.14-18-net-dsa-qca8k-dsa-qca8k-protect-MASTER-busy_wait-wit.patch new file mode 100644 index 0000000000..b6684d7210 --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-18-net-dsa-qca8k-dsa-qca8k-protect-MASTER-busy_wait-wit.patch @@ -0,0 +1,128 @@ +From 60df02b6ea4581d72eb7a3ab7204504a54059b72 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:08 +0200 +Subject: [PATCH] net: dsa: qca8k: dsa: qca8k: protect MASTER busy_wait with + mdio mutex + +MDIO_MASTER operation have a dedicated busy wait that is not protected +by the mdio mutex. This can cause situation where the MASTER operation +is done and a normal operation is executed between the MASTER read/write +and the MASTER busy_wait. Rework the qca8k_mdio_read/write function to +address this issue by binding the lock for the whole MASTER operation +and not only the mdio read/write common operation. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 68 +++++++++++++++++++++++++++++++++-------- + 1 file changed, 55 insertions(+), 13 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -628,8 +628,31 @@ qca8k_port_to_phy(int port) + } + + static int ++qca8k_mdio_busy_wait(struct qca8k_priv *priv, u32 reg, u32 mask) ++{ ++ u16 r1, r2, page; ++ u32 val; ++ int ret; ++ ++ qca8k_split_addr(reg, &r1, &r2, &page); ++ ++ ret = read_poll_timeout(qca8k_mii_read32, val, !(val & mask), 0, ++ QCA8K_BUSY_WAIT_TIMEOUT * USEC_PER_MSEC, false, ++ priv->bus, 0x10 | r2, r1); ++ ++ /* Check if qca8k_read has failed for a different reason ++ * before returnting -ETIMEDOUT ++ */ ++ if (ret < 0 && val < 0) ++ return val; ++ ++ return ret; ++} ++ ++static int + qca8k_mdio_write(struct qca8k_priv *priv, int port, u32 regnum, u16 data) + { ++ u16 r1, r2, page; + u32 phy, val; + int ret; + +@@ -645,12 +668,21 @@ qca8k_mdio_write(struct qca8k_priv *priv + QCA8K_MDIO_MASTER_REG_ADDR(regnum) | + QCA8K_MDIO_MASTER_DATA(data); + +- ret = qca8k_write(priv, QCA8K_MDIO_MASTER_CTRL, val); ++ qca8k_split_addr(QCA8K_MDIO_MASTER_CTRL, &r1, &r2, &page); ++ ++ mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); ++ ++ ret = qca8k_set_page(priv->bus, page); + if (ret) +- return ret; ++ goto exit; ++ ++ qca8k_mii_write32(priv->bus, 0x10 | r2, r1, val); + +- ret = qca8k_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, +- QCA8K_MDIO_MASTER_BUSY); ++ ret = qca8k_mdio_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, ++ QCA8K_MDIO_MASTER_BUSY); ++ ++exit: ++ mutex_unlock(&priv->bus->mdio_lock); + + /* even if the busy_wait timeouts try to clear the MASTER_EN */ + qca8k_reg_clear(priv, QCA8K_MDIO_MASTER_CTRL, +@@ -662,6 +694,7 @@ qca8k_mdio_write(struct qca8k_priv *priv + static int + qca8k_mdio_read(struct qca8k_priv *priv, int port, u32 regnum) + { ++ u16 r1, r2, page; + u32 phy, val; + int ret; + +@@ -676,21 +709,30 @@ qca8k_mdio_read(struct qca8k_priv *priv, + QCA8K_MDIO_MASTER_READ | QCA8K_MDIO_MASTER_PHY_ADDR(phy) | + QCA8K_MDIO_MASTER_REG_ADDR(regnum); + +- ret = qca8k_write(priv, QCA8K_MDIO_MASTER_CTRL, val); +- if (ret) +- return ret; ++ qca8k_split_addr(QCA8K_MDIO_MASTER_CTRL, &r1, &r2, &page); ++ ++ mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); + +- ret = qca8k_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, +- QCA8K_MDIO_MASTER_BUSY); ++ ret = qca8k_set_page(priv->bus, page); + if (ret) +- return ret; ++ goto exit; + +- val = qca8k_read(priv, QCA8K_MDIO_MASTER_CTRL); +- if (val < 0) +- return val; ++ qca8k_mii_write32(priv->bus, 0x10 | r2, r1, val); ++ ++ ret = qca8k_mdio_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, ++ QCA8K_MDIO_MASTER_BUSY); ++ if (ret) ++ goto exit; + ++ val = qca8k_mii_read32(priv->bus, 0x10 | r2, r1); + val &= QCA8K_MDIO_MASTER_DATA_MASK; + ++exit: ++ mutex_unlock(&priv->bus->mdio_lock); ++ ++ if (val >= 0) ++ val &= QCA8K_MDIO_MASTER_DATA_MASK; ++ + /* even if the busy_wait timeouts try to clear the MASTER_EN */ + qca8k_reg_clear(priv, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_EN); diff --git a/target/linux/generic/backport-5.10/785-v5.14-19-net-dsa-qca8k-enlarge-mdio-delay-and-timeout.patch b/target/linux/generic/backport-5.10/785-v5.14-19-net-dsa-qca8k-enlarge-mdio-delay-and-timeout.patch new file mode 100644 index 0000000000..30eeed361e --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-19-net-dsa-qca8k-enlarge-mdio-delay-and-timeout.patch @@ -0,0 +1,39 @@ +From 617960d72e93de0f3fa52407e2d39e8c43e73b0a Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:09 +0200 +Subject: [PATCH] net: dsa: qca8k: enlarge mdio delay and timeout + +The witch require some extra delay after setting page or the next +read/write can use still use the old page. Add a delay after the +set_page function to address this as it's done in QSDK legacy driver. +Some timeouts were notice with VLAN and phy function, enlarge the +mdio busy wait timeout to fix these problems. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 1 + + drivers/net/dsa/qca8k.h | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -143,6 +143,7 @@ qca8k_set_page(struct mii_bus *bus, u16 + } + + qca8k_current_page = page; ++ usleep_range(1000, 2000); + return 0; + } + +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -20,7 +20,7 @@ + #define PHY_ID_QCA8337 0x004dd036 + #define QCA8K_ID_QCA8337 0x13 + +-#define QCA8K_BUSY_WAIT_TIMEOUT 20 ++#define QCA8K_BUSY_WAIT_TIMEOUT 2000 + + #define QCA8K_NUM_FDB_RECORDS 2048 + diff --git a/target/linux/generic/backport-5.10/785-v5.14-20-net-dsa-qca8k-add-support-for-internal-phy-and-inter.patch b/target/linux/generic/backport-5.10/785-v5.14-20-net-dsa-qca8k-add-support-for-internal-phy-and-inter.patch new file mode 100644 index 0000000000..88d3c1ef43 --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-20-net-dsa-qca8k-add-support-for-internal-phy-and-inter.patch @@ -0,0 +1,267 @@ +From 759bafb8a3226326ca357613bc90acf738f80c32 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:10 +0200 +Subject: [PATCH] net: dsa: qca8k: add support for internal phy and internal + mdio + +Add support to setup_mdio_bus for internal phy declaration. Introduce a +flag to use the legacy port phy mapping by default and use the direct +mapping if a mdio node is detected in the switch node. Register a +dedicated mdio internal mdio bus to address the different mapping +between port and phy if the mdio node is detected. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 112 +++++++++++++++++++++++++++++----------- + drivers/net/dsa/qca8k.h | 1 + + 2 files changed, 83 insertions(+), 30 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -629,7 +630,7 @@ qca8k_port_to_phy(int port) + } + + static int +-qca8k_mdio_busy_wait(struct qca8k_priv *priv, u32 reg, u32 mask) ++qca8k_mdio_busy_wait(struct mii_bus *bus, u32 reg, u32 mask) + { + u16 r1, r2, page; + u32 val; +@@ -639,7 +640,7 @@ qca8k_mdio_busy_wait(struct qca8k_priv * + + ret = read_poll_timeout(qca8k_mii_read32, val, !(val & mask), 0, + QCA8K_BUSY_WAIT_TIMEOUT * USEC_PER_MSEC, false, +- priv->bus, 0x10 | r2, r1); ++ bus, 0x10 | r2, r1); + + /* Check if qca8k_read has failed for a different reason + * before returnting -ETIMEDOUT +@@ -651,19 +652,16 @@ qca8k_mdio_busy_wait(struct qca8k_priv * + } + + static int +-qca8k_mdio_write(struct qca8k_priv *priv, int port, u32 regnum, u16 data) ++qca8k_mdio_write(struct mii_bus *salve_bus, int phy, int regnum, u16 data) + { ++ struct qca8k_priv *priv = salve_bus->priv; + u16 r1, r2, page; +- u32 phy, val; ++ u32 val; + int ret; + + if (regnum >= QCA8K_MDIO_MASTER_MAX_REG) + return -EINVAL; + +- /* callee is responsible for not passing bad ports, +- * but we still would like to make spills impossible. +- */ +- phy = qca8k_port_to_phy(port) % PHY_MAX_ADDR; + val = QCA8K_MDIO_MASTER_BUSY | QCA8K_MDIO_MASTER_EN | + QCA8K_MDIO_MASTER_WRITE | QCA8K_MDIO_MASTER_PHY_ADDR(phy) | + QCA8K_MDIO_MASTER_REG_ADDR(regnum) | +@@ -679,33 +677,29 @@ qca8k_mdio_write(struct qca8k_priv *priv + + qca8k_mii_write32(priv->bus, 0x10 | r2, r1, val); + +- ret = qca8k_mdio_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, ++ ret = qca8k_mdio_busy_wait(priv->bus, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_BUSY); + + exit: +- mutex_unlock(&priv->bus->mdio_lock); +- + /* even if the busy_wait timeouts try to clear the MASTER_EN */ +- qca8k_reg_clear(priv, QCA8K_MDIO_MASTER_CTRL, +- QCA8K_MDIO_MASTER_EN); ++ qca8k_mii_write32(priv->bus, 0x10 | r2, r1, 0); ++ ++ mutex_unlock(&priv->bus->mdio_lock); + + return ret; + } + + static int +-qca8k_mdio_read(struct qca8k_priv *priv, int port, u32 regnum) ++qca8k_mdio_read(struct mii_bus *salve_bus, int phy, int regnum) + { ++ struct qca8k_priv *priv = salve_bus->priv; + u16 r1, r2, page; +- u32 phy, val; ++ u32 val; + int ret; + + if (regnum >= QCA8K_MDIO_MASTER_MAX_REG) + return -EINVAL; + +- /* callee is responsible for not passing bad ports, +- * but we still would like to make spills impossible. +- */ +- phy = qca8k_port_to_phy(port) % PHY_MAX_ADDR; + val = QCA8K_MDIO_MASTER_BUSY | QCA8K_MDIO_MASTER_EN | + QCA8K_MDIO_MASTER_READ | QCA8K_MDIO_MASTER_PHY_ADDR(phy) | + QCA8K_MDIO_MASTER_REG_ADDR(regnum); +@@ -720,24 +714,22 @@ qca8k_mdio_read(struct qca8k_priv *priv, + + qca8k_mii_write32(priv->bus, 0x10 | r2, r1, val); + +- ret = qca8k_mdio_busy_wait(priv, QCA8K_MDIO_MASTER_CTRL, ++ ret = qca8k_mdio_busy_wait(priv->bus, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_BUSY); + if (ret) + goto exit; + + val = qca8k_mii_read32(priv->bus, 0x10 | r2, r1); +- val &= QCA8K_MDIO_MASTER_DATA_MASK; + + exit: ++ /* even if the busy_wait timeouts try to clear the MASTER_EN */ ++ qca8k_mii_write32(priv->bus, 0x10 | r2, r1, 0); ++ + mutex_unlock(&priv->bus->mdio_lock); + + if (val >= 0) + val &= QCA8K_MDIO_MASTER_DATA_MASK; + +- /* even if the busy_wait timeouts try to clear the MASTER_EN */ +- qca8k_reg_clear(priv, QCA8K_MDIO_MASTER_CTRL, +- QCA8K_MDIO_MASTER_EN); +- + return val; + } + +@@ -746,7 +738,14 @@ qca8k_phy_write(struct dsa_switch *ds, i + { + struct qca8k_priv *priv = ds->priv; + +- return qca8k_mdio_write(priv, port, regnum, data); ++ /* Check if the legacy mapping should be used and the ++ * port is not correctly mapped to the right PHY in the ++ * devicetree ++ */ ++ if (priv->legacy_phy_port_mapping) ++ port = qca8k_port_to_phy(port) % PHY_MAX_ADDR; ++ ++ return qca8k_mdio_write(priv->bus, port, regnum, data); + } + + static int +@@ -755,7 +754,14 @@ qca8k_phy_read(struct dsa_switch *ds, in + struct qca8k_priv *priv = ds->priv; + int ret; + +- ret = qca8k_mdio_read(priv, port, regnum); ++ /* Check if the legacy mapping should be used and the ++ * port is not correctly mapped to the right PHY in the ++ * devicetree ++ */ ++ if (priv->legacy_phy_port_mapping) ++ port = qca8k_port_to_phy(port) % PHY_MAX_ADDR; ++ ++ ret = qca8k_mdio_read(priv->bus, port, regnum); + + if (ret < 0) + return 0xffff; +@@ -764,10 +770,37 @@ qca8k_phy_read(struct dsa_switch *ds, in + } + + static int ++qca8k_mdio_register(struct qca8k_priv *priv, struct device_node *mdio) ++{ ++ struct dsa_switch *ds = priv->ds; ++ struct mii_bus *bus; ++ ++ bus = devm_mdiobus_alloc(ds->dev); ++ ++ if (!bus) ++ return -ENOMEM; ++ ++ bus->priv = (void *)priv; ++ bus->name = "qca8k slave mii"; ++ bus->read = qca8k_mdio_read; ++ bus->write = qca8k_mdio_write; ++ snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d", ++ ds->index); ++ ++ bus->parent = ds->dev; ++ bus->phy_mask = ~ds->phys_mii_mask; ++ ++ ds->slave_mii_bus = bus; ++ ++ return devm_of_mdiobus_register(priv->dev, bus, mdio); ++} ++ ++static int + qca8k_setup_mdio_bus(struct qca8k_priv *priv) + { + u32 internal_mdio_mask = 0, external_mdio_mask = 0, reg; +- struct device_node *ports, *port; ++ struct device_node *ports, *port, *mdio; ++ phy_interface_t mode; + int err; + + ports = of_get_child_by_name(priv->dev->of_node, "ports"); +@@ -788,7 +821,10 @@ qca8k_setup_mdio_bus(struct qca8k_priv * + if (!dsa_is_user_port(priv->ds, reg)) + continue; + +- if (of_property_read_bool(port, "phy-handle")) ++ of_get_phy_mode(port, &mode); ++ ++ if (of_property_read_bool(port, "phy-handle") && ++ mode != PHY_INTERFACE_MODE_INTERNAL) + external_mdio_mask |= BIT(reg); + else + internal_mdio_mask |= BIT(reg); +@@ -825,8 +861,23 @@ qca8k_setup_mdio_bus(struct qca8k_priv * + QCA8K_MDIO_MASTER_EN); + } + ++ /* Check if the devicetree declare the port:phy mapping */ ++ mdio = of_get_child_by_name(priv->dev->of_node, "mdio"); ++ if (of_device_is_available(mdio)) { ++ err = qca8k_mdio_register(priv, mdio); ++ if (err) ++ of_node_put(mdio); ++ ++ return err; ++ } ++ ++ /* If a mapping can't be found the legacy mapping is used, ++ * using the qca8k_port_to_phy function ++ */ ++ priv->legacy_phy_port_mapping = true; + priv->ops.phy_read = qca8k_phy_read; + priv->ops.phy_write = qca8k_phy_write; ++ + return 0; + } + +@@ -1212,7 +1263,8 @@ qca8k_phylink_validate(struct dsa_switch + case 5: + /* Internal PHY */ + if (state->interface != PHY_INTERFACE_MODE_NA && +- state->interface != PHY_INTERFACE_MODE_GMII) ++ state->interface != PHY_INTERFACE_MODE_GMII && ++ state->interface != PHY_INTERFACE_MODE_INTERNAL) + goto unsupported; + break; + case 6: /* 2nd CPU port / external PHY */ +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -255,6 +255,7 @@ struct qca8k_priv { + u8 switch_revision; + u8 rgmii_tx_delay; + u8 rgmii_rx_delay; ++ bool legacy_phy_port_mapping; + struct regmap *regmap; + struct mii_bus *bus; + struct ar8xxx_port_status port_sts[QCA8K_NUM_PORTS]; diff --git a/target/linux/generic/backport-5.10/785-v5.14-21-devicetree-bindings-dsa-qca8k-Document-internal-mdio.patch b/target/linux/generic/backport-5.10/785-v5.14-21-devicetree-bindings-dsa-qca8k-Document-internal-mdio.patch new file mode 100644 index 0000000000..6db01b4b41 --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-21-devicetree-bindings-dsa-qca8k-Document-internal-mdio.patch @@ -0,0 +1,93 @@ +From 0c994a28e7518f098c84a3049cb2915780db873a Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:11 +0200 +Subject: [PATCH] devicetree: bindings: dsa: qca8k: Document internal mdio + definition + +Document new way of declare mapping of internal PHY to port. +The new implementation directly declare the PHY connected to the port +by adding a node in the switch node. The driver detect this and register +an internal mdiobus using the mapping defined in the mdio node. + +Signed-off-by: Ansuel Smith +Reviewed-by: Rob Herring +Signed-off-by: David S. Miller +--- + .../devicetree/bindings/net/dsa/qca8k.txt | 39 +++++++++++++++++++ + 1 file changed, 39 insertions(+) + +--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt ++++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt +@@ -21,6 +21,10 @@ described in dsa/dsa.txt. If the QCA8K s + mdio-bus each subnode describing a port needs to have a valid phandle + referencing the internal PHY it is connected to. This is because there's no + N:N mapping of port and PHY id. ++To declare the internal mdio-bus configuration, declare a mdio node in the ++switch node and declare the phandle for the port referencing the internal ++PHY is connected to. In this config a internal mdio-bus is registered and ++the mdio MASTER is used as communication. + + Don't use mixed external and internal mdio-bus configurations, as this is + not supported by the hardware. +@@ -150,26 +154,61 @@ for the internal master mdio-bus configu + port@1 { + reg = <1>; + label = "lan1"; ++ phy-mode = "internal"; ++ phy-handle = <&phy_port1>; + }; + + port@2 { + reg = <2>; + label = "lan2"; ++ phy-mode = "internal"; ++ phy-handle = <&phy_port2>; + }; + + port@3 { + reg = <3>; + label = "lan3"; ++ phy-mode = "internal"; ++ phy-handle = <&phy_port3>; + }; + + port@4 { + reg = <4>; + label = "lan4"; ++ phy-mode = "internal"; ++ phy-handle = <&phy_port4>; + }; + + port@5 { + reg = <5>; + label = "wan"; ++ phy-mode = "internal"; ++ phy-handle = <&phy_port5>; ++ }; ++ }; ++ ++ mdio { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ phy_port1: phy@0 { ++ reg = <0>; ++ }; ++ ++ phy_port2: phy@1 { ++ reg = <1>; ++ }; ++ ++ phy_port3: phy@2 { ++ reg = <2>; ++ }; ++ ++ phy_port4: phy@3 { ++ reg = <3>; ++ }; ++ ++ phy_port5: phy@4 { ++ reg = <4>; + }; + }; + }; diff --git a/target/linux/generic/backport-5.10/785-v5.14-22-net-dsa-qca8k-improve-internal-mdio-read-write-bus-a.patch b/target/linux/generic/backport-5.10/785-v5.14-22-net-dsa-qca8k-improve-internal-mdio-read-write-bus-a.patch new file mode 100644 index 0000000000..da8d5b3462 --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-22-net-dsa-qca8k-improve-internal-mdio-read-write-bus-a.patch @@ -0,0 +1,95 @@ +From b7ebac354d54f1657bb89b7a7ca149db50203e6a Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:12 +0200 +Subject: [PATCH] net: dsa: qca8k: improve internal mdio read/write bus access + +Improve the internal mdio read/write bus access by caching the value +without accessing it for every read/write. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 28 +++++++++++++++------------- + 1 file changed, 15 insertions(+), 13 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -655,6 +655,7 @@ static int + qca8k_mdio_write(struct mii_bus *salve_bus, int phy, int regnum, u16 data) + { + struct qca8k_priv *priv = salve_bus->priv; ++ struct mii_bus *bus = priv->bus; + u16 r1, r2, page; + u32 val; + int ret; +@@ -669,22 +670,22 @@ qca8k_mdio_write(struct mii_bus *salve_b + + qca8k_split_addr(QCA8K_MDIO_MASTER_CTRL, &r1, &r2, &page); + +- mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); + +- ret = qca8k_set_page(priv->bus, page); ++ ret = qca8k_set_page(bus, page); + if (ret) + goto exit; + +- qca8k_mii_write32(priv->bus, 0x10 | r2, r1, val); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, val); + +- ret = qca8k_mdio_busy_wait(priv->bus, QCA8K_MDIO_MASTER_CTRL, ++ ret = qca8k_mdio_busy_wait(bus, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_BUSY); + + exit: + /* even if the busy_wait timeouts try to clear the MASTER_EN */ +- qca8k_mii_write32(priv->bus, 0x10 | r2, r1, 0); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, 0); + +- mutex_unlock(&priv->bus->mdio_lock); ++ mutex_unlock(&bus->mdio_lock); + + return ret; + } +@@ -693,6 +694,7 @@ static int + qca8k_mdio_read(struct mii_bus *salve_bus, int phy, int regnum) + { + struct qca8k_priv *priv = salve_bus->priv; ++ struct mii_bus *bus = priv->bus; + u16 r1, r2, page; + u32 val; + int ret; +@@ -706,26 +708,26 @@ qca8k_mdio_read(struct mii_bus *salve_bu + + qca8k_split_addr(QCA8K_MDIO_MASTER_CTRL, &r1, &r2, &page); + +- mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED); ++ mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); + +- ret = qca8k_set_page(priv->bus, page); ++ ret = qca8k_set_page(bus, page); + if (ret) + goto exit; + +- qca8k_mii_write32(priv->bus, 0x10 | r2, r1, val); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, val); + +- ret = qca8k_mdio_busy_wait(priv->bus, QCA8K_MDIO_MASTER_CTRL, ++ ret = qca8k_mdio_busy_wait(bus, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_BUSY); + if (ret) + goto exit; + +- val = qca8k_mii_read32(priv->bus, 0x10 | r2, r1); ++ val = qca8k_mii_read32(bus, 0x10 | r2, r1); + + exit: + /* even if the busy_wait timeouts try to clear the MASTER_EN */ +- qca8k_mii_write32(priv->bus, 0x10 | r2, r1, 0); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, 0); + +- mutex_unlock(&priv->bus->mdio_lock); ++ mutex_unlock(&bus->mdio_lock); + + if (val >= 0) + val &= QCA8K_MDIO_MASTER_DATA_MASK; diff --git a/target/linux/generic/backport-5.10/785-v5.14-23-net-dsa-qca8k-pass-switch_revision-info-to-phy-dev_f.patch b/target/linux/generic/backport-5.10/785-v5.14-23-net-dsa-qca8k-pass-switch_revision-info-to-phy-dev_f.patch new file mode 100644 index 0000000000..1179cf152d --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-23-net-dsa-qca8k-pass-switch_revision-info-to-phy-dev_f.patch @@ -0,0 +1,48 @@ +From a46aec02bc06ac2c33f326339e4ef88c735dc30d Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:13 +0200 +Subject: [PATCH] net: dsa: qca8k: pass switch_revision info to phy dev_flags + +Define get_phy_flags to pass switch_Revision needed to tweak the +internal PHY with debug values based on the revision. + +Signed-off-by: Ansuel Smith +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1740,6 +1740,22 @@ qca8k_port_vlan_del(struct dsa_switch *d + return ret; + } + ++static u32 qca8k_get_phy_flags(struct dsa_switch *ds, int port) ++{ ++ struct qca8k_priv *priv = ds->priv; ++ ++ /* Communicate to the phy internal driver the switch revision. ++ * Based on the switch revision different values needs to be ++ * set to the dbg and mmd reg on the phy. ++ * The first 2 bit are used to communicate the switch revision ++ * to the phy driver. ++ */ ++ if (port > 0 && port < 6) ++ return priv->switch_revision; ++ ++ return 0; ++} ++ + static enum dsa_tag_protocol + qca8k_get_tag_protocol(struct dsa_switch *ds, int port, + enum dsa_tag_protocol mp) +@@ -1774,6 +1790,7 @@ static const struct dsa_switch_ops qca8k + .phylink_mac_config = qca8k_phylink_mac_config, + .phylink_mac_link_down = qca8k_phylink_mac_link_down, + .phylink_mac_link_up = qca8k_phylink_mac_link_up, ++ .get_phy_flags = qca8k_get_phy_flags, + }; + + static int qca8k_read_switch_id(struct qca8k_priv *priv) diff --git a/target/linux/generic/backport-5.10/785-v5.14-25-net-phy-add-support-for-qca8k-switch-internal-PHY-in.patch b/target/linux/generic/backport-5.10/785-v5.14-25-net-phy-add-support-for-qca8k-switch-internal-PHY-in.patch new file mode 100644 index 0000000000..20325f564d --- /dev/null +++ b/target/linux/generic/backport-5.10/785-v5.14-25-net-phy-add-support-for-qca8k-switch-internal-PHY-in.patch @@ -0,0 +1,229 @@ +From 272833b9b3b3969be7a91839121d86662c8c4253 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Fri, 14 May 2021 23:00:15 +0200 +Subject: [PATCH] net: phy: add support for qca8k switch internal PHY in at803x + +Since the at803x share the same regs, it's assumed they are based on the +same implementation. Make it part of the at803x PHY driver to skip +having redudant code. +Add initial support for qca8k internal PHYs. The internal PHYs requires +special mmd and debug values to be set based on the switch revision +passwd using the dev_flags. Supports output of idle, receive and eee_wake +errors stats. +Some debug values sets can't be translated as the documentation lacks any +reference about them. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/phy/Kconfig | 5 +- + drivers/net/phy/at803x.c | 132 ++++++++++++++++++++++++++++++++++++++- + 2 files changed, 134 insertions(+), 3 deletions(-) + +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -235,10 +235,11 @@ config NXP_TJA11XX_PHY + Currently supports the NXP TJA1100 and TJA1101 PHY. + + config AT803X_PHY +- tristate "Qualcomm Atheros AR803X PHYs" ++ tristate "Qualcomm Atheros AR803X PHYs and QCA833x PHYs" + depends on REGULATOR + help +- Currently supports the AR8030, AR8031, AR8033 and AR8035 model ++ Currently supports the AR8030, AR8031, AR8033, AR8035 and internal ++ QCA8337(Internal qca8k PHY) model + + config QSEMI_PHY + tristate "Quality Semiconductor PHYs" +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -92,10 +92,16 @@ + #define AT803X_DEBUG_REG_5 0x05 + #define AT803X_DEBUG_TX_CLK_DLY_EN BIT(8) + ++#define AT803X_DEBUG_REG_3C 0x3C ++ ++#define AT803X_DEBUG_REG_3D 0x3D ++ + #define AT803X_DEBUG_REG_1F 0x1F + #define AT803X_DEBUG_PLL_ON BIT(2) + #define AT803X_DEBUG_RGMII_1V8 BIT(3) + ++#define MDIO_AZ_DEBUG 0x800D ++ + /* AT803x supports either the XTAL input pad, an internal PLL or the + * DSP as clock reference for the clock output pad. The XTAL reference + * is only used for 25 MHz output, all other frequencies need the PLL. +@@ -142,10 +148,34 @@ + #define AT803X_PAGE_FIBER 0 + #define AT803X_PAGE_COPPER 1 + ++#define QCA8327_PHY_ID 0x004dd034 ++#define QCA8337_PHY_ID 0x004dd036 ++#define QCA8K_PHY_ID_MASK 0xffffffff ++ ++#define QCA8K_DEVFLAGS_REVISION_MASK GENMASK(2, 0) ++ + MODULE_DESCRIPTION("Qualcomm Atheros AR803x PHY driver"); + MODULE_AUTHOR("Matus Ujhelyi"); + MODULE_LICENSE("GPL"); + ++enum stat_access_type { ++ PHY, ++ MMD ++}; ++ ++struct at803x_hw_stat { ++ const char *string; ++ u8 reg; ++ u32 mask; ++ enum stat_access_type access_type; ++}; ++ ++static struct at803x_hw_stat at803x_hw_stats[] = { ++ { "phy_idle_errors", 0xa, GENMASK(7, 0), PHY}, ++ { "phy_receive_errors", 0x15, GENMASK(15, 0), PHY}, ++ { "eee_wake_errors", 0x16, GENMASK(15, 0), MMD}, ++}; ++ + struct at803x_priv { + int flags; + #define AT803X_KEEP_PLL_ENABLED BIT(0) /* don't turn off internal PLL */ +@@ -154,6 +184,7 @@ struct at803x_priv { + struct regulator_dev *vddio_rdev; + struct regulator_dev *vddh_rdev; + struct regulator *vddio; ++ u64 stats[ARRAY_SIZE(at803x_hw_stats)]; + }; + + struct at803x_context { +@@ -165,6 +196,17 @@ struct at803x_context { + u16 led_control; + }; + ++static int at803x_debug_reg_write(struct phy_device *phydev, u16 reg, u16 data) ++{ ++ int ret; ++ ++ ret = phy_write(phydev, AT803X_DEBUG_ADDR, reg); ++ if (ret < 0) ++ return ret; ++ ++ return phy_write(phydev, AT803X_DEBUG_DATA, data); ++} ++ + static int at803x_debug_reg_read(struct phy_device *phydev, u16 reg) + { + int ret; +@@ -327,6 +369,53 @@ static void at803x_get_wol(struct phy_de + wol->wolopts |= WAKE_MAGIC; + } + ++static int at803x_get_sset_count(struct phy_device *phydev) ++{ ++ return ARRAY_SIZE(at803x_hw_stats); ++} ++ ++static void at803x_get_strings(struct phy_device *phydev, u8 *data) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(at803x_hw_stats); i++) { ++ strscpy(data + i * ETH_GSTRING_LEN, ++ at803x_hw_stats[i].string, ETH_GSTRING_LEN); ++ } ++} ++ ++static u64 at803x_get_stat(struct phy_device *phydev, int i) ++{ ++ struct at803x_hw_stat stat = at803x_hw_stats[i]; ++ struct at803x_priv *priv = phydev->priv; ++ int val; ++ u64 ret; ++ ++ if (stat.access_type == MMD) ++ val = phy_read_mmd(phydev, MDIO_MMD_PCS, stat.reg); ++ else ++ val = phy_read(phydev, stat.reg); ++ ++ if (val < 0) { ++ ret = U64_MAX; ++ } else { ++ val = val & stat.mask; ++ priv->stats[i] += val; ++ ret = priv->stats[i]; ++ } ++ ++ return ret; ++} ++ ++static void at803x_get_stats(struct phy_device *phydev, ++ struct ethtool_stats *stats, u64 *data) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(at803x_hw_stats); i++) ++ data[i] = at803x_get_stat(phydev, i); ++} ++ + static int at803x_suspend(struct phy_device *phydev) + { + int value; +@@ -1102,6 +1191,34 @@ static int at803x_cable_test_start(struc + return 0; + } + ++static int qca83xx_config_init(struct phy_device *phydev) ++{ ++ u8 switch_revision; ++ ++ switch_revision = phydev->dev_flags & QCA8K_DEVFLAGS_REVISION_MASK; ++ ++ switch (switch_revision) { ++ case 1: ++ /* For 100M waveform */ ++ at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_0, 0x02ea); ++ /* Turn on Gigabit clock */ ++ at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_3D, 0x68a0); ++ break; ++ ++ case 2: ++ phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, 0x0); ++ fallthrough; ++ case 4: ++ phy_write_mmd(phydev, MDIO_MMD_PCS, MDIO_AZ_DEBUG, 0x803f); ++ at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_3D, 0x6860); ++ at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_5, 0x2c46); ++ at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_3C, 0x6000); ++ break; ++ } ++ ++ return 0; ++} ++ + static struct phy_driver at803x_driver[] = { + { + /* Qualcomm Atheros AR8035 */ +@@ -1198,7 +1315,20 @@ static struct phy_driver at803x_driver[] + .read_status = at803x_read_status, + .soft_reset = genphy_soft_reset, + .config_aneg = at803x_config_aneg, +-} }; ++}, { ++ /* QCA8337 */ ++ .phy_id = QCA8337_PHY_ID, ++ .phy_id_mask = QCA8K_PHY_ID_MASK, ++ .name = "QCA PHY 8337", ++ /* PHY_GBIT_FEATURES */ ++ .probe = at803x_probe, ++ .flags = PHY_IS_INTERNAL, ++ .config_init = qca83xx_config_init, ++ .soft_reset = genphy_soft_reset, ++ .get_sset_count = at803x_get_sset_count, ++ .get_strings = at803x_get_strings, ++ .get_stats = at803x_get_stats, ++}, }; + + module_phy_driver(at803x_driver); + diff --git a/target/linux/generic/pending-5.10/730-net-phy-at803x-fix-feature-detection.patch b/target/linux/generic/pending-5.10/730-net-phy-at803x-fix-feature-detection.patch index 1d4783e382..a00416ec3e 100644 --- a/target/linux/generic/pending-5.10/730-net-phy-at803x-fix-feature-detection.patch +++ b/target/linux/generic/pending-5.10/730-net-phy-at803x-fix-feature-detection.patch @@ -20,7 +20,7 @@ Signed-off-by: David Bauer --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c -@@ -935,6 +935,34 @@ static int at803x_set_tunable(struct phy +@@ -1024,6 +1024,34 @@ static int at803x_set_tunable(struct phy } } @@ -55,7 +55,7 @@ Signed-off-by: David Bauer static int at803x_cable_test_result_trans(u16 status) { switch (FIELD_GET(AT803X_CDT_STATUS_STAT_MASK, status)) { -@@ -1156,7 +1184,7 @@ static struct phy_driver at803x_driver[] +@@ -1273,7 +1301,7 @@ static struct phy_driver at803x_driver[] .resume = at803x_resume, .read_page = at803x_read_page, .write_page = at803x_write_page, diff --git a/target/linux/ipq40xx/patches-5.10/707-net-phy-Add-Qualcom-QCA807x-driver.patch b/target/linux/ipq40xx/patches-5.10/707-net-phy-Add-Qualcom-QCA807x-driver.patch index b58797c321..c81aa3bb73 100644 --- a/target/linux/ipq40xx/patches-5.10/707-net-phy-Add-Qualcom-QCA807x-driver.patch +++ b/target/linux/ipq40xx/patches-5.10/707-net-phy-Add-Qualcom-QCA807x-driver.patch @@ -25,9 +25,9 @@ Signed-off-by: Robert Marko --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -314,6 +314,12 @@ config AT803X_PHY - help - Currently supports the AR8030, AR8031, AR8033 and AR8035 model +@@ -315,6 +315,12 @@ config AT803X_PHY + Currently supports the AR8030, AR8031, AR8033, AR8035 and internal + QCA8337(Internal qca8k PHY) model +config QCA807X_PHY + tristate "Qualcomm QCA807X PHYs" From c757c71fd1a525549ba8610b81e970514d014d25 Mon Sep 17 00:00:00 2001 From: Matthew Hagan Date: Fri, 10 Sep 2021 17:59:49 +0000 Subject: [PATCH 30/54] kernel: 5.10: backport additional qca8k fixes Backport fixes including: net: dsa: qca8k: fix missing unlock on error in qca8k_vlan_(add|del) net: dsa: qca8k: check return value of read functions correctly net: dsa: qca8k: add missing check return value in qca8k_phylink_mac_config() net: dsa: qca8k: fix an endian bug in qca8k_get_ethtool_stats() net: dsa: qca8k: check the correct variable in qca8k_set_mac_eee() Signed-off-by: Ansuel Smith Signed-off-by: Matthew Hagan --- ...issing-unlock-on-error-in-qca8k-vlan.patch | 64 ++++ ...eck-return-value-of-read-functions-c.patch | 348 ++++++++++++++++++ ...d-missing-check-return-value-in-qca8.patch | 47 +++ ...x-an-endian-bug-in-qca8k-get-ethtool.patch | 47 +++ ...eck-the-correct-variable-in-qca8k-se.patch | 31 ++ 5 files changed, 537 insertions(+) create mode 100644 target/linux/generic/backport-5.10/786-v5.14-net-dsa-qca8k-fix-missing-unlock-on-error-in-qca8k-vlan.patch create mode 100644 target/linux/generic/backport-5.10/787-v5.14-01-net-dsa-qca8k-check-return-value-of-read-functions-c.patch create mode 100644 target/linux/generic/backport-5.10/787-v5.14-02-net-dsa-qca8k-add-missing-check-return-value-in-qca8.patch create mode 100644 target/linux/generic/backport-5.10/788-v5.14-01-net-dsa-qca8k-fix-an-endian-bug-in-qca8k-get-ethtool.patch create mode 100644 target/linux/generic/backport-5.10/788-v5.14-02-net-dsa-qca8k-check-the-correct-variable-in-qca8k-se.patch diff --git a/target/linux/generic/backport-5.10/786-v5.14-net-dsa-qca8k-fix-missing-unlock-on-error-in-qca8k-vlan.patch b/target/linux/generic/backport-5.10/786-v5.14-net-dsa-qca8k-fix-missing-unlock-on-error-in-qca8k-vlan.patch new file mode 100644 index 0000000000..a68e3b1821 --- /dev/null +++ b/target/linux/generic/backport-5.10/786-v5.14-net-dsa-qca8k-fix-missing-unlock-on-error-in-qca8k-vlan.patch @@ -0,0 +1,64 @@ +From 0d56e5c191b197e1d30a0a4c92628836dafced0f Mon Sep 17 00:00:00 2001 +From: Wei Yongjun +Date: Tue, 18 May 2021 11:24:13 +0000 +Subject: [PATCH] net: dsa: qca8k: fix missing unlock on error in + qca8k_vlan_(add|del) + +Add the missing unlock before return from function qca8k_vlan_add() +and qca8k_vlan_del() in the error handling case. + +Fixes: 028f5f8ef44f ("net: dsa: qca8k: handle error with qca8k_read operation") +Reported-by: Hulk Robot +Signed-off-by: Wei Yongjun +Reviewed-by: Vladimir Oltean +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -506,8 +506,10 @@ qca8k_vlan_add(struct qca8k_priv *priv, + goto out; + + reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0); +- if (reg < 0) +- return reg; ++ if (reg < 0) { ++ ret = reg; ++ goto out; ++ } + reg |= QCA8K_VTU_FUNC0_VALID | QCA8K_VTU_FUNC0_IVL_EN; + reg &= ~(QCA8K_VTU_FUNC0_EG_MODE_MASK << QCA8K_VTU_FUNC0_EG_MODE_S(port)); + if (untagged) +@@ -519,7 +521,7 @@ qca8k_vlan_add(struct qca8k_priv *priv, + + ret = qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg); + if (ret) +- return ret; ++ goto out; + ret = qca8k_vlan_access(priv, QCA8K_VLAN_LOAD, vid); + + out: +@@ -541,8 +543,10 @@ qca8k_vlan_del(struct qca8k_priv *priv, + goto out; + + reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0); +- if (reg < 0) +- return reg; ++ if (reg < 0) { ++ ret = reg; ++ goto out; ++ } + reg &= ~(3 << QCA8K_VTU_FUNC0_EG_MODE_S(port)); + reg |= QCA8K_VTU_FUNC0_EG_MODE_NOT << + QCA8K_VTU_FUNC0_EG_MODE_S(port); +@@ -564,7 +568,7 @@ qca8k_vlan_del(struct qca8k_priv *priv, + } else { + ret = qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg); + if (ret) +- return ret; ++ goto out; + ret = qca8k_vlan_access(priv, QCA8K_VLAN_LOAD, vid); + } + diff --git a/target/linux/generic/backport-5.10/787-v5.14-01-net-dsa-qca8k-check-return-value-of-read-functions-c.patch b/target/linux/generic/backport-5.10/787-v5.14-01-net-dsa-qca8k-check-return-value-of-read-functions-c.patch new file mode 100644 index 0000000000..451b0e9446 --- /dev/null +++ b/target/linux/generic/backport-5.10/787-v5.14-01-net-dsa-qca8k-check-return-value-of-read-functions-c.patch @@ -0,0 +1,348 @@ +From 7c9896e37807862e276064dd9331860f5d27affc Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Sat, 29 May 2021 11:04:38 +0800 +Subject: [PATCH] net: dsa: qca8k: check return value of read functions + correctly + +Current return type of qca8k_mii_read32() and qca8k_read() are +unsigned, it can't be negative, so the return value check is +unuseful. For check the return value correctly, change return +type of the read functions and add a output parameter to store +the read value. + +Signed-off-by: Yang Yingliang +Signed-off-by: Jakub Kicinski +--- + drivers/net/dsa/qca8k.c | 130 +++++++++++++++++++--------------------- + 1 file changed, 60 insertions(+), 70 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -89,26 +89,26 @@ qca8k_split_addr(u32 regaddr, u16 *r1, u + *page = regaddr & 0x3ff; + } + +-static u32 +-qca8k_mii_read32(struct mii_bus *bus, int phy_id, u32 regnum) ++static int ++qca8k_mii_read32(struct mii_bus *bus, int phy_id, u32 regnum, u32 *val) + { +- u32 val; + int ret; + + ret = bus->read(bus, phy_id, regnum); + if (ret >= 0) { +- val = ret; ++ *val = ret; + ret = bus->read(bus, phy_id, regnum + 1); +- val |= ret << 16; ++ *val |= ret << 16; + } + + if (ret < 0) { + dev_err_ratelimited(&bus->dev, + "failed to read qca8k 32bit register\n"); ++ *val = 0; + return ret; + } + +- return val; ++ return 0; + } + + static void +@@ -148,26 +148,26 @@ qca8k_set_page(struct mii_bus *bus, u16 + return 0; + } + +-static u32 +-qca8k_read(struct qca8k_priv *priv, u32 reg) ++static int ++qca8k_read(struct qca8k_priv *priv, u32 reg, u32 *val) + { + struct mii_bus *bus = priv->bus; + u16 r1, r2, page; +- u32 val; ++ int ret; + + qca8k_split_addr(reg, &r1, &r2, &page); + + mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); + +- val = qca8k_set_page(bus, page); +- if (val < 0) ++ ret = qca8k_set_page(bus, page); ++ if (ret < 0) + goto exit; + +- val = qca8k_mii_read32(bus, 0x10 | r2, r1); ++ ret = qca8k_mii_read32(bus, 0x10 | r2, r1, val); + + exit: + mutex_unlock(&bus->mdio_lock); +- return val; ++ return ret; + } + + static int +@@ -208,11 +208,9 @@ qca8k_rmw(struct qca8k_priv *priv, u32 r + if (ret < 0) + goto exit; + +- val = qca8k_mii_read32(bus, 0x10 | r2, r1); +- if (val < 0) { +- ret = val; ++ ret = qca8k_mii_read32(bus, 0x10 | r2, r1, &val); ++ if (ret < 0) + goto exit; +- } + + val &= ~mask; + val |= write_val; +@@ -240,15 +238,8 @@ static int + qca8k_regmap_read(void *ctx, uint32_t reg, uint32_t *val) + { + struct qca8k_priv *priv = (struct qca8k_priv *)ctx; +- int ret; +- +- ret = qca8k_read(priv, reg); +- if (ret < 0) +- return ret; +- +- *val = ret; + +- return 0; ++ return qca8k_read(priv, reg, val); + } + + static int +@@ -296,18 +287,18 @@ static struct regmap_config qca8k_regmap + static int + qca8k_busy_wait(struct qca8k_priv *priv, u32 reg, u32 mask) + { ++ int ret, ret1; + u32 val; +- int ret; + +- ret = read_poll_timeout(qca8k_read, val, !(val & mask), ++ ret = read_poll_timeout(qca8k_read, ret1, !(val & mask), + 0, QCA8K_BUSY_WAIT_TIMEOUT * USEC_PER_MSEC, false, +- priv, reg); ++ priv, reg, &val); + + /* Check if qca8k_read has failed for a different reason + * before returning -ETIMEDOUT + */ +- if (ret < 0 && val < 0) +- return val; ++ if (ret < 0 && ret1 < 0) ++ return ret1; + + return ret; + } +@@ -316,13 +307,13 @@ static int + qca8k_fdb_read(struct qca8k_priv *priv, struct qca8k_fdb *fdb) + { + u32 reg[4], val; +- int i; ++ int i, ret; + + /* load the ARL table into an array */ + for (i = 0; i < 4; i++) { +- val = qca8k_read(priv, QCA8K_REG_ATU_DATA0 + (i * 4)); +- if (val < 0) +- return val; ++ ret = qca8k_read(priv, QCA8K_REG_ATU_DATA0 + (i * 4), &val); ++ if (ret < 0) ++ return ret; + + reg[i] = val; + } +@@ -396,9 +387,9 @@ qca8k_fdb_access(struct qca8k_priv *priv + + /* Check for table full violation when adding an entry */ + if (cmd == QCA8K_FDB_LOAD) { +- reg = qca8k_read(priv, QCA8K_REG_ATU_FUNC); +- if (reg < 0) +- return reg; ++ ret = qca8k_read(priv, QCA8K_REG_ATU_FUNC, ®); ++ if (ret < 0) ++ return ret; + if (reg & QCA8K_ATU_FUNC_FULL) + return -1; + } +@@ -477,9 +468,9 @@ qca8k_vlan_access(struct qca8k_priv *pri + + /* Check for table full violation when adding an entry */ + if (cmd == QCA8K_VLAN_LOAD) { +- reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC1); +- if (reg < 0) +- return reg; ++ ret = qca8k_read(priv, QCA8K_REG_VTU_FUNC1, ®); ++ if (ret < 0) ++ return ret; + if (reg & QCA8K_VTU_FUNC1_FULL) + return -ENOMEM; + } +@@ -505,11 +496,9 @@ qca8k_vlan_add(struct qca8k_priv *priv, + if (ret < 0) + goto out; + +- reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0); +- if (reg < 0) { +- ret = reg; ++ ret = qca8k_read(priv, QCA8K_REG_VTU_FUNC0, ®); ++ if (ret < 0) + goto out; +- } + reg |= QCA8K_VTU_FUNC0_VALID | QCA8K_VTU_FUNC0_IVL_EN; + reg &= ~(QCA8K_VTU_FUNC0_EG_MODE_MASK << QCA8K_VTU_FUNC0_EG_MODE_S(port)); + if (untagged) +@@ -542,11 +531,9 @@ qca8k_vlan_del(struct qca8k_priv *priv, + if (ret < 0) + goto out; + +- reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0); +- if (reg < 0) { +- ret = reg; ++ ret = qca8k_read(priv, QCA8K_REG_VTU_FUNC0, ®); ++ if (ret < 0) + goto out; +- } + reg &= ~(3 << QCA8K_VTU_FUNC0_EG_MODE_S(port)); + reg |= QCA8K_VTU_FUNC0_EG_MODE_NOT << + QCA8K_VTU_FUNC0_EG_MODE_S(port); +@@ -638,19 +625,19 @@ qca8k_mdio_busy_wait(struct mii_bus *bus + { + u16 r1, r2, page; + u32 val; +- int ret; ++ int ret, ret1; + + qca8k_split_addr(reg, &r1, &r2, &page); + +- ret = read_poll_timeout(qca8k_mii_read32, val, !(val & mask), 0, ++ ret = read_poll_timeout(qca8k_mii_read32, ret1, !(val & mask), 0, + QCA8K_BUSY_WAIT_TIMEOUT * USEC_PER_MSEC, false, +- bus, 0x10 | r2, r1); ++ bus, 0x10 | r2, r1, &val); + + /* Check if qca8k_read has failed for a different reason + * before returnting -ETIMEDOUT + */ +- if (ret < 0 && val < 0) +- return val; ++ if (ret < 0 && ret1 < 0) ++ return ret1; + + return ret; + } +@@ -725,7 +712,7 @@ qca8k_mdio_read(struct mii_bus *salve_bu + if (ret) + goto exit; + +- val = qca8k_mii_read32(bus, 0x10 | r2, r1); ++ ret = qca8k_mii_read32(bus, 0x10 | r2, r1, &val); + + exit: + /* even if the busy_wait timeouts try to clear the MASTER_EN */ +@@ -733,10 +720,10 @@ exit: + + mutex_unlock(&bus->mdio_lock); + +- if (val >= 0) +- val &= QCA8K_MDIO_MASTER_DATA_MASK; ++ if (ret >= 0) ++ ret = val & QCA8K_MDIO_MASTER_DATA_MASK; + +- return val; ++ return ret; + } + + static int +@@ -1211,7 +1198,7 @@ qca8k_phylink_mac_config(struct dsa_swit + qca8k_write(priv, reg, QCA8K_PORT_PAD_SGMII_EN); + + /* Enable/disable SerDes auto-negotiation as necessary */ +- val = qca8k_read(priv, QCA8K_REG_PWS); ++ qca8k_read(priv, QCA8K_REG_PWS, &val); + if (phylink_autoneg_inband(mode)) + val &= ~QCA8K_PWS_SERDES_AEN_DIS; + else +@@ -1219,7 +1206,7 @@ qca8k_phylink_mac_config(struct dsa_swit + qca8k_write(priv, QCA8K_REG_PWS, val); + + /* Configure the SGMII parameters */ +- val = qca8k_read(priv, QCA8K_REG_SGMII_CTRL); ++ qca8k_read(priv, QCA8K_REG_SGMII_CTRL, &val); + + val |= QCA8K_SGMII_EN_PLL | QCA8K_SGMII_EN_RX | + QCA8K_SGMII_EN_TX | QCA8K_SGMII_EN_SD; +@@ -1314,10 +1301,11 @@ qca8k_phylink_mac_link_state(struct dsa_ + { + struct qca8k_priv *priv = ds->priv; + u32 reg; ++ int ret; + +- reg = qca8k_read(priv, QCA8K_REG_PORT_STATUS(port)); +- if (reg < 0) +- return reg; ++ ret = qca8k_read(priv, QCA8K_REG_PORT_STATUS(port), ®); ++ if (ret < 0) ++ return ret; + + state->link = !!(reg & QCA8K_PORT_STATUS_LINK_UP); + state->an_complete = state->link; +@@ -1419,19 +1407,20 @@ qca8k_get_ethtool_stats(struct dsa_switc + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; + const struct qca8k_mib_desc *mib; + u32 reg, i, val; +- u64 hi; ++ u64 hi = 0; ++ int ret; + + for (i = 0; i < ARRAY_SIZE(ar8327_mib); i++) { + mib = &ar8327_mib[i]; + reg = QCA8K_PORT_MIB_COUNTER(port) + mib->offset; + +- val = qca8k_read(priv, reg); +- if (val < 0) ++ ret = qca8k_read(priv, reg, &val); ++ if (ret < 0) + continue; + + if (mib->size == 2) { +- hi = qca8k_read(priv, reg + 4); +- if (hi < 0) ++ ret = qca8k_read(priv, reg + 4, (u32 *)&hi); ++ if (ret < 0) + continue; + } + +@@ -1459,7 +1448,7 @@ qca8k_set_mac_eee(struct dsa_switch *ds, + int ret; + + mutex_lock(&priv->reg_mutex); +- reg = qca8k_read(priv, QCA8K_REG_EEE_CTRL); ++ ret = qca8k_read(priv, QCA8K_REG_EEE_CTRL, ®); + if (reg < 0) { + ret = reg; + goto exit; +@@ -1802,14 +1791,15 @@ static int qca8k_read_switch_id(struct q + const struct qca8k_match_data *data; + u32 val; + u8 id; ++ int ret; + + /* get the switches ID from the compatible */ + data = of_device_get_match_data(priv->dev); + if (!data) + return -ENODEV; + +- val = qca8k_read(priv, QCA8K_REG_MASK_CTRL); +- if (val < 0) ++ ret = qca8k_read(priv, QCA8K_REG_MASK_CTRL, &val); ++ if (ret < 0) + return -ENODEV; + + id = QCA8K_MASK_CTRL_DEVICE_ID(val & QCA8K_MASK_CTRL_DEVICE_ID_MASK); diff --git a/target/linux/generic/backport-5.10/787-v5.14-02-net-dsa-qca8k-add-missing-check-return-value-in-qca8.patch b/target/linux/generic/backport-5.10/787-v5.14-02-net-dsa-qca8k-add-missing-check-return-value-in-qca8.patch new file mode 100644 index 0000000000..d20da5b85e --- /dev/null +++ b/target/linux/generic/backport-5.10/787-v5.14-02-net-dsa-qca8k-add-missing-check-return-value-in-qca8.patch @@ -0,0 +1,47 @@ +From 9fe99de01440d9ede74d447ac76e9c445d8daae9 Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Sat, 29 May 2021 11:04:39 +0800 +Subject: [PATCH] net: dsa: qca8k: add missing check return value in + qca8k_phylink_mac_config() + +Now we can check qca8k_read() return value correctly, so if +it fails, we need return directly. + +Signed-off-by: Yang Yingliang +Signed-off-by: Jakub Kicinski +--- + drivers/net/dsa/qca8k.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1128,6 +1128,7 @@ qca8k_phylink_mac_config(struct dsa_swit + { + struct qca8k_priv *priv = ds->priv; + u32 reg, val; ++ int ret; + + switch (port) { + case 0: /* 1st CPU port */ +@@ -1198,7 +1199,9 @@ qca8k_phylink_mac_config(struct dsa_swit + qca8k_write(priv, reg, QCA8K_PORT_PAD_SGMII_EN); + + /* Enable/disable SerDes auto-negotiation as necessary */ +- qca8k_read(priv, QCA8K_REG_PWS, &val); ++ ret = qca8k_read(priv, QCA8K_REG_PWS, &val); ++ if (ret) ++ return; + if (phylink_autoneg_inband(mode)) + val &= ~QCA8K_PWS_SERDES_AEN_DIS; + else +@@ -1206,7 +1209,9 @@ qca8k_phylink_mac_config(struct dsa_swit + qca8k_write(priv, QCA8K_REG_PWS, val); + + /* Configure the SGMII parameters */ +- qca8k_read(priv, QCA8K_REG_SGMII_CTRL, &val); ++ ret = qca8k_read(priv, QCA8K_REG_SGMII_CTRL, &val); ++ if (ret) ++ return; + + val |= QCA8K_SGMII_EN_PLL | QCA8K_SGMII_EN_RX | + QCA8K_SGMII_EN_TX | QCA8K_SGMII_EN_SD; diff --git a/target/linux/generic/backport-5.10/788-v5.14-01-net-dsa-qca8k-fix-an-endian-bug-in-qca8k-get-ethtool.patch b/target/linux/generic/backport-5.10/788-v5.14-01-net-dsa-qca8k-fix-an-endian-bug-in-qca8k-get-ethtool.patch new file mode 100644 index 0000000000..429d5d50f0 --- /dev/null +++ b/target/linux/generic/backport-5.10/788-v5.14-01-net-dsa-qca8k-fix-an-endian-bug-in-qca8k-get-ethtool.patch @@ -0,0 +1,47 @@ +aFrom aa3d020b22cb844ab7bdbb9e5d861a64666e2b74 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 9 Jun 2021 12:52:12 +0300 +Subject: [PATCH] net: dsa: qca8k: fix an endian bug in + qca8k_get_ethtool_stats() + +The "hi" variable is a u64 but the qca8k_read() writes to the top 32 +bits of it. That will work on little endian systems but it's a bit +subtle. It's cleaner to make declare "hi" as a u32. We will still need +to cast it when we shift it later on in the function but that's fine. + +Fixes: 7c9896e37807 ("net: dsa: qca8k: check return value of read functions correctly") +Signed-off-by: Dan Carpenter +Reviewed-by: Vladimir Oltean +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1412,7 +1412,7 @@ qca8k_get_ethtool_stats(struct dsa_switc + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; + const struct qca8k_mib_desc *mib; + u32 reg, i, val; +- u64 hi = 0; ++ u32 hi = 0; + int ret; + + for (i = 0; i < ARRAY_SIZE(ar8327_mib); i++) { +@@ -1424,14 +1424,14 @@ qca8k_get_ethtool_stats(struct dsa_switc + continue; + + if (mib->size == 2) { +- ret = qca8k_read(priv, reg + 4, (u32 *)&hi); ++ ret = qca8k_read(priv, reg + 4, &hi); + if (ret < 0) + continue; + } + + data[i] = val; + if (mib->size == 2) +- data[i] |= hi << 32; ++ data[i] |= (u64)hi << 32; + } + } + diff --git a/target/linux/generic/backport-5.10/788-v5.14-02-net-dsa-qca8k-check-the-correct-variable-in-qca8k-se.patch b/target/linux/generic/backport-5.10/788-v5.14-02-net-dsa-qca8k-check-the-correct-variable-in-qca8k-se.patch new file mode 100644 index 0000000000..c58f79cd8b --- /dev/null +++ b/target/linux/generic/backport-5.10/788-v5.14-02-net-dsa-qca8k-check-the-correct-variable-in-qca8k-se.patch @@ -0,0 +1,31 @@ +From 3d0167f2a627528032821cdeb78b4eab0510460f Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 9 Jun 2021 12:53:03 +0300 +Subject: [PATCH] net: dsa: qca8k: check the correct variable in + qca8k_set_mac_eee() + +This code check "reg" but "ret" was intended so the error handling will +never trigger. + +Fixes: 7c9896e37807 ("net: dsa: qca8k: check return value of read functions correctly") +Signed-off-by: Dan Carpenter +Reviewed-by: Vladimir Oltean +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1454,10 +1454,8 @@ qca8k_set_mac_eee(struct dsa_switch *ds, + + mutex_lock(&priv->reg_mutex); + ret = qca8k_read(priv, QCA8K_REG_EEE_CTRL, ®); +- if (reg < 0) { +- ret = reg; ++ if (ret < 0) + goto exit; +- } + + if (eee->eee_enabled) + reg |= lpi_en; From 8cd974dc4010ac05d06766b366ddcdda492c902c Mon Sep 17 00:00:00 2001 From: Matthew Hagan Date: Sat, 11 Sep 2021 16:41:03 +0000 Subject: [PATCH 31/54] kernel: 5.10: backport qca8k legacy mdio mapping panic fix Add backport of Ansuel Smith's "net: dsa: qca8k: fix kernel panic with legacy mdio mapping" patch. Signed-off-by: Ansuel Smith Signed-off-by: Matthew Hagan --- ...ernel-panic-with-legacy-mdio-mapping.patch | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 target/linux/generic/backport-5.10/789-v5.15-net-dsa-qca8k-fix-kernel-panic-with-legacy-mdio-mapping.patch diff --git a/target/linux/generic/backport-5.10/789-v5.15-net-dsa-qca8k-fix-kernel-panic-with-legacy-mdio-mapping.patch b/target/linux/generic/backport-5.10/789-v5.15-net-dsa-qca8k-fix-kernel-panic-with-legacy-mdio-mapping.patch new file mode 100644 index 0000000000..1e293d3a0b --- /dev/null +++ b/target/linux/generic/backport-5.10/789-v5.15-net-dsa-qca8k-fix-kernel-panic-with-legacy-mdio-mapping.patch @@ -0,0 +1,80 @@ +From ce062a0adbfe933b1932235fdfd874c4c91d1bb0 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Sat, 11 Sep 2021 17:50:09 +0200 +Subject: net: dsa: qca8k: fix kernel panic with legacy mdio mapping + +When the mdio legacy mapping is used the mii_bus priv registered by DSA +refer to the dsa switch struct instead of the qca8k_priv struct and +causes a kernel panic. Create dedicated function when the internal +dedicated mdio driver is used to properly handle the 2 different +implementation. + +Fixes: 759bafb8a322 ("net: dsa: qca8k: add support for internal phy and internal mdio") +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 30 ++++++++++++++++++++++-------- + 1 file changed, 22 insertions(+), 8 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -643,10 +643,8 @@ qca8k_mdio_busy_wait(struct mii_bus *bus + } + + static int +-qca8k_mdio_write(struct mii_bus *salve_bus, int phy, int regnum, u16 data) ++qca8k_mdio_write(struct mii_bus *bus, int phy, int regnum, u16 data) + { +- struct qca8k_priv *priv = salve_bus->priv; +- struct mii_bus *bus = priv->bus; + u16 r1, r2, page; + u32 val; + int ret; +@@ -682,10 +680,8 @@ exit: + } + + static int +-qca8k_mdio_read(struct mii_bus *salve_bus, int phy, int regnum) ++qca8k_mdio_read(struct mii_bus *bus, int phy, int regnum) + { +- struct qca8k_priv *priv = salve_bus->priv; +- struct mii_bus *bus = priv->bus; + u16 r1, r2, page; + u32 val; + int ret; +@@ -727,6 +723,24 @@ exit: + } + + static int ++qca8k_internal_mdio_write(struct mii_bus *slave_bus, int phy, int regnum, u16 data) ++{ ++ struct qca8k_priv *priv = slave_bus->priv; ++ struct mii_bus *bus = priv->bus; ++ ++ return qca8k_mdio_write(bus, phy, regnum, data); ++} ++ ++static int ++qca8k_internal_mdio_read(struct mii_bus *slave_bus, int phy, int regnum) ++{ ++ struct qca8k_priv *priv = slave_bus->priv; ++ struct mii_bus *bus = priv->bus; ++ ++ return qca8k_mdio_read(bus, phy, regnum); ++} ++ ++static int + qca8k_phy_write(struct dsa_switch *ds, int port, int regnum, u16 data) + { + struct qca8k_priv *priv = ds->priv; +@@ -775,8 +789,8 @@ qca8k_mdio_register(struct qca8k_priv *p + + bus->priv = (void *)priv; + bus->name = "qca8k slave mii"; +- bus->read = qca8k_mdio_read; +- bus->write = qca8k_mdio_write; ++ bus->read = qca8k_internal_mdio_read; ++ bus->write = qca8k_internal_mdio_write; + snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d", + ds->index); + From 3cee66cd37e6a52868a408ff0048772a97e0b6d0 Mon Sep 17 00:00:00 2001 From: Matthew Hagan Date: Tue, 14 Sep 2021 08:09:40 +0000 Subject: [PATCH 32/54] kernel: 5.10: backport at803x internal QCA8327 PHY support Add support for qca8327 internal phy needed for correct init of the switch port. It does use the same qca8337 function and reg just with a different id. Signed-off-by: Ansuel Smith Signed-off-by: Matthew Hagan --- ...dd-support-for-qca-8327-internal-phy.patch | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 target/linux/generic/backport-5.10/792-v5.16-net-phy-at803x-add-support-for-qca-8327-internal-phy.patch diff --git a/target/linux/generic/backport-5.10/792-v5.16-net-phy-at803x-add-support-for-qca-8327-internal-phy.patch b/target/linux/generic/backport-5.10/792-v5.16-net-phy-at803x-add-support-for-qca-8327-internal-phy.patch new file mode 100644 index 0000000000..16aa0711ad --- /dev/null +++ b/target/linux/generic/backport-5.10/792-v5.16-net-phy-at803x-add-support-for-qca-8327-internal-phy.patch @@ -0,0 +1,48 @@ +From 0ccf8511182436183c031e8a2f740ae91a02c625 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Tue, 14 Sep 2021 14:33:45 +0200 +Subject: net: phy: at803x: add support for qca 8327 internal phy + +Add support for qca8327 internal phy needed for correct init of the +switch port. It does use the same qca8337 function and reg just with a +different id. + +Signed-off-by: Ansuel Smith +Tested-by: Rosen Penev +Tested-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/at803x.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -1328,6 +1328,19 @@ static struct phy_driver at803x_driver[] + .get_sset_count = at803x_get_sset_count, + .get_strings = at803x_get_strings, + .get_stats = at803x_get_stats, ++}, { ++ /* QCA8327 */ ++ .phy_id = QCA8327_PHY_ID, ++ .phy_id_mask = QCA8K_PHY_ID_MASK, ++ .name = "QCA PHY 8327", ++ /* PHY_GBIT_FEATURES */ ++ .probe = at803x_probe, ++ .flags = PHY_IS_INTERNAL, ++ .config_init = qca83xx_config_init, ++ .soft_reset = genphy_soft_reset, ++ .get_sset_count = at803x_get_sset_count, ++ .get_strings = at803x_get_strings, ++ .get_stats = at803x_get_stats, + }, }; + + module_phy_driver(at803x_driver); +@@ -1338,6 +1351,8 @@ static struct mdio_device_id __maybe_unu + { PHY_ID_MATCH_EXACT(ATH8032_PHY_ID) }, + { PHY_ID_MATCH_EXACT(ATH8035_PHY_ID) }, + { PHY_ID_MATCH_EXACT(ATH9331_PHY_ID) }, ++ { PHY_ID_MATCH_EXACT(QCA8337_PHY_ID) }, ++ { PHY_ID_MATCH_EXACT(QCA8327_PHY_ID) }, + { } + }; + From dee819272ac2e62ecfb59905d2172e60ddce0bf5 Mon Sep 17 00:00:00 2001 From: Matthew Hagan Date: Mon, 20 Sep 2021 12:37:53 +0000 Subject: [PATCH 33/54] kernel: 5.10: backport at803x QCA83xx phy support improvements This commit add accepted upstream patches that improve & tidy qca83xx support. 1 - Split qca8327 to A & B variants, identifiable by phy_id 2 - Add suspend/resume support to qca8xx phys 3 - Tidy spacing and phy naming. Signed-off-by: Ansuel Smith Signed-off-by: Matthew Hagan --- ...x-add-support-for-qca-8327-A-variant.patch | 65 +++++++++++++ ...dd-resume-suspend-function-to-qca83x.patch | 45 +++++++++ ...ix-spacing-and-improve-name-for-83xx.patch | 95 +++++++++++++++++++ ...net-phy-at803x-fix-feature-detection.patch | 4 +- 4 files changed, 207 insertions(+), 2 deletions(-) create mode 100644 target/linux/generic/backport-5.10/795-v5.16-01-net-phy-at803x-add-support-for-qca-8327-A-variant.patch create mode 100644 target/linux/generic/backport-5.10/795-v5.16-02-net-phy-at803x-add-resume-suspend-function-to-qca83x.patch create mode 100644 target/linux/generic/backport-5.10/795-v5.16-03-net-phy-at803x-fix-spacing-and-improve-name-for-83xx.patch diff --git a/target/linux/generic/backport-5.10/795-v5.16-01-net-phy-at803x-add-support-for-qca-8327-A-variant.patch b/target/linux/generic/backport-5.10/795-v5.16-01-net-phy-at803x-add-support-for-qca-8327-A-variant.patch new file mode 100644 index 0000000000..c82bf913a0 --- /dev/null +++ b/target/linux/generic/backport-5.10/795-v5.16-01-net-phy-at803x-add-support-for-qca-8327-A-variant.patch @@ -0,0 +1,65 @@ +From b4df02b562f4aa14ff6811f30e1b4d2159585c59 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Sun, 19 Sep 2021 18:28:15 +0200 +Subject: net: phy: at803x: add support for qca 8327 A variant internal phy + +For qca8327 internal phy there are 2 different switch variant with 2 +different phy id. Add this missing variant so the internal phy can be +correctly identified and fixed. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/at803x.c | 25 ++++++++++++++++++++----- + 1 file changed, 20 insertions(+), 5 deletions(-) + +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -148,7 +148,8 @@ + #define AT803X_PAGE_FIBER 0 + #define AT803X_PAGE_COPPER 1 + +-#define QCA8327_PHY_ID 0x004dd034 ++#define QCA8327_A_PHY_ID 0x004dd033 ++#define QCA8327_B_PHY_ID 0x004dd034 + #define QCA8337_PHY_ID 0x004dd036 + #define QCA8K_PHY_ID_MASK 0xffffffff + +@@ -1329,10 +1330,23 @@ static struct phy_driver at803x_driver[] + .get_strings = at803x_get_strings, + .get_stats = at803x_get_stats, + }, { +- /* QCA8327 */ +- .phy_id = QCA8327_PHY_ID, ++ /* QCA8327-A from switch QCA8327-AL1A */ ++ .phy_id = QCA8327_A_PHY_ID, + .phy_id_mask = QCA8K_PHY_ID_MASK, +- .name = "QCA PHY 8327", ++ .name = "QCA PHY 8327-A", ++ /* PHY_GBIT_FEATURES */ ++ .probe = at803x_probe, ++ .flags = PHY_IS_INTERNAL, ++ .config_init = qca83xx_config_init, ++ .soft_reset = genphy_soft_reset, ++ .get_sset_count = at803x_get_sset_count, ++ .get_strings = at803x_get_strings, ++ .get_stats = at803x_get_stats, ++}, { ++ /* QCA8327-B from switch QCA8327-BL1A */ ++ .phy_id = QCA8327_B_PHY_ID, ++ .phy_id_mask = QCA8K_PHY_ID_MASK, ++ .name = "QCA PHY 8327-B", + /* PHY_GBIT_FEATURES */ + .probe = at803x_probe, + .flags = PHY_IS_INTERNAL, +@@ -1352,7 +1366,8 @@ static struct mdio_device_id __maybe_unu + { PHY_ID_MATCH_EXACT(ATH8035_PHY_ID) }, + { PHY_ID_MATCH_EXACT(ATH9331_PHY_ID) }, + { PHY_ID_MATCH_EXACT(QCA8337_PHY_ID) }, +- { PHY_ID_MATCH_EXACT(QCA8327_PHY_ID) }, ++ { PHY_ID_MATCH_EXACT(QCA8327_A_PHY_ID) }, ++ { PHY_ID_MATCH_EXACT(QCA8327_B_PHY_ID) }, + { } + }; + diff --git a/target/linux/generic/backport-5.10/795-v5.16-02-net-phy-at803x-add-resume-suspend-function-to-qca83x.patch b/target/linux/generic/backport-5.10/795-v5.16-02-net-phy-at803x-add-resume-suspend-function-to-qca83x.patch new file mode 100644 index 0000000000..be24fd5cf7 --- /dev/null +++ b/target/linux/generic/backport-5.10/795-v5.16-02-net-phy-at803x-add-resume-suspend-function-to-qca83x.patch @@ -0,0 +1,45 @@ +From 15b9df4ece17d084f14eb0ca1cf05f2ad497e425 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Sun, 19 Sep 2021 18:28:16 +0200 +Subject: net: phy: at803x: add resume/suspend function to qca83xx phy + +Add resume/suspend function to qca83xx internal phy. +We can't use the at803x generic function as the documentation lacks of +any support for WoL regs. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/at803x.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -1329,6 +1329,8 @@ static struct phy_driver at803x_driver[] + .get_sset_count = at803x_get_sset_count, + .get_strings = at803x_get_strings, + .get_stats = at803x_get_stats, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, + }, { + /* QCA8327-A from switch QCA8327-AL1A */ + .phy_id = QCA8327_A_PHY_ID, +@@ -1342,6 +1344,8 @@ static struct phy_driver at803x_driver[] + .get_sset_count = at803x_get_sset_count, + .get_strings = at803x_get_strings, + .get_stats = at803x_get_stats, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, + }, { + /* QCA8327-B from switch QCA8327-BL1A */ + .phy_id = QCA8327_B_PHY_ID, +@@ -1355,6 +1359,8 @@ static struct phy_driver at803x_driver[] + .get_sset_count = at803x_get_sset_count, + .get_strings = at803x_get_strings, + .get_stats = at803x_get_stats, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, + }, }; + + module_phy_driver(at803x_driver); diff --git a/target/linux/generic/backport-5.10/795-v5.16-03-net-phy-at803x-fix-spacing-and-improve-name-for-83xx.patch b/target/linux/generic/backport-5.10/795-v5.16-03-net-phy-at803x-fix-spacing-and-improve-name-for-83xx.patch new file mode 100644 index 0000000000..23f574c76f --- /dev/null +++ b/target/linux/generic/backport-5.10/795-v5.16-03-net-phy-at803x-fix-spacing-and-improve-name-for-83xx.patch @@ -0,0 +1,95 @@ +From d44fd8604a4ab92119adb35f05fd87612af722b5 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Sun, 19 Sep 2021 18:28:17 +0200 +Subject: net: phy: at803x: fix spacing and improve name for 83xx phy + +Fix spacing and improve name for 83xx phy following other phy in the +same driver. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/at803x.c | 60 ++++++++++++++++++++++++------------------------ + 1 file changed, 30 insertions(+), 30 deletions(-) + +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -1318,47 +1318,47 @@ static struct phy_driver at803x_driver[] + .config_aneg = at803x_config_aneg, + }, { + /* QCA8337 */ +- .phy_id = QCA8337_PHY_ID, +- .phy_id_mask = QCA8K_PHY_ID_MASK, +- .name = "QCA PHY 8337", ++ .phy_id = QCA8337_PHY_ID, ++ .phy_id_mask = QCA8K_PHY_ID_MASK, ++ .name = "Qualcomm Atheros 8337 internal PHY", + /* PHY_GBIT_FEATURES */ +- .probe = at803x_probe, +- .flags = PHY_IS_INTERNAL, +- .config_init = qca83xx_config_init, +- .soft_reset = genphy_soft_reset, +- .get_sset_count = at803x_get_sset_count, +- .get_strings = at803x_get_strings, +- .get_stats = at803x_get_stats, ++ .probe = at803x_probe, ++ .flags = PHY_IS_INTERNAL, ++ .config_init = qca83xx_config_init, ++ .soft_reset = genphy_soft_reset, ++ .get_sset_count = at803x_get_sset_count, ++ .get_strings = at803x_get_strings, ++ .get_stats = at803x_get_stats, + .suspend = genphy_suspend, + .resume = genphy_resume, + }, { + /* QCA8327-A from switch QCA8327-AL1A */ +- .phy_id = QCA8327_A_PHY_ID, +- .phy_id_mask = QCA8K_PHY_ID_MASK, +- .name = "QCA PHY 8327-A", ++ .phy_id = QCA8327_A_PHY_ID, ++ .phy_id_mask = QCA8K_PHY_ID_MASK, ++ .name = "Qualcomm Atheros 8327-A internal PHY", + /* PHY_GBIT_FEATURES */ +- .probe = at803x_probe, +- .flags = PHY_IS_INTERNAL, +- .config_init = qca83xx_config_init, +- .soft_reset = genphy_soft_reset, +- .get_sset_count = at803x_get_sset_count, +- .get_strings = at803x_get_strings, +- .get_stats = at803x_get_stats, ++ .probe = at803x_probe, ++ .flags = PHY_IS_INTERNAL, ++ .config_init = qca83xx_config_init, ++ .soft_reset = genphy_soft_reset, ++ .get_sset_count = at803x_get_sset_count, ++ .get_strings = at803x_get_strings, ++ .get_stats = at803x_get_stats, + .suspend = genphy_suspend, + .resume = genphy_resume, + }, { + /* QCA8327-B from switch QCA8327-BL1A */ +- .phy_id = QCA8327_B_PHY_ID, +- .phy_id_mask = QCA8K_PHY_ID_MASK, +- .name = "QCA PHY 8327-B", ++ .phy_id = QCA8327_B_PHY_ID, ++ .phy_id_mask = QCA8K_PHY_ID_MASK, ++ .name = "Qualcomm Atheros 8327-B internal PHY", + /* PHY_GBIT_FEATURES */ +- .probe = at803x_probe, +- .flags = PHY_IS_INTERNAL, +- .config_init = qca83xx_config_init, +- .soft_reset = genphy_soft_reset, +- .get_sset_count = at803x_get_sset_count, +- .get_strings = at803x_get_strings, +- .get_stats = at803x_get_stats, ++ .probe = at803x_probe, ++ .flags = PHY_IS_INTERNAL, ++ .config_init = qca83xx_config_init, ++ .soft_reset = genphy_soft_reset, ++ .get_sset_count = at803x_get_sset_count, ++ .get_strings = at803x_get_strings, ++ .get_stats = at803x_get_stats, + .suspend = genphy_suspend, + .resume = genphy_resume, + }, }; diff --git a/target/linux/generic/pending-5.10/730-net-phy-at803x-fix-feature-detection.patch b/target/linux/generic/pending-5.10/730-net-phy-at803x-fix-feature-detection.patch index a00416ec3e..5caed73372 100644 --- a/target/linux/generic/pending-5.10/730-net-phy-at803x-fix-feature-detection.patch +++ b/target/linux/generic/pending-5.10/730-net-phy-at803x-fix-feature-detection.patch @@ -20,7 +20,7 @@ Signed-off-by: David Bauer --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c -@@ -1024,6 +1024,34 @@ static int at803x_set_tunable(struct phy +@@ -1025,6 +1025,34 @@ static int at803x_set_tunable(struct phy } } @@ -55,7 +55,7 @@ Signed-off-by: David Bauer static int at803x_cable_test_result_trans(u16 status) { switch (FIELD_GET(AT803X_CDT_STATUS_STAT_MASK, status)) { -@@ -1273,7 +1301,7 @@ static struct phy_driver at803x_driver[] +@@ -1274,7 +1302,7 @@ static struct phy_driver at803x_driver[] .resume = at803x_resume, .read_page = at803x_read_page, .write_page = at803x_write_page, From d888ef5668a9243259381c57439ab5486009b05b Mon Sep 17 00:00:00 2001 From: Matthew Hagan Date: Fri, 1 Oct 2021 21:06:27 +0100 Subject: [PATCH 34/54] kernel: 5.10: backport QCA83x PHY resume fix, DAC amplitude preferred master, debug reg names Backport workaround for QCA8327 PHY resume, which does not properly support genphy_suspend/resume. Also add DAC amplitude fix for the QCA8327 PHY, set port to preferred master and add proper names to debug regs. Signed-off-by: Ansuel Smith Signed-off-by: Matthew Hagan --- ...hy-at803x-fix-resume-for-QCA8327-phy.patch | 131 ++++++++++++++++++ ...x-add-DAC-amplitude-fix-for-8327-phy.patch | 91 ++++++++++++ ...nable-prefer-master-for-83xx-interna.patch | 27 ++++ ...hy-at803x-better-describe-debug-regs.patch | 127 +++++++++++++++++ ...net-phy-at803x-fix-feature-detection.patch | 4 +- 5 files changed, 378 insertions(+), 2 deletions(-) create mode 100644 target/linux/generic/backport-5.10/796-v5.16-01-net-phy-at803x-fix-resume-for-QCA8327-phy.patch create mode 100644 target/linux/generic/backport-5.10/796-v5.16-02-net-phy-at803x-add-DAC-amplitude-fix-for-8327-phy.patch create mode 100644 target/linux/generic/backport-5.10/796-v5.16-03-net-phy-at803x-enable-prefer-master-for-83xx-interna.patch create mode 100644 target/linux/generic/backport-5.10/796-v5.16-04-net-phy-at803x-better-describe-debug-regs.patch diff --git a/target/linux/generic/backport-5.10/796-v5.16-01-net-phy-at803x-fix-resume-for-QCA8327-phy.patch b/target/linux/generic/backport-5.10/796-v5.16-01-net-phy-at803x-fix-resume-for-QCA8327-phy.patch new file mode 100644 index 0000000000..5dfe27dd24 --- /dev/null +++ b/target/linux/generic/backport-5.10/796-v5.16-01-net-phy-at803x-fix-resume-for-QCA8327-phy.patch @@ -0,0 +1,131 @@ +From ba3c01ee02ed0d821c9f241f179bbc9457542b8f Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Sun, 10 Oct 2021 00:46:15 +0200 +Subject: net: phy: at803x: fix resume for QCA8327 phy + +From Documentation phy resume triggers phy reset and restart +auto-negotiation. Add a dedicated function to wait reset to finish as +it was notice a regression where port sometime are not reliable after a +suspend/resume session. The reset wait logic is copied from phy_poll_reset. +Add dedicated suspend function to use genphy_suspend only with QCA8337 +phy and set only additional debug settings for QCA8327. With more test +it was reported that QCA8327 doesn't proprely support this mode and +using this cause the unreliability of the switch ports, especially the +malfunction of the port0. + +Fixes: 15b9df4ece17 ("net: phy: at803x: add resume/suspend function to qca83xx phy") +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/phy/at803x.c | 69 +++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 63 insertions(+), 6 deletions(-) + +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -92,9 +92,14 @@ + #define AT803X_DEBUG_REG_5 0x05 + #define AT803X_DEBUG_TX_CLK_DLY_EN BIT(8) + ++#define AT803X_DEBUG_REG_HIB_CTRL 0x0b ++#define AT803X_DEBUG_HIB_CTRL_SEL_RST_80U BIT(10) ++#define AT803X_DEBUG_HIB_CTRL_EN_ANY_CHANGE BIT(13) ++ + #define AT803X_DEBUG_REG_3C 0x3C + + #define AT803X_DEBUG_REG_3D 0x3D ++#define AT803X_DEBUG_GATE_CLK_IN1000 BIT(6) + + #define AT803X_DEBUG_REG_1F 0x1F + #define AT803X_DEBUG_PLL_ON BIT(2) +@@ -1220,6 +1225,58 @@ static int qca83xx_config_init(struct ph + return 0; + } + ++static int qca83xx_resume(struct phy_device *phydev) ++{ ++ int ret, val; ++ ++ /* Skip reset if not suspended */ ++ if (!phydev->suspended) ++ return 0; ++ ++ /* Reinit the port, reset values set by suspend */ ++ qca83xx_config_init(phydev); ++ ++ /* Reset the port on port resume */ ++ phy_set_bits(phydev, MII_BMCR, BMCR_RESET | BMCR_ANENABLE); ++ ++ /* On resume from suspend the switch execute a reset and ++ * restart auto-negotiation. Wait for reset to complete. ++ */ ++ ret = phy_read_poll_timeout(phydev, MII_BMCR, val, !(val & BMCR_RESET), ++ 50000, 600000, true); ++ if (ret) ++ return ret; ++ ++ msleep(1); ++ ++ return 0; ++} ++ ++static int qca83xx_suspend(struct phy_device *phydev) ++{ ++ u16 mask = 0; ++ ++ /* Only QCA8337 support actual suspend. ++ * QCA8327 cause port unreliability when phy suspend ++ * is set. ++ */ ++ if (phydev->drv->phy_id == QCA8337_PHY_ID) { ++ genphy_suspend(phydev); ++ } else { ++ mask |= ~(BMCR_SPEED1000 | BMCR_FULLDPLX); ++ phy_modify(phydev, MII_BMCR, mask, 0); ++ } ++ ++ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_3D, ++ AT803X_DEBUG_GATE_CLK_IN1000, 0); ++ ++ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_HIB_CTRL, ++ AT803X_DEBUG_HIB_CTRL_EN_ANY_CHANGE | ++ AT803X_DEBUG_HIB_CTRL_SEL_RST_80U, 0); ++ ++ return 0; ++} ++ + static struct phy_driver at803x_driver[] = { + { + /* Qualcomm Atheros AR8035 */ +@@ -1329,8 +1386,8 @@ static struct phy_driver at803x_driver[] + .get_sset_count = at803x_get_sset_count, + .get_strings = at803x_get_strings, + .get_stats = at803x_get_stats, +- .suspend = genphy_suspend, +- .resume = genphy_resume, ++ .suspend = qca83xx_suspend, ++ .resume = qca83xx_resume, + }, { + /* QCA8327-A from switch QCA8327-AL1A */ + .phy_id = QCA8327_A_PHY_ID, +@@ -1344,8 +1401,8 @@ static struct phy_driver at803x_driver[] + .get_sset_count = at803x_get_sset_count, + .get_strings = at803x_get_strings, + .get_stats = at803x_get_stats, +- .suspend = genphy_suspend, +- .resume = genphy_resume, ++ .suspend = qca83xx_suspend, ++ .resume = qca83xx_resume, + }, { + /* QCA8327-B from switch QCA8327-BL1A */ + .phy_id = QCA8327_B_PHY_ID, +@@ -1359,8 +1416,8 @@ static struct phy_driver at803x_driver[] + .get_sset_count = at803x_get_sset_count, + .get_strings = at803x_get_strings, + .get_stats = at803x_get_stats, +- .suspend = genphy_suspend, +- .resume = genphy_resume, ++ .suspend = qca83xx_suspend, ++ .resume = qca83xx_resume, + }, }; + + module_phy_driver(at803x_driver); diff --git a/target/linux/generic/backport-5.10/796-v5.16-02-net-phy-at803x-add-DAC-amplitude-fix-for-8327-phy.patch b/target/linux/generic/backport-5.10/796-v5.16-02-net-phy-at803x-add-DAC-amplitude-fix-for-8327-phy.patch new file mode 100644 index 0000000000..aeb43e2f67 --- /dev/null +++ b/target/linux/generic/backport-5.10/796-v5.16-02-net-phy-at803x-add-DAC-amplitude-fix-for-8327-phy.patch @@ -0,0 +1,91 @@ +From 1ca8311949aec5c9447645731ef1c6bc5bd71350 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Sun, 10 Oct 2021 00:46:16 +0200 +Subject: net: phy: at803x: add DAC amplitude fix for 8327 phy + +QCA8327 internal phy require DAC amplitude adjustement set to +6% with +100m speed. Also add additional define to report a change of the same +reg in QCA8337. (different scope it does set 1000m voltage) +Add link_change_notify function to set the proper amplitude adjustement +on PHY_RUNNING state and disable on any other state. + +Fixes: b4df02b562f4 ("net: phy: at803x: add support for qca 8327 A variant internal phy") +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/phy/at803x.c | 33 +++++++++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -87,6 +87,8 @@ + #define AT803X_PSSR_MR_AN_COMPLETE 0x0200 + + #define AT803X_DEBUG_REG_0 0x00 ++#define QCA8327_DEBUG_MANU_CTRL_EN BIT(2) ++#define QCA8337_DEBUG_MANU_CTRL_EN GENMASK(3, 2) + #define AT803X_DEBUG_RX_CLK_DLY_EN BIT(15) + + #define AT803X_DEBUG_REG_5 0x05 +@@ -1222,9 +1224,37 @@ static int qca83xx_config_init(struct ph + break; + } + ++ /* QCA8327 require DAC amplitude adjustment for 100m set to +6%. ++ * Disable on init and enable only with 100m speed following ++ * qca original source code. ++ */ ++ if (phydev->drv->phy_id == QCA8327_A_PHY_ID || ++ phydev->drv->phy_id == QCA8327_B_PHY_ID) ++ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, ++ QCA8327_DEBUG_MANU_CTRL_EN, 0); ++ + return 0; + } + ++static void qca83xx_link_change_notify(struct phy_device *phydev) ++{ ++ /* QCA8337 doesn't require DAC Amplitude adjustement */ ++ if (phydev->drv->phy_id == QCA8337_PHY_ID) ++ return; ++ ++ /* Set DAC Amplitude adjustment to +6% for 100m on link running */ ++ if (phydev->state == PHY_RUNNING) { ++ if (phydev->speed == SPEED_100) ++ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, ++ QCA8327_DEBUG_MANU_CTRL_EN, ++ QCA8327_DEBUG_MANU_CTRL_EN); ++ } else { ++ /* Reset DAC Amplitude adjustment */ ++ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, ++ QCA8327_DEBUG_MANU_CTRL_EN, 0); ++ } ++} ++ + static int qca83xx_resume(struct phy_device *phydev) + { + int ret, val; +@@ -1379,6 +1409,7 @@ static struct phy_driver at803x_driver[] + .phy_id_mask = QCA8K_PHY_ID_MASK, + .name = "Qualcomm Atheros 8337 internal PHY", + /* PHY_GBIT_FEATURES */ ++ .link_change_notify = qca83xx_link_change_notify, + .probe = at803x_probe, + .flags = PHY_IS_INTERNAL, + .config_init = qca83xx_config_init, +@@ -1394,6 +1425,7 @@ static struct phy_driver at803x_driver[] + .phy_id_mask = QCA8K_PHY_ID_MASK, + .name = "Qualcomm Atheros 8327-A internal PHY", + /* PHY_GBIT_FEATURES */ ++ .link_change_notify = qca83xx_link_change_notify, + .probe = at803x_probe, + .flags = PHY_IS_INTERNAL, + .config_init = qca83xx_config_init, +@@ -1409,6 +1441,7 @@ static struct phy_driver at803x_driver[] + .phy_id_mask = QCA8K_PHY_ID_MASK, + .name = "Qualcomm Atheros 8327-B internal PHY", + /* PHY_GBIT_FEATURES */ ++ .link_change_notify = qca83xx_link_change_notify, + .probe = at803x_probe, + .flags = PHY_IS_INTERNAL, + .config_init = qca83xx_config_init, diff --git a/target/linux/generic/backport-5.10/796-v5.16-03-net-phy-at803x-enable-prefer-master-for-83xx-interna.patch b/target/linux/generic/backport-5.10/796-v5.16-03-net-phy-at803x-enable-prefer-master-for-83xx-interna.patch new file mode 100644 index 0000000000..2352fa0e44 --- /dev/null +++ b/target/linux/generic/backport-5.10/796-v5.16-03-net-phy-at803x-enable-prefer-master-for-83xx-interna.patch @@ -0,0 +1,27 @@ +From 9d1c29b4028557a496be9c5eb2b4b86063700636 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Sun, 10 Oct 2021 00:46:17 +0200 +Subject: net: phy: at803x: enable prefer master for 83xx internal phy + +From original QCA source code the port was set to prefer master as port +type in 1000BASE-T mode. Apply the same settings also here. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/at803x.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -1233,6 +1233,9 @@ static int qca83xx_config_init(struct ph + at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, + QCA8327_DEBUG_MANU_CTRL_EN, 0); + ++ /* Following original QCA sourcecode set port to prefer master */ ++ phy_set_bits(phydev, MII_CTRL1000, CTL1000_PREFER_MASTER); ++ + return 0; + } + diff --git a/target/linux/generic/backport-5.10/796-v5.16-04-net-phy-at803x-better-describe-debug-regs.patch b/target/linux/generic/backport-5.10/796-v5.16-04-net-phy-at803x-better-describe-debug-regs.patch new file mode 100644 index 0000000000..9c28a893f1 --- /dev/null +++ b/target/linux/generic/backport-5.10/796-v5.16-04-net-phy-at803x-better-describe-debug-regs.patch @@ -0,0 +1,127 @@ +From 67999555ff42e91de7654488d9a7735bd9e84555 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Sun, 10 Oct 2021 00:46:18 +0200 +Subject: net: phy: at803x: better describe debug regs + +Give a name to known debug regs from Documentation instead of using +unknown hex values. + +Signed-off-by: Ansuel Smith +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + drivers/net/phy/at803x.c | 30 +++++++++++++++--------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -86,12 +86,12 @@ + #define AT803X_PSSR 0x11 /*PHY-Specific Status Register*/ + #define AT803X_PSSR_MR_AN_COMPLETE 0x0200 + +-#define AT803X_DEBUG_REG_0 0x00 ++#define AT803X_DEBUG_ANALOG_TEST_CTRL 0x00 + #define QCA8327_DEBUG_MANU_CTRL_EN BIT(2) + #define QCA8337_DEBUG_MANU_CTRL_EN GENMASK(3, 2) + #define AT803X_DEBUG_RX_CLK_DLY_EN BIT(15) + +-#define AT803X_DEBUG_REG_5 0x05 ++#define AT803X_DEBUG_SYSTEM_CTRL_MODE 0x05 + #define AT803X_DEBUG_TX_CLK_DLY_EN BIT(8) + + #define AT803X_DEBUG_REG_HIB_CTRL 0x0b +@@ -100,7 +100,7 @@ + + #define AT803X_DEBUG_REG_3C 0x3C + +-#define AT803X_DEBUG_REG_3D 0x3D ++#define AT803X_DEBUG_REG_GREEN 0x3D + #define AT803X_DEBUG_GATE_CLK_IN1000 BIT(6) + + #define AT803X_DEBUG_REG_1F 0x1F +@@ -274,25 +274,25 @@ static int at803x_read_page(struct phy_d + + static int at803x_enable_rx_delay(struct phy_device *phydev) + { +- return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, 0, ++ return at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, 0, + AT803X_DEBUG_RX_CLK_DLY_EN); + } + + static int at803x_enable_tx_delay(struct phy_device *phydev) + { +- return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, 0, ++ return at803x_debug_reg_mask(phydev, AT803X_DEBUG_SYSTEM_CTRL_MODE, 0, + AT803X_DEBUG_TX_CLK_DLY_EN); + } + + static int at803x_disable_rx_delay(struct phy_device *phydev) + { +- return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, ++ return at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, + AT803X_DEBUG_RX_CLK_DLY_EN, 0); + } + + static int at803x_disable_tx_delay(struct phy_device *phydev) + { +- return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, ++ return at803x_debug_reg_mask(phydev, AT803X_DEBUG_SYSTEM_CTRL_MODE, + AT803X_DEBUG_TX_CLK_DLY_EN, 0); + } + +@@ -1208,9 +1208,9 @@ static int qca83xx_config_init(struct ph + switch (switch_revision) { + case 1: + /* For 100M waveform */ +- at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_0, 0x02ea); ++ at803x_debug_reg_write(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, 0x02ea); + /* Turn on Gigabit clock */ +- at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_3D, 0x68a0); ++ at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_GREEN, 0x68a0); + break; + + case 2: +@@ -1218,8 +1218,8 @@ static int qca83xx_config_init(struct ph + fallthrough; + case 4: + phy_write_mmd(phydev, MDIO_MMD_PCS, MDIO_AZ_DEBUG, 0x803f); +- at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_3D, 0x6860); +- at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_5, 0x2c46); ++ at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_GREEN, 0x6860); ++ at803x_debug_reg_write(phydev, AT803X_DEBUG_SYSTEM_CTRL_MODE, 0x2c46); + at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_3C, 0x6000); + break; + } +@@ -1230,7 +1230,7 @@ static int qca83xx_config_init(struct ph + */ + if (phydev->drv->phy_id == QCA8327_A_PHY_ID || + phydev->drv->phy_id == QCA8327_B_PHY_ID) +- at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, ++ at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, + QCA8327_DEBUG_MANU_CTRL_EN, 0); + + /* Following original QCA sourcecode set port to prefer master */ +@@ -1248,12 +1248,12 @@ static void qca83xx_link_change_notify(s + /* Set DAC Amplitude adjustment to +6% for 100m on link running */ + if (phydev->state == PHY_RUNNING) { + if (phydev->speed == SPEED_100) +- at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, ++ at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, + QCA8327_DEBUG_MANU_CTRL_EN, + QCA8327_DEBUG_MANU_CTRL_EN); + } else { + /* Reset DAC Amplitude adjustment */ +- at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, ++ at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, + QCA8327_DEBUG_MANU_CTRL_EN, 0); + } + } +@@ -1300,7 +1300,7 @@ static int qca83xx_suspend(struct phy_de + phy_modify(phydev, MII_BMCR, mask, 0); + } + +- at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_3D, ++ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_GREEN, + AT803X_DEBUG_GATE_CLK_IN1000, 0); + + at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_HIB_CTRL, diff --git a/target/linux/generic/pending-5.10/730-net-phy-at803x-fix-feature-detection.patch b/target/linux/generic/pending-5.10/730-net-phy-at803x-fix-feature-detection.patch index 5caed73372..c49bb19601 100644 --- a/target/linux/generic/pending-5.10/730-net-phy-at803x-fix-feature-detection.patch +++ b/target/linux/generic/pending-5.10/730-net-phy-at803x-fix-feature-detection.patch @@ -20,7 +20,7 @@ Signed-off-by: David Bauer --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c -@@ -1025,6 +1025,34 @@ static int at803x_set_tunable(struct phy +@@ -1032,6 +1032,34 @@ static int at803x_set_tunable(struct phy } } @@ -55,7 +55,7 @@ Signed-off-by: David Bauer static int at803x_cable_test_result_trans(u16 status) { switch (FIELD_GET(AT803X_CDT_STATUS_STAT_MASK, status)) { -@@ -1274,7 +1302,7 @@ static struct phy_driver at803x_driver[] +@@ -1364,7 +1392,7 @@ static struct phy_driver at803x_driver[] .resume = at803x_resume, .read_page = at803x_read_page, .write_page = at803x_write_page, From f97cafdd1d4de52f3254138524817980f27833cd Mon Sep 17 00:00:00 2001 From: Matthew Hagan Date: Thu, 9 Sep 2021 19:40:21 +0000 Subject: [PATCH 35/54] kernel: 5.10: backport qca8k feature additions Backport Ansuel Smith's various qca8k feature additions: - mac-power-sel support - SGMII PLL explicit enable - tx/rx clock phase to falling edge - power-on-sel and LED open drain mode - cpu port 6 - qca8328 support - sgmii internal delay - move port config to dedicated struct - convert to yaml schema Signed-off-by: Ansuel Smith Signed-off-by: Matthew Hagan --- ...-dsa-qca8k-add-mac-power-sel-support.patch | 80 +++ ...dsa-qca8k-Add-SGMII-clock-phase-prop.patch | 30 + ...k-add-support-for-sgmii-falling-edge.patch | 127 ++++ ...dsa-qca8k-Document-support-for-CPU-p.patch | 29 + ...dsa-qca8k-add-support-for-cpu-port-6.patch | 153 +++++ ...work-rgmii-delay-logic-and-scan-for-.patch | 295 ++++++++ ...dsa-qca8k-Document-qca-sgmii-enable-.patch | 33 + ...-qca8k-add-explicit-SGMII-PLL-enable.patch | 65 ++ ...dsa-qca8k-Document-qca-led-open-drai.patch | 37 + ...qca8k-add-support-for-pws-config-reg.patch | 92 +++ ...dsa-qca8k-document-support-for-qca83.patch | 32 + ...et-dsa-qca8k-add-support-for-QCA8328.patch | 78 +++ ...8k-set-internal-delay-also-for-sgmii.patch | 159 +++++ ...move-port-config-to-dedicated-struct.patch | 124 ++++ ...ipq8064-mdio-fix-warning-with-new-qc.patch | 26 + ...net-dsa-qca8k-convert-to-YAML-schema.patch | 631 ++++++++++++++++++ 16 files changed, 1991 insertions(+) create mode 100644 target/linux/generic/backport-5.10/797-v5.16-01-dsa-qca8k-add-mac-power-sel-support.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-02-dt-bindings-net-dsa-qca8k-Add-SGMII-clock-phase-prop.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-03-net-dsa-qca8k-add-support-for-sgmii-falling-edge.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-04-dt-bindings-net-dsa-qca8k-Document-support-for-CPU-p.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-05-net-dsa-qca8k-add-support-for-cpu-port-6.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-06-net-dsa-qca8k-rework-rgmii-delay-logic-and-scan-for-.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-07-dt-bindings-net-dsa-qca8k-Document-qca-sgmii-enable-.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-08-net-dsa-qca8k-add-explicit-SGMII-PLL-enable.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-09-dt-bindings-net-dsa-qca8k-Document-qca-led-open-drai.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-10-net-dsa-qca8k-add-support-for-pws-config-reg.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-11-dt-bindings-net-dsa-qca8k-document-support-for-qca83.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-12-net-dsa-qca8k-add-support-for-QCA8328.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-13-net-dsa-qca8k-set-internal-delay-also-for-sgmii.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-14-net-dsa-qca8k-move-port-config-to-dedicated-struct.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-15-dt-bindings-net-ipq8064-mdio-fix-warning-with-new-qc.patch create mode 100644 target/linux/generic/backport-5.10/797-v5.16-16-dt-bindings-net-dsa-qca8k-convert-to-YAML-schema.patch diff --git a/target/linux/generic/backport-5.10/797-v5.16-01-dsa-qca8k-add-mac-power-sel-support.patch b/target/linux/generic/backport-5.10/797-v5.16-01-dsa-qca8k-add-mac-power-sel-support.patch new file mode 100644 index 0000000000..c8d424de38 --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-01-dsa-qca8k-add-mac-power-sel-support.patch @@ -0,0 +1,80 @@ +From d8b6f5bae6d3b648a67b6958cb98e4e97256d652 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:06 +0200 +Subject: dsa: qca8k: add mac_power_sel support + +Add missing mac power sel support needed for ipq8064/5 SoC that require +1.8v for the internal regulator port instead of the default 1.5v. +If other device needs this, consider adding a dedicated binding to +support this. + +Signed-off-by: Ansuel Smith +Reviewed-by: Vladimir Oltean +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 31 +++++++++++++++++++++++++++++++ + drivers/net/dsa/qca8k.h | 5 +++++ + 2 files changed, 36 insertions(+) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -951,6 +951,33 @@ qca8k_setup_of_rgmii_delay(struct qca8k_ + } + + static int ++qca8k_setup_mac_pwr_sel(struct qca8k_priv *priv) ++{ ++ u32 mask = 0; ++ int ret = 0; ++ ++ /* SoC specific settings for ipq8064. ++ * If more device require this consider adding ++ * a dedicated binding. ++ */ ++ if (of_machine_is_compatible("qcom,ipq8064")) ++ mask |= QCA8K_MAC_PWR_RGMII0_1_8V; ++ ++ /* SoC specific settings for ipq8065 */ ++ if (of_machine_is_compatible("qcom,ipq8065")) ++ mask |= QCA8K_MAC_PWR_RGMII1_1_8V; ++ ++ if (mask) { ++ ret = qca8k_rmw(priv, QCA8K_REG_MAC_PWR_SEL, ++ QCA8K_MAC_PWR_RGMII0_1_8V | ++ QCA8K_MAC_PWR_RGMII1_1_8V, ++ mask); ++ } ++ ++ return ret; ++} ++ ++static int + qca8k_setup(struct dsa_switch *ds) + { + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; +@@ -979,6 +1006,10 @@ qca8k_setup(struct dsa_switch *ds) + if (ret) + return ret; + ++ ret = qca8k_setup_mac_pwr_sel(priv); ++ if (ret) ++ return ret; ++ + /* Enable CPU Port */ + ret = qca8k_reg_set(priv, QCA8K_REG_GLOBAL_FW_CTRL0, + QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN); +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -100,6 +100,11 @@ + #define QCA8K_SGMII_MODE_CTRL_PHY (1 << 22) + #define QCA8K_SGMII_MODE_CTRL_MAC (2 << 22) + ++/* MAC_PWR_SEL registers */ ++#define QCA8K_REG_MAC_PWR_SEL 0x0e4 ++#define QCA8K_MAC_PWR_RGMII1_1_8V BIT(18) ++#define QCA8K_MAC_PWR_RGMII0_1_8V BIT(19) ++ + /* EEE control registers */ + #define QCA8K_REG_EEE_CTRL 0x100 + #define QCA8K_REG_EEE_CTRL_LPI_EN(_i) ((_i + 1) * 2) diff --git a/target/linux/generic/backport-5.10/797-v5.16-02-dt-bindings-net-dsa-qca8k-Add-SGMII-clock-phase-prop.patch b/target/linux/generic/backport-5.10/797-v5.16-02-dt-bindings-net-dsa-qca8k-Add-SGMII-clock-phase-prop.patch new file mode 100644 index 0000000000..bd768ec27d --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-02-dt-bindings-net-dsa-qca8k-Add-SGMII-clock-phase-prop.patch @@ -0,0 +1,30 @@ +From fdbf35df9c091db9c46e57e9938e3f7a4f603a7c Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:07 +0200 +Subject: dt-bindings: net: dsa: qca8k: Add SGMII clock phase properties + +Add names and descriptions of additional PORT0_PAD_CTRL properties. +qca,sgmii-(rx|tx)clk-falling-edge are for setting the respective clock +phase to failling edge. + +Co-developed-by: Matthew Hagan +Signed-off-by: Matthew Hagan +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + Documentation/devicetree/bindings/net/dsa/qca8k.txt | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt ++++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt +@@ -37,6 +37,10 @@ A CPU port node has the following option + managed entity. See + Documentation/devicetree/bindings/net/fixed-link.txt + for details. ++- qca,sgmii-rxclk-falling-edge: Set the receive clock phase to falling edge. ++ Mostly used in qca8327 with CPU port 0 set to ++ sgmii. ++- qca,sgmii-txclk-falling-edge: Set the transmit clock phase to falling edge. + + For QCA8K the 'fixed-link' sub-node supports only the following properties: + diff --git a/target/linux/generic/backport-5.10/797-v5.16-03-net-dsa-qca8k-add-support-for-sgmii-falling-edge.patch b/target/linux/generic/backport-5.10/797-v5.16-03-net-dsa-qca8k-add-support-for-sgmii-falling-edge.patch new file mode 100644 index 0000000000..e464452d82 --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-03-net-dsa-qca8k-add-support-for-sgmii-falling-edge.patch @@ -0,0 +1,127 @@ +From 6c43809bf1bee76c434e365a26546a92a5fbec14 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:08 +0200 +Subject: net: dsa: qca8k: add support for sgmii falling edge + +Add support for this in the qca8k driver. Also add support for SGMII +rx/tx clock falling edge. This is only present for pad0, pad5 and +pad6 have these bit reserved from Documentation. Add a comment that this +is hardcoded to PAD0 as qca8327/28/34/37 have an unique sgmii line and +setting falling in port0 applies to both configuration with sgmii used +for port0 or port6. + +Co-developed-by: Matthew Hagan +Signed-off-by: Matthew Hagan +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ + drivers/net/dsa/qca8k.h | 4 ++++ + 2 files changed, 67 insertions(+) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -978,6 +978,42 @@ qca8k_setup_mac_pwr_sel(struct qca8k_pri + } + + static int ++qca8k_parse_port_config(struct qca8k_priv *priv) ++{ ++ struct device_node *port_dn; ++ phy_interface_t mode; ++ struct dsa_port *dp; ++ int port, ret; ++ ++ /* We have 2 CPU port. Check them */ ++ for (port = 0; port < QCA8K_NUM_PORTS; port++) { ++ /* Skip every other port */ ++ if (port != 0 && port != 6) ++ continue; ++ ++ dp = dsa_to_port(priv->ds, port); ++ port_dn = dp->dn; ++ ++ if (!of_device_is_available(port_dn)) ++ continue; ++ ++ ret = of_get_phy_mode(port_dn, &mode); ++ if (ret) ++ continue; ++ ++ if (mode == PHY_INTERFACE_MODE_SGMII) { ++ if (of_property_read_bool(port_dn, "qca,sgmii-txclk-falling-edge")) ++ priv->sgmii_tx_clk_falling_edge = true; ++ ++ if (of_property_read_bool(port_dn, "qca,sgmii-rxclk-falling-edge")) ++ priv->sgmii_rx_clk_falling_edge = true; ++ } ++ } ++ ++ return 0; ++} ++ ++static int + qca8k_setup(struct dsa_switch *ds) + { + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; +@@ -990,6 +1026,11 @@ qca8k_setup(struct dsa_switch *ds) + return -EINVAL; + } + ++ /* Parse CPU port config to be later used in phy_link mac_config */ ++ ret = qca8k_parse_port_config(priv); ++ if (ret) ++ return ret; ++ + mutex_init(&priv->reg_mutex); + + /* Start by setting up the register mapping */ +@@ -1274,6 +1315,28 @@ qca8k_phylink_mac_config(struct dsa_swit + } + + qca8k_write(priv, QCA8K_REG_SGMII_CTRL, val); ++ ++ /* For qca8327/qca8328/qca8334/qca8338 sgmii is unique and ++ * falling edge is set writing in the PORT0 PAD reg ++ */ ++ if (priv->switch_id == QCA8K_ID_QCA8327 || ++ priv->switch_id == QCA8K_ID_QCA8337) ++ reg = QCA8K_REG_PORT0_PAD_CTRL; ++ ++ val = 0; ++ ++ /* SGMII Clock phase configuration */ ++ if (priv->sgmii_rx_clk_falling_edge) ++ val |= QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE; ++ ++ if (priv->sgmii_tx_clk_falling_edge) ++ val |= QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE; ++ ++ if (val) ++ ret = qca8k_rmw(priv, reg, ++ QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE | ++ QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE, ++ val); + break; + default: + dev_err(ds->dev, "xMII mode %s not supported for port %d\n", +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -35,6 +35,8 @@ + #define QCA8K_MASK_CTRL_DEVICE_ID_MASK GENMASK(15, 8) + #define QCA8K_MASK_CTRL_DEVICE_ID(x) ((x) >> 8) + #define QCA8K_REG_PORT0_PAD_CTRL 0x004 ++#define QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE BIT(19) ++#define QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE BIT(18) + #define QCA8K_REG_PORT5_PAD_CTRL 0x008 + #define QCA8K_REG_PORT6_PAD_CTRL 0x00c + #define QCA8K_PORT_PAD_RGMII_EN BIT(26) +@@ -260,6 +262,8 @@ struct qca8k_priv { + u8 switch_revision; + u8 rgmii_tx_delay; + u8 rgmii_rx_delay; ++ bool sgmii_rx_clk_falling_edge; ++ bool sgmii_tx_clk_falling_edge; + bool legacy_phy_port_mapping; + struct regmap *regmap; + struct mii_bus *bus; diff --git a/target/linux/generic/backport-5.10/797-v5.16-04-dt-bindings-net-dsa-qca8k-Document-support-for-CPU-p.patch b/target/linux/generic/backport-5.10/797-v5.16-04-dt-bindings-net-dsa-qca8k-Document-support-for-CPU-p.patch new file mode 100644 index 0000000000..606ac0af3d --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-04-dt-bindings-net-dsa-qca8k-Document-support-for-CPU-p.patch @@ -0,0 +1,29 @@ +From 731d613338ec6de482053ffa3f71be2325b0f8eb Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:09 +0200 +Subject: dt-bindings: net: dsa: qca8k: Document support for CPU port 6 + +The switch now support CPU port to be set 6 instead of be hardcoded to +0. Document support for it and describe logic selection. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + Documentation/devicetree/bindings/net/dsa/qca8k.txt | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt ++++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt +@@ -29,7 +29,11 @@ the mdio MASTER is used as communication + Don't use mixed external and internal mdio-bus configurations, as this is + not supported by the hardware. + +-The CPU port of this switch is always port 0. ++This switch support 2 CPU port. Normally and advised configuration is with ++CPU port set to port 0. It is also possible to set the CPU port to port 6 ++if the device requires it. The driver will configure the switch to the defined ++port. With both CPU port declared the first CPU port is selected as primary ++and the secondary CPU ignored. + + A CPU port node has the following optional node: + diff --git a/target/linux/generic/backport-5.10/797-v5.16-05-net-dsa-qca8k-add-support-for-cpu-port-6.patch b/target/linux/generic/backport-5.10/797-v5.16-05-net-dsa-qca8k-add-support-for-cpu-port-6.patch new file mode 100644 index 0000000000..320db8fa9f --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-05-net-dsa-qca8k-add-support-for-cpu-port-6.patch @@ -0,0 +1,153 @@ +From 3fcf734aa482487df83cf8f18608438fcf59127f Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:10 +0200 +Subject: net: dsa: qca8k: add support for cpu port 6 + +Currently CPU port is always hardcoded to port 0. This switch have 2 CPU +ports. The original intention of this driver seems to be use the +mac06_exchange bit to swap MAC0 with MAC6 in the strange configuration +where device have connected only the CPU port 6. To skip the +introduction of a new binding, rework the driver to address the +secondary CPU port as primary and drop any reference of hardcoded port. +With configuration of mac06 exchange, just skip the definition of port0 +and define the CPU port as a secondary. The driver will autoconfigure +the switch to use that as the primary CPU port. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 51 ++++++++++++++++++++++++++++++++++--------------- + drivers/net/dsa/qca8k.h | 2 -- + 2 files changed, 36 insertions(+), 17 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -977,6 +977,22 @@ qca8k_setup_mac_pwr_sel(struct qca8k_pri + return ret; + } + ++static int qca8k_find_cpu_port(struct dsa_switch *ds) ++{ ++ struct qca8k_priv *priv = ds->priv; ++ ++ /* Find the connected cpu port. Valid port are 0 or 6 */ ++ if (dsa_is_cpu_port(ds, 0)) ++ return 0; ++ ++ dev_dbg(priv->dev, "port 0 is not the CPU port. Checking port 6"); ++ ++ if (dsa_is_cpu_port(ds, 6)) ++ return 6; ++ ++ return -EINVAL; ++} ++ + static int + qca8k_parse_port_config(struct qca8k_priv *priv) + { +@@ -1017,13 +1033,13 @@ static int + qca8k_setup(struct dsa_switch *ds) + { + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; +- int ret, i; ++ int cpu_port, ret, i; + u32 mask; + +- /* Make sure that port 0 is the cpu port */ +- if (!dsa_is_cpu_port(ds, 0)) { +- dev_err(priv->dev, "port 0 is not the CPU port"); +- return -EINVAL; ++ cpu_port = qca8k_find_cpu_port(ds); ++ if (cpu_port < 0) { ++ dev_err(priv->dev, "No cpu port configured in both cpu port0 and port6"); ++ return cpu_port; + } + + /* Parse CPU port config to be later used in phy_link mac_config */ +@@ -1065,7 +1081,7 @@ qca8k_setup(struct dsa_switch *ds) + dev_warn(priv->dev, "mib init failed"); + + /* Enable QCA header mode on the cpu port */ +- ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(QCA8K_CPU_PORT), ++ ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(cpu_port), + QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_TX_S | + QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_RX_S); + if (ret) { +@@ -1087,10 +1103,10 @@ qca8k_setup(struct dsa_switch *ds) + + /* Forward all unknown frames to CPU port for Linux processing */ + ret = qca8k_write(priv, QCA8K_REG_GLOBAL_FW_CTRL1, +- BIT(0) << QCA8K_GLOBAL_FW_CTRL1_IGMP_DP_S | +- BIT(0) << QCA8K_GLOBAL_FW_CTRL1_BC_DP_S | +- BIT(0) << QCA8K_GLOBAL_FW_CTRL1_MC_DP_S | +- BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S); ++ BIT(cpu_port) << QCA8K_GLOBAL_FW_CTRL1_IGMP_DP_S | ++ BIT(cpu_port) << QCA8K_GLOBAL_FW_CTRL1_BC_DP_S | ++ BIT(cpu_port) << QCA8K_GLOBAL_FW_CTRL1_MC_DP_S | ++ BIT(cpu_port) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S); + if (ret) + return ret; + +@@ -1098,7 +1114,7 @@ qca8k_setup(struct dsa_switch *ds) + for (i = 0; i < QCA8K_NUM_PORTS; i++) { + /* CPU port gets connected to all user ports of the switch */ + if (dsa_is_cpu_port(ds, i)) { +- ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT), ++ ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(cpu_port), + QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds)); + if (ret) + return ret; +@@ -1110,7 +1126,7 @@ qca8k_setup(struct dsa_switch *ds) + + ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i), + QCA8K_PORT_LOOKUP_MEMBER, +- BIT(QCA8K_CPU_PORT)); ++ BIT(cpu_port)); + if (ret) + return ret; + +@@ -1616,9 +1632,12 @@ static int + qca8k_port_bridge_join(struct dsa_switch *ds, int port, struct net_device *br) + { + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; +- int port_mask = BIT(QCA8K_CPU_PORT); ++ int port_mask, cpu_port; + int i, ret; + ++ cpu_port = dsa_to_port(ds, port)->cpu_dp->index; ++ port_mask = BIT(cpu_port); ++ + for (i = 1; i < QCA8K_NUM_PORTS; i++) { + if (dsa_to_port(ds, i)->bridge_dev != br) + continue; +@@ -1645,7 +1664,9 @@ static void + qca8k_port_bridge_leave(struct dsa_switch *ds, int port, struct net_device *br) + { + struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv; +- int i; ++ int cpu_port, i; ++ ++ cpu_port = dsa_to_port(ds, port)->cpu_dp->index; + + for (i = 1; i < QCA8K_NUM_PORTS; i++) { + if (dsa_to_port(ds, i)->bridge_dev != br) +@@ -1662,7 +1683,7 @@ qca8k_port_bridge_leave(struct dsa_switc + * this port + */ + qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port), +- QCA8K_PORT_LOOKUP_MEMBER, BIT(QCA8K_CPU_PORT)); ++ QCA8K_PORT_LOOKUP_MEMBER, BIT(cpu_port)); + } + + static int +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -24,8 +24,6 @@ + + #define QCA8K_NUM_FDB_RECORDS 2048 + +-#define QCA8K_CPU_PORT 0 +- + #define QCA8K_PORT_VID_DEF 1 + + /* Global control registers */ diff --git a/target/linux/generic/backport-5.10/797-v5.16-06-net-dsa-qca8k-rework-rgmii-delay-logic-and-scan-for-.patch b/target/linux/generic/backport-5.10/797-v5.16-06-net-dsa-qca8k-rework-rgmii-delay-logic-and-scan-for-.patch new file mode 100644 index 0000000000..de201764f9 --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-06-net-dsa-qca8k-rework-rgmii-delay-logic-and-scan-for-.patch @@ -0,0 +1,295 @@ +From 5654ec78dd7e64b1e04777b24007344329e6a63b Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:11 +0200 +Subject: net: dsa: qca8k: rework rgmii delay logic and scan for cpu port 6 + +Future proof commit. This switch have 2 CPU ports and one valid +configuration is first CPU port set to sgmii and second CPU port set to +rgmii-id. The current implementation detects delay only for CPU port +zero set to rgmii and doesn't count any delay set in a secondary CPU +port. Drop the current delay scan function and move it to the sgmii +parser function to generalize and implicitly add support for secondary +CPU port set to rgmii-id. Introduce new logic where delay is enabled +also with internal delay binding declared and rgmii set as PHY mode. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 165 ++++++++++++++++++++++++------------------------ + drivers/net/dsa/qca8k.h | 10 ++- + 2 files changed, 89 insertions(+), 86 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -889,68 +889,6 @@ qca8k_setup_mdio_bus(struct qca8k_priv * + } + + static int +-qca8k_setup_of_rgmii_delay(struct qca8k_priv *priv) +-{ +- struct device_node *port_dn; +- phy_interface_t mode; +- struct dsa_port *dp; +- u32 val; +- +- /* CPU port is already checked */ +- dp = dsa_to_port(priv->ds, 0); +- +- port_dn = dp->dn; +- +- /* Check if port 0 is set to the correct type */ +- of_get_phy_mode(port_dn, &mode); +- if (mode != PHY_INTERFACE_MODE_RGMII_ID && +- mode != PHY_INTERFACE_MODE_RGMII_RXID && +- mode != PHY_INTERFACE_MODE_RGMII_TXID) { +- return 0; +- } +- +- switch (mode) { +- case PHY_INTERFACE_MODE_RGMII_ID: +- case PHY_INTERFACE_MODE_RGMII_RXID: +- if (of_property_read_u32(port_dn, "rx-internal-delay-ps", &val)) +- val = 2; +- else +- /* Switch regs accept value in ns, convert ps to ns */ +- val = val / 1000; +- +- if (val > QCA8K_MAX_DELAY) { +- dev_err(priv->dev, "rgmii rx delay is limited to a max value of 3ns, setting to the max value"); +- val = 3; +- } +- +- priv->rgmii_rx_delay = val; +- /* Stop here if we need to check only for rx delay */ +- if (mode != PHY_INTERFACE_MODE_RGMII_ID) +- break; +- +- fallthrough; +- case PHY_INTERFACE_MODE_RGMII_TXID: +- if (of_property_read_u32(port_dn, "tx-internal-delay-ps", &val)) +- val = 1; +- else +- /* Switch regs accept value in ns, convert ps to ns */ +- val = val / 1000; +- +- if (val > QCA8K_MAX_DELAY) { +- dev_err(priv->dev, "rgmii tx delay is limited to a max value of 3ns, setting to the max value"); +- val = 3; +- } +- +- priv->rgmii_tx_delay = val; +- break; +- default: +- return 0; +- } +- +- return 0; +-} +- +-static int + qca8k_setup_mac_pwr_sel(struct qca8k_priv *priv) + { + u32 mask = 0; +@@ -996,19 +934,21 @@ static int qca8k_find_cpu_port(struct ds + static int + qca8k_parse_port_config(struct qca8k_priv *priv) + { ++ int port, cpu_port_index = 0, ret; + struct device_node *port_dn; + phy_interface_t mode; + struct dsa_port *dp; +- int port, ret; ++ u32 delay; + + /* We have 2 CPU port. Check them */ +- for (port = 0; port < QCA8K_NUM_PORTS; port++) { ++ for (port = 0; port < QCA8K_NUM_PORTS && cpu_port_index < QCA8K_NUM_CPU_PORTS; port++) { + /* Skip every other port */ + if (port != 0 && port != 6) + continue; + + dp = dsa_to_port(priv->ds, port); + port_dn = dp->dn; ++ cpu_port_index++; + + if (!of_device_is_available(port_dn)) + continue; +@@ -1017,12 +957,54 @@ qca8k_parse_port_config(struct qca8k_pri + if (ret) + continue; + +- if (mode == PHY_INTERFACE_MODE_SGMII) { ++ switch (mode) { ++ case PHY_INTERFACE_MODE_RGMII: ++ case PHY_INTERFACE_MODE_RGMII_ID: ++ case PHY_INTERFACE_MODE_RGMII_TXID: ++ case PHY_INTERFACE_MODE_RGMII_RXID: ++ delay = 0; ++ ++ if (!of_property_read_u32(port_dn, "tx-internal-delay-ps", &delay)) ++ /* Switch regs accept value in ns, convert ps to ns */ ++ delay = delay / 1000; ++ else if (mode == PHY_INTERFACE_MODE_RGMII_ID || ++ mode == PHY_INTERFACE_MODE_RGMII_TXID) ++ delay = 1; ++ ++ if (delay > QCA8K_MAX_DELAY) { ++ dev_err(priv->dev, "rgmii tx delay is limited to a max value of 3ns, setting to the max value"); ++ delay = 3; ++ } ++ ++ priv->rgmii_tx_delay[cpu_port_index] = delay; ++ ++ delay = 0; ++ ++ if (!of_property_read_u32(port_dn, "rx-internal-delay-ps", &delay)) ++ /* Switch regs accept value in ns, convert ps to ns */ ++ delay = delay / 1000; ++ else if (mode == PHY_INTERFACE_MODE_RGMII_ID || ++ mode == PHY_INTERFACE_MODE_RGMII_RXID) ++ delay = 2; ++ ++ if (delay > QCA8K_MAX_DELAY) { ++ dev_err(priv->dev, "rgmii rx delay is limited to a max value of 3ns, setting to the max value"); ++ delay = 3; ++ } ++ ++ priv->rgmii_rx_delay[cpu_port_index] = delay; ++ ++ break; ++ case PHY_INTERFACE_MODE_SGMII: + if (of_property_read_bool(port_dn, "qca,sgmii-txclk-falling-edge")) + priv->sgmii_tx_clk_falling_edge = true; + + if (of_property_read_bool(port_dn, "qca,sgmii-rxclk-falling-edge")) + priv->sgmii_rx_clk_falling_edge = true; ++ ++ break; ++ default: ++ continue; + } + } + +@@ -1059,10 +1041,6 @@ qca8k_setup(struct dsa_switch *ds) + if (ret) + return ret; + +- ret = qca8k_setup_of_rgmii_delay(priv); +- if (ret) +- return ret; +- + ret = qca8k_setup_mac_pwr_sel(priv); + if (ret) + return ret; +@@ -1229,8 +1207,8 @@ qca8k_phylink_mac_config(struct dsa_swit + const struct phylink_link_state *state) + { + struct qca8k_priv *priv = ds->priv; +- u32 reg, val; +- int ret; ++ int cpu_port_index, ret; ++ u32 reg, val, delay; + + switch (port) { + case 0: /* 1st CPU port */ +@@ -1242,6 +1220,7 @@ qca8k_phylink_mac_config(struct dsa_swit + return; + + reg = QCA8K_REG_PORT0_PAD_CTRL; ++ cpu_port_index = QCA8K_CPU_PORT0; + break; + case 1: + case 2: +@@ -1260,6 +1239,7 @@ qca8k_phylink_mac_config(struct dsa_swit + return; + + reg = QCA8K_REG_PORT6_PAD_CTRL; ++ cpu_port_index = QCA8K_CPU_PORT6; + break; + default: + dev_err(ds->dev, "%s: unsupported port: %i\n", __func__, port); +@@ -1274,23 +1254,40 @@ qca8k_phylink_mac_config(struct dsa_swit + + switch (state->interface) { + case PHY_INTERFACE_MODE_RGMII: +- /* RGMII mode means no delay so don't enable the delay */ +- qca8k_write(priv, reg, QCA8K_PORT_PAD_RGMII_EN); +- break; + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_TXID: + case PHY_INTERFACE_MODE_RGMII_RXID: +- /* RGMII_ID needs internal delay. This is enabled through +- * PORT5_PAD_CTRL for all ports, rather than individual port +- * registers ++ val = QCA8K_PORT_PAD_RGMII_EN; ++ ++ /* Delay can be declared in 3 different way. ++ * Mode to rgmii and internal-delay standard binding defined ++ * rgmii-id or rgmii-tx/rx phy mode set. ++ * The parse logic set a delay different than 0 only when one ++ * of the 3 different way is used. In all other case delay is ++ * not enabled. With ID or TX/RXID delay is enabled and set ++ * to the default and recommended value. ++ */ ++ if (priv->rgmii_tx_delay[cpu_port_index]) { ++ delay = priv->rgmii_tx_delay[cpu_port_index]; ++ ++ val |= QCA8K_PORT_PAD_RGMII_TX_DELAY(delay) | ++ QCA8K_PORT_PAD_RGMII_TX_DELAY_EN; ++ } ++ ++ if (priv->rgmii_rx_delay[cpu_port_index]) { ++ delay = priv->rgmii_rx_delay[cpu_port_index]; ++ ++ val |= QCA8K_PORT_PAD_RGMII_RX_DELAY(delay) | ++ QCA8K_PORT_PAD_RGMII_RX_DELAY_EN; ++ } ++ ++ /* Set RGMII delay based on the selected values */ ++ qca8k_write(priv, reg, val); ++ ++ /* QCA8337 requires to set rgmii rx delay for all ports. ++ * This is enabled through PORT5_PAD_CTRL for all ports, ++ * rather than individual port registers. + */ +- qca8k_write(priv, reg, +- QCA8K_PORT_PAD_RGMII_EN | +- QCA8K_PORT_PAD_RGMII_TX_DELAY(priv->rgmii_tx_delay) | +- QCA8K_PORT_PAD_RGMII_RX_DELAY(priv->rgmii_rx_delay) | +- QCA8K_PORT_PAD_RGMII_TX_DELAY_EN | +- QCA8K_PORT_PAD_RGMII_RX_DELAY_EN); +- /* QCA8337 requires to set rgmii rx delay */ + if (priv->switch_id == QCA8K_ID_QCA8337) + qca8k_write(priv, QCA8K_REG_PORT5_PAD_CTRL, + QCA8K_PORT_PAD_RGMII_RX_DELAY_EN); +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -13,6 +13,7 @@ + #include + + #define QCA8K_NUM_PORTS 7 ++#define QCA8K_NUM_CPU_PORTS 2 + #define QCA8K_MAX_MTU 9000 + + #define PHY_ID_QCA8327 0x004dd034 +@@ -255,13 +256,18 @@ struct qca8k_match_data { + u8 id; + }; + ++enum { ++ QCA8K_CPU_PORT0, ++ QCA8K_CPU_PORT6, ++}; ++ + struct qca8k_priv { + u8 switch_id; + u8 switch_revision; +- u8 rgmii_tx_delay; +- u8 rgmii_rx_delay; + bool sgmii_rx_clk_falling_edge; + bool sgmii_tx_clk_falling_edge; ++ u8 rgmii_rx_delay[QCA8K_NUM_CPU_PORTS]; /* 0: CPU port0, 1: CPU port6 */ ++ u8 rgmii_tx_delay[QCA8K_NUM_CPU_PORTS]; /* 0: CPU port0, 1: CPU port6 */ + bool legacy_phy_port_mapping; + struct regmap *regmap; + struct mii_bus *bus; diff --git a/target/linux/generic/backport-5.10/797-v5.16-07-dt-bindings-net-dsa-qca8k-Document-qca-sgmii-enable-.patch b/target/linux/generic/backport-5.10/797-v5.16-07-dt-bindings-net-dsa-qca8k-Document-qca-sgmii-enable-.patch new file mode 100644 index 0000000000..8abd264e79 --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-07-dt-bindings-net-dsa-qca8k-Document-qca-sgmii-enable-.patch @@ -0,0 +1,33 @@ +From 13ad5ccc093ff448b99ac7e138e91e78796adb48 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:12 +0200 +Subject: dt-bindings: net: dsa: qca8k: Document qca,sgmii-enable-pll + +Document qca,sgmii-enable-pll binding used in the CPU nodes to +enable SGMII PLL on MAC config. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + Documentation/devicetree/bindings/net/dsa/qca8k.txt | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt ++++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt +@@ -45,6 +45,16 @@ A CPU port node has the following option + Mostly used in qca8327 with CPU port 0 set to + sgmii. + - qca,sgmii-txclk-falling-edge: Set the transmit clock phase to falling edge. ++- qca,sgmii-enable-pll : For SGMII CPU port, explicitly enable PLL, TX and RX ++ chain along with Signal Detection. ++ This should NOT be enabled for qca8327. If enabled with ++ qca8327 the sgmii port won't correctly init and an err ++ is printed. ++ This can be required for qca8337 switch with revision 2. ++ A warning is displayed when used with revision greater ++ 2. ++ With CPU port set to sgmii and qca8337 it is advised ++ to set this unless a communication problem is observed. + + For QCA8K the 'fixed-link' sub-node supports only the following properties: + diff --git a/target/linux/generic/backport-5.10/797-v5.16-08-net-dsa-qca8k-add-explicit-SGMII-PLL-enable.patch b/target/linux/generic/backport-5.10/797-v5.16-08-net-dsa-qca8k-add-explicit-SGMII-PLL-enable.patch new file mode 100644 index 0000000000..2b5a84a1b0 --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-08-net-dsa-qca8k-add-explicit-SGMII-PLL-enable.patch @@ -0,0 +1,65 @@ +From bbc4799e8bb6c397e3b3fec13de68e179f5db9ff Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:13 +0200 +Subject: net: dsa: qca8k: add explicit SGMII PLL enable + +Support enabling PLL on the SGMII CPU port. Some device require this +special configuration or no traffic is transmitted and the switch +doesn't work at all. A dedicated binding is added to the CPU node +port to apply the correct reg on mac config. +Fail to correctly configure sgmii with qca8327 switch and warn if pll is +used on qca8337 with a revision greater than 1. + +Signed-off-by: Ansuel Smith +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 19 +++++++++++++++++-- + drivers/net/dsa/qca8k.h | 1 + + 2 files changed, 18 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1002,6 +1002,18 @@ qca8k_parse_port_config(struct qca8k_pri + if (of_property_read_bool(port_dn, "qca,sgmii-rxclk-falling-edge")) + priv->sgmii_rx_clk_falling_edge = true; + ++ if (of_property_read_bool(port_dn, "qca,sgmii-enable-pll")) { ++ priv->sgmii_enable_pll = true; ++ ++ if (priv->switch_id == QCA8K_ID_QCA8327) { ++ dev_err(priv->dev, "SGMII PLL should NOT be enabled for qca8327. Aborting enabling"); ++ priv->sgmii_enable_pll = false; ++ } ++ ++ if (priv->switch_revision < 2) ++ dev_warn(priv->dev, "SGMII PLL should NOT be enabled for qca8337 with revision 2 or more."); ++ } ++ + break; + default: + continue; +@@ -1312,8 +1324,11 @@ qca8k_phylink_mac_config(struct dsa_swit + if (ret) + return; + +- val |= QCA8K_SGMII_EN_PLL | QCA8K_SGMII_EN_RX | +- QCA8K_SGMII_EN_TX | QCA8K_SGMII_EN_SD; ++ val |= QCA8K_SGMII_EN_SD; ++ ++ if (priv->sgmii_enable_pll) ++ val |= QCA8K_SGMII_EN_PLL | QCA8K_SGMII_EN_RX | ++ QCA8K_SGMII_EN_TX; + + if (dsa_is_cpu_port(ds, port)) { + /* CPU port, we're talking to the CPU MAC, be a PHY */ +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -266,6 +266,7 @@ struct qca8k_priv { + u8 switch_revision; + bool sgmii_rx_clk_falling_edge; + bool sgmii_tx_clk_falling_edge; ++ bool sgmii_enable_pll; + u8 rgmii_rx_delay[QCA8K_NUM_CPU_PORTS]; /* 0: CPU port0, 1: CPU port6 */ + u8 rgmii_tx_delay[QCA8K_NUM_CPU_PORTS]; /* 0: CPU port0, 1: CPU port6 */ + bool legacy_phy_port_mapping; diff --git a/target/linux/generic/backport-5.10/797-v5.16-09-dt-bindings-net-dsa-qca8k-Document-qca-led-open-drai.patch b/target/linux/generic/backport-5.10/797-v5.16-09-dt-bindings-net-dsa-qca8k-Document-qca-led-open-drai.patch new file mode 100644 index 0000000000..38dc954e8c --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-09-dt-bindings-net-dsa-qca8k-Document-qca-led-open-drai.patch @@ -0,0 +1,37 @@ +From 924087c5c3d41553700b0eb83ca2a53b91643dca Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:14 +0200 +Subject: dt-bindings: net: dsa: qca8k: Document qca,led-open-drain binding + +Document new binding qca,ignore-power-on-sel used to ignore +power on strapping and use sw regs instead. +Document qca,led-open.drain to set led to open drain mode, the +qca,ignore-power-on-sel is mandatory with this enabled or an error will +be reported. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + Documentation/devicetree/bindings/net/dsa/qca8k.txt | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt ++++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt +@@ -13,6 +13,17 @@ Required properties: + Optional properties: + + - reset-gpios: GPIO to be used to reset the whole device ++- qca,ignore-power-on-sel: Ignore power on pin strapping to configure led open ++ drain or eeprom presence. This is needed for broken ++ devices that have wrong configuration or when the oem ++ decided to not use pin strapping and fallback to sw ++ regs. ++- qca,led-open-drain: Set leds to open-drain mode. This requires the ++ qca,ignore-power-on-sel to be set or the driver will fail ++ to probe. This is needed if the oem doesn't use pin ++ strapping to set this mode and prefers to set it using sw ++ regs. The pin strapping related to led open drain mode is ++ the pin B68 for QCA832x and B49 for QCA833x + + Subnodes: + diff --git a/target/linux/generic/backport-5.10/797-v5.16-10-net-dsa-qca8k-add-support-for-pws-config-reg.patch b/target/linux/generic/backport-5.10/797-v5.16-10-net-dsa-qca8k-add-support-for-pws-config-reg.patch new file mode 100644 index 0000000000..aa5d92a4fd --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-10-net-dsa-qca8k-add-support-for-pws-config-reg.patch @@ -0,0 +1,92 @@ +From 362bb238d8bf1470424214a8a5968d9c6cce68fa Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:15 +0200 +Subject: net: dsa: qca8k: add support for pws config reg + +Some qca8327 switch require to force the ignore of power on sel +strapping. Some switch require to set the led open drain mode in regs +instead of using strapping. While most of the device implements this +using the correct way using pin strapping, there are still some broken +device that require to be set using sw regs. +Introduce a new binding and support these special configuration. +As led open drain require to ignore pin strapping to work, the probe +fails with EINVAL error with incorrect configuration. + +Signed-off-by: Ansuel Smith +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 39 +++++++++++++++++++++++++++++++++++++++ + drivers/net/dsa/qca8k.h | 6 ++++++ + 2 files changed, 45 insertions(+) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -932,6 +932,41 @@ static int qca8k_find_cpu_port(struct ds + } + + static int ++qca8k_setup_of_pws_reg(struct qca8k_priv *priv) ++{ ++ struct device_node *node = priv->dev->of_node; ++ u32 val = 0; ++ int ret; ++ ++ /* QCA8327 require to set to the correct mode. ++ * His bigger brother QCA8328 have the 172 pin layout. ++ * Should be applied by default but we set this just to make sure. ++ */ ++ if (priv->switch_id == QCA8K_ID_QCA8327) { ++ ret = qca8k_rmw(priv, QCA8K_REG_PWS, QCA8327_PWS_PACKAGE148_EN, ++ QCA8327_PWS_PACKAGE148_EN); ++ if (ret) ++ return ret; ++ } ++ ++ if (of_property_read_bool(node, "qca,ignore-power-on-sel")) ++ val |= QCA8K_PWS_POWER_ON_SEL; ++ ++ if (of_property_read_bool(node, "qca,led-open-drain")) { ++ if (!(val & QCA8K_PWS_POWER_ON_SEL)) { ++ dev_err(priv->dev, "qca,led-open-drain require qca,ignore-power-on-sel to be set."); ++ return -EINVAL; ++ } ++ ++ val |= QCA8K_PWS_LED_OPEN_EN_CSR; ++ } ++ ++ return qca8k_rmw(priv, QCA8K_REG_PWS, ++ QCA8K_PWS_LED_OPEN_EN_CSR | QCA8K_PWS_POWER_ON_SEL, ++ val); ++} ++ ++static int + qca8k_parse_port_config(struct qca8k_priv *priv) + { + int port, cpu_port_index = 0, ret; +@@ -1053,6 +1088,10 @@ qca8k_setup(struct dsa_switch *ds) + if (ret) + return ret; + ++ ret = qca8k_setup_of_pws_reg(priv); ++ if (ret) ++ return ret; ++ + ret = qca8k_setup_mac_pwr_sel(priv); + if (ret) + return ret; +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -46,6 +46,12 @@ + #define QCA8K_MAX_DELAY 3 + #define QCA8K_PORT_PAD_SGMII_EN BIT(7) + #define QCA8K_REG_PWS 0x010 ++#define QCA8K_PWS_POWER_ON_SEL BIT(31) ++/* This reg is only valid for QCA832x and toggle the package ++ * type from 176 pin (by default) to 148 pin used on QCA8327 ++ */ ++#define QCA8327_PWS_PACKAGE148_EN BIT(30) ++#define QCA8K_PWS_LED_OPEN_EN_CSR BIT(24) + #define QCA8K_PWS_SERDES_AEN_DIS BIT(7) + #define QCA8K_REG_MODULE_EN 0x030 + #define QCA8K_MODULE_EN_MIB BIT(0) diff --git a/target/linux/generic/backport-5.10/797-v5.16-11-dt-bindings-net-dsa-qca8k-document-support-for-qca83.patch b/target/linux/generic/backport-5.10/797-v5.16-11-dt-bindings-net-dsa-qca8k-document-support-for-qca83.patch new file mode 100644 index 0000000000..1bfb00c5b2 --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-11-dt-bindings-net-dsa-qca8k-document-support-for-qca83.patch @@ -0,0 +1,32 @@ +From ed7988d77fbfb79366b68f9e7fa60a6080da23d4 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:16 +0200 +Subject: dt-bindings: net: dsa: qca8k: document support for qca8328 + +QCA8328 is the bigger brother of qca8327. Document the new compatible +binding and add some information to understand the various switch +compatible. + +Signed-off-by: Ansuel Smith +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + Documentation/devicetree/bindings/net/dsa/qca8k.txt | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt ++++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt +@@ -3,9 +3,10 @@ + Required properties: + + - compatible: should be one of: +- "qca,qca8327" +- "qca,qca8334" +- "qca,qca8337" ++ "qca,qca8328": referenced as AR8328(N)-AK1(A/B) QFN 176 pin package ++ "qca,qca8327": referenced as AR8327(N)-AL1A DR-QFN 148 pin package ++ "qca,qca8334": referenced as QCA8334-AL3C QFN 88 pin package ++ "qca,qca8337": referenced as QCA8337N-AL3(B/C) DR-QFN 148 pin package + + - #size-cells: must be 0 + - #address-cells: must be 1 diff --git a/target/linux/generic/backport-5.10/797-v5.16-12-net-dsa-qca8k-add-support-for-QCA8328.patch b/target/linux/generic/backport-5.10/797-v5.16-12-net-dsa-qca8k-add-support-for-QCA8328.patch new file mode 100644 index 0000000000..6e118f5a14 --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-12-net-dsa-qca8k-add-support-for-QCA8328.patch @@ -0,0 +1,78 @@ +From f477d1c8bdbef4f400718238e350f16f521d2a3e Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:17 +0200 +Subject: net: dsa: qca8k: add support for QCA8328 + +QCA8328 switch is the bigger brother of the qca8327. Same regs different +chip. Change the function to set the correct pin layout and introduce a +new match_data to differentiate the 2 switch as they have the same ID +and their internal PHY have the same ID. + +Signed-off-by: Ansuel Smith +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 19 ++++++++++++++++--- + drivers/net/dsa/qca8k.h | 1 + + 2 files changed, 17 insertions(+), 3 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -935,6 +935,7 @@ static int + qca8k_setup_of_pws_reg(struct qca8k_priv *priv) + { + struct device_node *node = priv->dev->of_node; ++ const struct qca8k_match_data *data; + u32 val = 0; + int ret; + +@@ -943,8 +944,14 @@ qca8k_setup_of_pws_reg(struct qca8k_priv + * Should be applied by default but we set this just to make sure. + */ + if (priv->switch_id == QCA8K_ID_QCA8327) { ++ data = of_device_get_match_data(priv->dev); ++ ++ /* Set the correct package of 148 pin for QCA8327 */ ++ if (data->reduced_package) ++ val |= QCA8327_PWS_PACKAGE148_EN; ++ + ret = qca8k_rmw(priv, QCA8K_REG_PWS, QCA8327_PWS_PACKAGE148_EN, +- QCA8327_PWS_PACKAGE148_EN); ++ val); + if (ret) + return ret; + } +@@ -2098,7 +2105,12 @@ static int qca8k_resume(struct device *d + static SIMPLE_DEV_PM_OPS(qca8k_pm_ops, + qca8k_suspend, qca8k_resume); + +-static const struct qca8k_match_data qca832x = { ++static const struct qca8k_match_data qca8327 = { ++ .id = QCA8K_ID_QCA8327, ++ .reduced_package = true, ++}; ++ ++static const struct qca8k_match_data qca8328 = { + .id = QCA8K_ID_QCA8327, + }; + +@@ -2107,7 +2119,8 @@ static const struct qca8k_match_data qca + }; + + static const struct of_device_id qca8k_of_match[] = { +- { .compatible = "qca,qca8327", .data = &qca832x }, ++ { .compatible = "qca,qca8327", .data = &qca8327 }, ++ { .compatible = "qca,qca8328", .data = &qca8328 }, + { .compatible = "qca,qca8334", .data = &qca833x }, + { .compatible = "qca,qca8337", .data = &qca833x }, + { /* sentinel */ }, +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -260,6 +260,7 @@ struct ar8xxx_port_status { + + struct qca8k_match_data { + u8 id; ++ bool reduced_package; + }; + + enum { diff --git a/target/linux/generic/backport-5.10/797-v5.16-13-net-dsa-qca8k-set-internal-delay-also-for-sgmii.patch b/target/linux/generic/backport-5.10/797-v5.16-13-net-dsa-qca8k-set-internal-delay-also-for-sgmii.patch new file mode 100644 index 0000000000..27f94dca02 --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-13-net-dsa-qca8k-set-internal-delay-also-for-sgmii.patch @@ -0,0 +1,159 @@ +From cef08115846e581f80ff99abf7bf218da1840616 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:18 +0200 +Subject: net: dsa: qca8k: set internal delay also for sgmii + +QCA original code report port instability and sa that SGMII also require +to set internal delay. Generalize the rgmii delay function and apply the +advised value if they are not defined in DT. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 88 +++++++++++++++++++++++++++++++++---------------- + drivers/net/dsa/qca8k.h | 2 ++ + 2 files changed, 62 insertions(+), 28 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1004,6 +1004,7 @@ qca8k_parse_port_config(struct qca8k_pri + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_TXID: + case PHY_INTERFACE_MODE_RGMII_RXID: ++ case PHY_INTERFACE_MODE_SGMII: + delay = 0; + + if (!of_property_read_u32(port_dn, "tx-internal-delay-ps", &delay)) +@@ -1036,8 +1037,13 @@ qca8k_parse_port_config(struct qca8k_pri + + priv->rgmii_rx_delay[cpu_port_index] = delay; + +- break; +- case PHY_INTERFACE_MODE_SGMII: ++ /* Skip sgmii parsing for rgmii* mode */ ++ if (mode == PHY_INTERFACE_MODE_RGMII || ++ mode == PHY_INTERFACE_MODE_RGMII_ID || ++ mode == PHY_INTERFACE_MODE_RGMII_TXID || ++ mode == PHY_INTERFACE_MODE_RGMII_RXID) ++ break; ++ + if (of_property_read_bool(port_dn, "qca,sgmii-txclk-falling-edge")) + priv->sgmii_tx_clk_falling_edge = true; + +@@ -1261,12 +1267,53 @@ qca8k_setup(struct dsa_switch *ds) + } + + static void ++qca8k_mac_config_setup_internal_delay(struct qca8k_priv *priv, int cpu_port_index, ++ u32 reg) ++{ ++ u32 delay, val = 0; ++ int ret; ++ ++ /* Delay can be declared in 3 different way. ++ * Mode to rgmii and internal-delay standard binding defined ++ * rgmii-id or rgmii-tx/rx phy mode set. ++ * The parse logic set a delay different than 0 only when one ++ * of the 3 different way is used. In all other case delay is ++ * not enabled. With ID or TX/RXID delay is enabled and set ++ * to the default and recommended value. ++ */ ++ if (priv->rgmii_tx_delay[cpu_port_index]) { ++ delay = priv->rgmii_tx_delay[cpu_port_index]; ++ ++ val |= QCA8K_PORT_PAD_RGMII_TX_DELAY(delay) | ++ QCA8K_PORT_PAD_RGMII_TX_DELAY_EN; ++ } ++ ++ if (priv->rgmii_rx_delay[cpu_port_index]) { ++ delay = priv->rgmii_rx_delay[cpu_port_index]; ++ ++ val |= QCA8K_PORT_PAD_RGMII_RX_DELAY(delay) | ++ QCA8K_PORT_PAD_RGMII_RX_DELAY_EN; ++ } ++ ++ /* Set RGMII delay based on the selected values */ ++ ret = qca8k_rmw(priv, reg, ++ QCA8K_PORT_PAD_RGMII_TX_DELAY_MASK | ++ QCA8K_PORT_PAD_RGMII_RX_DELAY_MASK | ++ QCA8K_PORT_PAD_RGMII_TX_DELAY_EN | ++ QCA8K_PORT_PAD_RGMII_RX_DELAY_EN, ++ val); ++ if (ret) ++ dev_err(priv->dev, "Failed to set internal delay for CPU port%d", ++ cpu_port_index == QCA8K_CPU_PORT0 ? 0 : 6); ++} ++ ++static void + qca8k_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, + const struct phylink_link_state *state) + { + struct qca8k_priv *priv = ds->priv; + int cpu_port_index, ret; +- u32 reg, val, delay; ++ u32 reg, val; + + switch (port) { + case 0: /* 1st CPU port */ +@@ -1315,32 +1362,10 @@ qca8k_phylink_mac_config(struct dsa_swit + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_TXID: + case PHY_INTERFACE_MODE_RGMII_RXID: +- val = QCA8K_PORT_PAD_RGMII_EN; +- +- /* Delay can be declared in 3 different way. +- * Mode to rgmii and internal-delay standard binding defined +- * rgmii-id or rgmii-tx/rx phy mode set. +- * The parse logic set a delay different than 0 only when one +- * of the 3 different way is used. In all other case delay is +- * not enabled. With ID or TX/RXID delay is enabled and set +- * to the default and recommended value. +- */ +- if (priv->rgmii_tx_delay[cpu_port_index]) { +- delay = priv->rgmii_tx_delay[cpu_port_index]; +- +- val |= QCA8K_PORT_PAD_RGMII_TX_DELAY(delay) | +- QCA8K_PORT_PAD_RGMII_TX_DELAY_EN; +- } +- +- if (priv->rgmii_rx_delay[cpu_port_index]) { +- delay = priv->rgmii_rx_delay[cpu_port_index]; +- +- val |= QCA8K_PORT_PAD_RGMII_RX_DELAY(delay) | +- QCA8K_PORT_PAD_RGMII_RX_DELAY_EN; +- } ++ qca8k_write(priv, reg, QCA8K_PORT_PAD_RGMII_EN); + +- /* Set RGMII delay based on the selected values */ +- qca8k_write(priv, reg, val); ++ /* Configure rgmii delay */ ++ qca8k_mac_config_setup_internal_delay(priv, cpu_port_index, reg); + + /* QCA8337 requires to set rgmii rx delay for all ports. + * This is enabled through PORT5_PAD_CTRL for all ports, +@@ -1411,6 +1436,13 @@ qca8k_phylink_mac_config(struct dsa_swit + QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE | + QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE, + val); ++ ++ /* From original code is reported port instability as SGMII also ++ * require delay set. Apply advised values here or take them from DT. ++ */ ++ if (state->interface == PHY_INTERFACE_MODE_SGMII) ++ qca8k_mac_config_setup_internal_delay(priv, cpu_port_index, reg); ++ + break; + default: + dev_err(ds->dev, "xMII mode %s not supported for port %d\n", +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -39,7 +39,9 @@ + #define QCA8K_REG_PORT5_PAD_CTRL 0x008 + #define QCA8K_REG_PORT6_PAD_CTRL 0x00c + #define QCA8K_PORT_PAD_RGMII_EN BIT(26) ++#define QCA8K_PORT_PAD_RGMII_TX_DELAY_MASK GENMASK(23, 22) + #define QCA8K_PORT_PAD_RGMII_TX_DELAY(x) ((x) << 22) ++#define QCA8K_PORT_PAD_RGMII_RX_DELAY_MASK GENMASK(21, 20) + #define QCA8K_PORT_PAD_RGMII_RX_DELAY(x) ((x) << 20) + #define QCA8K_PORT_PAD_RGMII_TX_DELAY_EN BIT(25) + #define QCA8K_PORT_PAD_RGMII_RX_DELAY_EN BIT(24) diff --git a/target/linux/generic/backport-5.10/797-v5.16-14-net-dsa-qca8k-move-port-config-to-dedicated-struct.patch b/target/linux/generic/backport-5.10/797-v5.16-14-net-dsa-qca8k-move-port-config-to-dedicated-struct.patch new file mode 100644 index 0000000000..b991798c87 --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-14-net-dsa-qca8k-move-port-config-to-dedicated-struct.patch @@ -0,0 +1,124 @@ +From fd0bb28c547f7c8affb1691128cece38f5b626a1 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:19 +0200 +Subject: net: dsa: qca8k: move port config to dedicated struct + +Move ports related config to dedicated struct to keep things organized. + +Signed-off-by: Ansuel Smith +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 26 +++++++++++++------------- + drivers/net/dsa/qca8k.h | 10 +++++++--- + 2 files changed, 20 insertions(+), 16 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1019,7 +1019,7 @@ qca8k_parse_port_config(struct qca8k_pri + delay = 3; + } + +- priv->rgmii_tx_delay[cpu_port_index] = delay; ++ priv->ports_config.rgmii_tx_delay[cpu_port_index] = delay; + + delay = 0; + +@@ -1035,7 +1035,7 @@ qca8k_parse_port_config(struct qca8k_pri + delay = 3; + } + +- priv->rgmii_rx_delay[cpu_port_index] = delay; ++ priv->ports_config.rgmii_rx_delay[cpu_port_index] = delay; + + /* Skip sgmii parsing for rgmii* mode */ + if (mode == PHY_INTERFACE_MODE_RGMII || +@@ -1045,17 +1045,17 @@ qca8k_parse_port_config(struct qca8k_pri + break; + + if (of_property_read_bool(port_dn, "qca,sgmii-txclk-falling-edge")) +- priv->sgmii_tx_clk_falling_edge = true; ++ priv->ports_config.sgmii_tx_clk_falling_edge = true; + + if (of_property_read_bool(port_dn, "qca,sgmii-rxclk-falling-edge")) +- priv->sgmii_rx_clk_falling_edge = true; ++ priv->ports_config.sgmii_rx_clk_falling_edge = true; + + if (of_property_read_bool(port_dn, "qca,sgmii-enable-pll")) { +- priv->sgmii_enable_pll = true; ++ priv->ports_config.sgmii_enable_pll = true; + + if (priv->switch_id == QCA8K_ID_QCA8327) { + dev_err(priv->dev, "SGMII PLL should NOT be enabled for qca8327. Aborting enabling"); +- priv->sgmii_enable_pll = false; ++ priv->ports_config.sgmii_enable_pll = false; + } + + if (priv->switch_revision < 2) +@@ -1281,15 +1281,15 @@ qca8k_mac_config_setup_internal_delay(st + * not enabled. With ID or TX/RXID delay is enabled and set + * to the default and recommended value. + */ +- if (priv->rgmii_tx_delay[cpu_port_index]) { +- delay = priv->rgmii_tx_delay[cpu_port_index]; ++ if (priv->ports_config.rgmii_tx_delay[cpu_port_index]) { ++ delay = priv->ports_config.rgmii_tx_delay[cpu_port_index]; + + val |= QCA8K_PORT_PAD_RGMII_TX_DELAY(delay) | + QCA8K_PORT_PAD_RGMII_TX_DELAY_EN; + } + +- if (priv->rgmii_rx_delay[cpu_port_index]) { +- delay = priv->rgmii_rx_delay[cpu_port_index]; ++ if (priv->ports_config.rgmii_rx_delay[cpu_port_index]) { ++ delay = priv->ports_config.rgmii_rx_delay[cpu_port_index]; + + val |= QCA8K_PORT_PAD_RGMII_RX_DELAY(delay) | + QCA8K_PORT_PAD_RGMII_RX_DELAY_EN; +@@ -1397,7 +1397,7 @@ qca8k_phylink_mac_config(struct dsa_swit + + val |= QCA8K_SGMII_EN_SD; + +- if (priv->sgmii_enable_pll) ++ if (priv->ports_config.sgmii_enable_pll) + val |= QCA8K_SGMII_EN_PLL | QCA8K_SGMII_EN_RX | + QCA8K_SGMII_EN_TX; + +@@ -1425,10 +1425,10 @@ qca8k_phylink_mac_config(struct dsa_swit + val = 0; + + /* SGMII Clock phase configuration */ +- if (priv->sgmii_rx_clk_falling_edge) ++ if (priv->ports_config.sgmii_rx_clk_falling_edge) + val |= QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE; + +- if (priv->sgmii_tx_clk_falling_edge) ++ if (priv->ports_config.sgmii_tx_clk_falling_edge) + val |= QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE; + + if (val) +--- a/drivers/net/dsa/qca8k.h ++++ b/drivers/net/dsa/qca8k.h +@@ -270,15 +270,19 @@ enum { + QCA8K_CPU_PORT6, + }; + +-struct qca8k_priv { +- u8 switch_id; +- u8 switch_revision; ++struct qca8k_ports_config { + bool sgmii_rx_clk_falling_edge; + bool sgmii_tx_clk_falling_edge; + bool sgmii_enable_pll; + u8 rgmii_rx_delay[QCA8K_NUM_CPU_PORTS]; /* 0: CPU port0, 1: CPU port6 */ + u8 rgmii_tx_delay[QCA8K_NUM_CPU_PORTS]; /* 0: CPU port0, 1: CPU port6 */ ++}; ++ ++struct qca8k_priv { ++ u8 switch_id; ++ u8 switch_revision; + bool legacy_phy_port_mapping; ++ struct qca8k_ports_config ports_config; + struct regmap *regmap; + struct mii_bus *bus; + struct ar8xxx_port_status port_sts[QCA8K_NUM_PORTS]; diff --git a/target/linux/generic/backport-5.10/797-v5.16-15-dt-bindings-net-ipq8064-mdio-fix-warning-with-new-qc.patch b/target/linux/generic/backport-5.10/797-v5.16-15-dt-bindings-net-ipq8064-mdio-fix-warning-with-new-qc.patch new file mode 100644 index 0000000000..f7cb514176 --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-15-dt-bindings-net-ipq8064-mdio-fix-warning-with-new-qc.patch @@ -0,0 +1,26 @@ +From e52073a8e3086046a098b8a7cbeb282ff0cdb424 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Thu, 14 Oct 2021 00:39:20 +0200 +Subject: dt-bindings: net: ipq8064-mdio: fix warning with new qca8k switch + +Fix warning now that we have qca8k switch Documentation using yaml. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml ++++ b/Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml +@@ -51,6 +51,9 @@ examples: + switch@10 { + compatible = "qca,qca8337"; + reg = <0x10>; +- /* ... */ ++ ++ ports { ++ /* ... */ ++ }; + }; + }; diff --git a/target/linux/generic/backport-5.10/797-v5.16-16-dt-bindings-net-dsa-qca8k-convert-to-YAML-schema.patch b/target/linux/generic/backport-5.10/797-v5.16-16-dt-bindings-net-dsa-qca8k-convert-to-YAML-schema.patch new file mode 100644 index 0000000000..b9bce97dd3 --- /dev/null +++ b/target/linux/generic/backport-5.10/797-v5.16-16-dt-bindings-net-dsa-qca8k-convert-to-YAML-schema.patch @@ -0,0 +1,631 @@ +From d291fbb8245d5ba04979fed85575860a5cea7196 Mon Sep 17 00:00:00 2001 +From: Matthew Hagan +Date: Thu, 14 Oct 2021 00:39:21 +0200 +Subject: dt-bindings: net: dsa: qca8k: convert to YAML schema + +Convert the qca8k bindings to YAML format. + +Signed-off-by: Matthew Hagan +Co-developed-by: Ansuel Smith +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + .../devicetree/bindings/net/dsa/qca8k.txt | 245 -------------- + .../devicetree/bindings/net/dsa/qca8k.yaml | 362 +++++++++++++++++++++ + 2 files changed, 362 insertions(+), 245 deletions(-) + delete mode 100644 Documentation/devicetree/bindings/net/dsa/qca8k.txt + create mode 100644 Documentation/devicetree/bindings/net/dsa/qca8k.yaml + +--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt ++++ /dev/null +@@ -1,245 +0,0 @@ +-* Qualcomm Atheros QCA8xxx switch family +- +-Required properties: +- +-- compatible: should be one of: +- "qca,qca8328": referenced as AR8328(N)-AK1(A/B) QFN 176 pin package +- "qca,qca8327": referenced as AR8327(N)-AL1A DR-QFN 148 pin package +- "qca,qca8334": referenced as QCA8334-AL3C QFN 88 pin package +- "qca,qca8337": referenced as QCA8337N-AL3(B/C) DR-QFN 148 pin package +- +-- #size-cells: must be 0 +-- #address-cells: must be 1 +- +-Optional properties: +- +-- reset-gpios: GPIO to be used to reset the whole device +-- qca,ignore-power-on-sel: Ignore power on pin strapping to configure led open +- drain or eeprom presence. This is needed for broken +- devices that have wrong configuration or when the oem +- decided to not use pin strapping and fallback to sw +- regs. +-- qca,led-open-drain: Set leds to open-drain mode. This requires the +- qca,ignore-power-on-sel to be set or the driver will fail +- to probe. This is needed if the oem doesn't use pin +- strapping to set this mode and prefers to set it using sw +- regs. The pin strapping related to led open drain mode is +- the pin B68 for QCA832x and B49 for QCA833x +- +-Subnodes: +- +-The integrated switch subnode should be specified according to the binding +-described in dsa/dsa.txt. If the QCA8K switch is connect to a SoC's external +-mdio-bus each subnode describing a port needs to have a valid phandle +-referencing the internal PHY it is connected to. This is because there's no +-N:N mapping of port and PHY id. +-To declare the internal mdio-bus configuration, declare a mdio node in the +-switch node and declare the phandle for the port referencing the internal +-PHY is connected to. In this config a internal mdio-bus is registered and +-the mdio MASTER is used as communication. +- +-Don't use mixed external and internal mdio-bus configurations, as this is +-not supported by the hardware. +- +-This switch support 2 CPU port. Normally and advised configuration is with +-CPU port set to port 0. It is also possible to set the CPU port to port 6 +-if the device requires it. The driver will configure the switch to the defined +-port. With both CPU port declared the first CPU port is selected as primary +-and the secondary CPU ignored. +- +-A CPU port node has the following optional node: +- +-- fixed-link : Fixed-link subnode describing a link to a non-MDIO +- managed entity. See +- Documentation/devicetree/bindings/net/fixed-link.txt +- for details. +-- qca,sgmii-rxclk-falling-edge: Set the receive clock phase to falling edge. +- Mostly used in qca8327 with CPU port 0 set to +- sgmii. +-- qca,sgmii-txclk-falling-edge: Set the transmit clock phase to falling edge. +-- qca,sgmii-enable-pll : For SGMII CPU port, explicitly enable PLL, TX and RX +- chain along with Signal Detection. +- This should NOT be enabled for qca8327. If enabled with +- qca8327 the sgmii port won't correctly init and an err +- is printed. +- This can be required for qca8337 switch with revision 2. +- A warning is displayed when used with revision greater +- 2. +- With CPU port set to sgmii and qca8337 it is advised +- to set this unless a communication problem is observed. +- +-For QCA8K the 'fixed-link' sub-node supports only the following properties: +- +-- 'speed' (integer, mandatory), to indicate the link speed. Accepted +- values are 10, 100 and 1000 +-- 'full-duplex' (boolean, optional), to indicate that full duplex is +- used. When absent, half duplex is assumed. +- +-Examples: +- +-for the external mdio-bus configuration: +- +- &mdio0 { +- phy_port1: phy@0 { +- reg = <0>; +- }; +- +- phy_port2: phy@1 { +- reg = <1>; +- }; +- +- phy_port3: phy@2 { +- reg = <2>; +- }; +- +- phy_port4: phy@3 { +- reg = <3>; +- }; +- +- phy_port5: phy@4 { +- reg = <4>; +- }; +- +- switch@10 { +- compatible = "qca,qca8337"; +- #address-cells = <1>; +- #size-cells = <0>; +- +- reset-gpios = <&gpio 42 GPIO_ACTIVE_LOW>; +- reg = <0x10>; +- +- ports { +- #address-cells = <1>; +- #size-cells = <0>; +- port@0 { +- reg = <0>; +- label = "cpu"; +- ethernet = <&gmac1>; +- phy-mode = "rgmii"; +- fixed-link { +- speed = 1000; +- full-duplex; +- }; +- }; +- +- port@1 { +- reg = <1>; +- label = "lan1"; +- phy-handle = <&phy_port1>; +- }; +- +- port@2 { +- reg = <2>; +- label = "lan2"; +- phy-handle = <&phy_port2>; +- }; +- +- port@3 { +- reg = <3>; +- label = "lan3"; +- phy-handle = <&phy_port3>; +- }; +- +- port@4 { +- reg = <4>; +- label = "lan4"; +- phy-handle = <&phy_port4>; +- }; +- +- port@5 { +- reg = <5>; +- label = "wan"; +- phy-handle = <&phy_port5>; +- }; +- }; +- }; +- }; +- +-for the internal master mdio-bus configuration: +- +- &mdio0 { +- switch@10 { +- compatible = "qca,qca8337"; +- #address-cells = <1>; +- #size-cells = <0>; +- +- reset-gpios = <&gpio 42 GPIO_ACTIVE_LOW>; +- reg = <0x10>; +- +- ports { +- #address-cells = <1>; +- #size-cells = <0>; +- +- port@0 { +- reg = <0>; +- label = "cpu"; +- ethernet = <&gmac1>; +- phy-mode = "rgmii"; +- fixed-link { +- speed = 1000; +- full-duplex; +- }; +- }; +- +- port@1 { +- reg = <1>; +- label = "lan1"; +- phy-mode = "internal"; +- phy-handle = <&phy_port1>; +- }; +- +- port@2 { +- reg = <2>; +- label = "lan2"; +- phy-mode = "internal"; +- phy-handle = <&phy_port2>; +- }; +- +- port@3 { +- reg = <3>; +- label = "lan3"; +- phy-mode = "internal"; +- phy-handle = <&phy_port3>; +- }; +- +- port@4 { +- reg = <4>; +- label = "lan4"; +- phy-mode = "internal"; +- phy-handle = <&phy_port4>; +- }; +- +- port@5 { +- reg = <5>; +- label = "wan"; +- phy-mode = "internal"; +- phy-handle = <&phy_port5>; +- }; +- }; +- +- mdio { +- #address-cells = <1>; +- #size-cells = <0>; +- +- phy_port1: phy@0 { +- reg = <0>; +- }; +- +- phy_port2: phy@1 { +- reg = <1>; +- }; +- +- phy_port3: phy@2 { +- reg = <2>; +- }; +- +- phy_port4: phy@3 { +- reg = <3>; +- }; +- +- phy_port5: phy@4 { +- reg = <4>; +- }; +- }; +- }; +- }; +--- /dev/null ++++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml +@@ -0,0 +1,362 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/net/dsa/qca8k.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Qualcomm Atheros QCA83xx switch family ++ ++maintainers: ++ - John Crispin ++ ++description: ++ If the QCA8K switch is connect to an SoC's external mdio-bus, each subnode ++ describing a port needs to have a valid phandle referencing the internal PHY ++ it is connected to. This is because there is no N:N mapping of port and PHY ++ ID. To declare the internal mdio-bus configuration, declare an MDIO node in ++ the switch node and declare the phandle for the port, referencing the internal ++ PHY it is connected to. In this config, an internal mdio-bus is registered and ++ the MDIO master is used for communication. Mixed external and internal ++ mdio-bus configurations are not supported by the hardware. ++ ++properties: ++ compatible: ++ oneOf: ++ - enum: ++ - qca,qca8327 ++ - qca,qca8328 ++ - qca,qca8334 ++ - qca,qca8337 ++ description: | ++ qca,qca8328: referenced as AR8328(N)-AK1(A/B) QFN 176 pin package ++ qca,qca8327: referenced as AR8327(N)-AL1A DR-QFN 148 pin package ++ qca,qca8334: referenced as QCA8334-AL3C QFN 88 pin package ++ qca,qca8337: referenced as QCA8337N-AL3(B/C) DR-QFN 148 pin package ++ ++ reg: ++ maxItems: 1 ++ ++ reset-gpios: ++ description: ++ GPIO to be used to reset the whole device ++ maxItems: 1 ++ ++ qca,ignore-power-on-sel: ++ $ref: /schemas/types.yaml#/definitions/flag ++ description: ++ Ignore power-on pin strapping to configure LED open-drain or EEPROM ++ presence. This is needed for devices with incorrect configuration or when ++ the OEM has decided not to use pin strapping and falls back to SW regs. ++ ++ qca,led-open-drain: ++ $ref: /schemas/types.yaml#/definitions/flag ++ description: ++ Set LEDs to open-drain mode. This requires the qca,ignore-power-on-sel to ++ be set, otherwise the driver will fail at probe. This is required if the ++ OEM does not use pin strapping to set this mode and prefers to set it ++ using SW regs. The pin strappings related to LED open-drain mode are ++ B68 on the QCA832x and B49 on the QCA833x. ++ ++ mdio: ++ type: object ++ description: Qca8k switch have an internal mdio to access switch port. ++ If this is not present, the legacy mapping is used and the ++ internal mdio access is used. ++ With the legacy mapping the reg corresponding to the internal ++ mdio is the switch reg with an offset of -1. ++ ++ properties: ++ '#address-cells': ++ const: 1 ++ '#size-cells': ++ const: 0 ++ ++ patternProperties: ++ "^(ethernet-)?phy@[0-4]$": ++ type: object ++ ++ allOf: ++ - $ref: "http://devicetree.org/schemas/net/mdio.yaml#" ++ ++ properties: ++ reg: ++ maxItems: 1 ++ ++ required: ++ - reg ++ ++patternProperties: ++ "^(ethernet-)?ports$": ++ type: object ++ properties: ++ '#address-cells': ++ const: 1 ++ '#size-cells': ++ const: 0 ++ ++ patternProperties: ++ "^(ethernet-)?port@[0-6]$": ++ type: object ++ description: Ethernet switch ports ++ ++ properties: ++ reg: ++ description: Port number ++ ++ label: ++ description: ++ Describes the label associated with this port, which will become ++ the netdev name ++ $ref: /schemas/types.yaml#/definitions/string ++ ++ link: ++ description: ++ Should be a list of phandles to other switch's DSA port. This ++ port is used as the outgoing port towards the phandle ports. The ++ full routing information must be given, not just the one hop ++ routes to neighbouring switches ++ $ref: /schemas/types.yaml#/definitions/phandle-array ++ ++ ethernet: ++ description: ++ Should be a phandle to a valid Ethernet device node. This host ++ device is what the switch port is connected to ++ $ref: /schemas/types.yaml#/definitions/phandle ++ ++ phy-handle: true ++ ++ phy-mode: true ++ ++ fixed-link: true ++ ++ mac-address: true ++ ++ sfp: true ++ ++ qca,sgmii-rxclk-falling-edge: ++ $ref: /schemas/types.yaml#/definitions/flag ++ description: ++ Set the receive clock phase to falling edge. Mostly commonly used on ++ the QCA8327 with CPU port 0 set to SGMII. ++ ++ qca,sgmii-txclk-falling-edge: ++ $ref: /schemas/types.yaml#/definitions/flag ++ description: ++ Set the transmit clock phase to falling edge. ++ ++ qca,sgmii-enable-pll: ++ $ref: /schemas/types.yaml#/definitions/flag ++ description: ++ For SGMII CPU port, explicitly enable PLL, TX and RX chain along with ++ Signal Detection. On the QCA8327 this should not be enabled, otherwise ++ the SGMII port will not initialize. When used on the QCA8337, revision 3 ++ or greater, a warning will be displayed. When the CPU port is set to ++ SGMII on the QCA8337, it is advised to set this unless a communication ++ issue is observed. ++ ++ required: ++ - reg ++ ++ additionalProperties: false ++ ++oneOf: ++ - required: ++ - ports ++ - required: ++ - ethernet-ports ++ ++required: ++ - compatible ++ - reg ++ ++additionalProperties: true ++ ++examples: ++ - | ++ #include ++ ++ mdio { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ external_phy_port1: ethernet-phy@0 { ++ reg = <0>; ++ }; ++ ++ external_phy_port2: ethernet-phy@1 { ++ reg = <1>; ++ }; ++ ++ external_phy_port3: ethernet-phy@2 { ++ reg = <2>; ++ }; ++ ++ external_phy_port4: ethernet-phy@3 { ++ reg = <3>; ++ }; ++ ++ external_phy_port5: ethernet-phy@4 { ++ reg = <4>; ++ }; ++ ++ switch@10 { ++ compatible = "qca,qca8337"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reset-gpios = <&gpio 42 GPIO_ACTIVE_LOW>; ++ reg = <0x10>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ label = "cpu"; ++ ethernet = <&gmac1>; ++ phy-mode = "rgmii"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan1"; ++ phy-handle = <&external_phy_port1>; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ phy-handle = <&external_phy_port2>; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan3"; ++ phy-handle = <&external_phy_port3>; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan4"; ++ phy-handle = <&external_phy_port4>; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "wan"; ++ phy-handle = <&external_phy_port5>; ++ }; ++ }; ++ }; ++ }; ++ - | ++ #include ++ ++ mdio { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ switch@10 { ++ compatible = "qca,qca8337"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reset-gpios = <&gpio 42 GPIO_ACTIVE_LOW>; ++ reg = <0x10>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ label = "cpu"; ++ ethernet = <&gmac1>; ++ phy-mode = "rgmii"; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ label = "lan1"; ++ phy-mode = "internal"; ++ phy-handle = <&internal_phy_port1>; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ label = "lan2"; ++ phy-mode = "internal"; ++ phy-handle = <&internal_phy_port2>; ++ }; ++ ++ port@3 { ++ reg = <3>; ++ label = "lan3"; ++ phy-mode = "internal"; ++ phy-handle = <&internal_phy_port3>; ++ }; ++ ++ port@4 { ++ reg = <4>; ++ label = "lan4"; ++ phy-mode = "internal"; ++ phy-handle = <&internal_phy_port4>; ++ }; ++ ++ port@5 { ++ reg = <5>; ++ label = "wan"; ++ phy-mode = "internal"; ++ phy-handle = <&internal_phy_port5>; ++ }; ++ ++ port@6 { ++ reg = <0>; ++ label = "cpu"; ++ ethernet = <&gmac1>; ++ phy-mode = "sgmii"; ++ ++ qca,sgmii-rxclk-falling-edge; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++ }; ++ }; ++ ++ mdio { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ internal_phy_port1: ethernet-phy@0 { ++ reg = <0>; ++ }; ++ ++ internal_phy_port2: ethernet-phy@1 { ++ reg = <1>; ++ }; ++ ++ internal_phy_port3: ethernet-phy@2 { ++ reg = <2>; ++ }; ++ ++ internal_phy_port4: ethernet-phy@3 { ++ reg = <3>; ++ }; ++ ++ internal_phy_port5: ethernet-phy@4 { ++ reg = <4>; ++ }; ++ }; ++ }; ++ }; From ae77a466e43ee95cbb0477348895ceed0ff365a8 Mon Sep 17 00:00:00 2001 From: Matthew Hagan Date: Sat, 16 Oct 2021 20:22:45 +0100 Subject: [PATCH 36/54] kernel: 5.10: backport qca8k cpu_port_index fix in parse_port_config Add cpu_port_index fix to apply settings to correct CPU port. Signed-off-by: Ansuel Smith Signed-off-by: Matthew Hagan --- ...elay-applied-to-wrong-cpu-in-parse-p.patch | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 target/linux/generic/backport-5.10/798-v5.16-net-dsa-qca8k-fix-delay-applied-to-wrong-cpu-in-parse-p.patch diff --git a/target/linux/generic/backport-5.10/798-v5.16-net-dsa-qca8k-fix-delay-applied-to-wrong-cpu-in-parse-p.patch b/target/linux/generic/backport-5.10/798-v5.16-net-dsa-qca8k-fix-delay-applied-to-wrong-cpu-in-parse-p.patch new file mode 100644 index 0000000000..a510cfdc18 --- /dev/null +++ b/target/linux/generic/backport-5.10/798-v5.16-net-dsa-qca8k-fix-delay-applied-to-wrong-cpu-in-parse-p.patch @@ -0,0 +1,28 @@ +From 06dd34a628ae5b6a839b757e746de165d6789ca8 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Sun, 17 Oct 2021 16:56:46 +0200 +Subject: net: dsa: qca8k: fix delay applied to wrong cpu in parse_port_config + +Fix delay settings applied to wrong cpu in parse_port_config. The delay +values is set to the wrong index as the cpu_port_index is incremented +too early. Start the cpu_port_index to -1 so the correct value is +applied to address also the case with invalid phy mode and not available +port. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -976,7 +976,7 @@ qca8k_setup_of_pws_reg(struct qca8k_priv + static int + qca8k_parse_port_config(struct qca8k_priv *priv) + { +- int port, cpu_port_index = 0, ret; ++ int port, cpu_port_index = -1, ret; + struct device_node *port_dn; + phy_interface_t mode; + struct dsa_port *dp; From b428f187f0db70a0a7166895ac9d159104ae5708 Mon Sep 17 00:00:00 2001 From: Matthew Hagan Date: Sat, 16 Oct 2021 20:54:25 +0100 Subject: [PATCH 37/54] kernel: 5.10: qca8k: backport qca8k_setup tidy-up Tidy qca8k_setup for loops relating to port handling. No functional changes. Signed-off-by: Ansuel Smith Signed-off-by: Matthew Hagan --- ...for-loop-in-setup-and-add-cpu-port-c.patch | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 target/linux/generic/backport-5.10/799-v5.16-net-dsa-qca8k-tidy-for-loop-in-setup-and-add-cpu-port-c.patch diff --git a/target/linux/generic/backport-5.10/799-v5.16-net-dsa-qca8k-tidy-for-loop-in-setup-and-add-cpu-port-c.patch b/target/linux/generic/backport-5.10/799-v5.16-net-dsa-qca8k-tidy-for-loop-in-setup-and-add-cpu-port-c.patch new file mode 100644 index 0000000000..71fa3022d5 --- /dev/null +++ b/target/linux/generic/backport-5.10/799-v5.16-net-dsa-qca8k-tidy-for-loop-in-setup-and-add-cpu-port-c.patch @@ -0,0 +1,151 @@ +From 040e926f5813a5f4cc18dbff7c942d1e52f368f2 Mon Sep 17 00:00:00 2001 +From: Ansuel Smith +Date: Tue, 19 Oct 2021 02:08:50 +0200 +Subject: net: dsa: qca8k: tidy for loop in setup and add cpu port check + +Tidy and organize qca8k setup function from multiple for loop. +Change for loop in bridge leave/join to scan all port and skip cpu port. +No functional change intended. + +Signed-off-by: Ansuel Smith +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca8k.c | 74 +++++++++++++++++++++++++++++-------------------- + 1 file changed, 44 insertions(+), 30 deletions(-) + +--- a/drivers/net/dsa/qca8k.c ++++ b/drivers/net/dsa/qca8k.c +@@ -1122,28 +1122,34 @@ qca8k_setup(struct dsa_switch *ds) + if (ret) + dev_warn(priv->dev, "mib init failed"); + +- /* Enable QCA header mode on the cpu port */ +- ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(cpu_port), +- QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_TX_S | +- QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_RX_S); +- if (ret) { +- dev_err(priv->dev, "failed enabling QCA header mode"); +- return ret; +- } +- +- /* Disable forwarding by default on all ports */ ++ /* Initial setup of all ports */ + for (i = 0; i < QCA8K_NUM_PORTS; i++) { ++ /* Disable forwarding by default on all ports */ + ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i), + QCA8K_PORT_LOOKUP_MEMBER, 0); + if (ret) + return ret; +- } + +- /* Disable MAC by default on all ports */ +- for (i = 1; i < QCA8K_NUM_PORTS; i++) +- qca8k_port_set_status(priv, i, 0); ++ /* Enable QCA header mode on all cpu ports */ ++ if (dsa_is_cpu_port(ds, i)) { ++ ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(i), ++ QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_TX_S | ++ QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_RX_S); ++ if (ret) { ++ dev_err(priv->dev, "failed enabling QCA header mode"); ++ return ret; ++ } ++ } ++ ++ /* Disable MAC by default on all user ports */ ++ if (dsa_is_user_port(ds, i)) ++ qca8k_port_set_status(priv, i, 0); ++ } + +- /* Forward all unknown frames to CPU port for Linux processing */ ++ /* Forward all unknown frames to CPU port for Linux processing ++ * Notice that in multi-cpu config only one port should be set ++ * for igmp, unknown, multicast and broadcast packet ++ */ + ret = qca8k_write(priv, QCA8K_REG_GLOBAL_FW_CTRL1, + BIT(cpu_port) << QCA8K_GLOBAL_FW_CTRL1_IGMP_DP_S | + BIT(cpu_port) << QCA8K_GLOBAL_FW_CTRL1_BC_DP_S | +@@ -1152,11 +1158,13 @@ qca8k_setup(struct dsa_switch *ds) + if (ret) + return ret; + +- /* Setup connection between CPU port & user ports */ ++ /* Setup connection between CPU port & user ports ++ * Configure specific switch configuration for ports ++ */ + for (i = 0; i < QCA8K_NUM_PORTS; i++) { + /* CPU port gets connected to all user ports of the switch */ + if (dsa_is_cpu_port(ds, i)) { +- ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(cpu_port), ++ ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i), + QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds)); + if (ret) + return ret; +@@ -1193,16 +1201,14 @@ qca8k_setup(struct dsa_switch *ds) + if (ret) + return ret; + } +- } + +- /* The port 5 of the qca8337 have some problem in flood condition. The +- * original legacy driver had some specific buffer and priority settings +- * for the different port suggested by the QCA switch team. Add this +- * missing settings to improve switch stability under load condition. +- * This problem is limited to qca8337 and other qca8k switch are not affected. +- */ +- if (priv->switch_id == QCA8K_ID_QCA8337) { +- for (i = 0; i < QCA8K_NUM_PORTS; i++) { ++ /* The port 5 of the qca8337 have some problem in flood condition. The ++ * original legacy driver had some specific buffer and priority settings ++ * for the different port suggested by the QCA switch team. Add this ++ * missing settings to improve switch stability under load condition. ++ * This problem is limited to qca8337 and other qca8k switch are not affected. ++ */ ++ if (priv->switch_id == QCA8K_ID_QCA8337) { + switch (i) { + /* The 2 CPU port and port 5 requires some different + * priority than any other ports. +@@ -1238,6 +1244,12 @@ qca8k_setup(struct dsa_switch *ds) + QCA8K_PORT_HOL_CTRL1_WRED_EN, + mask); + } ++ ++ /* Set initial MTU for every port. ++ * We have only have a general MTU setting. So track ++ * every port and set the max across all port. ++ */ ++ priv->port_mtu[i] = ETH_FRAME_LEN + ETH_FCS_LEN; + } + + /* Special GLOBAL_FC_THRESH value are needed for ar8327 switch */ +@@ -1251,8 +1263,6 @@ qca8k_setup(struct dsa_switch *ds) + } + + /* Setup our port MTUs to match power on defaults */ +- for (i = 0; i < QCA8K_NUM_PORTS; i++) +- priv->port_mtu[i] = ETH_FRAME_LEN + ETH_FCS_LEN; + ret = qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, ETH_FRAME_LEN + ETH_FCS_LEN); + if (ret) + dev_warn(priv->dev, "failed setting MTU settings"); +@@ -1728,7 +1738,9 @@ qca8k_port_bridge_join(struct dsa_switch + cpu_port = dsa_to_port(ds, port)->cpu_dp->index; + port_mask = BIT(cpu_port); + +- for (i = 1; i < QCA8K_NUM_PORTS; i++) { ++ for (i = 0; i < QCA8K_NUM_PORTS; i++) { ++ if (dsa_is_cpu_port(ds, i)) ++ continue; + if (dsa_to_port(ds, i)->bridge_dev != br) + continue; + /* Add this port to the portvlan mask of the other ports +@@ -1758,7 +1770,9 @@ qca8k_port_bridge_leave(struct dsa_switc + + cpu_port = dsa_to_port(ds, port)->cpu_dp->index; + +- for (i = 1; i < QCA8K_NUM_PORTS; i++) { ++ for (i = 0; i < QCA8K_NUM_PORTS; i++) { ++ if (dsa_is_cpu_port(ds, i)) ++ continue; + if (dsa_to_port(ds, i)->bridge_dev != br) + continue; + /* Remove this port to the portvlan mask of the other ports From f262d2aae136d2fe60c3b7314a4a0c5f30d79062 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Wed, 13 Oct 2021 12:51:22 +0200 Subject: [PATCH 38/54] u-boot.mk: fix pkg-config usage Using Host/Exports doesn't work as intended, explicitly add the required vars so that u-boot finds the required libraries when building its tools. Signed-off-by: Andre Heider --- include/u-boot.mk | 3 +++ package/boot/uboot-mediatek/Makefile | 2 -- package/boot/uboot-mvebu/Makefile | 2 -- package/boot/uboot-mxs/Makefile | 2 -- package/boot/uboot-zynq/Makefile | 2 -- 5 files changed, 3 insertions(+), 8 deletions(-) diff --git a/include/u-boot.mk b/include/u-boot.mk index c0a1e87bf3..8c6941b88a 100644 --- a/include/u-boot.mk +++ b/include/u-boot.mk @@ -45,6 +45,9 @@ UBOOT_MAKE_FLAGS = \ HOSTCC="$(HOSTCC)" \ HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \ HOSTLDFLAGS="$(HOST_LDFLAGS)" \ + STAGING_PREFIX="$(STAGING_DIR_HOST)" \ + PKG_CONFIG_PATH="$(STAGING_DIR_HOST)/lib/pkgconfig" \ + PKG_CONFIG_LIBDIR="$(STAGING_DIR_HOST)/lib/pkgconfig" \ $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') define Build/U-Boot/Target diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index a5801afa2d..5d9459d461 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -111,8 +111,6 @@ UBOOT_TARGETS := \ UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE:.fip=.bin) -Build/Exports:=$(Host/Exports) - define Build/fip-image $(STAGING_DIR_HOST)/bin/fiptool create \ --soc-fw $(STAGING_DIR_IMAGE)/$(BUILD_SUBTARGET)-$(BL2_BOOTDEV)-$(BL2_DDRBLOB)ddr-bl31.bin \ diff --git a/package/boot/uboot-mvebu/Makefile b/package/boot/uboot-mvebu/Makefile index bf03fdd2b2..e2f2a2a382 100644 --- a/package/boot/uboot-mvebu/Makefile +++ b/package/boot/uboot-mvebu/Makefile @@ -53,8 +53,6 @@ UBOOT_TARGETS:= \ espressobin \ uDPU -Build/Exports:=$(Host/Exports) - define Build/Configure # enable additional options beyond _defconfig echo CONFIG_CMD_SETEXPR=y >> $(PKG_BUILD_DIR)/configs/$(UBOOT_CONFIG)_defconfig diff --git a/package/boot/uboot-mxs/Makefile b/package/boot/uboot-mxs/Makefile index f4211d3a54..3c908874fa 100644 --- a/package/boot/uboot-mxs/Makefile +++ b/package/boot/uboot-mxs/Makefile @@ -38,8 +38,6 @@ UBOOT_TARGETS := \ UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE) -Build/Exports:=$(Host/Exports) - define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR_IMAGE) $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE) diff --git a/package/boot/uboot-zynq/Makefile b/package/boot/uboot-zynq/Makefile index b6b1dc8b85..c605cfaeb2 100644 --- a/package/boot/uboot-zynq/Makefile +++ b/package/boot/uboot-zynq/Makefile @@ -60,6 +60,4 @@ endef define Package/u-boot/install/default endef -Build/Exports:=$(Host/Exports) - $(eval $(call BuildPackage/U-Boot)) From 0e411c69a819bf3c8a122d8421d6c1c0ded33ec8 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Tue, 19 Oct 2021 11:08:46 +0200 Subject: [PATCH 39/54] tools/pkgconf: add PKG_CONFIG_EXTRAARGS for additional arguments This can be used my the OpenWrt build system to pass additional arguments when required. Signed-off-by: Andre Heider --- tools/pkgconf/files/pkg-config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/pkgconf/files/pkg-config b/tools/pkgconf/files/pkg-config index 2c6fd08b4a..91d144d9b1 100755 --- a/tools/pkgconf/files/pkg-config +++ b/tools/pkgconf/files/pkg-config @@ -5,4 +5,5 @@ pkg-config.real \ --keep-system-libs \ --define-variable=prefix="${STAGING_PREFIX}" \ --define-variable=exec_prefix="${STAGING_PREFIX}" \ ---define-variable=bindir="${STAGING_PREFIX}/bin" "$@" +--define-variable=bindir="${STAGING_PREFIX}/bin" \ +$PKG_CONFIG_EXTRAARGS "$@" From 09465d802b8ce37ee87b6d104889059a6fa948e6 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Tue, 19 Oct 2021 11:08:46 +0200 Subject: [PATCH 40/54] u-boot.mk: always link host libraries static Host libraries are only build static, so let's pass --static to pkg-config globally and remove the then unnecessary patches doing exactly that individually. Signed-off-by: Andre Heider --- include/u-boot.mk | 1 + .../patches/210-link-libcrypto-static.patch | 14 -------------- .../patches/210-link-libcrypto-static.patch | 14 -------------- .../patches/210-link-libcrypto-static.patch | 14 -------------- 4 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 package/boot/uboot-mvebu/patches/210-link-libcrypto-static.patch delete mode 100644 package/boot/uboot-mxs/patches/210-link-libcrypto-static.patch delete mode 100644 package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch diff --git a/include/u-boot.mk b/include/u-boot.mk index 8c6941b88a..509b3d76dc 100644 --- a/include/u-boot.mk +++ b/include/u-boot.mk @@ -48,6 +48,7 @@ UBOOT_MAKE_FLAGS = \ STAGING_PREFIX="$(STAGING_DIR_HOST)" \ PKG_CONFIG_PATH="$(STAGING_DIR_HOST)/lib/pkgconfig" \ PKG_CONFIG_LIBDIR="$(STAGING_DIR_HOST)/lib/pkgconfig" \ + PKG_CONFIG_EXTRAARGS="--static" \ $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') define Build/U-Boot/Target diff --git a/package/boot/uboot-mvebu/patches/210-link-libcrypto-static.patch b/package/boot/uboot-mvebu/patches/210-link-libcrypto-static.patch deleted file mode 100644 index 2e7cf6663b..0000000000 --- a/package/boot/uboot-mvebu/patches/210-link-libcrypto-static.patch +++ /dev/null @@ -1,14 +0,0 @@ -OpenWrt links the libressl statically against mkimage, make sure all the -needed dependencies are added too. - ---- a/tools/Makefile -+++ b/tools/Makefile -@@ -168,7 +168,7 @@ ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CON - HOSTCFLAGS_kwbimage.o += \ - $(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "") - HOSTLDLIBS_mkimage += \ -- $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto") -+ $(shell pkg-config --libs --static libssl libcrypto 2> /dev/null || echo "-lssl -lpthread -lcrypto") - - # OS X deprecate openssl in favour of CommonCrypto, supress deprecation - # warnings on those systems diff --git a/package/boot/uboot-mxs/patches/210-link-libcrypto-static.patch b/package/boot/uboot-mxs/patches/210-link-libcrypto-static.patch deleted file mode 100644 index 022e798f19..0000000000 --- a/package/boot/uboot-mxs/patches/210-link-libcrypto-static.patch +++ /dev/null @@ -1,14 +0,0 @@ -OpenWrt links the libressl statically against mkimage, make sure all the -needed dependencies are added too. - ---- a/tools/Makefile -+++ b/tools/Makefile -@@ -147,7 +147,7 @@ endif - # MXSImage needs LibSSL - ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),) - HOSTLOADLIBES_mkimage += \ -- $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto") -+ $(shell pkg-config --libs --static libssl libcrypto 2> /dev/null || echo "-lssl -lpthread -lcrypto") - - # OS X deprecate openssl in favour of CommonCrypto, supress deprecation - # warnings on those systems diff --git a/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch b/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch deleted file mode 100644 index d2e7bf168d..0000000000 --- a/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch +++ /dev/null @@ -1,14 +0,0 @@ -OpenWrt links the libressl statically against mkimage, make sure all the -needed dependencies are added too. - ---- a/tools/Makefile -+++ b/tools/Makefile -@@ -151,7 +151,7 @@ ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CON - HOSTCFLAGS_kwbimage.o += \ - $(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "") - HOSTLOADLIBES_mkimage += \ -- $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto") -+ $(shell pkg-config --libs --static libssl libcrypto 2> /dev/null || echo "-lssl -lpthread -lcrypto") - - # OS X deprecate openssl in favour of CommonCrypto, supress deprecation - # warnings on those systems From 6b2ed6101e4c97691ba3aa94f25895be536b3870 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 26 Feb 2021 20:17:46 -0800 Subject: [PATCH 41/54] uclibc++: remove No package here depends on it. Furthermore, uClibc++ is a fairly buggy C++ library and seems to be relatively inactive upstream. It also lacks proper support for modern C++11 features. The main benefit of it is size: 66.6 KB vs 287.3 KB on mips24kc. Static linking and LTO can help bring the size down of packages that need it. Added warning message to uclibc++.mk Signed-off-by: Rosen Penev Acked-by: Hauke Mehrtens --- config/Config-build.in | 14 -- include/uclibc++.mk | 18 +-- package/libs/uclibc++/Makefile | 105 ------------- package/libs/uclibc++/files/config.default | 58 ------- .../libs/uclibc++/patches/001-no-ansi.patch | 10 -- .../patches/002-undef-functions.patch | 35 ----- .../libs/uclibc++/patches/003-no-fPIC.patch | 10 -- ...ibc-Make-long-long-available-to-C-11.patch | 143 ------------------ .../005-istream_helpers-Fix-sscanf-typo.patch | 37 ----- 9 files changed, 2 insertions(+), 428 deletions(-) delete mode 100644 package/libs/uclibc++/Makefile delete mode 100644 package/libs/uclibc++/files/config.default delete mode 100644 package/libs/uclibc++/patches/001-no-ansi.patch delete mode 100644 package/libs/uclibc++/patches/002-undef-functions.patch delete mode 100644 package/libs/uclibc++/patches/003-no-fPIC.patch delete mode 100644 package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch delete mode 100644 package/libs/uclibc++/patches/005-istream_helpers-Fix-sscanf-typo.patch diff --git a/config/Config-build.in b/config/Config-build.in index ca6f513450..92ec97aefa 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -217,20 +217,6 @@ menu "Global build settings" make the system libraries incompatible with most of the packages that are not selected during the build process. - choice - prompt "Preferred standard C++ library" - default USE_LIBSTDCXX if USE_GLIBC - default USE_UCLIBCXX - help - Select the preferred standard C++ library for all packages that support this. - - config USE_UCLIBCXX - bool "uClibc++" - - config USE_LIBSTDCXX - bool "libstdc++" - endchoice - comment "Hardening build options" config PKG_CHECK_FORMAT_SECURITY diff --git a/include/uclibc++.mk b/include/uclibc++.mk index a1a61f26d4..10f8d98e15 100644 --- a/include/uclibc++.mk +++ b/include/uclibc++.mk @@ -1,16 +1,2 @@ -ifndef DUMP - ifdef __package_mk - $(error uclibc++.mk must be included before package.mk) - endif -endif - -PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX -CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBSTDCXX:libstdcpp - -ifneq ($(CONFIG_USE_UCLIBCXX),) - ifneq ($(CONFIG_CCACHE),) - TARGET_CXX_NOCACHE=g++-uc - else - TARGET_CXX=g++-uc - endif -endif +$(warn uclibc++.mk is deprecated. Please remove it and CXX_DEPENDS) +CXX_DEPENDS = +libstdcpp diff --git a/package/libs/uclibc++/Makefile b/package/libs/uclibc++/Makefile deleted file mode 100644 index 0e3210a5b9..0000000000 --- a/package/libs/uclibc++/Makefile +++ /dev/null @@ -1,105 +0,0 @@ -# -# Copyright (C) 2006-2012 OpenWrt.org -# Copyright (c) 2016 LEDE project -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=uclibc++ -PKG_VERSION:=0.2.5 -PKG_RELEASE:=3 - -PKG_SOURCE:=uClibc++-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=https://cxx.uclibc.org/src/ -PKG_HASH:=596fb9ed7295564ce4c70ae6076a18f92e72f70310d70c98520bbca85c77895a -PKG_BUILD_DIR:=$(BUILD_DIR)/uClibc++-$(PKG_VERSION) - -PKG_LICENSE:=LGPL-2.1-or-later -PKG_INSTALL:=1 -PKG_BUILD_PARALLEL:=1 -PKG_USE_MIPS16:=0 - -include $(INCLUDE_DIR)/package.mk - -define Package/uclibcxx - NAME:=uclibc++ - SECTION:=libs - CATEGORY:=Libraries - TITLE:=C++ library for embedded systems - URL:=https://cxx.uclibc.org/ -endef - -UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \ - -e 's/i.86/i386/' \ - -e 's/sparc.*/sparc/' \ - -e 's/m68k.*/m68k/' \ - -e 's/ppc/powerpc/g' \ - -e 's/v850.*/v850/g' \ - -e 's/sh64/sh/' \ - -e 's/sh[234].*/sh/' \ - -e 's/mips.*/mips/' \ - -e 's/mipsel.*/mips/' \ -) - -TARGET_CFLAGS += $(FPIC) -nostdinc++ -std=c++11 -TARGET_LDFLAGS += -Wl,--gc-sections - -ifneq ($(CONFIG_CCACHE),) -TARGET_CXX=$(TARGET_CXX_NOCACHE) -endif - -ifeq ($(CONFIG_USE_MUSL),y) -SSP_LIB=-lssp_nonshared -endif - -ifeq (${V}, s) -MAKE_VARS+= \ - V=1 -else ifeq (${V}, sc) -MAKE_VARS+= \ - V=2 -endif - -MAKE_FLAGS:= \ - $(TARGET_CONFIGURE_OPTS) \ - CPU_CFLAGS="$(TARGET_CFLAGS)" \ - CROSS_COMPILE="$(TARGET_CROSS)" \ - LDFLAGS="$(TARGET_LDFLAGS)" \ - GEN_LIBS="-lc $(LIBGCC_S) $(SSP_LIB)" \ - check_as_needed= - -# check_as_needed overrides dependency on libgcc_s - -define Build/Configure - if [ -f ./files/config.$(UCLIBC_TARGET_ARCH) ]; then \ - cp ./files/config.$(UCLIBC_TARGET_ARCH) $(PKG_BUILD_DIR)/.config; \ - else \ - cp ./files/config.default $(PKG_BUILD_DIR)/.config; \ - fi -endef - -define Build/InstallDev - $(INSTALL_DIR) $(2)/bin $(1)/usr/include/uClibc++ $(1)/usr/lib - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/ - $(CP) $(PKG_INSTALL_DIR)/include/* $(1)/usr/include/uClibc++/ - $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++*.{a,so}* $(1)/usr/lib/ - $(SED) 's!\(^\|[[:space:]]\)-[IL]$(TOOLCHAIN_DIR)/[^[:space:]]*!!g' $(TOOLCHAIN_DIR)/bin/g++-uc - $(SED) 's|-I/include/|-I$$$${STAGING_DIR:-$(STAGING_DIR)}/usr/include/uClibc++/|g' $(TOOLCHAIN_DIR)/bin/g++-uc - $(SED) 's|-L/lib/|-L$$$${STAGING_DIR:-$(STAGING_DIR)}/lib/|g' $(TOOLCHAIN_DIR)/bin/g++-uc -# add another wrapper which links against both uClibc++ and libstdc++ - $(INSTALL_BIN) $(TOOLCHAIN_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/g++-uc+std - $(SED) 's|^WRAPPER_INCLUDEDIR=.*||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std - $(SED) 's|-luClibc++|-Wl,-Bdynamic,-luClibc++,-Bstatic,-lstdc++,-Bdynamic|g' $(TOOLCHAIN_DIR)/bin/g++-uc+std - $(SED) 's|-nostdinc++||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std -endef - -define Package/uclibcxx/install - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++.so.* $(1)/usr/lib/ - $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++-*.so $(1)/usr/lib/ -endef - -$(eval $(call BuildPackage,uclibcxx)) diff --git a/package/libs/uclibc++/files/config.default b/package/libs/uclibc++/files/config.default deleted file mode 100644 index d76670e969..0000000000 --- a/package/libs/uclibc++/files/config.default +++ /dev/null @@ -1,58 +0,0 @@ -# -# Automatically generated make config: don't edit -# - -# -# Target Features and Options -# -UCLIBCXX_HAS_FLOATS=y -# UCLIBCXX_HAS_LONG_DOUBLE is not set -# UCLIBCXX_HAS_TLS is not set -UCLIBCXX_WARNINGS="" -BUILD_EXTRA_LIBRARIES="" -HAVE_DOT_CONFIG=y - -# -# String and I/O Stream Support -# -UCLIBCXX_HAS_WCHAR=y -UCLIBCXX_IOSTREAM_BUFSIZE=32 -UCLIBCXX_HAS_LFS=y -UCLIBCXX_SUPPORT_CDIR=y -UCLIBCXX_SUPPORT_CIN=y -UCLIBCXX_SUPPORT_COUT=y -UCLIBCXX_SUPPORT_CERR=y -UCLIBCXX_SUPPORT_CLOG=y -# UCLIBCXX_SUPPORT_WCIN is not set -# UCLIBCXX_SUPPORT_WCOUT is not set -# UCLIBCXX_SUPPORT_WCERR is not set -# UCLIBCXX_SUPPORT_WCLOG is not set - -# -# STL and Code Expansion -# -UCLIBCXX_STL_BUFFER_SIZE=32 -UCLIBCXX_CODE_EXPANSION=y -UCLIBCXX_EXPAND_CONSTRUCTORS_DESTRUCTORS=y -UCLIBCXX_EXPAND_STRING_CHAR=y -UCLIBCXX_EXPAND_VECTOR_BASIC=y -UCLIBCXX_EXPAND_IOS_CHAR=y -UCLIBCXX_EXPAND_STREAMBUF_CHAR=y -UCLIBCXX_EXPAND_ISTREAM_CHAR=y -UCLIBCXX_EXPAND_OSTREAM_CHAR=y -UCLIBCXX_EXPAND_FSTREAM_CHAR=y -UCLIBCXX_EXPAND_SSTREAM_CHAR=y - -# -# Library Installation Options -# -UCLIBCXX_RUNTIME_PREFIX="" -UCLIBCXX_RUNTIME_INCLUDE_SUBDIR="/include" -UCLIBCXX_RUNTIME_LIB_SUBDIR="/lib" -UCLIBCXX_RUNTIME_BIN_SUBDIR="/bin" -UCLIBCXX_EXCEPTION_SUPPORT=y -IMPORT_LIBSUP=y -# IMPORT_LIBGCC_EH is not set -BUILD_STATIC_LIB=y -# BUILD_ONLY_STATIC_LIB is not set -# DODEBUG is not set diff --git a/package/libs/uclibc++/patches/001-no-ansi.patch b/package/libs/uclibc++/patches/001-no-ansi.patch deleted file mode 100644 index 7ddbf52f00..0000000000 --- a/package/libs/uclibc++/patches/001-no-ansi.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/Rules.mak -+++ b/Rules.mak -@@ -232,7 +232,6 @@ endif - GEN_CXXFLAGS:=-nostdinc++ - GEN_CXXFLAGS+=$(if $(CXXFLAG_-fvisibility-inlines-hidden),-DGCC_HASCLASSVISIBILITY) - CXXFLAGS:=$(CFLAGS) --CFLAGS += -ansi - - LIBGCC:=$(shell $(CC) -print-libgcc-file-name) - LIBGCC_DIR:=$(dir $(LIBGCC)) diff --git a/package/libs/uclibc++/patches/002-undef-functions.patch b/package/libs/uclibc++/patches/002-undef-functions.patch deleted file mode 100644 index 47fa1580f2..0000000000 --- a/package/libs/uclibc++/patches/002-undef-functions.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 8245f62c1e7aba150f666b3c3a1dda646dee6d4b Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 27 Sep 2019 13:12:44 -0700 -Subject: [PATCH] cstdio: Add undef for four functions - -When compiling with uClibc-ng, these functions get defined as macros and -become unavailable for std. - -Fixes programs that use the std versions of these functions. - -This matches libstdcpp behavior. - -Signed-off-by: Rosen Penev ---- - include/cstdio | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/include/cstdio -+++ b/include/cstdio -@@ -21,6 +21,15 @@ - #ifndef __HEADER_CSTDIO - #define __HEADER_CSTDIO 1 - -+#undef clearerr -+#undef feof -+#undef ferror -+#undef fgetc -+#undef fputc -+#undef getc -+#undef getchar -+#undef putc -+#undef putchar - - namespace std{ - using ::FILE; diff --git a/package/libs/uclibc++/patches/003-no-fPIC.patch b/package/libs/uclibc++/patches/003-no-fPIC.patch deleted file mode 100644 index dfd8833ae4..0000000000 --- a/package/libs/uclibc++/patches/003-no-fPIC.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/Rules.mak -+++ b/Rules.mak -@@ -185,7 +185,6 @@ export UCLIBCXX_RUNTIME_PREFIX UCLIBCXX_ - - WRAPPER = $(top_builddir)bin/g++-uc - OPTIMIZATION:= --PICFLAG:=-fPIC - - # use '-Os' optimization if available, else use -O2, allow Config to override - $(eval $(call check-gcc-var,-Os)) diff --git a/package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch b/package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch deleted file mode 100644 index 6e13f22c8a..0000000000 --- a/package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 8151579eb36d9366632242415ff3f5177fa5e1e2 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Thu, 3 Oct 2019 18:58:43 -0700 -Subject: [PATCH] uClibc++: Make long long available to C++11 - -C++11 makes long long available. It is no longer a GNU extension. - -Signed-off-by: Rosen Penev ---- - include/istream | 4 ++-- - include/istream_helpers | 2 +- - include/ostream | 8 ++++---- - include/ostream_helpers | 8 ++++---- - tests/sstreamtest.cpp | 4 ++-- - 5 files changed, 13 insertions(+), 13 deletions(-) - ---- a/include/istream -+++ b/include/istream -@@ -72,7 +72,7 @@ namespace std{ - basic_istream& operator>>(void*& p); - basic_istream& operator>>(basic_streambuf* sb); - --#ifndef __STRICT_ANSI__ -+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) - basic_istream& operator>>(long long& n); - basic_istream& operator>>(unsigned long long& n); - #endif -@@ -455,7 +455,7 @@ namespace std{ - return *this; - } - --#ifndef __STRICT_ANSI__ -+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) - template _UCXXEXPORT basic_istream& - basic_istream::operator>>(long long& n) - { ---- a/include/istream_helpers -+++ b/include/istream_helpers -@@ -301,7 +301,7 @@ namespace std{ - }; - - --#ifndef __STRICT_ANSI__ -+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) - template class _UCXXEXPORT __istream_readin{ - public: - inline static void readin(basic_istream& stream, long long & var) ---- a/include/ostream -+++ b/include/ostream -@@ -85,7 +85,7 @@ namespace std { - basic_ostream& operator<<(long double f); - basic_ostream& operator<<(void* p); - basic_ostream& operator<<(basic_streambuf* sb); --#ifndef __STRICT_ANSI__ -+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) - basic_ostream& operator<<(long long n); - basic_ostream& operator<<(unsigned long long n); - #endif -@@ -221,7 +221,7 @@ namespace std { - return *this; - } - --#ifndef __STRICT_ANSI__ -+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) - template _UCXXEXPORT basic_ostream& basic_ostream::operator<<(long long n) - { - sentry s(*this); -@@ -487,7 +487,7 @@ namespace std { - #endif - - --#ifndef __STRICT_ANSI__ -+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) - - //Support for output of long long data types - -@@ -509,7 +509,7 @@ template _UCXXEXPORT - } - - --#endif //__STRICT_ANSI__ -+#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) - - - ---- a/include/ostream_helpers -+++ b/include/ostream_helpers -@@ -142,7 +142,7 @@ namespace std{ - } - }; - --#ifndef __STRICT_ANSI__ -+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) - - template class _UCXXEXPORT __ostream_printout{ - public: -@@ -237,7 +237,7 @@ namespace std{ - }; - - --#endif //__STRICT_ANSI__ -+#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) - - template class _UCXXEXPORT __ostream_printout{ - public: -@@ -357,7 +357,7 @@ namespace std{ - } - }; - --#ifndef __STRICT_ANSI__ -+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) - - template class _UCXXEXPORT __ostream_printout{ - public: -@@ -428,7 +428,7 @@ namespace std{ - }; - - --#endif //__STRICT_ANSI__ -+#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) - - template class _UCXXEXPORT __ostream_printout{ - public: ---- a/tests/sstreamtest.cpp -+++ b/tests/sstreamtest.cpp -@@ -9,7 +9,7 @@ int main(){ - int i; - std::string s; - char c; --#ifndef __STRICT_ANSI__ -+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) - long long ll; - unsigned long long ull; - #endif -@@ -32,7 +32,7 @@ int main(){ - - - --#ifndef __STRICT_ANSI__ -+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L) - a.str("678 76 54"); - a >> ll >> ull >> s; - std::cout << "ll (should be 678): " << ll << std::endl; diff --git a/package/libs/uclibc++/patches/005-istream_helpers-Fix-sscanf-typo.patch b/package/libs/uclibc++/patches/005-istream_helpers-Fix-sscanf-typo.patch deleted file mode 100644 index 66b62c197c..0000000000 --- a/package/libs/uclibc++/patches/005-istream_helpers-Fix-sscanf-typo.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 7f6dd860818512c0eb313320308b22ba7e2c7205 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 4 Oct 2019 20:06:53 -0700 -Subject: [PATCH] istream_helpers: Fix sscanf typo - -This caused readin not to work properly with long long types. - -Found accidentally through a glibc warning -(declared with warn_unused_result). - -Tested with gptfdisk on OpenWrt. - -Signed-off-by: Rosen Penev ---- - include/istream_helpers | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/include/istream_helpers -+++ b/include/istream_helpers -@@ -317,7 +317,7 @@ namespace std{ - sscanf(temp.c_str(), "%llo", (unsigned long long *)&var ); - }else if(stream.flags() & ios_base::hex){ - if(stream.flags() & ios_base::uppercase){ -- scanf(temp.c_str(), "%llX", (unsigned long long *)&var ); -+ sscanf(temp.c_str(), "%llX", (unsigned long long *)&var ); - }else{ - sscanf(temp.c_str(), "%llx", (unsigned long long *)&var); - } -@@ -344,7 +344,7 @@ namespace std{ - sscanf(temp.c_str(), "%llo", &var ); - }else if(stream.flags() & ios_base::hex){ - if(stream.flags() & ios_base::uppercase){ -- scanf(temp.c_str(), "%llX", &var ); -+ sscanf(temp.c_str(), "%llX", &var ); - }else{ - sscanf(temp.c_str(), "%llx", &var); - } From d9a580eb2eeb7333da9b8bb50abfdb8a45f9a98b Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Sat, 2 Oct 2021 23:05:02 +0800 Subject: [PATCH 42/54] sunxi: 5.10: enable sun8i-thermal Enable the sun8i-thermal driver to allow reading the temperature of the SoC. As suggested by mans0n, disable this driver in the a8 subtarget because it does not support yet. Tested on NanoPi R1S H5. Signed-off-by: Chukun Pan --- target/linux/sunxi/config-5.10 | 2 +- target/linux/sunxi/cortexa8/config-5.10 | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/sunxi/config-5.10 b/target/linux/sunxi/config-5.10 index 2f0a8ab968..fc6ae720b7 100644 --- a/target/linux/sunxi/config-5.10 +++ b/target/linux/sunxi/config-5.10 @@ -443,7 +443,7 @@ CONFIG_SUN8I_DE2_CCU=y CONFIG_SUN8I_H3_CCU=y CONFIG_SUN8I_R40_CCU=y CONFIG_SUN8I_R_CCU=y -# CONFIG_SUN8I_THERMAL is not set +CONFIG_SUN8I_THERMAL=y CONFIG_SUN8I_V3S_CCU=y CONFIG_SUN9I_A80_CCU=y CONFIG_SUNXI_CCU=y diff --git a/target/linux/sunxi/cortexa8/config-5.10 b/target/linux/sunxi/cortexa8/config-5.10 index 00c535f865..579c81c3dc 100644 --- a/target/linux/sunxi/cortexa8/config-5.10 +++ b/target/linux/sunxi/cortexa8/config-5.10 @@ -7,3 +7,4 @@ CONFIG_PGTABLE_LEVELS=2 # CONFIG_PHY_SUN9I_USB is not set # CONFIG_SPI_SUN6I is not set # CONFIG_SUN8I_A83T_CCU is not set +# CONFIG_SUN8I_THERMAL is not set From 05a7af9ca0dd9c42eafbca5aa988b141e0e06053 Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Thu, 7 Oct 2021 20:15:25 +0000 Subject: [PATCH 43/54] wolfssl: enable ECC Curve 25519 by default * fixes https://github.com/openwrt/packages/issues/16652 see https://github.com/openwrt/packages/issues/16674#issuecomment-934983898 Signed-off-by: Stan Grishin --- package/libs/wolfssl/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/libs/wolfssl/Config.in b/package/libs/wolfssl/Config.in index 81496c15d6..99c156292c 100644 --- a/package/libs/wolfssl/Config.in +++ b/package/libs/wolfssl/Config.in @@ -49,7 +49,7 @@ config WOLFSSL_HAS_WPAS config WOLFSSL_HAS_ECC25519 bool "Include ECC Curve 25519 support" - default n + default y config WOLFSSL_HAS_OPENVPN bool "Include OpenVPN support" From 7bd0fba3dfefb4c4a7c0b4db65feedf3d7a13f5e Mon Sep 17 00:00:00 2001 From: Claudiu Beznea Date: Mon, 11 Oct 2021 11:47:21 +0300 Subject: [PATCH 44/54] at91: kernel: bump to 5.10 Bump at91 targets to kernel v5.10. With this patches and files for wb45n and wb50n were removed as they are now included in upstream kernel. Along with: - this the kernel config for sama5d2 and sam9x targets has been refreshed (with make kernel_menuconfig + save); - CONFIG_ARCH_AT91 and specific sam9x SoCs (AT91RM9200, AT91SAM9, SAM9X60) has been enabled such that sam9x SoCs to be able to boot. Signed-off-by: Claudiu Beznea --- target/linux/at91/Makefile | 2 +- .../at91/files/arch/arm/boot/dts/wb45n.dts | 220 ------------------ .../at91/files/arch/arm/boot/dts/wb50n.dts | 113 --------- .../at91/files/arch/arm/boot/dts/wb50n.dtsi | 205 ---------------- target/linux/at91/image/sam9x.mk | 1 + target/linux/at91/image/sama5.mk | 1 + .../101-ARM-at91-build-dtb-for-q5xr5.patch | 10 + .../101-ARM-at91-build-dtb-for-q5xr5.patch | 10 - .../102-ARM-at91-build-dtb-for-wb45n.patch | 12 - ...2-ARM-at91-wb45n-fix-duplicate-label.patch | 20 -- .../103-ARM-at91-build-dtb-for-wb50n.patch | 12 - ...3-ARM-at91-wb50n-fix-duplicate-label.patch | 39 ---- target/linux/at91/sam9x/config-default | 133 ++++++----- target/linux/at91/sama5/config-default | 110 +++------ 14 files changed, 109 insertions(+), 779 deletions(-) delete mode 100644 target/linux/at91/files/arch/arm/boot/dts/wb45n.dts delete mode 100644 target/linux/at91/files/arch/arm/boot/dts/wb50n.dts delete mode 100644 target/linux/at91/files/arch/arm/boot/dts/wb50n.dtsi create mode 100644 target/linux/at91/patches-5.10/101-ARM-at91-build-dtb-for-q5xr5.patch delete mode 100644 target/linux/at91/patches-5.4/101-ARM-at91-build-dtb-for-q5xr5.patch delete mode 100644 target/linux/at91/patches-5.4/102-ARM-at91-build-dtb-for-wb45n.patch delete mode 100644 target/linux/at91/patches-5.4/102-ARM-at91-wb45n-fix-duplicate-label.patch delete mode 100644 target/linux/at91/patches-5.4/103-ARM-at91-build-dtb-for-wb50n.patch delete mode 100644 target/linux/at91/patches-5.4/103-ARM-at91-wb50n-fix-duplicate-label.patch diff --git a/target/linux/at91/Makefile b/target/linux/at91/Makefile index fe6a93244a..e4da7fb7e7 100644 --- a/target/linux/at91/Makefile +++ b/target/linux/at91/Makefile @@ -10,7 +10,7 @@ BOARDNAME:=Microchip (Atmel AT91) FEATURES:=ext4 squashfs targz usb usbgadget ubifs SUBTARGETS:=sama5 sam9x -KERNEL_PATCHVER:=5.4 +KERNEL_PATCHVER:=5.10 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/at91/files/arch/arm/boot/dts/wb45n.dts b/target/linux/at91/files/arch/arm/boot/dts/wb45n.dts deleted file mode 100644 index fd9d260f2a..0000000000 --- a/target/linux/at91/files/arch/arm/boot/dts/wb45n.dts +++ /dev/null @@ -1,220 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * wb45n.dts - Device Tree file for WB45NBT board - * - * Copyright (C) 2015 Laird - */ - -/dts-v1/; -#include "at91sam9g25.dtsi" - -/ { - model = "Laird Workgroup Bridge 45N - Atmel AT91SAM (dt)"; - compatible = "laird,wb45n", "laird,wbxx", "atmel,at91sam9x5", "atmel,at91sam9"; - - chosen { - bootargs = "console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs"; - }; - - memory { - reg = <0x20000000 0x4000000>; - }; - - clocks { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - main_clock: clock@0 { - compatible = "atmel,osc", "fixed-clock"; - clock-frequency = <12000000>; - }; - - slow_xtal { - clock-frequency = <32768>; - }; - - main_xtal { - clock-frequency = <12000000>; - }; - }; - - ahb { - apb { - - rstc@fffffe00 { - compatible = "atmel,sama5d3-rstc"; - }; - - pinctrl@fffff400 { - nand { - pinctrl_nand: nand-0 { - atmel,pins = - ; /* PD5 gpio RDY/BUSY pin pull_up */ - }; - }; - - usb2 { - pinctrl_board_usb2: usb2-board { - atmel,pins = - ; /* PB11 gpio vbus sense, deglitch */ - }; - }; - }; - - dbgu: serial@fffff200 { - status = "okay"; - }; - - usart0: serial@f801c000 { - status = "okay"; - }; - - usart3: serial@f8028000 { - status = "okay"; - }; - - spi0: spi@f0000000 { - status = "okay"; - cs-gpios = <&pioA 14 0>, <&pioA 7 0>, <0>, <0>; - }; - - mmc0: mmc@f0008000 { - pinctrl-0 = < - &pinctrl_mmc0_slot0_clk_cmd_dat0 - &pinctrl_mmc0_slot0_dat1_3>; - status = "okay"; - /delete-property/dmas; - /delete-property/dma-names; - slot@0 { - reg = <0>; - bus-width = <4>; - }; - }; - - macb0: ethernet@f802c000 { - phy-mode = "rmii"; - status = "okay"; - }; - - usb2: gadget@f803c000 { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_board_usb2>; - atmel,vbus-gpio = <&pioB 11 GPIO_ACTIVE_HIGH>; - status = "okay"; - }; - - i2c1: i2c@f8014000 { - status = "okay"; - }; - - watchdog@fffffe40 { - status = "okay"; - }; - - shdwc@fffffe10 { - atmel,wakeup-mode = "low"; - }; - - rtc@fffffeb0 { - status = "okay"; - }; - }; - - usb0: ohci@00600000 { - status = "okay"; - num-ports = <2>; - atmel,vbus-gpio = < - &pioB 12 GPIO_ACTIVE_HIGH - &pioA 31 GPIO_ACTIVE_HIGH - >; - atmel,oc-gpio = <&pioB 13 GPIO_ACTIVE_LOW>; - }; - - usb1: ehci@00700000 { - status = "okay"; - }; - - nand0: nand@40000000 { - nand-bus-width = <8>; - nand-ecc-mode = "hw"; - atmel,has-pmecc; /* Enable PMECC */ - atmel,pmecc-cap = <4>; - atmel,pmecc-sector-size = <512>; - nand-on-flash-bbt; - status = "okay"; - - at91bootstrap@0 { - label = "at91bs"; - reg = <0x0 0x20000>; - }; - - uboot@20000 { - label = "u-boot"; - reg = <0x20000 0x80000>; - }; - - ubootenv@a0000 { - label = "u-boot-env"; - reg = <0xa0000 0x20000>; - }; - - ubootenv@c0000 { - label = "redund-env"; - reg = <0xc0000 0x20000>; - }; - - kernel-a@e0000 { - label = "kernel-a"; - reg = <0xe0000 0x280000>; - }; - - kernel-b@360000 { - label = "kernel-b"; - reg = <0x360000 0x280000>; - }; - - rootfs-a@5e0000 { - label = "rootfs-a"; - reg = <0x5e0000 0x2600000>; - }; - - rootfs-b@2be0000 { - label = "rootfs-b"; - reg = <0x2be0000 0x2600000>; - }; - - user@51e0000 { - label = "user"; - reg = <0x51e0000 0x2dc0000>; - }; - - logs@7fa0000 { - label = "logs"; - reg = <0x7fa0000 0x60000>; - }; - }; - }; - - atheros { - compatible = "atheros,ath6kl"; - atheros,board-id = "SD32"; - }; - - keys { - compatible = "gpio-keys"; - #address-cells = <1>; - #size-cells = <0>; - irqbtn@pb18 { - label = "IRQBTN"; - linux,code = <99>; - gpios = <&pioB 18 GPIO_ACTIVE_LOW>; - gpio-key,wakeup = <1>; - }; - }; -}; diff --git a/target/linux/at91/files/arch/arm/boot/dts/wb50n.dts b/target/linux/at91/files/arch/arm/boot/dts/wb50n.dts deleted file mode 100644 index 15b10a8b06..0000000000 --- a/target/linux/at91/files/arch/arm/boot/dts/wb50n.dts +++ /dev/null @@ -1,113 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * wb50n.dts - Device Tree file for wb50n board - * - * Copyright (C) 2015 Laird - */ - -/dts-v1/; -#include "wb50n.dtsi" - -/ { - model = "Laird Workgroup Bridge 50N - Atmel SAMA5D"; - compatible = "laird,wb50n", "atmel,sama5d31ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d31", "atmel,sama5d3", "atmel,sama5"; - - chosen { - bootargs = "console=ttyS0,115200 earlyprintk loglevel=4 mem=64M"; - }; - - ahb { - - apb { - mmc0: mmc@f0000000 { - status = "okay"; - }; - - macb1: ethernet@f802c000 { - status = "okay"; - }; - - dbgu: serial@ffffee00 { - status = "okay"; - }; - - /* On BB40 this port is labeled UART1 */ - usart0: serial@f001c000 { - status = "okay"; - }; - - /* On BB40 this port is labeled UART0 */ - usart1: serial@f0020000 { - status = "okay"; - }; - - i2c0: i2c@f0014000 { - status = "okay"; - }; - - spi1: spi@f8008000 { - status = "okay"; - - spidev@0 { - compatible = "spidev"; - reg = <0>; - spi-max-frequency = <8000000>; - }; - }; - - watchdog@fffffe40 { - status = "okay"; - }; - }; - - usb0: gadget@00500000 { - status = "okay"; - }; - - usb1: ohci@00600000 { - status = "okay"; - }; - - usb2: ehci@00700000 { - status = "okay"; - }; - }; - - keys { - compatible = "gpio-keys"; - #address-cells = <1>; - #size-cells = <0>; - btn0@pa10 { - label = "BTNESC"; - linux,code = <1>; /* ESC button */ - gpios = <&pioA 10 GPIO_ACTIVE_LOW>; - gpio-key,wakeup = <1>; - }; - - irqbtn@pe31 { - label = "IRQBTN"; - linux,code = <99>; /* SysReq button */ - gpios = <&pioE 31 GPIO_ACTIVE_LOW>; - gpio-key,wakeup = <1>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led0 { - label = "wb50n:blue:led0"; - gpios = <&pioA 12 GPIO_ACTIVE_LOW>; - }; - - led1 { - label = "wb50n:green:led1"; - gpios = <&pioA 24 GPIO_ACTIVE_LOW>; - }; - - led2 { - label = "wb50n:red:led2"; - gpios = <&pioA 26 GPIO_ACTIVE_LOW>; - }; - }; -}; diff --git a/target/linux/at91/files/arch/arm/boot/dts/wb50n.dtsi b/target/linux/at91/files/arch/arm/boot/dts/wb50n.dtsi deleted file mode 100644 index 936cce39ed..0000000000 --- a/target/linux/at91/files/arch/arm/boot/dts/wb50n.dtsi +++ /dev/null @@ -1,205 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * wb50n.dts - Device Tree file for wb50n board - * - * Copyright (C) 2015 Laird - */ - -#include "sama5d31.dtsi" - -/ { - model = "Laird Workgroup Bridge 50N - Atmel SAMA5D"; - compatible = "laird,wb50n", "atmel,sama5d31ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d31", "atmel,sama5d3", "atmel,sama5"; - - chosen { - bootargs = "console=ttyS0,115200 earlyprintk loglevel=4 mem=64M"; - }; - - memory { - reg = <0x20000000 0x4000000>; - }; - - clocks { - slow_xtal { - clock-frequency = <32768>; - }; - - main_xtal { - clock-frequency = <12000000>; - }; - }; - - ahb { - - apb { - pmc: pmc@fffffc00 { - main: mainck { - clock-frequency = <12000000>; - }; - - periphck { - usart1_clk: usart1_clk { - #clock-cells = <0>; - reg = <13>; - atmel,clk-output-range = <0 132000000>; - }; - }; - }; - - pinctrl@fffff200 { - board { - pinctrl_mmc0_cd: mmc0_cd { - atmel,pins = - ; /* PC26 GPIO with pullup deglitch */ - }; - - pinctrl_usba_vbus: usba_vbus { - atmel,pins = - ; /* PB13 GPIO with deglitch */ - }; - }; - }; - - mmc0: mmc@f0000000 { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_cd>; - cd-gpios = <&pioC 26 GPIO_ACTIVE_LOW>; - slot@0 { - reg = <0>; - bus-width = <4>; - }; - }; - - mmc1: mmc@f8000000 { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3>; - status = "okay"; - slot@0 { - reg = <0>; - bus-width = <4>; - }; - }; - - macb1: ethernet@f802c000 { - phy-mode = "rmii"; - }; - - - dbgu: serial@ffffee00 { - dmas = <0>, <0>; /* Do not use DMA for dbgu */ - }; - - /* On BB40 this port is labeled UART1 */ - usart0: serial@f001c000 { - atmel,use-dma-rx; - atmel,use-dma-tx; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_usart0 &pinctrl_usart0_rts_cts>; - }; - - /* On BB40 this port is labeled UART0 */ - usart1: serial@f0020000 { - atmel,use-dma-rx; - atmel,use-dma-tx; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_usart1 &pinctrl_usart1_rts_cts>; - dtr-gpios = <&pioD 13 GPIO_ACTIVE_LOW>; - dsr-gpios = <&pioD 11 GPIO_ACTIVE_LOW>; - dcd-gpios = <&pioD 7 GPIO_ACTIVE_LOW>; - rng-gpios = <&pioD 8 GPIO_ACTIVE_LOW>; - }; - - /* USART3 is direct-connect to the Bluetooth UART on the radio SIP */ - usart3: serial@f8024000 { - atmel,use-dma-rx; - atmel,use-dma-tx; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_usart3 &pinctrl_usart3_rts_cts>; - status = "okay"; - }; - - spi1: spi@f8008000 { - cs-gpios = <&pioC 25 0>, <0>, <0>, <0>; - }; - - sckc@fffffe50 { - slow_osc: slow_osc { - atmel,osc-bypass; - }; - }; - }; - - nand0: nand@60000000 { - nand-bus-width = <8>; - nand-ecc-mode = "hw"; - atmel,has-pmecc; - atmel,pmecc-cap = <8>; - atmel,pmecc-sector-size = <512>; - nand-on-flash-bbt; - status = "okay"; - - at91bootstrap@0 { - label = "at91bs"; - reg = <0x0 0x20000>; - }; - - uboot@20000 { - label = "u-boot"; - reg = <0x20000 0x80000>; - }; - - ubootenv@a0000 { - label = "u-boot-env"; - reg = <0xa0000 0x20000>; - }; - - ubootenv@c0000 { - label = "u-boot-env"; - reg = <0xc0000 0x20000>; - }; - - kernel-a@e0000 { - label = "kernel-a"; - reg = <0xe0000 0x500000>; - }; - - kernel-b@5e0000 { - label = "kernel-b"; - reg = <0x5e0000 0x500000>; - }; - - rootfs-a@ae0000 { - label = "rootfs-a"; - reg = <0xae0000 0x3000000>; - }; - - rootfs-b@3ae0000 { - label = "rootfs-b"; - reg = <0x3ae0000 0x3000000>; - }; - - user@6ae0000 { - label = "user"; - reg = <0x6ae0000 0x14e0000>; - }; - - }; - - usb0: gadget@00500000 { - atmel,vbus-gpio = <&pioB 13 GPIO_ACTIVE_LOW>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_usba_vbus>; - }; - - usb1: ohci@00600000 { - num-ports = <3>; - atmel,vbus-gpio = <&pioA 2 GPIO_ACTIVE_LOW>; - atmel,oc-gpio = <&pioA 4 GPIO_ACTIVE_LOW>; - }; - }; - - atheros { - compatible = "atheros,ath6kl"; - atheros,board-id = "SD32"; - }; -}; diff --git a/target/linux/at91/image/sam9x.mk b/target/linux/at91/image/sam9x.mk index 1a036e493f..6f10123bba 100644 --- a/target/linux/at91/image/sam9x.mk +++ b/target/linux/at91/image/sam9x.mk @@ -194,6 +194,7 @@ define Device/laird_wb45n $(Device/evaluation-fit) DEVICE_VENDOR := Laird DEVICE_MODEL := WB45N + DEVICE_DTS := at91-wb45n DEVICE_PACKAGES := \ kmod-mmc-at91 kmod-ath6kl-sdio ath6k-firmware \ kmod-usb-storage kmod-fs-vfat kmod-fs-msdos \ diff --git a/target/linux/at91/image/sama5.mk b/target/linux/at91/image/sama5.mk index d644f89266..f8e05aae93 100644 --- a/target/linux/at91/image/sama5.mk +++ b/target/linux/at91/image/sama5.mk @@ -104,6 +104,7 @@ ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"") $(Device/evaluation-fit) DEVICE_VENDOR := Laird DEVICE_MODEL := WB50N + DEVICE_DTS := at91-wb50n DEVICE_PACKAGES := \ kmod-mmc-at91 kmod-ath6kl-sdio ath6k-firmware \ kmod-usb-storage kmod-fs-vfat kmod-fs-msdos \ diff --git a/target/linux/at91/patches-5.10/101-ARM-at91-build-dtb-for-q5xr5.patch b/target/linux/at91/patches-5.10/101-ARM-at91-build-dtb-for-q5xr5.patch new file mode 100644 index 0000000000..2bf8ca52ec --- /dev/null +++ b/target/linux/at91/patches-5.10/101-ARM-at91-build-dtb-for-q5xr5.patch @@ -0,0 +1,10 @@ +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -41,6 +41,7 @@ dtb-$(CONFIG_SOC_AT91SAM9) += \ + at91-kizboxmini-mb.dtb \ + at91-kizboxmini-rd.dtb \ + at91-smartkiz.dtb \ ++ at91-q5xr5.dtb \ + at91-wb45n.dtb \ + at91sam9g15ek.dtb \ + at91sam9g25-gardena-smart-gateway.dtb \ diff --git a/target/linux/at91/patches-5.4/101-ARM-at91-build-dtb-for-q5xr5.patch b/target/linux/at91/patches-5.4/101-ARM-at91-build-dtb-for-q5xr5.patch deleted file mode 100644 index b736b99f7f..0000000000 --- a/target/linux/at91/patches-5.4/101-ARM-at91-build-dtb-for-q5xr5.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -38,6 +38,7 @@ dtb-$(CONFIG_SOC_AT91SAM9) += \ - at91-ariettag25.dtb \ - at91-cosino_mega2560.dtb \ - at91-kizboxmini.dtb \ -+ at91-q5xr5.dtb \ - at91-wb45n.dtb \ - at91sam9g15ek.dtb \ - at91sam9g25ek.dtb \ diff --git a/target/linux/at91/patches-5.4/102-ARM-at91-build-dtb-for-wb45n.patch b/target/linux/at91/patches-5.4/102-ARM-at91-build-dtb-for-wb45n.patch deleted file mode 100644 index c35ecc510a..0000000000 --- a/target/linux/at91/patches-5.4/102-ARM-at91-build-dtb-for-wb45n.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -44,7 +44,8 @@ dtb-$(CONFIG_SOC_AT91SAM9) += \ - at91sam9g25ek.dtb \ - at91sam9g35ek.dtb \ - at91sam9x25ek.dtb \ -- at91sam9x35ek.dtb -+ at91sam9x35ek.dtb \ -+ wb45n.dtb - dtb-$(CONFIG_SOC_SAM_V7) += \ - at91-kizbox2.dtb \ - at91-nattis-2-natte-2.dtb \ diff --git a/target/linux/at91/patches-5.4/102-ARM-at91-wb45n-fix-duplicate-label.patch b/target/linux/at91/patches-5.4/102-ARM-at91-wb45n-fix-duplicate-label.patch deleted file mode 100644 index 9d060426ec..0000000000 --- a/target/linux/at91/patches-5.4/102-ARM-at91-wb45n-fix-duplicate-label.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/arch/arm/boot/dts/wb45n.dts -+++ b/arch/arm/boot/dts/wb45n.dts -@@ -126,7 +126,7 @@ - }; - }; - -- usb0: ohci@00600000 { -+ usb0: ohci@600000 { - status = "okay"; - num-ports = <2>; - atmel,vbus-gpio = < -@@ -136,7 +136,7 @@ - atmel,oc-gpio = <&pioB 13 GPIO_ACTIVE_LOW>; - }; - -- usb1: ehci@00700000 { -+ usb1: ehci@700000 { - status = "okay"; - }; - diff --git a/target/linux/at91/patches-5.4/103-ARM-at91-build-dtb-for-wb50n.patch b/target/linux/at91/patches-5.4/103-ARM-at91-build-dtb-for-wb50n.patch deleted file mode 100644 index ab5d7afcbb..0000000000 --- a/target/linux/at91/patches-5.4/103-ARM-at91-build-dtb-for-wb50n.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -66,7 +66,8 @@ dtb-$(CONFIG_SOC_SAM_V7) += \ - at91-sama5d4_ma5d4evk.dtb \ - at91-sama5d4_xplained.dtb \ - at91-sama5d4ek.dtb \ -- at91-vinco.dtb -+ at91-vinco.dtb \ -+ wb50n.dtb - dtb-$(CONFIG_ARCH_ATLAS6) += \ - atlas6-evb.dtb - dtb-$(CONFIG_ARCH_ATLAS7) += \ diff --git a/target/linux/at91/patches-5.4/103-ARM-at91-wb50n-fix-duplicate-label.patch b/target/linux/at91/patches-5.4/103-ARM-at91-wb50n-fix-duplicate-label.patch deleted file mode 100644 index bfe6e5a9ba..0000000000 --- a/target/linux/at91/patches-5.4/103-ARM-at91-wb50n-fix-duplicate-label.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/arch/arm/boot/dts/wb50n.dts -+++ b/arch/arm/boot/dts/wb50n.dts -@@ -60,15 +60,15 @@ - }; - }; - -- usb0: gadget@00500000 { -+ usb0: gadget@500000 { - status = "okay"; - }; - -- usb1: ohci@00600000 { -+ usb1: ohci@600000 { - status = "okay"; - }; - -- usb2: ehci@00700000 { -+ usb2: ehci@700000 { - status = "okay"; - }; - }; ---- a/arch/arm/boot/dts/wb50n.dtsi -+++ b/arch/arm/boot/dts/wb50n.dtsi -@@ -185,13 +185,13 @@ - - }; - -- usb0: gadget@00500000 { -+ usb0: gadget@500000 { - atmel,vbus-gpio = <&pioB 13 GPIO_ACTIVE_LOW>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_usba_vbus>; - }; - -- usb1: ohci@00600000 { -+ usb1: ohci@600000 { - num-ports = <3>; - atmel,vbus-gpio = <&pioA 2 GPIO_ACTIVE_LOW>; - atmel,oc-gpio = <&pioA 4 GPIO_ACTIVE_LOW>; diff --git a/target/linux/at91/sam9x/config-default b/target/linux/at91/sam9x/config-default index d0a1cbc0a4..51d1e763cf 100644 --- a/target/linux/at91/sam9x/config-default +++ b/target/linux/at91/sam9x/config-default @@ -1,22 +1,6 @@ CONFIG_ALIGNMENT_TRAP=y CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_ARCH_HAS_BINFMT_FLAT=y -CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y -CONFIG_ARCH_HAS_DMA_WRITE_COMBINE=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_ARCH_HAS_FORTIFY_SOURCE=y -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -CONFIG_ARCH_HAS_KCOV=y -CONFIG_ARCH_HAS_KEEPINITRD=y -CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y -CONFIG_ARCH_HAS_PHYS_TO_DMA=y -CONFIG_ARCH_HAS_SETUP_DMA_OPS=y -CONFIG_ARCH_HAS_SET_MEMORY=y -CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y -CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y -CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS=y -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_AT91=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y @@ -27,27 +11,37 @@ CONFIG_ARCH_MULTI_V4_V5=y CONFIG_ARCH_MULTI_V5=y CONFIG_ARCH_NR_GPIO=0 CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ARM=y CONFIG_ARM_HAS_SG_CHAIN=y CONFIG_ARM_L1_CACHE_SHIFT=5 CONFIG_ARM_PATCH_PHYS_VIRT=y CONFIG_ARM_THUMB=y CONFIG_ARM_UNWIND=y +# CONFIG_AT91RM9200_WATCHDOG is not set +# CONFIG_AT91SAM9X_WATCHDOG is not set +CONFIG_AT91_SOC_ID=y +# CONFIG_AT91_SOC_SFR is not set +CONFIG_ATMEL_AIC5_IRQ=y +CONFIG_ATMEL_AIC_IRQ=y +CONFIG_ATMEL_CLOCKSOURCE_PIT=y +CONFIG_ATMEL_CLOCKSOURCE_TCB=y +CONFIG_ATMEL_EBI=y +CONFIG_ATMEL_PIT=y +CONFIG_ATMEL_SDRAMC=y +CONFIG_ATMEL_ST=y +CONFIG_ATMEL_TCB_CLKSRC=y +# CONFIG_ATMEL_TCLIB is not set CONFIG_AUTO_ZRELADDR=y CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y -CONFIG_CC_HAS_KASAN_GENERIC=y CONFIG_CLKDEV_LOOKUP=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y +CONFIG_COMMON_CLK_AT91=y CONFIG_COMPAT_32BIT_TIME=y +CONFIG_CONFIGFS_FS=y CONFIG_CPU_32v4T=y CONFIG_CPU_32v5=y CONFIG_CPU_ABRT_EV4T=y @@ -69,9 +63,12 @@ CONFIG_CPU_USE_DOMAINS=y CONFIG_CRC7=y CONFIG_CRC_CCITT=y CONFIG_CRC_ITU_T=y +CONFIG_CRYPTO_GF128MUL=y +CONFIG_CRYPTO_NULL2=y CONFIG_CRYPTO_RNG2=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +CONFIG_DMA_OPS=y CONFIG_DMA_REMAP=y CONFIG_DTC=y CONFIG_EDAC_ATOMIC_SCRUB=y @@ -85,56 +82,28 @@ CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CPU_AUTOPROBE=y CONFIG_GENERIC_EARLY_IOREMAP=y CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IRQ_CHIP=y CONFIG_GENERIC_IRQ_MULTI_HANDLER=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_IRQ_SHOW_LEVEL=y CONFIG_GENERIC_PCI_IOMAP=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_STRNCPY_FROM_USER=y CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GLOB=y +CONFIG_GPIOLIB=y +CONFIG_GPIOLIB_IRQCHIP=y CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAVE_ARCH_AUDITSYSCALL=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_COPY_THREAD_TLS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y -CONFIG_HAVE_EBPF_JIT=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_OPTPROBES=y -CONFIG_HAVE_PCI=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_PROC_CPU=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_RSEQ=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_UID16=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HZ_FIXED=0 +CONFIG_HZ=128 +CONFIG_HZ_FIXED=128 CONFIG_HZ_PERIODIC=y CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQCHIP=y @@ -142,10 +111,16 @@ CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_WORK=y CONFIG_LIBFDT=y +CONFIG_LLD_VERSION=0 CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_MEMFD_CREATE=y +CONFIG_MEMORY=y +# CONFIG_MFD_AT91_USART is not set +CONFIG_MFD_ATMEL_SMC=y +CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MMC=y +# CONFIG_MMC_ATMELMCI is not set CONFIG_MMC_BLOCK=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_OF_AT91=y @@ -154,10 +129,12 @@ CONFIG_MODULES_USE_ELF_REL=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_KUSER_HELPERS=y CONFIG_NEED_PER_CPU_KM=y +CONFIG_NLS=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_NET=y @@ -166,9 +143,21 @@ CONFIG_OLD_SIGSUSPEND3=y CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 +CONFIG_PINCTRL=y +CONFIG_PINCTRL_AT91=y +# CONFIG_PINCTRL_AT91PIO4 is not set CONFIG_RATIONAL=y -CONFIG_REFCOUNT_FULL=y +CONFIG_REGMAP=y +CONFIG_REGMAP_MMIO=y +# CONFIG_SAMA5D4_WATCHDOG is not set CONFIG_SERIAL_8250_FSL=y +# CONFIG_SERIAL_ATMEL is not set +CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SOC_AT91RM9200=y +CONFIG_SOC_AT91SAM9=y +CONFIG_SOC_BUS=y +CONFIG_SOC_SAM9X60=y +CONFIG_SOC_SAM_V4_V5=y CONFIG_SPARSE_IRQ=y CONFIG_SPLIT_PTLOCK_CPUS=999999 CONFIG_SRCU=y @@ -179,6 +168,24 @@ CONFIG_TIMER_PROBE=y CONFIG_TINY_SRCU=y CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" CONFIG_UNWINDER_ARM=y +CONFIG_USB=y +CONFIG_USB_ACM=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y +# CONFIG_USB_AT91 is not set +# CONFIG_USB_ATMEL_USBA is not set +CONFIG_USB_COMMON=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_HCD_AT91=y +# CONFIG_USB_EHCI_HCD_PLATFORM is not set +# CONFIG_USB_ETH is not set +CONFIG_USB_GADGET=y +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_OHCI_HCD_AT91=y +CONFIG_USB_OHCI_HCD_PLATFORM=y +CONFIG_USB_SERIAL=y +# CONFIG_USB_SERIAL_CONSOLE is not set +CONFIG_USB_SERIAL_FTDI_SIO=y +CONFIG_USB_SERIAL_PL2303=y CONFIG_USB_SUPPORT=y CONFIG_USE_OF=y # CONFIG_VFP is not set diff --git a/target/linux/at91/sama5/config-default b/target/linux/at91/sama5/config-default index 10d7d4d3b0..20fb90502a 100644 --- a/target/linux/at91/sama5/config-default +++ b/target/linux/at91/sama5/config-default @@ -1,22 +1,6 @@ CONFIG_ALIGNMENT_TRAP=y CONFIG_ARCH_32BIT_OFF_T=y CONFIG_ARCH_AT91=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_ARCH_HAS_BINFMT_FLAT=y -CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_ARCH_HAS_FORTIFY_SOURCE=y -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -CONFIG_ARCH_HAS_KCOV=y -CONFIG_ARCH_HAS_KEEPINITRD=y -CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y -CONFIG_ARCH_HAS_PHYS_TO_DMA=y -CONFIG_ARCH_HAS_SETUP_DMA_OPS=y -CONFIG_ARCH_HAS_SET_MEMORY=y -CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y -CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y -CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS=y -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y @@ -26,14 +10,9 @@ CONFIG_ARCH_MULTI_V7=y CONFIG_ARCH_NR_GPIO=0 CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ARM=y CONFIG_ARM_AT91_CPUIDLE=y CONFIG_ARM_CPU_SUSPEND=y @@ -50,6 +29,7 @@ CONFIG_AT91SAM9X_WATCHDOG=y CONFIG_AT91_ADC=y CONFIG_AT91_SAMA5D2_ADC=y CONFIG_AT91_SOC_ID=y +# CONFIG_AT91_SOC_SFR is not set CONFIG_ATMEL_AIC5_IRQ=y # CONFIG_ATMEL_CLOCKSOURCE_PIT is not set CONFIG_ATMEL_CLOCKSOURCE_TCB=y @@ -74,7 +54,6 @@ CONFIG_BLK_DEV_SD=y CONFIG_BLK_PM=y CONFIG_BLK_SCSI_REQUEST=y CONFIG_CACHE_L2X0=y -CONFIG_CC_HAS_KASAN_GENERIC=y CONFIG_CLKDEV_LOOKUP=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMA=y @@ -118,29 +97,17 @@ CONFIG_CRC16=y # CONFIG_CRC32_SARWATE is not set CONFIG_CRC32_SLICEBY8=y CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_CRYPTO_ACOMP2=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_CCM=y CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_CTR=y CONFIG_CRYPTO_DEFLATE=y CONFIG_CRYPTO_DRBG=y CONFIG_CRYPTO_DRBG_HMAC=y CONFIG_CRYPTO_DRBG_MENU=y -CONFIG_CRYPTO_GCM=y CONFIG_CRYPTO_GF128MUL=y -CONFIG_CRYPTO_GHASH=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_HASH_INFO=y CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_JITTERENTROPY=y CONFIG_CRYPTO_LIB_SHA256=y CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -CONFIG_CRYPTO_NULL=y CONFIG_CRYPTO_NULL2=y CONFIG_CRYPTO_RNG=y CONFIG_CRYPTO_RNG2=y @@ -156,6 +123,7 @@ CONFIG_DMADEVICES=y CONFIG_DMA_CMA=y CONFIG_DMA_ENGINE=y CONFIG_DMA_OF=y +CONFIG_DMA_OPS=y CONFIG_DMA_REMAP=y CONFIG_DMA_SHARED_BUFFER=y CONFIG_DNOTIFY=y @@ -173,6 +141,7 @@ CONFIG_DRM_PANEL_BRIDGE=y CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y CONFIG_DRM_PANEL_SIMPLE=y CONFIG_DTC=y +CONFIG_DVB_CORE=y CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y CONFIG_EEPROM_AT24=y @@ -196,12 +165,14 @@ CONFIG_FORCE_MAX_ZONEORDER=15 CONFIG_FREEZER=y CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y +CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CPU_AUTOPROBE=y CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_GENERIC_GETTIMEOFDAY=y CONFIG_GENERIC_IDLE_POLL_SETUP=y CONFIG_GENERIC_IRQ_CHIP=y CONFIG_GENERIC_IRQ_MULTI_HANDLER=y @@ -213,6 +184,8 @@ CONFIG_GENERIC_SCHED_CLOCK=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GENERIC_STRNCPY_FROM_USER=y 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 @@ -222,53 +195,7 @@ CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAVE_ARCH_AUDITSYSCALL=y -CONFIG_HAVE_ARCH_BITREVERSE=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_ARM_SMCCC=y -CONFIG_HAVE_AT91_AUDIO_PLL=y -CONFIG_HAVE_AT91_GENERATED_CLK=y -CONFIG_HAVE_AT91_H32MX=y -CONFIG_HAVE_AT91_I2S_MUX_CLK=y -CONFIG_HAVE_AT91_SMD=y -CONFIG_HAVE_AT91_USB_CLK=y -CONFIG_HAVE_AT91_UTMI=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_COPY_THREAD_TLS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y -CONFIG_HAVE_EBPF_JIT=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_OPTPROBES=y -CONFIG_HAVE_PCI=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_PROC_CPU=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_RSEQ=y CONFIG_HAVE_SMP=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_UID16=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y CONFIG_HDMI=y CONFIG_HID=y CONFIG_HID_GENERIC=y @@ -301,6 +228,7 @@ CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_WORK=y CONFIG_JBD2=y # CONFIG_JFFS2_FS is not set +CONFIG_KCMP=y CONFIG_KERNEL_GZIP=y # CONFIG_KERNEL_XZ is not set CONFIG_KEXEC=y @@ -312,19 +240,28 @@ CONFIG_LEDS_PWM=y CONFIG_LEDS_TRIGGER_CPU=y CONFIG_LEDS_TRIGGER_GPIO=y CONFIG_LIBFDT=y +CONFIG_LLD_VERSION=0 CONFIG_LOCALVERSION_AUTO=y CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_LOG_BUF_SHIFT=16 CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y CONFIG_MACB=y -CONFIG_MACB_USE_HWSTAMP=y CONFIG_MAGIC_SYSRQ=y CONFIG_MANDATORY_FILE_LOCKING=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_DEVRES=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_ATTACH=y CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +CONFIG_MEDIA_PLATFORM_SUPPORT=y +CONFIG_MEDIA_RADIO_SUPPORT=y +CONFIG_MEDIA_SDR_SUPPORT=y CONFIG_MEDIA_SUPPORT=y +CONFIG_MEDIA_TEST_SUPPORT=y +CONFIG_MEDIA_TUNER=y CONFIG_MEDIA_USB_SUPPORT=y CONFIG_MEMFD_CREATE=y CONFIG_MEMORY=y @@ -386,6 +323,7 @@ CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 CONFIG_PHYLIB=y +CONFIG_PHYLINK=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y CONFIG_PINCTRL_AT91PIO4=y @@ -411,7 +349,6 @@ CONFIG_PWM_ATMEL_HLCDC_PWM=y CONFIG_PWM_ATMEL_TCB=y CONFIG_PWM_SYSFS=y CONFIG_RATIONAL=y -CONFIG_REFCOUNT_FULL=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y CONFIG_REGMAP_MMIO=y @@ -457,6 +394,8 @@ CONFIG_SND_DMAENGINE_PCM=y CONFIG_SND_JACK=y CONFIG_SND_JACK_INPUT_DEV=y # CONFIG_SND_MCHP_SOC_I2S_MCC is not set +# CONFIG_SND_MCHP_SOC_SPDIFRX is not set +# CONFIG_SND_MCHP_SOC_SPDIFTX is not set CONFIG_SND_PCM=y CONFIG_SND_PCM_TIMER=y CONFIG_SND_SOC=y @@ -511,11 +450,13 @@ CONFIG_USB_ACM=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y # CONFIG_USB_AT91 is not set # CONFIG_USB_ATMEL_USBA is not set +# CONFIG_USB_AUDIO is not set CONFIG_USB_COMMON=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_HCD_AT91=y # CONFIG_USB_EHCI_HCD_PLATFORM is not set # CONFIG_USB_EHCI_ROOT_HUB_TT is not set +# CONFIG_USB_ETH is not set CONFIG_USB_GADGET=y CONFIG_USB_HID=y CONFIG_USB_OHCI_HCD=y @@ -534,6 +475,7 @@ CONFIG_VFAT_FS=y CONFIG_VFP=y CONFIG_VFPv3=y CONFIG_VIDEOMODE_HELPERS=y +# CONFIG_VIDEO_ATMEL_ISC is not set # CONFIG_VIDEO_ATMEL_ISI is not set # CONFIG_VIDEO_CPIA2 is not set CONFIG_VIDEO_DEV=y From 999c925f9d47637b3913229acb20568989df5ca3 Mon Sep 17 00:00:00 2001 From: Claudiu Beznea Date: Mon, 11 Oct 2021 11:47:22 +0300 Subject: [PATCH 45/54] at91: enable specific sam9x kernel config flags Enable specific sam9x kernel config flags. Signed-off-by: Claudiu Beznea --- target/linux/at91/sam9x/config-default | 112 +++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 6 deletions(-) diff --git a/target/linux/at91/sam9x/config-default b/target/linux/at91/sam9x/config-default index 51d1e763cf..51a746b7f0 100644 --- a/target/linux/at91/sam9x/config-default +++ b/target/linux/at91/sam9x/config-default @@ -21,7 +21,7 @@ CONFIG_ARM_PATCH_PHYS_VIRT=y CONFIG_ARM_THUMB=y CONFIG_ARM_UNWIND=y # CONFIG_AT91RM9200_WATCHDOG is not set -# CONFIG_AT91SAM9X_WATCHDOG is not set +CONFIG_AT91SAM9X_WATCHDOG=y CONFIG_AT91_SOC_ID=y # CONFIG_AT91_SOC_SFR is not set CONFIG_ATMEL_AIC5_IRQ=y @@ -31,9 +31,12 @@ CONFIG_ATMEL_CLOCKSOURCE_TCB=y CONFIG_ATMEL_EBI=y CONFIG_ATMEL_PIT=y CONFIG_ATMEL_SDRAMC=y +CONFIG_ATMEL_SSC=y CONFIG_ATMEL_ST=y CONFIG_ATMEL_TCB_CLKSRC=y -# CONFIG_ATMEL_TCLIB is not set +CONFIG_ATMEL_TCLIB=y +CONFIG_AT_HDMAC=y +# CONFIG_AT_XDMAC is not set CONFIG_AUTO_ZRELADDR=y CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y CONFIG_CLKDEV_LOOKUP=y @@ -60,20 +63,34 @@ CONFIG_CPU_PABRT_LEGACY=y CONFIG_CPU_THUMB_CAPABLE=y CONFIG_CPU_TLB_V4WBI=y CONFIG_CPU_USE_DOMAINS=y +CONFIG_CRC16=y CONFIG_CRC7=y CONFIG_CRC_CCITT=y CONFIG_CRC_ITU_T=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_DEFLATE=y CONFIG_CRYPTO_GF128MUL=y +CONFIG_CRYPTO_HASH_INFO=y +CONFIG_CRYPTO_LZO=y CONFIG_CRYPTO_NULL2=y CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_ZSTD=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +CONFIG_DMADEVICES=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_OF=y CONFIG_DMA_OPS=y CONFIG_DMA_REMAP=y CONFIG_DTC=y CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y +CONFIG_EEPROM_AT24=y +CONFIG_EXT4_FS=y +CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FS_IOMAP=y +CONFIG_FS_MBCACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y @@ -102,34 +119,72 @@ CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y +CONFIG_HW_RANDOM=y +CONFIG_HW_RANDOM_ATMEL=y CONFIG_HZ=128 CONFIG_HZ_FIXED=128 CONFIG_HZ_PERIODIC=y +CONFIG_I2C=y +CONFIG_I2C_ALGOBIT=y +CONFIG_I2C_AT91=y +# CONFIG_I2C_AT91_SLAVE_EXPERIMENTAL is not set +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_GPIO=y CONFIG_INITRAMFS_SOURCE="" +CONFIG_INPUT=y CONFIG_IRQCHIP=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_WORK=y +CONFIG_JBD2=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_PWM=y +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y CONFIG_LIBFDT=y CONFIG_LLD_VERSION=0 CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_MACB=y +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_DEVRES=y CONFIG_MEMFD_CREATE=y CONFIG_MEMORY=y -# CONFIG_MFD_AT91_USART is not set +CONFIG_MFD_AT91_USART=y +CONFIG_MFD_ATMEL_HLCDC=y CONFIG_MFD_ATMEL_SMC=y +CONFIG_MFD_CORE=y CONFIG_MFD_SYSCON=y +CONFIG_MICREL_PHY=y CONFIG_MIGRATION=y CONFIG_MMC=y -# CONFIG_MMC_ATMELMCI is not set +CONFIG_MMC_ATMELMCI=y CONFIG_MMC_BLOCK=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_OF_AT91=y CONFIG_MMC_SDHCI_PLTFM=y CONFIG_MODULES_USE_ELF_REL=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_DATAFLASH=y +# CONFIG_MTD_DATAFLASH_OTP is not set +# CONFIG_MTD_DATAFLASH_WRITE_VERIFY is not set +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_BEB_LIMIT=20 +# CONFIG_MTD_UBI_BLOCK is not set +CONFIG_MTD_UBI_FASTMAP=y +CONFIG_MTD_UBI_GLUEBI=y +CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_KUSER_HELPERS=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NLS=y +CONFIG_NVMEM=y +CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y @@ -137,35 +192,74 @@ CONFIG_OF_FLATTREE=y CONFIG_OF_GPIO=y CONFIG_OF_IRQ=y CONFIG_OF_KOBJ=y +CONFIG_OF_MDIO=y CONFIG_OF_NET=y CONFIG_OLD_SIGACTION=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 +CONFIG_PHYLIB=y +CONFIG_PHYLINK=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y # CONFIG_PINCTRL_AT91PIO4 is not set +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_AT91_POWEROFF=y +CONFIG_POWER_RESET_AT91_RESET=y +CONFIG_POWER_RESET_AT91_SAMA5D2_SHDWC=y +CONFIG_POWER_SUPPLY=y +CONFIG_PWM=y +CONFIG_PWM_ATMEL=y +CONFIG_PWM_ATMEL_HLCDC_PWM=y +CONFIG_PWM_ATMEL_TCB=y +CONFIG_PWM_SYSFS=y CONFIG_RATIONAL=y CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y CONFIG_REGMAP_MMIO=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_AT91RM9200=y +CONFIG_RTC_DRV_AT91SAM9=y +CONFIG_RTC_I2C_AND_SPI=y +CONFIG_RTC_MC146818_LIB=y # CONFIG_SAMA5D4_WATCHDOG is not set -CONFIG_SERIAL_8250_FSL=y -# CONFIG_SERIAL_ATMEL is not set +# CONFIG_SERIAL_8250 is not set +CONFIG_SERIAL_ATMEL=y +CONFIG_SERIAL_ATMEL_CONSOLE=y +CONFIG_SERIAL_ATMEL_PDC=y +# CONFIG_SERIAL_ATMEL_TTYAT is not set CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SGL_ALLOC=y CONFIG_SOC_AT91RM9200=y CONFIG_SOC_AT91SAM9=y CONFIG_SOC_BUS=y CONFIG_SOC_SAM9X60=y CONFIG_SOC_SAM_V4_V5=y CONFIG_SPARSE_IRQ=y +CONFIG_SPI=y +# CONFIG_SPI_AT91_USART is not set +CONFIG_SPI_ATMEL=y +CONFIG_SPI_ATMEL_QUADSPI=y +CONFIG_SPI_BITBANG=y +CONFIG_SPI_GPIO=y +CONFIG_SPI_MASTER=y +CONFIG_SPI_MEM=y +CONFIG_SPI_SPIDEV=y CONFIG_SPLIT_PTLOCK_CPUS=999999 +CONFIG_SRAM=y +CONFIG_SRAM_EXEC=y CONFIG_SRCU=y +CONFIG_SWPHY=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TIMER_OF=y CONFIG_TIMER_PROBE=y CONFIG_TINY_SRCU=y +CONFIG_UBIFS_FS=y +CONFIG_UBIFS_FS_ADVANCED_COMPR=y CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" CONFIG_UNWINDER_ARM=y CONFIG_USB=y @@ -189,5 +283,11 @@ CONFIG_USB_SERIAL_PL2303=y CONFIG_USB_SUPPORT=y CONFIG_USE_OF=y # CONFIG_VFP is not set +CONFIG_WATCHDOG_CORE=y +CONFIG_XXHASH=y CONFIG_ZBOOT_ROM_BSS=0x0 CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZSTD_COMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y From 8b7e577f76897ee44bc00a2303cbcae2a52b5ebf Mon Sep 17 00:00:00 2001 From: Claudiu Beznea Date: Mon, 11 Oct 2021 11:47:23 +0300 Subject: [PATCH 46/54] at91: add support for sama5d2 icp board Add support for SAMA5D2 ICP board. Hardware: - SoC: SAMA5D27 - RAM: 512 MB DDR3L - MMC: One stanard SD card interface - USB: One USB host switch 4 ports with power switch, One USB device type Micro-AB - CAN: 2 interfaces - Ethernet: One Gigabit Ethernet PHY through HSIC, One ETH switchport, One EtherCAT interface - WiFi/BT: Footprint for IEEE 802.11 b/g/n Wi-Fi plus Bluetooth module (Wi-Fi/BT), suitable for Microchip WILC3000-MR110CA or WILC3000-MR110UA - Debug port: One J-Link-OB/J-Link-CDC, one JTAG interface - Leds: one RGB LED - Buttons: reset, wakeup, 2 user buttons - Expansion: one PIOBU/PIO connector, 3 mikrobus sockets - Power mangament: PMIC (MCP16502), one power consumption device (PAC1934) Not working in Linux: - EtherCAT interface: there is no Linux support integrated - PAC1934: driver available at [1] but not integrated in Linux Flashing: - follow the procedure at [2] [1] https://ww1.microchip.com/downloads/en/DeviceDoc/pac193x_linux_driver.zip [2] https://www.linux4sam.org/bin/view/Linux4SAM/Sama5d2IcpMainPage#Create_a_SD_card_with_the_demo Signed-off-by: Claudiu Beznea --- package/boot/at91bootstrap/Makefile | 14 ++++++++++++++ package/boot/uboot-at91/Makefile | 7 +++++++ target/linux/at91/image/sama5.mk | 11 +++++++++++ 3 files changed, 32 insertions(+) diff --git a/package/boot/at91bootstrap/Makefile b/package/boot/at91bootstrap/Makefile index f66472fa9c..56e14c5770 100644 --- a/package/boot/at91bootstrap/Makefile +++ b/package/boot/at91bootstrap/Makefile @@ -40,6 +40,18 @@ define AT91Bootstrap/at91sam9x5eksd_uboot BUILD_DEVICES:=atmel_at91sam9x25ek atmel_at91sam9x35ek endef +define AT91Bootstrap/sama5d2_icpdf_qspi_uboot + TITLE:=AT91Bootstrap for SAMA5D2 ICP board (QSPI Flash) + BUILD_SUBTARGET:=sama5 + BUILD_DEVICES:=microchip_sama5d2-icp +endef + +define AT91Bootstrap/sama5d2_icpsd_uboot + TITLE:=AT91Bootstrap for SAMA5D2 ICP board (SDcard) + BUILD_SUBTARGET:=sama5 + BUILD_DEVICES:=microchip_sama5d2-icp +endef + define AT91Bootstrap/sama5d2_xplaineddf_uboot TITLE:=AT91Bootstrap for SAMA5D2 Xplained board (SPI Flash) BUILD_SUBTARGET:=sama5 @@ -121,6 +133,8 @@ endef AT91BOOTSTRAP_TARGETS := \ at91sam9x5eknf_uboot \ at91sam9x5eksd_uboot \ + sama5d2_icpdf_qspi_uboot \ + sama5d2_icpsd_uboot \ sama5d2_xplaineddf_uboot \ sama5d2_xplaineddf_qspi_uboot \ sama5d2_xplainedsd_uboot \ diff --git a/package/boot/uboot-at91/Makefile b/package/boot/uboot-at91/Makefile index 06cfcd9045..822d71f796 100644 --- a/package/boot/uboot-at91/Makefile +++ b/package/boot/uboot-at91/Makefile @@ -59,6 +59,12 @@ define U-Boot/sama5d3_xplained_mmc BUILD_DEVICES:=microchip_sama5d3-xplained endef +define U-Boot/sama5d2_icp_mmc + NAME:=SAMA5D2 ICP board (SDCard) + BUILD_SUBTARGET:=sama5 + BUILD_DEVICES:=microchip_sama5d2-icp +endef + define U-Boot/sama5d2_xplained_spiflash NAME:=SAMA5D2 Xplained board (SPI Flash) BUILD_SUBTARGET:=sama5 @@ -119,6 +125,7 @@ UBOOT_TARGETS := \ at91sam9x5ek_mmc \ sama5d3_xplained_nandflash \ sama5d3_xplained_mmc \ + sama5d2_icp_mmc \ sama5d2_xplained_mmc \ sama5d2_xplained_spiflash \ sama5d4_xplained_mmc \ diff --git a/target/linux/at91/image/sama5.mk b/target/linux/at91/image/sama5.mk index f8e05aae93..ae34943321 100644 --- a/target/linux/at91/image/sama5.mk +++ b/target/linux/at91/image/sama5.mk @@ -54,6 +54,17 @@ define Build/at91-sdcard rm -f $@.img $@.boot $@-uboot.env $@-uboot-env.txt) endef +define Device/microchip_sama5d2-icp + $(Device/evaluation-dtb) + DEVICE_VENDOR := Microchip + DEVICE_MODEL := SAMA5D2 ICP + DEVICE_DTS := at91-sama5d2_icp + SUPPORTED_DEVICES := microchip,sama5d2-icp + KERNEL_SIZE := 6144k + $(Device/evaluation-sdimage) +endef +TARGET_DEVICES += microchip_sama5d2-icp + define Device/microchip_sama5d2-xplained $(Device/evaluation-dtb) DEVICE_VENDOR := Microchip From 60f52f9b0d9dba7bcaec0be110178f0e3eadceb9 Mon Sep 17 00:00:00 2001 From: Claudiu Beznea Date: Mon, 11 Oct 2021 11:47:24 +0300 Subject: [PATCH 47/54] at91: add support for sama5d27-wlsom1-ek board Add support for SAMA5D27 WLSOM1-EK board. Hardware: - SIP: SAMA5D27C-LD2G-CU including SAMA5D27 MPU and 2Gbit LPDDR2-SDRAM - MMC: one standard SD card interface - Flash: 64 Mb serial quad I/O flash memory (SST26VF064BEUIT-104I/MF) with embedded EUI-48 and EUI-64 MAC addresses - USB: one USB device, one USB host one HSIC interface - Ethernet: 1x10/100Mbps port - WiFi/BT: IEEE 802.11 b/g/n Wi-Fi plus Bluetooth (Wi-Fi/BT) module (ATWILC3000-MR110UA) - Crypto: one ATECC608B-TNGTLS secure element - Video: one LCD RGB 18-bit interface, one ISC 12-bit camera interface - Debug port: one JTAG interface, one UART interface, one WILC UART interface - Leds: one RGB LED - Buttons: start, reset, wakeup, user buttons - Expansion: one tamper connector, one mikrobus interface, 2 XPRO PTC connector - Power managament: PMIC (MCP16502) Flashing: - follow procedure at [1] [1] https://www.linux4sam.org/bin/view/Linux4SAM/Sama5d27WLSom1EKMainPage#Create_a_SD_card_with_the_demo Signed-off-by: Claudiu Beznea --- package/boot/at91bootstrap/Makefile | 14 ++++++++++++++ package/boot/uboot-at91/Makefile | 14 ++++++++++++++ target/linux/at91/image/sama5.mk | 11 +++++++++++ 3 files changed, 39 insertions(+) diff --git a/package/boot/at91bootstrap/Makefile b/package/boot/at91bootstrap/Makefile index 56e14c5770..8711acd286 100644 --- a/package/boot/at91bootstrap/Makefile +++ b/package/boot/at91bootstrap/Makefile @@ -118,6 +118,18 @@ define AT91Bootstrap/sama5d27_som1_ekqspi_uboot BUILD_DEVICES:=microchip_sama5d27-som1-ek endef +define AT91Bootstrap/sama5d27_wlsom1_eksd_uboot + TITLE:=AT91Bootstrap for SAMA5D27 WLSOM1 Ek (SDcard0) + BUILD_SUBTARGET:=sama5 + BUILD_DEVICES:=microchip_sama5d27-wlsom1-ek +endef + +define AT91Bootstrap/sama5d27_wlsom1_ekdf_qspi_uboot + TITLE:=AT91Bootstrap for SAMA5D27 WLSOM1 Ek (QSPI Flash) + BUILD_SUBTARGET:=sama5 + BUILD_DEVICES:=microchip_sama5d27-wlsom1-ek +endef + define AT91Bootstrap/sama5d2_ptc_eknf_uboot TITLE:=AT91Bootstrap for SAMA5D2 PTC EK (Nand Flash) BUILD_SUBTARGET:=sama5 @@ -145,6 +157,8 @@ AT91BOOTSTRAP_TARGETS := \ sama5d4_xplainedsd_uboot_secure \ sama5d27_som1_eksd1_uboot \ sama5d27_som1_ekqspi_uboot \ + sama5d27_wlsom1_eksd_uboot \ + sama5d27_wlsom1_ekdf_qspi_uboot \ sama5d2_ptc_eknf_uboot \ sama5d2_ptc_eksd_uboot diff --git a/package/boot/uboot-at91/Makefile b/package/boot/uboot-at91/Makefile index 822d71f796..3262da4cbe 100644 --- a/package/boot/uboot-at91/Makefile +++ b/package/boot/uboot-at91/Makefile @@ -107,6 +107,18 @@ define U-Boot/sama5d27_som1_ek_qspiflash BUILD_DEVICES:=microchip_sama5d27-som1-ek endef +define U-Boot/sama5d27_wlsom1_ek_mmc + NAME:=SAMA5D27 WLSOM1 Ek (SDCard) + BUILD_SUBTARGET:=sama5 + BUILD_DEVICES:=microchip_sama5d27-wlsom1-ek +endef + +define U-Boot/sama5d27_wlsom1_ek_qspiflash + NAME:=SAMA5D27 WLSOM1 Ek (QSPI Flash) + BUILD_SUBTARGET:=sama5 + BUILD_DEVICES:=microchip_sama5d27-wlsom1-ek +endef + define U-Boot/sama5d2_ptc_ek_nandflash NAME:=SAMA5D2 PTC Ek (Nand Flash) BUILD_SUBTARGET:=sama5 @@ -133,6 +145,8 @@ UBOOT_TARGETS := \ sama5d4_xplained_nandflash\ sama5d27_som1_ek_mmc1 \ sama5d27_som1_ek_qspiflash \ + sama5d27_wlsom1_ek_mmc \ + sama5d27_wlsom1_ek_qspiflash \ sama5d2_ptc_ek_nandflash \ sama5d2_ptc_ek_mmc diff --git a/target/linux/at91/image/sama5.mk b/target/linux/at91/image/sama5.mk index ae34943321..9078db525f 100644 --- a/target/linux/at91/image/sama5.mk +++ b/target/linux/at91/image/sama5.mk @@ -87,6 +87,17 @@ define Device/microchip_sama5d27-som1-ek endef TARGET_DEVICES += microchip_sama5d27-som1-ek +define Device/microchip_sama5d27-wlsom1-ek + $(Device/evaluation-dtb) + DEVICE_VENDOR := Microchip + DEVICE_MODEL := SAMA5D27 WSOM1 Ek + DEVICE_DTS := at91-sama5d27_wlsom1_ek + SUPPORTED_DEVICES := microchip,sama5d27-wlsom1-ek + KERNEL_SIZE := 6144k + $(Device/evaluation-sdimage) +endef +TARGET_DEVICES += microchip_sama5d27-wlsom1-ek + define Device/microchip_sama5d2-ptc-ek $(Device/evaluation-dtb) DEVICE_VENDOR := Microchip From 65c4e89dcf01ca5e4ab3e5c2564fb8ca42757f8c Mon Sep 17 00:00:00 2001 From: Claudiu Beznea Date: Mon, 11 Oct 2021 11:47:25 +0300 Subject: [PATCH 48/54] at91: enable kernel config for sam9x60 Enable kernel config for SAM9X60. Signed-off-by: Claudiu Beznea --- target/linux/at91/sam9x/config-default | 29 ++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/target/linux/at91/sam9x/config-default b/target/linux/at91/sam9x/config-default index 51a746b7f0..95c229880b 100644 --- a/target/linux/at91/sam9x/config-default +++ b/target/linux/at91/sam9x/config-default @@ -15,6 +15,7 @@ CONFIG_ARCH_SELECT_MEMORY_MODEL=y CONFIG_ARCH_SPARSEMEM_ENABLE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM=y +CONFIG_ARM_CPU_SUSPEND=y CONFIG_ARM_HAS_SG_CHAIN=y CONFIG_ARM_L1_CACHE_SHIFT=5 CONFIG_ARM_PATCH_PHYS_VIRT=y @@ -22,6 +23,8 @@ CONFIG_ARM_THUMB=y CONFIG_ARM_UNWIND=y # CONFIG_AT91RM9200_WATCHDOG is not set CONFIG_AT91SAM9X_WATCHDOG=y +# CONFIG_AT91_ADC is not set +CONFIG_AT91_SAMA5D2_ADC=y CONFIG_AT91_SOC_ID=y # CONFIG_AT91_SOC_SFR is not set CONFIG_ATMEL_AIC5_IRQ=y @@ -30,16 +33,19 @@ CONFIG_ATMEL_CLOCKSOURCE_PIT=y CONFIG_ATMEL_CLOCKSOURCE_TCB=y CONFIG_ATMEL_EBI=y CONFIG_ATMEL_PIT=y +CONFIG_ATMEL_PM=y CONFIG_ATMEL_SDRAMC=y CONFIG_ATMEL_SSC=y CONFIG_ATMEL_ST=y CONFIG_ATMEL_TCB_CLKSRC=y CONFIG_ATMEL_TCLIB=y CONFIG_AT_HDMAC=y -# CONFIG_AT_XDMAC is not set +CONFIG_AT_XDMAC=y CONFIG_AUTO_ZRELADDR=y CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y +CONFIG_BLK_PM=y CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y CONFIG_COMMON_CLK_AT91=y @@ -60,6 +66,7 @@ CONFIG_CPU_CP15_MMU=y # CONFIG_CPU_DCACHE_WRITETHROUGH is not set CONFIG_CPU_NO_EFFICIENT_FFS=y CONFIG_CPU_PABRT_LEGACY=y +CONFIG_CPU_PM=y CONFIG_CPU_THUMB_CAPABLE=y CONFIG_CPU_TLB_V4WBI=y CONFIG_CPU_USE_DOMAINS=y @@ -89,8 +96,10 @@ CONFIG_EEPROM_AT24=y CONFIG_EXT4_FS=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FREEZER=y CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y +CONFIG_FW_CACHE=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y @@ -132,6 +141,11 @@ CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_COMPAT=y CONFIG_I2C_GPIO=y +CONFIG_IIO=y +CONFIG_IIO_BUFFER=y +CONFIG_IIO_KFIFO_BUF=y +CONFIG_IIO_TRIGGER=y +CONFIG_IIO_TRIGGERED_BUFFER=y CONFIG_INITRAMFS_SOURCE="" CONFIG_INPUT=y CONFIG_IRQCHIP=y @@ -155,11 +169,13 @@ CONFIG_MDIO_DEVRES=y CONFIG_MEMFD_CREATE=y CONFIG_MEMORY=y CONFIG_MFD_AT91_USART=y +CONFIG_MFD_ATMEL_FLEXCOM=y CONFIG_MFD_ATMEL_HLCDC=y CONFIG_MFD_ATMEL_SMC=y CONFIG_MFD_CORE=y CONFIG_MFD_SYSCON=y CONFIG_MICREL_PHY=y +CONFIG_MICROCHIP_PIT64B=y CONFIG_MIGRATION=y CONFIG_MMC=y CONFIG_MMC_ATMELMCI=y @@ -204,6 +220,12 @@ CONFIG_PHYLINK=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y # CONFIG_PINCTRL_AT91PIO4 is not set +CONFIG_PINCTRL_MCP23S08=y +CONFIG_PINCTRL_MCP23S08_I2C=y +CONFIG_PINCTRL_MCP23S08_SPI=y +CONFIG_PM=y +CONFIG_PM_CLK=y +CONFIG_PM_SLEEP=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_AT91_POWEROFF=y CONFIG_POWER_RESET_AT91_RESET=y @@ -218,6 +240,7 @@ CONFIG_RATIONAL=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_SPI=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_RTC_CLASS=y @@ -225,7 +248,7 @@ CONFIG_RTC_DRV_AT91RM9200=y CONFIG_RTC_DRV_AT91SAM9=y CONFIG_RTC_I2C_AND_SPI=y CONFIG_RTC_MC146818_LIB=y -# CONFIG_SAMA5D4_WATCHDOG is not set +CONFIG_SAMA5D4_WATCHDOG=y # CONFIG_SERIAL_8250 is not set CONFIG_SERIAL_ATMEL=y CONFIG_SERIAL_ATMEL_CONSOLE=y @@ -252,6 +275,8 @@ CONFIG_SPLIT_PTLOCK_CPUS=999999 CONFIG_SRAM=y CONFIG_SRAM_EXEC=y CONFIG_SRCU=y +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y CONFIG_SWPHY=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_TICK_CPU_ACCOUNTING=y From 8746ba3657b2c328ad23a6adcbe5fb6a9e87c490 Mon Sep 17 00:00:00 2001 From: Claudiu Beznea Date: Mon, 11 Oct 2021 11:47:26 +0300 Subject: [PATCH 49/54] at91: add support for sam9x60-ek board Add support for SAM9X60-EK board. Hardware: - SoC: SAM9X60 - RAM: Winbond W972GG6KB-25 (2Gbit DDR2) - NAND Flash: Micron MT29F4G08ABAEA - QSPI Flash: Microchip SST26VF064B - EEPROM: Microchip 24AA02E48 - SDMMC: One standard 4-bit SD card interface - USB: two stacked Type-A connectors with power switches, one micro-B USB device - CAN: 2 interfaces (Microchip MCP2542) - Ethernet: one 10/100Mbps - WiFi/BT: one optional WiFi/Bluetooth interface - Audio: one ClassD port - Display: one 24-bit LCD interface - Camera: one 12-bit image sensor interface - IO: one IO expander (Microchip MCP23008) - Debug ports: one J-Link-OB + CDC, one JTAG interface - Leds: one RGB LED - Buttons: 4 push button switches - Expansion: one PIO connector, one mikrobus connector - Power management: two power regulators, two power consumption measurement devices Flashing: - follow the procedure at [1] [1] https://www.linux4sam.org/bin/view/Linux4SAM/Sam9x60EKMainPage#Create_a_SD_card_with_the_demo Signed-off-by: Claudiu Beznea --- package/boot/at91bootstrap/Makefile | 14 ++++++++++++++ package/boot/uboot-at91/Makefile | 14 ++++++++++++++ target/linux/at91/image/sam9x.mk | 13 +++++++++++-- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/package/boot/at91bootstrap/Makefile b/package/boot/at91bootstrap/Makefile index 8711acd286..2d77f70997 100644 --- a/package/boot/at91bootstrap/Makefile +++ b/package/boot/at91bootstrap/Makefile @@ -40,6 +40,18 @@ define AT91Bootstrap/at91sam9x5eksd_uboot BUILD_DEVICES:=atmel_at91sam9x25ek atmel_at91sam9x35ek endef +define AT91Bootstrap/sam9x60eknf_uboot + NAME:=AT91Bootstrap for SAM9X60-EK board (NandFlash) + BUILD_SUBTARGET:=sam9x + BUILD_DEVICES:=microchip_sam9x60ek +endef + +define AT91Bootstrap/sam9x60eksd_uboot + NAME:=AT91Bootstrap for SAM9X60-EK board (SDcard) + BUILD_SUBTARGET:=sam9x + BUILD_DEVICES:=microchip_sam9x60ek +endef + define AT91Bootstrap/sama5d2_icpdf_qspi_uboot TITLE:=AT91Bootstrap for SAMA5D2 ICP board (QSPI Flash) BUILD_SUBTARGET:=sama5 @@ -145,6 +157,8 @@ endef AT91BOOTSTRAP_TARGETS := \ at91sam9x5eknf_uboot \ at91sam9x5eksd_uboot \ + sam9x60eknf_uboot \ + sam9x60eksd_uboot \ sama5d2_icpdf_qspi_uboot \ sama5d2_icpsd_uboot \ sama5d2_xplaineddf_uboot \ diff --git a/package/boot/uboot-at91/Makefile b/package/boot/uboot-at91/Makefile index 3262da4cbe..ad65247e3e 100644 --- a/package/boot/uboot-at91/Makefile +++ b/package/boot/uboot-at91/Makefile @@ -47,6 +47,18 @@ define U-Boot/at91sam9x5ek_mmc atmel_at91sam9x35ek endef +define U-Boot/sam9x60ek_nandflash + NAME:=SAM9X60-EK board (NandFlash) + BUILD_SUBTARGET:=sam9x + BUILD_DEVICES:=microchip_sam9x60ek +endef + +define U-Boot/sam9x60ek_mmc + NAME:=SAM9X60-EK board (SDcard) + BUILD_SUBTARGET:=sam9x + BUILD_DEVICES:=microchip_sam9x60ek +endef + define U-Boot/sama5d3_xplained_nandflash NAME:=SAMA5D3 Xplained board (NandFlash) BUILD_SUBTARGET:=sama5 @@ -135,6 +147,8 @@ UBOOT_TARGETS := \ at91sam9m10g45ek_nandflash \ at91sam9x5ek_nandflash \ at91sam9x5ek_mmc \ + sam9x60ek_nandflash \ + sam9x60ek_mmc \ sama5d3_xplained_nandflash \ sama5d3_xplained_mmc \ sama5d2_icp_mmc \ diff --git a/target/linux/at91/image/sam9x.mk b/target/linux/at91/image/sam9x.mk index 6f10123bba..b6c5e33ac4 100644 --- a/target/linux/at91/image/sam9x.mk +++ b/target/linux/at91/image/sam9x.mk @@ -16,11 +16,11 @@ define Build/at91-sdcard ::$(DEVICE_NAME)-fit.itb mcopy -i $@.boot \ - $(BIN_DIR)/u-boot-at91sam9x5ek_mmc/u-boot.bin \ + $(BIN_DIR)/u-boot-$(if $(findstring sam9x60,$@),$(DEVICE_DTS:at91-%=%),at91sam9x5ek)_mmc/u-boot.bin \ ::u-boot.bin mcopy -i $@.boot \ - $(BIN_DIR)/at91bootstrap-at91sam9x5eksd_uboot/at91bootstrap.bin \ + $(BIN_DIR)/at91bootstrap-$(if $(findstring sam9x60,$@),$(DEVICE_DTS:at91-%=%),at91sam9x5ek)sd_uboot/at91bootstrap.bin \ ::BOOT.bin $(CP) uboot-env.txt $@-uboot-env.txt @@ -112,6 +112,15 @@ define Device/atmel_at91sam9x35ek endef TARGET_DEVICES += atmel_at91sam9x35ek +define Device/microchip_sam9x60ek + $(Device/evaluation-dtb) + DEVICE_VENDOR := Microchip + DEVICE_MODEL := SAM9X60-EK + DEVICE_DTS := at91-sam9x60ek + $(Device/evaluation-sdimage) +endef +TARGET_DEVICES += microchip_sam9x60ek + define Device/calamp_lmu5000 $(Device/production) DEVICE_VENDOR := CalAmp From a1939e7e3727c771380e23213907a7a71fb2e996 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 24 Oct 2021 19:39:38 +0200 Subject: [PATCH 50/54] kernel: Add extra configuration options These options show up when compiling the at91 target. Signed-off-by: Hauke Mehrtens --- target/linux/generic/config-5.10 | 5 ++++- target/linux/generic/config-5.4 | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index 9809e09b24..69d9ddd0f4 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -3088,6 +3088,7 @@ CONFIG_LZMA_DECOMPRESS=y # CONFIG_MAC80211_MESSAGE_TRACING is not set CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 # CONFIG_MACB is not set +# CONFIG_MACB_USE_HWSTAMP is not set # CONFIG_MACH_ASM9260 is not set # CONFIG_MACH_DECSTATION is not set # CONFIG_MACH_INGENIC is not set @@ -4509,6 +4510,7 @@ CONFIG_PPC_4K_PAGES=y # CONFIG_PPC_DISABLE_WERROR is not set # CONFIG_PPC_EMULATED_STATS is not set # CONFIG_PPC_EPAPR_HV_BYTECHAN is not set +# CONFIG_PPC_QUEUED_SPINLOCKS is not set # CONFIG_PPP is not set # CONFIG_PPPOATM is not set # CONFIG_PPPOE is not set @@ -4526,7 +4528,6 @@ CONFIG_PPP_MULTILINK=y # CONFIG_PPS_CLIENT_LDISC is not set # CONFIG_PPS_CLIENT_PARPORT is not set # CONFIG_PPS_DEBUG is not set -# CONFIG_PPC_QUEUED_SPINLOCKS is not set # CONFIG_PPTP is not set # CONFIG_PREEMPT is not set # CONFIG_PREEMPTIRQ_DELAY_TEST is not set @@ -6793,6 +6794,8 @@ CONFIG_VHOST_MENU=y # CONFIG_VIDEO_AK7375 is not set # CONFIG_VIDEO_AK881X is not set # CONFIG_VIDEO_ASPEED is not set +# CONFIG_VIDEO_ATMEL_ISC is not set +# CONFIG_VIDEO_ATMEL_ISI is not set # CONFIG_VIDEO_AU0828 is not set # CONFIG_VIDEO_BT819 is not set # CONFIG_VIDEO_BT848 is not set diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index e922d23d2c..c44e9cf40b 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -2830,6 +2830,7 @@ CONFIG_LZMA_DECOMPRESS=y # CONFIG_MAC80211_MESSAGE_TRACING is not set CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 # CONFIG_MACB is not set +# CONFIG_MACB_USE_HWSTAMP is not set # CONFIG_MACH_ASM9260 is not set # CONFIG_MACH_DECSTATION is not set # CONFIG_MACH_INGENIC is not set @@ -6307,6 +6308,8 @@ CONFIG_VDSO=y # CONFIG_VIDEO_ADV_DEBUG is not set # CONFIG_VIDEO_AK881X is not set # CONFIG_VIDEO_ASPEED is not set +# CONFIG_VIDEO_ATMEL_ISC is not set +# CONFIG_VIDEO_ATMEL_ISI is not set # CONFIG_VIDEO_BT819 is not set # CONFIG_VIDEO_BT848 is not set # CONFIG_VIDEO_BT856 is not set From abd67de9f0d6470ba48f6df635db29ce91855397 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Wed, 29 Sep 2021 19:27:07 -1000 Subject: [PATCH 51/54] sunxi: switch to Kernel 5.10 Compile tested and run tested on Pine64+. Acked-by: Daniel Golle Acked-by: Hauke Mehrtens Signed-off-by: Paul Spooren --- target/linux/sunxi/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/sunxi/Makefile b/target/linux/sunxi/Makefile index 1f85f9b870..1c94c6eaaf 100644 --- a/target/linux/sunxi/Makefile +++ b/target/linux/sunxi/Makefile @@ -10,8 +10,8 @@ BOARDNAME:=Allwinner A1x/A20/A3x/H3/H5/R40 FEATURES:=fpu usb ext4 display rtc squashfs SUBTARGETS:=cortexa8 cortexa7 cortexa53 -KERNEL_PATCHVER:=5.4 -KERNEL_TESTING_PATCHVER:=5.10 +KERNEL_PATCHVER:=5.10 + KERNELNAME:=zImage dtbs # A10: Cortex-A8 From 269bdf6eefea70e4550e4d4dc8f52e3b018137c4 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 25 Oct 2021 22:57:50 +0200 Subject: [PATCH 52/54] ucode: update to latest Git HEAD 0f022aa lib: increase refcount when returning cached module instance c9e68bb lib: introduce resolver library 9041e24 lib: fix uninitialized memory access on handling %J string formats 4ee06d8 syntax: introduce optional chaining operators ce4a7d9 vm: reset callframes before invoking unhandled exception handler 218e822 vm: clear exception information before calling managed code functions 5b908bd ubus: properly handle signed 64bit values too e43b751 ubus: fix handling signed 16bit and 32bit integers 137428f nl80211: fix issues spotted by static code analyzer b9d4f61 nl80211: treat signal attr values as signed integers 9a7c355 nl80211: expose sta_info attributes bb358d9 lib: introduce Linux 802.11 netlink binding 914f54c types: fix invalid memory access on setting non-contiguous array indexes 631f00d main: fix leaking module name when processing -m flag e55188b compiler: properly handle jumps to offset 0 98c4147 tests: support specifying cmdline args in testcase files 64e4f68 types: fix formatting escape sequences for 8 bit chars dd86e1d rtnl: automatically derive message family from certain address attrs 74fdb97 rtnl: expose IPv4 and IPv6 devconfig information 7fa1008 rtnl: allow reply nla payloads to be smaller than headsize cbae3cb lib: introduce Linux route netlink binding e6dd389 ci: adjust build prereqs for GitHub as well 07ae165 ci: add libnl-tiny to prereqs Signed-off-by: Jo-Philipp Wich --- package/utils/ucode/Makefile | 57 ++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index 26281af730..2c11fe05be 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2021-07-30 -PKG_SOURCE_VERSION:=929c8627cf077c3e348fb12b02553d4a444c5e48 -PKG_MIRROR_HASH:= +PKG_SOURCE_DATE:=2021-10-25 +PKG_SOURCE_VERSION:=a7976c2802a9da737f62bec496c7115211c442a7 +PKG_MIRROR_HASH:=6bc3ddeef41d68fd96894957356472e576c625fcf7277cbb36aa464b8d3c274d PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC @@ -76,6 +76,39 @@ define Package/ucode-mod-math/description endef +define Package/ucode-mod-nl80211 + $(Package/ucode/default) + TITLE+= (nl80211 module) + DEPENDS:=ucode +libnl-tiny +endef + +define Package/ucode-mod-nl80211/description + The nl80211 plugin provides access to the Linux wireless 802.11 netlink API. +endef + + +define Package/ucode-mod-resolv + $(Package/ucode/default) + TITLE+= (resolv module) + DEPENDS:=ucode +endef + +define Package/ucode-mod-resolv/description + The resolv plugin implements simple DNS resolving. +endef + + +define Package/ucode-mod-rtnl + $(Package/ucode/default) + TITLE+= (rtnl module) + DEPENDS:=ucode +libnl-tiny +endef + +define Package/ucode-mod-rtnl/description + The rtnl plugin provides access to the Linux routing netlink API. +endef + + define Package/ucode-mod-ubus $(Package/ucode/default) TITLE+= (ubus module) @@ -126,6 +159,21 @@ define Package/ucode-mod-math/install $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/math.so $(1)/usr/lib/ucode/ endef +define Package/ucode-mod-nl80211/install + $(INSTALL_DIR) $(1)/usr/lib/ucode + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/nl80211.so $(1)/usr/lib/ucode/ +endef + +define Package/ucode-mod-resolv/install + $(INSTALL_DIR) $(1)/usr/lib/ucode + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/resolv.so $(1)/usr/lib/ucode/ +endef + +define Package/ucode-mod-rtnl/install + $(INSTALL_DIR) $(1)/usr/lib/ucode + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/rtnl.so $(1)/usr/lib/ucode/ +endef + define Package/ucode-mod-ubus/install $(INSTALL_DIR) $(1)/usr/lib/ucode $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/ubus.so $(1)/usr/lib/ucode/ @@ -141,5 +189,8 @@ $(eval $(call BuildPackage,ucode)) $(eval $(call BuildPackage,libucode)) $(eval $(call BuildPackage,ucode-mod-fs)) $(eval $(call BuildPackage,ucode-mod-math)) +$(eval $(call BuildPackage,ucode-mod-nl80211)) +$(eval $(call BuildPackage,ucode-mod-resolv)) +$(eval $(call BuildPackage,ucode-mod-rtnl)) $(eval $(call BuildPackage,ucode-mod-ubus)) $(eval $(call BuildPackage,ucode-mod-uci)) From 2c3e8bed3f04f426d676d6352018b33a49a72406 Mon Sep 17 00:00:00 2001 From: Bruno Randolf Date: Mon, 25 Oct 2021 11:38:15 +0100 Subject: [PATCH 53/54] ramips: minew g1-c: Allow dynamic RAM sizes Allow RAM size to be passed thru U-Boot. There are 128MB and 64MB versions of Minew G1-C. This is also in line with the behaviour of most other RAMIPS boards. Signed-off-by: Bruno Randolf --- target/linux/ramips/dts/mt7628an_minew_g1-c.dts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/target/linux/ramips/dts/mt7628an_minew_g1-c.dts b/target/linux/ramips/dts/mt7628an_minew_g1-c.dts index eeee1c25ed..92fbf7c6ae 100644 --- a/target/linux/ramips/dts/mt7628an_minew_g1-c.dts +++ b/target/linux/ramips/dts/mt7628an_minew_g1-c.dts @@ -16,11 +16,6 @@ led-upgrade = &led_system; }; - memory@0 { - device_type = "memory"; - reg = <0x0 0x8000000>; - }; - keys { compatible = "gpio-keys-polled"; poll-interval = <20>; From 70c12d26ca6eb01a938feb38f89720d78df0ca6d Mon Sep 17 00:00:00 2001 From: Peter Geis Date: Mon, 13 Sep 2021 11:08:57 -0400 Subject: [PATCH 54/54] ipq806x: add support for Netgear Nighthawk Pro Gaming XR500 This adds support for the Netgear Nighthawk Pro Gaming XR500. It is the successor to the Netgear Nighthawk R7800 and shares almost identical hardware to that device. The stock firmware is a heavily modified version of OpenWRT. Specifications: SoC: Qualcomm Atheros IPQ8065 RAM: 512 MB Storage: 256 MiB NAND Flash Wireless: 2x Qualcomm Atheros QCA9984 Ethernet: 2x 1000/100/10 dedicated interfaces Switch: 5x 1000/100/10 external ports USB: 2x 3.0 ports More information: Manufacturer page: https://www.netgear.com/gaming/xr500/ Almost identical to Netgear R7800 Differences (r7800 > xr500): Flash: 128MiB > 256MiB Removed esata swapped leds: usb1 (gpio 7 > 8) usb2 (gpio 8 > 26) guest/esata (gpio 26 > 7) MAC addresses: On the OEM firmware, the mac addresses are: WAN: *:50 art 0x6 LAN: *:4f art 0x0 (label) 2G: *:4f art 0x0 5G: *:51 art 0xc Installation: Install via Web Interface (preferred): Utilize openwrt-ipq806x-netgear_xr500-squashfs-factory.img Install via TFTP recovery: 1.Turn off the power, push and hold the reset button (in a hole on backside) with a pin 2.Turn on the power and wait till power led starts flashing white (after it first flashes orange for a while) 3.Release the reset button and tftp the factory img in binary mode. The power led will stop flashing if you succeeded in transferring the image, and the router reboots rather quickly with the new firmware. 4.Try to ping the router (ping 192.168.1.1). If does not respond, then tftp will not work either. Uploading the firmware image with a TFTP client $ tftp 192.168.1.1 bin put openwrt-ipq806x-netgear_xr500-squashfs-factory.img Note: The end of the last partition is at 0xee00000. This was chosen by the initial author, but nobody was able to tell why this particular arbitrary size was chosen. Since it's not leaving too much empty space and it's the only issue left, let's just keep it for now. Based on work by Adam Hnat ref: https://github.com/openwrt/openwrt/pull/3215 Signed-off-by: Peter Geis [squash commits, move common LEDs to DTSI, remove SPDX on old files, minor whitespace cleanup, commit message facelift, add MAC address overview, add Notes, fix MAC addresses, use generic name for partition nodes in DTS] Signed-off-by: Adrian Schmutzler --- .../ipq806x/base-files/etc/board.d/01_leds | 3 +- .../ipq806x/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 8 + .../base-files/lib/upgrade/platform.sh | 1 + .../arm/boot/dts/qcom-ipq8065-nighthawk.dtsi | 439 ++++++++++++++++ .../arch/arm/boot/dts/qcom-ipq8065-r7800.dts | 472 +----------------- .../arch/arm/boot/dts/qcom-ipq8065-xr500.dts | 54 ++ target/linux/ipq806x/image/Makefile | 14 + .../0069-arm-boot-add-dts-files.patch | 3 +- 9 files changed, 546 insertions(+), 449 deletions(-) create mode 100644 target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi create mode 100644 target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-xr500.dts diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds b/target/linux/ipq806x/base-files/etc/board.d/01_leds index 74b94a29b4..097ba0afe1 100644 --- a/target/linux/ipq806x/base-files/etc/board.d/01_leds +++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds @@ -32,7 +32,8 @@ nec,wg2600hp3) netgear,d7800 |\ netgear,r7500 |\ netgear,r7500v2 |\ -netgear,r7800) +netgear,r7800 |\ +netgear,xr500) ucidef_set_led_usbport "usb1" "USB 1" "white:usb1" "usb1-port1" "usb2-port1" ucidef_set_led_usbport "usb2" "USB 2" "white:usb2" "usb3-port1" "usb4-port1" ucidef_set_led_switch "wan" "WAN" "white:wan" "switch0" "0x20" diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network index 1a1cec51aa..bb77332ef9 100644 --- a/target/linux/ipq806x/base-files/etc/board.d/02_network +++ b/target/linux/ipq806x/base-files/etc/board.d/02_network @@ -57,6 +57,7 @@ nec,wg2600hp3) "2:lan" "3:lan" "4:lan" "5:lan" "0@eth1" "1:wan" "6@eth0" ;; netgear,r7800 |\ +netgear,xr500 |\ tplink,c2600) ucidef_add_switch "switch0" \ "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0" diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 8cea017ea4..a1cbe0a8f6 100644 --- a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -48,6 +48,10 @@ case "$FIRMWARE" in caldata_extract "art" 0x1000 0x2f20 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x6) 1) ;; + netgear,xr500) + caldata_extract "art" 0x1000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_binary art 0xc) + ;; tplink,ad7200 |\ tplink,c2600) caldata_extract "radio" 0x1000 0x2f20 @@ -102,6 +106,10 @@ case "$FIRMWARE" in caldata_extract "art" 0x5000 0x2f20 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x6) 2) ;; + netgear,xr500) + caldata_extract "art" 0x5000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_binary art 0x0) + ;; tplink,ad7200 |\ tplink,c2600) caldata_extract "radio" 0x5000 0x2f20 diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh index a5e18201df..308d7017b3 100644 --- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh @@ -16,6 +16,7 @@ platform_do_upgrade() { netgear,r7500 |\ netgear,r7500v2 |\ netgear,r7800 |\ + netgear,xr500 |\ qcom,ipq8064-ap148 |\ qcom,ipq8064-ap161) nand_do_upgrade "$1" diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi new file mode 100644 index 0000000000..a1fde4d698 --- /dev/null +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi @@ -0,0 +1,439 @@ +#include "qcom-ipq8065.dtsi" + +#include + +/ { + memory@0 { + reg = <0x42000000 0x1e000000>; + device_type = "memory"; + }; + + reserved-memory { + rsvd@5fe00000 { + reg = <0x5fe00000 0x200000>; + reusable; + }; + }; + + aliases { + label-mac-device = &gmac2; + + led-boot = &power_white; + led-failsafe = &power_amber; + led-running = &power_white; + led-upgrade = &power_amber; + + mdio-gpio0 = &mdio0; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + wifi { + label = "wifi"; + gpios = <&qcom_pinmux 6 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + wakeup-source; + }; + + reset { + label = "reset"; + gpios = <&qcom_pinmux 54 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + wakeup-source; + }; + + wps { + label = "wps"; + gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + wakeup-source; + }; + }; + + leds: leds { + compatible = "gpio-leds"; + pinctrl-0 = <&led_pins>; + pinctrl-names = "default"; + + power_white: power_white { + label = "white:power"; + gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + + power_amber: power_amber { + label = "amber:power"; + gpios = <&qcom_pinmux 9 GPIO_ACTIVE_HIGH>; + }; + + wan_white { + label = "white:wan"; + gpios = <&qcom_pinmux 22 GPIO_ACTIVE_HIGH>; + }; + + wan_amber { + label = "amber:wan"; + gpios = <&qcom_pinmux 23 GPIO_ACTIVE_HIGH>; + }; + + wifi { + label = "white:wifi"; + gpios = <&qcom_pinmux 64 GPIO_ACTIVE_HIGH>; + }; + + wps { + label = "white:wps"; + gpios = <&qcom_pinmux 24 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&qcom_pinmux { + button_pins: button_pins { + mux { + pins = "gpio6", "gpio54", "gpio65"; + function = "gpio"; + drive-strength = <2>; + bias-pull-up; + }; + }; + + led_pins: led_pins { + mux { + pins = "gpio7", "gpio8", "gpio9", + "gpio22", "gpio23", "gpio24", + "gpio26", "gpio53", "gpio64"; + function = "gpio"; + drive-strength = <2>; + bias-pull-down; + }; + }; + + mdio0_pins: mdio0_pins { + clk { + pins = "gpio1"; + input-disable; + }; + }; + + rgmii2_pins: rgmii2_pins { + tx { + pins = "gpio27", "gpio28", "gpio29", + "gpio30", "gpio31", "gpio32"; + input-disable; + }; + }; + + spi_pins: spi_pins { + mux { + pins = "gpio18", "gpio19", "gpio21"; + function = "gsbi5"; + bias-pull-down; + }; + + data { + pins = "gpio18", "gpio19"; + drive-strength = <10>; + }; + + cs { + pins = "gpio20"; + drive-strength = <10>; + bias-pull-up; + }; + + clk { + pins = "gpio21"; + drive-strength = <12>; + }; + }; + + spi6_pins: spi6_pins { + mux { + pins = "gpio55", "gpio56", "gpio58"; + function = "gsbi6"; + bias-pull-down; + }; + + mosi { + pins = "gpio55"; + drive-strength = <12>; + }; + + miso { + pins = "gpio56"; + drive-strength = <14>; + }; + + cs { + pins = "gpio57"; + drive-strength = <12>; + bias-pull-up; + }; + + clk { + pins = "gpio58"; + drive-strength = <12>; + }; + + reset { + pins = "gpio33"; + drive-strength = <10>; + bias-pull-down; + output-high; + }; + }; + + usb0_pwr_en_pins: usb0_pwr_en_pins { + mux { + pins = "gpio15"; + function = "gpio"; + drive-strength = <12>; + bias-pull-down; + output-high; + }; + }; + + usb1_pwr_en_pins: usb1_pwr_en_pins { + mux { + pins = "gpio16", "gpio68"; + function = "gpio"; + drive-strength = <12>; + bias-pull-down; + output-high; + }; + }; +}; + +&nand_controller { + status = "okay"; + + pinctrl-0 = <&nand_pins>; + pinctrl-names = "default"; + + nand@0 { + reg = <0>; + compatible = "qcom,nandcs"; + + nand-ecc-strength = <4>; + nand-bus-width = <8>; + nand-ecc-step-size = <512>; + + nand-is-boot-medium; + qcom,boot_pages_size = <0x1180000>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "qcadata"; + reg = <0x0000000 0x0c80000>; + read-only; + }; + + partition@c80000 { + label = "APPSBL"; + reg = <0x0c80000 0x0500000>; + read-only; + }; + + partition@1180000 { + label = "APPSBLENV"; + reg = <0x1180000 0x0080000>; + read-only; + }; + + art: partition@1200000 { + label = "art"; + reg = <0x1200000 0x0140000>; + read-only; + }; + + partition@1340000 { + label = "artbak"; + reg = <0x1340000 0x0140000>; + read-only; + }; + + partition@1480000 { + label = "kernel"; + reg = <0x1480000 0x0400000>; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + pinctrl-0 = <&mdio0_pins>; + pinctrl-names = "default"; + + phy0: ethernet-phy@0 { + reg = <0>; + qca,ar8327-initvals = < + 0x00004 0x7600000 /* PAD0_MODE */ + 0x00008 0x1000000 /* PAD5_MODE */ + 0x0000c 0x80 /* PAD6_MODE */ + 0x000e4 0xaa545 /* MAC_POWER_SEL */ + 0x000e0 0xc74164de /* SGMII_CTRL */ + 0x0007c 0x4e /* PORT0_STATUS */ + 0x00094 0x4e /* PORT6_STATUS */ + 0x00970 0x1e864443 /* QM_PORT0_CTRL0 */ + 0x00974 0x000001c6 /* QM_PORT0_CTRL1 */ + 0x00978 0x19008643 /* QM_PORT1_CTRL0 */ + 0x0097c 0x000001c6 /* QM_PORT1_CTRL1 */ + 0x00980 0x19008643 /* QM_PORT2_CTRL0 */ + 0x00984 0x000001c6 /* QM_PORT2_CTRL1 */ + 0x00988 0x19008643 /* QM_PORT3_CTRL0 */ + 0x0098c 0x000001c6 /* QM_PORT3_CTRL1 */ + 0x00990 0x19008643 /* QM_PORT4_CTRL0 */ + 0x00994 0x000001c6 /* QM_PORT4_CTRL1 */ + 0x00998 0x1e864443 /* QM_PORT5_CTRL0 */ + 0x0099c 0x000001c6 /* QM_PORT5_CTRL1 */ + 0x009a0 0x1e864443 /* QM_PORT6_CTRL0 */ + 0x009a4 0x000001c6 /* QM_PORT6_CTRL1 */ + >; + qca,ar8327-vlans = < + 0x1 0x5e /* VLAN1 Ports 1/2/3/4/6 */ + 0x2 0x21 /* VLAN2 Ports 0/5 */ + >; + }; + + phy4: ethernet-phy@4 { + reg = <4>; + qca,ar8327-initvals = < + 0x000e4 0x6a545 /* MAC_POWER_SEL */ + 0x0000c 0x80 /* PAD6_MODE */ + >; + }; +}; + +&gmac1 { + status = "okay"; + + phy-mode = "rgmii"; + qcom,id = <1>; + qcom,phy_mdio_addr = <4>; + qcom,poll_required = <0>; + qcom,rgmii_delay = <1>; + qcom,phy_mii_type = <0>; + qcom,emulation = <0>; + qcom,irq = <255>; + mdiobus = <&mdio0>; + + pinctrl-0 = <&rgmii2_pins>; + pinctrl-names = "default"; + + nvmem-cells = <&macaddr_art_6>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&gmac2 { + status = "okay"; + + phy-mode = "sgmii"; + qcom,id = <2>; + qcom,phy_mdio_addr = <0>; /* none */ + qcom,poll_required = <0>; /* no polling */ + qcom,rgmii_delay = <0>; + qcom,phy_mii_type = <1>; + qcom,emulation = <0>; + qcom,irq = <258>; + mdiobus = <&mdio0>; + + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&adm_dma { + status = "okay"; +}; + +&sata_phy { + status = "okay"; +}; + +&sata { + status = "okay"; +}; + +&usb3_0 { + status = "okay"; + + pinctrl-0 = <&usb0_pwr_en_pins>; + pinctrl-names = "default"; +}; + +&usb3_1 { + status = "okay"; + + pinctrl-0 = <&usb1_pwr_en_pins>; + pinctrl-names = "default"; +}; + +&pcie0 { + status = "okay"; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi0: wifi@1,0 { + compatible = "pci168c,0046"; + reg = <0x00010000 0 0 0 0>; + }; + }; +}; + +&pcie1 { + status = "okay"; + + max-link-speed = <1>; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi1: wifi@1,0 { + compatible = "pci168c,0046"; + reg = <0x00010000 0 0 0 0>; + }; + }; +}; + +&art { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_art_6: macaddr@6 { + reg = <0x6 0x6>; + }; +}; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-r7800.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-r7800.dts index b12e348145..48beaf313e 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-r7800.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-r7800.dts @@ -1,470 +1,48 @@ -#include "qcom-ipq8065.dtsi" - -#include +#include "qcom-ipq8065-nighthawk.dtsi" / { model = "Netgear Nighthawk X4S R7800"; compatible = "netgear,r7800", "qcom,ipq8065", "qcom,ipq8064"; +}; - memory@0 { - reg = <0x42000000 0x1e000000>; - device_type = "memory"; +&leds { + usb1 { + label = "white:usb1"; + gpios = <&qcom_pinmux 7 GPIO_ACTIVE_HIGH>; }; - reserved-memory { - rsvd@5fe00000 { - reg = <0x5fe00000 0x200000>; - reusable; - }; + usb2 { + label = "white:usb2"; + gpios = <&qcom_pinmux 8 GPIO_ACTIVE_HIGH>; }; - aliases { - mdio-gpio0 = &mdio0; - - led-boot = &power_white; - led-failsafe = &power_amber; - led-running = &power_white; - led-upgrade = &power_amber; - label-mac-device = &gmac2; - }; - - keys { - compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; - - wifi { - label = "wifi"; - gpios = <&qcom_pinmux 6 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - wakeup-source; - }; - - reset { - label = "reset"; - gpios = <&qcom_pinmux 54 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - wakeup-source; - }; - - wps { - label = "wps"; - gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - wakeup-source; - }; - }; - - leds { - compatible = "gpio-leds"; - pinctrl-0 = <&led_pins>; - pinctrl-names = "default"; - - power_white: power_white { - label = "white:power"; - gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - - power_amber: power_amber { - label = "amber:power"; - gpios = <&qcom_pinmux 9 GPIO_ACTIVE_HIGH>; - }; - - wan_white { - label = "white:wan"; - gpios = <&qcom_pinmux 22 GPIO_ACTIVE_HIGH>; - }; - - wan_amber { - label = "amber:wan"; - gpios = <&qcom_pinmux 23 GPIO_ACTIVE_HIGH>; - }; - - usb1 { - label = "white:usb1"; - gpios = <&qcom_pinmux 7 GPIO_ACTIVE_HIGH>; - }; - - usb2 { - label = "white:usb2"; - gpios = <&qcom_pinmux 8 GPIO_ACTIVE_HIGH>; - }; - - esata { - label = "white:esata"; - gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>; - }; - - wifi { - label = "white:wifi"; - gpios = <&qcom_pinmux 64 GPIO_ACTIVE_HIGH>; - }; - - wps { - label = "white:wps"; - gpios = <&qcom_pinmux 24 GPIO_ACTIVE_HIGH>; - }; + esata { + label = "white:esata"; + gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>; }; }; -&qcom_pinmux { - button_pins: button_pins { - mux { - pins = "gpio6", "gpio54", "gpio65"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; +&partitions { + partition@1880000 { + label = "ubi"; + reg = <0x1880000 0x6080000>; }; - led_pins: led_pins { - mux { - pins = "gpio7", "gpio8", "gpio9", "gpio22", "gpio23", - "gpio24","gpio26", "gpio53", "gpio64"; - function = "gpio"; - drive-strength = <2>; - bias-pull-down; - }; - }; - - mdio0_pins: mdio0_pins { - clk { - pins = "gpio1"; - input-disable; - }; - }; - - rgmii2_pins: rgmii2_pins { - tx { - pins = "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32" ; - input-disable; - }; - }; - - spi_pins: spi_pins { - mux { - pins = "gpio18", "gpio19", "gpio21"; - function = "gsbi5"; - bias-pull-down; - }; - - data { - pins = "gpio18", "gpio19"; - drive-strength = <10>; - }; - - cs { - pins = "gpio20"; - drive-strength = <10>; - bias-pull-up; - }; - - clk { - pins = "gpio21"; - drive-strength = <12>; - }; - }; - - spi6_pins: spi6_pins { - mux { - pins = "gpio55", "gpio56", "gpio58"; - function = "gsbi6"; - bias-pull-down; - }; - - mosi { - pins = "gpio55"; - drive-strength = <12>; - }; - - miso { - pins = "gpio56"; - drive-strength = <14>; - }; - - cs { - pins = "gpio57"; - drive-strength = <12>; - bias-pull-up; - }; - - clk { - pins = "gpio58"; - drive-strength = <12>; - }; - - reset { - pins = "gpio33"; - drive-strength = <10>; - bias-pull-down; - output-high; - }; - }; - - usb0_pwr_en_pins: usb0_pwr_en_pins { - mux { - pins = "gpio15"; - function = "gpio"; - drive-strength = <12>; - bias-pull-down; - output-high; - }; - }; - - usb1_pwr_en_pins: usb1_pwr_en_pins { - mux { - pins = "gpio16", "gpio68"; - function = "gpio"; - drive-strength = <12>; - bias-pull-down; - output-high; - }; + partition@7900000 { + label = "reserve"; + reg = <0x7900000 0x0700000>; + read-only; }; }; -&nand_controller { - status = "okay"; - - pinctrl-0 = <&nand_pins>; - pinctrl-names = "default"; - - nand@0 { - reg = <0>; - compatible = "qcom,nandcs"; - - nand-ecc-strength = <4>; - nand-bus-width = <8>; - nand-ecc-step-size = <512>; - - nand-is-boot-medium; - qcom,boot_pages_size = <0x1180000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - qcadata@0 { - label = "qcadata"; - reg = <0x0000000 0x0c80000>; - read-only; - }; - - APPSBL@c80000 { - label = "APPSBL"; - reg = <0x0c80000 0x0500000>; - read-only; - }; - - APPSBLENV@1180000 { - label = "APPSBLENV"; - reg = <0x1180000 0x0080000>; - read-only; - }; - - art: art@1200000 { - label = "art"; - reg = <0x1200000 0x0140000>; - read-only; - }; - - artbak: art@1340000 { - label = "artbak"; - reg = <0x1340000 0x0140000>; - read-only; - }; - - kernel@1480000 { - label = "kernel"; - reg = <0x1480000 0x0400000>; - }; - - ubi@1880000 { - label = "ubi"; - reg = <0x1880000 0x6080000>; - }; - - reserve@7900000 { - label = "reserve"; - reg = <0x7900000 0x0700000>; - read-only; - }; - }; - }; -}; - -&mdio0 { - status = "okay"; - - pinctrl-0 = <&mdio0_pins>; - pinctrl-names = "default"; - - phy0: ethernet-phy@0 { - reg = <0>; - qca,ar8327-initvals = < - 0x00004 0x7600000 /* PAD0_MODE */ - 0x00008 0x1000000 /* PAD5_MODE */ - 0x0000c 0x80 /* PAD6_MODE */ - 0x000e4 0xaa545 /* MAC_POWER_SEL */ - 0x000e0 0xc74164de /* SGMII_CTRL */ - 0x0007c 0x4e /* PORT0_STATUS */ - 0x00094 0x4e /* PORT6_STATUS */ - 0x00970 0x1e864443 /* QM_PORT0_CTRL0 */ - 0x00974 0x000001c6 /* QM_PORT0_CTRL1 */ - 0x00978 0x19008643 /* QM_PORT1_CTRL0 */ - 0x0097c 0x000001c6 /* QM_PORT1_CTRL1 */ - 0x00980 0x19008643 /* QM_PORT2_CTRL0 */ - 0x00984 0x000001c6 /* QM_PORT2_CTRL1 */ - 0x00988 0x19008643 /* QM_PORT3_CTRL0 */ - 0x0098c 0x000001c6 /* QM_PORT3_CTRL1 */ - 0x00990 0x19008643 /* QM_PORT4_CTRL0 */ - 0x00994 0x000001c6 /* QM_PORT4_CTRL1 */ - 0x00998 0x1e864443 /* QM_PORT5_CTRL0 */ - 0x0099c 0x000001c6 /* QM_PORT5_CTRL1 */ - 0x009a0 0x1e864443 /* QM_PORT6_CTRL0 */ - 0x009a4 0x000001c6 /* QM_PORT6_CTRL1 */ - >; - qca,ar8327-vlans = < - 0x1 0x5e /* VLAN1 Ports 1/2/3/4/6 */ - 0x2 0x21 /* VLAN2 Ports 0/5 */ - >; - }; - - phy4: ethernet-phy@4 { - reg = <4>; - qca,ar8327-initvals = < - 0x000e4 0x6a545 /* MAC_POWER_SEL */ - 0x0000c 0x80 /* PAD6_MODE */ - >; - }; -}; - -&gmac1 { - status = "okay"; - phy-mode = "rgmii"; - qcom,id = <1>; - qcom,phy_mdio_addr = <4>; - qcom,poll_required = <0>; - qcom,rgmii_delay = <1>; - qcom,phy_mii_type = <0>; - qcom,emulation = <0>; - qcom,irq = <255>; - mdiobus = <&mdio0>; - - pinctrl-0 = <&rgmii2_pins>; - pinctrl-names = "default"; - +&wifi0 { nvmem-cells = <&macaddr_art_6>; nvmem-cell-names = "mac-address"; - - fixed-link { - speed = <1000>; - full-duplex; - }; + mac-address-increment = <(1)>; }; -&gmac2 { - status = "okay"; - phy-mode = "sgmii"; - qcom,id = <2>; - qcom,phy_mdio_addr = <0>; /* none */ - qcom,poll_required = <0>; /* no polling */ - qcom,rgmii_delay = <0>; - qcom,phy_mii_type = <1>; - qcom,emulation = <0>; - qcom,irq = <258>; - mdiobus = <&mdio0>; - - nvmem-cells = <&macaddr_art_0>; +&wifi1 { + nvmem-cells = <&macaddr_art_6>; nvmem-cell-names = "mac-address"; - - fixed-link { - speed = <1000>; - full-duplex; - }; -}; - -&adm_dma { - status = "okay"; -}; - -&sata_phy { - status = "okay"; -}; - -&sata { - status = "okay"; -}; - -&usb3_0 { - status = "okay"; - - pinctrl-0 = <&usb0_pwr_en_pins>; - pinctrl-names = "default"; -}; - -&usb3_1 { - status = "okay"; - - pinctrl-0 = <&usb1_pwr_en_pins>; - pinctrl-names = "default"; -}; - -&pcie0 { - status = "okay"; - - bridge@0,0 { - reg = <0x00000000 0 0 0 0>; - #address-cells = <3>; - #size-cells = <2>; - ranges; - - wifi@1,0 { - compatible = "pci168c,0046"; - reg = <0x00010000 0 0 0 0>; - - nvmem-cells = <&macaddr_art_6>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <(1)>; - }; - }; -}; - -&pcie1 { - status = "okay"; - max-link-speed = <1>; - - bridge@0,0 { - reg = <0x00000000 0 0 0 0>; - #address-cells = <3>; - #size-cells = <2>; - ranges; - - wifi@1,0 { - compatible = "pci168c,0046"; - reg = <0x00010000 0 0 0 0>; - - nvmem-cells = <&macaddr_art_6>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <(2)>; - }; - }; -}; - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_0: macaddr@0 { - reg = <0x0 0x6>; - }; - - macaddr_art_6: macaddr@6 { - reg = <0x6 0x6>; - }; + mac-address-increment = <(2)>; }; diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-xr500.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-xr500.dts new file mode 100644 index 0000000000..b7f00a7a6f --- /dev/null +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-xr500.dts @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq8065-nighthawk.dtsi" + +/ { + model = "Netgear Nighthawk XR500"; + compatible = "netgear,xr500", "qcom,ipq8065", "qcom,ipq8064"; + +}; + +&leds { + usb1 { + label = "white:usb1"; + gpios = <&qcom_pinmux 8 GPIO_ACTIVE_HIGH>; + }; + + usb2 { + label = "white:usb2"; + gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>; + }; +}; + +&partitions { + partition@1880000 { + label = "ubi"; + reg = <0x1880000 0xce00000>; + }; + + partition@e680000 { + label = "reserve"; + reg = <0xe680000 0x0780000>; + read-only; + }; +}; + +&wifi0 { + nvmem-cells = <&macaddr_art_c>; + nvmem-cell-names = "mac-address"; +}; + +&wifi1 { + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; +}; + +&art { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_c: macaddr@c { + reg = <0xc 0x6>; + }; +}; diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile index 93e7ba3151..acb95347bf 100644 --- a/target/linux/ipq806x/image/Makefile +++ b/target/linux/ipq806x/image/Makefile @@ -284,6 +284,20 @@ define Device/netgear_r7800 endef TARGET_DEVICES += netgear_r7800 +define Device/netgear_xr500 + $(call Device/DniImage) + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := Nighthawk XR500 + SOC := qcom-ipq8065 + KERNEL_SIZE := 4096k + NETGEAR_BOARD_ID := XR500 + NETGEAR_HW_ID := 29764958+0+256+512+4x4+4x4+cascade + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct +endef +TARGET_DEVICES += netgear_xr500 + define Device/qcom_ipq8064-ap148 $(call Device/FitImage) $(call Device/UbiFit) diff --git a/target/linux/ipq806x/patches-5.10/0069-arm-boot-add-dts-files.patch b/target/linux/ipq806x/patches-5.10/0069-arm-boot-add-dts-files.patch index 87d6b65694..ca43a759ef 100644 --- a/target/linux/ipq806x/patches-5.10/0069-arm-boot-add-dts-files.patch +++ b/target/linux/ipq806x/patches-5.10/0069-arm-boot-add-dts-files.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -907,8 +907,26 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -907,8 +907,27 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-ipq4019-ap.dk04.1-c3.dtb \ qcom-ipq4019-ap.dk07.1-c1.dtb \ qcom-ipq4019-ap.dk07.1-c2.dtb \ @@ -33,6 +33,7 @@ Signed-off-by: John Crispin + qcom-ipq8065-nbg6817.dtb \ + qcom-ipq8065-r7800.dtb \ + qcom-ipq8065-rt4230w-rev6.dtb \ ++ qcom-ipq8065-xr500.dtb \ + qcom-ipq8068-ecw5410.dtb \ qcom-msm8660-surf.dtb \ qcom-msm8960-cdp.dtb \