developer | fd8e115 | 2023-02-14 11:29:23 +0800 | [diff] [blame^] | 1 | From 783c715b2271209d23b965517d97e5a834fcfa76 Mon Sep 17 00:00:00 2001 |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 2 | From: Sujuan Chen <sujuan.chen@mediatek.com> |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 3 | Date: Fri, 25 Nov 2022 10:38:53 +0800 |
developer | fd8e115 | 2023-02-14 11:29:23 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 3001/3015] mt76: mt7915: wed: add wed tx support |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 5 | |
| 6 | Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com> |
| 7 | --- |
developer | c226de8 | 2022-10-03 12:24:57 +0800 | [diff] [blame] | 8 | mt76_connac.h | 1 + |
| 9 | mt7915/mac.c | 11 +++++++---- |
| 10 | mt7915/main.c | 4 ++-- |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 11 | mt7915/mmio.c | 5 +++-- |
| 12 | 4 files changed, 13 insertions(+), 8 deletions(-) |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 13 | |
| 14 | diff --git a/mt76_connac.h b/mt76_connac.h |
developer | c04f540 | 2023-02-03 09:22:26 +0800 | [diff] [blame] | 15 | index b339c50b..323203df 100644 |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 16 | --- a/mt76_connac.h |
| 17 | +++ b/mt76_connac.h |
developer | c04f540 | 2023-02-03 09:22:26 +0800 | [diff] [blame] | 18 | @@ -117,6 +117,7 @@ struct mt76_connac_sta_key_conf { |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 19 | }; |
| 20 | |
| 21 | #define MT_TXP_MAX_BUF_NUM 6 |
| 22 | +#define MT_TXD_TXP_BUF_SIZE 128 |
| 23 | |
| 24 | struct mt76_connac_fw_txp { |
| 25 | __le16 flags; |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 26 | diff --git a/mt7915/mac.c b/mt7915/mac.c |
developer | c04f540 | 2023-02-03 09:22:26 +0800 | [diff] [blame] | 27 | index 6fe5cac6..175498b1 100644 |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 28 | --- a/mt7915/mac.c |
| 29 | +++ b/mt7915/mac.c |
developer | c04f540 | 2023-02-03 09:22:26 +0800 | [diff] [blame] | 30 | @@ -890,9 +890,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id) |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 31 | |
| 32 | txp->token = cpu_to_le16(token_id); |
| 33 | txp->nbuf = 1; |
| 34 | - txp->buf[0] = cpu_to_le32(phys + MT_TXD_SIZE + sizeof(*txp)); |
| 35 | + txp->buf[0] = cpu_to_le32(phys + MT_TXD_TXP_BUF_SIZE); |
| 36 | |
| 37 | - return MT_TXD_SIZE + sizeof(*txp); |
| 38 | + return MT_TXD_TXP_BUF_SIZE; |
| 39 | } |
| 40 | |
| 41 | static void |
developer | c04f540 | 2023-02-03 09:22:26 +0800 | [diff] [blame] | 42 | @@ -1008,6 +1008,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len) |
developer | 8d18bff | 2022-09-26 17:39:49 +0800 | [diff] [blame] | 43 | LIST_HEAD(free_list); |
| 44 | void *end = data + len; |
| 45 | bool v3, wake = false; |
| 46 | + bool with_txwi = true; |
| 47 | u16 total, count = 0; |
| 48 | u32 txd = le32_to_cpu(free->txd); |
| 49 | __le32 *cur_info; |
developer | c04f540 | 2023-02-03 09:22:26 +0800 | [diff] [blame] | 50 | @@ -1063,12 +1064,14 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len) |
developer | 8d18bff | 2022-09-26 17:39:49 +0800 | [diff] [blame] | 51 | txwi = mt76_token_release(mdev, msdu, &wake); |
| 52 | if (!txwi) |
| 53 | continue; |
| 54 | + else |
| 55 | + with_txwi = false; |
developer | c226de8 | 2022-10-03 12:24:57 +0800 | [diff] [blame] | 56 | |
developer | 8d18bff | 2022-09-26 17:39:49 +0800 | [diff] [blame] | 57 | mt7915_txwi_free(dev, txwi, sta, &free_list); |
| 58 | } |
| 59 | } |
| 60 | - |
| 61 | - mt7915_mac_tx_free_done(dev, &free_list, wake); |
| 62 | + if (!with_txwi) |
| 63 | + mt7915_mac_tx_free_done(dev, &free_list, wake); |
| 64 | } |
developer | c226de8 | 2022-10-03 12:24:57 +0800 | [diff] [blame] | 65 | |
developer | 8d18bff | 2022-09-26 17:39:49 +0800 | [diff] [blame] | 66 | static void |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 67 | diff --git a/mt7915/main.c b/mt7915/main.c |
developer | fd8e115 | 2023-02-14 11:29:23 +0800 | [diff] [blame^] | 68 | index 0d01d880..020a6d2d 100644 |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 69 | --- a/mt7915/main.c |
| 70 | +++ b/mt7915/main.c |
developer | fd8e115 | 2023-02-14 11:29:23 +0800 | [diff] [blame^] | 71 | @@ -1537,14 +1537,14 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw, |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 72 | if (!mtk_wed_device_active(wed)) |
| 73 | return -ENODEV; |
| 74 | |
| 75 | - if (msta->wcid.idx > 0xff) |
| 76 | + if (msta->wcid.idx > MT7915_WTBL_STA) |
| 77 | return -EIO; |
| 78 | |
| 79 | path->type = DEV_PATH_MTK_WDMA; |
| 80 | path->dev = ctx->dev; |
| 81 | path->mtk_wdma.wdma_idx = wed->wdma_idx; |
| 82 | path->mtk_wdma.bss = mvif->mt76.idx; |
developer | c226de8 | 2022-10-03 12:24:57 +0800 | [diff] [blame] | 83 | - path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? msta->wcid.idx : 0x3ff; |
| 84 | + path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? 0xff : 0x3ff; |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 85 | path->mtk_wdma.queue = phy != &dev->phy; |
| 86 | |
| 87 | ctx->dev = NULL; |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 88 | diff --git a/mt7915/mmio.c b/mt7915/mmio.c |
developer | c04f540 | 2023-02-03 09:22:26 +0800 | [diff] [blame] | 89 | index 95ded131..6ebb969f 100644 |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 90 | --- a/mt7915/mmio.c |
| 91 | +++ b/mt7915/mmio.c |
developer | c04f540 | 2023-02-03 09:22:26 +0800 | [diff] [blame] | 92 | @@ -13,7 +13,7 @@ |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 93 | #include "../trace.h" |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 94 | #include "../dma.h" |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 95 | |
developer | c226de8 | 2022-10-03 12:24:57 +0800 | [diff] [blame] | 96 | -static bool wed_enable; |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 97 | +static bool wed_enable = true; |
developer | c226de8 | 2022-10-03 12:24:57 +0800 | [diff] [blame] | 98 | module_param(wed_enable, bool, 0644); |
developer | 144824b | 2022-11-25 21:27:43 +0800 | [diff] [blame] | 99 | MODULE_PARM_DESC(wed_enable, "Enable Wireless Ethernet Dispatch support"); |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 100 | |
developer | c04f540 | 2023-02-03 09:22:26 +0800 | [diff] [blame] | 101 | @@ -584,7 +584,7 @@ static void mt7915_mmio_wed_offload_disable(struct mtk_wed_device *wed) |
developer | 515b048 | 2022-10-11 14:09:57 +0800 | [diff] [blame] | 102 | dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed); |
| 103 | |
| 104 | spin_lock_bh(&dev->mt76.token_lock); |
| 105 | - dev->mt76.token_size = MT7915_TOKEN_SIZE; |
| 106 | + dev->mt76.token_size = wed->wlan.token_start;//MT7915_TOKEN_SIZE |
| 107 | spin_unlock_bh(&dev->mt76.token_lock); |
| 108 | |
| 109 | /* MT_TXD5_TX_STATUS_HOST (MPDU format) has higher priority than |
developer | c04f540 | 2023-02-03 09:22:26 +0800 | [diff] [blame] | 110 | @@ -825,6 +825,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr, |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 111 | |
developer | c226de8 | 2022-10-03 12:24:57 +0800 | [diff] [blame] | 112 | *irq = wed->irq; |
| 113 | dev->mt76.dma_dev = wed->dev; |
| 114 | + dev->mt76.token_size = wed->wlan.token_start; |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 115 | |
developer | c226de8 | 2022-10-03 12:24:57 +0800 | [diff] [blame] | 116 | ret = dma_set_mask(wed->dev, DMA_BIT_MASK(32)); |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 117 | if (ret) |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 118 | -- |
developer | d75d363 | 2023-01-05 14:31:01 +0800 | [diff] [blame] | 119 | 2.18.0 |
developer | 8cb3ac7 | 2022-07-04 10:55:14 +0800 | [diff] [blame] | 120 | |