Commit Graph
77 Commits
Author SHA1 Message Date
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
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
Lorenzo BianconiandFelix Fietkau 283ebbefde mt76: dma: move mt76x02_init_{tx,rx}_queue in mt76 module
Move mt76x02_init_tx_queue and mt76x02_init_rx_queue in mt76
module in order to be reused adding support for mt7603 driver
and remove duplicated code.
Squash mt76x02_init_tx_queue and mt76x02_init_rx_queue in
mt76_dma_alloc_queue

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-01 13:00:31 +01:00
Felix Fietkau 3c6df9b75c mt76: rewrite dma descriptor base and ring size on queue reset
Useful in case the hardware reset clobbers these values

Signed-off-by: Felix Fietkau <[email protected]>
2019-02-27 19:38:30 +01:00
Ryder LeeandFelix Fietkau 6aacd1e346 mt76: change the return type of mt76_dma_attach()
There is no need to retun 0 in mt76_dma_attach(), so switch it to void.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-02-18 20:39:41 +01:00
Lorenzo BianconiandFelix Fietkau 0e8e53f6ad mt76: remove add_buf pointer in mt76_queue_ops
Remove add_buf function pointer in mt76_queue_ops data structure since
it is no longer used

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-02-07 14:48:44 +01:00
Lorenzo BianconiandFelix Fietkau 91d04558f0 mt76: move mt76_dma_tx_queue_skb_raw in mt76-core module
Move mt76_dma_tx_queue_skb_raw routine in dma.c and add the
corresponding entry in mt76_queue_ops data structure.
mt76_dma_tx_queue_skb_raw  will be reused adding support for
mt7603 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-02-07 14:48:44 +01:00
Lorenzo BianconiandFelix Fietkau 7d4a95c8dd mt76: dma: avoid indirect call in mt76_dma_tx_queue_skb
Call mt76_dma_add_buf routine directly in mt76_dma_tx_queue_skb
and avoid indirect call if not necessary

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-12-31 15:45:10 +01:00
Lorenzo BianconiandFelix Fietkau c78e317701 mt76: dma: do not build skb if reported len does not fit in buf_size
Precompute data length in order to avoid to allocate the related
skb data structure if reported length does not fit in queue buf_size

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 16:15:53 +01:00
Lorenzo BianconiandFelix Fietkau e67e551496 mt76: dma: remove napi from mt76_dma_rx_fill signature
Remove napi from mt76_dma_rx_fill routine signature since
it is a leftover of a previous implementation and it is no
longer used

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Felix Fietkau ffccb48c50 mt76: do not wake tx queues during flush
While the queue is being cleaned up, the stack must not attempt to add
any extra packets

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-09 13:44:02 +01:00
Felix Fietkau 8b7f50d236 mt76: add size check for additional rx fragments
So far the code only validates the buffer size of the first skb.
Extend this check to cover additional fragments as well, in case the size
is corrupted during a DMA reset.

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-06 12:29:46 +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 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 39a380a06c mt76: use a per rx queue page fragment cache
Using the NAPI or netdev frag cache along with other drivers can lead to
32 KiB pages being held for a long time, despite only being used for
very few page fragments.

This can happen if the driver grabs one or two fragments for rx ring
refill, while other drivers use (and free up) the remaining fragments.
The 32 KiB higher-order page can only be freed once all users have freed
their fragments.

Depending on the traffic patterns, this can waste a lot of memory and
look a lot like a memory leak.

Signed-off-by: Felix Fietkau <[email protected]>
2018-09-12 13:16:50 +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
Lorenzo BianconiandFelix Fietkau 730b86c73a mt76x2: add napi struct to mt76_rx_poll_complete/mt76_rx_complete signatures
in order to reuse mt76_rx_complete routine supporting mt76x2u based
devices add napi struct to mt76_rx_poll_complete and mt76_rx_complete
routine signatures and do not fetch it according to the rx queue index

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Felix Fietkau 8ba17b1825 Revert "mt76: use a per rx queue page fragment cache"
Will be added back after merging upstream changes

Signed-off-by: Felix Fietkau <[email protected]>
2018-09-11 13:49:15 +02:00
Felix Fietkau 08719b1129 mt76: use a per rx queue page fragment cache
Using the NAPI or netdev frag cache along with other drivers can lead to
32 KiB pages being held for a long time, despite only being used for
very few page fragments.

This can happen if the driver grabs one or two fragments for rx ring
refill, while other drivers use (and free up) the remaining fragments.
The 32 KiB higher-order page can only be freed once all users have freed
their fragments.

Depending on the traffic patterns, this can waste a lot of memory and
look a lot like a memory leak.

Signed-off-by: Felix Fietkau <[email protected]>
2018-07-13 16:28:41 +02:00
Felix Fietkau 730c292a2c mt76: wait for pending tx to complete before switching channel
Reduces interruption caused by scanning

Signed-off-by: Felix Fietkau <[email protected]>
2018-05-20 07:57:25 +02:00
Felix Fietkau cf3cfc43af mt76: split mt76_rx_complete
Add a separate function for processing frames after A-MPDU reordering,
reduce code duplication

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-22 10:43:22 +01:00
Felix Fietkau 58a41f17aa mt76: get station pointer by wcid and pass it to mac80211
Avoids the rhashtable lookup based on the MAC address inside mac80211

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-22 10:14:25 +01:00
Felix Fietkau 34d612d9ed mt76: retry rx polling as long as there is budget left
Sending frames to mac80211 needs time, which could allow for more rx
packets to end up in the DMA ring. Retry polling until there are no more
frames left. Improves rx latency under load.

Signed-off-by: Felix Fietkau <[email protected]>
2018-01-18 19:34:45 +01:00
Felix Fietkau b056a78fd7 dma: fix endian issue in mt76_dma_get_buf
Signed-off-by: Felix Fietkau <[email protected]>
2017-02-27 09:44:20 +01: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 b300bdc42e use the new bitfield accessor macros
Signed-off-by: Felix Fietkau <[email protected]>
2016-09-04 17:37:26 +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
Felix Fietkau 6355f35431 move tx queue wake to common code outside of locked section, fixes queue wake on mt7603
Signed-off-by: Felix Fietkau <[email protected]>
2016-03-03 15:57:39 +01:00
Felix Fietkau a957f7480e dma: add function for resetting the state of an rx queue
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-28 21:14:48 +01:00
Felix Fietkau fb818ab727 dma: write cpu index after queue flush, useful for hardware resets
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-28 21:14:48 +01:00
Felix Fietkau f8b61c27d3 dma: fix tx ring flush
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-27 18:30:58 +01:00
Felix Fietkau 9779a98658 let mt76_queue_tx_cleanup take a queue id instead of a pointer
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-25 21:13:30 +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 2bd92acfa2 dma: optimize icache footprint of rx path, batch frames before passing them to mac80211
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-08 17:35:40 +01:00
Felix Fietkau 9abb4b1754 dma: respect buffer offset for fragments
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-08 14:10:04 +01:00
Felix Fietkau fa3ee92842 unify tx completion handling, allow a driver callback to clean up tx skbs
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-06 16:14:02 +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 a6d7949f67 move rx polling to core
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-03 15:51:17 +01:00
Felix Fietkau 6b80f6c8dd pass queue index instead of pointer to rx_skb callback
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-03 15:10:33 +01:00
Felix Fietkau 6678c47893 remove dequeue op
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-03 14:59:50 +01:00
Felix Fietkau 41f973373e remove rx_fill op
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-03 14:58:35 +01:00
Felix Fietkau 812bcc3a78 mt76x2: move rx queue processing to core
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-03 14:51:07 +01:00
Felix Fietkau 859aa10d4d move initial rx queue fill to a new queue init function
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-03 14:37:09 +01:00
Felix Fietkau 03ec61db8e remove rx_cleanup queue op
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-03 14:24:07 +01:00
Felix Fietkau fc646f34e0 rename mt76_dma_init to mt76_dma_attach
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-03 14:19:12 +01:00
Felix Fietkau 92367b3bb9 move dma cleanup to core
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-03 14:17:17 +01:00
Felix Fietkau 1b5492bd23 dma: tell the driver if the buffer was the last one
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-01 21:50:08 +01:00
Felix Fietkau 0bbfb5653f move dma rx cleanup to core
Signed-off-by: Felix Fietkau <[email protected]>
2016-01-28 20:35:26 +01:00