diff options
author | bschmidt <bschmidt@FreeBSD.org> | 2012-04-03 17:48:42 +0000 |
---|---|---|
committer | bschmidt <bschmidt@FreeBSD.org> | 2012-04-03 17:48:42 +0000 |
commit | d54496d7dd5f79f0c555daafda2f2f8d9a27b17d (patch) | |
tree | 8b3c31d40c404259dd05e59c38f91239687c3045 /sys/net80211/ieee80211_regdomain.c | |
parent | ae90e605cb6385a601bcc1544061328f74de2595 (diff) | |
download | FreeBSD-src-d54496d7dd5f79f0c555daafda2f2f8d9a27b17d.zip FreeBSD-src-d54496d7dd5f79f0c555daafda2f2f8d9a27b17d.tar.gz |
Add basic HT channel setup to ieee80211_init_channels(), this will be
used by at least ral(4).
Reviewed by: ray
Diffstat (limited to 'sys/net80211/ieee80211_regdomain.c')
-rw-r--r-- | sys/net80211/ieee80211_regdomain.c | 70 |
1 files changed, 64 insertions, 6 deletions
diff --git a/sys/net80211/ieee80211_regdomain.c b/sys/net80211/ieee80211_regdomain.c index c1d6173..6bc5e0d 100644 --- a/sys/net80211/ieee80211_regdomain.c +++ b/sys/net80211/ieee80211_regdomain.c @@ -105,7 +105,12 @@ addchan(struct ieee80211com *ic, int ieee, int flags) c->ic_freq = ieee80211_ieee2mhz(ieee, flags); c->ic_ieee = ieee; c->ic_flags = flags; - c->ic_extieee = 0; + if (flags & IEEE80211_CHAN_HT40U) + c->ic_extieee = ieee + 4; + else if (flags & IEEE80211_CHAN_HT40D) + c->ic_extieee = ieee - 4; + else + c->ic_extieee = 0; } /* @@ -123,7 +128,8 @@ ieee80211_init_channels(struct ieee80211com *ic, /* XXX just do something for now */ ic->ic_nchans = 0; if (isset(bands, IEEE80211_MODE_11B) || - isset(bands, IEEE80211_MODE_11G)) { + isset(bands, IEEE80211_MODE_11G) || + isset(bands, IEEE80211_MODE_11NG)) { int maxchan = 11; if (rd != NULL && rd->ecm) maxchan = 14; @@ -132,15 +138,67 @@ ieee80211_init_channels(struct ieee80211com *ic, addchan(ic, i, IEEE80211_CHAN_B); if (isset(bands, IEEE80211_MODE_11G)) addchan(ic, i, IEEE80211_CHAN_G); + if (isset(bands, IEEE80211_MODE_11NG)) { + addchan(ic, i, + IEEE80211_CHAN_G | IEEE80211_CHAN_HT20); + } + if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) == 0) + continue; + if (i <= 7) { + addchan(ic, i, + IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U); + addchan(ic, i + 4, + IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D); + } } } - if (isset(bands, IEEE80211_MODE_11A)) { - for (i = 36; i <= 64; i += 4) + if (isset(bands, IEEE80211_MODE_11A) || + isset(bands, IEEE80211_MODE_11NA)) { + for (i = 36; i <= 64; i += 4) { addchan(ic, i, IEEE80211_CHAN_A); - for (i = 100; i <= 140; i += 4) + if (isset(bands, IEEE80211_MODE_11NA)) { + addchan(ic, i, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT20); + } + if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) == 0) + continue; + if ((i % 8) == 4) { + addchan(ic, i, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U); + addchan(ic, i + 4, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D); + } + } + for (i = 100; i <= 140; i += 4) { addchan(ic, i, IEEE80211_CHAN_A); - for (i = 149; i <= 161; i += 4) + if (isset(bands, IEEE80211_MODE_11NA)) { + addchan(ic, i, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT20); + } + if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) == 0) + continue; + if ((i % 8) == 4 && i != 140) { + addchan(ic, i, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U); + addchan(ic, i + 4, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D); + } + } + for (i = 149; i <= 161; i += 4) { addchan(ic, i, IEEE80211_CHAN_A); + if (isset(bands, IEEE80211_MODE_11NA)) { + addchan(ic, i, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT20); + } + if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) == 0) + continue; + if ((i % 8) == 5) { + addchan(ic, i, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U); + addchan(ic, i + 4, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D); + } + } } if (rd != NULL) ic->ic_regdomain = *rd; |