Lines Matching +full:in +full:- +full:band

2  * Misc utility routines used by kernel or app-level.
3 * Contents are wifi-specific, used by any kernel or app-level
23 * <<Broadcom-WL-IPTag/Dual:>>
32 #define tolower(c) (bcm_isupper((c)) ? ((c) + 'a' - 'A') : (c))
55 * [<band>'g']<channel>['/'<bandwidth>[<primary-sideband>]
56 * ['/'<1st-channel-segment>'-'<2nd-channel-segment>]]
58 * <band>:
67 * <primary-sideband>:
68 * 'u' or 'l' (only for 2.4GHz band 40MHz)
70 * For 2.4GHz band 40MHz channels, the same primary channel may be the
75 * For 40MHz in the 5GHz or 6GHz band and all channel bandwidths greater than
77 * non-overlapping and the primary 20MHz channel position is derived from its
78 * position in the wide bandwidth channel.
79 * <1st-channel-segment>
80 * <2nd-channel-segment>:
85 * In its simplest form, it is a 20MHz channel number, with the implied band
89 * 40MHz channels is also allowed: <channel><primary-sideband>
93 * <primary-sideband>:
98 * 5g8 20MHz 8 - -
99 * 52 20MHz 52 - -
100 * 52/40 40MHz 54 52-56 52
101 * 56/40 40MHz 54 52-56 56
102 * 52/80 80MHz 58 52-64 52
103 * 56/80 80MHz 58 52-64 56
104 * 60/80 80MHz 58 52-64 60
105 * 64/80 80MHz 58 52-64 64
106 * 52/160 160MHz 50 36-64 52
107 * 36/160 160MGz 50 36-64 36
108 * 36/80+80/42-106 80+80MHz 42,106 36-48,100-112 36
112 * 2g8 20MHz 8 - -
113 * 8 20MHz 8 - -
114 * 6 20MHz 6 - -
115 * 6/40l 40MHz 8 6-10 6
116 * 6l 40MHz 8 6-10 6
117 * 6/40u 40MHz 4 2-6 6
118 * 6u 40MHz 4 2-6 6
139 /* 40MHz channels in 2.4GHz band */
145 /* 40MHz channels in 5GHz band */
151 /* 80MHz channels in 5GHz band */
157 /* 160MHz channels in 5GHz band */
163 /** 80MHz channels in 6GHz band */
166 /** 160MHz channels in 6GHz band */
169 /** 240MHz channels in 6GHz band */
172 /** 320MHz channels in 6GHz band */
176 * in other branches and in trunk targets that don't need 11BE features...
196 * Return the chanspec bandwidth in MHz
201 * @return bandwidth of chspec in MHz units
212 /* bw in MHz, return the channel count from the center channel to the
213 * the channel at the edge of the band
220 /* edge channels separated by BW - 10MHz on each side in center_chan_to_edge()
242 /* return channel number of the low edge of the band
248 return (center_ch - center_chan_to_edge(bw)); in channel_low_edge()
251 /* return side band number given center channel and primary20 channel
252 * return -1 on error
261 (primary_ch - lowest) % 4) { in channel_to_sb()
265 return -1; in channel_to_sb()
268 sb = ((primary_ch - lowest) / 4); in channel_to_sb()
270 /* sb must be a index to a 20MHz channel in range */ in channel_to_sb()
278 return -1; in channel_to_sb()
284 /* return primary20 channel given center channel and side band */
292 * return -1 on error
303 return -1; in channel_80mhz_to_id()
307 * return -1 on error
315 ((ch - CH_MIN_6G_80M_CHANNEL) % 16) == 0) { // even multiple of 16 in channel_6g_80mhz_to_id()
316 return (ch - CH_MIN_6G_80M_CHANNEL) / 16; in channel_6g_80mhz_to_id()
319 return -1; in channel_6g_80mhz_to_id()
323 * return -1 on error
335 return -1; in channel_5g_160mhz_to_id()
339 * return -1 on error
347 ((ch - CH_MIN_6G_160M_CHANNEL) % 32) == 0) { in channel_6g_160mhz_to_id()
348 return (ch - CH_MIN_6G_160M_CHANNEL) / 32; in channel_6g_160mhz_to_id()
351 return -1; in channel_6g_160mhz_to_id()
355 * return -1 on error
363 ((ch - CH_MIN_6G_240M_CHANNEL) % 48) == 0) { in channel_6g_240mhz_to_id()
364 return (ch - CH_MIN_6G_240M_CHANNEL) / 48; in channel_6g_240mhz_to_id()
367 return -1; in channel_6g_240mhz_to_id()
371 * return -1 on error
379 ((ch - CH_MIN_6G_320M_CHANNEL) % 64) == 0) { in channel_6g_320mhz_to_id()
380 return (ch - CH_MIN_6G_320M_CHANNEL) / 64; in channel_6g_320mhz_to_id()
383 return -1; in channel_6g_320mhz_to_id()
464 * @return Returns pointer to passed in buf. The buffer will have the ascii
470 * Wrapper function for wf_chspec_ntoa. In case of an error it puts
471 * the original chanspec in the output buffer, prepended with "invalid".
472 * Can be directly used in print routines as it takes care of null
488 * @return Returns pointer to passed in buf or NULL on error. On sucess, the buffer
501 const char *band; in wf_chspec_ntoa() local
507 band = ""; in wf_chspec_ntoa()
509 /* check for non-default band spec */ in wf_chspec_ntoa()
511 band = "2g"; in wf_chspec_ntoa()
513 band = "5g"; in wf_chspec_ntoa()
515 band = "6g"; in wf_chspec_ntoa()
523 snprintf(buf, CHANSPEC_STR_LEN, "%s%d", band, pri_chan); in wf_chspec_ntoa()
530 snprintf(buf, CHANSPEC_STR_LEN, "%s%d/%s", band, pri_chan, bw); in wf_chspec_ntoa()
537 snprintf(buf, CHANSPEC_STR_LEN, "%s%d/%s", band, pri_chan, bw); in wf_chspec_ntoa()
550 snprintf(buf, CHANSPEC_STR_LEN, "%s%d/%s%s", band, pri_chan, bw, sb); in wf_chspec_ntoa()
555 snprintf(buf, CHANSPEC_STR_LEN, "%s%d%s", band, pri_chan, sb); in wf_chspec_ntoa()
557 snprintf(buf, CHANSPEC_STR_LEN, "%s%d/%s", band, pri_chan, bw); in wf_chspec_ntoa()
605 /* parse channel num or band */ in wf_chspec_aton()
608 /* if we are looking at a 'g', then the first number was a band */ in wf_chspec_aton()
613 /* band must be "2", "5", or "6" */ in wf_chspec_aton()
629 /* first number is channel, use default for band */ in wf_chspec_aton()
675 /* So far we have <band>g<chan>/<bw> in wf_chspec_aton()
723 /* if the bw is 20, only need the primary channel and band */ in wf_chspec_aton()
727 * non-overlapping in 5G or 6G bands. Each primary channel is contained in wf_chspec_aton()
728 * in only one higher bandwidth channel. The wf_create_chspec_from_primary() in wf_chspec_aton()
730 * sub-band spec was given. in wf_chspec_aton()
743 * chanspec specified a band, bw, pri_sb and channel and that the
776 /* channel IDs in 240 must be in range */ in BCMPOSTTRAPFN()
779 /* bad 240MHz channel ID for the band */ in BCMPOSTTRAPFN()
790 /* channel IDs in 320 must be in range */ in BCMPOSTTRAPFN()
793 /* bad 320MHz channel ID for the band */ in BCMPOSTTRAPFN()
811 /* must be a valid band */ in BCMPOSTTRAPFN()
823 /* side band needs to be consistent with bandwidth */ in BCMPOSTTRAPFN()
832 * 80+80 SB info is relative to the primary 80MHz sub-band. in BCMPOSTTRAPFN()
861 uint chspec_ch = -1; in wf_chspec_valid()
884 * a valid band field, in wf_chspec_valid()
885 * a valid bandwidth for the band, in wf_chspec_valid()
886 * and a valid sub-band value for the bandwidth. in wf_chspec_valid()
888 * Since all sub-band specs are valid for any channel, the only thing remaining to in wf_chspec_valid()
893 * are valid for the specified band. in wf_chspec_valid()
894 * Also, 80+80MHz channels need to be non-contiguous. in wf_chspec_valid()
926 /* 5G band 20MHz channel ranges with even (+4) channel spacing */
944 wf_chanspec_iter_init(wf_chanspec_iter_t *iter, chanspec_band_t band, chanspec_bw_t bw) in wf_chanspec_iter_init() argument
951 * in case the parameter validation fails. in wf_chanspec_iter_init()
956 iter->state = WF_ITER_DONE; in wf_chanspec_iter_init()
957 iter->chanspec = INVCHANSPEC; in wf_chanspec_iter_init()
959 if (band != WL_CHANSPEC_BAND_2G && in wf_chanspec_iter_init()
960 band != WL_CHANSPEC_BAND_5G && in wf_chanspec_iter_init()
961 band != WL_CHANSPEC_BAND_6G) { in wf_chanspec_iter_init()
972 (band != WL_CHANSPEC_BAND_2G && in wf_chanspec_iter_init()
984 * chanspec in the set. in wf_chanspec_iter_init()
986 iter->state = WF_ITER_INIT; in wf_chanspec_iter_init()
987 iter->band = band; in wf_chanspec_iter_init()
988 iter->bw = bw; in wf_chanspec_iter_init()
989 iter->range_id = RANGE_ID_INVAL; in wf_chanspec_iter_init()
1001 chanspec_band_t band = iter->band; in wf_chanspec_iter_firstchan() local
1002 chanspec_bw_t bw = iter->bw; in wf_chanspec_iter_firstchan()
1010 /* calc the initial channel based on band */ in wf_chanspec_iter_firstchan()
1011 if (band == WL_CHANSPEC_BAND_2G) { in wf_chanspec_iter_firstchan()
1016 chspec = wf_create_20MHz_chspec(CH_MIN_2G_CHANNEL, band); in wf_chanspec_iter_firstchan()
1022 if (band == WL_CHANSPEC_BAND_5G) { in wf_chanspec_iter_firstchan()
1027 chspec = wf_create_chspec_from_primary(iter->range.start, bw, band); in wf_chanspec_iter_firstchan()
1030 iter->chanspec = chspec; in wf_chanspec_iter_firstchan()
1039 return iter->chanspec; in wf_chanspec_iter_current()
1043 * @brief Advance the iteration to the next chanspec in the set.
1049 chanspec_band_t band = iter->band; in wf_chanspec_iter_next() local
1051 /* Handle the INIT and DONE states. Otherwise, we are in the RUN state in wf_chanspec_iter_next()
1052 * and will dispatch to the 'next' function for the appropriate band. in wf_chanspec_iter_next()
1054 if (iter->state == WF_ITER_INIT) { in wf_chanspec_iter_next()
1055 iter->state = WF_ITER_RUN; in wf_chanspec_iter_next()
1058 } else if (iter->state == WF_ITER_DONE) { in wf_chanspec_iter_next()
1060 } else if (band == WL_CHANSPEC_BAND_2G) { in wf_chanspec_iter_next()
1062 } else if (band == WL_CHANSPEC_BAND_5G) { in wf_chanspec_iter_next()
1064 } else if (band == WL_CHANSPEC_BAND_6G) { in wf_chanspec_iter_next()
1069 * In case the iteration is done, the return will be INVCHANSPEC. in wf_chanspec_iter_next()
1072 *chspec = iter->chanspec; in wf_chanspec_iter_next()
1113 * This is the _iter_next() helper for 2g band chanspec iteration.
1118 chanspec_t chspec = iter->chanspec; in wf_chanspec_iter_next_2g()
1125 } else if (iter->bw == INVCHANSPEC) { in wf_chanspec_iter_next_2g()
1131 iter->state = WF_ITER_DONE; in wf_chanspec_iter_next_2g()
1136 if (CHSPEC_SB_LOWER(iter->chanspec)) { in wf_chanspec_iter_next_2g()
1147 iter->state = WF_ITER_DONE; in wf_chanspec_iter_next_2g()
1152 iter->chanspec = chspec; in wf_chanspec_iter_next_2g()
1158 * This is the _iter_next() helper for 5g band chanspec iteration.
1160 * each chanspec in the set.
1167 chanspec_t chspec = iter->chanspec; in wf_chanspec_iter_next_5g()
1170 uint8 end = iter->range.end; in wf_chanspec_iter_next_5g()
1179 /* there was a new range in the current BW, so start at the beginning */ in wf_chanspec_iter_next_5g()
1180 ch = iter->range.start; in wf_chanspec_iter_next_5g()
1181 } else if (iter->bw == INVCHANSPEC) { in wf_chanspec_iter_next_5g()
1186 iter->range_id = RANGE_ID_INVAL; in wf_chanspec_iter_next_5g()
1188 ch = iter->range.start; in wf_chanspec_iter_next_5g()
1203 iter->chanspec = chspec; in wf_chanspec_iter_next_5g()
1207 iter->state = WF_ITER_DONE; in wf_chanspec_iter_next_5g()
1215 * iter->range_id
1217 * iter->range.start
1218 * iter->range.end
1220 * Returns FALSE if there are no more ranges in the current BW.
1225 uint8 range_id = iter->range_id; in wf_chanspec_iter_next_5g_range()
1237 iter->range_id = range_id; in wf_chanspec_iter_next_5g_range()
1238 iter->range = wf_5g_iter_ranges[range_id]; in wf_chanspec_iter_next_5g_range()
1267 iter->range_id = range_id; in wf_chanspec_iter_next_5g_range()
1268 iter->range.start = ch - offset; in wf_chanspec_iter_next_5g_range()
1269 iter->range.end = ch + offset; in wf_chanspec_iter_next_5g_range()
1277 * This is the _iter_next() helper for 6g band chanspec iteration.
1279 * each chanspec in the set.
1280 * Each BW in 6g has one contiguous range of primary 20MHz channels. When a range is
1286 chanspec_t chspec = iter->chanspec; in wf_chanspec_iter_next_6g()
1289 uint8 end = iter->range.end; in wf_chanspec_iter_next_6g()
1304 * of the valid channels in the range. in wf_chanspec_iter_next_6g()
1313 * Note: (iter->bw == INVCHANSPEC) indicates an unspecified BW for the interation, in wf_chanspec_iter_next_6g()
1317 iter->bw == INVCHANSPEC && in wf_chanspec_iter_next_6g()
1320 ch = iter->range.start; in wf_chanspec_iter_next_6g()
1324 iter->chanspec = chspec; in wf_chanspec_iter_next_6g()
1328 iter->state = WF_ITER_DONE; in wf_chanspec_iter_next_6g()
1335 * primary channels for the 6g band and for the BW being iterated.
1349 iter->range.start = CH_MIN_6G_CHANNEL; in wf_chanspec_iter_6g_range_init()
1350 iter->range.end = CH_MAX_6G_CHANNEL; in wf_chanspec_iter_6g_range_init()
1362 * @param band chanspec band
1367 wf_valid_20MHz_chan(uint channel, chanspec_band_t band) in wf_valid_20MHz_chan() argument
1369 if (band == WL_CHANSPEC_BAND_2G) { in wf_valid_20MHz_chan()
1373 } else if (band == WL_CHANSPEC_BAND_5G) { in wf_valid_20MHz_chan()
1390 /* check for channel 165 which is not the side band in wf_valid_20MHz_chan()
1410 else if (band == WL_CHANSPEC_BAND_6G) { in wf_valid_20MHz_chan()
1414 ((((channel - CH_MIN_6G_CHANNEL) % 4) == 0) || // even multiple of 4 in wf_valid_20MHz_chan()
1427 * @param band chanspec band
1432 wf_valid_40MHz_center_chan(uint center_channel, chanspec_band_t band) in wf_valid_40MHz_center_chan() argument
1434 if (band == WL_CHANSPEC_BAND_2G) { in wf_valid_40MHz_center_chan()
1438 } else if (band == WL_CHANSPEC_BAND_5G) { in wf_valid_40MHz_center_chan()
1448 else if (band == WL_CHANSPEC_BAND_6G) { in wf_valid_40MHz_center_chan()
1452 ((center_channel - CH_MIN_6G_40M_CHANNEL) % 8) == 0) { // even multiple of 8 in wf_valid_40MHz_center_chan()
1464 * @param band chanspec band
1469 wf_valid_80MHz_center_chan(uint center_channel, chanspec_band_t band) in wf_valid_80MHz_center_chan() argument
1471 if (band == WL_CHANSPEC_BAND_5G) { in wf_valid_80MHz_center_chan()
1476 } else if (band == WL_CHANSPEC_BAND_6G) { in wf_valid_80MHz_center_chan()
1490 * @param band chanspec band
1495 wf_valid_160MHz_center_chan(uint center_channel, chanspec_band_t band) in wf_valid_160MHz_center_chan() argument
1497 if (band == WL_CHANSPEC_BAND_5G) { in wf_valid_160MHz_center_chan()
1506 } else if (band == WL_CHANSPEC_BAND_6G) { in wf_valid_160MHz_center_chan()
1510 ((center_channel - CH_MIN_6G_160M_CHANNEL) % 32) == 0) { // even multiple of 32 in wf_valid_160MHz_center_chan()
1522 * @param band chanspec band
1527 wf_valid_240MHz_center_chan(uint center_channel, chanspec_band_t band) in wf_valid_240MHz_center_chan() argument
1529 if (band == WL_CHANSPEC_BAND_6G) { in wf_valid_240MHz_center_chan()
1533 ((center_channel - CH_MIN_6G_240M_CHANNEL) % 48) == 0) { // even multiple of 48 in wf_valid_240MHz_center_chan()
1545 * @param band chanspec band
1550 wf_valid_320MHz_center_chan(uint center_channel, chanspec_band_t band) in wf_valid_320MHz_center_chan() argument
1552 if (band == WL_CHANSPEC_BAND_6G) { in wf_valid_320MHz_center_chan()
1556 ((center_channel - CH_MIN_6G_320M_CHANNEL) % 64) == 0) { // even multiple of 64 in wf_valid_320MHz_center_chan()
1565 * This function returns TRUE if both the chanspec can co-exist in PHY.
1566 * Addition to primary20 channel, the function checks for side band for 2g 40 channels
1584 * Create a 20MHz chanspec for the given band.
1586 * This function returns a 20MHz chanspec in the given band.
1589 * @param band a chanspec band (e.g. WL_CHANSPEC_BAND_2G)
1591 * @return Returns a 20MHz chanspec, or IVNCHANSPEC in case of error.
1594 wf_create_20MHz_chspec(uint channel, chanspec_band_t band) in wf_create_20MHz_chspec() argument
1599 (band == WL_CHANSPEC_BAND_2G || in wf_create_20MHz_chspec()
1600 band == WL_CHANSPEC_BAND_5G || in wf_create_20MHz_chspec()
1601 band == WL_CHANSPEC_BAND_6G)) { in wf_create_20MHz_chspec()
1602 chspec = band | WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE | channel; in wf_create_20MHz_chspec()
1615 * the center channel number, and the band.
1619 * @param band band of the 40MHz channel (chanspec_band_t value)
1622 * in the given band.
1624 * @return returns a 40MHz chanspec, or INVCHANSPEC in case of error
1628 chanspec_band_t band) in wf_create_40MHz_chspec() argument
1633 * Will return -1 if not a valid pair for 40MHz in wf_create_40MHz_chspec()
1638 * valid for the given band. in wf_create_40MHz_chspec()
1640 if (sb < 0 || !wf_valid_40MHz_center_chan(center_channel, band)) { in wf_create_40MHz_chspec()
1645 return (chanspec_t)(center_channel | WL_CHANSPEC_BW_40 | band | in wf_create_40MHz_chspec()
1651 * the sub-band for the primary 20MHz channel, and the band.
1654 * @param primary_subband sub-band of the 20MHz primary channel (chanspec_subband_t value)
1655 * @param band band of the 40MHz channel (chanspec_band_t value)
1657 * The primary channel and sub-band should describe one of the 802.11 spec valid
1658 * 40MHz channels in the given band.
1660 * @return returns a 40MHz chanspec, or INVCHANSPEC in case of error
1664 chanspec_band_t band) in wf_create_40MHz_chspec_primary_sb() argument
1672 center_channel = primary_channel - CH_10MHZ_APART; in wf_create_40MHz_chspec_primary_sb()
1677 return wf_create_40MHz_chspec(primary_channel, center_channel, band); in wf_create_40MHz_chspec_primary_sb()
1682 * the center channel number, and the band.
1686 * @param band band of the 80MHz channel (chanspec_band_t value)
1691 * @return returns an 80MHz chanspec, or INVCHANSPEC in case of error
1695 chanspec_band_t band) in wf_create_80MHz_chspec() argument
1700 * Will return -1 if not a valid pair for 80MHz in wf_create_80MHz_chspec()
1705 * valid for the given band. in wf_create_80MHz_chspec()
1707 if (sb < 0 || !wf_valid_80MHz_center_chan(center_channel, band)) { in wf_create_80MHz_chspec()
1712 return (chanspec_t)(center_channel | WL_CHANSPEC_BW_80 | band | in wf_create_80MHz_chspec()
1718 * the center channel number, and the band.
1722 * @param band band of the 160MHz channel (chanspec_band_t value)
1727 * @return returns an 160MHz chanspec, or INVCHANSPEC in case of error
1730 wf_create_160MHz_chspec(uint primary_channel, uint center_channel, chanspec_band_t band) in wf_create_160MHz_chspec() argument
1735 * Will return -1 if not a valid pair for 160MHz in wf_create_160MHz_chspec()
1740 * valid for the given band. in wf_create_160MHz_chspec()
1742 if (sb < 0 || !wf_valid_160MHz_center_chan(center_channel, band)) { in wf_create_160MHz_chspec()
1747 return (chanspec_t)(center_channel | WL_CHANSPEC_BW_160 | band | in wf_create_160MHz_chspec()
1753 * the center channel numbers for each frequency segment, and the band.
1758 * @param band band of the 80+80 MHz channel (chanspec_band_t value)
1760 * Parameters chan0 and chan1 are valid 80 MHz center channel numbers for the given band.
1761 * The primary channel must be contained in one of the 80 MHz channels. This routine
1764 * @return returns an 80+80 MHz chanspec, or INVCHANSPEC in case of error
1766 * Refer to 802.11-2016 section 21.3.14 "Channelization".
1770 chanspec_band_t band) in wf_create_8080MHz_chspec() argument
1774 int chan0_id = -1, chan1_id = -1; in wf_create_8080MHz_chspec()
1777 /* frequency segments need to be non-contiguous, so the channel separation needs in wf_create_8080MHz_chspec()
1780 if ((uint)ABS((int)(chan0 - chan1)) <= CH_80MHZ_APART) { in wf_create_8080MHz_chspec()
1784 if (band == WL_CHANSPEC_BAND_5G) { in wf_create_8080MHz_chspec()
1787 } else if (band == WL_CHANSPEC_BAND_6G) { in wf_create_8080MHz_chspec()
1793 if (chan0_id == -1 || chan1_id == -1) { in wf_create_8080MHz_chspec()
1819 band); in wf_create_8080MHz_chspec()
1826 * the center channel numbers for each frequency segment, and the band.
1831 * @param band band of the 160+160 MHz channel (chanspec_band_t value)
1833 * Parameters chan0 and chan1 are valid 160 MHz center channel numbers for the given band.
1834 * The primary channel must be contained in one of the 160 MHz channels. This routine
1837 * @return returns an 160+160 MHz chanspec, or INVCHANSPEC in case of error
1843 chanspec_band_t band) in wf_create_160160MHz_chspec() argument
1847 int chan0_id = -1, chan1_id = -1; in wf_create_160160MHz_chspec()
1850 /* frequency segments need to be non-contiguous, so the channel separation needs in wf_create_160160MHz_chspec()
1853 if ((uint)ABS((int)(chan0 - chan1)) <= CH_160MHZ_APART) { in wf_create_160160MHz_chspec()
1857 if (band == WL_CHANSPEC_BAND_5G) { in wf_create_160160MHz_chspec()
1860 } else if (band == WL_CHANSPEC_BAND_6G) { in wf_create_160160MHz_chspec()
1866 if (chan0_id == -1 || chan1_id == -1) { in wf_create_160160MHz_chspec()
1892 band); in wf_create_160160MHz_chspec()
1899 * the center channel number, and the band.
1903 * @param band band of the 240 MHz channel (chanspec_band_t value)
1905 * @return returns an 240 MHz chanspec, or INVCHANSPEC in case of error
1910 wf_create_240MHz_chspec(uint primary_channel, uint center_channel, chanspec_band_t band) in wf_create_240MHz_chspec() argument
1914 int chan_id = -1; in wf_create_240MHz_chspec()
1916 if (band == WL_CHANSPEC_BAND_6G) { in wf_create_240MHz_chspec()
1921 if (chan_id == -1) { in wf_create_240MHz_chspec()
1926 * Will return -1 if not a valid pair for 240MHz in wf_create_240MHz_chspec()
1931 * valid for the given band. in wf_create_240MHz_chspec()
1933 if (sb < 0 || !wf_valid_240MHz_center_chan(center_channel, band)) { in wf_create_240MHz_chspec()
1940 band); in wf_create_240MHz_chspec()
1947 * the center channel number, and the band.
1951 * @param band band of the 320 MHz channel (chanspec_band_t value)
1953 * Parameters chan is valid 320 MHz center channel numbers for the given band.
1954 * The primary channel must be contained in one of the 320 MHz channels.
1956 * @return returns an 320 MHz chanspec, or INVCHANSPEC in case of error
1961 wf_create_320MHz_chspec(uint primary_channel, uint center_channel, chanspec_band_t band) in wf_create_320MHz_chspec() argument
1965 int chan_id = -1; in wf_create_320MHz_chspec()
1967 if (band == WL_CHANSPEC_BAND_6G) { in wf_create_320MHz_chspec()
1972 if (chan_id == -1) { in wf_create_320MHz_chspec()
1977 * Will return -1 if not a valid pair for 320MHz in wf_create_320MHz_chspec()
1982 * valid for the given band. in wf_create_320MHz_chspec()
1984 if (sb < 0 || !wf_valid_320MHz_center_chan(center_channel, band)) { in wf_create_320MHz_chspec()
1991 band); in wf_create_320MHz_chspec()
1998 * the center channel number, channel width, and the band. The channel width
2006 * @param band chanspec band of channel (chanspec_band_t)
2009 * for the given bandwidth in the given band.
2011 * @return returns a chanspec, or INVCHANSPEC in case of error
2015 chanspec_bw_t bw, chanspec_band_t band) in wf_create_chspec() argument
2018 int sb = -1; in wf_create_chspec()
2032 /* calculate the sub-band index */ in wf_create_chspec()
2036 /* if we have a good sub-band, assemble the chanspec, and use wf_chspec_valid() in wf_create_chspec()
2041 if (band == WL_CHANSPEC_BAND_6G) { in wf_create_chspec()
2048 if (band == WL_CHANSPEC_BAND_6G) { in wf_create_chspec()
2057 chspec = center_channel | band | bw | in wf_create_chspec()
2069 * channel width, and the band.
2073 * @param band chanspec band of channel (chanspec_band_t)
2075 * @return returns a chanspec, or INVCHANSPEC in case of error
2079 * the 2G band.
2081 * This function supports creating 20MHz bandwidth chanspecs on any band.
2083 * For the 2GHz band, 40MHz channels overlap, so two 40MHz channels may
2085 * whenever called with a bandwidth of 40MHz or wider for the 2GHz band.
2087 * 5GHz and 6GHz bands have non-overlapping 40/80/160 MHz channels, so a
2088 * 20MHz primary channel uniquely specifies a wider channel in a given band.
2094 wf_create_chspec_from_primary(uint primary_channel, chanspec_bw_t bw, chanspec_band_t band) in wf_create_chspec_from_primary() argument
2099 chspec = wf_create_20MHz_chspec(primary_channel, band); in wf_create_chspec_from_primary()
2100 } else if (band == WL_CHANSPEC_BAND_2G || band == WL_CHANSPEC_BAND_5G) { in wf_create_chspec_from_primary()
2107 if (band == WL_CHANSPEC_BAND_2G && bw == WL_CHANSPEC_BW_40) { in wf_create_chspec_from_primary()
2125 chspec = wf_create_chspec(primary_channel, center_ch[i], bw, band); in wf_create_chspec_from_primary()
2131 else if (band == WL_CHANSPEC_BAND_6G) { in wf_create_chspec_from_primary()
2157 mask = ~(ch_per_block - 1); in wf_create_chspec_from_primary()
2158 base = 1 + ((primary_channel - 1) & mask); in wf_create_chspec_from_primary()
2163 chspec = wf_create_chspec(primary_channel, center, bw, band); in wf_create_chspec_from_primary()
2281 int sb = -1; in wf_channel2chspec()
2330 * The primary 40MHz channel is the 40MHz sub-band that contains the primary 20MHz channel.
2352 /* determine primary 40 MHz sub-channel of an 80 MHz chanspec */ in wf_chspec_primary40_chspec()
2359 center_chan -= CH_20MHZ_APART; in wf_chspec_primary40_chspec()
2365 sb -= WL_CHANSPEC_CTL_SB_UL; in wf_chspec_primary40_chspec()
2379 * @param freq frequency in MHz of the channel center
2380 * @param start_factor starting base frequency in 500 KHz units
2382 * @return Returns a channel number > 0, or -1 on error
2392 * freq (GHz) -> assumed base freq (GHz)
2393 * 2G band 2.4 - 2.5 2.407
2394 * 5G band 5.0 - 5.940 5.000
2395 * 6G band 5.940 - 7.205 5.940
2397 * It is an error if the start_factor is zero and the freq is not in one of
2400 * The returned channel will be in the range [1, 14] in the 2.4 GHz band,
2401 * [1, 253] for 6 GHz band, or [1, 200] otherwise.
2411 * Reference 802.11-2016, section 17.3.8.3 and section 16.3.6.3
2416 int ch = -1; in wf_mhz2channel()
2438 return -1; in wf_mhz2channel()
2444 return -1; in wf_mhz2channel()
2447 offset = freq - base; in wf_mhz2channel()
2452 return -1; in wf_mhz2channel()
2457 * handled above as it is a non-5MHz offset in wf_mhz2channel()
2460 ch = -1; in wf_mhz2channel()
2466 ch = -1; in wf_mhz2channel()
2469 ch = -1; in wf_mhz2channel()
2476 * Return the center frequency in MHz of the given channel and base frequency.
2480 * The valid channel range is [1, 14] in the 2.4 GHz band, [1,253] in the 6 GHz
2481 * band, and [1, 200] otherwise.
2487 * Odd start_factors produce channels on .5 MHz boundaries, in which case
2489 * -1 is returned for an out of range channel.
2491 * Reference 802.11-2016, section 17.3.8.3 and section 16.3.6.3
2494 * @param start_factor base frequency in 500 kHz units, e.g. 10000 for 5 GHz
2496 * @return Returns a frequency in MHz
2510 freq = -1; in wf_channel2mhz()
2533 * primary_channel - primary 20Mhz channel
2534 * center_channel - center frequecny of the 80Mhz channel
2538 * returns INVCHANSPEC in case of error
2567 * primary_20mhz - Primary 20 MHz channel
2568 * chan0 - center channel number of one frequency segment
2569 * chan1 - center channel number of the other frequency segment
2571 * Parameters chan0 and chan1 are channel numbers in {42, 58, 106, 122, 138, 155}.
2572 * The primary channel must be contained in one of the 80MHz channels. This routine
2575 * Returns INVCHANSPEC in case of error.
2577 * Refer to 802.11-2016 section 22.3.14 "Channelization".
2593 if (chan0_id == -1 || chan1_id == -1) in wf_chspec_get8080_chspec()
2624 * Returns the center channel of the primary 80 MHz sub-band of the provided chanspec
2644 * Returns the center channel of the secondary 80 MHz sub-band of the provided chanspec
2664 * Returns the chanspec for the primary 80MHz sub-band of an 160MHz or 80+80 channel
2683 center_chan -= CH_40MHZ_APART; in wf_chspec_primary80_chspec()
2688 sb -= WL_CHANSPEC_CTL_SB_ULL; in wf_chspec_primary80_chspec()
2702 * Returns the chanspec for the secondary 80MHz sub-band of an 160MHz or 80+80 channel
2724 center_chan -= CH_40MHZ_APART; in wf_chspec_secondary80_chspec()
2743 * For 20/40/80MHz chanspec, set ch[0] to be the center freq, and chan[1]=-1
2751 ch[0] = center_chan - CH_40MHZ_APART; in wf_chspec_get_80p80_channels()
2757 ch[1] = -1; in wf_chspec_get_80p80_channels()
2764 * Returns the center channel of the primary 160MHz sub-band of the provided chanspec
2784 * Returns the chanspec for the primary 160MHz sub-band of an 240/320MHz or 160+160 channel
2808 center_chan -= CH_40MHZ_APART; in wf_chspec_primary160_chspec()
2812 sb -= 4u; in wf_chspec_primary160_chspec()
2829 center_chan -= CH_80MHZ_APART; in wf_chspec_primary160_chspec()
2834 sb -= 8u; in wf_chspec_primary160_chspec()
2850 /* Populates array with all 20MHz side bands of a given chanspec_t in the following order:
2869 (pext)[1] = (IS_CTL_IN_L20(t) ? pri_ch + CH_20MHZ_APART : pri_ch - CH_20MHZ_APART); in wf_get_all_ext()
2876 pri_ch + CH_40MHZ_APART : pri_ch - CH_40MHZ_APART), WL_CHANSPEC_BW_40); in wf_get_all_ext()
2877 GET_ALL_SB(t, &((pext)[2])); /* get the 20MHz side bands in 40MHz EXT */ in wf_get_all_ext()
2883 /* get the 20MHz side bands in 80MHz EXT (secondary) */ in wf_get_all_ext()
2901 if ((uint)ABS(ch0 - ch1) < CH_20MHZ_APART) { in wf_chspec_overlap()
2942 wf_create_chspec_sb(uint sb, uint center_channel, chanspec_bw_t bw, chanspec_band_t band) in wf_create_chspec_sb() argument
2948 chspec = center_channel | band | bw | ((uint)sb << WL_CHANSPEC_CTL_SB_SHIFT); in wf_create_chspec_sb()
2953 wf_create_160160MHz_chspec_sb(uint sb, uint chan0, uint chan1, chanspec_band_t band) in wf_create_160160MHz_chspec_sb() argument
2964 /* frequency segments need to be non-contiguous, so the channel in wf_create_160160MHz_chspec_sb()
2967 if ((uint)ABS((int)(chan0 - chan1)) <= CH_160MHZ_APART) { in wf_create_160160MHz_chspec_sb()
2971 if (band == WL_CHANSPEC_BAND_5G) { in wf_create_160160MHz_chspec_sb()
2974 } else if (band == WL_CHANSPEC_BAND_6G) { in wf_create_160160MHz_chspec_sb()
2982 if ((chan0_id == -1) || (chan1_id == -1)) { in wf_create_160160MHz_chspec_sb()
2986 * is in chan0 in wf_create_160160MHz_chspec_sb()
2994 sb -= WL_CHANSPEC_CTL_SB_ULL; in wf_create_160160MHz_chspec_sb()
2998 sb | WL_CHANSPEC_BW_160160 | band); in wf_create_160160MHz_chspec_sb()