Lines Matching +full:channel +full:- +full:4
3 * Copyright (c) 2002-2013, Jouni Malinen <j@w1.fi>
30 for (i = 0; i < mode->num_channels; i++) { in hw_get_channel_chan()
31 struct hostapd_channel_data *ch = &mode->channels[i]; in hw_get_channel_chan()
32 if (ch->chan == chan) { in hw_get_channel_chan()
34 *freq = ch->freq; in hw_get_channel_chan()
48 for (i = 0; i < mode->num_channels; i++) { in hw_mode_get_channel()
49 struct hostapd_channel_data *ch = &mode->channels[i]; in hw_mode_get_channel()
51 if (ch->freq == freq) { in hw_mode_get_channel()
53 *chan = ch->chan; in hw_mode_get_channel()
78 if (curr_mode->mode != mode) in hw_get_channel_freq()
123 pri_chan = p_chan->chan; in allowed_ht40_channel_pair()
124 sec_chan = s_chan->chan; in allowed_ht40_channel_pair()
132 wpa_printf(MSG_ERROR, "Channel %d is not allowed as primary", in allowed_ht40_channel_pair()
138 "HT40: control channel: %d (%d MHz), secondary channel: %d (%d MHz)", in allowed_ht40_channel_pair()
139 pri_chan, p_chan->freq, sec_chan, s_chan->freq); in allowed_ht40_channel_pair()
141 /* Verify that HT40 secondary channel is an allowed 20 MHz in allowed_ht40_channel_pair()
142 * channel */ in allowed_ht40_channel_pair()
143 if ((s_chan->flag & HOSTAPD_CHAN_DISABLED) || in allowed_ht40_channel_pair()
144 (ht40_plus && !(p_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40P)) || in allowed_ht40_channel_pair()
145 (!ht40_plus && !(p_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40M))) { in allowed_ht40_channel_pair()
146 wpa_printf(MSG_ERROR, "HT40 secondary channel %d not allowed", in allowed_ht40_channel_pair()
152 * Verify that HT40 primary,secondary channel pair is allowed per in allowed_ht40_channel_pair()
154 * 2.4 GHz rules allow all cases where the secondary channel fits into in allowed_ht40_channel_pair()
170 wpa_printf(MSG_ERROR, "HT40 channel pair (%d, %d) not allowed", in allowed_ht40_channel_pair()
186 if (ieee802_11_parse_elems((u8 *) (bss + 1), bss->ie_len, &elems, 0) != in get_pri_sec_chan()
189 *pri_chan = oper->primary_chan; in get_pri_sec_chan()
190 if (oper->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) { in get_pri_sec_chan()
191 int sec = oper->ht_param & in get_pri_sec_chan()
194 *sec_chan = *pri_chan + 4; in get_pri_sec_chan()
196 *sec_chan = *pri_chan - 4; in get_pri_sec_chan()
212 pri_chan->freq == sec_chan->freq) in check_40mhz_5g()
217 * channel, but not on selected PRI channel. in check_40mhz_5g()
220 for (i = 0; i < scan_res->num; i++) { in check_40mhz_5g()
221 struct wpa_scan_res *bss = scan_res->res[i]; in check_40mhz_5g()
222 if (bss->freq == pri_chan->freq) in check_40mhz_5g()
224 else if (bss->freq == sec_chan->freq) in check_40mhz_5g()
229 …"Switch own primary and secondary channel to get secondary channel with no Beacons from other BSSe… in check_40mhz_5g()
234 * Match PRI/SEC channel with any existing HT40 BSS on the same in check_40mhz_5g()
239 for (i = 0; i < scan_res->num; i++) { in check_40mhz_5g()
240 struct wpa_scan_res *bss = scan_res->res[i]; in check_40mhz_5g()
242 if (pri_chan->chan == bss_pri_chan && in check_40mhz_5g()
243 sec_chan->chan == bss_sec_chan) { in check_40mhz_5g()
249 for (i = 0; i < scan_res->num; i++) { in check_40mhz_5g()
250 struct wpa_scan_res *bss = scan_res->res[i]; in check_40mhz_5g()
252 if (pri_chan->chan == bss_sec_chan && in check_40mhz_5g()
253 sec_chan->chan == bss_pri_chan) { in check_40mhz_5g()
255 "secondary channel due to BSS " in check_40mhz_5g()
257 MAC2STR(bss->bssid)); in check_40mhz_5g()
273 if (bss->freq < start || bss->freq > end || bss->freq == pri_freq) in check_20mhz_bss()
276 if (ieee802_11_parse_elems((u8 *) (bss + 1), bss->ie_len, &elems, 0) == in check_20mhz_bss()
282 MACSTR " freq=%d", MAC2STR(bss->bssid), bss->freq); in check_20mhz_bss()
288 if (oper->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK) in check_20mhz_bss()
292 MACSTR " freq=%d", MAC2STR(bss->bssid), bss->freq); in check_20mhz_bss()
314 affected_start = (pri_freq + sec_freq) / 2 - 25; in check_40mhz_2g4()
316 wpa_printf(MSG_DEBUG, "40 MHz affected channel range: [%d,%d] MHz", in check_40mhz_2g4()
318 for (i = 0; i < scan_res->num; i++) { in check_40mhz_2g4()
319 struct wpa_scan_res *bss = scan_res->res[i]; in check_40mhz_2g4()
320 int pri = bss->freq; in check_40mhz_2g4()
336 sec = pri - 20; in check_40mhz_2g4()
343 continue; /* not within affected channel range */ in check_40mhz_2g4()
347 MAC2STR(bss->bssid), bss->freq, pri_chan, sec_chan); in check_40mhz_2g4()
355 MAC2STR(bss->bssid), in check_40mhz_2g4()
357 sec > pri ? '+' : '-', in check_40mhz_2g4()
363 if (ieee802_11_parse_elems((u8 *) (bss + 1), bss->ie_len, in check_40mhz_2g4()
370 if (le_to_host16(ht_cap->ht_capabilities_info) & in check_40mhz_2g4()
373 "40 MHz Intolerant is set on channel %d in BSS " in check_40mhz_2g4()
374 MACSTR, pri, MAC2STR(bss->bssid)); in check_40mhz_2g4()
386 u8 first_chan = *seg0 - 6, sec_chan; in punct_update_legacy_bw_80()
399 *seg0 -= 4; in punct_update_legacy_bw_80()
401 *seg0 += 4; in punct_update_legacy_bw_80()
406 sec_chan = pri_chan + 4; in punct_update_legacy_bw_80()
408 sec_chan = pri_chan - 4; in punct_update_legacy_bw_80()
410 if (bitmap & BIT((sec_chan - first_chan) / 4)) in punct_update_legacy_bw_80()
419 *seg0 -= 8; in punct_update_legacy_bw_160()
428 punct_update_legacy_bw_80((bitmap & 0xF0) >> 4, pri, in punct_update_legacy_bw_160()
455 int freq, int channel, int enable_edmg, in hostapd_set_freq_params() argument
469 if (!he_cap || !he_cap->he_supported) in hostapd_set_freq_params()
471 if (!eht_cap || !eht_cap->eht_supported) in hostapd_set_freq_params()
474 data->mode = mode; in hostapd_set_freq_params()
475 data->freq = freq; in hostapd_set_freq_params()
476 data->channel = channel; in hostapd_set_freq_params()
477 data->ht_enabled = ht_enabled; in hostapd_set_freq_params()
478 data->vht_enabled = vht_enabled; in hostapd_set_freq_params()
479 data->he_enabled = he_enabled; in hostapd_set_freq_params()
480 data->eht_enabled = eht_enabled; in hostapd_set_freq_params()
481 data->sec_channel_offset = sec_channel_offset; in hostapd_set_freq_params()
482 data->center_freq1 = freq + sec_channel_offset * 10; in hostapd_set_freq_params()
483 data->center_freq2 = 0; in hostapd_set_freq_params()
485 data->bandwidth = 80; in hostapd_set_freq_params()
488 data->bandwidth = 160; in hostapd_set_freq_params()
490 data->bandwidth = 320; in hostapd_set_freq_params()
492 data->bandwidth = 40; in hostapd_set_freq_params()
494 data->bandwidth = 20; in hostapd_set_freq_params()
497 hostapd_encode_edmg_chan(enable_edmg, edmg_channel, channel, in hostapd_set_freq_params()
498 &data->edmg); in hostapd_set_freq_params()
501 if (!data->he_enabled && !data->eht_enabled) { in hostapd_set_freq_params()
503 "Can't set 6 GHz mode - HE or EHT aren't enabled"); in hostapd_set_freq_params()
504 return -1; in hostapd_set_freq_params()
507 if (center_idx_to_bw_6ghz(channel) < 0) { in hostapd_set_freq_params()
509 "Invalid control channel for 6 GHz band"); in hostapd_set_freq_params()
510 return -1; in hostapd_set_freq_params()
517 return -1; in hostapd_set_freq_params()
520 data->center_freq1 = data->freq; in hostapd_set_freq_params()
529 return -1; in hostapd_set_freq_params()
532 /* The 6 GHz channel 2 uses a different operating class in hostapd_set_freq_params()
540 return -1; in hostapd_set_freq_params()
548 return -1; in hostapd_set_freq_params()
556 return -1; in hostapd_set_freq_params()
560 data->bandwidth = (1 << (u8) bw) * 20; in hostapd_set_freq_params()
561 data->center_freq1 = freq1; in hostapd_set_freq_params()
562 data->center_freq2 = freq2; in hostapd_set_freq_params()
564 data->ht_enabled = 0; in hostapd_set_freq_params()
565 data->vht_enabled = 0; in hostapd_set_freq_params()
570 if (data->eht_enabled) switch (oper_chwidth) { in hostapd_set_freq_params()
572 if (!(eht_cap->phy_cap[EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_IDX] & in hostapd_set_freq_params()
575 "320 MHz channel width is not supported in 5 or 6 GHz"); in hostapd_set_freq_params()
576 return -1; in hostapd_set_freq_params()
583 if (data->he_enabled || data->eht_enabled) switch (oper_chwidth) { in hostapd_set_freq_params()
590 !(he_cap->phy_cap[HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] & in hostapd_set_freq_params()
593 "40 MHz channel width is not supported in 2.4 GHz"); in hostapd_set_freq_params()
594 return -1; in hostapd_set_freq_params()
602 !(he_cap->phy_cap[HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] & in hostapd_set_freq_params()
605 "40/80 MHz channel width is not supported in 5/6 GHz"); in hostapd_set_freq_params()
606 return -1; in hostapd_set_freq_params()
612 !(he_cap->phy_cap[HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] & in hostapd_set_freq_params()
615 "80+80 MHz channel width is not supported in 5/6 GHz"); in hostapd_set_freq_params()
616 return -1; in hostapd_set_freq_params()
621 !(he_cap->phy_cap[HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] & in hostapd_set_freq_params()
624 "160 MHz channel width is not supported in 5 / 6GHz"); in hostapd_set_freq_params()
625 return -1; in hostapd_set_freq_params()
630 } else if (data->vht_enabled) switch (oper_chwidth) { in hostapd_set_freq_params()
636 "80+80 channel width is not supported!"); in hostapd_set_freq_params()
637 return -1; in hostapd_set_freq_params()
646 "160 MHz channel width is not supported!"); in hostapd_set_freq_params()
647 return -1; in hostapd_set_freq_params()
658 punct_update_legacy_bw(punct_bitmap, channel, in hostapd_set_freq_params()
662 if (data->eht_enabled || data->he_enabled || in hostapd_set_freq_params()
663 data->vht_enabled) switch (oper_chwidth) { in hostapd_set_freq_params()
667 5000 + center_segment0 * 5 != data->center_freq1 && in hostapd_set_freq_params()
668 2407 + center_segment0 * 5 != data->center_freq1)) { in hostapd_set_freq_params()
671 center_segment0, data->center_freq1); in hostapd_set_freq_params()
672 return -1; in hostapd_set_freq_params()
676 if (center_segment1 == center_segment0 + 4 || in hostapd_set_freq_params()
677 center_segment1 == center_segment0 - 4) { in hostapd_set_freq_params()
680 return -1; in hostapd_set_freq_params()
682 data->center_freq2 = 5000 + center_segment1 * 5; in hostapd_set_freq_params()
685 data->bandwidth = 80; in hostapd_set_freq_params()
689 "80/80+80 MHz: no second channel offset"); in hostapd_set_freq_params()
690 return -1; in hostapd_set_freq_params()
696 return -1; in hostapd_set_freq_params()
702 return -1; in hostapd_set_freq_params()
705 if (channel <= 48) in hostapd_set_freq_params()
707 else if (channel <= 64) in hostapd_set_freq_params()
709 else if (channel <= 112) in hostapd_set_freq_params()
711 else if (channel <= 128) in hostapd_set_freq_params()
713 else if (channel <= 144) in hostapd_set_freq_params()
715 else if (channel <= 161) in hostapd_set_freq_params()
717 else if (channel <= 177) in hostapd_set_freq_params()
719 data->center_freq1 = 5000 + center_segment0 * 5; in hostapd_set_freq_params()
723 * HT40 channel band is in VHT80 Pri channel band in hostapd_set_freq_params()
726 if (center_segment0 == channel + 6 || in hostapd_set_freq_params()
727 center_segment0 == channel + 2 || in hostapd_set_freq_params()
728 center_segment0 == channel - 2 || in hostapd_set_freq_params()
729 center_segment0 == channel - 6) in hostapd_set_freq_params()
730 data->center_freq1 = 5000 + center_segment0 * 5; in hostapd_set_freq_params()
733 "Wrong coupling between HT and VHT/HE channel setting"); in hostapd_set_freq_params()
734 return -1; in hostapd_set_freq_params()
739 data->bandwidth = 160; in hostapd_set_freq_params()
743 return -1; in hostapd_set_freq_params()
748 "160 MHz: second channel offset not set"); in hostapd_set_freq_params()
749 return -1; in hostapd_set_freq_params()
753 * HT40 channel band is in VHT160 channel band configuration. in hostapd_set_freq_params()
755 if (center_segment0 == channel + 14 || in hostapd_set_freq_params()
756 center_segment0 == channel + 10 || in hostapd_set_freq_params()
757 center_segment0 == channel + 6 || in hostapd_set_freq_params()
758 center_segment0 == channel + 2 || in hostapd_set_freq_params()
759 center_segment0 == channel - 2 || in hostapd_set_freq_params()
760 center_segment0 == channel - 6 || in hostapd_set_freq_params()
761 center_segment0 == channel - 10 || in hostapd_set_freq_params()
762 center_segment0 == channel - 14) in hostapd_set_freq_params()
763 data->center_freq1 = 5000 + center_segment0 * 5; in hostapd_set_freq_params()
766 "160 MHz: HT40 channel band is not in 160 MHz band"); in hostapd_set_freq_params()
767 return -1; in hostapd_set_freq_params()
771 data->bandwidth = 320; in hostapd_set_freq_params()
772 if (!data->eht_enabled || !is_6ghz_freq(freq)) { in hostapd_set_freq_params()
774 "320 MHz: EHT not enabled or not a 6 GHz channel"); in hostapd_set_freq_params()
775 return -1; in hostapd_set_freq_params()
780 return -1; in hostapd_set_freq_params()
782 if (center_segment0 == channel + 30 || in hostapd_set_freq_params()
783 center_segment0 == channel + 26 || in hostapd_set_freq_params()
784 center_segment0 == channel + 22 || in hostapd_set_freq_params()
785 center_segment0 == channel + 18 || in hostapd_set_freq_params()
786 center_segment0 == channel + 14 || in hostapd_set_freq_params()
787 center_segment0 == channel + 10 || in hostapd_set_freq_params()
788 center_segment0 == channel + 6 || in hostapd_set_freq_params()
789 center_segment0 == channel + 2 || in hostapd_set_freq_params()
790 center_segment0 == channel - 2 || in hostapd_set_freq_params()
791 center_segment0 == channel - 6 || in hostapd_set_freq_params()
792 center_segment0 == channel - 10 || in hostapd_set_freq_params()
793 center_segment0 == channel - 14 || in hostapd_set_freq_params()
794 center_segment0 == channel - 18 || in hostapd_set_freq_params()
795 center_segment0 == channel - 22 || in hostapd_set_freq_params()
796 center_segment0 == channel - 26 || in hostapd_set_freq_params()
797 center_segment0 == channel - 30) in hostapd_set_freq_params()
798 data->center_freq1 = 5000 + center_segment0 * 5; in hostapd_set_freq_params()
802 return -1; in hostapd_set_freq_params()
821 htcaps->ht_capabilities_info &= ~msk; in set_disable_ht40()
823 htcaps->ht_capabilities_info |= msk; in set_disable_ht40()
915 case 4: in num_chan_to_bw()
925 /* check if BW is applicable for channel */
936 /* HT 40 MHz support declared only for primary channel, in chan_bw_allowed()
959 return (chan->allowed_bw & bw_mask) == bw_mask; in chan_bw_allowed()
963 /* check if channel is allowed to be used as primary */
966 return !(chan->flag & HOSTAPD_CHAN_DISABLED) && in chan_pri_allowed()
967 (chan->allowed_bw & HOSTAPD_CHAN_WIDTH_20); in chan_pri_allowed()
971 /* IEEE P802.11be/D3.0, Table 36-30 - Definition of the Punctured Channel
972 * Information field in the U-SIG for an EHT MU PPDU using non-OFDMA
1021 if (!bitmap) /* No channel active */ in is_punct_bitmap_valid()
1025 wpa_printf(MSG_DEBUG, "Primary channel cannot be punctured"); in is_punct_bitmap_valid()