Lines Matching +full:auto +full:- +full:sleep +full:- +full:disabled
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
5 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
96 "SLEEP", /* IEEE80211_S_SLEEP */
108 * IEEE Std 802.11-2012, pp. 442-445 Table 8-36.
143 return ("4-Way handshake timeout"); in ieee80211_reason_to_string()
147 return ("element in 4-Way handshake different from " in ieee80211_reason_to_string()
165 return ("unspecified (QoS-related)"); in ieee80211_reason_to_string()
259 ic_printf(ni->ni_ic, "missing ic_raw_xmit callback, drop frame\n"); in null_raw_xmit()
270 hdrlen = ic->ic_headroom in ieee80211_proto_attach()
276 //ic->ic_protmode = IEEE80211_PROT_CTSONLY; in ieee80211_proto_attach()
278 TASK_INIT(&ic->ic_parent_task, 0, parent_updown, ic); in ieee80211_proto_attach()
279 TASK_INIT(&ic->ic_mcast_task, 0, update_mcast, ic); in ieee80211_proto_attach()
280 TASK_INIT(&ic->ic_promisc_task, 0, update_promisc, ic); in ieee80211_proto_attach()
281 TASK_INIT(&ic->ic_chan_task, 0, update_channel, ic); in ieee80211_proto_attach()
282 TASK_INIT(&ic->ic_bmiss_task, 0, beacon_miss, ic); in ieee80211_proto_attach()
283 TASK_INIT(&ic->ic_chw_task, 0, update_chw, ic); in ieee80211_proto_attach()
284 TASK_INIT(&ic->ic_restart_task, 0, restart_vaps, ic); in ieee80211_proto_attach()
286 ic->ic_wme.wme_hipri_switch_hysteresis = in ieee80211_proto_attach()
290 ic->ic_send_mgmt = ieee80211_send_mgmt; in ieee80211_proto_attach()
291 ic->ic_raw_xmit = null_raw_xmit; in ieee80211_proto_attach()
324 struct ieee80211com *ic = vap->iv_ic; in ieee80211_proto_vattach()
325 struct ifnet *ifp = vap->iv_ifp; in ieee80211_proto_vattach()
329 ifp->if_hdrlen = ic->ic_headroom in ieee80211_proto_vattach()
334 vap->iv_rtsthreshold = IEEE80211_RTS_DEFAULT; in ieee80211_proto_vattach()
335 vap->iv_fragthreshold = IEEE80211_FRAG_DEFAULT; in ieee80211_proto_vattach()
336 vap->iv_bmiss_max = IEEE80211_BMISS_MAX; in ieee80211_proto_vattach()
337 callout_init_mtx(&vap->iv_swbmiss, IEEE80211_LOCK_OBJ(ic), 0); in ieee80211_proto_vattach()
338 callout_init(&vap->iv_mgtsend, 1); in ieee80211_proto_vattach()
340 TASK_INIT(&vap->iv_nstate_task[i], 0, ieee80211_newstate_cb, vap); in ieee80211_proto_vattach()
341 TASK_INIT(&vap->iv_swbmiss_task, 0, beacon_swmiss, vap); in ieee80211_proto_vattach()
342 TASK_INIT(&vap->iv_wme_task, 0, vap_update_wme, vap); in ieee80211_proto_vattach()
343 TASK_INIT(&vap->iv_slot_task, 0, vap_update_slot, vap); in ieee80211_proto_vattach()
344 TASK_INIT(&vap->iv_erp_protmode_task, 0, vap_update_erp_protmode, vap); in ieee80211_proto_vattach()
345 TASK_INIT(&vap->iv_ht_protmode_task, 0, vap_update_ht_protmode, vap); in ieee80211_proto_vattach()
346 TASK_INIT(&vap->iv_preamble_task, 0, vap_update_preamble, vap); in ieee80211_proto_vattach()
354 if (isclr(ic->ic_modecaps, i)) in ieee80211_proto_vattach()
357 const struct ieee80211_rateset *rs = &ic->ic_sup_rates[i]; in ieee80211_proto_vattach()
359 vap->iv_txparms[i].ucastrate = IEEE80211_FIXED_RATE_NONE; in ieee80211_proto_vattach()
369 * At least one 11n AP (DLINK DIR-825) is reported to drop in ieee80211_proto_vattach()
372 * See also: 9.6.0 of the 802.11n-2009 specification. in ieee80211_proto_vattach()
376 vap->iv_txparms[i].mgmtrate = 0 | IEEE80211_RATE_MCS; in ieee80211_proto_vattach()
377 vap->iv_txparms[i].mcastrate = 0 | IEEE80211_RATE_MCS; in ieee80211_proto_vattach()
379 vap->iv_txparms[i].mgmtrate = in ieee80211_proto_vattach()
380 rs->rs_rates[0] & IEEE80211_RATE_VAL; in ieee80211_proto_vattach()
381 vap->iv_txparms[i].mcastrate = in ieee80211_proto_vattach()
382 rs->rs_rates[0] & IEEE80211_RATE_VAL; in ieee80211_proto_vattach()
385 vap->iv_txparms[i].mgmtrate = rs->rs_rates[0] & IEEE80211_RATE_VAL; in ieee80211_proto_vattach()
386 vap->iv_txparms[i].mcastrate = rs->rs_rates[0] & IEEE80211_RATE_VAL; in ieee80211_proto_vattach()
387 vap->iv_txparms[i].maxretry = IEEE80211_TXMAX_DEFAULT; in ieee80211_proto_vattach()
389 vap->iv_roaming = IEEE80211_ROAMING_AUTO; in ieee80211_proto_vattach()
391 vap->iv_update_beacon = null_update_beacon; in ieee80211_proto_vattach()
392 vap->iv_deliver_data = ieee80211_deliver_data; in ieee80211_proto_vattach()
393 vap->iv_protmode = IEEE80211_PROT_CTSONLY; in ieee80211_proto_vattach()
394 vap->iv_update_bss = vap_update_bss; in ieee80211_proto_vattach()
397 ic->ic_vattach[vap->iv_opmode](vap); in ieee80211_proto_vattach()
410 if (vap->iv_opdetach != NULL) in ieee80211_proto_vdetach()
411 vap->iv_opdetach(vap); in ieee80211_proto_vdetach()
417 if (vap->iv_auth->ia_detach != NULL) in ieee80211_proto_vdetach()
418 vap->iv_auth->ia_detach(vap); in ieee80211_proto_vdetach()
422 if (vap->iv_acl != NULL) in ieee80211_proto_vdetach()
423 vap->iv_acl->iac_detach(vap); in ieee80211_proto_vdetach()
425 FREEAPPIE(vap->iv_appie_beacon); in ieee80211_proto_vdetach()
426 FREEAPPIE(vap->iv_appie_probereq); in ieee80211_proto_vdetach()
427 FREEAPPIE(vap->iv_appie_proberesp); in ieee80211_proto_vdetach()
428 FREEAPPIE(vap->iv_appie_assocreq); in ieee80211_proto_vdetach()
429 FREEAPPIE(vap->iv_appie_assocresp); in ieee80211_proto_vdetach()
430 FREEAPPIE(vap->iv_appie_wpa); in ieee80211_proto_vdetach()
435 * Simple-minded authenticator module support.
439 /* XXX well-known names */
499 * Very simple-minded ACL module support.
507 printf("wlan: %s acl policy registered\n", iac->iac_name); in ieee80211_aclator_register()
516 printf("wlan: %s acl policy unregistered\n", iac->iac_name); in ieee80211_aclator_unregister()
524 return acl != NULL && strcmp(acl->iac_name, name) == 0 ? acl : NULL; in ieee80211_aclator_get()
560 switch (wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) { in ieee80211_dump_pkt()
562 printf("NODS %s", ether_sprintf(wh->i_addr2)); in ieee80211_dump_pkt()
563 printf("->%s", ether_sprintf(wh->i_addr1)); in ieee80211_dump_pkt()
564 printf("(%s)", ether_sprintf(wh->i_addr3)); in ieee80211_dump_pkt()
567 printf("TODS %s", ether_sprintf(wh->i_addr2)); in ieee80211_dump_pkt()
568 printf("->%s", ether_sprintf(wh->i_addr3)); in ieee80211_dump_pkt()
569 printf("(%s)", ether_sprintf(wh->i_addr1)); in ieee80211_dump_pkt()
572 printf("FRDS %s", ether_sprintf(wh->i_addr3)); in ieee80211_dump_pkt()
573 printf("->%s", ether_sprintf(wh->i_addr1)); in ieee80211_dump_pkt()
574 printf("(%s)", ether_sprintf(wh->i_addr2)); in ieee80211_dump_pkt()
578 printf("->%s", ether_sprintf(wh->i_addr3)); in ieee80211_dump_pkt()
579 printf("(%s", ether_sprintf(wh->i_addr2)); in ieee80211_dump_pkt()
580 printf("->%s)", ether_sprintf(wh->i_addr1)); in ieee80211_dump_pkt()
583 switch (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) { in ieee80211_dump_pkt()
588 printf(" %s", ieee80211_mgt_subtype_name(wh->i_fc[0])); in ieee80211_dump_pkt()
591 printf(" type#%d", wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK); in ieee80211_dump_pkt()
597 printf(" QoS [TID %u%s]", qwh->i_qos[0] & IEEE80211_QOS_TID, in ieee80211_dump_pkt()
598 qwh->i_qos[0] & IEEE80211_QOS_ACKPOLICY ? " ACM" : ""); in ieee80211_dump_pkt()
631 for (i = 0; i < rs->rs_nrates; i++) in findrix()
632 if ((rs->rs_rates[i] & IEEE80211_RATE_VAL) == r) in findrix()
634 return -1; in findrix()
641 struct ieee80211vap *vap = ni->ni_vap; in ieee80211_fix_rate()
642 struct ieee80211com *ic = ni->ni_ic; in ieee80211_fix_rate()
650 ucastrate = vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)].ucastrate; in ieee80211_fix_rate()
685 ieee80211_get_suphtrates(ic, ni->ni_chan); in ieee80211_fix_rate()
687 srs = ieee80211_get_suprates(ic, ni->ni_chan); in ieee80211_fix_rate()
688 for (i = 0; i < nrs->rs_nrates; ) { in ieee80211_fix_rate()
693 for (j = i + 1; j < nrs->rs_nrates; j++) { in ieee80211_fix_rate()
694 if (IEEE80211_RV(nrs->rs_rates[i]) > in ieee80211_fix_rate()
695 IEEE80211_RV(nrs->rs_rates[j])) { in ieee80211_fix_rate()
696 r = nrs->rs_rates[i]; in ieee80211_fix_rate()
697 nrs->rs_rates[i] = nrs->rs_rates[j]; in ieee80211_fix_rate()
698 nrs->rs_rates[j] = r; in ieee80211_fix_rate()
702 r = nrs->rs_rates[i] & IEEE80211_RATE_VAL; in ieee80211_fix_rate()
722 (nrs->rs_rates[i] & IEEE80211_RATE_BASIC)) in ieee80211_fix_rate()
729 nrs->rs_rates[i] = srs->rs_rates[rix]; in ieee80211_fix_rate()
736 nrs->rs_nrates--; in ieee80211_fix_rate()
737 for (j = i; j < nrs->rs_nrates; j++) in ieee80211_fix_rate()
738 nrs->rs_rates[j] = nrs->rs_rates[j + 1]; in ieee80211_fix_rate()
739 nrs->rs_rates[j] = 0; in ieee80211_fix_rate()
743 okrate = nrs->rs_rates[i]; in ieee80211_fix_rate()
758 * Reset 11g-related state.
760 * This is for per-VAP ERP/11g state.
763 * per-VAP and in here.
768 struct ieee80211com *ic = vap->iv_ic; in ieee80211_vap_reset_erp()
770 vap->iv_nonerpsta = 0; in ieee80211_vap_reset_erp()
771 vap->iv_longslotsta = 0; in ieee80211_vap_reset_erp()
773 vap->iv_flags &= ~IEEE80211_F_USEPROT; in ieee80211_vap_reset_erp()
775 * Set short preamble and ERP barker-preamble flags. in ieee80211_vap_reset_erp()
777 if (IEEE80211_IS_CHAN_A(ic->ic_curchan) || in ieee80211_vap_reset_erp()
778 (vap->iv_caps & IEEE80211_C_SHPREAMBLE)) { in ieee80211_vap_reset_erp()
779 vap->iv_flags |= IEEE80211_F_SHPREAMBLE; in ieee80211_vap_reset_erp()
780 vap->iv_flags &= ~IEEE80211_F_USEBARKER; in ieee80211_vap_reset_erp()
782 vap->iv_flags &= ~IEEE80211_F_SHPREAMBLE; in ieee80211_vap_reset_erp()
783 vap->iv_flags |= IEEE80211_F_USEBARKER; in ieee80211_vap_reset_erp()
792 IEEE80211_IS_CHAN_A(ic->ic_curchan) || in ieee80211_vap_reset_erp()
793 IEEE80211_IS_CHAN_HT(ic->ic_curchan) || in ieee80211_vap_reset_erp()
794 (IEEE80211_IS_CHAN_ANYG(ic->ic_curchan) && in ieee80211_vap_reset_erp()
795 vap->iv_opmode == IEEE80211_M_HOSTAP && in ieee80211_vap_reset_erp()
796 (ic->ic_caps & IEEE80211_C_SHSLOT))); in ieee80211_vap_reset_erp()
800 * Reset 11g-related state.
803 * a re-check of all the VAPs after setup to update said state.
809 ic->ic_flags &= ~IEEE80211_F_USEPROT; in ieee80211_reset_erp()
811 * Set short preamble and ERP barker-preamble flags. in ieee80211_reset_erp()
813 if (IEEE80211_IS_CHAN_A(ic->ic_curchan) || in ieee80211_reset_erp()
814 (ic->ic_caps & IEEE80211_C_SHPREAMBLE)) { in ieee80211_reset_erp()
815 ic->ic_flags |= IEEE80211_F_SHPREAMBLE; in ieee80211_reset_erp()
816 ic->ic_flags &= ~IEEE80211_F_USEBARKER; in ieee80211_reset_erp()
818 ic->ic_flags &= ~IEEE80211_F_SHPREAMBLE; in ieee80211_reset_erp()
819 ic->ic_flags |= IEEE80211_F_USEBARKER; in ieee80211_reset_erp()
822 /* XXX TODO: schedule a new per-VAP ERP calculation */ in ieee80211_reset_erp()
830 IEEE80211_LOCK_ASSERT(vap->iv_ic); in vap_update_bss()
832 obss = vap->iv_bss; in vap_update_bss()
833 vap->iv_bss = ni; in vap_update_bss()
841 * For per-VAP slot time configuration, call the VAP
845 * If the per-VAP method is called then it's expected that
846 * the driver/firmware will take care of turning the per-VAP
849 * If the per-VAP method is not called then the global flags will be
860 struct ieee80211com *ic = vap->iv_ic; in vap_update_slot()
865 * Per-VAP path - we've already had the flags updated; in vap_update_slot()
868 if (vap->iv_updateslot != NULL) { in vap_update_slot()
869 vap->iv_updateslot(vap); in vap_update_slot()
878 * short slot. If any vap has it disabled then in vap_update_slot()
879 * we leave it globally disabled. This should provide in vap_update_slot()
880 * correct behaviour in a multi-BSS scenario where in vap_update_slot()
881 * at least one VAP has short slot disabled for some in vap_update_slot()
885 TAILQ_FOREACH(iv, &ic->ic_vaps, iv_next) { in vap_update_slot()
886 if (iv->iv_flags & IEEE80211_F_SHSLOT) in vap_update_slot()
893 * It looks backwards but - if the number of short slot VAPs in vap_update_slot()
896 * of them have short slot disabled. in vap_update_slot()
899 ic->ic_flags &= ~IEEE80211_F_SHSLOT; in vap_update_slot()
901 ic->ic_flags |= IEEE80211_F_SHSLOT; in vap_update_slot()
907 if (ic->ic_updateslot != NULL) in vap_update_slot()
908 ic->ic_updateslot(ic); in vap_update_slot()
916 * for the global flag to be enabled. All VAPs with it disabled
917 * is enough for it to be disabled.
921 * offload firmware that's doing channel changes (eg off-channel
922 * TDLS, off-channel STA, off-channel P2P STA/AP) may get some
933 struct ieee80211com *ic = vap->iv_ic; in vap_update_erp_protmode()
942 * For now we assume that if a driver can handle this per-VAP in vap_update_erp_protmode()
943 * then it'll ignore the ic->ic_protmode variant and instead in vap_update_erp_protmode()
947 TAILQ_FOREACH(iv, &ic->ic_vaps, iv_next) { in vap_update_erp_protmode()
948 if (iv->iv_flags & IEEE80211_F_USEPROT) in vap_update_erp_protmode()
950 if (iv->iv_flags_ext & IEEE80211_FEXT_NONERP_PR) in vap_update_erp_protmode()
955 ic->ic_flags |= IEEE80211_F_USEPROT; in vap_update_erp_protmode()
957 ic->ic_flags &= ~IEEE80211_F_USEPROT; in vap_update_erp_protmode()
960 ic->ic_flags_ext |= IEEE80211_FEXT_NONERP_PR; in vap_update_erp_protmode()
962 ic->ic_flags_ext &= ~IEEE80211_FEXT_NONERP_PR; in vap_update_erp_protmode()
978 * for multi-VAP operation, even if it's on a different in vap_update_erp_protmode()
982 if (vap->iv_erp_protmode_update != NULL) in vap_update_erp_protmode()
983 vap->iv_erp_protmode_update(vap); in vap_update_erp_protmode()
999 struct ieee80211com *ic = vap->iv_ic; in vap_update_preamble()
1007 * For now we assume that if a driver can handle this per-VAP in vap_update_preamble()
1008 * then it'll ignore the ic->ic_flags variant and instead in vap_update_preamble()
1012 TAILQ_FOREACH(iv, &ic->ic_vaps, iv_next) { in vap_update_preamble()
1013 if (iv->iv_flags & IEEE80211_F_USEBARKER) in vap_update_preamble()
1015 if (iv->iv_flags & IEEE80211_F_SHPREAMBLE) in vap_update_preamble()
1033 ic->ic_flags |= IEEE80211_F_SHPREAMBLE; in vap_update_preamble()
1034 ic->ic_flags &= ~IEEE80211_F_USEBARKER; in vap_update_preamble()
1036 ic->ic_flags &= ~IEEE80211_F_SHPREAMBLE; in vap_update_preamble()
1037 ic->ic_flags |= IEEE80211_F_USEBARKER; in vap_update_preamble()
1042 !! (ic->ic_flags & IEEE80211_F_USEBARKER), in vap_update_preamble()
1043 !! (ic->ic_flags & IEEE80211_F_SHPREAMBLE)); in vap_update_preamble()
1051 if (vap->iv_preamble_update != NULL) in vap_update_preamble()
1052 vap->iv_preamble_update(vap); in vap_update_preamble()
1066 struct ieee80211com *ic = vap->iv_ic; in vap_update_ht_protmode()
1082 * For now we assume that if a driver can handle this per-VAP in vap_update_ht_protmode()
1083 * then it'll ignore the ic->ic_htprotmode / ic->ic_curhtprotmode in vap_update_ht_protmode()
1086 * XXX TODO: non-greenfield STAs present (IEEE80211_HTINFO_NONGF_PRESENT) ! in vap_update_ht_protmode()
1090 TAILQ_FOREACH(iv, &ic->ic_vaps, iv_next) { in vap_update_ht_protmode()
1092 /* overlapping BSSes advertising non-HT status present */ in vap_update_ht_protmode()
1093 if (iv->iv_flags_ht & IEEE80211_FHT_NONHT_PR) in vap_update_ht_protmode()
1096 if (iv->iv_curhtprotmode & IEEE80211_HTINFO_NONHT_PRESENT) in vap_update_ht_protmode()
1098 switch (iv->iv_curhtprotmode & IEEE80211_HTINFO_OPMODE) { in vap_update_ht_protmode()
1114 !! (iv->iv_flags_ht & IEEE80211_FHT_NONHT_PR), in vap_update_ht_protmode()
1115 iv->iv_curhtprotmode); in vap_update_ht_protmode()
1117 num_ht_sta += iv->iv_ht_sta_assoc; in vap_update_ht_protmode()
1118 num_ht40_sta += iv->iv_ht40_sta_assoc; in vap_update_ht_protmode()
1119 num_sta += iv->iv_sta_assoc; in vap_update_ht_protmode()
1123 * Step 1 - if any VAPs indicate NONHT_PR set (overlapping BSS in vap_update_ht_protmode()
1124 * non-HT present), set it here. This shouldn't be used by in vap_update_ht_protmode()
1129 ic->ic_flags_ht |= IEEE80211_FHT_NONHT_PR; in vap_update_ht_protmode()
1131 ic->ic_flags_ht &= ~IEEE80211_FHT_NONHT_PR; in vap_update_ht_protmode()
1134 * Step 2 - default HT protection mode to MIXED (802.11-2016 10.26.3.1.) in vap_update_ht_protmode()
1143 * + The fall-through is MIXED, because it means we have some odd in vap_update_ht_protmode()
1144 * non HT40-involved combination of opmode and this is the most in vap_update_ht_protmode()
1147 ic->ic_curhtprotmode = IEEE80211_HTINFO_OPMODE_MIXED; in vap_update_ht_protmode()
1150 ic->ic_curhtprotmode = IEEE80211_HTINFO_OPMODE_PURE; in vap_update_ht_protmode()
1153 ic->ic_curhtprotmode = IEEE80211_HTINFO_OPMODE_PROTOPT; in vap_update_ht_protmode()
1162 ic->ic_curhtprotmode = IEEE80211_HTINFO_OPMODE_HT20PR; in vap_update_ht_protmode()
1165 * Step 3 - if any of the stations across the VAPs are in vap_update_ht_protmode()
1166 * non-HT then this needs to be flipped back to MIXED. in vap_update_ht_protmode()
1169 ic->ic_curhtprotmode = IEEE80211_HTINFO_OPMODE_MIXED; in vap_update_ht_protmode()
1172 * Step 4 - If we see any overlapping BSS non-HT stations in vap_update_ht_protmode()
1176 ic->ic_curhtprotmode |= IEEE80211_HTINFO_NONHT_PRESENT; in vap_update_ht_protmode()
1179 TAILQ_FOREACH(iv, &ic->ic_vaps, iv_next) in vap_update_ht_protmode()
1187 !! (ic->ic_flags_ht & IEEE80211_FHT_NONHT_PR), in vap_update_ht_protmode()
1188 ic->ic_curhtprotmode); in vap_update_ht_protmode()
1191 if (vap->iv_ht_protmode_update != NULL) in vap_update_ht_protmode()
1192 vap->iv_ht_protmode_update(vap); in vap_update_ht_protmode()
1198 * This is the per-VAP slot time state.
1203 struct ieee80211com *ic = vap->iv_ic; in ieee80211_vap_set_shortslottime()
1208 * Only modify the per-VAP slot time. in ieee80211_vap_set_shortslottime()
1211 vap->iv_flags |= IEEE80211_F_SHSLOT; in ieee80211_vap_set_shortslottime()
1213 vap->iv_flags &= ~IEEE80211_F_SHSLOT; in ieee80211_vap_set_shortslottime()
1218 ieee80211_runtask(ic, &vap->iv_slot_task); in ieee80211_vap_set_shortslottime()
1225 * For now it simply copies the global flags into the per-vap
1227 * both global and per-VAP flags, especially useful for
1228 * and STA+STA multi-channel operation (eg p2p).
1233 struct ieee80211com *ic = vap->iv_ic; in ieee80211_vap_update_preamble()
1240 ieee80211_runtask(ic, &vap->iv_preamble_task); in ieee80211_vap_update_preamble()
1250 struct ieee80211com *ic = vap->iv_ic; in ieee80211_vap_update_erp_protmode()
1257 ieee80211_runtask(ic, &vap->iv_erp_protmode_task); in ieee80211_vap_update_erp_protmode()
1267 struct ieee80211com *ic = vap->iv_ic; in ieee80211_vap_update_ht_protmode()
1274 ieee80211_runtask(ic, &vap->iv_ht_protmode_task); in ieee80211_vap_update_ht_protmode()
1287 if (rs->rs_nrates < nitems(rates)) in ieee80211_iserp_rateset()
1290 for (j = 0; j < rs->rs_nrates; j++) { in ieee80211_iserp_rateset()
1291 int r = rs->rs_rates[j] & IEEE80211_RATE_VAL; in ieee80211_iserp_rateset()
1308 * 11b rates. There's also a pseudo 11a-mode used to mark only
1334 for (i = 0; i < rs->rs_nrates; i++) { in setbasicrates()
1336 rs->rs_rates[i] &= IEEE80211_RATE_VAL; in setbasicrates()
1338 if (basic[mode].rs_rates[j] == rs->rs_rates[i]) { in setbasicrates()
1339 rs->rs_rates[i] |= IEEE80211_RATE_BASIC; in setbasicrates()
1493 wmep->wmep_aifsn = phy->aifsn; in _setifsparams()
1494 wmep->wmep_logcwmin = phy->logcwmin; in _setifsparams()
1495 wmep->wmep_logcwmax = phy->logcwmax; in _setifsparams()
1496 wmep->wmep_txopLimit = phy->txopLimit; in _setifsparams()
1503 wmep->wmep_acm = phy->acm; in setwmeparams()
1509 wmep->wmep_acm, wmep->wmep_aifsn, wmep->wmep_logcwmin, in setwmeparams()
1510 wmep->wmep_logcwmax, wmep->wmep_txopLimit); in setwmeparams()
1516 struct ieee80211com *ic = vap->iv_ic; in ieee80211_wme_initparams_locked()
1517 struct ieee80211_wme_state *wme = &ic->ic_wme; in ieee80211_wme_initparams_locked()
1525 if ((ic->ic_caps & IEEE80211_C_WME) == 0 || ic->ic_nrunning > 1) in ieee80211_wme_initparams_locked()
1538 wme->wme_wmeChanParams.cap_info = 0xfe; in ieee80211_wme_initparams_locked()
1542 * always use auto mode. We know we'll be called when in ieee80211_wme_initparams_locked()
1546 if (ic->ic_bsschan != IEEE80211_CHAN_ANYC) in ieee80211_wme_initparams_locked()
1547 mode = ieee80211_chan2mode(ic->ic_bsschan); in ieee80211_wme_initparams_locked()
1570 wmep = &wme->wme_wmeChanParams.cap_wmeParams[i]; in ieee80211_wme_initparams_locked()
1571 if (ic->ic_opmode == IEEE80211_M_HOSTAP) { in ieee80211_wme_initparams_locked()
1576 wmep = &wme->wme_wmeBssChanParams.cap_wmeParams[i]; in ieee80211_wme_initparams_locked()
1580 if (vap->iv_bss != NULL) { in ieee80211_wme_initparams_locked()
1587 wme->wme_hipri_switch_thresh = in ieee80211_wme_initparams_locked()
1588 (HIGH_PRI_SWITCH_THRESH * vap->iv_bss->ni_intval) / 100; in ieee80211_wme_initparams_locked()
1589 wme->wme_flags &= ~WME_F_AGGRMODE; in ieee80211_wme_initparams_locked()
1597 struct ieee80211com *ic = vap->iv_ic; in ieee80211_wme_initparams()
1626 struct ieee80211com *ic = vap->iv_ic; in ieee80211_wme_updateparams_locked()
1627 struct ieee80211_wme_state *wme = &ic->ic_wme; in ieee80211_wme_updateparams_locked()
1639 chanp = &wme->wme_chanParams.cap_wmeParams[i]; in ieee80211_wme_updateparams_locked()
1640 wmep = &wme->wme_wmeChanParams.cap_wmeParams[i]; in ieee80211_wme_updateparams_locked()
1641 chanp->wmep_aifsn = wmep->wmep_aifsn; in ieee80211_wme_updateparams_locked()
1642 chanp->wmep_logcwmin = wmep->wmep_logcwmin; in ieee80211_wme_updateparams_locked()
1643 chanp->wmep_logcwmax = wmep->wmep_logcwmax; in ieee80211_wme_updateparams_locked()
1644 chanp->wmep_txopLimit = wmep->wmep_txopLimit; in ieee80211_wme_updateparams_locked()
1646 chanp = &wme->wme_bssChanParams.cap_wmeParams[i]; in ieee80211_wme_updateparams_locked()
1647 wmep = &wme->wme_wmeBssChanParams.cap_wmeParams[i]; in ieee80211_wme_updateparams_locked()
1648 chanp->wmep_aifsn = wmep->wmep_aifsn; in ieee80211_wme_updateparams_locked()
1649 chanp->wmep_logcwmin = wmep->wmep_logcwmin; in ieee80211_wme_updateparams_locked()
1650 chanp->wmep_logcwmax = wmep->wmep_logcwmax; in ieee80211_wme_updateparams_locked()
1651 chanp->wmep_txopLimit = wmep->wmep_txopLimit; in ieee80211_wme_updateparams_locked()
1656 * always use auto mode. We know we'll be called when in ieee80211_wme_updateparams_locked()
1660 if (ic->ic_bsschan != IEEE80211_CHAN_ANYC) in ieee80211_wme_updateparams_locked()
1661 mode = ieee80211_chan2mode(ic->ic_bsschan); in ieee80211_wme_updateparams_locked()
1671 * legacy/non-QoS traffic. in ieee80211_wme_updateparams_locked()
1675 if (vap->iv_opmode == IEEE80211_M_HOSTAP && in ieee80211_wme_updateparams_locked()
1676 (wme->wme_flags & WME_F_AGGRMODE) != 0) in ieee80211_wme_updateparams_locked()
1680 * Station? Only if we're in a non-QoS BSS. in ieee80211_wme_updateparams_locked()
1682 else if ((vap->iv_opmode == IEEE80211_M_STA && in ieee80211_wme_updateparams_locked()
1683 (vap->iv_bss->ni_flags & IEEE80211_NODE_QOS) == 0)) in ieee80211_wme_updateparams_locked()
1689 else if ((vap->iv_opmode == IEEE80211_M_IBSS) && in ieee80211_wme_updateparams_locked()
1690 (vap->iv_flags & IEEE80211_F_WME)) in ieee80211_wme_updateparams_locked()
1694 * If WME is disabled on this VAP, default to aggressive mode in ieee80211_wme_updateparams_locked()
1697 if ((vap->iv_flags & IEEE80211_F_WME) == 0) in ieee80211_wme_updateparams_locked()
1705 chanp = &wme->wme_chanParams.cap_wmeParams[WME_AC_BE]; in ieee80211_wme_updateparams_locked()
1706 bssp = &wme->wme_bssChanParams.cap_wmeParams[WME_AC_BE]; in ieee80211_wme_updateparams_locked()
1708 chanp->wmep_aifsn = bssp->wmep_aifsn = aggrParam[mode].aifsn; in ieee80211_wme_updateparams_locked()
1709 chanp->wmep_logcwmin = bssp->wmep_logcwmin = in ieee80211_wme_updateparams_locked()
1711 chanp->wmep_logcwmax = bssp->wmep_logcwmax = in ieee80211_wme_updateparams_locked()
1713 chanp->wmep_txopLimit = bssp->wmep_txopLimit = in ieee80211_wme_updateparams_locked()
1714 (vap->iv_flags & IEEE80211_F_BURST) ? in ieee80211_wme_updateparams_locked()
1719 chanp->wmep_acm, chanp->wmep_aifsn, chanp->wmep_logcwmin, in ieee80211_wme_updateparams_locked()
1720 chanp->wmep_logcwmax, chanp->wmep_txopLimit); in ieee80211_wme_updateparams_locked()
1729 if (vap->iv_opmode == IEEE80211_M_HOSTAP && in ieee80211_wme_updateparams_locked()
1730 vap->iv_sta_assoc < 2 && (wme->wme_flags & WME_F_AGGRMODE) != 0) { in ieee80211_wme_updateparams_locked()
1747 chanp = &wme->wme_chanParams.cap_wmeParams[WME_AC_BE]; in ieee80211_wme_updateparams_locked()
1748 bssp = &wme->wme_bssChanParams.cap_wmeParams[WME_AC_BE]; in ieee80211_wme_updateparams_locked()
1750 chanp->wmep_logcwmin = bssp->wmep_logcwmin = logCwMin[mode]; in ieee80211_wme_updateparams_locked()
1753 ieee80211_wme_acnames[WME_AC_BE], chanp->wmep_logcwmin); in ieee80211_wme_updateparams_locked()
1757 ieee80211_runtask(ic, &vap->iv_wme_task); in ieee80211_wme_updateparams_locked()
1761 vap->iv_opmode == IEEE80211_M_STA ? in ieee80211_wme_updateparams_locked()
1762 wme->wme_wmeChanParams.cap_info : in ieee80211_wme_updateparams_locked()
1763 wme->wme_bssChanParams.cap_info); in ieee80211_wme_updateparams_locked()
1769 struct ieee80211com *ic = vap->iv_ic; in ieee80211_wme_updateparams()
1771 if (ic->ic_caps & IEEE80211_C_WME) { in ieee80211_wme_updateparams()
1788 memcpy(wp, &vap->iv_ic->ic_wme.wme_chanParams, sizeof(*wp)); in ieee80211_wme_vap_getparams()
1801 memcpy(wp, &ic->ic_wme.wme_chanParams, sizeof(*wp)); in ieee80211_wme_ic_getparams()
1821 return (!! vap->iv_ic->ic_wme.wme_chanParams.cap_wmeParams[ac].wmep_noackPolicy); in ieee80211_wme_vap_ac_is_noack()
1829 ic->ic_parent(ic); in parent_updown()
1837 ic->ic_update_mcast(ic); in update_mcast()
1845 ic->ic_update_promisc(ic); in update_promisc()
1853 ic->ic_set_channel(ic); in update_channel()
1865 ic->ic_update_chw(ic); in update_chw()
1871 * In preparation for per-VAP WME configuration, call the VAP
1873 * older global method. There isn't a per-VAP WME configuration
1880 struct ieee80211com *ic = vap->iv_ic; in vap_update_wme()
1881 struct ieee80211_wme_state *wme = &ic->ic_wme; in vap_update_wme()
1884 if (vap->iv_wme_update != NULL) in vap_update_wme()
1885 vap->iv_wme_update(vap, in vap_update_wme()
1886 ic->ic_wme.wme_chanParams.cap_wmeParams); in vap_update_wme()
1888 ic->ic_wme.wme_update(ic); in vap_update_wme()
1896 if (vap->iv_opmode == IEEE80211_M_HOSTAP in vap_update_wme()
1897 || vap->iv_opmode == IEEE80211_M_IBSS) { in vap_update_wme()
1902 wme->wme_bssChanParams.cap_info = in vap_update_wme()
1903 (wme->wme_bssChanParams.cap_info+1) & WME_QOSINFO_COUNT; in vap_update_wme()
1921 * to auto-configure the parent device up/down).
1926 taskqueue_block(ic->ic_tq); in ieee80211_waitfor_parent()
1927 ieee80211_draintask(ic, &ic->ic_parent_task); in ieee80211_waitfor_parent()
1928 ieee80211_draintask(ic, &ic->ic_mcast_task); in ieee80211_waitfor_parent()
1929 ieee80211_draintask(ic, &ic->ic_promisc_task); in ieee80211_waitfor_parent()
1930 ieee80211_draintask(ic, &ic->ic_chan_task); in ieee80211_waitfor_parent()
1931 ieee80211_draintask(ic, &ic->ic_bmiss_task); in ieee80211_waitfor_parent()
1932 ieee80211_draintask(ic, &ic->ic_chw_task); in ieee80211_waitfor_parent()
1933 taskqueue_unblock(ic->ic_tq); in ieee80211_waitfor_parent()
1950 struct ieee80211com *ic = vap->iv_ic; in ieee80211_start_check_reset_chan()
1952 if ((vap->iv_opmode == IEEE80211_M_IBSS && in ieee80211_start_check_reset_chan()
1953 IEEE80211_IS_CHAN_NOADHOC(ic->ic_curchan)) || in ieee80211_start_check_reset_chan()
1954 (vap->iv_opmode == IEEE80211_M_HOSTAP && in ieee80211_start_check_reset_chan()
1955 IEEE80211_IS_CHAN_NOHOSTAP(ic->ic_curchan))) in ieee80211_start_check_reset_chan()
1966 struct ieee80211com *ic = vap->iv_ic; in ieee80211_start_reset_chan()
1968 ic->ic_curchan = &ic->ic_channels[0]; in ieee80211_start_reset_chan()
1979 struct ifnet *ifp = vap->iv_ifp; in ieee80211_start_locked()
1980 struct ieee80211com *ic = vap->iv_ic; in ieee80211_start_locked()
1986 "start running, %d vaps running\n", ic->ic_nrunning); in ieee80211_start_locked()
1988 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { in ieee80211_start_locked()
1997 ifp->if_drv_flags |= IFF_DRV_RUNNING; in ieee80211_start_locked()
2002 * to be brought up auto-up the parent if necessary. in ieee80211_start_locked()
2004 if (ic->ic_nrunning++ == 0) { in ieee80211_start_locked()
2011 "%s: up parent %s\n", __func__, ic->ic_name); in ieee80211_start_locked()
2012 ieee80211_runtask(ic, &ic->ic_parent_task); in ieee80211_start_locked()
2020 if (vap->iv_roaming != IEEE80211_ROAMING_MANUAL) { in ieee80211_start_locked()
2021 if (vap->iv_opmode == IEEE80211_M_STA) { in ieee80211_start_locked()
2028 * simply by re-associating. Otherwise we need to in ieee80211_start_locked()
2029 * re-scan to select an appropriate ap. in ieee80211_start_locked()
2031 if (vap->iv_state >= IEEE80211_S_RUN) in ieee80211_start_locked()
2046 vap->iv_flags_ext |= IEEE80211_FEXT_REINIT; in ieee80211_start_locked()
2047 if (vap->iv_opmode == IEEE80211_M_MONITOR || in ieee80211_start_locked()
2048 vap->iv_opmode == IEEE80211_M_WDS) in ieee80211_start_locked()
2050 IEEE80211_S_RUN, -1); in ieee80211_start_locked()
2069 IEEE80211_LOCK(vap->iv_ic); in ieee80211_init()
2071 IEEE80211_UNLOCK(vap->iv_ic); in ieee80211_init()
2083 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { in ieee80211_start_all()
2084 struct ifnet *ifp = vap->iv_ifp; in ieee80211_start_all()
2101 struct ieee80211com *ic = vap->iv_ic; in ieee80211_stop_locked()
2102 struct ifnet *ifp = vap->iv_ifp; in ieee80211_stop_locked()
2107 "stop running, %d vaps running\n", ic->ic_nrunning); in ieee80211_stop_locked()
2109 ieee80211_new_state_locked(vap, IEEE80211_S_INIT, -1); in ieee80211_stop_locked()
2110 if (ifp->if_drv_flags & IFF_DRV_RUNNING) { in ieee80211_stop_locked()
2111 ifp->if_drv_flags &= ~IFF_DRV_RUNNING; /* mark us stopped */ in ieee80211_stop_locked()
2113 if (--ic->ic_nrunning == 0) { in ieee80211_stop_locked()
2116 "down parent %s\n", ic->ic_name); in ieee80211_stop_locked()
2117 ieee80211_runtask(ic, &ic->ic_parent_task); in ieee80211_stop_locked()
2125 struct ieee80211com *ic = vap->iv_ic; in ieee80211_stop()
2141 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { in ieee80211_stop_all()
2142 struct ifnet *ifp = vap->iv_ifp; in ieee80211_stop_all()
2161 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { in ieee80211_suspend_all()
2162 struct ifnet *ifp = vap->iv_ifp; in ieee80211_suspend_all()
2164 vap->iv_flags_ext |= IEEE80211_FEXT_RESUME; in ieee80211_suspend_all()
2182 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { in ieee80211_resume_all()
2183 struct ifnet *ifp = vap->iv_ifp; in ieee80211_resume_all()
2185 (vap->iv_flags_ext & IEEE80211_FEXT_RESUME)) { in ieee80211_resume_all()
2186 vap->iv_flags_ext &= ~IEEE80211_FEXT_RESUME; in ieee80211_resume_all()
2203 taskqueue_enqueue(taskqueue_thread, &ic->ic_restart_task); in ieee80211_restart_all()
2210 if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) { in ieee80211_beacon_miss()
2212 ieee80211_runtask(ic, &ic->ic_bmiss_task); in ieee80211_beacon_miss()
2224 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { in beacon_miss()
2230 if (vap->iv_opmode == IEEE80211_M_STA && in beacon_miss()
2231 vap->iv_state >= IEEE80211_S_RUN && in beacon_miss()
2232 vap->iv_bmiss != NULL) in beacon_miss()
2233 vap->iv_bmiss(vap); in beacon_miss()
2242 struct ieee80211com *ic = vap->iv_ic; in beacon_swmiss()
2245 if (vap->iv_state >= IEEE80211_S_RUN) { in beacon_swmiss()
2247 vap->iv_bmiss(vap); in beacon_swmiss()
2261 struct ieee80211com *ic = vap->iv_ic; in ieee80211_swbmiss()
2265 KASSERT(vap->iv_state >= IEEE80211_S_RUN, in ieee80211_swbmiss()
2266 ("wrong state %d", vap->iv_state)); in ieee80211_swbmiss()
2268 if (ic->ic_flags & IEEE80211_F_SCAN) { in ieee80211_swbmiss()
2279 vap->iv_swbmiss_count = 0; in ieee80211_swbmiss()
2280 } else if (vap->iv_swbmiss_count == 0) { in ieee80211_swbmiss()
2281 if (vap->iv_bmiss != NULL) in ieee80211_swbmiss()
2282 ieee80211_runtask(ic, &vap->iv_swbmiss_task); in ieee80211_swbmiss()
2284 vap->iv_swbmiss_count = 0; in ieee80211_swbmiss()
2285 callout_reset(&vap->iv_swbmiss, vap->iv_swbmiss_period, in ieee80211_swbmiss()
2309 ic->ic_csa_newchan = c; in ieee80211_csa_startswitch()
2310 ic->ic_csa_mode = mode; in ieee80211_csa_startswitch()
2311 ic->ic_csa_count = count; in ieee80211_csa_startswitch()
2312 ic->ic_flags |= IEEE80211_F_CSAPENDING; in ieee80211_csa_startswitch()
2313 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { in ieee80211_csa_startswitch()
2314 if (vap->iv_opmode == IEEE80211_M_HOSTAP || in ieee80211_csa_startswitch()
2315 vap->iv_opmode == IEEE80211_M_IBSS || in ieee80211_csa_startswitch()
2316 vap->iv_opmode == IEEE80211_M_MBSS) in ieee80211_csa_startswitch()
2319 if (vap->iv_state == IEEE80211_S_RUN) in ieee80211_csa_startswitch()
2335 ic->ic_csa_newchan = NULL; in csa_completeswitch()
2336 ic->ic_flags &= ~IEEE80211_F_CSAPENDING; in csa_completeswitch()
2338 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) in csa_completeswitch()
2339 if (vap->iv_state == IEEE80211_S_CSA) in csa_completeswitch()
2361 KASSERT(ic->ic_flags & IEEE80211_F_CSAPENDING, ("csa not pending")); in ieee80211_csa_completeswitch()
2363 ieee80211_setcurchan(ic, ic->ic_csa_newchan); in ieee80211_csa_completeswitch()
2364 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) in ieee80211_csa_completeswitch()
2365 if (vap->iv_state == IEEE80211_S_CSA) in ieee80211_csa_completeswitch()
2366 vap->iv_bss->ni_chan = ic->ic_curchan; in ieee80211_csa_completeswitch()
2391 struct ieee80211com *ic = vap0->iv_ic; in ieee80211_cac_completeswitch()
2399 KASSERT(vap0->iv_state == IEEE80211_S_CAC, in ieee80211_cac_completeswitch()
2400 ("wrong state %d", vap0->iv_state)); in ieee80211_cac_completeswitch()
2403 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) in ieee80211_cac_completeswitch()
2404 if (vap->iv_state == IEEE80211_S_CAC && vap != vap0) in ieee80211_cac_completeswitch()
2418 struct ieee80211com *ic = vap0->iv_ic; in markwaiting()
2428 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { in markwaiting()
2431 if (vap->iv_state != IEEE80211_S_INIT) { in markwaiting()
2433 vap->iv_newstate(vap, IEEE80211_S_INIT, 0); in markwaiting()
2435 vap->iv_flags_ext |= IEEE80211_FEXT_SCANWAIT; in markwaiting()
2449 struct ieee80211com *ic = vap0->iv_ic; in wakeupwaiting()
2459 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { in wakeupwaiting()
2462 if (vap->iv_flags_ext & IEEE80211_FEXT_SCANWAIT) { in wakeupwaiting()
2463 vap->iv_flags_ext &= ~IEEE80211_FEXT_SCANWAIT; in wakeupwaiting()
2464 /* NB: sta's cannot go INIT->RUN */ in wakeupwaiting()
2471 * flag on a state transition to RUN from a non-RUN in wakeupwaiting()
2476 * a RUN->RUN transition! So the flag isn't/wasn't in wakeupwaiting()
2489 vap->iv_newstate(vap, in wakeupwaiting()
2490 vap->iv_opmode == IEEE80211_M_STA ? in wakeupwaiting()
2502 IEEE80211_LOCK_ASSERT(vap->iv_ic); in _ieee80211_newstate_get_next_empty_slot()
2504 if (vap->iv_nstate_n >= NET80211_IV_NSTATE_NUM) in _ieee80211_newstate_get_next_empty_slot()
2505 return (-1); in _ieee80211_newstate_get_next_empty_slot()
2507 nstate_num = vap->iv_nstate_b + vap->iv_nstate_n; in _ieee80211_newstate_get_next_empty_slot()
2509 vap->iv_nstate_n++; in _ieee80211_newstate_get_next_empty_slot()
2519 IEEE80211_LOCK_ASSERT(vap->iv_ic); in _ieee80211_newstate_get_next_pending_slot()
2521 KASSERT(vap->iv_nstate_n > 0, ("%s: vap %p iv_nstate_n %d\n", in _ieee80211_newstate_get_next_pending_slot()
2522 __func__, vap, vap->iv_nstate_n)); in _ieee80211_newstate_get_next_pending_slot()
2524 nstate_num = vap->iv_nstate_b; in _ieee80211_newstate_get_next_pending_slot()
2525 vap->iv_nstate_b++; in _ieee80211_newstate_get_next_pending_slot()
2526 if (vap->iv_nstate_b >= NET80211_IV_NSTATE_NUM) in _ieee80211_newstate_get_next_pending_slot()
2527 vap->iv_nstate_b = 0; in _ieee80211_newstate_get_next_pending_slot()
2528 vap->iv_nstate_n--; in _ieee80211_newstate_get_next_pending_slot()
2537 IEEE80211_LOCK_ASSERT(vap->iv_ic); in _ieee80211_newstate_get_npending()
2539 return (vap->iv_nstate_n); in _ieee80211_newstate_get_npending()
2549 struct ieee80211com *ic = vap->iv_ic; in ieee80211_newstate_cb()
2562 vap->iv_nstate = nstate = vap->iv_nstates[nstate_num]; in ieee80211_newstate_cb()
2563 arg = vap->iv_nstate_args[nstate_num]; in ieee80211_newstate_cb()
2566 "%s:%d: running state update %s -> %s (%d)\n", in ieee80211_newstate_cb()
2568 ieee80211_state_name[vap->iv_state], in ieee80211_newstate_cb()
2572 if (vap->iv_flags_ext & IEEE80211_FEXT_REINIT) { in ieee80211_newstate_cb()
2578 vap->iv_nstate = IEEE80211_S_INIT; in ieee80211_newstate_cb()
2580 "%s: %s -> %s arg %d -> %s arg %d\n", __func__, in ieee80211_newstate_cb()
2581 ieee80211_state_name[vap->iv_state], in ieee80211_newstate_cb()
2582 ieee80211_state_name[vap->iv_nstate], 0, in ieee80211_newstate_cb()
2584 vap->iv_newstate(vap, vap->iv_nstate, 0); in ieee80211_newstate_cb()
2586 vap->iv_flags_ext &= ~(IEEE80211_FEXT_REINIT | in ieee80211_newstate_cb()
2593 ostate = vap->iv_state; in ieee80211_newstate_cb()
2607 "%s: %s -> %s arg %d\n", __func__, in ieee80211_newstate_cb()
2610 rc = vap->iv_newstate(vap, nstate, arg); in ieee80211_newstate_cb()
2612 vap->iv_flags_ext &= ~IEEE80211_FEXT_STATEWAIT; in ieee80211_newstate_cb()
2625 * Handle the case of a RUN->RUN transition occuring when STA + AP in ieee80211_newstate_cb()
2631 * of RUN->INIT->RUN, the deferred path here only sees a RUN->RUN in ieee80211_newstate_cb()
2637 * be no-op code - and also if OACTIVE is finally retired, it'll in ieee80211_newstate_cb()
2638 * also be no-op code. in ieee80211_newstate_cb()
2646 * Note this can also happen as a result of SLEEP->RUN in ieee80211_newstate_cb()
2655 * Unblock the VAP queue; a RUN->RUN state can happen in ieee80211_newstate_cb()
2658 vap->iv_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; in ieee80211_newstate_cb()
2661 * XXX TODO Kick-start a VAP queue - this should be a method! in ieee80211_newstate_cb()
2692 * This routine single-threads the request and coordinates
2710 * will normally call back into operating mode-specific
2721 struct ieee80211com *ic = vap->iv_ic; in ieee80211_new_state_locked()
2728 if (vap->iv_flags_ext & IEEE80211_FEXT_STATEWAIT) { in ieee80211_new_state_locked()
2729 if (vap->iv_nstate == IEEE80211_S_INIT || in ieee80211_new_state_locked()
2730 ((vap->iv_state == IEEE80211_S_INIT || in ieee80211_new_state_locked()
2731 (vap->iv_flags_ext & IEEE80211_FEXT_REINIT)) && in ieee80211_new_state_locked()
2732 vap->iv_nstate == IEEE80211_S_SCAN && in ieee80211_new_state_locked()
2740 "%s:%d: %s -> %s (%s) transition discarded\n", in ieee80211_new_state_locked()
2742 ieee80211_state_name[vap->iv_state], in ieee80211_new_state_locked()
2744 ieee80211_state_name[vap->iv_nstate]); in ieee80211_new_state_locked()
2745 return -1; in ieee80211_new_state_locked()
2750 "%s:%d: starting state update %s -> %s (%s)\n", in ieee80211_new_state_locked()
2752 ieee80211_state_name[vap->iv_state], in ieee80211_new_state_locked()
2753 ieee80211_state_name[vap->iv_nstate], in ieee80211_new_state_locked()
2758 TAILQ_FOREACH(vp, &ic->ic_vaps, iv_next) { in ieee80211_new_state_locked()
2760 if (vp->iv_state >= IEEE80211_S_RUN) in ieee80211_new_state_locked()
2764 else if (vp->iv_state > IEEE80211_S_INIT) in ieee80211_new_state_locked()
2772 if (vap->iv_nstate_n == 0) { in ieee80211_new_state_locked()
2773 ostate = vap->iv_state; in ieee80211_new_state_locked()
2775 nstate_num = (vap->iv_nstate_b + vap->iv_nstate_n - 1) % NET80211_IV_NSTATE_NUM; in ieee80211_new_state_locked()
2776 ostate = vap->iv_nstates[nstate_num]; in ieee80211_new_state_locked()
2779 "%s: %s -> %s (arg %d) (nrunning %d nscanning %d)\n", __func__, in ieee80211_new_state_locked()
2786 * INIT -> SCAN happens on initial bringup. in ieee80211_new_state_locked()
2796 "%s: defer %s -> %s\n", in ieee80211_new_state_locked()
2799 vap->iv_flags_ext |= IEEE80211_FEXT_SCANWAIT; in ieee80211_new_state_locked()
2809 if (vap->iv_opmode == IEEE80211_M_STA) in ieee80211_new_state_locked()
2817 "%s: override, now %s -> %s\n", in ieee80211_new_state_locked()
2827 if (vap->iv_opmode == IEEE80211_M_WDS && in ieee80211_new_state_locked()
2828 (vap->iv_flags_ext & IEEE80211_FEXT_WDSLEGACY) && in ieee80211_new_state_locked()
2836 "%s: defer %s -> %s (legacy WDS)\n", __func__, in ieee80211_new_state_locked()
2839 vap->iv_flags_ext |= IEEE80211_FEXT_SCANWAIT; in ieee80211_new_state_locked()
2842 if (vap->iv_opmode == IEEE80211_M_HOSTAP && in ieee80211_new_state_locked()
2843 IEEE80211_IS_CHAN_DFS(ic->ic_bsschan) && in ieee80211_new_state_locked()
2844 (vap->iv_flags_ext & IEEE80211_FEXT_DFS) && in ieee80211_new_state_locked()
2845 !IEEE80211_IS_CHAN_CACDONE(ic->ic_bsschan)) { in ieee80211_new_state_locked()
2854 "%s: override %s -> %s (DFS)\n", __func__, in ieee80211_new_state_locked()
2864 /* INIT -> INIT. nothing to do */ in ieee80211_new_state_locked()
2865 vap->iv_flags_ext &= ~IEEE80211_FEXT_SCANWAIT; in ieee80211_new_state_locked()
2873 * We support up-to NET80211_IV_NSTATE_NUM pending state changes in ieee80211_new_state_locked()
2878 * This is kind-of a hack after 10 years but we know how to provoke in ieee80211_new_state_locked()
2882 if (nstate_num == -1) { in ieee80211_new_state_locked()
2887 ic_printf(ic, "%s:%d: pending %s -> %s (now to %s) " in ieee80211_new_state_locked()
2890 ieee80211_state_name[vap->iv_state], in ieee80211_new_state_locked()
2891 ieee80211_state_name[vap->iv_nstate], in ieee80211_new_state_locked()
2898 vap->iv_nstates[nstate_num] = nstate; in ieee80211_new_state_locked()
2899 vap->iv_nstate_args[nstate_num] = arg; in ieee80211_new_state_locked()
2900 vap->iv_flags_ext |= IEEE80211_FEXT_STATEWAIT; in ieee80211_new_state_locked()
2901 ieee80211_runtask(ic, &vap->iv_nstate_task[nstate_num]); in ieee80211_new_state_locked()
2909 struct ieee80211com *ic = vap->iv_ic; in ieee80211_new_state()