blob: a2523988d49bb5a7fddd2147bb6b1ea7dea6a7d3 [file] [log] [blame]
developerf1313102022-10-11 11:02:55 +08001From 82335286ec2a9d33c9638c30e7638035f431e116 Mon Sep 17 00:00:00 2001
developer36936c32022-09-30 12:55:06 +08002From: Peter Chiu <chui-hao.chiu@mediatek.com>
3Date: Tue, 27 Sep 2022 16:34:26 +0800
4Subject: [PATCH 3009/3010] mt76: mt7915: find rx token by physical address
5
6The token id in RxDMAD may be incorrect when it is not the last frame due to
7WED HW bug. Lookup correct token id by physical address in sdp0.
8
9Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
10---
11 dma.c | 19 ++++++++++++++++++-
12 1 file changed, 18 insertions(+), 1 deletion(-)
13
14diff --git a/dma.c b/dma.c
developerf1313102022-10-11 11:02:55 +080015index fa56ccf..c551369 100644
developer36936c32022-09-30 12:55:06 +080016--- a/dma.c
17+++ b/dma.c
18@@ -380,11 +380,28 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
developerf1313102022-10-11 11:02:55 +080019
developer36936c32022-09-30 12:55:06 +080020 type = FIELD_GET(MT_QFLAG_WED_TYPE, q->flags);
21 if (mtk_wed_device_active(wed) && type == MT76_WED_Q_RX) {
22- u32 token;
23+ u32 token, id, find = 0;
24 struct mt76_txwi_cache *r;
developerf1313102022-10-11 11:02:55 +080025
developer36936c32022-09-30 12:55:06 +080026 token = FIELD_GET(MT_DMA_CTL_TOKEN, desc->buf1);
developerf1313102022-10-11 11:02:55 +080027
developer36936c32022-09-30 12:55:06 +080028+ if (*more) {
29+ spin_lock_bh(&dev->rx_token_lock);
30+
31+ idr_for_each_entry(&dev->rx_token, r, id) {
32+ if (r->dma_addr == le32_to_cpu(desc->buf0)) {
33+ find = 1;
34+ desc->buf1 = FIELD_PREP(MT_DMA_CTL_TOKEN, id);
35+ token = id;
36+ break;
37+ }
38+ }
39+
40+ spin_unlock_bh(&dev->rx_token_lock);
41+ if (!find)
42+ return NULL;
43+
44+ }
45 r = mt76_rx_token_release(dev, token);
46 if (!r)
47 return NULL;
developerf1313102022-10-11 11:02:55 +080048--
developer36936c32022-09-30 12:55:06 +0800492.18.0
50