Commit Graph
415 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau e68c3e2548 mt76: mt7663s: use NULL instead of 0 in sdio code
Fix the following sparse warnings in mt7663s driver:

drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c:78:62: warning:
Using plain integer as NULL pointer
drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c:110:62: warning:
Using plain integer as NULL pointer
drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c:229:64: warning:
Using plain integer as NULL pointer
drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c:263:64: warning:
Using plain integer as NULL pointer

Fixes: a66cbdd6573d ("mt76: mt7615: introduce mt7663s support")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 21:19:24 +02:00
Lorenzo BianconiandFelix Fietkau 7c5445dec8 mt76: mt7615: release mutex in mt7615_reset_test_set
Reduce scope of mutex_acquire/mutex_release in mt7615_reset_test_set
routine in order to fix the following static checker warning:

drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c:179
mt7615_reset_test_set()
warn: inconsistent returns 'dev->mt76.mutex'.

Reported-by: Dan Carpenter <[email protected]>
Fixes: ea4906c4be49 ("mt76: mt7615: wake device before accessing regmap in debugfs")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 21:19:24 +02:00
Felix Fietkau 25dd8bdae3 mt76: mt7615: significantly reduce interrupt load
On 7615 and newer, DMA completion only triggers unmap, but not free of queued
skbs, since pointers to packets are queued internally.
Because of that, there is no need to process the main data queue immediately
on DMA completion.
To improve performance, mask out the DMA data queue completion interrupt and
process the queue only when we receive a txfree event.
This brings the number of interrupts under load down to a small fraction.

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 17:18:37 +02:00
Felix Fietkau 2f1318a06d mt76: convert from tx tasklet to tx worker thread
This should improve performance by allowing the scheduler to move the tx
scheduling work to idle CPUs

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 15:56:57 +02:00
Felix Fietkau 2767051432 mt76: mt7615: use v1 MCU API on MT7615 to fix issues with adding/removing stations
The implementation of embedding WTBL update inside the STA_REC update is buggy
on the MT7615 v2 firmware. This leads to connection issues after a station has
connected and disconnected again.

Switch to the v1 MCU API ops, since they have received much more testing and
should be more stable.

On MT7622 and later, the v2 API is more actively used, so we should keep using
it as well.

Fixes: 6849e29ed92e ("mt76: mt7615: add starec operating flow for firmware v2")
Cc: [email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-12 12:19:40 +02:00
Felix Fietkau ad90170b0a mt76: mt7615: remove mtxq->agg_ssn assignment
It is not used anywhere for this driver

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-11 12:13:34 +02:00
Felix Fietkau f2e71f0c1b mt76: mt7615: do not do any work in napi poll after calling napi_complete_done()
Fixes a race condition where multiple tx cleanup tasks could run in parallel

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-08 09:30:27 +02:00
Felix Fietkau 2fbd6baac1 mt76: mt7615: only clear unmasked interrupts in irq tasklet
If an interrupt is temporarily masked, its pending events need to be processed
later, even if another interrupt happened in the mean time.

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-07 22:09:58 +02:00
Felix Fietkau 58774b605f mt76: set interrupt mask register to 0 before requesting irq
Avoids spurious interrupts in case the hardware was running already

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-07 21:56:37 +02:00
Lorenzo BianconiandFelix Fietkau f957b050d8 mt76: mt76s: move tx/rx processing in 2 separate works
In order to maximize parallelism, split status work in tx status work
and rx net work

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:33:02 +02:00
Lorenzo BianconiandFelix Fietkau 2b34f2f6b0 mt76: mt76s: move status processing in txrx wq
As it has been done for tx and rx processing, move tx/rx status
processing into mt76s_txrx_wq workqueue

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:33:02 +02:00
Lorenzo BianconiandFelix Fietkau c828c84cb1 mt76: mt7663s: move rx processing in txrx wq
Move rx processing to mt76s_txrx_wq in order to minimize the interval when
the sdio bus is locked during rx

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:33:02 +02:00
Lorenzo BianconiandFelix Fietkau dc73103874 mt76: mt76s: move tx processing in a dedicated wq
Introduce mt76s_txrx_wq workqueue and move tx processing from kthread to
a dedicated work. This is preliminary patch to improve mt7663s throughput

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:33:02 +02:00
Lorenzo BianconiandFelix Fietkau ae4757a0ae mt76: mt7615: reschedule runtime-pm receiving a tx interrupt
Reschedule runtime-pm after receiving a tx interrupt.
Update runtime-pm last activity before injecting packets

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:33:02 +02:00
Lorenzo BianconiandFelix Fietkau a5602514ab mt76: mt7615: hold mt76 lock queueing wd in mt7615_queue_key_update
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:33:02 +02:00
Lorenzo BianconiandFelix Fietkau e7774de844 mt76: mt7663s: move drv_own/fw_own in mt7615_mcu_ops
Initialize set_drv_ctrl and set_fw_ctrl function pointers in
mt7663s_mcu_init. This is a preliminary patch to enable runtime-pm for
mt7663s chipset.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:33:02 +02:00
Lorenzo BianconiandFelix Fietkau 93407be934 mt76: mt7615: move drv_own/fw_own in mt7615_mcu_ops
Introduce set_drv_ctrl and set_fw_ctrl function pointers in
mt7615_mcu_ops data structure. This is a preliminary patch to enable
runtime-pm for non-pci chipsets

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:33:02 +02:00
Shayne ChenandFelix Fietkau 9980456037 mt76: mt7615: register ext_phy if DBDC is detected
MT_EE_WIFI_CONF field can be used to detect if the chipset is MT7615D.
Thus, add support to automatically register ext_phy if DBDC is detected.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:31:29 +02:00
Felix Fietkau 825343467d mt76: fix double DMA unmap of the first buffer on 7615/7915
A small part of the first skb buffer is passed to the firmware for parsing
via DMA, while the full buffer is passed as part of the TXP.

Avoid calling DMA unmap on the first part (with a different length than map)

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:31:29 +02:00
Lorenzo BianconiandFelix Fietkau 88fa973f59 mt76: mt7615: fix possible memory leak in mt7615_mcu_wtbl_sta_add
Free the second mcu skb if __mt76_mcu_skb_send_msg() fails to transmit
the first one in mt7615_mcu_wtbl_sta_add().

Fixes: 99c457d902cf9 ("mt76: mt7615: move mt7615_mcu_set_bmc to mt7615_mcu_ops")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-22 11:13:06 +02:00
Lorenzo BianconiandFelix Fietkau 4d2f622190 mt76: mt76s: move queue accounting in mt76s_tx_queue_skb
In order to avoid possible overflows, move tx queue accounting from
mt7663s_tx_run_queue() to mt76s_tx_queue_skb_raw()/mt76s_tx_queue_skb()

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-22 11:13:06 +02:00
Felix Fietkau 632ce698e8 mt76: mt7615: fix antenna settings for test mode
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-21 18:43:15 +02:00
Sean WangandFelix Fietkau aa97be8e02 mt76: mt7615: introduce mt7663s support
Introduce support for mt7663s 802.11ac 2x2:2 chipset to mt7615 driver.

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
2020-07-15 16:14:51 +02:00
Sean WangandFelix Fietkau bf88e70c7a mt76: introduce mt76_sdio module
Introduce mt76_sdio module as common layer to add mt7663s support

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
2020-07-15 16:05:18 +02:00
Lorenzo BianconiandFelix Fietkau fa16627d7e mt76: mt7615: introduce mt7663-usb-sdio-common module
Introduce mt7663-usb-sdio-common module as container for shared
code between usb and sdio driver.

Signed-off-by: Lorenzo Bianconi <[email protected]>
2020-07-15 16:04:52 +02:00
Lorenzo BianconiandFelix Fietkau 98412356c9 mt76: mt7615: sdio code must access rate/key regs in preocess context
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 <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
2020-07-15 16:04:28 +02:00
Lorenzo BianconiandFelix Fietkau c0cbef79eb mt76: mt76u: add mt76_skb_adjust_pad utility routine
Introduce mt76_skb_adjust_pad to reuse the code adding sdio support to
mt7615 driver and remove code duplication. Move 4B header configuration
for usb devices out of mt76_skb_adjust_pad

Signed-off-by: Lorenzo Bianconi <[email protected]>
2020-07-15 16:04:28 +02:00
Lorenzo BianconiandFelix Fietkau 8c0a25d6a3 mt76: mt7615: take into account sdio bus configuring txwi
usb and sdio relies on SF architecture. This is a preliminary patch to
add SDIO support to mt76 driver

Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
2020-07-15 16:04:28 +02:00
Felix Fietkau 6838d002f9 mt76: mt7615: fix tx_frames setup
Properly set up the state when entering the tx_frames state

Signed-off-by: Felix Fietkau <[email protected]>
2020-07-14 18:48:07 +02:00
Felix Fietkau 1641aa2016 mt76: mt7615: fix mt7615_mcu_set_test_param set non-bool parameters
Fixes testmode freq_offset

Signed-off-by: Felix Fietkau <[email protected]>
2020-07-14 18:17:34 +02:00
Sean WangandFelix Fietkau 4c9309f47d mt76: mt7615: fix potential memory leak in mcu message handler
Fix potential memory leak in mcu message handler on error condition.

Fixes: 0e6a29e477f3 ("mt76: mt7615: add support to read temperature from mcu")
Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:30 +02:00
Sean WangandFelix Fietkau afff00ad2b mt76: mt7663u: fix potential memory leak in mcu message handler
Fix potential memory leak in mcu message handler on error condition.

Fixes: eb99cc95c3b6 ("mt76: mt7615: introduce mt7663u support")
Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:30 +02:00
Sean WangandFelix Fietkau 1f670a5344 mt76: mt7663u: fix memory leak in set key
Fix memory leak in set key.

Fixes: eb99cc95c3b6 ("mt76: mt7615: introduce mt7663u support")
Signed-off-by: Sean Wang <[email protected]>
Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:30 +02:00
Lorenzo BianconiandFelix Fietkau f1ff52acb6 mt76: mt7615: reschedule ps work according to last activity
Reschedule runtime-pm delayed work if there is a new activity when ps
delayed work is already scheduled

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:30 +02:00
Lorenzo BianconiandFelix Fietkau b469c59c61 mt76: mt7615: avoid scheduling runtime-pm during hw scan
Do not schedule ps_work during hw scanning or hw scheduled frequency
scan

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:30 +02:00
Lorenzo BianconiandFelix Fietkau a873b7c8e3 mt76: mt7663u: sync probe sampling with rate configuration
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:30 +02:00
Lorenzo BianconiandFelix Fietkau 58057d1f23 mt76: mt7615: improve mt7615_driver_own reliability
mt7615_driver_own can fail if it runs too close to mt7615_fw_own. In
order to improve mt7615_driver_own reliability, retry to get runtime-pm
ownership if mt7615_driver_own fails

Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:30 +02:00
Lorenzo BianconiandFelix Fietkau 29f2bebe1a mt76: mt7615: add idle-timeout knob in mt7615 debugfs
Introduce idle-timeout knob in mt7615 debugfs in order to configure the
idle time to switch to low-power state

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:30 +02:00
Lorenzo BianconiandFelix Fietkau ccc90dafea mt76: mt7615: enable beacon hw filter for runtime-pm
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:30 +02:00
Lorenzo BianconiandFelix Fietkau 94519eac69 mt76: mt7615: add runtime-pm knob in mt7615 debugfs
Introduce runtime-pm knob in mt7615 debugfs in order to enable/disable
runtime pm available in offload firmware

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:30 +02:00
Lorenzo BianconiandFelix Fietkau 28a2f5fa6e mt76: mt7615: do not request {driver,fw}_own if already granted
Check MT76_STATE_PM in mt7615_driver_own/mt7615_firmware_own
in order to not requested power ownership if it is already granted

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:29 +02:00
Lorenzo BianconiandFelix Fietkau 2107caf92e mt76: mt7615: check MT76_STATE_PM flag before accessing the device
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:29 +02:00
Lorenzo BianconiandFelix Fietkau 65ccc40c14 mt76: mt7615: run mt7615_pm_wake in mt7615_mac_sta_{add,remove}
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:29 +02:00
Lorenzo BianconiandFelix Fietkau 82e8e0525d mt76: mt7615: wake device before pushing frames in mt7615_tx
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:29 +02:00
Lorenzo BianconiandFelix Fietkau b8cdce45c1 mt76: mt7615: wake device before pulling packets from mac80211 queues
Make sure the device is in full-power before pulling frames from
mac80211 queues

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:29 +02:00
Lorenzo BianconiandFelix Fietkau 36a789c00e mt76: mt7615: run mt7615_mcu_set_roc holding mt76 mutex
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:29 +02:00
Lorenzo BianconiandFelix Fietkau 6fdb20a025 mt76: mt7615: run mt7615_mcu_set_wmm holding mt76 mutex
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:29 +02:00
Lorenzo BianconiandFelix Fietkau 2c188db1f7 mt76: mt7615: add missing lock in mt7615_regd_notifier
Make sure to run mt7615_dfs_init_radar_detector in mt7615_regd_notifier
holding mt76 mutex in order to avoid races and set the device in full
power

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:29 +02:00
Lorenzo BianconiandFelix Fietkau 58369fdce2 mt76: mt7615: wake device before performing freq scan
Set device in full power before performing hw scan or hw scheduled scan

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:29 +02:00
Lorenzo BianconiandFelix Fietkau b0bcdd66cc mt76: mt7615: acquire driver_own before configuring device for suspend
Make sure to wake the device in mt7615_pci_suspend in order to properly
configure device registers before suspend

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-10 14:45:29 +02:00