MCPcopy Create free account
hub / github.com/F-Stack/f-stack / regdomain_addchans

Function regdomain_addchans

tools/ifconfig/ifieee80211.c:2146–2315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2144}
2145
2146static void
2147regdomain_addchans(struct ieee80211req_chaninfo *ci,
2148 const netband_head *bands,
2149 const struct ieee80211_regdomain *reg,
2150 uint32_t chanFlags,
2151 const struct ieee80211req_chaninfo *avail)
2152{
2153 const struct netband *nb;
2154 const struct freqband *b;
2155 struct ieee80211_channel *c, *prev;
2156 int freq, hi_adj, lo_adj, channelSep;
2157 uint32_t flags;
2158
2159 hi_adj = (chanFlags & IEEE80211_CHAN_HT40U) ? -20 : 0;
2160 lo_adj = (chanFlags & IEEE80211_CHAN_HT40D) ? 20 : 0;
2161 channelSep = (chanFlags & IEEE80211_CHAN_2GHZ) ? 0 : 40;
2162
2163 LIST_FOREACH(nb, bands, next) {
2164 b = nb->band;
2165 if (verbose) {
2166 printf("%s:", __func__);
2167 printb(" chanFlags", chanFlags, IEEE80211_CHAN_BITS);
2168 printb(" bandFlags", nb->flags | b->flags,
2169 IEEE80211_CHAN_BITS);
2170 putchar('\n');
2171 }
2172 prev = NULL;
2173
2174 for (freq = b->freqStart + lo_adj;
2175 freq <= b->freqEnd + hi_adj; freq += b->chanSep) {
2176 /*
2177 * Construct flags for the new channel. We take
2178 * the attributes from the band descriptions except
2179 * for HT40 which is enabled generically (i.e. +/-
2180 * extension channel) in the band description and
2181 * then constrained according by channel separation.
2182 */
2183 flags = nb->flags | b->flags;
2184
2185 /*
2186 * VHT first - HT is a subset.
2187 */
2188 if (flags & IEEE80211_CHAN_VHT) {
2189 if ((chanFlags & IEEE80211_CHAN_VHT20) &&
2190 (flags & IEEE80211_CHAN_VHT20) == 0) {
2191 if (verbose)
2192 printf("%u: skip, not a "
2193 "VHT20 channel\n", freq);
2194 continue;
2195 }
2196 if ((chanFlags & IEEE80211_CHAN_VHT40) &&
2197 (flags & IEEE80211_CHAN_VHT40) == 0) {
2198 if (verbose)
2199 printf("%u: skip, not a "
2200 "VHT40 channel\n", freq);
2201 continue;
2202 }
2203 if ((chanFlags & IEEE80211_CHAN_VHT80) &&

Callers 1

regdomain_makechannelsFunction · 0.85

Calls 5

putcharFunction · 0.85
checkchanFunction · 0.85
memsetFunction · 0.85
printbFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected