From 0ea08cfa346654243d5c3ea9e5907f58342aed0d Mon Sep 17 00:00:00 2001 From: sam Date: Sun, 11 Mar 2007 06:24:26 +0000 Subject: change ieee80211_mhz2ieee to use the PSB mapping when the frequency falls in the proper place, not when we're handed a 1/2 or 1/4-rate channel MFC after: 2 weeks --- sys/net80211/ieee80211.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sys/net80211') diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 803c530..bcef214 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -305,6 +305,7 @@ mappsb(u_int freq, u_int flags) int ieee80211_mhz2ieee(u_int freq, u_int flags) { +#define IS_FREQ_IN_PSB(_freq) ((_freq) > 4940 && (_freq) < 4990) if (flags & IEEE80211_CHAN_GSM) return mapgsm(freq, flags); if (flags & IEEE80211_CHAN_2GHZ) { /* 2GHz band */ @@ -316,7 +317,7 @@ ieee80211_mhz2ieee(u_int freq, u_int flags) return 15 + ((freq - 2512) / 20); } else if (flags & IEEE80211_CHAN_5GHZ) { /* 5Ghz band */ if (freq <= 5000) { - if (flags &(IEEE80211_CHAN_HALF|IEEE80211_CHAN_QUARTER)) + if (IS_FREQ_IN_PSB(freq)) return mappsb(freq, flags); return (freq - 4000) / 5; } else @@ -330,7 +331,7 @@ ieee80211_mhz2ieee(u_int freq, u_int flags) return ((int) freq - 2407) / 5; } if (freq < 5000) { - if (flags &(IEEE80211_CHAN_HALF|IEEE80211_CHAN_QUARTER)) + if (IS_FREQ_IN_PSB(freq)) return mappsb(freq, flags); else if (freq > 4900) return (freq - 4000) / 5; @@ -339,6 +340,7 @@ ieee80211_mhz2ieee(u_int freq, u_int flags) } return (freq - 5000) / 5; } +#undef IS_FREQ_IN_PSB } /* -- cgit v1.1