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] = (__s32) (*data >> 1);
517 range->bitrate[i] *= 1000000;
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);
824 mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r)))
827 rate = (u32) (vwrq->value / 500000);
832 if (rate && (data[i] == rate)) {
835 if (vwrq->value == i) {
849 /* Now, check if we want a fixed or auto value */
857 printk("prism54 rate: ");
859 printk("%u ", data[i]);
865 ret = mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile);
866 ret |= mgt_set_request(priv, DOT11_OID_EXTENDEDRATES, 0, data);
867 ret |= mgt_set_request(priv, DOT11_OID_RATES, 0, data);
874 /* Get the current bit rate */
876 prism54_get_rate(struct net_device *ndev,
877 struct iw_request_info *info,
878 struct iw_param *vwrq, char *extra)
880 islpci_private *priv = netdev_priv(ndev);
885 /* Get the current bit rate */
886 if ((rvalue = mgt_get_request(priv, GEN_OID_LINKSTATE, 0, NULL, &r)))
888 vwrq->value = r.u * 500000;
890 /* request the device for the enabled rates */
891 if ((rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r)))
894 vwrq->fixed = (data[0] != 0) && (data[1] == 0);
901 prism54_set_rts(struct net_device *ndev, struct iw_request_info *info,
902 struct iw_param *vwrq, char *extra)
904 islpci_private *priv = netdev_priv(ndev);
906 return mgt_set_request(priv, DOT11_OID_RTSTHRESH, 0, &vwrq->value);
910 prism54_get_rts(struct net_device *ndev, struct iw_request_info *info,
911 struct iw_param *vwrq, char *extra)
913 islpci_private *priv = netdev_priv(ndev);
917 /* get the rts threshold */
918 rvalue = mgt_get_request(priv, DOT11_OID_RTSTHRESH, 0, NULL, &r);
925 prism54_set_frag(struct net_device *ndev, struct iw_request_info *info,
926 struct iw_param *vwrq, char *extra)
928 islpci_private *priv = netdev_priv(ndev);
930 return mgt_set_request(priv, DOT11_OID_FRAGTHRESH, 0, &vwrq->value);
934 prism54_get_frag(struct net_device *ndev, struct iw_request_info *info,
935 struct iw_param *vwrq, char *extra)
937 islpci_private *priv = netdev_priv(ndev);
941 rvalue = mgt_get_request(priv, DOT11_OID_FRAGTHRESH, 0, NULL, &r);
947 /* Here we have (min,max) = max retries for (small frames, big frames). Where
948 * big frame <=> bigger than the rts threshold
949 * small frame <=> smaller than the rts threshold
950 * This is not really the behavior expected by the wireless tool but it seems
951 * to be a common behavior in other drivers.
955 prism54_set_retry(struct net_device *ndev, struct iw_request_info *info,
956 struct iw_param *vwrq, char *extra)
958 islpci_private *priv = netdev_priv(ndev);
959 u32 slimit = 0, llimit = 0; /* short and long limit */
964 /* we cannot disable this feature */
967 if (vwrq->flags & IW_RETRY_LIMIT) {
968 if (vwrq->flags & IW_RETRY_MIN)
969 slimit = vwrq->value;
970 else if (vwrq->flags & IW_RETRY_MAX)
971 llimit = vwrq->value;
973 /* we are asked to set both */
974 slimit = vwrq->value;
975 llimit = vwrq->value;
978 if (vwrq->flags & IW_RETRY_LIFETIME)
979 /* Wireless tools use us unit while the device uses 1024 us unit */
980 lifetime = vwrq->value / 1024;
982 /* now set what is requested */
985 mgt_set_request(priv, DOT11_OID_SHORTRETRIES, 0, &slimit);
988 mgt_set_request(priv, DOT11_OID_LONGRETRIES, 0, &llimit);
991 mgt_set_request(priv, DOT11_OID_MAXTXLIFETIME, 0,
997 prism54_get_retry(struct net_device *ndev, struct iw_request_info *info,
998 struct iw_param *vwrq, char *extra)
1000 islpci_private *priv = netdev_priv(ndev);
1003 vwrq->disabled = 0; /* It cannot be disabled */
1005 if ((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
1006 /* we are asked for the life time */
1008 mgt_get_request(priv, DOT11_OID_MAXTXLIFETIME, 0, NULL, &r);
1009 vwrq->value = r.u * 1024;
1010 vwrq->flags = IW_RETRY_LIFETIME;
1011 } else if ((vwrq->flags & IW_RETRY_MAX)) {
1012 /* we are asked for the long retry limit */
1014 mgt_get_request(priv, DOT11_OID_LONGRETRIES, 0, NULL, &r);
1016 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
1018 /* default. get the short retry limit */
1020 mgt_get_request(priv, DOT11_OID_SHORTRETRIES, 0, NULL, &r);
1022 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MIN;
1029 prism54_set_encode(struct net_device *ndev, struct iw_request_info *info,
1030 struct iw_point *dwrq, char *extra)
1032 islpci_private *priv = netdev_priv(ndev);
1033 int rvalue = 0, force = 0;
1034 int authen = DOT11_AUTH_OS, invoke = 0, exunencrypt = 0;
1037 /* with the new API, it's impossible to get a NULL pointer.
1038 * New version of iwconfig set the IW_ENCODE_NOKEY flag
1039 * when no key is given, but older versions don't. */
1041 if (dwrq->length > 0) {
1042 /* we have a key to set */
1043 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1045 struct obj_key key = { DOT11_PRIV_WEP, 0, "" };
1047 /* get the current key index */
1048 rvalue = mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r);
1049 current_index = r.u;
1050 /* Verify that the key is not marked as invalid */
1051 if (!(dwrq->flags & IW_ENCODE_NOKEY)) {
1052 key.length = dwrq->length > sizeof (key.key) ?
1053 sizeof (key.key) : dwrq->length;
1054 memcpy(key.key, extra, key.length);
1055 if (key.length == 32)
1056 /* we want WPA-PSK */
1057 key.type = DOT11_PRIV_TKIP;
1058 if ((index < 0) || (index > 3))
1059 /* no index provided use the current one */
1060 index = current_index;
1062 /* now send the key to the card */
1064 mgt_set_request(priv, DOT11_OID_DEFKEYX, index,
1068 * If a valid key is set, encryption should be enabled
1069 * (user may turn it off later).
1070 * This is also how "iwconfig ethX key on" works
1072 if ((index == current_index) && (key.length > 0))
1075 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1076 if ((index >= 0) && (index <= 3)) {
1077 /* we want to set the key index */
1079 mgt_set_request(priv, DOT11_OID_DEFKEYID, 0,
1082 if (!dwrq->flags & IW_ENCODE_MODE) {
1083 /* we cannot do anything. Complain. */
1088 /* now read the flags */
1089 if (dwrq->flags & IW_ENCODE_DISABLED) {
1090 /* Encoding disabled,
1091 * authen = DOT11_AUTH_OS;
1093 * exunencrypt = 0; */
1095 if (dwrq->flags & IW_ENCODE_OPEN)
1096 /* Encode but accept non-encoded packets. No auth */
1098 if ((dwrq->flags & IW_ENCODE_RESTRICTED) || force) {
1099 /* Refuse non-encoded packets. Auth */
1100 authen = DOT11_AUTH_BOTH;
1104 /* do the change if requested */
1105 if ((dwrq->flags & IW_ENCODE_MODE) || force) {
1107 mgt_set_request(priv, DOT11_OID_AUTHENABLE, 0, &authen);
1109 mgt_set_request(priv, DOT11_OID_PRIVACYINVOKED, 0, &invoke);
1111 mgt_set_request(priv, DOT11_OID_EXUNENCRYPTED, 0,
1118 prism54_get_encode(struct net_device *ndev, struct iw_request_info *info,
1119 struct iw_point *dwrq, char *extra)
1121 islpci_private *priv = netdev_priv(ndev);
1122 struct obj_key *key;
1123 u32 devindex, index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1124 u32 authen = 0, invoke = 0, exunencrypt = 0;
1128 /* first get the flags */
1129 rvalue = mgt_get_request(priv, DOT11_OID_AUTHENABLE, 0, NULL, &r);
1131 rvalue |= mgt_get_request(priv, DOT11_OID_PRIVACYINVOKED, 0, NULL, &r);
1133 rvalue |= mgt_get_request(priv, DOT11_OID_EXUNENCRYPTED, 0, NULL, &r);
1136 if (invoke && (authen == DOT11_AUTH_BOTH) && exunencrypt)
1137 dwrq->flags = IW_ENCODE_RESTRICTED;
1138 else if ((authen == DOT11_AUTH_OS) && !exunencrypt) {
1140 dwrq->flags = IW_ENCODE_OPEN;
1142 dwrq->flags = IW_ENCODE_DISABLED;
1144 /* The card should not work in this state */
1147 /* get the current device key index */
1148 rvalue |= mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r);
1150 /* Now get the key, return it */
1151 if ((index < 0) || (index > 3))
1152 /* no index provided, use the current one */
1154 rvalue |= mgt_get_request(priv, DOT11_OID_DEFKEYX, index, NULL, &r);
1156 dwrq->length = key->length;
1157 memcpy(extra, key->key, dwrq->length);
1159 /* return the used key index */
1160 dwrq->flags |= devindex + 1;
1166 prism54_get_txpower(struct net_device *ndev, struct iw_request_info *info,
1167 struct iw_param *vwrq, char *extra)
1169 islpci_private *priv = netdev_priv(ndev);
1173 rvalue = mgt_get_request(priv, OID_INL_OUTPUTPOWER, 0, NULL, &r);
1174 /* intersil firmware operates in 0.25 dBm (1/4 dBm) */
1175 vwrq->value = (s32) r.u / 4;
1177 /* radio is not turned of
1178 * btw: how is possible to turn off only the radio
1186 prism54_set_txpower(struct net_device *ndev, struct iw_request_info *info,
1187 struct iw_param *vwrq, char *extra)
1189 islpci_private *priv = netdev_priv(ndev);
1190 s32 u = vwrq->value;
1192 /* intersil firmware operates in 0.25 dBm (1/4) */
1194 if (vwrq->disabled) {
1195 /* don't know how to disable radio */
1197 "%s: %s() disabling radio is not yet supported.\n",
1198 priv->ndev->name, __FUNCTION__);
1200 } else if (vwrq->fixed)
1201 /* currently only fixed value is supported */
1202 return mgt_set_request(priv, OID_INL_OUTPUTPOWER, 0, &u);
1205 "%s: %s() auto power will be implemented later.\n",
1206 priv->ndev->name, __FUNCTION__);
1212 prism54_reset(struct net_device *ndev, struct iw_request_info *info,
1213 __u32 * uwrq, char *extra)
1215 islpci_reset(netdev_priv(ndev), 0);
1221 prism54_get_oid(struct net_device *ndev, struct iw_request_info *info,
1222 struct iw_point *dwrq, char *extra)
1226 enum oid_num_t n = dwrq->flags;
1228 rvalue = mgt_get_request((islpci_private *) ndev->priv, n, 0, NULL, &r);
1229 dwrq->length = mgt_response_to_str(n, &r, extra);
1230 if ((isl_oid[n].flags & OID_FLAG_TYPE) != OID_TYPE_U32)
1236 prism54_set_u32(struct net_device *ndev, struct iw_request_info *info,
1237 __u32 * uwrq, char *extra)
1239 u32 oid = uwrq[0], u = uwrq[1];
1241 return mgt_set_request((islpci_private *) ndev->priv, oid, 0, &u);
1245 prism54_set_raw(struct net_device *ndev, struct iw_request_info *info,
1246 struct iw_point *dwrq, char *extra)
1248 u32 oid = dwrq->flags;
1250 return mgt_set_request((islpci_private *) ndev->priv, oid, 0, extra);
1254 prism54_acl_init(struct islpci_acl *acl)
1256 sema_init(&acl->sem, 1);
1257 INIT_LIST_HEAD(&acl->mac_list);
1259 acl->policy = MAC_POLICY_OPEN;
1263 prism54_clear_mac(struct islpci_acl *acl)
1265 struct list_head *ptr, *next;
1266 struct mac_entry *entry;
1268 if (down_interruptible(&acl->sem))
1271 if (acl->size == 0) {
1276 for (ptr = acl->mac_list.next, next = ptr->next;
1277 ptr != &acl->mac_list; ptr = next, next = ptr->next) {
1278 entry = list_entry(ptr, struct mac_entry, _list);
1287 prism54_acl_clean(struct islpci_acl *acl)
1289 prism54_clear_mac(acl);
1293 prism54_add_mac(struct net_device *ndev, struct iw_request_info *info,
1294 struct sockaddr *awrq, char *extra)
1296 islpci_private *priv = netdev_priv(ndev);
1297 struct islpci_acl *acl = &priv->acl;
1298 struct mac_entry *entry;
1299 struct sockaddr *addr = (struct sockaddr *) extra;
1301 if (addr->sa_family != ARPHRD_ETHER)
1304 entry = kmalloc(sizeof (struct mac_entry), GFP_KERNEL);
1308 memcpy(entry->addr, addr->sa_data, ETH_ALEN);
1310 if (down_interruptible(&acl->sem)) {
1312 return -ERESTARTSYS;
1314 list_add_tail(&entry->_list, &acl->mac_list);
1322 prism54_del_mac(struct net_device *ndev, struct iw_request_info *info,
1323 struct sockaddr *awrq, char *extra)
1325 islpci_private *priv = netdev_priv(ndev);
1326 struct islpci_acl *acl = &priv->acl;
1327 struct mac_entry *entry;
1328 struct list_head *ptr;
1329 struct sockaddr *addr = (struct sockaddr *) extra;
1331 if (addr->sa_family != ARPHRD_ETHER)
1334 if (down_interruptible(&acl->sem))
1335 return -ERESTARTSYS;
1336 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
1337 entry = list_entry(ptr, struct mac_entry, _list);
1339 if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) {
1352 prism54_get_mac(struct net_device *ndev, struct iw_request_info *info,
1353 struct iw_point *dwrq, char *extra)
1355 islpci_private *priv = netdev_priv(ndev);
1356 struct islpci_acl *acl = &priv->acl;
1357 struct mac_entry *entry;
1358 struct list_head *ptr;
1359 struct sockaddr *dst = (struct sockaddr *) extra;
1363 if (down_interruptible(&acl->sem))
1364 return -ERESTARTSYS;
1366 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
1367 entry = list_entry(ptr, struct mac_entry, _list);
1369 memcpy(dst->sa_data, entry->addr, ETH_ALEN);
1370 dst->sa_family = ARPHRD_ETHER;
1378 /* Setting policy also clears the MAC acl, even if we don't change the defaut
1383 prism54_set_policy(struct net_device *ndev, struct iw_request_info *info,
1384 __u32 * uwrq, char *extra)
1386 islpci_private *priv = netdev_priv(ndev);
1387 struct islpci_acl *acl = &priv->acl;
1390 prism54_clear_mac(acl);
1392 if ((*uwrq < MAC_POLICY_OPEN) || (*uwrq > MAC_POLICY_REJECT))
1395 down_write(&priv->mib_sem);
1397 acl->policy = *uwrq;
1399 /* the ACL code needs an intermediate mlmeautolevel */
1400 if ((priv->iw_mode == IW_MODE_MASTER) &&
1401 (acl->policy != MAC_POLICY_OPEN))
1402 mlmeautolevel = DOT11_MLME_INTERMEDIATE;
1404 mlmeautolevel = CARD_DEFAULT_MLME_MODE;
1406 mlmeautolevel = DOT11_MLME_EXTENDED;
1407 mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &mlmeautolevel);
1408 /* restart the card with our new policy */
1410 up_write(&priv->mib_sem);
1416 prism54_get_policy(struct net_device *ndev, struct iw_request_info *info,
1417 __u32 * uwrq, char *extra)
1419 islpci_private *priv = netdev_priv(ndev);
1420 struct islpci_acl *acl = &priv->acl;
1422 *uwrq = acl->policy;
1427 /* Return 1 only if client should be accepted. */
1430 prism54_mac_accept(struct islpci_acl *acl, char *mac)
1432 struct list_head *ptr;
1433 struct mac_entry *entry;
1436 if (down_interruptible(&acl->sem))
1437 return -ERESTARTSYS;
1439 if (acl->policy == MAC_POLICY_OPEN) {
1444 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
1445 entry = list_entry(ptr, struct mac_entry, _list);
1446 if (memcmp(entry->addr, mac, ETH_ALEN) == 0) {
1451 res = (acl->policy == MAC_POLICY_ACCEPT) ? !res : res;
1458 prism54_kick_all(struct net_device *ndev, struct iw_request_info *info,
1459 struct iw_point *dwrq, char *extra)
1461 struct obj_mlme *mlme;
1464 mlme = kmalloc(sizeof (struct obj_mlme), GFP_KERNEL);
1468 /* Tell the card to kick every client */
1471 mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
1478 prism54_kick_mac(struct net_device *ndev, struct iw_request_info *info,
1479 struct sockaddr *awrq, char *extra)
1481 struct obj_mlme *mlme;
1482 struct sockaddr *addr = (struct sockaddr *) extra;
1485 if (addr->sa_family != ARPHRD_ETHER)
1488 mlme = kmalloc(sizeof (struct obj_mlme), GFP_KERNEL);
1492 /* Tell the card to only kick the corresponding bastard */
1493 memcpy(mlme->address, addr->sa_data, ETH_ALEN);
1496 mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
1503 /* Translate a TRAP oid into a wireless event. Called in islpci_mgt_receive. */
1506 format_event(islpci_private *priv, char *dest, const char *str,
1507 const struct obj_mlme *mlme, u16 *length, int error)
1509 const u8 *a = mlme->address;
1510 int n = snprintf(dest, IW_CUSTOM_MAX,
1511 "%s %s %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X %s (%2.2X)",
1513 ((priv->iw_mode == IW_MODE_MASTER) ? "from" : "to"),
1514 a[0], a[1], a[2], a[3], a[4], a[5],
1515 (error ? (mlme->code ? " : REJECTED " : " : ACCEPTED ")
1517 BUG_ON(n > IW_CUSTOM_MAX);
1522 send_formatted_event(islpci_private *priv, const char *str,
1523 const struct obj_mlme *mlme, int error)
1525 union iwreq_data wrqu;
1527 wrqu.data.pointer = kmalloc(IW_CUSTOM_MAX, GFP_KERNEL);
1528 if (!wrqu.data.pointer)
1530 wrqu.data.length = 0;
1531 format_event(priv, wrqu.data.pointer, str, mlme, &wrqu.data.length,
1533 wireless_send_event(priv->ndev, IWEVCUSTOM, &wrqu, wrqu.data.pointer);
1534 kfree(wrqu.data.pointer);
1538 send_simple_event(islpci_private *priv, const char *str)
1540 union iwreq_data wrqu;
1541 int n = strlen(str);
1543 wrqu.data.pointer = kmalloc(IW_CUSTOM_MAX, GFP_KERNEL);
1544 if (!wrqu.data.pointer)
1546 BUG_ON(n > IW_CUSTOM_MAX);
1547 wrqu.data.length = n;
1548 strcpy(wrqu.data.pointer, str);
1549 wireless_send_event(priv->ndev, IWEVCUSTOM, &wrqu, wrqu.data.pointer);
1550 kfree(wrqu.data.pointer);
1554 link_changed(struct net_device *ndev, u32 bitrate)
1556 islpci_private *priv = netdev_priv(ndev);
1559 if (priv->iw_mode == IW_MODE_INFRA) {
1560 union iwreq_data uwrq;
1561 prism54_get_wap(ndev, NULL, (struct sockaddr *) &uwrq,
1563 wireless_send_event(ndev, SIOCGIWAP, &uwrq, NULL);
1565 send_simple_event(netdev_priv(ndev),
1566 "Link established");
1568 send_simple_event(netdev_priv(ndev), "Link lost");
1571 /* Beacon/ProbeResp payload header */
1572 struct ieee80211_beacon_phdr {
1576 } __attribute__ ((packed));
1578 #define WLAN_EID_GENERIC 0xdd
1579 static u8 wpa_oid[4] = { 0x00, 0x50, 0xf2, 1 };
1581 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
1582 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
1585 prism54_wpa_ie_add(islpci_private *priv, u8 *bssid,
1586 u8 *wpa_ie, size_t wpa_ie_len)
1588 struct list_head *ptr;
1589 struct islpci_bss_wpa_ie *bss = NULL;
1591 if (wpa_ie_len > MAX_WPA_IE_LEN)
1592 wpa_ie_len = MAX_WPA_IE_LEN;
1594 if (down_interruptible(&priv->wpa_sem))
1597 /* try to use existing entry */
1598 list_for_each(ptr, &priv->bss_wpa_list) {
1599 bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
1600 if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0) {
1601 list_move(&bss->list, &priv->bss_wpa_list);
1608 /* add a new BSS entry; if max number of entries is already
1609 * reached, replace the least recently updated */
1610 if (priv->num_bss_wpa >= MAX_BSS_WPA_IE_COUNT) {
1611 bss = list_entry(priv->bss_wpa_list.prev,
1612 struct islpci_bss_wpa_ie, list);
1613 list_del(&bss->list);
1615 bss = kmalloc(sizeof (*bss), GFP_ATOMIC);
1617 priv->num_bss_wpa++;
1618 memset(bss, 0, sizeof (*bss));
1622 memcpy(bss->bssid, bssid, ETH_ALEN);
1623 list_add(&bss->list, &priv->bss_wpa_list);
1628 memcpy(bss->wpa_ie, wpa_ie, wpa_ie_len);
1629 bss->wpa_ie_len = wpa_ie_len;
1630 bss->last_update = jiffies;
1632 printk(KERN_DEBUG "Failed to add BSS WPA entry for " MACSTR
1633 "\n", MAC2STR(bssid));
1636 /* expire old entries from WPA list */
1637 while (priv->num_bss_wpa > 0) {
1638 bss = list_entry(priv->bss_wpa_list.prev,
1639 struct islpci_bss_wpa_ie, list);
1640 if (!time_after(jiffies, bss->last_update + 60 * HZ))
1643 list_del(&bss->list);
1644 priv->num_bss_wpa--;
1652 prism54_wpa_ie_get(islpci_private *priv, u8 *bssid, u8 *wpa_ie)
1654 struct list_head *ptr;
1655 struct islpci_bss_wpa_ie *bss = NULL;
1658 if (down_interruptible(&priv->wpa_sem))
1661 list_for_each(ptr, &priv->bss_wpa_list) {
1662 bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
1663 if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0)
1668 len = bss->wpa_ie_len;
1669 memcpy(wpa_ie, bss->wpa_ie, len);
1677 prism54_wpa_ie_init(islpci_private *priv)
1679 INIT_LIST_HEAD(&priv->bss_wpa_list);
1680 sema_init(&priv->wpa_sem, 1);
1684 prism54_wpa_ie_clean(islpci_private *priv)
1686 struct list_head *ptr, *n;
1688 list_for_each_safe(ptr, n, &priv->bss_wpa_list) {
1689 struct islpci_bss_wpa_ie *bss;
1690 bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
1696 prism54_process_bss_data(islpci_private *priv, u32 oid, u8 *addr,
1697 u8 *payload, size_t len)
1699 struct ieee80211_beacon_phdr *hdr;
1705 hdr = (struct ieee80211_beacon_phdr *) payload;
1706 pos = (u8 *) (hdr + 1);
1707 end = payload + len;
1709 if (pos + 2 + pos[1] > end) {
1710 printk(KERN_DEBUG "Parsing Beacon/ProbeResp failed "
1711 "for " MACSTR "\n", MAC2STR(addr));
1714 if (pos[0] == WLAN_EID_GENERIC && pos[1] >= 4 &&
1715 memcmp(pos + 2, wpa_oid, 4) == 0) {
1716 prism54_wpa_ie_add(priv, addr, pos, pos[1] + 2);
1724 handle_request(islpci_private *priv, struct obj_mlme *mlme, enum oid_num_t oid)
1726 if (((mlme->state == DOT11_STATE_AUTHING) ||
1727 (mlme->state == DOT11_STATE_ASSOCING))
1728 && mgt_mlme_answer(priv)) {
1729 /* Someone is requesting auth and we must respond. Just send back
1730 * the trap with error code set accordingly.
1732 mlme->code = prism54_mac_accept(&priv->acl,
1733 mlme->address) ? 0 : 1;
1734 mgt_set_request(priv, oid, 0, mlme);
1739 prism54_process_trap_helper(islpci_private *priv, enum oid_num_t oid,
1742 struct obj_mlme *mlme = (struct obj_mlme *) data;
1744 u8 *payload, *pos = (u8 *) (mlme + 1);
1746 len = pos[0] | (pos[1] << 8); /* little endian data length */
1749 /* I think all trapable objects are listed here.
1750 * Some oids have a EX version. The difference is that they are emitted
1751 * in DOT11_MLME_EXTENDED mode (set with DOT11_OID_MLMEAUTOLEVEL)
1753 * The few events already defined by the wireless tools are not really
1754 * suited. We use the more flexible custom event facility.
1757 /* I fear prism54_process_bss_data won't work with big endian data */
1758 if ((oid == DOT11_OID_BEACON) || (oid == DOT11_OID_PROBE))
1759 prism54_process_bss_data(priv, oid, mlme->address,
1762 mgt_le_to_cpu(isl_oid[oid].flags & OID_FLAG_TYPE, (void *) mlme);
1766 case GEN_OID_LINKSTATE:
1767 link_changed(priv->ndev, (u32) *data);
1770 case DOT11_OID_MICFAILURE:
1771 send_simple_event(priv, "Mic failure");
1774 case DOT11_OID_DEAUTHENTICATE:
1775 send_formatted_event(priv, "DeAuthenticate request", mlme, 0);
1778 case DOT11_OID_AUTHENTICATE:
1779 handle_request(priv, mlme, oid);
1780 send_formatted_event(priv, "Authenticate request", mlme, 1);
1783 case DOT11_OID_DISASSOCIATE:
1784 send_formatted_event(priv, "Disassociate request", mlme, 0);
1787 case DOT11_OID_ASSOCIATE:
1788 handle_request(priv, mlme, oid);
1789 send_formatted_event(priv, "Associate request", mlme, 1);
1792 case DOT11_OID_REASSOCIATE:
1793 handle_request(priv, mlme, oid);
1794 send_formatted_event(priv, "ReAssociate request", mlme, 1);
1797 case DOT11_OID_BEACON:
1798 send_formatted_event(priv,
1799 "Received a beacon from an unkown AP",
1803 case DOT11_OID_PROBE:
1804 /* we received a probe from a client. */
1805 send_formatted_event(priv, "Received a probe from client", mlme,
1809 /* Note : "mlme" is actually a "struct obj_mlmeex *" here, but this
1810 * is backward compatible layout-wise with "struct obj_mlme".
1813 case DOT11_OID_DEAUTHENTICATEEX:
1814 send_formatted_event(priv, "DeAuthenticate request", mlme, 0);
1817 case DOT11_OID_AUTHENTICATEEX:
1818 handle_request(priv, mlme, oid);
1819 send_formatted_event(priv, "Authenticate request", mlme, 1);
1822 case DOT11_OID_DISASSOCIATEEX:
1823 send_formatted_event(priv, "Disassociate request", mlme, 0);
1826 case DOT11_OID_ASSOCIATEEX:
1827 handle_request(priv, mlme, oid);
1828 send_formatted_event(priv, "Associate request", mlme, 1);
1831 case DOT11_OID_REASSOCIATEEX:
1832 handle_request(priv, mlme, oid);
1833 send_formatted_event(priv, "Reassociate request", mlme, 1);
1844 * Process a device trap. This is called via schedule_work(), outside of
1845 * interrupt context, no locks held.
1848 prism54_process_trap(void *data)
1850 struct islpci_mgmtframe *frame = data;
1851 struct net_device *ndev = frame->ndev;
1852 enum oid_num_t n = mgt_oidtonum(frame->header->oid);
1854 if (n != OID_NUM_LAST)
1855 prism54_process_trap_helper(netdev_priv(ndev), n, frame->data);
1856 islpci_mgt_release(frame);
1860 prism54_set_mac_address(struct net_device *ndev, void *addr)
1862 islpci_private *priv = netdev_priv(ndev);
1865 if (ndev->addr_len != 6)
1867 ret = mgt_set_request(priv, GEN_OID_MACADDRESS, 0,
1868 &((struct sockaddr *) addr)->sa_data);
1870 memcpy(priv->ndev->dev_addr,
1871 &((struct sockaddr *) addr)->sa_data, 6);
1877 prism54_set_wpa(struct net_device *ndev, struct iw_request_info *info,
1878 __u32 * uwrq, char *extra)
1880 islpci_private *priv = netdev_priv(ndev);
1882 down_write(&priv->mib_sem);
1886 u32 l = DOT11_MLME_EXTENDED;
1887 mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &l);
1889 /* restart the card with new level. Needed ? */
1891 up_write(&priv->mib_sem);
1897 prism54_get_wpa(struct net_device *ndev, struct iw_request_info *info,
1898 __u32 * uwrq, char *extra)
1900 islpci_private *priv = netdev_priv(ndev);
1906 prism54_set_prismhdr(struct net_device *ndev, struct iw_request_info *info,
1907 __u32 * uwrq, char *extra)
1909 islpci_private *priv = netdev_priv(ndev);
1910 priv->monitor_type =
1911 (*uwrq ? ARPHRD_IEEE80211_PRISM : ARPHRD_IEEE80211);
1912 if (priv->iw_mode == IW_MODE_MONITOR)
1913 priv->ndev->type = priv->monitor_type;
1919 prism54_get_prismhdr(struct net_device *ndev, struct iw_request_info *info,
1920 __u32 * uwrq, char *extra)
1922 islpci_private *priv = netdev_priv(ndev);
1923 *uwrq = (priv->monitor_type == ARPHRD_IEEE80211_PRISM);
1928 prism54_debug_oid(struct net_device *ndev, struct iw_request_info *info,
1929 __u32 * uwrq, char *extra)
1931 islpci_private *priv = netdev_priv(ndev);
1933 priv->priv_oid = *uwrq;
1934 printk("%s: oid 0x%08X\n", ndev->name, *uwrq);
1940 prism54_debug_get_oid(struct net_device *ndev, struct iw_request_info *info,
1941 struct iw_point *data, char *extra)
1943 islpci_private *priv = netdev_priv(ndev);
1944 struct islpci_mgmtframe *response = NULL;
1945 int ret = -EIO, response_op = PIMFOR_OP_ERROR;
1947 printk("%s: get_oid 0x%08X\n", ndev->name, priv->priv_oid);
1950 if (islpci_get_state(priv) >= PRV_STATE_INIT) {
1952 islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET,
1953 priv->priv_oid, extra, 256,
1955 response_op = response->header->operation;
1956 printk("%s: ret: %i\n", ndev->name, ret);
1957 printk("%s: response_op: %i\n", ndev->name, response_op);
1958 if (ret || !response
1959 || response->header->operation == PIMFOR_OP_ERROR) {
1961 islpci_mgt_release(response);
1963 printk("%s: EIO\n", ndev->name);
1967 data->length = response->header->length;
1968 memcpy(extra, response->data, data->length);
1969 islpci_mgt_release(response);
1970 printk("%s: len: %i\n", ndev->name, data->length);
1978 prism54_debug_set_oid(struct net_device *ndev, struct iw_request_info *info,
1979 struct iw_point *data, char *extra)
1981 islpci_private *priv = netdev_priv(ndev);
1982 struct islpci_mgmtframe *response = NULL;
1983 int ret = 0, response_op = PIMFOR_OP_ERROR;
1985 printk("%s: set_oid 0x%08X\tlen: %d\n", ndev->name, priv->priv_oid,
1988 if (islpci_get_state(priv) >= PRV_STATE_INIT) {
1990 islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET,
1991 priv->priv_oid, extra, data->length,
1993 printk("%s: ret: %i\n", ndev->name, ret);
1995 response_op = response->header->operation;
1996 printk("%s: response_op: %i\n", ndev->name,
1998 islpci_mgt_release(response);
2000 if (ret || response_op == PIMFOR_OP_ERROR) {
2001 printk("%s: EIO\n", ndev->name);
2006 return (ret ? ret : -EINPROGRESS);
2010 prism54_set_spy(struct net_device *ndev,
2011 struct iw_request_info *info,
2012 union iwreq_data *uwrq, char *extra)
2014 islpci_private *priv = netdev_priv(ndev);
2015 u32 u, oid = OID_INL_CONFIG;
2017 down_write(&priv->mib_sem);
2018 mgt_get(priv, OID_INL_CONFIG, &u);
2020 if ((uwrq->data.length == 0) && (priv->spy_data.spy_number > 0))
2022 u &= ~INL_CONFIG_RXANNEX;
2023 else if ((uwrq->data.length > 0) && (priv->spy_data.spy_number == 0))
2025 u |= INL_CONFIG_RXANNEX;
2027 mgt_set(priv, OID_INL_CONFIG, &u);
2028 mgt_commit_list(priv, &oid, 1);
2029 up_write(&priv->mib_sem);
2031 return iw_handler_set_spy(ndev, info, uwrq, extra);
2034 static const iw_handler prism54_handler[] = {
2035 (iw_handler) prism54_commit, /* SIOCSIWCOMMIT */
2036 (iw_handler) prism54_get_name, /* SIOCGIWNAME */
2037 (iw_handler) NULL, /* SIOCSIWNWID */
2038 (iw_handler) NULL, /* SIOCGIWNWID */
2039 (iw_handler) prism54_set_freq, /* SIOCSIWFREQ */
2040 (iw_handler) prism54_get_freq, /* SIOCGIWFREQ */
2041 (iw_handler) prism54_set_mode, /* SIOCSIWMODE */
2042 (iw_handler) prism54_get_mode, /* SIOCGIWMODE */
2043 (iw_handler) prism54_set_sens, /* SIOCSIWSENS */
2044 (iw_handler) prism54_get_sens, /* SIOCGIWSENS */
2045 (iw_handler) NULL, /* SIOCSIWRANGE */
2046 (iw_handler) prism54_get_range, /* SIOCGIWRANGE */
2047 (iw_handler) NULL, /* SIOCSIWPRIV */
2048 (iw_handler) NULL, /* SIOCGIWPRIV */
2049 (iw_handler) NULL, /* SIOCSIWSTATS */
2050 (iw_handler) NULL, /* SIOCGIWSTATS */
2051 prism54_set_spy, /* SIOCSIWSPY */
2052 iw_handler_get_spy, /* SIOCGIWSPY */
2053 iw_handler_set_thrspy, /* SIOCSIWTHRSPY */
2054 iw_handler_get_thrspy, /* SIOCGIWTHRSPY */
2055 (iw_handler) prism54_set_wap, /* SIOCSIWAP */
2056 (iw_handler) prism54_get_wap, /* SIOCGIWAP */
2057 (iw_handler) NULL, /* -- hole -- */
2058 (iw_handler) NULL, /* SIOCGIWAPLIST depreciated */
2059 (iw_handler) prism54_set_scan, /* SIOCSIWSCAN */
2060 (iw_handler) prism54_get_scan, /* SIOCGIWSCAN */
2061 (iw_handler) prism54_set_essid, /* SIOCSIWESSID */
2062 (iw_handler) prism54_get_essid, /* SIOCGIWESSID */
2063 (iw_handler) prism54_set_nick, /* SIOCSIWNICKN */
2064 (iw_handler) prism54_get_nick, /* SIOCGIWNICKN */
2065 (iw_handler) NULL, /* -- hole -- */
2066 (iw_handler) NULL, /* -- hole -- */
2067 (iw_handler) prism54_set_rate, /* SIOCSIWRATE */
2068 (iw_handler) prism54_get_rate, /* SIOCGIWRATE */
2069 (iw_handler) prism54_set_rts, /* SIOCSIWRTS */
2070 (iw_handler) prism54_get_rts, /* SIOCGIWRTS */
2071 (iw_handler) prism54_set_frag, /* SIOCSIWFRAG */
2072 (iw_handler) prism54_get_frag, /* SIOCGIWFRAG */
2073 (iw_handler) prism54_set_txpower, /* SIOCSIWTXPOW */
2074 (iw_handler) prism54_get_txpower, /* SIOCGIWTXPOW */
2075 (iw_handler) prism54_set_retry, /* SIOCSIWRETRY */
2076 (iw_handler) prism54_get_retry, /* SIOCGIWRETRY */
2077 (iw_handler) prism54_set_encode, /* SIOCSIWENCODE */
2078 (iw_handler) prism54_get_encode, /* SIOCGIWENCODE */
2079 (iw_handler) NULL, /* SIOCSIWPOWER */
2080 (iw_handler) NULL, /* SIOCGIWPOWER */
2083 /* The low order bit identify a SET (0) or a GET (1) ioctl. */
2085 #define PRISM54_RESET SIOCIWFIRSTPRIV
2086 #define PRISM54_GET_POLICY SIOCIWFIRSTPRIV+1
2087 #define PRISM54_SET_POLICY SIOCIWFIRSTPRIV+2
2088 #define PRISM54_GET_MAC SIOCIWFIRSTPRIV+3
2089 #define PRISM54_ADD_MAC SIOCIWFIRSTPRIV+4
2091 #define PRISM54_DEL_MAC SIOCIWFIRSTPRIV+6
2093 #define PRISM54_KICK_MAC SIOCIWFIRSTPRIV+8
2095 #define PRISM54_KICK_ALL SIOCIWFIRSTPRIV+10
2097 #define PRISM54_GET_WPA SIOCIWFIRSTPRIV+11
2098 #define PRISM54_SET_WPA SIOCIWFIRSTPRIV+12
2100 #define PRISM54_DBG_OID SIOCIWFIRSTPRIV+14
2101 #define PRISM54_DBG_GET_OID SIOCIWFIRSTPRIV+15
2102 #define PRISM54_DBG_SET_OID SIOCIWFIRSTPRIV+16
2104 #define PRISM54_GET_OID SIOCIWFIRSTPRIV+17
2105 #define PRISM54_SET_OID_U32 SIOCIWFIRSTPRIV+18
2106 #define PRISM54_SET_OID_STR SIOCIWFIRSTPRIV+20
2107 #define PRISM54_SET_OID_ADDR SIOCIWFIRSTPRIV+22
2109 #define PRISM54_GET_PRISMHDR SIOCIWFIRSTPRIV+23
2110 #define PRISM54_SET_PRISMHDR SIOCIWFIRSTPRIV+24
2112 #define IWPRIV_SET_U32(n,x) { n, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x }
2113 #define IWPRIV_SET_SSID(n,x) { n, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x }
2114 #define IWPRIV_SET_ADDR(n,x) { n, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x }
2115 #define IWPRIV_GET(n,x) { n, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, "g_"x }
2117 #define IWPRIV_U32(n,x) IWPRIV_SET_U32(n,x), IWPRIV_GET(n,x)
2118 #define IWPRIV_SSID(n,x) IWPRIV_SET_SSID(n,x), IWPRIV_GET(n,x)
2119 #define IWPRIV_ADDR(n,x) IWPRIV_SET_ADDR(n,x), IWPRIV_GET(n,x)
2121 /* Note : limited to 128 private ioctls (wireless tools 26) */
2123 static const struct iw_priv_args prism54_private_args[] = {
2124 /*{ cmd, set_args, get_args, name } */
2125 {PRISM54_RESET, 0, 0, "reset"},
2126 {PRISM54_GET_PRISMHDR, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
2128 {PRISM54_SET_PRISMHDR, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2130 {PRISM54_GET_POLICY, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
2132 {PRISM54_SET_POLICY, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2134 {PRISM54_GET_MAC, 0, IW_PRIV_TYPE_ADDR | 64, "getMac"},
2135 {PRISM54_ADD_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,
2137 {PRISM54_DEL_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,
2139 {PRISM54_KICK_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,
2141 {PRISM54_KICK_ALL, 0, 0, "kickAll"},
2142 {PRISM54_GET_WPA, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
2144 {PRISM54_SET_WPA, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2146 {PRISM54_DBG_OID, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2148 {PRISM54_DBG_GET_OID, 0, IW_PRIV_TYPE_BYTE | 256, "dbg_get_oid"},
2149 {PRISM54_DBG_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "dbg_set_oid"},
2150 /* --- sub-ioctls handlers --- */
2152 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, ""},
2153 {PRISM54_SET_OID_U32,
2154 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, ""},
2155 {PRISM54_SET_OID_STR,
2156 IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, ""},
2157 {PRISM54_SET_OID_ADDR,
2158 IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, ""},
2159 /* --- sub-ioctls definitions --- */
2160 IWPRIV_ADDR(GEN_OID_MACADDRESS, "addr"),
2161 IWPRIV_GET(GEN_OID_LINKSTATE, "linkstate"),
2162 IWPRIV_U32(DOT11_OID_BSSTYPE, "bsstype"),
2163 IWPRIV_ADDR(DOT11_OID_BSSID, "bssid"),
2164 IWPRIV_U32(DOT11_OID_STATE, "state"),
2165 IWPRIV_U32(DOT11_OID_AID, "aid"),
2167 IWPRIV_SSID(DOT11_OID_SSIDOVERRIDE, "ssidoverride"),
2169 IWPRIV_U32(DOT11_OID_MEDIUMLIMIT, "medlimit"),
2170 IWPRIV_U32(DOT11_OID_BEACONPERIOD, "beacon"),
2171 IWPRIV_U32(DOT11_OID_DTIMPERIOD, "dtimperiod"),
2173 IWPRIV_U32(DOT11_OID_AUTHENABLE, "authenable"),
2174 IWPRIV_U32(DOT11_OID_PRIVACYINVOKED, "privinvok"),
2175 IWPRIV_U32(DOT11_OID_EXUNENCRYPTED, "exunencrypt"),
2177 IWPRIV_U32(DOT11_OID_REKEYTHRESHOLD, "rekeythresh"),
2179 IWPRIV_U32(DOT11_OID_MAXTXLIFETIME, "maxtxlife"),
2180 IWPRIV_U32(DOT11_OID_MAXRXLIFETIME, "maxrxlife"),
2181 IWPRIV_U32(DOT11_OID_ALOFT_FIXEDRATE, "fixedrate"),
2182 IWPRIV_U32(DOT11_OID_MAXFRAMEBURST, "frameburst"),
2183 IWPRIV_U32(DOT11_OID_PSM, "psm"),
2185 IWPRIV_U32(DOT11_OID_BRIDGELOCAL, "bridge"),
2186 IWPRIV_U32(DOT11_OID_CLIENTS, "clients"),
2187 IWPRIV_U32(DOT11_OID_CLIENTSASSOCIATED, "clientassoc"),
2188 IWPRIV_U32(DOT11_OID_DOT1XENABLE, "dot1xenable"),
2189 IWPRIV_U32(DOT11_OID_ANTENNARX, "rxant"),
2190 IWPRIV_U32(DOT11_OID_ANTENNATX, "txant"),
2191 IWPRIV_U32(DOT11_OID_ANTENNADIVERSITY, "antdivers"),
2192 IWPRIV_U32(DOT11_OID_EDTHRESHOLD, "edthresh"),
2193 IWPRIV_U32(DOT11_OID_PREAMBLESETTINGS, "preamble"),
2194 IWPRIV_GET(DOT11_OID_RATES, "rates"),
2195 IWPRIV_U32(DOT11_OID_OUTPUTPOWER, ".11outpower"),
2196 IWPRIV_GET(DOT11_OID_SUPPORTEDRATES, "supprates"),
2197 IWPRIV_GET(DOT11_OID_SUPPORTEDFREQUENCIES, "suppfreq"),
2199 IWPRIV_U32(DOT11_OID_NOISEFLOOR, "noisefloor"),
2200 IWPRIV_GET(DOT11_OID_FREQUENCYACTIVITY, "freqactivity"),
2201 IWPRIV_U32(DOT11_OID_NONERPPROTECTION, "nonerpprotec"),
2202 IWPRIV_U32(DOT11_OID_PROFILES, "profile"),
2203 IWPRIV_GET(DOT11_OID_EXTENDEDRATES, "extrates"),
2204 IWPRIV_U32(DOT11_OID_MLMEAUTOLEVEL, "mlmelevel"),
2206 IWPRIV_GET(DOT11_OID_BSSS, "bsss"),
2207 IWPRIV_GET(DOT11_OID_BSSLIST, "bsslist"),
2208 IWPRIV_U32(OID_INL_MODE, "mode"),
2209 IWPRIV_U32(OID_INL_CONFIG, "config"),
2210 IWPRIV_U32(OID_INL_DOT11D_CONFORMANCE, ".11dconform"),
2211 IWPRIV_GET(OID_INL_PHYCAPABILITIES, "phycapa"),
2212 IWPRIV_U32(OID_INL_OUTPUTPOWER, "outpower"),
2215 static const iw_handler prism54_private_handler[] = {
2216 (iw_handler) prism54_reset,
2217 (iw_handler) prism54_get_policy,
2218 (iw_handler) prism54_set_policy,
2219 (iw_handler) prism54_get_mac,
2220 (iw_handler) prism54_add_mac,
2222 (iw_handler) prism54_del_mac,
2224 (iw_handler) prism54_kick_mac,
2226 (iw_handler) prism54_kick_all,
2227 (iw_handler) prism54_get_wpa,
2228 (iw_handler) prism54_set_wpa,
2230 (iw_handler) prism54_debug_oid,
2231 (iw_handler) prism54_debug_get_oid,
2232 (iw_handler) prism54_debug_set_oid,
2233 (iw_handler) prism54_get_oid,
2234 (iw_handler) prism54_set_u32,
2236 (iw_handler) prism54_set_raw,
2238 (iw_handler) prism54_set_raw,
2239 (iw_handler) prism54_get_prismhdr,
2240 (iw_handler) prism54_set_prismhdr,
2243 const struct iw_handler_def prism54_handler_def = {
2244 .num_standard = sizeof (prism54_handler) / sizeof (iw_handler),
2245 .num_private = sizeof (prism54_private_handler) / sizeof (iw_handler),
2247 sizeof (prism54_private_args) / sizeof (struct iw_priv_args),
2248 .standard = (iw_handler *) prism54_handler,
2249 .private = (iw_handler *) prism54_private_handler,
2250 .private_args = (struct iw_priv_args *) prism54_private_args,
2251 .spy_offset = offsetof(islpci_private, spy_data),
2254 /* For ioctls that don't work with the new API */
2257 prism54_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)