aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/main.c
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2008-10-29 00:46:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-11-10 15:14:57 -0500
commit5640b08ef7e88b606c740e746cb77bc97d78508e (patch)
tree355d8e4d2315e8b88b01521c8a79be52fd5d5429 /drivers/net/wireless/ath9k/main.c
parenta37c2c79404940dfc5e88c851c3de5328975b1a9 (diff)
ath9k: Revamp VAP management
Remove the internal VAP management routines and embed ath_vap in mac80211's driver private area provided in ieee80211_vif. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath9k/main.c80
1 files changed, 29 insertions, 51 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 0a0eb7ce0f5f..0194e44034e0 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -162,7 +162,7 @@ static int ath_key_config(struct ath_softc *sc,
162 if (!sc->sc_vaps[0]) 162 if (!sc->sc_vaps[0])
163 return -EIO; 163 return -EIO;
164 164
165 vif = sc->sc_vaps[0]->av_if_data; 165 vif = sc->sc_vaps[0];
166 opmode = vif->type; 166 opmode = vif->type;
167 167
168 /* 168 /*
@@ -313,11 +313,12 @@ static void ath9k_ht_conf(struct ath_softc *sc,
313} 313}
314 314
315static void ath9k_bss_assoc_info(struct ath_softc *sc, 315static void ath9k_bss_assoc_info(struct ath_softc *sc,
316 struct ieee80211_vif *vif,
316 struct ieee80211_bss_conf *bss_conf) 317 struct ieee80211_bss_conf *bss_conf)
317{ 318{
318 struct ieee80211_hw *hw = sc->hw; 319 struct ieee80211_hw *hw = sc->hw;
319 struct ieee80211_channel *curchan = hw->conf.channel; 320 struct ieee80211_channel *curchan = hw->conf.channel;
320 struct ath_vap *avp; 321 struct ath_vap *avp = (void *)vif->drv_priv;
321 int pos; 322 int pos;
322 323
323 if (bss_conf->assoc) { 324 if (bss_conf->assoc) {
@@ -325,13 +326,6 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
325 __func__, 326 __func__,
326 bss_conf->aid); 327 bss_conf->aid);
327 328
328 avp = sc->sc_vaps[0];
329 if (avp == NULL) {
330 DPRINTF(sc, ATH_DBG_FATAL, "%s: Invalid interface\n",
331 __func__);
332 return;
333 }
334
335 /* New association, store aid */ 329 /* New association, store aid */
336 if (avp->av_opmode == ATH9K_M_STA) { 330 if (avp->av_opmode == ATH9K_M_STA) {
337 sc->sc_curaid = bss_conf->aid; 331 sc->sc_curaid = bss_conf->aid;
@@ -906,6 +900,7 @@ static int ath_attach(u16 devid,
906 900
907 hw->queues = 4; 901 hw->queues = 4;
908 hw->sta_data_size = sizeof(struct ath_node); 902 hw->sta_data_size = sizeof(struct ath_node);
903 hw->vif_data_size = sizeof(struct ath_vap);
909 904
910 /* Register rate control */ 905 /* Register rate control */
911 hw->rate_control_algorithm = "ath9k_rate_control"; 906 hw->rate_control_algorithm = "ath9k_rate_control";
@@ -1091,7 +1086,8 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
1091 struct ieee80211_if_init_conf *conf) 1086 struct ieee80211_if_init_conf *conf)
1092{ 1087{
1093 struct ath_softc *sc = hw->priv; 1088 struct ath_softc *sc = hw->priv;
1094 int error, ic_opmode = 0; 1089 struct ath_vap *avp = (void *)conf->vif->drv_priv;
1090 int ic_opmode = 0;
1095 1091
1096 /* Support only vap for now */ 1092 /* Support only vap for now */
1097 1093
@@ -1119,13 +1115,22 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
1119 __func__, 1115 __func__,
1120 ic_opmode); 1116 ic_opmode);
1121 1117
1122 error = ath_vap_attach(sc, 0, conf->vif, ic_opmode); 1118 /* Set the VAP opmode */
1123 if (error) { 1119 avp->av_opmode = ic_opmode;
1124 DPRINTF(sc, ATH_DBG_FATAL, 1120 avp->av_bslot = -1;
1125 "%s: Unable to attach vap, error: %d\n", 1121
1126 __func__, error); 1122 if (ic_opmode == ATH9K_M_HOSTAP)
1127 return error; 1123 ath9k_hw_set_tsfadjust(sc->sc_ah, 1);
1128 } 1124
1125 sc->sc_vaps[0] = conf->vif;
1126 sc->sc_nvaps++;
1127
1128 /* Set the device opmode */
1129 sc->sc_ah->ah_opmode = ic_opmode;
1130
1131 /* default VAP configuration */
1132 avp->av_config.av_fixed_rateset = IEEE80211_FIXED_RATE_NONE;
1133 avp->av_config.av_fixed_retryset = 0x03030303;
1129 1134
1130 if (conf->type == NL80211_IFTYPE_AP) { 1135 if (conf->type == NL80211_IFTYPE_AP) {
1131 /* TODO: is this a suitable place to start ANI for AP mode? */ 1136 /* TODO: is this a suitable place to start ANI for AP mode? */
@@ -1141,27 +1146,16 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
1141 struct ieee80211_if_init_conf *conf) 1146 struct ieee80211_if_init_conf *conf)
1142{ 1147{
1143 struct ath_softc *sc = hw->priv; 1148 struct ath_softc *sc = hw->priv;
1144 struct ath_vap *avp; 1149 struct ath_vap *avp = (void *)conf->vif->drv_priv;
1145 int error;
1146 1150
1147 DPRINTF(sc, ATH_DBG_CONFIG, "%s: Detach VAP\n", __func__); 1151 DPRINTF(sc, ATH_DBG_CONFIG, "%s: Detach VAP\n", __func__);
1148 1152
1149 avp = sc->sc_vaps[0];
1150 if (avp == NULL) {
1151 DPRINTF(sc, ATH_DBG_FATAL, "%s: Invalid interface\n",
1152 __func__);
1153 return;
1154 }
1155
1156#ifdef CONFIG_SLOW_ANT_DIV 1153#ifdef CONFIG_SLOW_ANT_DIV
1157 ath_slow_ant_div_stop(&sc->sc_antdiv); 1154 ath_slow_ant_div_stop(&sc->sc_antdiv);
1158#endif 1155#endif
1159 /* Stop ANI */ 1156 /* Stop ANI */
1160 del_timer_sync(&sc->sc_ani.timer); 1157 del_timer_sync(&sc->sc_ani.timer);
1161 1158
1162 /* Update ratectrl */
1163 ath_rate_newstate(sc, avp);
1164
1165 /* Reclaim beacon resources */ 1159 /* Reclaim beacon resources */
1166 if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP || 1160 if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP ||
1167 sc->sc_ah->ah_opmode == ATH9K_M_IBSS) { 1161 sc->sc_ah->ah_opmode == ATH9K_M_IBSS) {
@@ -1169,16 +1163,10 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
1169 ath_beacon_return(sc, avp); 1163 ath_beacon_return(sc, avp);
1170 } 1164 }
1171 1165
1172 /* Set interrupt mask */
1173 sc->sc_imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
1174 ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_imask & ~ATH9K_INT_GLOBAL);
1175 sc->sc_flags &= ~SC_OP_BEACONS; 1166 sc->sc_flags &= ~SC_OP_BEACONS;
1176 1167
1177 error = ath_vap_detach(sc, 0); 1168 sc->sc_vaps[0] = NULL;
1178 if (error) 1169 sc->sc_nvaps--;
1179 DPRINTF(sc, ATH_DBG_FATAL,
1180 "%s: Unable to detach vap, error: %d\n",
1181 __func__, error);
1182} 1170}
1183 1171
1184static int ath9k_config(struct ieee80211_hw *hw, u32 changed) 1172static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
@@ -1226,17 +1214,10 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
1226{ 1214{
1227 struct ath_softc *sc = hw->priv; 1215 struct ath_softc *sc = hw->priv;
1228 struct ath_hal *ah = sc->sc_ah; 1216 struct ath_hal *ah = sc->sc_ah;
1229 struct ath_vap *avp; 1217 struct ath_vap *avp = (void *)vif->drv_priv;
1230 u32 rfilt = 0; 1218 u32 rfilt = 0;
1231 int error, i; 1219 int error, i;
1232 1220
1233 avp = sc->sc_vaps[0];
1234 if (avp == NULL) {
1235 DPRINTF(sc, ATH_DBG_FATAL, "%s: Invalid interface\n",
1236 __func__);
1237 return -EINVAL;
1238 }
1239
1240 /* TODO: Need to decide which hw opmode to use for multi-interface 1221 /* TODO: Need to decide which hw opmode to use for multi-interface
1241 * cases */ 1222 * cases */
1242 if (vif->type == NL80211_IFTYPE_AP && 1223 if (vif->type == NL80211_IFTYPE_AP &&
@@ -1317,7 +1298,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
1317 } 1298 }
1318 1299
1319 /* Check for WLAN_CAPABILITY_PRIVACY ? */ 1300 /* Check for WLAN_CAPABILITY_PRIVACY ? */
1320 if ((avp->av_opmode != NL80211_IFTYPE_STATION)) { 1301 if ((avp->av_opmode != ATH9K_M_STA)) {
1321 for (i = 0; i < IEEE80211_WEP_NKID; i++) 1302 for (i = 0; i < IEEE80211_WEP_NKID; i++)
1322 if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i)) 1303 if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i))
1323 ath9k_hw_keysetmac(sc->sc_ah, 1304 ath9k_hw_keysetmac(sc->sc_ah,
@@ -1366,9 +1347,6 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw,
1366 __func__, sc->rx_filter); 1347 __func__, sc->rx_filter);
1367} 1348}
1368 1349
1369/* Only a single interface is currently supported,
1370 so pass 0 as the interface id to ath_node_attach */
1371
1372static void ath9k_sta_notify(struct ieee80211_hw *hw, 1350static void ath9k_sta_notify(struct ieee80211_hw *hw,
1373 struct ieee80211_vif *vif, 1351 struct ieee80211_vif *vif,
1374 enum sta_notify_cmd cmd, 1352 enum sta_notify_cmd cmd,
@@ -1378,7 +1356,7 @@ static void ath9k_sta_notify(struct ieee80211_hw *hw,
1378 1356
1379 switch (cmd) { 1357 switch (cmd) {
1380 case STA_NOTIFY_ADD: 1358 case STA_NOTIFY_ADD:
1381 ath_node_attach(sc, sta, 0); 1359 ath_node_attach(sc, sta);
1382 break; 1360 break;
1383 case STA_NOTIFY_REMOVE: 1361 case STA_NOTIFY_REMOVE:
1384 ath_node_detach(sc, sta); 1362 ath_node_detach(sc, sta);
@@ -1496,7 +1474,7 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
1496 DPRINTF(sc, ATH_DBG_CONFIG, "%s: BSS Changed ASSOC %d\n", 1474 DPRINTF(sc, ATH_DBG_CONFIG, "%s: BSS Changed ASSOC %d\n",
1497 __func__, 1475 __func__,
1498 bss_conf->assoc); 1476 bss_conf->assoc);
1499 ath9k_bss_assoc_info(sc, bss_conf); 1477 ath9k_bss_assoc_info(sc, vif, bss_conf);
1500 } 1478 }
1501} 1479}
1502 1480