From de00033bbb8a5ef800f81e37644b723afae0fc1b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 11 Apr 2021 19:41:56 +0200 Subject: [PATCH 1/4] mac80211: support rx timestamps for HE rates Signed-off-by: Felix Fietkau (cherry-picked from commit 7d8e14e44f76e18d1696565569ec50ccdce963b3) --- ...-Rx-timestamp-calculation-for-all-pr.patch | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 package/kernel/mac80211/patches/subsys/373-mac80211-support-Rx-timestamp-calculation-for-all-pr.patch 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 new file mode 100644 index 0000000000..c432d77b2e --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/373-mac80211-support-Rx-timestamp-calculation-for-all-pr.patch @@ -0,0 +1,134 @@ +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 +@@ -1600,13 +1600,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; From 4ad1957eee084166a7dcdd265570c9fa2ffb1acd Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 11 Apr 2021 19:42:14 +0200 Subject: [PATCH 2/4] mac80211: add client mode connection monitor fix Signed-off-by: Felix Fietkau (cherry-picked from commit dfdb28c24aa60cf057ec45cbc11ab48ba2655f53) --- ...c80211-fix-time-is-after-bug-in-mlme.patch | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 package/kernel/mac80211/patches/subsys/374-mac80211-fix-time-is-after-bug-in-mlme.patch diff --git a/package/kernel/mac80211/patches/subsys/374-mac80211-fix-time-is-after-bug-in-mlme.patch b/package/kernel/mac80211/patches/subsys/374-mac80211-fix-time-is-after-bug-in-mlme.patch new file mode 100644 index 0000000000..0573aece64 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/374-mac80211-fix-time-is-after-bug-in-mlme.patch @@ -0,0 +1,31 @@ +From: Ben Greear +Date: Tue, 30 Mar 2021 16:07:49 -0700 +Subject: [PATCH] mac80211: fix time-is-after bug in mlme + +The incorrect timeout check caused probing to happen when it did +not need to happen. This in turn caused tx performance drop +for around 5 seconds in ath10k-ct driver. Possibly that tx drop +is due to a secondary issue, but fixing the probe to not happen +when traffic is running fixes the symptom. + +Signed-off-by: Ben Greear +Fixes: 9abf4e49830d ("mac80211: optimize station connection monitor") +Acked-by: Felix Fietkau +Link: https://lore.kernel.org/r/20210330230749.14097-1-greearb@candelatech.com +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/mlme.c ++++ b/net/mac80211/mlme.c +@@ -4691,7 +4691,10 @@ static void ieee80211_sta_conn_mon_timer + timeout = sta->rx_stats.last_rx; + timeout += IEEE80211_CONNECTION_IDLE_TIME; + +- if (time_is_before_jiffies(timeout)) { ++ /* If timeout is after now, then update timer to fire at ++ * the later date, but do not actually probe at this time. ++ */ ++ if (time_is_after_jiffies(timeout)) { + mod_timer(&ifmgd->conn_mon_timer, round_jiffies_up(timeout)); + return; + } From 04b22754d7f9d228468984d963d0f4b479d8ecdb Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 15 Mar 2021 00:10:03 +0100 Subject: [PATCH 3/4] mt76: update to the latest version 6a3cf95733e2 mt76: fix tx skb error handling in mt76_dma_tx_queue_skb ab9045153343 mt76: mt7915: only modify tx buffer list after allocating tx token id 7e1eff676257 mt76: mt7915: fix unused 'mode' variable 8a2e22fcbf69 mt76: mt7921: fix suspend/resume sequence 27a54e8b687f mt76: mt7921: fix memory leak in mt7921_coredump_work c267322f0bdb mt76: mt7921: switch to new api for hardware beacon filter [v2 update] fd2c59d9ba46 mt76: mt7921: fixup rx bitrate statistics [v2 update] bfa8d5a6a9a1 mt76: adjust to upstream API for enabling threaded NAPI 1706fb6c48e8 mt76: mt7663s: fix rx buffer refcounting c5aca6692c41 mt76: mt7615: enable hw rx-amsdu de-aggregation 9002b0b30aed mt76: mt7615: add rx checksum offload support 8e3f5bfe74f6 mt76: mt7615: add support for rx decapsulation offload 8e3bba8bd3ef mt76: mt7615: fix memory leak in mt7615_coredump_work 760adce29100 mt76: mt7921: fix aggr length histogram 84229a51845a mt76: mt7915: fix aggr len debugfs node 10a95da23cb7 mt76: mt7921: remove unneeded semicolon 2856dc8fb57e mt76: mt7921: fix stats register definitions 1b245e57549d mt76: mt7615: fix TSF configuration 1a2e2965b62b mt76: mt7615: remove hdr->fw_ver check f60ec1b9473d mt76: mt7615: fix mib stats counter reporting to mac80211 8a5b036af48f mt76: mt7915: fix mib stats counter reporting to mac80211 ee6dbcc64f6d mt76: connac: fix kernel warning adding monitor interface e46dd240ce72 mt76: check return value of mt76_txq_send_burst in mt76_txq_schedule_list ddf95ead3bb3 mt76: mt7921: get rid of mt7921_sta_rc_update routine fd2a51ea9dc8 mt76: mt7921: fix the base of PCIe interrupt 28f53d074bb0 mt76: mt7921: fix the base of the dynamic remap 8d737632b57f mt76: mt7921: check mcu returned values in mt7921_start 5ff25c915e62 mt76: mt7915: add missing capabilities for DBDC 58dd3f26c099 mt76: mt7615: fix CSA notification for DBDC 76f4959107ac mt76: mt7615: stop ext_phy queue when mac reset happens 7de0a0654054 mt76: mt7915: fix CSA notification for DBDC e9e418fc7eb0 mt76: mt7915: stop ext_phy queue when mac reset happens 477b78301879 mt76: mt7915: fix PHY mode for DBDC 37b4dc0f7595 mt76: mt76x0u: Add support for TP-Link T2UHP(UN) v1 29a04583aecb mt76: mt7915: fix rxrate reporting a4307e6ba054 mt76: mt7915: fix txrate reporting 256f324f8fcd mt76: mt7915: check mcu returned values in mt7915_ops 638b112188a5 mt76: mt7615: check mcu returned values in mt7615_ops 975cccfa96da mt76: mt7663: fix when beacon filter is being applied aafe972e95b2 mt76: mt7663s: make all of packets 4-bytes aligned in sdio tx aggregation 0d5b1a702715 mt76: mt7663s: fix the possible device hang in high traffic 00628061b546 mt76: mt7615: add missing capabilities for DBDC 2303e1844afd mt76: mt7915: fix possible deadlock while mt7915_register_ext_phy() 6e2b9d258306 mt76: mt7921: reduce mcu timeouts for suspend, offload and hif_ctrl msg 3cf5afc02955 mt76: introduce mcu_reset function pointer in mt76_mcu_ops structure 9af9622df549 mt76: mt7921: introduce mt7921_run_firmware utility routine. e12c44a7e165 mt76: mt7921: introduce __mt7921_start utility routine 7b56d5bf6ea0 mt76: dma: introduce mt76_dma_queue_reset routine a80e50098b51 mt76: dma: export mt76_dma_rx_cleanup routine e0708e296e27 mt76: mt7921: add wifi reset support 87e09e8482cf mt76: mt7921: remove leftovers from dbdc configuration cc933b3669f7 mt76: mt7921: remove redundant check on type ca22cc221ae7 linux-firmware: add firmware for MT7921 0b6c9a043f78 mt76: move de-amsdu buffer per-phy 48a905e23791 mt76: mt7615: fix CSA event format fbef8bba038f mt76: mt7921: remove duplicated macros in mcu.h 6886b57a1534 mt76: connac: introcuce mt76_sta_cmd_info data structure e529e8afe22a mt76: mt7921: properly configure rcpi adding a sta to the fw e4d522776804 mt76: mt7921: fix airtime reporting be2f67e8d3cb mt76: mt7915: fix key set/delete issue 09a1befde4b7 mt76: fix potential DMA mapping leak f66f8f41d47b mt76: mt7915: refresh repeater entry MAC address when setting BSSID 035e2f6f1ddf mt76: mt7921: get rid of mt7921_mac_wtbl_lmac_addr ee29cd5f3a6a mt76: mt7615: only enable DFS test knobs for mt7615 9a98b1a6f9c2 mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset() 3bd285424e7b mt76: mt7622: trigger hif interrupt for system reset bf6d9ee4acd1 mt76: mt7615: keep mcu_add_bss_info enabled till interface removal 115b74282314 mt76: mt7915: keep mcu_add_bss_info enabled till interface removal 57432e701d1a mt76: mt7915: cleanup mcu tx queue in mt7915_dma_reset() a519c49a6a42 mt76: mt7615: 0-terminate firmware log messages 4a22f2ffae2e mt76: mt7915: 0-terminate firmware log messages b8609066893a mt76: mt7615: fix chip reset on MT7622 and MT7663e 465dda65ee84 mt7615,mt7915: replace fw log 0-terminating code with wiphy info length limit 62b13f5352b8 mt76: mt7921: fix key set/delete issue 0ff3a336a8d8 mt7615,mt7915: fix a compiler warning 113ba8a81d54 mt76: mt7615: remove redundant dev_err call in mt7622_wmac_probe() be1ab3b9ae7c mt76: mt7921: fix typo in mt7921_pci_resume 4e22f0dc934b mt76: mt7915: fix txpower init for TSSI off chips e66a0b9b8d66 mt76: mt7615: always wake the device in mt7615_remove_interface 38f656768a90 mt76: mt7921: always wake the device in mt7921_remove_interface 6ee4770de083 mt76: mt7921: rework mt7921_mcu_debug_msg_event routine e578b4b8d56a mt76: mt7615: fix .add_beacon_offload() f8c6c7cbf10f mt76: mt7915: fix mt7915_mcu_add_beacon 7d35b7a15d1d mt76: mt7915: add wifi subsystem reset 04122c89749d mt76: fix rx amsdu subframe processing 5e764ec9bece mt76: mt7921: introduce MT_WFDMA_DUMMY_CR definition cf0badbc0497 mt76: mt7921: fix inappropriate WoW setup with the missing ARP informaiton f32a4e15f5b2 mt76: mt7921: fix the dwell time control 54f52771a04a mt76: mt7921: fix kernel crash when the firmware fails to download 97189d2a045b mt76: mt7921: fix the insmod hangs dcdbd7c89cf5 mt76: mt7921: fix MT_PCIE_MAC_INT_ENABLE access 813db729c02f mt76: mt7921: reduce the data latency during hw scan 028b7152b1a9 mt76: mt7921: remove 80+80 MHz support capabilities 7714dc914df6 mt76: report Rx timestamp ffd4cf15fa0e mt76: mt7915: add mmio.c fe8717dd573a mt76: mt7615: add missing SPDX tag in mmio.c 6b293c411d22 mt76: mt7615: always add rx header translation tlv when adding stations bf45b30d8919 add missing file Signed-off-by: Felix Fietkau (cherry-picked from commit 8cc013981d2a017a4604e696e4ec19c846f2c230) --- package/kernel/mt76/Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 45375ef564..e9e95fa9b3 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-02-14 -PKG_SOURCE_VERSION:=289cd7804587dc48f776d450db9cd3762692a370 -PKG_MIRROR_HASH:=91885feca9d935586c6e33a8e3734bfa61991d869bf42ac0d1c8c3b19bfa9653 +PKG_SOURCE_DATE:=2021-04-11 +PKG_SOURCE_VERSION:=bf45b30d891961dd7c4139dddb58b909ea2c2b5a +PKG_MIRROR_HASH:=431cecf80dafa986e805f809522721c2bb26289867d6770695d49baf8b471bea PKG_MAINTAINER:=Felix Fietkau PKG_BUILD_PARALLEL:=1 @@ -407,6 +407,14 @@ define KernelPackage/mt7915e/install $(1)/lib/firmware/mediatek endef +define KernelPackage/mt7921e/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + cp \ + $(PKG_BUILD_DIR)/firmware/WIFI_MT7961_patch_mcu_1_2_hdr.bin \ + $(PKG_BUILD_DIR)/firmware/WIFI_RAM_CODE_MT7961_1.bin \ + $(1)/lib/firmware/mediatek +endef + define Package/mt76-test/install mkdir -p $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mt76-test $(1)/usr/sbin From 121f2461e5d46c72ed5599d5ae4e940859228352 Mon Sep 17 00:00:00 2001 From: Koen Vandeputte Date: Mon, 12 Apr 2021 13:15:18 +0200 Subject: [PATCH 4/4] ath79: mikrotik: enable 2nd USB on RouterBOARD 922UAGS-5HPacD RB922 boards have 2 separate USB controllers: - 1 is connected to Slot Type A - 1 is connected to the mini PCIe port Enable the 2nd one too. Before: [ 5.339304] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 5.355053] SCSI subsystem initialized [ 5.364184] ehci-fsl: Freescale EHCI Host controller driver [ 5.372377] ehci-platform: EHCI generic platform driver [ 5.378053] ehci-platform 1b000000.usb: EHCI Host Controller [ 5.383861] ehci-platform 1b000000.usb: new USB bus registered, assigned bus number 1 [ 5.391932] ehci-platform 1b000000.usb: irq 14, io mem 0x1b000000 [ 5.410730] ehci-platform 1b000000.usb: USB 2.0 started, EHCI 1.00 [ 5.417739] hub 1-0:1.0: USB hub found [ 5.422280] hub 1-0:1.0: 1 port detected [ 5.434007] usbcore: registered new interface driver usb-storage After: [ 5.342988] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 5.358687] SCSI subsystem initialized [ 5.367813] ehci-fsl: Freescale EHCI Host controller driver [ 5.375998] ehci-platform: EHCI generic platform driver [ 5.381695] ehci-platform 1b000000.usb: EHCI Host Controller [ 5.387507] ehci-platform 1b000000.usb: new USB bus registered, assigned bus number 1 [ 5.395571] ehci-platform 1b000000.usb: irq 14, io mem 0x1b000000 [ 5.416050] ehci-platform 1b000000.usb: USB 2.0 started, EHCI 1.00 [ 5.423089] hub 1-0:1.0: USB hub found [ 5.427578] hub 1-0:1.0: 1 port detected [ 5.432432] ehci-platform 1b400000.usb: EHCI Host Controller [ 5.438254] ehci-platform 1b400000.usb: new USB bus registered, assigned bus number 2 [ 5.446325] ehci-platform 1b400000.usb: irq 15, io mem 0x1b400000 [ 5.468049] ehci-platform 1b400000.usb: USB 2.0 started, EHCI 1.00 [ 5.475082] hub 2-0:1.0: USB hub found [ 5.479574] hub 2-0:1.0: 1 port detected [ 5.491305] usbcore: registered new interface driver usb-storage Fixes: 8f93c05a59 ("ath79: add support for MikroTik RouterBOARD 922UAGS-5HPacD") Signed-off-by: Koen Vandeputte (cherry picked from commit 172fa3bc7544ce940ce724d682d66109a3e14a11) --- .../dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts index 34cc35735f..8ad834fe61 100644 --- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts @@ -47,3 +47,11 @@ &usb_phy0 { status = "okay"; }; + +&usb1 { + status = "okay"; +}; + +&usb_phy1 { + status = "okay"; +};