Commit Graph
100 Commits
Author SHA1 Message Date
Ryder LeeandFelix Fietkau f4df423d3d wifi: mt76: add ability to explicitly forbid LED registration with DT
Add ability to explicitly forbid LED registration using DT led\status = "disabled".

Tested-by: Alexey D. Filimonov <[email protected]>
Signed-off-by: Alexey D. Filimonov <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:11:33 +01:00
Ryder LeeandFelix Fietkau 325a0c4931 wifi: mt76: mt7996: fill txd by host driver
The hardware SDO has issue to fill txd for the moment, so fallback to
driver filling method.

Fixes: 98686cd21624 (wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices)
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:51 +02:00
Ryder LeeandFelix Fietkau 24a54ee3a5 wifi: mt76: mt7915: fix power-limits while chan_switch
If user changes the channel without completely disabling the interface the
txpower_sku values reported track the old channel the device was operating on.
If user bounces the interface the correct power tables are applied.

mt7915_sku_group_len array gets updated before the channel switch happens so it
uses data from the old channel.

Fixes: ecb187a74e18 ("mt76: mt7915: rework the flow of txpower setting")
Fixes: f1d962369d56 ("mt76: mt7915: implement HE per-rate tx power support")
Reported-By: Chad Monroe <[email protected]>
Tested-by: Chad Monroe <[email protected]>
Signed-off-by: Allen Ye <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-07-31 10:55:33 +02:00
Ryder LeeandFelix Fietkau 1f0fbbee35 wifi: mt76: mt7915: fix tlv length of mt7915_mcu_get_chan_mib_info
Correct per-device TLV lengths to avoid invalid operation in firmware.
(  64.040375:28:STATS-E)statsGetSingleHWCounter: MIB counter index = 65472 not supported.
This happens on mt7916/mt7986.

Fixes: b0bfa00595be ("wifi: mt76: mt7915: improve accuracy of time_busy calculation")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-07-31 10:55:23 +02:00
Ryder LeeandFelix Fietkau e48235308b wifi: mt76: mt7915: accumulate mu-mimo ofdma muru stats
The stats are clear-on-read, which makes it very difficult for tools
to adequately deal with wrapped stats and with keeping good totals.

So, accumulate these values when they are read from the firmware/radio
and present totals to user-space.

Signed-off-by: Ben Greear <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 17:52:14 +02:00
Ryder LeeandFelix Fietkau edd8a830f6 wifi: mt76: add tx_nss histogram to ethtool stats
mt76_connac2_mac_fill_txs() counts tx_nss but ethtool doesn't show
stats. Add missing histogram accordingly.

Signed-off-by: Ben Greear <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 17:52:14 +02:00
Ryder LeeandFelix Fietkau 251c363c30 wifi: mt76: mt7996: drop return in mt7996_sta_statistics
Avoid blocking other statistics sinfo->filled when txrate is
unavailable.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 17:50:24 +02:00
Ryder LeeandFelix Fietkau d71aa7b992 wifi: mt76: mt7915: drop return in mt7915_sta_statistics
Avoid blocking other statistics sinfo->filled when txrate is
unavailable.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 17:50:24 +02:00
Ryder LeeandFelix Fietkau d2a77a9954 wifi: mt76: mt7915: report tx retries/failed counts for non-WED path
Get missing tx retries/failed counts from txfree done events and report
them via mt7915_sta_statistics().

Co-developed-by: Peter Chiu <[email protected]>
Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 17:50:24 +02:00
Ryder LeeandFelix Fietkau 458ad0af21 wifi: mt76: enable UNII-4 channel 177 support
Enable support for the 5GHz channel 177 with center frequency 5885MHz and
operating class 125 based on IEEE Std 802.11ax-2021 Table E-4.

Signed-off-by: Himanshu Goyal <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 17:50:24 +02:00
Ryder LeeandFelix Fietkau 748d4a2bfe wifi: mt76: mt7615: enable BSS_CHANGED_MU_GROUPS support
The Group ID Management frame is an Action frame of category VHT.
It is transmitted by the AP to assign or change the user position
of a STA for one or more group IDs.

Also, sniffer can use a given group id to monitor STA that belongs
to that group.

Notify underlying driver of changes via BSS_CHANGED_MU_GROUPS.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 17:50:24 +02:00
Ryder LeeandFelix Fietkau 2386cec860 wifi: mt76: mt7996: enable BSS_CHANGED_MU_GROUPS support
The Group ID Management frame is an Action frame of category VHT.
It is transmitted by the AP to assign or change the user position
of a STA for one or more group IDs.

Also, sniffer can use a given group id to monitor STA that belongs
to that group.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 17:50:24 +02:00
Ryder LeeandFelix Fietkau 5c28e17f8c wifi: mt76: mt7996: fix header translation logic
When header translation failure is indicated, the hardware will insert
an extra 2-byte field containing the data length after the protocol
type field. This happens either when the LLC-SNAP pattern did not match,
or if a VLAN header was detected.

The previous commit accidentally breaks the logic, so reverts back.

Fixes: 27db47ab1f47 (wifi: mt76: mt7996: enable mesh HW amsdu/de-amsdu support)
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 17:50:24 +02:00
Ryder LeeandFelix Fietkau 5b7519be2b wifi: mt76: mt7996: fix endianness of MT_TXD6_TX_RATE
To avoid sparse warning:
sparse: warning: invalid assignment: |=
sparse:    left side has type restricted __le32
sparse:    right side has type unsigned lon

Fixes: 15ee62e73705 ("wifi: mt76: mt7996: enable BSS_CHANGED_BASIC_RATES support")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/16fa938373e3b145cb07a2c98d2428fea2abadba.1682285873.git.ryder.lee@mediatek.com
2023-06-22 17:49:09 +02:00
Ryder LeeandFelix Fietkau 3365c80f42 wifi: mt76: connac: fix stats->tx_bytes calculation
The stats->tx_bytes shall subtract retry byte from tx byte.

Fixes: 43eaa3689507 ("wifi: mt76: add PPDU based TxS support for WED device")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/b3cd45596943cf5a06b2e08e2fe732ab0b51311b.1682285873.git.ryder.lee@mediatek.com
2023-06-22 17:47:49 +02:00
Ryder LeeandFelix Fietkau 0cbe137670 wifi: mt76: mt7915: drop redundant prefix of mt7915_txpower_puts()
Just a cosmetic patch to drop redundant prefix for txpower ouput text.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-18 11:46:04 +02:00
Ryder LeeandFelix Fietkau 88d1b002d9 wifi: mt76: mt7996: enable mesh HW amsdu/de-amsdu support
This enables HW offloading amsdu/de-amsdu support for 802.11s mesh
interface.

Co-developed-by: Bo Jiao <[email protected]>
Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-18 11:35:57 +02:00
Ryder LeeandFelix Fietkau e3b5a8cc52 wifi: mt76: mt7996: enable configured beacon tx rate
The user is allowed to change beacon tx rate (HT/VHT/HE) from hostapd.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17 17:46:25 +02:00
Ryder LeeandFelix Fietkau a18bf4816a wifi: mt76: mt7996: enable BSS_CHANGED_MCAST_RATE support
Similar to BSS_CHANGED_BASIC_RATES, this enables mcast rate
configuration through fixed rate tables.

Signed-off-by: Ryder Lee <[email protected]>
Change-Id: Ifc305e8c7de9a7df4ad5f856e2097d721a886aaa
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17 17:46:25 +02:00
Ryder LeeandFelix Fietkau f863beedb6 wifi: mt76: mt7996: enable BSS_CHANGED_BASIC_RATES support
The connac3 removes fixed rate fields to reduce txd size and introduces
global rate tables (64 entries) for rate setting. Driver needs to fill
the corresponding idx in MT_TXD6_TX_RATE while tx, and push mt76_rate
into predifined table at bootup stage so that  mvif->basic_rates_idx
can immediately switch out once setting changes.

spe_idx is also needed for fixed rate frames, and will be updated by
future patches.

Note that all table entries are shared across driver and firmware
(i.e.TxBF), hence adding MT7996_BASIC_RATES_TBL to reflect mapping
status.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17 17:46:25 +02:00
Ryder LeeandFelix Fietkau aedc10d5d7 wifi: mt76: connac: add nss calculation into mt76_connac2_mac_tx_rate_val()
Take nss calculation into account since this function always wrongly
returns 0.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17 17:46:25 +02:00
Ryder LeeandFelix Fietkau 84a227e5ee wifi: mt76: connac: fix txd multicast rate setting
The vif->bss_conf.mcast_rate should be applied to multicast data frame
only.

Fixes: 182071cdd594 ("mt76: connac: move connac2_mac_write_txwi in mt76_connac module")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17 17:46:25 +02:00
Ryder LeeandFelix Fietkau 98fbca7a6f wifi: mt76: mt7996: enable coredump support
Host triggered and catastrophic event triggered firmware core dumping
for basic firmware issues triage, including state reporting, function
calltrace and MCU memory dump.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17 17:36:20 +02:00
Ryder LeeandFelix Fietkau be1ff24e87 wifi: mt76: mt7996: add full system reset knobs into debugfs
Add testing points into debugfs to trigger firmware assert and enable
full system recovery. Also rename knob "fw_ser" to a clear-cut name
"sys_recovery".

Co-developed-by: Bo Jiao <[email protected]>
Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17 17:36:20 +02:00
Ryder LeeandFelix Fietkau d39bb7c81c wifi: mt76: mt7996: remove mt7996_mcu_beacon_check_caps()
Those capabilities have been added into ieee80211_bss_conf.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17 15:53:06 +02:00
Ryder LeeandFelix Fietkau 4046b59183 wifi: mt76: mt7915: remove mt7915_mcu_beacon_check_caps()
Those capabilities have been added into ieee80211_bss_conf.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17 15:49:17 +02:00
Ryder LeeandFelix Fietkau b0721b9692 wifi: mt76: connac: refresh tx session timer for WED device
There's no keep-alive packet being received by mac80211 stack when WED
is enabled, which leads to tx BA session timeout. This patch calls
ieee80211_refresh_tx_agg_session_timer() to refresh timer according
to tx status reporting.

Signed-off-by: Ryder Lee <[email protected]>
2023-03-01 17:58:14 +01:00
Ryder LeeandFelix Fietkau 17ec2146b8 wifi: mt76: dynamic channel bandwidth changes in AP mode
Allow AP to change channel width for 40Mhz intolerant STA on the
2.4 GHz band.

Signed-off-by: Himanshu Goyal <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-02-28 11:19:52 +01:00
Ryder LeeandFelix Fietkau ce2438aa61 wifi: mt76: mt7996: fix radiotap bitfield
The 11be generation's radiotap bitfields were wrongly copy-and-pasted
from 11ax driver, so fix them accordingly.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-02-28 11:19:52 +01:00
Ryder LeeandFelix Fietkau 724a337cae wifi: mt76: mt7915: fix WED TxS reporting
The previous commit forgot to remove a leftover check.

Fixes: 43eaa3689507 ("wifi: mt76: add PPDU based TxS support for WED device")
Reported-By: Sujuan Chen <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-01-23 10:50:59 +01:00
Ryder LeeandFelix Fietkau be5dbb7810 wifi: mt76: mt7915: fix unintended sign extension of mt7915_hw_queue_read()
In the expression "map[i].qid << 24" starts as u8, but is promoted to
"signed int", then sign-extended to type "unsigned long", which is not
intended. Cast to u32 to avoid the sign extension.

Fixes: 776ec4e77aa6 ("mt76: mt7915: rework debugfs queue info")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:05 +01:00
Ryder LeeandFelix Fietkau a44109267e wifi: mt76: mt7996: fix unintended sign extension of mt7996_hw_queue_read()
In the expression "map[i].qid << 24" starts as u8, but is promoted to
"signed int", then sign-extended to type "unsigned long", which is not
intended. Cast to u32 to avoid the sign extension.

Reported-by: coverity-bot <[email protected]>
Addresses-Coverity-ID: 1527813 ("Integer handling issues")
Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:05 +01:00
Ryder LeeandFelix Fietkau 01a256c1dc wifi: mt76: mt7996: drop always true condition of __mt7996_reg_addr()
addr <= MT_CBTOP2_PHY_END(0xffffffff) is always true (<= u32max),
so drop it.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:05 +01:00
Ryder LeeandFelix Fietkau 35843a1670 wifi: mt76: mt7915: drop always true condition of __mt7915_reg_addr()
smatch warnings:
addr <= MT_CBTOP2_PHY_END(0xffffffff) is always true (<= u32max),
so drop it.

Fixes: cd4c314a65d3 ("mt76: mt7915: refine register definition")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:05 +01:00
Ryder LeeandFelix Fietkau b94ba58fa6 wifi: mt76: mt7915: check the correctness of event data
The mcu event might not be reliable, so check the correctness of data
before handling it.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:05 +01:00
Ryder LeeandFelix Fietkau f1cc3696d7 wifi: mt76: mt7996: check return value before accessing free_block_num
Check return value of mt7996_mcu_get_eeprom_free_block() first before
accessing free_block_num.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:05 +01:00
Ryder LeeandFelix Fietkau b252d94bd7 wifi: mt76: mt7915: check return value before accessing free_block_num
Check return value of mt7915_mcu_get_eeprom_free_block() first before
accessing free_block_num.

Fixes: bbc1d4154ec1 ("mt76: mt7915: add default calibrated data support")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:05 +01:00
Ryder LeeandFelix Fietkau f9598e6d4c wifi: mt76: mt7915: split mcu chan_mib array up
The current flow confuses coverity check that leads to false reporting,
so split the offs[] into two pieces according to chipset revision to
silence coverity tool.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:04 +01:00
Ryder LeeandFelix Fietkau 5616c4cc1d wifi: mt76: mt7996: fix integer handling issue of mt7996_rf_regval_set()
This code is supposed to set a u32 value, but casting will not work on
big endian systems.

Reported-by: coverity-bot <[email protected]>
Addresses-Coverity-ID: 1527816 ("Integer handling issues")
Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:04 +01:00
Ryder LeeandFelix Fietkau 233c272f0f wifi: mt76: mt7996: fix insecure data handling of mt7996_mcu_rx_radar_detected()
Coverity message:
using tainted "r->band_idx" variable as an index into an array "(*dev).mt76.phys".

Reported-by: coverity-bot <[email protected]>
Addresses-Coverity-ID: 1527812 ("Insecure data handling")
Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:04 +01:00
Ryder LeeandFelix Fietkau 379f3fc0fc wifi: mt76: mt7996: fix insecure data handling of mt7996_mcu_ie_countdown()
Coverity message:
using tainted "hdr->band" variable as an index into an array "(*dev).mt76.phys".

Reported-by: coverity-bot <[email protected]>
Addresses-Coverity-ID: 1527797 ("Insecure data handling")
Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:04 +01:00
Ryder LeeandFelix Fietkau 1ce4970d79 wifi: mt76: mt7915: fix mt7915_rate_txpower_get() resource leaks
Coverity message: variable "buf" going out of scope leaks the storage.

Reported-by: coverity-bot <[email protected]>
Addresses-Coverity-ID: 1527799 ("Resource leaks")
Fixes: e3296759f347 ("wifi: mt76: mt7915: enable per bandwidth power limit support")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:04 +01:00
Ryder LeeandFelix Fietkau 2a41e7a82f wifi: mt76: mt7996: add support to configure spatial reuse parameter set
The SPR parameter set comprises OBSS PD threshold for SRG and
non SRG and Bitmap of BSS color and partial BSSID. This adds
support to configure fields of SPR element to firmware.

User can disable firmware SR algorithms by turning sr_scene_detect off.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:04 +01:00
Ryder LeeandFelix Fietkau 98492dff3b wifi: mt76: mt7996: enable ack signal support
This reports signal strength of ACK packets from the peer as measured
at each interface.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:04 +01:00
Ryder LeeandFelix Fietkau d3838a52df wifi: mt76: mt7996: enable use_cts_prot support
This adds selectable RTC/CTS enablement for each interface.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:04 +01:00
Ryder LeeandFelix Fietkau 525592c28d wifi: mt76: mt7915: rely on band_idx of mt76_phy
The commit dc44c45c8cd0 added band_idx into mt76_phy, so switching to
rely on that.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-01 12:33:42 +01:00
Ryder LeeandFelix Fietkau a7b9153021 wifi: mt76: mt7915: fix scene detection flow of spatial reuse
Firmware is in the driving seat while sr_scene_detect is enabled,
so driver needs to skip operation to avoid mangling scene detection
algorithm.

Fixes: a633503 ("wifi: mt76: mt7915: add support to configure spatial reuse parameter set")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-01 12:33:42 +01:00
Ryder LeeandFelix Fietkau 5082a58f80 wifi: mt76: mt7915: enable per bandwidth power limit support
This power should override the per bandwidth max power that the
device emits.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-01 12:33:42 +01:00
Ryder LeeandFelix Fietkau ff94604b2e wifi: mt76: mt7915: introduce mt7915_get_power_bound()
Add a helper for common boundary check. This is a preliminary patch
to add per bandwidth power control.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-01 12:10:51 +01:00
Ryder LeeandFelix Fietkau aa7132da03 wifi: mt76: mt7915: fix endianness of mt7915_mcu_set_obss_spr_pd()
Fix sparse: sparse: incorrect type in assignment (different base types).

Fixes: a6335031eb96 ("wifi: mt76: mt7915: add support to configure spatial reuse parameter set")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-28 10:18:09 +01:00
Ryder LeeandFelix Fietkau 2c172bb6cd wifi: mt76: mt7915: fix band_idx usage
The commit 006b9d4ad5bf introduced phy->band_idx to accommodate the
band definition change for mt7986 so that the band_idx of main_phy
can be 0 or 1. Accordingly, the source of band_idx 1 has switched to
"phy != &dev->phy" or "dev->phy.band_idx = 1".

We still use ext_phy to represent band 1 somewhere in driver, so fix it.
Also, band_idx sounds more reasonable than dbdc_idx, so change it.

Fixes: 006b9d4ad5bf ("mt76: mt7915: introduce band_idx in mt7915_phy")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-23 13:38:55 +01:00
Ryder LeeandFelix Fietkau a9c88ded5c wifi: mt76: mt7915: enable .sta_set_txpwr support
This adds support for adjusting the Txpower level while pushing
traffic to an associated station. The allowed range is from 0 to
the maximum power of channel.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-23 13:38:55 +01:00
Ryder LeeandFelix Fietkau 4c23061ebc wifi: mt76: mt7915: add basedband Txpower info into debugfs
This helps user to debug Txpower propagation path easily.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-23 13:18:05 +01:00
Ryder LeeandFelix Fietkau 3b8eed9c38 wifi: mt76: mt7915: add support to configure spatial reuse parameter set
The SPR parameter set comprises OBSS PD threshold for SRG and
non SRG and Bitmap of BSS color and partial BSSID. This adds
support to configure fields of SPR element to firmware.

User can disable firmware SR algorithms by turning sr_scene_detect off.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-19 18:15:55 +01:00
Ryder LeeandFelix Fietkau d791ed1f58 wifi: mt76: mt7915: add missing MODULE_PARM_DESC
Add documentation for module_param so that they're visible with
modinfo command.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-19 18:09:57 +01:00
Ryder LeeandFelix Fietkau 3deafbad70 wifi: mt76: mt7915: fix uninitialized irq_mask
It should use dev->mt76.mmio.irqmask instead.

Fixes: 337acff38223 ("wifi: mt76: mt7915: enable full system reset support")
Signed-off-by: Ryder Lee <[email protected]>
2022-11-14 12:49:37 +01:00
Ryder LeeandFelix Fietkau a5e48378d2 wifi: mt76: mt7915: enable coredump support
Host triggered and catastrophic event triggered firmware core dumping
for basic firmware issues triage, including state reporting, task/irq
info, function calltrace and MCU memory dump.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-11 11:38:25 +01:00
Ryder LeeandFelix Fietkau 6b0668de7a wifi: mt76: mt7915: add full system reset into debugfs
Trigger firmware crash and enable full system recovery through debugfs.
This also renames knob "fw_ser" to a clear-cut name "sys_recovery".

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-11 11:38:25 +01:00
Ryder LeeandFelix Fietkau ad9bd2ba36 wifi: mt76: mt7615: enable use_cts_prot support
This adds selectable RTC/CTS enablement for each interface.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-11 11:38:25 +01:00
Ryder LeeandFelix Fietkau 3365c129f7 wifi: mt76: mt7915: enable use_cts_prot support
This adds selectable RTC/CTS enablement for each interface.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-11 11:38:25 +01:00
Ryder LeeandFelix Fietkau 94b335fa88 wifi: mt76: mt7915: add ack signal support
This reports signal strength of ACK packets from the peer as measured
at each interface.

Tested-by: Shurong Wen <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-11 11:31:52 +01:00
Ryder LeeandFelix Fietkau 176df35e7e wifi: mt76: mt7915: improve accuracy of time_busy calculation
The MIB INFO command is fetching MIB_BUSY_TIME, MIB_TX_TIME, MIB_RX_TIME and
MIB_OBSS_AIRTIME from the radio and filling out cc_busy, cc_tx, cc_bss_rx
and cc_rx respectively.

busy should be >= tx + rx >= tx + bss_rx but we don’t always quite see this.
Sometimes tx + rx is a bit higher than busy due to inaccurate accounting,
so this patch recalculates numbers to make them more reasonable.

Reported-By: Kevin Schneider <[email protected]>
Tested-by: Kevin Schneider <[email protected]>
Tested-by: Chad Monroe <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-11 11:31:52 +01:00
Ryder LeeandFelix Fietkau 2b8f56a72d wifi: mt76: mt7915: fix mt7915_mac_set_timing()
Correct mac timiing settings for different hardware generations.
This improves 40-60Mbps performance.

Fixes: 9aac2969fe5f ("mt76: mt7915: update mac timing settings")
Reported-By: Carson Vandegriffe <[email protected]>
Tested-by: Chad Monroe <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-10-01 14:38:20 +02:00
Ryder LeeandFelix Fietkau 873365b06c wifi: mt76: add PPDU based TxS support for WED device
Given that there's no data coming from network stack for binding flows,
hence driver counts and reports station's statistics directly through
NL80211_STA_INFO_* based on active PPDU based TxS for offloading data.

Apart from that, WA firmware and its offloading engine (SDO) have hardcoded
"2" as PID, so we introduce MT_PACKET_ID_WED to differentiate WED reporting.

Note that PPDU format TxS is mutually exclusive with MT_TXD5_TX_STATUS_HOST.

Co-developed-by: Yi-Chia Hsieh <[email protected]>
Signed-off-by: Yi-Chia Hsieh <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Ryder LeeandFelix Fietkau 2d72c9a740 wifi: mt76: move move mt76_sta_stats to mt76_wcid
This is a preliminary patch for WED's TxS support.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Ryder LeeandFelix Fietkau cdd66d6429 mt76: add DBDC rxq handlings into mac_reset_work
Enable/disable rx napi for DBDC.

Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:39:30 +02:00
Ryder LeeandFelix Fietkau 54b6504a3e mt76: mt7915: add more ethtool stats
Add channel time and MAC ready stats.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:39:30 +02:00
Ryder LeeandFelix Fietkau 838529da64 mt76: mt7915: add more statistics from fw_util debugfs knobs
Print out exception state and program counters of WA/WM MCUs.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-12 11:33:17 +02:00
Ryder LeeandFelix Fietkau bb54f5e1c1 mt76: mt7915: improve error handling for fw_debug knobs
In case fw.debug_wm/wa might be unavailable.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-12 11:31:01 +02:00
Ryder LeeandFelix Fietkau 8152406768 mt76: mt7915: move MT_INT_MASK_CSR to init.c
To avoid redundant MT_INT_MASK_CSR settings.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-05 14:27:56 +02:00
Ryder LeeandFelix Fietkau bac5f22365 mt76: mt7915: introduce mt7915_mac_severe_check()
In rare cases, TRB pointers might be out of sync leads to RMAC stopping
Rx that requires minimal recovery, so add this helper to periodically
check TRB status.

Tested-by: Chad Monroe <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-05 14:27:56 +02:00
Ryder LeeandFelix Fietkau 84319691b7 mt76: mt7915: reowrk SER debugfs knob
1. get status of system recovery from firmware.
2. add more recovery points.
3. make knob per phy.

Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-05 14:27:56 +02:00
Ryder LeeandFelix Fietkau 64ede85f14 mt76: mt7915: remove SCS feature
SCS is obsoleted and no longer used, so remove it.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-04-20 13:23:48 +02:00
Ryder LeeandFelix Fietkau 1442710d79 mt76: mt7915: always call mt7915_wfsys_reset() during init
Soft reboot might not clear certain condition, so always call
mt7915_wfsys_reset() during init.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-03-25 22:17:32 +01:00
Ryder LeeandFelix Fietkau e49af7036b mt76: use le32/16_get_bits() whenever possible
Switch to use le32/16_get_bits() to simplfy codes and specify
the size explicitly to avoid potential issues.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-03-14 15:53:26 +01:00
Ryder LeeandFelix Fietkau c374559eae mt76: mt7915: allow beaconing on all chains
This improves rate reach performance on units with polarized antennas.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-03-14 15:23:13 +01:00
Ryder LeeandFelix Fietkau d4fc42889a mt76: mt7915: check band idx for bcc event
Add missing band idx check for DBDC cases.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-02-14 15:15:48 +01:00
Ryder LeeandFelix Fietkau 7cdbea1dc8 mt76: only access ieee80211_hdr after mt76_insert_ccmp_hdr
Get rid of unsafe access since mt76_insert_ccmp_hdr moves the header.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-03 10:18:57 +01:00
Ryder LeeandFelix Fietkau dd054b7e16 mt76: only set rx radiotap flag from within decoder functions
Only set RX_FLAG_RADIOTAP_HE and RX_FLAG_RADIOTAP_HE_MU from with their
own decoder functions to prevent header calculation error.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-11-21 20:26:13 +01:00
Ryder LeeandFelix Fietkau ae8e02ddd2 mt76: mt7915: fix SMPS operation fail
TGn fails sending SM power save mode action frame to the AP to switch
from dynamic SMPS mode to static mode.

Reported-by: Fang Zhao <[email protected]>
Signed-off-by: Fang Zhao <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-11-12 13:13:18 +01:00
Ryder LeeandFelix Fietkau 577d45f6e4 mt76: mt7915: rework debugfs fixed-rate knob
Switch to use new mt7915_mcu_set_fixed_rate_ctrl().

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-23 07:27:06 +02:00
Ryder LeeandFelix Fietkau 2c8c3bcd76 mt76: mt7915: rework .set_bitrate_mask() to support more options
With this patch, driver can support single rate, (HE)GI and HE_LTF
configuration through .set_bitrate_mask().

Tested-by: MeiChia Chiu <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-23 07:27:06 +02:00
Ryder LeeandFelix Fietkau 4d2e81d9ec mt76: mt7915: remove mt7915_mcu_add_he()
Make mt7915_mcu_sta_he_tlv() as a part of mt7915_mcu_add_rate_ctrl() as
firmware rate control should get HE rate information from sta_rec_he,
and reduce a global function accordingly.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-23 07:27:06 +02:00
Ryder LeeandFelix Fietkau 9d288d7c0c mt76: mt7615: apply cached RF data for DBDC
Band0 and band1 share the same hardware, so band0 will stop Tx/Rx when
band1 performs Rx calibration. cal_cache is introduced to solve such
corner cases by moving necessary datas from channel_switch to bootup.

Co-developed-by: Peter Chiu <[email protected]>
Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-23 07:27:06 +02:00
Ryder LeeandFelix Fietkau 87d2fb6fbf mt76: mt7915: improve starec readability of txbf
1. Drop unnecessary MT_EBF/MT_IBF enum.
2. Rename fields 'nc'/'nr' to 'ncol'/'nrow'.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 11:21:17 +02:00
Ryder LeeandFelix Fietkau 4440025d0b mt76: mt7915: fix txbf starec TLV issues
With this patch we can append txbf starec TLVs. This is an intermediate
patch to improve HE MUMIMO performances.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 11:21:17 +02:00
Ryder LeeandFelix Fietkau 655a6c65b8 mt76: mt7915: introduce mt7915_mcu_beacon_check_caps()
Beacon elements might be changed by hostapd configuraion, so driver
should compare both IEs and PHY capabilities to get the least common
denominator before association.

Co-developed-by: Evelyn Tsai <[email protected]>
Signed-off-by: Evelyn Tsai <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 11:21:17 +02:00
Ryder LeeandFelix Fietkau 53d7eb3b48 mt76: mt7615: fix monitor mode tear down crash
[  103.451600] CPU 3 Unable to handle kernel paging request at virtual address 00000003, epc == 8576591c, ra == 857659f0
[  103.462226] Oops[#1]:
[  103.464499] CPU: 3 PID: 9247 Comm: ifconfig Tainted: G        W         5.4.143 #0
[  103.472031] $ 0   : 00000000 00000001 83be3854 00000000
[  103.477239] $ 4   : 8102a374 8102a374 8102f0b0 00000200
[  103.482444] $ 8   : 0000002d 000001e4 64373765 5d206337
[  103.487647] $12   : 00000000 00000005 00000000 0006d1df
[  103.492853] $16   : 83be3848 853838a8 8743d600 00010000
[  103.498059] $20   : 00000000 00000000 8553dec0 0000007f
[  103.503266] $24   : 00000003 80382084
[  103.508472] $28   : 831d4000 831d5bc0 00000001 857659f0
[  103.513678] Hi    : 00000122
[  103.516543] Lo    : d1768000
[  103.519452] epc   : 8576591c mt7615_mcu_add_bss+0xd0/0x3c0 [mt7615_common]
[  103.526306] ra    : 857659f0 mt7615_mcu_add_bss+0x1a4/0x3c0 [mt7615_common]
[  103.533232] Status: 11007c03 KERNEL EXL IE
[  103.537402] Cause : 40800008 (ExcCode 02)
[  103.541389] BadVA : 00000003
[  103.544253] PrId  : 0001992f (MIPS 1004Kc)
[  103.797086] Call Trace:
[  103.799562] [<8576591c>] mt7615_mcu_add_bss+0xd0/0x3c0 [mt7615_common]
[  103.806082] [<85760a14>] mt7615_remove_interface+0x74/0x1e0 [mt7615_common]
[  103.813280] [<85603fcc>] drv_remove_interface+0x2c/0xa0 [mac80211]
[  103.819612] [<8561a8e4>] ieee80211_del_virtual_monitor.part.22+0x74/0xe8 [mac80211]
[  103.827410] [<8561b7f0>] ieee80211_do_stop+0x4a4/0x8a0 [mac80211]
[  103.833671] [<8561bc00>] ieee80211_stop+0x14/0x24 [mac80211]
[  103.839405] [<8045a328>] __dev_close_many+0x9c/0x10c
[  103.844364] [<80463de4>] __dev_change_flags+0x16c/0x1e4
[  103.849569] [<80463e84>] dev_change_flags+0x28/0x70
[  103.854440] [<80521e54>] devinet_ioctl+0x280/0x774
[  103.859222] [<80526248>] inet_ioctl+0xa4/0x1c8
[  103.863674] [<80436830>] sock_ioctl+0x2d8/0x4bc
[  103.868201] [<801adbb4>] do_vfs_ioctl+0xb8/0x7c0
[  103.872804] [<801ae30c>] ksys_ioctl+0x50/0xb4
[  103.877156] [<80014598>] syscall_common+0x34/0x58

Fixes: 04b8e65922f63 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-11 11:53:39 +02:00
Ryder LeeandFelix Fietkau 3b9ba7e020 mt76: mt7615: fix hwmon temp sensor mem use-after-free
Without this change, garbage is seen in the hwmon name and sensors output
for mt7615 is garbled.

Fixes: 109e505ad944 ("mt76: mt7615: add thermal sensor device support")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-09-24 19:22:14 +02:00
Ryder LeeandFelix Fietkau 80fe40c945 mt76: mt7915: enable configured beacon tx rate
The user is allowed to change beacon tx rate (HT/VHT/HE) from hostapd.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-09-24 19:11:08 +02:00
Ryder LeeandFelix Fietkau d8b5e42c9a mt76: fill boottime_ns in Rx path
Give a proper boottime_ns value for netlink RX to avoid scan
issues with Android.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-09-24 17:43:16 +02:00
Ryder LeeandFelix Fietkau 62ffc31f4d mt76: mt7915: rename debugfs tx-queues
Rename "queues" to "tx-queues" to reflect its meaning.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-09-24 17:38:21 +02:00
Ryder LeeandFelix Fietkau 5a0f2382fc mt76: mt7915: rework debugfs queue info
Complete PSE/PLE queue statistics, including per-sta AC queue
information.

Co-developed-by: Sujuan Chen <[email protected]>
Signed-off-by: Sujuan Chen <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-09-24 17:36:42 +02:00
Ryder LeeandFelix Fietkau 5710d06434 mt76: add a bound check in mt76_calculate_default_rate()
basic_rate could be 0 ie. hidden AP. Always pick the lowest rate
for such cases.

Fixes: 75fb2e62d444 (mt76: add mt76_default_basic_rate more devices can rely on)
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-09-24 17:27:25 +02:00
Ryder LeeandFelix Fietkau e2ee9d0a33 mt76: use IEEE80211_OFFLOAD_ENCAP_ENABLED instead of MT_DRV_AMSDU_OFFLOAD
Drop MT_DRV_AMSDU_OFFLOAD after introducing IEEE80211_OFFLOAD_ENCAP_ENABLED
flag in mac80211. Driver now checks vif->offload_flags to know encap offload
status of each interface.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-08-27 19:08:21 +02:00
Ryder LeeandFelix Fietkau 0182a5b99a mt76: mt7915: update mac timing settings
1. EIFS has been divided into OFDM/CCK fields after 11ax generation.
2. For 5G/6G SIFS setting, hardware counts extra 6us for OFDM.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-08-16 13:50:52 +02:00
Ryder LeeandFelix Fietkau bc7ee7d7bd mt76: mt7915: add HE-LTF into fixed rate command
Add HE-LTF control.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-08-13 12:54:37 +02:00
Ryder LeeandFelix Fietkau 4f48ba4b02 mt76: mt7915: checkpatch cleanup
Fix reasonable checkpatch warnings and clean up codes.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-08-13 12:54:37 +02:00
Ryder LeeandFelix Fietkau d04814366c mt76: add support for setting mcast rate
Mesh and ad-hoc interfaces allow users to set mcast rate through
NL80211_ATTR_MCAST_RATE, so rework mt76_default_basic_rate() to
adapt that.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-08-13 12:26:54 +02:00
Ryder LeeandFelix Fietkau affea639c5 mt76: mt7921: send EAPOL frames at lowest rate
The firmware rate control may choose the high rate for EAPOL frames,
so checking IEEE80211_TX_CTL_USE_MINRATE to use the lowest TX rate.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-08-13 12:25:36 +02:00