developer | abdbf25 | 2023-02-06 16:02:21 +0800 | [diff] [blame] | 1 | From 8ba17e7cdbb5e921edd03102476cd8fb4f4e1b31 Mon Sep 17 00:00:00 2001 |
| 2 | From: Shayne Chen <shayne.chen@mediatek.com> |
| 3 | Date: Fri, 3 Feb 2023 11:12:46 +0800 |
| 4 | Subject: [PATCH 3/7] Revert "wifi: mt76: mt7996: rely on |
| 5 | mt76_connac_txp_common structure" |
| 6 | |
| 7 | This reverts commit 321edbb414dcc03d349bddd08916b7cc531802e8. |
| 8 | --- |
| 9 | mt7996/mac.c | 38 +++++++++++++++++++------------------- |
| 10 | mt7996/mac.h | 15 +++++++++++++-- |
| 11 | mt7996/mmio.c | 2 +- |
| 12 | 3 files changed, 33 insertions(+), 22 deletions(-) |
| 13 | |
| 14 | diff --git a/mt7996/mac.c b/mt7996/mac.c |
| 15 | index df97d7cf..e5b5fed6 100644 |
| 16 | --- a/mt7996/mac.c |
| 17 | +++ b/mt7996/mac.c |
| 18 | @@ -1088,8 +1088,8 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, |
| 19 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_info->skb); |
| 20 | struct ieee80211_key_conf *key = info->control.hw_key; |
| 21 | struct ieee80211_vif *vif = info->control.vif; |
| 22 | - struct mt76_connac_txp_common *txp; |
| 23 | struct mt76_txwi_cache *t; |
| 24 | + struct mt7996_txp *txp; |
| 25 | int id, i, pid, nbuf = tx_info->nbuf - 1; |
| 26 | bool is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP; |
| 27 | u8 *txwi = (u8 *)txwi_ptr; |
| 28 | @@ -1123,35 +1123,35 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, |
| 29 | mt7996_mac_write_txwi(dev, txwi_ptr, tx_info->skb, wcid, pid, |
| 30 | key, 0); |
| 31 | |
| 32 | - txp = (struct mt76_connac_txp_common *)(txwi + MT_TXD_SIZE); |
| 33 | + txp = (struct mt7996_txp *)(txwi + MT_TXD_SIZE); |
| 34 | for (i = 0; i < nbuf; i++) { |
| 35 | - txp->fw.buf[i] = cpu_to_le32(tx_info->buf[i + 1].addr); |
| 36 | - txp->fw.len[i] = cpu_to_le16(tx_info->buf[i + 1].len); |
| 37 | + txp->buf[i] = cpu_to_le32(tx_info->buf[i + 1].addr); |
| 38 | + txp->len[i] = cpu_to_le16(tx_info->buf[i + 1].len); |
| 39 | } |
| 40 | - txp->fw.nbuf = nbuf; |
| 41 | + txp->nbuf = nbuf; |
| 42 | |
| 43 | - txp->fw.flags = cpu_to_le16(MT_CT_INFO_FROM_HOST); |
| 44 | + txp->flags = cpu_to_le16(MT_CT_INFO_FROM_HOST); |
| 45 | |
| 46 | if (!is_8023 || pid >= MT_PACKET_ID_FIRST) |
| 47 | - txp->fw.flags |= cpu_to_le16(MT_CT_INFO_APPLY_TXD); |
| 48 | + txp->flags |= cpu_to_le16(MT_CT_INFO_APPLY_TXD); |
| 49 | |
| 50 | if (!key) |
| 51 | - txp->fw.flags |= cpu_to_le16(MT_CT_INFO_NONE_CIPHER_FRAME); |
| 52 | + txp->flags |= cpu_to_le16(MT_CT_INFO_NONE_CIPHER_FRAME); |
| 53 | |
| 54 | if (!is_8023 && ieee80211_is_mgmt(hdr->frame_control)) |
| 55 | - txp->fw.flags |= cpu_to_le16(MT_CT_INFO_MGMT_FRAME); |
| 56 | + txp->flags |= cpu_to_le16(MT_CT_INFO_MGMT_FRAME); |
| 57 | |
| 58 | if (vif) { |
| 59 | struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
| 60 | |
| 61 | - txp->fw.bss_idx = mvif->mt76.idx; |
| 62 | + txp->bss_idx = mvif->mt76.idx; |
| 63 | } |
| 64 | |
| 65 | - txp->fw.token = cpu_to_le16(id); |
| 66 | + txp->token = cpu_to_le16(id); |
| 67 | if (test_bit(MT_WCID_FLAG_4ADDR, &wcid->flags)) |
| 68 | - txp->fw.rept_wds_wcid = cpu_to_le16(wcid->idx); |
| 69 | + txp->rept_wds_wcid = cpu_to_le16(wcid->idx); |
| 70 | else |
| 71 | - txp->fw.rept_wds_wcid = cpu_to_le16(0xfff); |
| 72 | + txp->rept_wds_wcid = cpu_to_le16(0xfff); |
| 73 | tx_info->skb = DMA_DUMMY_DATA; |
| 74 | |
| 75 | /* pass partial skb header to fw */ |
| 76 | @@ -1190,13 +1190,13 @@ mt7996_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi) |
| 77 | static void |
| 78 | mt7996_txp_skb_unmap(struct mt76_dev *dev, struct mt76_txwi_cache *t) |
| 79 | { |
| 80 | - struct mt76_connac_txp_common *txp; |
| 81 | + struct mt7996_txp *txp; |
| 82 | int i; |
| 83 | |
| 84 | txp = mt7996_txwi_to_txp(dev, t); |
| 85 | - for (i = 0; i < txp->fw.nbuf; i++) |
| 86 | - dma_unmap_single(dev->dev, le32_to_cpu(txp->fw.buf[i]), |
| 87 | - le16_to_cpu(txp->fw.len[i]), DMA_TO_DEVICE); |
| 88 | + for (i = 0; i < txp->nbuf; i++) |
| 89 | + dma_unmap_single(dev->dev, le32_to_cpu(txp->buf[i]), |
| 90 | + le16_to_cpu(txp->len[i]), DMA_TO_DEVICE); |
| 91 | } |
| 92 | |
| 93 | static void |
| 94 | @@ -1586,11 +1586,11 @@ void mt7996_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e) |
| 95 | |
| 96 | /* error path */ |
| 97 | if (e->skb == DMA_DUMMY_DATA) { |
| 98 | - struct mt76_connac_txp_common *txp; |
| 99 | struct mt76_txwi_cache *t; |
| 100 | + struct mt7996_txp *txp; |
| 101 | |
| 102 | txp = mt7996_txwi_to_txp(mdev, e->txwi); |
| 103 | - t = mt76_token_put(mdev, le16_to_cpu(txp->fw.token)); |
| 104 | + t = mt76_token_put(mdev, le16_to_cpu(txp->token)); |
| 105 | e->skb = t ? t->skb : NULL; |
| 106 | } |
| 107 | |
| 108 | diff --git a/mt7996/mac.h b/mt7996/mac.h |
| 109 | index 10e08d66..9f688520 100644 |
| 110 | --- a/mt7996/mac.h |
| 111 | +++ b/mt7996/mac.h |
| 112 | @@ -268,6 +268,17 @@ enum tx_mgnt_type { |
| 113 | /* VHT/HE only use bits 0-3 */ |
| 114 | #define MT_TX_RATE_IDX GENMASK(5, 0) |
| 115 | |
| 116 | +struct mt7996_txp { |
| 117 | + __le16 flags; |
| 118 | + __le16 token; |
| 119 | + u8 bss_idx; |
| 120 | + __le16 rept_wds_wcid; |
| 121 | + u8 nbuf; |
| 122 | +#define MT_TXP_MAX_BUF_NUM 6 |
| 123 | + __le32 buf[MT_TXP_MAX_BUF_NUM]; |
| 124 | + __le16 len[MT_TXP_MAX_BUF_NUM]; |
| 125 | +} __packed __aligned(4); |
| 126 | + |
| 127 | #define MT_TXFREE0_PKT_TYPE GENMASK(31, 27) |
| 128 | #define MT_TXFREE0_MSDU_CNT GENMASK(25, 16) |
| 129 | #define MT_TXFREE0_RX_BYTE GENMASK(15, 0) |
| 130 | @@ -371,7 +382,7 @@ struct mt7996_dfs_radar_spec { |
| 131 | struct mt7996_dfs_pattern radar_pattern[16]; |
| 132 | }; |
| 133 | |
| 134 | -static inline struct mt76_connac_txp_common * |
| 135 | +static inline struct mt7996_txp * |
| 136 | mt7996_txwi_to_txp(struct mt76_dev *dev, struct mt76_txwi_cache *t) |
| 137 | { |
| 138 | u8 *txwi; |
| 139 | @@ -381,7 +392,7 @@ mt7996_txwi_to_txp(struct mt76_dev *dev, struct mt76_txwi_cache *t) |
| 140 | |
| 141 | txwi = mt76_get_txwi_ptr(dev, t); |
| 142 | |
| 143 | - return (struct mt76_connac_txp_common *)(txwi + MT_TXD_SIZE); |
| 144 | + return (struct mt7996_txp *)(txwi + MT_TXD_SIZE); |
| 145 | } |
| 146 | |
| 147 | #endif |
| 148 | diff --git a/mt7996/mmio.c b/mt7996/mmio.c |
| 149 | index 2237f50a..d8a2c1a7 100644 |
| 150 | --- a/mt7996/mmio.c |
| 151 | +++ b/mt7996/mmio.c |
| 152 | @@ -318,7 +318,7 @@ struct mt7996_dev *mt7996_mmio_probe(struct device *pdev, |
| 153 | { |
| 154 | static const struct mt76_driver_ops drv_ops = { |
| 155 | /* txwi_size = txd size + txp size */ |
| 156 | - .txwi_size = MT_TXD_SIZE + sizeof(struct mt76_connac_fw_txp), |
| 157 | + .txwi_size = MT_TXD_SIZE + sizeof(struct mt7996_txp), |
| 158 | .drv_flags = MT_DRV_TXWI_NO_FREE | |
| 159 | MT_DRV_HW_MGMT_TXQ, |
| 160 | .survey_flags = SURVEY_INFO_TIME_TX | |
| 161 | -- |
| 162 | 2.25.1 |
| 163 | |