summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt7615/main.c
AgeCommit message (Collapse)Author
2021-06-19mt76: mt7615: set macwork timeout according to runtime-pmLorenzo Bianconi
Set macwork timeout value according to runtime-pm in order to reduce power consumption Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-19mt76: connac: add mt76_connac_power_save_sched in mt76_connac_pm_unrefLorenzo Bianconi
Schedule power_save work running mt76_connac_pm_unref in order to reduce power consumption Tested-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-19mt76: mt7615: remove useless if condition in mt7615_add_interface()Lorenzo Bianconi
Get rid of unnecessary if condition in mt7615_add_interface routine Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-19mt76: mt7615: add .offset_tsf callbackRyder Lee
It's much more accurate than .get_tsf + .set_tsf and switch to use mt76_rmw to operate tsf registers. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-19mt76: mt7663: enable hw rx header translationLorenzo Bianconi
As already done for mt7615 and mt7915, enable rx header translation offload for mt7663 in order to reduce cpu load in the rx path. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: connac: do not run mt76_txq_schedule_all directlyLorenzo Bianconi
In order to not break runtime-pm, do run mt76_txq_schedule_all in mt7615_set_channel/mt7921_set_channel but rely on mt76_worker_schedule Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: mt7663: rely on mt76_connac_pm_ref/mt76_connac_pm_unref in tx pathLorenzo Bianconi
Introduce mt7615_tx_worker routine as mt76 tx worker callback for mt7663. Rely on mt76_connac_pm_ref/mt76_connac_pm_unref to check PM state and increment/decrement wake counter Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: connac: move mcu_update_arp_filter in mt76_connac moduleLorenzo Bianconi
Move mt76_connac_mcu_update_arp_filter in mt76_connac module since the code is shared between mt7615 and mt7921 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: introduce single-sku support for mt7663/mt7921Lorenzo Bianconi
Introduce support for rate-txpower compensation for mt7663/mt7921 chipsets. Rate-txpower limit is specified through dts Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: mt7615: keep mcu_add_bss_info enabled till interface removalRyder Lee
BSS_INFO_BASIC is never called alone with inactive state, which always follows beacon offload disable, so keep it enabled throughout interfaces life cycle. Inactive state also removes sta record of all connected stations, thurs causes connection lost which defeats the purpose of CSA. Lastly, this is especially an unexpected behavior that keeping mt7622 failing beacon buffer recyled when scanning channels. bss_conf change is updated with active state only, so just overwrite it. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: mt7663: fix when beacon filter is being appliedSean Wang
HW beacon filter command is being applied until we're in associated state because the command would rely on the associated access point's beacon interval and DTIM information. Fixes: 7124198ab1a4 ("mt76: mt7615: enable beacon filtering by default for offload fw") Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: mt7615: check mcu returned values in mt7615_opsRyder Lee
Properly check returned values from mcu utility routines in mt7615_ops. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: mt7615: fix mib stats counter reporting to mac80211Lorenzo Bianconi
In order to properly report MIB counters to mac80211, resets stats in mt7615_get_stats routine and hold mt76 mutex accessing MIB counters. Sum up MIB counters in mt7615_mac_update_mib_stats routine. Fixes: c388d8584bc83 ("mt76: mt7615: add a get_stats() callback") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: mt7615: fix TSF configurationRyder Lee
The index of TSF counters should follow HWBSSID. Fixes: d8d59f66d136 ("mt76: mt7615: support 16 interfaces") Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: mt7615: add support for rx decapsulation offloadRyder Lee
For AP and Client mode, the hardware can pass received packets as 802.3 frames that can be passed to the network stack as-is. Tested-by: Frank Wunderlich <frank-w@public-files.de> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-11mt76: mt7615: fix key set/delete issuesFelix Fietkau
There were multiple issues in the current key set/remove code: - deleting a key with the previous key index deletes the current key - BIP key would only be uploaded correctly initially and corrupted on rekey Rework the code to better keep track of multiple keys and check for the key index before deleting the current key Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-29mt76: mt76_connac: move pm utility routines in mt76_connac_lib moduleLorenzo Bianconi
Move power_save common code shared between mt7663 and mt7921 in mt76_connac module Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-29mt76: mt76_connac: move pm data struct in mt76_connac.hLorenzo Bianconi
Move pm mt7663 data structure in mt76_connac.h introducing mt76_connac_pm data struct. This is a preliminary patch to share pm code between mt7663 and mt7921 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-29mt76: mt76_connac: move WoW and suspend code in mt76_connac_mcu moduleLorenzo Bianconi
Move WoW and suspend code in mt76_connac_mcu module in order to be reused in mt7615 and mt7921 drivers Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-29mt76: mt76_connac: move hw_scan and sched_scan routine in mt76_connac_mcu moduleLorenzo Bianconi
Move hw_scan/sched_scan in mt76_connac_mcu module in order to be reused in mt7615 and mt7921 drivers Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-29mt76: mt76_connac: create mcu libraryLorenzo Bianconi
Introduce mt76_connac common mcu library for code sharing between mt7615 and mt7921 devices Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-29mt76: introduce mt76_vif data structureLorenzo Bianconi
Introduce mt76_vif data structure to share common fields between mt7615_vif and mt7921_vif and create a mcu common library Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-27mt76: move vif_mask back from mt76_phy to mt76_devFelix Fietkau
Since it is global for all drivers, it belongs to the main device Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-26mt76: mt7615: mt7915: disable txpower sku when testmode enabledShayne Chen
When testmode can be enabled, the start() callback would already be called, causing that txpower sku feature isn't really disabled after testmode is enabled. This patch fix the issue. Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-26mt76: move chainmask in mt76_phyLorenzo Bianconi
Move chainmask from driver phy to mt76_phy since it is used by all drivers. This is a preliminary patch to create a common mcu library used by mt7615 and mt7921 drivers Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-26mt76: move mac_work in mt76_core moduleLorenzo Bianconi
Move mac_work delayed_work and mac_work_count in mt76_phy since it is used by all drivers. This is a preliminary patch to create a common mcu library used by mt7615 and mt7921 drivers Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-26mt76: testmode: introduce dbdc supportShayne Chen
Add testmode support for DBDC NICs (both MT7615D and MT7915D work). Testmode data and parameters are moved from per-dev to per-phy for maintaining the value of each band. Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Acked-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: mt7615: support 16 interfacesRyder Lee
When looking for a MAC address slot, start by using main BSSID slots 1-3, afterwards use 16 repeater mode BSSID slots, then start using the slots usually used for AP mode. This search order should prevent unnecessary conflicts with AP mode interfaces on the same PHY. Note that two PHYs share global 32 omac slots with each other. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: mt7615: run key configuration in mt7615_set_key for usb/sdio devicesLorenzo Bianconi
Since rate configuration is run holding dev mutex, we can run key configuration in mt7615_set_key for usb/sdio devices avoiding to schedule the workqueue Tested-by: Tested-by: YN Chen <yn.chen@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: switch to wep sw crypto for mt7615/mt7915Lorenzo Bianconi
Switch to wep sw crypto for mt7615/mt7915 since wtbl require a sta reference and wep key is not pairwise Tested-by: YN Chen <yn.chen@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: mt7615: enable beacon filtering by default for offload fwLorenzo Bianconi
In order to reduce cpu cycles, enable hw beacon filter by default if the device is running offload fw with sta only interfaces. Disable runtime pm for multi-vif scenario. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: remove retry_q from struct mt76_txq and related codeFelix Fietkau
Since the switch to using AQL by default, mtxq->retry_q is never filled anymore Remove it to get rid of a few more unnecessary cycles in the tx path Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: convert from tx tasklet to tx worker threadFelix Fietkau
This improves performance by allowing the scheduler to move the tx scheduling work to idle CPUs. Since tx scheduling work is very latency sensitive and kept short via AQL, sched_set_fifo_low is used to keep worker priority above normal tasks Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: mt7615: remove mtxq->agg_ssn assignmentFelix Fietkau
It is not used anywhere for this driver Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: mt7615: reschedule runtime-pm receiving a tx interruptLorenzo Bianconi
Reschedule runtime-pm after receiving a tx interrupt. Update runtime-pm last activity before injecting packets Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: mt7615: hold mt76 lock queueing wd in mt7615_queue_key_updateLorenzo Bianconi
wq queue is always updated holding mt76 spinlock. Grab mt76 lock in mt7615_queue_key_update() before putting a new element at the end of the queue. Fixes: eb99cc95c3b65 ("mt76: mt7615: introduce mt7663u support") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7615: sdio code must access rate/key regs in preocess contextLorenzo Bianconi
As usb, sdio relies on mt76 workqueue to configure tx rate or upload keys to the hw. This is a preliminary patch to add SDIO support to mt76 driver Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7663u: sync probe sampling with rate configurationLorenzo Bianconi
On usb device rate configuration for sampling is performed relying on a workqueue since it is not possible to access the device in the interrupt context. Move the configuration of the probe_rate flag in the workqueue in order to keep probe sampling in sync with actual rate configuration Fixes: eb99cc95c3b6 ("mt76: mt7615: introduce mt7663u support") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7615: enable beacon hw filter for runtime-pmLorenzo Bianconi
In order to reduce number of received interrupts and power consumption, enable hw beacon filter if runtime-pm is enabled Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7615: check MT76_STATE_PM flag before accessing the deviceLorenzo Bianconi
Double-check if the device is in low-power state before accessing registermap in mt7615_sta_rate_tbl_update() and in mt7615_led_set_config() Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7615: run mt7615_pm_wake in mt7615_mac_sta_{add,remove}Lorenzo Bianconi
Run mt7615_pm_wake()/mt7615_pm_power_save_sched() directly in order to wake the device from low power state in mt7615_mac_sta_{add,remove} since they run holding mt76 mutex in common mt76 code Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7615: wake device before pushing frames in mt7615_txLorenzo Bianconi
Queue frames pushed by mac80211 running mt7615_tx if the device is low-power state. Run wake workqueue in order to swicth to full-power before transmitting pending frames Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7615: wake device before pulling packets from mac80211 queuesLorenzo Bianconi
Make sure the device is in full-power before pulling frames from mac80211 queues Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7615: run mt7615_mcu_set_roc holding mt76 mutexLorenzo Bianconi
Make sure to run mt7615_mcu_set_roc() holding mt76 mutex in order to wake the device from low power state and avoid races Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7615: run mt7615_mcu_set_wmm holding mt76 mutexLorenzo Bianconi
Make sure to run mt7615_mcu_set_wmm() holding mt76 mutex in order to wake the device from low power state and avoid races Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7615: wake device before performing freq scanLorenzo Bianconi
Set device in full power before performing hw scan or hw scheduled scan Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7615: introduce pm_power_save delayed workLorenzo Bianconi
Introduce runtime-pm power_save delayed work used to enable low-power after an inactivity period Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7615: wake device before configuring hw keysLorenzo Bianconi
Make sure the device is in full-power before uploading keys to the hw Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7615: introduce mt7615_mutex_{acquire,release} utilitiesLorenzo Bianconi
Introduce mt7615_mutex_{acquire,release} utility routines in order to switch in full-power/low-power before/after accessing device register-map Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: mt7615: add mt7615_pm_wake utility routineLorenzo Bianconi
Introduce mt7615_pm_wake utility routine to wake the device from runtime low-power state (lower-power state is currently supported by offload firmware for pcie devices). Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>