Staging: netwave: delete the driver
[linux/fpc-iii.git] / drivers / net / wireless / orinoco / wext.c
blobfbcc6e1a2e1d55f9631304e1f4562db55118bb01
1 /* Wireless extensions support.
3 * See copyright notice in main.c
4 */
5 #include <linux/slab.h>
6 #include <linux/kernel.h>
7 #include <linux/if_arp.h>
8 #include <linux/wireless.h>
9 #include <linux/ieee80211.h>
10 #include <net/iw_handler.h>
11 #include <net/cfg80211.h>
13 #include "hermes.h"
14 #include "hermes_rid.h"
15 #include "orinoco.h"
17 #include "hw.h"
18 #include "mic.h"
19 #include "scan.h"
20 #include "main.h"
22 #include "wext.h"
24 #define MAX_RID_LEN 1024
26 /* Helper routine to record keys
27 * It is called under orinoco_lock so it may not sleep */
28 static int orinoco_set_key(struct orinoco_private *priv, int index,
29 enum orinoco_alg alg, const u8 *key, int key_len,
30 const u8 *seq, int seq_len)
32 kzfree(priv->keys[index].key);
33 kzfree(priv->keys[index].seq);
35 if (key_len) {
36 priv->keys[index].key = kzalloc(key_len, GFP_ATOMIC);
37 if (!priv->keys[index].key)
38 goto nomem;
39 } else
40 priv->keys[index].key = NULL;
42 if (seq_len) {
43 priv->keys[index].seq = kzalloc(seq_len, GFP_ATOMIC);
44 if (!priv->keys[index].seq)
45 goto free_key;
46 } else
47 priv->keys[index].seq = NULL;
49 priv->keys[index].key_len = key_len;
50 priv->keys[index].seq_len = seq_len;
52 if (key_len)
53 memcpy(priv->keys[index].key, key, key_len);
54 if (seq_len)
55 memcpy(priv->keys[index].seq, seq, seq_len);
57 switch (alg) {
58 case ORINOCO_ALG_TKIP:
59 priv->keys[index].cipher = WLAN_CIPHER_SUITE_TKIP;
60 break;
62 case ORINOCO_ALG_WEP:
63 priv->keys[index].cipher = (key_len > SMALL_KEY_SIZE) ?
64 WLAN_CIPHER_SUITE_WEP104 : WLAN_CIPHER_SUITE_WEP40;
65 break;
67 case ORINOCO_ALG_NONE:
68 default:
69 priv->keys[index].cipher = 0;
70 break;
73 return 0;
75 free_key:
76 kfree(priv->keys[index].key);
77 priv->keys[index].key = NULL;
79 nomem:
80 priv->keys[index].key_len = 0;
81 priv->keys[index].seq_len = 0;
82 priv->keys[index].cipher = 0;
84 return -ENOMEM;
87 static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
89 struct orinoco_private *priv = ndev_priv(dev);
90 hermes_t *hw = &priv->hw;
91 struct iw_statistics *wstats = &priv->wstats;
92 int err;
93 unsigned long flags;
95 if (!netif_device_present(dev)) {
96 printk(KERN_WARNING "%s: get_wireless_stats() called while device not present\n",
97 dev->name);
98 return NULL; /* FIXME: Can we do better than this? */
101 /* If busy, return the old stats. Returning NULL may cause
102 * the interface to disappear from /proc/net/wireless */
103 if (orinoco_lock(priv, &flags) != 0)
104 return wstats;
106 /* We can't really wait for the tallies inquiry command to
107 * complete, so we just use the previous results and trigger
108 * a new tallies inquiry command for next time - Jean II */
109 /* FIXME: Really we should wait for the inquiry to come back -
110 * as it is the stats we give don't make a whole lot of sense.
111 * Unfortunately, it's not clear how to do that within the
112 * wireless extensions framework: I think we're in user
113 * context, but a lock seems to be held by the time we get in
114 * here so we're not safe to sleep here. */
115 hermes_inquire(hw, HERMES_INQ_TALLIES);
117 if (priv->iw_mode == NL80211_IFTYPE_ADHOC) {
118 memset(&wstats->qual, 0, sizeof(wstats->qual));
119 /* If a spy address is defined, we report stats of the
120 * first spy address - Jean II */
121 if (SPY_NUMBER(priv)) {
122 wstats->qual.qual = priv->spy_data.spy_stat[0].qual;
123 wstats->qual.level = priv->spy_data.spy_stat[0].level;
124 wstats->qual.noise = priv->spy_data.spy_stat[0].noise;
125 wstats->qual.updated =
126 priv->spy_data.spy_stat[0].updated;
128 } else {
129 struct {
130 __le16 qual, signal, noise, unused;
131 } __attribute__ ((packed)) cq;
133 err = HERMES_READ_RECORD(hw, USER_BAP,
134 HERMES_RID_COMMSQUALITY, &cq);
136 if (!err) {
137 wstats->qual.qual = (int)le16_to_cpu(cq.qual);
138 wstats->qual.level = (int)le16_to_cpu(cq.signal) - 0x95;
139 wstats->qual.noise = (int)le16_to_cpu(cq.noise) - 0x95;
140 wstats->qual.updated =
141 IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
145 orinoco_unlock(priv, &flags);
146 return wstats;
149 /********************************************************************/
150 /* Wireless extensions */
151 /********************************************************************/
153 static int orinoco_ioctl_setwap(struct net_device *dev,
154 struct iw_request_info *info,
155 struct sockaddr *ap_addr,
156 char *extra)
158 struct orinoco_private *priv = ndev_priv(dev);
159 int err = -EINPROGRESS; /* Call commit handler */
160 unsigned long flags;
161 static const u8 off_addr[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
162 static const u8 any_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
164 if (orinoco_lock(priv, &flags) != 0)
165 return -EBUSY;
167 /* Enable automatic roaming - no sanity checks are needed */
168 if (memcmp(&ap_addr->sa_data, off_addr, ETH_ALEN) == 0 ||
169 memcmp(&ap_addr->sa_data, any_addr, ETH_ALEN) == 0) {
170 priv->bssid_fixed = 0;
171 memset(priv->desired_bssid, 0, ETH_ALEN);
173 /* "off" means keep existing connection */
174 if (ap_addr->sa_data[0] == 0) {
175 __orinoco_hw_set_wap(priv);
176 err = 0;
178 goto out;
181 if (priv->firmware_type == FIRMWARE_TYPE_AGERE) {
182 printk(KERN_WARNING "%s: Lucent/Agere firmware doesn't "
183 "support manual roaming\n",
184 dev->name);
185 err = -EOPNOTSUPP;
186 goto out;
189 if (priv->iw_mode != NL80211_IFTYPE_STATION) {
190 printk(KERN_WARNING "%s: Manual roaming supported only in "
191 "managed mode\n", dev->name);
192 err = -EOPNOTSUPP;
193 goto out;
196 /* Intersil firmware hangs without Desired ESSID */
197 if (priv->firmware_type == FIRMWARE_TYPE_INTERSIL &&
198 strlen(priv->desired_essid) == 0) {
199 printk(KERN_WARNING "%s: Desired ESSID must be set for "
200 "manual roaming\n", dev->name);
201 err = -EOPNOTSUPP;
202 goto out;
205 /* Finally, enable manual roaming */
206 priv->bssid_fixed = 1;
207 memcpy(priv->desired_bssid, &ap_addr->sa_data, ETH_ALEN);
209 out:
210 orinoco_unlock(priv, &flags);
211 return err;
214 static int orinoco_ioctl_getwap(struct net_device *dev,
215 struct iw_request_info *info,
216 struct sockaddr *ap_addr,
217 char *extra)
219 struct orinoco_private *priv = ndev_priv(dev);
221 int err = 0;
222 unsigned long flags;
224 if (orinoco_lock(priv, &flags) != 0)
225 return -EBUSY;
227 ap_addr->sa_family = ARPHRD_ETHER;
228 err = orinoco_hw_get_current_bssid(priv, ap_addr->sa_data);
230 orinoco_unlock(priv, &flags);
232 return err;
235 static int orinoco_ioctl_setiwencode(struct net_device *dev,
236 struct iw_request_info *info,
237 struct iw_point *erq,
238 char *keybuf)
240 struct orinoco_private *priv = ndev_priv(dev);
241 int index = (erq->flags & IW_ENCODE_INDEX) - 1;
242 int setindex = priv->tx_key;
243 enum orinoco_alg encode_alg = priv->encode_alg;
244 int restricted = priv->wep_restrict;
245 int err = -EINPROGRESS; /* Call commit handler */
246 unsigned long flags;
248 if (!priv->has_wep)
249 return -EOPNOTSUPP;
251 if (erq->pointer) {
252 /* We actually have a key to set - check its length */
253 if (erq->length > LARGE_KEY_SIZE)
254 return -E2BIG;
256 if ((erq->length > SMALL_KEY_SIZE) && !priv->has_big_wep)
257 return -E2BIG;
260 if (orinoco_lock(priv, &flags) != 0)
261 return -EBUSY;
263 /* Clear any TKIP key we have */
264 if ((priv->has_wpa) && (priv->encode_alg == ORINOCO_ALG_TKIP))
265 (void) orinoco_clear_tkip_key(priv, setindex);
267 if (erq->length > 0) {
268 if ((index < 0) || (index >= ORINOCO_MAX_KEYS))
269 index = priv->tx_key;
271 /* Switch on WEP if off */
272 if (encode_alg != ORINOCO_ALG_WEP) {
273 setindex = index;
274 encode_alg = ORINOCO_ALG_WEP;
276 } else {
277 /* Important note : if the user do "iwconfig eth0 enc off",
278 * we will arrive there with an index of -1. This is valid
279 * but need to be taken care off... Jean II */
280 if ((index < 0) || (index >= ORINOCO_MAX_KEYS)) {
281 if ((index != -1) || (erq->flags == 0)) {
282 err = -EINVAL;
283 goto out;
285 } else {
286 /* Set the index : Check that the key is valid */
287 if (priv->keys[index].key_len == 0) {
288 err = -EINVAL;
289 goto out;
291 setindex = index;
295 if (erq->flags & IW_ENCODE_DISABLED)
296 encode_alg = ORINOCO_ALG_NONE;
297 if (erq->flags & IW_ENCODE_OPEN)
298 restricted = 0;
299 if (erq->flags & IW_ENCODE_RESTRICTED)
300 restricted = 1;
302 if (erq->pointer && erq->length > 0) {
303 err = orinoco_set_key(priv, index, ORINOCO_ALG_WEP, keybuf,
304 erq->length, NULL, 0);
306 priv->tx_key = setindex;
308 /* Try fast key change if connected and only keys are changed */
309 if ((priv->encode_alg == encode_alg) &&
310 (priv->wep_restrict == restricted) &&
311 netif_carrier_ok(dev)) {
312 err = __orinoco_hw_setup_wepkeys(priv);
313 /* No need to commit if successful */
314 goto out;
317 priv->encode_alg = encode_alg;
318 priv->wep_restrict = restricted;
320 out:
321 orinoco_unlock(priv, &flags);
323 return err;
326 static int orinoco_ioctl_getiwencode(struct net_device *dev,
327 struct iw_request_info *info,
328 struct iw_point *erq,
329 char *keybuf)
331 struct orinoco_private *priv = ndev_priv(dev);
332 int index = (erq->flags & IW_ENCODE_INDEX) - 1;
333 unsigned long flags;
335 if (!priv->has_wep)
336 return -EOPNOTSUPP;
338 if (orinoco_lock(priv, &flags) != 0)
339 return -EBUSY;
341 if ((index < 0) || (index >= ORINOCO_MAX_KEYS))
342 index = priv->tx_key;
344 erq->flags = 0;
345 if (!priv->encode_alg)
346 erq->flags |= IW_ENCODE_DISABLED;
347 erq->flags |= index + 1;
349 if (priv->wep_restrict)
350 erq->flags |= IW_ENCODE_RESTRICTED;
351 else
352 erq->flags |= IW_ENCODE_OPEN;
354 erq->length = priv->keys[index].key_len;
356 memcpy(keybuf, priv->keys[index].key, erq->length);
358 orinoco_unlock(priv, &flags);
359 return 0;
362 static int orinoco_ioctl_setessid(struct net_device *dev,
363 struct iw_request_info *info,
364 struct iw_point *erq,
365 char *essidbuf)
367 struct orinoco_private *priv = ndev_priv(dev);
368 unsigned long flags;
370 /* Note : ESSID is ignored in Ad-Hoc demo mode, but we can set it
371 * anyway... - Jean II */
373 /* Hum... Should not use Wireless Extension constant (may change),
374 * should use our own... - Jean II */
375 if (erq->length > IW_ESSID_MAX_SIZE)
376 return -E2BIG;
378 if (orinoco_lock(priv, &flags) != 0)
379 return -EBUSY;
381 /* NULL the string (for NULL termination & ESSID = ANY) - Jean II */
382 memset(priv->desired_essid, 0, sizeof(priv->desired_essid));
384 /* If not ANY, get the new ESSID */
385 if (erq->flags)
386 memcpy(priv->desired_essid, essidbuf, erq->length);
388 orinoco_unlock(priv, &flags);
390 return -EINPROGRESS; /* Call commit handler */
393 static int orinoco_ioctl_getessid(struct net_device *dev,
394 struct iw_request_info *info,
395 struct iw_point *erq,
396 char *essidbuf)
398 struct orinoco_private *priv = ndev_priv(dev);
399 int active;
400 int err = 0;
401 unsigned long flags;
403 if (netif_running(dev)) {
404 err = orinoco_hw_get_essid(priv, &active, essidbuf);
405 if (err < 0)
406 return err;
407 erq->length = err;
408 } else {
409 if (orinoco_lock(priv, &flags) != 0)
410 return -EBUSY;
411 memcpy(essidbuf, priv->desired_essid, IW_ESSID_MAX_SIZE);
412 erq->length = strlen(priv->desired_essid);
413 orinoco_unlock(priv, &flags);
416 erq->flags = 1;
418 return 0;
421 static int orinoco_ioctl_setfreq(struct net_device *dev,
422 struct iw_request_info *info,
423 struct iw_freq *frq,
424 char *extra)
426 struct orinoco_private *priv = ndev_priv(dev);
427 int chan = -1;
428 unsigned long flags;
429 int err = -EINPROGRESS; /* Call commit handler */
431 /* In infrastructure mode the AP sets the channel */
432 if (priv->iw_mode == NL80211_IFTYPE_STATION)
433 return -EBUSY;
435 if ((frq->e == 0) && (frq->m <= 1000)) {
436 /* Setting by channel number */
437 chan = frq->m;
438 } else {
439 /* Setting by frequency */
440 int denom = 1;
441 int i;
443 /* Calculate denominator to rescale to MHz */
444 for (i = 0; i < (6 - frq->e); i++)
445 denom *= 10;
447 chan = ieee80211_freq_to_dsss_chan(frq->m / denom);
450 if ((chan < 1) || (chan > NUM_CHANNELS) ||
451 !(priv->channel_mask & (1 << (chan-1))))
452 return -EINVAL;
454 if (orinoco_lock(priv, &flags) != 0)
455 return -EBUSY;
457 priv->channel = chan;
458 if (priv->iw_mode == NL80211_IFTYPE_MONITOR) {
459 /* Fast channel change - no commit if successful */
460 hermes_t *hw = &priv->hw;
461 err = hermes_docmd_wait(hw, HERMES_CMD_TEST |
462 HERMES_TEST_SET_CHANNEL,
463 chan, NULL);
465 orinoco_unlock(priv, &flags);
467 return err;
470 static int orinoco_ioctl_getfreq(struct net_device *dev,
471 struct iw_request_info *info,
472 struct iw_freq *frq,
473 char *extra)
475 struct orinoco_private *priv = ndev_priv(dev);
476 int tmp;
478 /* Locking done in there */
479 tmp = orinoco_hw_get_freq(priv);
480 if (tmp < 0)
481 return tmp;
483 frq->m = tmp * 100000;
484 frq->e = 1;
486 return 0;
489 static int orinoco_ioctl_getsens(struct net_device *dev,
490 struct iw_request_info *info,
491 struct iw_param *srq,
492 char *extra)
494 struct orinoco_private *priv = ndev_priv(dev);
495 hermes_t *hw = &priv->hw;
496 u16 val;
497 int err;
498 unsigned long flags;
500 if (!priv->has_sensitivity)
501 return -EOPNOTSUPP;
503 if (orinoco_lock(priv, &flags) != 0)
504 return -EBUSY;
505 err = hermes_read_wordrec(hw, USER_BAP,
506 HERMES_RID_CNFSYSTEMSCALE, &val);
507 orinoco_unlock(priv, &flags);
509 if (err)
510 return err;
512 srq->value = val;
513 srq->fixed = 0; /* auto */
515 return 0;
518 static int orinoco_ioctl_setsens(struct net_device *dev,
519 struct iw_request_info *info,
520 struct iw_param *srq,
521 char *extra)
523 struct orinoco_private *priv = ndev_priv(dev);
524 int val = srq->value;
525 unsigned long flags;
527 if (!priv->has_sensitivity)
528 return -EOPNOTSUPP;
530 if ((val < 1) || (val > 3))
531 return -EINVAL;
533 if (orinoco_lock(priv, &flags) != 0)
534 return -EBUSY;
535 priv->ap_density = val;
536 orinoco_unlock(priv, &flags);
538 return -EINPROGRESS; /* Call commit handler */
541 static int orinoco_ioctl_setrts(struct net_device *dev,
542 struct iw_request_info *info,
543 struct iw_param *rrq,
544 char *extra)
546 struct orinoco_private *priv = ndev_priv(dev);
547 int val = rrq->value;
548 unsigned long flags;
550 if (rrq->disabled)
551 val = 2347;
553 if ((val < 0) || (val > 2347))
554 return -EINVAL;
556 if (orinoco_lock(priv, &flags) != 0)
557 return -EBUSY;
559 priv->rts_thresh = val;
560 orinoco_unlock(priv, &flags);
562 return -EINPROGRESS; /* Call commit handler */
565 static int orinoco_ioctl_getrts(struct net_device *dev,
566 struct iw_request_info *info,
567 struct iw_param *rrq,
568 char *extra)
570 struct orinoco_private *priv = ndev_priv(dev);
572 rrq->value = priv->rts_thresh;
573 rrq->disabled = (rrq->value == 2347);
574 rrq->fixed = 1;
576 return 0;
579 static int orinoco_ioctl_setfrag(struct net_device *dev,
580 struct iw_request_info *info,
581 struct iw_param *frq,
582 char *extra)
584 struct orinoco_private *priv = ndev_priv(dev);
585 int err = -EINPROGRESS; /* Call commit handler */
586 unsigned long flags;
588 if (orinoco_lock(priv, &flags) != 0)
589 return -EBUSY;
591 if (priv->has_mwo) {
592 if (frq->disabled)
593 priv->mwo_robust = 0;
594 else {
595 if (frq->fixed)
596 printk(KERN_WARNING "%s: Fixed fragmentation "
597 "is not supported on this firmware. "
598 "Using MWO robust instead.\n",
599 dev->name);
600 priv->mwo_robust = 1;
602 } else {
603 if (frq->disabled)
604 priv->frag_thresh = 2346;
605 else {
606 if ((frq->value < 256) || (frq->value > 2346))
607 err = -EINVAL;
608 else
609 /* must be even */
610 priv->frag_thresh = frq->value & ~0x1;
614 orinoco_unlock(priv, &flags);
616 return err;
619 static int orinoco_ioctl_getfrag(struct net_device *dev,
620 struct iw_request_info *info,
621 struct iw_param *frq,
622 char *extra)
624 struct orinoco_private *priv = ndev_priv(dev);
625 hermes_t *hw = &priv->hw;
626 int err;
627 u16 val;
628 unsigned long flags;
630 if (orinoco_lock(priv, &flags) != 0)
631 return -EBUSY;
633 if (priv->has_mwo) {
634 err = hermes_read_wordrec(hw, USER_BAP,
635 HERMES_RID_CNFMWOROBUST_AGERE,
636 &val);
637 if (err)
638 val = 0;
640 frq->value = val ? 2347 : 0;
641 frq->disabled = !val;
642 frq->fixed = 0;
643 } else {
644 err = hermes_read_wordrec(hw, USER_BAP,
645 HERMES_RID_CNFFRAGMENTATIONTHRESHOLD,
646 &val);
647 if (err)
648 val = 0;
650 frq->value = val;
651 frq->disabled = (val >= 2346);
652 frq->fixed = 1;
655 orinoco_unlock(priv, &flags);
657 return err;
660 static int orinoco_ioctl_setrate(struct net_device *dev,
661 struct iw_request_info *info,
662 struct iw_param *rrq,
663 char *extra)
665 struct orinoco_private *priv = ndev_priv(dev);
666 int ratemode;
667 int bitrate; /* 100s of kilobits */
668 unsigned long flags;
670 /* As the user space doesn't know our highest rate, it uses -1
671 * to ask us to set the highest rate. Test it using "iwconfig
672 * ethX rate auto" - Jean II */
673 if (rrq->value == -1)
674 bitrate = 110;
675 else {
676 if (rrq->value % 100000)
677 return -EINVAL;
678 bitrate = rrq->value / 100000;
681 ratemode = orinoco_get_bitratemode(bitrate, !rrq->fixed);
683 if (ratemode == -1)
684 return -EINVAL;
686 if (orinoco_lock(priv, &flags) != 0)
687 return -EBUSY;
688 priv->bitratemode = ratemode;
689 orinoco_unlock(priv, &flags);
691 return -EINPROGRESS;
694 static int orinoco_ioctl_getrate(struct net_device *dev,
695 struct iw_request_info *info,
696 struct iw_param *rrq,
697 char *extra)
699 struct orinoco_private *priv = ndev_priv(dev);
700 int err = 0;
701 int bitrate, automatic;
702 unsigned long flags;
704 if (orinoco_lock(priv, &flags) != 0)
705 return -EBUSY;
707 orinoco_get_ratemode_cfg(priv->bitratemode, &bitrate, &automatic);
709 /* If the interface is running we try to find more about the
710 current mode */
711 if (netif_running(dev))
712 err = orinoco_hw_get_act_bitrate(priv, &bitrate);
714 orinoco_unlock(priv, &flags);
716 rrq->value = bitrate;
717 rrq->fixed = !automatic;
718 rrq->disabled = 0;
720 return err;
723 static int orinoco_ioctl_setpower(struct net_device *dev,
724 struct iw_request_info *info,
725 struct iw_param *prq,
726 char *extra)
728 struct orinoco_private *priv = ndev_priv(dev);
729 int err = -EINPROGRESS; /* Call commit handler */
730 unsigned long flags;
732 if (orinoco_lock(priv, &flags) != 0)
733 return -EBUSY;
735 if (prq->disabled) {
736 priv->pm_on = 0;
737 } else {
738 switch (prq->flags & IW_POWER_MODE) {
739 case IW_POWER_UNICAST_R:
740 priv->pm_mcast = 0;
741 priv->pm_on = 1;
742 break;
743 case IW_POWER_ALL_R:
744 priv->pm_mcast = 1;
745 priv->pm_on = 1;
746 break;
747 case IW_POWER_ON:
748 /* No flags : but we may have a value - Jean II */
749 break;
750 default:
751 err = -EINVAL;
752 goto out;
755 if (prq->flags & IW_POWER_TIMEOUT) {
756 priv->pm_on = 1;
757 priv->pm_timeout = prq->value / 1000;
759 if (prq->flags & IW_POWER_PERIOD) {
760 priv->pm_on = 1;
761 priv->pm_period = prq->value / 1000;
763 /* It's valid to not have a value if we are just toggling
764 * the flags... Jean II */
765 if (!priv->pm_on) {
766 err = -EINVAL;
767 goto out;
771 out:
772 orinoco_unlock(priv, &flags);
774 return err;
777 static int orinoco_ioctl_getpower(struct net_device *dev,
778 struct iw_request_info *info,
779 struct iw_param *prq,
780 char *extra)
782 struct orinoco_private *priv = ndev_priv(dev);
783 hermes_t *hw = &priv->hw;
784 int err = 0;
785 u16 enable, period, timeout, mcast;
786 unsigned long flags;
788 if (orinoco_lock(priv, &flags) != 0)
789 return -EBUSY;
791 err = hermes_read_wordrec(hw, USER_BAP,
792 HERMES_RID_CNFPMENABLED, &enable);
793 if (err)
794 goto out;
796 err = hermes_read_wordrec(hw, USER_BAP,
797 HERMES_RID_CNFMAXSLEEPDURATION, &period);
798 if (err)
799 goto out;
801 err = hermes_read_wordrec(hw, USER_BAP,
802 HERMES_RID_CNFPMHOLDOVERDURATION, &timeout);
803 if (err)
804 goto out;
806 err = hermes_read_wordrec(hw, USER_BAP,
807 HERMES_RID_CNFMULTICASTRECEIVE, &mcast);
808 if (err)
809 goto out;
811 prq->disabled = !enable;
812 /* Note : by default, display the period */
813 if ((prq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
814 prq->flags = IW_POWER_TIMEOUT;
815 prq->value = timeout * 1000;
816 } else {
817 prq->flags = IW_POWER_PERIOD;
818 prq->value = period * 1000;
820 if (mcast)
821 prq->flags |= IW_POWER_ALL_R;
822 else
823 prq->flags |= IW_POWER_UNICAST_R;
825 out:
826 orinoco_unlock(priv, &flags);
828 return err;
831 static int orinoco_ioctl_set_encodeext(struct net_device *dev,
832 struct iw_request_info *info,
833 union iwreq_data *wrqu,
834 char *extra)
836 struct orinoco_private *priv = ndev_priv(dev);
837 struct iw_point *encoding = &wrqu->encoding;
838 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
839 int idx, alg = ext->alg, set_key = 1;
840 unsigned long flags;
841 int err = -EINVAL;
843 if (orinoco_lock(priv, &flags) != 0)
844 return -EBUSY;
846 /* Determine and validate the key index */
847 idx = encoding->flags & IW_ENCODE_INDEX;
848 if (idx) {
849 if ((idx < 1) || (idx > 4))
850 goto out;
851 idx--;
852 } else
853 idx = priv->tx_key;
855 if (encoding->flags & IW_ENCODE_DISABLED)
856 alg = IW_ENCODE_ALG_NONE;
858 if (priv->has_wpa && (alg != IW_ENCODE_ALG_TKIP)) {
859 /* Clear any TKIP TX key we had */
860 (void) orinoco_clear_tkip_key(priv, priv->tx_key);
863 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
864 priv->tx_key = idx;
865 set_key = ((alg == IW_ENCODE_ALG_TKIP) ||
866 (ext->key_len > 0)) ? 1 : 0;
869 if (set_key) {
870 /* Set the requested key first */
871 switch (alg) {
872 case IW_ENCODE_ALG_NONE:
873 priv->encode_alg = ORINOCO_ALG_NONE;
874 err = orinoco_set_key(priv, idx, ORINOCO_ALG_NONE,
875 NULL, 0, NULL, 0);
876 break;
878 case IW_ENCODE_ALG_WEP:
879 if (ext->key_len <= 0)
880 goto out;
882 priv->encode_alg = ORINOCO_ALG_WEP;
883 err = orinoco_set_key(priv, idx, ORINOCO_ALG_WEP,
884 ext->key, ext->key_len, NULL, 0);
885 break;
887 case IW_ENCODE_ALG_TKIP:
889 u8 *tkip_iv = NULL;
891 if (!priv->has_wpa ||
892 (ext->key_len > sizeof(struct orinoco_tkip_key)))
893 goto out;
895 priv->encode_alg = ORINOCO_ALG_TKIP;
897 if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID)
898 tkip_iv = &ext->rx_seq[0];
900 err = orinoco_set_key(priv, idx, ORINOCO_ALG_TKIP,
901 ext->key, ext->key_len, tkip_iv,
902 ORINOCO_SEQ_LEN);
904 err = __orinoco_hw_set_tkip_key(priv, idx,
905 ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY,
906 priv->keys[idx].key,
907 tkip_iv, ORINOCO_SEQ_LEN, NULL, 0);
908 if (err)
909 printk(KERN_ERR "%s: Error %d setting TKIP key"
910 "\n", dev->name, err);
912 goto out;
914 default:
915 goto out;
918 err = -EINPROGRESS;
919 out:
920 orinoco_unlock(priv, &flags);
922 return err;
925 static int orinoco_ioctl_get_encodeext(struct net_device *dev,
926 struct iw_request_info *info,
927 union iwreq_data *wrqu,
928 char *extra)
930 struct orinoco_private *priv = ndev_priv(dev);
931 struct iw_point *encoding = &wrqu->encoding;
932 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
933 int idx, max_key_len;
934 unsigned long flags;
935 int err;
937 if (orinoco_lock(priv, &flags) != 0)
938 return -EBUSY;
940 err = -EINVAL;
941 max_key_len = encoding->length - sizeof(*ext);
942 if (max_key_len < 0)
943 goto out;
945 idx = encoding->flags & IW_ENCODE_INDEX;
946 if (idx) {
947 if ((idx < 1) || (idx > 4))
948 goto out;
949 idx--;
950 } else
951 idx = priv->tx_key;
953 encoding->flags = idx + 1;
954 memset(ext, 0, sizeof(*ext));
956 switch (priv->encode_alg) {
957 case ORINOCO_ALG_NONE:
958 ext->alg = IW_ENCODE_ALG_NONE;
959 ext->key_len = 0;
960 encoding->flags |= IW_ENCODE_DISABLED;
961 break;
962 case ORINOCO_ALG_WEP:
963 ext->alg = IW_ENCODE_ALG_WEP;
964 ext->key_len = min(priv->keys[idx].key_len, max_key_len);
965 memcpy(ext->key, priv->keys[idx].key, ext->key_len);
966 encoding->flags |= IW_ENCODE_ENABLED;
967 break;
968 case ORINOCO_ALG_TKIP:
969 ext->alg = IW_ENCODE_ALG_TKIP;
970 ext->key_len = min(priv->keys[idx].key_len, max_key_len);
971 memcpy(ext->key, priv->keys[idx].key, ext->key_len);
972 encoding->flags |= IW_ENCODE_ENABLED;
973 break;
976 err = 0;
977 out:
978 orinoco_unlock(priv, &flags);
980 return err;
983 static int orinoco_ioctl_set_auth(struct net_device *dev,
984 struct iw_request_info *info,
985 union iwreq_data *wrqu, char *extra)
987 struct orinoco_private *priv = ndev_priv(dev);
988 hermes_t *hw = &priv->hw;
989 struct iw_param *param = &wrqu->param;
990 unsigned long flags;
991 int ret = -EINPROGRESS;
993 if (orinoco_lock(priv, &flags) != 0)
994 return -EBUSY;
996 switch (param->flags & IW_AUTH_INDEX) {
997 case IW_AUTH_WPA_VERSION:
998 case IW_AUTH_CIPHER_PAIRWISE:
999 case IW_AUTH_CIPHER_GROUP:
1000 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
1001 case IW_AUTH_PRIVACY_INVOKED:
1002 case IW_AUTH_DROP_UNENCRYPTED:
1004 * orinoco does not use these parameters
1006 break;
1008 case IW_AUTH_KEY_MGMT:
1009 /* wl_lkm implies value 2 == PSK for Hermes I
1010 * which ties in with WEXT
1011 * no other hints tho :(
1013 priv->key_mgmt = param->value;
1014 break;
1016 case IW_AUTH_TKIP_COUNTERMEASURES:
1017 /* When countermeasures are enabled, shut down the
1018 * card; when disabled, re-enable the card. This must
1019 * take effect immediately.
1021 * TODO: Make sure that the EAPOL message is getting
1022 * out before card disabled
1024 if (param->value) {
1025 priv->tkip_cm_active = 1;
1026 ret = hermes_enable_port(hw, 0);
1027 } else {
1028 priv->tkip_cm_active = 0;
1029 ret = hermes_disable_port(hw, 0);
1031 break;
1033 case IW_AUTH_80211_AUTH_ALG:
1034 if (param->value & IW_AUTH_ALG_SHARED_KEY)
1035 priv->wep_restrict = 1;
1036 else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM)
1037 priv->wep_restrict = 0;
1038 else
1039 ret = -EINVAL;
1040 break;
1042 case IW_AUTH_WPA_ENABLED:
1043 if (priv->has_wpa) {
1044 priv->wpa_enabled = param->value ? 1 : 0;
1045 } else {
1046 if (param->value)
1047 ret = -EOPNOTSUPP;
1048 /* else silently accept disable of WPA */
1049 priv->wpa_enabled = 0;
1051 break;
1053 default:
1054 ret = -EOPNOTSUPP;
1057 orinoco_unlock(priv, &flags);
1058 return ret;
1061 static int orinoco_ioctl_get_auth(struct net_device *dev,
1062 struct iw_request_info *info,
1063 union iwreq_data *wrqu, char *extra)
1065 struct orinoco_private *priv = ndev_priv(dev);
1066 struct iw_param *param = &wrqu->param;
1067 unsigned long flags;
1068 int ret = 0;
1070 if (orinoco_lock(priv, &flags) != 0)
1071 return -EBUSY;
1073 switch (param->flags & IW_AUTH_INDEX) {
1074 case IW_AUTH_KEY_MGMT:
1075 param->value = priv->key_mgmt;
1076 break;
1078 case IW_AUTH_TKIP_COUNTERMEASURES:
1079 param->value = priv->tkip_cm_active;
1080 break;
1082 case IW_AUTH_80211_AUTH_ALG:
1083 if (priv->wep_restrict)
1084 param->value = IW_AUTH_ALG_SHARED_KEY;
1085 else
1086 param->value = IW_AUTH_ALG_OPEN_SYSTEM;
1087 break;
1089 case IW_AUTH_WPA_ENABLED:
1090 param->value = priv->wpa_enabled;
1091 break;
1093 default:
1094 ret = -EOPNOTSUPP;
1097 orinoco_unlock(priv, &flags);
1098 return ret;
1101 static int orinoco_ioctl_set_genie(struct net_device *dev,
1102 struct iw_request_info *info,
1103 union iwreq_data *wrqu, char *extra)
1105 struct orinoco_private *priv = ndev_priv(dev);
1106 u8 *buf;
1107 unsigned long flags;
1109 /* cut off at IEEE80211_MAX_DATA_LEN */
1110 if ((wrqu->data.length > IEEE80211_MAX_DATA_LEN) ||
1111 (wrqu->data.length && (extra == NULL)))
1112 return -EINVAL;
1114 if (wrqu->data.length) {
1115 buf = kmalloc(wrqu->data.length, GFP_KERNEL);
1116 if (buf == NULL)
1117 return -ENOMEM;
1119 memcpy(buf, extra, wrqu->data.length);
1120 } else
1121 buf = NULL;
1123 if (orinoco_lock(priv, &flags) != 0) {
1124 kfree(buf);
1125 return -EBUSY;
1128 kfree(priv->wpa_ie);
1129 priv->wpa_ie = buf;
1130 priv->wpa_ie_len = wrqu->data.length;
1132 if (priv->wpa_ie) {
1133 /* Looks like wl_lkm wants to check the auth alg, and
1134 * somehow pass it to the firmware.
1135 * Instead it just calls the key mgmt rid
1136 * - we do this in set auth.
1140 orinoco_unlock(priv, &flags);
1141 return 0;
1144 static int orinoco_ioctl_get_genie(struct net_device *dev,
1145 struct iw_request_info *info,
1146 union iwreq_data *wrqu, char *extra)
1148 struct orinoco_private *priv = ndev_priv(dev);
1149 unsigned long flags;
1150 int err = 0;
1152 if (orinoco_lock(priv, &flags) != 0)
1153 return -EBUSY;
1155 if ((priv->wpa_ie_len == 0) || (priv->wpa_ie == NULL)) {
1156 wrqu->data.length = 0;
1157 goto out;
1160 if (wrqu->data.length < priv->wpa_ie_len) {
1161 err = -E2BIG;
1162 goto out;
1165 wrqu->data.length = priv->wpa_ie_len;
1166 memcpy(extra, priv->wpa_ie, priv->wpa_ie_len);
1168 out:
1169 orinoco_unlock(priv, &flags);
1170 return err;
1173 static int orinoco_ioctl_set_mlme(struct net_device *dev,
1174 struct iw_request_info *info,
1175 union iwreq_data *wrqu, char *extra)
1177 struct orinoco_private *priv = ndev_priv(dev);
1178 struct iw_mlme *mlme = (struct iw_mlme *)extra;
1179 unsigned long flags;
1180 int ret = 0;
1182 if (orinoco_lock(priv, &flags) != 0)
1183 return -EBUSY;
1185 switch (mlme->cmd) {
1186 case IW_MLME_DEAUTH:
1187 /* silently ignore */
1188 break;
1190 case IW_MLME_DISASSOC:
1192 ret = orinoco_hw_disassociate(priv, mlme->addr.sa_data,
1193 mlme->reason_code);
1194 break;
1196 default:
1197 ret = -EOPNOTSUPP;
1200 orinoco_unlock(priv, &flags);
1201 return ret;
1204 static int orinoco_ioctl_getretry(struct net_device *dev,
1205 struct iw_request_info *info,
1206 struct iw_param *rrq,
1207 char *extra)
1209 struct orinoco_private *priv = ndev_priv(dev);
1210 hermes_t *hw = &priv->hw;
1211 int err = 0;
1212 u16 short_limit, long_limit, lifetime;
1213 unsigned long flags;
1215 if (orinoco_lock(priv, &flags) != 0)
1216 return -EBUSY;
1218 err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORTRETRYLIMIT,
1219 &short_limit);
1220 if (err)
1221 goto out;
1223 err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_LONGRETRYLIMIT,
1224 &long_limit);
1225 if (err)
1226 goto out;
1228 err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_MAXTRANSMITLIFETIME,
1229 &lifetime);
1230 if (err)
1231 goto out;
1233 rrq->disabled = 0; /* Can't be disabled */
1235 /* Note : by default, display the retry number */
1236 if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
1237 rrq->flags = IW_RETRY_LIFETIME;
1238 rrq->value = lifetime * 1000; /* ??? */
1239 } else {
1240 /* By default, display the min number */
1241 if ((rrq->flags & IW_RETRY_LONG)) {
1242 rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
1243 rrq->value = long_limit;
1244 } else {
1245 rrq->flags = IW_RETRY_LIMIT;
1246 rrq->value = short_limit;
1247 if (short_limit != long_limit)
1248 rrq->flags |= IW_RETRY_SHORT;
1252 out:
1253 orinoco_unlock(priv, &flags);
1255 return err;
1258 static int orinoco_ioctl_reset(struct net_device *dev,
1259 struct iw_request_info *info,
1260 void *wrqu,
1261 char *extra)
1263 struct orinoco_private *priv = ndev_priv(dev);
1265 if (!capable(CAP_NET_ADMIN))
1266 return -EPERM;
1268 if (info->cmd == (SIOCIWFIRSTPRIV + 0x1)) {
1269 printk(KERN_DEBUG "%s: Forcing reset!\n", dev->name);
1271 /* Firmware reset */
1272 orinoco_reset(&priv->reset_work);
1273 } else {
1274 printk(KERN_DEBUG "%s: Force scheduling reset!\n", dev->name);
1276 schedule_work(&priv->reset_work);
1279 return 0;
1282 static int orinoco_ioctl_setibssport(struct net_device *dev,
1283 struct iw_request_info *info,
1284 void *wrqu,
1285 char *extra)
1288 struct orinoco_private *priv = ndev_priv(dev);
1289 int val = *((int *) extra);
1290 unsigned long flags;
1292 if (orinoco_lock(priv, &flags) != 0)
1293 return -EBUSY;
1295 priv->ibss_port = val;
1297 /* Actually update the mode we are using */
1298 set_port_type(priv);
1300 orinoco_unlock(priv, &flags);
1301 return -EINPROGRESS; /* Call commit handler */
1304 static int orinoco_ioctl_getibssport(struct net_device *dev,
1305 struct iw_request_info *info,
1306 void *wrqu,
1307 char *extra)
1309 struct orinoco_private *priv = ndev_priv(dev);
1310 int *val = (int *) extra;
1312 *val = priv->ibss_port;
1313 return 0;
1316 static int orinoco_ioctl_setport3(struct net_device *dev,
1317 struct iw_request_info *info,
1318 void *wrqu,
1319 char *extra)
1321 struct orinoco_private *priv = ndev_priv(dev);
1322 int val = *((int *) extra);
1323 int err = 0;
1324 unsigned long flags;
1326 if (orinoco_lock(priv, &flags) != 0)
1327 return -EBUSY;
1329 switch (val) {
1330 case 0: /* Try to do IEEE ad-hoc mode */
1331 if (!priv->has_ibss) {
1332 err = -EINVAL;
1333 break;
1335 priv->prefer_port3 = 0;
1337 break;
1339 case 1: /* Try to do Lucent proprietary ad-hoc mode */
1340 if (!priv->has_port3) {
1341 err = -EINVAL;
1342 break;
1344 priv->prefer_port3 = 1;
1345 break;
1347 default:
1348 err = -EINVAL;
1351 if (!err) {
1352 /* Actually update the mode we are using */
1353 set_port_type(priv);
1354 err = -EINPROGRESS;
1357 orinoco_unlock(priv, &flags);
1359 return err;
1362 static int orinoco_ioctl_getport3(struct net_device *dev,
1363 struct iw_request_info *info,
1364 void *wrqu,
1365 char *extra)
1367 struct orinoco_private *priv = ndev_priv(dev);
1368 int *val = (int *) extra;
1370 *val = priv->prefer_port3;
1371 return 0;
1374 static int orinoco_ioctl_setpreamble(struct net_device *dev,
1375 struct iw_request_info *info,
1376 void *wrqu,
1377 char *extra)
1379 struct orinoco_private *priv = ndev_priv(dev);
1380 unsigned long flags;
1381 int val;
1383 if (!priv->has_preamble)
1384 return -EOPNOTSUPP;
1386 /* 802.11b has recently defined some short preamble.
1387 * Basically, the Phy header has been reduced in size.
1388 * This increase performance, especially at high rates
1389 * (the preamble is transmitted at 1Mb/s), unfortunately
1390 * this give compatibility troubles... - Jean II */
1391 val = *((int *) extra);
1393 if (orinoco_lock(priv, &flags) != 0)
1394 return -EBUSY;
1396 if (val)
1397 priv->preamble = 1;
1398 else
1399 priv->preamble = 0;
1401 orinoco_unlock(priv, &flags);
1403 return -EINPROGRESS; /* Call commit handler */
1406 static int orinoco_ioctl_getpreamble(struct net_device *dev,
1407 struct iw_request_info *info,
1408 void *wrqu,
1409 char *extra)
1411 struct orinoco_private *priv = ndev_priv(dev);
1412 int *val = (int *) extra;
1414 if (!priv->has_preamble)
1415 return -EOPNOTSUPP;
1417 *val = priv->preamble;
1418 return 0;
1421 /* ioctl interface to hermes_read_ltv()
1422 * To use with iwpriv, pass the RID as the token argument, e.g.
1423 * iwpriv get_rid [0xfc00]
1424 * At least Wireless Tools 25 is required to use iwpriv.
1425 * For Wireless Tools 25 and 26 append "dummy" are the end. */
1426 static int orinoco_ioctl_getrid(struct net_device *dev,
1427 struct iw_request_info *info,
1428 struct iw_point *data,
1429 char *extra)
1431 struct orinoco_private *priv = ndev_priv(dev);
1432 hermes_t *hw = &priv->hw;
1433 int rid = data->flags;
1434 u16 length;
1435 int err;
1436 unsigned long flags;
1438 /* It's a "get" function, but we don't want users to access the
1439 * WEP key and other raw firmware data */
1440 if (!capable(CAP_NET_ADMIN))
1441 return -EPERM;
1443 if (rid < 0xfc00 || rid > 0xffff)
1444 return -EINVAL;
1446 if (orinoco_lock(priv, &flags) != 0)
1447 return -EBUSY;
1449 err = hermes_read_ltv(hw, USER_BAP, rid, MAX_RID_LEN, &length,
1450 extra);
1451 if (err)
1452 goto out;
1454 data->length = min_t(u16, HERMES_RECLEN_TO_BYTES(length),
1455 MAX_RID_LEN);
1457 out:
1458 orinoco_unlock(priv, &flags);
1459 return err;
1463 /* Commit handler, called after set operations */
1464 static int orinoco_ioctl_commit(struct net_device *dev,
1465 struct iw_request_info *info,
1466 void *wrqu,
1467 char *extra)
1469 struct orinoco_private *priv = ndev_priv(dev);
1470 unsigned long flags;
1471 int err = 0;
1473 if (!priv->open)
1474 return 0;
1476 if (orinoco_lock(priv, &flags) != 0)
1477 return err;
1479 err = orinoco_commit(priv);
1481 orinoco_unlock(priv, &flags);
1482 return err;
1485 static const struct iw_priv_args orinoco_privtab[] = {
1486 { SIOCIWFIRSTPRIV + 0x0, 0, 0, "force_reset" },
1487 { SIOCIWFIRSTPRIV + 0x1, 0, 0, "card_reset" },
1488 { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1489 0, "set_port3" },
1490 { SIOCIWFIRSTPRIV + 0x3, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1491 "get_port3" },
1492 { SIOCIWFIRSTPRIV + 0x4, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1493 0, "set_preamble" },
1494 { SIOCIWFIRSTPRIV + 0x5, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1495 "get_preamble" },
1496 { SIOCIWFIRSTPRIV + 0x6, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1497 0, "set_ibssport" },
1498 { SIOCIWFIRSTPRIV + 0x7, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1499 "get_ibssport" },
1500 { SIOCIWFIRSTPRIV + 0x9, 0, IW_PRIV_TYPE_BYTE | MAX_RID_LEN,
1501 "get_rid" },
1506 * Structures to export the Wireless Handlers
1509 #define STD_IW_HANDLER(id, func) \
1510 [IW_IOCTL_IDX(id)] = (iw_handler) func
1511 static const iw_handler orinoco_handler[] = {
1512 STD_IW_HANDLER(SIOCSIWCOMMIT, orinoco_ioctl_commit),
1513 STD_IW_HANDLER(SIOCGIWNAME, cfg80211_wext_giwname),
1514 STD_IW_HANDLER(SIOCSIWFREQ, orinoco_ioctl_setfreq),
1515 STD_IW_HANDLER(SIOCGIWFREQ, orinoco_ioctl_getfreq),
1516 STD_IW_HANDLER(SIOCSIWMODE, cfg80211_wext_siwmode),
1517 STD_IW_HANDLER(SIOCGIWMODE, cfg80211_wext_giwmode),
1518 STD_IW_HANDLER(SIOCSIWSENS, orinoco_ioctl_setsens),
1519 STD_IW_HANDLER(SIOCGIWSENS, orinoco_ioctl_getsens),
1520 STD_IW_HANDLER(SIOCGIWRANGE, cfg80211_wext_giwrange),
1521 STD_IW_HANDLER(SIOCSIWSPY, iw_handler_set_spy),
1522 STD_IW_HANDLER(SIOCGIWSPY, iw_handler_get_spy),
1523 STD_IW_HANDLER(SIOCSIWTHRSPY, iw_handler_set_thrspy),
1524 STD_IW_HANDLER(SIOCGIWTHRSPY, iw_handler_get_thrspy),
1525 STD_IW_HANDLER(SIOCSIWAP, orinoco_ioctl_setwap),
1526 STD_IW_HANDLER(SIOCGIWAP, orinoco_ioctl_getwap),
1527 STD_IW_HANDLER(SIOCSIWSCAN, cfg80211_wext_siwscan),
1528 STD_IW_HANDLER(SIOCGIWSCAN, cfg80211_wext_giwscan),
1529 STD_IW_HANDLER(SIOCSIWESSID, orinoco_ioctl_setessid),
1530 STD_IW_HANDLER(SIOCGIWESSID, orinoco_ioctl_getessid),
1531 STD_IW_HANDLER(SIOCSIWRATE, orinoco_ioctl_setrate),
1532 STD_IW_HANDLER(SIOCGIWRATE, orinoco_ioctl_getrate),
1533 STD_IW_HANDLER(SIOCSIWRTS, orinoco_ioctl_setrts),
1534 STD_IW_HANDLER(SIOCGIWRTS, orinoco_ioctl_getrts),
1535 STD_IW_HANDLER(SIOCSIWFRAG, orinoco_ioctl_setfrag),
1536 STD_IW_HANDLER(SIOCGIWFRAG, orinoco_ioctl_getfrag),
1537 STD_IW_HANDLER(SIOCGIWRETRY, orinoco_ioctl_getretry),
1538 STD_IW_HANDLER(SIOCSIWENCODE, orinoco_ioctl_setiwencode),
1539 STD_IW_HANDLER(SIOCGIWENCODE, orinoco_ioctl_getiwencode),
1540 STD_IW_HANDLER(SIOCSIWPOWER, orinoco_ioctl_setpower),
1541 STD_IW_HANDLER(SIOCGIWPOWER, orinoco_ioctl_getpower),
1542 STD_IW_HANDLER(SIOCSIWGENIE, orinoco_ioctl_set_genie),
1543 STD_IW_HANDLER(SIOCGIWGENIE, orinoco_ioctl_get_genie),
1544 STD_IW_HANDLER(SIOCSIWMLME, orinoco_ioctl_set_mlme),
1545 STD_IW_HANDLER(SIOCSIWAUTH, orinoco_ioctl_set_auth),
1546 STD_IW_HANDLER(SIOCGIWAUTH, orinoco_ioctl_get_auth),
1547 STD_IW_HANDLER(SIOCSIWENCODEEXT, orinoco_ioctl_set_encodeext),
1548 STD_IW_HANDLER(SIOCGIWENCODEEXT, orinoco_ioctl_get_encodeext),
1553 Added typecasting since we no longer use iwreq_data -- Moustafa
1555 static const iw_handler orinoco_private_handler[] = {
1556 [0] = (iw_handler) orinoco_ioctl_reset,
1557 [1] = (iw_handler) orinoco_ioctl_reset,
1558 [2] = (iw_handler) orinoco_ioctl_setport3,
1559 [3] = (iw_handler) orinoco_ioctl_getport3,
1560 [4] = (iw_handler) orinoco_ioctl_setpreamble,
1561 [5] = (iw_handler) orinoco_ioctl_getpreamble,
1562 [6] = (iw_handler) orinoco_ioctl_setibssport,
1563 [7] = (iw_handler) orinoco_ioctl_getibssport,
1564 [9] = (iw_handler) orinoco_ioctl_getrid,
1567 const struct iw_handler_def orinoco_handler_def = {
1568 .num_standard = ARRAY_SIZE(orinoco_handler),
1569 .num_private = ARRAY_SIZE(orinoco_private_handler),
1570 .num_private_args = ARRAY_SIZE(orinoco_privtab),
1571 .standard = orinoco_handler,
1572 .private = orinoco_private_handler,
1573 .private_args = orinoco_privtab,
1574 .get_wireless_stats = orinoco_get_wireless_stats,