3 * Copyright (C) 2002 Intersil Americas Inc.
4 * (C) 2003,2004 Aurelien Alleaume <slts@free.fr>
5 * (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
6 * (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <linux/version.h>
24 #include <linux/module.h>
25 #include <linux/kernel.h>
26 #include <linux/if_arp.h>
27 #include <linux/pci.h>
29 #include <asm/uaccess.h>
31 #include "prismcompat.h"
32 #include "isl_ioctl.h"
33 #include "islpci_mgt.h"
34 #include "isl_oid.h" /* additional types and defs for isl38xx fw */
37 #include <net/iw_handler.h> /* New driver API */
39 static int init_mode = CARD_DEFAULT_IW_MODE;
40 static int init_channel = CARD_DEFAULT_CHANNEL;
41 static int init_wep = CARD_DEFAULT_WEP;
42 static int init_filter = CARD_DEFAULT_FILTER;
43 static int init_authen = CARD_DEFAULT_AUTHEN;
44 static int init_dot1x = CARD_DEFAULT_DOT1X;
45 static int init_conformance = CARD_DEFAULT_CONFORMANCE;
46 static int init_mlme = CARD_DEFAULT_MLME_MODE;
48 module_param(init_mode, int, 0);
49 MODULE_PARM_DESC(init_mode,
50 "Set card mode:\n0: Auto\n1: Ad-Hoc\n2: Managed Client (Default)\n3: Master / Access Point\n4: Repeater (Not supported yet)\n5: Secondary (Not supported yet)\n6: Monitor");
52 module_param(init_channel, int, 0);
53 MODULE_PARM_DESC(init_channel,
54 "Check `iwpriv ethx channel` for available channels");
56 module_param(init_wep, int, 0);
57 module_param(init_filter, int, 0);
59 module_param(init_authen, int, 0);
60 MODULE_PARM_DESC(init_authen,
61 "Authentication method. Can be of seven types:\n0 0x0000: None\n1 0x0001: DOT11_AUTH_OS (Default)\n2 0x0002: DOT11_AUTH_SK\n3 0x0003: DOT11_AUTH_BOTH");
63 module_param(init_dot1x, int, 0);
64 MODULE_PARM_DESC(init_dot1x,
65 "\n0: None/not set (Default)\n1: DOT11_DOT1X_AUTHENABLED\n2: DOT11_DOT1X_KEYTXENABLED");
67 module_param(init_mlme, int, 0);
68 MODULE_PARM_DESC(init_mlme,
69 "Sets the MAC layer management entity (MLME) mode of operation,\n0: DOT11_MLME_AUTO (Default)\n1: DOT11_MLME_INTERMEDIATE\n2: DOT11_MLME_EXTENDED");
72 * prism54_mib_mode_helper - MIB change mode helper function
73 * @mib: the &struct islpci_mib object to modify
74 * @iw_mode: new mode (%IW_MODE_*)
76 * This is a helper function, hence it does not lock. Make sure
77 * caller deals with locking *if* necessary. This function sets the
78 * mode-dependent mib values and does the mapping of the Linux
79 * Wireless API modes to Device firmware modes. It also checks for
80 * correct valid Linux wireless modes.
83 prism54_mib_mode_helper(islpci_private *priv, u32 iw_mode)
85 u32 config = INL_CONFIG_MANUALRUN;
88 /* For now, just catch early the Repeater and Secondary modes here */
89 if (iw_mode == IW_MODE_REPEAT || iw_mode == IW_MODE_SECOND) {
91 "%s(): Sorry, Repeater mode and Secondary mode "
92 "are not yet supported by this driver.\n", __FUNCTION__);
96 priv->iw_mode = iw_mode;
100 mode = INL_MODE_CLIENT;
101 bsstype = DOT11_BSSTYPE_ANY;
104 mode = INL_MODE_CLIENT;
105 bsstype = DOT11_BSSTYPE_IBSS;
108 mode = INL_MODE_CLIENT;
109 bsstype = DOT11_BSSTYPE_INFRA;
113 bsstype = DOT11_BSSTYPE_INFRA;
115 case IW_MODE_MONITOR:
116 mode = INL_MODE_PROMISCUOUS;
117 bsstype = DOT11_BSSTYPE_ANY;
118 config |= INL_CONFIG_RXANNEX;
125 config |= INL_CONFIG_WDS;
126 mgt_set(priv, DOT11_OID_BSSTYPE, &bsstype);
127 mgt_set(priv, OID_INL_CONFIG, &config);
128 mgt_set(priv, OID_INL_MODE, &mode);
134 * prism54_mib_init - fill MIB cache with defaults
136 * this function initializes the struct given as @mib with defaults,
137 * of which many are retrieved from the global module parameter
142 prism54_mib_init(islpci_private *priv)
145 struct obj_buffer psm_buffer = {
146 .size = PSM_BUFFER_SIZE,
147 .addr = priv->device_psm_buffer
150 mgt_set(priv, DOT11_OID_CHANNEL, &init_channel);
151 mgt_set(priv, DOT11_OID_AUTHENABLE, &init_authen);
152 mgt_set(priv, DOT11_OID_PRIVACYINVOKED, &init_wep);
154 mgt_set(priv, DOT11_OID_PSMBUFFER, &psm_buffer);
155 mgt_set(priv, DOT11_OID_EXUNENCRYPTED, &init_filter);
156 mgt_set(priv, DOT11_OID_DOT1XENABLE, &init_dot1x);
157 mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &init_mlme);
158 mgt_set(priv, OID_INL_DOT11D_CONFORMANCE, &init_conformance);
161 mgt_set(priv, OID_INL_OUTPUTPOWER, &t);
163 /* Important: we are setting a default wireless mode and we are
164 * forcing a valid one, so prism54_mib_mode_helper should just set
165 * mib values depending on what the wireless mode given is. No need
166 * for it save old values */
167 if (init_mode > IW_MODE_MONITOR || init_mode < IW_MODE_AUTO) {
168 printk(KERN_DEBUG "%s(): You passed a non-valid init_mode. "
169 "Using default mode\n", __FUNCTION__);
170 init_mode = CARD_DEFAULT_IW_MODE;
172 /* This sets all of the mode-dependent values */
173 prism54_mib_mode_helper(priv, init_mode);
176 /* this will be executed outside of atomic context thanks to
177 * schedule_work(), thus we can as well use sleeping semaphore
180 prism54_update_stats(islpci_private *priv)
184 struct obj_bss bss, *bss2;
187 if (down_interruptible(&priv->stats_sem))
191 * I'm not sure if the unit is dBm.
192 * Note : If we are not connected, this value seems to be irrelevant. */
194 mgt_get_request(priv, DOT11_OID_NOISEFLOOR, 0, NULL, &r);
195 priv->local_iwstatistics.qual.noise = r.u;
197 /* Get the rssi of the link. To do this we need to retrieve a bss. */
199 /* First get the MAC address of the AP we are associated with. */
200 mgt_get_request(priv, DOT11_OID_BSSID, 0, NULL, &r);
203 /* copy this MAC to the bss */
204 memcpy(bss.address, data, 6);
207 /* now ask for the corresponding bss */
208 j = mgt_get_request(priv, DOT11_OID_BSSFIND, 0, (void *) &bss, &r);
210 /* report the rssi and use it to calculate
211 * link quality through a signal-noise
213 priv->local_iwstatistics.qual.level = bss2->rssi;
214 priv->local_iwstatistics.qual.qual =
215 bss2->rssi - priv->iwstatistics.qual.noise;
219 /* report that the stats are new */
220 priv->local_iwstatistics.qual.updated = 0x7;
222 /* Rx : unable to decrypt the MPDU */
223 mgt_get_request(priv, DOT11_OID_PRIVRXFAILED, 0, NULL, &r);
224 priv->local_iwstatistics.discard.code = r.u;
226 /* Tx : Max MAC retries num reached */
227 mgt_get_request(priv, DOT11_OID_MPDUTXFAILED, 0, NULL, &r);
228 priv->local_iwstatistics.discard.retries = r.u;
230 up(&priv->stats_sem);
235 struct iw_statistics *
236 prism54_get_wireless_stats(struct net_device *ndev)
238 islpci_private *priv = netdev_priv(ndev);
240 /* If the stats are being updated return old data */
241 if (down_trylock(&priv->stats_sem) == 0) {
242 memcpy(&priv->iwstatistics, &priv->local_iwstatistics,
243 sizeof (struct iw_statistics));
244 /* They won't be marked updated for the next time */
245 priv->local_iwstatistics.qual.updated = 0;
246 up(&priv->stats_sem);
248 priv->iwstatistics.qual.updated = 0;
250 /* Update our wireless stats, but do not schedule to often
252 if ((priv->stats_timestamp == 0) ||
253 time_after(jiffies, priv->stats_timestamp + 1 * HZ)) {
254 schedule_work(&priv->stats_work);
255 priv->stats_timestamp = jiffies;
258 return &priv->iwstatistics;
262 prism54_commit(struct net_device *ndev, struct iw_request_info *info,
263 char *cwrq, char *extra)
265 islpci_private *priv = netdev_priv(ndev);
267 /* simply re-set the last set SSID, this should commit most stuff */
269 /* Commit in Monitor mode is not necessary, also setting essid
270 * in Monitor mode does not make sense and isn't allowed for this
271 * device's firmware */
272 if (priv->iw_mode != IW_MODE_MONITOR)
273 return mgt_set_request(priv, DOT11_OID_SSID, 0, NULL);
278 prism54_get_name(struct net_device *ndev, struct iw_request_info *info,
279 char *cwrq, char *extra)
281 islpci_private *priv = netdev_priv(ndev);
286 if (islpci_get_state(priv) < PRV_STATE_INIT) {
287 strncpy(cwrq, "NOT READY!", IFNAMSIZ);
290 rvalue = mgt_get_request(priv, OID_INL_PHYCAPABILITIES, 0, NULL, &r);
293 case INL_PHYCAP_5000MHZ:
294 capabilities = "IEEE 802.11a/b/g";
297 capabilities = "IEEE 802.11b/g - FAA Support";
299 case INL_PHYCAP_2400MHZ:
301 capabilities = "IEEE 802.11b/g"; /* Default */
304 strncpy(cwrq, capabilities, IFNAMSIZ);
309 prism54_set_freq(struct net_device *ndev, struct iw_request_info *info,
310 struct iw_freq *fwrq, char *extra)
312 islpci_private *priv = netdev_priv(ndev);
317 /* we have a channel number */
320 c = (fwrq->e == 1) ? channel_of_freq(fwrq->m / 100000) : 0;
322 rvalue = c ? mgt_set_request(priv, DOT11_OID_CHANNEL, 0, &c) : -EINVAL;
324 /* Call commit handler */
325 return (rvalue ? rvalue : -EINPROGRESS);
329 prism54_get_freq(struct net_device *ndev, struct iw_request_info *info,
330 struct iw_freq *fwrq, char *extra)
332 islpci_private *priv = netdev_priv(ndev);
336 rvalue = mgt_get_request(priv, DOT11_OID_CHANNEL, 0, NULL, &r);
338 rvalue |= mgt_get_request(priv, DOT11_OID_FREQUENCY, 0, NULL, &r);
346 prism54_set_mode(struct net_device *ndev, struct iw_request_info *info,
347 __u32 * uwrq, char *extra)
349 islpci_private *priv = netdev_priv(ndev);
350 u32 mlmeautolevel = CARD_DEFAULT_MLME_MODE;
352 /* Let's see if the user passed a valid Linux Wireless mode */
353 if (*uwrq > IW_MODE_MONITOR || *uwrq < IW_MODE_AUTO) {
355 "%s: %s() You passed a non-valid init_mode.\n",
356 priv->ndev->name, __FUNCTION__);
360 down_write(&priv->mib_sem);
362 if (prism54_mib_mode_helper(priv, *uwrq)) {
363 up_write(&priv->mib_sem);
367 /* the ACL code needs an intermediate mlmeautolevel. The wpa stuff an
370 if ((*uwrq == IW_MODE_MASTER) && (priv->acl.policy != MAC_POLICY_OPEN))
371 mlmeautolevel = DOT11_MLME_INTERMEDIATE;
373 mlmeautolevel = DOT11_MLME_EXTENDED;
375 mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &mlmeautolevel);
378 priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR)
379 ? priv->monitor_type : ARPHRD_ETHER;
380 up_write(&priv->mib_sem);
387 prism54_get_mode(struct net_device *ndev, struct iw_request_info *info,
388 __u32 * uwrq, char *extra)
390 islpci_private *priv = netdev_priv(ndev);
392 BUG_ON((priv->iw_mode < IW_MODE_AUTO) || (priv->iw_mode >
394 *uwrq = priv->iw_mode;
399 /* we use DOT11_OID_EDTHRESHOLD. From what I guess the card will not try to
400 * emit data if (sensitivity > rssi - noise) (in dBm).
401 * prism54_set_sens does not seem to work.
405 prism54_set_sens(struct net_device *ndev, struct iw_request_info *info,
406 struct iw_param *vwrq, char *extra)
408 islpci_private *priv = netdev_priv(ndev);
411 /* by default the card sets this to 20. */
412 sens = vwrq->disabled ? 20 : vwrq->value;
414 return mgt_set_request(priv, DOT11_OID_EDTHRESHOLD, 0, &sens);
418 prism54_get_sens(struct net_device *ndev, struct iw_request_info *info,
419 struct iw_param *vwrq, char *extra)
421 islpci_private *priv = netdev_priv(ndev);
425 rvalue = mgt_get_request(priv, DOT11_OID_EDTHRESHOLD, 0, NULL, &r);
428 vwrq->disabled = (vwrq->value == 0);
435 prism54_get_range(struct net_device *ndev, struct iw_request_info *info,
436 struct iw_point *dwrq, char *extra)
438 struct iw_range *range = (struct iw_range *) extra;
439 islpci_private *priv = netdev_priv(ndev);
442 struct obj_frequencies *freq;
445 memset(range, 0, sizeof (struct iw_range));
446 dwrq->length = sizeof (struct iw_range);
448 /* set the wireless extension version number */
449 range->we_version_source = SUPPORTED_WIRELESS_EXT;
450 range->we_version_compiled = WIRELESS_EXT;
452 /* Now the encoding capabilities */
453 range->num_encoding_sizes = 3;
454 /* 64(40) bits WEP */
455 range->encoding_size[0] = 5;
456 /* 128(104) bits WEP */
457 range->encoding_size[1] = 13;
458 /* 256 bits for WPA-PSK */
459 range->encoding_size[2] = 32;
460 /* 4 keys are allowed */
461 range->max_encoding_tokens = 4;
463 /* we don't know the quality range... */
464 range->max_qual.level = 0;
465 range->max_qual.noise = 0;
466 range->max_qual.qual = 0;
467 /* these value describe an average quality. Needs more tweaking... */
468 range->avg_qual.level = -80; /* -80 dBm */
469 range->avg_qual.noise = 0; /* don't know what to put here */
470 range->avg_qual.qual = 0;
472 range->sensitivity = 200;
474 /* retry limit capabilities */
475 range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;
476 range->retry_flags = IW_RETRY_LIMIT;
477 range->r_time_flags = IW_RETRY_LIFETIME;
479 /* I don't know the range. Put stupid things here */
480 range->min_retry = 1;
481 range->max_retry = 65535;
482 range->min_r_time = 1024;
483 range->max_r_time = 65535 * 1024;
485 /* txpower is supported in dBm's */
486 range->txpower_capa = IW_TXPOW_DBM;
488 if (islpci_get_state(priv) < PRV_STATE_INIT)
491 /* Request the device for the supported frequencies
492 * not really relevant since some devices will report the 5 GHz band
493 * frequencies even if they don't support them.
496 mgt_get_request(priv, DOT11_OID_SUPPORTEDFREQUENCIES, 0, NULL, &r);
499 range->num_channels = freq->nr;
500 range->num_frequency = freq->nr;
502 m = min(IW_MAX_FREQUENCIES, (int) freq->nr);
503 for (i = 0; i < m; i++) {
504 range->freq[i].m = freq->mhz[i];
505 range->freq[i].e = 6;
506 range->freq[i].i = channel_of_freq(freq->mhz[i]);
510 rvalue |= mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r);
513 /* We got an array of char. It is NULL terminated. */
515 while ((i < IW_MAX_BITRATES) && (*data != 0)) {
516 /* the result must be in bps. The card gives us 500Kbps */
517 range->bitrate[i] = *data * 500000;
521 range->num_bitrates = i;
530 prism54_set_wap(struct net_device *ndev, struct iw_request_info *info,
531 struct sockaddr *awrq, char *extra)
533 islpci_private *priv = netdev_priv(ndev);
537 if (awrq->sa_family != ARPHRD_ETHER)
540 /* prepare the structure for the set object */
541 memcpy(&bssid[0], awrq->sa_data, 6);
543 /* set the bssid -- does this make sense when in AP mode? */
544 rvalue = mgt_set_request(priv, DOT11_OID_BSSID, 0, &bssid);
546 return (rvalue ? rvalue : -EINPROGRESS); /* Call commit handler */
552 prism54_get_wap(struct net_device *ndev, struct iw_request_info *info,
553 struct sockaddr *awrq, char *extra)
555 islpci_private *priv = netdev_priv(ndev);
559 rvalue = mgt_get_request(priv, DOT11_OID_BSSID, 0, NULL, &r);
560 memcpy(awrq->sa_data, r.ptr, 6);
561 awrq->sa_family = ARPHRD_ETHER;
568 prism54_set_scan(struct net_device *dev, struct iw_request_info *info,
569 struct iw_param *vwrq, char *extra)
571 /* hehe the device does this automagicaly */
575 /* a little helper that will translate our data into a card independent
576 * format that the Wireless Tools will understand. This was inspired by
577 * the "Aironet driver for 4500 and 4800 series cards" (GPL)
581 prism54_translate_bss(struct net_device *ndev, char *current_ev,
582 char *end_buf, struct obj_bss *bss, char noise)
584 struct iw_event iwe; /* Temporary buffer */
586 islpci_private *priv = netdev_priv(ndev);
588 /* The first entry must be the MAC address */
589 memcpy(iwe.u.ap_addr.sa_data, bss->address, 6);
590 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
593 iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
595 /* The following entries will be displayed in the same order we give them */
598 iwe.u.data.length = bss->ssid.length;
599 iwe.u.data.flags = 1;
600 iwe.cmd = SIOCGIWESSID;
601 current_ev = iwe_stream_add_point(current_ev, end_buf,
602 &iwe, bss->ssid.octets);
606 #define CAP_IBSS 0x02
607 #define CAP_CRYPT 0x10
613 iwe.u.mode = IW_MODE_MASTER;
614 else if (cap & CAP_IBSS)
615 iwe.u.mode = IW_MODE_ADHOC;
616 iwe.cmd = SIOCGIWMODE;
619 iwe_stream_add_event(current_ev, end_buf, &iwe,
622 /* Encryption capability */
624 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
626 iwe.u.data.flags = IW_ENCODE_DISABLED;
627 iwe.u.data.length = 0;
628 iwe.cmd = SIOCGIWENCODE;
629 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, NULL);
631 /* Add frequency. (short) bss->channel is the frequency in MHz */
632 iwe.u.freq.m = channel_of_freq(bss->channel);
634 iwe.cmd = SIOCGIWFREQ;
636 iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
638 /* Add quality statistics */
639 iwe.u.qual.level = bss->rssi;
640 iwe.u.qual.noise = noise;
641 /* do a simple SNR for quality */
642 iwe.u.qual.qual = bss->rssi - noise;
645 iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
648 u8 wpa_ie[MAX_WPA_IE_LEN];
653 wpa_ie_len = prism54_wpa_ie_get(priv, bss->address, wpa_ie);
654 if (wpa_ie_len > 0 &&
655 (buf = kmalloc(wpa_ie_len * 2 + 10, GFP_ATOMIC))) {
657 p += sprintf(p, "wpa_ie=");
658 for (i = 0; i < wpa_ie_len; i++) {
659 p += sprintf(p, "%02x", wpa_ie[i]);
661 memset(&iwe, 0, sizeof (iwe));
662 iwe.cmd = IWEVCUSTOM;
663 iwe.u.data.length = strlen(buf);
664 current_ev = iwe_stream_add_point(current_ev, end_buf,
673 prism54_get_scan(struct net_device *ndev, struct iw_request_info *info,
674 struct iw_point *dwrq, char *extra)
676 islpci_private *priv = netdev_priv(ndev);
678 struct obj_bsslist *bsslist;
680 char *current_ev = extra;
683 if (islpci_get_state(priv) < PRV_STATE_INIT) {
684 /* device is not ready, fail gently */
689 /* first get the noise value. We will use it to report the link quality */
690 rvalue = mgt_get_request(priv, DOT11_OID_NOISEFLOOR, 0, NULL, &r);
693 /* Ask the device for a list of known bss. We can report at most
694 * IW_MAX_AP=64 to the range struct. But the device won't repport anything
695 * if you change the value of IWMAX_BSS=24.
697 rvalue |= mgt_get_request(priv, DOT11_OID_BSSLIST, 0, NULL, &r);
700 /* ok now, scan the list and translate its info */
701 for (i = 0; i < min(IW_MAX_AP, (int) bsslist->nr); i++)
702 current_ev = prism54_translate_bss(ndev, current_ev,
703 extra + IW_SCAN_MAX_DATA,
704 &(bsslist->bsslist[i]),
707 dwrq->length = (current_ev - extra);
708 dwrq->flags = 0; /* todo */
714 prism54_set_essid(struct net_device *ndev, struct iw_request_info *info,
715 struct iw_point *dwrq, char *extra)
717 islpci_private *priv = netdev_priv(ndev);
718 struct obj_ssid essid;
720 memset(essid.octets, 0, 33);
722 /* Check if we were asked for `any' */
723 if (dwrq->flags && dwrq->length) {
724 if (dwrq->length > min(33, IW_ESSID_MAX_SIZE + 1))
726 essid.length = dwrq->length - 1;
727 memcpy(essid.octets, extra, dwrq->length);
731 if (priv->iw_mode != IW_MODE_MONITOR)
732 return mgt_set_request(priv, DOT11_OID_SSID, 0, &essid);
734 /* If in monitor mode, just save to mib */
735 mgt_set(priv, DOT11_OID_SSID, &essid);
741 prism54_get_essid(struct net_device *ndev, struct iw_request_info *info,
742 struct iw_point *dwrq, char *extra)
744 islpci_private *priv = netdev_priv(ndev);
745 struct obj_ssid *essid;
749 rvalue = mgt_get_request(priv, DOT11_OID_SSID, 0, NULL, &r);
753 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */
754 /* if it is to big, trunk it */
755 dwrq->length = min(IW_ESSID_MAX_SIZE, essid->length + 1);
760 essid->octets[essid->length] = '\0';
761 memcpy(extra, essid->octets, dwrq->length);
767 /* Provides no functionality, just completes the ioctl. In essence this is a
768 * just a cosmetic ioctl.
771 prism54_set_nick(struct net_device *ndev, struct iw_request_info *info,
772 struct iw_point *dwrq, char *extra)
774 islpci_private *priv = netdev_priv(ndev);
776 if (dwrq->length > IW_ESSID_MAX_SIZE)
779 down_write(&priv->mib_sem);
780 memset(priv->nickname, 0, sizeof (priv->nickname));
781 memcpy(priv->nickname, extra, dwrq->length);
782 up_write(&priv->mib_sem);
788 prism54_get_nick(struct net_device *ndev, struct iw_request_info *info,
789 struct iw_point *dwrq, char *extra)
791 islpci_private *priv = netdev_priv(ndev);
795 down_read(&priv->mib_sem);
796 dwrq->length = strlen(priv->nickname) + 1;
797 memcpy(extra, priv->nickname, dwrq->length);
798 up_read(&priv->mib_sem);
803 /* Set the allowed Bitrates */
806 prism54_set_rate(struct net_device *ndev,
807 struct iw_request_info *info,
808 struct iw_param *vwrq, char *extra)
811 islpci_private *priv = netdev_priv(ndev);
817 if (vwrq->value == -1) {
818 /* auto mode. No limit. */
820 return mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile);
823 ret = mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r);
829 rate = (u32) (vwrq->value / 500000);
834 if (rate && (data[i] == rate)) {
837 if (vwrq->value == i) {
852 /* Now, check if we want a fixed or auto value */
860 printk("prism54 rate: ");
862 printk("%u ", data[i]);
868 ret = mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile);
869 ret |= mgt_set_request(priv, DOT11_OID_EXTENDEDRATES, 0, data);
870 ret |= mgt_set_request(priv, DOT11_OID_RATES, 0, data);
877 /* Get the current bit rate */
879 prism54_get_rate(struct net_device *ndev,
880 struct iw_request_info *info,
881 struct iw_param *vwrq, char *extra)
883 islpci_private *priv = netdev_priv(ndev);
888 /* Get the current bit rate */
889 if ((rvalue = mgt_get_request(priv, GEN_OID_LINKSTATE, 0, NULL, &r)))
891 vwrq->value = r.u * 500000;
893 /* request the device for the enabled rates */
894 rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r);
900 vwrq->fixed = (data[0] != 0) && (data[1] == 0);
907 prism54_set_rts(struct net_device *ndev, struct iw_request_info *info,
908 struct iw_param *vwrq, char *extra)
910 islpci_private *priv = netdev_priv(ndev);
912 return mgt_set_request(priv, DOT11_OID_RTSTHRESH, 0, &vwrq->value);
916 prism54_get_rts(struct net_device *ndev, struct iw_request_info *info,
917 struct iw_param *vwrq, char *extra)
919 islpci_private *priv = netdev_priv(ndev);
923 /* get the rts threshold */
924 rvalue = mgt_get_request(priv, DOT11_OID_RTSTHRESH, 0, NULL, &r);
931 prism54_set_frag(struct net_device *ndev, struct iw_request_info *info,
932 struct iw_param *vwrq, char *extra)
934 islpci_private *priv = netdev_priv(ndev);
936 return mgt_set_request(priv, DOT11_OID_FRAGTHRESH, 0, &vwrq->value);
940 prism54_get_frag(struct net_device *ndev, struct iw_request_info *info,
941 struct iw_param *vwrq, char *extra)
943 islpci_private *priv = netdev_priv(ndev);
947 rvalue = mgt_get_request(priv, DOT11_OID_FRAGTHRESH, 0, NULL, &r);
953 /* Here we have (min,max) = max retries for (small frames, big frames). Where
954 * big frame <=> bigger than the rts threshold
955 * small frame <=> smaller than the rts threshold
956 * This is not really the behavior expected by the wireless tool but it seems
957 * to be a common behavior in other drivers.
961 prism54_set_retry(struct net_device *ndev, struct iw_request_info *info,
962 struct iw_param *vwrq, char *extra)
964 islpci_private *priv = netdev_priv(ndev);
965 u32 slimit = 0, llimit = 0; /* short and long limit */
970 /* we cannot disable this feature */
973 if (vwrq->flags & IW_RETRY_LIMIT) {
974 if (vwrq->flags & IW_RETRY_MIN)
975 slimit = vwrq->value;
976 else if (vwrq->flags & IW_RETRY_MAX)
977 llimit = vwrq->value;
979 /* we are asked to set both */
980 slimit = vwrq->value;
981 llimit = vwrq->value;
984 if (vwrq->flags & IW_RETRY_LIFETIME)
985 /* Wireless tools use us unit while the device uses 1024 us unit */
986 lifetime = vwrq->value / 1024;
988 /* now set what is requested */
991 mgt_set_request(priv, DOT11_OID_SHORTRETRIES, 0, &slimit);
994 mgt_set_request(priv, DOT11_OID_LONGRETRIES, 0, &llimit);
997 mgt_set_request(priv, DOT11_OID_MAXTXLIFETIME, 0,
1003 prism54_get_retry(struct net_device *ndev, struct iw_request_info *info,
1004 struct iw_param *vwrq, char *extra)
1006 islpci_private *priv = netdev_priv(ndev);
1009 vwrq->disabled = 0; /* It cannot be disabled */
1011 if ((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
1012 /* we are asked for the life time */
1014 mgt_get_request(priv, DOT11_OID_MAXTXLIFETIME, 0, NULL, &r);
1015 vwrq->value = r.u * 1024;
1016 vwrq->flags = IW_RETRY_LIFETIME;
1017 } else if ((vwrq->flags & IW_RETRY_MAX)) {
1018 /* we are asked for the long retry limit */
1020 mgt_get_request(priv, DOT11_OID_LONGRETRIES, 0, NULL, &r);
1022 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
1024 /* default. get the short retry limit */
1026 mgt_get_request(priv, DOT11_OID_SHORTRETRIES, 0, NULL, &r);
1028 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MIN;
1035 prism54_set_encode(struct net_device *ndev, struct iw_request_info *info,
1036 struct iw_point *dwrq, char *extra)
1038 islpci_private *priv = netdev_priv(ndev);
1039 int rvalue = 0, force = 0;
1040 int authen = DOT11_AUTH_OS, invoke = 0, exunencrypt = 0;
1043 /* with the new API, it's impossible to get a NULL pointer.
1044 * New version of iwconfig set the IW_ENCODE_NOKEY flag
1045 * when no key is given, but older versions don't. */
1047 if (dwrq->length > 0) {
1048 /* we have a key to set */
1049 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1051 struct obj_key key = { DOT11_PRIV_WEP, 0, "" };
1053 /* get the current key index */
1054 rvalue = mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r);
1055 current_index = r.u;
1056 /* Verify that the key is not marked as invalid */
1057 if (!(dwrq->flags & IW_ENCODE_NOKEY)) {
1058 key.length = dwrq->length > sizeof (key.key) ?
1059 sizeof (key.key) : dwrq->length;
1060 memcpy(key.key, extra, key.length);
1061 if (key.length == 32)
1062 /* we want WPA-PSK */
1063 key.type = DOT11_PRIV_TKIP;
1064 if ((index < 0) || (index > 3))
1065 /* no index provided use the current one */
1066 index = current_index;
1068 /* now send the key to the card */
1070 mgt_set_request(priv, DOT11_OID_DEFKEYX, index,
1074 * If a valid key is set, encryption should be enabled
1075 * (user may turn it off later).
1076 * This is also how "iwconfig ethX key on" works
1078 if ((index == current_index) && (key.length > 0))
1081 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1082 if ((index >= 0) && (index <= 3)) {
1083 /* we want to set the key index */
1085 mgt_set_request(priv, DOT11_OID_DEFKEYID, 0,
1088 if (!dwrq->flags & IW_ENCODE_MODE) {
1089 /* we cannot do anything. Complain. */
1094 /* now read the flags */
1095 if (dwrq->flags & IW_ENCODE_DISABLED) {
1096 /* Encoding disabled,
1097 * authen = DOT11_AUTH_OS;
1099 * exunencrypt = 0; */
1101 if (dwrq->flags & IW_ENCODE_OPEN)
1102 /* Encode but accept non-encoded packets. No auth */
1104 if ((dwrq->flags & IW_ENCODE_RESTRICTED) || force) {
1105 /* Refuse non-encoded packets. Auth */
1106 authen = DOT11_AUTH_BOTH;
1110 /* do the change if requested */
1111 if ((dwrq->flags & IW_ENCODE_MODE) || force) {
1113 mgt_set_request(priv, DOT11_OID_AUTHENABLE, 0, &authen);
1115 mgt_set_request(priv, DOT11_OID_PRIVACYINVOKED, 0, &invoke);
1117 mgt_set_request(priv, DOT11_OID_EXUNENCRYPTED, 0,
1124 prism54_get_encode(struct net_device *ndev, struct iw_request_info *info,
1125 struct iw_point *dwrq, char *extra)
1127 islpci_private *priv = netdev_priv(ndev);
1128 struct obj_key *key;
1129 u32 devindex, index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1130 u32 authen = 0, invoke = 0, exunencrypt = 0;
1134 /* first get the flags */
1135 rvalue = mgt_get_request(priv, DOT11_OID_AUTHENABLE, 0, NULL, &r);
1137 rvalue |= mgt_get_request(priv, DOT11_OID_PRIVACYINVOKED, 0, NULL, &r);
1139 rvalue |= mgt_get_request(priv, DOT11_OID_EXUNENCRYPTED, 0, NULL, &r);
1142 if (invoke && (authen == DOT11_AUTH_BOTH) && exunencrypt)
1143 dwrq->flags = IW_ENCODE_RESTRICTED;
1144 else if ((authen == DOT11_AUTH_OS) && !exunencrypt) {
1146 dwrq->flags = IW_ENCODE_OPEN;
1148 dwrq->flags = IW_ENCODE_DISABLED;
1150 /* The card should not work in this state */
1153 /* get the current device key index */
1154 rvalue |= mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r);
1156 /* Now get the key, return it */
1157 if ((index < 0) || (index > 3))
1158 /* no index provided, use the current one */
1160 rvalue |= mgt_get_request(priv, DOT11_OID_DEFKEYX, index, NULL, &r);
1162 dwrq->length = key->length;
1163 memcpy(extra, key->key, dwrq->length);
1165 /* return the used key index */
1166 dwrq->flags |= devindex + 1;
1172 prism54_get_txpower(struct net_device *ndev, struct iw_request_info *info,
1173 struct iw_param *vwrq, char *extra)
1175 islpci_private *priv = netdev_priv(ndev);
1179 rvalue = mgt_get_request(priv, OID_INL_OUTPUTPOWER, 0, NULL, &r);
1180 /* intersil firmware operates in 0.25 dBm (1/4 dBm) */
1181 vwrq->value = (s32) r.u / 4;
1183 /* radio is not turned of
1184 * btw: how is possible to turn off only the radio
1192 prism54_set_txpower(struct net_device *ndev, struct iw_request_info *info,
1193 struct iw_param *vwrq, char *extra)
1195 islpci_private *priv = netdev_priv(ndev);
1196 s32 u = vwrq->value;
1198 /* intersil firmware operates in 0.25 dBm (1/4) */
1200 if (vwrq->disabled) {
1201 /* don't know how to disable radio */
1203 "%s: %s() disabling radio is not yet supported.\n",
1204 priv->ndev->name, __FUNCTION__);
1206 } else if (vwrq->fixed)
1207 /* currently only fixed value is supported */
1208 return mgt_set_request(priv, OID_INL_OUTPUTPOWER, 0, &u);
1211 "%s: %s() auto power will be implemented later.\n",
1212 priv->ndev->name, __FUNCTION__);
1218 prism54_reset(struct net_device *ndev, struct iw_request_info *info,
1219 __u32 * uwrq, char *extra)
1221 islpci_reset(netdev_priv(ndev), 0);
1227 prism54_get_oid(struct net_device *ndev, struct iw_request_info *info,
1228 struct iw_point *dwrq, char *extra)
1232 enum oid_num_t n = dwrq->flags;
1234 rvalue = mgt_get_request((islpci_private *) ndev->priv, n, 0, NULL, &r);
1235 dwrq->length = mgt_response_to_str(n, &r, extra);
1236 if ((isl_oid[n].flags & OID_FLAG_TYPE) != OID_TYPE_U32)
1242 prism54_set_u32(struct net_device *ndev, struct iw_request_info *info,
1243 __u32 * uwrq, char *extra)
1245 u32 oid = uwrq[0], u = uwrq[1];
1247 return mgt_set_request((islpci_private *) ndev->priv, oid, 0, &u);
1251 prism54_set_raw(struct net_device *ndev, struct iw_request_info *info,
1252 struct iw_point *dwrq, char *extra)
1254 u32 oid = dwrq->flags;
1256 return mgt_set_request((islpci_private *) ndev->priv, oid, 0, extra);
1260 prism54_acl_init(struct islpci_acl *acl)
1262 sema_init(&acl->sem, 1);
1263 INIT_LIST_HEAD(&acl->mac_list);
1265 acl->policy = MAC_POLICY_OPEN;
1269 prism54_clear_mac(struct islpci_acl *acl)
1271 struct list_head *ptr, *next;
1272 struct mac_entry *entry;
1274 if (down_interruptible(&acl->sem))
1277 if (acl->size == 0) {
1282 for (ptr = acl->mac_list.next, next = ptr->next;
1283 ptr != &acl->mac_list; ptr = next, next = ptr->next) {
1284 entry = list_entry(ptr, struct mac_entry, _list);
1293 prism54_acl_clean(struct islpci_acl *acl)
1295 prism54_clear_mac(acl);
1299 prism54_add_mac(struct net_device *ndev, struct iw_request_info *info,
1300 struct sockaddr *awrq, char *extra)
1302 islpci_private *priv = netdev_priv(ndev);
1303 struct islpci_acl *acl = &priv->acl;
1304 struct mac_entry *entry;
1305 struct sockaddr *addr = (struct sockaddr *) extra;
1307 if (addr->sa_family != ARPHRD_ETHER)
1310 entry = kmalloc(sizeof (struct mac_entry), GFP_KERNEL);
1314 memcpy(entry->addr, addr->sa_data, ETH_ALEN);
1316 if (down_interruptible(&acl->sem)) {
1318 return -ERESTARTSYS;
1320 list_add_tail(&entry->_list, &acl->mac_list);
1328 prism54_del_mac(struct net_device *ndev, struct iw_request_info *info,
1329 struct sockaddr *awrq, char *extra)
1331 islpci_private *priv = netdev_priv(ndev);
1332 struct islpci_acl *acl = &priv->acl;
1333 struct mac_entry *entry;
1334 struct list_head *ptr;
1335 struct sockaddr *addr = (struct sockaddr *) extra;
1337 if (addr->sa_family != ARPHRD_ETHER)
1340 if (down_interruptible(&acl->sem))
1341 return -ERESTARTSYS;
1342 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
1343 entry = list_entry(ptr, struct mac_entry, _list);
1345 if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) {
1358 prism54_get_mac(struct net_device *ndev, struct iw_request_info *info,
1359 struct iw_point *dwrq, char *extra)
1361 islpci_private *priv = netdev_priv(ndev);
1362 struct islpci_acl *acl = &priv->acl;
1363 struct mac_entry *entry;
1364 struct list_head *ptr;
1365 struct sockaddr *dst = (struct sockaddr *) extra;
1369 if (down_interruptible(&acl->sem))
1370 return -ERESTARTSYS;
1372 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
1373 entry = list_entry(ptr, struct mac_entry, _list);
1375 memcpy(dst->sa_data, entry->addr, ETH_ALEN);
1376 dst->sa_family = ARPHRD_ETHER;
1384 /* Setting policy also clears the MAC acl, even if we don't change the defaut
1389 prism54_set_policy(struct net_device *ndev, struct iw_request_info *info,
1390 __u32 * uwrq, char *extra)
1392 islpci_private *priv = netdev_priv(ndev);
1393 struct islpci_acl *acl = &priv->acl;
1396 prism54_clear_mac(acl);
1398 if ((*uwrq < MAC_POLICY_OPEN) || (*uwrq > MAC_POLICY_REJECT))
1401 down_write(&priv->mib_sem);
1403 acl->policy = *uwrq;
1405 /* the ACL code needs an intermediate mlmeautolevel */
1406 if ((priv->iw_mode == IW_MODE_MASTER) &&
1407 (acl->policy != MAC_POLICY_OPEN))
1408 mlmeautolevel = DOT11_MLME_INTERMEDIATE;
1410 mlmeautolevel = CARD_DEFAULT_MLME_MODE;
1412 mlmeautolevel = DOT11_MLME_EXTENDED;
1413 mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &mlmeautolevel);
1414 /* restart the card with our new policy */
1416 up_write(&priv->mib_sem);
1422 prism54_get_policy(struct net_device *ndev, struct iw_request_info *info,
1423 __u32 * uwrq, char *extra)
1425 islpci_private *priv = netdev_priv(ndev);
1426 struct islpci_acl *acl = &priv->acl;
1428 *uwrq = acl->policy;
1433 /* Return 1 only if client should be accepted. */
1436 prism54_mac_accept(struct islpci_acl *acl, char *mac)
1438 struct list_head *ptr;
1439 struct mac_entry *entry;
1442 if (down_interruptible(&acl->sem))
1443 return -ERESTARTSYS;
1445 if (acl->policy == MAC_POLICY_OPEN) {
1450 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
1451 entry = list_entry(ptr, struct mac_entry, _list);
1452 if (memcmp(entry->addr, mac, ETH_ALEN) == 0) {
1457 res = (acl->policy == MAC_POLICY_ACCEPT) ? !res : res;
1464 prism54_kick_all(struct net_device *ndev, struct iw_request_info *info,
1465 struct iw_point *dwrq, char *extra)
1467 struct obj_mlme *mlme;
1470 mlme = kmalloc(sizeof (struct obj_mlme), GFP_KERNEL);
1474 /* Tell the card to kick every client */
1477 mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
1484 prism54_kick_mac(struct net_device *ndev, struct iw_request_info *info,
1485 struct sockaddr *awrq, char *extra)
1487 struct obj_mlme *mlme;
1488 struct sockaddr *addr = (struct sockaddr *) extra;
1491 if (addr->sa_family != ARPHRD_ETHER)
1494 mlme = kmalloc(sizeof (struct obj_mlme), GFP_KERNEL);
1498 /* Tell the card to only kick the corresponding bastard */
1499 memcpy(mlme->address, addr->sa_data, ETH_ALEN);
1502 mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
1509 /* Translate a TRAP oid into a wireless event. Called in islpci_mgt_receive. */
1512 format_event(islpci_private *priv, char *dest, const char *str,
1513 const struct obj_mlme *mlme, u16 *length, int error)
1515 const u8 *a = mlme->address;
1516 int n = snprintf(dest, IW_CUSTOM_MAX,
1517 "%s %s %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X %s (%2.2X)",
1519 ((priv->iw_mode == IW_MODE_MASTER) ? "from" : "to"),
1520 a[0], a[1], a[2], a[3], a[4], a[5],
1521 (error ? (mlme->code ? " : REJECTED " : " : ACCEPTED ")
1523 BUG_ON(n > IW_CUSTOM_MAX);
1528 send_formatted_event(islpci_private *priv, const char *str,
1529 const struct obj_mlme *mlme, int error)
1531 union iwreq_data wrqu;
1533 wrqu.data.pointer = kmalloc(IW_CUSTOM_MAX, GFP_KERNEL);
1534 if (!wrqu.data.pointer)
1536 wrqu.data.length = 0;
1537 format_event(priv, wrqu.data.pointer, str, mlme, &wrqu.data.length,
1539 wireless_send_event(priv->ndev, IWEVCUSTOM, &wrqu, wrqu.data.pointer);
1540 kfree(wrqu.data.pointer);
1544 send_simple_event(islpci_private *priv, const char *str)
1546 union iwreq_data wrqu;
1547 int n = strlen(str);
1549 wrqu.data.pointer = kmalloc(IW_CUSTOM_MAX, GFP_KERNEL);
1550 if (!wrqu.data.pointer)
1552 BUG_ON(n > IW_CUSTOM_MAX);
1553 wrqu.data.length = n;
1554 strcpy(wrqu.data.pointer, str);
1555 wireless_send_event(priv->ndev, IWEVCUSTOM, &wrqu, wrqu.data.pointer);
1556 kfree(wrqu.data.pointer);
1560 link_changed(struct net_device *ndev, u32 bitrate)
1562 islpci_private *priv = netdev_priv(ndev);
1565 if (priv->iw_mode == IW_MODE_INFRA) {
1566 union iwreq_data uwrq;
1567 prism54_get_wap(ndev, NULL, (struct sockaddr *) &uwrq,
1569 wireless_send_event(ndev, SIOCGIWAP, &uwrq, NULL);
1571 send_simple_event(netdev_priv(ndev),
1572 "Link established");
1574 send_simple_event(netdev_priv(ndev), "Link lost");
1577 /* Beacon/ProbeResp payload header */
1578 struct ieee80211_beacon_phdr {
1582 } __attribute__ ((packed));
1584 #define WLAN_EID_GENERIC 0xdd
1585 static u8 wpa_oid[4] = { 0x00, 0x50, 0xf2, 1 };
1587 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
1588 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
1591 prism54_wpa_ie_add(islpci_private *priv, u8 *bssid,
1592 u8 *wpa_ie, size_t wpa_ie_len)
1594 struct list_head *ptr;
1595 struct islpci_bss_wpa_ie *bss = NULL;
1597 if (wpa_ie_len > MAX_WPA_IE_LEN)
1598 wpa_ie_len = MAX_WPA_IE_LEN;
1600 if (down_interruptible(&priv->wpa_sem))
1603 /* try to use existing entry */
1604 list_for_each(ptr, &priv->bss_wpa_list) {
1605 bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
1606 if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0) {
1607 list_move(&bss->list, &priv->bss_wpa_list);
1614 /* add a new BSS entry; if max number of entries is already
1615 * reached, replace the least recently updated */
1616 if (priv->num_bss_wpa >= MAX_BSS_WPA_IE_COUNT) {
1617 bss = list_entry(priv->bss_wpa_list.prev,
1618 struct islpci_bss_wpa_ie, list);
1619 list_del(&bss->list);
1621 bss = kmalloc(sizeof (*bss), GFP_ATOMIC);
1623 priv->num_bss_wpa++;
1624 memset(bss, 0, sizeof (*bss));
1628 memcpy(bss->bssid, bssid, ETH_ALEN);
1629 list_add(&bss->list, &priv->bss_wpa_list);
1634 memcpy(bss->wpa_ie, wpa_ie, wpa_ie_len);
1635 bss->wpa_ie_len = wpa_ie_len;
1636 bss->last_update = jiffies;
1638 printk(KERN_DEBUG "Failed to add BSS WPA entry for " MACSTR
1639 "\n", MAC2STR(bssid));
1642 /* expire old entries from WPA list */
1643 while (priv->num_bss_wpa > 0) {
1644 bss = list_entry(priv->bss_wpa_list.prev,
1645 struct islpci_bss_wpa_ie, list);
1646 if (!time_after(jiffies, bss->last_update + 60 * HZ))
1649 list_del(&bss->list);
1650 priv->num_bss_wpa--;
1658 prism54_wpa_ie_get(islpci_private *priv, u8 *bssid, u8 *wpa_ie)
1660 struct list_head *ptr;
1661 struct islpci_bss_wpa_ie *bss = NULL;
1664 if (down_interruptible(&priv->wpa_sem))
1667 list_for_each(ptr, &priv->bss_wpa_list) {
1668 bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
1669 if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0)
1674 len = bss->wpa_ie_len;
1675 memcpy(wpa_ie, bss->wpa_ie, len);
1683 prism54_wpa_ie_init(islpci_private *priv)
1685 INIT_LIST_HEAD(&priv->bss_wpa_list);
1686 sema_init(&priv->wpa_sem, 1);
1690 prism54_wpa_ie_clean(islpci_private *priv)
1692 struct list_head *ptr, *n;
1694 list_for_each_safe(ptr, n, &priv->bss_wpa_list) {
1695 struct islpci_bss_wpa_ie *bss;
1696 bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
1702 prism54_process_bss_data(islpci_private *priv, u32 oid, u8 *addr,
1703 u8 *payload, size_t len)
1705 struct ieee80211_beacon_phdr *hdr;
1711 hdr = (struct ieee80211_beacon_phdr *) payload;
1712 pos = (u8 *) (hdr + 1);
1713 end = payload + len;
1715 if (pos + 2 + pos[1] > end) {
1716 printk(KERN_DEBUG "Parsing Beacon/ProbeResp failed "
1717 "for " MACSTR "\n", MAC2STR(addr));
1720 if (pos[0] == WLAN_EID_GENERIC && pos[1] >= 4 &&
1721 memcmp(pos + 2, wpa_oid, 4) == 0) {
1722 prism54_wpa_ie_add(priv, addr, pos, pos[1] + 2);
1730 handle_request(islpci_private *priv, struct obj_mlme *mlme, enum oid_num_t oid)
1732 if (((mlme->state == DOT11_STATE_AUTHING) ||
1733 (mlme->state == DOT11_STATE_ASSOCING))
1734 && mgt_mlme_answer(priv)) {
1735 /* Someone is requesting auth and we must respond. Just send back
1736 * the trap with error code set accordingly.
1738 mlme->code = prism54_mac_accept(&priv->acl,
1739 mlme->address) ? 0 : 1;
1740 mgt_set_request(priv, oid, 0, mlme);
1745 prism54_process_trap_helper(islpci_private *priv, enum oid_num_t oid,
1748 struct obj_mlme *mlme = (struct obj_mlme *) data;
1750 u8 *payload, *pos = (u8 *) (mlme + 1);
1752 len = pos[0] | (pos[1] << 8); /* little endian data length */
1755 /* I think all trapable objects are listed here.
1756 * Some oids have a EX version. The difference is that they are emitted
1757 * in DOT11_MLME_EXTENDED mode (set with DOT11_OID_MLMEAUTOLEVEL)
1759 * The few events already defined by the wireless tools are not really
1760 * suited. We use the more flexible custom event facility.
1763 /* I fear prism54_process_bss_data won't work with big endian data */
1764 if ((oid == DOT11_OID_BEACON) || (oid == DOT11_OID_PROBE))
1765 prism54_process_bss_data(priv, oid, mlme->address,
1768 mgt_le_to_cpu(isl_oid[oid].flags & OID_FLAG_TYPE, (void *) mlme);
1772 case GEN_OID_LINKSTATE:
1773 link_changed(priv->ndev, (u32) *data);
1776 case DOT11_OID_MICFAILURE:
1777 send_simple_event(priv, "Mic failure");
1780 case DOT11_OID_DEAUTHENTICATE:
1781 send_formatted_event(priv, "DeAuthenticate request", mlme, 0);
1784 case DOT11_OID_AUTHENTICATE:
1785 handle_request(priv, mlme, oid);
1786 send_formatted_event(priv, "Authenticate request", mlme, 1);
1789 case DOT11_OID_DISASSOCIATE:
1790 send_formatted_event(priv, "Disassociate request", mlme, 0);
1793 case DOT11_OID_ASSOCIATE:
1794 handle_request(priv, mlme, oid);
1795 send_formatted_event(priv, "Associate request", mlme, 1);
1798 case DOT11_OID_REASSOCIATE:
1799 handle_request(priv, mlme, oid);
1800 send_formatted_event(priv, "ReAssociate request", mlme, 1);
1803 case DOT11_OID_BEACON:
1804 send_formatted_event(priv,
1805 "Received a beacon from an unkown AP",
1809 case DOT11_OID_PROBE:
1810 /* we received a probe from a client. */
1811 send_formatted_event(priv, "Received a probe from client", mlme,
1815 /* Note : "mlme" is actually a "struct obj_mlmeex *" here, but this
1816 * is backward compatible layout-wise with "struct obj_mlme".
1819 case DOT11_OID_DEAUTHENTICATEEX:
1820 send_formatted_event(priv, "DeAuthenticate request", mlme, 0);
1823 case DOT11_OID_AUTHENTICATEEX:
1824 handle_request(priv, mlme, oid);
1825 send_formatted_event(priv, "Authenticate request", mlme, 1);
1828 case DOT11_OID_DISASSOCIATEEX:
1829 send_formatted_event(priv, "Disassociate request", mlme, 0);
1832 case DOT11_OID_ASSOCIATEEX:
1833 handle_request(priv, mlme, oid);
1834 send_formatted_event(priv, "Associate request", mlme, 1);
1837 case DOT11_OID_REASSOCIATEEX:
1838 handle_request(priv, mlme, oid);
1839 send_formatted_event(priv, "Reassociate request", mlme, 1);
1850 * Process a device trap. This is called via schedule_work(), outside of
1851 * interrupt context, no locks held.
1854 prism54_process_trap(void *data)
1856 struct islpci_mgmtframe *frame = data;
1857 struct net_device *ndev = frame->ndev;
1858 enum oid_num_t n = mgt_oidtonum(frame->header->oid);
1860 if (n != OID_NUM_LAST)
1861 prism54_process_trap_helper(netdev_priv(ndev), n, frame->data);
1862 islpci_mgt_release(frame);
1866 prism54_set_mac_address(struct net_device *ndev, void *addr)
1868 islpci_private *priv = netdev_priv(ndev);
1871 if (ndev->addr_len != 6)
1873 ret = mgt_set_request(priv, GEN_OID_MACADDRESS, 0,
1874 &((struct sockaddr *) addr)->sa_data);
1876 memcpy(priv->ndev->dev_addr,
1877 &((struct sockaddr *) addr)->sa_data, 6);
1883 prism54_set_wpa(struct net_device *ndev, struct iw_request_info *info,
1884 __u32 * uwrq, char *extra)
1886 islpci_private *priv = netdev_priv(ndev);
1888 down_write(&priv->mib_sem);
1892 u32 l = DOT11_MLME_EXTENDED;
1893 mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &l);
1895 /* restart the card with new level. Needed ? */
1897 up_write(&priv->mib_sem);
1903 prism54_get_wpa(struct net_device *ndev, struct iw_request_info *info,
1904 __u32 * uwrq, char *extra)
1906 islpci_private *priv = netdev_priv(ndev);
1912 prism54_set_prismhdr(struct net_device *ndev, struct iw_request_info *info,
1913 __u32 * uwrq, char *extra)
1915 islpci_private *priv = netdev_priv(ndev);
1916 priv->monitor_type =
1917 (*uwrq ? ARPHRD_IEEE80211_PRISM : ARPHRD_IEEE80211);
1918 if (priv->iw_mode == IW_MODE_MONITOR)
1919 priv->ndev->type = priv->monitor_type;
1925 prism54_get_prismhdr(struct net_device *ndev, struct iw_request_info *info,
1926 __u32 * uwrq, char *extra)
1928 islpci_private *priv = netdev_priv(ndev);
1929 *uwrq = (priv->monitor_type == ARPHRD_IEEE80211_PRISM);
1934 prism54_debug_oid(struct net_device *ndev, struct iw_request_info *info,
1935 __u32 * uwrq, char *extra)
1937 islpci_private *priv = netdev_priv(ndev);
1939 priv->priv_oid = *uwrq;
1940 printk("%s: oid 0x%08X\n", ndev->name, *uwrq);
1946 prism54_debug_get_oid(struct net_device *ndev, struct iw_request_info *info,
1947 struct iw_point *data, char *extra)
1949 islpci_private *priv = netdev_priv(ndev);
1950 struct islpci_mgmtframe *response = NULL;
1953 printk("%s: get_oid 0x%08X\n", ndev->name, priv->priv_oid);
1956 if (islpci_get_state(priv) >= PRV_STATE_INIT) {
1958 islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET,
1959 priv->priv_oid, extra, 256,
1961 printk("%s: ret: %i\n", ndev->name, ret);
1962 if (ret || !response
1963 || response->header->operation == PIMFOR_OP_ERROR) {
1965 islpci_mgt_release(response);
1967 printk("%s: EIO\n", ndev->name);
1971 data->length = response->header->length;
1972 memcpy(extra, response->data, data->length);
1973 islpci_mgt_release(response);
1974 printk("%s: len: %i\n", ndev->name, data->length);
1982 prism54_debug_set_oid(struct net_device *ndev, struct iw_request_info *info,
1983 struct iw_point *data, char *extra)
1985 islpci_private *priv = netdev_priv(ndev);
1986 struct islpci_mgmtframe *response = NULL;
1987 int ret = 0, response_op = PIMFOR_OP_ERROR;
1989 printk("%s: set_oid 0x%08X\tlen: %d\n", ndev->name, priv->priv_oid,
1992 if (islpci_get_state(priv) >= PRV_STATE_INIT) {
1994 islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET,
1995 priv->priv_oid, extra, data->length,
1997 printk("%s: ret: %i\n", ndev->name, ret);
1998 if (ret || !response
1999 || response->header->operation == PIMFOR_OP_ERROR) {
2001 islpci_mgt_release(response);
2003 printk("%s: EIO\n", ndev->name);
2007 response_op = response->header->operation;
2008 printk("%s: response_op: %i\n", ndev->name,
2010 islpci_mgt_release(response);
2014 return (ret ? ret : -EINPROGRESS);
2018 prism54_set_spy(struct net_device *ndev,
2019 struct iw_request_info *info,
2020 union iwreq_data *uwrq, char *extra)
2022 islpci_private *priv = netdev_priv(ndev);
2023 u32 u, oid = OID_INL_CONFIG;
2025 down_write(&priv->mib_sem);
2026 mgt_get(priv, OID_INL_CONFIG, &u);
2028 if ((uwrq->data.length == 0) && (priv->spy_data.spy_number > 0))
2030 u &= ~INL_CONFIG_RXANNEX;
2031 else if ((uwrq->data.length > 0) && (priv->spy_data.spy_number == 0))
2033 u |= INL_CONFIG_RXANNEX;
2035 mgt_set(priv, OID_INL_CONFIG, &u);
2036 mgt_commit_list(priv, &oid, 1);
2037 up_write(&priv->mib_sem);
2039 return iw_handler_set_spy(ndev, info, uwrq, extra);
2042 static const iw_handler prism54_handler[] = {
2043 (iw_handler) prism54_commit, /* SIOCSIWCOMMIT */
2044 (iw_handler) prism54_get_name, /* SIOCGIWNAME */
2045 (iw_handler) NULL, /* SIOCSIWNWID */
2046 (iw_handler) NULL, /* SIOCGIWNWID */
2047 (iw_handler) prism54_set_freq, /* SIOCSIWFREQ */
2048 (iw_handler) prism54_get_freq, /* SIOCGIWFREQ */
2049 (iw_handler) prism54_set_mode, /* SIOCSIWMODE */
2050 (iw_handler) prism54_get_mode, /* SIOCGIWMODE */
2051 (iw_handler) prism54_set_sens, /* SIOCSIWSENS */
2052 (iw_handler) prism54_get_sens, /* SIOCGIWSENS */
2053 (iw_handler) NULL, /* SIOCSIWRANGE */
2054 (iw_handler) prism54_get_range, /* SIOCGIWRANGE */
2055 (iw_handler) NULL, /* SIOCSIWPRIV */
2056 (iw_handler) NULL, /* SIOCGIWPRIV */
2057 (iw_handler) NULL, /* SIOCSIWSTATS */
2058 (iw_handler) NULL, /* SIOCGIWSTATS */
2059 prism54_set_spy, /* SIOCSIWSPY */
2060 iw_handler_get_spy, /* SIOCGIWSPY */
2061 iw_handler_set_thrspy, /* SIOCSIWTHRSPY */
2062 iw_handler_get_thrspy, /* SIOCGIWTHRSPY */
2063 (iw_handler) prism54_set_wap, /* SIOCSIWAP */
2064 (iw_handler) prism54_get_wap, /* SIOCGIWAP */
2065 (iw_handler) NULL, /* -- hole -- */
2066 (iw_handler) NULL, /* SIOCGIWAPLIST depreciated */
2067 (iw_handler) prism54_set_scan, /* SIOCSIWSCAN */
2068 (iw_handler) prism54_get_scan, /* SIOCGIWSCAN */
2069 (iw_handler) prism54_set_essid, /* SIOCSIWESSID */
2070 (iw_handler) prism54_get_essid, /* SIOCGIWESSID */
2071 (iw_handler) prism54_set_nick, /* SIOCSIWNICKN */
2072 (iw_handler) prism54_get_nick, /* SIOCGIWNICKN */
2073 (iw_handler) NULL, /* -- hole -- */
2074 (iw_handler) NULL, /* -- hole -- */
2075 (iw_handler) prism54_set_rate, /* SIOCSIWRATE */
2076 (iw_handler) prism54_get_rate, /* SIOCGIWRATE */
2077 (iw_handler) prism54_set_rts, /* SIOCSIWRTS */
2078 (iw_handler) prism54_get_rts, /* SIOCGIWRTS */
2079 (iw_handler) prism54_set_frag, /* SIOCSIWFRAG */
2080 (iw_handler) prism54_get_frag, /* SIOCGIWFRAG */
2081 (iw_handler) prism54_set_txpower, /* SIOCSIWTXPOW */
2082 (iw_handler) prism54_get_txpower, /* SIOCGIWTXPOW */
2083 (iw_handler) prism54_set_retry, /* SIOCSIWRETRY */
2084 (iw_handler) prism54_get_retry, /* SIOCGIWRETRY */
2085 (iw_handler) prism54_set_encode, /* SIOCSIWENCODE */
2086 (iw_handler) prism54_get_encode, /* SIOCGIWENCODE */
2087 (iw_handler) NULL, /* SIOCSIWPOWER */
2088 (iw_handler) NULL, /* SIOCGIWPOWER */
2091 /* The low order bit identify a SET (0) or a GET (1) ioctl. */
2093 #define PRISM54_RESET SIOCIWFIRSTPRIV
2094 #define PRISM54_GET_POLICY SIOCIWFIRSTPRIV+1
2095 #define PRISM54_SET_POLICY SIOCIWFIRSTPRIV+2
2096 #define PRISM54_GET_MAC SIOCIWFIRSTPRIV+3
2097 #define PRISM54_ADD_MAC SIOCIWFIRSTPRIV+4
2099 #define PRISM54_DEL_MAC SIOCIWFIRSTPRIV+6
2101 #define PRISM54_KICK_MAC SIOCIWFIRSTPRIV+8
2103 #define PRISM54_KICK_ALL SIOCIWFIRSTPRIV+10
2105 #define PRISM54_GET_WPA SIOCIWFIRSTPRIV+11
2106 #define PRISM54_SET_WPA SIOCIWFIRSTPRIV+12
2108 #define PRISM54_DBG_OID SIOCIWFIRSTPRIV+14
2109 #define PRISM54_DBG_GET_OID SIOCIWFIRSTPRIV+15
2110 #define PRISM54_DBG_SET_OID SIOCIWFIRSTPRIV+16
2112 #define PRISM54_GET_OID SIOCIWFIRSTPRIV+17
2113 #define PRISM54_SET_OID_U32 SIOCIWFIRSTPRIV+18
2114 #define PRISM54_SET_OID_STR SIOCIWFIRSTPRIV+20
2115 #define PRISM54_SET_OID_ADDR SIOCIWFIRSTPRIV+22
2117 #define PRISM54_GET_PRISMHDR SIOCIWFIRSTPRIV+23
2118 #define PRISM54_SET_PRISMHDR SIOCIWFIRSTPRIV+24
2120 #define IWPRIV_SET_U32(n,x) { n, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x }
2121 #define IWPRIV_SET_SSID(n,x) { n, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x }
2122 #define IWPRIV_SET_ADDR(n,x) { n, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x }
2123 #define IWPRIV_GET(n,x) { n, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, "g_"x }
2125 #define IWPRIV_U32(n,x) IWPRIV_SET_U32(n,x), IWPRIV_GET(n,x)
2126 #define IWPRIV_SSID(n,x) IWPRIV_SET_SSID(n,x), IWPRIV_GET(n,x)
2127 #define IWPRIV_ADDR(n,x) IWPRIV_SET_ADDR(n,x), IWPRIV_GET(n,x)
2129 /* Note : limited to 128 private ioctls (wireless tools 26) */
2131 static const struct iw_priv_args prism54_private_args[] = {
2132 /*{ cmd, set_args, get_args, name } */
2133 {PRISM54_RESET, 0, 0, "reset"},
2134 {PRISM54_GET_PRISMHDR, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
2136 {PRISM54_SET_PRISMHDR, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2138 {PRISM54_GET_POLICY, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
2140 {PRISM54_SET_POLICY, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2142 {PRISM54_GET_MAC, 0, IW_PRIV_TYPE_ADDR | 64, "getMac"},
2143 {PRISM54_ADD_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,
2145 {PRISM54_DEL_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,
2147 {PRISM54_KICK_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,
2149 {PRISM54_KICK_ALL, 0, 0, "kickAll"},
2150 {PRISM54_GET_WPA, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
2152 {PRISM54_SET_WPA, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2154 {PRISM54_DBG_OID, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2156 {PRISM54_DBG_GET_OID, 0, IW_PRIV_TYPE_BYTE | 256, "dbg_get_oid"},
2157 {PRISM54_DBG_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "dbg_set_oid"},
2158 /* --- sub-ioctls handlers --- */
2160 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, ""},
2161 {PRISM54_SET_OID_U32,
2162 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, ""},
2163 {PRISM54_SET_OID_STR,
2164 IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, ""},
2165 {PRISM54_SET_OID_ADDR,
2166 IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, ""},
2167 /* --- sub-ioctls definitions --- */
2168 IWPRIV_ADDR(GEN_OID_MACADDRESS, "addr"),
2169 IWPRIV_GET(GEN_OID_LINKSTATE, "linkstate"),
2170 IWPRIV_U32(DOT11_OID_BSSTYPE, "bsstype"),
2171 IWPRIV_ADDR(DOT11_OID_BSSID, "bssid"),
2172 IWPRIV_U32(DOT11_OID_STATE, "state"),
2173 IWPRIV_U32(DOT11_OID_AID, "aid"),
2175 IWPRIV_SSID(DOT11_OID_SSIDOVERRIDE, "ssidoverride"),
2177 IWPRIV_U32(DOT11_OID_MEDIUMLIMIT, "medlimit"),
2178 IWPRIV_U32(DOT11_OID_BEACONPERIOD, "beacon"),
2179 IWPRIV_U32(DOT11_OID_DTIMPERIOD, "dtimperiod"),
2181 IWPRIV_U32(DOT11_OID_AUTHENABLE, "authenable"),
2182 IWPRIV_U32(DOT11_OID_PRIVACYINVOKED, "privinvok"),
2183 IWPRIV_U32(DOT11_OID_EXUNENCRYPTED, "exunencrypt"),
2185 IWPRIV_U32(DOT11_OID_REKEYTHRESHOLD, "rekeythresh"),
2187 IWPRIV_U32(DOT11_OID_MAXTXLIFETIME, "maxtxlife"),
2188 IWPRIV_U32(DOT11_OID_MAXRXLIFETIME, "maxrxlife"),
2189 IWPRIV_U32(DOT11_OID_ALOFT_FIXEDRATE, "fixedrate"),
2190 IWPRIV_U32(DOT11_OID_MAXFRAMEBURST, "frameburst"),
2191 IWPRIV_U32(DOT11_OID_PSM, "psm"),
2193 IWPRIV_U32(DOT11_OID_BRIDGELOCAL, "bridge"),
2194 IWPRIV_U32(DOT11_OID_CLIENTS, "clients"),
2195 IWPRIV_U32(DOT11_OID_CLIENTSASSOCIATED, "clientassoc"),
2196 IWPRIV_U32(DOT11_OID_DOT1XENABLE, "dot1xenable"),
2197 IWPRIV_U32(DOT11_OID_ANTENNARX, "rxant"),
2198 IWPRIV_U32(DOT11_OID_ANTENNATX, "txant"),
2199 IWPRIV_U32(DOT11_OID_ANTENNADIVERSITY, "antdivers"),
2200 IWPRIV_U32(DOT11_OID_EDTHRESHOLD, "edthresh"),
2201 IWPRIV_U32(DOT11_OID_PREAMBLESETTINGS, "preamble"),
2202 IWPRIV_GET(DOT11_OID_RATES, "rates"),
2203 IWPRIV_U32(DOT11_OID_OUTPUTPOWER, ".11outpower"),
2204 IWPRIV_GET(DOT11_OID_SUPPORTEDRATES, "supprates"),
2205 IWPRIV_GET(DOT11_OID_SUPPORTEDFREQUENCIES, "suppfreq"),
2207 IWPRIV_U32(DOT11_OID_NOISEFLOOR, "noisefloor"),
2208 IWPRIV_GET(DOT11_OID_FREQUENCYACTIVITY, "freqactivity"),
2209 IWPRIV_U32(DOT11_OID_NONERPPROTECTION, "nonerpprotec"),
2210 IWPRIV_U32(DOT11_OID_PROFILES, "profile"),
2211 IWPRIV_GET(DOT11_OID_EXTENDEDRATES, "extrates"),
2212 IWPRIV_U32(DOT11_OID_MLMEAUTOLEVEL, "mlmelevel"),
2214 IWPRIV_GET(DOT11_OID_BSSS, "bsss"),
2215 IWPRIV_GET(DOT11_OID_BSSLIST, "bsslist"),
2216 IWPRIV_U32(OID_INL_MODE, "mode"),
2217 IWPRIV_U32(OID_INL_CONFIG, "config"),
2218 IWPRIV_U32(OID_INL_DOT11D_CONFORMANCE, ".11dconform"),
2219 IWPRIV_GET(OID_INL_PHYCAPABILITIES, "phycapa"),
2220 IWPRIV_U32(OID_INL_OUTPUTPOWER, "outpower"),
2223 static const iw_handler prism54_private_handler[] = {
2224 (iw_handler) prism54_reset,
2225 (iw_handler) prism54_get_policy,
2226 (iw_handler) prism54_set_policy,
2227 (iw_handler) prism54_get_mac,
2228 (iw_handler) prism54_add_mac,
2230 (iw_handler) prism54_del_mac,
2232 (iw_handler) prism54_kick_mac,
2234 (iw_handler) prism54_kick_all,
2235 (iw_handler) prism54_get_wpa,
2236 (iw_handler) prism54_set_wpa,
2238 (iw_handler) prism54_debug_oid,
2239 (iw_handler) prism54_debug_get_oid,
2240 (iw_handler) prism54_debug_set_oid,
2241 (iw_handler) prism54_get_oid,
2242 (iw_handler) prism54_set_u32,
2244 (iw_handler) prism54_set_raw,
2246 (iw_handler) prism54_set_raw,
2247 (iw_handler) prism54_get_prismhdr,
2248 (iw_handler) prism54_set_prismhdr,
2251 const struct iw_handler_def prism54_handler_def = {
2252 .num_standard = sizeof (prism54_handler) / sizeof (iw_handler),
2253 .num_private = sizeof (prism54_private_handler) / sizeof (iw_handler),
2255 sizeof (prism54_private_args) / sizeof (struct iw_priv_args),
2256 .standard = (iw_handler *) prism54_handler,
2257 .private = (iw_handler *) prism54_private_handler,
2258 .private_args = (struct iw_priv_args *) prism54_private_args,
2259 .spy_offset = offsetof(islpci_private, spy_data),
2262 /* For ioctls that don't work with the new API */
2265 prism54_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)