diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/beacon.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/beacon.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c index b4a31a43a62c..22375a754718 100644 --- a/drivers/net/wireless/ath/ath9k/beacon.c +++ b/drivers/net/wireless/ath/ath9k/beacon.c | |||
@@ -524,6 +524,7 @@ static void ath9k_beacon_init(struct ath_softc *sc, | |||
524 | static void ath_beacon_config_ap(struct ath_softc *sc, | 524 | static void ath_beacon_config_ap(struct ath_softc *sc, |
525 | struct ath_beacon_config *conf) | 525 | struct ath_beacon_config *conf) |
526 | { | 526 | { |
527 | struct ath_hw *ah = sc->sc_ah; | ||
527 | u32 nexttbtt, intval; | 528 | u32 nexttbtt, intval; |
528 | 529 | ||
529 | /* NB: the beacon interval is kept internally in TU's */ | 530 | /* NB: the beacon interval is kept internally in TU's */ |
@@ -539,15 +540,15 @@ static void ath_beacon_config_ap(struct ath_softc *sc, | |||
539 | * prepare beacon frames. | 540 | * prepare beacon frames. |
540 | */ | 541 | */ |
541 | intval |= ATH9K_BEACON_ENA; | 542 | intval |= ATH9K_BEACON_ENA; |
542 | sc->imask |= ATH9K_INT_SWBA; | 543 | ah->imask |= ATH9K_INT_SWBA; |
543 | ath_beaconq_config(sc); | 544 | ath_beaconq_config(sc); |
544 | 545 | ||
545 | /* Set the computed AP beacon timers */ | 546 | /* Set the computed AP beacon timers */ |
546 | 547 | ||
547 | ath9k_hw_set_interrupts(sc->sc_ah, 0); | 548 | ath9k_hw_set_interrupts(ah, 0); |
548 | ath9k_beacon_init(sc, nexttbtt, intval); | 549 | ath9k_beacon_init(sc, nexttbtt, intval); |
549 | sc->beacon.bmisscnt = 0; | 550 | sc->beacon.bmisscnt = 0; |
550 | ath9k_hw_set_interrupts(sc->sc_ah, sc->imask); | 551 | ath9k_hw_set_interrupts(ah, ah->imask); |
551 | 552 | ||
552 | /* Clear the reset TSF flag, so that subsequent beacon updation | 553 | /* Clear the reset TSF flag, so that subsequent beacon updation |
553 | will not reset the HW TSF. */ | 554 | will not reset the HW TSF. */ |
@@ -566,7 +567,8 @@ static void ath_beacon_config_ap(struct ath_softc *sc, | |||
566 | static void ath_beacon_config_sta(struct ath_softc *sc, | 567 | static void ath_beacon_config_sta(struct ath_softc *sc, |
567 | struct ath_beacon_config *conf) | 568 | struct ath_beacon_config *conf) |
568 | { | 569 | { |
569 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 570 | struct ath_hw *ah = sc->sc_ah; |
571 | struct ath_common *common = ath9k_hw_common(ah); | ||
570 | struct ath9k_beacon_state bs; | 572 | struct ath9k_beacon_state bs; |
571 | int dtimperiod, dtimcount, sleepduration; | 573 | int dtimperiod, dtimcount, sleepduration; |
572 | int cfpperiod, cfpcount; | 574 | int cfpperiod, cfpcount; |
@@ -605,7 +607,7 @@ static void ath_beacon_config_sta(struct ath_softc *sc, | |||
605 | * Pull nexttbtt forward to reflect the current | 607 | * Pull nexttbtt forward to reflect the current |
606 | * TSF and calculate dtim+cfp state for the result. | 608 | * TSF and calculate dtim+cfp state for the result. |
607 | */ | 609 | */ |
608 | tsf = ath9k_hw_gettsf64(sc->sc_ah); | 610 | tsf = ath9k_hw_gettsf64(ah); |
609 | tsftu = TSF_TO_TU(tsf>>32, tsf) + FUDGE; | 611 | tsftu = TSF_TO_TU(tsf>>32, tsf) + FUDGE; |
610 | 612 | ||
611 | num_beacons = tsftu / intval + 1; | 613 | num_beacons = tsftu / intval + 1; |
@@ -678,17 +680,18 @@ static void ath_beacon_config_sta(struct ath_softc *sc, | |||
678 | 680 | ||
679 | /* Set the computed STA beacon timers */ | 681 | /* Set the computed STA beacon timers */ |
680 | 682 | ||
681 | ath9k_hw_set_interrupts(sc->sc_ah, 0); | 683 | ath9k_hw_set_interrupts(ah, 0); |
682 | ath9k_hw_set_sta_beacon_timers(sc->sc_ah, &bs); | 684 | ath9k_hw_set_sta_beacon_timers(ah, &bs); |
683 | sc->imask |= ATH9K_INT_BMISS; | 685 | ah->imask |= ATH9K_INT_BMISS; |
684 | ath9k_hw_set_interrupts(sc->sc_ah, sc->imask); | 686 | ath9k_hw_set_interrupts(ah, ah->imask); |
685 | } | 687 | } |
686 | 688 | ||
687 | static void ath_beacon_config_adhoc(struct ath_softc *sc, | 689 | static void ath_beacon_config_adhoc(struct ath_softc *sc, |
688 | struct ath_beacon_config *conf, | 690 | struct ath_beacon_config *conf, |
689 | struct ieee80211_vif *vif) | 691 | struct ieee80211_vif *vif) |
690 | { | 692 | { |
691 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 693 | struct ath_hw *ah = sc->sc_ah; |
694 | struct ath_common *common = ath9k_hw_common(ah); | ||
692 | u64 tsf; | 695 | u64 tsf; |
693 | u32 tsftu, intval, nexttbtt; | 696 | u32 tsftu, intval, nexttbtt; |
694 | 697 | ||
@@ -703,7 +706,7 @@ static void ath_beacon_config_adhoc(struct ath_softc *sc, | |||
703 | else if (intval) | 706 | else if (intval) |
704 | nexttbtt = roundup(nexttbtt, intval); | 707 | nexttbtt = roundup(nexttbtt, intval); |
705 | 708 | ||
706 | tsf = ath9k_hw_gettsf64(sc->sc_ah); | 709 | tsf = ath9k_hw_gettsf64(ah); |
707 | tsftu = TSF_TO_TU((u32)(tsf>>32), (u32)tsf) + FUDGE; | 710 | tsftu = TSF_TO_TU((u32)(tsf>>32), (u32)tsf) + FUDGE; |
708 | do { | 711 | do { |
709 | nexttbtt += intval; | 712 | nexttbtt += intval; |
@@ -719,20 +722,20 @@ static void ath_beacon_config_adhoc(struct ath_softc *sc, | |||
719 | * self-linked tx descriptor and let the hardware deal with things. | 722 | * self-linked tx descriptor and let the hardware deal with things. |
720 | */ | 723 | */ |
721 | intval |= ATH9K_BEACON_ENA; | 724 | intval |= ATH9K_BEACON_ENA; |
722 | if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) | 725 | if (!(ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) |
723 | sc->imask |= ATH9K_INT_SWBA; | 726 | ah->imask |= ATH9K_INT_SWBA; |
724 | 727 | ||
725 | ath_beaconq_config(sc); | 728 | ath_beaconq_config(sc); |
726 | 729 | ||
727 | /* Set the computed ADHOC beacon timers */ | 730 | /* Set the computed ADHOC beacon timers */ |
728 | 731 | ||
729 | ath9k_hw_set_interrupts(sc->sc_ah, 0); | 732 | ath9k_hw_set_interrupts(ah, 0); |
730 | ath9k_beacon_init(sc, nexttbtt, intval); | 733 | ath9k_beacon_init(sc, nexttbtt, intval); |
731 | sc->beacon.bmisscnt = 0; | 734 | sc->beacon.bmisscnt = 0; |
732 | ath9k_hw_set_interrupts(sc->sc_ah, sc->imask); | 735 | ath9k_hw_set_interrupts(ah, ah->imask); |
733 | 736 | ||
734 | /* FIXME: Handle properly when vif is NULL */ | 737 | /* FIXME: Handle properly when vif is NULL */ |
735 | if (vif && sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_VEOL) | 738 | if (vif && ah->caps.hw_caps & ATH9K_HW_CAP_VEOL) |
736 | ath_beacon_start_adhoc(sc, vif); | 739 | ath_beacon_start_adhoc(sc, vif); |
737 | } | 740 | } |
738 | 741 | ||