aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/sta_info.c
diff options
context:
space:
mode:
authorMatti Gottlieb <matti.gottlieb@intel.com>2013-11-18 12:06:45 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-12-02 05:51:50 -0500
commitad38bfc916da6aee9160bfa5335aed8d6c190e39 (patch)
treebc00170187f5e2036a8c804f546c32d94bdee349 /net/mac80211/sta_info.c
parent1d940aaab881b0ee62557ffbaad877ac5a1b51db (diff)
mac80211: Tx frame latency statistics
Measure TX latency and jitter statistics per station per TID. These Measurements are disabled by default and can be enabled via debugfs. Features included for each station's TID: 1. Keep count of the maximum and average latency of Tx frames. 2. Keep track of many frames arrived in a specific time range (need to enable through debugfs and configure the bins ranges) Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/sta_info.c')
-rw-r--r--net/mac80211/sta_info.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 7b69d4c3db55..8ed97f76c3cf 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -266,9 +266,17 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
266 */ 266 */
267void sta_info_free(struct ieee80211_local *local, struct sta_info *sta) 267void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
268{ 268{
269 int i;
270
269 if (sta->rate_ctrl) 271 if (sta->rate_ctrl)
270 rate_control_free_sta(sta); 272 rate_control_free_sta(sta);
271 273
274 if (sta->tx_lat) {
275 for (i = 0; i < IEEE80211_NUM_TIDS; i++)
276 kfree(sta->tx_lat[i].bins);
277 kfree(sta->tx_lat);
278 }
279
272 sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr); 280 sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
273 281
274 kfree(sta); 282 kfree(sta);
@@ -333,6 +341,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
333 struct ieee80211_local *local = sdata->local; 341 struct ieee80211_local *local = sdata->local;
334 struct sta_info *sta; 342 struct sta_info *sta;
335 struct timespec uptime; 343 struct timespec uptime;
344 struct ieee80211_tx_latency_bin_ranges *tx_latency;
336 int i; 345 int i;
337 346
338 sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp); 347 sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp);
@@ -410,6 +419,31 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
410 } 419 }
411 } 420 }
412 421
422 rcu_read_lock();
423
424 tx_latency = rcu_dereference(local->tx_latency);
425 /* init stations Tx latency statistics && TID bins */
426 if (tx_latency)
427 sta->tx_lat = kzalloc(IEEE80211_NUM_TIDS *
428 sizeof(struct ieee80211_tx_latency_stat),
429 GFP_ATOMIC);
430
431 /*
432 * if Tx latency and bins are enabled and the previous allocation
433 * succeeded
434 */
435 if (tx_latency && tx_latency->n_ranges && sta->tx_lat)
436 for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
437 /* size of bins is size of the ranges +1 */
438 sta->tx_lat[i].bin_count =
439 tx_latency->n_ranges + 1;
440 sta->tx_lat[i].bins = kcalloc(sta->tx_lat[i].bin_count,
441 sizeof(u32),
442 GFP_ATOMIC);
443 }
444
445 rcu_read_unlock();
446
413 sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr); 447 sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);
414 448
415 return sta; 449 return sta;