orinoco: allow IW_AUTH_MFP to pass through
[orinoco_usb.git] / drivers / net / wireless / orinoco / wext.c
blob6a06b5d64719ff73224e5b2a0e110f5dc80631dd
1 /* Wireless extensions support.
3 * See copyright notice in main.c
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>
12 #include "hermes.h"
13 #include "hermes_rid.h"
14 #include "orinoco.h"
16 #include "hw.h"
17 #include "mic.h"
18 #include "scan.h"
19 #include "main.h"
21 #include "wext.h"
23 #define MAX_RID_LEN 1024
25 /* Helper routine to record keys
26 * It is called under orinoco_lock so it may not sleep */
27 static 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)
31 kzfree(priv->keys[index].key);
32 kzfree(priv->keys[index].seq);
34 if (key_len) {
35 priv->keys[index].key = kzalloc(key_len, GFP_ATOMIC);
36 if (!priv->keys[index].key)
37 goto nomem;
38 } else
39 priv->keys[index].key = NULL;
41 if (seq_len) {
42 priv->keys[index].seq = kzalloc(seq_len, GFP_ATOMIC);
43 if (!priv->keys[index].seq)
44 goto free_key;
45 } else
46 priv->keys[index].seq = NULL;
48 priv->keys[index].key_len = key_len;
49 priv->keys[index].seq_len = seq_len;
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);
56 switch (alg) {
57 case ORINOCO_ALG_TKIP:
58 priv->keys[index].cipher = WLAN_CIPHER_SUITE_TKIP;
59 break;
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;
66 case ORINOCO_ALG_NONE:
67 default:
68 priv->keys[index].cipher = 0;
69 break;
72 return 0;
74 free_key:
75 kfree(priv->keys[index].key);
76 priv->keys[index].key = NULL;
78 nomem:
79 priv->keys[index].key_len = 0;
80 priv->keys[index].seq_len = 0;
81 priv->keys[index].cipher = 0;
83 return -ENOMEM;
86 static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
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;
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; /* FIXME: Can we do better than this? */
100 /* If busy, return the old stats. Returning NULL may cause
101 * the interface to disappear from /proc/net/wireless */
102 if (orinoco_lock(priv, &flags) != 0)
103 return wstats;
105 /* We can't really wait for the tallies inquiry command to
106 * complete, so we just use the previous results and trigger
107 * a new tallies inquiry command for next time - Jean II */
108 /* FIXME: Really we should wait for the inquiry to come back -
109 * as it is the stats we give don't make a whole lot of sense.
110 * Unfortunately, it's not clear how to do that within the
111 * wireless extensions framework: I think we're in user
112 * context, but a lock seems to be held by the time we get in
113 * here so we're not safe to sleep here. */
114 hermes_inquire(hw, HERMES_INQ_TALLIES);
116 if (priv->iw_mode == NL80211_IFTYPE_ADHOC) {
117 memset(&wstats->qual, 0, sizeof(wstats->qual));
118 /* If a spy address is defined, we report stats of the
119 * first spy address - Jean II */
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;
127 } else {
128 struct {
129 __le16 qual, signal, noise, unused;
130 } __attribute__ ((packed)) cq;
132 err = HERMES_READ_RECORD(hw, USER_BAP,
133 HERMES_RID_COMMSQUALITY, &cq);
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;
144 orinoco_unlock(priv, &flags);
145 return wstats;
148 /********************************************************************/
149 /* Wireless extensions */
150 /********************************************************************/
152 static int orinoco_ioctl_setwap(struct net_device *dev,
153 struct iw_request_info *info,
154 struct sockaddr *ap_addr,
155 char *extra)
157 struct orinoco_private *priv = ndev_priv(dev);
158 int err = -EINPROGRESS; /* Call commit handler */
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 };
163 if (orinoco_lock(priv, &flags) != 0)
164 return -EBUSY;
166 /* Enable automatic roaming - no sanity checks are needed */
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);
172 /* "off" means keep existing connection */
173 if (ap_addr->sa_data[0] == 0) {
174 __orinoco_hw_set_wap(priv);
175 err = 0;
177 goto out;
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;
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;
195 /* Intersil firmware hangs without Desired ESSID */
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;
204 /* Finally, enable manual roaming */
205 priv->bssid_fixed = 1;
206 memcpy(priv->desired_bssid, &ap_addr->sa_data, ETH_ALEN);
208 out:
209 orinoco_unlock(priv, &flags);
210 return err;
213 static int orinoco_ioctl_getwap(struct net_device *dev,
214 struct iw_request_info *info,
215 struct sockaddr *ap_addr,
216 char *extra)
218 struct orinoco_private *priv = ndev_priv(dev);
220 int err = 0;
221 unsigned long flags;
223 if (orinoco_lock(priv, &flags) != 0)
224 return -EBUSY;
226 ap_addr->sa_family = ARPHRD_ETHER;
227 err = orinoco_hw_get_current_bssid(priv, ap_addr->sa_data);
229 orinoco_unlock(priv, &flags);
231 return err;
234 static int orinoco_ioctl_setiwencode(struct net_device *dev,
235 struct iw_request_info *info,
236 struct iw_point *erq,
237 char *keybuf)
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; /* Call commit handler */
245 unsigned long flags;
247 if (!priv->has_wep)
248 return -EOPNOTSUPP;
250 if (erq->pointer) {
251 /* We actually have a key to set - check its length */
252 if (erq->length > LARGE_KEY_SIZE)
253 return -E2BIG;
255 if ((erq->length > SMALL_KEY_SIZE) && !priv->has_big_wep)
256 return -E2BIG;
259 if (orinoco_lock(priv, &flags) != 0)
260 return -EBUSY;
262 /* Clear any TKIP key we have */
263 if ((priv->has_wpa) && (priv->encode_alg == ORINOCO_ALG_TKIP))
264 (void) orinoco_clear_tkip_key(priv, setindex);
266 if (erq->length > 0) {
267 if ((index < 0) || (index >= ORINOCO_MAX_KEYS))
268 index = priv->tx_key;
270 /* Switch on WEP if off */
271 if (encode_alg != ORINOCO_ALG_WEP) {
272 setindex = index;
273 encode_alg = ORINOCO_ALG_WEP;
275 } else {
276 /* Important note : if the user do "iwconfig eth0 enc off",
277 * we will arrive there with an index of -1. This is valid
278 * but need to be taken care off... Jean II */
279 if ((index < 0) || (index >= ORINOCO_MAX_KEYS)) {
280 if ((index != -1) || (erq->flags == 0)) {
281 err = -EINVAL;
282 goto out;
284 } else {
285 /* Set the index : Check that the key is valid */
286 if (priv->keys[index].key_len == 0) {
287 err = -EINVAL;
288 goto out;
290 setindex = index;
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;
301 if (erq->pointer && erq->length > 0) {
302 err = orinoco_set_key(priv, index, ORINOCO_ALG_WEP, keybuf,
303 erq->length, NULL, 0);
305 priv->tx_key = setindex;
307 /* Try fast key change if connected and only keys are changed */
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 /* No need to commit if successful */
313 goto out;
316 priv->encode_alg = encode_alg;
317 priv->wep_restrict = restricted;
319 out:
320 orinoco_unlock(priv, &flags);
322 return err;
325 static int orinoco_ioctl_getiwencode(struct net_device *dev,
326 struct iw_request_info *info,
327 struct iw_point *erq,
328 char *keybuf)
330 struct orinoco_private *priv = ndev_priv(dev);
331 int index = (erq->flags & IW_ENCODE_INDEX) - 1;
332 unsigned long flags;
334 if (!priv->has_wep)
335 return -EOPNOTSUPP;
337 if (orinoco_lock(priv, &flags) != 0)
338 return -EBUSY;
340 if ((index < 0) || (index >= ORINOCO_MAX_KEYS))
341 index = priv->tx_key;
343 erq->flags = 0;
344 if (!priv->encode_alg)
345 erq->flags |= IW_ENCODE_DISABLED;
346 erq->flags |= index + 1;
348 if (priv->wep_restrict)
349 erq->flags |= IW_ENCODE_RESTRICTED;
350 else
351 erq->flags |= IW_ENCODE_OPEN;
353 erq->length = priv->keys[index].key_len;
355 memcpy(keybuf, priv->keys[index].key, erq->length);
357 orinoco_unlock(priv, &flags);
358 return 0;
361 static int orinoco_ioctl_setessid(struct net_device *dev,
362 struct iw_request_info *info,
363 struct iw_point *erq,
364 char *essidbuf)
366 struct orinoco_private *priv = ndev_priv(dev);
367 unsigned long flags;
369 /* Note : ESSID is ignored in Ad-Hoc demo mode, but we can set it
370 * anyway... - Jean II */
372 /* Hum... Should not use Wireless Extension constant (may change),
373 * should use our own... - Jean II */
374 if (erq->length > IW_ESSID_MAX_SIZE)
375 return -E2BIG;
377 if (orinoco_lock(priv, &flags) != 0)
378 return -EBUSY;
380 /* NULL the string (for NULL termination & ESSID = ANY) - Jean II */
381 memset(priv->desired_essid, 0, sizeof(priv->desired_essid));
383 /* If not ANY, get the new ESSID */
384 if (erq->flags)
385 memcpy(priv->desired_essid, essidbuf, erq->length);
387 orinoco_unlock(priv, &flags);
389 return -EINPROGRESS; /* Call commit handler */
392 static int orinoco_ioctl_getessid(struct net_device *dev,
393 struct iw_request_info *info,
394 struct iw_point *erq,
395 char *essidbuf)
397 struct orinoco_private *priv = ndev_priv(dev);
398 int active;
399 int err = 0;
400 unsigned long flags;
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);
415 erq->flags = 1;
417 return 0;
420 static int orinoco_ioctl_setfreq(struct net_device *dev,
421 struct iw_request_info *info,
422 struct iw_freq *frq,
423 char *extra)
425 struct orinoco_private *priv = ndev_priv(dev);
426 int chan = -1;
427 unsigned long flags;
428 int err = -EINPROGRESS; /* Call commit handler */
430 /* In infrastructure mode the AP sets the channel */
431 if (priv->iw_mode == NL80211_IFTYPE_STATION)
432 return -EBUSY;
434 if ((frq->e == 0) && (frq->m <= 1000)) {
435 /* Setting by channel number */
436 chan = frq->m;
437 } else {
438 /* Setting by frequency */
439 int denom = 1;
440 int i;
442 /* Calculate denominator to rescale to MHz */
443 for (i = 0; i < (6 - frq->e); i++)
444 denom *= 10;
446 chan = ieee80211_freq_to_dsss_chan(frq->m / denom);
449 if ((chan < 1) || (chan > NUM_CHANNELS) ||
450 !(priv->channel_mask & (1 << (chan-1))))
451 return -EINVAL;
453 if (orinoco_lock(priv, &flags) != 0)
454 return -EBUSY;
456 priv->channel = chan;
457 if (priv->iw_mode == NL80211_IFTYPE_MONITOR) {
458 /* Fast channel change - no commit if successful */
459 hermes_t *hw = &priv->hw;
460 err = hw->ops->cmd_wait(hw, HERMES_CMD_TEST |
461 HERMES_TEST_SET_CHANNEL,
462 chan, NULL);
464 orinoco_unlock(priv, &flags);
466 return err;
469 static int orinoco_ioctl_getfreq(struct net_device *dev,
470 struct iw_request_info *info,
471 struct iw_freq *frq,
472 char *extra)
474 struct orinoco_private *priv = ndev_priv(dev);
475 int tmp;
477 /* Locking done in there */
478 tmp = orinoco_hw_get_freq(priv);
479 if (tmp < 0)
480 return tmp;
482 frq->m = tmp * 100000;
483 frq->e = 1;
485 return 0;
488 static int orinoco_ioctl_getsens(struct net_device *dev,
489 struct iw_request_info *info,
490 struct iw_param *srq,
491 char *extra)
493 struct orinoco_private *priv = ndev_priv(dev);
494 hermes_t *hw = &priv->hw;
495 u16 val;
496 int err;
497 unsigned long flags;
499 if (!priv->has_sensitivity)
500 return -EOPNOTSUPP;
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);
508 if (err)
509 return err;
511 srq->value = val;
512 srq->fixed = 0; /* auto */
514 return 0;
517 static int orinoco_ioctl_setsens(struct net_device *dev,
518 struct iw_request_info *info,
519 struct iw_param *srq,
520 char *extra)
522 struct orinoco_private *priv = ndev_priv(dev);
523 int val = srq->value;
524 unsigned long flags;
526 if (!priv->has_sensitivity)
527 return -EOPNOTSUPP;
529 if ((val < 1) || (val > 3))
530 return -EINVAL;
532 if (orinoco_lock(priv, &flags) != 0)
533 return -EBUSY;
534 priv->ap_density = val;
535 orinoco_unlock(priv, &flags);
537 return -EINPROGRESS; /* Call commit handler */
540 static int orinoco_ioctl_setrts(struct net_device *dev,
541 struct iw_request_info *info,
542 struct iw_param *rrq,
543 char *extra)
545 struct orinoco_private *priv = ndev_priv(dev);
546 int val = rrq->value;
547 unsigned long flags;
549 if (rrq->disabled)
550 val = 2347;
552 if ((val < 0) || (val > 2347))
553 return -EINVAL;
555 if (orinoco_lock(priv, &flags) != 0)
556 return -EBUSY;
558 priv->rts_thresh = val;
559 orinoco_unlock(priv, &flags);
561 return -EINPROGRESS; /* Call commit handler */
564 static int orinoco_ioctl_getrts(struct net_device *dev,
565 struct iw_request_info *info,
566 struct iw_param *rrq,
567 char *extra)
569 struct orinoco_private *priv = ndev_priv(dev);
571 rrq->value = priv->rts_thresh;
572 rrq->disabled = (rrq->value == 2347);
573 rrq->fixed = 1;
575 return 0;
578 static int orinoco_ioctl_setfrag(struct net_device *dev,
579 struct iw_request_info *info,
580 struct iw_param *frq,
581 char *extra)
583 struct orinoco_private *priv = ndev_priv(dev);
584 int err = -EINPROGRESS; /* Call commit handler */
585 unsigned long flags;
587 if (orinoco_lock(priv, &flags) != 0)
588 return -EBUSY;
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;
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 /* must be even */
609 priv->frag_thresh = frq->value & ~0x1;
613 orinoco_unlock(priv, &flags);
615 return err;
618 static int orinoco_ioctl_getfrag(struct net_device *dev,
619 struct iw_request_info *info,
620 struct iw_param *frq,
621 char *extra)
623 struct orinoco_private *priv = ndev_priv(dev);
624 hermes_t *hw = &priv->hw;
625 int err;
626 u16 val;
627 unsigned long flags;
629 if (orinoco_lock(priv, &flags) != 0)
630 return -EBUSY;
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;
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;
649 frq->value = val;
650 frq->disabled = (val >= 2346);
651 frq->fixed = 1;
654 orinoco_unlock(priv, &flags);
656 return err;
659 static int orinoco_ioctl_setrate(struct net_device *dev,
660 struct iw_request_info *info,
661 struct iw_param *rrq,
662 char *extra)
664 struct orinoco_private *priv = ndev_priv(dev);
665 int ratemode;
666 int bitrate; /* 100s of kilobits */
667 unsigned long flags;
669 /* As the user space doesn't know our highest rate, it uses -1
670 * to ask us to set the highest rate. Test it using "iwconfig
671 * ethX rate auto" - Jean II */
672 if (rrq->value == -1)
673 bitrate = 110;
674 else {
675 if (rrq->value % 100000)
676 return -EINVAL;
677 bitrate = rrq->value / 100000;
680 ratemode = orinoco_get_bitratemode(bitrate, !rrq->fixed);
682 if (ratemode == -1)
683 return -EINVAL;
685 if (orinoco_lock(priv, &flags) != 0)
686 return -EBUSY;
687 priv->bitratemode = ratemode;
688 orinoco_unlock(priv, &flags);
690 return -EINPROGRESS;
693 static int orinoco_ioctl_getrate(struct net_device *dev,
694 struct iw_request_info *info,
695 struct iw_param *rrq,
696 char *extra)
698 struct orinoco_private *priv = ndev_priv(dev);
699 int err = 0;
700 int bitrate, automatic;
701 unsigned long flags;
703 if (orinoco_lock(priv, &flags) != 0)
704 return -EBUSY;
706 orinoco_get_ratemode_cfg(priv->bitratemode, &bitrate, &automatic);
708 /* If the interface is running we try to find more about the
709 current mode */
710 if (netif_running(dev))
711 err = orinoco_hw_get_act_bitrate(priv, &bitrate);
713 orinoco_unlock(priv, &flags);
715 rrq->value = bitrate;
716 rrq->fixed = !automatic;
717 rrq->disabled = 0;
719 return err;
722 static int orinoco_ioctl_setpower(struct net_device *dev,
723 struct iw_request_info *info,
724 struct iw_param *prq,
725 char *extra)
727 struct orinoco_private *priv = ndev_priv(dev);
728 int err = -EINPROGRESS; /* Call commit handler */
729 unsigned long flags;
731 if (orinoco_lock(priv, &flags) != 0)
732 return -EBUSY;
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 /* No flags : but we may have a value - Jean II */
748 break;
749 default:
750 err = -EINVAL;
751 goto out;
754 if (prq->flags & IW_POWER_TIMEOUT) {
755 priv->pm_on = 1;
756 priv->pm_timeout = prq->value / 1000;
758 if (prq->flags & IW_POWER_PERIOD) {
759 priv->pm_on = 1;
760 priv->pm_period = prq->value / 1000;
762 /* It's valid to not have a value if we are just toggling
763 * the flags... Jean II */
764 if (!priv->pm_on) {
765 err = -EINVAL;
766 goto out;
770 out:
771 orinoco_unlock(priv, &flags);
773 return err;
776 static int orinoco_ioctl_getpower(struct net_device *dev,
777 struct iw_request_info *info,
778 struct iw_param *prq,
779 char *extra)
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;
787 if (orinoco_lock(priv, &flags) != 0)
788 return -EBUSY;
790 err = hermes_read_wordrec(hw, USER_BAP,
791 HERMES_RID_CNFPMENABLED, &enable);
792 if (err)
793 goto out;
795 err = hermes_read_wordrec(hw, USER_BAP,
796 HERMES_RID_CNFMAXSLEEPDURATION, &period);
797 if (err)
798 goto out;
800 err = hermes_read_wordrec(hw, USER_BAP,
801 HERMES_RID_CNFPMHOLDOVERDURATION, &timeout);
802 if (err)
803 goto out;
805 err = hermes_read_wordrec(hw, USER_BAP,
806 HERMES_RID_CNFMULTICASTRECEIVE, &mcast);
807 if (err)
808 goto out;
810 prq->disabled = !enable;
811 /* Note : by default, display the period */
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;
819 if (mcast)
820 prq->flags |= IW_POWER_ALL_R;
821 else
822 prq->flags |= IW_POWER_UNICAST_R;
824 out:
825 orinoco_unlock(priv, &flags);
827 return err;
830 static int orinoco_ioctl_set_encodeext(struct net_device *dev,
831 struct iw_request_info *info,
832 union iwreq_data *wrqu,
833 char *extra)
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;
842 if (orinoco_lock(priv, &flags) != 0)
843 return -EBUSY;
845 /* Determine and validate the key index */
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;
854 if (encoding->flags & IW_ENCODE_DISABLED)
855 alg = IW_ENCODE_ALG_NONE;
857 if (priv->has_wpa && (alg != IW_ENCODE_ALG_TKIP)) {
858 /* Clear any TKIP TX key we had */
859 (void) orinoco_clear_tkip_key(priv, priv->tx_key);
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;
868 if (set_key) {
869 /* Set the requested key first */
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;
877 case IW_ENCODE_ALG_WEP:
878 if (ext->key_len <= 0)
879 goto out;
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;
886 case IW_ENCODE_ALG_TKIP:
888 u8 *tkip_iv = NULL;
890 if (!priv->has_wpa ||
891 (ext->key_len > sizeof(struct orinoco_tkip_key)))
892 goto out;
894 priv->encode_alg = ORINOCO_ALG_TKIP;
896 if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID)
897 tkip_iv = &ext->rx_seq[0];
899 err = orinoco_set_key(priv, idx, ORINOCO_ALG_TKIP,
900 ext->key, ext->key_len, tkip_iv,
901 ORINOCO_SEQ_LEN);
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);
911 goto out;
913 default:
914 goto out;
917 err = -EINPROGRESS;
918 out:
919 orinoco_unlock(priv, &flags);
921 return err;
924 static int orinoco_ioctl_get_encodeext(struct net_device *dev,
925 struct iw_request_info *info,
926 union iwreq_data *wrqu,
927 char *extra)
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;
936 if (orinoco_lock(priv, &flags) != 0)
937 return -EBUSY;
939 err = -EINVAL;
940 max_key_len = encoding->length - sizeof(*ext);
941 if (max_key_len < 0)
942 goto out;
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;
952 encoding->flags = idx + 1;
953 memset(ext, 0, sizeof(*ext));
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;
975 err = 0;
976 out:
977 orinoco_unlock(priv, &flags);
979 return err;
982 static int orinoco_ioctl_set_auth(struct net_device *dev,
983 struct iw_request_info *info,
984 union iwreq_data *wrqu, char *extra)
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;
992 if (orinoco_lock(priv, &flags) != 0)
993 return -EBUSY;
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:
1003 * orinoco does not use these parameters
1005 break;
1007 case IW_AUTH_MFP:
1008 /* Management Frame Protection not supported.
1009 * Only fail if set to required.
1011 if (param->value == IW_AUTH_MFP_REQUIRED)
1012 ret = -EINVAL;
1013 break;
1015 case IW_AUTH_KEY_MGMT:
1016 /* wl_lkm implies value 2 == PSK for Hermes I
1017 * which ties in with WEXT
1018 * no other hints tho :(
1020 priv->key_mgmt = param->value;
1021 break;
1023 case IW_AUTH_TKIP_COUNTERMEASURES:
1024 /* When countermeasures are enabled, shut down the
1025 * card; when disabled, re-enable the card. This must
1026 * take effect immediately.
1028 * TODO: Make sure that the EAPOL message is getting
1029 * out before card disabled
1031 if (param->value) {
1032 priv->tkip_cm_active = 1;
1033 ret = hermes_enable_port(hw, 0);
1034 } else {
1035 priv->tkip_cm_active = 0;
1036 ret = hermes_disable_port(hw, 0);
1038 break;
1040 case IW_AUTH_80211_AUTH_ALG:
1041 if (param->value & IW_AUTH_ALG_SHARED_KEY)
1042 priv->wep_restrict = 1;
1043 else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM)
1044 priv->wep_restrict = 0;
1045 else
1046 ret = -EINVAL;
1047 break;
1049 case IW_AUTH_WPA_ENABLED:
1050 if (priv->has_wpa) {
1051 priv->wpa_enabled = param->value ? 1 : 0;
1052 } else {
1053 if (param->value)
1054 ret = -EOPNOTSUPP;
1055 /* else silently accept disable of WPA */
1056 priv->wpa_enabled = 0;
1058 break;
1060 default:
1061 ret = -EOPNOTSUPP;
1064 orinoco_unlock(priv, &flags);
1065 return ret;
1068 static int orinoco_ioctl_get_auth(struct net_device *dev,
1069 struct iw_request_info *info,
1070 union iwreq_data *wrqu, char *extra)
1072 struct orinoco_private *priv = ndev_priv(dev);
1073 struct iw_param *param = &wrqu->param;
1074 unsigned long flags;
1075 int ret = 0;
1077 if (orinoco_lock(priv, &flags) != 0)
1078 return -EBUSY;
1080 switch (param->flags & IW_AUTH_INDEX) {
1081 case IW_AUTH_KEY_MGMT:
1082 param->value = priv->key_mgmt;
1083 break;
1085 case IW_AUTH_TKIP_COUNTERMEASURES:
1086 param->value = priv->tkip_cm_active;
1087 break;
1089 case IW_AUTH_80211_AUTH_ALG:
1090 if (priv->wep_restrict)
1091 param->value = IW_AUTH_ALG_SHARED_KEY;
1092 else
1093 param->value = IW_AUTH_ALG_OPEN_SYSTEM;
1094 break;
1096 case IW_AUTH_WPA_ENABLED:
1097 param->value = priv->wpa_enabled;
1098 break;
1100 default:
1101 ret = -EOPNOTSUPP;
1104 orinoco_unlock(priv, &flags);
1105 return ret;
1108 static int orinoco_ioctl_set_genie(struct net_device *dev,
1109 struct iw_request_info *info,
1110 union iwreq_data *wrqu, char *extra)
1112 struct orinoco_private *priv = ndev_priv(dev);
1113 u8 *buf;
1114 unsigned long flags;
1116 /* cut off at IEEE80211_MAX_DATA_LEN */
1117 if ((wrqu->data.length > IEEE80211_MAX_DATA_LEN) ||
1118 (wrqu->data.length && (extra == NULL)))
1119 return -EINVAL;
1121 if (wrqu->data.length) {
1122 buf = kmalloc(wrqu->data.length, GFP_KERNEL);
1123 if (buf == NULL)
1124 return -ENOMEM;
1126 memcpy(buf, extra, wrqu->data.length);
1127 } else
1128 buf = NULL;
1130 if (orinoco_lock(priv, &flags) != 0) {
1131 kfree(buf);
1132 return -EBUSY;
1135 kfree(priv->wpa_ie);
1136 priv->wpa_ie = buf;
1137 priv->wpa_ie_len = wrqu->data.length;
1139 if (priv->wpa_ie) {
1140 /* Looks like wl_lkm wants to check the auth alg, and
1141 * somehow pass it to the firmware.
1142 * Instead it just calls the key mgmt rid
1143 * - we do this in set auth.
1147 orinoco_unlock(priv, &flags);
1148 return 0;
1151 static int orinoco_ioctl_get_genie(struct net_device *dev,
1152 struct iw_request_info *info,
1153 union iwreq_data *wrqu, char *extra)
1155 struct orinoco_private *priv = ndev_priv(dev);
1156 unsigned long flags;
1157 int err = 0;
1159 if (orinoco_lock(priv, &flags) != 0)
1160 return -EBUSY;
1162 if ((priv->wpa_ie_len == 0) || (priv->wpa_ie == NULL)) {
1163 wrqu->data.length = 0;
1164 goto out;
1167 if (wrqu->data.length < priv->wpa_ie_len) {
1168 err = -E2BIG;
1169 goto out;
1172 wrqu->data.length = priv->wpa_ie_len;
1173 memcpy(extra, priv->wpa_ie, priv->wpa_ie_len);
1175 out:
1176 orinoco_unlock(priv, &flags);
1177 return err;
1180 static int orinoco_ioctl_set_mlme(struct net_device *dev,
1181 struct iw_request_info *info,
1182 union iwreq_data *wrqu, char *extra)
1184 struct orinoco_private *priv = ndev_priv(dev);
1185 struct iw_mlme *mlme = (struct iw_mlme *)extra;
1186 unsigned long flags;
1187 int ret = 0;
1189 if (orinoco_lock(priv, &flags) != 0)
1190 return -EBUSY;
1192 switch (mlme->cmd) {
1193 case IW_MLME_DEAUTH:
1194 /* silently ignore */
1195 break;
1197 case IW_MLME_DISASSOC:
1199 ret = orinoco_hw_disassociate(priv, mlme->addr.sa_data,
1200 mlme->reason_code);
1201 break;
1203 default:
1204 ret = -EOPNOTSUPP;
1207 orinoco_unlock(priv, &flags);
1208 return ret;
1211 static int orinoco_ioctl_getretry(struct net_device *dev,
1212 struct iw_request_info *info,
1213 struct iw_param *rrq,
1214 char *extra)
1216 struct orinoco_private *priv = ndev_priv(dev);
1217 hermes_t *hw = &priv->hw;
1218 int err = 0;
1219 u16 short_limit, long_limit, lifetime;
1220 unsigned long flags;
1222 if (orinoco_lock(priv, &flags) != 0)
1223 return -EBUSY;
1225 err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORTRETRYLIMIT,
1226 &short_limit);
1227 if (err)
1228 goto out;
1230 err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_LONGRETRYLIMIT,
1231 &long_limit);
1232 if (err)
1233 goto out;
1235 err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_MAXTRANSMITLIFETIME,
1236 &lifetime);
1237 if (err)
1238 goto out;
1240 rrq->disabled = 0; /* Can't be disabled */
1242 /* Note : by default, display the retry number */
1243 if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
1244 rrq->flags = IW_RETRY_LIFETIME;
1245 rrq->value = lifetime * 1000; /* ??? */
1246 } else {
1247 /* By default, display the min number */
1248 if ((rrq->flags & IW_RETRY_LONG)) {
1249 rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
1250 rrq->value = long_limit;
1251 } else {
1252 rrq->flags = IW_RETRY_LIMIT;
1253 rrq->value = short_limit;
1254 if (short_limit != long_limit)
1255 rrq->flags |= IW_RETRY_SHORT;
1259 out:
1260 orinoco_unlock(priv, &flags);
1262 return err;
1265 static int orinoco_ioctl_reset(struct net_device *dev,
1266 struct iw_request_info *info,
1267 void *wrqu,
1268 char *extra)
1270 struct orinoco_private *priv = ndev_priv(dev);
1272 if (!capable(CAP_NET_ADMIN))
1273 return -EPERM;
1275 if (info->cmd == (SIOCIWFIRSTPRIV + 0x1)) {
1276 printk(KERN_DEBUG "%s: Forcing reset!\n", dev->name);
1278 /* Firmware reset */
1279 orinoco_reset(&priv->reset_work);
1280 } else {
1281 printk(KERN_DEBUG "%s: Force scheduling reset!\n", dev->name);
1283 schedule_work(&priv->reset_work);
1286 return 0;
1289 static int orinoco_ioctl_setibssport(struct net_device *dev,
1290 struct iw_request_info *info,
1291 void *wrqu,
1292 char *extra)
1295 struct orinoco_private *priv = ndev_priv(dev);
1296 int val = *((int *) extra);
1297 unsigned long flags;
1299 if (orinoco_lock(priv, &flags) != 0)
1300 return -EBUSY;
1302 priv->ibss_port = val;
1304 /* Actually update the mode we are using */
1305 set_port_type(priv);
1307 orinoco_unlock(priv, &flags);
1308 return -EINPROGRESS; /* Call commit handler */
1311 static int orinoco_ioctl_getibssport(struct net_device *dev,
1312 struct iw_request_info *info,
1313 void *wrqu,
1314 char *extra)
1316 struct orinoco_private *priv = ndev_priv(dev);
1317 int *val = (int *) extra;
1319 *val = priv->ibss_port;
1320 return 0;
1323 static int orinoco_ioctl_setport3(struct net_device *dev,
1324 struct iw_request_info *info,
1325 void *wrqu,
1326 char *extra)
1328 struct orinoco_private *priv = ndev_priv(dev);
1329 int val = *((int *) extra);
1330 int err = 0;
1331 unsigned long flags;
1333 if (orinoco_lock(priv, &flags) != 0)
1334 return -EBUSY;
1336 switch (val) {
1337 case 0: /* Try to do IEEE ad-hoc mode */
1338 if (!priv->has_ibss) {
1339 err = -EINVAL;
1340 break;
1342 priv->prefer_port3 = 0;
1344 break;
1346 case 1: /* Try to do Lucent proprietary ad-hoc mode */
1347 if (!priv->has_port3) {
1348 err = -EINVAL;
1349 break;
1351 priv->prefer_port3 = 1;
1352 break;
1354 default:
1355 err = -EINVAL;
1358 if (!err) {
1359 /* Actually update the mode we are using */
1360 set_port_type(priv);
1361 err = -EINPROGRESS;
1364 orinoco_unlock(priv, &flags);
1366 return err;
1369 static int orinoco_ioctl_getport3(struct net_device *dev,
1370 struct iw_request_info *info,
1371 void *wrqu,
1372 char *extra)
1374 struct orinoco_private *priv = ndev_priv(dev);
1375 int *val = (int *) extra;
1377 *val = priv->prefer_port3;
1378 return 0;
1381 static int orinoco_ioctl_setpreamble(struct net_device *dev,
1382 struct iw_request_info *info,
1383 void *wrqu,
1384 char *extra)
1386 struct orinoco_private *priv = ndev_priv(dev);
1387 unsigned long flags;
1388 int val;
1390 if (!priv->has_preamble)
1391 return -EOPNOTSUPP;
1393 /* 802.11b has recently defined some short preamble.
1394 * Basically, the Phy header has been reduced in size.
1395 * This increase performance, especially at high rates
1396 * (the preamble is transmitted at 1Mb/s), unfortunately
1397 * this give compatibility troubles... - Jean II */
1398 val = *((int *) extra);
1400 if (orinoco_lock(priv, &flags) != 0)
1401 return -EBUSY;
1403 if (val)
1404 priv->preamble = 1;
1405 else
1406 priv->preamble = 0;
1408 orinoco_unlock(priv, &flags);
1410 return -EINPROGRESS; /* Call commit handler */
1413 static int orinoco_ioctl_getpreamble(struct net_device *dev,
1414 struct iw_request_info *info,
1415 void *wrqu,
1416 char *extra)
1418 struct orinoco_private *priv = ndev_priv(dev);
1419 int *val = (int *) extra;
1421 if (!priv->has_preamble)
1422 return -EOPNOTSUPP;
1424 *val = priv->preamble;
1425 return 0;
1428 /* ioctl interface to hermes_read_ltv()
1429 * To use with iwpriv, pass the RID as the token argument, e.g.
1430 * iwpriv get_rid [0xfc00]
1431 * At least Wireless Tools 25 is required to use iwpriv.
1432 * For Wireless Tools 25 and 26 append "dummy" are the end. */
1433 static int orinoco_ioctl_getrid(struct net_device *dev,
1434 struct iw_request_info *info,
1435 struct iw_point *data,
1436 char *extra)
1438 struct orinoco_private *priv = ndev_priv(dev);
1439 hermes_t *hw = &priv->hw;
1440 int rid = data->flags;
1441 u16 length;
1442 int err;
1443 unsigned long flags;
1445 /* It's a "get" function, but we don't want users to access the
1446 * WEP key and other raw firmware data */
1447 if (!capable(CAP_NET_ADMIN))
1448 return -EPERM;
1450 if (rid < 0xfc00 || rid > 0xffff)
1451 return -EINVAL;
1453 if (orinoco_lock(priv, &flags) != 0)
1454 return -EBUSY;
1456 err = hw->ops->read_ltv(hw, USER_BAP, rid, MAX_RID_LEN, &length,
1457 extra);
1458 if (err)
1459 goto out;
1461 data->length = min_t(u16, HERMES_RECLEN_TO_BYTES(length),
1462 MAX_RID_LEN);
1464 out:
1465 orinoco_unlock(priv, &flags);
1466 return err;
1470 /* Commit handler, called after set operations */
1471 static int orinoco_ioctl_commit(struct net_device *dev,
1472 struct iw_request_info *info,
1473 void *wrqu,
1474 char *extra)
1476 struct orinoco_private *priv = ndev_priv(dev);
1477 unsigned long flags;
1478 int err = 0;
1480 if (!priv->open)
1481 return 0;
1483 if (orinoco_lock(priv, &flags) != 0)
1484 return err;
1486 err = orinoco_commit(priv);
1488 orinoco_unlock(priv, &flags);
1489 return err;
1492 static const struct iw_priv_args orinoco_privtab[] = {
1493 { SIOCIWFIRSTPRIV + 0x0, 0, 0, "force_reset" },
1494 { SIOCIWFIRSTPRIV + 0x1, 0, 0, "card_reset" },
1495 { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1496 0, "set_port3" },
1497 { SIOCIWFIRSTPRIV + 0x3, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1498 "get_port3" },
1499 { SIOCIWFIRSTPRIV + 0x4, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1500 0, "set_preamble" },
1501 { SIOCIWFIRSTPRIV + 0x5, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1502 "get_preamble" },
1503 { SIOCIWFIRSTPRIV + 0x6, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1504 0, "set_ibssport" },
1505 { SIOCIWFIRSTPRIV + 0x7, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1506 "get_ibssport" },
1507 { SIOCIWFIRSTPRIV + 0x9, 0, IW_PRIV_TYPE_BYTE | MAX_RID_LEN,
1508 "get_rid" },
1513 * Structures to export the Wireless Handlers
1516 #define STD_IW_HANDLER(id, func) \
1517 [IW_IOCTL_IDX(id)] = (iw_handler) func
1518 static const iw_handler orinoco_handler[] = {
1519 STD_IW_HANDLER(SIOCSIWCOMMIT, orinoco_ioctl_commit),
1520 STD_IW_HANDLER(SIOCGIWNAME, cfg80211_wext_giwname),
1521 STD_IW_HANDLER(SIOCSIWFREQ, orinoco_ioctl_setfreq),
1522 STD_IW_HANDLER(SIOCGIWFREQ, orinoco_ioctl_getfreq),
1523 STD_IW_HANDLER(SIOCSIWMODE, cfg80211_wext_siwmode),
1524 STD_IW_HANDLER(SIOCGIWMODE, cfg80211_wext_giwmode),
1525 STD_IW_HANDLER(SIOCSIWSENS, orinoco_ioctl_setsens),
1526 STD_IW_HANDLER(SIOCGIWSENS, orinoco_ioctl_getsens),
1527 STD_IW_HANDLER(SIOCGIWRANGE, cfg80211_wext_giwrange),
1528 STD_IW_HANDLER(SIOCSIWSPY, iw_handler_set_spy),
1529 STD_IW_HANDLER(SIOCGIWSPY, iw_handler_get_spy),
1530 STD_IW_HANDLER(SIOCSIWTHRSPY, iw_handler_set_thrspy),
1531 STD_IW_HANDLER(SIOCGIWTHRSPY, iw_handler_get_thrspy),
1532 STD_IW_HANDLER(SIOCSIWAP, orinoco_ioctl_setwap),
1533 STD_IW_HANDLER(SIOCGIWAP, orinoco_ioctl_getwap),
1534 STD_IW_HANDLER(SIOCSIWSCAN, cfg80211_wext_siwscan),
1535 STD_IW_HANDLER(SIOCGIWSCAN, cfg80211_wext_giwscan),
1536 STD_IW_HANDLER(SIOCSIWESSID, orinoco_ioctl_setessid),
1537 STD_IW_HANDLER(SIOCGIWESSID, orinoco_ioctl_getessid),
1538 STD_IW_HANDLER(SIOCSIWRATE, orinoco_ioctl_setrate),
1539 STD_IW_HANDLER(SIOCGIWRATE, orinoco_ioctl_getrate),
1540 STD_IW_HANDLER(SIOCSIWRTS, orinoco_ioctl_setrts),
1541 STD_IW_HANDLER(SIOCGIWRTS, orinoco_ioctl_getrts),
1542 STD_IW_HANDLER(SIOCSIWFRAG, orinoco_ioctl_setfrag),
1543 STD_IW_HANDLER(SIOCGIWFRAG, orinoco_ioctl_getfrag),
1544 STD_IW_HANDLER(SIOCGIWRETRY, orinoco_ioctl_getretry),
1545 STD_IW_HANDLER(SIOCSIWENCODE, orinoco_ioctl_setiwencode),
1546 STD_IW_HANDLER(SIOCGIWENCODE, orinoco_ioctl_getiwencode),
1547 STD_IW_HANDLER(SIOCSIWPOWER, orinoco_ioctl_setpower),
1548 STD_IW_HANDLER(SIOCGIWPOWER, orinoco_ioctl_getpower),
1549 STD_IW_HANDLER(SIOCSIWGENIE, orinoco_ioctl_set_genie),
1550 STD_IW_HANDLER(SIOCGIWGENIE, orinoco_ioctl_get_genie),
1551 STD_IW_HANDLER(SIOCSIWMLME, orinoco_ioctl_set_mlme),
1552 STD_IW_HANDLER(SIOCSIWAUTH, orinoco_ioctl_set_auth),
1553 STD_IW_HANDLER(SIOCGIWAUTH, orinoco_ioctl_get_auth),
1554 STD_IW_HANDLER(SIOCSIWENCODEEXT, orinoco_ioctl_set_encodeext),
1555 STD_IW_HANDLER(SIOCGIWENCODEEXT, orinoco_ioctl_get_encodeext),
1560 Added typecasting since we no longer use iwreq_data -- Moustafa
1562 static const iw_handler orinoco_private_handler[] = {
1563 [0] = (iw_handler) orinoco_ioctl_reset,
1564 [1] = (iw_handler) orinoco_ioctl_reset,
1565 [2] = (iw_handler) orinoco_ioctl_setport3,
1566 [3] = (iw_handler) orinoco_ioctl_getport3,
1567 [4] = (iw_handler) orinoco_ioctl_setpreamble,
1568 [5] = (iw_handler) orinoco_ioctl_getpreamble,
1569 [6] = (iw_handler) orinoco_ioctl_setibssport,
1570 [7] = (iw_handler) orinoco_ioctl_getibssport,
1571 [9] = (iw_handler) orinoco_ioctl_getrid,
1574 const struct iw_handler_def orinoco_handler_def = {
1575 .num_standard = ARRAY_SIZE(orinoco_handler),
1576 .num_private = ARRAY_SIZE(orinoco_private_handler),
1577 .num_private_args = ARRAY_SIZE(orinoco_privtab),
1578 .standard = orinoco_handler,
1579 .private = orinoco_private_handler,
1580 .private_args = orinoco_privtab,
1581 .get_wireless_stats = orinoco_get_wireless_stats,