linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] mt76: set dma-done flag for flushed descriptors
@ 2020-01-27 18:17 Felix Fietkau
  2020-01-27 18:17 ` [PATCH 2/5] mt76: fix handling full tx queues in mt76_dma_tx_queue_skb_raw Felix Fietkau
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Felix Fietkau @ 2020-01-27 18:17 UTC (permalink / raw)
  To: linux-wireless

Avoids a theoretical corner case where the hardware could try to process
a stale descriptor after a watchdog reset

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/dma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index 9e03a7871ff4..e69329feed78 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -246,7 +246,9 @@ mt76_dma_dequeue(struct mt76_dev *dev, struct mt76_queue *q, bool flush,
 	if (!q->queued)
 		return NULL;
 
-	if (!flush && !(q->desc[idx].ctrl & cpu_to_le32(MT_DMA_CTL_DMA_DONE)))
+	if (flush)
+		q->desc[idx].ctrl |= cpu_to_le32(MT_DMA_CTL_DMA_DONE);
+	else if (!(q->desc[idx].ctrl & cpu_to_le32(MT_DMA_CTL_DMA_DONE)))
 		return NULL;
 
 	q->tail = (q->tail + 1) % q->ndesc;
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-02-20 17:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-27 18:17 [PATCH 1/5] mt76: set dma-done flag for flushed descriptors Felix Fietkau
2020-01-27 18:17 ` [PATCH 2/5] mt76: fix handling full tx queues in mt76_dma_tx_queue_skb_raw Felix Fietkau
2020-01-27 18:17 ` [PATCH 3/5] mt76: dma: do not write cpu_idx on rx queue reset until after refill Felix Fietkau
2020-01-27 18:17 ` [PATCH 4/5] mt76: mt7603: increase dma mcu rx ring size Felix Fietkau
2020-01-27 18:17 ` [PATCH 5/5] mt76: enable Airtime Queue Limit support Felix Fietkau
2020-02-01 12:58   ` Toke Høiland-Jørgensen
2020-02-19 16:50     ` Sebastian Gottschall
2020-02-19 22:23       ` Toke Høiland-Jørgensen
2020-02-20 17:20         ` Sebastian Gottschall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).