Commit 81811173 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: mt7915: run mt7915_get_et_stats holding mt76 mutex

Since it can run in parallel with mac_work, hold mutex lock in
mt7915_get_et_stats. Moreover update mib counters running
mt7915_get_et_stats.
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 54ae98ff
...@@ -201,7 +201,10 @@ mt7915_tx_stats_show(struct seq_file *file, void *data) ...@@ -201,7 +201,10 @@ mt7915_tx_stats_show(struct seq_file *file, void *data)
struct mt7915_dev *dev = phy->dev; struct mt7915_dev *dev = phy->dev;
int stat[8], i, n; int stat[8], i, n;
mutex_lock(&dev->mt76.mutex);
mt7915_ampdu_stat_read_phy(phy, file); mt7915_ampdu_stat_read_phy(phy, file);
mt7915_mac_update_stats(phy);
mt7915_txbf_stat_read_phy(phy, file); mt7915_txbf_stat_read_phy(phy, file);
/* Tx amsdu info */ /* Tx amsdu info */
...@@ -220,6 +223,8 @@ mt7915_tx_stats_show(struct seq_file *file, void *data) ...@@ -220,6 +223,8 @@ mt7915_tx_stats_show(struct seq_file *file, void *data)
seq_puts(file, "\n"); seq_puts(file, "\n");
} }
mutex_unlock(&dev->mt76.mutex);
return 0; return 0;
} }
......
...@@ -1918,8 +1918,7 @@ void mt7915_mac_reset_work(struct work_struct *work) ...@@ -1918,8 +1918,7 @@ void mt7915_mac_reset_work(struct work_struct *work)
MT7915_WATCHDOG_TIME); MT7915_WATCHDOG_TIME);
} }
static void void mt7915_mac_update_stats(struct mt7915_phy *phy)
mt7915_mac_update_stats(struct mt7915_phy *phy)
{ {
struct mt7915_dev *dev = phy->dev; struct mt7915_dev *dev = phy->dev;
struct mib_stats *mib = &phy->mib; struct mib_stats *mib = &phy->mib;
......
...@@ -1215,6 +1215,10 @@ void mt7915_get_et_stats(struct ieee80211_hw *hw, ...@@ -1215,6 +1215,10 @@ void mt7915_get_et_stats(struct ieee80211_hw *hw,
bool ext_phy = phy != &dev->phy; bool ext_phy = phy != &dev->phy;
int i, n, ei = 0; int i, n, ei = 0;
mutex_lock(&dev->mt76.mutex);
mt7915_mac_update_stats(phy);
data[ei++] = mib->tx_ampdu_cnt; data[ei++] = mib->tx_ampdu_cnt;
data[ei++] = mib->tx_stop_q_empty_cnt; data[ei++] = mib->tx_stop_q_empty_cnt;
data[ei++] = mib->tx_mpdu_attempts_cnt; data[ei++] = mib->tx_mpdu_attempts_cnt;
...@@ -1278,6 +1282,8 @@ void mt7915_get_et_stats(struct ieee80211_hw *hw, ...@@ -1278,6 +1282,8 @@ void mt7915_get_et_stats(struct ieee80211_hw *hw,
wi.initial_stat_idx = ei; wi.initial_stat_idx = ei;
ieee80211_iterate_stations_atomic(hw, mt7915_ethtool_worker, &wi); ieee80211_iterate_stations_atomic(hw, mt7915_ethtool_worker, &wi);
mutex_unlock(&dev->mt76.mutex);
if (wi.sta_count == 0) if (wi.sta_count == 0)
return; return;
......
...@@ -492,6 +492,7 @@ void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, ...@@ -492,6 +492,7 @@ void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
void mt7915_mac_work(struct work_struct *work); void mt7915_mac_work(struct work_struct *work);
void mt7915_mac_reset_work(struct work_struct *work); void mt7915_mac_reset_work(struct work_struct *work);
void mt7915_mac_sta_rc_work(struct work_struct *work); void mt7915_mac_sta_rc_work(struct work_struct *work);
void mt7915_mac_update_stats(struct mt7915_phy *phy);
int mt7915_mmio_init(struct mt76_dev *mdev, void __iomem *mem_base, int irq); int mt7915_mmio_init(struct mt76_dev *mdev, void __iomem *mem_base, int irq);
void mt7915_mac_twt_teardown_flow(struct mt7915_dev *dev, void mt7915_mac_twt_teardown_flow(struct mt7915_dev *dev,
struct mt7915_sta *msta, struct mt7915_sta *msta,
......
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