aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/wlan-ng/prism2mib.c714
1 files changed, 333 insertions, 381 deletions
diff --git a/drivers/staging/wlan-ng/prism2mib.c b/drivers/staging/wlan-ng/prism2mib.c
index 8d89268b78c..1bb91b20643 100644
--- a/drivers/staging/wlan-ng/prism2mib.c
+++ b/drivers/staging/wlan-ng/prism2mib.c
@@ -50,11 +50,7 @@
50* -------------------------------------------------------------------- 50* --------------------------------------------------------------------
51*/ 51*/
52 52
53/*================================================================*/
54/* System Includes */
55
56#include <linux/version.h> 53#include <linux/version.h>
57
58#include <linux/module.h> 54#include <linux/module.h>
59#include <linux/kernel.h> 55#include <linux/kernel.h>
60#include <linux/sched.h> 56#include <linux/sched.h>
@@ -62,15 +58,12 @@
62#include <linux/slab.h> 58#include <linux/slab.h>
63#include <linux/wireless.h> 59#include <linux/wireless.h>
64#include <linux/netdevice.h> 60#include <linux/netdevice.h>
65#include <asm/io.h> 61#include <linux/io.h>
66#include <linux/delay.h> 62#include <linux/delay.h>
67#include <asm/byteorder.h> 63#include <asm/byteorder.h>
68#include <linux/usb.h> 64#include <linux/usb.h>
69#include <linux/bitops.h> 65#include <linux/bitops.h>
70 66
71/*================================================================*/
72/* Project Includes */
73
74#include "p80211types.h" 67#include "p80211types.h"
75#include "p80211hdr.h" 68#include "p80211hdr.h"
76#include "p80211mgmt.h" 69#include "p80211mgmt.h"
@@ -82,196 +75,169 @@
82#include "hfa384x.h" 75#include "hfa384x.h"
83#include "prism2mgmt.h" 76#include "prism2mgmt.h"
84 77
85/*================================================================*/ 78#define MIB_TMP_MAXLEN 200 /* Max length of RID record (in bytes). */
86/* Local Constants */ 79
87 80#define F_STA 0x1 /* MIB is supported on stations. */
88#define MIB_TMP_MAXLEN 200 /* Max length of RID record (in bytes). */ 81#define F_READ 0x2 /* MIB may be read. */
89 82#define F_WRITE 0x4 /* MIB may be written. */
90/*================================================================*/ 83
91/* Local Types */ 84typedef struct mibrec {
92 85 u32 did;
93#define F_STA 0x1 /* MIB is supported on stations. */ 86 u16 flag;
94#define F_READ 0x2 /* MIB may be read. */ 87 u16 parm1;
95#define F_WRITE 0x4 /* MIB may be written. */ 88 u16 parm2;
96 89 u16 parm3;
97typedef struct mibrec 90 int (*func) (struct mibrec *mib,
98{ 91 int isget,
99 u32 did; 92 wlandevice_t *wlandev,
100 u16 flag; 93 hfa384x_t *hw,
101 u16 parm1; 94 p80211msg_dot11req_mibset_t *msg, void *data);
102 u16 parm2;
103 u16 parm3;
104 int (*func)(struct mibrec *mib,
105 int isget,
106 wlandevice_t *wlandev,
107 hfa384x_t *hw,
108 p80211msg_dot11req_mibset_t *msg,
109 void *data);
110} mibrec_t; 95} mibrec_t;
111 96
112/*================================================================*/ 97static int prism2mib_bytearea2pstr(mibrec_t *mib,
113/* Local Function Declarations */ 98 int isget,
114 99 wlandevice_t *wlandev,
115static int prism2mib_bytearea2pstr( 100 hfa384x_t *hw,
116mibrec_t *mib, 101 p80211msg_dot11req_mibset_t *msg,
117int isget, 102 void *data);
118wlandevice_t *wlandev, 103
119hfa384x_t *hw, 104static int prism2mib_uint32(mibrec_t *mib,
120p80211msg_dot11req_mibset_t *msg, 105 int isget,
121void *data); 106 wlandevice_t *wlandev,
122 107 hfa384x_t *hw,
123static int prism2mib_uint32( 108 p80211msg_dot11req_mibset_t *msg, void *data);
124mibrec_t *mib, 109
125int isget, 110static int prism2mib_flag(mibrec_t *mib,
126wlandevice_t *wlandev, 111 int isget,
127hfa384x_t *hw, 112 wlandevice_t *wlandev,
128p80211msg_dot11req_mibset_t *msg, 113 hfa384x_t *hw,
129void *data); 114 p80211msg_dot11req_mibset_t *msg, void *data);
130 115
131static int prism2mib_flag( 116static int prism2mib_wepdefaultkey(mibrec_t *mib,
132mibrec_t *mib, 117 int isget,
133int isget, 118 wlandevice_t *wlandev,
134wlandevice_t *wlandev, 119 hfa384x_t *hw,
135hfa384x_t *hw, 120 p80211msg_dot11req_mibset_t *msg,
136p80211msg_dot11req_mibset_t *msg, 121 void *data);
137void *data); 122
138 123static int prism2mib_privacyinvoked(mibrec_t *mib,
139static int prism2mib_wepdefaultkey( 124 int isget,
140mibrec_t *mib, 125 wlandevice_t *wlandev,
141int isget, 126 hfa384x_t *hw,
142wlandevice_t *wlandev, 127 p80211msg_dot11req_mibset_t *msg,
143hfa384x_t *hw, 128 void *data);
144p80211msg_dot11req_mibset_t *msg, 129
145void *data); 130static int prism2mib_excludeunencrypted(mibrec_t *mib,
146 131 int isget,
147static int prism2mib_privacyinvoked( 132 wlandevice_t *wlandev,
148mibrec_t *mib, 133 hfa384x_t *hw,
149int isget, 134 p80211msg_dot11req_mibset_t *msg,
150wlandevice_t *wlandev, 135 void *data);
151hfa384x_t *hw, 136
152p80211msg_dot11req_mibset_t *msg, 137static int prism2mib_fragmentationthreshold(mibrec_t *mib,
153void *data); 138 int isget,
154 139 wlandevice_t *wlandev,
155static int prism2mib_excludeunencrypted( 140 hfa384x_t *hw,
156mibrec_t *mib, 141 p80211msg_dot11req_mibset_t *msg,
157int isget, 142 void *data);
158wlandevice_t *wlandev, 143
159hfa384x_t *hw, 144static int prism2mib_priv(mibrec_t *mib,
160p80211msg_dot11req_mibset_t *msg, 145 int isget,
161void *data); 146 wlandevice_t *wlandev,
162 147 hfa384x_t *hw,
163static int prism2mib_fragmentationthreshold( 148 p80211msg_dot11req_mibset_t *msg, void *data);
164mibrec_t *mib,
165int isget,
166wlandevice_t *wlandev,
167hfa384x_t *hw,
168p80211msg_dot11req_mibset_t *msg,
169void *data);
170
171static int prism2mib_priv(
172mibrec_t *mib,
173int isget,
174wlandevice_t *wlandev,
175hfa384x_t *hw,
176p80211msg_dot11req_mibset_t *msg,
177void *data);
178
179/*================================================================*/
180/* Local Static Definitions */
181 149
182static mibrec_t mibtab[] = { 150static mibrec_t mibtab[] = {
183 151
184 /* dot11smt MIB's */ 152 /* dot11smt MIB's */
185 { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0, 153 {DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0,
186 F_STA | F_WRITE, 154 F_STA | F_WRITE,
187 HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0, 155 HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0,
188 prism2mib_wepdefaultkey }, 156 prism2mib_wepdefaultkey},
189 { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1, 157 {DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1,
190 F_STA | F_WRITE, 158 F_STA | F_WRITE,
191 HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0, 159 HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0,
192 prism2mib_wepdefaultkey }, 160 prism2mib_wepdefaultkey},
193 { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2, 161 {DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2,
194 F_STA | F_WRITE, 162 F_STA | F_WRITE,
195 HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0, 163 HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0,
196 prism2mib_wepdefaultkey }, 164 prism2mib_wepdefaultkey},
197 { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3, 165 {DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3,
198 F_STA | F_WRITE, 166 F_STA | F_WRITE,
199 HFA384x_RID_CNFWEPDEFAULTKEY3, 0, 0, 167 HFA384x_RID_CNFWEPDEFAULTKEY3, 0, 0,
200 prism2mib_wepdefaultkey }, 168 prism2mib_wepdefaultkey},
201 { DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, 169 {DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
202 F_STA | F_READ | F_WRITE, 170 F_STA | F_READ | F_WRITE,
203 HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_PRIVINVOKED, 0, 171 HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_PRIVINVOKED, 0,
204 prism2mib_privacyinvoked }, 172 prism2mib_privacyinvoked},
205 { DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID, 173 {DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
206 F_STA | F_READ | F_WRITE, 174 F_STA | F_READ | F_WRITE,
207 HFA384x_RID_CNFWEPDEFAULTKEYID, 0, 0, 175 HFA384x_RID_CNFWEPDEFAULTKEYID, 0, 0,
208 prism2mib_uint32 }, 176 prism2mib_uint32},
209 { DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, 177 {DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted,
210 F_STA | F_READ | F_WRITE, 178 F_STA | F_READ | F_WRITE,
211 HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_EXCLUDE, 0, 179 HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_EXCLUDE, 0,
212 prism2mib_excludeunencrypted }, 180 prism2mib_excludeunencrypted},
213 181
214 /* dot11mac MIB's */ 182 /* dot11mac MIB's */
215 183
216 { DIDmib_dot11mac_dot11OperationTable_dot11MACAddress, 184 {DIDmib_dot11mac_dot11OperationTable_dot11MACAddress,
217 F_STA | F_READ | F_WRITE, 185 F_STA | F_READ | F_WRITE,
218 HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0, 186 HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0,
219 prism2mib_bytearea2pstr }, 187 prism2mib_bytearea2pstr},
220 { DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold, 188 {DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold,
221 F_STA | F_READ | F_WRITE, 189 F_STA | F_READ | F_WRITE,
222 HFA384x_RID_RTSTHRESH, 0, 0, 190 HFA384x_RID_RTSTHRESH, 0, 0,
223 prism2mib_uint32 }, 191 prism2mib_uint32},
224 { DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit, 192 {DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit,
225 F_STA | F_READ, 193 F_STA | F_READ,
226 HFA384x_RID_SHORTRETRYLIMIT, 0, 0, 194 HFA384x_RID_SHORTRETRYLIMIT, 0, 0,
227 prism2mib_uint32 }, 195 prism2mib_uint32},
228 { DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit, 196 {DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit,
229 F_STA | F_READ, 197 F_STA | F_READ,
230 HFA384x_RID_LONGRETRYLIMIT, 0, 0, 198 HFA384x_RID_LONGRETRYLIMIT, 0, 0,
231 prism2mib_uint32 }, 199 prism2mib_uint32},
232 { DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold, 200 {DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold,
233 F_STA | F_READ | F_WRITE, 201 F_STA | F_READ | F_WRITE,
234 HFA384x_RID_FRAGTHRESH, 0, 0, 202 HFA384x_RID_FRAGTHRESH, 0, 0,
235 prism2mib_fragmentationthreshold }, 203 prism2mib_fragmentationthreshold},
236 { DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime, 204 {DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime,
237 F_STA | F_READ, 205 F_STA | F_READ,
238 HFA384x_RID_MAXTXLIFETIME, 0, 0, 206 HFA384x_RID_MAXTXLIFETIME, 0, 0,
239 prism2mib_uint32 }, 207 prism2mib_uint32},
240 208
241 /* dot11phy MIB's */ 209 /* dot11phy MIB's */
242 210
243 { DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel, 211 {DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel,
244 F_STA | F_READ, 212 F_STA | F_READ,
245 HFA384x_RID_CURRENTCHANNEL, 0, 0, 213 HFA384x_RID_CURRENTCHANNEL, 0, 0,
246 prism2mib_uint32 }, 214 prism2mib_uint32},
247 { DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel, 215 {DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel,
248 F_STA | F_READ | F_WRITE, 216 F_STA | F_READ | F_WRITE,
249 HFA384x_RID_TXPOWERMAX, 0, 0, 217 HFA384x_RID_TXPOWERMAX, 0, 0,
250 prism2mib_uint32 }, 218 prism2mib_uint32},
251 219
252 /* p2Static MIB's */ 220 /* p2Static MIB's */
253 221
254 { DIDmib_p2_p2Static_p2CnfPortType, 222 {DIDmib_p2_p2Static_p2CnfPortType,
255 F_STA | F_READ | F_WRITE, 223 F_STA | F_READ | F_WRITE,
256 HFA384x_RID_CNFPORTTYPE, 0, 0, 224 HFA384x_RID_CNFPORTTYPE, 0, 0,
257 prism2mib_uint32 }, 225 prism2mib_uint32},
258 226
259 /* p2MAC MIB's */ 227 /* p2MAC MIB's */
260 228
261 { DIDmib_p2_p2MAC_p2CurrentTxRate, 229 {DIDmib_p2_p2MAC_p2CurrentTxRate,
262 F_STA | F_READ, 230 F_STA | F_READ,
263 HFA384x_RID_CURRENTTXRATE, 0, 0, 231 HFA384x_RID_CURRENTTXRATE, 0, 0,
264 prism2mib_uint32 }, 232 prism2mib_uint32},
265 233
266 /* And finally, lnx mibs */ 234 /* And finally, lnx mibs */
267 { DIDmib_lnx_lnxConfigTable_lnxRSNAIE, 235 {DIDmib_lnx_lnxConfigTable_lnxRSNAIE,
268 F_STA | F_READ | F_WRITE, 236 F_STA | F_READ | F_WRITE,
269 HFA384x_RID_CNFWPADATA, 0, 0, 237 HFA384x_RID_CNFWPADATA, 0, 0,
270 prism2mib_priv }, 238 prism2mib_priv},
271 { 0, 0, 0, 0, 0, NULL}}; 239 {0, 0, 0, 0, 0, NULL}
272 240};
273/*================================================================*/
274/* Function Definitions */
275 241
276/*---------------------------------------------------------------- 242/*----------------------------------------------------------------
277* prism2mgmt_mibset_mibget 243* prism2mgmt_mibset_mibget
@@ -295,30 +261,30 @@ static mibrec_t mibtab[] = {
295 261
296int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp) 262int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp)
297{ 263{
298 hfa384x_t *hw = wlandev->priv; 264 hfa384x_t *hw = wlandev->priv;
299 int result, isget; 265 int result, isget;
300 mibrec_t *mib; 266 mibrec_t *mib;
301 267
302 u16 which; 268 u16 which;
303 269
304 p80211msg_dot11req_mibset_t *msg = msgp; 270 p80211msg_dot11req_mibset_t *msg = msgp;
305 p80211itemd_t *mibitem; 271 p80211itemd_t *mibitem;
306 272
307 msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; 273 msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
308 msg->resultcode.data = P80211ENUM_resultcode_success; 274 msg->resultcode.data = P80211ENUM_resultcode_success;
309 275
310 /* 276 /*
311 ** Determine if this is an Access Point or a station. 277 ** Determine if this is an Access Point or a station.
312 */ 278 */
313 279
314 which = F_STA; 280 which = F_STA;
315 281
316 /* 282 /*
317 ** Find the MIB in the MIB table. Note that a MIB may be in the 283 ** Find the MIB in the MIB table. Note that a MIB may be in the
318 ** table twice...once for an AP and once for a station. Make sure 284 ** table twice...once for an AP and once for a station. Make sure
319 ** to get the correct one. Note that DID=0 marks the end of the 285 ** to get the correct one. Note that DID=0 marks the end of the
320 ** MIB table. 286 ** MIB table.
321 */ 287 */
322 288
323 mibitem = (p80211itemd_t *) msg->mibattribute.data; 289 mibitem = (p80211itemd_t *) msg->mibattribute.data;
324 290
@@ -332,56 +298,55 @@ int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp)
332 } 298 }
333 299
334 /* 300 /*
335 ** Determine if this is a "mibget" or a "mibset". If this is a 301 ** Determine if this is a "mibget" or a "mibset". If this is a
336 ** "mibget", then make sure that the MIB may be read. Otherwise, 302 ** "mibget", then make sure that the MIB may be read. Otherwise,
337 ** this is a "mibset" so make make sure that the MIB may be written. 303 ** this is a "mibset" so make make sure that the MIB may be written.
338 */ 304 */
339 305
340 isget = (msg->msgcode == DIDmsg_dot11req_mibget); 306 isget = (msg->msgcode == DIDmsg_dot11req_mibget);
341 307
342 if (isget) { 308 if (isget) {
343 if (!(mib->flag & F_READ)) { 309 if (!(mib->flag & F_READ)) {
344 msg->resultcode.data = 310 msg->resultcode.data =
345 P80211ENUM_resultcode_cant_get_writeonly_mib; 311 P80211ENUM_resultcode_cant_get_writeonly_mib;
346 goto done; 312 goto done;
347 } 313 }
348 } else { 314 } else {
349 if (!(mib->flag & F_WRITE)) { 315 if (!(mib->flag & F_WRITE)) {
350 msg->resultcode.data = 316 msg->resultcode.data =
351 P80211ENUM_resultcode_cant_set_readonly_mib; 317 P80211ENUM_resultcode_cant_set_readonly_mib;
352 goto done; 318 goto done;
353 } 319 }
354 } 320 }
355 321
356 /* 322 /*
357 ** Execute the MIB function. If things worked okay, then make 323 ** Execute the MIB function. If things worked okay, then make
358 ** sure that the MIB function also worked okay. If so, and this 324 ** sure that the MIB function also worked okay. If so, and this
359 ** is a "mibget", then the status value must be set for both the 325 ** is a "mibget", then the status value must be set for both the
360 ** "mibattribute" parameter and the mib item within the data 326 ** "mibattribute" parameter and the mib item within the data
361 ** portion of the "mibattribute". 327 ** portion of the "mibattribute".
362 */ 328 */
363 329
364 result = mib->func(mib, isget, wlandev, hw, msg, 330 result = mib->func(mib, isget, wlandev, hw, msg, (void *)mibitem->data);
365 (void *) mibitem->data);
366 331
367 if (msg->resultcode.data == P80211ENUM_resultcode_success) { 332 if (msg->resultcode.data == P80211ENUM_resultcode_success) {
368 if (result != 0) { 333 if (result != 0) {
369 pr_debug("get/set failure, result=%d\n", 334 pr_debug("get/set failure, result=%d\n",
370 result); 335 result);
371 msg->resultcode.data = 336 msg->resultcode.data =
372 P80211ENUM_resultcode_implementation_failure; 337 P80211ENUM_resultcode_implementation_failure;
373 } else { 338 } else {
374 if (isget) { 339 if (isget) {
375 msg->mibattribute.status = 340 msg->mibattribute.status =
376 P80211ENUM_msgitem_status_data_ok; 341 P80211ENUM_msgitem_status_data_ok;
377 mibitem->status = 342 mibitem->status =
378 P80211ENUM_msgitem_status_data_ok; 343 P80211ENUM_msgitem_status_data_ok;
379 } 344 }
380 } 345 }
381 } 346 }
382 347
383done: 348done:
384 return(0); 349 return 0;
385} 350}
386 351
387/*---------------------------------------------------------------- 352/*----------------------------------------------------------------
@@ -409,28 +374,29 @@ done:
409* 374*
410----------------------------------------------------------------*/ 375----------------------------------------------------------------*/
411 376
412static int prism2mib_bytearea2pstr( 377static int prism2mib_bytearea2pstr(mibrec_t *mib,
413mibrec_t *mib, 378 int isget,
414int isget, 379 wlandevice_t *wlandev,
415wlandevice_t *wlandev, 380 hfa384x_t *hw,
416hfa384x_t *hw, 381 p80211msg_dot11req_mibset_t *msg,
417p80211msg_dot11req_mibset_t *msg, 382 void *data)
418void *data)
419{ 383{
420 int result; 384 int result;
421 p80211pstrd_t *pstr = (p80211pstrd_t*) data; 385 p80211pstrd_t *pstr = (p80211pstrd_t *) data;
422 u8 bytebuf[MIB_TMP_MAXLEN]; 386 u8 bytebuf[MIB_TMP_MAXLEN];
423 387
424 if (isget) { 388 if (isget) {
425 result = hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2); 389 result =
390 hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2);
426 prism2mgmt_bytearea2pstr(bytebuf, pstr, mib->parm2); 391 prism2mgmt_bytearea2pstr(bytebuf, pstr, mib->parm2);
427 } else { 392 } else {
428 memset(bytebuf, 0, mib->parm2); 393 memset(bytebuf, 0, mib->parm2);
429 prism2mgmt_pstr2bytearea(bytebuf, pstr); 394 prism2mgmt_pstr2bytearea(bytebuf, pstr);
430 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2); 395 result =
396 hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2);
431 } 397 }
432 398
433 return(result); 399 return result;
434} 400}
435 401
436/*---------------------------------------------------------------- 402/*----------------------------------------------------------------
@@ -458,18 +424,16 @@ void *data)
458* 424*
459----------------------------------------------------------------*/ 425----------------------------------------------------------------*/
460 426
461static int prism2mib_uint32( 427static int prism2mib_uint32(mibrec_t *mib,
462mibrec_t *mib, 428 int isget,
463int isget, 429 wlandevice_t *wlandev,
464wlandevice_t *wlandev, 430 hfa384x_t *hw,
465hfa384x_t *hw, 431 p80211msg_dot11req_mibset_t *msg, void *data)
466p80211msg_dot11req_mibset_t *msg,
467void *data)
468{ 432{
469 int result; 433 int result;
470 u32 *uint32 = (u32*) data; 434 u32 *uint32 = (u32 *) data;
471 u8 bytebuf[MIB_TMP_MAXLEN]; 435 u8 bytebuf[MIB_TMP_MAXLEN];
472 u16 *wordbuf = (u16*) bytebuf; 436 u16 *wordbuf = (u16 *) bytebuf;
473 437
474 if (isget) { 438 if (isget) {
475 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf); 439 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
@@ -485,7 +449,7 @@ void *data)
485 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf); 449 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
486 } 450 }
487 451
488 return(result); 452 return result;
489} 453}
490 454
491/*---------------------------------------------------------------- 455/*----------------------------------------------------------------
@@ -513,19 +477,17 @@ void *data)
513* 477*
514----------------------------------------------------------------*/ 478----------------------------------------------------------------*/
515 479
516static int prism2mib_flag( 480static int prism2mib_flag(mibrec_t *mib,
517mibrec_t *mib, 481 int isget,
518int isget, 482 wlandevice_t *wlandev,
519wlandevice_t *wlandev, 483 hfa384x_t *hw,
520hfa384x_t *hw, 484 p80211msg_dot11req_mibset_t *msg, void *data)
521p80211msg_dot11req_mibset_t *msg,
522void *data)
523{ 485{
524 int result; 486 int result;
525 u32 *uint32 = (u32*) data; 487 u32 *uint32 = (u32 *) data;
526 u8 bytebuf[MIB_TMP_MAXLEN]; 488 u8 bytebuf[MIB_TMP_MAXLEN];
527 u16 *wordbuf = (u16*) bytebuf; 489 u16 *wordbuf = (u16 *) bytebuf;
528 u32 flags; 490 u32 flags;
529 491
530 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf); 492 result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf);
531 if (result == 0) { 493 if (result == 0) {
@@ -535,7 +497,7 @@ void *data)
535 flags = *wordbuf; 497 flags = *wordbuf;
536 if (isget) { 498 if (isget) {
537 *uint32 = (flags & mib->parm2) ? 499 *uint32 = (flags & mib->parm2) ?
538 P80211ENUM_truth_true : P80211ENUM_truth_false; 500 P80211ENUM_truth_true : P80211ENUM_truth_false;
539 } else { 501 } else {
540 if ((*uint32) == P80211ENUM_truth_true) 502 if ((*uint32) == P80211ENUM_truth_true)
541 flags |= mib->parm2; 503 flags |= mib->parm2;
@@ -545,11 +507,12 @@ void *data)
545 * prism2mgmt_p80211int2prism2int(wordbuf, &flags); 507 * prism2mgmt_p80211int2prism2int(wordbuf, &flags);
546 */ 508 */
547 *wordbuf = flags; 509 *wordbuf = flags;
548 result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf); 510 result =
511 hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf);
549 } 512 }
550 } 513 }
551 514
552 return(result); 515 return result;
553} 516}
554 517
555/*---------------------------------------------------------------- 518/*----------------------------------------------------------------
@@ -577,30 +540,29 @@ void *data)
577* 540*
578----------------------------------------------------------------*/ 541----------------------------------------------------------------*/
579 542
580static int prism2mib_wepdefaultkey( 543static int prism2mib_wepdefaultkey(mibrec_t *mib,
581mibrec_t *mib, 544 int isget,
582int isget, 545 wlandevice_t *wlandev,
583wlandevice_t *wlandev, 546 hfa384x_t *hw,
584hfa384x_t *hw, 547 p80211msg_dot11req_mibset_t *msg,
585p80211msg_dot11req_mibset_t *msg, 548 void *data)
586void *data)
587{ 549{
588 int result; 550 int result;
589 p80211pstrd_t *pstr = (p80211pstrd_t*) data; 551 p80211pstrd_t *pstr = (p80211pstrd_t *) data;
590 u8 bytebuf[MIB_TMP_MAXLEN]; 552 u8 bytebuf[MIB_TMP_MAXLEN];
591 u16 len; 553 u16 len;
592 554
593 if (isget) { 555 if (isget) {
594 result = 0; /* Should never happen. */ 556 result = 0; /* Should never happen. */
595 } else { 557 } else {
596 len = (pstr->len > 5) ? HFA384x_RID_CNFWEP128DEFAULTKEY_LEN : 558 len = (pstr->len > 5) ? HFA384x_RID_CNFWEP128DEFAULTKEY_LEN :
597 HFA384x_RID_CNFWEPDEFAULTKEY_LEN; 559 HFA384x_RID_CNFWEPDEFAULTKEY_LEN;
598 memset(bytebuf, 0, len); 560 memset(bytebuf, 0, len);
599 prism2mgmt_pstr2bytearea(bytebuf, pstr); 561 prism2mgmt_pstr2bytearea(bytebuf, pstr);
600 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, len); 562 result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, len);
601 } 563 }
602 564
603 return(result); 565 return result;
604} 566}
605 567
606/*---------------------------------------------------------------- 568/*----------------------------------------------------------------
@@ -628,15 +590,14 @@ void *data)
628* 590*
629----------------------------------------------------------------*/ 591----------------------------------------------------------------*/
630 592
631static int prism2mib_privacyinvoked( 593static int prism2mib_privacyinvoked(mibrec_t *mib,
632mibrec_t *mib, 594 int isget,
633int isget, 595 wlandevice_t *wlandev,
634wlandevice_t *wlandev, 596 hfa384x_t *hw,
635hfa384x_t *hw, 597 p80211msg_dot11req_mibset_t *msg,
636p80211msg_dot11req_mibset_t *msg, 598 void *data)
637void *data)
638{ 599{
639 int result; 600 int result;
640 601
641 if (wlandev->hostwep & HOSTWEP_DECRYPT) { 602 if (wlandev->hostwep & HOSTWEP_DECRYPT) {
642 if (wlandev->hostwep & HOSTWEP_DECRYPT) 603 if (wlandev->hostwep & HOSTWEP_DECRYPT)
@@ -647,7 +608,7 @@ void *data)
647 608
648 result = prism2mib_flag(mib, isget, wlandev, hw, msg, data); 609 result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
649 610
650 return(result); 611 return result;
651} 612}
652 613
653/*---------------------------------------------------------------- 614/*----------------------------------------------------------------
@@ -675,19 +636,18 @@ void *data)
675* 636*
676----------------------------------------------------------------*/ 637----------------------------------------------------------------*/
677 638
678static int prism2mib_excludeunencrypted( 639static int prism2mib_excludeunencrypted(mibrec_t *mib,
679mibrec_t *mib, 640 int isget,
680int isget, 641 wlandevice_t *wlandev,
681wlandevice_t *wlandev, 642 hfa384x_t *hw,
682hfa384x_t *hw, 643 p80211msg_dot11req_mibset_t *msg,
683p80211msg_dot11req_mibset_t *msg, 644 void *data)
684void *data)
685{ 645{
686 int result; 646 int result;
687 647
688 result = prism2mib_flag(mib, isget, wlandev, hw, msg, data); 648 result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
689 649
690 return(result); 650 return result;
691} 651}
692 652
693/*---------------------------------------------------------------- 653/*----------------------------------------------------------------
@@ -715,28 +675,28 @@ void *data)
715* 675*
716----------------------------------------------------------------*/ 676----------------------------------------------------------------*/
717 677
718static int prism2mib_fragmentationthreshold( 678static int prism2mib_fragmentationthreshold(mibrec_t *mib,
719mibrec_t *mib, 679 int isget,
720int isget, 680 wlandevice_t *wlandev,
721wlandevice_t *wlandev, 681 hfa384x_t *hw,
722hfa384x_t *hw, 682 p80211msg_dot11req_mibset_t *msg,
723p80211msg_dot11req_mibset_t *msg, 683 void *data)
724void *data)
725{ 684{
726 int result; 685 int result;
727 u32 *uint32 = (u32*) data; 686 u32 *uint32 = (u32 *) data;
728 687
729 if (!isget) 688 if (!isget)
730 if ((*uint32) % 2) { 689 if ((*uint32) % 2) {
731 printk(KERN_WARNING "Attempt to set odd number " 690 printk(KERN_WARNING "Attempt to set odd number "
732 "FragmentationThreshold\n"); 691 "FragmentationThreshold\n");
733 msg->resultcode.data = P80211ENUM_resultcode_not_supported; 692 msg->resultcode.data =
734 return(0); 693 P80211ENUM_resultcode_not_supported;
694 return 0;
735 } 695 }
736 696
737 result = prism2mib_uint32(mib, isget, wlandev, hw, msg, data); 697 result = prism2mib_uint32(mib, isget, wlandev, hw, msg, data);
738 698
739 return(result); 699 return result;
740} 700}
741 701
742/*---------------------------------------------------------------- 702/*----------------------------------------------------------------
@@ -764,40 +724,43 @@ void *data)
764* 724*
765----------------------------------------------------------------*/ 725----------------------------------------------------------------*/
766 726
767static int prism2mib_priv( 727static int prism2mib_priv(mibrec_t *mib,
768mibrec_t *mib, 728 int isget,
769int isget, 729 wlandevice_t *wlandev,
770wlandevice_t *wlandev, 730 hfa384x_t *hw,
771hfa384x_t *hw, 731 p80211msg_dot11req_mibset_t *msg, void *data)
772p80211msg_dot11req_mibset_t *msg,
773void *data)
774{ 732{
775 p80211pstrd_t *pstr = (p80211pstrd_t*) data; 733 p80211pstrd_t *pstr = (p80211pstrd_t *) data;
776 734
777 int result; 735 int result;
778 736
779 switch (mib->did) { 737 switch (mib->did) {
780 case DIDmib_lnx_lnxConfigTable_lnxRSNAIE: { 738 case DIDmib_lnx_lnxConfigTable_lnxRSNAIE:{
781 hfa384x_WPAData_t wpa; 739 hfa384x_WPAData_t wpa;
782 if (isget) { 740 if (isget) {
783 hfa384x_drvr_getconfig( hw, HFA384x_RID_CNFWPADATA, 741 hfa384x_drvr_getconfig(hw,
784 (u8 *) &wpa, sizeof(wpa)); 742 HFA384x_RID_CNFWPADATA,
785 pstr->len = hfa384x2host_16(wpa.datalen); 743 (u8 *)&wpa,
786 memcpy(pstr->data, wpa.data, pstr->len); 744 sizeof(wpa));
787 } else { 745 pstr->len = hfa384x2host_16(wpa.datalen);
788 wpa.datalen = host2hfa384x_16(pstr->len); 746 memcpy(pstr->data, wpa.data, pstr->len);
789 memcpy(wpa.data, pstr->data, pstr->len); 747 } else {
790 748 wpa.datalen = host2hfa384x_16(pstr->len);
791 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFWPADATA, 749 memcpy(wpa.data, pstr->data, pstr->len);
792 (u8 *) &wpa, sizeof(wpa)); 750
751 result =
752 hfa384x_drvr_setconfig(hw,
753 HFA384x_RID_CNFWPADATA,
754 (u8 *)&wpa,
755 sizeof(wpa));
756 }
757 break;
793 } 758 }
794 break;
795 }
796 default: 759 default:
797 printk(KERN_ERR "Unhandled DID 0x%08x\n", mib->did); 760 printk(KERN_ERR "Unhandled DID 0x%08x\n", mib->did);
798 } 761 }
799 762
800 return(0); 763 return 0;
801} 764}
802 765
803/*---------------------------------------------------------------- 766/*----------------------------------------------------------------
@@ -817,11 +780,10 @@ void *data)
817 780
818void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr) 781void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
819{ 782{
820 bytestr->len = host2hfa384x_16((u16)(pstr->len)); 783 bytestr->len = host2hfa384x_16((u16) (pstr->len));
821 memcpy(bytestr->data, pstr->data, pstr->len); 784 memcpy(bytestr->data, pstr->data, pstr->len);
822} 785}
823 786
824
825/*---------------------------------------------------------------- 787/*----------------------------------------------------------------
826* prism2mgmt_pstr2bytearea 788* prism2mgmt_pstr2bytearea
827* 789*
@@ -842,7 +804,6 @@ void prism2mgmt_pstr2bytearea(u8 *bytearea, p80211pstrd_t *pstr)
842 memcpy(bytearea, pstr->data, pstr->len); 804 memcpy(bytearea, pstr->data, pstr->len);
843} 805}
844 806
845
846/*---------------------------------------------------------------- 807/*----------------------------------------------------------------
847* prism2mgmt_bytestr2pstr 808* prism2mgmt_bytestr2pstr
848* 809*
@@ -860,11 +821,10 @@ void prism2mgmt_pstr2bytearea(u8 *bytearea, p80211pstrd_t *pstr)
860 821
861void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr) 822void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
862{ 823{
863 pstr->len = (u8)(hfa384x2host_16((u16)(bytestr->len))); 824 pstr->len = (u8) (hfa384x2host_16((u16) (bytestr->len)));
864 memcpy(pstr->data, bytestr->data, pstr->len); 825 memcpy(pstr->data, bytestr->data, pstr->len);
865} 826}
866 827
867
868/*---------------------------------------------------------------- 828/*----------------------------------------------------------------
869* prism2mgmt_bytearea2pstr 829* prism2mgmt_bytearea2pstr
870* 830*
@@ -882,11 +842,10 @@ void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
882 842
883void prism2mgmt_bytearea2pstr(u8 *bytearea, p80211pstrd_t *pstr, int len) 843void prism2mgmt_bytearea2pstr(u8 *bytearea, p80211pstrd_t *pstr, int len)
884{ 844{
885 pstr->len = (u8)len; 845 pstr->len = (u8) len;
886 memcpy(pstr->data, bytearea, len); 846 memcpy(pstr->data, bytearea, len);
887} 847}
888 848
889
890/*---------------------------------------------------------------- 849/*----------------------------------------------------------------
891* prism2mgmt_prism2int2p80211int 850* prism2mgmt_prism2int2p80211int
892* 851*
@@ -903,10 +862,9 @@ void prism2mgmt_bytearea2pstr(u8 *bytearea, p80211pstrd_t *pstr, int len)
903 862
904void prism2mgmt_prism2int2p80211int(u16 *prism2int, u32 *wlanint) 863void prism2mgmt_prism2int2p80211int(u16 *prism2int, u32 *wlanint)
905{ 864{
906 *wlanint = (u32)hfa384x2host_16(*prism2int); 865 *wlanint = (u32) hfa384x2host_16(*prism2int);
907} 866}
908 867
909
910/*---------------------------------------------------------------- 868/*----------------------------------------------------------------
911* prism2mgmt_p80211int2prism2int 869* prism2mgmt_p80211int2prism2int
912* 870*
@@ -923,10 +881,9 @@ void prism2mgmt_prism2int2p80211int(u16 *prism2int, u32 *wlanint)
923 881
924void prism2mgmt_p80211int2prism2int(u16 *prism2int, u32 *wlanint) 882void prism2mgmt_p80211int2prism2int(u16 *prism2int, u32 *wlanint)
925{ 883{
926 *prism2int = host2hfa384x_16((u16)(*wlanint)); 884 *prism2int = host2hfa384x_16((u16) (*wlanint));
927} 885}
928 886
929
930/*---------------------------------------------------------------- 887/*----------------------------------------------------------------
931* prism2mgmt_prism2enum2p80211enum 888* prism2mgmt_prism2enum2p80211enum
932* 889*
@@ -944,12 +901,11 @@ void prism2mgmt_p80211int2prism2int(u16 *prism2int, u32 *wlanint)
944void prism2mgmt_prism2enum2p80211enum(u16 *prism2enum, u32 *wlanenum, u16 rid) 901void prism2mgmt_prism2enum2p80211enum(u16 *prism2enum, u32 *wlanenum, u16 rid)
945{ 902{
946 /* At the moment, the need for this functionality hasn't 903 /* At the moment, the need for this functionality hasn't
947 presented itself. All the wlan enumerated values are 904 presented itself. All the wlan enumerated values are
948 a 1-to-1 match against the Prism2 enumerated values*/ 905 a 1-to-1 match against the Prism2 enumerated values */
949 return; 906 return;
950} 907}
951 908
952
953/*---------------------------------------------------------------- 909/*----------------------------------------------------------------
954* prism2mgmt_p80211enum2prism2enum 910* prism2mgmt_p80211enum2prism2enum
955* 911*
@@ -967,13 +923,11 @@ void prism2mgmt_prism2enum2p80211enum(u16 *prism2enum, u32 *wlanenum, u16 rid)
967void prism2mgmt_p80211enum2prism2enum(u16 *prism2enum, u32 *wlanenum, u16 rid) 923void prism2mgmt_p80211enum2prism2enum(u16 *prism2enum, u32 *wlanenum, u16 rid)
968{ 924{
969 /* At the moment, the need for this functionality hasn't 925 /* At the moment, the need for this functionality hasn't
970 presented itself. All the wlan enumerated values are 926 presented itself. All the wlan enumerated values are
971 a 1-to-1 match against the Prism2 enumerated values*/ 927 a 1-to-1 match against the Prism2 enumerated values */
972 return; 928 return;
973} 929}
974 930
975
976
977/*---------------------------------------------------------------- 931/*----------------------------------------------------------------
978* prism2mgmt_get_oprateset 932* prism2mgmt_get_oprateset
979* 933*
@@ -989,37 +943,37 @@ void prism2mgmt_p80211enum2prism2enum(u16 *prism2enum, u32 *wlanenum, u16 rid)
989----------------------------------------------------------------*/ 943----------------------------------------------------------------*/
990void prism2mgmt_get_oprateset(u16 *rate, p80211pstrd_t *pstr) 944void prism2mgmt_get_oprateset(u16 *rate, p80211pstrd_t *pstr)
991{ 945{
992 u8 len; 946 u8 len;
993 u8 *datarate; 947 u8 *datarate;
994 948
995 len = 0; 949 len = 0;
996 datarate = pstr->data; 950 datarate = pstr->data;
997 951
998 /* 1 Mbps */ 952 /* 1 Mbps */
999 if ( BIT(0) & (*rate) ) { 953 if (BIT(0) & (*rate)) {
1000 len += (u8)1; 954 len += (u8) 1;
1001 *datarate = (u8)2; 955 *datarate = (u8) 2;
1002 datarate++; 956 datarate++;
1003 } 957 }
1004 958
1005 /* 2 Mbps */ 959 /* 2 Mbps */
1006 if ( BIT(1) & (*rate) ) { 960 if (BIT(1) & (*rate)) {
1007 len += (u8)1; 961 len += (u8) 1;
1008 *datarate = (u8)4; 962 *datarate = (u8) 4;
1009 datarate++; 963 datarate++;
1010 } 964 }
1011 965
1012 /* 5.5 Mbps */ 966 /* 5.5 Mbps */
1013 if ( BIT(2) & (*rate) ) { 967 if (BIT(2) & (*rate)) {
1014 len += (u8)1; 968 len += (u8) 1;
1015 *datarate = (u8)11; 969 *datarate = (u8) 11;
1016 datarate++; 970 datarate++;
1017 } 971 }
1018 972
1019 /* 11 Mbps */ 973 /* 11 Mbps */
1020 if ( BIT(3) & (*rate) ) { 974 if (BIT(3) & (*rate)) {
1021 len += (u8)1; 975 len += (u8) 1;
1022 *datarate = (u8)22; 976 *datarate = (u8) 22;
1023 datarate++; 977 datarate++;
1024 } 978 }
1025 979
@@ -1028,8 +982,6 @@ void prism2mgmt_get_oprateset(u16 *rate, p80211pstrd_t *pstr)
1028 return; 982 return;
1029} 983}
1030 984
1031
1032
1033/*---------------------------------------------------------------- 985/*----------------------------------------------------------------
1034* prism2mgmt_set_oprateset 986* prism2mgmt_set_oprateset
1035* 987*
@@ -1045,30 +997,30 @@ void prism2mgmt_get_oprateset(u16 *rate, p80211pstrd_t *pstr)
1045----------------------------------------------------------------*/ 997----------------------------------------------------------------*/
1046void prism2mgmt_set_oprateset(u16 *rate, p80211pstrd_t *pstr) 998void prism2mgmt_set_oprateset(u16 *rate, p80211pstrd_t *pstr)
1047{ 999{
1048 u8 *datarate; 1000 u8 *datarate;
1049 int i; 1001 int i;
1050 1002
1051 *rate = 0; 1003 *rate = 0;
1052 1004
1053 datarate = pstr->data; 1005 datarate = pstr->data;
1054 1006
1055 for ( i=0; i < pstr->len; i++, datarate++ ) { 1007 for (i = 0; i < pstr->len; i++, datarate++) {
1056 switch (*datarate) { 1008 switch (*datarate) {
1057 case 2: /* 1 Mbps */ 1009 case 2: /* 1 Mbps */
1058 *rate |= BIT(0); 1010 *rate |= BIT(0);
1059 break; 1011 break;
1060 case 4: /* 2 Mbps */ 1012 case 4: /* 2 Mbps */
1061 *rate |= BIT(1); 1013 *rate |= BIT(1);
1062 break; 1014 break;
1063 case 11: /* 5.5 Mbps */ 1015 case 11: /* 5.5 Mbps */
1064 *rate |= BIT(2); 1016 *rate |= BIT(2);
1065 break; 1017 break;
1066 case 22: /* 11 Mbps */ 1018 case 22: /* 11 Mbps */
1067 *rate |= BIT(3); 1019 *rate |= BIT(3);
1068 break; 1020 break;
1069 default: 1021 default:
1070 pr_debug("Unrecoginzed Rate of %d\n", 1022 pr_debug("Unrecoginzed Rate of %d\n",
1071 *datarate); 1023 *datarate);
1072 break; 1024 break;
1073 } 1025 }
1074 } 1026 }