From 11df4239a6d5e6b5c526fc2ebe426e31fb9cf53c Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Sun, 11 Mar 2007 06:24:26 +0000 Subject: [PATCH] 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(-) diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 803c53059d5c..bcef214669c7 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 } /*