aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorSujith Manoharan <c_manoha@qca.qualcomm.com>2013-08-01 11:27:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-08-01 15:52:05 -0400
commite3d5291436ff9efeeb968459724af5332305dded (patch)
tree6218c3359d1633bd8355d591bba39f2a0845788a /drivers/net
parent37133002f5263153e71a509191fbb8951c1de3e0 (diff)
ath9k: Add statistics for antenna diversity
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath9k/antenna.c18
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c85
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.h20
3 files changed, 95 insertions, 28 deletions
diff --git a/drivers/net/wireless/ath/ath9k/antenna.c b/drivers/net/wireless/ath/ath9k/antenna.c
index ea4ee08cddf2..291ca019d37b 100644
--- a/drivers/net/wireless/ath/ath9k/antenna.c
+++ b/drivers/net/wireless/ath/ath9k/antenna.c
@@ -695,15 +695,18 @@ void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs)
695 antcomb->main_total_rssi += main_rssi; 695 antcomb->main_total_rssi += main_rssi;
696 antcomb->alt_total_rssi += alt_rssi; 696 antcomb->alt_total_rssi += alt_rssi;
697 697
698 if (main_ant_conf == rx_ant_conf) { 698 if (main_ant_conf == rx_ant_conf)
699 antcomb->main_recv_cnt++; 699 antcomb->main_recv_cnt++;
700 ANT_STAT_INC(ANT_MAIN, recv_cnt); 700 else
701 ANT_LNA_INC(ANT_MAIN, rx_ant_conf);
702 } else {
703 antcomb->alt_recv_cnt++; 701 antcomb->alt_recv_cnt++;
704 ANT_STAT_INC(ANT_ALT, recv_cnt); 702 }
705 ANT_LNA_INC(ANT_ALT, rx_ant_conf); 703
706 } 704 if (main_ant_conf == rx_ant_conf) {
705 ANT_STAT_INC(ANT_MAIN, recv_cnt);
706 ANT_LNA_INC(ANT_MAIN, rx_ant_conf);
707 } else {
708 ANT_STAT_INC(ANT_ALT, recv_cnt);
709 ANT_LNA_INC(ANT_ALT, rx_ant_conf);
707 } 710 }
708 711
709 /* Short scan check */ 712 /* Short scan check */
@@ -782,6 +785,7 @@ void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs)
782div_comb_done: 785div_comb_done:
783 ath_ant_div_conf_fast_divbias(&div_ant_conf, antcomb, alt_ratio); 786 ath_ant_div_conf_fast_divbias(&div_ant_conf, antcomb, alt_ratio);
784 ath9k_hw_antdiv_comb_conf_set(sc->sc_ah, &div_ant_conf); 787 ath9k_hw_antdiv_comb_conf_set(sc->sc_ah, &div_ant_conf);
788 ath9k_debug_stat_ant(sc, &div_ant_conf, main_rssi_avg, alt_rssi_avg);
785 789
786 antcomb->scan_start_time = jiffies; 790 antcomb->scan_start_time = jiffies;
787 antcomb->total_pkt_count = 0; 791 antcomb->total_pkt_count = 0;
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index d8764ae3371e..e744d9747697 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -321,6 +321,20 @@ static const struct file_operations fops_ant_diversity = {
321 .llseek = default_llseek, 321 .llseek = default_llseek,
322}; 322};
323 323
324void ath9k_debug_stat_ant(struct ath_softc *sc,
325 struct ath_hw_antcomb_conf *div_ant_conf,
326 int main_rssi_avg, int alt_rssi_avg)
327{
328 struct ath_antenna_stats *as_main = &sc->debug.stats.ant_stats[ANT_MAIN];
329 struct ath_antenna_stats *as_alt = &sc->debug.stats.ant_stats[ANT_ALT];
330
331 as_main->lna_attempt_cnt[div_ant_conf->main_lna_conf]++;
332 as_alt->lna_attempt_cnt[div_ant_conf->alt_lna_conf]++;
333
334 as_main->rssi_avg = main_rssi_avg;
335 as_alt->rssi_avg = alt_rssi_avg;
336}
337
324static ssize_t read_file_antenna_diversity(struct file *file, 338static ssize_t read_file_antenna_diversity(struct file *file,
325 char __user *user_buf, 339 char __user *user_buf,
326 size_t count, loff_t *ppos) 340 size_t count, loff_t *ppos)
@@ -330,9 +344,14 @@ static ssize_t read_file_antenna_diversity(struct file *file,
330 struct ath9k_hw_capabilities *pCap = &ah->caps; 344 struct ath9k_hw_capabilities *pCap = &ah->caps;
331 struct ath_antenna_stats *as_main = &sc->debug.stats.ant_stats[ANT_MAIN]; 345 struct ath_antenna_stats *as_main = &sc->debug.stats.ant_stats[ANT_MAIN];
332 struct ath_antenna_stats *as_alt = &sc->debug.stats.ant_stats[ANT_ALT]; 346 struct ath_antenna_stats *as_alt = &sc->debug.stats.ant_stats[ANT_ALT];
347 struct ath_hw_antcomb_conf div_ant_conf;
333 unsigned int len = 0, size = 1024; 348 unsigned int len = 0, size = 1024;
334 ssize_t retval = 0; 349 ssize_t retval = 0;
335 char *buf; 350 char *buf;
351 char *lna_conf_str[4] = {"LNA1_MINUS_LNA2",
352 "LNA2",
353 "LNA1",
354 "LNA1_PLUS_LNA2"};
336 355
337 buf = kzalloc(size, GFP_KERNEL); 356 buf = kzalloc(size, GFP_KERNEL);
338 if (buf == NULL) 357 if (buf == NULL)
@@ -344,28 +363,66 @@ static ssize_t read_file_antenna_diversity(struct file *file,
344 goto exit; 363 goto exit;
345 } 364 }
346 365
366 ath9k_ps_wakeup(sc);
367 ath9k_hw_antdiv_comb_conf_get(ah, &div_ant_conf);
368 len += snprintf(buf + len, size - len, "Current MAIN config : %s\n",
369 lna_conf_str[div_ant_conf.main_lna_conf]);
370 len += snprintf(buf + len, size - len, "Current ALT config : %s\n",
371 lna_conf_str[div_ant_conf.alt_lna_conf]);
372 len += snprintf(buf + len, size - len, "Average MAIN RSSI : %d\n",
373 as_main->rssi_avg);
374 len += snprintf(buf + len, size - len, "Average ALT RSSI : %d\n\n",
375 as_alt->rssi_avg);
376 ath9k_ps_restore(sc);
377
378 len += snprintf(buf + len, size - len, "Packet Receive Cnt:\n");
379 len += snprintf(buf + len, size - len, "-------------------\n");
380
347 len += snprintf(buf + len, size - len, "%30s%15s\n", 381 len += snprintf(buf + len, size - len, "%30s%15s\n",
348 "MAIN", "ALT"); 382 "MAIN", "ALT");
349 len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", 383 len += snprintf(buf + len, size - len, "%-14s:%15d%15d\n",
350 "RECV CNT", 384 "TOTAL COUNT",
351 as_main->recv_cnt, 385 as_main->recv_cnt,
352 as_alt->recv_cnt); 386 as_alt->recv_cnt);
353 len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", 387 len += snprintf(buf + len, size - len, "%-14s:%15d%15d\n",
388 "LNA1",
389 as_main->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA1],
390 as_alt->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA1]);
391 len += snprintf(buf + len, size - len, "%-14s:%15d%15d\n",
392 "LNA2",
393 as_main->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA2],
394 as_alt->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA2]);
395 len += snprintf(buf + len, size - len, "%-14s:%15d%15d\n",
396 "LNA1 + LNA2",
397 as_main->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2],
398 as_alt->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2]);
399 len += snprintf(buf + len, size - len, "%-14s:%15d%15d\n",
400 "LNA1 - LNA2",
401 as_main->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2],
402 as_alt->lna_recv_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2]);
403
404 len += snprintf(buf + len, size - len, "\nLNA Config Attempts:\n");
405 len += snprintf(buf + len, size - len, "--------------------\n");
406
407 len += snprintf(buf + len, size - len, "%30s%15s\n",
408 "MAIN", "ALT");
409 len += snprintf(buf + len, size - len, "%-14s:%15d%15d\n",
354 "LNA1", 410 "LNA1",
355 as_main->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1], 411 as_main->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA1],
356 as_alt->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1]); 412 as_alt->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA1]);
357 len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", 413 len += snprintf(buf + len, size - len, "%-14s:%15d%15d\n",
358 "LNA2", 414 "LNA2",
359 as_main->lna_config_cnt[ATH_ANT_DIV_COMB_LNA2], 415 as_main->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA2],
360 as_alt->lna_config_cnt[ATH_ANT_DIV_COMB_LNA2]); 416 as_alt->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA2]);
361 len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", 417 len += snprintf(buf + len, size - len, "%-14s:%15d%15d\n",
362 "LNA1 + LNA2", 418 "LNA1 + LNA2",
363 as_main->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2], 419 as_main->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2],
364 as_alt->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2]); 420 as_alt->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2]);
365 len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", 421 len += snprintf(buf + len, size - len, "%-14s:%15d%15d\n",
366 "LNA1 - LNA2", 422 "LNA1 - LNA2",
367 as_main->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2], 423 as_main->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2],
368 as_alt->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2]); 424 as_alt->lna_attempt_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2]);
425
369exit: 426exit:
370 if (len > size) 427 if (len > size)
371 len = size; 428 len = size;
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index a879e451dc46..01c5c6a22e1b 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -29,7 +29,7 @@ struct fft_sample_tlv;
29#define TX_STAT_INC(q, c) sc->debug.stats.txstats[q].c++ 29#define TX_STAT_INC(q, c) sc->debug.stats.txstats[q].c++
30#define RESET_STAT_INC(sc, type) sc->debug.stats.reset[type]++ 30#define RESET_STAT_INC(sc, type) sc->debug.stats.reset[type]++
31#define ANT_STAT_INC(i, c) sc->debug.stats.ant_stats[i].c++ 31#define ANT_STAT_INC(i, c) sc->debug.stats.ant_stats[i].c++
32#define ANT_LNA_INC(i, c) sc->debug.stats.ant_stats[i].lna_config_cnt[c]++; 32#define ANT_LNA_INC(i, c) sc->debug.stats.ant_stats[i].lna_recv_cnt[c]++;
33#else 33#else
34#define TX_STAT_INC(q, c) do { } while (0) 34#define TX_STAT_INC(q, c) do { } while (0)
35#define RESET_STAT_INC(sc, type) do { } while (0) 35#define RESET_STAT_INC(sc, type) do { } while (0)
@@ -252,7 +252,9 @@ struct ath_rx_stats {
252 252
253struct ath_antenna_stats { 253struct ath_antenna_stats {
254 u32 recv_cnt; 254 u32 recv_cnt;
255 u32 lna_config_cnt[4]; 255 u32 rssi_avg;
256 u32 lna_recv_cnt[4];
257 u32 lna_attempt_cnt[4];
256}; 258};
257 259
258struct ath_stats { 260struct ath_stats {
@@ -294,10 +296,11 @@ void ath9k_sta_remove_debugfs(struct ieee80211_hw *hw,
294 struct ieee80211_vif *vif, 296 struct ieee80211_vif *vif,
295 struct ieee80211_sta *sta, 297 struct ieee80211_sta *sta,
296 struct dentry *dir); 298 struct dentry *dir);
297
298void ath_debug_send_fft_sample(struct ath_softc *sc, 299void ath_debug_send_fft_sample(struct ath_softc *sc,
299 struct fft_sample_tlv *fft_sample); 300 struct fft_sample_tlv *fft_sample);
300 301void ath9k_debug_stat_ant(struct ath_softc *sc,
302 struct ath_hw_antcomb_conf *div_ant_conf,
303 int main_rssi_avg, int alt_rssi_avg);
301#else 304#else
302 305
303#define RX_STAT_INC(c) /* NOP */ 306#define RX_STAT_INC(c) /* NOP */
@@ -310,12 +313,10 @@ static inline int ath9k_init_debug(struct ath_hw *ah)
310static inline void ath9k_deinit_debug(struct ath_softc *sc) 313static inline void ath9k_deinit_debug(struct ath_softc *sc)
311{ 314{
312} 315}
313
314static inline void ath_debug_stat_interrupt(struct ath_softc *sc, 316static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
315 enum ath9k_int status) 317 enum ath9k_int status)
316{ 318{
317} 319}
318
319static inline void ath_debug_stat_tx(struct ath_softc *sc, 320static inline void ath_debug_stat_tx(struct ath_softc *sc,
320 struct ath_buf *bf, 321 struct ath_buf *bf,
321 struct ath_tx_status *ts, 322 struct ath_tx_status *ts,
@@ -323,11 +324,16 @@ static inline void ath_debug_stat_tx(struct ath_softc *sc,
323 unsigned int flags) 324 unsigned int flags)
324{ 325{
325} 326}
326
327static inline void ath_debug_stat_rx(struct ath_softc *sc, 327static inline void ath_debug_stat_rx(struct ath_softc *sc,
328 struct ath_rx_status *rs) 328 struct ath_rx_status *rs)
329{ 329{
330} 330}
331static inline void ath9k_debug_stat_ant(struct ath_softc *sc,
332 struct ath_hw_antcomb_conf *div_ant_conf,
333 int main_rssi_avg, int alt_rssi_avg)
334{
335
336}
331 337
332#endif /* CONFIG_ATH9K_DEBUGFS */ 338#endif /* CONFIG_ATH9K_DEBUGFS */
333 339