blob: ef367928e339b01234d97583556bf3e38b1178e5 [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From 6d6ae068e478b101556ae723c23533220a8daeb5 Mon Sep 17 00:00:00 2001
developer3609d782022-11-29 18:07:22 +08002From: Sujuan Chen <sujuan.chen@mediatek.com>
3Date: Fri, 25 Nov 2022 14:32:35 +0800
developera20cdc22024-05-31 18:57:31 +08004Subject: [PATCH 2003/2015] wifi: mt76: mt7915: wed: find rx token by physical
developer4eb49d92022-12-05 11:29:56 +08005 address
developer3609d782022-11-29 18:07:22 +08006
7The token id in RxDMAD may be incorrect when it is not the last frame due to
8WED HW bug. Lookup correct token id by physical address in sdp0.
9
developer57c8f1a2022-12-15 14:09:45 +080010Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
developer3609d782022-11-29 18:07:22 +080011---
developerbb6ddff2023-03-08 17:22:32 +080012 dma.c | 25 ++++++++++++++++++++++++-
13 1 file changed, 24 insertions(+), 1 deletion(-)
developer3609d782022-11-29 18:07:22 +080014
15diff --git a/dma.c b/dma.c
developer05f3b2b2024-08-19 19:17:34 +080016index 100d2aff..185c6f12 100644
developer3609d782022-11-29 18:07:22 +080017--- a/dma.c
18+++ b/dma.c
developer753619c2024-02-22 13:42:45 +080019@@ -444,9 +444,32 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
developer1a173672023-12-21 14:49:33 +080020 mt76_dma_should_drop_buf(drop, ctrl, buf1, desc_info);
developer3609d782022-11-29 18:07:22 +080021
developer60a3d662023-02-07 15:24:34 +080022 if (mt76_queue_is_wed_rx(q)) {
developer3609d782022-11-29 18:07:22 +080023+ u32 id, find = 0;
developerbb6ddff2023-03-08 17:22:32 +080024 u32 token = FIELD_GET(MT_DMA_CTL_TOKEN, buf1);
developer3609d782022-11-29 18:07:22 +080025- struct mt76_txwi_cache *t = mt76_rx_token_release(dev, token);
26+ struct mt76_txwi_cache *t;
developer765f1892023-01-30 14:02:51 +080027+
developer3609d782022-11-29 18:07:22 +080028+ if (*more) {
29+ spin_lock_bh(&dev->rx_token_lock);
30+
31+ idr_for_each_entry(&dev->rx_token, t, id) {
32+ if (t->dma_addr == le32_to_cpu(desc->buf0)) {
33+ find = 1;
developer3609d782022-11-29 18:07:22 +080034+ token = id;
developer60a3d662023-02-07 15:24:34 +080035+
36+ /* Write correct id back to DMA*/
developerbb6ddff2023-03-08 17:22:32 +080037+ u32p_replace_bits(&buf1, id,
38+ MT_DMA_CTL_TOKEN);
39+ WRITE_ONCE(desc->buf1, cpu_to_le32(buf1));
developer3609d782022-11-29 18:07:22 +080040+ break;
41+ }
42+ }
43+
44+ spin_unlock_bh(&dev->rx_token_lock);
45+ if (!find)
46+ return NULL;
47+ }
developer765f1892023-01-30 14:02:51 +080048
developer3609d782022-11-29 18:07:22 +080049+ t = mt76_rx_token_release(dev, token);
50 if (!t)
51 return NULL;
52
53--
developerbd9fa1e2023-10-16 11:04:00 +0800542.18.0
developer3609d782022-11-29 18:07:22 +080055