blob: a40e74fa7bd85c5ceacc10988256d3a2b3859328 [file] [log] [blame]
developerc9233442023-04-04 06:06:17 +08001From a3b35051c293bf0f138ec4d10098da5a71f69fc5 Mon Sep 17 00:00:00 2001
developer33554a22023-01-30 14:11:29 +08002From: Peter Chiu <chui-hao.chiu@mediatek.com>
3Date: Wed, 18 Jan 2023 11:50:38 +0800
developerc9233442023-04-04 06:06:17 +08004Subject: [PATCH 3009/3012] wifi: mt76: mt7915: enable PPDU-TxS to host when
developer33554a22023-01-30 14:11:29 +08005 wed enable
6
7Calculate tx bytes and tx retries from PPDU-TxS
8---
9 mt76_connac_mac.c | 2 --
10 mt7915/init.c | 6 ++++++
11 mt7915/mmio.c | 21 ---------------------
12 tx.c | 6 ++++++
13 4 files changed, 12 insertions(+), 23 deletions(-)
14
15diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
developer4f0d84b2023-03-03 14:21:44 +080016index abcb9a27..5a5861a8 100644
developer33554a22023-01-30 14:11:29 +080017--- a/mt76_connac_mac.c
18+++ b/mt76_connac_mac.c
19@@ -490,8 +490,6 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
20 mt76_connac_lmac_mapping(skb_get_queue_mapping(skb));
21
22 /* counting non-offloading skbs */
23- wcid->stats.tx_bytes += skb->len;
24-
25 if (is_mt7915(dev))
26 wcid->stats.tx_packets++;
27 }
28diff --git a/mt7915/init.c b/mt7915/init.c
developerc9233442023-04-04 06:06:17 +080029index 3f07aa11..0b852286 100644
developer33554a22023-01-30 14:11:29 +080030--- a/mt7915/init.c
31+++ b/mt7915/init.c
developer4f0d84b2023-03-03 14:21:44 +080032@@ -503,6 +503,12 @@ mt7915_mac_init_band(struct mt7915_dev *dev, u8 band)
developer33554a22023-01-30 14:11:29 +080033 set = FIELD_PREP(MT_WTBLOFF_TOP_RSCR_RCPI_MODE, 0) |
34 FIELD_PREP(MT_WTBLOFF_TOP_RSCR_RCPI_PARAM, 0x3);
35 mt76_rmw(dev, MT_WTBLOFF_TOP_RSCR(band), mask, set);
36+
37+ /* MT_TXD5_TX_STATUS_HOST (MPDU format) has higher priority than
38+ * MT_AGG_ACR_PPDU_TXS2H (PPDU format) even though ACR bit is set.
39+ */
40+ if (mtk_wed_device_active(&dev->mt76.mmio.wed))
41+ mt76_set(dev, MT_AGG_ACR4(band), MT_AGG_ACR_PPDU_TXS2H);
42 }
43
44 static void
45diff --git a/mt7915/mmio.c b/mt7915/mmio.c
developerc9233442023-04-04 06:06:17 +080046index fc9aadb1..65ee2afa 100644
developer33554a22023-01-30 14:11:29 +080047--- a/mt7915/mmio.c
48+++ b/mt7915/mmio.c
49@@ -551,7 +551,6 @@ static u32 mt7915_rmw(struct mt76_dev *mdev, u32 offset, u32 mask, u32 val)
50 static int mt7915_mmio_wed_offload_enable(struct mtk_wed_device *wed)
51 {
52 struct mt7915_dev *dev;
53- struct mt7915_phy *phy;
54 int ret;
55
56 dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed);
57@@ -565,38 +564,18 @@ static int mt7915_mmio_wed_offload_enable(struct mtk_wed_device *wed)
58 if (!ret)
59 return -EAGAIN;
60
61- phy = &dev->phy;
62- mt76_set(dev, MT_AGG_ACR4(phy->mt76->band_idx), MT_AGG_ACR_PPDU_TXS2H);
63-
64- phy = dev->mt76.phys[MT_BAND1] ? dev->mt76.phys[MT_BAND1]->priv : NULL;
65- if (phy)
66- mt76_set(dev, MT_AGG_ACR4(phy->mt76->band_idx),
67- MT_AGG_ACR_PPDU_TXS2H);
68-
69 return 0;
70 }
71
72 static void mt7915_mmio_wed_offload_disable(struct mtk_wed_device *wed)
73 {
74 struct mt7915_dev *dev;
75- struct mt7915_phy *phy;
76
77 dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed);
78
79 spin_lock_bh(&dev->mt76.token_lock);
80 dev->mt76.token_size = wed->wlan.token_start;//MT7915_TOKEN_SIZE
81 spin_unlock_bh(&dev->mt76.token_lock);
82-
83- /* MT_TXD5_TX_STATUS_HOST (MPDU format) has higher priority than
84- * MT_AGG_ACR_PPDU_TXS2H (PPDU format) even though ACR bit is set.
85- */
86- phy = &dev->phy;
87- mt76_clear(dev, MT_AGG_ACR4(phy->mt76->band_idx), MT_AGG_ACR_PPDU_TXS2H);
88-
89- phy = dev->mt76.phys[MT_BAND1] ? dev->mt76.phys[MT_BAND1]->priv : NULL;
90- if (phy)
91- mt76_clear(dev, MT_AGG_ACR4(phy->mt76->band_idx),
92- MT_AGG_ACR_PPDU_TXS2H);
93 }
94
95 static void mt7915_mmio_wed_release_rx_buf(struct mtk_wed_device *wed)
96diff --git a/tx.c b/tx.c
developerc9233442023-04-04 06:06:17 +080097index 04b6f2e7..6b590b27 100644
developer33554a22023-01-30 14:11:29 +080098--- a/tx.c
99+++ b/tx.c
developerc9233442023-04-04 06:06:17 +0800100@@ -115,6 +115,7 @@ mt76_tx_status_skb_add(struct mt76_dev *dev, struct mt76_wcid *wcid,
developer33554a22023-01-30 14:11:29 +0800101 struct sk_buff *skb)
102 {
103 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
104+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
105 struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
106 int pid;
107
developerc9233442023-04-04 06:06:17 +0800108@@ -126,6 +127,11 @@ mt76_tx_status_skb_add(struct mt76_dev *dev, struct mt76_wcid *wcid,
developer33554a22023-01-30 14:11:29 +0800109 if (info->flags & IEEE80211_TX_CTL_NO_ACK)
110 return MT_PACKET_ID_NO_ACK;
111
112+ if (mtk_wed_device_active(&dev->mmio.wed) &&
113+ ((info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) ||
114+ ieee80211_is_data(hdr->frame_control)))
115+ return MT_PACKET_ID_WED;
116+
117 if (!(info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS |
118 IEEE80211_TX_CTL_RATE_CTRL_PROBE)))
119 return MT_PACKET_ID_NO_SKB;
120--
developerc9233442023-04-04 06:06:17 +08001212.39.0
developer33554a22023-01-30 14:11:29 +0800122