aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/beacon.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/beacon.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 5e108c086904..385ba03134ba 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -566,8 +566,6 @@ static void ath_beacon_config_sta(struct ath_softc *sc,
566 * last beacon we received (which may be none). 566 * last beacon we received (which may be none).
567 */ 567 */
568 dtimperiod = conf->dtim_period; 568 dtimperiod = conf->dtim_period;
569 if (dtimperiod <= 0) /* NB: 0 if not known */
570 dtimperiod = 1;
571 dtimcount = conf->dtim_count; 569 dtimcount = conf->dtim_count;
572 if (dtimcount >= dtimperiod) /* NB: sanity check */ 570 if (dtimcount >= dtimperiod) /* NB: sanity check */
573 dtimcount = 0; 571 dtimcount = 0;
@@ -575,8 +573,6 @@ static void ath_beacon_config_sta(struct ath_softc *sc,
575 cfpcount = 0; 573 cfpcount = 0;
576 574
577 sleepduration = conf->listen_interval * intval; 575 sleepduration = conf->listen_interval * intval;
578 if (sleepduration <= 0)
579 sleepduration = intval;
580 576
581 /* 577 /*
582 * Pull nexttbtt forward to reflect the current 578 * Pull nexttbtt forward to reflect the current
@@ -662,8 +658,7 @@ static void ath_beacon_config_sta(struct ath_softc *sc,
662} 658}
663 659
664static void ath_beacon_config_adhoc(struct ath_softc *sc, 660static void ath_beacon_config_adhoc(struct ath_softc *sc,
665 struct ath_beacon_config *conf, 661 struct ath_beacon_config *conf)
666 struct ieee80211_vif *vif)
667{ 662{
668 struct ath_hw *ah = sc->sc_ah; 663 struct ath_hw *ah = sc->sc_ah;
669 struct ath_common *common = ath9k_hw_common(ah); 664 struct ath_common *common = ath9k_hw_common(ah);
@@ -718,18 +713,17 @@ void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif)
718 /* Setup the beacon configuration parameters */ 713 /* Setup the beacon configuration parameters */
719 if (vif) { 714 if (vif) {
720 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; 715 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
721
722 iftype = vif->type; 716 iftype = vif->type;
723
724 cur_conf->beacon_interval = bss_conf->beacon_int; 717 cur_conf->beacon_interval = bss_conf->beacon_int;
725 cur_conf->dtim_period = bss_conf->dtim_period; 718 cur_conf->dtim_period = bss_conf->dtim_period;
719 } else {
720 iftype = sc->sc_ah->opmode;
721 }
722
726 cur_conf->listen_interval = 1; 723 cur_conf->listen_interval = 1;
727 cur_conf->dtim_count = 1; 724 cur_conf->dtim_count = 1;
728 cur_conf->bmiss_timeout = 725 cur_conf->bmiss_timeout =
729 ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval; 726 ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;
730 } else {
731 iftype = sc->sc_ah->opmode;
732 }
733 727
734 /* 728 /*
735 * It looks like mac80211 may end up using beacon interval of zero in 729 * It looks like mac80211 may end up using beacon interval of zero in
@@ -740,13 +734,20 @@ void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif)
740 if (cur_conf->beacon_interval == 0) 734 if (cur_conf->beacon_interval == 0)
741 cur_conf->beacon_interval = 100; 735 cur_conf->beacon_interval = 100;
742 736
737 /*
738 * Some times we dont parse dtim period from mac80211, in that case
739 * use a default value
740 */
741 if (cur_conf->dtim_period == 0)
742 cur_conf->dtim_period = 1;
743
743 switch (iftype) { 744 switch (iftype) {
744 case NL80211_IFTYPE_AP: 745 case NL80211_IFTYPE_AP:
745 ath_beacon_config_ap(sc, cur_conf); 746 ath_beacon_config_ap(sc, cur_conf);
746 break; 747 break;
747 case NL80211_IFTYPE_ADHOC: 748 case NL80211_IFTYPE_ADHOC:
748 case NL80211_IFTYPE_MESH_POINT: 749 case NL80211_IFTYPE_MESH_POINT:
749 ath_beacon_config_adhoc(sc, cur_conf, vif); 750 ath_beacon_config_adhoc(sc, cur_conf);
750 break; 751 break;
751 case NL80211_IFTYPE_STATION: 752 case NL80211_IFTYPE_STATION:
752 ath_beacon_config_sta(sc, cur_conf); 753 ath_beacon_config_sta(sc, cur_conf);