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
This commit is contained in:
Sam Leffler 2007-03-11 06:24:26 +00:00
parent c640357f04
commit 11df4239a6

View File

@ -305,6 +305,7 @@ mappsb(u_int freq, u_int flags)
int int
ieee80211_mhz2ieee(u_int freq, u_int flags) ieee80211_mhz2ieee(u_int freq, u_int flags)
{ {
#define IS_FREQ_IN_PSB(_freq) ((_freq) > 4940 && (_freq) < 4990)
if (flags & IEEE80211_CHAN_GSM) if (flags & IEEE80211_CHAN_GSM)
return mapgsm(freq, flags); return mapgsm(freq, flags);
if (flags & IEEE80211_CHAN_2GHZ) { /* 2GHz band */ if (flags & IEEE80211_CHAN_2GHZ) { /* 2GHz band */
@ -316,7 +317,7 @@ ieee80211_mhz2ieee(u_int freq, u_int flags)
return 15 + ((freq - 2512) / 20); return 15 + ((freq - 2512) / 20);
} else if (flags & IEEE80211_CHAN_5GHZ) { /* 5Ghz band */ } else if (flags & IEEE80211_CHAN_5GHZ) { /* 5Ghz band */
if (freq <= 5000) { if (freq <= 5000) {
if (flags &(IEEE80211_CHAN_HALF|IEEE80211_CHAN_QUARTER)) if (IS_FREQ_IN_PSB(freq))
return mappsb(freq, flags); return mappsb(freq, flags);
return (freq - 4000) / 5; return (freq - 4000) / 5;
} else } else
@ -330,7 +331,7 @@ ieee80211_mhz2ieee(u_int freq, u_int flags)
return ((int) freq - 2407) / 5; return ((int) freq - 2407) / 5;
} }
if (freq < 5000) { if (freq < 5000) {
if (flags &(IEEE80211_CHAN_HALF|IEEE80211_CHAN_QUARTER)) if (IS_FREQ_IN_PSB(freq))
return mappsb(freq, flags); return mappsb(freq, flags);
else if (freq > 4900) else if (freq > 4900)
return (freq - 4000) / 5; return (freq - 4000) / 5;
@ -339,6 +340,7 @@ ieee80211_mhz2ieee(u_int freq, u_int flags)
} }
return (freq - 5000) / 5; return (freq - 5000) / 5;
} }
#undef IS_FREQ_IN_PSB
} }
/* /*