| From 8ba17e7cdbb5e921edd03102476cd8fb4f4e1b31 Mon Sep 17 00:00:00 2001 |
| From: Shayne Chen <shayne.chen@mediatek.com> |
| Date: Fri, 3 Feb 2023 11:12:46 +0800 |
| Subject: [PATCH 3/7] Revert "wifi: mt76: mt7996: rely on |
| mt76_connac_txp_common structure" |
| |
| This reverts commit 321edbb414dcc03d349bddd08916b7cc531802e8. |
| --- |
| mt7996/mac.c | 38 +++++++++++++++++++------------------- |
| mt7996/mac.h | 15 +++++++++++++-- |
| mt7996/mmio.c | 2 +- |
| 3 files changed, 33 insertions(+), 22 deletions(-) |
| |
| diff --git a/mt7996/mac.c b/mt7996/mac.c |
| index df97d7cf..e5b5fed6 100644 |
| --- a/mt7996/mac.c |
| +++ b/mt7996/mac.c |
| @@ -1088,8 +1088,8 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, |
| struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_info->skb); |
| struct ieee80211_key_conf *key = info->control.hw_key; |
| struct ieee80211_vif *vif = info->control.vif; |
| - struct mt76_connac_txp_common *txp; |
| struct mt76_txwi_cache *t; |
| + struct mt7996_txp *txp; |
| int id, i, pid, nbuf = tx_info->nbuf - 1; |
| bool is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP; |
| u8 *txwi = (u8 *)txwi_ptr; |
| @@ -1123,35 +1123,35 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, |
| mt7996_mac_write_txwi(dev, txwi_ptr, tx_info->skb, wcid, pid, |
| key, 0); |
| |
| - txp = (struct mt76_connac_txp_common *)(txwi + MT_TXD_SIZE); |
| + txp = (struct mt7996_txp *)(txwi + MT_TXD_SIZE); |
| for (i = 0; i < nbuf; i++) { |
| - txp->fw.buf[i] = cpu_to_le32(tx_info->buf[i + 1].addr); |
| - txp->fw.len[i] = cpu_to_le16(tx_info->buf[i + 1].len); |
| + txp->buf[i] = cpu_to_le32(tx_info->buf[i + 1].addr); |
| + txp->len[i] = cpu_to_le16(tx_info->buf[i + 1].len); |
| } |
| - txp->fw.nbuf = nbuf; |
| + txp->nbuf = nbuf; |
| |
| - txp->fw.flags = cpu_to_le16(MT_CT_INFO_FROM_HOST); |
| + txp->flags = cpu_to_le16(MT_CT_INFO_FROM_HOST); |
| |
| if (!is_8023 || pid >= MT_PACKET_ID_FIRST) |
| - txp->fw.flags |= cpu_to_le16(MT_CT_INFO_APPLY_TXD); |
| + txp->flags |= cpu_to_le16(MT_CT_INFO_APPLY_TXD); |
| |
| if (!key) |
| - txp->fw.flags |= cpu_to_le16(MT_CT_INFO_NONE_CIPHER_FRAME); |
| + txp->flags |= cpu_to_le16(MT_CT_INFO_NONE_CIPHER_FRAME); |
| |
| if (!is_8023 && ieee80211_is_mgmt(hdr->frame_control)) |
| - txp->fw.flags |= cpu_to_le16(MT_CT_INFO_MGMT_FRAME); |
| + txp->flags |= cpu_to_le16(MT_CT_INFO_MGMT_FRAME); |
| |
| if (vif) { |
| struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; |
| |
| - txp->fw.bss_idx = mvif->mt76.idx; |
| + txp->bss_idx = mvif->mt76.idx; |
| } |
| |
| - txp->fw.token = cpu_to_le16(id); |
| + txp->token = cpu_to_le16(id); |
| if (test_bit(MT_WCID_FLAG_4ADDR, &wcid->flags)) |
| - txp->fw.rept_wds_wcid = cpu_to_le16(wcid->idx); |
| + txp->rept_wds_wcid = cpu_to_le16(wcid->idx); |
| else |
| - txp->fw.rept_wds_wcid = cpu_to_le16(0xfff); |
| + txp->rept_wds_wcid = cpu_to_le16(0xfff); |
| tx_info->skb = DMA_DUMMY_DATA; |
| |
| /* pass partial skb header to fw */ |
| @@ -1190,13 +1190,13 @@ mt7996_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi) |
| static void |
| mt7996_txp_skb_unmap(struct mt76_dev *dev, struct mt76_txwi_cache *t) |
| { |
| - struct mt76_connac_txp_common *txp; |
| + struct mt7996_txp *txp; |
| int i; |
| |
| txp = mt7996_txwi_to_txp(dev, t); |
| - for (i = 0; i < txp->fw.nbuf; i++) |
| - dma_unmap_single(dev->dev, le32_to_cpu(txp->fw.buf[i]), |
| - le16_to_cpu(txp->fw.len[i]), DMA_TO_DEVICE); |
| + for (i = 0; i < txp->nbuf; i++) |
| + dma_unmap_single(dev->dev, le32_to_cpu(txp->buf[i]), |
| + le16_to_cpu(txp->len[i]), DMA_TO_DEVICE); |
| } |
| |
| static void |
| @@ -1586,11 +1586,11 @@ void mt7996_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e) |
| |
| /* error path */ |
| if (e->skb == DMA_DUMMY_DATA) { |
| - struct mt76_connac_txp_common *txp; |
| struct mt76_txwi_cache *t; |
| + struct mt7996_txp *txp; |
| |
| txp = mt7996_txwi_to_txp(mdev, e->txwi); |
| - t = mt76_token_put(mdev, le16_to_cpu(txp->fw.token)); |
| + t = mt76_token_put(mdev, le16_to_cpu(txp->token)); |
| e->skb = t ? t->skb : NULL; |
| } |
| |
| diff --git a/mt7996/mac.h b/mt7996/mac.h |
| index 10e08d66..9f688520 100644 |
| --- a/mt7996/mac.h |
| +++ b/mt7996/mac.h |
| @@ -268,6 +268,17 @@ enum tx_mgnt_type { |
| /* VHT/HE only use bits 0-3 */ |
| #define MT_TX_RATE_IDX GENMASK(5, 0) |
| |
| +struct mt7996_txp { |
| + __le16 flags; |
| + __le16 token; |
| + u8 bss_idx; |
| + __le16 rept_wds_wcid; |
| + u8 nbuf; |
| +#define MT_TXP_MAX_BUF_NUM 6 |
| + __le32 buf[MT_TXP_MAX_BUF_NUM]; |
| + __le16 len[MT_TXP_MAX_BUF_NUM]; |
| +} __packed __aligned(4); |
| + |
| #define MT_TXFREE0_PKT_TYPE GENMASK(31, 27) |
| #define MT_TXFREE0_MSDU_CNT GENMASK(25, 16) |
| #define MT_TXFREE0_RX_BYTE GENMASK(15, 0) |
| @@ -371,7 +382,7 @@ struct mt7996_dfs_radar_spec { |
| struct mt7996_dfs_pattern radar_pattern[16]; |
| }; |
| |
| -static inline struct mt76_connac_txp_common * |
| +static inline struct mt7996_txp * |
| mt7996_txwi_to_txp(struct mt76_dev *dev, struct mt76_txwi_cache *t) |
| { |
| u8 *txwi; |
| @@ -381,7 +392,7 @@ mt7996_txwi_to_txp(struct mt76_dev *dev, struct mt76_txwi_cache *t) |
| |
| txwi = mt76_get_txwi_ptr(dev, t); |
| |
| - return (struct mt76_connac_txp_common *)(txwi + MT_TXD_SIZE); |
| + return (struct mt7996_txp *)(txwi + MT_TXD_SIZE); |
| } |
| |
| #endif |
| diff --git a/mt7996/mmio.c b/mt7996/mmio.c |
| index 2237f50a..d8a2c1a7 100644 |
| --- a/mt7996/mmio.c |
| +++ b/mt7996/mmio.c |
| @@ -318,7 +318,7 @@ struct mt7996_dev *mt7996_mmio_probe(struct device *pdev, |
| { |
| static const struct mt76_driver_ops drv_ops = { |
| /* txwi_size = txd size + txp size */ |
| - .txwi_size = MT_TXD_SIZE + sizeof(struct mt76_connac_fw_txp), |
| + .txwi_size = MT_TXD_SIZE + sizeof(struct mt7996_txp), |
| .drv_flags = MT_DRV_TXWI_NO_FREE | |
| MT_DRV_HW_MGMT_TXQ, |
| .survey_flags = SURVEY_INFO_TIME_TX | |
| -- |
| 2.25.1 |
| |