/* * This function returns the channel number that control traffic is being sent on, for legacy * channels this is just the channel number, for 40MHZ channels it is the upper or lowre 20MHZ * sideband depending on the chanspec selected */ uint8 wf_chspec_ctlchan(chanspec_t chspec) { uint8 ctl_chan; /* Is there a sideband ? */ if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) { return CHSPEC_CHANNEL(chspec); } else { /* we only support 40MHZ with sidebands */ ASSERT(CHSPEC_BW(chspec) == WL_CHANSPEC_BW_40); /* chanspec channel holds the centre frequency, use that and the * side band information to reconstruct the control channel number */ if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) { /* control chan is the upper 20 MHZ SB of the 40MHZ channel */ ctl_chan = UPPER_20_SB(CHSPEC_CHANNEL(chspec)); } else { ASSERT(CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_LOWER); /* control chan is the lower 20 MHZ SB of the 40MHZ channel */ ctl_chan = LOWER_20_SB(CHSPEC_CHANNEL(chspec)); } } return ctl_chan; }
uint8 wf_chspec_ctlchan(chanspec_t chspec) { uint8 ctl_chan; DHD_MYTRACE(("%s-%s\n", __FILE__, __FUNCTION__)); if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) { return CHSPEC_CHANNEL(chspec); } else { ASSERT(CHSPEC_BW(chspec) == WL_CHANSPEC_BW_40); if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) { ctl_chan = UPPER_20_SB(CHSPEC_CHANNEL(chspec)); } else { ASSERT(CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_LOWER); ctl_chan = LOWER_20_SB(CHSPEC_CHANNEL(chspec)); } } return ctl_chan; }
bool wlc_quiet_chanspec(wlc_cm_info_t *wlc_cm, chanspec_t chspec) { return N_ENAB(wlc_cm->wlc->pub) && CHSPEC_IS40(chspec) ? (isset (wlc_cm->quiet_channels.vec, LOWER_20_SB(CHSPEC_CHANNEL(chspec))) || isset(wlc_cm->quiet_channels.vec, UPPER_20_SB(CHSPEC_CHANNEL(chspec)))) : isset(wlc_cm-> quiet_channels. vec, CHSPEC_CHANNEL (chspec)); }
static uint8 spec_to_chan(chanspec_t chspec) { switch (CHSPEC_CTL_SB(chspec)) { case WL_CHANSPEC_CTL_SB_NONE: return CHSPEC_CHANNEL(chspec); case WL_CHANSPEC_CTL_SB_UPPER: return UPPER_20_SB(CHSPEC_CHANNEL(chspec)); case WL_CHANSPEC_CTL_SB_LOWER: return LOWER_20_SB(CHSPEC_CHANNEL(chspec)); default: return 0; } }
chanspec_t wf_chspec_ctlchspec(chanspec_t chspec) { chanspec_t ctl_chspec = 0; uint8 channel; ASSERT(!wf_chspec_malformed(chspec)); /* Is there a sideband ? */ if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) { return chspec; } else { if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) { channel = UPPER_20_SB(CHSPEC_CHANNEL(chspec)); } else { channel = LOWER_20_SB(CHSPEC_CHANNEL(chspec)); } ctl_chspec = channel | WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE; ctl_chspec |= CHSPEC_BAND(chspec); } return ctl_chspec; }
chanspec_t wf_chspec_ctlchspec(chanspec_t chspec) { DHD_MYTRACE(("%s-%s\n", __FILE__, __FUNCTION__)); chanspec_t ctl_chspec = 0; uint8 channel; ASSERT(!wf_chspec_malformed(chspec)); if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) { return chspec; } else { if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) { channel = UPPER_20_SB(CHSPEC_CHANNEL(chspec)); } else { channel = LOWER_20_SB(CHSPEC_CHANNEL(chspec)); } ctl_chspec = channel | WL_CHANSPEC_BW_20 | WL_CHANSPEC_CTL_SB_NONE; ctl_chspec |= CHSPEC_BAND(chspec); } return ctl_chspec; }
uint8 wf_chspec_ctlchan(chanspec_t chspec) { uint8 ctl_chan; if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) { return CHSPEC_CHANNEL(chspec); } else { ASSERT(CHSPEC_BW(chspec) == WL_CHANSPEC_BW_40); if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) { ctl_chan = UPPER_20_SB(CHSPEC_CHANNEL(chspec)); } else { ASSERT(CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_LOWER); ctl_chan = LOWER_20_SB(CHSPEC_CHANNEL(chspec)); } } return ctl_chan; }
/* * Validate the chanspec for this locale, for 40MHZ we need to also check that the sidebands * are valid 20MZH channels in this locale and they are also a legal HT combination */ static bool wlc_valid_chanspec_ext(wlc_cm_info_t *wlc_cm, chanspec_t chspec, bool dualband) { struct wlc_info *wlc = wlc_cm->wlc; u8 channel = CHSPEC_CHANNEL(chspec); /* check the chanspec */ if (wf_chspec_malformed(chspec)) { WL_ERROR("wl%d: malformed chanspec 0x%x\n", wlc->pub->unit, chspec); ASSERT(0); return false; } if (CHANNEL_BANDUNIT(wlc_cm->wlc, channel) != CHSPEC_WLCBANDUNIT(chspec)) return false; /* Check a 20Mhz channel */ if (CHSPEC_IS20(chspec)) { if (dualband) return VALID_CHANNEL20_DB(wlc_cm->wlc, channel); else return VALID_CHANNEL20(wlc_cm->wlc, channel); } #ifdef SUPPORT_40MHZ /* We know we are now checking a 40MHZ channel, so we should only be here * for NPHYS */ if (WLCISNPHY(wlc->band) || WLCISSSLPNPHY(wlc->band)) { u8 upper_sideband = 0, idx; u8 num_ch20_entries = sizeof(chan20_info) / sizeof(struct chan20_info); if (!VALID_40CHANSPEC_IN_BAND(wlc, CHSPEC_WLCBANDUNIT(chspec))) return false; if (dualband) { if (!VALID_CHANNEL20_DB(wlc, LOWER_20_SB(channel)) || !VALID_CHANNEL20_DB(wlc, UPPER_20_SB(channel))) return false; } else { if (!VALID_CHANNEL20(wlc, LOWER_20_SB(channel)) || !VALID_CHANNEL20(wlc, UPPER_20_SB(channel))) return false; } /* find the lower sideband info in the sideband array */ for (idx = 0; idx < num_ch20_entries; idx++) { if (chan20_info[idx].sb == LOWER_20_SB(channel)) upper_sideband = chan20_info[idx].adj_sbs; } /* check that the lower sideband allows an upper sideband */ if ((upper_sideband & (CH_UPPER_SB | CH_EWA_VALID)) == (CH_UPPER_SB | CH_EWA_VALID)) return true; return false; } #endif /* 40 MHZ */ return false; }