Commit Graph
85 Commits
Author SHA1 Message Date
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
Felix Fietkau 83a80cabbd mt76: request tx status for powersave released EOSP packet
Allows mac80211 to keep track of the service period

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-13 20:54:19 +01:00
Felix Fietkau 67458301fd mt76: fix race condition in station removal
If there are still pending packets in the tx queue when removing a station,
it could possibly lead to a call to further attempts to pull packets from
the mac80211 tx queue after it has already been removed from the scheduling
list.
Prevent this from happening by calling synchronize_rcu after deleting the
wcid pointer before further cleaning up the tx queues.
To be extra careful, ensure that mtxq->list is always initialized properly.

Also drop the useless call to mt76x02_mac_wcid_setup, which only re-assigns
the bss index of the wcid entry, but does not help with the cleanup in any
way.

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-13 11:30:00 +01:00
Felix Fietkau ef06c3074f mt76: avoid queue/status spinlocks while passing tx status to mac80211
There is some code in the mac80211 tx status processing code that could
potentially call back into the tx codepath.
To avoid deadlocks, make sure that no tx related spinlocks are taken
during the ieee80211_tx_status call.

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-05 21:11:42 +01:00
Felix Fietkau fdc63f168e mt76: fix regression in tx status handling
Tx status reporting needs to work on non-STA WCID entries as well

Signed-off-by: Felix Fietkau <[email protected]>
2018-10-27 17:36:53 +02:00
Felix Fietkau 9d59d2a53f mt76: add support for reporting tx status with skb
MT76x2/MT76x0 has somewhat unreliable tx status reporting, and for that
reason the driver currently does not report per-skb tx ack status at all.
This breaks things like client idle polling, which relies on the tx ack
status of a transmitted nullfunc frame.

This patch adds code to report skb-attached tx status if requested by
mac80211 or the rate control module. Since tx status is polled from a
simple FIFO register, the code needs to account for the possibility of
tx status events getting lost.

The code keeps a list of skbs for which tx status is required and passes
them to mac80211 once tx status has been filled in and the DMA queue is
done with it.
If a tx status event is not received after one second, the status rates
are cleared, and a succesful ACK is indicated to avoid spurious disassoc
during assoc or client polling.

Signed-off-by: Felix Fietkau <[email protected]>
2018-10-25 18:27:55 +02:00
Felix Fietkau 96fa353e79 mt76: do not store aggregation sequence number for null-data frames
Fixes a rare corner case where a BlockAckReq might get the wrong
sequence number.

Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:46:42 +02:00
Felix Fietkau 7464cc9710 mt76: check aggregation sequence number for frames sent via drv_tx
ps-poll response frames can be sent via drv_tx. Store the frame sequence number
for such frames, in case a BlockAckReq needs to be sent

Signed-off-by: Felix Fietkau <[email protected]>
2018-09-29 13:15:33 +02:00
Stanislaw GruszkaandFelix Fietkau a69033307e mt76: unify AC to hw queue mapping
Use the same AC to hardware queue mappings for all subdrivers.
Note: this change BK and BE mappings for USB drivers.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau 66f394984d mt76: introduce tx_queue_skb function pointer in mt76_bus_ops
Add tx_queue_skb function pointer in mt76_bus_ops since mt76x2u based
devices do not map mt76x2_txwi on dma buffers and it is not possible
to reuse mt76_dma_tx_queue_skb() routine to enqueue tx frames to
hw buffers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau 7ac6dac9a3 mt76: rename mt76_tx_queue_skb in mt76_dma_tx_queue_skb
Move mt76_dma_tx_queue_skb routine in dma.c.
Remove static qualifier from mt76_get_txwi definition

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Felix Fietkau 0ef26ef052 mt76: only stop tx queues on offchannel, not during the entire scan
During scans, mac80211 frequently switches back to the home channel to
minimize interruption of ongoing traffic. Keep regular tx queues active
during that time.

Signed-off-by: Felix Fietkau <[email protected]>
2018-05-20 07:57:25 +02:00
Felix Fietkau 2d08440e90 mt76: add rcu locking around tx scheduling
Fixes a reported lockdep error in mac80211:

[  179.867321] =============================
[  179.871510] WARNING: suspicious RCU usage
[  179.875528] 4.14.32 #0 Not tainted
[  179.878924] -----------------------------
[  179.882981] backports-2017-11-01/net/mac80211/tx.c:594 suspicious rcu_dereference_check() usage!
[  179.891785]
[  179.891785] other info that might help us debug this:
[  179.891785]
[  179.899824]
[  179.899824] rcu_scheduler_active = 2, debug_locks = 1
[  179.906343] 2 locks held by ksoftirqd/0/7:
[  179.910479]  #0:  (&(&q->lock)->rlock){+.-.}, at: [<86b207a4>] mt76_dma_tx_cleanup+0x64/0x354 [mt76]
[  179.919734]  #1:  (&(&fq->lock)->rlock){+.-.}, at: [<87238410>] ieee80211_tx_dequeue+0x54/0xc3c [mac80211]
[  179.929890]
[  179.929890] stack backtrace:
[  179.934257] CPU: 0 PID: 7 Comm: ksoftirqd/0 Not tainted 4.14.32 #0
[  179.940421] Stack : 00000000 00000000 00000000 00000000 80e0fce2 00000036 00000000 00000000
[  179.948864]         87c3d24c 80696377 8061039c 00000000 00000007 00000001 87c5db78 6534689d
[  179.957306]         00000000 00000000 80e10000 87c5da74 00000001 0000015a 00000007 00000000
[  179.965748]         00000000 806a0000 000e4171 00000000 00000000 00000000 ffffffff 00000001
[  179.974189]         806c0000 8692b240 86b000d0 87316fe4 00000001 802c9a68 00000000 80700000
[  179.982632]         ...
[  179.985104] Call Trace:
[  179.987582] [<80010a48>] show_stack+0x58/0x100
[  179.992040] [<804c2c58>] dump_stack+0xe8/0x170
[  179.996868] [<87234a04>] ieee80211_tx_h_select_key+0xa8/0x5b8 [mac80211]
[  180.004299] [<87238d44>] ieee80211_tx_dequeue+0x988/0xc3c [mac80211]
[  180.011048] [<86b230dc>] mt76_txq_schedule+0x110/0x3a4 [mt76]
[  180.016821] [<86b209d0>] mt76_dma_tx_cleanup+0x290/0x354 [mt76]
[  180.022777] [<86be2e60>] mt7603_tx_tasklet+0x40/0x6c [mt7603e]
[  180.028637] [<80037058>] tasklet_action+0x110/0x1ec
[  180.033532] [<804e1dac>] __do_softirq+0x164/0x35c
[  180.038235] [<80037174>] run_ksoftirqd+0x40/0x84
[  180.042870] [<800580c8>] smpboot_thread_fn+0x1a8/0x1d8
[  180.048023] [<800542e8>] kthread+0x130/0x144
[  180.052297] [<8000b1f8>] ret_from_kernel_thread+0x14/0x1c

Signed-off-by: Felix Fietkau <[email protected]>
2018-04-15 19:36:13 +02:00
Felix Fietkau 7a31731af2 mt76: check for pending reset before attempting to schedule tx
The check within mt76_txq_send_burst is not enough, as it happens after
a first frame has already been queued up

Signed-off-by: Felix Fietkau <[email protected]>
2018-04-13 11:47:45 +02:00
Rosen PenevandFelix Fietkau e7647871da Fix errors found by cppcheck
Mismatching declarations as well as unused results.

Signed-off-by: Rosen Penev <[email protected]>
2017-10-27 12:15:53 +02:00
Lorenzo BianconiandFelix Fietkau 3c4c9a647e tx: move state check in mt76_txq_send_burst()
Move device state check in mt76_txq_send_burst() in order to be more
reactive in stopping tx process during hw reset

Signed-off-by: Lorenzo Bianconi <[email protected]>
2017-07-17 10:22:05 +02:00
Lorenzo BianconiandFelix Fietkau 70d225123f tx: fix AGGR burst length estimation
Use tx_info reference of last dequeued frame instead of the previous one
to compute 802.11 aggregate burst length

Signed-off-by: Lorenzo Bianconi <[email protected]>
2017-06-16 15:27:34 +02:00
Felix Fietkau b18d66f749 core: fix checkpatch errors
Signed-off-by: Felix Fietkau <[email protected]>
2016-09-05 11:12:19 +02:00
Felix Fietkau 53c1b7f6ac update my email address
Signed-off-by: Felix Fietkau <[email protected]>
2016-09-04 17:33:28 +02:00
Felix Fietkau ced81a3458 relicense to ISC (except for util.h which is based on GPL'd kernel code
Signed-off-by: Felix Fietkau <[email protected]>
2016-07-12 08:38:46 +02:00
Daniel GolleandFelix Fietkau 9226e96c40 tx: remove spurious semicolon
Remove spurious semicolon resulting in ieee80211_sta_set_buffered()
being always called independent from the result of the expression
evaluated by the preceding if-clause.

Spotted by gcc-6 while attempting to build the driver outside of the
buildroot.

Signed-off-by: Daniel Golle <[email protected]>
2016-07-08 10:20:53 +02:00
Felix Fietkau 9ecf04c4d7 tx: fix locking error pointed out by dnnn88
Signed-off-by: Felix Fietkau <[email protected]>
2016-04-12 11:52:43 +02:00
Felix Fietkau 101dacba43 tx: always leave one descriptor free in the dma ring to avoid getting the queue stuck
Signed-off-by: Felix Fietkau <[email protected]>
2016-03-04 12:40:20 +01:00
Felix Fietkau 4554e8a23d tx: add missing locking in mt76_txq_schedule_all
Signed-off-by: Felix Fietkau <[email protected]>
2016-03-04 12:40:20 +01:00
Felix Fietkau 7e9d52f998 tx: add missing locking in mt76_release_buffered_frames
Signed-off-by: Felix Fietkau <[email protected]>
2016-03-04 12:40:20 +01:00