developer | 60a3d66 | 2023-02-07 15:24:34 +0800 | [diff] [blame^] | 1 | From e27abd8471cfe265afd0061cc86f85cce5b37773 Mon Sep 17 00:00:00 2001 |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 2 | From: Sujuan Chen <sujuan.chen@mediatek.com> |
| 3 | Date: Fri, 25 Nov 2022 14:32:35 +0800 |
developer | 60a3d66 | 2023-02-07 15:24:34 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 3004/3010] mt76: mt7915: wed: find rx token by physical |
developer | 4eb49d9 | 2022-12-05 11:29:56 +0800 | [diff] [blame] | 5 | address |
developer | 3609d78 | 2022-11-29 18:07:22 +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 | 57c8f1a | 2022-12-15 14:09:45 +0800 | [diff] [blame] | 10 | Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 11 | --- |
developer | 60a3d66 | 2023-02-07 15:24:34 +0800 | [diff] [blame^] | 12 | dma.c | 27 ++++++++++++++++++++++++++- |
| 13 | 1 file changed, 26 insertions(+), 1 deletion(-) |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 14 | |
| 15 | diff --git a/dma.c b/dma.c |
developer | 60a3d66 | 2023-02-07 15:24:34 +0800 | [diff] [blame^] | 16 | index a6bb3730..b58579c5 100644 |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 17 | --- a/dma.c |
| 18 | +++ b/dma.c |
developer | 60a3d66 | 2023-02-07 15:24:34 +0800 | [diff] [blame^] | 19 | @@ -402,10 +402,35 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx, |
| 20 | *info = le32_to_cpu(desc->info); |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 21 | |
developer | 60a3d66 | 2023-02-07 15:24:34 +0800 | [diff] [blame^] | 22 | if (mt76_queue_is_wed_rx(q)) { |
| 23 | + __le32 buf1; |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 24 | + u32 id, find = 0; |
| 25 | u32 token = FIELD_GET(MT_DMA_CTL_TOKEN, |
| 26 | le32_to_cpu(desc->buf1)); |
| 27 | - struct mt76_txwi_cache *t = mt76_rx_token_release(dev, token); |
| 28 | + struct mt76_txwi_cache *t; |
developer | 765f189 | 2023-01-30 14:02:51 +0800 | [diff] [blame] | 29 | + |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 30 | + if (*more) { |
| 31 | + spin_lock_bh(&dev->rx_token_lock); |
| 32 | + |
| 33 | + idr_for_each_entry(&dev->rx_token, t, id) { |
| 34 | + if (t->dma_addr == le32_to_cpu(desc->buf0)) { |
| 35 | + find = 1; |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 36 | + token = id; |
developer | 60a3d66 | 2023-02-07 15:24:34 +0800 | [diff] [blame^] | 37 | + |
| 38 | + /* Write correct id back to DMA*/ |
| 39 | + buf1 = desc->buf1; |
| 40 | + buf1 = le32_replace_bits(buf1, id, |
| 41 | + MT_DMA_CTL_TOKEN); |
| 42 | + WRITE_ONCE(desc->buf1, buf1); |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 43 | + break; |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | + spin_unlock_bh(&dev->rx_token_lock); |
| 48 | + if (!find) |
| 49 | + return NULL; |
| 50 | + } |
developer | 765f189 | 2023-01-30 14:02:51 +0800 | [diff] [blame] | 51 | |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 52 | + t = mt76_rx_token_release(dev, token); |
| 53 | if (!t) |
| 54 | return NULL; |
| 55 | |
| 56 | -- |
developer | 23c2234 | 2023-01-09 13:57:39 +0800 | [diff] [blame] | 57 | 2.18.0 |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 58 | |