aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2009-08-13 00:04:25 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-14 09:14:08 -0400
commit1aa8e84736fb1a584c679f2893245826583a0526 (patch)
treeeaf56fa92b250c8c4e714dc4171cd39810c93b86
parent2a219eb26793fc4c47b3ad7b84bded7b66f6e2c4 (diff)
ath9k: Remove has_hw_phycounters
PHY counters are available in all chipsets supported by ath9k. Remove the check. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/ani.c195
-rw-r--r--drivers/net/wireless/ath/ath9k/ani.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c3
4 files changed, 88 insertions, 112 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index b7093126dbb8..f264097a2f4e 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -236,36 +236,35 @@ static void ath9k_ani_restart(struct ath_hw *ah)
236 return; 236 return;
237 237
238 aniState = ah->curani; 238 aniState = ah->curani;
239
240 aniState->listenTime = 0; 239 aniState->listenTime = 0;
241 if (ah->has_hw_phycounters) { 240
242 if (aniState->ofdmTrigHigh > AR_PHY_COUNTMAX) { 241 if (aniState->ofdmTrigHigh > AR_PHY_COUNTMAX) {
243 aniState->ofdmPhyErrBase = 0; 242 aniState->ofdmPhyErrBase = 0;
244 DPRINTF(ah->ah_sc, ATH_DBG_ANI,
245 "OFDM Trigger is too high for hw counters\n");
246 } else {
247 aniState->ofdmPhyErrBase =
248 AR_PHY_COUNTMAX - aniState->ofdmTrigHigh;
249 }
250 if (aniState->cckTrigHigh > AR_PHY_COUNTMAX) {
251 aniState->cckPhyErrBase = 0;
252 DPRINTF(ah->ah_sc, ATH_DBG_ANI,
253 "CCK Trigger is too high for hw counters\n");
254 } else {
255 aniState->cckPhyErrBase =
256 AR_PHY_COUNTMAX - aniState->cckTrigHigh;
257 }
258 DPRINTF(ah->ah_sc, ATH_DBG_ANI, 243 DPRINTF(ah->ah_sc, ATH_DBG_ANI,
259 "Writing ofdmbase=%u cckbase=%u\n", 244 "OFDM Trigger is too high for hw counters\n");
260 aniState->ofdmPhyErrBase, 245 } else {
261 aniState->cckPhyErrBase); 246 aniState->ofdmPhyErrBase =
262 REG_WRITE(ah, AR_PHY_ERR_1, aniState->ofdmPhyErrBase); 247 AR_PHY_COUNTMAX - aniState->ofdmTrigHigh;
263 REG_WRITE(ah, AR_PHY_ERR_2, aniState->cckPhyErrBase); 248 }
264 REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING); 249 if (aniState->cckTrigHigh > AR_PHY_COUNTMAX) {
265 REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING); 250 aniState->cckPhyErrBase = 0;
266 251 DPRINTF(ah->ah_sc, ATH_DBG_ANI,
267 ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); 252 "CCK Trigger is too high for hw counters\n");
253 } else {
254 aniState->cckPhyErrBase =
255 AR_PHY_COUNTMAX - aniState->cckTrigHigh;
268 } 256 }
257 DPRINTF(ah->ah_sc, ATH_DBG_ANI,
258 "Writing ofdmbase=%u cckbase=%u\n",
259 aniState->ofdmPhyErrBase,
260 aniState->cckPhyErrBase);
261 REG_WRITE(ah, AR_PHY_ERR_1, aniState->ofdmPhyErrBase);
262 REG_WRITE(ah, AR_PHY_ERR_2, aniState->cckPhyErrBase);
263 REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING);
264 REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING);
265
266 ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
267
269 aniState->ofdmPhyErrCount = 0; 268 aniState->ofdmPhyErrCount = 0;
270 aniState->cckPhyErrCount = 0; 269 aniState->cckPhyErrCount = 0;
271} 270}
@@ -530,18 +529,12 @@ void ath9k_ani_reset(struct ath_hw *ah)
530 if (aniState->firstepLevel != 0) 529 if (aniState->firstepLevel != 0)
531 ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, 530 ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
532 aniState->firstepLevel); 531 aniState->firstepLevel);
533 if (ah->has_hw_phycounters) {
534 ath9k_hw_setrxfilter(ah, ath9k_hw_getrxfilter(ah) &
535 ~ATH9K_RX_FILTER_PHYERR);
536 ath9k_ani_restart(ah);
537 REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING);
538 REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING);
539 532
540 } else { 533 ath9k_hw_setrxfilter(ah, ath9k_hw_getrxfilter(ah) &
541 ath9k_ani_restart(ah); 534 ~ATH9K_RX_FILTER_PHYERR);
542 ath9k_hw_setrxfilter(ah, ath9k_hw_getrxfilter(ah) | 535 ath9k_ani_restart(ah);
543 ATH9K_RX_FILTER_PHYERR); 536 REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING);
544 } 537 REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING);
545} 538}
546 539
547void ath9k_hw_ani_monitor(struct ath_hw *ah, 540void ath9k_hw_ani_monitor(struct ath_hw *ah,
@@ -550,6 +543,8 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah,
550{ 543{
551 struct ar5416AniState *aniState; 544 struct ar5416AniState *aniState;
552 int32_t listenTime; 545 int32_t listenTime;
546 u32 phyCnt1, phyCnt2;
547 u32 ofdmPhyErrCnt, cckPhyErrCnt;
553 548
554 if (!DO_ANI(ah)) 549 if (!DO_ANI(ah))
555 return; 550 return;
@@ -566,50 +561,45 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah,
566 561
567 aniState->listenTime += listenTime; 562 aniState->listenTime += listenTime;
568 563
569 if (ah->has_hw_phycounters) { 564 ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
570 u32 phyCnt1, phyCnt2;
571 u32 ofdmPhyErrCnt, cckPhyErrCnt;
572 565
573 ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); 566 phyCnt1 = REG_READ(ah, AR_PHY_ERR_1);
574 567 phyCnt2 = REG_READ(ah, AR_PHY_ERR_2);
575 phyCnt1 = REG_READ(ah, AR_PHY_ERR_1); 568
576 phyCnt2 = REG_READ(ah, AR_PHY_ERR_2); 569 if (phyCnt1 < aniState->ofdmPhyErrBase ||
577 570 phyCnt2 < aniState->cckPhyErrBase) {
578 if (phyCnt1 < aniState->ofdmPhyErrBase || 571 if (phyCnt1 < aniState->ofdmPhyErrBase) {
579 phyCnt2 < aniState->cckPhyErrBase) { 572 DPRINTF(ah->ah_sc, ATH_DBG_ANI,
580 if (phyCnt1 < aniState->ofdmPhyErrBase) { 573 "phyCnt1 0x%x, resetting "
581 DPRINTF(ah->ah_sc, ATH_DBG_ANI, 574 "counter value to 0x%x\n",
582 "phyCnt1 0x%x, resetting " 575 phyCnt1, aniState->ofdmPhyErrBase);
583 "counter value to 0x%x\n", 576 REG_WRITE(ah, AR_PHY_ERR_1,
584 phyCnt1, aniState->ofdmPhyErrBase); 577 aniState->ofdmPhyErrBase);
585 REG_WRITE(ah, AR_PHY_ERR_1, 578 REG_WRITE(ah, AR_PHY_ERR_MASK_1,
586 aniState->ofdmPhyErrBase); 579 AR_PHY_ERR_OFDM_TIMING);
587 REG_WRITE(ah, AR_PHY_ERR_MASK_1, 580 }
588 AR_PHY_ERR_OFDM_TIMING); 581 if (phyCnt2 < aniState->cckPhyErrBase) {
589 } 582 DPRINTF(ah->ah_sc, ATH_DBG_ANI,
590 if (phyCnt2 < aniState->cckPhyErrBase) { 583 "phyCnt2 0x%x, resetting "
591 DPRINTF(ah->ah_sc, ATH_DBG_ANI, 584 "counter value to 0x%x\n",
592 "phyCnt2 0x%x, resetting " 585 phyCnt2, aniState->cckPhyErrBase);
593 "counter value to 0x%x\n", 586 REG_WRITE(ah, AR_PHY_ERR_2,
594 phyCnt2, aniState->cckPhyErrBase); 587 aniState->cckPhyErrBase);
595 REG_WRITE(ah, AR_PHY_ERR_2, 588 REG_WRITE(ah, AR_PHY_ERR_MASK_2,
596 aniState->cckPhyErrBase); 589 AR_PHY_ERR_CCK_TIMING);
597 REG_WRITE(ah, AR_PHY_ERR_MASK_2,
598 AR_PHY_ERR_CCK_TIMING);
599 }
600 return;
601 } 590 }
591 return;
592 }
602 593
603 ofdmPhyErrCnt = phyCnt1 - aniState->ofdmPhyErrBase; 594 ofdmPhyErrCnt = phyCnt1 - aniState->ofdmPhyErrBase;
604 ah->stats.ast_ani_ofdmerrs += 595 ah->stats.ast_ani_ofdmerrs +=
605 ofdmPhyErrCnt - aniState->ofdmPhyErrCount; 596 ofdmPhyErrCnt - aniState->ofdmPhyErrCount;
606 aniState->ofdmPhyErrCount = ofdmPhyErrCnt; 597 aniState->ofdmPhyErrCount = ofdmPhyErrCnt;
607 598
608 cckPhyErrCnt = phyCnt2 - aniState->cckPhyErrBase; 599 cckPhyErrCnt = phyCnt2 - aniState->cckPhyErrBase;
609 ah->stats.ast_ani_cckerrs += 600 ah->stats.ast_ani_cckerrs +=
610 cckPhyErrCnt - aniState->cckPhyErrCount; 601 cckPhyErrCnt - aniState->cckPhyErrCount;
611 aniState->cckPhyErrCount = cckPhyErrCnt; 602 aniState->cckPhyErrCount = cckPhyErrCnt;
612 }
613 603
614 if (aniState->listenTime > 5 * ah->aniperiod) { 604 if (aniState->listenTime > 5 * ah->aniperiod) {
615 if (aniState->ofdmPhyErrCount <= aniState->listenTime * 605 if (aniState->ofdmPhyErrCount <= aniState->listenTime *
@@ -632,11 +622,6 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah,
632 } 622 }
633} 623}
634 624
635bool ath9k_hw_phycounters(struct ath_hw *ah)
636{
637 return ah->has_hw_phycounters ? true : false;
638}
639
640void ath9k_enable_mib_counters(struct ath_hw *ah) 625void ath9k_enable_mib_counters(struct ath_hw *ah)
641{ 626{
642 DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Enable MIB counters\n"); 627 DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Enable MIB counters\n");
@@ -781,9 +766,7 @@ void ath9k_hw_ani_init(struct ath_hw *ah)
781{ 766{
782 int i; 767 int i;
783 768
784 DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Attach ANI\n"); 769 DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Initialize ANI\n");
785
786 ah->has_hw_phycounters = 1;
787 770
788 memset(ah->ani, 0, sizeof(ah->ani)); 771 memset(ah->ani, 0, sizeof(ah->ani));
789 for (i = 0; i < ARRAY_SIZE(ah->ani); i++) { 772 for (i = 0; i < ARRAY_SIZE(ah->ani); i++) {
@@ -799,24 +782,22 @@ void ath9k_hw_ani_init(struct ath_hw *ah)
799 ATH9K_ANI_CCK_WEAK_SIG_THR; 782 ATH9K_ANI_CCK_WEAK_SIG_THR;
800 ah->ani[i].spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL; 783 ah->ani[i].spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL;
801 ah->ani[i].firstepLevel = ATH9K_ANI_FIRSTEP_LVL; 784 ah->ani[i].firstepLevel = ATH9K_ANI_FIRSTEP_LVL;
802 if (ah->has_hw_phycounters) { 785 ah->ani[i].ofdmPhyErrBase =
803 ah->ani[i].ofdmPhyErrBase = 786 AR_PHY_COUNTMAX - ATH9K_ANI_OFDM_TRIG_HIGH;
804 AR_PHY_COUNTMAX - ATH9K_ANI_OFDM_TRIG_HIGH; 787 ah->ani[i].cckPhyErrBase =
805 ah->ani[i].cckPhyErrBase = 788 AR_PHY_COUNTMAX - ATH9K_ANI_CCK_TRIG_HIGH;
806 AR_PHY_COUNTMAX - ATH9K_ANI_CCK_TRIG_HIGH;
807 }
808 }
809 if (ah->has_hw_phycounters) {
810 DPRINTF(ah->ah_sc, ATH_DBG_ANI,
811 "Setting OfdmErrBase = 0x%08x\n",
812 ah->ani[0].ofdmPhyErrBase);
813 DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Setting cckErrBase = 0x%08x\n",
814 ah->ani[0].cckPhyErrBase);
815
816 REG_WRITE(ah, AR_PHY_ERR_1, ah->ani[0].ofdmPhyErrBase);
817 REG_WRITE(ah, AR_PHY_ERR_2, ah->ani[0].cckPhyErrBase);
818 ath9k_enable_mib_counters(ah);
819 } 789 }
790
791 DPRINTF(ah->ah_sc, ATH_DBG_ANI,
792 "Setting OfdmErrBase = 0x%08x\n",
793 ah->ani[0].ofdmPhyErrBase);
794 DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Setting cckErrBase = 0x%08x\n",
795 ah->ani[0].cckPhyErrBase);
796
797 REG_WRITE(ah, AR_PHY_ERR_1, ah->ani[0].ofdmPhyErrBase);
798 REG_WRITE(ah, AR_PHY_ERR_2, ah->ani[0].cckPhyErrBase);
799 ath9k_enable_mib_counters(ah);
800
820 ah->aniperiod = ATH9K_ANI_PERIOD; 801 ah->aniperiod = ATH9K_ANI_PERIOD;
821 if (ah->config.enable_ani) 802 if (ah->config.enable_ani)
822 ah->proc_phyerr |= HAL_PROCESS_ANI; 803 ah->proc_phyerr |= HAL_PROCESS_ANI;
@@ -826,9 +807,7 @@ void ath9k_hw_ani_disable(struct ath_hw *ah)
826{ 807{
827 DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Disabling ANI\n"); 808 DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Disabling ANI\n");
828 809
829 if (ah->has_hw_phycounters) { 810 ath9k_hw_disable_mib_counters(ah);
830 ath9k_hw_disable_mib_counters(ah); 811 REG_WRITE(ah, AR_PHY_ERR_1, 0);
831 REG_WRITE(ah, AR_PHY_ERR_1, 0); 812 REG_WRITE(ah, AR_PHY_ERR_2, 0);
832 REG_WRITE(ah, AR_PHY_ERR_2, 0);
833 }
834} 813}
diff --git a/drivers/net/wireless/ath/ath9k/ani.h b/drivers/net/wireless/ath/ath9k/ani.h
index a36b7bb7c42a..119924511f85 100644
--- a/drivers/net/wireless/ath/ath9k/ani.h
+++ b/drivers/net/wireless/ath/ath9k/ani.h
@@ -124,7 +124,6 @@ void ath9k_ani_reset(struct ath_hw *ah);
124void ath9k_hw_ani_monitor(struct ath_hw *ah, 124void ath9k_hw_ani_monitor(struct ath_hw *ah,
125 const struct ath9k_node_stats *stats, 125 const struct ath9k_node_stats *stats,
126 struct ath9k_channel *chan); 126 struct ath9k_channel *chan);
127bool ath9k_hw_phycounters(struct ath_hw *ah);
128void ath9k_enable_mib_counters(struct ath_hw *ah); 127void ath9k_enable_mib_counters(struct ath_hw *ah);
129void ath9k_hw_disable_mib_counters(struct ath_hw *ah); 128void ath9k_hw_disable_mib_counters(struct ath_hw *ah);
130u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt, 129u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt,
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index e83e900e2750..0e65873cc276 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -507,7 +507,6 @@ struct ath_hw {
507 507
508 /* ANI */ 508 /* ANI */
509 u32 proc_phyerr; 509 u32 proc_phyerr;
510 bool has_hw_phycounters;
511 u32 aniperiod; 510 u32 aniperiod;
512 struct ar5416AniState *curani; 511 struct ar5416AniState *curani;
513 struct ar5416AniState ani[255]; 512 struct ar5416AniState ani[255];
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index b29d0ff74514..3eb6dc0c8e21 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2214,8 +2214,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
2214 if ((conf->type == NL80211_IFTYPE_STATION) || 2214 if ((conf->type == NL80211_IFTYPE_STATION) ||
2215 (conf->type == NL80211_IFTYPE_ADHOC) || 2215 (conf->type == NL80211_IFTYPE_ADHOC) ||
2216 (conf->type == NL80211_IFTYPE_MESH_POINT)) { 2216 (conf->type == NL80211_IFTYPE_MESH_POINT)) {
2217 if (ath9k_hw_phycounters(sc->sc_ah)) 2217 sc->imask |= ATH9K_INT_MIB;
2218 sc->imask |= ATH9K_INT_MIB;
2219 sc->imask |= ATH9K_INT_TSFOOR; 2218 sc->imask |= ATH9K_INT_TSFOOR;
2220 } 2219 }
2221 2220