diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/debugfs_sta.c')
-rw-r--r-- | drivers/net/wireless/ath/ath10k/debugfs_sta.c | 74 |
1 files changed, 47 insertions, 27 deletions
diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c b/drivers/net/wireless/ath/ath10k/debugfs_sta.c index 67ef75b60567..9955fea0802a 100644 --- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c +++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c | |||
@@ -18,13 +18,34 @@ | |||
18 | #include "wmi-ops.h" | 18 | #include "wmi-ops.h" |
19 | #include "debug.h" | 19 | #include "debug.h" |
20 | 20 | ||
21 | void ath10k_sta_update_rx_duration(struct ath10k *ar, struct list_head *head) | 21 | static void ath10k_sta_update_extd_stats_rx_duration(struct ath10k *ar, |
22 | { struct ieee80211_sta *sta; | 22 | struct ath10k_fw_stats *stats) |
23 | { | ||
24 | struct ath10k_fw_extd_stats_peer *peer; | ||
25 | struct ieee80211_sta *sta; | ||
26 | struct ath10k_sta *arsta; | ||
27 | |||
28 | rcu_read_lock(); | ||
29 | list_for_each_entry(peer, &stats->peers_extd, list) { | ||
30 | sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr, | ||
31 | NULL); | ||
32 | if (!sta) | ||
33 | continue; | ||
34 | arsta = (struct ath10k_sta *)sta->drv_priv; | ||
35 | arsta->rx_duration += (u64)peer->rx_duration; | ||
36 | } | ||
37 | rcu_read_unlock(); | ||
38 | } | ||
39 | |||
40 | static void ath10k_sta_update_stats_rx_duration(struct ath10k *ar, | ||
41 | struct ath10k_fw_stats *stats) | ||
42 | { | ||
23 | struct ath10k_fw_stats_peer *peer; | 43 | struct ath10k_fw_stats_peer *peer; |
44 | struct ieee80211_sta *sta; | ||
24 | struct ath10k_sta *arsta; | 45 | struct ath10k_sta *arsta; |
25 | 46 | ||
26 | rcu_read_lock(); | 47 | rcu_read_lock(); |
27 | list_for_each_entry(peer, head, list) { | 48 | list_for_each_entry(peer, &stats->peers, list) { |
28 | sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr, | 49 | sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr, |
29 | NULL); | 50 | NULL); |
30 | if (!sta) | 51 | if (!sta) |
@@ -35,6 +56,29 @@ void ath10k_sta_update_rx_duration(struct ath10k *ar, struct list_head *head) | |||
35 | rcu_read_unlock(); | 56 | rcu_read_unlock(); |
36 | } | 57 | } |
37 | 58 | ||
59 | void ath10k_sta_update_rx_duration(struct ath10k *ar, | ||
60 | struct ath10k_fw_stats *stats) | ||
61 | { | ||
62 | if (stats->extended) | ||
63 | ath10k_sta_update_extd_stats_rx_duration(ar, stats); | ||
64 | else | ||
65 | ath10k_sta_update_stats_rx_duration(ar, stats); | ||
66 | } | ||
67 | |||
68 | void ath10k_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
69 | struct ieee80211_sta *sta, | ||
70 | struct station_info *sinfo) | ||
71 | { | ||
72 | struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; | ||
73 | struct ath10k *ar = arsta->arvif->ar; | ||
74 | |||
75 | if (!ath10k_peer_stats_enabled(ar)) | ||
76 | return; | ||
77 | |||
78 | sinfo->rx_duration = arsta->rx_duration; | ||
79 | sinfo->filled |= 1ULL << NL80211_STA_INFO_RX_DURATION; | ||
80 | } | ||
81 | |||
38 | static ssize_t ath10k_dbg_sta_read_aggr_mode(struct file *file, | 82 | static ssize_t ath10k_dbg_sta_read_aggr_mode(struct file *file, |
39 | char __user *user_buf, | 83 | char __user *user_buf, |
40 | size_t count, loff_t *ppos) | 84 | size_t count, loff_t *ppos) |
@@ -249,28 +293,6 @@ static const struct file_operations fops_delba = { | |||
249 | .llseek = default_llseek, | 293 | .llseek = default_llseek, |
250 | }; | 294 | }; |
251 | 295 | ||
252 | static ssize_t ath10k_dbg_sta_read_rx_duration(struct file *file, | ||
253 | char __user *user_buf, | ||
254 | size_t count, loff_t *ppos) | ||
255 | { | ||
256 | struct ieee80211_sta *sta = file->private_data; | ||
257 | struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; | ||
258 | char buf[100]; | ||
259 | int len = 0; | ||
260 | |||
261 | len = scnprintf(buf, sizeof(buf), | ||
262 | "%llu usecs\n", arsta->rx_duration); | ||
263 | |||
264 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
265 | } | ||
266 | |||
267 | static const struct file_operations fops_rx_duration = { | ||
268 | .read = ath10k_dbg_sta_read_rx_duration, | ||
269 | .open = simple_open, | ||
270 | .owner = THIS_MODULE, | ||
271 | .llseek = default_llseek, | ||
272 | }; | ||
273 | |||
274 | void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 296 | void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
275 | struct ieee80211_sta *sta, struct dentry *dir) | 297 | struct ieee80211_sta *sta, struct dentry *dir) |
276 | { | 298 | { |
@@ -279,6 +301,4 @@ void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
279 | debugfs_create_file("addba", S_IWUSR, dir, sta, &fops_addba); | 301 | debugfs_create_file("addba", S_IWUSR, dir, sta, &fops_addba); |
280 | debugfs_create_file("addba_resp", S_IWUSR, dir, sta, &fops_addba_resp); | 302 | debugfs_create_file("addba_resp", S_IWUSR, dir, sta, &fops_addba_resp); |
281 | debugfs_create_file("delba", S_IWUSR, dir, sta, &fops_delba); | 303 | debugfs_create_file("delba", S_IWUSR, dir, sta, &fops_delba); |
282 | debugfs_create_file("rx_duration", S_IRUGO, dir, sta, | ||
283 | &fops_rx_duration); | ||
284 | } | 304 | } |