aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/libertas/Makefile9
-rw-r--r--drivers/net/wireless/libertas/README516
-rw-r--r--drivers/net/wireless/libertas/assoc.c41
-rw-r--r--drivers/net/wireless/libertas/cmd.c23
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c4
-rw-r--r--drivers/net/wireless/libertas/debugfs.c31
-rw-r--r--drivers/net/wireless/libertas/defs.h52
-rw-r--r--drivers/net/wireless/libertas/dev.h14
-rw-r--r--drivers/net/wireless/libertas/fw.c9
-rw-r--r--drivers/net/wireless/libertas/if_usb.c5
-rw-r--r--drivers/net/wireless/libertas/if_usb.h2
-rw-r--r--drivers/net/wireless/libertas/ioctl.c1529
-rw-r--r--drivers/net/wireless/libertas/join.c194
-rw-r--r--drivers/net/wireless/libertas/join.h7
-rw-r--r--drivers/net/wireless/libertas/main.c7
-rw-r--r--drivers/net/wireless/libertas/rx.c4
-rw-r--r--drivers/net/wireless/libertas/scan.c203
-rw-r--r--drivers/net/wireless/libertas/scan.h22
-rw-r--r--drivers/net/wireless/libertas/tx.c2
-rw-r--r--drivers/net/wireless/libertas/version.h7
-rw-r--r--drivers/net/wireless/libertas/wext.c448
-rw-r--r--drivers/net/wireless/libertas/wext.h85
22 files changed, 259 insertions, 2955 deletions
diff --git a/drivers/net/wireless/libertas/Makefile b/drivers/net/wireless/libertas/Makefile
index 19c935071d8e..56a8ea1fbf04 100644
--- a/drivers/net/wireless/libertas/Makefile
+++ b/drivers/net/wireless/libertas/Makefile
@@ -1,5 +1,3 @@
1# EXTRA_CFLAGS += -Wpacked
2
3usb8xxx-objs := main.o fw.o wext.o \ 1usb8xxx-objs := main.o fw.o wext.o \
4 rx.o tx.o cmd.o \ 2 rx.o tx.o cmd.o \
5 cmdresp.o scan.o \ 3 cmdresp.o scan.o \
@@ -7,13 +5,6 @@ usb8xxx-objs := main.o fw.o wext.o \
7 ioctl.o debugfs.o \ 5 ioctl.o debugfs.o \
8 ethtool.o assoc.o 6 ethtool.o assoc.o
9 7
10ifeq ($(CONFIG_LIBERTAS_USB_DEBUG), y)
11EXTRA_CFLAGS += -DDEBUG -DPROC_DEBUG
12endif
13
14
15# This is needed to support the newer boot2 bootloader (v >= 3104)
16EXTRA_CFLAGS += -DSUPPORT_BOOT_COMMAND
17usb8xxx-objs += if_bootcmd.o 8usb8xxx-objs += if_bootcmd.o
18usb8xxx-objs += if_usb.o 9usb8xxx-objs += if_usb.o
19 10
diff --git a/drivers/net/wireless/libertas/README b/drivers/net/wireless/libertas/README
index 688da4c784b1..378577200b56 100644
--- a/drivers/net/wireless/libertas/README
+++ b/drivers/net/wireless/libertas/README
@@ -40,64 +40,11 @@ NAME
40SYNOPSIS 40SYNOPSIS
41 iwpriv <ethX> <command> [sub-command] ... 41 iwpriv <ethX> <command> [sub-command] ...
42 42
43 iwpriv ethX version
44 iwpriv ethX scantype [sub-command]
45 iwpriv ethX getSNR <n>
46 iwpriv ethX getNF <n>
47 iwpriv ethX getRSSI <n>
48 iwpriv ethX setrxant <n>
49 iwpriv ethX getrxant
50 iwpriv ethX settxant <n>
51 iwpriv ethX gettxant
52 iwpriv ethX authalgs <n>
53 iwpriv ethX pre-TBTT <n>
54 iwpriv ethX 8021xauthalgs <n>
55 iwpriv ethX encryptionmode <n>
56 iwpriv ethX setregioncode <n> 43 iwpriv ethX setregioncode <n>
57 iwpriv ethX getregioncode 44 iwpriv ethX getregioncode
58 iwpriv ethX setbcnavg <n>
59 iwpriv ethX getbcnavg
60 iwpriv ethX setdataavg <n>
61 iwpriv ethX setlisteninter <n>
62 iwpriv ethX getlisteninter
63 iwpriv ethX setmultipledtim <n>
64 iwpriv ethX getmultipledtim
65 iwpriv ethX atimwindow <n>
66 iwpriv ethX deauth
67 iwpriv ethX adhocstop
68 iwpriv ethX radioon
69 iwpriv ethX radiooff
70 iwpriv ethX reasso-on
71 iwpriv ethX reasso-off
72 iwpriv ethX scanmode [sub-command]
73 iwpriv ethX setwpaie <n>
74 iwpriv ethX wlanidle-off
75 iwpriv ethX wlanidle-on
76 iwpriv ethX getcis
77 iwpriv ethX getlog
78 iwpriv ethX getadhocstatus
79 iwpriv ethX adhocgrate <n>
80
81Version 4 Command:
82 iwpriv ethX inactvityto <n>
83 iwpriv ethX sleeppd <n>
84 iwpriv ethX enable11d <n>
85 iwpriv ethX tpccfg <n>
86 iwpriv ethX powercfg <n>
87 iwpriv ethX setafc <n>
88 iwpriv ethX getafc
89 45
90Version 5 Command: 46Version 5 Command:
91 iwpriv ethX ledgpio <n> 47 iwpriv ethX ledgpio <n>
92 iwpriv ethX scanprobes <n>
93 iwpriv ethX lolisteninter <n>
94 iwpriv ethX rateadapt <n> <m>
95 iwpriv ethX txcontrol <n>
96 iwpriv ethX psnullinterval <n>
97 iwpriv ethX prescan <n>
98 iwpriv ethX getrxinfo
99 iwpriv ethX gettxrate
100 iwpriv ethX beaconinterval
101 48
102BT Commands: 49BT Commands:
103 The blinding table (BT) contains a list of mac addresses that should be 50 The blinding table (BT) contains a list of mac addresses that should be
@@ -150,114 +97,6 @@ DESCRIPTION
150 The ethX parameter specifies the network device that is to be used to 97 The ethX parameter specifies the network device that is to be used to
151 perform this command on. it could be eth0, eth1 etc. 98 perform this command on. it could be eth0, eth1 etc.
152 99
153version
154 This is used to get the current version of the driver and the firmware.
155
156scantype
157 This command is used to set the scan type to be used by the driver in
158 the scan command. This setting will not be used while performing a scan
159 for a specific SSID, as it is always done with scan type being active.
160
161 where the sub-commands are: -
162 active -- to set the scan type to active
163 passive -- to set the scan type to passive
164 get -- to get the scan type set in the driver
165
166getSNR
167 This command gets the average and non average value of Signal to Noise
168 Ratio of Beacon and Data.
169
170 where value is:-
171 0 -- Beacon non-average.
172 1 -- Beacon average.
173 2 -- Data non-average.
174 3 -- Data average.
175
176 If no value is given, all four values are returned in the order mentioned
177 above.
178
179 Note: This command is available only when STA is connected.
180
181getRSSI
182 This command gets the average and non average value os Receive Signal
183 Strength of Beacon and Data.
184
185 where value is:-
186 0 -- Beacon non-average.
187 1 -- Beacon average.
188 2 -- Data non-average.
189 3 -- Data average.
190
191 Note: This command is available only when STA is connected.
192
193getNF
194 This command gets the average and non average value of Noise Floor of
195 Beacon and Data.
196
197 where value is:-
198 0 -- Beacon non-average.
199 1 -- Beacon average.
200 2 -- Data non-average.
201 3 -- Data average.
202
203 Note: This command is available only when STA is connected.
204
205setrxant
206 This command is used to set the mode for Rx antenna.
207
208 The options that can be sent are:-
209 1 -- Antenna 1.
210 2 -- Antenna 2.
211 0xFFFF -- Diversity.
212
213 Usage:
214 iwpriv ethX setrxant 0x01: select Antenna 1.
215
216getrxant
217 This command is used to get the mode for Rx antenna.
218
219
220settxant
221 This command is used to set the mode for Tx antenna.
222 The options that can be sent are:-
223 1 -- Antenna 1.
224 2 -- Antenna 2.
225 0xFFFF -- Diversity.
226 Usage:
227 iwpriv ethX settxant 0x01: select Antenna 1.
228
229gettxant
230 This command is used to get the mode for Tx antenna.
231
232authalgs
233 This command is used by the WPA supplicant to set the authentication
234 algorithms in the station.
235
2368021xauthalgs
237 This command is used by the WPA supplicant to set the 8021.x authentication algorithm type
238 station.
239
240 where values can be:-
241 1 -- None
242 2 -- LEAP
243 4 -- TLS
244 8 -- TTLs
245 16 -- MD5
246
247
248encryptionmode
249 This command is used by the WPA supplicant to set the encryption algorithm.
250
251 where values can be:-
252 0 -- NONE
253 1 -- WEP40
254 2 -- TKIP
255 3 -- CCMP
256 4 -- WEP104
257
258pre-TBTT
259 This command is used to set pre-TBTT time period where value is in microseconds.
260
261setregioncode 100setregioncode
262 This command is used to set the region code in the station. 101 This command is used to set the region code in the station.
263 where value is 'region code' for various regions like 102 where value is 'region code' for various regions like
@@ -270,114 +109,6 @@ getregioncode
270 This command is used to get the region code information set in the 109 This command is used to get the region code information set in the
271 station. 110 station.
272 111
273setbcnavg
274 Set the weighting factor for calculating RSSI.
275
276getbcnavg
277 Get weighting factor for calculating RSSI.
278
279setdataavg
280 Set the weighting factor for calculating SNR.
281
282setlisteninter
283 This command is used to set the listen interval in the
284 station.
285
286 where the value ranges between 1 - 255
287
288getlisteninter
289 This command is used to get the listen interval value set in the
290 station.
291
292setmultipledtim
293 This command is used to set the multiple dtim value in the
294 station.
295 where the value is 1,2,3,4,5,0xfffe
296 0xfffe means the firmware will use listen interval in association
297 command for waking up
298
299getmultipledtim
300 This command is used to get the multiple dtim value set in the station.
301
302atimwindow
303 This command is used to set the atim value in the
304 station.
305
306 where the value ranges between 0 - 50
307
308deauth
309 This command is used to send the de-authentication to the AP with which
310 the station is associated. This command is valid only when
311 station is in Infrastructure mode.
312
313 Note: This command is available only when STA is connected.
314
315adhocstop
316 This command is used to stop beacon transmission from the station and
317 go into idle state in ad-hoc mode.
318
319 Note: This command is available only when STA is connected.
320
321radioon
322 This command is used to turn on the RF antenna.
323
324radiooff
325 This command is sued to turn off the RF antenna.
326
327scanmode
328 This command is used to set the station to scan for either IBSS
329 networks or BSS networks or both BSS and IBSS networks. This
330 command can be used with sub commands,
331
332 where the value for
333 bss -- Scan All the BSS networks.
334 ibss -- Scan All the IBSS networks.
335 any -- Scan both BSS and IBSS networks.
336
337
338
339setwpaie
340 This command is used by WPA supplicant to send the WPA-IE to the driver.
341
342wlanidle-off
343 This command is used to get into idle state.
344
345 Note: This command is available only when STA is connected.
346
347wlanidle-on
348 This command is used to get off the idle state.
349
350 Note: This command is available only when STA is connected.
351
352
353getlog
354 This command is used to get the 802.11 statistics available in the
355 station.
356
357 Note: This command is available only when STA is connected.
358
359getadhocstatus
360 This command is used to get the ad-hoc Network Status.
361
362 The various status codes are:
363 AdhocStarted
364 AdhocJoined
365 AdhocIdle
366 InfraMode
367 AutoUnknownMode
368
369 Note: This command is available only when STA is connected.
370
371adhocgrate
372 This command is used to enable(1) g_rate, Disable(0) g_rate
373 and request(2) the status which g_rate is disabled/enabled,
374 for Ad-hoc creator.
375
376 where value is:-
377 0 -- Disabled
378 1 -- Enabled
379 2 -- Get
380
381ledgpio 112ledgpio
382 This command is used to set/get LEDs. 113 This command is used to set/get LEDs.
383 114
@@ -400,253 +131,6 @@ ledgpio
400 Note: LED0 is invalid 131 Note: LED0 is invalid
401 Note: Maximum Number of LEDs are 16. 132 Note: Maximum Number of LEDs are 16.
402 133
403inactivityto
404 This command is used by the host to set/get the inactivity timeout value,
405 which specifies when WLAN device is put to sleep.
406
407 Usage:
408 iwpriv ethX inactivityto [<timeout>]
409
410 where the parameter are:
411 timeout: timeout value in milliseconds.
412
413 Example:
414 iwpriv eth1 inactivityto
415 "get the timeout value"
416
417 iwpriv eth1 inactivityto X
418 "set timeout value to X ms"
419
420
421sleeppd
422 This command is used to configure the sleep period of the WLAN device.
423
424 Usage:
425 iwpriv ethX sleeppd [<sleep period>]
426
427 where the parameter are:
428 Period: sleep period in milliseconds. Range 10~60.
429
430 Example:
431 iwpriv eth1 sleeppd 10
432 "set period as 10 ms"
433 iwpriv eth1 sleeppd
434 "get the sleep period configuration"
435
436enable11d
437 This command is used to control 11d
438 where value is:-
439 1 -- Enabled
440 0 -- Disabled
441 2 -- Get
442
443
444
445
446tpccfg
447 Enables or disables automatic transmit power control.
448
449 The first parameter turns this feature on (1) or off (0). When turning
450 on, the user must also supply four more parameters in the following
451 order:
452 -UseSNR (Use SNR (in addition to PER) for TPC algorithm),
453 -P0 (P0 power level for TPC),
454 -P1 (P1 power level for TPC),
455 -P2 (P2 power level for TPC).
456
457 Usage:
458 iwpriv ethX tpccfg: Get current configuration
459 iwpriv ethX tpccfg 0: disable auto TPC
460 iwpriv ethX tpccfg 0x01 0x00 0x05 0x0a 0x0d: enable auto TPC; do not use SNR;
461 P0=0x05; P1=0x0a; P2=0x0d;
462 iwpriv ethX tpccfg 0x01 0x01 0x05 0x0a 0x0d: enable auto TPC; use SNR;
463 P0=0x05; P1=0x0a; P2=0x0d.
464
465powercfg
466 Enables or disables power adaptation.
467
468 The first parameter turns this feature on (1) or off (0). When turning
469 on, the user must also supply three more parameters in the following
470 order:
471 -P0 (P0 power level for Power Adaptation),
472 -P1 (P1 power level for Power Adaptation),
473 -P2 (P2 power level for Power Adaptation).
474
475 Usage:
476 iwpriv ethX powercfg: Get current configuration
477 iwpriv ethX powercfg 0: disable power adaptation
478 iwpriv ethX powercfg 1 0x0d 0x0f 0x12: enable power adaptation;
479 P0=0x0d; P1=0x0f; P2=0x12.
480
481getafc
482 This command returns automatic frequency control parameters. It returns
483 three integers:
484 -P0: automatic is on (1), or off (0),
485 -P1: current timing offset in PPM (part per million), and
486 -P2: current frequency offset in PPM.
487
488setafc
489 Set automatic frequency control options.
490
491 The first parameter turns automatic on (1) or off (0).
492 The user must supply two more parameters in either case, in the following
493 order:
494
495 When auto is on:
496
497 -P0 (automatic adjustment frequency threshold in PPM),
498 -P1 (automatic adjustment period in beacon period),
499
500 When auto is off:
501
502 -P0 (manual adjustment timing offset in PPM), and
503 -P1 (manual adjustment frequency offset in PPM).
504
505 Usage:
506 iwpriv ethX setafc 0 10 10: manual adjustment, both timing and frequcncy
507 offset are 10 PPM.
508
509 iwpriv ethX setafc 1 10 10 enable afc, automatic adjustment,
510 frequency threshold 10 PPM, for every 10 beacon periods.
511
512
513
514scanprobes
515 This command sets number of probe requests per channel.
516
517 Usage:
518 iwpriv ethX scanprobes 3 (set scan probes to 3)
519 iwpriv ethX scanprobes (get scan probes)
520
521lolisteninter
522 This command sets the value of listen interval.
523
524 Usage:
525 iwpriv ethX lolisteninter 234 (set the lolisteninter to 234)
526 iwpriv ethX lolisteninter (get the lolisteninter value)
527
528rateadapt
529 This command sets the data rates bitmap.
530 Where <n>
531 0: Disable auto rate adapt
532 1: Enable auto rate adapt
533
534 <m>
535 data rate bitmap
536 Bit Data rate
537 0 1 Mbps
538 1 2 Mbps
539 2 5.5 Mbps
540 3 11 Mbps
541 4 Reserved
542 5 6 Mbps
543 6 9 Mbps
544 7 12 Mbps
545 8 18 Mbps
546 9 24 Mbps
547 10 36 Mbps
548 11 48 Mbps
549 12 54 Mbps
550 12-15 Reserved
551
552 Usage:
553 iwpriv ethX rateadapt
554 read the currect data rate setting
555 iwpriv ethX rateadapt 1 0x07
556 enable auto data rate adapt and
557 data rates are 1Mbps, 2Mbsp and 5.5Mbps
558
559
560txcontrol
561 This command is used to set the Tx rate, ack policy, and retry limit on a per packet basis.
562
563 Where value <n> is:
564 if bit[4] == 1:
565 bit[3:0] -- 0 1 2 3 4 5 6 7 8 9 10 11 12 13-16
566 Data Rate(Mbps) -- 1 2 5.5 11 Rsv 6 9 12 18 24 36 48 54 Rsv
567
568 bit[12:8]
569 if bit[12] == 1, bit[11:8] specifies the Tx retry limit.
570
571 bit[14:13] specifies per packet ack policy:
572 bit[14:13]
573 1 0 use immediate ack policy for this packet
574 1 1 use no ack policy for this packet
575 0 x use the per-packet ack policy setting
576
577 Usage:
578 iwpriv ethX txcontrol 0x7513
579 Use no-ack policy, 5 retires for Tx, 11Mbps rate
580
581
582
583psnullinterval
584 This command is used to set/request NULL package interval for Power Save
585 under infrastructure mode.
586
587 where value is:-
588 -1 -- Disabled
589 n>0 -- Set interval as n (seconds)
590
591prescan
592 This command is used to enable (1)/disable(0) auto prescan before assoicate to the ap
593
594 where value is:-
595 0 -- Disabled
596 1 -- Enabled
597 2 -- Get
598
599getrxinfo
600 This command gets non average value of Signal to Noise Ratio of Data and rate index.
601
602 The following table shows RateIndex and Rate
603
604 RateIndex Data rate
605 0 1 Mbps
606 1 2 Mbps
607 2 5.5 Mbps
608 3 11 Mbps
609 4 Reserved
610 5 6 Mbps
611 6 9 Mbps
612 7 12 Mbps
613 8 18 Mbps
614 9 24 Mbps
615 10 36 Mbps
616 11 48 Mbps
617 12 54 Mbps
618 13-15 Reserved
619
620gettxrate
621 This command gets current Tx rate index of the first packet associated with Rate Adaptation.
622
623 The following table shows RateIndex and Rate
624
625 RateIndex Data rate
626 0 1 Mbps
627 1 2 Mbps
628 2 5.5 Mbps
629 3 11 Mbps
630 4 Reserved
631 5 6 Mbps
632 6 9 Mbps
633 7 12 Mbps
634 8 18 Mbps
635 9 24 Mbps
636 10 36 Mbps
637 11 48 Mbps
638 12 54 Mbps
639 13-15 Reserved
640
641bcninterval
642 This command is used to sets beacon interval in adhoc mode when an argument is given, and gets current adhoc
643 beacon interval when no argument is given. The valid beacon interval is between 20 - 1000,
644 default beacon interval is 100.
645
646 Usage:
647 iwpriv ethX bcninterval 100 (set adhoc beacon interval to 100)
648 iwpriv ethX bcninterval (get adhoc beacon interval)
649
650fwt_add 134fwt_add
651 This command is used to insert an entry into the FWT table. The list of 135 This command is used to insert an entry into the FWT table. The list of
652 parameters must follow the following structure: 136 parameters must follow the following structure:
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index b55c7f57aca8..c260bd1b3d46 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -23,13 +23,13 @@ static int assoc_helper_essid(wlan_private *priv,
23 ENTER(); 23 ENTER();
24 24
25 lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid); 25 lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid);
26 if (assoc_req->mode == wlan802_11infrastructure) { 26 if (assoc_req->mode == IW_MODE_INFRA) {
27 if (adapter->prescan) { 27 if (adapter->prescan) {
28 libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1); 28 libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1);
29 } 29 }
30 30
31 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, 31 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid,
32 NULL, wlan802_11infrastructure); 32 NULL, IW_MODE_INFRA);
33 if (i >= 0) { 33 if (i >= 0) {
34 lbs_pr_debug(1, 34 lbs_pr_debug(1,
35 "SSID found in scan list ... associating...\n"); 35 "SSID found in scan list ... associating...\n");
@@ -44,7 +44,7 @@ static int assoc_helper_essid(wlan_private *priv,
44 lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n", 44 lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n",
45 assoc_req->ssid.ssid); 45 assoc_req->ssid.ssid);
46 } 46 }
47 } else if (assoc_req->mode == wlan802_11ibss) { 47 } else if (assoc_req->mode == IW_MODE_ADHOC) {
48 /* Scan for the network, do not save previous results. Stale 48 /* Scan for the network, do not save previous results. Stale
49 * scan data will cause us to join a non-existant adhoc network 49 * scan data will cause us to join a non-existant adhoc network
50 */ 50 */
@@ -52,7 +52,7 @@ static int assoc_helper_essid(wlan_private *priv,
52 52
53 /* Search for the requested SSID in the scan table */ 53 /* Search for the requested SSID in the scan table */
54 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL, 54 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL,
55 wlan802_11ibss); 55 IW_MODE_ADHOC);
56 if (i >= 0) { 56 if (i >= 0) {
57 lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret); 57 lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret);
58 libertas_join_adhoc_network(priv, &adapter->scantable[i]); 58 libertas_join_adhoc_network(priv, &adapter->scantable[i]);
@@ -90,10 +90,10 @@ static int assoc_helper_bssid(wlan_private *priv,
90 goto out; 90 goto out;
91 } 91 }
92 92
93 if (assoc_req->mode == wlan802_11infrastructure) { 93 if (assoc_req->mode == IW_MODE_INFRA) {
94 ret = wlan_associate(priv, &adapter->scantable[i]); 94 ret = wlan_associate(priv, &adapter->scantable[i]);
95 lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret); 95 lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret);
96 } else if (assoc_req->mode == wlan802_11ibss) { 96 } else if (assoc_req->mode == IW_MODE_ADHOC) {
97 libertas_join_adhoc_network(priv, &adapter->scantable[i]); 97 libertas_join_adhoc_network(priv, &adapter->scantable[i]);
98 } 98 }
99 memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid, 99 memcpy(&assoc_req->ssid, &adapter->scantable[i].ssid,
@@ -142,23 +142,23 @@ static int assoc_helper_mode(wlan_private *priv,
142 142
143 ENTER(); 143 ENTER();
144 144
145 if (assoc_req->mode == adapter->inframode) { 145 if (assoc_req->mode == adapter->mode) {
146 LEAVE(); 146 LEAVE();
147 return 0; 147 return 0;
148 } 148 }
149 149
150 if (assoc_req->mode == wlan802_11infrastructure) { 150 if (assoc_req->mode == IW_MODE_INFRA) {
151 if (adapter->psstate != PS_STATE_FULL_POWER) 151 if (adapter->psstate != PS_STATE_FULL_POWER)
152 libertas_ps_wakeup(priv, cmd_option_waitforrsp); 152 libertas_ps_wakeup(priv, cmd_option_waitforrsp);
153 adapter->psmode = wlan802_11powermodecam; 153 adapter->psmode = wlan802_11powermodecam;
154 } 154 }
155 155
156 adapter->inframode = assoc_req->mode; 156 adapter->mode = assoc_req->mode;
157 ret = libertas_prepare_and_send_command(priv, 157 ret = libertas_prepare_and_send_command(priv,
158 cmd_802_11_snmp_mib, 158 cmd_802_11_snmp_mib,
159 0, cmd_option_waitforrsp, 159 0, cmd_option_waitforrsp,
160 OID_802_11_INFRASTRUCTURE_MODE, 160 OID_802_11_INFRASTRUCTURE_MODE,
161 (void *) assoc_req->mode); 161 (void *) (size_t) assoc_req->mode);
162 162
163 LEAVE(); 163 LEAVE();
164 return ret; 164 return ret;
@@ -196,7 +196,7 @@ static int assoc_helper_wep_keys(wlan_private *priv,
196 goto out; 196 goto out;
197 197
198 /* enable/disable the MAC's WEP packet filter */ 198 /* enable/disable the MAC's WEP packet filter */
199 if (assoc_req->secinfo.WEPstatus == wlan802_11WEPenabled) 199 if (assoc_req->secinfo.wep_enabled)
200 adapter->currentpacketfilter |= cmd_act_mac_wep_enable; 200 adapter->currentpacketfilter |= cmd_act_mac_wep_enable;
201 else 201 else
202 adapter->currentpacketfilter &= ~cmd_act_mac_wep_enable; 202 adapter->currentpacketfilter &= ~cmd_act_mac_wep_enable;
@@ -300,8 +300,7 @@ static int should_deauth_infrastructure(wlan_adapter *adapter,
300 } 300 }
301 301
302 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { 302 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
303 if (adapter->secinfo.authmode != 303 if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) {
304 assoc_req->secinfo.authmode) {
305 lbs_pr_debug(1, "Deauthenticating due to updated security " 304 lbs_pr_debug(1, "Deauthenticating due to updated security "
306 "info in configuration request.\n"); 305 "info in configuration request.\n");
307 return 1; 306 return 1;
@@ -316,7 +315,7 @@ static int should_deauth_infrastructure(wlan_adapter *adapter,
316 315
317 /* FIXME: deal with 'auto' mode somehow */ 316 /* FIXME: deal with 'auto' mode somehow */
318 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { 317 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
319 if (assoc_req->mode != wlan802_11infrastructure) 318 if (assoc_req->mode != IW_MODE_INFRA)
320 return 1; 319 return 1;
321 } 320 }
322 321
@@ -333,12 +332,12 @@ static int should_stop_adhoc(wlan_adapter *adapter,
333 if (adapter->curbssparams.ssid.ssidlength != assoc_req->ssid.ssidlength) 332 if (adapter->curbssparams.ssid.ssidlength != assoc_req->ssid.ssidlength)
334 return 1; 333 return 1;
335 if (memcmp(adapter->curbssparams.ssid.ssid, assoc_req->ssid.ssid, 334 if (memcmp(adapter->curbssparams.ssid.ssid, assoc_req->ssid.ssid,
336 sizeof(struct WLAN_802_11_SSID))) 335 adapter->curbssparams.ssid.ssidlength))
337 return 1; 336 return 1;
338 337
339 /* FIXME: deal with 'auto' mode somehow */ 338 /* FIXME: deal with 'auto' mode somehow */
340 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { 339 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
341 if (assoc_req->mode != wlan802_11ibss) 340 if (assoc_req->mode != IW_MODE_ADHOC)
342 return 1; 341 return 1;
343 } 342 }
344 343
@@ -382,7 +381,7 @@ void wlan_association_worker(struct work_struct *work)
382 } 381 }
383 382
384 if (find_any_ssid) { 383 if (find_any_ssid) {
385 enum WLAN_802_11_NETWORK_INFRASTRUCTURE new_mode; 384 u8 new_mode;
386 385
387 ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid, 386 ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid,
388 assoc_req->mode, &new_mode); 387 assoc_req->mode, &new_mode);
@@ -393,7 +392,7 @@ void wlan_association_worker(struct work_struct *work)
393 } 392 }
394 393
395 /* Ensure we switch to the mode of the AP */ 394 /* Ensure we switch to the mode of the AP */
396 if (assoc_req->mode == wlan802_11autounknown) { 395 if (assoc_req->mode == IW_MODE_AUTO) {
397 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); 396 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags);
398 assoc_req->mode = new_mode; 397 assoc_req->mode = new_mode;
399 } 398 }
@@ -403,7 +402,7 @@ void wlan_association_worker(struct work_struct *work)
403 * Check if the attributes being changing require deauthentication 402 * Check if the attributes being changing require deauthentication
404 * from the currently associated infrastructure access point. 403 * from the currently associated infrastructure access point.
405 */ 404 */
406 if (adapter->inframode == wlan802_11infrastructure) { 405 if (adapter->mode == IW_MODE_INFRA) {
407 if (should_deauth_infrastructure(adapter, assoc_req)) { 406 if (should_deauth_infrastructure(adapter, assoc_req)) {
408 ret = libertas_send_deauthentication(priv); 407 ret = libertas_send_deauthentication(priv);
409 if (ret) { 408 if (ret) {
@@ -412,7 +411,7 @@ void wlan_association_worker(struct work_struct *work)
412 ret); 411 ret);
413 } 412 }
414 } 413 }
415 } else if (adapter->inframode == wlan802_11ibss) { 414 } else if (adapter->mode == IW_MODE_ADHOC) {
416 if (should_stop_adhoc(adapter, assoc_req)) { 415 if (should_stop_adhoc(adapter, assoc_req)) {
417 ret = libertas_stop_adhoc_network(priv); 416 ret = libertas_stop_adhoc_network(priv);
418 if (ret) { 417 if (ret) {
@@ -543,7 +542,7 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
543 assoc_req->channel = adapter->curbssparams.channel; 542 assoc_req->channel = adapter->curbssparams.channel;
544 543
545 if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) 544 if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags))
546 assoc_req->mode = adapter->inframode; 545 assoc_req->mode = adapter->mode;
547 546
548 if (!test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { 547 if (!test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
549 memcpy(&assoc_req->bssid, adapter->curbssparams.bssid, 548 memcpy(&assoc_req->bssid, adapter->curbssparams.bssid,
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index bfdac58b5c06..de9cb46a70ff 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -381,15 +381,16 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
381 switch (cmd_oid) { 381 switch (cmd_oid) {
382 case OID_802_11_INFRASTRUCTURE_MODE: 382 case OID_802_11_INFRASTRUCTURE_MODE:
383 { 383 {
384 enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode = 384 u8 mode = (u8) (size_t) pdata_buf;
385 (enum WLAN_802_11_NETWORK_INFRASTRUCTURE) pdata_buf;
386 pSNMPMIB->querytype = cpu_to_le16(cmd_act_set); 385 pSNMPMIB->querytype = cpu_to_le16(cmd_act_set);
387 pSNMPMIB->oid = cpu_to_le16((u16) desired_bsstype_i); 386 pSNMPMIB->oid = cpu_to_le16((u16) desired_bsstype_i);
388 pSNMPMIB->bufsize = sizeof(u8); 387 pSNMPMIB->bufsize = sizeof(u8);
389 if (mode == wlan802_11infrastructure) 388 if (mode == IW_MODE_ADHOC) {
390 ucTemp = SNMP_MIB_VALUE_INFRA;
391 else
392 ucTemp = SNMP_MIB_VALUE_ADHOC; 389 ucTemp = SNMP_MIB_VALUE_ADHOC;
390 } else {
391 /* Infra and Auto modes */
392 ucTemp = SNMP_MIB_VALUE_INFRA;
393 }
393 394
394 memmove(pSNMPMIB->value, &ucTemp, sizeof(u8)); 395 memmove(pSNMPMIB->value, &ucTemp, sizeof(u8));
395 396
@@ -947,8 +948,8 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
947 948
948 spin_unlock_irqrestore(&adapter->driver_lock, flags); 949 spin_unlock_irqrestore(&adapter->driver_lock, flags);
949 950
950 lbs_pr_debug(1, "QUEUE_CMD: Inserted node=0x%x, cmd=0x%x in cmdpendingq\n", 951 lbs_pr_debug(1, "QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n",
951 (u32) cmdnode, 952 cmdnode,
952 ((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command); 953 ((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command);
953 954
954done: 955done:
@@ -976,8 +977,8 @@ static int DownloadcommandToStation(wlan_private * priv,
976 ENTER(); 977 ENTER();
977 978
978 if (!adapter || !cmdnode) { 979 if (!adapter || !cmdnode) {
979 lbs_pr_debug(1, "DNLD_CMD: adapter = %#x, cmdnode = %#x\n", 980 lbs_pr_debug(1, "DNLD_CMD: adapter = %p, cmdnode = %p\n",
980 (int)adapter, (int)cmdnode); 981 adapter, cmdnode);
981 if (cmdnode) { 982 if (cmdnode) {
982 spin_lock_irqsave(&adapter->driver_lock, flags); 983 spin_lock_irqsave(&adapter->driver_lock, flags);
983 __libertas_cleanup_and_insert_cmd(priv, cmdnode); 984 __libertas_cleanup_and_insert_cmd(priv, cmdnode);
@@ -1174,8 +1175,8 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1174 1175
1175 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; 1176 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
1176 1177
1177 lbs_pr_debug(1, "PREP_CMD: Val of cmd ptr =0x%x, command=0x%X\n", 1178 lbs_pr_debug(1, "PREP_CMD: Val of cmd ptr=%p, command=0x%X\n",
1178 (u32) cmdptr, cmd_no); 1179 cmdptr, cmd_no);
1179 1180
1180 if (!cmdptr) { 1181 if (!cmdptr) {
1181 lbs_pr_debug(1, "PREP_CMD: bufvirtualaddr of cmdnode is NULL\n"); 1182 lbs_pr_debug(1, "PREP_CMD: bufvirtualaddr of cmdnode is NULL\n");
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index cdb012c7e9cf..c86454034b58 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -72,8 +72,6 @@ void libertas_mac_event_disconnected(wlan_private * priv)
72 adapter->secinfo.WPAenabled = 0; 72 adapter->secinfo.WPAenabled = 0;
73 adapter->secinfo.WPA2enabled = 0; 73 adapter->secinfo.WPA2enabled = 0;
74 adapter->wpa_ie_len = 0; 74 adapter->wpa_ie_len = 0;
75 adapter->secinfo.auth1xalg = WLAN_1X_AUTH_ALG_NONE;
76 adapter->secinfo.Encryptionmode = CIPHER_NONE;
77 75
78 adapter->connect_status = libertas_disconnected; 76 adapter->connect_status = libertas_disconnected;
79 77
@@ -811,7 +809,7 @@ int libertas_process_rx_command(wlan_private * priv)
811 if (result) { 809 if (result) {
812 lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n", 810 lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n",
813 resp->result); 811 resp->result);
814 if (adapter->inframode == wlan802_11ibss) { 812 if (adapter->mode == IW_MODE_ADHOC) {
815 /* 813 /*
816 * We should not re-try enter-ps command in 814 * We should not re-try enter-ps command in
817 * ad-hoc mode. It takes place in 815 * ad-hoc mode. It takes place in
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 51dfd202f558..7d7bc5e86a56 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -7,6 +7,7 @@
7#include "dev.h" 7#include "dev.h"
8#include "decl.h" 8#include "decl.h"
9#include "host.h" 9#include "host.h"
10#include "debugfs.h"
10 11
11static struct dentry *libertas_dir = NULL; 12static struct dentry *libertas_dir = NULL;
12static char *szStates[] = { 13static char *szStates[] = {
@@ -276,7 +277,7 @@ static void libertas_parse_ssid(char *buf, size_t count,
276 if (!end) 277 if (!end)
277 end = buf + count - 1; 278 end = buf + count - 1;
278 279
279 size = min(IW_ESSID_MAX_SIZE, end - hold); 280 size = min((size_t)IW_ESSID_MAX_SIZE, (size_t) (end - hold));
280 strncpy(scan_cfg->specificSSID, hold, size); 281 strncpy(scan_cfg->specificSSID, hold, size);
281 282
282 return; 283 return;
@@ -1648,7 +1649,7 @@ struct libertas_debugfs_files {
1648 struct file_operations fops; 1649 struct file_operations fops;
1649}; 1650};
1650 1651
1651struct libertas_debugfs_files debugfs_files[] = { 1652static struct libertas_debugfs_files debugfs_files[] = {
1652 { "info", 0444, FOPS(libertas_dev_info, write_file_dummy), }, 1653 { "info", 0444, FOPS(libertas_dev_info, write_file_dummy), },
1653 { "getscantable", 0444, FOPS(libertas_getscantable, 1654 { "getscantable", 0444, FOPS(libertas_getscantable,
1654 write_file_dummy), }, 1655 write_file_dummy), },
@@ -1658,7 +1659,7 @@ struct libertas_debugfs_files debugfs_files[] = {
1658 { "setuserscan", 0600, FOPS(NULL, libertas_setuserscan), }, 1659 { "setuserscan", 0600, FOPS(NULL, libertas_setuserscan), },
1659}; 1660};
1660 1661
1661struct libertas_debugfs_files debugfs_events_files[] = { 1662static struct libertas_debugfs_files debugfs_events_files[] = {
1662 {"low_rssi", 0644, FOPS(libertas_lowrssi_read, 1663 {"low_rssi", 0644, FOPS(libertas_lowrssi_read,
1663 libertas_lowrssi_write), }, 1664 libertas_lowrssi_write), },
1664 {"low_snr", 0644, FOPS(libertas_lowsnr_read, 1665 {"low_snr", 0644, FOPS(libertas_lowsnr_read,
@@ -1673,7 +1674,7 @@ struct libertas_debugfs_files debugfs_events_files[] = {
1673 libertas_highsnr_write), }, 1674 libertas_highsnr_write), },
1674}; 1675};
1675 1676
1676struct libertas_debugfs_files debugfs_regs_files[] = { 1677static struct libertas_debugfs_files debugfs_regs_files[] = {
1677 {"rdmac", 0644, FOPS(libertas_rdmac_read, libertas_rdmac_write), }, 1678 {"rdmac", 0644, FOPS(libertas_rdmac_read, libertas_rdmac_write), },
1678 {"wrmac", 0600, FOPS(NULL, libertas_wrmac_write), }, 1679 {"wrmac", 0600, FOPS(NULL, libertas_wrmac_write), },
1679 {"rdbbp", 0644, FOPS(libertas_rdbbp_read, libertas_rdbbp_write), }, 1680 {"rdbbp", 0644, FOPS(libertas_rdbbp_read, libertas_rdbbp_write), },
@@ -1778,7 +1779,7 @@ void libertas_debugfs_remove_one(wlan_private *priv)
1778struct debug_data { 1779struct debug_data {
1779 char name[32]; 1780 char name[32];
1780 u32 size; 1781 u32 size;
1781 u32 addr; 1782 size_t addr;
1782}; 1783};
1783 1784
1784/* To debug any member of wlan_adapter, simply add one line here. 1785/* To debug any member of wlan_adapter, simply add one line here.
@@ -1825,6 +1826,8 @@ static ssize_t wlan_debugfs_read(struct file *file, char __user *userbuf,
1825 val = *((u16 *) d[i].addr); 1826 val = *((u16 *) d[i].addr);
1826 else if (d[i].size == 4) 1827 else if (d[i].size == 4)
1827 val = *((u32 *) d[i].addr); 1828 val = *((u32 *) d[i].addr);
1829 else if (d[i].size == 8)
1830 val = *((u64 *) d[i].addr);
1828 1831
1829 pos += sprintf(p + pos, "%s=%d\n", d[i].name, val); 1832 pos += sprintf(p + pos, "%s=%d\n", d[i].name, val);
1830 } 1833 }
@@ -1844,7 +1847,7 @@ static ssize_t wlan_debugfs_read(struct file *file, char __user *userbuf,
1844 * @param data data to write 1847 * @param data data to write
1845 * @return number of data 1848 * @return number of data
1846 */ 1849 */
1847static int wlan_debugfs_write(struct file *f, const char __user *buf, 1850static ssize_t wlan_debugfs_write(struct file *f, const char __user *buf,
1848 size_t cnt, loff_t *ppos) 1851 size_t cnt, loff_t *ppos)
1849{ 1852{
1850 int r, i; 1853 int r, i;
@@ -1886,12 +1889,14 @@ static int wlan_debugfs_write(struct file *f, const char __user *buf,
1886 *((u16 *) d[i].addr) = (u16) r; 1889 *((u16 *) d[i].addr) = (u16) r;
1887 else if (d[i].size == 4) 1890 else if (d[i].size == 4)
1888 *((u32 *) d[i].addr) = (u32) r; 1891 *((u32 *) d[i].addr) = (u32) r;
1892 else if (d[i].size == 8)
1893 *((u64 *) d[i].addr) = (u64) r;
1889 break; 1894 break;
1890 } while (1); 1895 } while (1);
1891 } 1896 }
1892 kfree(pdata); 1897 kfree(pdata);
1893 1898
1894 return cnt; 1899 return (ssize_t)cnt;
1895} 1900}
1896 1901
1897static struct file_operations libertas_debug_fops = { 1902static struct file_operations libertas_debug_fops = {
@@ -1916,20 +1921,10 @@ void libertas_debug_init(wlan_private * priv, struct net_device *dev)
1916 return; 1921 return;
1917 1922
1918 for (i = 0; i < num_of_items; i++) 1923 for (i = 0; i < num_of_items; i++)
1919 items[i].addr += (u32) priv->adapter; 1924 items[i].addr += (size_t) priv->adapter;
1920 1925
1921 priv->debugfs_debug = debugfs_create_file("debug", 0644, 1926 priv->debugfs_debug = debugfs_create_file("debug", 0644,
1922 priv->debugfs_dir, &items[0], 1927 priv->debugfs_dir, &items[0],
1923 &libertas_debug_fops); 1928 &libertas_debug_fops);
1924} 1929}
1925 1930
1926/**
1927 * @brief remove proc file
1928 *
1929 * @param priv pointer wlan_private
1930 * @return N/A
1931 */
1932void libertas_debug_remove(wlan_private * priv)
1933{
1934 debugfs_remove(priv->debugfs_debug);
1935}
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h
index fb1478c1b87d..80dd9ea19c8e 100644
--- a/drivers/net/wireless/libertas/defs.h
+++ b/drivers/net/wireless/libertas/defs.h
@@ -9,6 +9,11 @@
9 9
10extern unsigned int libertas_debug; 10extern unsigned int libertas_debug;
11 11
12#ifdef CONFIG_LIBERTAS_DEBUG
13#define DEBUG
14#define PROC_DEBUG
15#endif
16
12#define DRV_NAME "usb8xxx" 17#define DRV_NAME "usb8xxx"
13 18
14#define lbs_pr_info(format, args...) \ 19#define lbs_pr_info(format, args...) \
@@ -223,31 +228,6 @@ enum SNRNF_DATA {
223 MAX_TYPE_AVG 228 MAX_TYPE_AVG
224}; 229};
225 230
226/** WLAN_802_11_AUTH_ALG*/
227enum WLAN_802_11_AUTH_ALG {
228 AUTH_ALG_OPEN_SYSTEM = 1,
229 AUTH_ALG_SHARED_KEY = 2,
230 AUTH_ALG_NETWORK_EAP = 8,
231};
232
233/** WLAN_802_1X_AUTH_ALG */
234enum WLAN_802_1X_AUTH_ALG {
235 WLAN_1X_AUTH_ALG_NONE = 1,
236 WLAN_1X_AUTH_ALG_LEAP = 2,
237 WLAN_1X_AUTH_ALG_TLS = 4,
238 WLAN_1X_AUTH_ALG_TTLS = 8,
239 WLAN_1X_AUTH_ALG_MD5 = 16,
240};
241
242/** WLAN_802_11_ENCRYPTION_MODE */
243enum WLAN_802_11_ENCRYPTION_MODE {
244 CIPHER_NONE,
245 CIPHER_WEP40,
246 CIPHER_TKIP,
247 CIPHER_CCMP,
248 CIPHER_WEP104,
249};
250
251/** WLAN_802_11_POWER_MODE */ 231/** WLAN_802_11_POWER_MODE */
252enum WLAN_802_11_POWER_MODE { 232enum WLAN_802_11_POWER_MODE {
253 wlan802_11powermodecam, 233 wlan802_11powermodecam,
@@ -292,28 +272,6 @@ enum mv_ms_type {
292 MVMS_EVENT 272 MVMS_EVENT
293}; 273};
294 274
295/** WLAN_802_11_NETWORK_INFRASTRUCTURE */
296enum WLAN_802_11_NETWORK_INFRASTRUCTURE {
297 wlan802_11ibss,
298 wlan802_11infrastructure,
299 wlan802_11autounknown,
300 /*defined as upper bound */
301 wlan802_11infrastructuremax
302};
303
304/** WLAN_802_11_AUTHENTICATION_MODE */
305enum WLAN_802_11_AUTHENTICATION_MODE {
306 wlan802_11authmodeopen = 0x00,
307 wlan802_11authmodeshared = 0x01,
308 wlan802_11authmodenetworkEAP = 0x80,
309};
310
311/** WLAN_802_11_WEP_STATUS */
312enum WLAN_802_11_WEP_STATUS {
313 wlan802_11WEPenabled,
314 wlan802_11WEPdisabled,
315};
316
317/** SNMP_MIB_INDEX_e */ 275/** SNMP_MIB_INDEX_e */
318enum SNMP_MIB_INDEX_e { 276enum SNMP_MIB_INDEX_e {
319 desired_bsstype_i = 0, 277 desired_bsstype_i = 0,
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index b1f876f9693b..e8b9020f9bd6 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -10,6 +10,7 @@
10#include <linux/wireless.h> 10#include <linux/wireless.h>
11#include <linux/ethtool.h> 11#include <linux/ethtool.h>
12#include <linux/debugfs.h> 12#include <linux/debugfs.h>
13#include <net/ieee80211.h>
13 14
14#include "defs.h" 15#include "defs.h"
15#include "scan.h" 16#include "scan.h"
@@ -56,10 +57,8 @@ struct region_channel {
56struct wlan_802_11_security { 57struct wlan_802_11_security {
57 u8 WPAenabled; 58 u8 WPAenabled;
58 u8 WPA2enabled; 59 u8 WPA2enabled;
59 enum WLAN_802_11_WEP_STATUS WEPstatus; 60 u8 wep_enabled;
60 enum WLAN_802_11_AUTHENTICATION_MODE authmode; 61 u8 auth_mode;
61 enum WLAN_802_1X_AUTH_ALG auth1xalg;
62 enum WLAN_802_11_ENCRYPTION_MODE Encryptionmode;
63}; 62};
64 63
65/** Current Basic Service Set State Structure */ 64/** Current Basic Service Set State Structure */
@@ -184,7 +183,7 @@ struct assoc_request {
184 183
185 struct WLAN_802_11_SSID ssid; 184 struct WLAN_802_11_SSID ssid;
186 u8 channel; 185 u8 channel;
187 enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode; 186 u8 mode;
188 u8 bssid[ETH_ALEN]; 187 u8 bssid[ETH_ALEN];
189 188
190 /** WEP keys */ 189 /** WEP keys */
@@ -198,7 +197,6 @@ struct assoc_request {
198 struct wlan_802_11_security secinfo; 197 struct wlan_802_11_security secinfo;
199 198
200 /** WPA Information Elements*/ 199 /** WPA Information Elements*/
201#define MAX_WPA_IE_LEN 64
202 u8 wpa_ie[MAX_WPA_IE_LEN]; 200 u8 wpa_ie[MAX_WPA_IE_LEN];
203 u8 wpa_ie_len; 201 u8 wpa_ie_len;
204}; 202};
@@ -254,7 +252,8 @@ struct _wlan_adapter {
254 /** current ssid/bssid related parameters*/ 252 /** current ssid/bssid related parameters*/
255 struct current_bss_params curbssparams; 253 struct current_bss_params curbssparams;
256 254
257 enum WLAN_802_11_NETWORK_INFRASTRUCTURE inframode; 255 /* IW_MODE_* */
256 u8 mode;
258 257
259 struct bss_descriptor *pattemptedbssdesc; 258 struct bss_descriptor *pattemptedbssdesc;
260 259
@@ -339,7 +338,6 @@ struct _wlan_adapter {
339 struct WLAN_802_11_KEY wpa_unicast_key; 338 struct WLAN_802_11_KEY wpa_unicast_key;
340 339
341 /** WPA Information Elements*/ 340 /** WPA Information Elements*/
342#define MAX_WPA_IE_LEN 64
343 u8 wpa_ie[MAX_WPA_IE_LEN]; 341 u8 wpa_ie[MAX_WPA_IE_LEN];
344 u8 wpa_ie_len; 342 u8 wpa_ie_len;
345 343
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c
index b194a4570791..441123c85e62 100644
--- a/drivers/net/wireless/libertas/fw.c
+++ b/drivers/net/wireless/libertas/fw.c
@@ -194,16 +194,13 @@ static void wlan_init_adapter(wlan_private * priv)
194 adapter->scanmode = cmd_bss_type_any; 194 adapter->scanmode = cmd_bss_type_any;
195 195
196 /* 802.11 specific */ 196 /* 802.11 specific */
197 adapter->secinfo.WEPstatus = wlan802_11WEPdisabled; 197 adapter->secinfo.wep_enabled = 0;
198 for (i = 0; i < sizeof(adapter->wep_keys) / sizeof(adapter->wep_keys[0]); 198 for (i = 0; i < sizeof(adapter->wep_keys) / sizeof(adapter->wep_keys[0]);
199 i++) 199 i++)
200 memset(&adapter->wep_keys[i], 0, sizeof(struct WLAN_802_11_KEY)); 200 memset(&adapter->wep_keys[i], 0, sizeof(struct WLAN_802_11_KEY));
201 adapter->wep_tx_keyidx = 0; 201 adapter->wep_tx_keyidx = 0;
202 adapter->secinfo.WEPstatus = wlan802_11WEPdisabled; 202 adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
203 adapter->secinfo.authmode = wlan802_11authmodeopen; 203 adapter->mode = IW_MODE_INFRA;
204 adapter->secinfo.auth1xalg = WLAN_1X_AUTH_ALG_NONE;
205 adapter->secinfo.Encryptionmode = CIPHER_NONE;
206 adapter->inframode = wlan802_11infrastructure;
207 204
208 adapter->assoc_req = NULL; 205 adapter->assoc_req = NULL;
209 206
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 695fb6a66ffe..ae6f72a6cdf3 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -388,7 +388,7 @@ static int __if_usb_submit_rx_urb(wlan_private * priv,
388 usb_fill_bulk_urb(cardp->rx_urb, cardp->udev, 388 usb_fill_bulk_urb(cardp->rx_urb, cardp->udev,
389 usb_rcvbulkpipe(cardp->udev, 389 usb_rcvbulkpipe(cardp->udev,
390 cardp->bulk_in_endpointAddr), 390 cardp->bulk_in_endpointAddr),
391 skb->tail + IPFIELD_ALIGN_OFFSET, 391 (void *) (skb->tail + (size_t) IPFIELD_ALIGN_OFFSET),
392 MRVDRV_ETH_RX_PACKET_BUFFER_SIZE, callbackfn, 392 MRVDRV_ETH_RX_PACKET_BUFFER_SIZE, callbackfn,
393 rinfo); 393 rinfo);
394 394
@@ -626,6 +626,7 @@ static void if_usb_receive(struct urb *urb)
626 cardp->usb_event_cause); 626 cardp->usb_event_cause);
627 if (cardp->usb_event_cause & 0xffff0000) { 627 if (cardp->usb_event_cause & 0xffff0000) {
628 libertas_send_tx_feedback(priv); 628 libertas_send_tx_feedback(priv);
629 spin_unlock(&priv->adapter->driver_lock);
629 break; 630 break;
630 } 631 }
631 cardp->usb_event_cause = le32_to_cpu(cardp->usb_event_cause) << 3; 632 cardp->usb_event_cause = le32_to_cpu(cardp->usb_event_cause) << 3;
@@ -775,7 +776,6 @@ restart:
775 return -1; 776 return -1;
776 } 777 }
777 778
778#ifdef SUPPORT_BOOT_COMMAND
779 cardp->bootcmdresp = 0; 779 cardp->bootcmdresp = 0;
780 do { 780 do {
781 int j = 0; 781 int j = 0;
@@ -796,7 +796,6 @@ restart:
796 } 796 }
797 return -1; 797 return -1;
798 } 798 }
799#endif
800 799
801 i = 0; 800 i = 0;
802 priv->adapter->fw_ready = 0; 801 priv->adapter->fw_ready = 0;
diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h
index 785116720bc6..170dfe6809f5 100644
--- a/drivers/net/wireless/libertas/if_usb.h
+++ b/drivers/net/wireless/libertas/if_usb.h
@@ -12,7 +12,6 @@
12#define USB8388_VID_2 0x05a3 12#define USB8388_VID_2 0x05a3
13#define USB8388_PID_2 0x8388 13#define USB8388_PID_2 0x8388
14 14
15#ifdef SUPPORT_BOOT_COMMAND
16#define BOOT_CMD_FW_BY_USB 0x01 15#define BOOT_CMD_FW_BY_USB 0x01
17#define BOOT_CMD_FW_IN_EEPROM 0x02 16#define BOOT_CMD_FW_IN_EEPROM 0x02
18#define BOOT_CMD_UPDATE_BOOT2 0x03 17#define BOOT_CMD_UPDATE_BOOT2 0x03
@@ -36,7 +35,6 @@ struct bootcmdrespStr
36 u8 u8result; 35 u8 u8result;
37 u8 au8dumy[2]; 36 u8 au8dumy[2];
38}; 37};
39#endif /* SUPPORT_BOOT_COMMAND */
40 38
41/* read callback private data */ 39/* read callback private data */
42struct read_cb_info { 40struct read_cb_info {
diff --git a/drivers/net/wireless/libertas/ioctl.c b/drivers/net/wireless/libertas/ioctl.c
index 82b39642423a..a8f76c358992 100644
--- a/drivers/net/wireless/libertas/ioctl.c
+++ b/drivers/net/wireless/libertas/ioctl.c
@@ -27,95 +27,6 @@
27 27
28#define WAIT_FOR_SCAN_RRESULT_MAX_TIME (10 * HZ) 28#define WAIT_FOR_SCAN_RRESULT_MAX_TIME (10 * HZ)
29 29
30static int setrxantenna(wlan_private * priv, int mode)
31{
32 int ret = 0;
33 wlan_adapter *adapter = priv->adapter;
34
35 if (mode != RF_ANTENNA_1 && mode != RF_ANTENNA_2
36 && mode != RF_ANTENNA_AUTO) {
37 return -EINVAL;
38 }
39
40 adapter->rxantennamode = mode;
41
42 lbs_pr_debug(1, "SET RX Antenna mode to 0x%04x\n", adapter->rxantennamode);
43
44 ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_antenna,
45 cmd_act_set_rx,
46 cmd_option_waitforrsp, 0,
47 &adapter->rxantennamode);
48 return ret;
49}
50
51static int settxantenna(wlan_private * priv, int mode)
52{
53 int ret = 0;
54 wlan_adapter *adapter = priv->adapter;
55
56 if ((mode != RF_ANTENNA_1) && (mode != RF_ANTENNA_2)
57 && (mode != RF_ANTENNA_AUTO)) {
58 return -EINVAL;
59 }
60
61 adapter->txantennamode = mode;
62
63 lbs_pr_debug(1, "SET TX Antenna mode to 0x%04x\n", adapter->txantennamode);
64
65 ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_antenna,
66 cmd_act_set_tx,
67 cmd_option_waitforrsp, 0,
68 &adapter->txantennamode);
69
70 return ret;
71}
72
73static int getrxantenna(wlan_private * priv, char *buf)
74{
75 int ret = 0;
76 wlan_adapter *adapter = priv->adapter;
77
78 // clear it, so we will know if the value
79 // returned below is correct or not.
80 adapter->rxantennamode = 0;
81
82 ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_antenna,
83 cmd_act_get_rx,
84 cmd_option_waitforrsp, 0, NULL);
85
86 if (ret) {
87 LEAVE();
88 return ret;
89 }
90
91 lbs_pr_debug(1, "Get Rx Antenna mode:0x%04x\n", adapter->rxantennamode);
92
93 return sprintf(buf, "0x%04x", adapter->rxantennamode) + 1;
94}
95
96static int gettxantenna(wlan_private * priv, char *buf)
97{
98 int ret = 0;
99 wlan_adapter *adapter = priv->adapter;
100
101 // clear it, so we will know if the value
102 // returned below is correct or not.
103 adapter->txantennamode = 0;
104
105 ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_antenna,
106 cmd_act_get_tx,
107 cmd_option_waitforrsp, 0, NULL);
108
109 if (ret) {
110 LEAVE();
111 return ret;
112 }
113
114 lbs_pr_debug(1, "Get Tx Antenna mode:0x%04x\n", adapter->txantennamode);
115
116 return sprintf(buf, "0x%04x", adapter->txantennamode) + 1;
117}
118
119static int wlan_set_region(wlan_private * priv, u16 region_code) 30static int wlan_set_region(wlan_private * priv, u16 region_code)
120{ 31{
121 int i; 32 int i;
@@ -144,998 +55,6 @@ static int wlan_set_region(wlan_private * priv, u16 region_code)
144 return 0; 55 return 0;
145} 56}
146 57
147/**
148 * @brief Get/Set Firmware wakeup method
149 *
150 * @param priv A pointer to wlan_private structure
151 * @param wrq A pointer to user data
152 * @return 0--success, otherwise fail
153 */
154static int wlan_txcontrol(wlan_private * priv, struct iwreq *wrq)
155{
156 wlan_adapter *adapter = priv->adapter;
157 int data;
158 ENTER();
159
160 if ((int)wrq->u.data.length == 0) {
161 if (copy_to_user
162 (wrq->u.data.pointer, &adapter->pkttxctrl, sizeof(u32))) {
163 lbs_pr_alert("copy_to_user failed!\n");
164 return -EFAULT;
165 }
166 } else {
167 if ((int)wrq->u.data.length > 1) {
168 lbs_pr_alert("ioctl too many args!\n");
169 return -EFAULT;
170 }
171 if (copy_from_user(&data, wrq->u.data.pointer, sizeof(int))) {
172 lbs_pr_alert("Copy from user failed\n");
173 return -EFAULT;
174 }
175
176 adapter->pkttxctrl = (u32) data;
177 }
178
179 wrq->u.data.length = 1;
180
181 LEAVE();
182 return 0;
183}
184
185/**
186 * @brief Get/Set NULL Package generation interval
187 *
188 * @param priv A pointer to wlan_private structure
189 * @param wrq A pointer to user data
190 * @return 0--success, otherwise fail
191 */
192static int wlan_null_pkt_interval(wlan_private * priv, struct iwreq *wrq)
193{
194 wlan_adapter *adapter = priv->adapter;
195 int data;
196 ENTER();
197
198 if ((int)wrq->u.data.length == 0) {
199 data = adapter->nullpktinterval;
200
201 if (copy_to_user(wrq->u.data.pointer, &data, sizeof(int))) {
202 lbs_pr_alert( "copy_to_user failed!\n");
203 return -EFAULT;
204 }
205 } else {
206 if ((int)wrq->u.data.length > 1) {
207 lbs_pr_alert( "ioctl too many args!\n");
208 return -EFAULT;
209 }
210 if (copy_from_user(&data, wrq->u.data.pointer, sizeof(int))) {
211 lbs_pr_debug(1, "Copy from user failed\n");
212 return -EFAULT;
213 }
214
215 adapter->nullpktinterval = data;
216 }
217
218 wrq->u.data.length = 1;
219
220 LEAVE();
221 return 0;
222}
223
224static int wlan_get_rxinfo(wlan_private * priv, struct iwreq *wrq)
225{
226 wlan_adapter *adapter = priv->adapter;
227 int data[2];
228 ENTER();
229 data[0] = adapter->SNR[TYPE_RXPD][TYPE_NOAVG];
230 data[1] = adapter->rxpd_rate;
231 if (copy_to_user(wrq->u.data.pointer, data, sizeof(int) * 2)) {
232 lbs_pr_debug(1, "Copy to user failed\n");
233 return -EFAULT;
234 }
235 wrq->u.data.length = 2;
236 LEAVE();
237 return 0;
238}
239
240static int wlan_get_snr(wlan_private * priv, struct iwreq *wrq)
241{
242 int ret = 0;
243 wlan_adapter *adapter = priv->adapter;
244 int data[4];
245
246 ENTER();
247 memset(data, 0, sizeof(data));
248 if (wrq->u.data.length) {
249 if (copy_from_user(data, wrq->u.data.pointer,
250 min_t(size_t, wrq->u.data.length, 4) * sizeof(int)))
251 return -EFAULT;
252 }
253 if ((wrq->u.data.length == 0) || (data[0] == 0) || (data[0] == 1)) {
254 if (adapter->connect_status == libertas_connected) {
255 ret = libertas_prepare_and_send_command(priv,
256 cmd_802_11_rssi,
257 0,
258 cmd_option_waitforrsp,
259 0, NULL);
260
261 if (ret) {
262 LEAVE();
263 return ret;
264 }
265 }
266 }
267
268 if (wrq->u.data.length == 0) {
269 data[0] = adapter->SNR[TYPE_BEACON][TYPE_NOAVG];
270 data[1] = adapter->SNR[TYPE_BEACON][TYPE_AVG];
271 data[2] = adapter->SNR[TYPE_RXPD][TYPE_NOAVG];
272 data[3] = adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE;
273 if (copy_to_user(wrq->u.data.pointer, data, sizeof(int) * 4))
274 return -EFAULT;
275 wrq->u.data.length = 4;
276 } else if (data[0] == 0) {
277 data[0] = adapter->SNR[TYPE_BEACON][TYPE_NOAVG];
278 if (copy_to_user(wrq->u.data.pointer, data, sizeof(int)))
279 return -EFAULT;
280 wrq->u.data.length = 1;
281 } else if (data[0] == 1) {
282 data[0] = adapter->SNR[TYPE_BEACON][TYPE_AVG];
283 if (copy_to_user(wrq->u.data.pointer, data, sizeof(int)))
284 return -EFAULT;
285 wrq->u.data.length = 1;
286 } else if (data[0] == 2) {
287 data[0] = adapter->SNR[TYPE_RXPD][TYPE_NOAVG];
288 if (copy_to_user(wrq->u.data.pointer, data, sizeof(int)))
289 return -EFAULT;
290 wrq->u.data.length = 1;
291 } else if (data[0] == 3) {
292 data[0] = adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE;
293 if (copy_to_user(wrq->u.data.pointer, data, sizeof(int)))
294 return -EFAULT;
295 wrq->u.data.length = 1;
296 } else
297 return -ENOTSUPP;
298
299 LEAVE();
300 return 0;
301}
302
303static int wlan_beacon_interval(wlan_private * priv, struct iwreq *wrq)
304{
305 int data;
306 wlan_adapter *adapter = priv->adapter;
307
308 if (wrq->u.data.length > 0) {
309 if (copy_from_user(&data, wrq->u.data.pointer, sizeof(int)))
310 return -EFAULT;
311
312 lbs_pr_debug(1, "WLAN SET BEACON INTERVAL: %d\n", data);
313 if ((data > MRVDRV_MAX_BEACON_INTERVAL)
314 || (data < MRVDRV_MIN_BEACON_INTERVAL))
315 return -ENOTSUPP;
316 adapter->beaconperiod = data;
317 }
318 data = adapter->beaconperiod;
319 if (copy_to_user(wrq->u.data.pointer, &data, sizeof(int)))
320 return -EFAULT;
321
322 wrq->u.data.length = 1;
323
324 return 0;
325}
326
327static int wlan_get_rssi(wlan_private * priv, struct iwreq *wrq)
328{
329 int ret = 0;
330 wlan_adapter *adapter = priv->adapter;
331 int temp;
332 int data = 0;
333 int *val;
334
335 ENTER();
336 data = SUBCMD_DATA(wrq);
337 if ((data == 0) || (data == 1)) {
338 ret = libertas_prepare_and_send_command(priv,
339 cmd_802_11_rssi,
340 0, cmd_option_waitforrsp,
341 0, NULL);
342 if (ret) {
343 LEAVE();
344 return ret;
345 }
346 }
347
348 switch (data) {
349 case 0:
350
351 temp = CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG],
352 adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
353 break;
354 case 1:
355 temp = CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG],
356 adapter->NF[TYPE_BEACON][TYPE_AVG]);
357 break;
358 case 2:
359 temp = CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_NOAVG],
360 adapter->NF[TYPE_RXPD][TYPE_NOAVG]);
361 break;
362 case 3:
363 temp = CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
364 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
365 break;
366 default:
367 return -ENOTSUPP;
368 }
369 val = (int *)wrq->u.name;
370 *val = temp;
371
372 LEAVE();
373 return 0;
374}
375
376static int wlan_get_nf(wlan_private * priv, struct iwreq *wrq)
377{
378 int ret = 0;
379 wlan_adapter *adapter = priv->adapter;
380 int temp;
381 int data = 0;
382 int *val;
383
384 data = SUBCMD_DATA(wrq);
385 if ((data == 0) || (data == 1)) {
386 ret = libertas_prepare_and_send_command(priv,
387 cmd_802_11_rssi,
388 0, cmd_option_waitforrsp,
389 0, NULL);
390
391 if (ret) {
392 LEAVE();
393 return ret;
394 }
395 }
396
397 switch (data) {
398 case 0:
399 temp = adapter->NF[TYPE_BEACON][TYPE_NOAVG];
400 break;
401 case 1:
402 temp = adapter->NF[TYPE_BEACON][TYPE_AVG];
403 break;
404 case 2:
405 temp = adapter->NF[TYPE_RXPD][TYPE_NOAVG];
406 break;
407 case 3:
408 temp = adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE;
409 break;
410 default:
411 return -ENOTSUPP;
412 }
413
414 temp = CAL_NF(temp);
415
416 lbs_pr_debug(1, "%s: temp = %d\n", __FUNCTION__, temp);
417 val = (int *)wrq->u.name;
418 *val = temp;
419 return 0;
420}
421
422static int wlan_get_txrate_ioctl(wlan_private * priv, struct ifreq *req)
423{
424 wlan_adapter *adapter = priv->adapter;
425 int *pdata;
426 struct iwreq *wrq = (struct iwreq *)req;
427 int ret = 0;
428 adapter->txrate = 0;
429 lbs_pr_debug(1, "wlan_get_txrate_ioctl\n");
430 ret = libertas_prepare_and_send_command(priv, cmd_802_11_tx_rate_query,
431 cmd_act_get, cmd_option_waitforrsp,
432 0, NULL);
433 if (ret)
434 return ret;
435
436 pdata = (int *)wrq->u.name;
437 *pdata = (int)adapter->txrate;
438 return 0;
439}
440
441static int wlan_get_adhoc_status_ioctl(wlan_private * priv, struct iwreq *wrq)
442{
443 char status[64];
444 wlan_adapter *adapter = priv->adapter;
445
446 memset(status, 0, sizeof(status));
447
448 switch (adapter->inframode) {
449 case wlan802_11ibss:
450 if (adapter->connect_status == libertas_connected) {
451 if (adapter->adhoccreate)
452 memcpy(&status, "AdhocStarted", sizeof(status));
453 else
454 memcpy(&status, "AdhocJoined", sizeof(status));
455 } else {
456 memcpy(&status, "AdhocIdle", sizeof(status));
457 }
458 break;
459 case wlan802_11infrastructure:
460 memcpy(&status, "Inframode", sizeof(status));
461 break;
462 default:
463 memcpy(&status, "AutoUnknownmode", sizeof(status));
464 break;
465 }
466
467 lbs_pr_debug(1, "status = %s\n", status);
468 wrq->u.data.length = strlen(status) + 1;
469
470 if (wrq->u.data.pointer) {
471 if (copy_to_user(wrq->u.data.pointer,
472 &status, wrq->u.data.length))
473 return -EFAULT;
474 }
475
476 LEAVE();
477 return 0;
478}
479
480/**
481 * @brief Set/Get WPA IE
482 * @param priv A pointer to wlan_private structure
483 * @param req A pointer to ifreq structure
484 * @return 0 --success, otherwise fail
485 */
486static int wlan_setwpaie_ioctl(wlan_private * priv, struct ifreq *req)
487{
488 struct iwreq *wrq = (struct iwreq *)req;
489 wlan_adapter *adapter = priv->adapter;
490 int ret = 0;
491
492 ENTER();
493
494 if (wrq->u.data.length) {
495 if (wrq->u.data.length > sizeof(adapter->wpa_ie)) {
496 lbs_pr_debug(1, "failed to copy WPA IE, too big \n");
497 return -EFAULT;
498 }
499 if (copy_from_user(adapter->wpa_ie, wrq->u.data.pointer,
500 wrq->u.data.length)) {
501 lbs_pr_debug(1, "failed to copy WPA IE \n");
502 return -EFAULT;
503 }
504 adapter->wpa_ie_len = wrq->u.data.length;
505 lbs_pr_debug(1, "Set wpa_ie_len=%d IE=%#x\n", adapter->wpa_ie_len,
506 adapter->wpa_ie[0]);
507 lbs_dbg_hex("wpa_ie", adapter->wpa_ie, adapter->wpa_ie_len);
508 if (adapter->wpa_ie[0] == WPA_IE)
509 adapter->secinfo.WPAenabled = 1;
510 else if (adapter->wpa_ie[0] == WPA2_IE)
511 adapter->secinfo.WPA2enabled = 1;
512 else {
513 adapter->secinfo.WPAenabled = 0;
514 adapter->secinfo.WPA2enabled = 0;
515 }
516 } else {
517 memset(adapter->wpa_ie, 0, sizeof(adapter->wpa_ie));
518 adapter->wpa_ie_len = wrq->u.data.length;
519 lbs_pr_debug(1, "Reset wpa_ie_len=%d IE=%#x\n",
520 adapter->wpa_ie_len, adapter->wpa_ie[0]);
521 adapter->secinfo.WPAenabled = 0;
522 adapter->secinfo.WPA2enabled = 0;
523 }
524
525 // enable/disable RSN in firmware if WPA is enabled/disabled
526 // depending on variable adapter->secinfo.WPAenabled is set or not
527 ret = libertas_prepare_and_send_command(priv, cmd_802_11_enable_rsn,
528 cmd_act_set, cmd_option_waitforrsp,
529 0, NULL);
530
531 LEAVE();
532 return ret;
533}
534
535/**
536 * @brief Set Auto prescan
537 * @param priv A pointer to wlan_private structure
538 * @param wrq A pointer to iwreq structure
539 * @return 0 --success, otherwise fail
540 */
541static int wlan_subcmd_setprescan_ioctl(wlan_private * priv, struct iwreq *wrq)
542{
543 int data;
544 wlan_adapter *adapter = priv->adapter;
545 int *val;
546
547 data = SUBCMD_DATA(wrq);
548 lbs_pr_debug(1, "WLAN_SUBCMD_SET_PRESCAN %d\n", data);
549 adapter->prescan = data;
550
551 val = (int *)wrq->u.name;
552 *val = data;
553 return 0;
554}
555
556static int wlan_set_multiple_dtim_ioctl(wlan_private * priv, struct ifreq *req)
557{
558 struct iwreq *wrq = (struct iwreq *)req;
559 u32 mdtim;
560 int idata;
561 int ret = -EINVAL;
562
563 ENTER();
564
565 idata = SUBCMD_DATA(wrq);
566 mdtim = (u32) idata;
567 if (((mdtim >= MRVDRV_MIN_MULTIPLE_DTIM)
568 && (mdtim <= MRVDRV_MAX_MULTIPLE_DTIM))
569 || (mdtim == MRVDRV_IGNORE_MULTIPLE_DTIM)) {
570 priv->adapter->multipledtim = mdtim;
571 ret = 0;
572 }
573 if (ret)
574 lbs_pr_debug(1, "Invalid parameter, multipledtim not changed.\n");
575
576 LEAVE();
577 return ret;
578}
579
580/**
581 * @brief Set authentication mode
582 * @param priv A pointer to wlan_private structure
583 * @param req A pointer to ifreq structure
584 * @return 0 --success, otherwise fail
585 */
586static int wlan_setauthalg_ioctl(wlan_private * priv, struct ifreq *req)
587{
588 int alg;
589 struct iwreq *wrq = (struct iwreq *)req;
590 wlan_adapter *adapter = priv->adapter;
591
592 if (wrq->u.data.flags == 0) {
593 //from iwpriv subcmd
594 alg = SUBCMD_DATA(wrq);
595 } else {
596 //from wpa_supplicant subcmd
597 if (copy_from_user(&alg, wrq->u.data.pointer, sizeof(alg))) {
598 lbs_pr_debug(1, "Copy from user failed\n");
599 return -EFAULT;
600 }
601 }
602
603 lbs_pr_debug(1, "auth alg is %#x\n", alg);
604
605 switch (alg) {
606 case AUTH_ALG_SHARED_KEY:
607 adapter->secinfo.authmode = wlan802_11authmodeshared;
608 break;
609 case AUTH_ALG_NETWORK_EAP:
610 adapter->secinfo.authmode =
611 wlan802_11authmodenetworkEAP;
612 break;
613 case AUTH_ALG_OPEN_SYSTEM:
614 default:
615 adapter->secinfo.authmode = wlan802_11authmodeopen;
616 break;
617 }
618 return 0;
619}
620
621/**
622 * @brief Set 802.1x authentication mode
623 * @param priv A pointer to wlan_private structure
624 * @param req A pointer to ifreq structure
625 * @return 0 --success, otherwise fail
626 */
627static int wlan_set8021xauthalg_ioctl(wlan_private * priv, struct ifreq *req)
628{
629 int alg;
630 struct iwreq *wrq = (struct iwreq *)req;
631
632 if (wrq->u.data.flags == 0) {
633 //from iwpriv subcmd
634 alg = SUBCMD_DATA(wrq);
635 } else {
636 //from wpa_supplicant subcmd
637 if (copy_from_user(&alg, wrq->u.data.pointer, sizeof(int))) {
638 lbs_pr_debug(1, "Copy from user failed\n");
639 return -EFAULT;
640 }
641 }
642 lbs_pr_debug(1, "802.1x auth alg is %#x\n", alg);
643 priv->adapter->secinfo.auth1xalg = alg;
644 return 0;
645}
646
647static int wlan_setencryptionmode_ioctl(wlan_private * priv, struct ifreq *req)
648{
649 int mode;
650 struct iwreq *wrq = (struct iwreq *)req;
651
652 ENTER();
653
654 if (wrq->u.data.flags == 0) {
655 //from iwpriv subcmd
656 mode = SUBCMD_DATA(wrq);
657 } else {
658 //from wpa_supplicant subcmd
659 if (copy_from_user(&mode, wrq->u.data.pointer, sizeof(int))) {
660 lbs_pr_debug(1, "Copy from user failed\n");
661 return -EFAULT;
662 }
663 }
664 lbs_pr_debug(1, "encryption mode is %#x\n", mode);
665 priv->adapter->secinfo.Encryptionmode = mode;
666
667 LEAVE();
668 return 0;
669}
670
671static void adjust_mtu(wlan_private * priv)
672{
673 int mtu_increment = 0;
674
675 if (priv->adapter->linkmode == WLAN_LINKMODE_802_11)
676 mtu_increment += sizeof(struct ieee80211_hdr_4addr);
677
678 if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP)
679 mtu_increment += max(sizeof(struct tx_radiotap_hdr),
680 sizeof(struct rx_radiotap_hdr));
681 priv->wlan_dev.netdev->mtu = ETH_FRAME_LEN
682 - sizeof(struct ethhdr)
683 + mtu_increment;
684}
685
686/**
687 * @brief Set Link-Layer Layer mode
688 * @param priv A pointer to wlan_private structure
689 * @param req A pointer to ifreq structure
690 * @return 0 --success, otherwise fail
691 */
692static int wlan_set_linkmode_ioctl(wlan_private * priv, struct ifreq *req)
693{
694 int mode;
695
696 mode = (int)((struct ifreq *)((u8 *) req + 4))->ifr_data;
697
698 switch (mode) {
699 case WLAN_LINKMODE_802_3:
700 priv->adapter->linkmode = mode;
701 break;
702 case WLAN_LINKMODE_802_11:
703 priv->adapter->linkmode = mode;
704 break;
705 default:
706 lbs_pr_info("usb8388-5: invalid link-layer mode (%#x)\n",
707 mode);
708 return -EINVAL;
709 break;
710 }
711 lbs_pr_debug(1, "usb8388-5: link-layer mode is %#x\n", mode);
712
713 adjust_mtu(priv);
714
715 return 0;
716}
717
718/**
719 * @brief Set Radio header mode
720 * @param priv A pointer to wlan_private structure
721 * @param req A pointer to ifreq structure
722 * @return 0 --success, otherwise fail
723 */
724static int wlan_set_radiomode_ioctl(wlan_private * priv, struct ifreq *req)
725{
726 int mode;
727
728 mode = (int)((struct ifreq *)((u8 *) req + 4))->ifr_data;
729
730 switch (mode) {
731 case WLAN_RADIOMODE_NONE:
732 priv->adapter->radiomode = mode;
733 break;
734 case WLAN_RADIOMODE_RADIOTAP:
735 priv->adapter->radiomode = mode;
736 break;
737 default:
738 lbs_pr_debug(1, "usb8388-5: invalid radio header mode (%#x)\n",
739 mode);
740 return -EINVAL;
741 }
742 lbs_pr_debug(1, "usb8388-5: radio-header mode is %#x\n", mode);
743
744 adjust_mtu(priv);
745 return 0;
746}
747
748/**
749 * @brief Set Debug header mode
750 * @param priv A pointer to wlan_private structure
751 * @param req A pointer to ifreq structure
752 * @return 0 --success, otherwise fail
753 */
754static int wlan_set_debugmode_ioctl(wlan_private * priv, struct ifreq *req)
755{
756 priv->adapter->debugmode = (int)((struct ifreq *)
757 ((u8 *) req + 4))->ifr_data;
758 return 0;
759}
760
761static int wlan_subcmd_getrxantenna_ioctl(wlan_private * priv,
762 struct ifreq *req)
763{
764 int len;
765 char buf[8];
766 struct iwreq *wrq = (struct iwreq *)req;
767
768 lbs_pr_debug(1, "WLAN_SUBCMD_GETRXANTENNA\n");
769 len = getrxantenna(priv, buf);
770
771 wrq->u.data.length = len;
772 if (wrq->u.data.pointer) {
773 if (copy_to_user(wrq->u.data.pointer, &buf, len)) {
774 lbs_pr_debug(1, "CopyToUser failed\n");
775 return -EFAULT;
776 }
777 }
778
779 return 0;
780}
781
782static int wlan_subcmd_gettxantenna_ioctl(wlan_private * priv,
783 struct ifreq *req)
784{
785 int len;
786 char buf[8];
787 struct iwreq *wrq = (struct iwreq *)req;
788
789 lbs_pr_debug(1, "WLAN_SUBCMD_GETTXANTENNA\n");
790 len = gettxantenna(priv, buf);
791
792 wrq->u.data.length = len;
793 if (wrq->u.data.pointer) {
794 if (copy_to_user(wrq->u.data.pointer, &buf, len)) {
795 lbs_pr_debug(1, "CopyToUser failed\n");
796 return -EFAULT;
797 }
798 }
799 return 0;
800}
801
802/**
803 * @brief Get the MAC TSF value from the firmware
804 *
805 * @param priv A pointer to wlan_private structure
806 * @param wrq A pointer to iwreq structure containing buffer
807 * space to store a TSF value retrieved from the firmware
808 *
809 * @return 0 if successful; IOCTL error code otherwise
810 */
811static int wlan_get_tsf_ioctl(wlan_private * priv, struct iwreq *wrq)
812{
813 u64 tsfval;
814 int ret;
815
816 ret = libertas_prepare_and_send_command(priv,
817 cmd_get_tsf,
818 0, cmd_option_waitforrsp, 0, &tsfval);
819
820 lbs_pr_debug(1, "IOCTL: Get TSF = 0x%016llx\n", tsfval);
821
822 if (ret != 0) {
823 lbs_pr_debug(1, "IOCTL: Get TSF; command exec failed\n");
824 ret = -EFAULT;
825 } else {
826 if (copy_to_user(wrq->u.data.pointer,
827 &tsfval,
828 min_t(size_t, wrq->u.data.length,
829 sizeof(tsfval))) != 0) {
830
831 lbs_pr_debug(1, "IOCTL: Get TSF; Copy to user failed\n");
832 ret = -EFAULT;
833 } else {
834 ret = 0;
835 }
836 }
837 return ret;
838}
839
840/**
841 * @brief Get/Set adapt rate
842 * @param priv A pointer to wlan_private structure
843 * @param wrq A pointer to iwreq structure
844 * @return 0 --success, otherwise fail
845 */
846static int wlan_adapt_rateset(wlan_private * priv, struct iwreq *wrq)
847{
848 int ret;
849 wlan_adapter *adapter = priv->adapter;
850 int data[2];
851
852 memset(data, 0, sizeof(data));
853 if (!wrq->u.data.length) {
854 lbs_pr_debug(1, "Get ADAPT RATE SET\n");
855 ret = libertas_prepare_and_send_command(priv,
856 cmd_802_11_rate_adapt_rateset,
857 cmd_act_get,
858 cmd_option_waitforrsp, 0, NULL);
859 data[0] = adapter->enablehwauto;
860 data[1] = adapter->ratebitmap;
861 if (copy_to_user(wrq->u.data.pointer, data, sizeof(int) * 2)) {
862 lbs_pr_debug(1, "Copy to user failed\n");
863 return -EFAULT;
864 }
865#define GET_TWO_INT 2
866 wrq->u.data.length = GET_TWO_INT;
867 } else {
868 lbs_pr_debug(1, "Set ADAPT RATE SET\n");
869 if (wrq->u.data.length > 2)
870 return -EINVAL;
871 if (copy_from_user
872 (data, wrq->u.data.pointer,
873 sizeof(int) * wrq->u.data.length)) {
874 lbs_pr_debug(1, "Copy from user failed\n");
875 return -EFAULT;
876 }
877
878 adapter->enablehwauto = data[0];
879 adapter->ratebitmap = data[1];
880 ret = libertas_prepare_and_send_command(priv,
881 cmd_802_11_rate_adapt_rateset,
882 cmd_act_set,
883 cmd_option_waitforrsp, 0, NULL);
884 }
885 return ret;
886}
887
888/**
889 * @brief Get/Set inactivity timeout
890 * @param priv A pointer to wlan_private structure
891 * @param wrq A pointer to iwreq structure
892 * @return 0 --success, otherwise fail
893 */
894static int wlan_inactivity_timeout(wlan_private * priv, struct iwreq *wrq)
895{
896 int ret;
897 int data = 0;
898 u16 timeout = 0;
899
900 ENTER();
901 if (wrq->u.data.length > 1)
902 return -ENOTSUPP;
903
904 if (wrq->u.data.length == 0) {
905 /* Get */
906 ret = libertas_prepare_and_send_command(priv,
907 cmd_802_11_inactivity_timeout,
908 cmd_act_get,
909 cmd_option_waitforrsp, 0,
910 &timeout);
911 data = timeout;
912 if (copy_to_user(wrq->u.data.pointer, &data, sizeof(int))) {
913 lbs_pr_debug(1, "Copy to user failed\n");
914 return -EFAULT;
915 }
916 } else {
917 /* Set */
918 if (copy_from_user(&data, wrq->u.data.pointer, sizeof(int))) {
919 lbs_pr_debug(1, "Copy from user failed\n");
920 return -EFAULT;
921 }
922
923 timeout = data;
924 ret = libertas_prepare_and_send_command(priv,
925 cmd_802_11_inactivity_timeout,
926 cmd_act_set,
927 cmd_option_waitforrsp, 0,
928 &timeout);
929 }
930
931 wrq->u.data.length = 1;
932
933 LEAVE();
934 return ret;
935}
936
937static int wlan_do_getlog_ioctl(wlan_private * priv, struct iwreq *wrq)
938{
939 int ret;
940 char buf[GETLOG_BUFSIZE - 1];
941 wlan_adapter *adapter = priv->adapter;
942
943 lbs_pr_debug(1, " GET STATS\n");
944
945 ret = libertas_prepare_and_send_command(priv, cmd_802_11_get_log,
946 0, cmd_option_waitforrsp, 0, NULL);
947
948 if (ret) {
949 return ret;
950 }
951
952 if (wrq->u.data.pointer) {
953 sprintf(buf, "\n mcasttxframe %u failed %u retry %u "
954 "multiretry %u framedup %u "
955 "rtssuccess %u rtsfailure %u ackfailure %u\n"
956 "rxfrag %u mcastrxframe %u fcserror %u "
957 "txframe %u wepundecryptable %u ",
958 adapter->logmsg.mcasttxframe,
959 adapter->logmsg.failed,
960 adapter->logmsg.retry,
961 adapter->logmsg.multiretry,
962 adapter->logmsg.framedup,
963 adapter->logmsg.rtssuccess,
964 adapter->logmsg.rtsfailure,
965 adapter->logmsg.ackfailure,
966 adapter->logmsg.rxfrag,
967 adapter->logmsg.mcastrxframe,
968 adapter->logmsg.fcserror,
969 adapter->logmsg.txframe,
970 adapter->logmsg.wepundecryptable);
971 wrq->u.data.length = strlen(buf) + 1;
972 if (copy_to_user(wrq->u.data.pointer, buf, wrq->u.data.length)) {
973 lbs_pr_debug(1, "Copy to user failed\n");
974 return -EFAULT;
975 }
976 }
977
978 return 0;
979}
980
981static int wlan_scan_type_ioctl(wlan_private * priv, struct iwreq *wrq)
982{
983 u8 buf[12];
984 u8 *option[] = { "active", "passive", "get", };
985 int i, max_options = (sizeof(option) / sizeof(option[0]));
986 int ret = 0;
987 wlan_adapter *adapter = priv->adapter;
988
989 if (priv->adapter->enable11d) {
990 lbs_pr_debug(1, "11D: Cannot set scantype when 11D enabled\n");
991 return -EFAULT;
992 }
993
994 memset(buf, 0, sizeof(buf));
995
996 if (copy_from_user(buf, wrq->u.data.pointer, min_t(size_t, sizeof(buf),
997 wrq->u.data.length)))
998 return -EFAULT;
999
1000 lbs_pr_debug(1, "Scan type Option = %s\n", buf);
1001
1002 buf[sizeof(buf) - 1] = '\0';
1003
1004 for (i = 0; i < max_options; i++) {
1005 if (!strcmp(buf, option[i]))
1006 break;
1007 }
1008
1009 switch (i) {
1010 case 0:
1011 adapter->scantype = cmd_scan_type_active;
1012 break;
1013 case 1:
1014 adapter->scantype = cmd_scan_type_passive;
1015 break;
1016 case 2:
1017 wrq->u.data.length = strlen(option[adapter->scantype]) + 1;
1018
1019 if (copy_to_user(wrq->u.data.pointer,
1020 option[adapter->scantype],
1021 wrq->u.data.length)) {
1022 lbs_pr_debug(1, "Copy to user failed\n");
1023 ret = -EFAULT;
1024 }
1025
1026 break;
1027 default:
1028 lbs_pr_debug(1, "Invalid Scan type Ioctl Option\n");
1029 ret = -EINVAL;
1030 break;
1031 }
1032
1033 return ret;
1034}
1035
1036static int wlan_scan_mode_ioctl(wlan_private * priv, struct iwreq *wrq)
1037{
1038 wlan_adapter *adapter = priv->adapter;
1039 u8 buf[12];
1040 u8 *option[] = { "bss", "ibss", "any", "get" };
1041 int i, max_options = (sizeof(option) / sizeof(option[0]));
1042 int ret = 0;
1043
1044 ENTER();
1045
1046 memset(buf, 0, sizeof(buf));
1047
1048 if (copy_from_user(buf, wrq->u.data.pointer, min_t(size_t, sizeof(buf),
1049 wrq->u.data.length))) {
1050 lbs_pr_debug(1, "Copy from user failed\n");
1051 return -EFAULT;
1052 }
1053
1054 lbs_pr_debug(1, "Scan mode Option = %s\n", buf);
1055
1056 buf[sizeof(buf) - 1] = '\0';
1057
1058 for (i = 0; i < max_options; i++) {
1059 if (!strcmp(buf, option[i]))
1060 break;
1061 }
1062
1063 switch (i) {
1064
1065 case 0:
1066 adapter->scanmode = cmd_bss_type_bss;
1067 break;
1068 case 1:
1069 adapter->scanmode = cmd_bss_type_ibss;
1070 break;
1071 case 2:
1072 adapter->scanmode = cmd_bss_type_any;
1073 break;
1074 case 3:
1075
1076 wrq->u.data.length = strlen(option[adapter->scanmode - 1]) + 1;
1077
1078 lbs_pr_debug(1, "Get Scan mode Option = %s\n",
1079 option[adapter->scanmode - 1]);
1080
1081 lbs_pr_debug(1, "Scan mode length %d\n", wrq->u.data.length);
1082
1083 if (copy_to_user(wrq->u.data.pointer,
1084 option[adapter->scanmode - 1],
1085 wrq->u.data.length)) {
1086 lbs_pr_debug(1, "Copy to user failed\n");
1087 ret = -EFAULT;
1088 }
1089 lbs_pr_debug(1, "GET Scan type Option after copy = %s\n",
1090 (char *)wrq->u.data.pointer);
1091
1092 break;
1093
1094 default:
1095 lbs_pr_debug(1, "Invalid Scan mode Ioctl Option\n");
1096 ret = -EINVAL;
1097 break;
1098 }
1099
1100 LEAVE();
1101 return ret;
1102}
1103
1104/**
1105 * @brief Get/Set Adhoc G Rate
1106 *
1107 * @param priv A pointer to wlan_private structure
1108 * @param wrq A pointer to user data
1109 * @return 0--success, otherwise fail
1110 */
1111static int wlan_do_set_grate_ioctl(wlan_private * priv, struct iwreq *wrq)
1112{
1113 wlan_adapter *adapter = priv->adapter;
1114 int data, data1;
1115 int *val;
1116
1117 ENTER();
1118
1119 data1 = SUBCMD_DATA(wrq);
1120 switch (data1) {
1121 case 0:
1122 adapter->adhoc_grate_enabled = 0;
1123 break;
1124 case 1:
1125 adapter->adhoc_grate_enabled = 1;
1126 break;
1127 case 2:
1128 break;
1129 default:
1130 return -EINVAL;
1131 }
1132 data = adapter->adhoc_grate_enabled;
1133 val = (int *)wrq->u.name;
1134 *val = data;
1135 LEAVE();
1136 return 0;
1137}
1138
1139static inline int hex2int(char c) 58static inline int hex2int(char c)
1140{ 59{
1141 if (c >= '0' && c <= '9') 60 if (c >= '0' && c <= '9')
@@ -1761,6 +680,7 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
1761 */ 680 */
1762static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req) 681static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
1763{ 682{
683 struct iwreq *wrq = (struct iwreq *)req;
1764 static struct cmd_ds_fwt_access fwt_access; 684 static struct cmd_ds_fwt_access fwt_access;
1765 int ret; 685 int ret;
1766 686
@@ -1776,7 +696,7 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
1776 (void *)&fwt_access); 696 (void *)&fwt_access);
1777 697
1778 if (ret == 0) 698 if (ret == 0)
1779 req->ifr_data = (char *)(le32_to_cpu(fwt_access.references)); 699 wrq->u.param.value = le32_to_cpu(fwt_access.references);
1780 else 700 else
1781 return -EFAULT; 701 return -EFAULT;
1782 702
@@ -1792,6 +712,7 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
1792 */ 712 */
1793static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req) 713static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
1794{ 714{
715 struct iwreq *wrq = (struct iwreq *)req;
1795 static struct cmd_ds_fwt_access fwt_access; 716 static struct cmd_ds_fwt_access fwt_access;
1796 int ret; 717 int ret;
1797 718
@@ -1807,7 +728,7 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
1807 (void *)&fwt_access); 728 (void *)&fwt_access);
1808 729
1809 if (ret == 0) 730 if (ret == 0)
1810 req->ifr_data = (char *)(le32_to_cpu(fwt_access.references)); 731 wrq->u.param.value = le32_to_cpu(fwt_access.references);
1811 else 732 else
1812 return -EFAULT; 733 return -EFAULT;
1813 734
@@ -1823,6 +744,7 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
1823 */ 744 */
1824static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req) 745static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
1825{ 746{
747 struct iwreq *wrq = (struct iwreq *)req;
1826 struct cmd_ds_mesh_access mesh_access; 748 struct cmd_ds_mesh_access mesh_access;
1827 int ret; 749 int ret;
1828 750
@@ -1835,9 +757,8 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
1835 cmd_option_waitforrsp, 0, 757 cmd_option_waitforrsp, 0,
1836 (void *)&mesh_access); 758 (void *)&mesh_access);
1837 759
1838 if (ret == 0) { 760 if (ret == 0)
1839 req->ifr_data = (char *)(le32_to_cpu(mesh_access.data[0])); 761 wrq->u.param.value = le32_to_cpu(mesh_access.data[0]);
1840 }
1841 else 762 else
1842 return -EFAULT; 763 return -EFAULT;
1843 764
@@ -1898,36 +819,8 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
1898 819
1899 lbs_pr_debug(1, "libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd); 820 lbs_pr_debug(1, "libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd);
1900 switch (cmd) { 821 switch (cmd) {
1901 case WLANSCAN_TYPE:
1902 lbs_pr_debug(1, "Scan type Ioctl\n");
1903 ret = wlan_scan_type_ioctl(priv, wrq);
1904 break;
1905
1906 case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */ 822 case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */
1907 switch (wrq->u.data.flags) { 823 switch (wrq->u.data.flags) {
1908 case WLANDEAUTH:
1909 lbs_pr_debug(1, "Deauth\n");
1910 libertas_send_deauth(priv);
1911 break;
1912
1913 case WLANADHOCSTOP:
1914 lbs_pr_debug(1, "Adhoc stop\n");
1915 ret = libertas_do_adhocstop_ioctl(priv);
1916 break;
1917
1918 case WLANRADIOON:
1919 wlan_radio_ioctl(priv, 1);
1920 break;
1921
1922 case WLANRADIOOFF:
1923 wlan_radio_ioctl(priv, 0);
1924 break;
1925 case WLANWLANIDLEON:
1926 libertas_idle_on(priv);
1927 break;
1928 case WLANWLANIDLEOFF:
1929 libertas_idle_off(priv);
1930 break;
1931 case WLAN_SUBCMD_BT_RESET: /* bt_reset */ 824 case WLAN_SUBCMD_BT_RESET: /* bt_reset */
1932 wlan_bt_reset_ioctl(priv); 825 wlan_bt_reset_ioctl(priv);
1933 break; 826 break;
@@ -1937,162 +830,19 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
1937 } /* End of switch */ 830 } /* End of switch */
1938 break; 831 break;
1939 832
1940 case WLANSETWPAIE:
1941 ret = wlan_setwpaie_ioctl(priv, req);
1942 break;
1943 case WLAN_SETINT_GETINT:
1944 /* The first 4 bytes of req->ifr_data is sub-ioctl number
1945 * after 4 bytes sits the payload.
1946 */
1947 subcmd = (int)req->ifr_data; //from iwpriv subcmd
1948 switch (subcmd) {
1949 case WLANNF:
1950 ret = wlan_get_nf(priv, wrq);
1951 break;
1952 case WLANRSSI:
1953 ret = wlan_get_rssi(priv, wrq);
1954 break;
1955 case WLANENABLE11D:
1956 ret = libertas_cmd_enable_11d(priv, wrq);
1957 break;
1958 case WLANADHOCGRATE:
1959 ret = wlan_do_set_grate_ioctl(priv, wrq);
1960 break;
1961 case WLAN_SUBCMD_SET_PRESCAN:
1962 ret = wlan_subcmd_setprescan_ioctl(priv, wrq);
1963 break;
1964 }
1965 break;
1966
1967 case WLAN_SETONEINT_GETONEINT:
1968 switch (wrq->u.data.flags) {
1969 case WLAN_BEACON_INTERVAL:
1970 ret = wlan_beacon_interval(priv, wrq);
1971 break;
1972
1973 case WLAN_LISTENINTRVL:
1974 if (!wrq->u.data.length) {
1975 int data;
1976 lbs_pr_debug(1, "Get locallisteninterval value\n");
1977#define GET_ONE_INT 1
1978 data = adapter->locallisteninterval;
1979 if (copy_to_user(wrq->u.data.pointer,
1980 &data, sizeof(int))) {
1981 lbs_pr_debug(1, "Copy to user failed\n");
1982 return -EFAULT;
1983 }
1984
1985 wrq->u.data.length = GET_ONE_INT;
1986 } else {
1987 int data;
1988 if (copy_from_user
1989 (&data, wrq->u.data.pointer, sizeof(int))) {
1990 lbs_pr_debug(1, "Copy from user failed\n");
1991 return -EFAULT;
1992 }
1993
1994 lbs_pr_debug(1, "Set locallisteninterval = %d\n",
1995 data);
1996#define MAX_U16_VAL 65535
1997 if (data > MAX_U16_VAL) {
1998 lbs_pr_debug(1, "Exceeds U16 value\n");
1999 return -EINVAL;
2000 }
2001 adapter->locallisteninterval = data;
2002 }
2003 break;
2004 case WLAN_TXCONTROL:
2005 ret = wlan_txcontrol(priv, wrq); //adds for txcontrol ioctl
2006 break;
2007
2008 case WLAN_NULLPKTINTERVAL:
2009 ret = wlan_null_pkt_interval(priv, wrq);
2010 break;
2011
2012 default:
2013 ret = -EOPNOTSUPP;
2014 break;
2015 }
2016 break;
2017
2018 case WLAN_SETONEINT_GETNONE: 833 case WLAN_SETONEINT_GETNONE:
2019 /* The first 4 bytes of req->ifr_data is sub-ioctl number 834 /* The first 4 bytes of req->ifr_data is sub-ioctl number
2020 * after 4 bytes sits the payload. 835 * after 4 bytes sits the payload.
2021 */ 836 */
2022 subcmd = wrq->u.data.flags; //from wpa_supplicant subcmd 837 subcmd = wrq->u.data.flags;
2023
2024 if (!subcmd) 838 if (!subcmd)
2025 subcmd = (int)req->ifr_data; //from iwpriv subcmd 839 subcmd = (int)wrq->u.param.value;
2026 840
2027 switch (subcmd) { 841 switch (subcmd) {
2028 case WLAN_SUBCMD_SETRXANTENNA: /* SETRXANTENNA */
2029 idata = SUBCMD_DATA(wrq);
2030 ret = setrxantenna(priv, idata);
2031 break;
2032 case WLAN_SUBCMD_SETTXANTENNA: /* SETTXANTENNA */
2033 idata = SUBCMD_DATA(wrq);
2034 ret = settxantenna(priv, idata);
2035 break;
2036 case WLAN_SET_ATIM_WINDOW:
2037 adapter->atimwindow = SUBCMD_DATA(wrq);
2038 adapter->atimwindow = min_t(__u16, adapter->atimwindow, 50);
2039 break;
2040 case WLANSETBCNAVG:
2041 adapter->bcn_avg_factor = SUBCMD_DATA(wrq);
2042 if (adapter->bcn_avg_factor == 0)
2043 adapter->bcn_avg_factor =
2044 DEFAULT_BCN_AVG_FACTOR;
2045 if (adapter->bcn_avg_factor > DEFAULT_BCN_AVG_FACTOR)
2046 adapter->bcn_avg_factor =
2047 DEFAULT_BCN_AVG_FACTOR;
2048 break;
2049 case WLANSETDATAAVG:
2050 adapter->data_avg_factor = SUBCMD_DATA(wrq);
2051 if (adapter->data_avg_factor == 0)
2052 adapter->data_avg_factor =
2053 DEFAULT_DATA_AVG_FACTOR;
2054 if (adapter->data_avg_factor > DEFAULT_DATA_AVG_FACTOR)
2055 adapter->data_avg_factor =
2056 DEFAULT_DATA_AVG_FACTOR;
2057 break;
2058 case WLANSETREGION: 842 case WLANSETREGION:
2059 idata = SUBCMD_DATA(wrq); 843 idata = SUBCMD_DATA(wrq);
2060 ret = wlan_set_region(priv, (u16) idata); 844 ret = wlan_set_region(priv, (u16) idata);
2061 break; 845 break;
2062
2063 case WLAN_SET_LISTEN_INTERVAL:
2064 idata = SUBCMD_DATA(wrq);
2065 adapter->listeninterval = (u16) idata;
2066 break;
2067
2068 case WLAN_SET_MULTIPLE_DTIM:
2069 ret = wlan_set_multiple_dtim_ioctl(priv, req);
2070 break;
2071
2072 case WLANSETAUTHALG:
2073 ret = wlan_setauthalg_ioctl(priv, req);
2074 break;
2075
2076 case WLANSET8021XAUTHALG:
2077 ret = wlan_set8021xauthalg_ioctl(priv, req);
2078 break;
2079
2080 case WLANSETENCRYPTIONMODE:
2081 ret = wlan_setencryptionmode_ioctl(priv, req);
2082 break;
2083
2084 case WLAN_SET_LINKMODE:
2085 ret = wlan_set_linkmode_ioctl(priv, req);
2086 break;
2087
2088 case WLAN_SET_RADIOMODE:
2089 ret = wlan_set_radiomode_ioctl(priv, req);
2090 break;
2091
2092 case WLAN_SET_DEBUGMODE:
2093 ret = wlan_set_debugmode_ioctl(priv, req);
2094 break;
2095
2096 case WLAN_SUBCMD_MESH_SET_TTL: 846 case WLAN_SUBCMD_MESH_SET_TTL:
2097 idata = SUBCMD_DATA(wrq); 847 idata = SUBCMD_DATA(wrq);
2098 ret = wlan_mesh_set_ttl_ioctl(priv, idata); 848 ret = wlan_mesh_set_ttl_ioctl(priv, idata);
@@ -2105,38 +855,8 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
2105 855
2106 break; 856 break;
2107 857
2108 case WLAN_SETNONE_GETTWELVE_CHAR: /* Get Antenna settings */
2109 /*
2110 * We've not used IW_PRIV_TYPE_FIXED so sub-ioctl number is
2111 * in flags of iwreq structure, otherwise it will be in
2112 * mode member of iwreq structure.
2113 */
2114 switch ((int)wrq->u.data.flags) {
2115 case WLAN_SUBCMD_GETRXANTENNA: /* Get Rx Antenna */
2116 ret = wlan_subcmd_getrxantenna_ioctl(priv, req);
2117 break;
2118
2119 case WLAN_SUBCMD_GETTXANTENNA: /* Get Tx Antenna */
2120 ret = wlan_subcmd_gettxantenna_ioctl(priv, req);
2121 break;
2122
2123 case WLAN_GET_TSF:
2124 ret = wlan_get_tsf_ioctl(priv, wrq);
2125 break;
2126 }
2127 break;
2128
2129 case WLAN_SET128CHAR_GET128CHAR: 858 case WLAN_SET128CHAR_GET128CHAR:
2130 switch ((int)wrq->u.data.flags) { 859 switch ((int)wrq->u.data.flags) {
2131
2132 case WLANSCAN_MODE:
2133 lbs_pr_debug(1, "Scan mode Ioctl\n");
2134 ret = wlan_scan_mode_ioctl(priv, wrq);
2135 break;
2136
2137 case WLAN_GET_ADHOC_STATUS:
2138 ret = wlan_get_adhoc_status_ioctl(priv, wrq);
2139 break;
2140 case WLAN_SUBCMD_BT_ADD: 860 case WLAN_SUBCMD_BT_ADD:
2141 ret = wlan_bt_add_ioctl(priv, req); 861 ret = wlan_bt_add_ioctl(priv, req);
2142 break; 862 break;
@@ -2168,41 +888,11 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
2168 break; 888 break;
2169 889
2170 case WLAN_SETNONE_GETONEINT: 890 case WLAN_SETNONE_GETONEINT:
2171 switch ((int)req->ifr_data) { 891 switch (wrq->u.param.value) {
2172 case WLANGETBCNAVG:
2173 pdata = (int *)wrq->u.name;
2174 *pdata = (int)adapter->bcn_avg_factor;
2175 break;
2176
2177 case WLANGETREGION: 892 case WLANGETREGION:
2178 pdata = (int *)wrq->u.name; 893 pdata = (int *)wrq->u.name;
2179 *pdata = (int)adapter->regioncode; 894 *pdata = (int)adapter->regioncode;
2180 break; 895 break;
2181
2182 case WLAN_GET_LISTEN_INTERVAL:
2183 pdata = (int *)wrq->u.name;
2184 *pdata = (int)adapter->listeninterval;
2185 break;
2186
2187 case WLAN_GET_LINKMODE:
2188 req->ifr_data = (char *)((u32) adapter->linkmode);
2189 break;
2190
2191 case WLAN_GET_RADIOMODE:
2192 req->ifr_data = (char *)((u32) adapter->radiomode);
2193 break;
2194
2195 case WLAN_GET_DEBUGMODE:
2196 req->ifr_data = (char *)((u32) adapter->debugmode);
2197 break;
2198
2199 case WLAN_GET_MULTIPLE_DTIM:
2200 pdata = (int *)wrq->u.name;
2201 *pdata = (int)adapter->multipledtim;
2202 break;
2203 case WLAN_GET_TX_RATE:
2204 ret = wlan_get_txrate_ioctl(priv, req);
2205 break;
2206 case WLAN_SUBCMD_FWT_CLEANUP: /* fwt_cleanup */ 896 case WLAN_SUBCMD_FWT_CLEANUP: /* fwt_cleanup */
2207 ret = wlan_fwt_cleanup_ioctl(priv, req); 897 ret = wlan_fwt_cleanup_ioctl(priv, req);
2208 break; 898 break;
@@ -2222,196 +912,8 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
2222 912
2223 break; 913 break;
2224 914
2225 case WLANGETLOG:
2226 ret = wlan_do_getlog_ioctl(priv, wrq);
2227 break;
2228
2229 case WLAN_SET_GET_SIXTEEN_INT: 915 case WLAN_SET_GET_SIXTEEN_INT:
2230 switch ((int)wrq->u.data.flags) { 916 switch ((int)wrq->u.data.flags) {
2231 case WLAN_TPCCFG:
2232 {
2233 int data[5];
2234 struct cmd_ds_802_11_tpc_cfg cfg;
2235 memset(&cfg, 0, sizeof(cfg));
2236 if ((wrq->u.data.length > 1)
2237 && (wrq->u.data.length != 5))
2238 return -1;
2239
2240 if (wrq->u.data.length == 0) {
2241 cfg.action =
2242 cpu_to_le16
2243 (cmd_act_get);
2244 } else {
2245 if (copy_from_user
2246 (data, wrq->u.data.pointer,
2247 sizeof(int) * 5)) {
2248 lbs_pr_debug(1,
2249 "Copy from user failed\n");
2250 return -EFAULT;
2251 }
2252
2253 cfg.action =
2254 cpu_to_le16
2255 (cmd_act_set);
2256 cfg.enable = data[0];
2257 cfg.usesnr = data[1];
2258 cfg.P0 = data[2];
2259 cfg.P1 = data[3];
2260 cfg.P2 = data[4];
2261 }
2262
2263 ret =
2264 libertas_prepare_and_send_command(priv,
2265 cmd_802_11_tpc_cfg,
2266 0,
2267 cmd_option_waitforrsp,
2268 0, (void *)&cfg);
2269
2270 data[0] = cfg.enable;
2271 data[1] = cfg.usesnr;
2272 data[2] = cfg.P0;
2273 data[3] = cfg.P1;
2274 data[4] = cfg.P2;
2275 if (copy_to_user
2276 (wrq->u.data.pointer, data,
2277 sizeof(int) * 5)) {
2278 lbs_pr_debug(1, "Copy to user failed\n");
2279 return -EFAULT;
2280 }
2281
2282 wrq->u.data.length = 5;
2283 }
2284 break;
2285
2286 case WLAN_POWERCFG:
2287 {
2288 int data[4];
2289 struct cmd_ds_802_11_pwr_cfg cfg;
2290 memset(&cfg, 0, sizeof(cfg));
2291 if ((wrq->u.data.length > 1)
2292 && (wrq->u.data.length != 4))
2293 return -1;
2294 if (wrq->u.data.length == 0) {
2295 cfg.action =
2296 cpu_to_le16
2297 (cmd_act_get);
2298 } else {
2299 if (copy_from_user
2300 (data, wrq->u.data.pointer,
2301 sizeof(int) * 4)) {
2302 lbs_pr_debug(1,
2303 "Copy from user failed\n");
2304 return -EFAULT;
2305 }
2306
2307 cfg.action =
2308 cpu_to_le16
2309 (cmd_act_set);
2310 cfg.enable = data[0];
2311 cfg.PA_P0 = data[1];
2312 cfg.PA_P1 = data[2];
2313 cfg.PA_P2 = data[3];
2314 }
2315 ret =
2316 libertas_prepare_and_send_command(priv,
2317 cmd_802_11_pwr_cfg,
2318 0,
2319 cmd_option_waitforrsp,
2320 0, (void *)&cfg);
2321 data[0] = cfg.enable;
2322 data[1] = cfg.PA_P0;
2323 data[2] = cfg.PA_P1;
2324 data[3] = cfg.PA_P2;
2325 if (copy_to_user
2326 (wrq->u.data.pointer, data,
2327 sizeof(int) * 4)) {
2328 lbs_pr_debug(1, "Copy to user failed\n");
2329 return -EFAULT;
2330 }
2331
2332 wrq->u.data.length = 4;
2333 }
2334 break;
2335 case WLAN_AUTO_FREQ_SET:
2336 {
2337 int data[3];
2338 struct cmd_ds_802_11_afc afc;
2339 memset(&afc, 0, sizeof(afc));
2340 if (wrq->u.data.length != 3)
2341 return -1;
2342 if (copy_from_user
2343 (data, wrq->u.data.pointer,
2344 sizeof(int) * 3)) {
2345 lbs_pr_debug(1, "Copy from user failed\n");
2346 return -EFAULT;
2347 }
2348 afc.afc_auto = data[0];
2349
2350 if (afc.afc_auto != 0) {
2351 afc.threshold = data[1];
2352 afc.period = data[2];
2353 } else {
2354 afc.timing_offset = data[1];
2355 afc.carrier_offset = data[2];
2356 }
2357 ret =
2358 libertas_prepare_and_send_command(priv,
2359 cmd_802_11_set_afc,
2360 0,
2361 cmd_option_waitforrsp,
2362 0, (void *)&afc);
2363 }
2364 break;
2365 case WLAN_AUTO_FREQ_GET:
2366 {
2367 int data[3];
2368 struct cmd_ds_802_11_afc afc;
2369 memset(&afc, 0, sizeof(afc));
2370 ret =
2371 libertas_prepare_and_send_command(priv,
2372 cmd_802_11_get_afc,
2373 0,
2374 cmd_option_waitforrsp,
2375 0, (void *)&afc);
2376 data[0] = afc.afc_auto;
2377 data[1] = afc.timing_offset;
2378 data[2] = afc.carrier_offset;
2379 if (copy_to_user
2380 (wrq->u.data.pointer, data,
2381 sizeof(int) * 3)) {
2382 lbs_pr_debug(1, "Copy to user failed\n");
2383 return -EFAULT;
2384 }
2385
2386 wrq->u.data.length = 3;
2387 }
2388 break;
2389 case WLAN_SCANPROBES:
2390 {
2391 int data;
2392 if (wrq->u.data.length > 0) {
2393 if (copy_from_user
2394 (&data, wrq->u.data.pointer,
2395 sizeof(int))) {
2396 lbs_pr_debug(1,
2397 "Copy from user failed\n");
2398 return -EFAULT;
2399 }
2400
2401 adapter->scanprobes = data;
2402 } else {
2403 data = adapter->scanprobes;
2404 if (copy_to_user
2405 (wrq->u.data.pointer, &data,
2406 sizeof(int))) {
2407 lbs_pr_debug(1,
2408 "Copy to user failed\n");
2409 return -EFAULT;
2410 }
2411 }
2412 wrq->u.data.length = 1;
2413 }
2414 break;
2415 case WLAN_LED_GPIO_CTRL: 917 case WLAN_LED_GPIO_CTRL:
2416 { 918 {
2417 int i; 919 int i;
@@ -2475,17 +977,6 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
2475 wrq->u.data.length = gpio->header.len; 977 wrq->u.data.length = gpio->header.len;
2476 } 978 }
2477 break; 979 break;
2478 case WLAN_ADAPT_RATESET:
2479 ret = wlan_adapt_rateset(priv, wrq);
2480 break;
2481 case WLAN_INACTIVITY_TIMEOUT:
2482 ret = wlan_inactivity_timeout(priv, wrq);
2483 break;
2484 case WLANSNR:
2485 ret = wlan_get_snr(priv, wrq);
2486 break;
2487 case WLAN_GET_RXINFO:
2488 ret = wlan_get_rxinfo(priv, wrq);
2489 } 980 }
2490 break; 981 break;
2491 982
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c
index 11682cbe752b..d4926b83e145 100644
--- a/drivers/net/wireless/libertas/join.c
+++ b/drivers/net/wireless/libertas/join.c
@@ -15,6 +15,8 @@
15#include "join.h" 15#include "join.h"
16#include "dev.h" 16#include "dev.h"
17 17
18#define AD_HOC_CAP_PRIVACY_ON 1
19
18/** 20/**
19 * @brief This function finds out the common rates between rate1 and rate2. 21 * @brief This function finds out the common rates between rate1 and rate2.
20 * 22 *
@@ -85,7 +87,7 @@ int libertas_send_deauth(wlan_private * priv)
85 wlan_adapter *adapter = priv->adapter; 87 wlan_adapter *adapter = priv->adapter;
86 int ret = 0; 88 int ret = 0;
87 89
88 if (adapter->inframode == wlan802_11infrastructure && 90 if (adapter->mode == IW_MODE_INFRA &&
89 adapter->connect_status == libertas_connected) 91 adapter->connect_status == libertas_connected)
90 ret = libertas_send_deauthentication(priv); 92 ret = libertas_send_deauthentication(priv);
91 else 93 else
@@ -94,20 +96,6 @@ int libertas_send_deauth(wlan_private * priv)
94 return ret; 96 return ret;
95} 97}
96 98
97int libertas_do_adhocstop_ioctl(wlan_private * priv)
98{
99 wlan_adapter *adapter = priv->adapter;
100 int ret = 0;
101
102 if (adapter->inframode == wlan802_11ibss &&
103 adapter->connect_status == libertas_connected)
104 ret = libertas_stop_adhoc_network(priv);
105 else
106 ret = -ENOTSUPP;
107
108 return ret;
109}
110
111/** 99/**
112 * @brief Associate to a specific BSS discovered in a scan 100 * @brief Associate to a specific BSS discovered in a scan
113 * 101 *
@@ -207,8 +195,7 @@ int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbs
207 /* check if the requested SSID is already joined */ 195 /* check if the requested SSID is already joined */
208 if (adapter->curbssparams.ssid.ssidlength 196 if (adapter->curbssparams.ssid.ssidlength
209 && !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid) 197 && !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid)
210 && (adapter->curbssparams.bssdescriptor.inframode == 198 && (adapter->mode == IW_MODE_ADHOC)) {
211 wlan802_11ibss)) {
212 199
213 lbs_pr_debug(1, 200 lbs_pr_debug(1,
214 "ADHOC_J_CMD: New ad-hoc SSID is the same as current, " 201 "ADHOC_J_CMD: New ad-hoc SSID is the same as current, "
@@ -261,130 +248,6 @@ int libertas_send_deauthentication(wlan_private * priv)
261} 248}
262 249
263/** 250/**
264 * @brief Set Idle Off
265 *
266 * @param priv A pointer to wlan_private structure
267 * @return 0 --success, otherwise fail
268 */
269int libertas_idle_off(wlan_private * priv)
270{
271 wlan_adapter *adapter = priv->adapter;
272 int ret = 0;
273 const u8 zeromac[] = { 0, 0, 0, 0, 0, 0 };
274 int i;
275
276 ENTER();
277
278 if (adapter->connect_status == libertas_disconnected) {
279 if (adapter->inframode == wlan802_11infrastructure) {
280 if (memcmp(adapter->previousbssid, zeromac,
281 sizeof(zeromac)) != 0) {
282
283 lbs_pr_debug(1, "Previous SSID = %s\n",
284 adapter->previousssid.ssid);
285 lbs_pr_debug(1, "Previous BSSID = "
286 "%02x:%02x:%02x:%02x:%02x:%02x:\n",
287 adapter->previousbssid[0],
288 adapter->previousbssid[1],
289 adapter->previousbssid[2],
290 adapter->previousbssid[3],
291 adapter->previousbssid[4],
292 adapter->previousbssid[5]);
293
294 i = libertas_find_SSID_in_list(adapter,
295 &adapter->previousssid,
296 adapter->previousbssid,
297 adapter->inframode);
298
299 if (i < 0) {
300 libertas_send_specific_BSSID_scan(priv,
301 adapter->
302 previousbssid,
303 1);
304 i = libertas_find_SSID_in_list(adapter,
305 &adapter->
306 previousssid,
307 adapter->
308 previousbssid,
309 adapter->
310 inframode);
311 }
312
313 if (i < 0) {
314 /* If the BSSID could not be found, try just the SSID */
315 i = libertas_find_SSID_in_list(adapter,
316 &adapter->
317 previousssid, NULL,
318 adapter->
319 inframode);
320 }
321
322 if (i < 0) {
323 libertas_send_specific_SSID_scan(priv,
324 &adapter->
325 previousssid,
326 1);
327 i = libertas_find_SSID_in_list(adapter,
328 &adapter->
329 previousssid, NULL,
330 adapter->
331 inframode);
332 }
333
334 if (i >= 0) {
335 ret =
336 wlan_associate(priv,
337 &adapter->
338 scantable[i]);
339 }
340 }
341 } else if (adapter->inframode == wlan802_11ibss) {
342 ret = libertas_prepare_and_send_command(priv,
343 cmd_802_11_ad_hoc_start,
344 0,
345 cmd_option_waitforrsp,
346 0, &adapter->previousssid);
347 }
348 }
349 /* else it is connected */
350
351 lbs_pr_debug(1, "\nwlanidle is off");
352 LEAVE();
353 return ret;
354}
355
356/**
357 * @brief Set Idle On
358 *
359 * @param priv A pointer to wlan_private structure
360 * @return 0 --success, otherwise fail
361 */
362int libertas_idle_on(wlan_private * priv)
363{
364 wlan_adapter *adapter = priv->adapter;
365 int ret = 0;
366
367 if (adapter->connect_status == libertas_connected) {
368 if (adapter->inframode == wlan802_11infrastructure) {
369 lbs_pr_debug(1, "Previous SSID = %s\n",
370 adapter->previousssid.ssid);
371 memmove(&adapter->previousssid,
372 &adapter->curbssparams.ssid,
373 sizeof(struct WLAN_802_11_SSID));
374 libertas_send_deauth(priv);
375
376 } else if (adapter->inframode == wlan802_11ibss) {
377 ret = libertas_stop_adhoc_network(priv);
378 }
379
380 }
381
382 lbs_pr_debug(1, "\nwlanidle is on");
383
384 return ret;
385}
386
387/**
388 * @brief This function prepares command of authenticate. 251 * @brief This function prepares command of authenticate.
389 * 252 *
390 * @param priv A pointer to wlan_private structure 253 * @param priv A pointer to wlan_private structure
@@ -398,22 +261,39 @@ int libertas_cmd_80211_authenticate(wlan_private * priv,
398 void *pdata_buf) 261 void *pdata_buf)
399{ 262{
400 wlan_adapter *adapter = priv->adapter; 263 wlan_adapter *adapter = priv->adapter;
401 struct cmd_ds_802_11_authenticate *pauthenticate = 264 struct cmd_ds_802_11_authenticate *pauthenticate = &cmd->params.auth;
402 &cmd->params.auth; 265 int ret = -1;
403 u8 *bssid = pdata_buf; 266 u8 *bssid = pdata_buf;
404 267
405 cmd->command = cpu_to_le16(cmd_802_11_authenticate); 268 cmd->command = cpu_to_le16(cmd_802_11_authenticate);
406 cmd->size = 269 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate)
407 cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate) 270 + S_DS_GEN);
408 + S_DS_GEN); 271
272 /* translate auth mode to 802.11 defined wire value */
273 switch (adapter->secinfo.auth_mode) {
274 case IW_AUTH_ALG_OPEN_SYSTEM:
275 pauthenticate->authtype = 0x00;
276 break;
277 case IW_AUTH_ALG_SHARED_KEY:
278 pauthenticate->authtype = 0x01;
279 break;
280 case IW_AUTH_ALG_LEAP:
281 pauthenticate->authtype = 0x80;
282 break;
283 default:
284 lbs_pr_debug(1, "AUTH_CMD: invalid auth alg 0x%X\n",
285 adapter->secinfo.auth_mode);
286 goto out;
287 }
409 288
410 pauthenticate->authtype = adapter->secinfo.authmode;
411 memcpy(pauthenticate->macaddr, bssid, ETH_ALEN); 289 memcpy(pauthenticate->macaddr, bssid, ETH_ALEN);
412 290
413 lbs_pr_debug(1, "AUTH_CMD: Bssid is : %x:%x:%x:%x:%x:%x\n", 291 lbs_pr_debug(1, "AUTH_CMD: Bssid is : %x:%x:%x:%x:%x:%x\n",
414 bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]); 292 bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]);
293 ret = 0;
415 294
416 return 0; 295out:
296 return ret;
417} 297}
418 298
419int libertas_cmd_80211_deauthenticate(wlan_private * priv, 299int libertas_cmd_80211_deauthenticate(wlan_private * priv,
@@ -550,7 +430,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
550 lbs_pr_debug(1, "ASSOC_CMD: rates->header.len = %d\n", rates->header.len); 430 lbs_pr_debug(1, "ASSOC_CMD: rates->header.len = %d\n", rates->header.len);
551 431
552 /* set IBSS field */ 432 /* set IBSS field */
553 if (pbssdesc->inframode == wlan802_11infrastructure) { 433 if (pbssdesc->mode == IW_MODE_INFRA) {
554#define CAPINFO_ESS_MODE 1 434#define CAPINFO_ESS_MODE 1
555 passo->capinfo.ess = CAPINFO_ESS_MODE; 435 passo->capinfo.ess = CAPINFO_ESS_MODE;
556 } 436 }
@@ -624,7 +504,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
624 504
625 /* set the BSS type */ 505 /* set the BSS type */
626 adhs->bsstype = cmd_bss_type_ibss; 506 adhs->bsstype = cmd_bss_type_ibss;
627 pbssdesc->inframode = wlan802_11ibss; 507 pbssdesc->mode = IW_MODE_ADHOC;
628 adhs->beaconperiod = adapter->beaconperiod; 508 adhs->beaconperiod = adapter->beaconperiod;
629 509
630 /* set Physical param set */ 510 /* set Physical param set */
@@ -666,15 +546,12 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
666 adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); 546 adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
667 547
668 /* set up privacy in adapter->scantable[i] */ 548 /* set up privacy in adapter->scantable[i] */
669 if (adapter->secinfo.WEPstatus == wlan802_11WEPenabled) { 549 if (adapter->secinfo.wep_enabled) {
670 550 lbs_pr_debug(1, "ADHOC_S_CMD: WEP enabled, setting privacy on\n");
671#define AD_HOC_CAP_PRIVACY_ON 1
672 lbs_pr_debug(1, "ADHOC_S_CMD: WEPstatus set, privacy to WEP\n");
673 pbssdesc->privacy = wlan802_11privfilter8021xWEP; 551 pbssdesc->privacy = wlan802_11privfilter8021xWEP;
674 adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON; 552 adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON;
675 } else { 553 } else {
676 lbs_pr_debug(1, "ADHOC_S_CMD: WEPstatus NOT set, Setting " 554 lbs_pr_debug(1, "ADHOC_S_CMD: WEP disabled, setting privacy off\n");
677 "privacy to ACCEPT ALL\n");
678 pbssdesc->privacy = wlan802_11privfilteracceptall; 555 pbssdesc->privacy = wlan802_11privfilteracceptall;
679 } 556 }
680 557
@@ -786,9 +663,6 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
786 padhocjoin->bssdescriptor.BSSID[5], 663 padhocjoin->bssdescriptor.BSSID[5],
787 padhocjoin->bssdescriptor.SSID); 664 padhocjoin->bssdescriptor.SSID);
788 665
789 lbs_pr_debug(1, "ADHOC_J_CMD: Data Rate = %x\n",
790 (u32) padhocjoin->bssdescriptor.datarates);
791
792 /* failtimeout */ 666 /* failtimeout */
793 padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); 667 padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT);
794 668
@@ -832,7 +706,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
832 padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow = 706 padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow =
833 cpu_to_le16(pbssdesc->atimwindow); 707 cpu_to_le16(pbssdesc->atimwindow);
834 708
835 if (adapter->secinfo.WEPstatus == wlan802_11WEPenabled) { 709 if (adapter->secinfo.wep_enabled) {
836 padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON; 710 padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON;
837 } 711 }
838 712
diff --git a/drivers/net/wireless/libertas/join.h b/drivers/net/wireless/libertas/join.h
index 8efa2455af9a..115f5a8ba346 100644
--- a/drivers/net/wireless/libertas/join.h
+++ b/drivers/net/wireless/libertas/join.h
@@ -1,6 +1,3 @@
1/* -*- mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
2/* vi: set expandtab shiftwidth=4 tabstop=4 textwidth=78: */
3
4/** 1/**
5 * Interface for the wlan infrastructure and adhoc join routines 2 * Interface for the wlan infrastructure and adhoc join routines
6 * 3 *
@@ -40,10 +37,6 @@ extern int libertas_ret_80211_disassociate(wlan_private * priv,
40extern int libertas_ret_80211_associate(wlan_private * priv, 37extern int libertas_ret_80211_associate(wlan_private * priv,
41 struct cmd_ds_command *resp); 38 struct cmd_ds_command *resp);
42 39
43extern int libertas_idle_on(wlan_private * priv);
44extern int libertas_idle_off(wlan_private * priv);
45
46extern int libertas_do_adhocstop_ioctl(wlan_private * priv);
47extern int libertas_reassociation_thread(void *data); 40extern int libertas_reassociation_thread(void *data);
48 41
49struct WLAN_802_11_SSID; 42struct WLAN_802_11_SSID;
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index dcbf102a057e..b9b25ce65919 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -21,6 +21,13 @@
21#include "debugfs.h" 21#include "debugfs.h"
22#include "assoc.h" 22#include "assoc.h"
23 23
24#define DRIVER_RELEASE_VERSION "320.p0"
25const char libertas_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION
26#ifdef DEBUG
27 "-dbg"
28#endif
29 "";
30
24#ifdef ENABLE_PM 31#ifdef ENABLE_PM
25static struct pm_dev *wlan_pm_dev = NULL; 32static struct pm_dev *wlan_pm_dev = NULL;
26#endif 33#endif
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index 7e3f78f092dc..d17924f764e5 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -210,7 +210,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
210 goto done; 210 goto done;
211 } 211 }
212 212
213 lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %d = %d\n", 213 lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n",
214 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); 214 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
215 215
216 lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr, 216 lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr,
@@ -364,7 +364,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
364 priv->stats.rx_errors++; 364 priv->stats.rx_errors++;
365 } 365 }
366 366
367 lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %d = %d\n", 367 lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n",
368 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); 368 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
369 369
370 /* create the exported radio header */ 370 /* create the exported radio header */
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index e18706238951..3c0b1a2a1727 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -1,6 +1,3 @@
1/* -*- mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
2/* vi: set expandtab shiftwidth=4 tabstop=4 textwidth=78: */
3
4/** 1/**
5 * Functions implementing wlan scan IOCTL and firmware command APIs 2 * Functions implementing wlan scan IOCTL and firmware command APIs
6 * 3 *
@@ -87,118 +84,95 @@
87 * 84 *
88 * @return Index in scantable, or error code if negative 85 * @return Index in scantable, or error code if negative
89 */ 86 */
90static int is_network_compatible(wlan_adapter * adapter, int index, int mode) 87static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
91{ 88{
92 ENTER(); 89 ENTER();
93 90
94 if (adapter->scantable[index].inframode == mode) { 91 if (adapter->scantable[index].mode == mode) {
95 if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled 92 if ( !adapter->secinfo.wep_enabled
96 && !adapter->secinfo.WPAenabled 93 && !adapter->secinfo.WPAenabled
97 && !adapter->secinfo.WPA2enabled 94 && !adapter->secinfo.WPA2enabled
98 && adapter->scantable[index].wpa_supplicant.wpa_ie[0] != 95 && adapter->scantable[index].wpa_ie[0] != WPA_IE
99 WPA_IE 96 && adapter->scantable[index].rsn_ie[0] != WPA2_IE
100 && adapter->scantable[index].wpa2_supplicant.wpa_ie[0] !=
101 WPA2_IE && adapter->secinfo.Encryptionmode == CIPHER_NONE
102 && !adapter->scantable[index].privacy) { 97 && !adapter->scantable[index].privacy) {
103 /* no security */ 98 /* no security */
104 LEAVE(); 99 LEAVE();
105 return index; 100 return index;
106 } else if (adapter->secinfo.WEPstatus == wlan802_11WEPenabled 101 } else if ( adapter->secinfo.wep_enabled
107 && !adapter->secinfo.WPAenabled 102 && !adapter->secinfo.WPAenabled
108 && !adapter->secinfo.WPA2enabled 103 && !adapter->secinfo.WPA2enabled
109 && adapter->scantable[index].privacy) { 104 && adapter->scantable[index].privacy) {
110 /* static WEP enabled */ 105 /* static WEP enabled */
111 LEAVE(); 106 LEAVE();
112 return index; 107 return index;
113 } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled 108 } else if ( !adapter->secinfo.wep_enabled
114 && adapter->secinfo.WPAenabled 109 && adapter->secinfo.WPAenabled
115 && !adapter->secinfo.WPA2enabled 110 && !adapter->secinfo.WPA2enabled
116 && (adapter->scantable[index].wpa_supplicant. 111 && (adapter->scantable[index].wpa_ie[0] == WPA_IE)
117 wpa_ie[0]
118 == WPA_IE)
119 /* privacy bit may NOT be set in some APs like LinkSys WRT54G 112 /* privacy bit may NOT be set in some APs like LinkSys WRT54G
120 && adapter->scantable[index].privacy */ 113 && adapter->scantable[index].privacy */
121 ) { 114 ) {
122 /* WPA enabled */ 115 /* WPA enabled */
123 lbs_pr_debug(1, 116 lbs_pr_debug(1,
124 "is_network_compatible() WPA: index=%d wpa_ie=%#x " 117 "is_network_compatible() WPA: index=%d wpa_ie=%#x "
125 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x " 118 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
126 "privacy=%#x\n", index, 119 "privacy=%#x\n", index,
127 adapter->scantable[index].wpa_supplicant. 120 adapter->scantable[index].wpa_ie[0],
128 wpa_ie[0], 121 adapter->scantable[index].rsn_ie[0],
129 adapter->scantable[index].wpa2_supplicant. 122 adapter->secinfo.wep_enabled ? "e" : "d",
130 wpa_ie[0], 123 adapter->secinfo.WPAenabled ? "e" : "d",
131 (adapter->secinfo.WEPstatus == 124 adapter->secinfo.WPA2enabled ? "e" : "d",
132 wlan802_11WEPenabled) ? "e" : "d",
133 (adapter->secinfo.WPAenabled) ? "e" : "d",
134 (adapter->secinfo.WPA2enabled) ? "e" : "d",
135 adapter->secinfo.Encryptionmode,
136 adapter->scantable[index].privacy); 125 adapter->scantable[index].privacy);
137 LEAVE(); 126 LEAVE();
138 return index; 127 return index;
139 } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled 128 } else if ( !adapter->secinfo.wep_enabled
140 && !adapter->secinfo.WPAenabled 129 && !adapter->secinfo.WPAenabled
141 && adapter->secinfo.WPA2enabled 130 && adapter->secinfo.WPA2enabled
142 && (adapter->scantable[index].wpa2_supplicant. 131 && (adapter->scantable[index].rsn_ie[0] == WPA2_IE)
143 wpa_ie[0]
144 == WPA2_IE)
145 /* privacy bit may NOT be set in some APs like LinkSys WRT54G 132 /* privacy bit may NOT be set in some APs like LinkSys WRT54G
146 && adapter->scantable[index].privacy */ 133 && adapter->scantable[index].privacy */
147 ) { 134 ) {
148 /* WPA2 enabled */ 135 /* WPA2 enabled */
149 lbs_pr_debug(1, 136 lbs_pr_debug(1,
150 "is_network_compatible() WPA2: index=%d wpa_ie=%#x " 137 "is_network_compatible() WPA2: index=%d wpa_ie=%#x "
151 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x " 138 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
152 "privacy=%#x\n", index, 139 "privacy=%#x\n", index,
153 adapter->scantable[index].wpa_supplicant. 140 adapter->scantable[index].wpa_ie[0],
154 wpa_ie[0], 141 adapter->scantable[index].rsn_ie[0],
155 adapter->scantable[index].wpa2_supplicant. 142 adapter->secinfo.wep_enabled ? "e" : "d",
156 wpa_ie[0], 143 adapter->secinfo.WPAenabled ? "e" : "d",
157 (adapter->secinfo.WEPstatus == 144 adapter->secinfo.WPA2enabled ? "e" : "d",
158 wlan802_11WEPenabled) ? "e" : "d",
159 (adapter->secinfo.WPAenabled) ? "e" : "d",
160 (adapter->secinfo.WPA2enabled) ? "e" : "d",
161 adapter->secinfo.Encryptionmode,
162 adapter->scantable[index].privacy); 145 adapter->scantable[index].privacy);
163 LEAVE(); 146 LEAVE();
164 return index; 147 return index;
165 } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled 148 } else if ( !adapter->secinfo.wep_enabled
166 && !adapter->secinfo.WPAenabled 149 && !adapter->secinfo.WPAenabled
167 && !adapter->secinfo.WPA2enabled 150 && !adapter->secinfo.WPA2enabled
168 && (adapter->scantable[index].wpa_supplicant. 151 && (adapter->scantable[index].wpa_ie[0] != WPA_IE)
169 wpa_ie[0] 152 && (adapter->scantable[index].rsn_ie[0] != WPA2_IE)
170 != WPA_IE)
171 && (adapter->scantable[index].wpa2_supplicant.
172 wpa_ie[0]
173 != WPA2_IE)
174 && adapter->secinfo.Encryptionmode != CIPHER_NONE
175 && adapter->scantable[index].privacy) { 153 && adapter->scantable[index].privacy) {
176 /* dynamic WEP enabled */ 154 /* dynamic WEP enabled */
177 lbs_pr_debug(1, 155 lbs_pr_debug(1,
178 "is_network_compatible() dynamic WEP: index=%d " 156 "is_network_compatible() dynamic WEP: index=%d "
179 "wpa_ie=%#x wpa2_ie=%#x Encmode=%#x privacy=%#x\n", 157 "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n",
180 index, 158 index,
181 adapter->scantable[index].wpa_supplicant. 159 adapter->scantable[index].wpa_ie[0],
182 wpa_ie[0], 160 adapter->scantable[index].rsn_ie[0],
183 adapter->scantable[index].wpa2_supplicant.
184 wpa_ie[0], adapter->secinfo.Encryptionmode,
185 adapter->scantable[index].privacy); 161 adapter->scantable[index].privacy);
186 LEAVE(); 162 LEAVE();
187 return index; 163 return index;
188 } 164 }
189 165
190 /* security doesn't match */ 166 /* security doesn't match */
191 lbs_pr_debug(1, 167 lbs_pr_debug(1,
192 "is_network_compatible() FAILED: index=%d wpa_ie=%#x " 168 "is_network_compatible() FAILED: index=%d wpa_ie=%#x "
193 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x privacy=%#x\n", 169 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n",
194 index, 170 index,
195 adapter->scantable[index].wpa_supplicant.wpa_ie[0], 171 adapter->scantable[index].wpa_ie[0],
196 adapter->scantable[index].wpa2_supplicant.wpa_ie[0], 172 adapter->scantable[index].rsn_ie[0],
197 (adapter->secinfo.WEPstatus == 173 adapter->secinfo.wep_enabled ? "e" : "d",
198 wlan802_11WEPenabled) ? "e" : "d", 174 adapter->secinfo.WPAenabled ? "e" : "d",
199 (adapter->secinfo.WPAenabled) ? "e" : "d", 175 adapter->secinfo.WPA2enabled ? "e" : "d",
200 (adapter->secinfo.WPA2enabled) ? "e" : "d",
201 adapter->secinfo.Encryptionmode,
202 adapter->scantable[index].privacy); 176 adapter->scantable[index].privacy);
203 LEAVE(); 177 LEAVE();
204 return -ECONNREFUSED; 178 return -ECONNREFUSED;
@@ -924,8 +898,6 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
924 u8 founddatarateie; 898 u8 founddatarateie;
925 int bytesleftforcurrentbeacon; 899 int bytesleftforcurrentbeacon;
926 900
927 struct WPA_SUPPLICANT *pwpa_supplicant;
928 struct WPA_SUPPLICANT *pwpa2_supplicant;
929 struct IE_WPA *pIe; 901 struct IE_WPA *pIe;
930 const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 }; 902 const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 };
931 903
@@ -962,9 +934,6 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
962 934
963 bytesleftforcurrentbeacon = beaconsize; 935 bytesleftforcurrentbeacon = beaconsize;
964 936
965 pwpa_supplicant = &pBSSEntry->wpa_supplicant;
966 pwpa2_supplicant = &pBSSEntry->wpa2_supplicant;
967
968 memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN); 937 memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN);
969 lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n", 938 lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n",
970 pBSSEntry->macaddress[0], pBSSEntry->macaddress[1], 939 pBSSEntry->macaddress[0], pBSSEntry->macaddress[1],
@@ -1027,9 +996,9 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1027 } 996 }
1028 997
1029 if (pcap->ibss == 1) { 998 if (pcap->ibss == 1) {
1030 pBSSEntry->inframode = wlan802_11ibss; 999 pBSSEntry->mode = IW_MODE_ADHOC;
1031 } else { 1000 } else {
1032 pBSSEntry->inframode = wlan802_11infrastructure; 1001 pBSSEntry->mode = IW_MODE_INFRA;
1033 } 1002 }
1034 1003
1035 /* process variable IE */ 1004 /* process variable IE */
@@ -1116,7 +1085,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1116 sizeof(pcountryinfo->countrycode) 1085 sizeof(pcountryinfo->countrycode)
1117 || pcountryinfo->len > 254) { 1086 || pcountryinfo->len > 254) {
1118 lbs_pr_debug(1, "InterpretIE: 11D- Err " 1087 lbs_pr_debug(1, "InterpretIE: 11D- Err "
1119 "CountryInfo len =%d min=%d max=254\n", 1088 "CountryInfo len =%d min=%zd max=254\n",
1120 pcountryinfo->len, 1089 pcountryinfo->len,
1121 sizeof(pcountryinfo->countrycode)); 1090 sizeof(pcountryinfo->countrycode));
1122 LEAVE(); 1091 LEAVE();
@@ -1160,27 +1129,27 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1160#define IE_ID_LEN_FIELDS_BYTES 2 1129#define IE_ID_LEN_FIELDS_BYTES 2
1161 pIe = (struct IE_WPA *)pcurrentptr; 1130 pIe = (struct IE_WPA *)pcurrentptr;
1162 1131
1163 if (!memcmp(pIe->oui, oui01, sizeof(oui01))) { 1132 if (memcmp(pIe->oui, oui01, sizeof(oui01)))
1164 pwpa_supplicant->wpa_ie_len 1133 break;
1165 = min_t(size_t, elemlen + IE_ID_LEN_FIELDS_BYTES, 1134
1166 sizeof(pwpa_supplicant->wpa_ie)); 1135 pBSSEntry->wpa_ie_len = min_t(size_t,
1167 memcpy(pwpa_supplicant->wpa_ie, 1136 elemlen + IE_ID_LEN_FIELDS_BYTES,
1168 pcurrentptr, 1137 sizeof(pBSSEntry->wpa_ie));
1169 pwpa_supplicant->wpa_ie_len); 1138 memcpy(pBSSEntry->wpa_ie, pcurrentptr,
1170 lbs_dbg_hex("InterpretIE: Resp WPA_IE", 1139 pBSSEntry->wpa_ie_len);
1171 pwpa_supplicant->wpa_ie, elemlen); 1140 lbs_dbg_hex("InterpretIE: Resp WPA_IE",
1172 } 1141 pBSSEntry->wpa_ie, elemlen);
1173 break; 1142 break;
1174 case WPA2_IE: 1143 case WPA2_IE:
1175 pIe = (struct IE_WPA *)pcurrentptr; 1144 pIe = (struct IE_WPA *)pcurrentptr;
1176 pwpa2_supplicant->wpa_ie_len
1177 = min_t(size_t, elemlen + IE_ID_LEN_FIELDS_BYTES,
1178 sizeof(pwpa2_supplicant->wpa_ie));
1179 memcpy(pwpa2_supplicant->wpa_ie,
1180 pcurrentptr, pwpa2_supplicant->wpa_ie_len);
1181 1145
1146 pBSSEntry->rsn_ie_len = min_t(size_t,
1147 elemlen + IE_ID_LEN_FIELDS_BYTES,
1148 sizeof(pBSSEntry->rsn_ie));
1149 memcpy(pBSSEntry->rsn_ie, pcurrentptr,
1150 pBSSEntry->rsn_ie_len);
1182 lbs_dbg_hex("InterpretIE: Resp WPA2_IE", 1151 lbs_dbg_hex("InterpretIE: Resp WPA2_IE",
1183 pwpa2_supplicant->wpa_ie, elemlen); 1152 pBSSEntry->rsn_ie, elemlen);
1184 break; 1153 break;
1185 case TIM: 1154 case TIM:
1186 break; 1155 break;
@@ -1227,7 +1196,7 @@ int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *s
1227 * 1196 *
1228 * @return index in BSSID list, or error return code (< 0) 1197 * @return index in BSSID list, or error return code (< 0)
1229 */ 1198 */
1230int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode) 1199int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode)
1231{ 1200{
1232 int ret = -ENETUNREACH; 1201 int ret = -ENETUNREACH;
1233 int i; 1202 int i;
@@ -1247,8 +1216,8 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode)
1247 for (i = 0; ret < 0 && i < adapter->numinscantable; i++) { 1216 for (i = 0; ret < 0 && i < adapter->numinscantable; i++) {
1248 if (!memcmp(adapter->scantable[i].macaddress, bssid, ETH_ALEN)) { 1217 if (!memcmp(adapter->scantable[i].macaddress, bssid, ETH_ALEN)) {
1249 switch (mode) { 1218 switch (mode) {
1250 case wlan802_11infrastructure: 1219 case IW_MODE_INFRA:
1251 case wlan802_11ibss: 1220 case IW_MODE_ADHOC:
1252 ret = is_network_compatible(adapter, i, mode); 1221 ret = is_network_compatible(adapter, i, mode);
1253 break; 1222 break;
1254 default: 1223 default:
@@ -1272,7 +1241,7 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode)
1272 * @return index in BSSID list 1241 * @return index in BSSID list
1273 */ 1242 */
1274int libertas_find_SSID_in_list(wlan_adapter * adapter, 1243int libertas_find_SSID_in_list(wlan_adapter * adapter,
1275 struct WLAN_802_11_SSID *ssid, u8 * bssid, int mode) 1244 struct WLAN_802_11_SSID *ssid, u8 * bssid, u8 mode)
1276{ 1245{
1277 int net = -ENETUNREACH; 1246 int net = -ENETUNREACH;
1278 u8 bestrssi = 0; 1247 u8 bestrssi = 0;
@@ -1287,8 +1256,8 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
1287 !memcmp(adapter->scantable[i]. 1256 !memcmp(adapter->scantable[i].
1288 macaddress, bssid, ETH_ALEN))) { 1257 macaddress, bssid, ETH_ALEN))) {
1289 switch (mode) { 1258 switch (mode) {
1290 case wlan802_11infrastructure: 1259 case IW_MODE_INFRA:
1291 case wlan802_11ibss: 1260 case IW_MODE_ADHOC:
1292 j = is_network_compatible(adapter, i, mode); 1261 j = is_network_compatible(adapter, i, mode);
1293 1262
1294 if (j >= 0) { 1263 if (j >= 0) {
@@ -1311,7 +1280,7 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
1311 } 1280 }
1312 } 1281 }
1313 break; 1282 break;
1314 case wlan802_11autounknown: 1283 case IW_MODE_AUTO:
1315 default: 1284 default:
1316 if (SCAN_RSSI(adapter->scantable[i].rssi) 1285 if (SCAN_RSSI(adapter->scantable[i].rssi)
1317 > bestrssi) { 1286 > bestrssi) {
@@ -1338,8 +1307,7 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
1338 * 1307 *
1339 * @return index in BSSID list 1308 * @return index in BSSID list
1340 */ 1309 */
1341int libertas_find_best_SSID_in_list(wlan_adapter * adapter, 1310int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode)
1342 enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode)
1343{ 1311{
1344 int bestnet = -ENETUNREACH; 1312 int bestnet = -ENETUNREACH;
1345 u8 bestrssi = 0; 1313 u8 bestrssi = 0;
@@ -1351,8 +1319,8 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter,
1351 1319
1352 for (i = 0; i < adapter->numinscantable; i++) { 1320 for (i = 0; i < adapter->numinscantable; i++) {
1353 switch (mode) { 1321 switch (mode) {
1354 case wlan802_11infrastructure: 1322 case IW_MODE_INFRA:
1355 case wlan802_11ibss: 1323 case IW_MODE_ADHOC:
1356 if (is_network_compatible(adapter, i, mode) >= 0) { 1324 if (is_network_compatible(adapter, i, mode) >= 0) {
1357 if (SCAN_RSSI(adapter->scantable[i].rssi) > 1325 if (SCAN_RSSI(adapter->scantable[i].rssi) >
1358 bestrssi) { 1326 bestrssi) {
@@ -1363,7 +1331,7 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter,
1363 } 1331 }
1364 } 1332 }
1365 break; 1333 break;
1366 case wlan802_11autounknown: 1334 case IW_MODE_AUTO:
1367 default: 1335 default:
1368 if (SCAN_RSSI(adapter->scantable[i].rssi) > bestrssi) { 1336 if (SCAN_RSSI(adapter->scantable[i].rssi) > bestrssi) {
1369 bestrssi = 1337 bestrssi =
@@ -1388,8 +1356,7 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter,
1388 */ 1356 */
1389int libertas_find_best_network_SSID(wlan_private * priv, 1357int libertas_find_best_network_SSID(wlan_private * priv,
1390 struct WLAN_802_11_SSID *pSSID, 1358 struct WLAN_802_11_SSID *pSSID,
1391 enum WLAN_802_11_NETWORK_INFRASTRUCTURE preferred_mode, 1359 u8 preferred_mode, u8 *out_mode)
1392 enum WLAN_802_11_NETWORK_INFRASTRUCTURE *out_mode)
1393{ 1360{
1394 wlan_adapter *adapter = priv->adapter; 1361 wlan_adapter *adapter = priv->adapter;
1395 int ret = 0; 1362 int ret = 0;
@@ -1414,7 +1381,7 @@ int libertas_find_best_network_SSID(wlan_private * priv,
1414 preqbssid = &adapter->scantable[i]; 1381 preqbssid = &adapter->scantable[i];
1415 memcpy(pSSID, &preqbssid->ssid, 1382 memcpy(pSSID, &preqbssid->ssid,
1416 sizeof(struct WLAN_802_11_SSID)); 1383 sizeof(struct WLAN_802_11_SSID));
1417 *out_mode = preqbssid->inframode; 1384 *out_mode = preqbssid->mode;
1418 1385
1419 if (!pSSID->ssidlength) { 1386 if (!pSSID->ssidlength) {
1420 ret = -1; 1387 ret = -1;
@@ -1584,7 +1551,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1584 for (i = 0; i < adapter->numinscantable; i++) { 1551 for (i = 0; i < adapter->numinscantable; i++) {
1585 if ((current_ev + MAX_SCAN_CELL_SIZE) >= end_buf) { 1552 if ((current_ev + MAX_SCAN_CELL_SIZE) >= end_buf) {
1586 lbs_pr_debug(1, "i=%d break out: current_ev=%p end_buf=%p " 1553 lbs_pr_debug(1, "i=%d break out: current_ev=%p end_buf=%p "
1587 "MAX_SCAN_CELL_SIZE=%d\n", 1554 "MAX_SCAN_CELL_SIZE=%zd\n",
1588 i, current_ev, end_buf, MAX_SCAN_CELL_SIZE); 1555 i, current_ev, end_buf, MAX_SCAN_CELL_SIZE);
1589 break; 1556 break;
1590 } 1557 }
@@ -1632,7 +1599,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1632 1599
1633 //Add mode 1600 //Add mode
1634 iwe.cmd = SIOCGIWMODE; 1601 iwe.cmd = SIOCGIWMODE;
1635 iwe.u.mode = adapter->scantable[i].inframode + 1; 1602 iwe.u.mode = adapter->scantable[i].mode;
1636 iwe.len = IW_EV_UINT_LEN; 1603 iwe.len = IW_EV_UINT_LEN;
1637 current_ev = 1604 current_ev =
1638 iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len); 1605 iwe_stream_add_event(current_ev, end_buf, &iwe, iwe.len);
@@ -1666,7 +1633,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1666 iwe.u.qual.noise = 1633 iwe.u.qual.noise =
1667 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); 1634 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
1668 } 1635 }
1669 if ((adapter->inframode == wlan802_11ibss) && 1636 if ((adapter->mode == IW_MODE_ADHOC) &&
1670 !libertas_SSID_cmp(&adapter->curbssparams.ssid, 1637 !libertas_SSID_cmp(&adapter->curbssparams.ssid,
1671 &adapter->scantable[i].ssid) 1638 &adapter->scantable[i].ssid)
1672 && adapter->adhoccreate) { 1639 && adapter->adhoccreate) {
@@ -1731,7 +1698,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1731 end_buf, &iwe, iwe.len); 1698 end_buf, &iwe, iwe.len);
1732 1699
1733 } 1700 }
1734 if ((adapter->scantable[i].inframode == wlan802_11ibss) 1701 if ((adapter->scantable[i].mode == IW_MODE_ADHOC)
1735 && !libertas_SSID_cmp(&adapter->curbssparams.ssid, 1702 && !libertas_SSID_cmp(&adapter->curbssparams.ssid,
1736 &adapter->scantable[i].ssid) 1703 &adapter->scantable[i].ssid)
1737 && adapter->adhoccreate) { 1704 && adapter->adhoccreate) {
@@ -1745,30 +1712,24 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1745 /* Add new value to event */ 1712 /* Add new value to event */
1746 current_val = current_ev + IW_EV_LCP_LEN; 1713 current_val = current_ev + IW_EV_LCP_LEN;
1747 1714
1748 if (adapter->scantable[i].wpa2_supplicant.wpa_ie[0] == WPA2_IE) { 1715 if (adapter->scantable[i].rsn_ie[0] == WPA2_IE) {
1749 memset(&iwe, 0, sizeof(iwe)); 1716 memset(&iwe, 0, sizeof(iwe));
1750 memset(buf, 0, sizeof(buf)); 1717 memset(buf, 0, sizeof(buf));
1751 memcpy(buf, adapter->scantable[i]. 1718 memcpy(buf, adapter->scantable[i].rsn_ie,
1752 wpa2_supplicant.wpa_ie, 1719 adapter->scantable[i].rsn_ie_len);
1753 adapter->scantable[i].wpa2_supplicant.
1754 wpa_ie_len);
1755 iwe.cmd = IWEVGENIE; 1720 iwe.cmd = IWEVGENIE;
1756 iwe.u.data.length = adapter->scantable[i]. 1721 iwe.u.data.length = adapter->scantable[i].rsn_ie_len;
1757 wpa2_supplicant.wpa_ie_len;
1758 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; 1722 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
1759 current_ev = iwe_stream_add_point(current_ev, end_buf, 1723 current_ev = iwe_stream_add_point(current_ev, end_buf,
1760 &iwe, buf); 1724 &iwe, buf);
1761 } 1725 }
1762 if (adapter->scantable[i].wpa_supplicant.wpa_ie[0] == WPA_IE) { 1726 if (adapter->scantable[i].wpa_ie[0] == WPA_IE) {
1763 memset(&iwe, 0, sizeof(iwe)); 1727 memset(&iwe, 0, sizeof(iwe));
1764 memset(buf, 0, sizeof(buf)); 1728 memset(buf, 0, sizeof(buf));
1765 memcpy(buf, adapter->scantable[i]. 1729 memcpy(buf, adapter->scantable[i].wpa_ie,
1766 wpa_supplicant.wpa_ie, 1730 adapter->scantable[i].wpa_ie_len);
1767 adapter->scantable[i].wpa_supplicant.
1768 wpa_ie_len);
1769 iwe.cmd = IWEVGENIE; 1731 iwe.cmd = IWEVGENIE;
1770 iwe.u.data.length = adapter->scantable[i]. 1732 iwe.u.data.length = adapter->scantable[i].wpa_ie_len;
1771 wpa_supplicant.wpa_ie_len;
1772 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; 1733 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
1773 current_ev = iwe_stream_add_point(current_ev, end_buf, 1734 current_ev = iwe_stream_add_point(current_ev, end_buf,
1774 &iwe, buf); 1735 &iwe, buf);
diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h
index d93aa7fa44fd..405f4f0fe575 100644
--- a/drivers/net/wireless/libertas/scan.h
+++ b/drivers/net/wireless/libertas/scan.h
@@ -1,6 +1,3 @@
1/* -*- mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
2/* vi: set expandtab shiftwidth=4 tabstop=4 textwidth=78: */
3
4/** 1/**
5 * Interface for the wlan network scan routines 2 * Interface for the wlan network scan routines
6 * 3 *
@@ -10,6 +7,7 @@
10#ifndef _WLAN_SCAN_H 7#ifndef _WLAN_SCAN_H
11#define _WLAN_SCAN_H 8#define _WLAN_SCAN_H
12 9
10#include <net/ieee80211.h>
13#include "hostcmd.h" 11#include "hostcmd.h"
14 12
15/** 13/**
@@ -155,7 +153,7 @@ struct bss_descriptor {
155 153
156 u32 atimwindow; 154 u32 atimwindow;
157 155
158 enum WLAN_802_11_NETWORK_INFRASTRUCTURE inframode; 156 u8 mode;
159 u8 libertas_supported_rates[WLAN_SUPPORTED_RATES]; 157 u8 libertas_supported_rates[WLAN_SUPPORTED_RATES];
160 158
161 int extra_ie; 159 int extra_ie;
@@ -170,22 +168,22 @@ struct bss_descriptor {
170 168
171 struct ieeetypes_countryinfofullset countryinfo; 169 struct ieeetypes_countryinfofullset countryinfo;
172 170
173 struct WPA_SUPPLICANT wpa_supplicant; 171 u8 wpa_ie[MAX_WPA_IE_LEN];
174 struct WPA_SUPPLICANT wpa2_supplicant; 172 size_t wpa_ie_len;
175 173 u8 rsn_ie[MAX_WPA_IE_LEN];
174 size_t rsn_ie_len;
176}; 175};
177 176
178extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, 177extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1,
179 struct WLAN_802_11_SSID *ssid2); 178 struct WLAN_802_11_SSID *ssid2);
180extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid, 179extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid,
181 u8 * bssid, int mode); 180 u8 * bssid, u8 mode);
182int libertas_find_best_SSID_in_list(wlan_adapter * adapter, enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode); 181int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode);
183extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, int mode); 182extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode);
184 183
185int libertas_find_best_network_SSID(wlan_private * priv, 184int libertas_find_best_network_SSID(wlan_private * priv,
186 struct WLAN_802_11_SSID *pSSID, 185 struct WLAN_802_11_SSID *pSSID,
187 enum WLAN_802_11_NETWORK_INFRASTRUCTURE preferred_mode, 186 u8 preferred_mode, u8 *out_mode);
188 enum WLAN_802_11_NETWORK_INFRASTRUCTURE *out_mode);
189 187
190extern int libertas_send_specific_SSID_scan(wlan_private * priv, 188extern int libertas_send_specific_SSID_scan(wlan_private * priv,
191 struct WLAN_802_11_SSID *prequestedssid, 189 struct WLAN_802_11_SSID *prequestedssid,
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c
index 82d06223043e..d4b13478c9a7 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -78,7 +78,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
78 min_t(unsigned int, skb->len, 100)); 78 min_t(unsigned int, skb->len, 100));
79 79
80 if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { 80 if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) {
81 lbs_pr_debug(1, "Tx error: Bad skb length %d : %d\n", 81 lbs_pr_debug(1, "Tx error: Bad skb length %d : %zd\n",
82 skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); 82 skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE);
83 ret = -1; 83 ret = -1;
84 goto done; 84 goto done;
diff --git a/drivers/net/wireless/libertas/version.h b/drivers/net/wireless/libertas/version.h
index e86f65ae79b8..8b137891791f 100644
--- a/drivers/net/wireless/libertas/version.h
+++ b/drivers/net/wireless/libertas/version.h
@@ -1,8 +1 @@
1#define DRIVER_RELEASE_VERSION "320.p0"
2const char libertas_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION
3#ifdef DEBUG
4 "-dbg"
5#endif
6 "";
7
8
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 4a52336bc0f6..69f52b6e59c8 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -17,7 +17,6 @@
17#include "defs.h" 17#include "defs.h"
18#include "dev.h" 18#include "dev.h"
19#include "join.h" 19#include "join.h"
20#include "version.h"
21#include "wext.h" 20#include "wext.h"
22#include "assoc.h" 21#include "assoc.h"
23 22
@@ -233,7 +232,7 @@ static int changeadhocchannel(wlan_private * priv, int channel)
233 232
234 // find out the BSSID that matches the current SSID 233 // find out the BSSID that matches the current SSID
235 i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL, 234 i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL,
236 wlan802_11ibss); 235 IW_MODE_ADHOC);
237 236
238 if (i >= 0) { 237 if (i >= 0) {
239 lbs_pr_debug(1, "SSID found at %d in List," 238 lbs_pr_debug(1, "SSID found at %d in List,"
@@ -316,13 +315,11 @@ static int get_active_data_rates(wlan_adapter * adapter,
316 ENTER(); 315 ENTER();
317 316
318 if (adapter->connect_status != libertas_connected) { 317 if (adapter->connect_status != libertas_connected) {
319 if (adapter->inframode == wlan802_11infrastructure) { 318 if (adapter->mode == IW_MODE_INFRA) {
320 //Infra. mode
321 lbs_pr_debug(1, "Infra\n"); 319 lbs_pr_debug(1, "Infra\n");
322 k = copyrates(rates, k, libertas_supported_rates, 320 k = copyrates(rates, k, libertas_supported_rates,
323 sizeof(libertas_supported_rates)); 321 sizeof(libertas_supported_rates));
324 } else { 322 } else {
325 //ad-hoc mode
326 lbs_pr_debug(1, "Adhoc G\n"); 323 lbs_pr_debug(1, "Adhoc G\n");
327 k = copyrates(rates, k, libertas_adhoc_rates_g, 324 k = copyrates(rates, k, libertas_adhoc_rates_g,
328 sizeof(libertas_adhoc_rates_g)); 325 sizeof(libertas_adhoc_rates_g));
@@ -586,20 +583,7 @@ static int wlan_get_mode(struct net_device *dev,
586 583
587 ENTER(); 584 ENTER();
588 585
589 switch (adapter->inframode) { 586 *uwrq = adapter->mode;
590 case wlan802_11ibss:
591 *uwrq = IW_MODE_ADHOC;
592 break;
593
594 case wlan802_11infrastructure:
595 *uwrq = IW_MODE_INFRA;
596 break;
597
598 default:
599 case wlan802_11autounknown:
600 *uwrq = IW_MODE_AUTO;
601 break;
602 }
603 587
604 LEAVE(); 588 LEAVE();
605 return 0; 589 return 0;
@@ -1002,149 +986,18 @@ static const struct iw_priv_args wlan_private_args[] = {
1002 /* 986 /*
1003 * { cmd, set_args, get_args, name } 987 * { cmd, set_args, get_args, name }
1004 */ 988 */
1005 {
1006 WLANSCAN_TYPE,
1007 IW_PRIV_TYPE_CHAR | 8,
1008 IW_PRIV_TYPE_CHAR | 8,
1009 "scantype"},
1010
1011 {
1012 WLAN_SETINT_GETINT,
1013 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1014 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1015 ""},
1016 {
1017 WLANNF,
1018 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1019 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1020 "getNF"},
1021 {
1022 WLANRSSI,
1023 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1024 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1025 "getRSSI"},
1026 {
1027 WLANENABLE11D,
1028 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1029 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1030 "enable11d"},
1031 {
1032 WLANADHOCGRATE,
1033 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1034 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1035 "adhocgrate"},
1036
1037 {
1038 WLAN_SUBCMD_SET_PRESCAN,
1039 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1040 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1041 "prescan"},
1042 {
1043 WLAN_SETONEINT_GETONEINT,
1044 IW_PRIV_TYPE_INT | 1,
1045 IW_PRIV_TYPE_INT | 1,
1046 ""},
1047 {
1048 WLAN_BEACON_INTERVAL,
1049 IW_PRIV_TYPE_INT | 1,
1050 IW_PRIV_TYPE_INT | 1,
1051 "bcninterval"},
1052 {
1053 WLAN_LISTENINTRVL,
1054 IW_PRIV_TYPE_INT | 1,
1055 IW_PRIV_TYPE_INT | 1,
1056 "lolisteninter"},
1057 {
1058 WLAN_TXCONTROL,
1059 IW_PRIV_TYPE_INT | 1,
1060 IW_PRIV_TYPE_INT | 1,
1061 "txcontrol"},
1062 {
1063 WLAN_NULLPKTINTERVAL,
1064 IW_PRIV_TYPE_INT | 1,
1065 IW_PRIV_TYPE_INT | 1,
1066 "psnullinterval"},
1067 /* Using iwpriv sub-command feature */ 989 /* Using iwpriv sub-command feature */
1068 { 990 {
1069 WLAN_SETONEINT_GETNONE, /* IOCTL: 24 */ 991 WLAN_SETONEINT_GETNONE, /* IOCTL: 24 */
1070 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 992 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1071 IW_PRIV_TYPE_NONE, 993 IW_PRIV_TYPE_NONE,
1072 ""}, 994 ""},
1073
1074 {
1075 WLAN_SUBCMD_SETRXANTENNA,
1076 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1077 IW_PRIV_TYPE_NONE,
1078 "setrxant"},
1079 {
1080 WLAN_SUBCMD_SETTXANTENNA,
1081 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1082 IW_PRIV_TYPE_NONE,
1083 "settxant"},
1084 {
1085 WLANSETAUTHALG,
1086 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1087 IW_PRIV_TYPE_NONE,
1088 "authalgs",
1089 },
1090 {
1091 WLANSET8021XAUTHALG,
1092 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1093 IW_PRIV_TYPE_NONE,
1094 "8021xauthalgs",
1095 },
1096 {
1097 WLANSETENCRYPTIONMODE,
1098 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1099 IW_PRIV_TYPE_NONE,
1100 "encryptionmode",
1101 },
1102 { 995 {
1103 WLANSETREGION, 996 WLANSETREGION,
1104 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 997 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1105 IW_PRIV_TYPE_NONE, 998 IW_PRIV_TYPE_NONE,
1106 "setregioncode"}, 999 "setregioncode"},
1107 { 1000 {
1108 WLAN_SET_LISTEN_INTERVAL,
1109 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1110 IW_PRIV_TYPE_NONE,
1111 "setlisteninter"},
1112 {
1113 WLAN_SET_MULTIPLE_DTIM,
1114 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1115 IW_PRIV_TYPE_NONE,
1116 "setmultipledtim"},
1117 {
1118 WLAN_SET_ATIM_WINDOW,
1119 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1120 IW_PRIV_TYPE_NONE,
1121 "atimwindow"},
1122 {
1123 WLANSETBCNAVG,
1124 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1125 IW_PRIV_TYPE_NONE,
1126 "setbcnavg"},
1127 {
1128 WLANSETDATAAVG,
1129 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1130 IW_PRIV_TYPE_NONE,
1131 "setdataavg"},
1132 {
1133 WLAN_SET_LINKMODE,
1134 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1135 IW_PRIV_TYPE_NONE,
1136 "linkmode"},
1137 {
1138 WLAN_SET_RADIOMODE,
1139 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1140 IW_PRIV_TYPE_NONE,
1141 "radiomode"},
1142 {
1143 WLAN_SET_DEBUGMODE,
1144 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1145 IW_PRIV_TYPE_NONE,
1146 "debugmode"},
1147 {
1148 WLAN_SUBCMD_MESH_SET_TTL, 1001 WLAN_SUBCMD_MESH_SET_TTL,
1149 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1002 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1150 IW_PRIV_TYPE_NONE, 1003 IW_PRIV_TYPE_NONE,
@@ -1160,41 +1013,6 @@ static const struct iw_priv_args wlan_private_args[] = {
1160 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1013 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1161 "getregioncode"}, 1014 "getregioncode"},
1162 { 1015 {
1163 WLAN_GET_LISTEN_INTERVAL,
1164 IW_PRIV_TYPE_NONE,
1165 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1166 "getlisteninter"},
1167 {
1168 WLAN_GET_MULTIPLE_DTIM,
1169 IW_PRIV_TYPE_NONE,
1170 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1171 "getmultipledtim"},
1172 {
1173 WLAN_GET_TX_RATE,
1174 IW_PRIV_TYPE_NONE,
1175 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1176 "gettxrate"},
1177 {
1178 WLANGETBCNAVG,
1179 IW_PRIV_TYPE_NONE,
1180 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1181 "getbcnavg"},
1182 {
1183 WLAN_GET_LINKMODE,
1184 IW_PRIV_TYPE_NONE,
1185 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1186 "get_linkmode"},
1187 {
1188 WLAN_GET_RADIOMODE,
1189 IW_PRIV_TYPE_NONE,
1190 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1191 "get_radiomode"},
1192 {
1193 WLAN_GET_DEBUGMODE,
1194 IW_PRIV_TYPE_NONE,
1195 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1196 "get_debugmode"},
1197 {
1198 WLAN_SUBCMD_FWT_CLEANUP, 1016 WLAN_SUBCMD_FWT_CLEANUP,
1199 IW_PRIV_TYPE_NONE, 1017 IW_PRIV_TYPE_NONE,
1200 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1018 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
@@ -1210,61 +1028,11 @@ static const struct iw_priv_args wlan_private_args[] = {
1210 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 1028 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1211 "mesh_get_ttl"}, 1029 "mesh_get_ttl"},
1212 { 1030 {
1213 WLAN_SETNONE_GETTWELVE_CHAR,
1214 IW_PRIV_TYPE_NONE,
1215 IW_PRIV_TYPE_CHAR | 12,
1216 ""},
1217 {
1218 WLAN_SUBCMD_GETRXANTENNA,
1219 IW_PRIV_TYPE_NONE,
1220 IW_PRIV_TYPE_CHAR | 12,
1221 "getrxant"},
1222 {
1223 WLAN_SUBCMD_GETTXANTENNA,
1224 IW_PRIV_TYPE_NONE,
1225 IW_PRIV_TYPE_CHAR | 12,
1226 "gettxant"},
1227 {
1228 WLAN_GET_TSF,
1229 IW_PRIV_TYPE_NONE,
1230 IW_PRIV_TYPE_CHAR | 12,
1231 "gettsf"},
1232 {
1233 WLAN_SETNONE_GETNONE, 1031 WLAN_SETNONE_GETNONE,
1234 IW_PRIV_TYPE_NONE, 1032 IW_PRIV_TYPE_NONE,
1235 IW_PRIV_TYPE_NONE, 1033 IW_PRIV_TYPE_NONE,
1236 ""}, 1034 ""},
1237 { 1035 {
1238 WLANDEAUTH,
1239 IW_PRIV_TYPE_NONE,
1240 IW_PRIV_TYPE_NONE,
1241 "deauth"},
1242 {
1243 WLANADHOCSTOP,
1244 IW_PRIV_TYPE_NONE,
1245 IW_PRIV_TYPE_NONE,
1246 "adhocstop"},
1247 {
1248 WLANRADIOON,
1249 IW_PRIV_TYPE_NONE,
1250 IW_PRIV_TYPE_NONE,
1251 "radioon"},
1252 {
1253 WLANRADIOOFF,
1254 IW_PRIV_TYPE_NONE,
1255 IW_PRIV_TYPE_NONE,
1256 "radiooff"},
1257 {
1258 WLANWLANIDLEON,
1259 IW_PRIV_TYPE_NONE,
1260 IW_PRIV_TYPE_NONE,
1261 "wlanidle-on"},
1262 {
1263 WLANWLANIDLEOFF,
1264 IW_PRIV_TYPE_NONE,
1265 IW_PRIV_TYPE_NONE,
1266 "wlanidle-off"},
1267 {
1268 WLAN_SUBCMD_FWT_RESET, 1036 WLAN_SUBCMD_FWT_RESET,
1269 IW_PRIV_TYPE_NONE, 1037 IW_PRIV_TYPE_NONE,
1270 IW_PRIV_TYPE_NONE, 1038 IW_PRIV_TYPE_NONE,
@@ -1327,90 +1095,15 @@ static const struct iw_priv_args wlan_private_args[] = {
1327 IW_PRIV_TYPE_CHAR | 128, 1095 IW_PRIV_TYPE_CHAR | 128,
1328 "fwt_list_route"}, 1096 "fwt_list_route"},
1329 { 1097 {
1330 WLANSCAN_MODE,
1331 IW_PRIV_TYPE_CHAR | 128,
1332 IW_PRIV_TYPE_CHAR | 128,
1333 "scanmode"},
1334 {
1335 WLAN_GET_ADHOC_STATUS,
1336 IW_PRIV_TYPE_CHAR | 128,
1337 IW_PRIV_TYPE_CHAR | 128,
1338 "getadhocstatus"},
1339 {
1340 WLAN_SETNONE_GETWORDCHAR,
1341 IW_PRIV_TYPE_NONE,
1342 IW_PRIV_TYPE_CHAR | 128,
1343 ""},
1344 {
1345 WLANSETWPAIE,
1346 IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 24,
1347 IW_PRIV_TYPE_NONE,
1348 "setwpaie"},
1349 {
1350 WLANGETLOG,
1351 IW_PRIV_TYPE_NONE,
1352 IW_PRIV_TYPE_CHAR | GETLOG_BUFSIZE,
1353 "getlog"},
1354 {
1355 WLAN_SET_GET_SIXTEEN_INT, 1098 WLAN_SET_GET_SIXTEEN_INT,
1356 IW_PRIV_TYPE_INT | 16, 1099 IW_PRIV_TYPE_INT | 16,
1357 IW_PRIV_TYPE_INT | 16, 1100 IW_PRIV_TYPE_INT | 16,
1358 ""}, 1101 ""},
1359 { 1102 {
1360 WLAN_TPCCFG,
1361 IW_PRIV_TYPE_INT | 16,
1362 IW_PRIV_TYPE_INT | 16,
1363 "tpccfg"},
1364 {
1365 WLAN_POWERCFG,
1366 IW_PRIV_TYPE_INT | 16,
1367 IW_PRIV_TYPE_INT | 16,
1368 "powercfg"},
1369 {
1370 WLAN_AUTO_FREQ_SET,
1371 IW_PRIV_TYPE_INT | 16,
1372 IW_PRIV_TYPE_INT | 16,
1373 "setafc"},
1374 {
1375 WLAN_AUTO_FREQ_GET,
1376 IW_PRIV_TYPE_INT | 16,
1377 IW_PRIV_TYPE_INT | 16,
1378 "getafc"},
1379 {
1380 WLAN_SCANPROBES,
1381 IW_PRIV_TYPE_INT | 16,
1382 IW_PRIV_TYPE_INT | 16,
1383 "scanprobes"},
1384 {
1385 WLAN_LED_GPIO_CTRL, 1103 WLAN_LED_GPIO_CTRL,
1386 IW_PRIV_TYPE_INT | 16, 1104 IW_PRIV_TYPE_INT | 16,
1387 IW_PRIV_TYPE_INT | 16, 1105 IW_PRIV_TYPE_INT | 16,
1388 "ledgpio"}, 1106 "ledgpio"},
1389 {
1390 WLAN_ADAPT_RATESET,
1391 IW_PRIV_TYPE_INT | 16,
1392 IW_PRIV_TYPE_INT | 16,
1393 "rateadapt"},
1394 {
1395 WLAN_INACTIVITY_TIMEOUT,
1396 IW_PRIV_TYPE_INT | 16,
1397 IW_PRIV_TYPE_INT | 16,
1398 "inactivityto"},
1399 {
1400 WLANSNR,
1401 IW_PRIV_TYPE_INT | 16,
1402 IW_PRIV_TYPE_INT | 16,
1403 "getSNR"},
1404 {
1405 WLAN_GET_RATE,
1406 IW_PRIV_TYPE_INT | 16,
1407 IW_PRIV_TYPE_INT | 16,
1408 "getrate"},
1409 {
1410 WLAN_GET_RXINFO,
1411 IW_PRIV_TYPE_INT | 16,
1412 IW_PRIV_TYPE_INT | 16,
1413 "getrxinfo"},
1414}; 1107};
1415 1108
1416static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) 1109static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
@@ -1434,7 +1127,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1434 1127
1435 ENTER(); 1128 ENTER();
1436 1129
1437 priv->wstats.status = adapter->inframode; 1130 priv->wstats.status = adapter->mode;
1438 1131
1439 /* If we're not associated, all quality values are meaningless */ 1132 /* If we're not associated, all quality values are meaningless */
1440 if (adapter->connect_status != libertas_connected) 1133 if (adapter->connect_status != libertas_connected)
@@ -1568,13 +1261,12 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1568 if (!cfp) { 1261 if (!cfp) {
1569 rc = -EINVAL; 1262 rc = -EINVAL;
1570 } else { 1263 } else {
1571 if (adapter->inframode == wlan802_11ibss) { 1264 if (adapter->mode == IW_MODE_ADHOC) {
1572 rc = changeadhocchannel(priv, channel); 1265 rc = changeadhocchannel(priv, channel);
1573 /* If station is WEP enabled, send the 1266 /* If station is WEP enabled, send the
1574 * command to set WEP in firmware 1267 * command to set WEP in firmware
1575 */ 1268 */
1576 if (adapter->secinfo.WEPstatus == 1269 if (adapter->secinfo.wep_enabled) {
1577 wlan802_11WEPenabled) {
1578 lbs_pr_debug(1, "set_freq: WEP enabled\n"); 1270 lbs_pr_debug(1, "set_freq: WEP enabled\n");
1579 ret = libertas_prepare_and_send_command(priv, 1271 ret = libertas_prepare_and_send_command(priv,
1580 cmd_802_11_set_wep, 1272 cmd_802_11_set_wep,
@@ -1716,49 +1408,31 @@ static int wlan_set_mode(struct net_device *dev,
1716 wlan_private *priv = dev->priv; 1408 wlan_private *priv = dev->priv;
1717 wlan_adapter *adapter = priv->adapter; 1409 wlan_adapter *adapter = priv->adapter;
1718 struct assoc_request * assoc_req; 1410 struct assoc_request * assoc_req;
1719 enum WLAN_802_11_NETWORK_INFRASTRUCTURE new_mode;
1720 1411
1721 ENTER(); 1412 ENTER();
1722 1413
1723 switch (*uwrq) { 1414 if ( (*uwrq != IW_MODE_ADHOC)
1724 case IW_MODE_ADHOC: 1415 && (*uwrq != IW_MODE_INFRA)
1725 lbs_pr_debug(1, "Wanted mode is ad-hoc: current datarate=%#x\n", 1416 && (*uwrq != IW_MODE_AUTO)) {
1726 adapter->datarate); 1417 lbs_pr_debug(1, "Invalid mode: 0x%x\n", *uwrq);
1727 new_mode = wlan802_11ibss; 1418 ret = -EINVAL;
1728 adapter->adhocchannel = DEFAULT_AD_HOC_CHANNEL; 1419 goto out;
1729 break;
1730
1731 case IW_MODE_INFRA:
1732 lbs_pr_debug(1, "Wanted mode is Infrastructure\n");
1733 new_mode = wlan802_11infrastructure;
1734 break;
1735
1736 case IW_MODE_AUTO:
1737 lbs_pr_debug(1, "Wanted mode is Auto\n");
1738 new_mode = wlan802_11autounknown;
1739 break;
1740
1741 default:
1742 lbs_pr_debug(1, "Wanted mode is Unknown: 0x%x\n", *uwrq);
1743 return -EINVAL;
1744 } 1420 }
1745 1421
1746 mutex_lock(&adapter->lock); 1422 mutex_lock(&adapter->lock);
1747 assoc_req = wlan_get_association_request(adapter); 1423 assoc_req = wlan_get_association_request(adapter);
1748 if (!assoc_req) { 1424 if (!assoc_req) {
1749 ret = -ENOMEM; 1425 ret = -ENOMEM;
1426 wlan_cancel_association_work(priv);
1750 } else { 1427 } else {
1751 assoc_req->mode = new_mode; 1428 assoc_req->mode = *uwrq;
1752 }
1753
1754 if (ret == 0) {
1755 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); 1429 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags);
1756 wlan_postpone_association_work(priv); 1430 wlan_postpone_association_work(priv);
1757 } else { 1431 lbs_pr_debug(1, "Switching to mode: 0x%x\n", *uwrq);
1758 wlan_cancel_association_work(priv);
1759 } 1432 }
1760 mutex_unlock(&adapter->lock); 1433 mutex_unlock(&adapter->lock);
1761 1434
1435out:
1762 LEAVE(); 1436 LEAVE();
1763 return ret; 1437 return ret;
1764} 1438}
@@ -1789,13 +1463,13 @@ static int wlan_get_encode(struct net_device *dev,
1789 dwrq->flags = 0; 1463 dwrq->flags = 0;
1790 1464
1791 /* Authentication method */ 1465 /* Authentication method */
1792 switch (adapter->secinfo.authmode) { 1466 switch (adapter->secinfo.auth_mode) {
1793 case wlan802_11authmodeopen: 1467 case IW_AUTH_ALG_OPEN_SYSTEM:
1794 dwrq->flags = IW_ENCODE_OPEN; 1468 dwrq->flags = IW_ENCODE_OPEN;
1795 break; 1469 break;
1796 1470
1797 case wlan802_11authmodeshared: 1471 case IW_AUTH_ALG_SHARED_KEY:
1798 case wlan802_11authmodenetworkEAP: 1472 case IW_AUTH_ALG_LEAP:
1799 dwrq->flags = IW_ENCODE_RESTRICTED; 1473 dwrq->flags = IW_ENCODE_RESTRICTED;
1800 break; 1474 break;
1801 default: 1475 default:
@@ -1803,8 +1477,9 @@ static int wlan_get_encode(struct net_device *dev,
1803 break; 1477 break;
1804 } 1478 }
1805 1479
1806 if ((adapter->secinfo.WEPstatus == wlan802_11WEPenabled) 1480 if ( adapter->secinfo.wep_enabled
1807 || adapter->secinfo.WPAenabled || adapter->secinfo.WPA2enabled) { 1481 || adapter->secinfo.WPAenabled
1482 || adapter->secinfo.WPA2enabled) {
1808 dwrq->flags &= ~IW_ENCODE_DISABLED; 1483 dwrq->flags &= ~IW_ENCODE_DISABLED;
1809 } else { 1484 } else {
1810 dwrq->flags |= IW_ENCODE_DISABLED; 1485 dwrq->flags |= IW_ENCODE_DISABLED;
@@ -1818,8 +1493,7 @@ static int wlan_get_encode(struct net_device *dev,
1818 if (index < 0) 1493 if (index < 0)
1819 index = adapter->wep_tx_keyidx; 1494 index = adapter->wep_tx_keyidx;
1820 1495
1821 if ((adapter->wep_keys[index].len) && 1496 if ((adapter->wep_keys[index].len) && adapter->secinfo.wep_enabled) {
1822 (adapter->secinfo.WEPstatus == wlan802_11WEPenabled)) {
1823 memcpy(extra, adapter->wep_keys[index].key, 1497 memcpy(extra, adapter->wep_keys[index].key,
1824 adapter->wep_keys[index].len); 1498 adapter->wep_keys[index].len);
1825 dwrq->length = adapter->wep_keys[index].len; 1499 dwrq->length = adapter->wep_keys[index].len;
@@ -1903,7 +1577,7 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req,
1903 assoc_req->wep_tx_keyidx = index; 1577 assoc_req->wep_tx_keyidx = index;
1904 } 1578 }
1905 1579
1906 assoc_req->secinfo.WEPstatus = wlan802_11WEPenabled; 1580 assoc_req->secinfo.wep_enabled = 1;
1907 1581
1908 LEAVE(); 1582 LEAVE();
1909 return 0; 1583 return 0;
@@ -1932,10 +1606,10 @@ static void disable_wep(struct assoc_request *assoc_req)
1932 int i; 1606 int i;
1933 1607
1934 /* Set Open System auth mode */ 1608 /* Set Open System auth mode */
1935 assoc_req->secinfo.authmode = wlan802_11authmodeopen; 1609 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
1936 1610
1937 /* Clear WEP keys and mark WEP as disabled */ 1611 /* Clear WEP keys and mark WEP as disabled */
1938 assoc_req->secinfo.WEPstatus = wlan802_11WEPdisabled; 1612 assoc_req->secinfo.wep_enabled = 0;
1939 for (i = 0; i < 4; i++) 1613 for (i = 0; i < 4; i++)
1940 assoc_req->wep_keys[i].len = 0; 1614 assoc_req->wep_keys[i].len = 0;
1941 1615
@@ -1987,8 +1661,7 @@ static int wlan_set_encode(struct net_device *dev,
1987 /* If WEP isn't enabled, or if there is no key data but a valid 1661 /* If WEP isn't enabled, or if there is no key data but a valid
1988 * index, set the TX key. 1662 * index, set the TX key.
1989 */ 1663 */
1990 if ((assoc_req->secinfo.WEPstatus != wlan802_11WEPenabled) 1664 if (!assoc_req->secinfo.wep_enabled || (dwrq->length == 0 && !is_default))
1991 || (dwrq->length == 0 && !is_default))
1992 set_tx_key = 1; 1665 set_tx_key = 1;
1993 1666
1994 ret = wlan_set_wep_key(assoc_req, extra, dwrq->length, index, set_tx_key); 1667 ret = wlan_set_wep_key(assoc_req, extra, dwrq->length, index, set_tx_key);
@@ -2001,9 +1674,9 @@ static int wlan_set_encode(struct net_device *dev,
2001 set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); 1674 set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags);
2002 1675
2003 if (dwrq->flags & IW_ENCODE_RESTRICTED) { 1676 if (dwrq->flags & IW_ENCODE_RESTRICTED) {
2004 assoc_req->secinfo.authmode = wlan802_11authmodeshared; 1677 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY;
2005 } else if (dwrq->flags & IW_ENCODE_OPEN) { 1678 } else if (dwrq->flags & IW_ENCODE_OPEN) {
2006 assoc_req->secinfo.authmode = wlan802_11authmodeopen; 1679 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2007 } 1680 }
2008 1681
2009out: 1682out:
@@ -2056,30 +1729,31 @@ static int wlan_get_encodeext(struct net_device *dev,
2056 1729
2057 if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY && 1730 if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY &&
2058 ext->alg != IW_ENCODE_ALG_WEP) { 1731 ext->alg != IW_ENCODE_ALG_WEP) {
2059 if (index != 0 || adapter->inframode != wlan802_11infrastructure) 1732 if (index != 0 || adapter->mode != IW_MODE_INFRA)
2060 goto out; 1733 goto out;
2061 } 1734 }
2062 1735
2063 dwrq->flags = index + 1; 1736 dwrq->flags = index + 1;
2064 memset(ext, 0, sizeof(*ext)); 1737 memset(ext, 0, sizeof(*ext));
2065 1738
2066 if ((adapter->secinfo.WEPstatus == wlan802_11WEPdisabled) 1739 if ( !adapter->secinfo.wep_enabled
2067 && !adapter->secinfo.WPAenabled && !adapter->secinfo.WPA2enabled) { 1740 && !adapter->secinfo.WPAenabled
1741 && !adapter->secinfo.WPA2enabled) {
2068 ext->alg = IW_ENCODE_ALG_NONE; 1742 ext->alg = IW_ENCODE_ALG_NONE;
2069 ext->key_len = 0; 1743 ext->key_len = 0;
2070 dwrq->flags |= IW_ENCODE_DISABLED; 1744 dwrq->flags |= IW_ENCODE_DISABLED;
2071 } else { 1745 } else {
2072 u8 *key = NULL; 1746 u8 *key = NULL;
2073 1747
2074 if ((adapter->secinfo.WEPstatus == wlan802_11WEPenabled) 1748 if ( adapter->secinfo.wep_enabled
2075 && !adapter->secinfo.WPAenabled 1749 && !adapter->secinfo.WPAenabled
2076 && !adapter->secinfo.WPA2enabled) { 1750 && !adapter->secinfo.WPA2enabled) {
2077 ext->alg = IW_ENCODE_ALG_WEP; 1751 ext->alg = IW_ENCODE_ALG_WEP;
2078 ext->key_len = adapter->wep_keys[index].len; 1752 ext->key_len = adapter->wep_keys[index].len;
2079 key = &adapter->wep_keys[index].key[0]; 1753 key = &adapter->wep_keys[index].key[0];
2080 } else if ((adapter->secinfo.WEPstatus == wlan802_11WEPdisabled) && 1754 } else if ( !adapter->secinfo.wep_enabled
2081 (adapter->secinfo.WPAenabled || 1755 && (adapter->secinfo.WPAenabled ||
2082 adapter->secinfo.WPA2enabled)) { 1756 adapter->secinfo.WPA2enabled)) {
2083 /* WPA */ 1757 /* WPA */
2084 ext->alg = IW_ENCODE_ALG_TKIP; 1758 ext->alg = IW_ENCODE_ALG_TKIP;
2085 ext->key_len = 0; 1759 ext->key_len = 0;
@@ -2149,7 +1823,7 @@ static int wlan_set_encodeext(struct net_device *dev,
2149 /* If WEP isn't enabled, or if there is no key data but a valid 1823 /* If WEP isn't enabled, or if there is no key data but a valid
2150 * index, or if the set-TX-key flag was passed, set the TX key. 1824 * index, or if the set-TX-key flag was passed, set the TX key.
2151 */ 1825 */
2152 if ((assoc_req->secinfo.WEPstatus != wlan802_11WEPenabled) 1826 if ( !assoc_req->secinfo.wep_enabled
2153 || (dwrq->length == 0 && !is_default) 1827 || (dwrq->length == 0 && !is_default)
2154 || (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)) 1828 || (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY))
2155 set_tx_key = 1; 1829 set_tx_key = 1;
@@ -2161,11 +1835,9 @@ static int wlan_set_encodeext(struct net_device *dev,
2161 goto out; 1835 goto out;
2162 1836
2163 if (dwrq->flags & IW_ENCODE_RESTRICTED) { 1837 if (dwrq->flags & IW_ENCODE_RESTRICTED) {
2164 assoc_req->secinfo.authmode = 1838 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY;
2165 wlan802_11authmodeshared;
2166 } else if (dwrq->flags & IW_ENCODE_OPEN) { 1839 } else if (dwrq->flags & IW_ENCODE_OPEN) {
2167 assoc_req->secinfo.authmode = 1840 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2168 wlan802_11authmodeopen;
2169 } 1841 }
2170 1842
2171 /* Mark the various WEP bits as modified */ 1843 /* Mark the various WEP bits as modified */
@@ -2350,15 +2022,13 @@ static int wlan_set_auth(struct net_device *dev,
2350 } 2022 }
2351 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) { 2023 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) {
2352 assoc_req->secinfo.WPAenabled = 1; 2024 assoc_req->secinfo.WPAenabled = 1;
2353 assoc_req->secinfo.WEPstatus = wlan802_11WEPdisabled; 2025 assoc_req->secinfo.wep_enabled = 0;
2354 assoc_req->secinfo.authmode = 2026 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2355 wlan802_11authmodeopen;
2356 } 2027 }
2357 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA2) { 2028 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA2) {
2358 assoc_req->secinfo.WPA2enabled = 1; 2029 assoc_req->secinfo.WPA2enabled = 1;
2359 assoc_req->secinfo.WEPstatus = wlan802_11WEPdisabled; 2030 assoc_req->secinfo.wep_enabled = 0;
2360 assoc_req->secinfo.authmode = 2031 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2361 wlan802_11authmodeopen;
2362 } 2032 }
2363 updated = 1; 2033 updated = 1;
2364 break; 2034 break;
@@ -2376,14 +2046,11 @@ static int wlan_set_auth(struct net_device *dev,
2376 2046
2377 case IW_AUTH_80211_AUTH_ALG: 2047 case IW_AUTH_80211_AUTH_ALG:
2378 if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) { 2048 if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) {
2379 assoc_req->secinfo.authmode = 2049 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY;
2380 wlan802_11authmodeshared;
2381 } else if (dwrq->value & IW_AUTH_ALG_OPEN_SYSTEM) { 2050 } else if (dwrq->value & IW_AUTH_ALG_OPEN_SYSTEM) {
2382 assoc_req->secinfo.authmode = 2051 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2383 wlan802_11authmodeopen;
2384 } else if (dwrq->value & IW_AUTH_ALG_LEAP) { 2052 } else if (dwrq->value & IW_AUTH_ALG_LEAP) {
2385 assoc_req->secinfo.authmode = 2053 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_LEAP;
2386 wlan802_11authmodenetworkEAP;
2387 } else { 2054 } else {
2388 ret = -EINVAL; 2055 ret = -EINVAL;
2389 } 2056 }
@@ -2396,9 +2063,8 @@ static int wlan_set_auth(struct net_device *dev,
2396 !assoc_req->secinfo.WPA2enabled) { 2063 !assoc_req->secinfo.WPA2enabled) {
2397 assoc_req->secinfo.WPAenabled = 1; 2064 assoc_req->secinfo.WPAenabled = 1;
2398 assoc_req->secinfo.WPA2enabled = 1; 2065 assoc_req->secinfo.WPA2enabled = 1;
2399 assoc_req->secinfo.WEPstatus = wlan802_11WEPdisabled; 2066 assoc_req->secinfo.wep_enabled = 0;
2400 assoc_req->secinfo.authmode = 2067 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2401 wlan802_11authmodeopen;
2402 } 2068 }
2403 } else { 2069 } else {
2404 assoc_req->secinfo.WPAenabled = 0; 2070 assoc_req->secinfo.WPAenabled = 0;
@@ -2455,19 +2121,7 @@ static int wlan_get_auth(struct net_device *dev,
2455 break; 2121 break;
2456 2122
2457 case IW_AUTH_80211_AUTH_ALG: 2123 case IW_AUTH_80211_AUTH_ALG:
2458 switch (adapter->secinfo.authmode) { 2124 dwrq->value = adapter->secinfo.auth_mode;
2459 case wlan802_11authmodeshared:
2460 dwrq->value = IW_AUTH_ALG_SHARED_KEY;
2461 break;
2462 case wlan802_11authmodeopen:
2463 dwrq->value = IW_AUTH_ALG_OPEN_SYSTEM;
2464 break;
2465 case wlan802_11authmodenetworkEAP:
2466 dwrq->value = IW_AUTH_ALG_LEAP;
2467 break;
2468 default:
2469 break;
2470 }
2471 break; 2125 break;
2472 2126
2473 case IW_AUTH_WPA_ENABLED: 2127 case IW_AUTH_WPA_ENABLED:
diff --git a/drivers/net/wireless/libertas/wext.h b/drivers/net/wireless/libertas/wext.h
index 39f367c38d90..15cfaaf0797f 100644
--- a/drivers/net/wireless/libertas/wext.h
+++ b/drivers/net/wireless/libertas/wext.h
@@ -10,88 +10,22 @@
10/** PRIVATE CMD ID */ 10/** PRIVATE CMD ID */
11#define WLANIOCTL SIOCIWFIRSTPRIV 11#define WLANIOCTL SIOCIWFIRSTPRIV
12 12
13#define WLANSETWPAIE (WLANIOCTL + 0)
14
15#define WLAN_SETINT_GETINT (WLANIOCTL + 7)
16#define WLANNF 1
17#define WLANRSSI 2
18#define WLANENABLE11D 5
19#define WLANADHOCGRATE 6
20#define WLAN_SUBCMD_SET_PRESCAN 11
21
22#define WLAN_SETNONE_GETNONE (WLANIOCTL + 8) 13#define WLAN_SETNONE_GETNONE (WLANIOCTL + 8)
23#define WLANDEAUTH 1
24#define WLANRADIOON 2
25#define WLANRADIOOFF 3
26#define WLANREMOVEADHOCAES 4
27#define WLANADHOCSTOP 5
28#define WLANCIPHERTEST 6
29#define WLANCRYPTOTEST 7
30
31#define WLANWLANIDLEON 10
32#define WLANWLANIDLEOFF 11
33#define WLAN_SUBCMD_BT_RESET 13 14#define WLAN_SUBCMD_BT_RESET 13
34#define WLAN_SUBCMD_FWT_RESET 14 15#define WLAN_SUBCMD_FWT_RESET 14
35 16
36#define WLANGETLOG (WLANIOCTL + 9)
37#define GETLOG_BUFSIZE 300
38
39#define WLANSCAN_TYPE (WLANIOCTL + 11)
40
41#define WLAN_SETNONE_GETONEINT (WLANIOCTL + 15) 17#define WLAN_SETNONE_GETONEINT (WLANIOCTL + 15)
42#define WLANGETREGION 1 18#define WLANGETREGION 1
43#define WLAN_GET_LISTEN_INTERVAL 2
44#define WLAN_GET_MULTIPLE_DTIM 3
45#define WLAN_GET_TX_RATE 4
46#define WLANGETBCNAVG 5
47 19
48#define WLAN_GET_LINKMODE 6
49#define WLAN_GET_RADIOMODE 7
50#define WLAN_GET_DEBUGMODE 8
51#define WLAN_SUBCMD_FWT_CLEANUP 15 20#define WLAN_SUBCMD_FWT_CLEANUP 15
52#define WLAN_SUBCMD_FWT_TIME 16 21#define WLAN_SUBCMD_FWT_TIME 16
53#define WLAN_SUBCMD_MESH_GET_TTL 17 22#define WLAN_SUBCMD_MESH_GET_TTL 17
54 23
55#define WLANREGCFRDWR (WLANIOCTL + 18)
56
57#define WLAN_SETNONE_GETTWELVE_CHAR (WLANIOCTL + 19)
58#define WLAN_SUBCMD_GETRXANTENNA 1
59#define WLAN_SUBCMD_GETTXANTENNA 2
60#define WLAN_GET_TSF 3
61
62#define WLAN_SETNONE_GETWORDCHAR (WLANIOCTL + 21)
63#define WLANGETADHOCAES 1
64
65#define WLAN_SETONEINT_GETONEINT (WLANIOCTL + 23)
66#define WLAN_BEACON_INTERVAL 1
67#define WLAN_LISTENINTRVL 4
68
69#define WLAN_TXCONTROL 6
70#define WLAN_NULLPKTINTERVAL 7
71
72#define WLAN_SETONEINT_GETNONE (WLANIOCTL + 24) 24#define WLAN_SETONEINT_GETNONE (WLANIOCTL + 24)
73#define WLAN_SUBCMD_SETRXANTENNA 1
74#define WLAN_SUBCMD_SETTXANTENNA 2
75#define WLANSETAUTHALG 5
76#define WLANSET8021XAUTHALG 6
77#define WLANSETENCRYPTIONMODE 7
78#define WLANSETREGION 8 25#define WLANSETREGION 8
79#define WLAN_SET_LISTEN_INTERVAL 9
80
81#define WLAN_SET_MULTIPLE_DTIM 10
82#define WLAN_SET_ATIM_WINDOW 11
83#define WLANSETBCNAVG 13
84#define WLANSETDATAAVG 14
85#define WLAN_SET_LINKMODE 15
86#define WLAN_SET_RADIOMODE 16
87#define WLAN_SET_DEBUGMODE 17
88#define WLAN_SUBCMD_MESH_SET_TTL 18 26#define WLAN_SUBCMD_MESH_SET_TTL 18
89 27
90#define WLAN_SET128CHAR_GET128CHAR (WLANIOCTL + 25) 28#define WLAN_SET128CHAR_GET128CHAR (WLANIOCTL + 25)
91#define WLANSCAN_MODE 6
92
93#define WLAN_GET_ADHOC_STATUS 9
94
95#define WLAN_SUBCMD_BT_ADD 18 29#define WLAN_SUBCMD_BT_ADD 18
96#define WLAN_SUBCMD_BT_DEL 19 30#define WLAN_SUBCMD_BT_DEL 19
97#define WLAN_SUBCMD_BT_LIST 20 31#define WLAN_SUBCMD_BT_LIST 20
@@ -103,27 +37,8 @@
103#define WLAN_SUBCMD_FWT_LIST_ROUTE 26 37#define WLAN_SUBCMD_FWT_LIST_ROUTE 26
104 38
105#define WLAN_SET_GET_SIXTEEN_INT (WLANIOCTL + 29) 39#define WLAN_SET_GET_SIXTEEN_INT (WLANIOCTL + 29)
106#define WLAN_TPCCFG 1
107#define WLAN_POWERCFG 2
108
109#define WLAN_AUTO_FREQ_SET 3
110#define WLAN_AUTO_FREQ_GET 4
111#define WLAN_LED_GPIO_CTRL 5 40#define WLAN_LED_GPIO_CTRL 5
112#define WLAN_SCANPROBES 6
113#define WLAN_ADAPT_RATESET 8
114#define WLAN_INACTIVITY_TIMEOUT 9
115#define WLANSNR 10
116#define WLAN_GET_RATE 11
117#define WLAN_GET_RXINFO 12
118
119#define WLANCMD52RDWR (WLANIOCTL + 30)
120#define WLANCMD53RDWR (WLANIOCTL + 31)
121#define CMD53BUFLEN 32
122 41
123#define REG_MAC 0x19
124#define REG_BBP 0x1a
125#define REG_RF 0x1b
126#define REG_EEPROM 0x59
127#define WLAN_LINKMODE_802_3 0 42#define WLAN_LINKMODE_802_3 0
128#define WLAN_LINKMODE_802_11 2 43#define WLAN_LINKMODE_802_11 2
129#define WLAN_RADIOMODE_NONE 0 44#define WLAN_RADIOMODE_NONE 0