Lines Matching +full:switching +full:- +full:freq
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) \
136 ic->ic_sup_rates[m] = def; \
141 KASSERT(0 < ic->ic_nchans && ic->ic_nchans <= IEEE80211_CHAN_MAX,
142 ("invalid number of channels specified: %u", ic->ic_nchans));
143 memset(ic->ic_chan_avail, 0, sizeof(ic->ic_chan_avail));
144 memset(ic->ic_modecaps, 0, sizeof(ic->ic_modecaps));
145 setbit(ic->ic_modecaps, IEEE80211_MODE_AUTO);
146 for (i = 0; i < ic->ic_nchans; i++) {
147 c = &ic->ic_channels[i];
148 KASSERT(c->ic_flags != 0, ("channel with no flags"));
155 if (c->ic_ieee == 0)
156 c->ic_ieee = ieee80211_mhz2ieee(c->ic_freq,c->ic_flags);
162 if (IEEE80211_IS_CHAN_HT40(c) && c->ic_extieee == 0)
163 c->ic_extieee = ieee80211_mhz2ieee(c->ic_freq +
164 (IEEE80211_IS_CHAN_HT40U(c) ? 20 : -20),
165 c->ic_flags);
175 if (c->ic_maxpower == 0)
176 c->ic_maxpower = 2*c->ic_maxregpower;
177 setbit(ic->ic_chan_avail, c->ic_ieee);
182 setbit(ic->ic_modecaps, IEEE80211_MODE_11A);
184 setbit(ic->ic_modecaps, IEEE80211_MODE_11B);
186 setbit(ic->ic_modecaps, IEEE80211_MODE_11G);
188 setbit(ic->ic_modecaps, IEEE80211_MODE_FH);
190 setbit(ic->ic_modecaps, IEEE80211_MODE_TURBO_A);
192 setbit(ic->ic_modecaps, IEEE80211_MODE_TURBO_G);
194 setbit(ic->ic_modecaps, IEEE80211_MODE_STURBO_A);
196 setbit(ic->ic_modecaps, IEEE80211_MODE_HALF);
198 setbit(ic->ic_modecaps, IEEE80211_MODE_QUARTER);
200 setbit(ic->ic_modecaps, IEEE80211_MODE_11NA);
202 setbit(ic->ic_modecaps, IEEE80211_MODE_11NG);
204 setbit(ic->ic_modecaps, IEEE80211_MODE_VHT_5GHZ);
206 setbit(ic->ic_modecaps, IEEE80211_MODE_VHT_2GHZ);
209 memcpy(ic->ic_chan_active, ic->ic_chan_avail,
210 sizeof(ic->ic_chan_avail));
213 ieee80211_sort_channels(ic->ic_channels, ic->ic_nchans);
216 ic->ic_bsschan = IEEE80211_CHAN_ANYC;
217 ic->ic_prevchan = NULL;
218 ic->ic_csa_newchan = NULL;
220 ic->ic_curchan = &ic->ic_channels[0];
221 ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan);
223 /* fillin well-known rate sets if driver has not specified */
241 if (ic->ic_rxstream == 0)
242 ic->ic_rxstream = 2;
243 if (ic->ic_txstream == 0)
244 ic->ic_txstream = 2;
282 retval = printf("%s: ", ic->ic_name);
309 sbuf_printf(&sb, "%s%s", sp, ic->ic_name);
330 IEEE80211_LOCK_INIT(ic, ic->ic_name);
331 IEEE80211_TX_LOCK_INIT(ic, ic->ic_name);
332 TAILQ_INIT(&ic->ic_vaps);
335 ic->ic_tq = taskqueue_create("ic_taskq",
337 taskqueue_thread_enqueue, &ic->ic_tq);
338 taskqueue_start_threads(&ic->ic_tq, 1, PI_NET, "%s net80211 taskq",
339 ic->ic_name);
340 ic->ic_ierrors = counter_u64_alloc(IEEE80211_M_WAITOK);
341 ic->ic_oerrors = counter_u64_alloc(IEEE80211_M_WAITOK);
349 ic->ic_update_mcast = null_update_mcast;
350 ic->ic_update_promisc = null_update_promisc;
351 ic->ic_update_chw = null_update_chw;
353 ic->ic_hash_key = arc4random();
354 ic->ic_bintval = IEEE80211_BINTVAL_DEFAULT;
355 ic->ic_lintval = ic->ic_bintval;
356 ic->ic_txpowlimit = IEEE80211_TXPOWER_MAX;
395 if (ic->ic_tq == NULL)
402 taskqueue_drain(taskqueue_thread, &ic->ic_restart_task);
408 while ((vap = TAILQ_FIRST(&ic->ic_vaps)) != NULL) {
429 counter_u64_free(ic->ic_ierrors);
430 counter_u64_free(ic->ic_oerrors);
432 taskqueue_free(ic->ic_tq);
478 if (strcmp(ic->ic_name, name) == 0)
500 * require re-initialization of the 802.11 state machine (e.g
502 * should cause the driver to re-initialize the device. Drivers
524 vap->iv_def_txkey = kid;
533 struct ieee80211vap *vap = ifp->if_softc;
534 struct ieee80211com *ic = vap->iv_ic;
540 rv += counter_u64_fetch(ic->ic_oerrors);
543 rv += counter_u64_fetch(ic->ic_ierrors);
566 ifp->if_softc = vap; /* back pointer */
567 ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
568 ifp->if_transmit = ieee80211_vap_transmit;
569 ifp->if_qflush = ieee80211_vap_qflush;
570 ifp->if_ioctl = ieee80211_ioctl;
571 ifp->if_init = ieee80211_init;
572 ifp->if_get_counter = ieee80211_get_counter;
574 vap->iv_ifp = ifp;
575 vap->iv_ic = ic;
576 vap->iv_flags = ic->ic_flags; /* propagate common flags */
577 vap->iv_flags_ext = ic->ic_flags_ext;
578 vap->iv_flags_ven = ic->ic_flags_ven;
579 vap->iv_caps = ic->ic_caps &~ IEEE80211_C_OPMODE;
581 /* 11n capabilities - XXX methodize */
582 vap->iv_htcaps = ic->ic_htcaps;
583 vap->iv_htextcaps = ic->ic_htextcaps;
585 /* 11ac capabilities - XXX methodize */
586 vap->iv_vht_cap.vht_cap_info = ic->ic_vht_cap.vht_cap_info;
587 vap->iv_vhtextcaps = ic->ic_vhtextcaps;
589 vap->iv_opmode = opmode;
590 vap->iv_caps |= ieee80211_opcap[opmode];
591 IEEE80211_ADDR_COPY(vap->iv_myaddr, ic->ic_macaddr);
597 * For non-legacy operation the station must associate
602 IEEE80211_ADDR_COPY(vap->iv_des_bssid, bssid);
603 vap->iv_flags |= IEEE80211_F_DESBSSID;
605 vap->iv_flags_ext |= IEEE80211_FEXT_WDSLEGACY;
611 KASSERT(ic->ic_caps & IEEE80211_C_TDMA,
612 ("not TDMA capable, ic_caps 0x%x", ic->ic_caps));
618 vap->iv_caps |= IEEE80211_C_TDMA;
625 /* auto-enable s/w beacon miss support */
627 vap->iv_flags_ext |= IEEE80211_FEXT_SWBMISS;
628 /* auto-generated or user supplied MAC address */
630 vap->iv_flags_ext |= IEEE80211_FEXT_UNIQMAC;
635 if (vap->iv_caps & IEEE80211_C_WME)
636 vap->iv_flags |= IEEE80211_F_WME;
637 if (vap->iv_caps & IEEE80211_C_BURST)
638 vap->iv_flags |= IEEE80211_F_BURST;
640 if (vap->iv_opmode == IEEE80211_M_STA &&
641 (vap->iv_caps & IEEE80211_C_BGSCAN))
642 vap->iv_flags |= IEEE80211_F_BGSCAN;
643 vap->iv_flags |= IEEE80211_F_DOTH; /* XXX no cap, just ena */
645 if (vap->iv_opmode == IEEE80211_M_HOSTAP &&
646 (vap->iv_caps & IEEE80211_C_DFS))
647 vap->iv_flags_ext |= IEEE80211_FEXT_DFS;
648 /* NB: only flip on U-APSD for hostap/sta for now */
649 if ((vap->iv_opmode == IEEE80211_M_STA)
650 || (vap->iv_opmode == IEEE80211_M_HOSTAP)) {
651 if (vap->iv_caps & IEEE80211_C_UAPSD)
652 vap->iv_flags_ext |= IEEE80211_FEXT_UAPSD;
655 vap->iv_des_chan = IEEE80211_CHAN_ANYC; /* any channel is ok */
656 vap->iv_bmissthreshold = IEEE80211_HWBMISS_DEFAULT;
657 vap->iv_dtim_period = IEEE80211_DTIM_DEFAULT;
662 vap->iv_reset = default_reset;
668 vap->iv_update_deftxkey = default_update_deftxkey;
698 struct ifnet *ifp = vap->iv_ifp;
699 struct ieee80211com *ic = vap->iv_ic;
705 __func__, ieee80211_opmode_name[vap->iv_opmode],
706 ic->ic_name, vap->iv_flags, vap->iv_flags_ext);
715 maxrate = ieee80211_media_setup(ic, &vap->iv_media, vap->iv_caps,
716 vap->iv_opmode == IEEE80211_M_STA, media_change, media_stat);
719 ifmedia_set(&vap->iv_media,
722 ifp->if_baudrate = IF_Mbps(maxrate);
725 IEEE80211_ADDR_COPY(vap->iv_myaddr, IF_LLADDR(ifp));
727 vap->iv_output = ifp->if_output;
728 ifp->if_output = ieee80211_output;
732 TAILQ_INSERT_TAIL(&ic->ic_vaps, vap, iv_next);
763 struct ieee80211com *ic = vap->iv_ic;
764 struct ifnet *ifp = vap->iv_ifp;
767 CURVNET_SET(ifp->if_vnet);
770 __func__, ieee80211_opmode_name[vap->iv_opmode], ic->ic_name);
781 ieee80211_draintask(ic, &vap->iv_nstate_task[i]);
782 ieee80211_draintask(ic, &vap->iv_swbmiss_task);
783 ieee80211_draintask(ic, &vap->iv_wme_task);
784 ieee80211_draintask(ic, &ic->ic_parent_task);
786 /* XXX band-aid until ifnet handles this for us */
787 taskqueue_drain(taskqueue_swi, &ifp->if_linktask);
790 KASSERT(vap->iv_state == IEEE80211_S_INIT , ("vap still running"));
791 TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next);
811 if (vap->iv_ifflags & IFF_PROMISC)
813 if (vap->iv_ifflags & IFF_ALLMULTI)
817 ifmedia_removeall(&vap->iv_media);
846 struct ieee80211com *ic = vap->iv_ic;
851 if (++ic->ic_promisc == 1)
852 ieee80211_runtask(ic, &ic->ic_promisc_task);
854 KASSERT(ic->ic_promisc > 0, ("%s: ic %p not promisc",
856 if (--ic->ic_promisc == 0)
857 ieee80211_runtask(ic, &ic->ic_promisc_task);
868 struct ieee80211com *ic = vap->iv_ic;
873 if (++ic->ic_allmulti == 1)
874 ieee80211_runtask(ic, &ic->ic_mcast_task);
876 KASSERT(ic->ic_allmulti > 0, ("%s: ic %p not allmulti",
878 if (--ic->ic_allmulti == 0)
879 ieee80211_runtask(ic, &ic->ic_mcast_task);
897 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next)
898 if (vap->iv_flags & flag) {
903 ic->ic_flags |= flag;
905 ic->ic_flags &= ~flag;
911 struct ieee80211com *ic = vap->iv_ic;
915 flag = -flag;
916 vap->iv_flags &= ~flag;
918 vap->iv_flags |= flag;
937 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next)
938 if (vap->iv_flags_ht & flag) {
943 ic->ic_flags_ht |= flag;
945 ic->ic_flags_ht &= ~flag;
951 struct ieee80211com *ic = vap->iv_ic;
955 flag = -flag;
956 vap->iv_flags_ht &= ~flag;
958 vap->iv_flags_ht |= flag;
977 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next)
978 if (vap->iv_vht_flags & flag) {
983 ic->ic_vht_flags |= flag;
985 ic->ic_vht_flags &= ~flag;
991 struct ieee80211com *ic = vap->iv_ic;
995 flag = -flag;
996 vap->iv_vht_flags &= ~flag;
998 vap->iv_vht_flags |= flag;
1017 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next)
1018 if (vap->iv_flags_ext & flag) {
1023 ic->ic_flags_ext |= flag;
1025 ic->ic_flags_ext &= ~flag;
1031 struct ieee80211com *ic = vap->iv_ic;
1035 flag = -flag;
1036 vap->iv_flags_ext &= ~flag;
1038 vap->iv_flags_ext |= flag;
1044 mapgsm(u_int freq, u_int flags)
1046 freq *= 10;
1048 freq += 5;
1050 freq += 10;
1052 freq += 20;
1054 return (freq - 906*10) / 5;
1058 mappsb(u_int freq, u_int flags)
1060 return 37 + ((freq * 10) + ((freq % 5) == 2 ? 5 : 0) - 49400) / 5;
1067 ieee80211_mhz2ieee(u_int freq, u_int flags)
1071 return mapgsm(freq, flags);
1073 if (freq == 2484)
1075 if (freq < 2484)
1076 return ((int) freq - 2407) / 5;
1078 return 15 + ((freq - 2512) / 20);
1080 if (freq <= 5000) {
1082 if (IS_FREQ_IN_PSB(freq))
1083 return mappsb(freq, flags);
1084 return (freq - 4000) / 5;
1086 return (freq - 5000) / 5;
1088 if (freq == 2484)
1090 if (freq < 2484) {
1091 if (907 <= freq && freq <= 922)
1092 return mapgsm(freq, flags);
1093 return ((int) freq - 2407) / 5;
1095 if (freq < 5000) {
1096 if (IS_FREQ_IN_PSB(freq))
1097 return mappsb(freq, flags);
1098 else if (freq > 4900)
1099 return (freq - 4000) / 5;
1101 return 15 + ((freq - 2512) / 20);
1103 return (freq - 5000) / 5;
1118 return (c == IEEE80211_CHAN_ANYC ? IEEE80211_CHAN_ANY : c->ic_ieee);
1135 return 2512 + ((chan-15)*20);
1138 chan -= 37;
1146 if (chan < 14) /* 0-13 */
1148 if (chan < 27) /* 15-26 */
1149 return 2512 + ((chan-15)*20);
1159 * IEEE Std 802.11-2012, page 1738, subclause 20.3.15.4:
1160 * "the secondary channel number shall be 'N + [1,-1] * 4'
1162 if (c->ic_flags & IEEE80211_CHAN_HT40U)
1163 c->ic_extieee = c->ic_ieee + 4;
1164 else if (c->ic_flags & IEEE80211_CHAN_HT40D)
1165 c->ic_extieee = c->ic_ieee - 4;
1167 c->ic_extieee = 0;
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
1220 __func__, c->ic_ieee, c->ic_flags);
1225 if (c->ic_freq >= vht160_chan_ranges[i].freq_start &&
1226 c->ic_freq < vht160_chan_ranges[i].freq_end) {
1230 c->ic_vht_ch_freq1 =
1231 ieee80211_mhz2ieee(midpoint, c->ic_flags);
1232 c->ic_vht_ch_freq2 = 0;
1234 printf("%s: %d, freq=%d, midpoint=%d, freq1=%d, freq2=%d\n",
1235 __func__, c->ic_ieee, c->ic_freq, midpoint,
1236 c->ic_vht_ch_freq1, c->ic_vht_ch_freq2);
1246 if (c->ic_freq >= vht80_chan_ranges[i].freq_start &&
1247 c->ic_freq < vht80_chan_ranges[i].freq_end) {
1251 c->ic_vht_ch_freq1 =
1252 ieee80211_mhz2ieee(midpoint, c->ic_flags);
1253 c->ic_vht_ch_freq2 = 0;
1255 printf("%s: %d, freq=%d, midpoint=%d, freq1=%d, freq2=%d\n",
1256 __func__, c->ic_ieee, c->ic_freq, midpoint,
1257 c->ic_vht_ch_freq1, c->ic_vht_ch_freq2);
1267 c->ic_vht_ch_freq1 = c->ic_ieee + 2;
1269 c->ic_vht_ch_freq1 = c->ic_ieee - 2;
1276 c->ic_vht_ch_freq1 = c->ic_ieee;
1281 __func__, c->ic_ieee, c->ic_flags);
1294 is_vht160_valid_freq(uint16_t freq)
1299 if (freq >= vht160_chan_ranges[i].freq_start &&
1300 freq < vht160_chan_ranges[i].freq_end)
1307 is_vht80_valid_freq(uint16_t freq)
1311 if (freq >= vht80_chan_ranges[i].freq_start &&
1312 freq < vht80_chan_ranges[i].freq_end)
1320 uint8_t ieee, uint16_t freq, int8_t maxregpower, uint32_t flags)
1328 printf("%s: %d of %d: ieee=%d, freq=%d, flags=0x%08x\n",
1329 __func__, *nchans, maxchans, ieee, freq, flags);
1333 c->ic_ieee = ieee;
1334 c->ic_freq = freq != 0 ? freq : ieee80211_ieee2mhz(ieee, flags);
1335 c->ic_maxregpower = maxregpower;
1336 c->ic_maxpower = 2 * maxregpower;
1337 c->ic_flags = flags;
1338 c->ic_vht_ch_freq1 = 0;
1339 c->ic_vht_ch_freq2 = 0;
1363 c[0] = c[-1];
1364 c->ic_flags = flags;
1365 c->ic_vht_ch_freq1 = 0;
1366 c->ic_vht_ch_freq2 = 0;
1374 * XXX VHT-2GHz
1490 int *nchans, uint8_t ieee, uint16_t freq, int8_t maxregpower,
1499 error = addchan(chans, maxchans, nchans, ieee, freq, maxregpower,
1511 int *nchans, uint8_t ieee, uint16_t freq, int8_t maxregpower,
1515 return (ieee80211_add_channel_cbw(chans, maxchans, nchans, ieee, freq,
1520 findchannel(struct ieee80211_channel chans[], int nchans, uint16_t freq,
1530 if (c->ic_freq == freq &&
1531 (c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags)
1546 uint16_t freq;
1549 freq = ieee80211_ieee2mhz(ieee, flags);
1556 cent = findchannel(chans, *nchans, freq, flags);
1560 extc = findchannel(chans, *nchans, freq + 20, flags);
1565 error = addchan(chans, maxchans, nchans, cent->ic_ieee, cent->ic_freq,
1570 error = addchan(chans, maxchans, nchans, extc->ic_ieee, extc->ic_freq,
1583 return (c->ic_freq);
1603 * VHT - use the pre-calculated centre frequency
1607 return (ieee80211_ieee2mhz(c->ic_vht_ch_freq1, c->ic_flags));
1610 return (c->ic_freq + 10);
1613 return (c->ic_freq - 10);
1616 return (c->ic_freq);
1626 if (IEEE80211_IS_CHAN_VHT(c) && (c->ic_vht_ch_freq2 != 0))
1627 return (ieee80211_ieee2mhz(c->ic_vht_ch_freq2, c->ic_flags));
1640 uint16_t freq;
1645 freq = ieee80211_ieee2mhz(ieee[i], flags[0]);
1661 if (! is_vht160_valid_freq(freq))
1675 if (! is_vht80_valid_freq(freq))
1698 freq - 20 !=
1699 ieee80211_ieee2mhz(ieee[i] - 4, flags[j]))
1713 if (i == nieee - 1 ||
1714 ieee[i] + 4 > ieee[nieee - 1] ||
1715 freq + 20 !=
1721 ieee[i], freq, 0, flags[j]);
1765 * XXX-BZ with HT and VHT there is no 1:1 mapping anymore. Review all
1778 * the previous lookup to optimize switching between two
1779 * channels--as happens with dynamic turbo.
1782 ieee80211_find_channel(struct ieee80211com *ic, int freq, int flags)
1787 c = ic->ic_prevchan;
1788 if (c != NULL && c->ic_freq == freq &&
1789 (c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags)
1792 return (findchannel(ic->ic_channels, ic->ic_nchans, freq, flags));
1797 * the previous lookup to optimize switching between two
1798 * channels--as happens with dynamic turbo.
1807 c = ic->ic_prevchan;
1808 if (c != NULL && c->ic_ieee == ieee &&
1809 (c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags)
1812 for (i = 0; i < ic->ic_nchans; i++) {
1813 c = &ic->ic_channels[i];
1814 if (c->ic_ieee == ieee &&
1815 (c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags)
1830 * like. It also doesn't know about legacy-turbog and
1831 * legacy-turbo modes, which some offload NICs actually
1843 struct ieee80211com *ic = vap->iv_ic;
1851 * Strictly speaking we only use freq for now,
1855 if ((rxs->r_flags & IEEE80211_R_FREQ) == 0)
1857 if ((rxs->r_flags & IEEE80211_R_IEEE) == 0)
1859 if ((rxs->r_flags & IEEE80211_R_BAND) == 0)
1863 * If the rx status contains a valid ieee/freq, then
1871 switch (rxs->c_band) {
1879 if (rxs->c_freq < 3000) {
1888 c = ieee80211_find_channel(ic, rxs->c_freq, flags);
1891 "%s: freq=%d, ieee=%d, flags=0x%08x; c=%p\n",
1892 __func__, (int) rxs->c_freq, (int) rxs->c_ieee, flags, c);
1963 if (isclr(ic->ic_modecaps, mode))
1968 rs = &ic->ic_sup_rates[mode];
1969 for (i = 0; i < rs->rs_nrates; i++) {
1970 rate = rs->rs_rates[i];
2008 if (isclr(ic->ic_modecaps, mode))
2013 if (isset(ic->ic_modecaps, IEEE80211_MODE_11NA) ||
2014 isset(ic->ic_modecaps, IEEE80211_MODE_11NG)) {
2017 i = ic->ic_txstream * 8 - 1;
2018 if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) &&
2019 (ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40))
2021 else if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40))
2023 else if ((ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20))
2033 * XXX-BZ skip "VHT_2GHZ" for now.
2037 if (isclr(ic->ic_modecaps, mode))
2042 if (isset(ic->ic_modecaps, IEEE80211_MODE_VHT_5GHZ)) {
2057 return &ic->ic_sup_rates[ieee80211_chan2mode(c)];
2065 return &ic->ic_sup_htrates;
2077 if (isclr(ic->ic_modecaps, mode))
2080 rs = &ic->ic_sup_rates[mode];
2081 for (i = 0; i < rs->rs_nrates; i++) {
2082 mword = ieee80211_rate2media(ic, rs->rs_rates[i], mode);
2102 printf("Chan Freq CW RegPwr MinPwr MaxPwr\n");
2103 for (i = 0; i < ic->ic_nchans; i++) {
2104 c = &ic->ic_channels[i];
2130 , c->ic_ieee, c->ic_freq, type
2133 IEEE80211_IS_CHAN_HT40D(c) ? '-' : ' '
2134 , c->ic_maxregpower
2135 , c->ic_minpower / 2, c->ic_minpower & 1 ? 5 : 0
2136 , c->ic_maxpower / 2, c->ic_maxpower & 1 ? 5 : 0
2144 switch (IFM_MODE(ime->ifm_media)) {
2179 if (ime->ifm_media & IFM_IEEE80211_TURBO) {
2190 /* XXX HT40 +/- */
2200 struct ieee80211vap *vap = ifp->if_softc;
2201 struct ifmedia_entry *ime = vap->iv_media.ifm_cur;
2204 if (!media2mode(ime, vap->iv_flags, &newmode))
2206 if (vap->iv_des_mode != newmode) {
2207 vap->iv_des_mode = newmode;
2278 struct ieee80211vap *vap = ifp->if_softc;
2279 struct ieee80211com *ic = vap->iv_ic;
2282 imr->ifm_status = IFM_AVALID;
2288 if (vap->iv_state == IEEE80211_S_RUN ||
2289 vap->iv_state == IEEE80211_S_SLEEP) {
2290 imr->ifm_status |= IFM_ACTIVE;
2291 mode = ieee80211_chan2mode(ic->ic_curchan);
2294 imr->ifm_active = media_status(vap->iv_opmode, ic->ic_curchan);
2298 if (vap->iv_txparms[mode].ucastrate != IEEE80211_FIXED_RATE_NONE) {
2302 imr->ifm_active |= ieee80211_rate2media(ic,
2303 vap->iv_txparms[mode].ucastrate, mode);
2304 } else if (vap->iv_opmode == IEEE80211_M_STA) {
2308 imr->ifm_active |= ieee80211_rate2media(ic,
2309 vap->iv_bss->ni_txrate, mode);
2311 imr->ifm_active |= IFM_AUTO;
2312 if (imr->ifm_status & IFM_ACTIVE)
2313 imr->ifm_current = imr->ifm_active;
2332 ieee80211_setbasicrates(&ic->ic_sup_rates[mode], mode);
2334 ic->ic_curmode = mode;
2375 printf("%s: cannot map channel to mode; freq %u flags 0x%x\n",
2376 __func__, chan->ic_freq, chan->ic_flags);
2579 if (ic != NULL && ic->ic_phytype == IEEE80211_T_FH)
2600 -1, /* IFM_AUTO */
2624 -1, /* IFM_IEEE80211_MCS */
2625 -1, /* IFM_IEEE80211_VHT */
2637 a -= b; a -= c; a ^= (c >> 13); \
2638 b -= c; b -= a; b ^= (a << 8); \
2639 c -= a; c -= b; c ^= (b >> 13); \
2640 a -= b; a -= c; a ^= (c >> 12); \
2641 b -= c; b -= a; b ^= (a << 16); \
2642 c -= a; c -= b; c ^= (b >> 5); \
2643 a -= b; a -= c; a ^= (c >> 3); \
2644 b -= c; b -= a; b ^= (a << 10); \
2645 c -= a; c -= b; c ^= (b >> 15); \
2652 uint32_t a = 0x9e3779b9, b = 0x9e3779b9, c = ic->ic_hash_key;
2701 return (&vap->iv_nw_keys[0] <= key &&
2702 key < &vap->iv_nw_keys[IEEE80211_WEP_NKID]);
2713 * This is a short-cut for now; eventually we will need