Commit 943e4fb9 authored by Ryder Lee's avatar Ryder Lee Committed by Felix Fietkau

wifi: mt76: mt7915: report tx retries/failed counts for non-WED path

Get missing tx retries/failed counts from txfree done events and report
them via mt7915_sta_statistics().
Co-developed-by: default avatarPeter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: default avatarPeter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 9a399407
...@@ -729,17 +729,15 @@ bool mt76_connac2_mac_add_txs_skb(struct mt76_dev *dev, struct mt76_wcid *wcid, ...@@ -729,17 +729,15 @@ bool mt76_connac2_mac_add_txs_skb(struct mt76_dev *dev, struct mt76_wcid *wcid,
skb = mt76_tx_status_skb_get(dev, wcid, pid, &list); skb = mt76_tx_status_skb_get(dev, wcid, pid, &list);
if (skb) { if (skb) {
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
bool noacked = !(info->flags & IEEE80211_TX_STAT_ACK);
if (!(le32_to_cpu(txs_data[0]) & MT_TXS0_ACK_ERROR_MASK)) if (!(le32_to_cpu(txs_data[0]) & MT_TXS0_ACK_ERROR_MASK))
info->flags |= IEEE80211_TX_STAT_ACK; info->flags |= IEEE80211_TX_STAT_ACK;
info->status.ampdu_len = 1; info->status.ampdu_len = 1;
info->status.ampdu_ack_len = !noacked; info->status.ampdu_ack_len =
!!(info->flags & IEEE80211_TX_STAT_ACK);
info->status.rates[0].idx = -1; info->status.rates[0].idx = -1;
wcid->stats.tx_failed += noacked;
mt76_connac2_mac_fill_txs(dev, wcid, txs_data); mt76_connac2_mac_fill_txs(dev, wcid, txs_data);
mt76_tx_status_skb_done(dev, skb, &list); mt76_tx_status_skb_done(dev, skb, &list);
} }
......
...@@ -581,6 +581,8 @@ void mt7915_mac_init(struct mt7915_dev *dev) ...@@ -581,6 +581,8 @@ void mt7915_mac_init(struct mt7915_dev *dev)
if (!is_mt7915(&dev->mt76)) if (!is_mt7915(&dev->mt76))
mt76_clear(dev, MT_MDP_DCR2, MT_MDP_DCR2_RX_TRANS_SHORT); mt76_clear(dev, MT_MDP_DCR2, MT_MDP_DCR2_RX_TRANS_SHORT);
else
mt76_clear(dev, MT_PLE_HOST_RPT0, MT_PLE_HOST_RPT0_TX_LATENCY);
/* enable hardware de-agg */ /* enable hardware de-agg */
mt76_set(dev, MT_MDP_DCR0, MT_MDP_DCR0_DAMSDU_EN); mt76_set(dev, MT_MDP_DCR0, MT_MDP_DCR0_DAMSDU_EN);
......
...@@ -951,6 +951,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len) ...@@ -951,6 +951,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
struct mt76_dev *mdev = &dev->mt76; struct mt76_dev *mdev = &dev->mt76;
struct mt76_txwi_cache *txwi; struct mt76_txwi_cache *txwi;
struct ieee80211_sta *sta = NULL; struct ieee80211_sta *sta = NULL;
struct mt76_wcid *wcid = NULL;
LIST_HEAD(free_list); LIST_HEAD(free_list);
void *end = data + len; void *end = data + len;
bool v3, wake = false; bool v3, wake = false;
...@@ -977,7 +978,6 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len) ...@@ -977,7 +978,6 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
info = le32_to_cpu(*cur_info); info = le32_to_cpu(*cur_info);
if (info & MT_TX_FREE_PAIR) { if (info & MT_TX_FREE_PAIR) {
struct mt7915_sta *msta; struct mt7915_sta *msta;
struct mt76_wcid *wcid;
u16 idx; u16 idx;
idx = FIELD_GET(MT_TX_FREE_WLAN_ID, info); idx = FIELD_GET(MT_TX_FREE_WLAN_ID, info);
...@@ -994,7 +994,25 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len) ...@@ -994,7 +994,25 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
continue; continue;
} }
if (v3 && (info & MT_TX_FREE_MPDU_HEADER)) if (!mtk_wed_device_active(&mdev->mmio.wed) && wcid) {
u32 tx_retries = 0, tx_failed = 0;
if (v3 && (info & MT_TX_FREE_MPDU_HEADER_V3)) {
tx_retries =
FIELD_GET(MT_TX_FREE_COUNT_V3, info) - 1;
tx_failed = tx_retries +
!!FIELD_GET(MT_TX_FREE_STAT_V3, info);
} else if (!v3 && (info & MT_TX_FREE_MPDU_HEADER)) {
tx_retries =
FIELD_GET(MT_TX_FREE_COUNT, info) - 1;
tx_failed = tx_retries +
!!FIELD_GET(MT_TX_FREE_STAT, info);
}
wcid->stats.tx_retries += tx_retries;
wcid->stats.tx_failed += tx_failed;
}
if (v3 && (info & MT_TX_FREE_MPDU_HEADER_V3))
continue; continue;
for (i = 0; i < 1 + v3; i++) { for (i = 0; i < 1 + v3; i++) {
......
...@@ -9,7 +9,12 @@ ...@@ -9,7 +9,12 @@
#define MT_TX_FREE_VER GENMASK(18, 16) #define MT_TX_FREE_VER GENMASK(18, 16)
#define MT_TX_FREE_MSDU_CNT_V0 GENMASK(6, 0) #define MT_TX_FREE_MSDU_CNT_V0 GENMASK(6, 0)
/* 0: success, others: dropped */ /* 0: success, others: dropped */
#define MT_TX_FREE_MPDU_HEADER BIT(30) #define MT_TX_FREE_COUNT GENMASK(12, 0)
#define MT_TX_FREE_COUNT_V3 GENMASK(27, 24)
#define MT_TX_FREE_STAT GENMASK(14, 13)
#define MT_TX_FREE_STAT_V3 GENMASK(29, 28)
#define MT_TX_FREE_MPDU_HEADER BIT(15)
#define MT_TX_FREE_MPDU_HEADER_V3 BIT(30)
#define MT_TX_FREE_MSDU_ID_V3 GENMASK(14, 0) #define MT_TX_FREE_MSDU_ID_V3 GENMASK(14, 0)
#define MT_TXS5_F0_FINAL_MPDU BIT(31) #define MT_TXS5_F0_FINAL_MPDU BIT(31)
......
...@@ -1045,12 +1045,6 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw, ...@@ -1045,12 +1045,6 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw,
sinfo->tx_packets = msta->wcid.stats.tx_packets; sinfo->tx_packets = msta->wcid.stats.tx_packets;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS);
sinfo->tx_failed = msta->wcid.stats.tx_failed;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED);
sinfo->tx_retries = msta->wcid.stats.tx_retries;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES);
if (mtk_wed_get_rx_capa(&phy->dev->mt76.mmio.wed)) { if (mtk_wed_get_rx_capa(&phy->dev->mt76.mmio.wed)) {
sinfo->rx_bytes = msta->wcid.stats.rx_bytes; sinfo->rx_bytes = msta->wcid.stats.rx_bytes;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64);
...@@ -1060,6 +1054,12 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw, ...@@ -1060,6 +1054,12 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw,
} }
} }
sinfo->tx_failed = msta->wcid.stats.tx_failed;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED);
sinfo->tx_retries = msta->wcid.stats.tx_retries;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES);
sinfo->ack_signal = (s8)msta->ack_signal; sinfo->ack_signal = (s8)msta->ack_signal;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL);
......
...@@ -145,6 +145,9 @@ enum offs_rev { ...@@ -145,6 +145,9 @@ enum offs_rev {
#define MT_PLE_BASE 0x820c0000 #define MT_PLE_BASE 0x820c0000
#define MT_PLE(ofs) (MT_PLE_BASE + (ofs)) #define MT_PLE(ofs) (MT_PLE_BASE + (ofs))
#define MT_PLE_HOST_RPT0 MT_PLE(0x030)
#define MT_PLE_HOST_RPT0_TX_LATENCY BIT(3)
#define MT_FL_Q_EMPTY MT_PLE(__OFFS(PLE_FL_Q_EMPTY)) #define MT_FL_Q_EMPTY MT_PLE(__OFFS(PLE_FL_Q_EMPTY))
#define MT_FL_Q0_CTRL MT_PLE(__OFFS(PLE_FL_Q_CTRL)) #define MT_FL_Q0_CTRL MT_PLE(__OFFS(PLE_FL_Q_CTRL))
#define MT_FL_Q2_CTRL MT_PLE(__OFFS(PLE_FL_Q_CTRL) + 0x8) #define MT_FL_Q2_CTRL MT_PLE(__OFFS(PLE_FL_Q_CTRL) + 0x8)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment