developer | 36936c3 | 2022-09-30 12:55:06 +0800 | [diff] [blame^] | 1 | From c72a8943ae9e7b97d9f67c066fe232eba920f517 Mon Sep 17 00:00:00 2001 |
| 2 | From: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 3 | Date: Tue, 27 Sep 2022 16:34:26 +0800 |
| 4 | Subject: [PATCH 3009/3010] mt76: mt7915: find rx token by physical address |
| 5 | |
| 6 | The token id in RxDMAD may be incorrect when it is not the last frame due to |
| 7 | WED HW bug. Lookup correct token id by physical address in sdp0. |
| 8 | |
| 9 | Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 10 | --- |
| 11 | dma.c | 19 ++++++++++++++++++- |
| 12 | 1 file changed, 18 insertions(+), 1 deletion(-) |
| 13 | |
| 14 | diff --git a/dma.c b/dma.c |
| 15 | index fa56ccfb..c5513690 100644 |
| 16 | --- 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, |
| 19 | |
| 20 | 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; |
| 25 | |
| 26 | token = FIELD_GET(MT_DMA_CTL_TOKEN, desc->buf1); |
| 27 | |
| 28 | + 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; |
| 48 | -- |
| 49 | 2.18.0 |
| 50 | |