aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8187se/ieee80211/dot11d.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2009-03-03 17:38:09 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-04-03 17:53:30 -0400
commit88adc104476cccb4b5cfaa48da7019cf9184481b (patch)
treed22f8713ac2101882fe077c5add567cf9d33725d /drivers/staging/rtl8187se/ieee80211/dot11d.c
parent9c515551f17493248cd287997d46d6d7e3203b1d (diff)
Staging: rtl8187se: fix \r\n line ends
Andrew pointed out that I forgot to convert some files to unix format when adding them originally. This patch runs dos2unix on the rtl8187se files that needed them. Reported-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rtl8187se/ieee80211/dot11d.c')
-rw-r--r--drivers/staging/rtl8187se/ieee80211/dot11d.c492
1 files changed, 246 insertions, 246 deletions
diff --git a/drivers/staging/rtl8187se/ieee80211/dot11d.c b/drivers/staging/rtl8187se/ieee80211/dot11d.c
index 5d8b752fc0f..54bcdcf1d33 100644
--- a/drivers/staging/rtl8187se/ieee80211/dot11d.c
+++ b/drivers/staging/rtl8187se/ieee80211/dot11d.c
@@ -1,246 +1,246 @@
1#ifdef ENABLE_DOT11D 1#ifdef ENABLE_DOT11D
2//----------------------------------------------------------------------------- 2//-----------------------------------------------------------------------------
3// File: 3// File:
4// Dot11d.c 4// Dot11d.c
5// 5//
6// Description: 6// Description:
7// Implement 802.11d. 7// Implement 802.11d.
8// 8//
9//----------------------------------------------------------------------------- 9//-----------------------------------------------------------------------------
10 10
11#include "dot11d.h" 11#include "dot11d.h"
12 12
13void 13void
14Dot11d_Init(struct ieee80211_device *ieee) 14Dot11d_Init(struct ieee80211_device *ieee)
15{ 15{
16 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); 16 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee);
17 17
18 pDot11dInfo->bEnabled = 0; 18 pDot11dInfo->bEnabled = 0;
19 19
20 pDot11dInfo->State = DOT11D_STATE_NONE; 20 pDot11dInfo->State = DOT11D_STATE_NONE;
21 pDot11dInfo->CountryIeLen = 0; 21 pDot11dInfo->CountryIeLen = 0;
22 memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); 22 memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1);
23 memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); 23 memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1);
24 RESET_CIE_WATCHDOG(ieee); 24 RESET_CIE_WATCHDOG(ieee);
25 25
26 printk("Dot11d_Init()\n"); 26 printk("Dot11d_Init()\n");
27} 27}
28 28
29// 29//
30// Description: 30// Description:
31// Reset to the state as we are just entering a regulatory domain. 31// Reset to the state as we are just entering a regulatory domain.
32// 32//
33void 33void
34Dot11d_Reset(struct ieee80211_device *ieee) 34Dot11d_Reset(struct ieee80211_device *ieee)
35{ 35{
36 u32 i; 36 u32 i;
37 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); 37 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee);
38 38
39 // Clear old channel map 39 // Clear old channel map
40 memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); 40 memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1);
41 memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); 41 memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1);
42 // Set new channel map 42 // Set new channel map
43 for (i=1; i<=11; i++) { 43 for (i=1; i<=11; i++) {
44 (pDot11dInfo->channel_map)[i] = 1; 44 (pDot11dInfo->channel_map)[i] = 1;
45 } 45 }
46 for (i=12; i<=14; i++) { 46 for (i=12; i<=14; i++) {
47 (pDot11dInfo->channel_map)[i] = 2; 47 (pDot11dInfo->channel_map)[i] = 2;
48 } 48 }
49 49
50 pDot11dInfo->State = DOT11D_STATE_NONE; 50 pDot11dInfo->State = DOT11D_STATE_NONE;
51 pDot11dInfo->CountryIeLen = 0; 51 pDot11dInfo->CountryIeLen = 0;
52 RESET_CIE_WATCHDOG(ieee); 52 RESET_CIE_WATCHDOG(ieee);
53 53
54 //printk("Dot11d_Reset()\n"); 54 //printk("Dot11d_Reset()\n");
55} 55}
56 56
57// 57//
58// Description: 58// Description:
59// Update country IE from Beacon or Probe Resopnse 59// Update country IE from Beacon or Probe Resopnse
60// and configure PHY for operation in the regulatory domain. 60// and configure PHY for operation in the regulatory domain.
61// 61//
62// TODO: 62// TODO:
63// Configure Tx power. 63// Configure Tx power.
64// 64//
65// Assumption: 65// Assumption:
66// 1. IS_DOT11D_ENABLE() is TRUE. 66// 1. IS_DOT11D_ENABLE() is TRUE.
67// 2. Input IE is an valid one. 67// 2. Input IE is an valid one.
68// 68//
69void 69void
70Dot11d_UpdateCountryIe( 70Dot11d_UpdateCountryIe(
71 struct ieee80211_device *dev, 71 struct ieee80211_device *dev,
72 u8 * pTaddr, 72 u8 * pTaddr,
73 u16 CoutryIeLen, 73 u16 CoutryIeLen,
74 u8 * pCoutryIe 74 u8 * pCoutryIe
75 ) 75 )
76{ 76{
77 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); 77 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev);
78 u8 i, j, NumTriples, MaxChnlNum; 78 u8 i, j, NumTriples, MaxChnlNum;
79 PCHNL_TXPOWER_TRIPLE pTriple; 79 PCHNL_TXPOWER_TRIPLE pTriple;
80 80
81 if((CoutryIeLen - 3)%3 != 0) 81 if((CoutryIeLen - 3)%3 != 0)
82 { 82 {
83 printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); 83 printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n");
84 Dot11d_Reset(dev); 84 Dot11d_Reset(dev);
85 return; 85 return;
86 } 86 }
87 87
88 memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); 88 memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1);
89 memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); 89 memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1);
90 MaxChnlNum = 0; 90 MaxChnlNum = 0;
91 NumTriples = (CoutryIeLen - 3) / 3; // skip 3-byte country string. 91 NumTriples = (CoutryIeLen - 3) / 3; // skip 3-byte country string.
92 pTriple = (PCHNL_TXPOWER_TRIPLE)(pCoutryIe + 3); 92 pTriple = (PCHNL_TXPOWER_TRIPLE)(pCoutryIe + 3);
93 for(i = 0; i < NumTriples; i++) 93 for(i = 0; i < NumTriples; i++)
94 { 94 {
95 if(MaxChnlNum >= pTriple->FirstChnl) 95 if(MaxChnlNum >= pTriple->FirstChnl)
96 { // It is not in a monotonically increasing order, so stop processing. 96 { // It is not in a monotonically increasing order, so stop processing.
97 printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); 97 printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n");
98 Dot11d_Reset(dev); 98 Dot11d_Reset(dev);
99 return; 99 return;
100 } 100 }
101 if(MAX_CHANNEL_NUMBER < (pTriple->FirstChnl + pTriple->NumChnls)) 101 if(MAX_CHANNEL_NUMBER < (pTriple->FirstChnl + pTriple->NumChnls))
102 { // It is not a valid set of channel id, so stop processing. 102 { // It is not a valid set of channel id, so stop processing.
103 printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........2\n"); 103 printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........2\n");
104 Dot11d_Reset(dev); 104 Dot11d_Reset(dev);
105 return; 105 return;
106 } 106 }
107 107
108 for(j = 0 ; j < pTriple->NumChnls; j++) 108 for(j = 0 ; j < pTriple->NumChnls; j++)
109 { 109 {
110 pDot11dInfo->channel_map[pTriple->FirstChnl + j] = 1; 110 pDot11dInfo->channel_map[pTriple->FirstChnl + j] = 1;
111 pDot11dInfo->MaxTxPwrDbmList[pTriple->FirstChnl + j] = pTriple->MaxTxPowerInDbm; 111 pDot11dInfo->MaxTxPwrDbmList[pTriple->FirstChnl + j] = pTriple->MaxTxPowerInDbm;
112 MaxChnlNum = pTriple->FirstChnl + j; 112 MaxChnlNum = pTriple->FirstChnl + j;
113 } 113 }
114 114
115 pTriple = (PCHNL_TXPOWER_TRIPLE)((u8*)pTriple + 3); 115 pTriple = (PCHNL_TXPOWER_TRIPLE)((u8*)pTriple + 3);
116 } 116 }
117#if 1 117#if 1
118 //printk("Dot11d_UpdateCountryIe(): Channel List:\n"); 118 //printk("Dot11d_UpdateCountryIe(): Channel List:\n");
119 printk("Channel List:"); 119 printk("Channel List:");
120 for(i=1; i<= MAX_CHANNEL_NUMBER; i++) 120 for(i=1; i<= MAX_CHANNEL_NUMBER; i++)
121 if(pDot11dInfo->channel_map[i] > 0) 121 if(pDot11dInfo->channel_map[i] > 0)
122 printk(" %d", i); 122 printk(" %d", i);
123 printk("\n"); 123 printk("\n");
124#endif 124#endif
125 125
126 UPDATE_CIE_SRC(dev, pTaddr); 126 UPDATE_CIE_SRC(dev, pTaddr);
127 127
128 pDot11dInfo->CountryIeLen = CoutryIeLen; 128 pDot11dInfo->CountryIeLen = CoutryIeLen;
129 memcpy(pDot11dInfo->CountryIeBuf, pCoutryIe,CoutryIeLen); 129 memcpy(pDot11dInfo->CountryIeBuf, pCoutryIe,CoutryIeLen);
130 pDot11dInfo->State = DOT11D_STATE_LEARNED; 130 pDot11dInfo->State = DOT11D_STATE_LEARNED;
131} 131}
132 132
133void dump_chnl_map(u8 * channel_map) 133void dump_chnl_map(u8 * channel_map)
134{ 134{
135 int i; 135 int i;
136 printk("Channel List:"); 136 printk("Channel List:");
137 for(i=1; i<= MAX_CHANNEL_NUMBER; i++) 137 for(i=1; i<= MAX_CHANNEL_NUMBER; i++)
138 if(channel_map[i] > 0) 138 if(channel_map[i] > 0)
139 printk(" %d(%d)", i, channel_map[i]); 139 printk(" %d(%d)", i, channel_map[i]);
140 printk("\n"); 140 printk("\n");
141} 141}
142 142
143u8 143u8
144DOT11D_GetMaxTxPwrInDbm( 144DOT11D_GetMaxTxPwrInDbm(
145 struct ieee80211_device *dev, 145 struct ieee80211_device *dev,
146 u8 Channel 146 u8 Channel
147 ) 147 )
148{ 148{
149 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); 149 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev);
150 u8 MaxTxPwrInDbm = 255; 150 u8 MaxTxPwrInDbm = 255;
151 151
152 if(MAX_CHANNEL_NUMBER < Channel) 152 if(MAX_CHANNEL_NUMBER < Channel)
153 { 153 {
154 printk("DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n"); 154 printk("DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n");
155 return MaxTxPwrInDbm; 155 return MaxTxPwrInDbm;
156 } 156 }
157 if(pDot11dInfo->channel_map[Channel]) 157 if(pDot11dInfo->channel_map[Channel])
158 { 158 {
159 MaxTxPwrInDbm = pDot11dInfo->MaxTxPwrDbmList[Channel]; 159 MaxTxPwrInDbm = pDot11dInfo->MaxTxPwrDbmList[Channel];
160 } 160 }
161 161
162 return MaxTxPwrInDbm; 162 return MaxTxPwrInDbm;
163} 163}
164 164
165 165
166void 166void
167DOT11D_ScanComplete( 167DOT11D_ScanComplete(
168 struct ieee80211_device * dev 168 struct ieee80211_device * dev
169 ) 169 )
170{ 170{
171 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); 171 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev);
172 172
173 switch(pDot11dInfo->State) 173 switch(pDot11dInfo->State)
174 { 174 {
175 case DOT11D_STATE_LEARNED: 175 case DOT11D_STATE_LEARNED:
176 pDot11dInfo->State = DOT11D_STATE_DONE; 176 pDot11dInfo->State = DOT11D_STATE_DONE;
177 break; 177 break;
178 178
179 case DOT11D_STATE_DONE: 179 case DOT11D_STATE_DONE:
180 if( GET_CIE_WATCHDOG(dev) == 0 ) 180 if( GET_CIE_WATCHDOG(dev) == 0 )
181 { // Reset country IE if previous one is gone. 181 { // Reset country IE if previous one is gone.
182 Dot11d_Reset(dev); 182 Dot11d_Reset(dev);
183 } 183 }
184 break; 184 break;
185 case DOT11D_STATE_NONE: 185 case DOT11D_STATE_NONE:
186 break; 186 break;
187 } 187 }
188} 188}
189 189
190int IsLegalChannel( 190int IsLegalChannel(
191 struct ieee80211_device * dev, 191 struct ieee80211_device * dev,
192 u8 channel 192 u8 channel
193) 193)
194{ 194{
195 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); 195 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev);
196 196
197 if(MAX_CHANNEL_NUMBER < channel) 197 if(MAX_CHANNEL_NUMBER < channel)
198 { 198 {
199 printk("IsLegalChannel(): Invalid Channel\n"); 199 printk("IsLegalChannel(): Invalid Channel\n");
200 return 0; 200 return 0;
201 } 201 }
202 if(pDot11dInfo->channel_map[channel] > 0) 202 if(pDot11dInfo->channel_map[channel] > 0)
203 return 1; 203 return 1;
204 return 0; 204 return 0;
205} 205}
206 206
207int ToLegalChannel( 207int ToLegalChannel(
208 struct ieee80211_device * dev, 208 struct ieee80211_device * dev,
209 u8 channel 209 u8 channel
210) 210)
211{ 211{
212 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); 212 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev);
213 u8 default_chn = 0; 213 u8 default_chn = 0;
214 u32 i = 0; 214 u32 i = 0;
215 215
216 for (i=1; i<= MAX_CHANNEL_NUMBER; i++) 216 for (i=1; i<= MAX_CHANNEL_NUMBER; i++)
217 { 217 {
218 if(pDot11dInfo->channel_map[i] > 0) 218 if(pDot11dInfo->channel_map[i] > 0)
219 { 219 {
220 default_chn = i; 220 default_chn = i;
221 break; 221 break;
222 } 222 }
223 } 223 }
224 224
225 if(MAX_CHANNEL_NUMBER < channel) 225 if(MAX_CHANNEL_NUMBER < channel)
226 { 226 {
227 printk("IsLegalChannel(): Invalid Channel\n"); 227 printk("IsLegalChannel(): Invalid Channel\n");
228 return default_chn; 228 return default_chn;
229 } 229 }
230 230
231 if(pDot11dInfo->channel_map[channel] > 0) 231 if(pDot11dInfo->channel_map[channel] > 0)
232 return channel; 232 return channel;
233 233
234 return default_chn; 234 return default_chn;
235} 235}
236 236
237#if 0 237#if 0
238EXPORT_SYMBOL(Dot11d_Init); 238EXPORT_SYMBOL(Dot11d_Init);
239EXPORT_SYMBOL(Dot11d_Reset); 239EXPORT_SYMBOL(Dot11d_Reset);
240EXPORT_SYMBOL(Dot11d_UpdateCountryIe); 240EXPORT_SYMBOL(Dot11d_UpdateCountryIe);
241EXPORT_SYMBOL(DOT11D_GetMaxTxPwrInDbm); 241EXPORT_SYMBOL(DOT11D_GetMaxTxPwrInDbm);
242EXPORT_SYMBOL(DOT11D_ScanComplete); 242EXPORT_SYMBOL(DOT11D_ScanComplete);
243EXPORT_SYMBOL(IsLegalChannel); 243EXPORT_SYMBOL(IsLegalChannel);
244EXPORT_SYMBOL(ToLegalChannel); 244EXPORT_SYMBOL(ToLegalChannel);
245#endif 245#endif
246#endif 246#endif