blob: bcdd37a73191af1c2491743fd895cf35e9985fce [file] [log] [blame]
developerf6ebf632023-01-06 19:15:00 +08001From 7c2e0d8a456963e4d5df268b7b28ae8a5d0d94d9 Mon Sep 17 00:00:00 2001
developer144824b2022-11-25 21:27:43 +08002From: Sujuan Chen <sujuan.chen@mediatek.com>
3Date: Fri, 25 Nov 2022 14:32:35 +0800
developerf6ebf632023-01-06 19:15:00 +08004Subject: [PATCH 3007/3014] mt76: mt7915: wed: find rx token by physical
developerbf24a8a2022-11-30 14:52:20 +08005 address
developer144824b2022-11-25 21:27:43 +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
developerafd75872022-12-14 21:15:46 +080010Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
developer144824b2022-11-25 21:27:43 +080011---
12 dma.c | 21 ++++++++++++++++++++-
13 1 file changed, 20 insertions(+), 1 deletion(-)
14
15diff --git a/dma.c b/dma.c
developerf6ebf632023-01-06 19:15:00 +080016index 5163a8e9..0dce97fb 100644
developer144824b2022-11-25 21:27:43 +080017--- a/dma.c
18+++ b/dma.c
developer28d04742023-01-18 14:02:40 +080019@@ -406,10 +406,29 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
developer144824b2022-11-25 21:27:43 +080020
21 if ((q->flags & MT_QFLAG_WED) &&
22 FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX) {
23+ u32 id, find = 0;
24 u32 token = FIELD_GET(MT_DMA_CTL_TOKEN,
25 le32_to_cpu(desc->buf1));
26- struct mt76_txwi_cache *t = mt76_rx_token_release(dev, token);
27+ struct mt76_txwi_cache *t;
developer28d04742023-01-18 14:02:40 +080028+
developer144824b2022-11-25 21:27:43 +080029+ if (*more) {
30+ spin_lock_bh(&dev->rx_token_lock);
31+
32+ idr_for_each_entry(&dev->rx_token, t, id) {
33+ if (t->dma_addr == le32_to_cpu(desc->buf0)) {
34+ find = 1;
35+ desc->buf1 = FIELD_PREP(MT_DMA_CTL_TOKEN, id);
36+ token = id;
37+ break;
38+ }
39+ }
40+
41+ spin_unlock_bh(&dev->rx_token_lock);
42+ if (!find)
43+ return NULL;
44+ }
developer28d04742023-01-18 14:02:40 +080045
developer144824b2022-11-25 21:27:43 +080046+ t = mt76_rx_token_release(dev, token);
47 if (!t)
48 return NULL;
49
50--
developerd75d3632023-01-05 14:31:01 +0800512.18.0
developer144824b2022-11-25 21:27:43 +080052