Lines Matching defs:chandef

23 void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
30 *chandef = (struct cfg80211_chan_def) {
37 chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
38 chandef->center_freq1 = chan->center_freq;
41 chandef->width = NL80211_CHAN_WIDTH_20;
42 chandef->center_freq1 = chan->center_freq;
45 chandef->width = NL80211_CHAN_WIDTH_40;
46 chandef->center_freq1 = chan->center_freq + 10;
49 chandef->width = NL80211_CHAN_WIDTH_40;
50 chandef->center_freq1 = chan->center_freq - 10;
89 static bool valid_puncturing_bitmap(const struct cfg80211_chan_def *chandef)
91 u32 idx, i, start_freq, primary_center = chandef->chan->center_freq;
93 switch (chandef->width) {
96 start_freq = chandef->center_freq1 - 40;
100 start_freq = chandef->center_freq1 - 80;
104 start_freq = chandef->center_freq1 - 160;
107 return chandef->punctured == 0;
110 if (!chandef->punctured)
114 if (chandef->punctured & (u16)BIT((primary_center - start_freq) / 20))
118 if (per_bw_puncturing[idx].valid_values[i] == chandef->punctured)
125 static bool cfg80211_edmg_chandef_valid(const struct cfg80211_chan_def *chandef)
132 if (!chandef->edmg.channels || !chandef->edmg.bw_config)
135 if (!cfg80211_valid_60g_freq(chandef->chan->center_freq))
139 if (chandef->edmg.channels & BIT(i)) {
152 switch (chandef->edmg.bw_config) {
183 switch (chandef->edmg.bw_config) {
266 bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef)
271 if (!chandef->chan)
274 if (chandef->freq1_offset >= 1000)
277 control_freq = chandef->chan->center_freq;
279 switch (chandef->width) {
284 if (ieee80211_chandef_to_khz(chandef) !=
285 ieee80211_channel_to_khz(chandef->chan))
287 if (chandef->center_freq2)
295 if (chandef->chan->band != NL80211_BAND_S1GHZ)
298 control_freq = ieee80211_channel_to_khz(chandef->chan);
299 oper_freq = ieee80211_chandef_to_khz(chandef);
302 chandef->chan));
303 oper_width = cfg80211_chandef_get_width(chandef);
307 if (chandef->center_freq2)
319 if (!chandef->center_freq2)
322 if (chandef->center_freq1 - chandef->center_freq2 == 80 ||
323 chandef->center_freq2 - chandef->center_freq1 == 80)
327 if (chandef->center_freq2)
332 switch (chandef->width) {
345 if (chandef->center_freq1 == control_freq + 150 ||
346 chandef->center_freq1 == control_freq + 130 ||
347 chandef->center_freq1 == control_freq + 110 ||
348 chandef->center_freq1 == control_freq + 90 ||
349 chandef->center_freq1 == control_freq - 90 ||
350 chandef->center_freq1 == control_freq - 110 ||
351 chandef->center_freq1 == control_freq - 130 ||
352 chandef->center_freq1 == control_freq - 150)
356 if (chandef->center_freq1 == control_freq + 70 ||
357 chandef->center_freq1 == control_freq + 50 ||
358 chandef->center_freq1 == control_freq - 50 ||
359 chandef->center_freq1 == control_freq - 70)
364 if (chandef->center_freq1 == control_freq + 30 ||
365 chandef->center_freq1 == control_freq - 30)
369 if (chandef->center_freq1 == control_freq + 10 ||
370 chandef->center_freq1 == control_freq - 10)
378 if (chandef->center_freq1 == 2484 &&
379 chandef->width != NL80211_CHAN_WIDTH_20_NOHT)
382 if (cfg80211_chandef_is_edmg(chandef) &&
383 !cfg80211_edmg_chandef_valid(chandef))
386 return valid_puncturing_bitmap(chandef);
567 const struct cfg80211_chan_def *chandef,
572 if (WARN_ON(!cfg80211_chandef_valid(chandef)))
575 width = cfg80211_chandef_get_width(chandef);
579 cfg80211_set_chans_dfs_state(wiphy, chandef->center_freq1,
582 if (!chandef->center_freq2)
584 cfg80211_set_chans_dfs_state(wiphy, chandef->center_freq2,
626 struct cfg80211_chan_def chandef = {};
644 ret = rdev_get_channel(rdev, wdev, link_id, &chandef);
648 if (cfg80211_is_sub_chan(&chandef, chan, false))
715 const struct cfg80211_chan_def *chandef,
721 if (WARN_ON(!cfg80211_chandef_valid(chandef)))
729 width = cfg80211_chandef_get_width(chandef);
734 ieee80211_chandef_to_khz(chandef),
739 return BIT(chandef->width);
741 if (!chandef->center_freq2)
745 MHZ_TO_KHZ(chandef->center_freq2),
750 return BIT(chandef->width);
809 const struct cfg80211_chan_def *chandef)
814 if (WARN_ON(!cfg80211_chandef_valid(chandef)))
817 width = cfg80211_chandef_get_width(chandef);
822 MHZ_TO_KHZ(chandef->center_freq1),
828 switch (chandef->width) {
830 WARN_ON(!chandef->center_freq2);
832 MHZ_TO_KHZ(chandef->center_freq2),
838 WARN_ON(chandef->center_freq2);
848 * range of chandef.
850 bool cfg80211_is_sub_chan(struct cfg80211_chan_def *chandef,
857 if (!chandef->chan)
860 if (chandef->chan->center_freq == chan->center_freq)
866 width = cfg80211_chandef_get_width(chandef);
870 for (freq = chandef->center_freq1 - width / 2 + 10;
871 freq <= chandef->center_freq1 + width / 2 - 10; freq += 20) {
876 if (!chandef->center_freq2)
879 for (freq = chandef->center_freq2 - width / 2 + 10;
880 freq <= chandef->center_freq2 + width / 2 - 10; freq += 20) {
938 if (cfg80211_is_sub_chan(&wdev->links[link].ap.chandef,
944 return cfg80211_is_sub_chan(&wdev->u.ibss.chandef, chan,
947 return cfg80211_is_sub_chan(&wdev->u.mesh.chandef, chan,
1053 const struct cfg80211_chan_def *chandef)
1058 if (WARN_ON(!cfg80211_chandef_valid(chandef)))
1061 width = cfg80211_chandef_get_width(chandef);
1066 MHZ_TO_KHZ(chandef->center_freq1),
1073 switch (chandef->width) {
1075 WARN_ON(!chandef->center_freq2);
1077 MHZ_TO_KHZ(chandef->center_freq2),
1081 WARN_ON(chandef->center_freq2);
1119 const struct cfg80211_chan_def *chandef)
1124 if (WARN_ON(!cfg80211_chandef_valid(chandef)))
1127 width = cfg80211_chandef_get_width(chandef);
1132 MHZ_TO_KHZ(chandef->center_freq1),
1135 if (!chandef->center_freq2)
1139 MHZ_TO_KHZ(chandef->center_freq2),
1223 const struct cfg80211_chan_def *chandef,
1235 if (WARN_ON(!cfg80211_chandef_valid(chandef)))
1238 ht_cap = &wiphy->bands[chandef->chan->band]->ht_cap;
1239 vht_cap = &wiphy->bands[chandef->chan->band]->vht_cap;
1240 edmg_cap = &wiphy->bands[chandef->chan->band]->edmg_cap;
1246 chandef->edmg.channels,
1247 chandef->edmg.bw_config,
1248 chandef->chan->hw_value,
1252 control_freq = chandef->chan->center_freq;
1254 switch (chandef->width) {
1279 chandef->chan->band != NL80211_BAND_6GHZ)
1288 if (chandef->chan->band == NL80211_BAND_6GHZ)
1295 if (chandef->center_freq1 < control_freq &&
1296 chandef->chan->flags & IEEE80211_CHAN_NO_HT40MINUS)
1298 if (chandef->center_freq1 > control_freq &&
1299 chandef->chan->flags & IEEE80211_CHAN_NO_HT40PLUS)
1310 if (chandef->chan->band != NL80211_BAND_6GHZ && !support_80_80)
1316 if (chandef->chan->band == NL80211_BAND_6GHZ)
1324 if (chandef->chan->band == NL80211_BAND_6GHZ)
1339 if (chandef->chan->band != NL80211_BAND_6GHZ)
1385 ieee80211_chandef_to_khz(chandef),
1389 if (!chandef->center_freq2)
1392 MHZ_TO_KHZ(chandef->center_freq2),
1397 const struct cfg80211_chan_def *chandef,
1400 return _cfg80211_chandef_usable(wiphy, chandef, prohibited_flags,
1429 other_chan = wdev->links[link_id].ap.chandef.chan;
1521 struct cfg80211_chan_def *chandef,
1529 trace_cfg80211_reg_can_beacon(wiphy, chandef, iftype, check_no_ir);
1534 dfs_required = cfg80211_chandef_dfs_required(wiphy, chandef, iftype);
1539 cfg80211_chandef_dfs_available(wiphy, chandef)) {
1540 /* We can skip IEEE80211_CHAN_NO_IR if chandef dfs available */
1544 res = cfg80211_chandef_usable(wiphy, chandef, prohibited_flags);
1551 struct cfg80211_chan_def *chandef,
1554 return _cfg80211_reg_can_beacon(wiphy, chandef, iftype, true);
1559 struct cfg80211_chan_def *chandef,
1574 chandef->chan);
1576 return _cfg80211_reg_can_beacon(wiphy, chandef, iftype, check_no_ir);
1581 struct cfg80211_chan_def *chandef)
1588 return rdev_set_monitor_channel(rdev, chandef);
1632 return &wdev->u.mesh.chandef;
1634 return &wdev->u.ibss.chandef;
1636 return &wdev->u.ocb.chandef;
1639 return &wdev->links[link_id].ap.chandef;