aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/main.c
diff options
context:
space:
mode:
authorSujith Manoharan <c_manoha@qca.qualcomm.com>2012-07-17 07:45:30 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-07-17 15:11:37 -0400
commit130ef6e9dc76f821caf98fa9ed6e2dafe15f3b1f (patch)
treee14de489e9e7f45c279ab9210ee4daba266902a2 /drivers/net/wireless/ath/ath9k/main.c
parent0f245ed20b8df90f7610f0f62f9c3513e084a679 (diff)
ath9k: Fix beacon setup
This patch revamps interface addition and deletion and simplifies slot allocation. There is no need to setup the beacon buffer in add/remove interface, remove this and use simple APIs for assigning/deleting slots. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c48
1 files changed, 12 insertions, 36 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index a07f69c1e9e9..f7d92e0ba4dd 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -852,16 +852,6 @@ bool ath9k_uses_beacons(int type)
852 } 852 }
853} 853}
854 854
855static void ath9k_reclaim_beacon(struct ath_softc *sc,
856 struct ieee80211_vif *vif)
857{
858 struct ath_vif *avp = (void *)vif->drv_priv;
859
860 ath9k_set_beaconing_status(sc, false);
861 ath_beacon_return(sc, avp);
862 ath9k_set_beaconing_status(sc, true);
863}
864
865static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) 855static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
866{ 856{
867 struct ath9k_vif_iter_data *iter_data = data; 857 struct ath9k_vif_iter_data *iter_data = data;
@@ -977,22 +967,6 @@ static void ath9k_calculate_summary_state(struct ieee80211_hw *hw,
977 } 967 }
978} 968}
979 969
980/* Called with sc->mutex held, vif counts set up properly. */
981static void ath9k_do_vif_add_setup(struct ieee80211_hw *hw,
982 struct ieee80211_vif *vif)
983{
984 struct ath_softc *sc = hw->priv;
985
986 ath9k_calculate_summary_state(hw, vif);
987
988 if (ath9k_uses_beacons(vif->type)) {
989 /* Reserve a beacon slot for the vif */
990 ath9k_set_beaconing_status(sc, false);
991 ath_beacon_alloc(sc, vif);
992 ath9k_set_beaconing_status(sc, true);
993 }
994}
995
996static int ath9k_add_interface(struct ieee80211_hw *hw, 970static int ath9k_add_interface(struct ieee80211_hw *hw,
997 struct ieee80211_vif *vif) 971 struct ieee80211_vif *vif)
998{ 972{
@@ -1032,7 +1006,10 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
1032 1006
1033 sc->nvifs++; 1007 sc->nvifs++;
1034 1008
1035 ath9k_do_vif_add_setup(hw, vif); 1009 ath9k_calculate_summary_state(hw, vif);
1010 if (ath9k_uses_beacons(vif->type))
1011 ath9k_beacon_assign_slot(sc, vif);
1012
1036out: 1013out:
1037 mutex_unlock(&sc->mutex); 1014 mutex_unlock(&sc->mutex);
1038 ath9k_ps_restore(sc); 1015 ath9k_ps_restore(sc);
@@ -1049,6 +1026,7 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
1049 int ret = 0; 1026 int ret = 0;
1050 1027
1051 ath_dbg(common, CONFIG, "Change Interface\n"); 1028 ath_dbg(common, CONFIG, "Change Interface\n");
1029
1052 mutex_lock(&sc->mutex); 1030 mutex_lock(&sc->mutex);
1053 ath9k_ps_wakeup(sc); 1031 ath9k_ps_wakeup(sc);
1054 1032
@@ -1061,15 +1039,16 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
1061 } 1039 }
1062 } 1040 }
1063 1041
1064 /* Clean up old vif stuff */
1065 if (ath9k_uses_beacons(vif->type)) 1042 if (ath9k_uses_beacons(vif->type))
1066 ath9k_reclaim_beacon(sc, vif); 1043 ath9k_beacon_remove_slot(sc, vif);
1067 1044
1068 /* Add new settings */
1069 vif->type = new_type; 1045 vif->type = new_type;
1070 vif->p2p = p2p; 1046 vif->p2p = p2p;
1071 1047
1072 ath9k_do_vif_add_setup(hw, vif); 1048 ath9k_calculate_summary_state(hw, vif);
1049 if (ath9k_uses_beacons(vif->type))
1050 ath9k_beacon_assign_slot(sc, vif);
1051
1073out: 1052out:
1074 ath9k_ps_restore(sc); 1053 ath9k_ps_restore(sc);
1075 mutex_unlock(&sc->mutex); 1054 mutex_unlock(&sc->mutex);
@@ -1089,9 +1068,8 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
1089 1068
1090 sc->nvifs--; 1069 sc->nvifs--;
1091 1070
1092 /* Reclaim beacon resources */
1093 if (ath9k_uses_beacons(vif->type)) 1071 if (ath9k_uses_beacons(vif->type))
1094 ath9k_reclaim_beacon(sc, vif); 1072 ath9k_beacon_remove_slot(sc, vif);
1095 1073
1096 ath9k_calculate_summary_state(hw, NULL); 1074 ath9k_calculate_summary_state(hw, NULL);
1097 1075
@@ -1610,9 +1588,7 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
1610 (changed & BSS_CHANGED_BEACON_ENABLED) || 1588 (changed & BSS_CHANGED_BEACON_ENABLED) ||
1611 (changed & BSS_CHANGED_BEACON_INT))) { 1589 (changed & BSS_CHANGED_BEACON_INT))) {
1612 ath9k_set_beaconing_status(sc, false); 1590 ath9k_set_beaconing_status(sc, false);
1613 if (bss_conf->enable_beacon) 1591 if (!bss_conf->enable_beacon)
1614 ath_beacon_alloc(sc, vif);
1615 else
1616 avp->is_bslot_active = false; 1592 avp->is_bslot_active = false;
1617 ath_beacon_config(sc, vif); 1593 ath_beacon_config(sc, vif);
1618 ath9k_set_beaconing_status(sc, true); 1594 ath9k_set_beaconing_status(sc, true);