Commit Graph
56 Commits
Author SHA1 Message Date
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
Felix Fietkau 675868d4e8 mt7603: opt out of the tx BAR refresh at wakeup time
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-28 22:02:21 +01:00
Felix Fietkau 06619cd877 fix freeing frames on tx
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-28 10:47:27 +01:00
Felix Fietkau d1610c641c mt7603: add code to recover from MAC/DMA hangs
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-27 19:47:00 +01:00
Felix Fietkau 2cfb50f84d mt7603: pass the correct hardware queue index to the tx header
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-25 21:29:15 +01:00
Felix Fietkau 079ad90fe2 update copyright lines
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-25 18:09:13 +01:00
Felix Fietkau d7f5fea7e6 tx: fix frame queueing in mt76_release_buffered_frames
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-18 20:35:03 +01:00
Felix Fietkau 2dfb9faa78 add support for queueing frames spanning multiple descriptors
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-05 01:15:35 +01:00
Felix Fietkau b08f5433d1 tx: move dma mapping code to core, unify tx callbacks into one that prepares tx_info, skb and txwi
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-03 20:14:53 +01:00
Felix Fietkau 2c2fa07e98 suspend txq scheduling during scanning
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-03 16:10:54 +01:00
Felix Fietkau 1389db799a move txwi cache to core
Signed-off-by: Felix Fietkau <[email protected]>
2015-12-17 15:50:01 +01:00
Felix Fietkau 5a2e904bbd move more tx code to common
Signed-off-by: Felix Fietkau <[email protected]>
2015-12-16 19:11:16 +01:00
Felix Fietkau 43d5b84989 move tx scheduling code to common
Signed-off-by: Felix Fietkau <[email protected]>
2015-12-16 19:04:06 +01:00
Felix Fietkau a0ee20716f add a mt76x2_ prefix to all files
Signed-off-by: Felix Fietkau <[email protected]>
2015-12-06 16:54:53 +01:00
Felix Fietkau 31c11fdb05 replace mt76 prefix with mt76x2 in preparation for splitting the driver for more chipset support
Signed-off-by: Felix Fietkau <[email protected]>
2015-12-06 16:54:53 +01:00
Felix Fietkau 2f31d1e329 tx: check for an empty txq list in mt76_txq_schedule_list
Signed-off-by: Felix Fietkau <[email protected]>
2015-10-12 14:33:57 +02:00
Felix Fietkau 4e356ab590 tx: get txq fields inside the locked section before calling ieee80211_send_bar
Signed-off-by: Felix Fietkau <[email protected]>
2015-10-12 14:31:50 +02:00
Felix Fietkau f0573e15b4 tx: free txq skbs without holding the hw queue lock
Signed-off-by: Felix Fietkau <[email protected]>
2015-10-12 14:26:11 +02:00
Felix Fietkau 35c24b4db0 tx: restart schedule after sending a BAR, fixes an unlikely race condition
Signed-off-by: Felix Fietkau <[email protected]>
2015-10-12 14:22:27 +02:00
Felix Fietkau 0169cab3e4 tx: only set txq->send_bar if aggregation is active
Signed-off-by: Felix Fietkau <[email protected]>
2015-10-05 17:43:10 +02:00
Felix Fietkau a621df3111 tx: add extra sanity check for qos-data before recording agg_ssn
Signed-off-by: Felix Fietkau <[email protected]>
2015-10-05 17:30:21 +02:00
Felix Fietkau d4900fc37f tx: store aggregation starting sequence number on first tx attempt, not on initial dequeue
Signed-off-by: Felix Fietkau <[email protected]>
2015-10-05 10:27:04 +02:00
Felix Fietkau f411f5bc5f tx: only send BAR on tx queue schedule if aggregation is active
Signed-off-by: Felix Fietkau <[email protected]>
2015-09-27 23:15:09 +02:00
Lorenzo BianconiandFelix Fietkau 0a47c463d2 tx: mt76_txq_schedule() optimization
Avoid to unnecessary call mt76_txq_schedule_list() if 4 (or more)
AGGR frames have been queued to the corresponding hw queue or
if the given hw queue is empty.
This patch let burst length to be more concentrated to max value
(i.e. 16) instead of 0

Signed-off-by: Lorenzo Bianconi <[email protected]>
2015-08-26 16:35:51 +02:00
Lorenzo BianconiandFelix Fietkau 319c0161ec tx: fix mt76_txq_schedule indentation
Signed-off-by: Lorenzo Bianconi <[email protected]>
2015-08-26 16:34:53 +02:00
Lorenzo BianconiandFelix Fietkau 1bce98e00d mt76: fix burst len estimation in mt76_txq_schedule_list()
Signed-off-by: Lorenzo Bianconi <[email protected]>
2015-08-06 15:19:44 +02:00
Felix Fietkau dbcda50b22 tx: purge frames from retry queue when removing a txq
Signed-off-by: Felix Fietkau <[email protected]>
2015-06-13 09:26:41 +02:00
Felix Fietkau bca9b7c3a3 tx: send BAR after a sta waking up from PS
Signed-off-by: Felix Fietkau <[email protected]>
2015-06-13 09:26:41 +02:00
Felix Fietkau 93550af391 tx: stop sta queues when going to sleep
Signed-off-by: Felix Fietkau <[email protected]>
2015-06-13 09:26:41 +02:00
Felix Fietkau 5a343275e9 tx: implement release_buffered_frames
Signed-off-by: Felix Fietkau <[email protected]>
2015-06-13 09:26:41 +02:00