1
Commit Graph

3217 Commits

Author SHA1 Message Date
David S. Miller
e31a8219fb wireless fixes for v6.12-rc5
The first set of wireless fixes for v6.12. We have been busy and have
 not been able to send this earlier, so there are more fixes than
 usual. The fixes are all over, both in stack and in drivers, but
 nothing special really standing out.
 -----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCgAvFiEEiBjanGPFTz4PRfLobhckVSbrbZsFAmcWl7MRHGt2YWxvQGtl
 cm5lbC5vcmcACgkQbhckVSbrbZv0Qgf/fQJKXkGJkvozrbJATkKHfHKUOphIl4Y8
 /r3SlrsIL6qXZAUq5N+NH9vfUeKt5kkKG8Fc8yrJaygDLsV9v1LGiBSsb5eJ+PfM
 4fCOdzPSrWG984dLwsCK8UGEzfQ1G4d6HckwubUMimK2X/m6wx/99fenjMAQvdWO
 rjAJmpAkgoT0Fvf8GD3joMBKKjMFr2KT8tgbfvwpyr9cXAPZYf35+74Nl84UjHiP
 rGTGN++NQuPMsYyYIPPA+eMNUnlUVyDah+UVmzsMp27YUdKBKjx23kRH6tKM/46H
 dWqpqEV50xshlPaotHoFg9+4KRrxnxwvFtGTsnbvHcuSnkPBUusAvw==
 =l6SI
 -----END PGP SIGNATURE-----

Merge tag 'wireless-2024-10-21' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless

wireless fixes for v6.12-rc5

The first set of wireless fixes for v6.12. We have been busy and have
not been able to send this earlier, so there are more fixes than
usual. The fixes are all over, both in stack and in drivers, but
nothing special really standing out.
2024-10-25 10:44:41 +01:00
Al Viro
5f60d5f6bb move asm/unaligned.h to linux/unaligned.h
asm/unaligned.h is always an include of asm-generic/unaligned.h;
might as well move that thing to linux/unaligned.h and include
that - there's nothing arch-specific in that header.

auto-generated by the following:

for i in `git grep -l -w asm/unaligned.h`; do
	sed -i -e "s/asm\/unaligned.h/linux\/unaligned.h/" $i
done
for i in `git grep -l -w asm-generic/unaligned.h`; do
	sed -i -e "s/asm-generic\/unaligned.h/linux\/unaligned.h/" $i
done
git mv include/asm-generic/unaligned.h include/linux/unaligned.h
git mv tools/include/asm-generic/unaligned.h tools/include/linux/unaligned.h
sed -i -e "/unaligned.h/d" include/asm-generic/Kbuild
sed -i -e "s/__ASM_GENERIC/__LINUX/" include/linux/unaligned.h tools/include/linux/unaligned.h
2024-10-02 17:23:23 -04:00
Felix Fietkau
34b6954810 wifi: mt76: do not increase mcu skb refcount if retry is not supported
If mcu_skb_prepare_msg is not implemented, incrementing skb refcount does not
work for mcu message retry. In some cases (e.g. on SDIO), shared skbs can trigger
a BUG_ON, crashing the system.
Fix this by only incrementing refcount if retry is actually supported.

Fixes: 3688c18b65 ("wifi: mt76: mt7915: retry mcu messages")
Closes: https://lore.kernel.org/r/d907b13a-f8be-4cb8-a0bb-560a21278041@notapiano/
Reported-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> #KernelCI
Tested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20240917110942.22077-1-nbd@nbd.name
2024-09-18 16:34:00 +03:00
Kalle Valo
abbd838c57 mt76 patches for 6.12
- fixes
 - mt7915 .sta_state support
 - mt7915 hardware restart improvements
 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org
 
 iF0EABECAB0WIQR10Rp9kadxD0kAQu/XfRQdAqdu9QUCZtr0OgAKCRDXfRQdAqdu
 9SBpAKCUgIMVypIp3Hs/TcJWrHAHTELAnQCeOaSPIiZNQg+Ifvp1N+EFmIjgTZg=
 =MTUi
 -----END PGP SIGNATURE-----

Merge tag 'mt76-for-kvalo-2024-09-06' of https://github.com/nbd168/wireless

mt76 patches for 6.12

- fixes
- mt7915 .sta_state support
- mt7915 hardware restart improvements
2024-09-09 20:37:47 +03:00
Ming Yen Hsieh
6bba05d651 wifi: mt76: mt7925: replace chan config with extend txpower config for clc
Since MT792x_CLC_CHAN is currently not in use, we have added an
extension for setting txpower to replace it.

Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20240819015334.14580-2-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:08 +02:00
Ming Yen Hsieh
9679ca7326 wifi: mt76: mt7925: fix a potential array-index-out-of-bounds issue for clc
Due to the lack of checks on the clc array, if the firmware supports
more clc configuration, it will cause illegal memory access.

Cc: stable@vger.kernel.org
Fixes: c948b5da6b ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20240819015334.14580-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:08 +02:00
Ma Ke
5acdc432f8 wifi: mt76: mt7615: check devm_kasprintf() returned value
devm_kasprintf() can return a NULL pointer on failure but this returned
value is not checked. Fix this lack and check the returned value.

Found by code review.

Cc: stable@vger.kernel.org
Fixes: 0bb4e9187e ("mt76: mt7615: fix hwmon temp sensor mem use-after-free")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Link: https://patch.msgid.link/20240905014753.353271-1-make24@iscas.ac.cn
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Chen Ni
df6b08670f wifi: mt76: mt7925: convert comma to semicolon
Replace comma between expressions with semicolons.

Using a ',' in place of a ';' can have unintended side effects.
Although that is not the case here, it is seems best to use ';'
unless ',' is intended.

Found by inspection.
No functional change intended.
Compile tested only.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Link: https://patch.msgid.link/20240904075213.1352976-1-nichen@iscas.ac.cn
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Michael Lo
45064d19fd wifi: mt76: mt7925: fix a potential association failure upon resuming
In multi-channel scenarios, the granted channel must be aborted before
suspending. Otherwise, the firmware will be put into a wrong state,
resulting in an association failure after resuming.

With this patch, the granted channel will be aborted before suspending
if necessary.

Cc: stable@vger.kernel.org
Fixes: c948b5da6b ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Signed-off-by: Michael Lo <michael.lo@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20240902090054.15806-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Gustavo A. R. Silva
bb6fe2b92a wifi: mt76: Avoid multiple -Wflex-array-member-not-at-end warnings
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

So, in order to avoid ending up with a flexible-array member in the
middle of multiple other structs, we use the `struct_group_tagged()`
helper to create a new tagged `struct mt76_connac2_mcu_rxd_hdr`.
This structure groups together all the members of the flexible
`struct mt76_connac2_mcu_rxd` except the flexible array.

As a result, the array is effectively separated from the rest of the
members without modifying the memory layout of the flexible structure.
We then change the type of the middle struct members currently causing
trouble from `struct mt76_connac2_mcu_rxd` to `struct
mt76_connac2_mcu_rxd_hdr`.

We also want to ensure that when new members need to be added to the
flexible structure, they are always included within the newly created
tagged struct. For this, we use `static_assert()`. This ensures that the
memory layout for both the flexible structure and the new tagged struct
is the same after any changes.

This approach avoids having to implement `struct mt76_connac2_mcu_rxd_hdr`
as a completely separate structure, thus preventing having to maintain
two independent but basically identical structures, closing the door
to potential bugs in the future.

So, with these changes, fix the following warnings:

drivers/net/wireless/mediatek/mt76/mt7915/mcu.h:32:37: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/mediatek/mt76/mt7915/mcu.h:40:37: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/mediatek/mt76/mt7915/mcu.h:49:37: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/mediatek/mt76/mt7915/mcu.h:58:37: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://patch.msgid.link/Zr5KsZugaEXrApQJ@elsanto
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Ma Ke
1ccc9e476c wifi: mt76: mt7921: Check devm_kasprintf() returned value
devm_kasprintf() can return a NULL pointer on failure but this returned
value is not checked. Fix this lack and check the returned value.

Found by code review.

Cc: stable@vger.kernel.org
Fixes: 6ae39b7c7e ("wifi: mt76: mt7921: Support temp sensor")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Reviwed-by: Matthias Brugger <matthias.bgg@gmail.com>
Link: https://patch.msgid.link/20240903014455.4144536-1-make24@iscas.ac.cn
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Ma Ke
267efeda8c wifi: mt76: mt7915: check devm_kasprintf() returned value
devm_kasprintf() can return a NULL pointer on failure but this returned
value is not checked. Fix this lack and check the returned value.

Found by code review.

Cc: stable@vger.kernel.org
Fixes: 6ae39b7c7e ("wifi: mt76: mt7921: Support temp sensor")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Link: https://patch.msgid.link/20240903014955.4145423-1-make24@iscas.ac.cn
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Felix Fietkau
b13cd593ef wifi: mt76: mt7915: avoid long MCU command timeouts during SER
Immediately abort MCU commands when firmware requests DMA restart.

Link: https://patch.msgid.link/20240827093011.18621-24-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Felix Fietkau
9e461f4a23 wifi: mt76: mt7996: fix uninitialized TLV data
Use skb_put_zero instead of skb_put

Fixes: 98686cd216 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Link: https://patch.msgid.link/20240827093011.18621-23-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Felix Fietkau
eeb672b50d wifi: mt76: mt7915: always query station rx rate from firmware
When offloading is enabled, the software rx path may not have the latest
rate information.

Link: https://patch.msgid.link/20240827093011.18621-22-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Howard Hsu
6ac80fce71 wifi: mt76: mt7915: fix rx filter setting for bfee functionality
Fix rx filter setting to prevent dropping NDPA frames. Without this
change, bfee functionality may behave abnormally.

Fixes: e57b790146 ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Link: https://patch.msgid.link/20240827093011.18621-21-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Felix Fietkau
c377844352 wifi: mt76: shrink mt76_queue_buf
Reuse one bit from the length field for skip_unmap

Link: https://patch.msgid.link/20240827093011.18621-20-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Felix Fietkau
328e35c7bf wifi: mt76: mt7915: improve hardware restart reliability
- use reconfig_complete to restart mac_work / queues
- reset full wtbl after firmware init
- clear wcid and vif mask to avoid leak
- fix sta poll list corruption

Link: https://patch.msgid.link/20240827093011.18621-19-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Felix Fietkau
b2141eadf8 wifi: mt76: connac: move mt7615_mcu_del_wtbl_all to connac
Preparation for reusing it in mt7915

Link: https://patch.msgid.link/20240827093011.18621-18-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Felix Fietkau
8f7152f10c wifi: mt76: mt7915: hold dev->mt76.mutex while disabling tx worker
Prevent racing against other functions disabling the same worker

Link: https://patch.msgid.link/20240827093011.18621-17-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Benjamin Lin
f2cc859149 wifi: mt76: mt7915: add dummy HW offload of IEEE 802.11 fragmentation
Currently, CONNAC2 series do not support encryption for fragmented Tx frames.
Therefore, add dummy function mt7915_set_frag_threshold() to prevent SW
IEEE 802.11 fragmentation.

Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Link: https://patch.msgid.link/20240827093011.18621-16-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:07 +02:00
Felix Fietkau
10f73bb393 wifi: mt76: mt7915: reset the device after MCU timeout
On MT7915, MCU hangs do not trigger watchdog interrupts, so they can only
be detected through MCU message timeouts. Ensure that the hardware gets
restarted when that happens in order to prevent a permanent stuck state.

Link: https://patch.msgid.link/20240827093011.18621-15-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:06 +02:00
Felix Fietkau
3688c18b65 wifi: mt76: mt7915: retry mcu messages
In some cases MCU messages can get lost. Instead of failing completely,
attempt to recover by re-sending them.

Link: https://patch.msgid.link/20240827093011.18621-14-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:06 +02:00
Felix Fietkau
8351a4a40b wifi: mt76: mt7915: set MT76_MCU_RESET early in mt7915_mac_full_reset
This avoids running into unnecessary timeouts waiting for MCU responses

Link: https://patch.msgid.link/20240827093011.18621-13-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:06 +02:00
Felix Fietkau
33eb14f102 wifi: mt76: mt7915: use mac80211 .sta_state op
Allows adding stations before assoc, though they are not passed to the
firmware yet at that point.

Link: https://patch.msgid.link/20240827093011.18621-12-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:06 +02:00
Felix Fietkau
17b0f68a72 wifi: mt76: change .sta_assoc callback to .sta_event
Also report auth/disassoc events, in order to give the driver more control over
handling the station state.

Link: https://patch.msgid.link/20240827093011.18621-11-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:06 +02:00
Felix Fietkau
8a977b3f96 wifi: mt76: connac: add support for passing connection state directly
Preparation for improvements to sta handling. No functional changes.

Link: https://patch.msgid.link/20240827093011.18621-10-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:06 +02:00
Benjamin Lin
dfaf079a1a wifi: mt76: connac: add support for IEEE 802.11 fragmentation
Add fragmentation index into TXD.DW2 to support IEEE 802.11 fragmentation.

Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Link: https://patch.msgid.link/20240827093011.18621-9-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:06 +02:00
Felix Fietkau
f3049b88b2 wifi: mt76: mt7915: allocate vif wcid in the same range as stations
Reduces the amount of unnecessary WTBL bank switching, while still reserving
WTBL entries for vifs.

Link: https://patch.msgid.link/20240827093011.18621-8-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:06 +02:00
Felix Fietkau
256cbd26fb wifi: mt76: mt7915: disable tx worker during tx BA session enable/disable
Avoids firmware race condition.

Link: https://patch.msgid.link/20240827093011.18621-7-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:06 +02:00
Felix Fietkau
0b3be9d1d3 wifi: mt76: add separate tx scheduling queue for off-channel tx
Ensure that packets are not sent out to the wrong channel

Link: https://patch.msgid.link/20240827093011.18621-6-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 14:23:06 +02:00
Aditya Kumar Singh
bca8bc0399 wifi: mac80211: handle ieee80211_radar_detected() for MLO
Currently DFS works under assumption there could be only one channel
context in the hardware. Hence, drivers just calls the function
ieee80211_radar_detected() passing the hardware structure. However, with
MLO, this obviously will not work since number of channel contexts will be
more than one and hence drivers would need to pass the channel information
as well on which the radar is detected.

Also, when radar is detected in one of the links, other link's CAC should
not be cancelled.

Hence, in order to support DFS with MLO, do the following changes -
  * Add channel context conf pointer as an argument to the function
    ieee80211_radar_detected(). During MLO, drivers would have to pass on
    which channel context conf radar is detected. Otherwise, drivers could
    just pass NULL.
  * ieee80211_radar_detected() will iterate over all channel contexts
    present and
  	* if channel context conf is passed, only mark that as radar
  	  detected
  	* if NULL is passed, then mark all channel contexts as radar
  	  detected
  	* Then as usual, schedule the radar detected work.
  * In the worker, go over all the contexts again and for all such context
    which is marked with radar detected, cancel the ongoing CAC by calling
    ieee80211_dfs_cac_cancel() and then notify cfg80211 via
    cfg80211_radar_event().
  * To cancel the CAC, pass the channel context as well where radar is
    detected to ieee80211_dfs_cac_cancel(). This ensures that CAC is
    canceled only on the links using the provided context, leaving other
    links unaffected.

This would also help in scenarios where there is split phy 5 GHz radio,
which is capable of DFS channels in both lower and upper band. In this
case, simultaneous radars can be detected.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Link: https://patch.msgid.link/20240906064426.2101315-9-quic_adisi@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-09-06 13:01:05 +02:00
Felix Fietkau
f4fdd77162 wifi: mt76: partially move channel change code to core
This allows the core code to change the channel. Code deduplication and
preparation for adding scanning code to the core.

Link: https://patch.msgid.link/20240828063422.44813-1-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 11:14:37 +02:00
Felix Fietkau
e43b87f6b7 wifi: mt76: fix mt76_get_rate
Do not assume that the first phy has 2 GHz support.
Check sband->band instead of accessing dev->phy.sband_2g.

Link: https://patch.msgid.link/20240827093011.18621-4-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 11:14:37 +02:00
Felix Fietkau
6ea13e6bd2 wifi: mt76: mt7603: initialize chainmask
Fixes reported tx power by accounting for the combined output

Link: https://patch.msgid.link/20240827093011.18621-3-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 11:14:37 +02:00
Felix Fietkau
3dd99b8f20 wifi: mt76: mt7603: fix reading target power from eeprom
If the ext-PA target power is unset, fall back to the standard EEPROM value.

Link: https://patch.msgid.link/20240827093011.18621-2-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 11:14:37 +02:00
Felix Fietkau
9b8d932053 wifi: mt76: mt7603: fix mixed declarations and code
Move the qid variable declaration further up

Fixes: b473c0e47f ("wifi: mt76: mt7603: fix tx queue of loopback packets")
Link: https://patch.msgid.link/20240827093011.18621-1-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 11:14:34 +02:00
Peter Chiu
a04b920fbc wifi: mt76: connac: fix checksum offload fields of connac3 RXD
Fix incorrect RXD offset and bitfield related to RX checksum offload.

Fixes: 98686cd216 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Fixes: 4e9011fcdf ("wifi: mt76: connac: move connac3 definitions in mt76_connac3_mac.h")
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Link: https://patch.msgid.link/20240816095040.2574-1-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 11:14:31 +02:00
Ma Ke
f503ae90c7 wifi: mt76: mt7996: fix NULL pointer dereference in mt7996_mcu_sta_bfer_he
Fix the NULL pointer dereference in mt7996_mcu_sta_bfer_he
routine adding an sta interface to the mt7996 driver.

Found by code review.

Cc: stable@vger.kernel.org
Fixes: 98686cd216 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Link: https://patch.msgid.link/20240813081242.3991814-1-make24@iscas.ac.cn
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 11:14:31 +02:00
Michael-CY Lee
dcd21b27f1 wifi: mt76: mt7996: set IEEE80211_KEY_FLAG_GENERATE_MMIE for other ciphers
When beacon protection is enabled, FW checks MMIE tag & length in the
beacon for every cipher mode. To pass the check, driver needs to set the
key flag IEEE80211_KEY_GENERATE_MMIE to let mac80211 generate and
initialize MMIE.

Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20240816094635.2391-11-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 11:14:31 +02:00
Benjamin Lin
5353679ab4 wifi: mt76: connac: add IEEE 802.11 fragmentation support for mt7996
Add fragment index into TXD.DW2 to support IEEE 802.11 fragmentation.

Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20240816094635.2391-10-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 11:14:31 +02:00
Rex Lu
ded1a6d9e1 wifi: mt76: mt7996: fix handling mbss enable/disable
When mbss was previously enabled, the TLV needs to be included when
disabling it again, in order to clear the firmware state.

Fixes: a7908d5b61 ("wifi: mt76: mt7996: fix non-main BSS no beacon issue for MBSS scenario")
Signed-off-by: Rex Lu <rex.lu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20240816094635.2391-9-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-06 11:13:37 +02:00
Howard Hsu
5dae5d09fe wifi: mt76: mt7996: set correct value in beamforming mcu command for mt7992
Configure correct bf number and bitmap in beamforming mcu command for
mt7992 chipsets, which only support dual-band.

Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20240816094635.2391-8-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-05 13:01:55 +02:00
Howard Hsu
9ca65757f0 wifi: mt76: mt7996: fix EHT beamforming capability check
If a VIF acts as a beamformer, it should check peer's beamformee
capability, and vice versa.

Fixes: ba01944ade ("wifi: mt76: mt7996: add EHT beamforming support")
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20240816094635.2391-7-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-05 13:01:55 +02:00
Howard Hsu
0cca3fe745 wifi: mt76: mt7996: set correct beamformee SS capability
According to IEEE P802.11be/D6.0 Table 9-417n, beamformee SS field stands
for the maximum number of spatial streams that the STA can receive in an
EHT sounding NDP minus 1, and the minimum value of this field is 3.

This value indicates the decoding capability of a beamformee, which is
independent of current antenna settings. Correct the value for mt7996
and mt7992 chipsets based on their HW capability.

Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20240816094635.2391-6-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-05 13:01:55 +02:00
Howard Hsu
e1f4847fdb wifi: mt76: mt7996: fix HE and EHT beamforming capabilities
Fix HE and EHT beamforming capabilities for different bands and
interface types.

Fixes: 98686cd216 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Fixes: 348533eb96 ("wifi: mt76: mt7996: add EHT capability init")
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20240816094635.2391-5-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-05 13:01:55 +02:00
Peter Chiu
948f652498 wifi: mt76: mt7996: advertize beacon_int_min_gcd
Advertize beacon_int_min_gcd as 100 to allow setting different beacon
intervals on different interfaces.

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20240816094635.2391-4-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-05 13:01:55 +02:00
Peter Chiu
9265397caa wifi: mt76: mt7996: fix wmm set of station interface to 3
According to connac3 HW design, the WMM index of AP and STA interface
should be 0 and 3, respectively.

Fixes: 98686cd216 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20240816094635.2391-3-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-05 13:01:55 +02:00
Peter Chiu
376200f095 wifi: mt76: mt7996: fix traffic delay when switching back to working channel
During scanning, UNI_CHANNEL_RX_PATH tag is necessary for the firmware to
properly stop and resume MAC TX queue. Without this tag, HW needs more time
to resume traffic when switching back to working channel.

Fixes: 98686cd216 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20240816094635.2391-2-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-05 13:01:55 +02:00
Peter Chiu
f98c3de92b wifi: mt76: mt7996: use hweight16 to get correct tx antenna
The chainmask is u16 so using hweight8 cannot get correct tx_ant.
Without this patch, the tx_ant of band 2 would be -1 and lead to the
following issue:
BUG: KASAN: stack-out-of-bounds in mt7996_mcu_add_sta+0x12e0/0x16e0 [mt7996e]

Fixes: 98686cd216 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20240816094635.2391-1-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-09-05 13:01:55 +02:00