blob: a2523988d49bb5a7fddd2147bb6b1ea7dea6a7d3 [file] [log] [blame]
From 82335286ec2a9d33c9638c30e7638035f431e116 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Tue, 27 Sep 2022 16:34:26 +0800
Subject: [PATCH 3009/3010] mt76: mt7915: find rx token by physical address
The token id in RxDMAD may be incorrect when it is not the last frame due to
WED HW bug. Lookup correct token id by physical address in sdp0.
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
dma.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/dma.c b/dma.c
index fa56ccf..c551369 100644
--- a/dma.c
+++ b/dma.c
@@ -380,11 +380,28 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
type = FIELD_GET(MT_QFLAG_WED_TYPE, q->flags);
if (mtk_wed_device_active(wed) && type == MT76_WED_Q_RX) {
- u32 token;
+ u32 token, id, find = 0;
struct mt76_txwi_cache *r;
token = FIELD_GET(MT_DMA_CTL_TOKEN, desc->buf1);
+ if (*more) {
+ spin_lock_bh(&dev->rx_token_lock);
+
+ idr_for_each_entry(&dev->rx_token, r, id) {
+ if (r->dma_addr == le32_to_cpu(desc->buf0)) {
+ find = 1;
+ desc->buf1 = FIELD_PREP(MT_DMA_CTL_TOKEN, id);
+ token = id;
+ break;
+ }
+ }
+
+ spin_unlock_bh(&dev->rx_token_lock);
+ if (!find)
+ return NULL;
+
+ }
r = mt76_rx_token_release(dev, token);
if (!r)
return NULL;
--
2.18.0