mt76: mt7915: add tx stats gathered from tx-status callbacks
Add tx-mode (ofdma, ht, vht, HE) histogram, tx-ru-idx histogram, and tx-bandwidth histogram. Also add tx attempts and tx success counters. All of this is per-station. Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
95bc1457f6
commit
c4c2a37030
|
@ -761,6 +761,7 @@ enum mt76_phy_type {
|
|||
MT_PHY_TYPE_HE_EXT_SU,
|
||||
MT_PHY_TYPE_HE_TB,
|
||||
MT_PHY_TYPE_HE_MU,
|
||||
__MT_PHY_TYPE_HE_MAX,
|
||||
};
|
||||
|
||||
#define CCK_RATE(_idx, _rate) { \
|
||||
|
|
|
@ -1346,7 +1346,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, struct sk_buff *skb)
|
|||
|
||||
static bool
|
||||
mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid,
|
||||
__le32 *txs_data)
|
||||
__le32 *txs_data, struct mt7915_sta_stats *stats)
|
||||
{
|
||||
struct ieee80211_supported_band *sband;
|
||||
struct mt76_dev *mdev = &dev->mt76;
|
||||
|
@ -1356,7 +1356,7 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid,
|
|||
struct rate_info rate = {};
|
||||
struct sk_buff *skb;
|
||||
bool cck = false;
|
||||
u32 txrate, txs;
|
||||
u32 txrate, txs, mode;
|
||||
|
||||
mt76_tx_status_lock(mdev, &list);
|
||||
skb = mt76_tx_status_skb_get(mdev, wcid, pid, &list);
|
||||
|
@ -1375,15 +1375,18 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid,
|
|||
|
||||
info->status.rates[0].idx = -1;
|
||||
|
||||
if (!wcid->sta)
|
||||
goto out;
|
||||
|
||||
txrate = FIELD_GET(MT_TXS0_TX_RATE, txs);
|
||||
|
||||
rate.mcs = FIELD_GET(MT_TX_RATE_IDX, txrate);
|
||||
rate.nss = FIELD_GET(MT_TX_RATE_NSS, txrate) + 1;
|
||||
|
||||
switch (FIELD_GET(MT_TX_RATE_MODE, txrate)) {
|
||||
if (rate.nss - 1 < ARRAY_SIZE(stats->tx_nss))
|
||||
stats->tx_nss[rate.nss - 1]++;
|
||||
if (rate.mcs < ARRAY_SIZE(stats->tx_mcs))
|
||||
stats->tx_mcs[rate.mcs]++;
|
||||
|
||||
mode = FIELD_GET(MT_TX_RATE_MODE, txrate);
|
||||
switch (mode) {
|
||||
case MT_PHY_TYPE_CCK:
|
||||
cck = true;
|
||||
fallthrough;
|
||||
|
@ -1431,18 +1434,24 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid,
|
|||
goto out;
|
||||
}
|
||||
|
||||
stats->tx_mode[mode]++;
|
||||
|
||||
switch (FIELD_GET(MT_TXS0_BW, txs)) {
|
||||
case IEEE80211_STA_RX_BW_160:
|
||||
rate.bw = RATE_INFO_BW_160;
|
||||
stats->tx_bw[3]++;
|
||||
break;
|
||||
case IEEE80211_STA_RX_BW_80:
|
||||
rate.bw = RATE_INFO_BW_80;
|
||||
stats->tx_bw[2]++;
|
||||
break;
|
||||
case IEEE80211_STA_RX_BW_40:
|
||||
rate.bw = RATE_INFO_BW_40;
|
||||
stats->tx_bw[1]++;
|
||||
break;
|
||||
default:
|
||||
rate.bw = RATE_INFO_BW_20;
|
||||
stats->tx_bw[0]++;
|
||||
break;
|
||||
}
|
||||
wcid->rate = rate;
|
||||
|
@ -1487,12 +1496,13 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data)
|
|||
if (!wcid)
|
||||
goto out;
|
||||
|
||||
mt7915_mac_add_txs_skb(dev, wcid, pid, txs_data);
|
||||
msta = container_of(wcid, struct mt7915_sta, wcid);
|
||||
|
||||
mt7915_mac_add_txs_skb(dev, wcid, pid, txs_data, &msta->stats);
|
||||
|
||||
if (!wcid->sta)
|
||||
goto out;
|
||||
|
||||
msta = container_of(wcid, struct mt7915_sta, wcid);
|
||||
spin_lock_bh(&dev->sta_poll_lock);
|
||||
if (list_empty(&msta->poll_list))
|
||||
list_add_tail(&msta->poll_list, &dev->sta_poll_list);
|
||||
|
|
|
@ -62,6 +62,13 @@ enum mt7915_rxq_id {
|
|||
MT7915_RXQ_MCU_WA_EXT,
|
||||
};
|
||||
|
||||
struct mt7915_sta_stats {
|
||||
unsigned long tx_mode[__MT_PHY_TYPE_HE_MAX]; /* See mt76_phy_type */
|
||||
unsigned long tx_bw[4]; /* 20, 40, 80, 160 */
|
||||
unsigned long tx_nss[4]; /* 1, 2, 3, 4 */
|
||||
unsigned long tx_mcs[16]; /* mcs idx */
|
||||
};
|
||||
|
||||
struct mt7915_sta_key_conf {
|
||||
s8 keyidx;
|
||||
u8 key[16];
|
||||
|
@ -80,8 +87,11 @@ struct mt7915_sta {
|
|||
unsigned long jiffies;
|
||||
unsigned long ampdu_state;
|
||||
|
||||
struct mt7915_sta_stats stats;
|
||||
|
||||
struct mt7915_sta_key_conf bip;
|
||||
};
|
||||
|
||||
struct mt7915_vif {
|
||||
u16 idx;
|
||||
u8 omac_idx;
|
||||
|
@ -101,6 +111,7 @@ struct mib_stats {
|
|||
u32 rts_cnt;
|
||||
u32 rts_retries_cnt;
|
||||
u32 ba_miss_cnt;
|
||||
/* Add more stats here, updated from mac_update_stats */
|
||||
};
|
||||
|
||||
struct mt7915_hif {
|
||||
|
|
Loading…
Reference in New Issue