Commit Graph
109 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau e46dd240ce mt76: check return value of mt76_txq_send_burst in mt76_txq_schedule_list
Since mt76_txq_send_burst routine can report a negative error code,
check the returned value before incrementing the number of transmitted
frames in mt76_txq_schedule_list routine.
Return -EBUSY directly if the device is in reset or in power management.

Fixes: 90fdc1717b186 ("mt76: use mac80211 txq scheduling")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 23:38:18 +01:00
Felix Fietkau 4eb5caaf6c mt76: reduce q->lock hold time
Instead of holding it for the duration of an entire station schedule run,
which can block out competing tasks for a significant amount of time,
only hold it for scheduling one batch of packets for one station.
Improves responsiveness under load

Signed-off-by: Felix Fietkau <[email protected]>
2021-01-24 12:26:58 +01:00
Shayne ChenandFelix Fietkau a897a69769 mt76: testmode: introduce dbdc support
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 <[email protected]>
Acked-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-01-04 18:30:34 +01:00
Souptick JoarderandFelix Fietkau c202ace409 mt76: remove unused variable q
Kernel test robot reported warning:

   drivers/net/wireless/mediatek/mt76/tx.c: In function
'mt76_txq_schedule':
>> drivers/net/wireless/mediatek/mt76/tx.c:499:21: warning: variable 'q'
>> set but not used [-Wunused-but-set-variable]
     499 |  struct mt76_queue *q;
         |                     ^

Reported-by: kernel test robot <[email protected]>
Signed-off-by: Souptick Joarder <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
2021-01-04 18:30:34 +01:00
Felix Fietkau e44b7c9107 mt76: skip queue stop/wake, rely entirely on txq scheduling
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-25 19:54:16 +01:00
Felix Fietkau 5cd805ddfb mt76: add more conditions for stopping tx scheduling
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-25 05:42:40 +01:00
Felix Fietkau 066cc441eb mt76: attempt to free up more room when filling the tx queue
Run dma cleanup immediately if the queue is almost full, instead of waiting
for the tx interrupt

Signed-off-by: Felix Fietkau <[email protected]>
2020-11-21 18:23:36 +01:00
Felix Fietkau e361b6a71e mt76: improve tx queue stop/wake
Instead of stopping and waking only a single queue, handle all phy tx queues
mapped ot the same hardware queue.
Also allow the driver to block tx queues

Signed-off-by: Felix Fietkau <[email protected]>
2020-11-21 15:58:52 +01:00
Lorenzo BianconiandFelix Fietkau 2e217fb9e9 mt76: move tx hw data queues in mt76_phy
Move hw data queues in mt76_phy from mt76_dev since mt7915 supports per
phy hw queues in dbdc mode

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-12 14:59:29 +01:00
Lorenzo BianconiandFelix Fietkau 0f9350bef1 mt76: rely on mt76_queue in tx_queue_skb signature
Rely on mt76_queue instead of qid in tx_queue_skb signature.
This is a preliminary patch to move data queues in mt76_phy and add
dbdc support to mt7915 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-12 14:59:29 +01:00
Lorenzo BianconiandFelix Fietkau fdf14d1b6a mt76: move pad estimation out of mt76_skb_adjust_pad
Move frame pad computation out of mt76_skb_adjust_pad routine.
This is a preliminary patch to introduce sdio tx aggregation.

Tested-by: Sean Wang <[email protected]>
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-09-08 23:44:29 +02:00
Felix Fietkau 115b62efac mt76: remove retry_q from struct mt76_txq and related code
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 <[email protected]>
2020-09-04 19:31:36 +02:00
Felix Fietkau 5f080033ec mt76: move txwi handling code to dma.c, since it is mmio specific
This way we can make some functions static

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-04 19:31:36 +02:00
Felix Fietkau 15391c1c94 mt76: fix tx hang on non-AQL frame limit
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-27 15:16:25 +02:00
Felix Fietkau 3218b914a2 mt76: remove struct mt76_sw_queue
All members except for the struct mt76_queue pointer have been removed

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-24 20:59:30 +02:00
Felix Fietkau e861cb0518 mt76: rely on AQL for burst size limits on tx queueing
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 <[email protected]>
2020-08-24 20:59:30 +02:00
Felix Fietkau 780cdabb86 mt76: remove qid argument to drv->tx_complete_skb
It is not needed

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-24 20:59:30 +02:00
Felix Fietkau 3c2cd85803 mt76: unify queue tx cleanup code
Cleanup and preparation for changing tx scheduling behavior

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-24 20:59:30 +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 3a3306e408 mt76: mt7915: add 802.11 encap offload support
It is currently limited to 3-address mode AP and STA interfaces

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 15:56:57 +02:00
Felix Fietkau 9816f9812a mt76: move mt76_check_agg_ssn to driver tx_prepare calls
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 <[email protected]>
2020-08-11 12:13:34 +02:00
Lorenzo BianconiandFelix Fietkau 5c42061ce1 mt76: do not inject packets if MT76_STATE_PM is set
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 <[email protected]>
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:33:02 +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
Felix Fietkau 3a1ea7287e mt76: add API for testmode support
This can be used for calibration in the manufacturing process.
It supports sending a configurable number of packets with a specific rate
and configurable tx power levels / antenna settings.
It also supports receiving packets and showing some statistics, including
packet counters and detailed RSSI information.
It will only be compiled in if CONFIG_NL80211_TESTMODE is enabled

Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 21:31:02 +02:00
Lorenzo BianconiandFelix Fietkau 4058595e14 mt76: overwrite qid for non-bufferable mgmt frames
Overwrite hw queue id for non-bufferable management frames if the hw
support always txq (altxq) in order to be in sync with mac txwi code

Fixes: cdad4874057d ("mt76: mt7615: add dma and tx queue initialization for MT7622")
Fixes: f40ac0f3d3c0 ("mt76: mt7615: introduce mt7663e support")
Suggested-by: Felix Fietkau <[email protected]>
Tested-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-06-07 17:01:19 +02:00
Jules IrengeandFelix Fietkau 5822911f80 mt76: remove unnecessary annotations
Sparse report warnings at mt76_tx_status_unlock() and mt76_tx_status_lock()

warning: context imbalance in mt76_tx_status_lock() - wrong count at exit
warning: context imbalance in mt76_tx_status_unlock() - unexpected unlock

The root cause is the additional __acquire(&dev->status_list.lock)
and __release(&dev->status_list.unlock) called
 from inside mt76_tx_status_lock() and mt76_tx_status_unlock().

Remove __acquire(&dev->status_list.lock) annotation
Remove __releases(&dev->status_list.unlock)
Correct &dev->status_list.unlock to &dev->status_list.lock
	-unlock not defined in the sk_buff_head struct

Signed-off-by: Jules Irenge <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-17 14:46:00 +02:00
Felix Fietkau a3e88bcf17 mt76: move state from struct mt76_dev to mt76_phy
Allows keeping per-wiphy state separate

Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:54:55 +01:00
Felix Fietkau 1d80118714 mt76: add support for an extra wiphy in the tx status path
This is preparation for supporting multiple wiphys per device to support the
concurrent dual-band feature of MT7615D

Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:54:17 +01:00
Felix Fietkau c5f1e83e30 mt76: add support for an extra wiphy in the main tx path
This is preparation for supporting multiple wiphys per device to support the
concurrent dual-band feature of MT7615D

Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:54:17 +01:00
Lorenzo BianconiandFelix Fietkau 0308d75f28 mt76: remove empty flag in mt76_txq_schedule_list
Remove empty flag in mt76_txq_schedule_list and mt76_txq_send_burst
since we just need retry_q length to notify mac80211 to reschedule the
current tx queue

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-09-26 12:04:20 +02:00
Felix Fietkau 2a0edbb447 mt76: remove offchannel check in tx scheduling
tx queues are already disabled by mac80211 during scanning or other
off-channel activity. There is no need to repeat the check in mt76,
since scheduled queues are selected by mac80211 as well.

Signed-off-by: Balakrishna Bandi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-22 10:08:56 +02:00
Ryder LeeandFelix Fietkau 37673a4181 mt76: fix some checkpatch warnings
This fixes the following checkpatch warnings:
CHECK: Alignment should match open parenthesis
CHECK: No space is necessary after a cast

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-22 09:26:30 +02:00
Lorenzo BianconiandFelix Fietkau af860c0dec mt76: move mt76_tx_tasklet in mt76 module
Move mt76{15,03}_tx_tasklet in mt76_alloc_device in order to be used as
default tx_tasklet initialization. Remove duplicated code in
mt7603/mt7615 drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-21 13:02:33 +02:00
Ryder LeeandFelix Fietkau f625afcedc mt76: switch to SPDX tag instead of verbose boilerplate text
No functional change intended.

Add SPDX identifiers to all remaining files in /mt76.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-20 15:22:20 +02:00
Lorenzo BianconiandFelix Fietkau c47a5685d0 mt76: dma: introduce skb field in mt76_txwi_cache
Introduce skb field in mt76_txwi_cache. Moreover add txwi_flags
to mt76_driver_ops since new chipsets will release mt76_txwi_cache/skbs
at tx completion instead of dma one.
This is a preliminary patch to add mt7615 support

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-04-25 12:04:34 +02:00
Lorenzo BianconiandFelix Fietkau 3e371ca35c mt76: set txwi_size according to the driver value
Dynamically allocate txwi since new chipsets will use longer txwi
descriptors

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-04-25 12:04:34 +02:00
Felix Fietkau e7bd802cf7 mt76: adjust for mac80211 txq scheduling API changes
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-19 10:09:15 +01:00
Felix Fietkau 688d708a43 mt76: only schedule txqs from the tx tasklet
Reduces lock contention from the tx path and improves performance

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-14 22:37:30 +01:00
Felix Fietkau c0ab515474 mt76: store wcid tx rate info in one u32 reduce locking
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-14 22:37:30 +01:00
Felix Fietkau 72fe286f2d mt76: use mac80211 txq scheduling
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-14 22:37:30 +01:00
Lorenzo BianconiandFelix Fietkau 2dc63b0da0 mt76: introduce mt76_txq_id field in mt76_queue_entry
Add mt76_txq_id field to mt76_queue_entry in order to properly
track outstanding frames for mt7615 that relies on a single hw queue

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-13 12:53:23 +01:00
Lorenzo BianconiandFelix Fietkau 06c917faeb mt76: introduce mt76_sw_queue data structure
Introduce mt76_sw_queue data structure in order to support new
chipsets (e.g. mt7615) that have a shared hardware queue for all traffic
identifiers. mt76_sw_queue will be used to track outstanding packets

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-13 12:53:23 +01:00
Lorenzo BianconiandFelix Fietkau e97a209226 mt76: remove mt76_queue dependency from tx_queue_skb function pointer
Remove mt76_queue dependency from tx_queue_skb function pointer and
rely on mt76_tx_qid instead. This is a preliminary patch to introduce
mt76_sw_queue support

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-12 16:58:06 +01:00
Felix Fietkau 42ab27e54a mt76: when releasing PS frames, end the service period if no frame was found
Fixes a rare corner case if the txq dequeue attempt fails, but mac80211
still has PS buffered packets

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-03 19:21:42 +01:00
Felix Fietkau 2c62d03d69 mt76x02: clear running flag when resetting state on restart
Use it to avoid unsafe calls to mt76_wake_tx_queue

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-01 14:51:48 +01:00
Lorenzo BianconiandFelix Fietkau b216d3ca4e mt76: introduce q->stopped parameter
Introduce mt76_queue stopped parameter in order to run
ieee80211_wake_queue only when mac80211 queues have been
previously stopped and avoid to disable interrupts when
it is not necessary

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-01 13:00:31 +01:00
Felix Fietkau b4ee01f95c mt76: fix tx status timeout processing
Remove bogus check for MT_PACKET_ID_NO_ACK in mt76_tx_status_skb_get, which
is already handled in callers and turns timeout calls into no-ops
Do not clean up pending status items on reordering of tx status information
if the timeout is not reached yet

Signed-off-by: Felix Fietkau <[email protected]>
2019-01-25 15:22:41 +01:00
Felix Fietkau 1c751f391f mt76: avoid scheduling tx queues for powersave stations
Signed-off-by: Felix Fietkau <[email protected]>
2019-01-21 17:33:38 +01:00
Felix Fietkau f84b008222 mt76: fix tx status reporting for non-probing frames
On MT76x2, the hardware does not report tx status in the FIFO register,
if the packet id is 0.
Change the allocation of packet IDs to use 0 for no-ack packets, 1 for
non-probing packets and 2-255 for packets with tx status requested.
Fixes rate control issues

Signed-off-by: Felix Fietkau <[email protected]>
2019-01-11 15:24:32 +01:00
Lorenzo BianconiandFelix Fietkau fa7335bbe3 mt76: fix potential NULL pointer dereference in mt76_stop_tx_queues
Starting from mac80211 commit adf8ed01e4fd ("mac80211: add an optional
TXQ for other PS-buffered frames") and commit 0eeb2b674f05 ("mac80211:
add an option for station management TXQ") a new per-sta queue has been
introduced for bufferable management frames.
sta->txq[IEEE80211_NUM_TIDS] is initialized just if the driver reports
the following hw flags:
- IEEE80211_HW_STA_MMPDU_TXQ
- IEEE80211_HW_BUFF_MMPDU_TXQ
This can produce a NULL pointer dereference in mt76_stop_tx_queues
since mt76 iterates on all available sta tx queues assuming they are
initialized by mac80211. This issue has been spotted analyzing the code
(it has not triggered any crash yet)

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-17 18:15:00 +01:00