Now that AQL works well on all mt76 drivers, completely replace the arbitrary
burst sizing and number of bursts logic for tx scheduling.
For the short period of time in which AQL does not work well yet, limit each
stations to 16 in-flight packets that have no estimated tx time.
This should avoid filling the queue if a station connects and queues up a
large number of packets before rate control information is available, especially
with hardware rate control
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Some devices using MT7628 or MT7603 have only one antenna chain connected.
Detect these using the EEPROM rx/tx path settings
Reported-by: Qin Wei <me@vonger.cn>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
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 <nbd@nbd.name>
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 <nbd@nbd.name>
The previous scheduling round may have been limited by AQL.
More frames might be available after the tx free run.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Tx cleanup and tx enqueuing can run in parallel. In order to avoid queue
starvation issues under load, update q->queued immediately.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Since DMA completion does not imply tx completion, it makes more sense to
poll for airtime from mt7915_mac_tx_free.
Reduce the runtime of the function by moving all items from dev->sta_poll_list
to a local list once and process any stations that were added afterwards
on the next run
Signed-off-by: Felix Fietkau <nbd@nbd.name>
- change the WTBL LMAC access function to set the mapping window only once
- use ac * 2 as offset, since each AC has separate words for rx and tx
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Fix length field corruption in usb dma header introduced adding sdio
support
Fixes: 75b10f0cbd ("mt76: mt76u: add mt76_skb_adjust_pad utility routine")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Fix a possible NULL pointer dereference in mt76_testmode_dump() since
nla_nest_start returns NULL in case of error
Fixes: f0efa86215 ("mt76: add API for testmode support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Initialize wcid to global_wcid if msta is NULL in mt7615_pm_wake_work
routine since wcid will be dereferenced running mt76_tx()
Fixes: 2b8cdfb28d ("mt76: mt7615: wake device before pushing frames in mt7615_tx")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Fix a memory leak in mt7615_tm_set_tx_power routine if
mt7615_eeprom_get_target_power_index fails.
Moreover do not account req_header twice in mcu skb allocation.
Fixes: 4f0bce1c88 ("mt76: mt7615: implement testmode support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
MT7663s have to rely on MMC_PM_KEEP_POWER in pm_flags for to avoid SDIO
power is being shut off.
To fix sdio access failure like "mt7663s mmc1:0001:1: sdio write failed:
-22" for the first sdio command to access the bus in the resume handler.
Fixes: a66cbdd657 ("mt76: mt7615: introduce mt7663s support")
Co-developed-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
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: a66cbdd657 ("mt76: mt7615: introduce mt7663s support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
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 <dan.carpenter@oracle.com>
Fixes: ea4906c4be ("mt76: mt7615: wake device before accessing regmap in debugfs")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This disables the software A-MSDU aggregation in mac80211 and enables hardware
offloading
Suggested-by: Yiwei Chung <yiwei.chung@mediatek.com>
Suggested-by: YF Luo <yf.luo@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Use the txwi data as primary source information to avoid touching skb data
Use bitfield instead of state variable + spinlock
Signed-off-by: Felix Fietkau <nbd@nbd.name>
mt7615 and newer drivers do not need this, since they use sequence number offload
Moving this code also reduces the number of callsites to make it easier to review
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Queueing a per-sta work item from the tx free path can become very expensive
under load. This work is only supposed to pull rate control stats every
second and deal with rate control changes.
Additionally, the rate control update code was wrong, because it was
confusing bit masks and bit numbers in test_bit.
Fix this by introducing a dedicated device work item for rate control
updates, and by polling station stats from the phy mac work.
Stations requiring polling or rate control updates are added to lists
protected by dev->sta_poll_lock.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Only clear unmasked interrupts. If an interrupt is temporarily masked,
its pending events need to be processed later, even if another interrupt
happened in the mean time.
Disable interrupts in one call before scheduling
Signed-off-by: Felix Fietkau <nbd@nbd.name>
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 <nbd@nbd.name>
Only clear unmasked interrupts. 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 <nbd@nbd.name>
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 <nbd@nbd.name>
In order to maximize parallelism, split status work in tx status work
and rx net work
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
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 <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
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 <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
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 <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Free the mcu skb in case of error in mt76s_tx_queue_skb_raw routine
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
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>
Do not tx packets in mt76_txq_send_burst() or mt76_txq_schedule_list()
if the device is in runtime-pm
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>