mt76: mt7921: add sta stats accounting in mt7921_mac_add_txs_skb
This is a preliminary patch to add ethtool stats to mt7921 driver. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
6eb58ceaf2
commit
9e893d28ce
@ -951,14 +951,16 @@ static bool
|
||||
mt7921_mac_add_txs_skb(struct mt7921_dev *dev, struct mt76_wcid *wcid, int pid,
|
||||
__le32 *txs_data)
|
||||
{
|
||||
struct mt7921_sta *msta = container_of(wcid, struct mt7921_sta, wcid);
|
||||
struct mt76_sta_stats *stats = &msta->stats;
|
||||
struct ieee80211_supported_band *sband;
|
||||
struct mt76_dev *mdev = &dev->mt76;
|
||||
struct ieee80211_tx_info *info;
|
||||
struct rate_info rate = {};
|
||||
struct sk_buff_head list;
|
||||
u32 txrate, txs, mode;
|
||||
struct sk_buff *skb;
|
||||
bool cck = false;
|
||||
u32 txrate, txs;
|
||||
|
||||
mt76_tx_status_lock(mdev, &list);
|
||||
skb = mt76_tx_status_skb_get(mdev, wcid, pid, &list);
|
||||
@ -984,7 +986,13 @@ mt7921_mac_add_txs_skb(struct mt7921_dev *dev, struct mt76_wcid *wcid, int pid,
|
||||
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;
|
||||
@ -1027,19 +1035,24 @@ mt7921_mac_add_txs_skb(struct mt7921_dev *dev, struct mt76_wcid *wcid, int pid,
|
||||
default:
|
||||
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;
|
||||
|
@ -104,6 +104,7 @@ struct mt7921_sta {
|
||||
|
||||
unsigned long last_txs;
|
||||
unsigned long ampdu_state;
|
||||
struct mt76_sta_stats stats;
|
||||
|
||||
struct mt7921_sta_key_conf bip;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user