developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1 | From daf071f6469272be2b7b61cb227efb7ad57c2ddd 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 | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 78/94] 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 ++-- |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 11 | mt7915/mmio.c | 3 ++- |
developer | 7a520b5 | 2023-03-14 14:09:34 +0800 | [diff] [blame] | 12 | mt7915/mt7915.h | 2 +- |
developer | 753619c | 2024-02-22 13:42:45 +0800 | [diff] [blame] | 13 | wed.c | 2 +- |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 14 | 6 files changed, 14 insertions(+), 8 deletions(-) |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 15 | |
| 16 | diff --git a/mt76_connac.h b/mt76_connac.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 17 | index e411032..f2006ea 100644 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 18 | --- a/mt76_connac.h |
| 19 | +++ b/mt76_connac.h |
developer | 7af0f76 | 2023-05-22 15:16:16 +0800 | [diff] [blame] | 20 | @@ -130,6 +130,7 @@ struct mt76_connac_sta_key_conf { |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 21 | }; |
| 22 | |
| 23 | #define MT_TXP_MAX_BUF_NUM 6 |
| 24 | +#define MT_TXD_TXP_BUF_SIZE 128 |
| 25 | |
| 26 | struct mt76_connac_fw_txp { |
| 27 | __le16 flags; |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 28 | diff --git a/mt7915/mac.c b/mt7915/mac.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 29 | index 677c339..543077d 100644 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 30 | --- a/mt7915/mac.c |
| 31 | +++ b/mt7915/mac.c |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 32 | @@ -878,9 +878,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] | 33 | |
| 34 | txp->token = cpu_to_le16(token_id); |
| 35 | txp->nbuf = 1; |
| 36 | - txp->buf[0] = cpu_to_le32(phys + MT_TXD_SIZE + sizeof(*txp)); |
| 37 | + txp->buf[0] = cpu_to_le32(phys + MT_TXD_TXP_BUF_SIZE); |
| 38 | |
| 39 | - return MT_TXD_SIZE + sizeof(*txp); |
| 40 | + return MT_TXD_TXP_BUF_SIZE; |
| 41 | } |
| 42 | |
| 43 | static void |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 44 | @@ -929,6 +929,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len) |
developer | 61c4ae8 | 2022-09-30 12:55:06 +0800 | [diff] [blame] | 45 | LIST_HEAD(free_list); |
| 46 | void *end = data + len; |
| 47 | bool v3, wake = false; |
| 48 | + bool with_txwi = true; |
| 49 | u16 total, count = 0; |
| 50 | u32 txd = le32_to_cpu(free->txd); |
| 51 | __le32 *cur_info; |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 52 | @@ -1010,12 +1011,15 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len) |
developer | 61c4ae8 | 2022-09-30 12:55:06 +0800 | [diff] [blame] | 53 | txwi = mt76_token_release(mdev, msdu, &wake); |
| 54 | if (!txwi) |
| 55 | continue; |
| 56 | + else |
| 57 | + with_txwi = false; |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 58 | |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 59 | mt76_connac2_txwi_free(mdev, txwi, sta, &free_list); |
developer | 61c4ae8 | 2022-09-30 12:55:06 +0800 | [diff] [blame] | 60 | } |
| 61 | } |
developer | 47efbdb | 2023-06-29 20:33:22 +0800 | [diff] [blame] | 62 | |
developer | 61c4ae8 | 2022-09-30 12:55:06 +0800 | [diff] [blame] | 63 | - mt7915_mac_tx_free_done(dev, &free_list, wake); |
| 64 | + if (!with_txwi) |
| 65 | + mt7915_mac_tx_free_done(dev, &free_list, wake); |
| 66 | } |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 67 | |
developer | 61c4ae8 | 2022-09-30 12:55:06 +0800 | [diff] [blame] | 68 | static void |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 69 | diff --git a/mt7915/main.c b/mt7915/main.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 70 | index e3bc373..6f09dda 100644 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 71 | --- a/mt7915/main.c |
| 72 | +++ b/mt7915/main.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 73 | @@ -1832,7 +1832,7 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw, |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 74 | if (!mtk_wed_device_active(wed)) |
| 75 | return -ENODEV; |
| 76 | |
| 77 | - if (msta->wcid.idx > 0xff) |
| 78 | + if (msta->wcid.idx > MT7915_WTBL_STA) |
| 79 | return -EIO; |
| 80 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 81 | if (!test_bit((mvif->qos_map[path->mtk_wdma.tid >> 2] + AMPDU_ADDBA_SUCC_SHFT), |
| 82 | @@ -1843,7 +1843,7 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw, |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 83 | path->dev = ctx->dev; |
| 84 | path->mtk_wdma.wdma_idx = wed->wdma_idx; |
| 85 | path->mtk_wdma.bss = mvif->mt76.idx; |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 86 | - path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? msta->wcid.idx : 0x3ff; |
| 87 | + path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? 0xff : 0x3ff; |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 88 | path->mtk_wdma.queue = phy != &dev->phy; |
| 89 | |
| 90 | ctx->dev = NULL; |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 91 | diff --git a/mt7915/mmio.c b/mt7915/mmio.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 92 | index b1b219c..5364821 100644 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 93 | --- a/mt7915/mmio.c |
| 94 | +++ b/mt7915/mmio.c |
developer | 60a3d66 | 2023-02-07 15:24:34 +0800 | [diff] [blame] | 95 | @@ -13,7 +13,7 @@ |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 96 | #include "../trace.h" |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 97 | #include "../dma.h" |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 98 | |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 99 | -static bool wed_enable; |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 100 | +static bool wed_enable = true; |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 101 | module_param(wed_enable, bool, 0644); |
developer | 3609d78 | 2022-11-29 18:07:22 +0800 | [diff] [blame] | 102 | MODULE_PARM_DESC(wed_enable, "Enable Wireless Ethernet Dispatch support"); |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 103 | |
developer | 753619c | 2024-02-22 13:42:45 +0800 | [diff] [blame] | 104 | @@ -732,6 +732,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr, |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 105 | |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 106 | *irq = wed->irq; |
| 107 | dev->mt76.dma_dev = wed->dev; |
| 108 | + dev->mt76.token_size = wed->wlan.token_start; |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 109 | |
developer | ec56711 | 2022-10-11 11:02:55 +0800 | [diff] [blame] | 110 | ret = dma_set_mask(wed->dev, DMA_BIT_MASK(32)); |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 111 | if (ret) |
developer | 7a520b5 | 2023-03-14 14:09:34 +0800 | [diff] [blame] | 112 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 113 | index 7c185a1..94ea3e1 100644 |
developer | 7a520b5 | 2023-03-14 14:09:34 +0800 | [diff] [blame] | 114 | --- a/mt7915/mt7915.h |
| 115 | +++ b/mt7915/mt7915.h |
developer | 7af0f76 | 2023-05-22 15:16:16 +0800 | [diff] [blame] | 116 | @@ -62,7 +62,7 @@ |
developer | 7a520b5 | 2023-03-14 14:09:34 +0800 | [diff] [blame] | 117 | #define MT7916_EEPROM_SIZE 4096 |
| 118 | |
| 119 | #define MT7915_EEPROM_BLOCK_SIZE 16 |
| 120 | -#define MT7915_HW_TOKEN_SIZE 4096 |
| 121 | +#define MT7915_HW_TOKEN_SIZE 7168 |
| 122 | #define MT7915_TOKEN_SIZE 8192 |
| 123 | |
| 124 | #define MT7915_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */ |
developer | 753619c | 2024-02-22 13:42:45 +0800 | [diff] [blame] | 125 | diff --git a/wed.c b/wed.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 126 | index f7a3f1b..47c81a2 100644 |
developer | 753619c | 2024-02-22 13:42:45 +0800 | [diff] [blame] | 127 | --- a/wed.c |
| 128 | +++ b/wed.c |
| 129 | @@ -187,7 +187,7 @@ void mt76_wed_offload_disable(struct mtk_wed_device *wed) |
| 130 | struct mt76_dev *dev = container_of(wed, struct mt76_dev, mmio.wed); |
| 131 | |
| 132 | spin_lock_bh(&dev->token_lock); |
| 133 | - dev->token_size = dev->drv->token_size; |
| 134 | + dev->token_size = wed->wlan.token_start; |
| 135 | spin_unlock_bh(&dev->token_lock); |
| 136 | } |
| 137 | EXPORT_SYMBOL_GPL(mt76_wed_offload_disable); |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 138 | -- |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 139 | 2.45.2 |
developer | f79ad45 | 2022-07-12 11:37:54 +0800 | [diff] [blame] | 140 | |