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);
345 prism54_set_mode(struct net_device *ndev, struct iw_request_info *info,
346 __u32 * uwrq, char *extra)
348 islpci_private *priv = netdev_priv(ndev);
349 u32 mlmeautolevel = CARD_DEFAULT_MLME_MODE;
351 /* Let's see if the user passed a valid Linux Wireless mode */
352 if (*uwrq > IW_MODE_MONITOR || *uwrq < IW_MODE_AUTO) {
354 "%s: %s() You passed a non-valid init_mode.\n",
355 priv->ndev->name, __FUNCTION__);
359 down_write(&priv->mib_sem);
361 if (prism54_mib_mode_helper(priv, *uwrq)) {
362 up_write(&priv->mib_sem);
366 /* the ACL code needs an intermediate mlmeautolevel. The wpa stuff an
369 if ((*uwrq == IW_MODE_MASTER) && (priv->acl.policy != MAC_POLICY_OPEN))
370 mlmeautolevel = DOT11_MLME_INTERMEDIATE;
372 mlmeautolevel = DOT11_MLME_EXTENDED;
374 mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &mlmeautolevel);
377 priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR)
378 ? priv->monitor_type : ARPHRD_ETHER;
379 up_write(&priv->mib_sem);
386 prism54_get_mode(struct net_device *ndev, struct iw_request_info *info,
387 __u32 * uwrq, char *extra)
389 islpci_private *priv = netdev_priv(ndev);
391 BUG_ON((priv->iw_mode < IW_MODE_AUTO) || (priv->iw_mode >
393 *uwrq = priv->iw_mode;
398 /* we use DOT11_OID_EDTHRESHOLD. From what I guess the card will not try to
399 * emit data if (sensitivity > rssi - noise) (in dBm).
400 * prism54_set_sens does not seem to work.
404 prism54_set_sens(struct net_device *ndev, struct iw_request_info *info,
405 struct iw_param *vwrq, char *extra)
407 islpci_private *priv = netdev_priv(ndev);
410 /* by default the card sets this to 20. */
411 sens = vwrq->disabled ? 20 : vwrq->value;
413 return mgt_set_request(priv, DOT11_OID_EDTHRESHOLD, 0, &sens);
417 prism54_get_sens(struct net_device *ndev, struct iw_request_info *info,
418 struct iw_param *vwrq, char *extra)
420 islpci_private *priv = netdev_priv(ndev);
424 rvalue = mgt_get_request(priv, DOT11_OID_EDTHRESHOLD, 0, NULL, &r);
427 vwrq->disabled = (vwrq->value == 0);
434 prism54_get_range(struct net_device *ndev, struct iw_request_info *info,
435 struct iw_point *dwrq, char *extra)
437 struct iw_range *range = (struct iw_range *) extra;
438 islpci_private *priv = netdev_priv(ndev);
441 struct obj_frequencies *freq;
444 memset(range, 0, sizeof (struct iw_range));
445 dwrq->length = sizeof (struct iw_range);
447 /* set the wireless extension version number */
448 range->we_version_source = SUPPORTED_WIRELESS_EXT;
449 range->we_version_compiled = WIRELESS_EXT;
451 /* Now the encoding capabilities */
452 range->num_encoding_sizes = 3;
453 /* 64(40) bits WEP */
454 range->encoding_size[0] = 5;
455 /* 128(104) bits WEP */
456 range->encoding_size[1] = 13;
457 /* 256 bits for WPA-PSK */
458 range->encoding_size[2] = 32;
459 /* 4 keys are allowed */
460 range->max_encoding_tokens = 4;
462 /* we don't know the quality range... */
463 range->max_qual.level = 0;
464 range->max_qual.noise = 0;
465 range->max_qual.qual = 0;
466 /* these value describe an average quality. Needs more tweaking... */
467 range->avg_qual.level = -80; /* -80 dBm */
468 range->avg_qual.noise = 0; /* don't know what to put here */
469 range->avg_qual.qual = 0;
471 range->sensitivity = 200;
473 /* retry limit capabilities */
474 range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;
475 range->retry_flags = IW_RETRY_LIMIT;
476 range->r_time_flags = IW_RETRY_LIFETIME;
478 /* I don't know the range. Put stupid things here */
479 range->min_retry = 1;
480 range->max_retry = 65535;
481 range->min_r_time = 1024;
482 range->max_r_time = 65535 * 1024;
484 /* txpower is supported in dBm's */
485 range->txpower_capa = IW_TXPOW_DBM;
487 if (islpci_get_state(priv) < PRV_STATE_INIT)
490 /* Request the device for the supported frequencies
491 * not really relevant since some devices will report the 5 GHz band
492 * frequencies even if they don't support them.
495 mgt_get_request(priv, DOT11_OID_SUPPORTEDFREQUENCIES, 0, NULL, &r);
498 range->num_channels = freq->nr;
499 range->num_frequency = freq->nr;
501 m = min(IW_MAX_FREQUENCIES, (int) freq->nr);
502 for (i = 0; i < m; i++) {
503 range->freq[i].m = freq->mhz[i];
504 range->freq[i].e = 6;
505 range->freq[i].i = channel_of_freq(freq->mhz[i]);
509 rvalue |= mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r);
512 /* We got an array of char. It is NULL terminated. */
514 while ((i < IW_MAX_BITRATES) && (*data != 0)) {
515 /* the result must be in bps. The card gives us 500Kbps */
516 range->bitrate[i] = *data * 500000;
520 range->num_bitrates = i;
529 prism54_set_wap(struct net_device *ndev, struct iw_request_info *info,
530 struct sockaddr *awrq, char *extra)
532 islpci_private *priv = netdev_priv(ndev);
536 if (awrq->sa_family != ARPHRD_ETHER)
539 /* prepare the structure for the set object */
540 memcpy(&bssid[0], awrq->sa_data, 6);
542 /* set the bssid -- does this make sense when in AP mode? */
543 rvalue = mgt_set_request(priv, DOT11_OID_BSSID, 0, &bssid);
545 return (rvalue ? rvalue : -EINPROGRESS); /* Call commit handler */
551 prism54_get_wap(struct net_device *ndev, struct iw_request_info *info,
552 struct sockaddr *awrq, char *extra)
554 islpci_private *priv = netdev_priv(ndev);
558 rvalue = mgt_get_request(priv, DOT11_OID_BSSID, 0, NULL, &r);
559 memcpy(awrq->sa_data, r.ptr, 6);
560 awrq->sa_family = ARPHRD_ETHER;
567 prism54_set_scan(struct net_device *dev, struct iw_request_info *info,
568 struct iw_param *vwrq, char *extra)
570 /* hehe the device does this automagicaly */
574 /* a little helper that will translate our data into a card independent
575 * format that the Wireless Tools will understand. This was inspired by
576 * the "Aironet driver for 4500 and 4800 series cards" (GPL)
580 prism54_translate_bss(struct net_device *ndev, char *current_ev,
581 char *end_buf, struct obj_bss *bss, char noise)
583 struct iw_event iwe; /* Temporary buffer */
585 islpci_private *priv = netdev_priv(ndev);
587 /* The first entry must be the MAC address */
588 memcpy(iwe.u.ap_addr.sa_data, bss->address, 6);
589 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
592 iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
594 /* The following entries will be displayed in the same order we give them */
597 iwe.u.data.length = bss->ssid.length;
598 iwe.u.data.flags = 1;
599 iwe.cmd = SIOCGIWESSID;
600 current_ev = iwe_stream_add_point(current_ev, end_buf,
601 &iwe, bss->ssid.octets);
605 #define CAP_IBSS 0x02
606 #define CAP_CRYPT 0x10
612 iwe.u.mode = IW_MODE_MASTER;
613 else if (cap & CAP_IBSS)
614 iwe.u.mode = IW_MODE_ADHOC;
615 iwe.cmd = SIOCGIWMODE;
618 iwe_stream_add_event(current_ev, end_buf, &iwe,
621 /* Encryption capability */
623 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
625 iwe.u.data.flags = IW_ENCODE_DISABLED;
626 iwe.u.data.length = 0;
627 iwe.cmd = SIOCGIWENCODE;
628 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, NULL);
630 /* Add frequency. (short) bss->channel is the frequency in MHz */
631 iwe.u.freq.m = channel_of_freq(bss->channel);
633 iwe.cmd = SIOCGIWFREQ;
635 iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
637 /* Add quality statistics */
638 iwe.u.qual.level = bss->rssi;
639 iwe.u.qual.noise = noise;
640 /* do a simple SNR for quality */
641 iwe.u.qual.qual = bss->rssi - noise;
644 iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
647 u8 wpa_ie[MAX_WPA_IE_LEN];
652 wpa_ie_len = prism54_wpa_ie_get(priv, bss->address, wpa_ie);
653 if (wpa_ie_len > 0 &&
654 (buf = kmalloc(wpa_ie_len * 2 + 10, GFP_ATOMIC))) {
656 p += sprintf(p, "wpa_ie=");
657 for (i = 0; i < wpa_ie_len; i++) {
658 p += sprintf(p, "%02x", wpa_ie[i]);
660 memset(&iwe, 0, sizeof (iwe));
661 iwe.cmd = IWEVCUSTOM;
662 iwe.u.data.length = strlen(buf);
663 current_ev = iwe_stream_add_point(current_ev, end_buf,
672 prism54_get_scan(struct net_device *ndev, struct iw_request_info *info,
673 struct iw_point *dwrq, char *extra)
675 islpci_private *priv = netdev_priv(ndev);
677 struct obj_bsslist *bsslist;
679 char *current_ev = extra;
682 if (islpci_get_state(priv) < PRV_STATE_INIT) {
683 /* device is not ready, fail gently */
688 /* first get the noise value. We will use it to report the link quality */
689 rvalue = mgt_get_request(priv, DOT11_OID_NOISEFLOOR, 0, NULL, &r);
692 /* Ask the device for a list of known bss. We can report at most
693 * IW_MAX_AP=64 to the range struct. But the device won't repport anything
694 * if you change the value of IWMAX_BSS=24.
696 rvalue |= mgt_get_request(priv, DOT11_OID_BSSLIST, 0, NULL, &r);
699 /* ok now, scan the list and translate its info */
700 for (i = 0; i < min(IW_MAX_AP, (int) bsslist->nr); i++)
701 current_ev = prism54_translate_bss(ndev, current_ev,
702 extra + IW_SCAN_MAX_DATA,
703 &(bsslist->bsslist[i]),
706 dwrq->length = (current_ev - extra);
707 dwrq->flags = 0; /* todo */
713 prism54_set_essid(struct net_device *ndev, struct iw_request_info *info,
714 struct iw_point *dwrq, char *extra)
716 islpci_private *priv = netdev_priv(ndev);
717 struct obj_ssid essid;
719 memset(essid.octets, 0, 33);
721 /* Check if we were asked for `any' */
722 if (dwrq->flags && dwrq->length) {
723 if (dwrq->length > min(33, IW_ESSID_MAX_SIZE + 1))
725 essid.length = dwrq->length - 1;
726 memcpy(essid.octets, extra, dwrq->length);
730 if (priv->iw_mode != IW_MODE_MONITOR)
731 return mgt_set_request(priv, DOT11_OID_SSID, 0, &essid);
733 /* If in monitor mode, just save to mib */
734 mgt_set(priv, DOT11_OID_SSID, &essid);
740 prism54_get_essid(struct net_device *ndev, struct iw_request_info *info,
741 struct iw_point *dwrq, char *extra)
743 islpci_private *priv = netdev_priv(ndev);
744 struct obj_ssid *essid;
748 rvalue = mgt_get_request(priv, DOT11_OID_SSID, 0, NULL, &r);
752 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */
753 /* if it is to big, trunk it */
754 dwrq->length = min(IW_ESSID_MAX_SIZE, essid->length + 1);
759 essid->octets[essid->length] = '\0';
760 memcpy(extra, essid->octets, dwrq->length);
766 /* Provides no functionality, just completes the ioctl. In essence this is a
767 * just a cosmetic ioctl.
770 prism54_set_nick(struct net_device *ndev, struct iw_request_info *info,
771 struct iw_point *dwrq, char *extra)
773 islpci_private *priv = netdev_priv(ndev);
775 if (dwrq->length > IW_ESSID_MAX_SIZE)
778 down_write(&priv->mib_sem);
779 memset(priv->nickname, 0, sizeof (priv->nickname));
780 memcpy(priv->nickname, extra, dwrq->length);
781 up_write(&priv->mib_sem);
787 prism54_get_nick(struct net_device *ndev, struct iw_request_info *info,
788 struct iw_point *dwrq, char *extra)
790 islpci_private *priv = netdev_priv(ndev);
794 down_read(&priv->mib_sem);
795 dwrq->length = strlen(priv->nickname) + 1;
796 memcpy(extra, priv->nickname, dwrq->length);
797 up_read(&priv->mib_sem);
802 /* Set the allowed Bitrates */
805 prism54_set_rate(struct net_device *ndev,
806 struct iw_request_info *info,
807 struct iw_param *vwrq, char *extra)
810 islpci_private *priv = netdev_priv(ndev);
816 if (vwrq->value == -1) {
817 /* auto mode. No limit. */
819 return mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile);
822 ret = mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r);
828 rate = (u32) (vwrq->value / 500000);
833 if (rate && (data[i] == rate)) {
836 if (vwrq->value == i) {
851 /* Now, check if we want a fixed or auto value */
859 printk("prism54 rate: ");
861 printk("%u ", data[i]);
867 ret = mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile);
868 ret |= mgt_set_request(priv, DOT11_OID_EXTENDEDRATES, 0, data);
869 ret |= mgt_set_request(priv, DOT11_OID_RATES, 0, data);
876 /* Get the current bit rate */
878 prism54_get_rate(struct net_device *ndev,
879 struct iw_request_info *info,
880 struct iw_param *vwrq, char *extra)
882 islpci_private *priv = netdev_priv(ndev);
887 /* Get the current bit rate */
888 if ((rvalue = mgt_get_request(priv, GEN_OID_LINKSTATE, 0, NULL, &r)))
890 vwrq->value = r.u * 500000;
892 /* request the device for the enabled rates */
893 rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r);
899 vwrq->fixed = (data[0] != 0) && (data[1] == 0);
906 prism54_set_rts(struct net_device *ndev, struct iw_request_info *info,
907 struct iw_param *vwrq, char *extra)
909 islpci_private *priv = netdev_priv(ndev);
911 return mgt_set_request(priv, DOT11_OID_RTSTHRESH, 0, &vwrq->value);
915 prism54_get_rts(struct net_device *ndev, struct iw_request_info *info,
916 struct iw_param *vwrq, char *extra)
918 islpci_private *priv = netdev_priv(ndev);
922 /* get the rts threshold */
923 rvalue = mgt_get_request(priv, DOT11_OID_RTSTHRESH, 0, NULL, &r);
930 prism54_set_frag(struct net_device *ndev, struct iw_request_info *info,
931 struct iw_param *vwrq, char *extra)
933 islpci_private *priv = netdev_priv(ndev);
935 return mgt_set_request(priv, DOT11_OID_FRAGTHRESH, 0, &vwrq->value);
939 prism54_get_frag(struct net_device *ndev, struct iw_request_info *info,
940 struct iw_param *vwrq, char *extra)
942 islpci_private *priv = netdev_priv(ndev);
946 rvalue = mgt_get_request(priv, DOT11_OID_FRAGTHRESH, 0, NULL, &r);
952 /* Here we have (min,max) = max retries for (small frames, big frames). Where
953 * big frame <=> bigger than the rts threshold
954 * small frame <=> smaller than the rts threshold
955 * This is not really the behavior expected by the wireless tool but it seems
956 * to be a common behavior in other drivers.
960 prism54_set_retry(struct net_device *ndev, struct iw_request_info *info,
961 struct iw_param *vwrq, char *extra)
963 islpci_private *priv = netdev_priv(ndev);
964 u32 slimit = 0, llimit = 0; /* short and long limit */
969 /* we cannot disable this feature */
972 if (vwrq->flags & IW_RETRY_LIMIT) {
973 if (vwrq->flags & IW_RETRY_MIN)
974 slimit = vwrq->value;
975 else if (vwrq->flags & IW_RETRY_MAX)
976 llimit = vwrq->value;
978 /* we are asked to set both */
979 slimit = vwrq->value;
980 llimit = vwrq->value;
983 if (vwrq->flags & IW_RETRY_LIFETIME)
984 /* Wireless tools use us unit while the device uses 1024 us unit */
985 lifetime = vwrq->value / 1024;
987 /* now set what is requested */
990 mgt_set_request(priv, DOT11_OID_SHORTRETRIES, 0, &slimit);
993 mgt_set_request(priv, DOT11_OID_LONGRETRIES, 0, &llimit);
996 mgt_set_request(priv, DOT11_OID_MAXTXLIFETIME, 0,
1002 prism54_get_retry(struct net_device *ndev, struct iw_request_info *info,
1003 struct iw_param *vwrq, char *extra)
1005 islpci_private *priv = netdev_priv(ndev);
1008 vwrq->disabled = 0; /* It cannot be disabled */
1010 if ((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
1011 /* we are asked for the life time */
1013 mgt_get_request(priv, DOT11_OID_MAXTXLIFETIME, 0, NULL, &r);
1014 vwrq->value = r.u * 1024;
1015 vwrq->flags = IW_RETRY_LIFETIME;
1016 } else if ((vwrq->flags & IW_RETRY_MAX)) {
1017 /* we are asked for the long retry limit */
1019 mgt_get_request(priv, DOT11_OID_LONGRETRIES, 0, NULL, &r);
1021 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
1023 /* default. get the short retry limit */
1025 mgt_get_request(priv, DOT11_OID_SHORTRETRIES, 0, NULL, &r);
1027 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MIN;
1034 prism54_set_encode(struct net_device *ndev, struct iw_request_info *info,
1035 struct iw_point *dwrq, char *extra)
1037 islpci_private *priv = netdev_priv(ndev);
1038 int rvalue = 0, force = 0;
1039 int authen = DOT11_AUTH_OS, invoke = 0, exunencrypt = 0;
1042 /* with the new API, it's impossible to get a NULL pointer.
1043 * New version of iwconfig set the IW_ENCODE_NOKEY flag
1044 * when no key is given, but older versions don't. */
1046 if (dwrq->length > 0) {
1047 /* we have a key to set */
1048 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1050 struct obj_key key = { DOT11_PRIV_WEP, 0, "" };
1052 /* get the current key index */
1053 rvalue = mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r);
1054 current_index = r.u;
1055 /* Verify that the key is not marked as invalid */
1056 if (!(dwrq->flags & IW_ENCODE_NOKEY)) {
1057 key.length = dwrq->length > sizeof (key.key) ?
1058 sizeof (key.key) : dwrq->length;
1059 memcpy(key.key, extra, key.length);
1060 if (key.length == 32)
1061 /* we want WPA-PSK */
1062 key.type = DOT11_PRIV_TKIP;
1063 if ((index < 0) || (index > 3))
1064 /* no index provided use the current one */
1065 index = current_index;
1067 /* now send the key to the card */
1069 mgt_set_request(priv, DOT11_OID_DEFKEYX, index,
1073 * If a valid key is set, encryption should be enabled
1074 * (user may turn it off later).
1075 * This is also how "iwconfig ethX key on" works
1077 if ((index == current_index) && (key.length > 0))
1080 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1081 if ((index >= 0) && (index <= 3)) {
1082 /* we want to set the key index */
1084 mgt_set_request(priv, DOT11_OID_DEFKEYID, 0,
1087 if (!dwrq->flags & IW_ENCODE_MODE) {
1088 /* we cannot do anything. Complain. */
1093 /* now read the flags */
1094 if (dwrq->flags & IW_ENCODE_DISABLED) {
1095 /* Encoding disabled,
1096 * authen = DOT11_AUTH_OS;
1098 * exunencrypt = 0; */
1100 if (dwrq->flags & IW_ENCODE_OPEN)
1101 /* Encode but accept non-encoded packets. No auth */
1103 if ((dwrq->flags & IW_ENCODE_RESTRICTED) || force) {
1104 /* Refuse non-encoded packets. Auth */
1105 authen = DOT11_AUTH_BOTH;
1109 /* do the change if requested */
1110 if ((dwrq->flags & IW_ENCODE_MODE) || force) {
1112 mgt_set_request(priv, DOT11_OID_AUTHENABLE, 0, &authen);
1114 mgt_set_request(priv, DOT11_OID_PRIVACYINVOKED, 0, &invoke);
1116 mgt_set_request(priv, DOT11_OID_EXUNENCRYPTED, 0,
1123 prism54_get_encode(struct net_device *ndev, struct iw_request_info *info,
1124 struct iw_point *dwrq, char *extra)
1126 islpci_private *priv = netdev_priv(ndev);
1127 struct obj_key *key;
1128 u32 devindex, index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1129 u32 authen = 0, invoke = 0, exunencrypt = 0;
1133 /* first get the flags */
1134 rvalue = mgt_get_request(priv, DOT11_OID_AUTHENABLE, 0, NULL, &r);
1136 rvalue |= mgt_get_request(priv, DOT11_OID_PRIVACYINVOKED, 0, NULL, &r);
1138 rvalue |= mgt_get_request(priv, DOT11_OID_EXUNENCRYPTED, 0, NULL, &r);
1141 if (invoke && (authen == DOT11_AUTH_BOTH) && exunencrypt)
1142 dwrq->flags = IW_ENCODE_RESTRICTED;
1143 else if ((authen == DOT11_AUTH_OS) && !exunencrypt) {
1145 dwrq->flags = IW_ENCODE_OPEN;
1147 dwrq->flags = IW_ENCODE_DISABLED;
1149 /* The card should not work in this state */
1152 /* get the current device key index */
1153 rvalue |= mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r);
1155 /* Now get the key, return it */
1156 if ((index < 0) || (index > 3))
1157 /* no index provided, use the current one */
1159 rvalue |= mgt_get_request(priv, DOT11_OID_DEFKEYX, index, NULL, &r);
1161 dwrq->length = key->length;
1162 memcpy(extra, key->key, dwrq->length);
1164 /* return the used key index */
1165 dwrq->flags |= devindex + 1;
1171 prism54_get_txpower(struct net_device *ndev, struct iw_request_info *info,
1172 struct iw_param *vwrq, char *extra)
1174 islpci_private *priv = netdev_priv(ndev);
1178 rvalue = mgt_get_request(priv, OID_INL_OUTPUTPOWER, 0, NULL, &r);
1179 /* intersil firmware operates in 0.25 dBm (1/4 dBm) */
1180 vwrq->value = (s32) r.u / 4;
1182 /* radio is not turned of
1183 * btw: how is possible to turn off only the radio
1191 prism54_set_txpower(struct net_device *ndev, struct iw_request_info *info,
1192 struct iw_param *vwrq, char *extra)
1194 islpci_private *priv = netdev_priv(ndev);
1195 s32 u = vwrq->value;
1197 /* intersil firmware operates in 0.25 dBm (1/4) */
1199 if (vwrq->disabled) {
1200 /* don't know how to disable radio */
1202 "%s: %s() disabling radio is not yet supported.\n",
1203 priv->ndev->name, __FUNCTION__);
1205 } else if (vwrq->fixed)
1206 /* currently only fixed value is supported */
1207 return mgt_set_request(priv, OID_INL_OUTPUTPOWER, 0, &u);
1210 "%s: %s() auto power will be implemented later.\n",
1211 priv->ndev->name, __FUNCTION__);
1217 prism54_reset(struct net_device *ndev, struct iw_request_info *info,
1218 __u32 * uwrq, char *extra)
1220 islpci_reset(netdev_priv(ndev), 0);
1226 prism54_get_oid(struct net_device *ndev, struct iw_request_info *info,
1227 struct iw_point *dwrq, char *extra)
1231 enum oid_num_t n = dwrq->flags;
1233 rvalue = mgt_get_request((islpci_private *) ndev->priv, n, 0, NULL, &r);
1234 dwrq->length = mgt_response_to_str(n, &r, extra);
1235 if ((isl_oid[n].flags & OID_FLAG_TYPE) != OID_TYPE_U32)
1241 prism54_set_u32(struct net_device *ndev, struct iw_request_info *info,
1242 __u32 * uwrq, char *extra)
1244 u32 oid = uwrq[0], u = uwrq[1];
1246 return mgt_set_request((islpci_private *) ndev->priv, oid, 0, &u);
1250 prism54_set_raw(struct net_device *ndev, struct iw_request_info *info,
1251 struct iw_point *dwrq, char *extra)
1253 u32 oid = dwrq->flags;
1255 return mgt_set_request((islpci_private *) ndev->priv, oid, 0, extra);
1259 prism54_acl_init(struct islpci_acl *acl)
1261 sema_init(&acl->sem, 1);
1262 INIT_LIST_HEAD(&acl->mac_list);
1264 acl->policy = MAC_POLICY_OPEN;
1268 prism54_clear_mac(struct islpci_acl *acl)
1270 struct list_head *ptr, *next;
1271 struct mac_entry *entry;
1273 if (down_interruptible(&acl->sem))
1276 if (acl->size == 0) {
1281 for (ptr = acl->mac_list.next, next = ptr->next;
1282 ptr != &acl->mac_list; ptr = next, next = ptr->next) {
1283 entry = list_entry(ptr, struct mac_entry, _list);
1292 prism54_acl_clean(struct islpci_acl *acl)
1294 prism54_clear_mac(acl);
1298 prism54_add_mac(struct net_device *ndev, struct iw_request_info *info,
1299 struct sockaddr *awrq, char *extra)
1301 islpci_private *priv = netdev_priv(ndev);
1302 struct islpci_acl *acl = &priv->acl;
1303 struct mac_entry *entry;
1304 struct sockaddr *addr = (struct sockaddr *) extra;
1306 if (addr->sa_family != ARPHRD_ETHER)
1309 entry = kmalloc(sizeof (struct mac_entry), GFP_KERNEL);
1313 memcpy(entry->addr, addr->sa_data, ETH_ALEN);
1315 if (down_interruptible(&acl->sem)) {
1317 return -ERESTARTSYS;
1319 list_add_tail(&entry->_list, &acl->mac_list);
1327 prism54_del_mac(struct net_device *ndev, struct iw_request_info *info,
1328 struct sockaddr *awrq, char *extra)
1330 islpci_private *priv = netdev_priv(ndev);
1331 struct islpci_acl *acl = &priv->acl;
1332 struct mac_entry *entry;
1333 struct list_head *ptr;
1334 struct sockaddr *addr = (struct sockaddr *) extra;
1336 if (addr->sa_family != ARPHRD_ETHER)
1339 if (down_interruptible(&acl->sem))
1340 return -ERESTARTSYS;
1341 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
1342 entry = list_entry(ptr, struct mac_entry, _list);
1344 if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) {
1357 prism54_get_mac(struct net_device *ndev, struct iw_request_info *info,
1358 struct iw_point *dwrq, char *extra)
1360 islpci_private *priv = netdev_priv(ndev);
1361 struct islpci_acl *acl = &priv->acl;
1362 struct mac_entry *entry;
1363 struct list_head *ptr;
1364 struct sockaddr *dst = (struct sockaddr *) extra;
1368 if (down_interruptible(&acl->sem))
1369 return -ERESTARTSYS;
1371 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
1372 entry = list_entry(ptr, struct mac_entry, _list);
1374 memcpy(dst->sa_data, entry->addr, ETH_ALEN);
1375 dst->sa_family = ARPHRD_ETHER;
1383 /* Setting policy also clears the MAC acl, even if we don't change the defaut
1388 prism54_set_policy(struct net_device *ndev, struct iw_request_info *info,
1389 __u32 * uwrq, char *extra)
1391 islpci_private *priv = netdev_priv(ndev);
1392 struct islpci_acl *acl = &priv->acl;
1395 prism54_clear_mac(acl);
1397 if ((*uwrq < MAC_POLICY_OPEN) || (*uwrq > MAC_POLICY_REJECT))
1400 down_write(&priv->mib_sem);
1402 acl->policy = *uwrq;
1404 /* the ACL code needs an intermediate mlmeautolevel */
1405 if ((priv->iw_mode == IW_MODE_MASTER) &&
1406 (acl->policy != MAC_POLICY_OPEN))
1407 mlmeautolevel = DOT11_MLME_INTERMEDIATE;
1409 mlmeautolevel = CARD_DEFAULT_MLME_MODE;
1411 mlmeautolevel = DOT11_MLME_EXTENDED;
1412 mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &mlmeautolevel);
1413 /* restart the card with our new policy */
1415 up_write(&priv->mib_sem);
1421 prism54_get_policy(struct net_device *ndev, struct iw_request_info *info,
1422 __u32 * uwrq, char *extra)
1424 islpci_private *priv = netdev_priv(ndev);
1425 struct islpci_acl *acl = &priv->acl;
1427 *uwrq = acl->policy;
1432 /* Return 1 only if client should be accepted. */
1435 prism54_mac_accept(struct islpci_acl *acl, char *mac)
1437 struct list_head *ptr;
1438 struct mac_entry *entry;
1441 if (down_interruptible(&acl->sem))
1442 return -ERESTARTSYS;
1444 if (acl->policy == MAC_POLICY_OPEN) {
1449 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
1450 entry = list_entry(ptr, struct mac_entry, _list);
1451 if (memcmp(entry->addr, mac, ETH_ALEN) == 0) {
1456 res = (acl->policy == MAC_POLICY_ACCEPT) ? !res : res;
1463 prism54_kick_all(struct net_device *ndev, struct iw_request_info *info,
1464 struct iw_point *dwrq, char *extra)
1466 struct obj_mlme *mlme;
1469 mlme = kmalloc(sizeof (struct obj_mlme), GFP_KERNEL);
1473 /* Tell the card to kick every client */
1476 mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
1483 prism54_kick_mac(struct net_device *ndev, struct iw_request_info *info,
1484 struct sockaddr *awrq, char *extra)
1486 struct obj_mlme *mlme;
1487 struct sockaddr *addr = (struct sockaddr *) extra;
1490 if (addr->sa_family != ARPHRD_ETHER)
1493 mlme = kmalloc(sizeof (struct obj_mlme), GFP_KERNEL);
1497 /* Tell the card to only kick the corresponding bastard */
1498 memcpy(mlme->address, addr->sa_data, ETH_ALEN);
1501 mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
1508 /* Translate a TRAP oid into a wireless event. Called in islpci_mgt_receive. */
1511 format_event(islpci_private *priv, char *dest, const char *str,
1512 const struct obj_mlme *mlme, u16 *length, int error)
1514 const u8 *a = mlme->address;
1515 int n = snprintf(dest, IW_CUSTOM_MAX,
1516 "%s %s %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X %s (%2.2X)",
1518 ((priv->iw_mode == IW_MODE_MASTER) ? "from" : "to"),
1519 a[0], a[1], a[2], a[3], a[4], a[5],
1520 (error ? (mlme->code ? " : REJECTED " : " : ACCEPTED ")
1522 BUG_ON(n > IW_CUSTOM_MAX);
1527 send_formatted_event(islpci_private *priv, const char *str,
1528 const struct obj_mlme *mlme, int error)
1530 union iwreq_data wrqu;
1532 wrqu.data.pointer = kmalloc(IW_CUSTOM_MAX, GFP_KERNEL);
1533 if (!wrqu.data.pointer)
1535 wrqu.data.length = 0;
1536 format_event(priv, wrqu.data.pointer, str, mlme, &wrqu.data.length,
1538 wireless_send_event(priv->ndev, IWEVCUSTOM, &wrqu, wrqu.data.pointer);
1539 kfree(wrqu.data.pointer);
1543 send_simple_event(islpci_private *priv, const char *str)
1545 union iwreq_data wrqu;
1546 int n = strlen(str);
1548 wrqu.data.pointer = kmalloc(IW_CUSTOM_MAX, GFP_KERNEL);
1549 if (!wrqu.data.pointer)
1551 BUG_ON(n > IW_CUSTOM_MAX);
1552 wrqu.data.length = n;
1553 strcpy(wrqu.data.pointer, str);
1554 wireless_send_event(priv->ndev, IWEVCUSTOM, &wrqu, wrqu.data.pointer);
1555 kfree(wrqu.data.pointer);
1559 link_changed(struct net_device *ndev, u32 bitrate)
1561 islpci_private *priv = netdev_priv(ndev);
1564 if (priv->iw_mode == IW_MODE_INFRA) {
1565 union iwreq_data uwrq;
1566 prism54_get_wap(ndev, NULL, (struct sockaddr *) &uwrq,
1568 wireless_send_event(ndev, SIOCGIWAP, &uwrq, NULL);
1570 send_simple_event(netdev_priv(ndev),
1571 "Link established");
1573 send_simple_event(netdev_priv(ndev), "Link lost");
1576 /* Beacon/ProbeResp payload header */
1577 struct ieee80211_beacon_phdr {
1581 } __attribute__ ((packed));
1583 #define WLAN_EID_GENERIC 0xdd
1584 static u8 wpa_oid[4] = { 0x00, 0x50, 0xf2, 1 };
1586 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
1587 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
1590 prism54_wpa_ie_add(islpci_private *priv, u8 *bssid,
1591 u8 *wpa_ie, size_t wpa_ie_len)
1593 struct list_head *ptr;
1594 struct islpci_bss_wpa_ie *bss = NULL;
1596 if (wpa_ie_len > MAX_WPA_IE_LEN)
1597 wpa_ie_len = MAX_WPA_IE_LEN;
1599 if (down_interruptible(&priv->wpa_sem))
1602 /* try to use existing entry */
1603 list_for_each(ptr, &priv->bss_wpa_list) {
1604 bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
1605 if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0) {
1606 list_move(&bss->list, &priv->bss_wpa_list);
1613 /* add a new BSS entry; if max number of entries is already
1614 * reached, replace the least recently updated */
1615 if (priv->num_bss_wpa >= MAX_BSS_WPA_IE_COUNT) {
1616 bss = list_entry(priv->bss_wpa_list.prev,
1617 struct islpci_bss_wpa_ie, list);
1618 list_del(&bss->list);
1620 bss = kmalloc(sizeof (*bss), GFP_ATOMIC);
1622 priv->num_bss_wpa++;
1623 memset(bss, 0, sizeof (*bss));
1627 memcpy(bss->bssid, bssid, ETH_ALEN);
1628 list_add(&bss->list, &priv->bss_wpa_list);
1633 memcpy(bss->wpa_ie, wpa_ie, wpa_ie_len);
1634 bss->wpa_ie_len = wpa_ie_len;
1635 bss->last_update = jiffies;
1637 printk(KERN_DEBUG "Failed to add BSS WPA entry for " MACSTR
1638 "\n", MAC2STR(bssid));
1641 /* expire old entries from WPA list */
1642 while (priv->num_bss_wpa > 0) {
1643 bss = list_entry(priv->bss_wpa_list.prev,
1644 struct islpci_bss_wpa_ie, list);
1645 if (!time_after(jiffies, bss->last_update + 60 * HZ))
1648 list_del(&bss->list);
1649 priv->num_bss_wpa--;
1657 prism54_wpa_ie_get(islpci_private *priv, u8 *bssid, u8 *wpa_ie)
1659 struct list_head *ptr;
1660 struct islpci_bss_wpa_ie *bss = NULL;
1663 if (down_interruptible(&priv->wpa_sem))
1666 list_for_each(ptr, &priv->bss_wpa_list) {
1667 bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
1668 if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0)
1673 len = bss->wpa_ie_len;
1674 memcpy(wpa_ie, bss->wpa_ie, len);
1682 prism54_wpa_ie_init(islpci_private *priv)
1684 INIT_LIST_HEAD(&priv->bss_wpa_list);
1685 sema_init(&priv->wpa_sem, 1);
1689 prism54_wpa_ie_clean(islpci_private *priv)
1691 struct list_head *ptr, *n;
1693 list_for_each_safe(ptr, n, &priv->bss_wpa_list) {
1694 struct islpci_bss_wpa_ie *bss;
1695 bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
1701 prism54_process_bss_data(islpci_private *priv, u32 oid, u8 *addr,
1702 u8 *payload, size_t len)
1704 struct ieee80211_beacon_phdr *hdr;
1710 hdr = (struct ieee80211_beacon_phdr *) payload;
1711 pos = (u8 *) (hdr + 1);
1712 end = payload + len;
1714 if (pos + 2 + pos[1] > end) {
1715 printk(KERN_DEBUG "Parsing Beacon/ProbeResp failed "
1716 "for " MACSTR "\n", MAC2STR(addr));
1719 if (pos[0] == WLAN_EID_GENERIC && pos[1] >= 4 &&
1720 memcmp(pos + 2, wpa_oid, 4) == 0) {
1721 prism54_wpa_ie_add(priv, addr, pos, pos[1] + 2);
1729 handle_request(islpci_private *priv, struct obj_mlme *mlme, enum oid_num_t oid)
1731 if (((mlme->state == DOT11_STATE_AUTHING) ||
1732 (mlme->state == DOT11_STATE_ASSOCING))
1733 && mgt_mlme_answer(priv)) {
1734 /* Someone is requesting auth and we must respond. Just send back
1735 * the trap with error code set accordingly.
1737 mlme->code = prism54_mac_accept(&priv->acl,
1738 mlme->address) ? 0 : 1;
1739 mgt_set_request(priv, oid, 0, mlme);
1744 prism54_process_trap_helper(islpci_private *priv, enum oid_num_t oid,
1747 struct obj_mlme *mlme = (struct obj_mlme *) data;
1749 u8 *payload, *pos = (u8 *) (mlme + 1);
1751 len = pos[0] | (pos[1] << 8); /* little endian data length */
1754 /* I think all trapable objects are listed here.
1755 * Some oids have a EX version. The difference is that they are emitted
1756 * in DOT11_MLME_EXTENDED mode (set with DOT11_OID_MLMEAUTOLEVEL)
1758 * The few events already defined by the wireless tools are not really
1759 * suited. We use the more flexible custom event facility.
1762 /* I fear prism54_process_bss_data won't work with big endian data */
1763 if ((oid == DOT11_OID_BEACON) || (oid == DOT11_OID_PROBE))
1764 prism54_process_bss_data(priv, oid, mlme->address,
1767 mgt_le_to_cpu(isl_oid[oid].flags & OID_FLAG_TYPE, (void *) mlme);
1771 case GEN_OID_LINKSTATE:
1772 link_changed(priv->ndev, (u32) *data);
1775 case DOT11_OID_MICFAILURE:
1776 send_simple_event(priv, "Mic failure");
1779 case DOT11_OID_DEAUTHENTICATE:
1780 send_formatted_event(priv, "DeAuthenticate request", mlme, 0);
1783 case DOT11_OID_AUTHENTICATE:
1784 handle_request(priv, mlme, oid);
1785 send_formatted_event(priv, "Authenticate request", mlme, 1);
1788 case DOT11_OID_DISASSOCIATE:
1789 send_formatted_event(priv, "Disassociate request", mlme, 0);
1792 case DOT11_OID_ASSOCIATE:
1793 handle_request(priv, mlme, oid);
1794 send_formatted_event(priv, "Associate request", mlme, 1);
1797 case DOT11_OID_REASSOCIATE:
1798 handle_request(priv, mlme, oid);
1799 send_formatted_event(priv, "ReAssociate request", mlme, 1);
1802 case DOT11_OID_BEACON:
1803 send_formatted_event(priv,
1804 "Received a beacon from an unkown AP",
1808 case DOT11_OID_PROBE:
1809 /* we received a probe from a client. */
1810 send_formatted_event(priv, "Received a probe from client", mlme,
1814 /* Note : "mlme" is actually a "struct obj_mlmeex *" here, but this
1815 * is backward compatible layout-wise with "struct obj_mlme".
1818 case DOT11_OID_DEAUTHENTICATEEX:
1819 send_formatted_event(priv, "DeAuthenticate request", mlme, 0);
1822 case DOT11_OID_AUTHENTICATEEX:
1823 handle_request(priv, mlme, oid);
1824 send_formatted_event(priv, "Authenticate request", mlme, 1);
1827 case DOT11_OID_DISASSOCIATEEX:
1828 send_formatted_event(priv, "Disassociate request", mlme, 0);
1831 case DOT11_OID_ASSOCIATEEX:
1832 handle_request(priv, mlme, oid);
1833 send_formatted_event(priv, "Associate request", mlme, 1);
1836 case DOT11_OID_REASSOCIATEEX:
1837 handle_request(priv, mlme, oid);
1838 send_formatted_event(priv, "Reassociate request", mlme, 1);
1849 * Process a device trap. This is called via schedule_work(), outside of
1850 * interrupt context, no locks held.
1853 prism54_process_trap(void *data)
1855 struct islpci_mgmtframe *frame = data;
1856 struct net_device *ndev = frame->ndev;
1857 enum oid_num_t n = mgt_oidtonum(frame->header->oid);
1859 if (n != OID_NUM_LAST)
1860 prism54_process_trap_helper(netdev_priv(ndev), n, frame->data);
1861 islpci_mgt_release(frame);
1865 prism54_set_mac_address(struct net_device *ndev, void *addr)
1867 islpci_private *priv = netdev_priv(ndev);
1870 if (ndev->addr_len != 6)
1872 ret = mgt_set_request(priv, GEN_OID_MACADDRESS, 0,
1873 &((struct sockaddr *) addr)->sa_data);
1875 memcpy(priv->ndev->dev_addr,
1876 &((struct sockaddr *) addr)->sa_data, 6);
1882 prism54_set_wpa(struct net_device *ndev, struct iw_request_info *info,
1883 __u32 * uwrq, char *extra)
1885 islpci_private *priv = netdev_priv(ndev);
1887 down_write(&priv->mib_sem);
1891 u32 l = DOT11_MLME_EXTENDED;
1892 mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &l);
1894 /* restart the card with new level. Needed ? */
1896 up_write(&priv->mib_sem);
1902 prism54_get_wpa(struct net_device *ndev, struct iw_request_info *info,
1903 __u32 * uwrq, char *extra)
1905 islpci_private *priv = netdev_priv(ndev);
1911 prism54_set_prismhdr(struct net_device *ndev, struct iw_request_info *info,
1912 __u32 * uwrq, char *extra)
1914 islpci_private *priv = netdev_priv(ndev);
1915 priv->monitor_type =
1916 (*uwrq ? ARPHRD_IEEE80211_PRISM : ARPHRD_IEEE80211);
1917 if (priv->iw_mode == IW_MODE_MONITOR)
1918 priv->ndev->type = priv->monitor_type;
1924 prism54_get_prismhdr(struct net_device *ndev, struct iw_request_info *info,
1925 __u32 * uwrq, char *extra)
1927 islpci_private *priv = netdev_priv(ndev);
1928 *uwrq = (priv->monitor_type == ARPHRD_IEEE80211_PRISM);
1933 prism54_debug_oid(struct net_device *ndev, struct iw_request_info *info,
1934 __u32 * uwrq, char *extra)
1936 islpci_private *priv = netdev_priv(ndev);
1938 priv->priv_oid = *uwrq;
1939 printk("%s: oid 0x%08X\n", ndev->name, *uwrq);
1945 prism54_debug_get_oid(struct net_device *ndev, struct iw_request_info *info,
1946 struct iw_point *data, char *extra)
1948 islpci_private *priv = netdev_priv(ndev);
1949 struct islpci_mgmtframe *response = NULL;
1952 printk("%s: get_oid 0x%08X\n", ndev->name, priv->priv_oid);
1955 if (islpci_get_state(priv) >= PRV_STATE_INIT) {
1957 islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET,
1958 priv->priv_oid, extra, 256,
1960 printk("%s: ret: %i\n", ndev->name, ret);
1961 if (ret || !response
1962 || response->header->operation == PIMFOR_OP_ERROR) {
1964 islpci_mgt_release(response);
1966 printk("%s: EIO\n", ndev->name);
1970 data->length = response->header->length;
1971 memcpy(extra, response->data, data->length);
1972 islpci_mgt_release(response);
1973 printk("%s: len: %i\n", ndev->name, data->length);
1981 prism54_debug_set_oid(struct net_device *ndev, struct iw_request_info *info,
1982 struct iw_point *data, char *extra)
1984 islpci_private *priv = netdev_priv(ndev);
1985 struct islpci_mgmtframe *response = NULL;
1986 int ret = 0, response_op = PIMFOR_OP_ERROR;
1988 printk("%s: set_oid 0x%08X\tlen: %d\n", ndev->name, priv->priv_oid,
1991 if (islpci_get_state(priv) >= PRV_STATE_INIT) {
1993 islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET,
1994 priv->priv_oid, extra, data->length,
1996 printk("%s: ret: %i\n", ndev->name, ret);
1997 if (ret || !response
1998 || response->header->operation == PIMFOR_OP_ERROR) {
2000 islpci_mgt_release(response);
2002 printk("%s: EIO\n", ndev->name);
2006 response_op = response->header->operation;
2007 printk("%s: response_op: %i\n", ndev->name,
2009 islpci_mgt_release(response);
2013 return (ret ? ret : -EINPROGRESS);
2017 prism54_set_spy(struct net_device *ndev,
2018 struct iw_request_info *info,
2019 union iwreq_data *uwrq, char *extra)
2021 islpci_private *priv = netdev_priv(ndev);
2022 u32 u, oid = OID_INL_CONFIG;
2024 down_write(&priv->mib_sem);
2025 mgt_get(priv, OID_INL_CONFIG, &u);
2027 if ((uwrq->data.length == 0) && (priv->spy_data.spy_number > 0))
2029 u &= ~INL_CONFIG_RXANNEX;
2030 else if ((uwrq->data.length > 0) && (priv->spy_data.spy_number == 0))
2032 u |= INL_CONFIG_RXANNEX;
2034 mgt_set(priv, OID_INL_CONFIG, &u);
2035 mgt_commit_list(priv, &oid, 1);
2036 up_write(&priv->mib_sem);
2038 return iw_handler_set_spy(ndev, info, uwrq, extra);
2041 static const iw_handler prism54_handler[] = {
2042 (iw_handler) prism54_commit, /* SIOCSIWCOMMIT */
2043 (iw_handler) prism54_get_name, /* SIOCGIWNAME */
2044 (iw_handler) NULL, /* SIOCSIWNWID */
2045 (iw_handler) NULL, /* SIOCGIWNWID */
2046 (iw_handler) prism54_set_freq, /* SIOCSIWFREQ */
2047 (iw_handler) prism54_get_freq, /* SIOCGIWFREQ */
2048 (iw_handler) prism54_set_mode, /* SIOCSIWMODE */
2049 (iw_handler) prism54_get_mode, /* SIOCGIWMODE */
2050 (iw_handler) prism54_set_sens, /* SIOCSIWSENS */
2051 (iw_handler) prism54_get_sens, /* SIOCGIWSENS */
2052 (iw_handler) NULL, /* SIOCSIWRANGE */
2053 (iw_handler) prism54_get_range, /* SIOCGIWRANGE */
2054 (iw_handler) NULL, /* SIOCSIWPRIV */
2055 (iw_handler) NULL, /* SIOCGIWPRIV */
2056 (iw_handler) NULL, /* SIOCSIWSTATS */
2057 (iw_handler) NULL, /* SIOCGIWSTATS */
2058 prism54_set_spy, /* SIOCSIWSPY */
2059 iw_handler_get_spy, /* SIOCGIWSPY */
2060 iw_handler_set_thrspy, /* SIOCSIWTHRSPY */
2061 iw_handler_get_thrspy, /* SIOCGIWTHRSPY */
2062 (iw_handler) prism54_set_wap, /* SIOCSIWAP */
2063 (iw_handler) prism54_get_wap, /* SIOCGIWAP */
2064 (iw_handler) NULL, /* -- hole -- */
2065 (iw_handler) NULL, /* SIOCGIWAPLIST depreciated */
2066 (iw_handler) prism54_set_scan, /* SIOCSIWSCAN */
2067 (iw_handler) prism54_get_scan, /* SIOCGIWSCAN */
2068 (iw_handler) prism54_set_essid, /* SIOCSIWESSID */
2069 (iw_handler) prism54_get_essid, /* SIOCGIWESSID */
2070 (iw_handler) prism54_set_nick, /* SIOCSIWNICKN */
2071 (iw_handler) prism54_get_nick, /* SIOCGIWNICKN */
2072 (iw_handler) NULL, /* -- hole -- */
2073 (iw_handler) NULL, /* -- hole -- */
2074 (iw_handler) prism54_set_rate, /* SIOCSIWRATE */
2075 (iw_handler) prism54_get_rate, /* SIOCGIWRATE */
2076 (iw_handler) prism54_set_rts, /* SIOCSIWRTS */
2077 (iw_handler) prism54_get_rts, /* SIOCGIWRTS */
2078 (iw_handler) prism54_set_frag, /* SIOCSIWFRAG */
2079 (iw_handler) prism54_get_frag, /* SIOCGIWFRAG */
2080 (iw_handler) prism54_set_txpower, /* SIOCSIWTXPOW */
2081 (iw_handler) prism54_get_txpower, /* SIOCGIWTXPOW */
2082 (iw_handler) prism54_set_retry, /* SIOCSIWRETRY */
2083 (iw_handler) prism54_get_retry, /* SIOCGIWRETRY */
2084 (iw_handler) prism54_set_encode, /* SIOCSIWENCODE */
2085 (iw_handler) prism54_get_encode, /* SIOCGIWENCODE */
2086 (iw_handler) NULL, /* SIOCSIWPOWER */
2087 (iw_handler) NULL, /* SIOCGIWPOWER */
2090 /* The low order bit identify a SET (0) or a GET (1) ioctl. */
2092 #define PRISM54_RESET SIOCIWFIRSTPRIV
2093 #define PRISM54_GET_POLICY SIOCIWFIRSTPRIV+1
2094 #define PRISM54_SET_POLICY SIOCIWFIRSTPRIV+2
2095 #define PRISM54_GET_MAC SIOCIWFIRSTPRIV+3
2096 #define PRISM54_ADD_MAC SIOCIWFIRSTPRIV+4
2098 #define PRISM54_DEL_MAC SIOCIWFIRSTPRIV+6
2100 #define PRISM54_KICK_MAC SIOCIWFIRSTPRIV+8
2102 #define PRISM54_KICK_ALL SIOCIWFIRSTPRIV+10
2104 #define PRISM54_GET_WPA SIOCIWFIRSTPRIV+11
2105 #define PRISM54_SET_WPA SIOCIWFIRSTPRIV+12
2107 #define PRISM54_DBG_OID SIOCIWFIRSTPRIV+14
2108 #define PRISM54_DBG_GET_OID SIOCIWFIRSTPRIV+15
2109 #define PRISM54_DBG_SET_OID SIOCIWFIRSTPRIV+16
2111 #define PRISM54_GET_OID SIOCIWFIRSTPRIV+17
2112 #define PRISM54_SET_OID_U32 SIOCIWFIRSTPRIV+18
2113 #define PRISM54_SET_OID_STR SIOCIWFIRSTPRIV+20
2114 #define PRISM54_SET_OID_ADDR SIOCIWFIRSTPRIV+22
2116 #define PRISM54_GET_PRISMHDR SIOCIWFIRSTPRIV+23
2117 #define PRISM54_SET_PRISMHDR SIOCIWFIRSTPRIV+24
2119 #define IWPRIV_SET_U32(n,x) { n, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x }
2120 #define IWPRIV_SET_SSID(n,x) { n, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x }
2121 #define IWPRIV_SET_ADDR(n,x) { n, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x }
2122 #define IWPRIV_GET(n,x) { n, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, "g_"x }
2124 #define IWPRIV_U32(n,x) IWPRIV_SET_U32(n,x), IWPRIV_GET(n,x)
2125 #define IWPRIV_SSID(n,x) IWPRIV_SET_SSID(n,x), IWPRIV_GET(n,x)
2126 #define IWPRIV_ADDR(n,x) IWPRIV_SET_ADDR(n,x), IWPRIV_GET(n,x)
2128 /* Note : limited to 128 private ioctls (wireless tools 26) */
2130 static const struct iw_priv_args prism54_private_args[] = {
2131 /*{ cmd, set_args, get_args, name } */
2132 {PRISM54_RESET, 0, 0, "reset"},
2133 {PRISM54_GET_PRISMHDR, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
2135 {PRISM54_SET_PRISMHDR, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2137 {PRISM54_GET_POLICY, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
2139 {PRISM54_SET_POLICY, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2141 {PRISM54_GET_MAC, 0, IW_PRIV_TYPE_ADDR | 64, "getMac"},
2142 {PRISM54_ADD_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,
2144 {PRISM54_DEL_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,
2146 {PRISM54_KICK_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,
2148 {PRISM54_KICK_ALL, 0, 0, "kickAll"},
2149 {PRISM54_GET_WPA, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
2151 {PRISM54_SET_WPA, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2153 {PRISM54_DBG_OID, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2155 {PRISM54_DBG_GET_OID, 0, IW_PRIV_TYPE_BYTE | 256, "dbg_get_oid"},
2156 {PRISM54_DBG_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "dbg_set_oid"},
2157 /* --- sub-ioctls handlers --- */
2159 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, ""},
2160 {PRISM54_SET_OID_U32,
2161 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, ""},
2162 {PRISM54_SET_OID_STR,
2163 IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, ""},
2164 {PRISM54_SET_OID_ADDR,
2165 IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, ""},
2166 /* --- sub-ioctls definitions --- */
2167 IWPRIV_ADDR(GEN_OID_MACADDRESS, "addr"),
2168 IWPRIV_GET(GEN_OID_LINKSTATE, "linkstate"),
2169 IWPRIV_U32(DOT11_OID_BSSTYPE, "bsstype"),
2170 IWPRIV_ADDR(DOT11_OID_BSSID, "bssid"),
2171 IWPRIV_U32(DOT11_OID_STATE, "state"),
2172 IWPRIV_U32(DOT11_OID_AID, "aid"),
2174 IWPRIV_SSID(DOT11_OID_SSIDOVERRIDE, "ssidoverride"),
2176 IWPRIV_U32(DOT11_OID_MEDIUMLIMIT, "medlimit"),
2177 IWPRIV_U32(DOT11_OID_BEACONPERIOD, "beacon"),
2178 IWPRIV_U32(DOT11_OID_DTIMPERIOD, "dtimperiod"),
2180 IWPRIV_U32(DOT11_OID_AUTHENABLE, "authenable"),
2181 IWPRIV_U32(DOT11_OID_PRIVACYINVOKED, "privinvok"),
2182 IWPRIV_U32(DOT11_OID_EXUNENCRYPTED, "exunencrypt"),
2184 IWPRIV_U32(DOT11_OID_REKEYTHRESHOLD, "rekeythresh"),
2186 IWPRIV_U32(DOT11_OID_MAXTXLIFETIME, "maxtxlife"),
2187 IWPRIV_U32(DOT11_OID_MAXRXLIFETIME, "maxrxlife"),
2188 IWPRIV_U32(DOT11_OID_ALOFT_FIXEDRATE, "fixedrate"),
2189 IWPRIV_U32(DOT11_OID_MAXFRAMEBURST, "frameburst"),
2190 IWPRIV_U32(DOT11_OID_PSM, "psm"),
2192 IWPRIV_U32(DOT11_OID_BRIDGELOCAL, "bridge"),
2193 IWPRIV_U32(DOT11_OID_CLIENTS, "clients"),
2194 IWPRIV_U32(DOT11_OID_CLIENTSASSOCIATED, "clientassoc"),
2195 IWPRIV_U32(DOT11_OID_DOT1XENABLE, "dot1xenable"),
2196 IWPRIV_U32(DOT11_OID_ANTENNARX, "rxant"),
2197 IWPRIV_U32(DOT11_OID_ANTENNATX, "txant"),
2198 IWPRIV_U32(DOT11_OID_ANTENNADIVERSITY, "antdivers"),
2199 IWPRIV_U32(DOT11_OID_EDTHRESHOLD, "edthresh"),
2200 IWPRIV_U32(DOT11_OID_PREAMBLESETTINGS, "preamble"),
2201 IWPRIV_GET(DOT11_OID_RATES, "rates"),
2202 IWPRIV_U32(DOT11_OID_OUTPUTPOWER, ".11outpower"),
2203 IWPRIV_GET(DOT11_OID_SUPPORTEDRATES, "supprates"),
2204 IWPRIV_GET(DOT11_OID_SUPPORTEDFREQUENCIES, "suppfreq"),
2206 IWPRIV_U32(DOT11_OID_NOISEFLOOR, "noisefloor"),
2207 IWPRIV_GET(DOT11_OID_FREQUENCYACTIVITY, "freqactivity"),
2208 IWPRIV_U32(DOT11_OID_NONERPPROTECTION, "nonerpprotec"),
2209 IWPRIV_U32(DOT11_OID_PROFILES, "profile"),
2210 IWPRIV_GET(DOT11_OID_EXTENDEDRATES, "extrates"),
2211 IWPRIV_U32(DOT11_OID_MLMEAUTOLEVEL, "mlmelevel"),
2213 IWPRIV_GET(DOT11_OID_BSSS, "bsss"),
2214 IWPRIV_GET(DOT11_OID_BSSLIST, "bsslist"),
2215 IWPRIV_U32(OID_INL_MODE, "mode"),
2216 IWPRIV_U32(OID_INL_CONFIG, "config"),
2217 IWPRIV_U32(OID_INL_DOT11D_CONFORMANCE, ".11dconform"),
2218 IWPRIV_GET(OID_INL_PHYCAPABILITIES, "phycapa"),
2219 IWPRIV_U32(OID_INL_OUTPUTPOWER, "outpower"),
2222 static const iw_handler prism54_private_handler[] = {
2223 (iw_handler) prism54_reset,
2224 (iw_handler) prism54_get_policy,
2225 (iw_handler) prism54_set_policy,
2226 (iw_handler) prism54_get_mac,
2227 (iw_handler) prism54_add_mac,
2229 (iw_handler) prism54_del_mac,
2231 (iw_handler) prism54_kick_mac,
2233 (iw_handler) prism54_kick_all,
2234 (iw_handler) prism54_get_wpa,
2235 (iw_handler) prism54_set_wpa,
2237 (iw_handler) prism54_debug_oid,
2238 (iw_handler) prism54_debug_get_oid,
2239 (iw_handler) prism54_debug_set_oid,
2240 (iw_handler) prism54_get_oid,
2241 (iw_handler) prism54_set_u32,
2243 (iw_handler) prism54_set_raw,
2245 (iw_handler) prism54_set_raw,
2246 (iw_handler) prism54_get_prismhdr,
2247 (iw_handler) prism54_set_prismhdr,
2250 const struct iw_handler_def prism54_handler_def = {
2251 .num_standard = sizeof (prism54_handler) / sizeof (iw_handler),
2252 .num_private = sizeof (prism54_private_handler) / sizeof (iw_handler),
2254 sizeof (prism54_private_args) / sizeof (struct iw_priv_args),
2255 .standard = (iw_handler *) prism54_handler,
2256 .private = (iw_handler *) prism54_private_handler,
2257 .private_args = (struct iw_priv_args *) prism54_private_args,
2258 .spy_offset = offsetof(islpci_private, spy_data),
2261 /* For ioctls that don't work with the new API */
2264 prism54_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)