developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 1 | From 3659e82e8fa99a3a5be9e22c9941ca20d035e1fe Mon Sep 17 00:00:00 2001 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 2 | From: Sujuan Chen <sujuan.chen@mediatek.com> |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 3 | Date: Fri, 25 Nov 2022 10:38:53 +0800 |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 2000/2009] wifi: mt76: mt7915: wed: add wed tx support |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 5 | |
| 6 | Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com> |
| 7 | --- |
developer | 7a520b5 | 2023-03-14 14:09:34 +0800 | [diff] [blame] | 8 | mt76_connac.h | 1 + |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 9 | mt7915/mac.c | 10 +++++++--- |
developer | 7a520b5 | 2023-03-14 14:09:34 +0800 | [diff] [blame] | 10 | mt7915/main.c | 4 ++-- |
| 11 | mt7915/mmio.c | 5 +++-- |
| 12 | mt7915/mt7915.h | 2 +- |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 13 | 5 files changed, 14 insertions(+), 8 deletions(-) |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 14 | |
| 15 | diff --git a/mt76_connac.h b/mt76_connac.h |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 16 | index 4560ab7..431e4d7 100644 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 17 | --- a/mt76_connac.h |
| 18 | +++ b/mt76_connac.h |
developer | 7af0f76 | 2023-05-22 15:16:16 +0800 | [diff] [blame] | 19 | @@ -130,6 +130,7 @@ struct mt76_connac_sta_key_conf { |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 20 | }; |
| 21 | |
| 22 | #define MT_TXP_MAX_BUF_NUM 6 |
| 23 | +#define MT_TXD_TXP_BUF_SIZE 128 |
| 24 | |
| 25 | struct mt76_connac_fw_txp { |
| 26 | __le16 flags; |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 27 | diff --git a/mt7915/mac.c b/mt7915/mac.c |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 28 | index f930c50..a0d1f89 100644 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 29 | --- a/mt7915/mac.c |
| 30 | +++ b/mt7915/mac.c |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 31 | @@ -867,9 +867,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id) |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 32 | |
| 33 | txp->token = cpu_to_le16(token_id); |
| 34 | txp->nbuf = 1; |
| 35 | - txp->buf[0] = cpu_to_le32(phys + MT_TXD_SIZE + sizeof(*txp)); |
| 36 | + txp->buf[0] = cpu_to_le32(phys + MT_TXD_TXP_BUF_SIZE); |
| 37 | |
| 38 | - return MT_TXD_SIZE + sizeof(*txp); |
| 39 | + return MT_TXD_TXP_BUF_SIZE; |
| 40 | } |
| 41 | |
| 42 | static void |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 43 | @@ -918,6 +918,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len) |
developer | 61c4ae8 | 2022-09-30 12:55:06 +0800 | [diff] [blame] | 44 | LIST_HEAD(free_list); |
| 45 | void *end = data + len; |
| 46 | bool v3, wake = false; |
| 47 | + bool with_txwi = true; |
| 48 | u16 total, count = 0; |
| 49 | u32 txd = le32_to_cpu(free->txd); |
| 50 | __le32 *cur_info; |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 51 | @@ -999,12 +1000,15 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len) |
developer | 61c4ae8 | 2022-09-30 12:55:06 +0800 | [diff] [blame] | 52 | txwi = mt76_token_release(mdev, msdu, &wake); |
| 53 | if (!txwi) |
| 54 | continue; |
| 55 | + else |
| 56 | + with_txwi = false; |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 57 | |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 58 | mt76_connac2_txwi_free(mdev, txwi, sta, &free_list); |
developer | 61c4ae8 | 2022-09-30 12:55:06 +0800 | [diff] [blame] | 59 | } |
| 60 | } |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 61 | |
developer | 61c4ae8 | 2022-09-30 12:55:06 +0800 | [diff] [blame] | 62 | - mt7915_mac_tx_free_done(dev, &free_list, wake); |
| 63 | + if (!with_txwi) |
| 64 | + mt7915_mac_tx_free_done(dev, &free_list, wake); |
| 65 | } |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 66 | |
developer | 61c4ae8 | 2022-09-30 12:55:06 +0800 | [diff] [blame] | 67 | static void |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 68 | diff --git a/mt7915/main.c b/mt7915/main.c |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 69 | index 95b15a2..e0b1643 100644 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 70 | --- a/mt7915/main.c |
| 71 | +++ b/mt7915/main.c |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 72 | @@ -1640,14 +1640,14 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw, |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 73 | if (!mtk_wed_device_active(wed)) |
| 74 | return -ENODEV; |
| 75 | |
| 76 | - if (msta->wcid.idx > 0xff) |
| 77 | + if (msta->wcid.idx > MT7915_WTBL_STA) |
| 78 | return -EIO; |
| 79 | |
| 80 | path->type = DEV_PATH_MTK_WDMA; |
| 81 | path->dev = ctx->dev; |
| 82 | path->mtk_wdma.wdma_idx = wed->wdma_idx; |
| 83 | path->mtk_wdma.bss = mvif->mt76.idx; |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 84 | - path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? msta->wcid.idx : 0x3ff; |
| 85 | + path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? 0xff : 0x3ff; |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 86 | path->mtk_wdma.queue = phy != &dev->phy; |
| 87 | |
| 88 | ctx->dev = NULL; |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 89 | diff --git a/mt7915/mmio.c b/mt7915/mmio.c |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 90 | index 25c3fe2..e5e005e 100644 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 91 | --- a/mt7915/mmio.c |
| 92 | +++ b/mt7915/mmio.c |
developer | 60a3d66 | 2023-02-07 15:24:34 +0800 | [diff] [blame] | 93 | @@ -13,7 +13,7 @@ |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 94 | #include "../trace.h" |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 95 | #include "../dma.h" |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 96 | |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 97 | -static bool wed_enable; |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 98 | +static bool wed_enable = true; |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 99 | module_param(wed_enable, bool, 0644); |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 100 | MODULE_PARM_DESC(wed_enable, "Enable Wireless Ethernet Dispatch support"); |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 101 | |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 102 | @@ -569,7 +569,7 @@ static void mt7915_mmio_wed_offload_disable(struct mtk_wed_device *wed) |
developer | 275185a | 2022-10-12 18:25:15 +0800 | [diff] [blame] | 103 | dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed); |
| 104 | |
| 105 | spin_lock_bh(&dev->mt76.token_lock); |
| 106 | - dev->mt76.token_size = MT7915_TOKEN_SIZE; |
| 107 | + dev->mt76.token_size = wed->wlan.token_start;//MT7915_TOKEN_SIZE |
| 108 | spin_unlock_bh(&dev->mt76.token_lock); |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 109 | } |
developer | 275185a | 2022-10-12 18:25:15 +0800 | [diff] [blame] | 110 | |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 111 | @@ -812,6 +812,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr, |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 112 | |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 113 | *irq = wed->irq; |
| 114 | dev->mt76.dma_dev = wed->dev; |
| 115 | + dev->mt76.token_size = wed->wlan.token_start; |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 116 | |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 117 | ret = dma_set_mask(wed->dev, DMA_BIT_MASK(32)); |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 118 | if (ret) |
developer | 7a520b5 | 2023-03-14 14:09:34 +0800 | [diff] [blame] | 119 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame^] | 120 | index b7fa1a4..f4e60b2 100644 |
developer | 7a520b5 | 2023-03-14 14:09:34 +0800 | [diff] [blame] | 121 | --- a/mt7915/mt7915.h |
| 122 | +++ b/mt7915/mt7915.h |
developer | 7af0f76 | 2023-05-22 15:16:16 +0800 | [diff] [blame] | 123 | @@ -62,7 +62,7 @@ |
developer | 7a520b5 | 2023-03-14 14:09:34 +0800 | [diff] [blame] | 124 | #define MT7916_EEPROM_SIZE 4096 |
| 125 | |
| 126 | #define MT7915_EEPROM_BLOCK_SIZE 16 |
| 127 | -#define MT7915_HW_TOKEN_SIZE 4096 |
| 128 | +#define MT7915_HW_TOKEN_SIZE 7168 |
| 129 | #define MT7915_TOKEN_SIZE 8192 |
| 130 | |
| 131 | #define MT7915_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */ |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 132 | -- |
developer | 8effbd3 | 2023-04-17 15:57:28 +0800 | [diff] [blame] | 133 | 2.18.0 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 134 | |