aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/asus_acpi.c3
-rw-r--r--drivers/misc/blink.c22
-rw-r--r--drivers/net/irda/irport.c2
-rw-r--r--drivers/net/irda/smsc-ircc2.c2
-rw-r--r--drivers/net/wireless/libertas/Makefile2
-rw-r--r--drivers/net/wireless/libertas/README275
-rw-r--r--drivers/net/wireless/libertas/assoc.c28
-rw-r--r--drivers/net/wireless/libertas/cmd.c12
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c21
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h2
-rw-r--r--drivers/net/wireless/libertas/ioctl.c1081
-rw-r--r--drivers/net/wireless/libertas/main.c8
-rw-r--r--drivers/net/wireless/libertas/scan.c51
-rw-r--r--drivers/net/wireless/libertas/wext.c152
-rw-r--r--drivers/net/wireless/libertas/wext.h45
15 files changed, 103 insertions, 1603 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index 6d7d4157e049..3cd79caad70c 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -1398,7 +1398,7 @@ static int __init asus_acpi_init(void)
1398 if (!asus_hotk_found) { 1398 if (!asus_hotk_found) {
1399 acpi_bus_unregister_driver(&asus_hotk_driver); 1399 acpi_bus_unregister_driver(&asus_hotk_driver);
1400 remove_proc_entry(PROC_ASUS, acpi_root_dir); 1400 remove_proc_entry(PROC_ASUS, acpi_root_dir);
1401 return result; 1401 return -ENODEV;
1402 } 1402 }
1403 1403
1404 asus_backlight_device = backlight_device_register("asus",NULL,NULL, 1404 asus_backlight_device = backlight_device_register("asus",NULL,NULL,
@@ -1407,6 +1407,7 @@ static int __init asus_acpi_init(void)
1407 printk(KERN_ERR "Could not register asus backlight device\n"); 1407 printk(KERN_ERR "Could not register asus backlight device\n");
1408 asus_backlight_device = NULL; 1408 asus_backlight_device = NULL;
1409 asus_acpi_exit(); 1409 asus_acpi_exit();
1410 return -ENODEV;
1410 } 1411 }
1411 asus_backlight_device->props.max_brightness = 15; 1412 asus_backlight_device->props.max_brightness = 15;
1412 1413
diff --git a/drivers/misc/blink.c b/drivers/misc/blink.c
index 634431ce1184..97f7253ce2d3 100644
--- a/drivers/misc/blink.c
+++ b/drivers/misc/blink.c
@@ -16,12 +16,30 @@ static void do_blink(unsigned long data)
16 add_timer(&blink_timer); 16 add_timer(&blink_timer);
17} 17}
18 18
19static int blink_init(void) 19static int blink_panic_event(struct notifier_block *blk,
20 unsigned long event, void *arg)
20{ 21{
21 printk(KERN_INFO "Enabling keyboard blinking\n");
22 do_blink(0); 22 do_blink(0);
23 return 0; 23 return 0;
24} 24}
25 25
26static struct notifier_block blink_notify = {
27 .notifier_call = blink_panic_event,
28};
29
30static __init int blink_init(void)
31{
32 printk(KERN_INFO "Enabling keyboard blinking\n");
33 atomic_notifier_chain_register(&panic_notifier_list, &blink_notify);
34 return 0;
35}
36
37static __exit void blink_remove(void)
38{
39 del_timer_sync(&blink_timer);
40 atomic_notifier_chain_unregister(&panic_notifier_list, &blink_notify);
41}
42
26module_init(blink_init); 43module_init(blink_init);
44module_exit(blink_remove);
27 45
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c
index 3098960dc2a1..3078c419cb02 100644
--- a/drivers/net/irda/irport.c
+++ b/drivers/net/irda/irport.c
@@ -509,7 +509,7 @@ static void irport_timeout(struct net_device *dev)
509 IRDA_DEBUG(0, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n", 509 IRDA_DEBUG(0, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n",
510 __FUNCTION__, iir, lsr, iobase); 510 __FUNCTION__, iir, lsr, iobase);
511 511
512 IRDA_DEBUG(0, "%s(), transmitting=%d, remain=%d, done=%d\n", 512 IRDA_DEBUG(0, "%s(), transmitting=%d, remain=%d, done=%td\n",
513 __FUNCTION__, self->transmitting, self->tx_buff.len, 513 __FUNCTION__, self->transmitting, self->tx_buff.len,
514 self->tx_buff.data - self->tx_buff.head); 514 self->tx_buff.data - self->tx_buff.head);
515 515
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 2803b370ba01..36ab98386be0 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -79,7 +79,7 @@ MODULE_AUTHOR("Daniele Peri <peri@csai.unipa.it>");
79MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver"); 79MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver");
80MODULE_LICENSE("GPL"); 80MODULE_LICENSE("GPL");
81 81
82static int smsc_nopnp; 82static int smsc_nopnp = 1;
83module_param_named(nopnp, smsc_nopnp, bool, 0); 83module_param_named(nopnp, smsc_nopnp, bool, 0);
84MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings"); 84MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings");
85 85
diff --git a/drivers/net/wireless/libertas/Makefile b/drivers/net/wireless/libertas/Makefile
index a1097f59fd46..32ed4136b0d4 100644
--- a/drivers/net/wireless/libertas/Makefile
+++ b/drivers/net/wireless/libertas/Makefile
@@ -2,7 +2,7 @@ libertas-objs := main.o fw.o wext.o \
2 rx.o tx.o cmd.o \ 2 rx.o tx.o cmd.o \
3 cmdresp.o scan.o \ 3 cmdresp.o scan.o \
4 join.o 11d.o \ 4 join.o 11d.o \
5 ioctl.o debugfs.o \ 5 debugfs.o \
6 ethtool.o assoc.o 6 ethtool.o assoc.o
7 7
8usb8xxx-objs += if_bootcmd.o 8usb8xxx-objs += if_bootcmd.o
diff --git a/drivers/net/wireless/libertas/README b/drivers/net/wireless/libertas/README
index 1f92f50b643c..0b133ce63805 100644
--- a/drivers/net/wireless/libertas/README
+++ b/drivers/net/wireless/libertas/README
@@ -28,281 +28,6 @@ DRIVER LOADING
28 28
29 insmod usb8388.ko [fw_name=usb8388.bin] 29 insmod usb8388.ko [fw_name=usb8388.bin]
30 30
31=====================
32IWPRIV COMMAND
33=====================
34
35NAME
36 This manual describes the usage of private commands used in Marvell WLAN
37 Linux Driver. All the commands available in Wlanconfig will not be available
38 in the iwpriv.
39
40SYNOPSIS
41 iwpriv <ethX> <command> [sub-command] ...
42
43 iwpriv ethX setregioncode <n>
44 iwpriv ethX getregioncode
45
46Version 5 Command:
47 iwpriv ethX ledgpio <n>
48
49BT Commands:
50 The blinding table (BT) contains a list of mac addresses that will be,
51 by default, ignored by the firmware. It is also possible to invert this
52 behavior so that we will ignore all traffic except for the portion
53 coming from mac addresess in the list. It is primarily used for
54 debugging and testing networks. It can be edited and inspected with
55 the following commands:
56
57 iwpriv ethX bt_reset
58 iwpriv ethX bt_add <mac_address>
59 iwpriv ethX bt_del <mac_address>
60 iwpriv ethX bt_list <id>
61 iwpriv ethX bt_get_invert <n>
62 iwpriv ethX bt_set_invert <n>
63
64FWT Commands:
65 The forwarding table (FWT) is a feature used to manage mesh network
66 routing in the firmware. The FWT is essentially a routing table that
67 associates a destination mac address (da) with a next hop receiver
68 address (ra). The FWT can be inspected and edited with the following
69 iwpriv commands, which are described in greater detail below.
70 Eventually, the table will be automatically maintained by a custom
71 routing protocol.
72
73 NOTE: FWT commands replace the previous DFT commands. What were the DFT
74 commands?, you might ask. They were an earlier API to the firmware that
75 implemented a simple MAC-layer forwarding mechanism. In the unlikely
76 event that you were using these commands, you must migrate to the new
77 FWT commands which can be used to achieve the same functionality.
78
79 iwpriv ethX fwt_add [parameters]
80 iwpriv ethX fwt_del [parameters]
81 iwpriv ethX fwt_lookup [parameters]
82 iwpriv ethX fwt_list [parameters]
83 iwpriv ethX fwt_list_route [parameters]
84 iwpriv ethX fwt_list_neigh [parameters]
85 iwpriv ethX fwt_reset [parameters]
86 iwpriv ethX fwt_cleanup
87 iwpriv ethX fwt_time
88
89MESH Commands:
90
91 The MESH commands are used to configure various features of the mesh
92 routing protocol. The following commands are supported:
93
94 iwpriv ethX mesh_get_ttl
95 iwpriv ethX mesh_set_ttl ttl
96
97DESCRIPTION
98 Those commands are used to send additional commands to the Marvell WLAN
99 card via the Linux device driver.
100
101 The ethX parameter specifies the network device that is to be used to
102 perform this command on. it could be eth0, eth1 etc.
103
104setregioncode
105 This command is used to set the region code in the station.
106 where value is 'region code' for various regions like
107 USA FCC, Canada IC, Spain, France, Europe ETSI, Japan ...
108
109 Usage:
110 iwpriv ethX setregioncode 0x10: set region code to USA (0x10).
111
112getregioncode
113 This command is used to get the region code information set in the
114 station.
115
116ledgpio
117 This command is used to set/get LEDs.
118
119 iwpriv ethX ledgpio <LEDs>
120 will set the corresponding LED for the GPIO Line.
121
122 iwpriv ethX ledgpio
123 will give u which LEDs are Enabled.
124
125 Usage:
126 iwpriv eth1 ledgpio 1 0 2 1 3 4
127 will enable
128 LED 1 -> GPIO 0
129 LED 2 -> GPIO 1
130 LED 3 -> GPIO 4
131
132 iwpriv eth1 ledgpio
133 shows LED information in the format as mentioned above.
134
135 Note: LED0 is invalid
136 Note: Maximum Number of LEDs are 16.
137
138fwt_add
139 This command is used to insert an entry into the FWT table. The list of
140 parameters must follow the following structure:
141
142 iwpriv ethX fwt_add da ra [metric dir rate ssn dsn hopcount ttl expiration sleepmode snr]
143
144 The parameters between brackets are optional, but they must appear in
145 the order specified. For example, if you want to specify the metric,
146 you must also specify the dir, ssn, and dsn but you need not specify the
147 hopcount, expiration, sleepmode, or snr. Any unspecified parameters
148 will be assigned the defaults specified below.
149
150 The different parameters are:-
151 da -- DA MAC address in the form 00:11:22:33:44:55
152 ra -- RA MAC address in the form 00:11:22:33:44:55
153 metric -- route metric (cost: smaller-metric routes are
154 preferred, default is 0)
155 dir -- direction (1 for direct, 0 for reverse,
156 default is 1)
157 rate -- data rate used for transmission to the RA,
158 as specified for the rateadapt command,
159 default is 3 (11Mbps)
160 ssn -- Source Sequence Number (time at the RA for
161 reverse routes. Default is 0)
162 dsn -- Destination Sequence Number (time at the DA
163 for direct routes. Default is 0)
164 hopcount -- hop count (currently unused, default is 0)
165 ttl -- TTL (Only used in reverse entries)
166 expiration -- entry expiration (in ticks, where a tick is
167 1024us, or ~ 1ms. Use 0 for an indefinite
168 entry, default is 0)
169 sleepmode -- RA's sleep mode (currently unused, default is
170 0)
171 snr -- SNR in the link to RA (currently unused,
172 default is 0)
173
174 The command does not return anything.
175
176fwt_del
177 This command is used to remove an entry to the FWT table. The list of
178 parameters must follow the following structure:
179
180 iwpriv ethX fwt_del da ra [dir]
181
182 where the different parameters are:-
183 da -- DA MAC address (in the form "00:11:22:33:44:55")
184 ra -- RA MAC address (in the form "00:11:22:33:44:55")
185 dir -- direction (1 for direct, 0 for reverse,
186 default is 1)
187
188 The command does not return anything.
189
190fwt_lookup
191 This command is used to get the best route in the FWT table to a given
192 host. The only parameter is the MAC address of the host that is being
193 looked for.
194
195 iwpriv ethX fwt_lookup da
196
197 where:-
198 da -- DA MAC address (in the form "00:11:22:33:44:55")
199
200 The command returns an output string identical to the one returned by
201 fwt_list described below.
202
203
204fwt_list
205 This command is used to list a route from the FWT table. The only
206 parameter is the index into the table. If you want to list all the
207 routes in a table, start with index=0, and keep listing until you get a
208 "(null)" string. Note that the indicies may change as the fwt is
209 updated. It is expected that most users will not use fwt_list directly,
210 but that a utility similar to the traditional route command will be used
211 to invoke fwt_list over and over.
212
213 iwpriv ethX fwt_list index
214
215 The output is a string of the following form:
216
217 da ra valid metric dir rate ssn dsn hopcount ttl expiration
218 sleepmode snr precursor
219
220 where the different fields are:-
221 da -- DA MAC address (in the form "00:11:22:33:44:55")
222 ra -- RA MAC address (in the form "00:11:22:33:44:55")
223 valid -- whether the route is valid (0 if not valid)
224 metric -- route metric (cost: smaller-metric routes are preferred)
225 dir -- direction (1 for direct, 0 for reverse)
226 rate -- data rate used for transmission to the RA,
227 as specified for the rateadapt command
228 ssn -- Source Sequence Number (time at the RA for reverse routes)
229 dsn -- Destination Sequence Number (time at the DA for direct routes)
230 hopcount -- hop count (currently unused)
231 ttl -- TTL (only used in reverse entries)
232 expiration -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry)
233 sleepmode -- RA's sleep mode (currently unused)
234 snr -- SNR in the link to RA (currently unused)
235 precursor -- predecessor in direct routes
236
237fwt_list_route
238 This command is equivalent to fwt_list.
239
240fwt_list_neigh
241 This command is used to list a neighbor from the FWT table. The only
242 parameter is the neighbor ID. If you want to list all the neighbors in a
243 table, start with nid=0, and keep incrementing nid until you get a
244 "(null)" string. Note that the nid from a fwt_list_route command can be
245 used as an input to this command. Also note that this command is meant
246 mostly for debugging. It is expected that users will use fwt_lookup.
247 One important reason for this is that the neighbor id may change as the
248 neighbor table is altered.
249
250 iwpriv ethX fwt_list_neigh nid
251
252 The output is a string of the following form:
253
254 ra sleepmode snr references
255
256 where the different fields are:-
257 ra -- RA MAC address (in the form "00:11:22:33:44:55")
258 sleepmode -- RA's sleep mode (currently unused)
259 snr -- SNR in the link to RA (currently unused)
260 references -- RA's reference counter
261
262fwt_reset
263 This command is used to reset the FWT table, getting rid of all the
264 entries. There are no input parameters.
265
266 iwpriv ethX fwt_reset
267
268 The command does not return anything.
269
270fwt_cleanup
271 This command is used to perform user-based garbage recollection. The
272 FWT table is checked, and all the entries that are expired or invalid
273 are cleaned. Note that this is exported to the driver for debugging
274 purposes, as garbage collection is also fired by the firmware when in
275 space problems. There are no input parameters.
276
277 iwpriv ethX fwt_cleanup
278
279 The command does returns the number of invalid/expired routes deleted.
280
281fwt_time
282 This command returns a card's internal time representation. It is this
283 time that is used to represent the expiration times of FWT entries. The
284 number is not consistent from card to card; it is simply a timer count.
285 The fwt_time command is used to inspect the timer so that expiration
286 times reported by fwt_list can be properly interpreted.
287
288 iwpriv ethX fwt_time
289
290mesh_get_ttl
291
292 The mesh ttl is the number of hops a mesh packet can traverse before it
293 is dropped. This parameter is used to prevent infinite loops in the
294 mesh network. The value returned by this function is the ttl assigned
295 to all mesh packets. Currently there is no way to control the ttl on a
296 per packet or per socket basis.
297
298 iwpriv ethX mesh_get_ttl
299
300mesh_set_ttl ttl
301
302 Set the ttl. The argument must be between 0 and 255.
303
304 iwpriv ethX mesh_set_ttl <ttl>
305
306========================= 31=========================
307ETHTOOL 32ETHTOOL
308========================= 33=========================
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index f67efa0815fe..afd5617dd92b 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -323,6 +323,8 @@ static int assoc_helper_secinfo(wlan_private *priv,
323{ 323{
324 wlan_adapter *adapter = priv->adapter; 324 wlan_adapter *adapter = priv->adapter;
325 int ret = 0; 325 int ret = 0;
326 u32 do_wpa;
327 u32 rsn = 0;
326 328
327 lbs_deb_enter(LBS_DEB_ASSOC); 329 lbs_deb_enter(LBS_DEB_ASSOC);
328 330
@@ -333,12 +335,34 @@ static int assoc_helper_secinfo(wlan_private *priv,
333 if (ret) 335 if (ret)
334 goto out; 336 goto out;
335 337
336 /* enable/disable RSN */ 338 /* If RSN is already enabled, don't try to enable it again, since
339 * ENABLE_RSN resets internal state machines and will clobber the
340 * 4-way WPA handshake.
341 */
342
343 /* Get RSN enabled/disabled */
337 ret = libertas_prepare_and_send_command(priv, 344 ret = libertas_prepare_and_send_command(priv,
338 cmd_802_11_enable_rsn, 345 cmd_802_11_enable_rsn,
339 cmd_act_set, 346 cmd_act_set,
340 cmd_option_waitforrsp, 347 cmd_option_waitforrsp,
341 0, assoc_req); 348 0, &rsn);
349 if (ret) {
350 lbs_deb_assoc("Failed to get RSN status: %d", ret);
351 goto out;
352 }
353
354 /* Don't re-enable RSN if it's already enabled */
355 do_wpa = (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled);
356 if (do_wpa == rsn)
357 goto out;
358
359 /* Set RSN enabled/disabled */
360 rsn = do_wpa;
361 ret = libertas_prepare_and_send_command(priv,
362 cmd_802_11_enable_rsn,
363 cmd_act_set,
364 cmd_option_waitforrsp,
365 0, &rsn);
342 366
343out: 367out:
344 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); 368 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 124e029f1bf4..13f6528abb00 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -228,17 +228,19 @@ static int wlan_cmd_802_11_enable_rsn(wlan_private * priv,
228 void * pdata_buf) 228 void * pdata_buf)
229{ 229{
230 struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn; 230 struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn;
231 struct assoc_request * assoc_req = pdata_buf; 231 u32 * enable = pdata_buf;
232 232
233 lbs_deb_enter(LBS_DEB_CMD); 233 lbs_deb_enter(LBS_DEB_CMD);
234 234
235 cmd->command = cpu_to_le16(cmd_802_11_enable_rsn); 235 cmd->command = cpu_to_le16(cmd_802_11_enable_rsn);
236 cmd->size = cpu_to_le16(sizeof(*penableRSN) + S_DS_GEN); 236 cmd->size = cpu_to_le16(sizeof(*penableRSN) + S_DS_GEN);
237 penableRSN->action = cpu_to_le16(cmd_action); 237 penableRSN->action = cpu_to_le16(cmd_action);
238 if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { 238
239 penableRSN->enable = cpu_to_le16(cmd_enable_rsn); 239 if (cmd_action == cmd_act_set) {
240 } else { 240 if (*enable)
241 penableRSN->enable = cpu_to_le16(cmd_disable_rsn); 241 penableRSN->enable = cpu_to_le16(cmd_enable_rsn);
242 else
243 penableRSN->enable = cpu_to_le16(cmd_enable_rsn);
242 } 244 }
243 245
244 lbs_deb_leave(LBS_DEB_CMD); 246 lbs_deb_leave(LBS_DEB_CMD);
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 0c3b9a583d83..6ac0d4752fa4 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -537,6 +537,24 @@ static int wlan_ret_get_log(wlan_private * priv,
537 return 0; 537 return 0;
538} 538}
539 539
540static int libertas_ret_802_11_enable_rsn(wlan_private * priv,
541 struct cmd_ds_command *resp)
542{
543 struct cmd_ds_802_11_enable_rsn *enable_rsn = &resp->params.enbrsn;
544 wlan_adapter *adapter = priv->adapter;
545 u32 * pdata_buf = adapter->cur_cmd->pdata_buf;
546
547 lbs_deb_enter(LBS_DEB_CMD);
548
549 if (enable_rsn->action == cpu_to_le16(cmd_act_get)) {
550 if (pdata_buf)
551 *pdata_buf = (u32) le16_to_cpu(enable_rsn->enable);
552 }
553
554 lbs_deb_enter(LBS_DEB_CMD);
555 return 0;
556}
557
540static inline int handle_cmd_response(u16 respcmd, 558static inline int handle_cmd_response(u16 respcmd,
541 struct cmd_ds_command *resp, 559 struct cmd_ds_command *resp,
542 wlan_private *priv) 560 wlan_private *priv)
@@ -610,7 +628,10 @@ static inline int handle_cmd_response(u16 respcmd,
610 case cmd_ret_802_11_authenticate: 628 case cmd_ret_802_11_authenticate:
611 case cmd_ret_802_11_radio_control: 629 case cmd_ret_802_11_radio_control:
612 case cmd_ret_802_11_beacon_stop: 630 case cmd_ret_802_11_beacon_stop:
631 break;
632
613 case cmd_ret_802_11_enable_rsn: 633 case cmd_ret_802_11_enable_rsn:
634 ret = libertas_ret_802_11_enable_rsn(priv, resp);
614 break; 635 break;
615 636
616 case cmd_ret_802_11_data_rate: 637 case cmd_ret_802_11_data_rate:
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index 3acf93988125..09b898f6719c 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -503,7 +503,7 @@ struct cmd_ds_802_11_ad_hoc_join {
503struct cmd_ds_802_11_enable_rsn { 503struct cmd_ds_802_11_enable_rsn {
504 __le16 action; 504 __le16 action;
505 __le16 enable; 505 __le16 enable;
506}; 506} __attribute__ ((packed));
507 507
508struct MrvlIEtype_keyParamSet { 508struct MrvlIEtype_keyParamSet {
509 /* type ID */ 509 /* type ID */
diff --git a/drivers/net/wireless/libertas/ioctl.c b/drivers/net/wireless/libertas/ioctl.c
deleted file mode 100644
index f41081585564..000000000000
--- a/drivers/net/wireless/libertas/ioctl.c
+++ /dev/null
@@ -1,1081 +0,0 @@
1/**
2 * This file contains ioctl functions
3 */
4
5#include <linux/ctype.h>
6#include <linux/delay.h>
7#include <linux/if.h>
8#include <linux/if_arp.h>
9#include <linux/wireless.h>
10
11#include <net/iw_handler.h>
12#include <net/ieee80211.h>
13
14#include "host.h"
15#include "radiotap.h"
16#include "decl.h"
17#include "defs.h"
18#include "dev.h"
19#include "join.h"
20#include "wext.h"
21
22#define MAX_SCAN_CELL_SIZE (IW_EV_ADDR_LEN + \
23 IW_ESSID_MAX_SIZE + \
24 IW_EV_UINT_LEN + IW_EV_FREQ_LEN + \
25 IW_EV_QUAL_LEN + IW_ESSID_MAX_SIZE + \
26 IW_EV_PARAM_LEN + 40) /* 40 for WPAIE */
27
28#define WAIT_FOR_SCAN_RRESULT_MAX_TIME (10 * HZ)
29
30static int wlan_set_region(wlan_private * priv, u16 region_code)
31{
32 int i;
33 int ret = 0;
34
35 for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) {
36 // use the region code to search for the index
37 if (region_code == libertas_region_code_to_index[i]) {
38 priv->adapter->regiontableindex = (u16) i;
39 priv->adapter->regioncode = region_code;
40 break;
41 }
42 }
43
44 // if it's unidentified region code
45 if (i >= MRVDRV_MAX_REGION_CODE) {
46 lbs_deb_ioctl("region Code not identified\n");
47 ret = -1;
48 goto done;
49 }
50
51 if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) {
52 ret = -EINVAL;
53 }
54
55done:
56 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
57 return ret;
58}
59
60static inline int hex2int(char c)
61{
62 if (c >= '0' && c <= '9')
63 return (c - '0');
64 if (c >= 'a' && c <= 'f')
65 return (c - 'a' + 10);
66 if (c >= 'A' && c <= 'F')
67 return (c - 'A' + 10);
68 return -1;
69}
70
71/* Convert a string representation of a MAC address ("xx:xx:xx:xx:xx:xx")
72 into binary format (6 bytes).
73
74 This function expects that each byte is represented with 2 characters
75 (e.g., 11:2:11:11:11:11 is invalid)
76
77 */
78static char *eth_str2addr(char *ethstr, u8 * addr)
79{
80 int i, val, val2;
81 char *pos = ethstr;
82
83 /* get rid of initial blanks */
84 while (*pos == ' ' || *pos == '\t')
85 ++pos;
86
87 for (i = 0; i < 6; i++) {
88 val = hex2int(*pos++);
89 if (val < 0)
90 return NULL;
91 val2 = hex2int(*pos++);
92 if (val2 < 0)
93 return NULL;
94 addr[i] = (val * 16 + val2) & 0xff;
95
96 if (i < 5 && *pos++ != ':')
97 return NULL;
98 }
99 return pos;
100}
101
102/* this writes xx:xx:xx:xx:xx:xx into ethstr
103 (ethstr must have space for 18 chars) */
104static int eth_addr2str(u8 * addr, char *ethstr)
105{
106 int i;
107 char *pos = ethstr;
108
109 for (i = 0; i < 6; i++) {
110 sprintf(pos, "%02x", addr[i] & 0xff);
111 pos += 2;
112 if (i < 5)
113 *pos++ = ':';
114 }
115 return 17;
116}
117
118/**
119 * @brief Add an entry to the BT table
120 * @param priv A pointer to wlan_private structure
121 * @param req A pointer to ifreq structure
122 * @return 0 --success, otherwise fail
123 */
124static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req)
125{
126 struct iwreq *wrq = (struct iwreq *)req;
127 char ethaddrs_str[18];
128 char *pos;
129 u8 ethaddr[ETH_ALEN];
130 int ret;
131
132 lbs_deb_enter(LBS_DEB_IOCTL);
133
134 if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
135 sizeof(ethaddrs_str)))
136 return -EFAULT;
137
138 if ((pos = eth_str2addr(ethaddrs_str, ethaddr)) == NULL) {
139 lbs_pr_info("BT_ADD: Invalid MAC address\n");
140 return -EINVAL;
141 }
142
143 lbs_deb_ioctl("BT: adding %s\n", ethaddrs_str);
144 ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
145 cmd_act_bt_access_add,
146 cmd_option_waitforrsp, 0, ethaddr);
147 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
148 return ret;
149}
150
151/**
152 * @brief Delete an entry from the BT table
153 * @param priv A pointer to wlan_private structure
154 * @param req A pointer to ifreq structure
155 * @return 0 --success, otherwise fail
156 */
157static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
158{
159 struct iwreq *wrq = (struct iwreq *)req;
160 char ethaddrs_str[18];
161 u8 ethaddr[ETH_ALEN];
162 char *pos;
163
164 lbs_deb_enter(LBS_DEB_IOCTL);
165
166 if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
167 sizeof(ethaddrs_str)))
168 return -EFAULT;
169
170 if ((pos = eth_str2addr(ethaddrs_str, ethaddr)) == NULL) {
171 lbs_pr_info("Invalid MAC address\n");
172 return -EINVAL;
173 }
174
175 lbs_deb_ioctl("BT: deleting %s\n", ethaddrs_str);
176
177 return (libertas_prepare_and_send_command(priv,
178 cmd_bt_access,
179 cmd_act_bt_access_del,
180 cmd_option_waitforrsp, 0, ethaddr));
181
182 lbs_deb_leave(LBS_DEB_IOCTL);
183 return 0;
184}
185
186/**
187 * @brief Reset all entries from the BT table
188 * @param priv A pointer to wlan_private structure
189 * @return 0 --success, otherwise fail
190 */
191static int wlan_bt_reset_ioctl(wlan_private * priv)
192{
193 lbs_deb_enter(LBS_DEB_IOCTL);
194
195 lbs_pr_alert( "BT: resetting\n");
196
197 return (libertas_prepare_and_send_command(priv,
198 cmd_bt_access,
199 cmd_act_bt_access_reset,
200 cmd_option_waitforrsp, 0, NULL));
201
202 lbs_deb_leave(LBS_DEB_IOCTL);
203 return 0;
204}
205
206/**
207 * @brief List an entry from the BT table
208 * @param priv A pointer to wlan_private structure
209 * @param req A pointer to ifreq structure
210 * @return 0 --success, otherwise fail
211 */
212static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
213{
214 int pos;
215 char *addr1;
216 struct iwreq *wrq = (struct iwreq *)req;
217 /* used to pass id and store the bt entry returned by the FW */
218 union {
219 u32 id;
220 char addr1addr2[2 * ETH_ALEN];
221 } param;
222 static char outstr[64];
223 char *pbuf = outstr;
224 int ret;
225
226 lbs_deb_enter(LBS_DEB_IOCTL);
227
228 if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) {
229 lbs_deb_ioctl("Copy from user failed\n");
230 return -1;
231 }
232 param.id = simple_strtoul(outstr, NULL, 10);
233 pos = sprintf(pbuf, "%d: ", param.id);
234 pbuf += pos;
235
236 ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
237 cmd_act_bt_access_list,
238 cmd_option_waitforrsp, 0,
239 (char *)&param);
240
241 if (ret == 0) {
242 addr1 = param.addr1addr2;
243
244 pos = sprintf(pbuf, "BT includes node ");
245 pbuf += pos;
246 pos = eth_addr2str(addr1, pbuf);
247 pbuf += pos;
248 } else {
249 sprintf(pbuf, "(null)");
250 pbuf += pos;
251 }
252
253 wrq->u.data.length = strlen(outstr);
254 if (copy_to_user(wrq->u.data.pointer, (char *)outstr,
255 wrq->u.data.length)) {
256 lbs_deb_ioctl("BT_LIST: Copy to user failed!\n");
257 return -EFAULT;
258 }
259
260 lbs_deb_leave(LBS_DEB_IOCTL);
261 return 0 ;
262}
263
264/**
265 * @brief Sets inverted state of blacklist (non-zero if inverted)
266 * @param priv A pointer to wlan_private structure
267 * @param req A pointer to ifreq structure
268 * @return 0 --success, otherwise fail
269 */
270static int wlan_bt_set_invert_ioctl(wlan_private * priv, struct ifreq *req)
271{
272 int ret;
273 struct iwreq *wrq = (struct iwreq *)req;
274 union {
275 u32 id;
276 char addr1addr2[2 * ETH_ALEN];
277 } param;
278
279 lbs_deb_enter(LBS_DEB_IOCTL);
280
281 param.id = SUBCMD_DATA(wrq) ;
282 ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
283 cmd_act_bt_access_set_invert,
284 cmd_option_waitforrsp, 0,
285 (char *)&param);
286 if (ret != 0)
287 return -EFAULT;
288 lbs_deb_leave(LBS_DEB_IOCTL);
289 return 0;
290}
291
292/**
293 * @brief Gets inverted state of blacklist (non-zero if inverted)
294 * @param priv A pointer to wlan_private structure
295 * @param req A pointer to ifreq structure
296 * @return 0 --success, otherwise fail
297 */
298static int wlan_bt_get_invert_ioctl(wlan_private * priv, struct ifreq *req)
299{
300 struct iwreq *wrq = (struct iwreq *)req;
301 int ret;
302 union {
303 u32 id;
304 char addr1addr2[2 * ETH_ALEN];
305 } param;
306
307 lbs_deb_enter(LBS_DEB_IOCTL);
308
309 ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
310 cmd_act_bt_access_get_invert,
311 cmd_option_waitforrsp, 0,
312 (char *)&param);
313
314 if (ret == 0)
315 wrq->u.param.value = le32_to_cpu(param.id);
316 else
317 return -EFAULT;
318
319 lbs_deb_leave(LBS_DEB_IOCTL);
320 return 0;
321}
322
323/**
324 * @brief Find the next parameter in an input string
325 * @param ptr A pointer to the input parameter string
326 * @return A pointer to the next parameter, or 0 if no parameters left.
327 */
328static char * next_param(char * ptr)
329{
330 if (!ptr) return NULL;
331 while (*ptr == ' ' || *ptr == '\t') ++ptr;
332 return (*ptr == '\0') ? NULL : ptr;
333}
334
335/**
336 * @brief Add an entry to the FWT table
337 * @param priv A pointer to wlan_private structure
338 * @param req A pointer to ifreq structure
339 * @return 0 --success, otherwise fail
340 */
341static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
342{
343 struct iwreq *wrq = (struct iwreq *)req;
344 char in_str[128];
345 static struct cmd_ds_fwt_access fwt_access;
346 char *ptr;
347 int ret;
348
349 lbs_deb_enter(LBS_DEB_IOCTL);
350
351 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
352 return -EFAULT;
353
354 if ((ptr = eth_str2addr(in_str, fwt_access.da)) == NULL) {
355 lbs_pr_alert( "FWT_ADD: Invalid MAC address 1\n");
356 return -EINVAL;
357 }
358
359 if ((ptr = eth_str2addr(ptr, fwt_access.ra)) == NULL) {
360 lbs_pr_alert( "FWT_ADD: Invalid MAC address 2\n");
361 return -EINVAL;
362 }
363
364 if ((ptr = next_param(ptr)))
365 fwt_access.metric =
366 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
367 else
368 fwt_access.metric = cpu_to_le32(FWT_DEFAULT_METRIC);
369
370 if ((ptr = next_param(ptr)))
371 fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10);
372 else
373 fwt_access.dir = FWT_DEFAULT_DIR;
374
375 if ((ptr = next_param(ptr)))
376 fwt_access.rate = (u8) simple_strtoul(ptr, &ptr, 10);
377 else
378 fwt_access.rate = FWT_DEFAULT_RATE;
379
380 if ((ptr = next_param(ptr)))
381 fwt_access.ssn =
382 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
383 else
384 fwt_access.ssn = cpu_to_le32(FWT_DEFAULT_SSN);
385
386 if ((ptr = next_param(ptr)))
387 fwt_access.dsn =
388 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
389 else
390 fwt_access.dsn = cpu_to_le32(FWT_DEFAULT_DSN);
391
392 if ((ptr = next_param(ptr)))
393 fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10);
394 else
395 fwt_access.hopcount = FWT_DEFAULT_HOPCOUNT;
396
397 if ((ptr = next_param(ptr)))
398 fwt_access.ttl = simple_strtoul(ptr, &ptr, 10);
399 else
400 fwt_access.ttl = FWT_DEFAULT_TTL;
401
402 if ((ptr = next_param(ptr)))
403 fwt_access.expiration =
404 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
405 else
406 fwt_access.expiration = cpu_to_le32(FWT_DEFAULT_EXPIRATION);
407
408 if ((ptr = next_param(ptr)))
409 fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10);
410 else
411 fwt_access.sleepmode = FWT_DEFAULT_SLEEPMODE;
412
413 if ((ptr = next_param(ptr)))
414 fwt_access.snr =
415 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
416 else
417 fwt_access.snr = cpu_to_le32(FWT_DEFAULT_SNR);
418
419#ifdef DEBUG
420 {
421 char ethaddr1_str[18], ethaddr2_str[18];
422 eth_addr2str(fwt_access.da, ethaddr1_str);
423 eth_addr2str(fwt_access.ra, ethaddr2_str);
424 lbs_deb_ioctl("FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str,
425 fwt_access.dir, ethaddr2_str);
426 lbs_deb_ioctl("FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n",
427 fwt_access.ssn, fwt_access.dsn, fwt_access.metric,
428 fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration,
429 fwt_access.sleepmode, fwt_access.snr);
430 }
431#endif
432
433 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
434 cmd_act_fwt_access_add,
435 cmd_option_waitforrsp, 0,
436 (void *)&fwt_access);
437
438 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
439 return ret;
440}
441
442/**
443 * @brief Delete an entry from the FWT table
444 * @param priv A pointer to wlan_private structure
445 * @param req A pointer to ifreq structure
446 * @return 0 --success, otherwise fail
447 */
448static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req)
449{
450 struct iwreq *wrq = (struct iwreq *)req;
451 char in_str[64];
452 static struct cmd_ds_fwt_access fwt_access;
453 char *ptr;
454 int ret;
455
456 lbs_deb_enter(LBS_DEB_IOCTL);
457
458 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
459 return -EFAULT;
460
461 if ((ptr = eth_str2addr(in_str, fwt_access.da)) == NULL) {
462 lbs_pr_alert( "FWT_DEL: Invalid MAC address 1\n");
463 return -EINVAL;
464 }
465
466 if ((ptr = eth_str2addr(ptr, fwt_access.ra)) == NULL) {
467 lbs_pr_alert( "FWT_DEL: Invalid MAC address 2\n");
468 return -EINVAL;
469 }
470
471 if ((ptr = next_param(ptr)))
472 fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10);
473 else
474 fwt_access.dir = FWT_DEFAULT_DIR;
475
476#ifdef DEBUG
477 {
478 char ethaddr1_str[18], ethaddr2_str[18];
479 lbs_deb_ioctl("FWT_DEL: line is %s\n", in_str);
480 eth_addr2str(fwt_access.da, ethaddr1_str);
481 eth_addr2str(fwt_access.ra, ethaddr2_str);
482 lbs_deb_ioctl("FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str,
483 ethaddr2_str, fwt_access.dir);
484 }
485#endif
486
487 ret = libertas_prepare_and_send_command(priv,
488 cmd_fwt_access,
489 cmd_act_fwt_access_del,
490 cmd_option_waitforrsp, 0,
491 (void *)&fwt_access);
492 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
493 return ret;
494}
495
496
497/**
498 * @brief Print route parameters
499 * @param fwt_access struct cmd_ds_fwt_access with route info
500 * @param buf destination buffer for route info
501 */
502static void print_route(struct cmd_ds_fwt_access fwt_access, char *buf)
503{
504 buf += sprintf(buf, " ");
505 buf += eth_addr2str(fwt_access.da, buf);
506 buf += sprintf(buf, " ");
507 buf += eth_addr2str(fwt_access.ra, buf);
508 buf += sprintf(buf, " %u", fwt_access.valid);
509 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.metric));
510 buf += sprintf(buf, " %u", fwt_access.dir);
511 buf += sprintf(buf, " %u", fwt_access.rate);
512 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.ssn));
513 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.dsn));
514 buf += sprintf(buf, " %u", fwt_access.hopcount);
515 buf += sprintf(buf, " %u", fwt_access.ttl);
516 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.expiration));
517 buf += sprintf(buf, " %u", fwt_access.sleepmode);
518 buf += sprintf(buf, " %u ", le32_to_cpu(fwt_access.snr));
519 buf += eth_addr2str(fwt_access.prec, buf);
520}
521
522/**
523 * @brief Lookup an entry in the FWT table
524 * @param priv A pointer to wlan_private structure
525 * @param req A pointer to ifreq structure
526 * @return 0 --success, otherwise fail
527 */
528static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
529{
530 struct iwreq *wrq = (struct iwreq *)req;
531 char in_str[64];
532 char *ptr;
533 static struct cmd_ds_fwt_access fwt_access;
534 static char out_str[128];
535 int ret;
536
537 lbs_deb_enter(LBS_DEB_IOCTL);
538
539 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
540 return -EFAULT;
541
542 if ((ptr = eth_str2addr(in_str, fwt_access.da)) == NULL) {
543 lbs_pr_alert( "FWT_LOOKUP: Invalid MAC address\n");
544 return -EINVAL;
545 }
546
547#ifdef DEBUG
548 {
549 char ethaddr1_str[18];
550 lbs_deb_ioctl("FWT_LOOKUP: line is %s\n", in_str);
551 eth_addr2str(fwt_access.da, ethaddr1_str);
552 lbs_deb_ioctl("FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str);
553 }
554#endif
555
556 ret = libertas_prepare_and_send_command(priv,
557 cmd_fwt_access,
558 cmd_act_fwt_access_lookup,
559 cmd_option_waitforrsp, 0,
560 (void *)&fwt_access);
561
562 if (ret == 0)
563 print_route(fwt_access, out_str);
564 else
565 sprintf(out_str, "(null)");
566
567 wrq->u.data.length = strlen(out_str);
568 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
569 wrq->u.data.length)) {
570 lbs_deb_ioctl("FWT_LOOKUP: Copy to user failed!\n");
571 return -EFAULT;
572 }
573
574 lbs_deb_leave(LBS_DEB_IOCTL);
575 return 0;
576}
577
578/**
579 * @brief Reset all entries from the FWT table
580 * @param priv A pointer to wlan_private structure
581 * @return 0 --success, otherwise fail
582 */
583static int wlan_fwt_reset_ioctl(wlan_private * priv)
584{
585 lbs_deb_ioctl("FWT: resetting\n");
586
587 return (libertas_prepare_and_send_command(priv,
588 cmd_fwt_access,
589 cmd_act_fwt_access_reset,
590 cmd_option_waitforrsp, 0, NULL));
591}
592
593/**
594 * @brief List an entry from the FWT table
595 * @param priv A pointer to wlan_private structure
596 * @param req A pointer to ifreq structure
597 * @return 0 --success, otherwise fail
598 */
599static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
600{
601 struct iwreq *wrq = (struct iwreq *)req;
602 char in_str[8];
603 static struct cmd_ds_fwt_access fwt_access;
604 char *ptr = in_str;
605 static char out_str[128];
606 char *pbuf = out_str;
607 int ret = 0;
608
609 lbs_deb_enter(LBS_DEB_IOCTL);
610
611 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) {
612 ret = -EFAULT;
613 goto out;
614 }
615
616 fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
617
618#ifdef DEBUG
619 {
620 lbs_deb_ioctl("FWT_LIST: line is %s\n", in_str);
621 lbs_deb_ioctl("FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id));
622 }
623#endif
624
625 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
626 cmd_act_fwt_access_list,
627 cmd_option_waitforrsp, 0, (void *)&fwt_access);
628
629 if (ret == 0)
630 print_route(fwt_access, pbuf);
631 else
632 pbuf += sprintf(pbuf, " (null)");
633
634 wrq->u.data.length = strlen(out_str);
635 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
636 wrq->u.data.length)) {
637 lbs_deb_ioctl("FWT_LIST: Copy to user failed!\n");
638 ret = -EFAULT;
639 goto out;
640 }
641
642 ret = 0;
643
644out:
645 lbs_deb_leave(LBS_DEB_IOCTL);
646 return ret;
647}
648
649/**
650 * @brief List an entry from the FRT table
651 * @param priv A pointer to wlan_private structure
652 * @param req A pointer to ifreq structure
653 * @return 0 --success, otherwise fail
654 */
655static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
656{
657 struct iwreq *wrq = (struct iwreq *)req;
658 char in_str[64];
659 static struct cmd_ds_fwt_access fwt_access;
660 char *ptr = in_str;
661 static char out_str[128];
662 char *pbuf = out_str;
663 int ret;
664
665 lbs_deb_enter(LBS_DEB_IOCTL);
666
667 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
668 return -EFAULT;
669
670 fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
671
672#ifdef DEBUG
673 {
674 lbs_deb_ioctl("FWT_LIST_ROUTE: line is %s\n", in_str);
675 lbs_deb_ioctl("FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id));
676 }
677#endif
678
679 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
680 cmd_act_fwt_access_list_route,
681 cmd_option_waitforrsp, 0, (void *)&fwt_access);
682
683 if (ret == 0) {
684 print_route(fwt_access, pbuf);
685 } else
686 pbuf += sprintf(pbuf, " (null)");
687
688 wrq->u.data.length = strlen(out_str);
689 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
690 wrq->u.data.length)) {
691 lbs_deb_ioctl("FWT_LIST_ROUTE: Copy to user failed!\n");
692 return -EFAULT;
693 }
694
695 lbs_deb_leave(LBS_DEB_IOCTL);
696 return 0;
697}
698
699/**
700 * @brief List an entry from the FNT table
701 * @param priv A pointer to wlan_private structure
702 * @param req A pointer to ifreq structure
703 * @return 0 --success, otherwise fail
704 */
705static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
706{
707 struct iwreq *wrq = (struct iwreq *)req;
708 char in_str[8];
709 static struct cmd_ds_fwt_access fwt_access;
710 char *ptr = in_str;
711 static char out_str[128];
712 char *pbuf = out_str;
713 int ret;
714
715 lbs_deb_enter(LBS_DEB_IOCTL);
716
717 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
718 return -EFAULT;
719
720 memset(&fwt_access, 0, sizeof(fwt_access));
721 fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
722
723#ifdef DEBUG
724 {
725 lbs_deb_ioctl("FWT_LIST_NEIGHBOR: line is %s\n", in_str);
726 lbs_deb_ioctl("FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id));
727 }
728#endif
729
730 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
731 cmd_act_fwt_access_list_neighbor,
732 cmd_option_waitforrsp, 0,
733 (void *)&fwt_access);
734
735 if (ret == 0) {
736 pbuf += sprintf(pbuf, " ra ");
737 pbuf += eth_addr2str(fwt_access.ra, pbuf);
738 pbuf += sprintf(pbuf, " slp %u", fwt_access.sleepmode);
739 pbuf += sprintf(pbuf, " snr %u", le32_to_cpu(fwt_access.snr));
740 pbuf += sprintf(pbuf, " ref %u", le32_to_cpu(fwt_access.references));
741 } else
742 pbuf += sprintf(pbuf, " (null)");
743
744 wrq->u.data.length = strlen(out_str);
745 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
746 wrq->u.data.length)) {
747 lbs_deb_ioctl("FWT_LIST_NEIGHBOR: Copy to user failed!\n");
748 return -EFAULT;
749 }
750
751 lbs_deb_leave(LBS_DEB_IOCTL);
752 return 0;
753}
754
755/**
756 * @brief Cleans up the route (FRT) and neighbor (FNT) tables
757 * (Garbage Collection)
758 * @param priv A pointer to wlan_private structure
759 * @param req A pointer to ifreq structure
760 * @return 0 --success, otherwise fail
761 */
762static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
763{
764 struct iwreq *wrq = (struct iwreq *)req;
765 static struct cmd_ds_fwt_access fwt_access;
766 int ret;
767
768 lbs_deb_enter(LBS_DEB_IOCTL);
769
770 lbs_deb_ioctl("FWT: cleaning up\n");
771
772 memset(&fwt_access, 0, sizeof(fwt_access));
773
774 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
775 cmd_act_fwt_access_cleanup,
776 cmd_option_waitforrsp, 0,
777 (void *)&fwt_access);
778
779 if (ret == 0)
780 wrq->u.param.value = le32_to_cpu(fwt_access.references);
781 else
782 return -EFAULT;
783
784 lbs_deb_leave(LBS_DEB_IOCTL);
785 return 0;
786}
787
788/**
789 * @brief Gets firmware internal time (debug purposes)
790 * @param priv A pointer to wlan_private structure
791 * @param req A pointer to ifreq structure
792 * @return 0 --success, otherwise fail
793 */
794static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
795{
796 struct iwreq *wrq = (struct iwreq *)req;
797 static struct cmd_ds_fwt_access fwt_access;
798 int ret;
799
800 lbs_deb_enter(LBS_DEB_IOCTL);
801
802 lbs_deb_ioctl("FWT: getting time\n");
803
804 memset(&fwt_access, 0, sizeof(fwt_access));
805
806 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
807 cmd_act_fwt_access_time,
808 cmd_option_waitforrsp, 0,
809 (void *)&fwt_access);
810
811 if (ret == 0)
812 wrq->u.param.value = le32_to_cpu(fwt_access.references);
813 else
814 return -EFAULT;
815
816 lbs_deb_leave(LBS_DEB_IOCTL);
817 return 0;
818}
819
820/**
821 * @brief Gets mesh ttl from firmware
822 * @param priv A pointer to wlan_private structure
823 * @param req A pointer to ifreq structure
824 * @return 0 --success, otherwise fail
825 */
826static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
827{
828 struct iwreq *wrq = (struct iwreq *)req;
829 struct cmd_ds_mesh_access mesh_access;
830 int ret;
831
832 lbs_deb_enter(LBS_DEB_IOCTL);
833
834 memset(&mesh_access, 0, sizeof(mesh_access));
835
836 ret = libertas_prepare_and_send_command(priv, cmd_mesh_access,
837 cmd_act_mesh_get_ttl,
838 cmd_option_waitforrsp, 0,
839 (void *)&mesh_access);
840
841 if (ret == 0)
842 wrq->u.param.value = le32_to_cpu(mesh_access.data[0]);
843 else
844 return -EFAULT;
845
846 lbs_deb_leave(LBS_DEB_IOCTL);
847 return 0;
848}
849
850/**
851 * @brief Gets mesh ttl from firmware
852 * @param priv A pointer to wlan_private structure
853 * @param ttl New ttl value
854 * @return 0 --success, otherwise fail
855 */
856static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
857{
858 struct cmd_ds_mesh_access mesh_access;
859 int ret;
860
861 lbs_deb_enter(LBS_DEB_IOCTL);
862
863 if( (ttl > 0xff) || (ttl < 0) )
864 return -EINVAL;
865
866 memset(&mesh_access, 0, sizeof(mesh_access));
867 mesh_access.data[0] = cpu_to_le32(ttl);
868
869 ret = libertas_prepare_and_send_command(priv, cmd_mesh_access,
870 cmd_act_mesh_set_ttl,
871 cmd_option_waitforrsp, 0,
872 (void *)&mesh_access);
873
874 if (ret != 0)
875 ret = -EFAULT;
876
877 lbs_deb_leave(LBS_DEB_IOCTL);
878 return ret;
879}
880
881/**
882 * @brief ioctl function - entry point
883 *
884 * @param dev A pointer to net_device structure
885 * @param req A pointer to ifreq structure
886 * @param cmd command
887 * @return 0--success, otherwise fail
888 */
889int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
890{
891 int subcmd = 0;
892 int idata = 0;
893 int *pdata;
894 int ret = 0;
895 wlan_private *priv = dev->priv;
896 wlan_adapter *adapter = priv->adapter;
897 struct iwreq *wrq = (struct iwreq *)req;
898
899 lbs_deb_enter(LBS_DEB_IOCTL);
900
901 lbs_deb_ioctl("libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd);
902 switch (cmd) {
903 case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */
904 switch (wrq->u.data.flags) {
905 case WLAN_SUBCMD_BT_RESET: /* bt_reset */
906 wlan_bt_reset_ioctl(priv);
907 break;
908 case WLAN_SUBCMD_FWT_RESET: /* fwt_reset */
909 wlan_fwt_reset_ioctl(priv);
910 break;
911 } /* End of switch */
912 break;
913
914 case WLAN_SETONEINT_GETNONE:
915 /* The first 4 bytes of req->ifr_data is sub-ioctl number
916 * after 4 bytes sits the payload.
917 */
918 subcmd = wrq->u.data.flags;
919 if (!subcmd)
920 subcmd = (int)wrq->u.param.value;
921
922 switch (subcmd) {
923 case WLANSETREGION:
924 idata = SUBCMD_DATA(wrq);
925 ret = wlan_set_region(priv, (u16) idata);
926 break;
927 case WLAN_SUBCMD_MESH_SET_TTL:
928 idata = SUBCMD_DATA(wrq);
929 ret = wlan_mesh_set_ttl_ioctl(priv, idata);
930 break;
931
932 case WLAN_SUBCMD_BT_SET_INVERT:
933 ret = wlan_bt_set_invert_ioctl(priv, req);
934 break ;
935
936 default:
937 ret = -EOPNOTSUPP;
938 break;
939 }
940
941 break;
942
943 case WLAN_SET128CHAR_GET128CHAR:
944 switch ((int)wrq->u.data.flags) {
945 case WLAN_SUBCMD_BT_ADD:
946 ret = wlan_bt_add_ioctl(priv, req);
947 break;
948 case WLAN_SUBCMD_BT_DEL:
949 ret = wlan_bt_del_ioctl(priv, req);
950 break;
951 case WLAN_SUBCMD_BT_LIST:
952 ret = wlan_bt_list_ioctl(priv, req);
953 break;
954 case WLAN_SUBCMD_FWT_ADD:
955 ret = wlan_fwt_add_ioctl(priv, req);
956 break;
957 case WLAN_SUBCMD_FWT_DEL:
958 ret = wlan_fwt_del_ioctl(priv, req);
959 break;
960 case WLAN_SUBCMD_FWT_LOOKUP:
961 ret = wlan_fwt_lookup_ioctl(priv, req);
962 break;
963 case WLAN_SUBCMD_FWT_LIST_NEIGHBOR:
964 ret = wlan_fwt_list_neighbor_ioctl(priv, req);
965 break;
966 case WLAN_SUBCMD_FWT_LIST:
967 ret = wlan_fwt_list_ioctl(priv, req);
968 break;
969 case WLAN_SUBCMD_FWT_LIST_ROUTE:
970 ret = wlan_fwt_list_route_ioctl(priv, req);
971 break;
972 }
973 break;
974
975 case WLAN_SETNONE_GETONEINT:
976 switch (wrq->u.param.value) {
977 case WLANGETREGION:
978 pdata = (int *)wrq->u.name;
979 *pdata = (int)adapter->regioncode;
980 break;
981 case WLAN_SUBCMD_FWT_CLEANUP: /* fwt_cleanup */
982 ret = wlan_fwt_cleanup_ioctl(priv, req);
983 break;
984
985 case WLAN_SUBCMD_FWT_TIME: /* fwt_time */
986 ret = wlan_fwt_time_ioctl(priv, req);
987 break;
988
989 case WLAN_SUBCMD_MESH_GET_TTL:
990 ret = wlan_mesh_get_ttl_ioctl(priv, req);
991 break;
992
993 case WLAN_SUBCMD_BT_GET_INVERT:
994 ret = wlan_bt_get_invert_ioctl(priv, req);
995 break ;
996
997 default:
998 ret = -EOPNOTSUPP;
999
1000 }
1001
1002 break;
1003
1004 case WLAN_SET_GET_SIXTEEN_INT:
1005 switch ((int)wrq->u.data.flags) {
1006 case WLAN_LED_GPIO_CTRL:
1007 {
1008 int i;
1009 int data[16];
1010
1011 struct cmd_ds_802_11_led_ctrl ctrl;
1012 struct mrvlietypes_ledgpio *gpio =
1013 (struct mrvlietypes_ledgpio *) ctrl.data;
1014
1015 memset(&ctrl, 0, sizeof(ctrl));
1016 if (wrq->u.data.length > MAX_LEDS * 2)
1017 return -ENOTSUPP;
1018 if ((wrq->u.data.length % 2) != 0)
1019 return -ENOTSUPP;
1020 if (wrq->u.data.length == 0) {
1021 ctrl.action =
1022 cpu_to_le16
1023 (cmd_act_get);
1024 } else {
1025 if (copy_from_user
1026 (data, wrq->u.data.pointer,
1027 sizeof(int) *
1028 wrq->u.data.length)) {
1029 lbs_deb_ioctl(
1030 "Copy from user failed\n");
1031 return -EFAULT;
1032 }
1033
1034 ctrl.action =
1035 cpu_to_le16
1036 (cmd_act_set);
1037 ctrl.numled = cpu_to_le16(0);
1038 gpio->header.type =
1039 cpu_to_le16(TLV_TYPE_LED_GPIO);
1040 gpio->header.len = wrq->u.data.length;
1041 for (i = 0; i < wrq->u.data.length;
1042 i += 2) {
1043 gpio->ledpin[i / 2].led =
1044 data[i];
1045 gpio->ledpin[i / 2].pin =
1046 data[i + 1];
1047 }
1048 }
1049 ret =
1050 libertas_prepare_and_send_command(priv,
1051 cmd_802_11_led_gpio_ctrl,
1052 0,
1053 cmd_option_waitforrsp,
1054 0, (void *)&ctrl);
1055 for (i = 0; i < gpio->header.len; i += 2) {
1056 data[i] = gpio->ledpin[i / 2].led;
1057 data[i + 1] = gpio->ledpin[i / 2].pin;
1058 }
1059 if (copy_to_user(wrq->u.data.pointer, data,
1060 sizeof(int) *
1061 gpio->header.len)) {
1062 lbs_deb_ioctl("Copy to user failed\n");
1063 return -EFAULT;
1064 }
1065
1066 wrq->u.data.length = gpio->header.len;
1067 }
1068 break;
1069 }
1070 break;
1071
1072 default:
1073 ret = -EINVAL;
1074 break;
1075 }
1076
1077 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
1078 return ret;
1079}
1080
1081
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 623ab4b16973..4a59306a3f05 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -181,7 +181,8 @@ u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] =
181 * @brief Get function for sysfs attribute anycast_mask 181 * @brief Get function for sysfs attribute anycast_mask
182 */ 182 */
183static ssize_t libertas_anycast_get(struct device * dev, 183static ssize_t libertas_anycast_get(struct device * dev,
184 struct device_attribute *attr, char * buf) { 184 struct device_attribute *attr, char * buf)
185{
185 struct cmd_ds_mesh_access mesh_access; 186 struct cmd_ds_mesh_access mesh_access;
186 187
187 memset(&mesh_access, 0, sizeof(mesh_access)); 188 memset(&mesh_access, 0, sizeof(mesh_access));
@@ -197,7 +198,8 @@ static ssize_t libertas_anycast_get(struct device * dev,
197 * @brief Set function for sysfs attribute anycast_mask 198 * @brief Set function for sysfs attribute anycast_mask
198 */ 199 */
199static ssize_t libertas_anycast_set(struct device * dev, 200static ssize_t libertas_anycast_set(struct device * dev,
200 struct device_attribute *attr, const char * buf, size_t count) { 201 struct device_attribute *attr, const char * buf, size_t count)
202{
201 struct cmd_ds_mesh_access mesh_access; 203 struct cmd_ds_mesh_access mesh_access;
202 uint32_t datum; 204 uint32_t datum;
203 205
@@ -799,7 +801,6 @@ wlan_private *libertas_add_card(void *card, struct device *dmdev)
799 dev->open = wlan_open; 801 dev->open = wlan_open;
800 dev->hard_start_xmit = wlan_pre_start_xmit; 802 dev->hard_start_xmit = wlan_pre_start_xmit;
801 dev->stop = wlan_close; 803 dev->stop = wlan_close;
802 dev->do_ioctl = libertas_do_ioctl;
803 dev->set_mac_address = wlan_set_mac_address; 804 dev->set_mac_address = wlan_set_mac_address;
804 dev->tx_timeout = wlan_tx_timeout; 805 dev->tx_timeout = wlan_tx_timeout;
805 dev->get_stats = wlan_get_stats; 806 dev->get_stats = wlan_get_stats;
@@ -918,7 +919,6 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev)
918 mesh_dev->open = mesh_open; 919 mesh_dev->open = mesh_open;
919 mesh_dev->hard_start_xmit = mesh_pre_start_xmit; 920 mesh_dev->hard_start_xmit = mesh_pre_start_xmit;
920 mesh_dev->stop = mesh_close; 921 mesh_dev->stop = mesh_close;
921 mesh_dev->do_ioctl = libertas_do_ioctl;
922 mesh_dev->get_stats = wlan_get_stats; 922 mesh_dev->get_stats = wlan_get_stats;
923 mesh_dev->set_mac_address = wlan_set_mac_address; 923 mesh_dev->set_mac_address = wlan_set_mac_address;
924 mesh_dev->ethtool_ops = &libertas_ethtool_ops; 924 mesh_dev->ethtool_ops = &libertas_ethtool_ops;
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 606af50fa09b..c3043dcb541e 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -215,38 +215,6 @@ done:
215} 215}
216 216
217/** 217/**
218 * @brief Post process the scan table after a new scan command has completed
219 *
220 * Inspect each entry of the scan table and try to find an entry that
221 * matches our current associated/joined network from the scan. If
222 * one is found, update the stored copy of the bssdescriptor for our
223 * current network.
224 *
225 * Debug dump the current scan table contents if compiled accordingly.
226 *
227 * @param priv A pointer to wlan_private structure
228 *
229 * @return void
230 */
231static void wlan_scan_process_results(wlan_private * priv)
232{
233 wlan_adapter *adapter = priv->adapter;
234 struct bss_descriptor * iter_bss;
235 int i = 0;
236
237 if (adapter->connect_status == libertas_connected)
238 return;
239
240 mutex_lock(&adapter->lock);
241 list_for_each_entry (iter_bss, &adapter->network_list, list) {
242 lbs_deb_scan("Scan:(%02d) " MAC_FMT ", RSSI[%03d], SSID[%s]\n",
243 i++, MAC_ARG(iter_bss->bssid), (s32) iter_bss->rssi,
244 escape_essid(iter_bss->ssid, iter_bss->ssid_len));
245 }
246 mutex_unlock(&adapter->lock);
247}
248
249/**
250 * @brief Create a channel list for the driver to scan based on region info 218 * @brief Create a channel list for the driver to scan based on region info
251 * 219 *
252 * Use the driver region/band information to construct a comprehensive list 220 * Use the driver region/band information to construct a comprehensive list
@@ -791,6 +759,10 @@ int wlan_scan_networks(wlan_private * priv,
791 u8 scancurrentchanonly; 759 u8 scancurrentchanonly;
792 int maxchanperscan; 760 int maxchanperscan;
793 int ret; 761 int ret;
762#ifdef CONFIG_LIBERTAS_DEBUG
763 struct bss_descriptor * iter_bss;
764 int i = 0;
765#endif
794 766
795 lbs_deb_enter(LBS_DEB_ASSOC); 767 lbs_deb_enter(LBS_DEB_ASSOC);
796 768
@@ -832,11 +804,16 @@ int wlan_scan_networks(wlan_private * priv,
832 puserscanin, 804 puserscanin,
833 full_scan); 805 full_scan);
834 806
835 /* Process the resulting scan table: 807#ifdef CONFIG_LIBERTAS_DEBUG
836 * - Remove any bad ssids 808 /* Dump the scan table */
837 * - Update our current BSS information from scan data 809 mutex_lock(&adapter->lock);
838 */ 810 list_for_each_entry (iter_bss, &adapter->network_list, list) {
839 wlan_scan_process_results(priv); 811 lbs_deb_scan("Scan:(%02d) " MAC_FMT ", RSSI[%03d], SSID[%s]\n",
812 i++, MAC_ARG(iter_bss->bssid), (s32) iter_bss->rssi,
813 escape_essid(iter_bss->ssid, iter_bss->ssid_len));
814 }
815 mutex_unlock(&adapter->lock);
816#endif
840 817
841 if (priv->adapter->connect_status == libertas_connected) { 818 if (priv->adapter->connect_status == libertas_connected) {
842 netif_carrier_on(priv->dev); 819 netif_carrier_on(priv->dev);
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 8939251a2f4c..f42b796b5e47 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -913,148 +913,6 @@ out:
913 return 0; 913 return 0;
914} 914}
915 915
916/*
917 * iwpriv settable callbacks
918 */
919
920static const iw_handler wlan_private_handler[] = {
921 NULL, /* SIOCIWFIRSTPRIV */
922};
923
924static const struct iw_priv_args wlan_private_args[] = {
925 /*
926 * { cmd, set_args, get_args, name }
927 */
928 /* Using iwpriv sub-command feature */
929 {
930 WLAN_SETONEINT_GETNONE, /* IOCTL: 24 */
931 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
932 IW_PRIV_TYPE_NONE,
933 ""},
934 {
935 WLANSETREGION,
936 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
937 IW_PRIV_TYPE_NONE,
938 "setregioncode"},
939 {
940 WLAN_SUBCMD_MESH_SET_TTL,
941 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
942 IW_PRIV_TYPE_NONE,
943 "mesh_set_ttl"},
944 {
945 WLAN_SETNONE_GETONEINT,
946 IW_PRIV_TYPE_NONE,
947 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
948 ""},
949 {
950 WLANGETREGION,
951 IW_PRIV_TYPE_NONE,
952 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
953 "getregioncode"},
954 {
955 WLAN_SUBCMD_FWT_CLEANUP,
956 IW_PRIV_TYPE_NONE,
957 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
958 "fwt_cleanup"},
959 {
960 WLAN_SUBCMD_FWT_TIME,
961 IW_PRIV_TYPE_NONE,
962 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
963 "fwt_time"},
964 {
965 WLAN_SUBCMD_MESH_GET_TTL,
966 IW_PRIV_TYPE_NONE,
967 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
968 "mesh_get_ttl"},
969 {
970 WLAN_SETNONE_GETNONE,
971 IW_PRIV_TYPE_NONE,
972 IW_PRIV_TYPE_NONE,
973 ""},
974 {
975 WLAN_SUBCMD_FWT_RESET,
976 IW_PRIV_TYPE_NONE,
977 IW_PRIV_TYPE_NONE,
978 "fwt_reset"},
979 {
980 WLAN_SUBCMD_BT_RESET,
981 IW_PRIV_TYPE_NONE,
982 IW_PRIV_TYPE_NONE,
983 "bt_reset"},
984 {
985 WLAN_SET128CHAR_GET128CHAR,
986 IW_PRIV_TYPE_CHAR | 128,
987 IW_PRIV_TYPE_CHAR | 128,
988 ""},
989 /* BT Management */
990 {
991 WLAN_SUBCMD_BT_ADD,
992 IW_PRIV_TYPE_CHAR | 128,
993 IW_PRIV_TYPE_CHAR | 128,
994 "bt_add"},
995 {
996 WLAN_SUBCMD_BT_DEL,
997 IW_PRIV_TYPE_CHAR | 128,
998 IW_PRIV_TYPE_CHAR | 128,
999 "bt_del"},
1000 {
1001 WLAN_SUBCMD_BT_LIST,
1002 IW_PRIV_TYPE_CHAR | 128,
1003 IW_PRIV_TYPE_CHAR | 128,
1004 "bt_list"},
1005 {
1006 WLAN_SUBCMD_BT_SET_INVERT,
1007 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1008 IW_PRIV_TYPE_NONE,
1009 "bt_set_invert"},
1010 {
1011 WLAN_SUBCMD_BT_GET_INVERT,
1012 IW_PRIV_TYPE_NONE,
1013 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1014 "bt_get_invert"},
1015 /* FWT Management */
1016 {
1017 WLAN_SUBCMD_FWT_ADD,
1018 IW_PRIV_TYPE_CHAR | 128,
1019 IW_PRIV_TYPE_CHAR | 128,
1020 "fwt_add"},
1021 {
1022 WLAN_SUBCMD_FWT_DEL,
1023 IW_PRIV_TYPE_CHAR | 128,
1024 IW_PRIV_TYPE_CHAR | 128,
1025 "fwt_del"},
1026 {
1027 WLAN_SUBCMD_FWT_LOOKUP,
1028 IW_PRIV_TYPE_CHAR | 128,
1029 IW_PRIV_TYPE_CHAR | 128,
1030 "fwt_lookup"},
1031 {
1032 WLAN_SUBCMD_FWT_LIST_NEIGHBOR,
1033 IW_PRIV_TYPE_CHAR | 128,
1034 IW_PRIV_TYPE_CHAR | 128,
1035 "fwt_list_neigh"},
1036 {
1037 WLAN_SUBCMD_FWT_LIST,
1038 IW_PRIV_TYPE_CHAR | 128,
1039 IW_PRIV_TYPE_CHAR | 128,
1040 "fwt_list"},
1041 {
1042 WLAN_SUBCMD_FWT_LIST_ROUTE,
1043 IW_PRIV_TYPE_CHAR | 128,
1044 IW_PRIV_TYPE_CHAR | 128,
1045 "fwt_list_route"},
1046 {
1047 WLAN_SET_GET_SIXTEEN_INT,
1048 IW_PRIV_TYPE_INT | 16,
1049 IW_PRIV_TYPE_INT | 16,
1050 ""},
1051 {
1052 WLAN_LED_GPIO_CTRL,
1053 IW_PRIV_TYPE_INT | 16,
1054 IW_PRIV_TYPE_INT | 16,
1055 "ledgpio"},
1056};
1057
1058static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) 916static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1059{ 917{
1060 enum { 918 enum {
@@ -2444,22 +2302,12 @@ static const iw_handler mesh_wlan_handler[] = {
2444}; 2302};
2445struct iw_handler_def libertas_handler_def = { 2303struct iw_handler_def libertas_handler_def = {
2446 .num_standard = sizeof(wlan_handler) / sizeof(iw_handler), 2304 .num_standard = sizeof(wlan_handler) / sizeof(iw_handler),
2447 .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler),
2448 .num_private_args = sizeof(wlan_private_args) /
2449 sizeof(struct iw_priv_args),
2450 .standard = (iw_handler *) wlan_handler, 2305 .standard = (iw_handler *) wlan_handler,
2451 .private = (iw_handler *) wlan_private_handler,
2452 .private_args = (struct iw_priv_args *)wlan_private_args,
2453 .get_wireless_stats = wlan_get_wireless_stats, 2306 .get_wireless_stats = wlan_get_wireless_stats,
2454}; 2307};
2455 2308
2456struct iw_handler_def mesh_handler_def = { 2309struct iw_handler_def mesh_handler_def = {
2457 .num_standard = sizeof(mesh_wlan_handler) / sizeof(iw_handler), 2310 .num_standard = sizeof(mesh_wlan_handler) / sizeof(iw_handler),
2458 .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler),
2459 .num_private_args = sizeof(wlan_private_args) /
2460 sizeof(struct iw_priv_args),
2461 .standard = (iw_handler *) mesh_wlan_handler, 2311 .standard = (iw_handler *) mesh_wlan_handler,
2462 .private = (iw_handler *) wlan_private_handler,
2463 .private_args = (struct iw_priv_args *)wlan_private_args,
2464 .get_wireless_stats = wlan_get_wireless_stats, 2312 .get_wireless_stats = wlan_get_wireless_stats,
2465}; 2313};
diff --git a/drivers/net/wireless/libertas/wext.h b/drivers/net/wireless/libertas/wext.h
index d555056b25b7..3d5196c9553a 100644
--- a/drivers/net/wireless/libertas/wext.h
+++ b/drivers/net/wireless/libertas/wext.h
@@ -7,45 +7,6 @@
7#define SUBCMD_OFFSET 4 7#define SUBCMD_OFFSET 4
8#define SUBCMD_DATA(x) *((int *)(x->u.name + SUBCMD_OFFSET)) 8#define SUBCMD_DATA(x) *((int *)(x->u.name + SUBCMD_OFFSET))
9 9
10/** PRIVATE CMD ID */
11#define WLANIOCTL SIOCIWFIRSTPRIV
12
13#define WLAN_SETNONE_GETNONE (WLANIOCTL + 8)
14#define WLAN_SUBCMD_BT_RESET 13
15#define WLAN_SUBCMD_FWT_RESET 14
16
17#define WLAN_SETNONE_GETONEINT (WLANIOCTL + 15)
18#define WLANGETREGION 1
19
20#define WLAN_SUBCMD_FWT_CLEANUP 15
21#define WLAN_SUBCMD_FWT_TIME 16
22#define WLAN_SUBCMD_MESH_GET_TTL 17
23#define WLAN_SUBCMD_BT_GET_INVERT 18
24
25#define WLAN_SETONEINT_GETNONE (WLANIOCTL + 24)
26#define WLANSETREGION 8
27#define WLAN_SUBCMD_MESH_SET_TTL 18
28#define WLAN_SUBCMD_BT_SET_INVERT 19
29
30#define WLAN_SET128CHAR_GET128CHAR (WLANIOCTL + 25)
31#define WLAN_SUBCMD_BT_ADD 18
32#define WLAN_SUBCMD_BT_DEL 19
33#define WLAN_SUBCMD_BT_LIST 20
34#define WLAN_SUBCMD_FWT_ADD 21
35#define WLAN_SUBCMD_FWT_DEL 22
36#define WLAN_SUBCMD_FWT_LOOKUP 23
37#define WLAN_SUBCMD_FWT_LIST_NEIGHBOR 24
38#define WLAN_SUBCMD_FWT_LIST 25
39#define WLAN_SUBCMD_FWT_LIST_ROUTE 26
40
41#define WLAN_SET_GET_SIXTEEN_INT (WLANIOCTL + 29)
42#define WLAN_LED_GPIO_CTRL 5
43
44#define WLAN_LINKMODE_802_3 0
45#define WLAN_LINKMODE_802_11 2
46#define WLAN_RADIOMODE_NONE 0
47#define WLAN_RADIOMODE_RADIOTAP 2
48
49/** wlan_ioctl_regrdwr */ 10/** wlan_ioctl_regrdwr */
50struct wlan_ioctl_regrdwr { 11struct wlan_ioctl_regrdwr {
51 /** Which register to access */ 12 /** Which register to access */
@@ -57,9 +18,13 @@ struct wlan_ioctl_regrdwr {
57 u32 value; 18 u32 value;
58}; 19};
59 20
21#define WLAN_LINKMODE_802_3 0
22#define WLAN_LINKMODE_802_11 2
23#define WLAN_RADIOMODE_NONE 0
24#define WLAN_RADIOMODE_RADIOTAP 2
25
60extern struct iw_handler_def libertas_handler_def; 26extern struct iw_handler_def libertas_handler_def;
61extern struct iw_handler_def mesh_handler_def; 27extern struct iw_handler_def mesh_handler_def;
62int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int i);
63int wlan_radio_ioctl(wlan_private * priv, u8 option); 28int wlan_radio_ioctl(wlan_private * priv, u8 option);
64 29
65#endif /* _WLAN_WEXT_H_ */ 30#endif /* _WLAN_WEXT_H_ */