sfrench/cifs-2.6.git
5 months agoMerge tag 'ath-next-20231215' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath
Kalle Valo [Sun, 17 Dec 2023 11:20:18 +0000 (13:20 +0200)]
Merge tag 'ath-next-20231215' of git://git./linux/kernel/git/kvalo/ath

ath.git patches for v6.8.

We have new features only for ath12k but lots of small cleanup for
ath10k, ath11k and ath12k. And of course smaller fixes to several
drivers.

Major changes:

ath12k

* support one MSI vector

* WCN7850: support AP mode

5 months agowifi: mt76: mt7996: Use DECLARE_FLEX_ARRAY() and fix -Warray-bounds warnings
Gustavo A. R. Silva [Tue, 12 Dec 2023 17:14:29 +0000 (11:14 -0600)]
wifi: mt76: mt7996: Use DECLARE_FLEX_ARRAY() and fix -Warray-bounds warnings

Transform zero-length arrays `rate`, `adm_stat` and `msdu_cnt` into
proper flexible-array members in anonymous union in `struct
mt7996_mcu_all_sta_info_event` via the DECLARE_FLEX_ARRAY()
helper; and fix multiple -Warray-bounds warnings:

drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:544:61: warning: array subscript <unknown> is outside array bounds of 'struct <anonymous>[0]' [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:551:58: warning: array subscript <unknown> is outside array bounds of 'struct <anonymous>[0]' [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:553:58: warning: array subscript <unknown> is outside array bounds of 'struct <anonymous>[0]' [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:530:61: warning: array subscript <unknown> is outside array bounds of 'struct <anonymous>[0]' [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:538:66: warning: array subscript <unknown> is outside array bounds of 'struct <anonymous>[0]' [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:540:66: warning: array subscript <unknown> is outside array bounds of 'struct <anonymous>[0]' [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:520:57: warning: array subscript <unknown> is outside array bounds of 'struct all_sta_trx_rate[0]' [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:526:76: warning: array subscript <unknown> is outside array bounds of 'struct all_sta_trx_rate[0]' [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:526:76: warning: array subscript <unknown> is outside array bounds of 'struct all_sta_trx_rate[0]' [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:526:76: warning: array subscript <unknown> is outside array bounds of 'struct all_sta_trx_rate[0]' [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:526:76: warning: array subscript <unknown> is outside array bounds of 'struct all_sta_trx_rate[0]' [-Warray-bounds=]

This results in no differences in binary output, helps with the ongoing
efforts to globally enable -Warray-bounds.

Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/ZXiU9ayVCslt3qiI@work
5 months agowifi: ath11k: workaround too long expansion sparse warnings
Kalle Valo [Thu, 14 Dec 2023 16:17:40 +0000 (18:17 +0200)]
wifi: ath11k: workaround too long expansion sparse warnings

In v6.7-rc1 sparse warns:

drivers/net/wireless/ath/ath11k/mac.c:4702:15: error: too long token expansion
drivers/net/wireless/ath/ath11k/mac.c:4702:15: error: too long token expansion
drivers/net/wireless/ath/ath11k/mac.c:8393:23: error: too long token expansion
drivers/net/wireless/ath/ath11k/mac.c:8393:23: error: too long token expansion

Workaround the warnings by refactoring the code to a new function, which also
reduces code duplication. And in the new function use max3() to make the code
more readable.

No functional changes, compile tested only.

Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20231214161740.1582340-1-kvalo@kernel.org
5 months agoRevert "wifi: ath12k: use ATH12K_PCI_IRQ_DP_OFFSET for DP IRQ"
Karthikeyan Periyasamy [Thu, 14 Dec 2023 05:32:15 +0000 (11:02 +0530)]
Revert "wifi: ath12k: use ATH12K_PCI_IRQ_DP_OFFSET for DP IRQ"

This reverts commit 1f1f7d548a00ebe50808cb1f580df9693e194a7c. The commit
caused bootup failure on QCN9274 hw2.0 platform. Incorrect hardcode DP
irq offset overwrite the CE irq, which caused the driver to miss the
mandatory bootup message from the firmware through the CE interrupt. This
occurs because the CE count differs between platforms. The revert has no
impact since the original change was based on an incorrect assumption.

Log:

ath12k_pci 0000:06:00.0: fw_version 0x1011001d fw_build_timestamp 2022-12-02 01:16 fw_build_id QC_IMAGE_VERSION_STRING=WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
ath12k_pci 0000:06:00.0: failed to receive control response completion, polling..
ath12k_pci 0000:06:00.0: Service connect timeout
ath12k_pci 0000:06:00.0: failed to connect to HTT: -110
ath12k_pci 0000:06:00.0: failed to start core: -110

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20231214053215.2087308-1-quic_periyasa@quicinc.com
5 months agowifi: rt2x00: remove useless code in rt2x00queue_create_tx_descriptor()
Dmitry Antipov [Wed, 13 Dec 2023 05:14:43 +0000 (08:14 +0300)]
wifi: rt2x00: remove useless code in rt2x00queue_create_tx_descriptor()

In 'rt2x00queue_create_tx_descriptor()', there is no need to call
'ieee80211_get_rts_cts_rate()' while checking for RTS/CTS frame
since this function returns NULL or pointer to internal bitrate
table entry, and the return value is not actually used. Compile
tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231213051449.126963-1-dmantipov@yandex.ru
5 months agowifi: rtw89: only reset BB/RF for existing WiFi 6 chips while starting up
Ping-Ke Shih [Mon, 11 Dec 2023 08:33:41 +0000 (16:33 +0800)]
wifi: rtw89: only reset BB/RF for existing WiFi 6 chips while starting up

The new WiFi 7 chips change the design, so no need to disable/enable
BB/RF when core_start(). Keep the same logic for existing chips.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231211083341.118047-7-pkshih@realtek.com
5 months agowifi: rtw89: add DBCC H2C to notify firmware the status
Ping-Ke Shih [Mon, 11 Dec 2023 08:33:40 +0000 (16:33 +0800)]
wifi: rtw89: add DBCC H2C to notify firmware the status

To support MLO of WiFi 7, we should configure hardware as DBCC mode, and
notify this status to firmware.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231211083341.118047-6-pkshih@realtek.com
5 months agowifi: rtw89: mac: add suffix _ax to MAC functions
Ping-Ke Shih [Mon, 11 Dec 2023 08:33:39 +0000 (16:33 +0800)]
wifi: rtw89: mac: add suffix _ax to MAC functions

Many existing MAC access functions are used by WiFi 6 chips only, so add
suffix _ax to be clearer. Some are common and can be used by WiFi 7, so
export this kind of functions. This patch doesn't change logic at all.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231211083341.118047-5-pkshih@realtek.com
5 months agowifi: rtw89: mac: add flags to check if CMAC and DMAC are enabled
Ping-Ke Shih [Mon, 11 Dec 2023 08:33:38 +0000 (16:33 +0800)]
wifi: rtw89: mac: add flags to check if CMAC and DMAC are enabled

Before accessing CMAC and DMAC registers, we should ensure they have been
powered on, so add flag to determine the state. For old chips, we read
registers and check corresponding bit, but it takes extra cost to read.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231211083341.118047-4-pkshih@realtek.com
5 months agowifi: rtw89: 8922a: add power on/off functions
Ping-Ke Shih [Mon, 11 Dec 2023 08:33:37 +0000 (16:33 +0800)]
wifi: rtw89: 8922a: add power on/off functions

The power on/off functions are to turn on hardware function blocks and
to turn off them if we are going to stay in idle state.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231211083341.118047-3-pkshih@realtek.com
5 months agowifi: rtw89: add XTAL SI for WiFi 7 chips
Ping-Ke Shih [Mon, 11 Dec 2023 08:33:36 +0000 (16:33 +0800)]
wifi: rtw89: add XTAL SI for WiFi 7 chips

The XTAL SI is a serial interface to indirectly access registers of
analog hardware circuit. Since WiFi 7 chips use different registers, add
a ops to access them via common functions. This patch doesn't change logic
for existing chips.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231211083341.118047-2-pkshih@realtek.com
5 months agowifi: rtw89: phy: print out RFK log with formatted string
Ping-Ke Shih [Wed, 13 Dec 2023 00:50:54 +0000 (08:50 +0800)]
wifi: rtw89: phy: print out RFK log with formatted string

With formatted string loaded from firmware file, we can use the formatted
string ID and get corresponding string, and then use regular rtw89_debug()
to show the message if debug mask of RFK is enabled.

If the string ID doesn't present, fallback to print plain hexadecimal.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231213005054.10568-7-pkshih@realtek.com
5 months agowifi: rtw89: parse and print out RFK log from C2H events
Ping-Ke Shih [Wed, 13 Dec 2023 00:50:53 +0000 (08:50 +0800)]
wifi: rtw89: parse and print out RFK log from C2H events

RFK log events contains two types. One called RUN log is to reflect state
during RFK is running, and it replies on formatted string loaded from
firmware file, but print this type as plain hexadecimal only in this patch.
The other is REPORT log that reflects the final result of a RFK, and
each calibration has its own struct to carry many specific information.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231213005054.10568-6-pkshih@realtek.com
5 months agowifi: rtw89: add C2H event handlers of RFK log and report
Ping-Ke Shih [Wed, 13 Dec 2023 00:50:52 +0000 (08:50 +0800)]
wifi: rtw89: add C2H event handlers of RFK log and report

Trigger a RFK (RF calibration) in firmware by a H2C command, and in
progress it reports log and a result finally by C2H events. Firstly, add
prototype of the C2H event handlers to have a simple picture of framework.

The callers who trigger H2C will wait until a C2H event is received,
so we must process these C2H events in receiving process. Thus, mark this
kind of C2H events as atomic. Also, timestamp is also useful for
debugging, mark C2H events carrying RFK log as atomic as well.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231213005054.10568-5-pkshih@realtek.com
5 months agowifi: rtw89: load RFK log format string from firmware file
Ping-Ke Shih [Wed, 13 Dec 2023 00:50:51 +0000 (08:50 +0800)]
wifi: rtw89: load RFK log format string from firmware file

To debug RFK (RF calibration) in firmware, it sends log via firmware C2H
events to driver with string format ID and four arguments. Load formatted
string from firmware file, and the string ID can get back its string. Then,
use regular print format to show the message.

This firmware element layout looks like

    +============================================+
    |  elm ID  | elm size | version  |           |
    +----------+----------+----------+-----------+
    |                     | nr |rsvd |rfk_id|rsvd|
    +--------------------------------------------+
    | offset[] (__le16 * nr)                     |
    | ...                                        |
    +--------------------------------------------+
    | formatted string with null termintor (*nr) |
    | ...                                        |
    +============================================+

 * a firmware file can contains more than one elements with this element ID
   named RTW89_FW_ELEMENT_ID_RFKLOG_FMT (19), because many RFK needs its
   own formatted strings, so add 'rfk_id' to know it belongs to which RFK.
 * the 'formatted string' just follow 'offset[]' without padding to align
   32bits.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231213005054.10568-4-pkshih@realtek.com
5 months agowifi: rtw89: fw: add version field to BB MCU firmware element
Ping-Ke Shih [Wed, 13 Dec 2023 00:50:50 +0000 (08:50 +0800)]
wifi: rtw89: fw: add version field to BB MCU firmware element

8922AE has more than one hardware version, and they use different BB MCU
firmware, so occupy a byte from element priv[] to annotate version. Since
there are more than one firmware and only matched version is adopted,
return 1 to ignore not matched firmware.

     +===========================================+
     |  elm ID  | elm size | version  |          |
     +----------+----------+----------+----------+
     |                     |  element_priv[]     |
     +-------------------------------------------+

                change to  |
                           v

     +===========================================+
     |  elm ID  | elm size | version  |          |
     +----------+----------+----------+----------+
     |                     | cv | element_rsvd[] |
     +-------------------------------------------+

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231213005054.10568-3-pkshih@realtek.com
5 months agowifi: rtw89: fw: load TX power track tables from fw_element
Ping-Ke Shih [Wed, 13 Dec 2023 00:50:49 +0000 (08:50 +0800)]
wifi: rtw89: fw: load TX power track tables from fw_element

The TX power track tables are used to define compensation power reflected
to thermal value. Currently, we have 16 (2 * 4 * 2) tables made by
combinations of
  {negative/positive thermal value, 2GHz/2GHz-CCK/5GHz/6GHz, path A/B}

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231213005054.10568-2-pkshih@realtek.com
5 months agowifi: mwifiex: configure BSSID consistently when starting AP
David Lin [Fri, 15 Dec 2023 00:51:18 +0000 (08:51 +0800)]
wifi: mwifiex: configure BSSID consistently when starting AP

AP BSSID configuration is missing at AP start.  Without this fix, FW returns
STA interface MAC address after first init.  When hostapd restarts, it gets MAC
address from netdev before driver sets STA MAC to netdev again. Now MAC address
between hostapd and net interface are different causes STA cannot connect to
AP.  After that MAC address of uap0 mlan0 become the same. And issue disappears
after following hostapd restart (another issue is AP/STA MAC address become the
same).

This patch fixes the issue cleanly.

Signed-off-by: David Lin <yu-hao.lin@nxp.com>
Fixes: 12190c5d80bd ("mwifiex: add cfg80211 start_ap and stop_ap handlers")
Cc: stable@vger.kernel.org
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Tested-by: Rafael Beims <rafael.beims@toradex.com> # Verdin iMX8MP/SD8997 SD
Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231215005118.17031-1-yu-hao.lin@nxp.com
5 months agowifi: mwifiex: add extra delay for firmware ready
David Lin [Fri, 8 Dec 2023 23:40:29 +0000 (07:40 +0800)]
wifi: mwifiex: add extra delay for firmware ready

For SDIO IW416, due to a bug, FW may return ready before complete full
initialization. Command timeout may occur at driver load after reboot.
Workaround by adding 100ms delay at checking FW status.

Signed-off-by: David Lin <yu-hao.lin@nxp.com>
Cc: stable@vger.kernel.org
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Brian Norris <briannorris@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # Verdin AM62 (IW416)
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231208234029.2197-1-yu-hao.lin@nxp.com
5 months agowifi: mac80211: sta_info.c: fix sentence grammar
Randy Dunlap [Wed, 13 Dec 2023 05:48:09 +0000 (21:48 -0800)]
wifi: mac80211: sta_info.c: fix sentence grammar

Correct run-on sentences by changing "," to ";".

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: linux-wireless@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Link: https://msgid.link/20231213054809.23475-1-rdunlap@infradead.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: mac80211: rx.c: fix sentence grammar
Randy Dunlap [Wed, 13 Dec 2023 05:48:00 +0000 (21:48 -0800)]
wifi: mac80211: rx.c: fix sentence grammar

Correct a run-on sentence by changing "," to ";".
Add a subject in one sentence.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: linux-wireless@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Link: https://msgid.link/20231213054800.22561-1-rdunlap@infradead.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: nl80211: fix grammar & spellos
Randy Dunlap [Wed, 13 Dec 2023 04:43:15 +0000 (20:43 -0800)]
wifi: nl80211: fix grammar & spellos

Correct spelling as reported by codespell.
Correct run-on sentences and other grammar issues.
Add hyphenation of adjectives.
Correct some punctuation.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
Cc: Kalle Valo <kvalo@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Link: https://msgid.link/20231213044315.19459-1-rdunlap@infradead.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: cfg80211: fix spelling & punctutation
Randy Dunlap [Wed, 13 Dec 2023 04:35:58 +0000 (20:35 -0800)]
wifi: cfg80211: fix spelling & punctutation

Correct spelling and run-on sentences.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
Cc: Kalle Valo <kvalo@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Link: https://msgid.link/20231213043558.10409-1-rdunlap@infradead.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: cfg80211: sort certificates in build
Johannes Berg [Thu, 14 Dec 2023 11:03:49 +0000 (12:03 +0100)]
wifi: cfg80211: sort certificates in build

The build can become unreproducible if the list of files
found by $(wildcard ...) differs. Sort the list to avoid
this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: ath9k: reset survey of current channel after a scan started
Hancheng Yang [Tue, 5 Dec 2023 17:06:23 +0000 (18:06 +0100)]
wifi: ath9k: reset survey of current channel after a scan started

In the `ath_set_channel()` function, we only reset surveys that are not
from the current channel. This leads to the accumulation of survey data for
the current channel indefinitely. This may not be the most optimal
approach, as we want the ACS to rely on the most recent survey.
So reset the survey data for the current channel at the start of each scan.

Signed-off-by: Hancheng Yang <hyang@freebox.fr>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20231205170623.3029689-1-hyang@freebox.fr
5 months agowifi: ath12k: fix the issue that the multicast/broadcast indicator is not read correc...
Lingbo Kong [Wed, 6 Dec 2023 14:17:59 +0000 (22:17 +0800)]
wifi: ath12k: fix the issue that the multicast/broadcast indicator is not read correctly for WCN7850

We observe some packets are discarded in ieee80211_rx_handlers_result
function for WCN7850. This is because the way to get multicast/broadcast
indicator with RX_MSDU_END_INFO5_DA_IS_MCBC & info5 is incorrect. It should
use RX_MSDU_END_INFO13_MCAST_BCAST & info13 to get multicast/broadcast
indicator.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Lingbo Kong <quic_lingbok@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20231206141759.5430-1-quic_lingbok@quicinc.com
5 months agowifi: ath11k: Fix ath11k_htc_record flexible record
Jeff Johnson [Tue, 5 Dec 2023 21:00:17 +0000 (13:00 -0800)]
wifi: ath11k: Fix ath11k_htc_record flexible record

Transform the zero-length ath11k_htc_record::credit_report array into
a proper flexible array. Since this is the only array in
ath11k_htc_record, remove the unnecessary union.

Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20231205-flexarray-htc_record-v2-1-fbb56d436951@quicinc.com
5 months agowifi: iwlegacy: Add null pointer check to il_leds_init()
Kunwu Chan [Mon, 11 Dec 2023 03:30:19 +0000 (11:30 +0800)]
wifi: iwlegacy: Add null pointer check to il_leds_init()

kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure.

Cc: Kunwu Chan <kunwu.chan@hotmail.com>
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231211033019.238149-1-chentao@kylinos.cn
5 months agowifi: rtw88: Use random MAC when efuse MAC invalid
Chris Morgan [Fri, 8 Dec 2023 15:07:39 +0000 (09:07 -0600)]
wifi: rtw88: Use random MAC when efuse MAC invalid

When the MAC address read from the efuse data is invalid, warn the
user and use a random MAC address instead.

On a device I am currently using (Anbernic RG-ARC) with a rtw8821cs
the efuse appears to be incompletely/improperly programmed. The MAC
address reads as ff:ff:ff:ff:ff:ff. When networkmanager attempts to
initiate a connection (and I haven't hard-coded a MAC address or
set it to random) it fails to establish a connection.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231208150739.129753-1-macroalpha82@gmail.com
5 months agowifi: wfx: fix possible NULL pointer dereference in wfx_set_mfp_ap()
Dmitry Antipov [Mon, 4 Dec 2023 17:11:28 +0000 (20:11 +0300)]
wifi: wfx: fix possible NULL pointer dereference in wfx_set_mfp_ap()

Since 'ieee80211_beacon_get()' can return NULL, 'wfx_set_mfp_ap()'
should check the return value before examining skb data. So convert
the latter to return an appropriate error code and propagate it to
return from 'wfx_start_ap()' as well. Compile tested only.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Tested-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Acked-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231204171130.141394-1-dmantipov@yandex.ru
5 months agowifi: rtw89: avoid stringop-overflow warning
Arnd Bergmann [Mon, 4 Dec 2023 07:30:13 +0000 (08:30 +0100)]
wifi: rtw89: avoid stringop-overflow warning

After -Wstringop-overflow got enabled, the rtw89 driver produced
two odd warnings with gcc-13:

drivers/net/wireless/realtek/rtw89/coex.c: In function 'rtw89_btc_ntfy_scan_start':
drivers/net/wireless/realtek/rtw89/coex.c:5362:50: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
 5362 |                 wl->dbcc_info.scan_band[phy_idx] = band;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
In file included from drivers/net/wireless/realtek/rtw89/coex.h:8,
                 from drivers/net/wireless/realtek/rtw89/coex.c:5:
drivers/net/wireless/realtek/rtw89/core.h:1441:12: note: at offset [64, 255] into destination object 'scan_band' of size 2
 1441 |         u8 scan_band[RTW89_PHY_MAX]; /* scan band in  each phy */
      |            ^~~~~~~~~
drivers/net/wireless/realtek/rtw89/coex.c: In function 'rtw89_btc_ntfy_switch_band':
drivers/net/wireless/realtek/rtw89/coex.c:5406:50: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
 5406 |                 wl->dbcc_info.scan_band[phy_idx] = band;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
drivers/net/wireless/realtek/rtw89/core.h:1441:12: note: at offset [64, 255] into destination object 'scan_band' of size 2
 1441 |         u8 scan_band[RTW89_PHY_MAX]; /* scan band in  each phy */
      |            ^~~~~~~~~

I don't know what happened here, but adding an explicit range check
shuts up the output.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231204073020.1105416-1-arnd@kernel.org
5 months agoMerge tag 'mt76-for-kvalo-2023-12-06' of https://github.com/nbd168/wireless
Kalle Valo [Tue, 12 Dec 2023 15:03:55 +0000 (17:03 +0200)]
Merge tag 'mt76-for-kvalo-2023-12-06' of https://github.com/nbd168/wireless

mt76 patches for 6.8

* fixes
* nvmem eeprom improvements
* mt7996 eht improvements
* mt7996 wed support
* mt7996 36-bit DMA support

5 months agowifi: mac80211: drop spurious WARN_ON() in ieee80211_ibss_csa_beacon()
Dmitry Antipov [Fri, 8 Dec 2023 15:31:25 +0000 (18:31 +0300)]
wifi: mac80211: drop spurious WARN_ON() in ieee80211_ibss_csa_beacon()

The WARN_ON() in subject was actually seen only once, with 5.10.200
under syzkaller. It looks like a weird artifact of (ab?)using the
syzkaller itself [1], and hopefully may be safely removed.

[1] https://lore.kernel.org/linux-wireless/1bd8f266-dee0-4d4e-9b50-e22546b55763@yandex.ru/T/#u

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://msgid.link/20231208153130.107409-1-dmantipov@yandex.ru
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: mac80211: don't set ESS capab bit in assoc request
Johannes Berg [Mon, 11 Dec 2023 07:05:29 +0000 (09:05 +0200)]
wifi: mac80211: don't set ESS capab bit in assoc request

The ESS capability bit is reserved in frames transmitted by
the client, so we shouldn't set it. Since we've set it for
decades, keep that old behaviour unless we're connection to
a new EHT AP.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231211085121.65005aba900b.I3d00c8741400572a89a7508b5ae612c968874ad7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: cfg80211: consume both probe response and beacon IEs
Benjamin Berg [Mon, 11 Dec 2023 07:05:28 +0000 (09:05 +0200)]
wifi: cfg80211: consume both probe response and beacon IEs

When doing a channel switch, cfg80211_update_known_bss may be called
with a BSS where both proberesp_ies and beacon_ies is set. If that
happens, both need to be consumed.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231211085121.07a88656d7df.I0fe9fc599382de0eccf96455617e377d9c231966@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: cfg80211: generate an ML element for per-STA profiles
Benjamin Berg [Mon, 11 Dec 2023 07:05:27 +0000 (09:05 +0200)]
wifi: cfg80211: generate an ML element for per-STA profiles

The specification says that this information should not be explicitly
included in the per-STA profile. However, we need this information
readily available in the BSS for userspace and also internally when
associating. As such, append the appropriate element before
adding/updating the BSS.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231211085121.abde63d9cc6d.I3d346be0f84f51dccf4f4f92a3e997e6102b9456@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: cfg80211: Replace ENOTSUPP with EOPNOTSUPP
Andrei Otcheretianski [Mon, 11 Dec 2023 07:05:26 +0000 (09:05 +0200)]
wifi: cfg80211: Replace ENOTSUPP with EOPNOTSUPP

ENOTSUPP isn't a standard error code, don't use it.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231211085121.0214b6c79756.I2536bc8426ae15c8cff7ad199e57f06e2e404f13@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: mac80211: Replace ENOTSUPP with EOPNOTSUPP
Andrei Otcheretianski [Mon, 11 Dec 2023 07:05:25 +0000 (09:05 +0200)]
wifi: mac80211: Replace ENOTSUPP with EOPNOTSUPP

ENOTSUP isn't a standard error code. EOPNOTSUPP should be used instead.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231211085121.3841b71c867d.Idf2ad01d9dfe8d6d6c352bf02deb06e49701ad1d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: mac80211: add a flag to disallow puncturing
Johannes Berg [Mon, 11 Dec 2023 07:05:23 +0000 (09:05 +0200)]
wifi: mac80211: add a flag to disallow puncturing

There may be cases where puncturing isn't possible, and
a connection needs to be downgraded. Add a hardware flag
to support this.

This is likely temporary: it seems we will need to move
puncturing to the chandef/channel context.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231211085121.c1e89ea55e93.I37b8ca0ee64d5d7699e351785a9010afc106da3c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: cfg80211: Add support for setting TID to link mapping
Ilan Peer [Mon, 11 Dec 2023 07:05:22 +0000 (09:05 +0200)]
wifi: cfg80211: Add support for setting TID to link mapping

Add support for setting the TID to link mapping for a non-AP MLD
station.

This is useful in cases user space needs to restrict the possible
set of active links, e.g., since it got a BSS Transition Management
request forcing to use only a subset of the valid links etc.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231211085121.da4d56a5f3ff.Iacf88e943326bf9c169c49b728c4a3445fdedc97@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: mac80211: update some locking documentation
Johannes Berg [Mon, 11 Dec 2023 07:05:21 +0000 (09:05 +0200)]
wifi: mac80211: update some locking documentation

With the locking rework, more functions need to be called
with the wiphy mutex held. Document that, and for that use
the "Context" description that shows up more nicely in the
generated documentation.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231211085121.24fa44c7eeb4.I8c9e030ddd78e07c99dd21fe1d5156555390f92e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: cfg80211: add BSS usage reporting
Johannes Berg [Mon, 11 Dec 2023 07:05:20 +0000 (09:05 +0200)]
wifi: cfg80211: add BSS usage reporting

Sometimes there may be reasons for which a BSS that's
actually found in scan cannot be used to connect to,
for example a nonprimary link of an NSTR mobile AP MLD
cannot be used for normal direct connections to it.

Not indicating these to userspace as we do now of course
avoids being able to connect to them, but it's better if
they're shown to userspace and it can make an appropriate
decision, without e.g. doing an additional ML probe.

Thus add an indication of what a BSS can be used for,
currently "normal" and "MLD link", including a reason
bitmap for it being not usable.

The latter can be extended later for certain BSSes if there
are other reasons they cannot be used.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231211085121.0464f25e0b1d.I9f70ca9f1440565ad9a5207d0f4d00a20cca67e7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: iwlwifi: mvm: do not send STA_DISABLE_TX_CMD for newer firmware
Emmanuel Grumbach [Thu, 7 Dec 2023 02:50:16 +0000 (04:50 +0200)]
wifi: iwlwifi: mvm: do not send STA_DISABLE_TX_CMD for newer firmware

Newest firmware has completely offloaded this logic and this command
will be deprecated soon. Based on a capability bit advertised by the
firmware, skip this command.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.e64ef70c0133.I9f47cdef2ba45f1f383b70023857376973de3a8c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: iwlwifi: remove async command callback
Johannes Berg [Thu, 7 Dec 2023 02:50:15 +0000 (04:50 +0200)]
wifi: iwlwifi: remove async command callback

There's only one user of this code, which is STA unblock
during sleep for uAPSD on really old devices. Instead of
having this all through the API with calls up and down,
just implemented a special-case CMD_BLOCK_TXQS flag for
this, it's only needed in the old gen1 transport.

While at it, fix a complain that lockdep would have, as
we lock the cmd queue and then the TXQs in the reclaim
by using spin_lock_nested(). We no longer need to disable
BHs in iwl_trans_pcie_block_txq_ptrs() since it's called
with them disabled already.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.2bd95e0570fc.I16486dbc82570d2f73a585872f5394698627310d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: iwlwifi: fw: file: don't use [0] for variable arrays
Johannes Berg [Thu, 7 Dec 2023 02:50:14 +0000 (04:50 +0200)]
wifi: iwlwifi: fw: file: don't use [0] for variable arrays

This causes fortify warnings when compiled against recent kernels
with recent compilers, and generally is not supported in the kernel
anymore.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.367a2c77b9be.I4964ec8ca1d30c7c3163f9873814c8205a1a14eb@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: iwlwifi: pcie: get_crf_id() can be void
Johannes Berg [Thu, 7 Dec 2023 02:50:13 +0000 (04:50 +0200)]
wifi: iwlwifi: pcie: get_crf_id() can be void

This never returns an error and the return value is never
checked anyway, so it can just be void.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.898b7e99206f.I61378115093fe70e6f5baca7f334651e4190eb3b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: iwlwifi: pcie: dump CSRs before removal
Johannes Berg [Thu, 7 Dec 2023 02:50:12 +0000 (04:50 +0200)]
wifi: iwlwifi: pcie: dump CSRs before removal

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.a0e2198e9afd.I3bf737ba5ec1b3013218001e808f6bae0c834543@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: iwlwifi: pcie: clean up device removal work
Johannes Berg [Thu, 7 Dec 2023 02:50:11 +0000 (04:50 +0200)]
wifi: iwlwifi: pcie: clean up device removal work

We shouldn't access the device if we don't hold a reference,
and if - after locking - we see that it has no bus, we also
can't do anything, in fact, pci_stop_and_remove_bus_device()
will be a no-op.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.6c0879e695f7.I1d3ce75ecad32a4cbf1b9dad61bfb7bc7821fdd9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: iwlwifi: mvm: add a debugfs hook to clear the monitor data
Emmanuel Grumbach [Thu, 7 Dec 2023 02:50:10 +0000 (04:50 +0200)]
wifi: iwlwifi: mvm: add a debugfs hook to clear the monitor data

This can be used by the user space when it wants to clear the data we
collected so far for privacy reasons.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.d5e97d5ec0d9.I7a5e836e6109e1fce7e6301dba8d1f28e60a5440@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: iwlwifi: refactor RX tracing
Johannes Berg [Thu, 7 Dec 2023 02:50:09 +0000 (04:50 +0200)]
wifi: iwlwifi: refactor RX tracing

When there's not going to be any data in the data event, we
don't need to add it at all (unlike the TX version, it has
no data at all.)

Also combine the tracing into a separate inline so we only
call iwl_rx_trace_len() once, which also simplifies things,
and lets us have a single place to later add other checks.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.13325a4848d2.Ic9e7d794fc4aebfe5ac5136b539ee62789f210f3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: iwlwifi: don't support triggered EHT CQI feedback
Miri Korenblit [Thu, 7 Dec 2023 02:50:08 +0000 (04:50 +0200)]
wifi: iwlwifi: don't support triggered EHT CQI feedback

EHT CQI is one of the EHT PHY capabilities. We don't support EHT CQI.
The non-triggered CQI feedback bit was unset in a previous patch,
but the triggered CQI feedback bit wasn't. Unset it.

Fixes: 0e21ec6edbb5 ("wifi: iwlwifi: nvm: Update EHT capabilities for GL device")
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.092528daf59e.I5715769490835819beddb00c91bbc9e806e170cb@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: iwlwifi: mvm: Correctly report TSF data in scan complete
Ilan Peer [Thu, 7 Dec 2023 02:50:07 +0000 (04:50 +0200)]
wifi: iwlwifi: mvm: Correctly report TSF data in scan complete

For an MLO connection, the BSSID of the link used during the scanning
should be used (and not the one from the default link).

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.1e67dba640c1.I6c4941bfab3a04498370e58b402c64d990c39fbf@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: iwlwifi: mvm: Use the link ID provided in scan request
Ilan Peer [Thu, 7 Dec 2023 02:50:06 +0000 (04:50 +0200)]
wifi: iwlwifi: mvm: Use the link ID provided in scan request

If a valid link ID was provided in the scan request use it instead
of picking one of the active links.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.84e21c01b79d.Ib5f546d35542c6c561f5b944c08c9b1850f44146@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: nl80211: Extend del pmksa support for SAE and OWE security
Vinayak Yadawad [Wed, 29 Nov 2023 12:50:43 +0000 (18:20 +0530)]
wifi: nl80211: Extend del pmksa support for SAE and OWE security

Current handling of del pmksa with SSID is limited to FILS
security. In the current change the del pmksa support is extended
to SAE/OWE security offloads as well. For OWE/SAE offloads, the
PMK is generated and cached at driver/FW, so user app needs the
capability to request cache deletion based on SSID for drivers
supporting SAE/OWE offload.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
Link: https://msgid.link/ecdae726459e0944c377a6a6f6cb2c34d2e057d0.1701262123.git.vinayak.yadawad@broadcom.com
[drop whitespace-damaged rdev_ops pointer completely, enabling tracing]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: mac80211: cleanup airtime arithmetic with ieee80211_sta_keep_active()
Dmitry Antipov [Wed, 6 Dec 2023 06:09:27 +0000 (09:09 +0300)]
wifi: mac80211: cleanup airtime arithmetic with ieee80211_sta_keep_active()

Prefer native jiffies-wide 'unsigned long' for the 'last_active' field of
'struct airtime_info' and introduce 'ieee80211_sta_keep_active()' for airtime
check in 'ieee80211_txq_keep_active()' and 'ieee80211_sta_register_airtime()'.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Reviewed-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://msgid.link/20231206060935.612241-1-dmantipov@yandex.ru
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: mac80211: Add support for WBRF features
Evan Quan [Mon, 11 Dec 2023 10:06:25 +0000 (18:06 +0800)]
wifi: mac80211: Add support for WBRF features

To support the WBRF mechanism, Wifi adapters utilized in the system must
register the frequencies in use (or unregister those frequencies no longer
used) via the dedicated calls. So that, other drivers responding to the
frequencies can take proper actions to mitigate possible interference.

Co-developed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Evan Quan <quanliangl@hotmail.com>
Signed-off-by: Evan Quan <quanliangl@hotmail.com>
Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Link: https://msgid.link/20231211100630.2170152-5-Jun.Ma2@amd.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: cfg80211: expose nl80211_chan_width_to_mhz for wide sharing
Evan Quan [Mon, 11 Dec 2023 10:06:24 +0000 (18:06 +0800)]
wifi: cfg80211: expose nl80211_chan_width_to_mhz for wide sharing

The newly added WBRF feature needs this interface for channel
width calculation.

Signed-off-by: Evan Quan <quanliangl@hotmail.com>
Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://msgid.link/20231211100630.2170152-4-Jun.Ma2@amd.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agoMerge tag 'platform-drivers-x86-amd-wbrf-v6.8-1' into wireless-next
Johannes Berg [Tue, 12 Dec 2023 08:36:25 +0000 (09:36 +0100)]
Merge tag 'platform-drivers-x86-amd-wbrf-v6.8-1' into wireless-next

Merge the platform drivers tag for WRBF. Hans says:

   Immutable branch between pdx86 amd wbrf branch and wifi / amdgpu due for the v6.8 merge window

   platform-drivers-x86-amd-wbrf-v6.8-1: v6.7-rc1 + AMD WBRF support
   for merging into the wifi subsys and amdgpu driver for 6.8.

Merge it so we can apply the wifi tie-in for this feature.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 months agowifi: mt76: mt7921: fix wrong 6Ghz power type
Ming Yen Hsieh [Wed, 22 Nov 2023 03:06:46 +0000 (11:06 +0800)]
wifi: mt76: mt7921: fix wrong 6Ghz power type

To avoid using incorrect 6g power settings after disconnection,
it should to update back to the default state when disconnected.

Fixes: 51ba0e3a15eb ("wifi: mt76: mt7921: add 6GHz power type support for clc")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7921: fix CLC command timeout when suspend/resume
Ming Yen Hsieh [Wed, 22 Nov 2023 03:06:45 +0000 (11:06 +0800)]
wifi: mt76: mt7921: fix CLC command timeout when suspend/resume

When enter suspend/resume while in a connected state, the upper layer
will trigger disconnection before entering suspend, and at the same time,
it will trigger regd_notifier() and update CLC, causing the CLC event to
not be received due to suspend, resulting in a command timeout.

Therefore, the update of CLC is postponed until resume, to ensure data
consistency and avoid the occurrence of command timeout.

Fixes: 4fc8df50fd41 ("wifi: mt76: mt7921: get regulatory information from the clc event")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7921: fix country count limitation for CLC
Ming Yen Hsieh [Wed, 22 Nov 2023 03:06:44 +0000 (11:06 +0800)]
wifi: mt76: mt7921: fix country count limitation for CLC

Due to the increase in the number of power tables for 6Ghz on CLC,
the variable nr_country is no longer sufficient to represent the
total quantity. Therefore, we have switched to calculating the
length of clc buf to obtain the correct power table. Additionally,
the version number has been incremented to 1.

Fixes: 23bdc5d8cadf ("wifi: mt76: mt7921: introduce Country Location Control support")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7921: reduce the size of MCU firmware download Rx queue
Sean Wang [Tue, 21 Nov 2023 22:27:22 +0000 (06:27 +0800)]
wifi: mt76: mt7921: reduce the size of MCU firmware download Rx queue

We actually don't need the reserve the 512 entries for the MCU firmware
download Rx queue because the queue was only used in the firmware download
phase to save the most of space and the reduction can significantly help
with reducing latency we spent by ~20% further in resetting the Rx queue
as the device was waking up from deep sleep mode.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: set DMA mask to 36 bits for boards with more than 4GB of RAM
Sujuan Chen [Fri, 17 Nov 2023 17:13:19 +0000 (18:13 +0100)]
wifi: mt76: mt7996: set DMA mask to 36 bits for boards with more than 4GB of RAM

Introduce the capability to run mt7996 driver on boards with more than
4GB of memory.

Co-developed-by: Rex Lu <rex.lu@mediatek.com>
Signed-off-by: Rex Lu <rex.lu@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agoplatform/x86/amd: Add support for AMD ACPI based Wifi band RFI mitigation feature
Ma Jun [Mon, 11 Dec 2023 10:06:23 +0000 (18:06 +0800)]
platform/x86/amd: Add support for AMD ACPI based Wifi band RFI mitigation feature

Due to electrical and mechanical constraints in certain platform designs
there may be likely interference of relatively high-powered harmonics of
the (G-)DDR memory clocks with local radio module frequency bands used
by Wifi 6/6e/7.

To mitigate this, AMD has introduced a mechanism that devices can use to
notify active use of particular frequencies so that other devices can make
relative internal adjustments as necessary to avoid this resonance.

Co-developed-by: Evan Quan <quanliangl@hotmail.com>
Signed-off-by: Evan Quan <quanliangl@hotmail.com>
Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
5 months agoDocumentation/driver-api: Add document about WBRF mechanism
Ma Jun [Mon, 11 Dec 2023 10:06:22 +0000 (18:06 +0800)]
Documentation/driver-api: Add document about WBRF mechanism

Add documentation about AMD's Wifi band RFI mitigation (WBRF) mechanism
explaining the theory and how it is used.

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
5 months agowifi: mt76: mt7921s: fix workqueue problem causes STA association fail
Wang Zhao [Fri, 17 Nov 2023 12:54:49 +0000 (20:54 +0800)]
wifi: mt76: mt7921s: fix workqueue problem causes STA association fail

The ieee80211_queue_work function queues work into the mac80211
local->workqueue, which is widely used for mac80211 internal
work processes. In the mt76 driver, both the mt76-sido-status and
mt76-sdio-net threads enqueue workers to the workqueue with this
function. However, in some cases, when two workers are enqueued
to the workqueue almost simultaneously, the second worker may not
be scheduled immediately and may get stuck for a while.
This can cause timing issues. To avoid these timing
conflicts caused by worker scheduling, replace the worker
with an independent thread.

Fixes: 48fab5bbef40 ("mt76: mt7921: introduce mt7921s support")
Signed-off-by: Wang Zhao <wang.zhao@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: Convert to platform remove callback returning void
Uwe Kleine-König [Fri, 17 Nov 2023 09:31:03 +0000 (10:31 +0100)]
wifi: mt76: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert the three mt76 drivers from always returning zero in
the remove callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7925: remove iftype from mt7925_init_eht_caps signature
Lorenzo Bianconi [Mon, 13 Nov 2023 10:16:19 +0000 (11:16 +0100)]
wifi: mt76: mt7925: remove iftype from mt7925_init_eht_caps signature

Get rid of nl80211_iftype from mt7925_init_eht_caps routine signature
since it is not actually used.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: add PCI IDs for mt7992
StanleyYP Wang [Mon, 13 Nov 2023 07:06:19 +0000 (15:06 +0800)]
wifi: mt76: mt7996: add PCI IDs for mt7992

Add PCI device IDs to enable mt7992 chipsets support.

Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: connac: add new definition of tx descriptor
Benjamin Lin [Mon, 13 Nov 2023 07:06:18 +0000 (15:06 +0800)]
wifi: mt76: connac: add new definition of tx descriptor

Add MT_TXD6_MSDU_CNT_V2 bitfield, which is used by mt7992 chipsets.
This is a preliminary patch for mt7992 chipsets support.

Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: adjust interface num and wtbl size for mt7992
StanleyYP Wang [Mon, 13 Nov 2023 07:06:17 +0000 (15:06 +0800)]
wifi: mt76: mt7996: adjust interface num and wtbl size for mt7992

MT7992 chipsets support up to 32 interfaces (with maximum 19 per-band)
and 512 station entries.
This is a preliminary patch for mt7992 chipsets support.

Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: support mt7992 eeprom loading
StanleyYP Wang [Mon, 13 Nov 2023 07:06:16 +0000 (15:06 +0800)]
wifi: mt76: mt7996: support mt7992 eeprom loading

Add the default eeprom and 0x7992 check to mt7996_check_eeprom().
This is a preliminary patch for mt7992 chipsets support.

Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: rework register offsets for mt7992
StanleyYP Wang [Mon, 13 Nov 2023 07:06:15 +0000 (15:06 +0800)]
wifi: mt76: mt7996: rework register offsets for mt7992

Add mt7992_offs to differentiate registers that share the same
definitions with mt7996 chipsets but have differnet offsets.
This is a preliminary patch for mt7992 chipsets support.

Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: add DMA support for mt7992
Benjamin Lin [Mon, 13 Nov 2023 07:06:14 +0000 (15:06 +0800)]
wifi: mt76: mt7996: add DMA support for mt7992

Add DMA TX/RX queues and RRO init flow for mt7992 chipsets.
This is a preliminary patch for mt7992 chipsets support.

Co-developed-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: connac: add firmware support for mt7992
StanleyYP Wang [Mon, 13 Nov 2023 07:06:13 +0000 (15:06 +0800)]
wifi: mt76: connac: add firmware support for mt7992

Support firmware download and enable related AFE PLL for mt7992 chipsets.
This is a preliminary patch for mt7992 chipsets support.

Co-developed-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: introduce mt7996_band_valid()
Shayne Chen [Mon, 13 Nov 2023 07:06:12 +0000 (15:06 +0800)]
wifi: mt76: mt7996: introduce mt7996_band_valid()

Replace dbdc_support and tbtc_support with mt7996_band_valid() to
support mt7996 variants with band0/band2 dual-band support.
This changes reduces ambiguity when checking supported bands on different
variants or new chipsets, as well as during the init configurations on
DMA TX/RX queues or irq masks.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: fix mt7996_mcu_all_sta_info_event struct packing
Arnd Bergmann [Fri, 10 Nov 2023 14:29:30 +0000 (15:29 +0100)]
wifi: mt76: mt7996: fix mt7996_mcu_all_sta_info_event struct packing

The internal struct and union inside mt7996_mcu_all_sta_info_event is
marked as being aligned, which conflicts with it being unaligned
within that structure:

drivers/net/wireless/mediatek/mt76/mt7996/mcu.h:165:2: error: field  within 'struct mt7996_mcu_all_sta_info_event' is less aligned than 'union mt7996_mcu_all_sta_info_event::(anonymous at ../drivers/net/wireless/mediatek/mt76/mt7996/mcu.h:165:2)' and is usually due to 'struct mt7996_mcu_all_sta_info_event' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]

Mark all three as being packed as well to ensure byte packing for
the entire thing.

Fixes: adde3eed4a75 ("wifi: mt76: mt7996: Add mcu commands for getting sta tx statistic")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7915: also MT7981 is 3T3R but nss2 on 5 GHz band
StanleyYP Wang [Mon, 6 Nov 2023 22:39:31 +0000 (22:39 +0000)]
wifi: mt76: mt7915: also MT7981 is 3T3R but nss2 on 5 GHz band

Just like MT7916 also MT7981 can handle 3T3R DBDC frontend and should
hence be included in the corresponding conditional expression in the
driver. Add it.

Fixes: 6bad146d162e ("wifi: mt76: mt7915: add support for MT7981")
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7915: fix EEPROM offset of TSSI flag on MT7981
StanleyYP Wang [Mon, 6 Nov 2023 22:38:53 +0000 (22:38 +0000)]
wifi: mt76: mt7915: fix EEPROM offset of TSSI flag on MT7981

The offset of the TSSI flag on the EEPROM of MT7981 devices was wrong.
Set the correct offset instead.

Fixes: 6bad146d162e ("wifi: mt76: mt7915: add support for MT7981")
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: connac: fix EHT phy mode check
MeiChia Chiu [Thu, 2 Nov 2023 10:03:02 +0000 (18:03 +0800)]
wifi: mt76: connac: fix EHT phy mode check

Add a BSS eht_support check before returning EHT phy mode. Without this
patch, there might be an inconsistency where the softmac layer thinks
the BSS is in HE mode, while the FW thinks it is in EHT mode.

Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: connac: add beacon protection support for mt7996
Allen Ye [Thu, 2 Nov 2023 10:03:01 +0000 (18:03 +0800)]
wifi: mt76: connac: add beacon protection support for mt7996

Implement beacon protection feature for mt7996 chipsets, and also do
some cleanup on the set key routine.

Co-developed-by: Rudra Shahi <rudra.shahi@mediatek.com>
Signed-off-by: Rudra Shahi <rudra.shahi@mediatek.com>
Signed-off-by: Allen Ye <allen.ye@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: rework ampdu params setting
Peter Chiu [Thu, 2 Nov 2023 10:03:00 +0000 (18:03 +0800)]
wifi: mt76: mt7996: rework ampdu params setting

Add sta_rec_ht_uni struct to pass HT ampdu params to firmware. For VHT,
HE, and EHT mode, firmware will get the ampdu params by parsing the
corresponding capability.

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>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: fix alignment of sta info event
StanleyYP Wang [Thu, 2 Nov 2023 10:02:59 +0000 (18:02 +0800)]
wifi: mt76: mt7996: fix alignment of sta info event

Fix the alignment of struct mt7996_mcu_all_sta_info_event.

Fixes: adde3eed4a75 ("wifi: mt76: mt7996: Add mcu commands for getting sta tx statistic")
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: switch to mcu command for TX GI report
Benjamin Lin [Thu, 2 Nov 2023 10:02:58 +0000 (18:02 +0800)]
wifi: mt76: mt7996: switch to mcu command for TX GI report

During runtime, the GI value in the WTBL is not updated in real-time. To
obtain the latest results for the TX GI, switch to use an MCU command.

Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: use chainmask for power delta calculation
Allen Ye [Thu, 2 Nov 2023 10:02:57 +0000 (18:02 +0800)]
wifi: mt76: use chainmask for power delta calculation

The power gain value is related to total TX path, so change the
calculation to use per-phy chainmask.

Signed-off-by: Allen Ye <allen.ye@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: add txpower setting support
Shayne Chen [Thu, 2 Nov 2023 10:02:56 +0000 (18:02 +0800)]
wifi: mt76: mt7996: add txpower setting support

Add support for setting txpower from upper layer and configuring per-rate
txpower limit table.

Co-developed-by: Allen Ye <allen.ye@mediatek.com>
Signed-off-by: Allen Ye <allen.ye@mediatek.com>
Co-developed-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: change txpower init to per-phy
Shayne Chen [Thu, 2 Nov 2023 10:02:55 +0000 (18:02 +0800)]
wifi: mt76: change txpower init to per-phy

Use per-phy structure for maximum txpower value initializing, since each
phy may have a different chainmask, which can impact the calculation of
power gain.

Co-developed-by: Allen Ye <allen.ye@mediatek.com>
Signed-off-by: Allen Ye <allen.ye@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: fix rate usage of inband discovery frames
MeiChia Chiu [Mon, 23 Oct 2023 15:38:54 +0000 (23:38 +0800)]
wifi: mt76: mt7996: fix rate usage of inband discovery frames

For UBPR and FILS frames, the BSS_CHANGED_BEACON flag will also be set,
which causes those frames to use the beacon rate in TX descriptors.
Adjust the statement to fix this issue.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: align the format of fixed rate command
Peter Chiu [Mon, 23 Oct 2023 15:38:53 +0000 (23:38 +0800)]
wifi: mt76: mt7996: align the format of fixed rate command

Use the new fixed rate command format to let the fixed field function
work normally.

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: handle IEEE80211_RC_SMPS_CHANGED
Peter Chiu [Mon, 23 Oct 2023 15:38:52 +0000 (23:38 +0800)]
wifi: mt76: mt7996: handle IEEE80211_RC_SMPS_CHANGED

Make mt7996_mcu_set_fixed_field() non-static in order to handle
IEEE80211_RC_SMPS_CHANGED in mt7996_mac_sta_rc_work().

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: connac: set fixed_bw bit in TX descriptor for fixed rate frames
Howard Hsu [Mon, 23 Oct 2023 15:38:51 +0000 (23:38 +0800)]
wifi: mt76: connac: set fixed_bw bit in TX descriptor for fixed rate frames

Always set the fixed_bw bitfield for fixed rate frames to keep it being
sent with specific bandwidth. Without this change, the bw of fixed rate
frames will still be decided by hardware.

Reported-by: Chank Chen <chank.chen@mediatek.com>
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: adjust WFDMA settings to improve performance
Peter Chiu [Mon, 23 Oct 2023 15:38:50 +0000 (23:38 +0800)]
wifi: mt76: mt7996: adjust WFDMA settings to improve performance

Refactor and update dma prefetch parts and also split band 1 traffic to
PCIe 1 to enhance throughput.

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: fix the size of struct bss_rate_tlv
Sujuan Chen [Mon, 23 Oct 2023 15:38:49 +0000 (23:38 +0800)]
wifi: mt76: mt7996: fix the size of struct bss_rate_tlv

Align the format of struct bss_rate_tlv to the firmware.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: connac: add beacon duplicate TX mode support for mt7996
StanleyYP Wang [Mon, 23 Oct 2023 15:38:48 +0000 (23:38 +0800)]
wifi: mt76: connac: add beacon duplicate TX mode support for mt7996

For connac3 chipsets, setting of spe_idx is moved from TX descriptor to
the fixed rate table. This patch implements the setting to support
duplicate TX mode for beacon.

Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: add thermal sensor device support
Howard Hsu [Mon, 23 Oct 2023 15:38:47 +0000 (23:38 +0800)]
wifi: mt76: mt7996: add thermal sensor device support

This patch adds support for thermal sensor device, including the
following features:
- Support to read current chip temperature.
- Support to set/get the trigger/restore temperature for thermal service.
- Support to read current chip tx cycle.

Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: connac: add thermal protection support for mt7996
Howard Hsu [Mon, 23 Oct 2023 15:38:46 +0000 (23:38 +0800)]
wifi: mt76: connac: add thermal protection support for mt7996

Implement thermal protection commands and support Linux cooling device
control for mt7996 chipsets.

Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: add TX statistics for EHT mode in debugfs
Howard Hsu [Mon, 23 Oct 2023 15:38:45 +0000 (23:38 +0800)]
wifi: mt76: mt7996: add TX statistics for EHT mode in debugfs

Add EHT statistics of beamforming feedback and BW320 in debugfs tx_stats
command.

Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: add support for variants with auxiliary RX path
Shayne Chen [Mon, 23 Oct 2023 15:38:44 +0000 (23:38 +0800)]
wifi: mt76: mt7996: add support for variants with auxiliary RX path

Add support to correctly configure the rx chainmask of variants that
have additional auxiliary RX path. e.g., 4T5R.
The auxiliary RX path is transparent to driver, but driver needs to
correctly configure it in the set channel fw command.

Co-developed-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7915: fallback to non-wed mode if platform_get_resource fails in mt7915...
Lorenzo Bianconi [Fri, 20 Oct 2023 10:45:19 +0000 (12:45 +0200)]
wifi: mt76: mt7915: fallback to non-wed mode if platform_get_resource fails in mt7915_mmio_wed_init()

mt76 assumes mt7915_mmio_wed_init can fail just after wed driver has
been attached running mtk_wed_device_attach().
Fall back to non-wed mode if platform_get_resource fails in
mt7915_mmio_wed_init routines.

Fixes: eebb70976be5 ("wifi: mt76: mt7915: enable wed for mt7986-wmac chipset")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 months agowifi: mt76: mt7996: add wed rro delete session garbage collector
Lorenzo Bianconi [Fri, 20 Oct 2023 10:31:00 +0000 (12:31 +0200)]
wifi: mt76: mt7996: add wed rro delete session garbage collector

Introduce the capability to clear WED rro session configured in the hw
according to the event reported by the MCU firmware

Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>