aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-11-03 20:07:04 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-11 17:09:04 -0500
commit3d536acf45ba65acb15fc65bf46f8d6c7ad6c463 (patch)
treebd07619f8a4c9f1a926abcbc203fadc5962c13fa /drivers
parent30cbd42265546a3efa146d4eb3456165325c83a7 (diff)
ath9k: move struct ath_ani to common area
This can be shared between ath9k and ath9k_htc. It will also help with sharing routine helpers on the RX path. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath.h12
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h11
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c56
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c3
4 files changed, 42 insertions, 40 deletions
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index 5e19a7330d39..b3c8ee08bb7c 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -23,6 +23,16 @@
23 23
24static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 24static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
25 25
26struct ath_ani {
27 bool caldone;
28 int16_t noise_floor;
29 unsigned int longcal_timer;
30 unsigned int shortcal_timer;
31 unsigned int resetcal_timer;
32 unsigned int checkani_timer;
33 struct timer_list timer;
34};
35
26enum ath_device_state { 36enum ath_device_state {
27 ATH_HW_UNAVAILABLE, 37 ATH_HW_UNAVAILABLE,
28 ATH_HW_INITIALIZED, 38 ATH_HW_INITIALIZED,
@@ -66,6 +76,8 @@ struct ath_common {
66 int debug_mask; 76 int debug_mask;
67 enum ath_device_state state; 77 enum ath_device_state state;
68 78
79 struct ath_ani ani;
80
69 u16 cachelsz; 81 u16 cachelsz;
70 u16 curaid; 82 u16 curaid;
71 u8 macaddr[ETH_ALEN]; 83 u8 macaddr[ETH_ALEN];
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 4169d2b3f71e..24f61fdb1c20 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -434,16 +434,6 @@ void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp);
434#define ATH_LONG_CALINTERVAL 30000 /* 30 seconds */ 434#define ATH_LONG_CALINTERVAL 30000 /* 30 seconds */
435#define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes */ 435#define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes */
436 436
437struct ath_ani {
438 bool caldone;
439 int16_t noise_floor;
440 unsigned int longcal_timer;
441 unsigned int shortcal_timer;
442 unsigned int resetcal_timer;
443 unsigned int checkani_timer;
444 struct timer_list timer;
445};
446
447/* Defines the BT AR_BT_COEX_WGHT used */ 437/* Defines the BT AR_BT_COEX_WGHT used */
448enum ath_stomp_type { 438enum ath_stomp_type {
449 ATH_BTCOEX_NO_STOMP, 439 ATH_BTCOEX_NO_STOMP,
@@ -601,7 +591,6 @@ struct ath_softc {
601 591
602 int beacon_interval; 592 int beacon_interval;
603 593
604 struct ath_ani ani;
605#ifdef CONFIG_ATH9K_DEBUG 594#ifdef CONFIG_ATH9K_DEBUG
606 struct ath9k_debug debug; 595 struct ath9k_debug debug;
607#endif 596#endif
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 11aaa7d69a1f..01ac8974eb07 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -405,34 +405,34 @@ static void ath_ani_calibrate(unsigned long data)
405 ath9k_ps_wakeup(sc); 405 ath9k_ps_wakeup(sc);
406 406
407 /* Long calibration runs independently of short calibration. */ 407 /* Long calibration runs independently of short calibration. */
408 if ((timestamp - sc->ani.longcal_timer) >= ATH_LONG_CALINTERVAL) { 408 if ((timestamp - common->ani.longcal_timer) >= ATH_LONG_CALINTERVAL) {
409 longcal = true; 409 longcal = true;
410 ath_print(common, ATH_DBG_ANI, "longcal @%lu\n", jiffies); 410 ath_print(common, ATH_DBG_ANI, "longcal @%lu\n", jiffies);
411 sc->ani.longcal_timer = timestamp; 411 common->ani.longcal_timer = timestamp;
412 } 412 }
413 413
414 /* Short calibration applies only while caldone is false */ 414 /* Short calibration applies only while caldone is false */
415 if (!sc->ani.caldone) { 415 if (!common->ani.caldone) {
416 if ((timestamp - sc->ani.shortcal_timer) >= short_cal_interval) { 416 if ((timestamp - common->ani.shortcal_timer) >= short_cal_interval) {
417 shortcal = true; 417 shortcal = true;
418 ath_print(common, ATH_DBG_ANI, 418 ath_print(common, ATH_DBG_ANI,
419 "shortcal @%lu\n", jiffies); 419 "shortcal @%lu\n", jiffies);
420 sc->ani.shortcal_timer = timestamp; 420 common->ani.shortcal_timer = timestamp;
421 sc->ani.resetcal_timer = timestamp; 421 common->ani.resetcal_timer = timestamp;
422 } 422 }
423 } else { 423 } else {
424 if ((timestamp - sc->ani.resetcal_timer) >= 424 if ((timestamp - common->ani.resetcal_timer) >=
425 ATH_RESTART_CALINTERVAL) { 425 ATH_RESTART_CALINTERVAL) {
426 sc->ani.caldone = ath9k_hw_reset_calvalid(ah); 426 common->ani.caldone = ath9k_hw_reset_calvalid(ah);
427 if (sc->ani.caldone) 427 if (common->ani.caldone)
428 sc->ani.resetcal_timer = timestamp; 428 common->ani.resetcal_timer = timestamp;
429 } 429 }
430 } 430 }
431 431
432 /* Verify whether we must check ANI */ 432 /* Verify whether we must check ANI */
433 if ((timestamp - sc->ani.checkani_timer) >= ATH_ANI_POLLINTERVAL) { 433 if ((timestamp - common->ani.checkani_timer) >= ATH_ANI_POLLINTERVAL) {
434 aniflag = true; 434 aniflag = true;
435 sc->ani.checkani_timer = timestamp; 435 common->ani.checkani_timer = timestamp;
436 } 436 }
437 437
438 /* Skip all processing if there's nothing to do. */ 438 /* Skip all processing if there's nothing to do. */
@@ -443,21 +443,21 @@ static void ath_ani_calibrate(unsigned long data)
443 443
444 /* Perform calibration if necessary */ 444 /* Perform calibration if necessary */
445 if (longcal || shortcal) { 445 if (longcal || shortcal) {
446 sc->ani.caldone = 446 common->ani.caldone =
447 ath9k_hw_calibrate(ah, 447 ath9k_hw_calibrate(ah,
448 ah->curchan, 448 ah->curchan,
449 common->rx_chainmask, 449 common->rx_chainmask,
450 longcal); 450 longcal);
451 451
452 if (longcal) 452 if (longcal)
453 sc->ani.noise_floor = ath9k_hw_getchan_noise(ah, 453 common->ani.noise_floor = ath9k_hw_getchan_noise(ah,
454 ah->curchan); 454 ah->curchan);
455 455
456 ath_print(common, ATH_DBG_ANI, 456 ath_print(common, ATH_DBG_ANI,
457 " calibrate chan %u/%x nf: %d\n", 457 " calibrate chan %u/%x nf: %d\n",
458 ah->curchan->channel, 458 ah->curchan->channel,
459 ah->curchan->channelFlags, 459 ah->curchan->channelFlags,
460 sc->ani.noise_floor); 460 common->ani.noise_floor);
461 } 461 }
462 } 462 }
463 463
@@ -473,21 +473,21 @@ set_timer:
473 cal_interval = ATH_LONG_CALINTERVAL; 473 cal_interval = ATH_LONG_CALINTERVAL;
474 if (sc->sc_ah->config.enable_ani) 474 if (sc->sc_ah->config.enable_ani)
475 cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL); 475 cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
476 if (!sc->ani.caldone) 476 if (!common->ani.caldone)
477 cal_interval = min(cal_interval, (u32)short_cal_interval); 477 cal_interval = min(cal_interval, (u32)short_cal_interval);
478 478
479 mod_timer(&sc->ani.timer, jiffies + msecs_to_jiffies(cal_interval)); 479 mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval));
480} 480}
481 481
482static void ath_start_ani(struct ath_softc *sc) 482static void ath_start_ani(struct ath_common *common)
483{ 483{
484 unsigned long timestamp = jiffies_to_msecs(jiffies); 484 unsigned long timestamp = jiffies_to_msecs(jiffies);
485 485
486 sc->ani.longcal_timer = timestamp; 486 common->ani.longcal_timer = timestamp;
487 sc->ani.shortcal_timer = timestamp; 487 common->ani.shortcal_timer = timestamp;
488 sc->ani.checkani_timer = timestamp; 488 common->ani.checkani_timer = timestamp;
489 489
490 mod_timer(&sc->ani.timer, 490 mod_timer(&common->ani.timer,
491 jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL)); 491 jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
492} 492}
493 493
@@ -1023,12 +1023,12 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
1023 /* Reset rssi stats */ 1023 /* Reset rssi stats */
1024 sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER; 1024 sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER;
1025 1025
1026 ath_start_ani(sc); 1026 ath_start_ani(common);
1027 } else { 1027 } else {
1028 ath_print(common, ATH_DBG_CONFIG, "Bss Info DISASSOC\n"); 1028 ath_print(common, ATH_DBG_CONFIG, "Bss Info DISASSOC\n");
1029 common->curaid = 0; 1029 common->curaid = 0;
1030 /* Stop ANI */ 1030 /* Stop ANI */
1031 del_timer_sync(&sc->ani.timer); 1031 del_timer_sync(&common->ani.timer);
1032 } 1032 }
1033} 1033}
1034 1034
@@ -1761,8 +1761,8 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
1761 /* Initializes the noise floor to a reasonable default value. 1761 /* Initializes the noise floor to a reasonable default value.
1762 * Later on this will be updated during ANI processing. */ 1762 * Later on this will be updated during ANI processing. */
1763 1763
1764 sc->ani.noise_floor = ATH_DEFAULT_NOISE_FLOOR; 1764 common->ani.noise_floor = ATH_DEFAULT_NOISE_FLOOR;
1765 setup_timer(&sc->ani.timer, ath_ani_calibrate, (unsigned long)sc); 1765 setup_timer(&common->ani.timer, ath_ani_calibrate, (unsigned long)sc);
1766 1766
1767 if (ath9k_hw_getcapability(ah, ATH9K_CAP_CIPHER, 1767 if (ath9k_hw_getcapability(ah, ATH9K_CAP_CIPHER,
1768 ATH9K_CIPHER_TKIP, NULL)) { 1768 ATH9K_CIPHER_TKIP, NULL)) {
@@ -2634,7 +2634,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
2634 if (conf->type == NL80211_IFTYPE_AP || 2634 if (conf->type == NL80211_IFTYPE_AP ||
2635 conf->type == NL80211_IFTYPE_ADHOC || 2635 conf->type == NL80211_IFTYPE_ADHOC ||
2636 conf->type == NL80211_IFTYPE_MONITOR) 2636 conf->type == NL80211_IFTYPE_MONITOR)
2637 ath_start_ani(sc); 2637 ath_start_ani(common);
2638 2638
2639out: 2639out:
2640 mutex_unlock(&sc->mutex); 2640 mutex_unlock(&sc->mutex);
@@ -2655,7 +2655,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
2655 mutex_lock(&sc->mutex); 2655 mutex_lock(&sc->mutex);
2656 2656
2657 /* Stop ANI */ 2657 /* Stop ANI */
2658 del_timer_sync(&sc->ani.timer); 2658 del_timer_sync(&common->ani.timer);
2659 2659
2660 /* Reclaim beacon resources */ 2660 /* Reclaim beacon resources */
2661 if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || 2661 if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) ||
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index b27ea89bbc97..403debb4ec11 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -102,6 +102,7 @@ static int ath_rx_prepare(struct ieee80211_hw *hw,
102 struct ieee80211_sta *sta; 102 struct ieee80211_sta *sta;
103 struct ath_node *an; 103 struct ath_node *an;
104 int last_rssi = ATH_RSSI_DUMMY_MARKER; 104 int last_rssi = ATH_RSSI_DUMMY_MARKER;
105 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
105 106
106 hdr = (struct ieee80211_hdr *)skb->data; 107 hdr = (struct ieee80211_hdr *)skb->data;
107 fc = hdr->frame_control; 108 fc = hdr->frame_control;
@@ -212,7 +213,7 @@ static int ath_rx_prepare(struct ieee80211_hw *hw,
212 rx_status->mactime = ath9k_hw_extend_tsf(sc->sc_ah, rx_stats->rs_tstamp); 213 rx_status->mactime = ath9k_hw_extend_tsf(sc->sc_ah, rx_stats->rs_tstamp);
213 rx_status->band = hw->conf.channel->band; 214 rx_status->band = hw->conf.channel->band;
214 rx_status->freq = hw->conf.channel->center_freq; 215 rx_status->freq = hw->conf.channel->center_freq;
215 rx_status->noise = sc->ani.noise_floor; 216 rx_status->noise = common->ani.noise_floor;
216 rx_status->signal = ATH_DEFAULT_NOISE_FLOOR + rx_stats->rs_rssi; 217 rx_status->signal = ATH_DEFAULT_NOISE_FLOOR + rx_stats->rs_rssi;
217 rx_status->antenna = rx_stats->rs_antenna; 218 rx_status->antenna = rx_stats->rs_antenna;
218 219