diff options
author | David Kilroy <kilroyd@googlemail.com> | 2008-12-23 09:03:38 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:58:46 -0500 |
commit | 9ee677c2276bfcbcf68042ec2718a504af0c5fd7 (patch) | |
tree | 0b5528241690e143c60832d319ddbb2ad1c5d7f1 /drivers/net/wireless/airo.c | |
parent | eaee7cc2c180c291084a1c1f49cd2bf13002b3e1 (diff) |
wireless: Add channel/frequency conversions to ieee80211.h
Added mappings for FHSS, DSSS and OFDM channels - with macros to point
HR DSSS and ERP to the DSSS mappings. Currently just static inline
functions.
Use the new functions in the older fullmac drivers. This eliminates a
number of const static buffers and removes a couple of range checks that
are now redundant.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Richard Farina <sidhayn@gmail.com>
Acked-by: Jeroen Vreeken <pe1rxq@amsat.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/airo.c')
-rw-r--r-- | drivers/net/wireless/airo.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index fc4322ca669f..2ff588bb0a7c 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -1070,10 +1070,6 @@ static WifiCtlHdr wifictlhdr8023 = { | |||
1070 | } | 1070 | } |
1071 | }; | 1071 | }; |
1072 | 1072 | ||
1073 | // Frequency list (map channels to frequencies) | ||
1074 | static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, | ||
1075 | 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; | ||
1076 | |||
1077 | // A few details needed for WEP (Wireless Equivalent Privacy) | 1073 | // A few details needed for WEP (Wireless Equivalent Privacy) |
1078 | #define MAX_KEY_SIZE 13 // 128 (?) bits | 1074 | #define MAX_KEY_SIZE 13 // 128 (?) bits |
1079 | #define MIN_KEY_SIZE 5 // 40 bits RC4 - WEP | 1075 | #define MIN_KEY_SIZE 5 // 40 bits RC4 - WEP |
@@ -5725,16 +5721,12 @@ static int airo_set_freq(struct net_device *dev, | |||
5725 | int rc = -EINPROGRESS; /* Call commit handler */ | 5721 | int rc = -EINPROGRESS; /* Call commit handler */ |
5726 | 5722 | ||
5727 | /* If setting by frequency, convert to a channel */ | 5723 | /* If setting by frequency, convert to a channel */ |
5728 | if((fwrq->e == 1) && | 5724 | if(fwrq->e == 1) { |
5729 | (fwrq->m >= (int) 2.412e8) && | ||
5730 | (fwrq->m <= (int) 2.487e8)) { | ||
5731 | int f = fwrq->m / 100000; | 5725 | int f = fwrq->m / 100000; |
5732 | int c = 0; | 5726 | |
5733 | while((c < 14) && (f != frequency_list[c])) | ||
5734 | c++; | ||
5735 | /* Hack to fall through... */ | 5727 | /* Hack to fall through... */ |
5736 | fwrq->e = 0; | 5728 | fwrq->e = 0; |
5737 | fwrq->m = c + 1; | 5729 | fwrq->m = ieee80211_freq_to_dsss_chan(f); |
5738 | } | 5730 | } |
5739 | /* Setting by channel number */ | 5731 | /* Setting by channel number */ |
5740 | if((fwrq->m > 1000) || (fwrq->e > 0)) | 5732 | if((fwrq->m > 1000) || (fwrq->e > 0)) |
@@ -5778,7 +5770,7 @@ static int airo_get_freq(struct net_device *dev, | |||
5778 | 5770 | ||
5779 | ch = le16_to_cpu(status_rid.channel); | 5771 | ch = le16_to_cpu(status_rid.channel); |
5780 | if((ch > 0) && (ch < 15)) { | 5772 | if((ch > 0) && (ch < 15)) { |
5781 | fwrq->m = frequency_list[ch - 1] * 100000; | 5773 | fwrq->m = ieee80211_dsss_chan_to_freq(ch) * 100000; |
5782 | fwrq->e = 1; | 5774 | fwrq->e = 1; |
5783 | } else { | 5775 | } else { |
5784 | fwrq->m = ch; | 5776 | fwrq->m = ch; |
@@ -6795,8 +6787,8 @@ static int airo_get_range(struct net_device *dev, | |||
6795 | k = 0; | 6787 | k = 0; |
6796 | for(i = 0; i < 14; i++) { | 6788 | for(i = 0; i < 14; i++) { |
6797 | range->freq[k].i = i + 1; /* List index */ | 6789 | range->freq[k].i = i + 1; /* List index */ |
6798 | range->freq[k].m = frequency_list[i] * 100000; | 6790 | range->freq[k].m = ieee80211_dsss_chan_to_freq(i + 1) * 100000; |
6799 | range->freq[k++].e = 1; /* Values in table in MHz -> * 10^5 * 10 */ | 6791 | range->freq[k++].e = 1; /* Values in MHz -> * 10^5 * 10 */ |
6800 | } | 6792 | } |
6801 | range->num_frequency = k; | 6793 | range->num_frequency = k; |
6802 | 6794 | ||
@@ -7189,10 +7181,7 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
7189 | /* Add frequency */ | 7181 | /* Add frequency */ |
7190 | iwe.cmd = SIOCGIWFREQ; | 7182 | iwe.cmd = SIOCGIWFREQ; |
7191 | iwe.u.freq.m = le16_to_cpu(bss->dsChannel); | 7183 | iwe.u.freq.m = le16_to_cpu(bss->dsChannel); |
7192 | /* iwe.u.freq.m containt the channel (starting 1), our | 7184 | iwe.u.freq.m = ieee80211_dsss_chan_to_freq(iwe.u.freq.m) * 100000; |
7193 | * frequency_list array start at index 0... | ||
7194 | */ | ||
7195 | iwe.u.freq.m = frequency_list[iwe.u.freq.m - 1] * 100000; | ||
7196 | iwe.u.freq.e = 1; | 7185 | iwe.u.freq.e = 1; |
7197 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, | 7186 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, |
7198 | &iwe, IW_EV_FREQ_LEN); | 7187 | &iwe, IW_EV_FREQ_LEN); |