Lines Matching +full:coexist +full:- +full:support
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
5 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
135 if (ic->ic_sup_rates[m].rs_nrates == 0) \ in ieee80211_chan_init()
136 ic->ic_sup_rates[m] = def; \ in ieee80211_chan_init()
141 KASSERT(0 < ic->ic_nchans && ic->ic_nchans <= IEEE80211_CHAN_MAX, in ieee80211_chan_init()
142 ("invalid number of channels specified: %u", ic->ic_nchans)); in ieee80211_chan_init()
143 memset(ic->ic_chan_avail, 0, sizeof(ic->ic_chan_avail)); in ieee80211_chan_init()
144 memset(ic->ic_modecaps, 0, sizeof(ic->ic_modecaps)); in ieee80211_chan_init()
145 setbit(ic->ic_modecaps, IEEE80211_MODE_AUTO); in ieee80211_chan_init()
146 for (i = 0; i < ic->ic_nchans; i++) { in ieee80211_chan_init()
147 c = &ic->ic_channels[i]; in ieee80211_chan_init()
148 KASSERT(c->ic_flags != 0, ("channel with no flags")); in ieee80211_chan_init()
155 if (c->ic_ieee == 0) in ieee80211_chan_init()
156 c->ic_ieee = ieee80211_mhz2ieee(c->ic_freq,c->ic_flags); in ieee80211_chan_init()
162 if (IEEE80211_IS_CHAN_HT40(c) && c->ic_extieee == 0) in ieee80211_chan_init()
163 c->ic_extieee = ieee80211_mhz2ieee(c->ic_freq + in ieee80211_chan_init()
164 (IEEE80211_IS_CHAN_HT40U(c) ? 20 : -20), in ieee80211_chan_init()
165 c->ic_flags); in ieee80211_chan_init()
175 if (c->ic_maxpower == 0) in ieee80211_chan_init()
176 c->ic_maxpower = 2*c->ic_maxregpower; in ieee80211_chan_init()
177 setbit(ic->ic_chan_avail, c->ic_ieee); in ieee80211_chan_init()
182 setbit(ic->ic_modecaps, IEEE80211_MODE_11A); in ieee80211_chan_init()
184 setbit(ic->ic_modecaps, IEEE80211_MODE_11B); in ieee80211_chan_init()
186 setbit(ic->ic_modecaps, IEEE80211_MODE_11G); in ieee80211_chan_init()
188 setbit(ic->ic_modecaps, IEEE80211_MODE_FH); in ieee80211_chan_init()
190 setbit(ic->ic_modecaps, IEEE80211_MODE_TURBO_A); in ieee80211_chan_init()
192 setbit(ic->ic_modecaps, IEEE80211_MODE_TURBO_G); in ieee80211_chan_init()
194 setbit(ic->ic_modecaps, IEEE80211_MODE_STURBO_A); in ieee80211_chan_init()
196 setbit(ic->ic_modecaps, IEEE80211_MODE_HALF); in ieee80211_chan_init()
198 setbit(ic->ic_modecaps, IEEE80211_MODE_QUARTER); in ieee80211_chan_init()
200 setbit(ic->ic_modecaps, IEEE80211_MODE_11NA); in ieee80211_chan_init()
202 setbit(ic->ic_modecaps, IEEE80211_MODE_11NG); in ieee80211_chan_init()
204 setbit(ic->ic_modecaps, IEEE80211_MODE_VHT_5GHZ); in ieee80211_chan_init()
206 setbit(ic->ic_modecaps, IEEE80211_MODE_VHT_2GHZ); in ieee80211_chan_init()
209 memcpy(ic->ic_chan_active, ic->ic_chan_avail, in ieee80211_chan_init()
210 sizeof(ic->ic_chan_avail)); in ieee80211_chan_init()
213 ieee80211_sort_channels(ic->ic_channels, ic->ic_nchans); in ieee80211_chan_init()
216 ic->ic_bsschan = IEEE80211_CHAN_ANYC; in ieee80211_chan_init()
217 ic->ic_prevchan = NULL; in ieee80211_chan_init()
218 ic->ic_csa_newchan = NULL; in ieee80211_chan_init()
220 ic->ic_curchan = &ic->ic_channels[0]; in ieee80211_chan_init()
221 ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan); in ieee80211_chan_init()
223 /* fillin well-known rate sets if driver has not specified */ in ieee80211_chan_init()
241 if (ic->ic_rxstream == 0) in ieee80211_chan_init()
242 ic->ic_rxstream = 2; in ieee80211_chan_init()
243 if (ic->ic_txstream == 0) in ieee80211_chan_init()
244 ic->ic_txstream = 2; in ieee80211_chan_init()
282 retval = printf("%s: ", ic->ic_name); in ic_printf()
309 sbuf_printf(&sb, "%s%s", sp, ic->ic_name); in sysctl_ieee80211coms()
330 IEEE80211_LOCK_INIT(ic, ic->ic_name); in ieee80211_ifattach()
331 IEEE80211_TX_LOCK_INIT(ic, ic->ic_name); in ieee80211_ifattach()
332 TAILQ_INIT(&ic->ic_vaps); in ieee80211_ifattach()
335 ic->ic_tq = taskqueue_create("ic_taskq", in ieee80211_ifattach()
337 taskqueue_thread_enqueue, &ic->ic_tq); in ieee80211_ifattach()
338 taskqueue_start_threads(&ic->ic_tq, 1, PI_NET, "%s net80211 taskq", in ieee80211_ifattach()
339 ic->ic_name); in ieee80211_ifattach()
340 ic->ic_ierrors = counter_u64_alloc(IEEE80211_M_WAITOK); in ieee80211_ifattach()
341 ic->ic_oerrors = counter_u64_alloc(IEEE80211_M_WAITOK); in ieee80211_ifattach()
349 ic->ic_update_mcast = null_update_mcast; in ieee80211_ifattach()
350 ic->ic_update_promisc = null_update_promisc; in ieee80211_ifattach()
351 ic->ic_update_chw = null_update_chw; in ieee80211_ifattach()
353 ic->ic_hash_key = arc4random(); in ieee80211_ifattach()
354 ic->ic_bintval = IEEE80211_BINTVAL_DEFAULT; in ieee80211_ifattach()
355 ic->ic_lintval = ic->ic_bintval; in ieee80211_ifattach()
356 ic->ic_txpowlimit = IEEE80211_TXPOWER_MAX; in ieee80211_ifattach()
395 if (ic->ic_tq == NULL) in ieee80211_ifdetach()
402 taskqueue_drain(taskqueue_thread, &ic->ic_restart_task); in ieee80211_ifdetach()
408 while ((vap = TAILQ_FIRST(&ic->ic_vaps)) != NULL) { in ieee80211_ifdetach()
429 counter_u64_free(ic->ic_ierrors); in ieee80211_ifdetach()
430 counter_u64_free(ic->ic_oerrors); in ieee80211_ifdetach()
432 taskqueue_free(ic->ic_tq); in ieee80211_ifdetach()
478 if (strcmp(ic->ic_name, name) == 0) in ieee80211_find_com()
497 * Default reset method for use with the ioctl support. This
500 * require re-initialization of the 802.11 state machine (e.g
502 * should cause the driver to re-initialize the device. Drivers
503 * can override this method to implement more optimized support.
514 * Drivers that support TX offload as well as hardware encryption offload
524 vap->iv_def_txkey = kid; in default_update_deftxkey()
533 struct ieee80211vap *vap = ifp->if_softc; in ieee80211_get_counter()
534 struct ieee80211com *ic = vap->iv_ic; in ieee80211_get_counter()
540 rv += counter_u64_fetch(ic->ic_oerrors); in ieee80211_get_counter()
543 rv += counter_u64_fetch(ic->ic_ierrors); in ieee80211_get_counter()
566 ifp->if_softc = vap; /* back pointer */ in ieee80211_vap_setup()
567 ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; in ieee80211_vap_setup()
568 ifp->if_transmit = ieee80211_vap_transmit; in ieee80211_vap_setup()
569 ifp->if_qflush = ieee80211_vap_qflush; in ieee80211_vap_setup()
570 ifp->if_ioctl = ieee80211_ioctl; in ieee80211_vap_setup()
571 ifp->if_init = ieee80211_init; in ieee80211_vap_setup()
572 ifp->if_get_counter = ieee80211_get_counter; in ieee80211_vap_setup()
574 vap->iv_ifp = ifp; in ieee80211_vap_setup()
575 vap->iv_ic = ic; in ieee80211_vap_setup()
576 vap->iv_flags = ic->ic_flags; /* propagate common flags */ in ieee80211_vap_setup()
577 vap->iv_flags_ext = ic->ic_flags_ext; in ieee80211_vap_setup()
578 vap->iv_flags_ven = ic->ic_flags_ven; in ieee80211_vap_setup()
579 vap->iv_caps = ic->ic_caps &~ IEEE80211_C_OPMODE; in ieee80211_vap_setup()
581 /* 11n capabilities - XXX methodize */ in ieee80211_vap_setup()
582 vap->iv_htcaps = ic->ic_htcaps; in ieee80211_vap_setup()
583 vap->iv_htextcaps = ic->ic_htextcaps; in ieee80211_vap_setup()
585 /* 11ac capabilities - XXX methodize */ in ieee80211_vap_setup()
586 vap->iv_vht_cap.vht_cap_info = ic->ic_vht_cap.vht_cap_info; in ieee80211_vap_setup()
587 vap->iv_vhtextcaps = ic->ic_vhtextcaps; in ieee80211_vap_setup()
589 vap->iv_opmode = opmode; in ieee80211_vap_setup()
590 vap->iv_caps |= ieee80211_opcap[opmode]; in ieee80211_vap_setup()
591 IEEE80211_ADDR_COPY(vap->iv_myaddr, ic->ic_macaddr); in ieee80211_vap_setup()
597 * For non-legacy operation the station must associate in ieee80211_vap_setup()
602 IEEE80211_ADDR_COPY(vap->iv_des_bssid, bssid); in ieee80211_vap_setup()
603 vap->iv_flags |= IEEE80211_F_DESBSSID; in ieee80211_vap_setup()
605 vap->iv_flags_ext |= IEEE80211_FEXT_WDSLEGACY; in ieee80211_vap_setup()
611 KASSERT(ic->ic_caps & IEEE80211_C_TDMA, in ieee80211_vap_setup()
612 ("not TDMA capable, ic_caps 0x%x", ic->ic_caps)); in ieee80211_vap_setup()
618 vap->iv_caps |= IEEE80211_C_TDMA; in ieee80211_vap_setup()
625 /* auto-enable s/w beacon miss support */ in ieee80211_vap_setup()
627 vap->iv_flags_ext |= IEEE80211_FEXT_SWBMISS; in ieee80211_vap_setup()
628 /* auto-generated or user supplied MAC address */ in ieee80211_vap_setup()
630 vap->iv_flags_ext |= IEEE80211_FEXT_UNIQMAC; in ieee80211_vap_setup()
635 if (vap->iv_caps & IEEE80211_C_WME) in ieee80211_vap_setup()
636 vap->iv_flags |= IEEE80211_F_WME; in ieee80211_vap_setup()
637 if (vap->iv_caps & IEEE80211_C_BURST) in ieee80211_vap_setup()
638 vap->iv_flags |= IEEE80211_F_BURST; in ieee80211_vap_setup()
640 if (vap->iv_opmode == IEEE80211_M_STA && in ieee80211_vap_setup()
641 (vap->iv_caps & IEEE80211_C_BGSCAN)) in ieee80211_vap_setup()
642 vap->iv_flags |= IEEE80211_F_BGSCAN; in ieee80211_vap_setup()
643 vap->iv_flags |= IEEE80211_F_DOTH; /* XXX no cap, just ena */ in ieee80211_vap_setup()
644 /* NB: DFS support only makes sense for ap mode right now */ in ieee80211_vap_setup()
645 if (vap->iv_opmode == IEEE80211_M_HOSTAP && in ieee80211_vap_setup()
646 (vap->iv_caps & IEEE80211_C_DFS)) in ieee80211_vap_setup()
647 vap->iv_flags_ext |= IEEE80211_FEXT_DFS; in ieee80211_vap_setup()
648 /* NB: only flip on U-APSD for hostap/sta for now */ in ieee80211_vap_setup()
649 if ((vap->iv_opmode == IEEE80211_M_STA) in ieee80211_vap_setup()
650 || (vap->iv_opmode == IEEE80211_M_HOSTAP)) { in ieee80211_vap_setup()
651 if (vap->iv_caps & IEEE80211_C_UAPSD) in ieee80211_vap_setup()
652 vap->iv_flags_ext |= IEEE80211_FEXT_UAPSD; in ieee80211_vap_setup()
655 vap->iv_des_chan = IEEE80211_CHAN_ANYC; /* any channel is ok */ in ieee80211_vap_setup()
656 vap->iv_bmissthreshold = IEEE80211_HWBMISS_DEFAULT; in ieee80211_vap_setup()
657 vap->iv_dtim_period = IEEE80211_DTIM_DEFAULT; in ieee80211_vap_setup()
659 * Install a default reset method for the ioctl support; in ieee80211_vap_setup()
662 vap->iv_reset = default_reset; in ieee80211_vap_setup()
668 vap->iv_update_deftxkey = default_update_deftxkey; in ieee80211_vap_setup()
698 struct ifnet *ifp = vap->iv_ifp; in ieee80211_vap_attach()
699 struct ieee80211com *ic = vap->iv_ic; in ieee80211_vap_attach()
705 __func__, ieee80211_opmode_name[vap->iv_opmode], in ieee80211_vap_attach()
706 ic->ic_name, vap->iv_flags, vap->iv_flags_ext); in ieee80211_vap_attach()
715 maxrate = ieee80211_media_setup(ic, &vap->iv_media, vap->iv_caps, in ieee80211_vap_attach()
716 vap->iv_opmode == IEEE80211_M_STA, media_change, media_stat); in ieee80211_vap_attach()
719 ifmedia_set(&vap->iv_media, in ieee80211_vap_attach()
722 ifp->if_baudrate = IF_Mbps(maxrate); in ieee80211_vap_attach()
725 IEEE80211_ADDR_COPY(vap->iv_myaddr, IF_LLADDR(ifp)); in ieee80211_vap_attach()
727 vap->iv_output = ifp->if_output; in ieee80211_vap_attach()
728 ifp->if_output = ieee80211_output; in ieee80211_vap_attach()
732 TAILQ_INSERT_TAIL(&ic->ic_vaps, vap, iv_next); in ieee80211_vap_attach()
763 struct ieee80211com *ic = vap->iv_ic; in ieee80211_vap_detach()
764 struct ifnet *ifp = vap->iv_ifp; in ieee80211_vap_detach()
767 CURVNET_SET(ifp->if_vnet); in ieee80211_vap_detach()
770 __func__, ieee80211_opmode_name[vap->iv_opmode], ic->ic_name); in ieee80211_vap_detach()
781 ieee80211_draintask(ic, &vap->iv_nstate_task[i]); in ieee80211_vap_detach()
782 ieee80211_draintask(ic, &vap->iv_swbmiss_task); in ieee80211_vap_detach()
783 ieee80211_draintask(ic, &vap->iv_wme_task); in ieee80211_vap_detach()
784 ieee80211_draintask(ic, &ic->ic_parent_task); in ieee80211_vap_detach()
786 /* XXX band-aid until ifnet handles this for us */ in ieee80211_vap_detach()
787 taskqueue_drain(taskqueue_swi, &ifp->if_linktask); in ieee80211_vap_detach()
790 KASSERT(vap->iv_state == IEEE80211_S_INIT , ("vap still running")); in ieee80211_vap_detach()
791 TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next); in ieee80211_vap_detach()
811 if (vap->iv_ifflags & IFF_PROMISC) in ieee80211_vap_detach()
813 if (vap->iv_ifflags & IFF_ALLMULTI) in ieee80211_vap_detach()
817 ifmedia_removeall(&vap->iv_media); in ieee80211_vap_detach()
846 struct ieee80211com *ic = vap->iv_ic; in ieee80211_promisc()
851 if (++ic->ic_promisc == 1) in ieee80211_promisc()
852 ieee80211_runtask(ic, &ic->ic_promisc_task); in ieee80211_promisc()
854 KASSERT(ic->ic_promisc > 0, ("%s: ic %p not promisc", in ieee80211_promisc()
856 if (--ic->ic_promisc == 0) in ieee80211_promisc()
857 ieee80211_runtask(ic, &ic->ic_promisc_task); in ieee80211_promisc()
868 struct ieee80211com *ic = vap->iv_ic; in ieee80211_allmulti()
873 if (++ic->ic_allmulti == 1) in ieee80211_allmulti()
874 ieee80211_runtask(ic, &ic->ic_mcast_task); in ieee80211_allmulti()
876 KASSERT(ic->ic_allmulti > 0, ("%s: ic %p not allmulti", in ieee80211_allmulti()
878 if (--ic->ic_allmulti == 0) in ieee80211_allmulti()
879 ieee80211_runtask(ic, &ic->ic_mcast_task); in ieee80211_allmulti()
897 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) in ieee80211_syncflag_locked()
898 if (vap->iv_flags & flag) { in ieee80211_syncflag_locked()
903 ic->ic_flags |= flag; in ieee80211_syncflag_locked()
905 ic->ic_flags &= ~flag; in ieee80211_syncflag_locked()
911 struct ieee80211com *ic = vap->iv_ic; in ieee80211_syncflag()
915 flag = -flag; in ieee80211_syncflag()
916 vap->iv_flags &= ~flag; in ieee80211_syncflag()
918 vap->iv_flags |= flag; in ieee80211_syncflag()
937 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) in ieee80211_syncflag_ht_locked()
938 if (vap->iv_flags_ht & flag) { in ieee80211_syncflag_ht_locked()
943 ic->ic_flags_ht |= flag; in ieee80211_syncflag_ht_locked()
945 ic->ic_flags_ht &= ~flag; in ieee80211_syncflag_ht_locked()
951 struct ieee80211com *ic = vap->iv_ic; in ieee80211_syncflag_ht()
955 flag = -flag; in ieee80211_syncflag_ht()
956 vap->iv_flags_ht &= ~flag; in ieee80211_syncflag_ht()
958 vap->iv_flags_ht |= flag; in ieee80211_syncflag_ht()
977 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) in ieee80211_syncflag_vht_locked()
978 if (vap->iv_vht_flags & flag) { in ieee80211_syncflag_vht_locked()
983 ic->ic_vht_flags |= flag; in ieee80211_syncflag_vht_locked()
985 ic->ic_vht_flags &= ~flag; in ieee80211_syncflag_vht_locked()
991 struct ieee80211com *ic = vap->iv_ic; in ieee80211_syncflag_vht()
995 flag = -flag; in ieee80211_syncflag_vht()
996 vap->iv_vht_flags &= ~flag; in ieee80211_syncflag_vht()
998 vap->iv_vht_flags |= flag; in ieee80211_syncflag_vht()
1017 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) in ieee80211_syncflag_ext_locked()
1018 if (vap->iv_flags_ext & flag) { in ieee80211_syncflag_ext_locked()
1023 ic->ic_flags_ext |= flag; in ieee80211_syncflag_ext_locked()
1025 ic->ic_flags_ext &= ~flag; in ieee80211_syncflag_ext_locked()
1031 struct ieee80211com *ic = vap->iv_ic; in ieee80211_syncflag_ext()
1035 flag = -flag; in ieee80211_syncflag_ext()
1036 vap->iv_flags_ext &= ~flag; in ieee80211_syncflag_ext()
1038 vap->iv_flags_ext |= flag; in ieee80211_syncflag_ext()
1054 return (freq - 906*10) / 5; in mapgsm()
1060 return 37 + ((freq * 10) + ((freq % 5) == 2 ? 5 : 0) - 49400) / 5; in mappsb()
1076 return ((int) freq - 2407) / 5; in ieee80211_mhz2ieee()
1078 return 15 + ((freq - 2512) / 20); in ieee80211_mhz2ieee()
1084 return (freq - 4000) / 5; in ieee80211_mhz2ieee()
1086 return (freq - 5000) / 5; in ieee80211_mhz2ieee()
1093 return ((int) freq - 2407) / 5; in ieee80211_mhz2ieee()
1099 return (freq - 4000) / 5; in ieee80211_mhz2ieee()
1101 return 15 + ((freq - 2512) / 20); in ieee80211_mhz2ieee()
1103 return (freq - 5000) / 5; in ieee80211_mhz2ieee()
1118 return (c == IEEE80211_CHAN_ANYC ? IEEE80211_CHAN_ANY : c->ic_ieee); in ieee80211_chan2ieee()
1135 return 2512 + ((chan-15)*20); in ieee80211_ieee2mhz()
1138 chan -= 37; in ieee80211_ieee2mhz()
1146 if (chan < 14) /* 0-13 */ in ieee80211_ieee2mhz()
1148 if (chan < 27) /* 15-26 */ in ieee80211_ieee2mhz()
1149 return 2512 + ((chan-15)*20); in ieee80211_ieee2mhz()
1159 * IEEE Std 802.11-2012, page 1738, subclause 20.3.15.4: in set_extchan()
1160 * "the secondary channel number shall be 'N + [1,-1] * 4' in set_extchan()
1162 if (c->ic_flags & IEEE80211_CHAN_HT40U) in set_extchan()
1163 c->ic_extieee = c->ic_ieee + 4; in set_extchan()
1164 else if (c->ic_flags & IEEE80211_CHAN_HT40D) in set_extchan()
1165 c->ic_extieee = c->ic_ieee - 4; in set_extchan()
1167 c->ic_extieee = 0; in set_extchan()
1173 * This for now uses a hard-coded list of 80MHz wide channels.
1181 * This is all likely very very wrong - both the regulatory code
1218 __func__, c->ic_ieee, c->ic_flags); in set_vht_extchan()
1223 if (c->ic_freq >= vht160_chan_ranges[i].freq_start && in set_vht_extchan()
1224 c->ic_freq < vht160_chan_ranges[i].freq_end) { in set_vht_extchan()
1228 c->ic_vht_ch_freq1 = in set_vht_extchan()
1229 ieee80211_mhz2ieee(midpoint, c->ic_flags); in set_vht_extchan()
1230 c->ic_vht_ch_freq2 = 0; in set_vht_extchan()
1233 __func__, c->ic_ieee, c->ic_freq, midpoint, in set_vht_extchan()
1234 c->ic_vht_ch_freq1, c->ic_vht_ch_freq2); in set_vht_extchan()
1244 if (c->ic_freq >= vht80_chan_ranges[i].freq_start && in set_vht_extchan()
1245 c->ic_freq < vht80_chan_ranges[i].freq_end) { in set_vht_extchan()
1249 c->ic_vht_ch_freq1 = in set_vht_extchan()
1250 ieee80211_mhz2ieee(midpoint, c->ic_flags); in set_vht_extchan()
1251 c->ic_vht_ch_freq2 = 0; in set_vht_extchan()
1254 __func__, c->ic_ieee, c->ic_freq, midpoint, in set_vht_extchan()
1255 c->ic_vht_ch_freq1, c->ic_vht_ch_freq2); in set_vht_extchan()
1265 c->ic_vht_ch_freq1 = c->ic_ieee + 2; in set_vht_extchan()
1267 c->ic_vht_ch_freq1 = c->ic_ieee - 2; in set_vht_extchan()
1274 c->ic_vht_ch_freq1 = c->ic_ieee; in set_vht_extchan()
1279 __func__, c->ic_ieee, c->ic_flags); in set_vht_extchan()
1331 c->ic_ieee = ieee; in addchan()
1332 c->ic_freq = freq != 0 ? freq : ieee80211_ieee2mhz(ieee, flags); in addchan()
1333 c->ic_maxregpower = maxregpower; in addchan()
1334 c->ic_maxpower = 2 * maxregpower; in addchan()
1335 c->ic_flags = flags; in addchan()
1336 c->ic_vht_ch_freq1 = 0; in addchan()
1337 c->ic_vht_ch_freq2 = 0; in addchan()
1361 c[0] = c[-1]; in copychan_prev()
1362 c->ic_flags = flags; in copychan_prev()
1363 c->ic_vht_ch_freq1 = 0; in copychan_prev()
1364 c->ic_vht_ch_freq2 = 0; in copychan_prev()
1372 * XXX VHT-2GHz
1484 * The _cbw() variant does also support HT40/VHT80/160/80+80.
1528 if (c->ic_freq == freq && in findchannel()
1529 (c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags) in findchannel()
1563 error = addchan(chans, maxchans, nchans, cent->ic_ieee, cent->ic_freq, in ieee80211_add_channel_ht40()
1568 error = addchan(chans, maxchans, nchans, extc->ic_ieee, extc->ic_freq, in ieee80211_add_channel_ht40()
1581 return (c->ic_freq); in ieee80211_get_channel_center_freq()
1601 * VHT - use the pre-calculated centre frequency in ieee80211_get_channel_center_freq1()
1605 return (ieee80211_ieee2mhz(c->ic_vht_ch_freq1, c->ic_flags)); in ieee80211_get_channel_center_freq1()
1608 return (c->ic_freq + 10); in ieee80211_get_channel_center_freq1()
1611 return (c->ic_freq - 10); in ieee80211_get_channel_center_freq1()
1614 return (c->ic_freq); in ieee80211_get_channel_center_freq1()
1618 * For now, no 80+80 support; it will likely always return 0.
1624 if (IEEE80211_IS_CHAN_VHT(c) && (c->ic_vht_ch_freq2 != 0)) in ieee80211_get_channel_center_freq2()
1625 return (ieee80211_ieee2mhz(c->ic_vht_ch_freq2, c->ic_flags)); in ieee80211_get_channel_center_freq2()
1649 * + VHT80, VHT160 will coexist with HT40/VHT40, so in add_chanlist()
1696 freq - 20 != in add_chanlist()
1697 ieee80211_ieee2mhz(ieee[i] - 4, flags[j])) in add_chanlist()
1711 if (i == nieee - 1 || in add_chanlist()
1712 ieee[i] + 4 > ieee[nieee - 1] || in add_chanlist()
1763 * XXX-BZ with HT and VHT there is no 1:1 mapping anymore. Review all in ieee80211_add_channel_list_5ghz()
1777 * channels--as happens with dynamic turbo.
1785 c = ic->ic_prevchan; in ieee80211_find_channel()
1786 if (c != NULL && c->ic_freq == freq && in ieee80211_find_channel()
1787 (c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags) in ieee80211_find_channel()
1790 return (findchannel(ic->ic_channels, ic->ic_nchans, freq, flags)); in ieee80211_find_channel()
1796 * channels--as happens with dynamic turbo.
1805 c = ic->ic_prevchan; in ieee80211_find_channel_byieee()
1806 if (c != NULL && c->ic_ieee == ieee && in ieee80211_find_channel_byieee()
1807 (c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags) in ieee80211_find_channel_byieee()
1810 for (i = 0; i < ic->ic_nchans; i++) { in ieee80211_find_channel_byieee()
1811 c = &ic->ic_channels[i]; in ieee80211_find_channel_byieee()
1812 if (c->ic_ieee == ieee && in ieee80211_find_channel_byieee()
1813 (c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags) in ieee80211_find_channel_byieee()
1828 * like. It also doesn't know about legacy-turbog and
1829 * legacy-turbo modes, which some offload NICs actually
1830 * support in weird ways.
1835 * XXX TODO: Add support for that when the need arises.
1841 struct ieee80211com *ic = vap->iv_ic; in ieee80211_lookup_channel_rxstatus()
1853 if ((rxs->r_flags & IEEE80211_R_FREQ) == 0) in ieee80211_lookup_channel_rxstatus()
1855 if ((rxs->r_flags & IEEE80211_R_IEEE) == 0) in ieee80211_lookup_channel_rxstatus()
1857 if ((rxs->r_flags & IEEE80211_R_BAND) == 0) in ieee80211_lookup_channel_rxstatus()
1869 switch (rxs->c_band) { in ieee80211_lookup_channel_rxstatus()
1877 if (rxs->c_freq < 3000) { in ieee80211_lookup_channel_rxstatus()
1886 c = ieee80211_find_channel(ic, rxs->c_freq, flags); in ieee80211_lookup_channel_rxstatus()
1890 __func__, (int) rxs->c_freq, (int) rxs->c_ieee, flags, c); in ieee80211_lookup_channel_rxstatus()
1961 if (isclr(ic->ic_modecaps, mode)) in ieee80211_media_setup()
1966 rs = &ic->ic_sup_rates[mode]; in ieee80211_media_setup()
1967 for (i = 0; i < rs->rs_nrates; i++) { in ieee80211_media_setup()
1968 rate = rs->rs_rates[i]; in ieee80211_media_setup()
2006 if (isclr(ic->ic_modecaps, mode)) in ieee80211_media_setup()
2011 if (isset(ic->ic_modecaps, IEEE80211_MODE_11NA) || in ieee80211_media_setup()
2012 isset(ic->ic_modecaps, IEEE80211_MODE_11NG)) { in ieee80211_media_setup()
2015 i = ic->ic_txstream * 8 - 1; in ieee80211_media_setup()
2016 if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) && in ieee80211_media_setup()
2017 (ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40)) in ieee80211_media_setup()
2019 else if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40)) in ieee80211_media_setup()
2021 else if ((ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20)) in ieee80211_media_setup()
2031 * XXX-BZ skip "VHT_2GHZ" for now. in ieee80211_media_setup()
2035 if (isclr(ic->ic_modecaps, mode)) in ieee80211_media_setup()
2040 if (isset(ic->ic_modecaps, IEEE80211_MODE_VHT_5GHZ)) { in ieee80211_media_setup()
2055 return &ic->ic_sup_rates[ieee80211_chan2mode(c)]; in ieee80211_get_suprates()
2063 return &ic->ic_sup_htrates; in ieee80211_get_suphtrates()
2075 if (isclr(ic->ic_modecaps, mode)) in ieee80211_announce()
2078 rs = &ic->ic_sup_rates[mode]; in ieee80211_announce()
2079 for (i = 0; i < rs->rs_nrates; i++) { in ieee80211_announce()
2080 mword = ieee80211_rate2media(ic, rs->rs_rates[i], mode); in ieee80211_announce()
2101 for (i = 0; i < ic->ic_nchans; i++) { in ieee80211_announce_channels()
2102 c = &ic->ic_channels[i]; in ieee80211_announce_channels()
2128 , c->ic_ieee, c->ic_freq, type in ieee80211_announce_channels()
2131 IEEE80211_IS_CHAN_HT40D(c) ? '-' : ' ' in ieee80211_announce_channels()
2132 , c->ic_maxregpower in ieee80211_announce_channels()
2133 , c->ic_minpower / 2, c->ic_minpower & 1 ? 5 : 0 in ieee80211_announce_channels()
2134 , c->ic_maxpower / 2, c->ic_maxpower & 1 ? 5 : 0 in ieee80211_announce_channels()
2142 switch (IFM_MODE(ime->ifm_media)) { in media2mode()
2177 if (ime->ifm_media & IFM_IEEE80211_TURBO) { in media2mode()
2188 /* XXX HT40 +/- */ in media2mode()
2198 struct ieee80211vap *vap = ifp->if_softc; in ieee80211_media_change()
2199 struct ifmedia_entry *ime = vap->iv_media.ifm_cur; in ieee80211_media_change()
2202 if (!media2mode(ime, vap->iv_flags, &newmode)) in ieee80211_media_change()
2204 if (vap->iv_des_mode != newmode) { in ieee80211_media_change()
2205 vap->iv_des_mode = newmode; in ieee80211_media_change()
2276 struct ieee80211vap *vap = ifp->if_softc; in ieee80211_media_status()
2277 struct ieee80211com *ic = vap->iv_ic; in ieee80211_media_status()
2280 imr->ifm_status = IFM_AVALID; in ieee80211_media_status()
2286 if (vap->iv_state == IEEE80211_S_RUN || in ieee80211_media_status()
2287 vap->iv_state == IEEE80211_S_SLEEP) { in ieee80211_media_status()
2288 imr->ifm_status |= IFM_ACTIVE; in ieee80211_media_status()
2289 mode = ieee80211_chan2mode(ic->ic_curchan); in ieee80211_media_status()
2292 imr->ifm_active = media_status(vap->iv_opmode, ic->ic_curchan); in ieee80211_media_status()
2296 if (vap->iv_txparms[mode].ucastrate != IEEE80211_FIXED_RATE_NONE) { in ieee80211_media_status()
2300 imr->ifm_active |= ieee80211_rate2media(ic, in ieee80211_media_status()
2301 vap->iv_txparms[mode].ucastrate, mode); in ieee80211_media_status()
2302 } else if (vap->iv_opmode == IEEE80211_M_STA) { in ieee80211_media_status()
2306 imr->ifm_active |= ieee80211_rate2media(ic, in ieee80211_media_status()
2307 vap->iv_bss->ni_txrate, mode); in ieee80211_media_status()
2309 imr->ifm_active |= IFM_AUTO; in ieee80211_media_status()
2310 if (imr->ifm_status & IFM_ACTIVE) in ieee80211_media_status()
2311 imr->ifm_current = imr->ifm_active; in ieee80211_media_status()
2330 ieee80211_setbasicrates(&ic->ic_sup_rates[mode], mode); in ieee80211_setmode()
2332 ic->ic_curmode = mode; in ieee80211_setmode()
2374 __func__, chan->ic_freq, chan->ic_flags); in ieee80211_chan2mode()
2526 /* Some QCA and BRCM seem to support this; offspec. */ in ieee80211_rate2media()
2577 if (ic != NULL && ic->ic_phytype == IEEE80211_T_FH) in ieee80211_rate2media()
2598 -1, /* IFM_AUTO */ in ieee80211_media2rate()
2622 -1, /* IFM_IEEE80211_MCS */ in ieee80211_media2rate()
2623 -1, /* IFM_IEEE80211_VHT */ in ieee80211_media2rate()
2635 a -= b; a -= c; a ^= (c >> 13); \
2636 b -= c; b -= a; b ^= (a << 8); \
2637 c -= a; c -= b; c ^= (b >> 13); \
2638 a -= b; a -= c; a ^= (c >> 12); \
2639 b -= c; b -= a; b ^= (a << 16); \
2640 c -= a; c -= b; c ^= (b >> 5); \
2641 a -= b; a -= c; a ^= (c >> 3); \
2642 b -= c; b -= a; b ^= (a << 10); \
2643 c -= a; c -= b; c ^= (b >> 15); \
2650 uint32_t a = 0x9e3779b9, b = 0x9e3779b9, c = ic->ic_hash_key; in ieee80211_mac_hash()
2699 return (&vap->iv_nw_keys[0] <= key && in ieee80211_is_key_global()
2700 key < &vap->iv_nw_keys[IEEE80211_WEP_NKID]); in ieee80211_is_key_global()
2711 * This is a short-cut for now; eventually we will need in ieee80211_is_key_unicast()
2712 * to support multiple unicast keys, IGTK, etc) so we in ieee80211_is_key_unicast()