Kuan-Chung Chen [Thu, 22 Sep 2022 01:27:19 +0000 (09:27 +0800)]
wifi: rtw89: disable 26-tone RU HE TB PPDU transmissions
Align with the spec of 802.11ax, follow the conditions for not responding
with an HE TB PPDU. When there are OBSS that cannot interpret 26-tone RU
transmissions, we should disable such transmissions.
Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220922012719.15037-1-pkshih@realtek.com
Dian-Syuan Yang [Thu, 22 Sep 2022 01:04:35 +0000 (09:04 +0800)]
wifi: rtw89: support for processing P2P power saving
Support P2P client to process Notice of Absence (NoA) mechanism when it
connects with P2P GO applying an NoA schedule. We define some action
types including init, update, remove and terminate in h2c function to
enable/disable NoA schedule.
Signed-off-by: Dian-Syuan Yang <dian_syuan0116@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220922010435.12167-6-pkshih@realtek.com
Dian-Syuan Yang [Thu, 22 Sep 2022 01:04:34 +0000 (09:04 +0800)]
wifi: rtw89: support WMM-PS in P2P GO mode
To handle a connected client using WMM-PS, the P2P GO also need to enable
this power save mechanism.
We add WIPHY_FLAG_AP_UAPSD flag to support it and define maximum number
of buffered frames the WMM GO may deliver to the WMM client.
Signed-off-by: Dian-Syuan Yang <dian_syuan0116@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220922010435.12167-5-pkshih@realtek.com
Ping-Ke Shih [Thu, 22 Sep 2022 01:04:33 +0000 (09:04 +0800)]
wifi: rtw89: set wifi_role of P2P
Consider vif->p2p to set wifi_role to let firmware know current vif is
running as GC or GO. And, allow GC to enter PS mode, but disallow to enter
deep PS for now.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220922010435.12167-4-pkshih@realtek.com
Dian-Syuan Yang [Thu, 22 Sep 2022 01:04:32 +0000 (09:04 +0800)]
wifi: rtw89: send OFDM rate only in P2P mode
Check IEEE80211_TX_CTL_NO_CCK_RATE flag to avoid sending frames with
CCK rates in 2GHz band.
In TX flow, add IEEE80211_TX_CTL_NO_CCK_RATE flag to check and get its
lowest rate without CCK rates if the TX type is mgmt frames or data frames.
Besides, the decision of phy rate and retry rate in P2P mode are also
be handled.
In P2P GO mode, it should send beacon of no CCK rates in its frame rate.
Therefore, We add a condition to decide which rate is added to beacon
content.
Moreover, we avoid setting a mask of rates to be used for rate control
selection before and after connection in P2P mode.
Signed-off-by: Dian-Syuan Yang <dian_syuan0116@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220922010435.12167-3-pkshih@realtek.com
Po Hao Huang [Thu, 22 Sep 2022 01:04:31 +0000 (09:04 +0800)]
wifi: rtw89: support P2P
To support P2P in driver, we set P2P interface mode to the wiphy
allocated for 802.11 PHY and add a change interface function to
switch the interface type to P2P.
Signed-off-by: Po Hao Huang <phhuang@realtek.com>
Signed-off-by: Dian-Syuan Yang <dian_syuan0116@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220922010435.12167-2-pkshih@realtek.com
Daniel Golle [Sat, 17 Sep 2022 20:30:09 +0000 (21:30 +0100)]
wifi: rt2x00: correctly set BBP register 86 for MT7620
Instead of 0 set the correct value for BBP register 86 for MT7620.
Reported-by: Serge Vasilugin <vasilugin@yandex.ru>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/257267247ee4fa7ebc6a5d0c4948b3f8119c0d77.1663445157.git.daniel@makrotopia.org
Daniel Golle [Sat, 17 Sep 2022 20:29:55 +0000 (21:29 +0100)]
wifi: rt2x00: set SoC wmac clock register
Instead of using the default value 33 (pci), set US_CYC_CNT init based
on Programming guide:
If available, set chipset bus clock with fallback to cpu clock/3.
Reported-by: Serge Vasilugin <vasilugin@yandex.ru>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/3e275d259f476f597dab91a9c395015ef3fe3284.1663445157.git.daniel@makrotopia.org
Daniel Golle [Sat, 17 Sep 2022 20:29:40 +0000 (21:29 +0100)]
wifi: rt2x00: set VGC gain for both chains of MT7620
Set bbp66 for all chains of the MT7620.
Reported-by: Serge Vasilugin <vasilugin@yandex.ru>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/29e161397e5c9d9399da0fe87d44458aa2b90a78.1663445157.git.daniel@makrotopia.org
Daniel Golle [Sat, 17 Sep 2022 20:29:26 +0000 (21:29 +0100)]
wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620
Set correct TX_SW_CFG1 MAC register as it is done also in v3 of the
vendor driver[1].
[1]: https://gitlab.com/dm38/padavan-ng/-/blob/master/trunk/proprietary/rt_wifi/rtpci/3.0.X.X/mt76x2/chips/rt6352.c#L531
Reported-by: Serge Vasilugin <vasilugin@yandex.ru>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/4be38975ce600a34249e12d09a3cb758c6e71071.1663445157.git.daniel@makrotopia.org
Daniel Golle [Sat, 17 Sep 2022 20:29:13 +0000 (21:29 +0100)]
wifi: rt2x00: fix HT20/HT40 bandwidth switch on MT7620
Add missing configuration of the channel bandwidth filter to the
channel setup function for MT7620.
Reported-by: Serge Vasilugin <vasilugin@yandex.ru>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/1664d89ba149f7b0bcec18b2a2abaedf49654507.1663445157.git.daniel@makrotopia.org
Daniel Golle [Sat, 17 Sep 2022 20:28:58 +0000 (21:28 +0100)]
wifi: rt2x00: move helper functions up in file
Move register access helper functions up to the head of the file so
they can be used in all functions.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/c27baa8efd5c29e2bcb2432925d9cdc5c913a125.1663445157.git.daniel@makrotopia.org
Tomislav Požega [Sat, 17 Sep 2022 20:28:43 +0000 (21:28 +0100)]
wifi: rt2x00: add TX LOFT calibration for MT7620
Add TX LOFT calibration from mtk driver.
Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/d9295a9138a1f552b648aacb84e1419d38f5c896.1663445157.git.daniel@makrotopia.org
Daniel Golle [Sat, 17 Sep 2022 20:28:29 +0000 (21:28 +0100)]
wifi: rt2x00: don't run Rt5592 IQ calibration on MT7620
The function rt2800_iq_calibrate is intended for Rt5592 only.
Don't call it for MT7620 which has it's own calibration functions.
Reported-by: Serge Vasilugin <vasilugin@yandex.ru>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/31a1c34ddbd296b82f38c18c9ae7339059215fdc.1663445157.git.daniel@makrotopia.org
Tomislav Požega [Sat, 17 Sep 2022 20:28:10 +0000 (21:28 +0100)]
wifi: rt2x00: add RXIQ calibration for MT7620
Add RXIQ calibration found in mtk driver. With old openwrt builds this
gets us ~8Mbps more of RX bandwidth (test with iPA/eLNA layout).
Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/033a39a697d51f6df258acea4c33608e0944fe4c.1663445157.git.daniel@makrotopia.org
Tomislav Požega [Sat, 17 Sep 2022 20:27:56 +0000 (21:27 +0100)]
wifi: rt2x00: add RXDCOC calibration for MT7620
Add RXDCOC calibration code from mtk driver.
Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
[fixed typo reported by Serge Vasilugin <vasilugin@yandex.ru>]
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/850b30f652e88de30d79e968af4eb47aa5bc2511.1663445157.git.daniel@makrotopia.org
Tomislav Požega [Sat, 17 Sep 2022 20:27:41 +0000 (21:27 +0100)]
wifi: rt2x00: add r calibration for MT7620
Add r calibration code as found in mtk driver.
Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/e0c34f233089bec4eb73826bc4f512166ee25934.1663445157.git.daniel@makrotopia.org
Tomislav Požega [Sat, 17 Sep 2022 20:27:26 +0000 (21:27 +0100)]
wifi: rt2x00: add RF self TXDC calibration for MT7620
Add TX self calibration based on mtk driver.
Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/dbb6e5a0c12d6101477bd09e83253091d21512c9.1663445157.git.daniel@makrotopia.org
Daniel Golle [Sat, 17 Sep 2022 20:27:10 +0000 (21:27 +0100)]
wifi: rt2x00: move up and reuse busy wait functions
Move bbp_ready and rf_ready busy wait functions up in the code so they
can more easily be used. Allow specifying register mask in rf_ready
function which is useful for calibration routines which will be added
in follow-up commits.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/3fdb9dc15e76a9f9c1948b4a3a1308a7a5677bb8.1663445157.git.daniel@makrotopia.org
Daniel Golle [Sat, 17 Sep 2022 20:26:55 +0000 (21:26 +0100)]
wifi: rt2x00: add support for external PA on MT7620
Implement support for external PA connected to MT7620A.
Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
[pozega.tomislav@gmail.com: use chanreg and dccal helpers.]
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/af2c68ff831816a86fc39b0c10911c129a1f03dc.1663445157.git.daniel@makrotopia.org
David Bauer [Sat, 17 Sep 2022 20:26:40 +0000 (21:26 +0100)]
wifi: rt2x00: add throughput LED trigger
This adds a (currently missing) throughput LED trigger for the rt2x00
driver. Previously, LED triggers had to be assigned to the netdev, which
was limited to a single VAP.
Tested-by: Christoph Krapp <achterin@googlemail.com>
Signed-off-by: David Bauer <mail@david-bauer.net>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/73f5ba4134e621462a26186449400cf0c1ac1730.1663445157.git.daniel@makrotopia.org
Tomislav Požega [Sat, 17 Sep 2022 20:26:27 +0000 (21:26 +0100)]
wifi: rt2x00: define RF5592 in init_eeprom routine
Fix incorrect RF value encoded in EEPROM on devices with Ralink Rt5592
PCIe radio (a single chip 2T2R 802.11abgn solution).
Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/d7eccb2c7b8ec4cd360fa2007796abffc35abb0d.1663445157.git.daniel@makrotopia.org
Kalle Valo [Thu, 22 Sep 2022 06:14:33 +0000 (09:14 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2022-09-18' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next
iwlwifi patches for v6.1
Kalle Valo [Thu, 22 Sep 2022 06:13:17 +0000 (09:13 +0300)]
Merge tag 'mt76-for-kvalo-2022-09-15' of https://github.com/nbd168/wireless
mt76 patches for 6.1
- fixes
- suspend/resume improvements
- tx status reporting improvements
Ching-Te Ku [Tue, 20 Sep 2022 01:09:39 +0000 (09:09 +0800)]
wifi: rtw89: coex: update coexistence to 6.3.0
Since we maintain coexistence as shared code, so move coexistence version
from chip specific attribute to a definition.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220920010939.12173-10-pkshih@realtek.com
Ching-Te Ku [Tue, 20 Sep 2022 01:09:38 +0000 (09:09 +0800)]
wifi: rtw89: coex: add logic to control BT scan priority
Add control logic to operate Wi-Fi to BT scoreboard to control BT scan
priority. And patch mechanism parameter to enhance Wi-Fi throughput while
coexisting with BT profile & BT scan. Set PTA priority let Wi-Fi BT can RX
at the same time.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220920010939.12173-9-pkshih@realtek.com
Ching-Te Ku [Tue, 20 Sep 2022 01:09:37 +0000 (09:09 +0800)]
wifi: rtw89: coex: summarize Wi-Fi to BT scoreboard and inform BT one time a cycle
If Wi-Fi driver send Wi-Fi status to BT via scoreboard too frequent in a
short moment, BT will loss some of them because of hardware response time.
To avoid this issue, change the code flow. Summarize the scoreboard changes
and if the value have changed, send the scoreboard to BT only once in
a coexistence processing cycle. It also can help to reduce driver I/O.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220920010939.12173-8-pkshih@realtek.com
Ching-Te Ku [Tue, 20 Sep 2022 01:09:36 +0000 (09:09 +0800)]
wifi: rtw89: coex: modify LNA2 setting to avoid BT destroyed Wi-Fi aggregation
To prevent LNA2 change its gain during a Wi-Fi aggregation packet while
GNT_BT pull high. Otherwise, changes of this gain will destroy the whole
aggregation when Wi-Fi RX.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220920010939.12173-7-pkshih@realtek.com
Ching-Te Ku [Tue, 20 Sep 2022 01:09:35 +0000 (09:09 +0800)]
wifi: rtw89: coex: add WL_S0 hardware TX/RX mask to allow WL_S0 TX/RX during GNT_BT
WiFi/BT combo module could only have two antenna, namely WL_S0 and WL_S1.
WiFi can use two antenna to TX/RX 2SS data, and BT can share one of the
antenna. This patch is to allow WiFi to TX/RX 1SS data like ACK/RTS/CTS to
improve Wi-Fi performance while coexisting with Bluetooth.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220920010939.12173-6-pkshih@realtek.com
Ching-Te Ku [Tue, 20 Sep 2022 01:09:34 +0000 (09:09 +0800)]
wifi: rtw89: coex: add v1 Wi-Fi firmware steps report
This report is to record firmware call flow like notify events, and take
actions. This can help to address if firmware flow is in expectation.
Implement v1 parser to support 8852CE firmware report.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220920010939.12173-5-pkshih@realtek.com
Ching-Te Ku [Tue, 20 Sep 2022 01:09:33 +0000 (09:09 +0800)]
wifi: rtw89: coex: add v1 summary info to parse the traffic status from firmware
This debug entry is to summarize important messages to quickly address
problem types, such as firmware hang, C2H/H2C stuck, or too much
occupation of BT A2DP. If unexpected something is addressed, we can dig
the problem via other debug messages that provide more detail information.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220920010939.12173-4-pkshih@realtek.com
Ching-Te Ku [Tue, 20 Sep 2022 01:09:32 +0000 (09:09 +0800)]
wifi: rtw89: coex: translate slot ID to readable name
To analyze debug log quickly, use readable name in string format instead.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220920010939.12173-3-pkshih@realtek.com
Ching-Te Ku [Tue, 20 Sep 2022 01:09:31 +0000 (09:09 +0800)]
wifi: rtw89: coex: add v1 cycle report to parsing Bluetooth A2DP status
'cysta' is short for statistics for cycles. That is a circular buffer to
record snapshot status including beacon count, RX count, TX count etc.
Since 8852CE Wi-Fi firmware report this statistics in different format,
add v1 parser by this patch.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220920010939.12173-2-pkshih@realtek.com
Johannes Berg [Sun, 4 Sep 2022 19:29:07 +0000 (21:29 +0200)]
wifi: mwifiex: fix array of flexible structures warnings
There are two, just change them to have a "u8 data[]" type
member, and add casts where needed. No binary changes.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220904212910.2c885310ebee.If7177ea588b56c405eee6e6df595e9efccdfb99a@changeid
Johannes Berg [Sun, 4 Sep 2022 19:29:04 +0000 (21:29 +0200)]
wifi: rndis_wlan: fix array of flexible structures warning
Use "u8 bssid_data[]" with an appropriate cast. No binary
changes.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220904212910.0e7ce5fdbcfb.I972158734def3f93b93a3858a087cbc2cca6337e@changeid
Johannes Berg [Sun, 4 Sep 2022 19:29:02 +0000 (21:29 +0200)]
wifi: ipw2x00: fix array of flexible structures warnings
There are a number of these here, fix them by using
appropriate casts. No binary changes.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220904212910.645346411660.I471e8fadce54ea262920828f25b8e84545bcd07e@changeid
Duoming Zhou [Tue, 23 Aug 2022 11:21:27 +0000 (19:21 +0800)]
mwifiex: fix sleep in atomic context bugs caused by dev_coredumpv
There are sleep in atomic context bugs when uploading device dump
data in mwifiex. The root cause is that dev_coredumpv could not
be used in atomic contexts, because it calls dev_set_name which
include operations that may sleep. The call tree shows execution
paths that could lead to bugs:
(Interrupt context)
fw_dump_timer_fn
mwifiex_upload_device_dump
dev_coredumpv(..., GFP_KERNEL)
dev_coredumpm()
kzalloc(sizeof(*devcd), gfp); //may sleep
dev_set_name
kobject_set_name_vargs
kvasprintf_const(GFP_KERNEL, ...); //may sleep
kstrdup(s, GFP_KERNEL); //may sleep
The corresponding fail log is shown below:
[ 135.275938] usb 1-1: == mwifiex dump information to /sys/class/devcoredump start
[ 135.281029] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:265
...
[ 135.293613] Call Trace:
[ 135.293613] <IRQ>
[ 135.293613] dump_stack_lvl+0x57/0x7d
[ 135.293613] __might_resched.cold+0x138/0x173
[ 135.293613] ? dev_coredumpm+0xca/0x2e0
[ 135.293613] kmem_cache_alloc_trace+0x189/0x1f0
[ 135.293613] ? devcd_match_failing+0x30/0x30
[ 135.293613] dev_coredumpm+0xca/0x2e0
[ 135.293613] ? devcd_freev+0x10/0x10
[ 135.293613] dev_coredumpv+0x1c/0x20
[ 135.293613] ? devcd_match_failing+0x30/0x30
[ 135.293613] mwifiex_upload_device_dump+0x65/0xb0
[ 135.293613] ? mwifiex_dnld_fw+0x1b0/0x1b0
[ 135.293613] call_timer_fn+0x122/0x3d0
[ 135.293613] ? msleep_interruptible+0xb0/0xb0
[ 135.293613] ? lock_downgrade+0x3c0/0x3c0
[ 135.293613] ? __next_timer_interrupt+0x13c/0x160
[ 135.293613] ? lockdep_hardirqs_on_prepare+0xe/0x220
[ 135.293613] ? mwifiex_dnld_fw+0x1b0/0x1b0
[ 135.293613] __run_timers.part.0+0x3f8/0x540
[ 135.293613] ? call_timer_fn+0x3d0/0x3d0
[ 135.293613] ? arch_restore_msi_irqs+0x10/0x10
[ 135.293613] ? lapic_next_event+0x31/0x40
[ 135.293613] run_timer_softirq+0x4f/0xb0
[ 135.293613] __do_softirq+0x1c2/0x651
...
[ 135.293613] RIP: 0010:default_idle+0xb/0x10
[ 135.293613] RSP: 0018:
ffff888006317e68 EFLAGS:
00000246
[ 135.293613] RAX:
ffffffff82ad8d10 RBX:
ffff888006301cc0 RCX:
ffffffff82ac90e1
[ 135.293613] RDX:
ffffed100d9ff1b4 RSI:
ffffffff831ad140 RDI:
ffffffff82ad8f20
[ 135.293613] RBP:
0000000000000003 R08:
0000000000000000 R09:
ffff88806cff8d9b
[ 135.293613] R10:
ffffed100d9ff1b3 R11:
0000000000000001 R12:
ffffffff84593410
[ 135.293613] R13:
0000000000000000 R14:
0000000000000000 R15:
1ffff11000c62fd2
...
[ 135.389205] usb 1-1: == mwifiex dump information to /sys/class/devcoredump end
This patch uses delayed work to replace timer and moves the operations
that may sleep into a delayed work in order to mitigate bugs, it was
tested on Marvell 88W8801 chip whose port is usb and the firmware is
usb8801_uapsta.bin. The following is the result after using delayed
work to replace timer.
[ 134.936453] usb 1-1: == mwifiex dump information to /sys/class/devcoredump start
[ 135.043344] usb 1-1: == mwifiex dump information to /sys/class/devcoredump end
As we can see, there is no bug now.
Fixes:
f5ecd02a8b20 ("mwifiex: device dump support for usb interface")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/5cfa5c473ff6d069cb67760ffa04a2f84ef450a8.1661252818.git.duoming@zju.edu.cn
Dan Carpenter [Thu, 15 Sep 2022 14:13:34 +0000 (17:13 +0300)]
wifi: rtw89: uninitialized variable on error in rtw89_early_fw_feature_recognize()
If request_partial_firmware_into_buf() fails then "firmware" is not
initialized and the release_firmware(firmware) will crash.
Fixes:
deebea35d699 ("wifi: rtw89: early recognize FW feature to decide if chanctx")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/YyMzDtX/3fUBnonC@kili
Hans de Goede [Thu, 8 Sep 2022 17:36:18 +0000 (19:36 +0200)]
wifi: rt2x00: Fix "Error - Attempt to send packet over invalid queue 2"
Even though ieee80211_hw.queues is set to 2, the ralink rt2x00 driver
is seeing tx skbs submitted to it with the queue-id set to 2 / set to
IEEE80211_AC_BE on a rt2500 card when associating with an access-point.
This causes rt2x00queue_get_tx_queue() to return NULL and the following
error to be logged: "ieee80211 phy0: rt2x00mac_tx: Error - Attempt to
send packet over invalid queue 2", after which association with the AP
fails.
This patch works around this by mapping QID_AC_BE and QID_AC_BK
to QID_AC_VI when there are only 2 tx_queues.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220908173618.155291-2-hdegoede@redhat.com
Po-Hao Huang [Fri, 16 Sep 2022 03:38:11 +0000 (11:38 +0800)]
wifi: rtw89: 8852c: add multi-port ID to TX descriptor
Update tx descriptor settings so broadcast packets on other ports can be
issued properly when DTIM count is 0. Before this, all broadcast packets
are sent via port 0 and won't be transmitted correctly.
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220916033811.13862-8-pkshih@realtek.com
Po-Hao Huang [Fri, 16 Sep 2022 03:38:10 +0000 (11:38 +0800)]
wifi: rtw89: fix rx filter after scan
In monitor mode we should be able to received all packets even if it's not
destined to us. But after scan, the configuration was wrongly set, so we
fix it.
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220916033811.13862-7-pkshih@realtek.com
Po-Hao Huang [Fri, 16 Sep 2022 03:38:09 +0000 (11:38 +0800)]
wifi: rtw89: free unused skb to prevent memory leak
This avoid potential memory leak under power saving mode.
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220916033811.13862-6-pkshih@realtek.com
Ping-Ke Shih [Fri, 16 Sep 2022 03:38:08 +0000 (11:38 +0800)]
wifi: rtw89: reset halt registers before turn on wifi CPU
Reset these registers to prevent firmware get false alarm after wifi CPU
is running.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220916033811.13862-5-pkshih@realtek.com
Ping-Ke Shih [Fri, 16 Sep 2022 03:38:07 +0000 (11:38 +0800)]
wifi: rtw89: pci: update LTR settings
Modify PCI LTR control flow and LTR idle latency to improve power save
efficiency.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220916033811.13862-4-pkshih@realtek.com
Ping-Ke Shih [Fri, 16 Sep 2022 03:38:06 +0000 (11:38 +0800)]
wifi: rtw89: mac: set NAV upper to 25ms
NAV upper register is to limit the maximum NAV value to prevent
unexpected NAV, but the old setting is too small to reflect NAV from
AP transmiting big MPDU at once.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220916033811.13862-3-pkshih@realtek.com
Ping-Ke Shih [Fri, 16 Sep 2022 03:38:05 +0000 (11:38 +0800)]
wifi: rtw89: initialize DMA of CMAC
8852C needs this to change CMAC dma to full mode to keep receiving
packets after RX full event being resolved.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220916033811.13862-2-pkshih@realtek.com
Zong-Zhe Yang [Wed, 14 Sep 2022 03:50:34 +0000 (11:50 +0800)]
wifi: rtw89: support SER L1 simulation
SER (system error recovery) can deal with different crash types by
different levels of processes. Previous FW crash simulation triggers
a CPU exception which is one kind of SER L2 type. It can verify SER L2
flow which includes HW/FW restart.
Now, we want to increase crash simulation types. A debug function is added
to trigger control error in purpose for SER L1 simulation/verification.
And, debugfs fw_crash is extended to accept different parameters.
echo 1 > fw_crash:
simulate CPU exception as before
(keep 1 for compatibility with previous)
It will be catched and handled by SER L2.
(this requires HW/FW restart)
echo 2 > fw_crash:
simulate control error
It will be catched and handled by SER L1.
(driver and FW cooperate to recover this)
Besides, in order to apply to the above two cases,
rename RTW89_FLAG_RESTART_TRIGGER to RTW89_FLAG_CRASH_SIMULATING
and adjust where SER flow clears this bit for both L1 and L2.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220914035034.14521-5-pkshih@realtek.com
Zong-Zhe Yang [Wed, 14 Sep 2022 03:50:33 +0000 (11:50 +0800)]
wifi: rtw89: 8852c: support fw crash simulation
With FW >= v0.27.40.0, 8852C FW has feature to handle crash simulation.
Besides, use RTW89_WCPU_BASE_MASK to replace use of RTW89_WCPU_BASE_ADDR
and work for both 8852A and 8852C.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220914035034.14521-4-pkshih@realtek.com
Zong-Zhe Yang [Wed, 14 Sep 2022 03:50:32 +0000 (11:50 +0800)]
wifi: rtw89: introudce functions to drop packets
Introudce a H2C feature to drop packets according to given parameters.
And, we implement instances to drop packets from BE, BK, VI, VO queues
by vif or sta. Then, we refine our callback of ieee80211_ops::flush to
deal with the case of drop=true via this feature.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220914035034.14521-3-pkshih@realtek.com
Ping-Ke Shih [Wed, 14 Sep 2022 03:50:31 +0000 (11:50 +0800)]
wifi: rtw89: unify use of rtw89_h2c_tx()
Seaprate calling of rtw89_h2c_tx() out of if-expression, and bypass the
return value to upper caller.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220914035034.14521-2-pkshih@realtek.com
Chin-Yen Lee [Mon, 12 Sep 2022 07:17:06 +0000 (15:17 +0800)]
wifi: rtw89: pci: concentrate control function of TX DMA channel
Different chips use different register and mask for
tx dma channels, so concentrate them.
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220912071706.13619-4-pkshih@realtek.com
Chin-Yen Lee [Mon, 12 Sep 2022 07:17:05 +0000 (15:17 +0800)]
wifi: rtw89: correct enable functions of HCI/PCI DMA
Some PCI and MAC registers are changed for different
chips and correct them accordingly. And HCI MAD functions
belongs to MAC core, so move it to mac.h/.c.
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220912071706.13619-3-pkshih@realtek.com
Zong-Zhe Yang [Mon, 12 Sep 2022 07:17:04 +0000 (15:17 +0800)]
wifi: rtw89: 8852c: L1 DMA reset has offloaded to FW
For 8852C, rtw89_pci_lv1rst_stop_dma() and rtw89_pci_lv1rst_start_dma()
are offloaded to FW L1 reset flow. So, driver no longer needs to do them.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220912071706.13619-2-pkshih@realtek.com
Kuan-Chung Chen [Mon, 12 Sep 2022 07:00:14 +0000 (15:00 +0800)]
wifi: rtw89: support for setting TID specific configuration
Add ops set_tid_config to support TID specific configuration.
We currently only support ampdu setting.
The command example is:
iw wlan0 set tidconf tids 0x3 ampdu off
iw wlan0 set tidconf peer xx:xx:xx:xx:xx:xx tids 0x2 ampdu on
Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220912070014.10018-3-pkshih@realtek.com
Kuan-Chung Chen [Mon, 12 Sep 2022 07:00:13 +0000 (15:00 +0800)]
wifi: rtw89: support for setting HE GI and LTF
Support setting HE GI and LTF values to the kernel via nl80211.
We currently only support some GI and LTF values settings.
The command example is:
iw wlan0 set bitrates he-gi-2.4 0.8 he-ltf-2.4 2
Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220912070014.10018-2-pkshih@realtek.com
Ping-Ke Shih [Mon, 12 Sep 2022 02:10:09 +0000 (10:10 +0800)]
wifi: rtw89: coex: show connecting state in debug message
The variable cnt_connecting is to indicate if we are connecting to an AP.
This is an important clue for coexistence to assign more time slot to WiFi
side in this situation to ensure WiFi can establish connection.
Without this patch, compiler warns:
drivers/net/wireless/realtek/rtw89/coex.c:3244:25: warning: variable
'cnt_connecting' set but not used [-Wunused-but-set-variable]
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220912021009.6011-1-pkshih@realtek.com
Ching-Te Ku [Tue, 13 Sep 2022 09:25:46 +0000 (17:25 +0800)]
wifi: rtw89: coex: Combine set grant WL/BT and correct the debug log
To reduce register IO, combine set_gnt_wl/set_gnt_bt to set the same
register one time. Because RTL8852C use different register to control
antenna path, so make correction of path control related debug logs.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220913092546.43722-8-pkshih@realtek.com
Ching-Te Ku [Tue, 13 Sep 2022 09:25:45 +0000 (17:25 +0800)]
wifi: rtw89: coex: Remove trace_step at COEX-MECH control structure for RTL8852C
RTL8852C don't need to send the data trace_step which used to tell
firmware how many TDMA steps should record. Remove the member.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220913092546.43722-7-pkshih@realtek.com
Ching-Te Ku [Tue, 13 Sep 2022 09:25:44 +0000 (17:25 +0800)]
wifi: rtw89: coex: Parsing Wi-Fi firmware TDMA info from reports
Show TDMA information containing TDMA policy and time slot of Wi-Fi/BT in
debug message to check things are in expected. The v1 format contains
additional header, and remaining part is the same as original. So 8852CE
selects v1 version, and then everything like original.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220913092546.43722-6-pkshih@realtek.com
Ching-Te Ku [Tue, 13 Sep 2022 09:25:43 +0000 (17:25 +0800)]
wifi: rtw89: coex: Parsing Wi-Fi firmware error message from reports
Parsing firmware error message from original version and v1 reports to
show up exception counter of commands from firmware in debug message.
Then, we can make sure exchange commands are correct totally.
In the later version Wi-Fi firmware(v1), the report format was changed.
With this update, we can yield correct report from proper struct.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220913092546.43722-5-pkshih@realtek.com
Ching-Te Ku [Tue, 13 Sep 2022 09:25:42 +0000 (17:25 +0800)]
wifi: rtw89: coex: Move coexistence firmware buffer size parameter to chip info
Because RTL8852A/RTL8852C use different firmware buffer size to
send C2H packet, it's necessary to use different size to parse C2H report.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220913092546.43722-4-pkshih@realtek.com
Ching-Te Ku [Tue, 13 Sep 2022 09:25:41 +0000 (17:25 +0800)]
wifi: rtw89: coex: Add v1 Wi-Fi firmware power-saving null data report
The later version Wi-Fi firmware will report null data TX times,
so the structure is different from before.
Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220913092546.43722-3-pkshih@realtek.com
Ping-Ke Shih [Tue, 13 Sep 2022 09:25:40 +0000 (17:25 +0800)]
wifi: rtw89: coex: use void pointer as temporal type to copy report
With void pointer, we don't need to cast to 'u8 *' by one by.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220913092546.43722-2-pkshih@realtek.com
Hector Martin [Fri, 16 Sep 2022 16:03:22 +0000 (17:03 +0100)]
arm64: dts: apple: Add WiFi module and antenna properties
Add the new module-instance/antenna-sku properties required to select
WiFi firmwares properly to all board device trees.
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Acked-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/E1oZDoI-0077b3-Dd@rmk-PC.armlinux.org.uk
Hector Martin [Fri, 16 Sep 2022 16:03:17 +0000 (17:03 +0100)]
wifi: brcmfmac: pcie: Add IDs/properties for BCM4378
This chip is present on Apple M1 (t8103) platforms:
* atlantisb (apple,j274): Mac mini (M1, 2020)
* honshu (apple,j293): MacBook Pro (13-inch, M1, 2020)
* shikoku (apple,j313): MacBook Air (M1, 2020)
* capri (apple,j456): iMac (24-inch, 4x USB-C, M1, 2020)
* santorini (apple,j457): iMac (24-inch, 2x USB-C, M1, 2020)
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/E1oZDoD-0077ax-AI@rmk-PC.armlinux.org.uk
Hector Martin [Fri, 16 Sep 2022 16:03:12 +0000 (17:03 +0100)]
wifi: brcmfmac: pcie: Support PCIe core revisions >= 64
These newer PCIe core revisions include new sets of registers that must
be used instead of the legacy ones. Introduce a brcmf_pcie_reginfo to
hold the specific register offsets and values to use for a given
platform, and change all the register accesses to indirect through it.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/E1oZDo8-0077aq-6I@rmk-PC.armlinux.org.uk
Hector Martin [Fri, 16 Sep 2022 16:03:07 +0000 (17:03 +0100)]
wifi: brcmfmac: msgbuf: Increase RX ring sizes to 1024
Newer chips used on Apple platforms have a max_rxbufpost greater than
512, which causes warnings when brcmf_msgbuf_rxbuf_data_fill tries to
put more entries in the ring than will fit. Increase the ring sizes
to 1024.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/E1oZDo3-0077ak-2h@rmk-PC.armlinux.org.uk
Hector Martin [Fri, 16 Sep 2022 16:03:01 +0000 (17:03 +0100)]
wifi: brcmfmac: firmware: Allow platform to override macaddr
On Device Tree platforms, it is customary to be able to set the MAC
address via the Device Tree, as it is often stored in system firmware.
This is particularly relevant for Apple ARM64 platforms, where this
information comes from system configuration and passed through by the
bootloader into the DT.
Implement support for this by fetching the platform MAC address and
adding or replacing the macaddr= property in nvram. This becomes the
dongle's default MAC address.
On platforms with an SROM MAC address, this overrides it. On platforms
without one, such as Apple ARM64 devices, this is required for the
firmware to boot (it will fail if it does not have a valid MAC at all).
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/E1oZDnx-0077ae-VK@rmk-PC.armlinux.org.uk
Hector Martin [Fri, 16 Sep 2022 16:02:56 +0000 (17:02 +0100)]
wifi: brcmfmac: pcie: Perform firmware selection for Apple platforms
On Apple platforms, firmware selection uses the following elements:
Property Example Source
============== ======= ========================
* Chip name 4378 Device ID
* Chip revision B1 OTP
* Platform shikoku DT (ARM64) or ACPI (x86)
* Module type RASP OTP
* Module vendor m OTP
* Module version 6.11 OTP
* Antenna SKU X3 DT (ARM64) or ACPI (x86)
In macOS, these firmwares are stored using filenames in this format
under /usr/share/firmware/wifi:
C-4378__s-B1/P-shikoku-X3_M-RASP_V-m__m-6.11.txt
To prepare firmwares for Linux, we rename these to a scheme following
the existing brcmfmac convention:
brcmfmac<chip><lower(rev)>-pcie.apple,<platform>-<mod_type>-\
<mod_vendor>-<mod_version>-<antenna_sku>.txt
The NVRAM uses all the components, while the firmware and CLM blob only
use the chip/revision/platform/antenna_sku:
brcmfmac<chip><lower(rev)>-pcie.apple,<platform>-<antenna_sku>.bin
e.g.
brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP-m-6.11-X3.txt
brcm/brcmfmac4378b1-pcie.apple,shikoku-X3.bin
In addition, since there are over 1000 files in total, many of which are
symlinks or outright duplicates, we deduplicate and prune the firmware
tree to reduce firmware filenames to fewer dimensions. For example, the
shikoku platform (MacBook Air M1 2020) simplifies to just 4 files:
brcm/brcmfmac4378b1-pcie.apple,shikoku.clm_blob
brcm/brcmfmac4378b1-pcie.apple,shikoku.bin
brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP-m.txt
brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP-u.txt
This reduces the total file count to around 170, of which 75 are
symlinks and 95 are regular files: 7 firmware blobs, 27 CLM blobs, and
61 NVRAM config files. We also slightly process NVRAM files to correct
some formatting issues.
To handle this, the driver must try the following path formats when
looking for firmware files:
brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP-m-6.11-X3.txt
brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP-m-6.11.txt
brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP-m.txt
brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP.txt
brcm/brcmfmac4378b1-pcie.apple,shikoku-X3.txt *
brcm/brcmfmac4378b1-pcie.apple,shikoku.txt
* Not relevant for NVRAM, only for firmware/CLM.
The chip revision nominally comes from OTP on Apple platforms, but it
can be mapped to the PCI revision number, so we ignore the OTP revision
and continue to use the existing PCI revision mechanism to identify chip
revisions, as the driver already does for other chips. Unfortunately,
the mapping is not consistent between different chip types, so this has
to be determined experimentally.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/E1oZDns-0077aY-Qn@rmk-PC.armlinux.org.uk
Hector Martin [Fri, 16 Sep 2022 16:02:51 +0000 (17:02 +0100)]
wifi: brcmfmac: of: Fetch Apple properties
On Apple ARM64 platforms, firmware selection requires two properties
that come from system firmware: the module-instance (aka "island", a
codename representing a given hardware platform) and the antenna-sku.
We map Apple's module codenames to board_types in the form
"apple,<module-instance>".
The mapped board_type is added to the DTS file in that form, while the
antenna-sku is forwarded by our bootloader from the Apple Device Tree
into the FDT. Grab them from the DT so firmware selection can use
them.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/E1oZDnn-0077aS-NA@rmk-PC.armlinux.org.uk
Hector Martin [Fri, 16 Sep 2022 16:02:46 +0000 (17:02 +0100)]
wifi: brcmfmac: pcie: Read Apple OTP information
On Apple platforms, the One Time Programmable ROM in the Broadcom chips
contains information about the specific board design (module, vendor,
version) that is required to select the correct NVRAM file. Parse this
OTP ROM and extract the required strings.
Note that the user OTP offset/size is per-chip. This patch does not add
any chips yet.
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/E1oZDni-0077aM-I6@rmk-PC.armlinux.org.uk
Hector Martin [Fri, 16 Sep 2022 16:02:41 +0000 (17:02 +0100)]
wifi: brcmfmac: firmware: Support passing in multiple board_types
Apple platforms have firmware and config files identified with multiple
dimensions. We want to be able to find the most specific firmware
available for any given platform, progressively trying more general
firmwares.
To do this, first add support for passing in multiple board_types,
which will be tried in sequence.
Since this will cause more log spam due to missing firmwares, also
switch the secondary firmware fecthes to use the _nowarn variant, which
will not log if the firmware is not found.
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/E1oZDnd-0077aG-Dk@rmk-PC.armlinux.org.uk
Hector Martin [Fri, 16 Sep 2022 16:02:36 +0000 (17:02 +0100)]
wifi: brcmfmac: pcie/sdio/usb: Get CLM blob via standard firmware mechanism
Now that the firmware fetcher can handle per-board CLM files, load the
CLM blob alongside the other firmware files and change the bus API to
just return the existing blob, instead of fetching the filename.
This enables per-board CLM blobs, which are required on Apple platforms.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/E1oZDnY-0077aA-8f@rmk-PC.armlinux.org.uk
Hector Martin [Fri, 16 Sep 2022 16:02:31 +0000 (17:02 +0100)]
wifi: brcmfmac: firmware: Handle per-board clm_blob files
Teach brcm_alt_fw_paths to correctly split off variable length
extensions, and enable alt firmware lookups for the CLM blob firmware
requests.
Apple platforms have per-board CLM blob files.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/E1oZDnT-0077a4-4k@rmk-PC.armlinux.org.uk
Hector Martin [Fri, 16 Sep 2022 16:02:26 +0000 (17:02 +0100)]
dt-bindings: net: bcm4329-fmac: Add Apple properties & chips
This binding is currently used for SDIO devices, but these chips are
also used as PCIe devices on DT platforms and may be represented in the
DT. Re-use the existing binding and add chip compatibles used by Apple
T2 and M1 platforms (the T2 ones are not known to be used in DT
platforms, but we might as well document them).
Then, add properties required for firmware selection and calibration on
M1 machines.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/E1oZDnO-0077Zy-18@rmk-PC.armlinux.org.uk
Naftali Goldstein [Tue, 6 Sep 2022 13:42:19 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: d3: parse keys from wowlan info notification
This notification replaces the WOWLAN_GET_STATUSES command-and-response,
so it's required to parse all the keys in the notification just like
what happened when that command was used.
Move around a few required static functions in order to avoid forward
declarations.
Signed-off-by: Naftali Goldstein <naftali.goldstein@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.ca3fb23cab81.I0a9fe7729af4567b98813bc51bad13ee5512a0ae@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Yedidya Benshimol [Tue, 6 Sep 2022 13:42:18 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: iterate over interfaces after an assert in d3
In recent patches notifications based d3 resume flow was added,
and the resume flow was changed.
Currently, when resuming from d3 during which an assert was thrown,
the resume flow skips the iteration over active interfaces
preventing the sta to reconnect to the ap.
Perform the iteration in case an assert was thrown to fix it.
Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.ad888cc6cd91.Ib56e416fce17df089edf76d22896430df5ebe080@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Haim, Dreyfuss [Tue, 6 Sep 2022 13:42:17 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: trigger resume flow before wait for notifications
We have recently enabled resume flow based on notifications.
These notifications are sent by the FW when completing the resume flow.
From IWL_DEVICE_FAMILY_AX210 the resume flow is triggered by the
transport layer on iwl_trans_d3_resume.
On IWL_DEVICE_FAMILY_22000 and earlier we trigger the resume flow by
sending the D0I3 command.
Currently, we are waiting for the notifications before sending the
command, the notifications won't be sent by the FW since there is no
resume trigger to piggyback on.
Send the command before starting the wait flow to fix it.
Signed-off-by: Haim, Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.5f0f251edf9c.Ia49ab73105af6f52aa7d318f4984edecd3b0671a@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Ilan Peer [Tue, 6 Sep 2022 13:42:16 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: Add handling for scan offload match info notification
To support FW versions that send the scan match information as
an asynchronous notification.
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.bbc5602d0b6f.I1329c231f82e7bf18f7dba0ccbd9f2d4080cbfc1@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Haim Dreyfuss [Tue, 6 Sep 2022 13:42:15 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: enable resume based on notifications
We have recently added support for resume based on notifications.
Enable it.
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.a6344ba23df5.I09fce8cf5aac1d46b40ae81b1abcf7a0e54af196@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Haim Dreyfuss [Tue, 6 Sep 2022 13:42:14 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: Add support for d3 end notification
Due to IMR, when host returns from hibernate, commands cannot
be sent as part of the resume flow, and so after ending
d3 the FW needs to send notifications instead of responses.
This notification indicates whether a fw reset is required.
Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.898ecba881b2.I13eb69bb5af08b9ac33043647eaed6b8d50e8659@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Haim Dreyfuss [Tue, 6 Sep 2022 13:42:13 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: Add support for wowlan wake packet notification
The wowlan info notification is quite big.
(~750 bytes without the wake packet itself).
The max FW notification size is ~2K.
There might be cases where the wake packet gets truncated because of
this limit.
Separating the wake packet from the wowlan info notification allows us to
get more data without trimming it.
Note: we currently limit the wake packet to 1600 bytes.
Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.06d1e6aecf10.Ib3d6a46ffe71d10cbc69bdb5654e6b14c28df245@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Haim Dreyfuss [Tue, 6 Sep 2022 13:42:12 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: Add support for wowlan info notification
IMR (Isolated Memory Regions) is a mechanism to protect memory regions
from unwarranted access by agents in the system that should not have access
to that memory.
When IMR is enabled, pages in the DRAM will be located within the IMR
memory space, accessible only by the device.
As a side effect, during S4 (a.k.a hibernate) the IMR memory space
is not retained.
While the DRAM is saved to the disk and restored by the OS upon resume,
the IMR, which is hidden from the OS neither saved upon suspend nor
restored upon resume.
As a consequence of the above, it turned out that commands cannot
be sent as part of the resume flow, and so after ending
d3 the FW needs to use notifications instead of cmd-resp.
The resume flow becomes asynchronous, with a series
of notifications, starting with wowlan_info_notif, through
wowlan_pkt_notif and complete the resume flow by d3_end_notif.
This patch adds the support for wowlan info notification.
The wake packet has been removed from the wowlan info struct
and will be handled in a dedicated notification.
Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.3ce8deefd929.Ieba8610e8bb4bec788076371ae38becb4a3d20d5@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Haim Dreyfuss [Tue, 6 Sep 2022 13:42:11 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: don't check D0I3 version
This code is dead, even old FW versions don't use it.
The IWL_D0I3_RESET_REQUIRE flag will be sent by the FW via a notification,
instead of command, the notification handler will be introduced later
in the series.
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.87c82482229a.I70456c38ed8f7beb7d62dd618f58e7dc0a7d33b2@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Johannes Berg [Tue, 6 Sep 2022 13:42:10 +0000 (16:42 +0300)]
wifi: iwlwifi: cfg: remove IWL_DEVICE_BZ_COMMON macro
We only have a single use of this inside the IWL_DEVICE_BZ
macro, so just combine the contents here.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.23d6c92e9a11.I4a11928a6d698079dc742e3ba3d3ce6fd7a878d1@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Johannes Berg [Tue, 6 Sep 2022 13:42:09 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: refactor iwl_mvm_set_sta_rate() a bit
Use a switch statement over the rate type instead of the
if chain, to simplify.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.623e32931b67.Id743a7879e84ae37a849179e536c58b1bf55380f@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Johannes Berg [Tue, 6 Sep 2022 13:42:08 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: rxmq: further unify some VHT/HE code
There's some duplication here, unify it so that adding EHT
becomes easier.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.d1e8673b9443.I6d81fc9dd0856d75e3a799c23f0f8d212b077fca@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Johannes Berg [Tue, 6 Sep 2022 13:42:07 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: rxmq: refactor mac80211 rx_status setting
There's a bunch of duplicated code in the normal data RX and
the no-data RX paths, refactor that.
Note that we're evidently not implementing the 6 GHz band in
the no-data path correctly, need to fix that in firmware
first. Also, we were setting the NSS differently, keep doing
that, but just override the previous values.
Note also that we used to drop frames with bad rate data, to
simplify that just report rate 0 and continue.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.a81580d5e769.I3ee7a1fe1adf8684c48713dbbdc2cbc60bd24cd1@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Johannes Berg [Tue, 6 Sep 2022 13:42:06 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: fix typo in struct iwl_rx_no_data API
The version 2 is also for RX, of course, that's just a typo.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.80f7eda56163.Ib783512104f0c135695b4d59b637f3eef3e8f537@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Yaara Baruch [Tue, 6 Sep 2022 13:42:05 +0000 (16:42 +0300)]
wifi: iwlwifi: pcie: add support for BZ devices
Add support in BZ-FM and BZ-GL devices. Adjust current structs
steps to differ between the new devices.
Signed-off-by: Yaara Baruch <yaara.baruch@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.0b7fc8487039.I984dcb58272e2f38c835e7aaa7e1ac646bc2f65e@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Deren Wu [Thu, 15 Sep 2022 08:36:04 +0000 (16:36 +0800)]
wifi: mt76: mt7921s: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to
handle the .suspend/.resume callbacks. The new macros allow suspend
and resume functions to be automatically dropped without any #ifdef
guards.
Tested-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Deren Wu [Thu, 15 Sep 2022 08:35:52 +0000 (16:35 +0800)]
wifi: mt76: mt7663s: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to
handle the .suspend/.resume callbacks. The new macros allow suspend
and resume functions to be automatically dropped without any #ifdef
guards.
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Deren Wu [Mon, 12 Sep 2022 08:45:52 +0000 (16:45 +0800)]
wifi: mt76: mt7921e: fix random fw download fail
In case of PCIe interoperability problem shows up, the firmware
payload may be corrupted in download stage. Turn off L0s to keep
fw download process accurately.
[ 1093.528363] mt7921e 0000:3b:00.0: Message
00000007 (seq 7) timeout
[ 1093.528414] mt7921e 0000:3b:00.0: Failed to start patch
[ 1096.600156] mt7921e 0000:3b:00.0: Message
00000010 (seq 8) timeout
[ 1096.600207] mt7921e 0000:3b:00.0: Failed to release patch semaphore
[ 1097.699031] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1098.758427] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1099.834408] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1100.915264] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1101.990625] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1103.077587] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1104.173258] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1105.248466] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1106.336969] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1106.397542] mt7921e 0000:3b:00.0: hardware init failed
Cc: stable@vger.kernel.org
Fixes:
bf3747ae2e25 ("mt76: mt7921: enable aspm by default")
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 7 Sep 2022 11:19:15 +0000 (19:19 +0800)]
wifi: mt76: mt7921: introduce Country Location Control support
Country Location Control (CLC) is an additional control for country rules
in firmware. We introduce this new feature to make sure mt7921 series
working properly in all region.
The addtional policies would be put into firmware based on differnt
regions. mt76 driver should be in charge of submitting per region policy.
Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Tested-by: YN Chen <YN.Chen@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Deren Wu [Tue, 6 Sep 2022 12:39:43 +0000 (20:39 +0800)]
wifi: mt76: mt7921e: fix rmmod crash in driver reload test
In insmod/rmmod stress test, the following crash dump shows up immediately.
The problem is caused by missing mt76_dev in mt7921_pci_remove(). We
should make sure the drvdata is ready before probe() finished.
[168.862789] ==================================================================
[168.862797] BUG: KASAN: user-memory-access in try_to_grab_pending+0x59/0x480
[168.862805] Write of size 8 at addr
0000000000006df0 by task rmmod/5361
[168.862812] CPU: 7 PID: 5361 Comm: rmmod Tainted: G OE 5.19.0-rc6 #1
[168.862816] Hardware name: Intel(R) Client Systems NUC8i7BEH/NUC8BEB, 05/04/2020
[168.862820] Call Trace:
[168.862822] <TASK>
[168.862825] dump_stack_lvl+0x49/0x63
[168.862832] print_report.cold+0x493/0x6b7
[168.862845] kasan_report+0xa7/0x120
[168.862857] kasan_check_range+0x163/0x200
[168.862861] __kasan_check_write+0x14/0x20
[168.862866] try_to_grab_pending+0x59/0x480
[168.862870] __cancel_work_timer+0xbb/0x340
[168.862898] cancel_work_sync+0x10/0x20
[168.862902] mt7921_pci_remove+0x61/0x1c0 [mt7921e]
[168.862909] pci_device_remove+0xa3/0x1d0
[168.862914] device_remove+0xc4/0x170
[168.862920] device_release_driver_internal+0x163/0x300
[168.862925] driver_detach+0xc7/0x1a0
[168.862930] bus_remove_driver+0xeb/0x2d0
[168.862935] driver_unregister+0x71/0xb0
[168.862939] pci_unregister_driver+0x30/0x230
[168.862944] mt7921_pci_driver_exit+0x10/0x1b [mt7921e]
[168.862949] __x64_sys_delete_module+0x2f9/0x4b0
[168.862968] do_syscall_64+0x38/0x90
[168.862973] entry_SYSCALL_64_after_hwframe+0x63/0xcd
Test steps:
1. insmode
2. do not ifup
3. rmmod quickly (within 1 second)
Fixes:
1c71e03afe4b ("mt76: mt7921: move mt7921_init_hw in a dedicated work")
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Sean Wang [Mon, 29 Aug 2022 22:57:44 +0000 (06:57 +0800)]
wifi: mt76: mt7921: reset msta->airtime_ac while clearing up hw value
We should reset mstat->airtime_ac along with clear up the entries in the
hardware WLAN table for the Rx and Rx accumulative airtime. Otherwsie, the
value msta->airtime_ac - [tx, rx]_last may be a negative and that is not
the actual airtime the device took in the last run.
Reported-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Howard Hsu [Thu, 18 Aug 2022 02:44:07 +0000 (10:44 +0800)]
wifi: mt76: mt7915: do not check state before configuring implicit beamform
Do not need to check running state before configuring implicit Tx
beamform. It is okay to configure implicit Tx beamform in run time.
Noted that the existing connected stations will be applied for new
configuration only if they reconnected to the interface.
Fixes:
6d6dc980e07d ("mt76: mt7915: add implicit Tx beamforming support")
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Tue, 16 Aug 2022 10:32:12 +0000 (12:32 +0200)]
wifi: mt76: fix uninitialized pointer in mt7921_mac_fill_rx
Initialize msta pointer to NULL in mt7921_mac_fill_rx() in order to not
dereference a uninitialized pointer.
Fixes:
0880d40871d1d ("mt76: connac: move mt76_connac2_reverse_frag0_hdr_trans in mt76-connac module")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Howard Hsu [Mon, 15 Aug 2022 03:29:31 +0000 (11:29 +0800)]
wifi: mt76: mt7915: fix mcs value in ht mode
Fix the error that mcs will be reduced to a range of 0 to 7 in ht mode.
Fixes:
70fd1333cd32 ("mt76: mt7915: rework .set_bitrate_mask() to support more options")
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Sean Wang [Sun, 14 Aug 2022 23:37:14 +0000 (07:37 +0800)]
wifi: mt76: mt7921: get rid of the false positive reset
False positive reset would be possibly triggered by those commands we
applied in suspend with HZ MCU timeout, especially it happened when we
enabled kernel log in pm core to diagnose how much time we spend in each
driver during suspend procedure. So we enlarge the value and align the MCU
timeout as other commands we did to reduce the false positive reset.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>