aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorVasanthakumar Thiagarajan <vasanth@atheros.com>2009-05-15 09:29:22 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-20 14:46:26 -0400
commit6b96f93e962e25d38d7a73c0009597672d87c496 (patch)
treeeb5bfd9d9ad14ec37c8846b50fe9a87e4133774a /drivers
parentd31e20af9f65e38429a3ed32175f8e233bdcd2b2 (diff)
ath9k: cleanup beacon parameters configuration
This patch configures the beacon timers with beacon interval and beacon period passed through vif.bss_conf. Also cache the currecnt beacon configuration which will be used to configure the beacon timers when the driver triggers it after reset. Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c63
2 files changed, 36 insertions, 28 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 34256621d417..bd2363f075cf 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -600,6 +600,7 @@ struct ath_softc {
600 struct ath9k_debug debug; 600 struct ath9k_debug debug;
601#endif 601#endif
602 struct ath_bus_ops *bus_ops; 602 struct ath_bus_ops *bus_ops;
603 struct ath_beacon_config cur_beacon_conf;
603}; 604};
604 605
605struct ath_wiphy { 606struct ath_wiphy {
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index af5edb840ade..57f91a9ff0eb 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -695,43 +695,50 @@ static void ath_beacon_config_adhoc(struct ath_softc *sc,
695 sc->beacon.bmisscnt = 0; 695 sc->beacon.bmisscnt = 0;
696 ath9k_hw_set_interrupts(sc->sc_ah, sc->imask); 696 ath9k_hw_set_interrupts(sc->sc_ah, sc->imask);
697 697
698 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_VEOL) 698 /* FIXME: Handle properly when vif is NULL */
699 if (vif && sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)
699 ath_beacon_start_adhoc(sc, vif); 700 ath_beacon_start_adhoc(sc, vif);
700} 701}
701 702
702void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif) 703void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif)
703{ 704{
704 struct ath_beacon_config conf; 705 struct ath_beacon_config *cur_conf = &sc->cur_beacon_conf;
706 enum nl80211_iftype iftype;
705 707
706 /* Setup the beacon configuration parameters */ 708 /* Setup the beacon configuration parameters */
707 709
708 memset(&conf, 0, sizeof(struct ath_beacon_config));
709 conf.beacon_interval = sc->beacon_interval ? : ATH_DEFAULT_BINTVAL;
710 conf.listen_interval = 1;
711 conf.dtim_period = conf.beacon_interval;
712 conf.dtim_count = 1;
713 conf.bmiss_timeout = ATH_DEFAULT_BMISS_LIMIT * conf.beacon_interval;
714
715 if (vif) { 710 if (vif) {
716 struct ath_vif *avp = (struct ath_vif *)vif->drv_priv; 711 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
717 712
718 switch(avp->av_opmode) { 713 iftype = vif->type;
719 case NL80211_IFTYPE_AP:
720 ath_beacon_config_ap(sc, &conf);
721 break;
722 case NL80211_IFTYPE_ADHOC:
723 case NL80211_IFTYPE_MESH_POINT:
724 ath_beacon_config_adhoc(sc, &conf, vif);
725 break;
726 case NL80211_IFTYPE_STATION:
727 ath_beacon_config_sta(sc, &conf);
728 break;
729 default:
730 DPRINTF(sc, ATH_DBG_CONFIG,
731 "Unsupported beaconing mode\n");
732 return;
733 }
734 714
735 sc->sc_flags |= SC_OP_BEACONS; 715 cur_conf->beacon_interval = bss_conf->beacon_int;
716 cur_conf->dtim_period = bss_conf->dtim_period;
717 cur_conf->listen_interval = 1;
718 cur_conf->dtim_count = 1;
719 cur_conf->bmiss_timeout =
720 ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;
721 } else {
722 iftype = sc->sc_ah->opmode;
736 } 723 }
724
725
726 switch (iftype) {
727 case NL80211_IFTYPE_AP:
728 ath_beacon_config_ap(sc, cur_conf);
729 break;
730 case NL80211_IFTYPE_ADHOC:
731 case NL80211_IFTYPE_MESH_POINT:
732 ath_beacon_config_adhoc(sc, cur_conf, vif);
733 break;
734 case NL80211_IFTYPE_STATION:
735 ath_beacon_config_sta(sc, cur_conf);
736 break;
737 default:
738 DPRINTF(sc, ATH_DBG_CONFIG,
739 "Unsupported beaconing mode\n");
740 return;
741 }
742
743 sc->sc_flags |= SC_OP_BEACONS;
737} 744}