blob: 7c2bb77b9651f06071541babf6b286cb0e88f011 [file] [log] [blame]
From 70c17335911119c353fdf709d8ce1688509c02d0 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/3011] 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 d63b02f5..a7a4538a 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