1
2
3
4
5#include <linux/kernel.h>
6#include <linux/if_arp.h>
7#include <linux/wireless.h>
8#include <linux/ieee80211.h>
9#include <net/iw_handler.h>
10#include <net/cfg80211.h>
11
12#include "hermes.h"
13#include "hermes_rid.h"
14#include "orinoco.h"
15
16#include "hw.h"
17#include "mic.h"
18#include "scan.h"
19#include "main.h"
20
21#include "wext.h"
22
23#define MAX_RID_LEN 1024
24
25
26
27static int orinoco_set_key(struct orinoco_private *priv, int index,
28 enum orinoco_alg alg, const u8 *key, int key_len,
29 const u8 *seq, int seq_len)
30{
31 kzfree(priv->keys[index].key);
32 kzfree(priv->keys[index].seq);
33
34 if (key_len) {
35 priv->keys[index].key = kzalloc(key_len, GFP_KERNEL);
36 if (!priv->keys[index].key)
37 goto nomem;
38 } else
39 priv->keys[index].key = NULL;
40
41 if (seq_len) {
42 priv->keys[index].seq = kzalloc(seq_len, GFP_KERNEL);
43 if (!priv->keys[index].seq)
44 goto free_key;
45 } else
46 priv->keys[index].seq = NULL;
47
48 priv->keys[index].key_len = key_len;
49 priv->keys[index].seq_len = seq_len;
50
51 if (key_len)
52 memcpy(priv->keys[index].key, key, key_len);
53 if (seq_len)
54 memcpy(priv->keys[index].seq, seq, seq_len);
55
56 switch (alg) {
57 case ORINOCO_ALG_TKIP:
58 priv->keys[index].cipher = WLAN_CIPHER_SUITE_TKIP;
59 break;
60
61 case ORINOCO_ALG_WEP:
62 priv->keys[index].cipher = (key_len > SMALL_KEY_SIZE) ?
63 WLAN_CIPHER_SUITE_WEP104 : WLAN_CIPHER_SUITE_WEP40;
64 break;
65
66 case ORINOCO_ALG_NONE:
67 default:
68 priv->keys[index].cipher = 0;
69 break;
70 }
71
72 return 0;
73
74free_key:
75 kfree(priv->keys[index].key);
76 priv->keys[index].key = NULL;
77
78nomem:
79 priv->keys[index].key_len = 0;
80 priv->keys[index].seq_len = 0;
81 priv->keys[index].cipher = 0;
82
83 return -ENOMEM;
84}
85
86static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
87{
88 struct orinoco_private *priv = ndev_priv(dev);
89 hermes_t *hw = &priv->hw;
90 struct iw_statistics *wstats = &priv->wstats;
91 int err;
92 unsigned long flags;
93
94 if (!netif_device_present(dev)) {
95 printk(KERN_WARNING "%s: get_wireless_stats() called while device not present\n",
96 dev->name);
97 return NULL;
98 }
99
100
101
102 if (orinoco_lock(priv, &flags) != 0)
103 return wstats;
104
105
106
107
108
109
110
111
112
113
114 hermes_inquire(hw, HERMES_INQ_TALLIES);
115
116 if (priv->iw_mode == NL80211_IFTYPE_ADHOC) {
117 memset(&wstats->qual, 0, sizeof(wstats->qual));
118
119
120 if (SPY_NUMBER(priv)) {
121 wstats->qual.qual = priv->spy_data.spy_stat[0].qual;
122 wstats->qual.level = priv->spy_data.spy_stat[0].level;
123 wstats->qual.noise = priv->spy_data.spy_stat[0].noise;
124 wstats->qual.updated =
125 priv->spy_data.spy_stat[0].updated;
126 }
127 } else {
128 struct {
129 __le16 qual, signal, noise, unused;
130 } __attribute__ ((packed)) cq;
131
132 err = HERMES_READ_RECORD(hw, USER_BAP,
133 HERMES_RID_COMMSQUALITY, &cq);
134
135 if (!err) {
136 wstats->qual.qual = (int)le16_to_cpu(cq.qual);
137 wstats->qual.level = (int)le16_to_cpu(cq.signal) - 0x95;
138 wstats->qual.noise = (int)le16_to_cpu(cq.noise) - 0x95;
139 wstats->qual.updated =
140 IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
141 }
142 }
143
144 orinoco_unlock(priv, &flags);
145 return wstats;
146}
147
148
149
150
151
152static int orinoco_ioctl_setwap(struct net_device *dev,
153 struct iw_request_info *info,
154 struct sockaddr *ap_addr,
155 char *extra)
156{
157 struct orinoco_private *priv = ndev_priv(dev);
158 int err = -EINPROGRESS;
159 unsigned long flags;
160 static const u8 off_addr[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
161 static const u8 any_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
162
163 if (orinoco_lock(priv, &flags) != 0)
164 return -EBUSY;
165
166
167 if (memcmp(&ap_addr->sa_data, off_addr, ETH_ALEN) == 0 ||
168 memcmp(&ap_addr->sa_data, any_addr, ETH_ALEN) == 0) {
169 priv->bssid_fixed = 0;
170 memset(priv->desired_bssid, 0, ETH_ALEN);
171
172
173 if (ap_addr->sa_data[0] == 0) {
174 __orinoco_hw_set_wap(priv);
175 err = 0;
176 }
177 goto out;
178 }
179
180 if (priv->firmware_type == FIRMWARE_TYPE_AGERE) {
181 printk(KERN_WARNING "%s: Lucent/Agere firmware doesn't "
182 "support manual roaming\n",
183 dev->name);
184 err = -EOPNOTSUPP;
185 goto out;
186 }
187
188 if (priv->iw_mode != NL80211_IFTYPE_STATION) {
189 printk(KERN_WARNING "%s: Manual roaming supported only in "
190 "managed mode\n", dev->name);
191 err = -EOPNOTSUPP;
192 goto out;
193 }
194
195
196 if (priv->firmware_type == FIRMWARE_TYPE_INTERSIL &&
197 strlen(priv->desired_essid) == 0) {
198 printk(KERN_WARNING "%s: Desired ESSID must be set for "
199 "manual roaming\n", dev->name);
200 err = -EOPNOTSUPP;
201 goto out;
202 }
203
204
205 priv->bssid_fixed = 1;
206 memcpy(priv->desired_bssid, &ap_addr->sa_data, ETH_ALEN);
207
208 out:
209 orinoco_unlock(priv, &flags);
210 return err;
211}
212
213static int orinoco_ioctl_getwap(struct net_device *dev,
214 struct iw_request_info *info,
215 struct sockaddr *ap_addr,
216 char *extra)
217{
218 struct orinoco_private *priv = ndev_priv(dev);
219
220 int err = 0;
221 unsigned long flags;
222
223 if (orinoco_lock(priv, &flags) != 0)
224 return -EBUSY;
225
226 ap_addr->sa_family = ARPHRD_ETHER;
227 err = orinoco_hw_get_current_bssid(priv, ap_addr->sa_data);
228
229 orinoco_unlock(priv, &flags);
230
231 return err;
232}
233
234static int orinoco_ioctl_setiwencode(struct net_device *dev,
235 struct iw_request_info *info,
236 struct iw_point *erq,
237 char *keybuf)
238{
239 struct orinoco_private *priv = ndev_priv(dev);
240 int index = (erq->flags & IW_ENCODE_INDEX) - 1;
241 int setindex = priv->tx_key;
242 enum orinoco_alg encode_alg = priv->encode_alg;
243 int restricted = priv->wep_restrict;
244 int err = -EINPROGRESS;
245 unsigned long flags;
246
247 if (!priv->has_wep)
248 return -EOPNOTSUPP;
249
250 if (erq->pointer) {
251
252 if (erq->length > LARGE_KEY_SIZE)
253 return -E2BIG;
254
255 if ((erq->length > SMALL_KEY_SIZE) && !priv->has_big_wep)
256 return -E2BIG;
257 }
258
259 if (orinoco_lock(priv, &flags) != 0)
260 return -EBUSY;
261
262
263 if ((priv->has_wpa) && (priv->encode_alg == ORINOCO_ALG_TKIP))
264 (void) orinoco_clear_tkip_key(priv, setindex);
265
266 if (erq->length > 0) {
267 if ((index < 0) || (index >= ORINOCO_MAX_KEYS))
268 index = priv->tx_key;
269
270
271 if (encode_alg != ORINOCO_ALG_WEP) {
272 setindex = index;
273 encode_alg = ORINOCO_ALG_WEP;
274 }
275 } else {
276
277
278
279 if ((index < 0) || (index >= ORINOCO_MAX_KEYS)) {
280 if ((index != -1) || (erq->flags == 0)) {
281 err = -EINVAL;
282 goto out;
283 }
284 } else {
285
286 if (priv->keys[index].key_len == 0) {
287 err = -EINVAL;
288 goto out;
289 }
290 setindex = index;
291 }
292 }
293
294 if (erq->flags & IW_ENCODE_DISABLED)
295 encode_alg = ORINOCO_ALG_NONE;
296 if (erq->flags & IW_ENCODE_OPEN)
297 restricted = 0;
298 if (erq->flags & IW_ENCODE_RESTRICTED)
299 restricted = 1;
300
301 if (erq->pointer && erq->length > 0) {
302 err = orinoco_set_key(priv, index, ORINOCO_ALG_WEP, keybuf,
303 erq->length, NULL, 0);
304 }
305 priv->tx_key = setindex;
306
307
308 if ((priv->encode_alg == encode_alg) &&
309 (priv->wep_restrict == restricted) &&
310 netif_carrier_ok(dev)) {
311 err = __orinoco_hw_setup_wepkeys(priv);
312
313 goto out;
314 }
315
316 priv->encode_alg = encode_alg;
317 priv->wep_restrict = restricted;
318
319 out:
320 orinoco_unlock(priv, &flags);
321
322 return err;
323}
324
325static int orinoco_ioctl_getiwencode(struct net_device *dev,
326 struct iw_request_info *info,
327 struct iw_point *erq,
328 char *keybuf)
329{
330 struct orinoco_private *priv = ndev_priv(dev);
331 int index = (erq->flags & IW_ENCODE_INDEX) - 1;
332 unsigned long flags;
333
334 if (!priv->has_wep)
335 return -EOPNOTSUPP;
336
337 if (orinoco_lock(priv, &flags) != 0)
338 return -EBUSY;
339
340 if ((index < 0) || (index >= ORINOCO_MAX_KEYS))
341 index = priv->tx_key;
342
343 erq->flags = 0;
344 if (!priv->encode_alg)
345 erq->flags |= IW_ENCODE_DISABLED;
346 erq->flags |= index + 1;
347
348 if (priv->wep_restrict)
349 erq->flags |= IW_ENCODE_RESTRICTED;
350 else
351 erq->flags |= IW_ENCODE_OPEN;
352
353 erq->length = priv->keys[index].key_len;
354
355 memcpy(keybuf, priv->keys[index].key, erq->length);
356
357 orinoco_unlock(priv, &flags);
358 return 0;
359}
360
361static int orinoco_ioctl_setessid(struct net_device *dev,
362 struct iw_request_info *info,
363 struct iw_point *erq,
364 char *essidbuf)
365{
366 struct orinoco_private *priv = ndev_priv(dev);
367 unsigned long flags;
368
369
370
371
372
373
374 if (erq->length > IW_ESSID_MAX_SIZE)
375 return -E2BIG;
376
377 if (orinoco_lock(priv, &flags) != 0)
378 return -EBUSY;
379
380
381 memset(priv->desired_essid, 0, sizeof(priv->desired_essid));
382
383
384 if (erq->flags)
385 memcpy(priv->desired_essid, essidbuf, erq->length);
386
387 orinoco_unlock(priv, &flags);
388
389 return -EINPROGRESS;
390}
391
392static int orinoco_ioctl_getessid(struct net_device *dev,
393 struct iw_request_info *info,
394 struct iw_point *erq,
395 char *essidbuf)
396{
397 struct orinoco_private *priv = ndev_priv(dev);
398 int active;
399 int err = 0;
400 unsigned long flags;
401
402 if (netif_running(dev)) {
403 err = orinoco_hw_get_essid(priv, &active, essidbuf);
404 if (err < 0)
405 return err;
406 erq->length = err;
407 } else {
408 if (orinoco_lock(priv, &flags) != 0)
409 return -EBUSY;
410 memcpy(essidbuf, priv->desired_essid, IW_ESSID_MAX_SIZE);
411 erq->length = strlen(priv->desired_essid);
412 orinoco_unlock(priv, &flags);
413 }
414
415 erq->flags = 1;
416
417 return 0;
418}
419
420static int orinoco_ioctl_setfreq(struct net_device *dev,
421 struct iw_request_info *info,
422 struct iw_freq *frq,
423 char *extra)
424{
425 struct orinoco_private *priv = ndev_priv(dev);
426 int chan = -1;
427 unsigned long flags;
428 int err = -EINPROGRESS;
429
430
431 if (priv->iw_mode == NL80211_IFTYPE_STATION)
432 return -EBUSY;
433
434 if ((frq->e == 0) && (frq->m <= 1000)) {
435
436 chan = frq->m;
437 } else {
438
439 int denom = 1;
440 int i;
441
442
443 for (i = 0; i < (6 - frq->e); i++)
444 denom *= 10;
445
446 chan = ieee80211_freq_to_dsss_chan(frq->m / denom);
447 }
448
449 if ((chan < 1) || (chan > NUM_CHANNELS) ||
450 !(priv->channel_mask & (1 << (chan-1))))
451 return -EINVAL;
452
453 if (orinoco_lock(priv, &flags) != 0)
454 return -EBUSY;
455
456 priv->channel = chan;
457 if (priv->iw_mode == NL80211_IFTYPE_MONITOR) {
458
459 hermes_t *hw = &priv->hw;
460 err = hermes_docmd_wait(hw, HERMES_CMD_TEST |
461 HERMES_TEST_SET_CHANNEL,
462 chan, NULL);
463 }
464 orinoco_unlock(priv, &flags);
465
466 return err;
467}
468
469static int orinoco_ioctl_getfreq(struct net_device *dev,
470 struct iw_request_info *info,
471 struct iw_freq *frq,
472 char *extra)
473{
474 struct orinoco_private *priv = ndev_priv(dev);
475 int tmp;
476
477
478 tmp = orinoco_hw_get_freq(priv);
479 if (tmp < 0)
480 return tmp;
481
482 frq->m = tmp * 100000;
483 frq->e = 1;
484
485 return 0;
486}
487
488static int orinoco_ioctl_getsens(struct net_device *dev,
489 struct iw_request_info *info,
490 struct iw_param *srq,
491 char *extra)
492{
493 struct orinoco_private *priv = ndev_priv(dev);
494 hermes_t *hw = &priv->hw;
495 u16 val;
496 int err;
497 unsigned long flags;
498
499 if (!priv->has_sensitivity)
500 return -EOPNOTSUPP;
501
502 if (orinoco_lock(priv, &flags) != 0)
503 return -EBUSY;
504 err = hermes_read_wordrec(hw, USER_BAP,
505 HERMES_RID_CNFSYSTEMSCALE, &val);
506 orinoco_unlock(priv, &flags);
507
508 if (err)
509 return err;
510
511 srq->value = val;
512 srq->fixed = 0;
513
514 return 0;
515}
516
517static int orinoco_ioctl_setsens(struct net_device *dev,
518 struct iw_request_info *info,
519 struct iw_param *srq,
520 char *extra)
521{
522 struct orinoco_private *priv = ndev_priv(dev);
523 int val = srq->value;
524 unsigned long flags;
525
526 if (!priv->has_sensitivity)
527 return -EOPNOTSUPP;
528
529 if ((val < 1) || (val > 3))
530 return -EINVAL;
531
532 if (orinoco_lock(priv, &flags) != 0)
533 return -EBUSY;
534 priv->ap_density = val;
535 orinoco_unlock(priv, &flags);
536
537 return -EINPROGRESS;
538}
539
540static int orinoco_ioctl_setrts(struct net_device *dev,
541 struct iw_request_info *info,
542 struct iw_param *rrq,
543 char *extra)
544{
545 struct orinoco_private *priv = ndev_priv(dev);
546 int val = rrq->value;
547 unsigned long flags;
548
549 if (rrq->disabled)
550 val = 2347;
551
552 if ((val < 0) || (val > 2347))
553 return -EINVAL;
554
555 if (orinoco_lock(priv, &flags) != 0)
556 return -EBUSY;
557
558 priv->rts_thresh = val;
559 orinoco_unlock(priv, &flags);
560
561 return -EINPROGRESS;
562}
563
564static int orinoco_ioctl_getrts(struct net_device *dev,
565 struct iw_request_info *info,
566 struct iw_param *rrq,
567 char *extra)
568{
569 struct orinoco_private *priv = ndev_priv(dev);
570
571 rrq->value = priv->rts_thresh;
572 rrq->disabled = (rrq->value == 2347);
573 rrq->fixed = 1;
574
575 return 0;
576}
577
578static int orinoco_ioctl_setfrag(struct net_device *dev,
579 struct iw_request_info *info,
580 struct iw_param *frq,
581 char *extra)
582{
583 struct orinoco_private *priv = ndev_priv(dev);
584 int err = -EINPROGRESS;
585 unsigned long flags;
586
587 if (orinoco_lock(priv, &flags) != 0)
588 return -EBUSY;
589
590 if (priv->has_mwo) {
591 if (frq->disabled)
592 priv->mwo_robust = 0;
593 else {
594 if (frq->fixed)
595 printk(KERN_WARNING "%s: Fixed fragmentation "
596 "is not supported on this firmware. "
597 "Using MWO robust instead.\n",
598 dev->name);
599 priv->mwo_robust = 1;
600 }
601 } else {
602 if (frq->disabled)
603 priv->frag_thresh = 2346;
604 else {
605 if ((frq->value < 256) || (frq->value > 2346))
606 err = -EINVAL;
607 else
608
609 priv->frag_thresh = frq->value & ~0x1;
610 }
611 }
612
613 orinoco_unlock(priv, &flags);
614
615 return err;
616}
617
618static int orinoco_ioctl_getfrag(struct net_device *dev,
619 struct iw_request_info *info,
620 struct iw_param *frq,
621 char *extra)
622{
623 struct orinoco_private *priv = ndev_priv(dev);
624 hermes_t *hw = &priv->hw;
625 int err;
626 u16 val;
627 unsigned long flags;
628
629 if (orinoco_lock(priv, &flags) != 0)
630 return -EBUSY;
631
632 if (priv->has_mwo) {
633 err = hermes_read_wordrec(hw, USER_BAP,
634 HERMES_RID_CNFMWOROBUST_AGERE,
635 &val);
636 if (err)
637 val = 0;
638
639 frq->value = val ? 2347 : 0;
640 frq->disabled = !val;
641 frq->fixed = 0;
642 } else {
643 err = hermes_read_wordrec(hw, USER_BAP,
644 HERMES_RID_CNFFRAGMENTATIONTHRESHOLD,
645 &val);
646 if (err)
647 val = 0;
648
649 frq->value = val;
650 frq->disabled = (val >= 2346);
651 frq->fixed = 1;
652 }
653
654 orinoco_unlock(priv, &flags);
655
656 return err;
657}
658
659static int orinoco_ioctl_setrate(struct net_device *dev,
660 struct iw_request_info *info,
661 struct iw_param *rrq,
662 char *extra)
663{
664 struct orinoco_private *priv = ndev_priv(dev);
665 int ratemode;
666 int bitrate;
667 unsigned long flags;
668
669
670
671
672 if (rrq->value == -1)
673 bitrate = 110;
674 else {
675 if (rrq->value % 100000)
676 return -EINVAL;
677 bitrate = rrq->value / 100000;
678 }
679
680 ratemode = orinoco_get_bitratemode(bitrate, !rrq->fixed);
681
682 if (ratemode == -1)
683 return -EINVAL;
684
685 if (orinoco_lock(priv, &flags) != 0)
686 return -EBUSY;
687 priv->bitratemode = ratemode;
688 orinoco_unlock(priv, &flags);
689
690 return -EINPROGRESS;
691}
692
693static int orinoco_ioctl_getrate(struct net_device *dev,
694 struct iw_request_info *info,
695 struct iw_param *rrq,
696 char *extra)
697{
698 struct orinoco_private *priv = ndev_priv(dev);
699 int err = 0;
700 int bitrate, automatic;
701 unsigned long flags;
702
703 if (orinoco_lock(priv, &flags) != 0)
704 return -EBUSY;
705
706 orinoco_get_ratemode_cfg(priv->bitratemode, &bitrate, &automatic);
707
708
709
710 if (netif_running(dev))
711 err = orinoco_hw_get_act_bitrate(priv, &bitrate);
712
713 orinoco_unlock(priv, &flags);
714
715 rrq->value = bitrate;
716 rrq->fixed = !automatic;
717 rrq->disabled = 0;
718
719 return err;
720}
721
722static int orinoco_ioctl_setpower(struct net_device *dev,
723 struct iw_request_info *info,
724 struct iw_param *prq,
725 char *extra)
726{
727 struct orinoco_private *priv = ndev_priv(dev);
728 int err = -EINPROGRESS;
729 unsigned long flags;
730
731 if (orinoco_lock(priv, &flags) != 0)
732 return -EBUSY;
733
734 if (prq->disabled) {
735 priv->pm_on = 0;
736 } else {
737 switch (prq->flags & IW_POWER_MODE) {
738 case IW_POWER_UNICAST_R:
739 priv->pm_mcast = 0;
740 priv->pm_on = 1;
741 break;
742 case IW_POWER_ALL_R:
743 priv->pm_mcast = 1;
744 priv->pm_on = 1;
745 break;
746 case IW_POWER_ON:
747
748 break;
749 default:
750 err = -EINVAL;
751 goto out;
752 }
753
754 if (prq->flags & IW_POWER_TIMEOUT) {
755 priv->pm_on = 1;
756 priv->pm_timeout = prq->value / 1000;
757 }
758 if (prq->flags & IW_POWER_PERIOD) {
759 priv->pm_on = 1;
760 priv->pm_period = prq->value / 1000;
761 }
762
763
764 if (!priv->pm_on) {
765 err = -EINVAL;
766 goto out;
767 }
768 }
769
770 out:
771 orinoco_unlock(priv, &flags);
772
773 return err;
774}
775
776static int orinoco_ioctl_getpower(struct net_device *dev,
777 struct iw_request_info *info,
778 struct iw_param *prq,
779 char *extra)
780{
781 struct orinoco_private *priv = ndev_priv(dev);
782 hermes_t *hw = &priv->hw;
783 int err = 0;
784 u16 enable, period, timeout, mcast;
785 unsigned long flags;
786
787 if (orinoco_lock(priv, &flags) != 0)
788 return -EBUSY;
789
790 err = hermes_read_wordrec(hw, USER_BAP,
791 HERMES_RID_CNFPMENABLED, &enable);
792 if (err)
793 goto out;
794
795 err = hermes_read_wordrec(hw, USER_BAP,
796 HERMES_RID_CNFMAXSLEEPDURATION, &period);
797 if (err)
798 goto out;
799
800 err = hermes_read_wordrec(hw, USER_BAP,
801 HERMES_RID_CNFPMHOLDOVERDURATION, &timeout);
802 if (err)
803 goto out;
804
805 err = hermes_read_wordrec(hw, USER_BAP,
806 HERMES_RID_CNFMULTICASTRECEIVE, &mcast);
807 if (err)
808 goto out;
809
810 prq->disabled = !enable;
811
812 if ((prq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
813 prq->flags = IW_POWER_TIMEOUT;
814 prq->value = timeout * 1000;
815 } else {
816 prq->flags = IW_POWER_PERIOD;
817 prq->value = period * 1000;
818 }
819 if (mcast)
820 prq->flags |= IW_POWER_ALL_R;
821 else
822 prq->flags |= IW_POWER_UNICAST_R;
823
824 out:
825 orinoco_unlock(priv, &flags);
826
827 return err;
828}
829
830static int orinoco_ioctl_set_encodeext(struct net_device *dev,
831 struct iw_request_info *info,
832 union iwreq_data *wrqu,
833 char *extra)
834{
835 struct orinoco_private *priv = ndev_priv(dev);
836 struct iw_point *encoding = &wrqu->encoding;
837 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
838 int idx, alg = ext->alg, set_key = 1;
839 unsigned long flags;
840 int err = -EINVAL;
841
842 if (orinoco_lock(priv, &flags) != 0)
843 return -EBUSY;
844
845
846 idx = encoding->flags & IW_ENCODE_INDEX;
847 if (idx) {
848 if ((idx < 1) || (idx > 4))
849 goto out;
850 idx--;
851 } else
852 idx = priv->tx_key;
853
854 if (encoding->flags & IW_ENCODE_DISABLED)
855 alg = IW_ENCODE_ALG_NONE;
856
857 if (priv->has_wpa && (alg != IW_ENCODE_ALG_TKIP)) {
858
859 (void) orinoco_clear_tkip_key(priv, priv->tx_key);
860 }
861
862 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
863 priv->tx_key = idx;
864 set_key = ((alg == IW_ENCODE_ALG_TKIP) ||
865 (ext->key_len > 0)) ? 1 : 0;
866 }
867
868 if (set_key) {
869
870 switch (alg) {
871 case IW_ENCODE_ALG_NONE:
872 priv->encode_alg = ORINOCO_ALG_NONE;
873 err = orinoco_set_key(priv, idx, ORINOCO_ALG_NONE,
874 NULL, 0, NULL, 0);
875 break;
876
877 case IW_ENCODE_ALG_WEP:
878 if (ext->key_len <= 0)
879 goto out;
880
881 priv->encode_alg = ORINOCO_ALG_WEP;
882 err = orinoco_set_key(priv, idx, ORINOCO_ALG_WEP,
883 ext->key, ext->key_len, NULL, 0);
884 break;
885
886 case IW_ENCODE_ALG_TKIP:
887 {
888 u8 *tkip_iv = NULL;
889
890 if (!priv->has_wpa ||
891 (ext->key_len > sizeof(struct orinoco_tkip_key)))
892 goto out;
893
894 priv->encode_alg = ORINOCO_ALG_TKIP;
895
896 if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID)
897 tkip_iv = &ext->rx_seq[0];
898
899 err = orinoco_set_key(priv, idx, ORINOCO_ALG_TKIP,
900 ext->key, ext->key_len, tkip_iv,
901 ORINOCO_SEQ_LEN);
902
903 err = __orinoco_hw_set_tkip_key(priv, idx,
904 ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY,
905 priv->keys[idx].key,
906 tkip_iv, ORINOCO_SEQ_LEN, NULL, 0);
907 if (err)
908 printk(KERN_ERR "%s: Error %d setting TKIP key"
909 "\n", dev->name, err);
910
911 goto out;
912 }
913 default:
914 goto out;
915 }
916 }
917 err = -EINPROGRESS;
918 out:
919 orinoco_unlock(priv, &flags);
920
921 return err;
922}
923
924static int orinoco_ioctl_get_encodeext(struct net_device *dev,
925 struct iw_request_info *info,
926 union iwreq_data *wrqu,
927 char *extra)
928{
929 struct orinoco_private *priv = ndev_priv(dev);
930 struct iw_point *encoding = &wrqu->encoding;
931 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
932 int idx, max_key_len;
933 unsigned long flags;
934 int err;
935
936 if (orinoco_lock(priv, &flags) != 0)
937 return -EBUSY;
938
939 err = -EINVAL;
940 max_key_len = encoding->length - sizeof(*ext);
941 if (max_key_len < 0)
942 goto out;
943
944 idx = encoding->flags & IW_ENCODE_INDEX;
945 if (idx) {
946 if ((idx < 1) || (idx > 4))
947 goto out;
948 idx--;
949 } else
950 idx = priv->tx_key;
951
952 encoding->flags = idx + 1;
953 memset(ext, 0, sizeof(*ext));
954
955 switch (priv->encode_alg) {
956 case ORINOCO_ALG_NONE:
957 ext->alg = IW_ENCODE_ALG_NONE;
958 ext->key_len = 0;
959 encoding->flags |= IW_ENCODE_DISABLED;
960 break;
961 case ORINOCO_ALG_WEP:
962 ext->alg = IW_ENCODE_ALG_WEP;
963 ext->key_len = min(priv->keys[idx].key_len, max_key_len);
964 memcpy(ext->key, priv->keys[idx].key, ext->key_len);
965 encoding->flags |= IW_ENCODE_ENABLED;
966 break;
967 case ORINOCO_ALG_TKIP:
968 ext->alg = IW_ENCODE_ALG_TKIP;
969 ext->key_len = min(priv->keys[idx].key_len, max_key_len);
970 memcpy(ext->key, priv->keys[idx].key, ext->key_len);
971 encoding->flags |= IW_ENCODE_ENABLED;
972 break;
973 }
974
975 err = 0;
976 out:
977 orinoco_unlock(priv, &flags);
978
979 return err;
980}
981
982static int orinoco_ioctl_set_auth(struct net_device *dev,
983 struct iw_request_info *info,
984 union iwreq_data *wrqu, char *extra)
985{
986 struct orinoco_private *priv = ndev_priv(dev);
987 hermes_t *hw = &priv->hw;
988 struct iw_param *param = &wrqu->param;
989 unsigned long flags;
990 int ret = -EINPROGRESS;
991
992 if (orinoco_lock(priv, &flags) != 0)
993 return -EBUSY;
994
995 switch (param->flags & IW_AUTH_INDEX) {
996 case IW_AUTH_WPA_VERSION:
997 case IW_AUTH_CIPHER_PAIRWISE:
998 case IW_AUTH_CIPHER_GROUP:
999 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
1000 case IW_AUTH_PRIVACY_INVOKED:
1001 case IW_AUTH_DROP_UNENCRYPTED:
1002
1003
1004
1005 break;
1006
1007 case IW_AUTH_KEY_MGMT:
1008
1009
1010
1011
1012 priv->key_mgmt = param->value;
1013 break;
1014
1015 case IW_AUTH_TKIP_COUNTERMEASURES:
1016
1017
1018
1019
1020
1021
1022
1023 if (param->value) {
1024 priv->tkip_cm_active = 1;
1025 ret = hermes_enable_port(hw, 0);
1026 } else {
1027 priv->tkip_cm_active = 0;
1028 ret = hermes_disable_port(hw, 0);
1029 }
1030 break;
1031
1032 case IW_AUTH_80211_AUTH_ALG:
1033 if (param->value & IW_AUTH_ALG_SHARED_KEY)
1034 priv->wep_restrict = 1;
1035 else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM)
1036 priv->wep_restrict = 0;
1037 else
1038 ret = -EINVAL;
1039 break;
1040
1041 case IW_AUTH_WPA_ENABLED:
1042 if (priv->has_wpa) {
1043 priv->wpa_enabled = param->value ? 1 : 0;
1044 } else {
1045 if (param->value)
1046 ret = -EOPNOTSUPP;
1047
1048 priv->wpa_enabled = 0;
1049 }
1050 break;
1051
1052 default:
1053 ret = -EOPNOTSUPP;
1054 }
1055
1056 orinoco_unlock(priv, &flags);
1057 return ret;
1058}
1059
1060static int orinoco_ioctl_get_auth(struct net_device *dev,
1061 struct iw_request_info *info,
1062 union iwreq_data *wrqu, char *extra)
1063{
1064 struct orinoco_private *priv = ndev_priv(dev);
1065 struct iw_param *param = &wrqu->param;
1066 unsigned long flags;
1067 int ret = 0;
1068
1069 if (orinoco_lock(priv, &flags) != 0)
1070 return -EBUSY;
1071
1072 switch (param->flags & IW_AUTH_INDEX) {
1073 case IW_AUTH_KEY_MGMT:
1074 param->value = priv->key_mgmt;
1075 break;
1076
1077 case IW_AUTH_TKIP_COUNTERMEASURES:
1078 param->value = priv->tkip_cm_active;
1079 break;
1080
1081 case IW_AUTH_80211_AUTH_ALG:
1082 if (priv->wep_restrict)
1083 param->value = IW_AUTH_ALG_SHARED_KEY;
1084 else
1085 param->value = IW_AUTH_ALG_OPEN_SYSTEM;
1086 break;
1087
1088 case IW_AUTH_WPA_ENABLED:
1089 param->value = priv->wpa_enabled;
1090 break;
1091
1092 default:
1093 ret = -EOPNOTSUPP;
1094 }
1095
1096 orinoco_unlock(priv, &flags);
1097 return ret;
1098}
1099
1100static int orinoco_ioctl_set_genie(struct net_device *dev,
1101 struct iw_request_info *info,
1102 union iwreq_data *wrqu, char *extra)
1103{
1104 struct orinoco_private *priv = ndev_priv(dev);
1105 u8 *buf;
1106 unsigned long flags;
1107
1108
1109 if ((wrqu->data.length > IEEE80211_MAX_DATA_LEN) ||
1110 (wrqu->data.length && (extra == NULL)))
1111 return -EINVAL;
1112
1113 if (wrqu->data.length) {
1114 buf = kmalloc(wrqu->data.length, GFP_KERNEL);
1115 if (buf == NULL)
1116 return -ENOMEM;
1117
1118 memcpy(buf, extra, wrqu->data.length);
1119 } else
1120 buf = NULL;
1121
1122 if (orinoco_lock(priv, &flags) != 0) {
1123 kfree(buf);
1124 return -EBUSY;
1125 }
1126
1127 kfree(priv->wpa_ie);
1128 priv->wpa_ie = buf;
1129 priv->wpa_ie_len = wrqu->data.length;
1130
1131 if (priv->wpa_ie) {
1132
1133
1134
1135
1136
1137 }
1138
1139 orinoco_unlock(priv, &flags);
1140 return 0;
1141}
1142
1143static int orinoco_ioctl_get_genie(struct net_device *dev,
1144 struct iw_request_info *info,
1145 union iwreq_data *wrqu, char *extra)
1146{
1147 struct orinoco_private *priv = ndev_priv(dev);
1148 unsigned long flags;
1149 int err = 0;
1150
1151 if (orinoco_lock(priv, &flags) != 0)
1152 return -EBUSY;
1153
1154 if ((priv->wpa_ie_len == 0) || (priv->wpa_ie == NULL)) {
1155 wrqu->data.length = 0;
1156 goto out;
1157 }
1158
1159 if (wrqu->data.length < priv->wpa_ie_len) {
1160 err = -E2BIG;
1161 goto out;
1162 }
1163
1164 wrqu->data.length = priv->wpa_ie_len;
1165 memcpy(extra, priv->wpa_ie, priv->wpa_ie_len);
1166
1167out:
1168 orinoco_unlock(priv, &flags);
1169 return err;
1170}
1171
1172static int orinoco_ioctl_set_mlme(struct net_device *dev,
1173 struct iw_request_info *info,
1174 union iwreq_data *wrqu, char *extra)
1175{
1176 struct orinoco_private *priv = ndev_priv(dev);
1177 struct iw_mlme *mlme = (struct iw_mlme *)extra;
1178 unsigned long flags;
1179 int ret = 0;
1180
1181 if (orinoco_lock(priv, &flags) != 0)
1182 return -EBUSY;
1183
1184 switch (mlme->cmd) {
1185 case IW_MLME_DEAUTH:
1186
1187 break;
1188
1189 case IW_MLME_DISASSOC:
1190
1191 ret = orinoco_hw_disassociate(priv, mlme->addr.sa_data,
1192 mlme->reason_code);
1193 break;
1194
1195 default:
1196 ret = -EOPNOTSUPP;
1197 }
1198
1199 orinoco_unlock(priv, &flags);
1200 return ret;
1201}
1202
1203static int orinoco_ioctl_getretry(struct net_device *dev,
1204 struct iw_request_info *info,
1205 struct iw_param *rrq,
1206 char *extra)
1207{
1208 struct orinoco_private *priv = ndev_priv(dev);
1209 hermes_t *hw = &priv->hw;
1210 int err = 0;
1211 u16 short_limit, long_limit, lifetime;
1212 unsigned long flags;
1213
1214 if (orinoco_lock(priv, &flags) != 0)
1215 return -EBUSY;
1216
1217 err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORTRETRYLIMIT,
1218 &short_limit);
1219 if (err)
1220 goto out;
1221
1222 err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_LONGRETRYLIMIT,
1223 &long_limit);
1224 if (err)
1225 goto out;
1226
1227 err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_MAXTRANSMITLIFETIME,
1228 &lifetime);
1229 if (err)
1230 goto out;
1231
1232 rrq->disabled = 0;
1233
1234
1235 if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
1236 rrq->flags = IW_RETRY_LIFETIME;
1237 rrq->value = lifetime * 1000;
1238 } else {
1239
1240 if ((rrq->flags & IW_RETRY_LONG)) {
1241 rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
1242 rrq->value = long_limit;
1243 } else {
1244 rrq->flags = IW_RETRY_LIMIT;
1245 rrq->value = short_limit;
1246 if (short_limit != long_limit)
1247 rrq->flags |= IW_RETRY_SHORT;
1248 }
1249 }
1250
1251 out:
1252 orinoco_unlock(priv, &flags);
1253
1254 return err;
1255}
1256
1257static int orinoco_ioctl_reset(struct net_device *dev,
1258 struct iw_request_info *info,
1259 void *wrqu,
1260 char *extra)
1261{
1262 struct orinoco_private *priv = ndev_priv(dev);
1263
1264 if (!capable(CAP_NET_ADMIN))
1265 return -EPERM;
1266
1267 if (info->cmd == (SIOCIWFIRSTPRIV + 0x1)) {
1268 printk(KERN_DEBUG "%s: Forcing reset!\n", dev->name);
1269
1270
1271 orinoco_reset(&priv->reset_work);
1272 } else {
1273 printk(KERN_DEBUG "%s: Force scheduling reset!\n", dev->name);
1274
1275 schedule_work(&priv->reset_work);
1276 }
1277
1278 return 0;
1279}
1280
1281static int orinoco_ioctl_setibssport(struct net_device *dev,
1282 struct iw_request_info *info,
1283 void *wrqu,
1284 char *extra)
1285
1286{
1287 struct orinoco_private *priv = ndev_priv(dev);
1288 int val = *((int *) extra);
1289 unsigned long flags;
1290
1291 if (orinoco_lock(priv, &flags) != 0)
1292 return -EBUSY;
1293
1294 priv->ibss_port = val;
1295
1296
1297 set_port_type(priv);
1298
1299 orinoco_unlock(priv, &flags);
1300 return -EINPROGRESS;
1301}
1302
1303static int orinoco_ioctl_getibssport(struct net_device *dev,
1304 struct iw_request_info *info,
1305 void *wrqu,
1306 char *extra)
1307{
1308 struct orinoco_private *priv = ndev_priv(dev);
1309 int *val = (int *) extra;
1310
1311 *val = priv->ibss_port;
1312 return 0;
1313}
1314
1315static int orinoco_ioctl_setport3(struct net_device *dev,
1316 struct iw_request_info *info,
1317 void *wrqu,
1318 char *extra)
1319{
1320 struct orinoco_private *priv = ndev_priv(dev);
1321 int val = *((int *) extra);
1322 int err = 0;
1323 unsigned long flags;
1324
1325 if (orinoco_lock(priv, &flags) != 0)
1326 return -EBUSY;
1327
1328 switch (val) {
1329 case 0:
1330 if (!priv->has_ibss) {
1331 err = -EINVAL;
1332 break;
1333 }
1334 priv->prefer_port3 = 0;
1335
1336 break;
1337
1338 case 1:
1339 if (!priv->has_port3) {
1340 err = -EINVAL;
1341 break;
1342 }
1343 priv->prefer_port3 = 1;
1344 break;
1345
1346 default:
1347 err = -EINVAL;
1348 }
1349
1350 if (!err) {
1351
1352 set_port_type(priv);
1353 err = -EINPROGRESS;
1354 }
1355
1356 orinoco_unlock(priv, &flags);
1357
1358 return err;
1359}
1360
1361static int orinoco_ioctl_getport3(struct net_device *dev,
1362 struct iw_request_info *info,
1363 void *wrqu,
1364 char *extra)
1365{
1366 struct orinoco_private *priv = ndev_priv(dev);
1367 int *val = (int *) extra;
1368
1369 *val = priv->prefer_port3;
1370 return 0;
1371}
1372
1373static int orinoco_ioctl_setpreamble(struct net_device *dev,
1374 struct iw_request_info *info,
1375 void *wrqu,
1376 char *extra)
1377{
1378 struct orinoco_private *priv = ndev_priv(dev);
1379 unsigned long flags;
1380 int val;
1381
1382 if (!priv->has_preamble)
1383 return -EOPNOTSUPP;
1384
1385
1386
1387
1388
1389
1390 val = *((int *) extra);
1391
1392 if (orinoco_lock(priv, &flags) != 0)
1393 return -EBUSY;
1394
1395 if (val)
1396 priv->preamble = 1;
1397 else
1398 priv->preamble = 0;
1399
1400 orinoco_unlock(priv, &flags);
1401
1402 return -EINPROGRESS;
1403}
1404
1405static int orinoco_ioctl_getpreamble(struct net_device *dev,
1406 struct iw_request_info *info,
1407 void *wrqu,
1408 char *extra)
1409{
1410 struct orinoco_private *priv = ndev_priv(dev);
1411 int *val = (int *) extra;
1412
1413 if (!priv->has_preamble)
1414 return -EOPNOTSUPP;
1415
1416 *val = priv->preamble;
1417 return 0;
1418}
1419
1420
1421
1422
1423
1424
1425static int orinoco_ioctl_getrid(struct net_device *dev,
1426 struct iw_request_info *info,
1427 struct iw_point *data,
1428 char *extra)
1429{
1430 struct orinoco_private *priv = ndev_priv(dev);
1431 hermes_t *hw = &priv->hw;
1432 int rid = data->flags;
1433 u16 length;
1434 int err;
1435 unsigned long flags;
1436
1437
1438
1439 if (!capable(CAP_NET_ADMIN))
1440 return -EPERM;
1441
1442 if (rid < 0xfc00 || rid > 0xffff)
1443 return -EINVAL;
1444
1445 if (orinoco_lock(priv, &flags) != 0)
1446 return -EBUSY;
1447
1448 err = hermes_read_ltv(hw, USER_BAP, rid, MAX_RID_LEN, &length,
1449 extra);
1450 if (err)
1451 goto out;
1452
1453 data->length = min_t(u16, HERMES_RECLEN_TO_BYTES(length),
1454 MAX_RID_LEN);
1455
1456 out:
1457 orinoco_unlock(priv, &flags);
1458 return err;
1459}
1460
1461
1462
1463static int orinoco_ioctl_commit(struct net_device *dev,
1464 struct iw_request_info *info,
1465 void *wrqu,
1466 char *extra)
1467{
1468 struct orinoco_private *priv = ndev_priv(dev);
1469 unsigned long flags;
1470 int err = 0;
1471
1472 if (!priv->open)
1473 return 0;
1474
1475 if (orinoco_lock(priv, &flags) != 0)
1476 return err;
1477
1478 err = orinoco_commit(priv);
1479
1480 orinoco_unlock(priv, &flags);
1481 return err;
1482}
1483
1484static const struct iw_priv_args orinoco_privtab[] = {
1485 { SIOCIWFIRSTPRIV + 0x0, 0, 0, "force_reset" },
1486 { SIOCIWFIRSTPRIV + 0x1, 0, 0, "card_reset" },
1487 { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1488 0, "set_port3" },
1489 { SIOCIWFIRSTPRIV + 0x3, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1490 "get_port3" },
1491 { SIOCIWFIRSTPRIV + 0x4, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1492 0, "set_preamble" },
1493 { SIOCIWFIRSTPRIV + 0x5, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1494 "get_preamble" },
1495 { SIOCIWFIRSTPRIV + 0x6, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1496 0, "set_ibssport" },
1497 { SIOCIWFIRSTPRIV + 0x7, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1498 "get_ibssport" },
1499 { SIOCIWFIRSTPRIV + 0x9, 0, IW_PRIV_TYPE_BYTE | MAX_RID_LEN,
1500 "get_rid" },
1501};
1502
1503
1504
1505
1506
1507
1508#define STD_IW_HANDLER(id, func) \
1509 [IW_IOCTL_IDX(id)] = (iw_handler) func
1510static const iw_handler orinoco_handler[] = {
1511 STD_IW_HANDLER(SIOCSIWCOMMIT, orinoco_ioctl_commit),
1512 STD_IW_HANDLER(SIOCGIWNAME, cfg80211_wext_giwname),
1513 STD_IW_HANDLER(SIOCSIWFREQ, orinoco_ioctl_setfreq),
1514 STD_IW_HANDLER(SIOCGIWFREQ, orinoco_ioctl_getfreq),
1515 STD_IW_HANDLER(SIOCSIWMODE, cfg80211_wext_siwmode),
1516 STD_IW_HANDLER(SIOCGIWMODE, cfg80211_wext_giwmode),
1517 STD_IW_HANDLER(SIOCSIWSENS, orinoco_ioctl_setsens),
1518 STD_IW_HANDLER(SIOCGIWSENS, orinoco_ioctl_getsens),
1519 STD_IW_HANDLER(SIOCGIWRANGE, cfg80211_wext_giwrange),
1520 STD_IW_HANDLER(SIOCSIWSPY, iw_handler_set_spy),
1521 STD_IW_HANDLER(SIOCGIWSPY, iw_handler_get_spy),
1522 STD_IW_HANDLER(SIOCSIWTHRSPY, iw_handler_set_thrspy),
1523 STD_IW_HANDLER(SIOCGIWTHRSPY, iw_handler_get_thrspy),
1524 STD_IW_HANDLER(SIOCSIWAP, orinoco_ioctl_setwap),
1525 STD_IW_HANDLER(SIOCGIWAP, orinoco_ioctl_getwap),
1526 STD_IW_HANDLER(SIOCSIWSCAN, cfg80211_wext_siwscan),
1527 STD_IW_HANDLER(SIOCGIWSCAN, cfg80211_wext_giwscan),
1528 STD_IW_HANDLER(SIOCSIWESSID, orinoco_ioctl_setessid),
1529 STD_IW_HANDLER(SIOCGIWESSID, orinoco_ioctl_getessid),
1530 STD_IW_HANDLER(SIOCSIWRATE, orinoco_ioctl_setrate),
1531 STD_IW_HANDLER(SIOCGIWRATE, orinoco_ioctl_getrate),
1532 STD_IW_HANDLER(SIOCSIWRTS, orinoco_ioctl_setrts),
1533 STD_IW_HANDLER(SIOCGIWRTS, orinoco_ioctl_getrts),
1534 STD_IW_HANDLER(SIOCSIWFRAG, orinoco_ioctl_setfrag),
1535 STD_IW_HANDLER(SIOCGIWFRAG, orinoco_ioctl_getfrag),
1536 STD_IW_HANDLER(SIOCGIWRETRY, orinoco_ioctl_getretry),
1537 STD_IW_HANDLER(SIOCSIWENCODE, orinoco_ioctl_setiwencode),
1538 STD_IW_HANDLER(SIOCGIWENCODE, orinoco_ioctl_getiwencode),
1539 STD_IW_HANDLER(SIOCSIWPOWER, orinoco_ioctl_setpower),
1540 STD_IW_HANDLER(SIOCGIWPOWER, orinoco_ioctl_getpower),
1541 STD_IW_HANDLER(SIOCSIWGENIE, orinoco_ioctl_set_genie),
1542 STD_IW_HANDLER(SIOCGIWGENIE, orinoco_ioctl_get_genie),
1543 STD_IW_HANDLER(SIOCSIWMLME, orinoco_ioctl_set_mlme),
1544 STD_IW_HANDLER(SIOCSIWAUTH, orinoco_ioctl_set_auth),
1545 STD_IW_HANDLER(SIOCGIWAUTH, orinoco_ioctl_get_auth),
1546 STD_IW_HANDLER(SIOCSIWENCODEEXT, orinoco_ioctl_set_encodeext),
1547 STD_IW_HANDLER(SIOCGIWENCODEEXT, orinoco_ioctl_get_encodeext),
1548};
1549
1550
1551
1552
1553
1554static const iw_handler orinoco_private_handler[] = {
1555 [0] = (iw_handler) orinoco_ioctl_reset,
1556 [1] = (iw_handler) orinoco_ioctl_reset,
1557 [2] = (iw_handler) orinoco_ioctl_setport3,
1558 [3] = (iw_handler) orinoco_ioctl_getport3,
1559 [4] = (iw_handler) orinoco_ioctl_setpreamble,
1560 [5] = (iw_handler) orinoco_ioctl_getpreamble,
1561 [6] = (iw_handler) orinoco_ioctl_setibssport,
1562 [7] = (iw_handler) orinoco_ioctl_getibssport,
1563 [9] = (iw_handler) orinoco_ioctl_getrid,
1564};
1565
1566const struct iw_handler_def orinoco_handler_def = {
1567 .num_standard = ARRAY_SIZE(orinoco_handler),
1568 .num_private = ARRAY_SIZE(orinoco_private_handler),
1569 .num_private_args = ARRAY_SIZE(orinoco_privtab),
1570 .standard = orinoco_handler,
1571 .private = orinoco_private_handler,
1572 .private_args = orinoco_privtab,
1573 .get_wireless_stats = orinoco_get_wireless_stats,
1574};
1575