summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt7921/main.c
AgeCommit message (Collapse)Author
2024-07-09wifi: mt76: mt792x: extend mt76_connac_mcu_uni_add_dev for per-link BSSSean Wang
Extend mt76_connac_mcu_uni_add_dev with per-link BSS configuration. The patch we created is a prerequisite to enable the MLO function in the driver. It is purely a refactoring patch so the functionality should remain unchanged. We also extend link_idx field in mt76_connac_bss_basic_tlv for the firmware to able to identify the link index in the MLO mode that is not harmful for the current non-MLO mode. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Link: https://patch.msgid.link/20240613030241.5771-6-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-07-09wifi: mt76: mt792x: add struct mt792x_chanctxDeren Wu
We are introducing a new structure, mt792x_chanctx, to quickly identify the linked BSS it is working on. This eliminates the need to search in mt7921_ctx_iter() or mt7925_ctx_iter() when the channel context changes. Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Link: https://patch.msgid.link/20240613030241.5771-4-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-07-09wifi: mt76: mt792x: add struct mt792x_link_staDeren Wu
We are introducing a new structure, mt792x_link_sta, to manage per-link configurations in preparation for future station (STA) support of Multi-Link Operation (MLO). This patch only includes structural changes and does not involve any logic changes. We have moved relevant parameters, such as the wcid from the mt76_wcid structure, from the mt7921x_sta structure to the mt792x_link_sta structure. For current drivers that do not support MLO, there is only one link STA, and link information is accessed via the deflink member. However, we have not yet created the per-link BSS configuration indexed by link ID for Multi-Link Device (MLD) support in mt7921x_sta. This step needs to be completed before adding MLD support for STA mode. Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Link: https://patch.msgid.link/20240613030241.5771-3-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-07-09wifi: mt76: mt792x: add struct mt792x_bss_confDeren Wu
We are introducing a new structure, mt792x_bss_conf, to manage per-link configurations in preparation for future STA support of Multi-Link Operation (MLO). The patch does not include any logic changes, only structural changes. We have moved relevant parameters from the mt7921x_vif structure such as to mt76 of mt76_vif structure, rssi and Tx queue parameters to mt7921x_bss_conf structure. We can access those members to configure the BSS for this interface, whether it is our own BSS or the one we are associated with. However, we have not yet created the per-link BSS configuration indexed by link ID for Multi-Link Device (MLD) support. This step needs to be extended before adding MLD support for AP mode. Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Link: https://patch.msgid.link/20240613030241.5771-2-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-06-26wifi: mac80211: inform the low level if drv_stop() is a suspendEmmanuel Grumbach
This will allow the low level driver to take different actions for different flows. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20240618192529.739036208b6e.Ie18a2fe8e02bf2717549d39420b350cfdaf3d317@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-05-02wifi: mt76: mt7921e: add LED control supportHao Zhang
Introduce wifi LED switch control, add flow to Control a wifi gpio pin based on the status of WIFI radio, if the pin is connected to an LED, the LED will indicate the status of the WiFi radio. Signed-off-by: Hao Zhang <hao.zhang@mediatek.com> Co-developed-by: Quan Zhou <quan.zhou@mediatek.com> Signed-off-by: Quan Zhou <quan.zhou@mediatek.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-05-02wifi: mt76: mt7921: cqm rssi low/high event notifyRong Yan
The implementation amounts to setting the driver flag IEEE80211_VIF_SUPPORTS_CQM_RSSI, and then providing mechanisms for continuously updating enough information to be able to provide notifications to userspace when RSSI drops below a certain threshold Signed-off-by: Rong Yan <rong.yan@mediatek.com> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-02-22wifi: mt76: mt7921: fix a potential association failure upon resumingLeon Yen
In multi-channel scenarios, the granted channel must be aborted before suspending. Otherwise, the firmware will be put into a wrong state, resulting in an association failure after resuming. With this patch, the granted channel will be aborted before suspending if necessary. Signed-off-by: Leon Yen <leon.yen@mediatek.com> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-01-31wifi: fill in MODULE_DESCRIPTION()s for mt76 driversBreno Leitao
W=1 builds now warn if module is built without a MODULE_DESCRIPTION(). Add descriptions to the MediaTek mt76 drivers. Here is a sorted list of descriptions. It might make the reviewing process easier. MODULE_DESCRIPTION("MediaTek MT7603E and MT76x8 wireless driver"); MODULE_DESCRIPTION("MediaTek MT7615E and MT7663E wireless driver"); MODULE_DESCRIPTION("MediaTek MT7615E MMIO helpers"); MODULE_DESCRIPTION("MediaTek MT7663 SDIO/USB helpers"); MODULE_DESCRIPTION("MediaTek MT7663S (SDIO) wireless driver"); MODULE_DESCRIPTION("MediaTek MT7663U (USB) wireless driver"); MODULE_DESCRIPTION("MediaTek MT76x02 helpers"); MODULE_DESCRIPTION("MediaTek MT76x02 MCU helpers"); MODULE_DESCRIPTION("MediaTek MT76x0E (PCIe) wireless driver"); MODULE_DESCRIPTION("MediaTek MT76x0U (USB) wireless driver"); MODULE_DESCRIPTION("MediaTek MT76x2 EEPROM helpers"); MODULE_DESCRIPTION("MediaTek MT76x2E (PCIe) wireless driver"); MODULE_DESCRIPTION("MediaTek MT76x2U (USB) wireless driver"); MODULE_DESCRIPTION("MediaTek MT76x connac layer helpers"); MODULE_DESCRIPTION("MediaTek MT76x EEPROM helpers"); MODULE_DESCRIPTION("MediaTek MT76x helpers"); MODULE_DESCRIPTION("MediaTek MT76x SDIO helpers"); MODULE_DESCRIPTION("MediaTek MT76x USB helpers"); MODULE_DESCRIPTION("MediaTek MT7915E MMIO helpers"); MODULE_DESCRIPTION("MediaTek MT7921 core driver"); MODULE_DESCRIPTION("MediaTek MT7921E (PCIe) wireless driver"); MODULE_DESCRIPTION("MediaTek MT7921S (SDIO) wireless driver"); MODULE_DESCRIPTION("MediaTek MT7921U (USB) wireless driver"); MODULE_DESCRIPTION("MediaTek MT7925 core driver"); MODULE_DESCRIPTION("MediaTek MT7925E (PCIe) wireless driver"); MODULE_DESCRIPTION("MediaTek MT7925U (USB) wireless driver"); MODULE_DESCRIPTION("MediaTek MT792x core driver"); MODULE_DESCRIPTION("MediaTek MT792x USB helpers"); MODULE_DESCRIPTION("MediaTek MT7996 MMIO helpers"); Signed-off-by: Breno Leitao <leitao@debian.org> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://msgid.link/20240130104243.3025393-10-leitao@debian.org
2023-12-11wifi: mt76: mt7921: fix wrong 6Ghz power typeMing Yen Hsieh
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>
2023-09-30wifi: mt76: mt7921: add 6GHz power type support for clcMing Yen Hsieh
There are several power type should be supported in 6GHz band. mt7921 apply 6GHz power type from AP settings and clc will setup the corresponding regulatory power. Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Co-developed-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-09-30wifi: mt76: mt792x: move some common usb code in mt792x moduleLorenzo Bianconi
Move the following shared usb routines in mt792x module: - mt792xu_stop - mt792x_stop Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-09-30wifi: mt76: move struct ieee80211_chanctx_conf up to struct mt76_vifSean Wang
Move struct ieee80211_chanctx_conf up to struct mt76_vif to allow the connac2 library can access the struct ieee80211_chanctx_conf * member in struct mt76_vif. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Reviewed-by: David Ruth <druth@chromium.org> Tested-by: David Ruth <druth@chromium.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-09-30wifi: mt76: fix race condition related to checking tx queue fill statusFelix Fietkau
When drv_tx calls race against local tx scheduling, the queue fill status checks can potentially race, leading to dma queue entries being overwritten. Fix this by deferring packets from drv_tx calls to the tx worker, in order to ensure that all regular queue tx comes from the same context. Reported-by: Ryder Lee <Ryder.Lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-09-11wifi: cfg80211: annotate iftype_data pointer with sparseJohannes Berg
There were are a number of cases in mac80211 and iwlwifi (at least) that used the sband->iftype_data pointer directly, instead of using the accessors to find the right array entry to use. Make sparse warn when such a thing is done. To not have a lot of casts, add two helper functions/macros - ieee80211_set_sband_iftype_data() - for_each_sband_iftype_data() Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-07-26wifi: mt76: mt7921: move acpi_sar code in mt792x-lib moduleLorenzo Bianconi
Move acpi_sar code in mt792x-lib module since it is shared between mt7921 and mt7925 driver. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-26wifi: mt76: mt7921: move mac shared code in mt792x-lib moduleLorenzo Bianconi
Reduce duplicated code moving mac shared code in mt792x-lib module. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-26wifi: mt76: mt792x: introduce mt792x-lib moduleLorenzo Bianconi
mt792x-lib module will contain the shared code between mt7921 and new MT79 WiFi7 chipset Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-26wifi: mt76: mt7921: move mt792x_hw_dev in mt792x.hLorenzo Bianconi
This is a preliminary patch to introduce WiFi7 chipset support Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-26wifi: mt76: mt7921: move mt792x_mutex_{acquire/release} in mt792x.hLorenzo Bianconi
This is a preliminary patch to introduce WiFi7 chipset support Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-26wifi: mt76: mt7921: rename mt7921_dev in mt792x_devLorenzo Bianconi
This is a preliminary patch to introduce WiFi7 chipset support Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-26wifi: mt76: mt7921: rename mt7921_phy in mt792x_phyLorenzo Bianconi
This is a preliminary patch to introduce WiFi7 chipset support Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-26wifi: mt76: mt7921: rename mt7921_sta in mt792x_staLorenzo Bianconi
This is a preliminary patch to introduce WiFi7 chipset support Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-26wifi: mt76: mt7921: rename mt7921_vif in mt792x_vifLorenzo Bianconi
This is a preliminary patch to introduce WiFi7 chipset support Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-25wifi: mt76: move ampdu_state in mt76_wcidLorenzo Bianconi
ampdu_state field is used by most of the drivers, so move it in mt76_wcid structure. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-25wifi: mt76: mt7921: rely on shared poll_list fieldLorenzo Bianconi
Rely on poll_list field in mt76_wcid structure and get rid of private copy. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-25wifi: mt76: mt7921: rely on shared sta_poll_list and sta_poll_lockLorenzo Bianconi
Rely on sta_poll_list and sta_poll_lock fields in mt76_dev structure and get rid of private copies. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-25wifi: mt76: add tx_nss histogram to ethtool statsRyder Lee
mt76_connac2_mac_fill_txs() counts tx_nss but ethtool doesn't show stats. Add missing histogram accordingly. Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-25wifi: mt76: mt7921e: report tx retries/failed counts in tx free eventDeren Wu
Get missing tx retries/failed counts from txfree done events and report them via mt7921_sta_statistics(). Signed-off-by: Deren Wu <deren.wu@mediatek.com> Reviewed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-25wifi: mt76: mt7921: rely on mib_stats shared definitionLorenzo Bianconi
Get rid of private copy of mib_stats structure. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-07-25wifi: mt76: mt7921: do not support one stream on secondary antenna onlyDeren Wu
mt7921 support following antenna combiantions only. * primary + secondary (2x2) * primary only (1x1) Since we cannot work on secondary antenna only, return error if the antenna bitmap is 0x2 in .set_antenna(). For example: iw phy0 set antenna 3 3 /* valid */ iw phy0 set antenna 1 1 /* valid */ iw phy0 set antenna 2 2 /* invalid */ Cc: stable@vger.kernel.org Fixes: e0f9fdda81bd ("mt76: mt7921: add ieee80211_ops") Suggested-by: Knox Chiou <knoxchiou@google.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-04-21Merge tag 'wireless-next-2023-04-21' of ↵Jakub Kicinski
git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next Kalle Valo says: ==================== wireless-next patches for v6.4 Most likely the last -next pull request for v6.4. We have changes all over. rtw88 now supports SDIO bus and iwlwifi continues to work on Wi-Fi 7 support. Not much stack changes this time. Major changes: cfg80211/mac80211 - fix some Fine Time Measurement (FTM) frames not being bufferable - flush frames before key removal to avoid potential unencrypted transmission depending on the hardware design iwlwifi - preparation for Wi-Fi 7 EHT and multi-link support rtw88 - SDIO bus support - RTL8822BS, RTL8822CS and RTL8821CS SDIO chipset support rtw89 - framework firmware backwards compatibility brcmfmac - Cypress 43439 SDIO support mt76 - mt7921 P2P support - mt7996 mesh A-MSDU support - mt7996 EHT support - mt7996 coredump support wcn36xx - support for pronto v3 hardware ath11k - PCIe DeviceTree bindings - WCN6750: enable SAR support ath10k - convert DeviceTree bindings to YAML * tag 'wireless-next-2023-04-21' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (261 commits) wifi: rtw88: Update spelling in main.h wifi: airo: remove ISA_DMA_API dependency wifi: rtl8xxxu: Simplify setting the initial gain wifi: rtl8xxxu: Add rtl8xxxu_write{8,16,32}_{set,clear} wifi: rtl8xxxu: Don't print the vendor/product/serial wifi: rtw88: Fix memory leak in rtw88_usb wifi: rtw88: call rtw8821c_switch_rf_set() according to chip variant wifi: rtw88: set pkg_type correctly for specific rtw8821c variants wifi: rtw88: rtw8821c: Fix rfe_option field width wifi: rtw88: usb: fix priority queue to endpoint mapping wifi: rtw88: 8822c: add iface combination wifi: rtw88: handle station mode concurrent scan with AP mode wifi: rtw88: prevent scan abort with other VIFs wifi: rtw88: refine reserved page flow for AP mode wifi: rtw88: disallow PS during AP mode wifi: rtw88: 8822c: extend reserved page number wifi: rtw88: add port switch for AP mode wifi: rtw88: add bitmap for dynamic port settings wifi: rtw89: mac: use regular int as return type of DLE buffer request wifi: mac80211: remove return value check of debugfs_create_dir() ... ==================== Link: https://lore.kernel.org/r/20230421104726.800BCC433D2@smtp.kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-04-17wifi: mt76: add mt76_connac_gen_ppe_thresh utility routineLorenzo Bianconi
gen_ppe_thresh routine is shared between mt7615, mt7915, mt7921 and mt7996 so move it in mt76_connac module. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-04-17wifi: mt76: mt7921: use driver flags rather than mac80211 flags to mcuNeil Chen
FIF_* flags from mac80211 is not ABI. mt7921 should not pass it into mcu directly. Remap FIF_* to driver defined flags as mcu command input. Fixes: c222f77fd421 ("wifi: mt76: mt7921: fix rx filter incorrect by drv/fw inconsistent") Signed-off-by: Neil Chen <yn.chen@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-04-17wifi: mt76: mt7921: fix wrong command to set STA channelDeren Wu
Should not use AND operator to check vif type NL80211_IFTYPE_MONITOR, and that will cause we go into sniffer command for both STA and MONITOR mode. However, the sniffer command would set channel properly (with some extra options), the STA mode still works even if using the wrong command. Fix vif type check to make sure we using the right command to update channel. Fixes: 914189af23b8 ("wifi: mt76: mt7921: fix channel switch fail in monitor mode") Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-04-03wifi: mt76: ignore key disable commandsFelix Fietkau
This helps avoid cleartext leakage of already queued or powersave buffered packets, when a reassoc triggers the key deletion. Cc: stable@vger.kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230330091259.61378-1-nbd@nbd.name
2023-02-03wifi: mt76: add EHT rate stats for ethtoolShayne Chen
Add support to get EHT rate stats from ethtool. This is the preliminary patch to add EHT support for mt7996. Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-02-03wifi: mt76: enable page_pool statsLorenzo Bianconi
Enable page_pool ethtool statistics for mt7915 and mt7921 chipsets. Tested-by: Felix Fietkau <nbd@nbd.name> Tested-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-02-03wifi: mt76: mt7921: fix rx filter incorrect by drv/fw inconsistentNeil Chen
The rx filter, in mt7921 series, may be changed in fw operation. There is a racing problem if rx filter controlled by both driver and firmware at the same time. To avoid this issue, let mt7921 driver set rx filter by new command MCU_CE_CMD_SET_RX_FILTER and allow the firmware controlling it only. Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org> Co-developed-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Neil Chen <yn.chen@mediatek.com> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-02-03wifi: mt76: mt7921: add ack signal supportDeren Wu
This reports signal strength of ACK packets from the peer as measured at each interface. Reviewed-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-02-03wifi: mt76: mt7921: fix channel switch fail in monitor modeDeren Wu
When the chanctx enabled, IEEE80211_CONF_CHANGE_CHANNEL in .config() would not be called anymore. mt76 cannot control RF channel for monitor. Add monitor type set-channel flow in .change_chanctx(). Fixes: 41ac53c899bd ("wifi: mt76: mt7921: introduce chanctx support") Reviewed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-02-03wifi: mt76: mt7921: fix deadlock in mt7921_abort_rocFelix Fietkau
When mt7921_abort_roc is called with dev->mutex held, it can deadlock while calling cancel_work_sync(&phy->roc_work), because the work function could be waiting to acquire the mutex. Fix this by flushing the work before taking the mutex Reported-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com> Fixes: 034ae28b56f1 ("wifi: mt76: mt7921: introduce remain_on_channel support") Fixes: 41ac53c899bd ("wifi: mt76: mt7921: introduce chanctx support") Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-12-01wifi: mt76: mt7921: fix wrong power after multiple SAR setYN Chen
We should update CLC config before SAR set to synchronize all related settings. Fixes: 23bdc5d8cadf ("wifi: mt76: mt7921: introduce Country Location Control support") Signed-off-by: YN Chen <YN.Chen@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-12-01wifi: mt76: mt7921: introduce chanctx supportSean Wang
The firmware can have the capability to manage the channel context scheduling on multiple roles running on the device including Station, AP and P2P GC/GO mode (will be extended based on the future patchset) to help users sharing the network with others on a single device. The firmware is able to support the channel chanctx up to 2 interface simultaneously running on the different channels. Another thing to be noted is that before the driver is going sent out the management frames, the driver has to get the privilege from the firmware to occupy the current channel context until the frame handshake is completed and then get the privilege back to the firmware. Co-developed-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-12-01wifi: mt76: mt7921: introduce remain_on_channel supportSean Wang
Introduce remain_on_channel support. Additionally, we add mt7921_check_offload_capability to disable .remain_on_channel and .cancel_remain_on_channel and related configuration because those operations would rely on the fundamental MCU commands that will be only supported with newer firmware. Co-developed-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-12-01wifi: mt76: mt7921: add chanctx parameter to mt76_connac_mcu_uni_add_bss ↵Sean Wang
signature Add a chanctx parameter to mt76_connac_mcu_uni_add_bss signature to allow the firmware binds the BSS into the specific channel context. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-12-01wifi: mt76: move aggr_stats array in mt76_phyLorenzo Bianconi
Move aggregation stats array per-phy instead of share it between multiple interfaces. This is a preliminary patch to add mt7996 driver support. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-09-15wifi: mt76: mt7921: reset msta->airtime_ac while clearing up hw valueSean Wang
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>
2022-09-15wifi: mt76: move move mt76_sta_stats to mt76_wcidRyder Lee
This is a preliminary patch for WED's TxS support. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-09-15wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_sta_set_decap_offloadSean Wang
Add mt7921_mutex_acquire at mt7921_[start, stop]_ap to fix the race with the context holding dev->muxtex and the driver might access the device in low power state. Fixes: 24299fc869f7 ("mt76: mt7921: enable rx header traslation offload") Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>