developer | 12a4279 | 2023-07-29 05:30:55 +0800 | [diff] [blame] | 1 | From 4e923f831b7eaad738f51bfd54223d74478f3b78 Mon Sep 17 00:00:00 2001 |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 2 | From: Sujuan Chen <sujuan.chen@mediatek.com> |
| 3 | Date: Fri, 25 Nov 2022 14:32:35 +0800 |
developer | 2157bf8 | 2023-06-26 02:27:49 +0800 | [diff] [blame] | 4 | Subject: [PATCH 2003/2009] wifi: mt76: mt7915: wed: find rx token by physical |
developer | bf24a8a | 2022-11-30 14:52:20 +0800 | [diff] [blame] | 5 | address |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 6 | |
| 7 | The token id in RxDMAD may be incorrect when it is not the last frame due to |
| 8 | WED HW bug. Lookup correct token id by physical address in sdp0. |
| 9 | |
developer | afd7587 | 2022-12-14 21:15:46 +0800 | [diff] [blame] | 10 | Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 11 | --- |
developer | 4f0d84b | 2023-03-03 14:21:44 +0800 | [diff] [blame] | 12 | dma.c | 25 ++++++++++++++++++++++++- |
| 13 | 1 file changed, 24 insertions(+), 1 deletion(-) |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 14 | |
| 15 | diff --git a/dma.c b/dma.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 16 | index fc92e39..3047f8b 100644 |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 17 | --- a/dma.c |
| 18 | +++ b/dma.c |
developer | 4f0d84b | 2023-03-03 14:21:44 +0800 | [diff] [blame] | 19 | @@ -403,9 +403,32 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx, |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 20 | |
developer | c04f540 | 2023-02-03 09:22:26 +0800 | [diff] [blame] | 21 | if (mt76_queue_is_wed_rx(q)) { |
developer | 4f0d84b | 2023-03-03 14:21:44 +0800 | [diff] [blame] | 22 | u32 buf1 = le32_to_cpu(desc->buf1); |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 23 | + u32 id, find = 0; |
developer | 4f0d84b | 2023-03-03 14:21:44 +0800 | [diff] [blame] | 24 | u32 token = FIELD_GET(MT_DMA_CTL_TOKEN, buf1); |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 25 | - struct mt76_txwi_cache *t = mt76_rx_token_release(dev, token); |
| 26 | + struct mt76_txwi_cache *t; |
developer | 28d0474 | 2023-01-18 14:02:40 +0800 | [diff] [blame] | 27 | + |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 28 | + if (*more) { |
| 29 | + spin_lock_bh(&dev->rx_token_lock); |
| 30 | + |
| 31 | + idr_for_each_entry(&dev->rx_token, t, id) { |
| 32 | + if (t->dma_addr == le32_to_cpu(desc->buf0)) { |
| 33 | + find = 1; |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 34 | + token = id; |
developer | c04f540 | 2023-02-03 09:22:26 +0800 | [diff] [blame] | 35 | + |
| 36 | + /* Write correct id back to DMA*/ |
developer | 4f0d84b | 2023-03-03 14:21:44 +0800 | [diff] [blame] | 37 | + u32p_replace_bits(&buf1, id, |
| 38 | + MT_DMA_CTL_TOKEN); |
| 39 | + WRITE_ONCE(desc->buf1, cpu_to_le32(buf1)); |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 40 | + break; |
| 41 | + } |
| 42 | + } |
| 43 | + |
| 44 | + spin_unlock_bh(&dev->rx_token_lock); |
| 45 | + if (!find) |
| 46 | + return NULL; |
| 47 | + } |
developer | 28d0474 | 2023-01-18 14:02:40 +0800 | [diff] [blame] | 48 | |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 49 | + t = mt76_rx_token_release(dev, token); |
| 50 | if (!t) |
| 51 | return NULL; |
| 52 | |
| 53 | -- |
developer | 2324aa2 | 2023-04-12 11:30:15 +0800 | [diff] [blame] | 54 | 2.18.0 |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 55 | |