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>
28 #include <linux/moduleparam.h>
30 #include <asm/uaccess.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);
177 prism54_mib_init_work(islpci_private *priv)
179 down_write(&priv->mib_sem);
181 up_write(&priv->mib_sem);
184 /* this will be executed outside of atomic context thanks to
185 * schedule_work(), thus we can as well use sleeping semaphore
188 prism54_update_stats(islpci_private *priv)
192 struct obj_bss bss, *bss2;
195 if (down_interruptible(&priv->stats_sem))
198 /* missing stats are :
199 * iwstatistics.qual.updated
200 * iwstatistics.discard.nwid
201 * iwstatistics.discard.fragment
202 * iwstatistics.discard.misc
203 * iwstatistics.miss.beacon */
206 * I'm not sure if the unit is dBm.
207 * Note : If we are not connected, this value seems to be irrevelant. */
209 mgt_get_request(priv, DOT11_OID_NOISEFLOOR, 0, NULL, &r);
210 priv->local_iwstatistics.qual.noise = r.u;
212 /* Get the rssi of the link. To do this we need to retrieve a bss. */
214 /* First get the MAC address of the AP we are associated with. */
215 mgt_get_request(priv, DOT11_OID_BSSID, 0, NULL, &r);
218 /* copy this MAC to the bss */
219 for (j = 0; j < 6; j++)
220 bss.address[j] = data[j];
223 /* now ask for the corresponding bss */
224 j = mgt_get_request(priv, DOT11_OID_BSSFIND, 0, (void *) &bss, &r);
226 /* report the rssi and use it to calculate
227 * link quality through a signal-noise
229 priv->local_iwstatistics.qual.level = bss2->rssi;
230 priv->local_iwstatistics.qual.qual =
231 bss2->rssi - priv->iwstatistics.qual.noise;
235 /* report that the stats are new */
236 priv->local_iwstatistics.qual.updated = 0x7;
238 /* Rx : unable to decrypt the MPDU */
239 mgt_get_request(priv, DOT11_OID_PRIVRXFAILED, 0, NULL, &r);
240 priv->local_iwstatistics.discard.code = r.u;
242 /* Tx : Max MAC retries num reached */
243 mgt_get_request(priv, DOT11_OID_MPDUTXFAILED, 0, NULL, &r);
244 priv->local_iwstatistics.discard.retries = r.u;
246 up(&priv->stats_sem);
251 struct iw_statistics *
252 prism54_get_wireless_stats(struct net_device *ndev)
254 islpci_private *priv = netdev_priv(ndev);
256 /* If the stats are being updated return old data */
257 if (down_trylock(&priv->stats_sem) == 0) {
258 memcpy(&priv->iwstatistics, &priv->local_iwstatistics,
259 sizeof (struct iw_statistics));
260 /* They won't be marked updated for the next time */
261 priv->local_iwstatistics.qual.updated = 0;
262 up(&priv->stats_sem);
264 priv->iwstatistics.qual.updated = 0;
266 /* Update our wireless stats, but do not schedule to often
268 if ((priv->stats_timestamp == 0) ||
269 time_after(jiffies, priv->stats_timestamp + 1 * HZ)) {
270 schedule_work(&priv->stats_work);
271 priv->stats_timestamp = jiffies;
274 return &priv->iwstatistics;
278 prism54_commit(struct net_device *ndev, struct iw_request_info *info,
279 char *cwrq, char *extra)
281 islpci_private *priv = netdev_priv(ndev);
283 /* simply re-set the last set SSID, this should commit most stuff */
285 /* Commit in Monitor mode is not necessary, also setting essid
286 * in Monitor mode does not make sense and isn't allowed for this
287 * device's firmware */
288 if (priv->iw_mode != IW_MODE_MONITOR)
289 return mgt_set_request(priv, DOT11_OID_SSID, 0, NULL);
294 prism54_get_name(struct net_device *ndev, struct iw_request_info *info,
295 char *cwrq, char *extra)
297 islpci_private *priv = netdev_priv(ndev);
302 if (islpci_get_state(priv) < PRV_STATE_INIT) {
303 strncpy(cwrq, "NOT READY!", IFNAMSIZ);
306 rvalue = mgt_get_request(priv, OID_INL_PHYCAPABILITIES, 0, NULL, &r);
309 case INL_PHYCAP_5000MHZ:
310 capabilities = "IEEE 802.11a/b/g";
313 capabilities = "IEEE 802.11b/g - FAA Support";
315 case INL_PHYCAP_2400MHZ:
317 capabilities = "IEEE 802.11b/g"; /* Default */
320 strncpy(cwrq, capabilities, IFNAMSIZ);
325 prism54_set_freq(struct net_device *ndev, struct iw_request_info *info,
326 struct iw_freq *fwrq, char *extra)
328 islpci_private *priv = netdev_priv(ndev);
333 /* we have a channel number */
336 c = (fwrq->e == 1) ? channel_of_freq(fwrq->m / 100000) : 0;
338 rvalue = c ? mgt_set_request(priv, DOT11_OID_CHANNEL, 0, &c) : -EINVAL;
340 /* Call commit handler */
341 return (rvalue ? rvalue : -EINPROGRESS);
345 prism54_get_freq(struct net_device *ndev, struct iw_request_info *info,
346 struct iw_freq *fwrq, char *extra)
348 islpci_private *priv = netdev_priv(ndev);
352 rvalue = mgt_get_request(priv, DOT11_OID_CHANNEL, 0, NULL, &r);
361 prism54_set_mode(struct net_device *ndev, struct iw_request_info *info,
362 __u32 * uwrq, char *extra)
364 islpci_private *priv = netdev_priv(ndev);
365 u32 mlmeautolevel = CARD_DEFAULT_MLME_MODE;
367 /* Let's see if the user passed a valid Linux Wireless mode */
368 if (*uwrq > IW_MODE_MONITOR || *uwrq < IW_MODE_AUTO) {
370 "%s: %s() You passed a non-valid init_mode.\n",
371 priv->ndev->name, __FUNCTION__);
375 down_write(&priv->mib_sem);
377 if (prism54_mib_mode_helper(priv, *uwrq)) {
378 up_write(&priv->mib_sem);
382 /* the ACL code needs an intermediate mlmeautolevel. The wpa stuff an
385 if ((*uwrq == IW_MODE_MASTER) && (priv->acl.policy != MAC_POLICY_OPEN))
386 mlmeautolevel = DOT11_MLME_INTERMEDIATE;
388 mlmeautolevel = DOT11_MLME_EXTENDED;
390 mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &mlmeautolevel);
393 priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR)
394 ? priv->monitor_type : ARPHRD_ETHER;
395 up_write(&priv->mib_sem);
402 prism54_get_mode(struct net_device *ndev, struct iw_request_info *info,
403 __u32 * uwrq, char *extra)
405 islpci_private *priv = netdev_priv(ndev);
407 BUG_ON((priv->iw_mode < IW_MODE_AUTO) || (priv->iw_mode >
409 *uwrq = priv->iw_mode;
414 /* we use DOT11_OID_EDTHRESHOLD. From what I guess the card will not try to
415 * emit data if (sensitivity > rssi - noise) (in dBm).
416 * prism54_set_sens does not seem to work.
420 prism54_set_sens(struct net_device *ndev, struct iw_request_info *info,
421 struct iw_param *vwrq, char *extra)
423 islpci_private *priv = netdev_priv(ndev);
426 /* by default the card sets this to 20. */
427 sens = vwrq->disabled ? 20 : vwrq->value;
429 /* set the ed threshold. */
430 return mgt_set_request(priv, DOT11_OID_EDTHRESHOLD, 0, &sens);
434 prism54_get_sens(struct net_device *ndev, struct iw_request_info *info,
435 struct iw_param *vwrq, char *extra)
437 islpci_private *priv = netdev_priv(ndev);
441 rvalue = mgt_get_request(priv, DOT11_OID_EDTHRESHOLD, 0, NULL, &r);
444 vwrq->disabled = (vwrq->value == 0);
451 prism54_get_range(struct net_device *ndev, struct iw_request_info *info,
452 struct iw_point *dwrq, char *extra)
454 struct iw_range *range = (struct iw_range *) extra;
455 islpci_private *priv = netdev_priv(ndev);
458 struct obj_frequencies *freq;
461 memset(range, 0, sizeof (struct iw_range));
462 dwrq->length = sizeof (struct iw_range);
464 /* set the wireless extension version number */
465 range->we_version_source = SUPPORTED_WIRELESS_EXT;
466 range->we_version_compiled = WIRELESS_EXT;
468 /* Now the encoding capabilities */
469 range->num_encoding_sizes = 3;
470 /* 64(40) bits WEP */
471 range->encoding_size[0] = 5;
472 /* 128(104) bits WEP */
473 range->encoding_size[1] = 13;
474 /* 256 bits for WPA-PSK */
475 range->encoding_size[2] = 32;
476 /* 4 keys are allowed */
477 range->max_encoding_tokens = 4;
479 /* we don't know the quality range... */
480 range->max_qual.level = 0;
481 range->max_qual.noise = 0;
482 range->max_qual.qual = 0;
483 /* these value describe an average quality. Needs more tweaking... */
484 range->avg_qual.level = -80; /* -80 dBm */
485 range->avg_qual.noise = 0; /* don't know what to put here */
486 range->avg_qual.qual = 0;
488 range->sensitivity = 200;
490 /* retry limit capabilities */
491 range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;
492 range->retry_flags = IW_RETRY_LIMIT;
493 range->r_time_flags = IW_RETRY_LIFETIME;
495 /* I don't know the range. Put stupid things here */
496 range->min_retry = 1;
497 range->max_retry = 65535;
498 range->min_r_time = 1024;
499 range->max_r_time = 65535 * 1024;
501 /* txpower is supported in dBm's */
502 range->txpower_capa = IW_TXPOW_DBM;
504 if (islpci_get_state(priv) < PRV_STATE_INIT)
507 /* Request the device for the supported frequencies
508 * not really revelant since some devices will report the 5 GHz band
509 * frequencies even if they don't support them.
512 mgt_get_request(priv, DOT11_OID_SUPPORTEDFREQUENCIES, 0, NULL, &r);
515 range->num_channels = freq->nr;
516 range->num_frequency = freq->nr;
518 /* Frequencies are not listed in the right order. The reordering is probably
519 * firmware dependant and thus should work for everyone.
521 m = min(IW_MAX_FREQUENCIES, (int) freq->nr);
522 for (i = 0; i < m - 12; i++) {
523 range->freq[i].m = freq->mhz[12 + i];
524 range->freq[i].e = 6;
525 range->freq[i].i = i + 1;
527 for (i = m - 12; i < m; i++) {
528 range->freq[i].m = freq->mhz[i - m + 12];
529 range->freq[i].e = 6;
530 range->freq[i].i = i + 23;
535 rvalue |= mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r);
538 /* We got an array of char. It is NULL terminated. */
540 while ((i < IW_MAX_BITRATES) && (*data != 0)) {
541 /* the result must be in bps. The card gives us 500Kbps */
542 range->bitrate[i] = (__s32) (*data >> 1);
543 range->bitrate[i] *= 1000000;
548 range->num_bitrates = i;
558 prism54_set_wap(struct net_device *ndev, struct iw_request_info *info,
559 struct sockaddr *awrq, char *extra)
561 islpci_private *priv = netdev_priv(ndev);
565 if (awrq->sa_family != ARPHRD_ETHER)
568 /* prepare the structure for the set object */
569 memcpy(&bssid[0], awrq->sa_data, 6);
571 /* set the bssid -- does this make sense when in AP mode? */
572 rvalue = mgt_set_request(priv, DOT11_OID_BSSID, 0, &bssid);
574 return (rvalue ? rvalue : -EINPROGRESS); /* Call commit handler */
580 prism54_get_wap(struct net_device *ndev, struct iw_request_info *info,
581 struct sockaddr *awrq, char *extra)
583 islpci_private *priv = netdev_priv(ndev);
587 rvalue = mgt_get_request(priv, DOT11_OID_BSSID, 0, NULL, &r);
589 memcpy(awrq->sa_data, r.ptr, 6);
590 awrq->sa_family = ARPHRD_ETHER;
597 prism54_set_scan(struct net_device *dev, struct iw_request_info *info,
598 struct iw_param *vwrq, char *extra)
600 /* hehe the device does this automagicaly */
604 /* a little helper that will translate our data into a card independent
605 * format that the Wireless Tools will understand. This was inspired by
606 * the "Aironet driver for 4500 and 4800 series cards" (GPL)
610 prism54_translate_bss(struct net_device *ndev, char *current_ev,
611 char *end_buf, struct obj_bss *bss, char noise)
613 struct iw_event iwe; /* Temporary buffer */
615 islpci_private *priv = netdev_priv(ndev);
617 /* The first entry must be the MAC address */
618 memcpy(iwe.u.ap_addr.sa_data, bss->address, 6);
619 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
622 iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
624 /* The following entries will be displayed in the same order we give them */
627 iwe.u.data.length = bss->ssid.length;
628 iwe.u.data.flags = 1;
629 iwe.cmd = SIOCGIWESSID;
630 current_ev = iwe_stream_add_point(current_ev, end_buf,
631 &iwe, bss->ssid.octets);
635 #define CAP_IBSS 0x02
636 #define CAP_CRYPT 0x10
642 iwe.u.mode = IW_MODE_MASTER;
643 else if (cap & CAP_IBSS)
644 iwe.u.mode = IW_MODE_ADHOC;
645 iwe.cmd = SIOCGIWMODE;
648 iwe_stream_add_event(current_ev, end_buf, &iwe,
651 /* Encryption capability */
653 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
655 iwe.u.data.flags = IW_ENCODE_DISABLED;
656 iwe.u.data.length = 0;
657 iwe.cmd = SIOCGIWENCODE;
658 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, NULL);
660 /* Add frequency. (short) bss->channel is the frequency in MHz */
661 iwe.u.freq.m = bss->channel;
663 iwe.cmd = SIOCGIWFREQ;
665 iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
667 /* Add quality statistics */
668 iwe.u.qual.level = bss->rssi;
669 iwe.u.qual.noise = noise;
670 /* do a simple SNR for quality */
671 iwe.u.qual.qual = bss->rssi - noise;
674 iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
677 u8 wpa_ie[MAX_WPA_IE_LEN];
682 wpa_ie_len = prism54_wpa_ie_get(priv, bss->address, wpa_ie);
683 if (wpa_ie_len > 0 &&
684 (buf = kmalloc(wpa_ie_len * 2 + 10, GFP_ATOMIC))) {
686 p += sprintf(p, "wpa_ie=");
687 for (i = 0; i < wpa_ie_len; i++) {
688 p += sprintf(p, "%02x", wpa_ie[i]);
690 memset(&iwe, 0, sizeof (iwe));
691 iwe.cmd = IWEVCUSTOM;
692 iwe.u.data.length = strlen(buf);
693 current_ev = iwe_stream_add_point(current_ev, end_buf,
703 prism54_get_scan(struct net_device *ndev, struct iw_request_info *info,
704 struct iw_point *dwrq, char *extra)
706 islpci_private *priv = netdev_priv(ndev);
708 struct obj_bsslist *bsslist;
710 char *current_ev = extra;
713 if (islpci_get_state(priv) < PRV_STATE_INIT) {
714 /* device is not ready, fail gently */
719 /* first get the noise value. We will use it to report the link quality */
720 rvalue = mgt_get_request(priv, DOT11_OID_NOISEFLOOR, 0, NULL, &r);
723 /* Ask the device for a list of known bss. We can report at most
724 * IW_MAX_AP=64 to the range struct. But the device won't repport anything
725 * if you change the value of MAXBSS=24. Anyway 24 AP It is probably enough.
727 rvalue |= mgt_get_request(priv, DOT11_OID_BSSLIST, 0, NULL, &r);
730 /* ok now, scan the list and translate its info */
731 for (i = 0; i < min(IW_MAX_AP, (int) bsslist->nr); i++)
732 current_ev = prism54_translate_bss(ndev, current_ev,
733 extra + IW_SCAN_MAX_DATA,
734 &(bsslist->bsslist[i]),
737 dwrq->length = (current_ev - extra);
738 dwrq->flags = 0; /* todo */
744 prism54_set_essid(struct net_device *ndev, struct iw_request_info *info,
745 struct iw_point *dwrq, char *extra)
747 islpci_private *priv = netdev_priv(ndev);
748 struct obj_ssid essid;
750 memset(essid.octets, 0, 33);
752 /* Check if we were asked for `any' */
753 if (dwrq->flags && dwrq->length) {
754 if (dwrq->length > min(33, IW_ESSID_MAX_SIZE + 1))
756 essid.length = dwrq->length - 1;
757 memcpy(essid.octets, extra, dwrq->length);
761 if (priv->iw_mode != IW_MODE_MONITOR)
762 return mgt_set_request(priv, DOT11_OID_SSID, 0, &essid);
764 /* If in monitor mode, just save to mib */
765 mgt_set(priv, DOT11_OID_SSID, &essid);
771 prism54_get_essid(struct net_device *ndev, struct iw_request_info *info,
772 struct iw_point *dwrq, char *extra)
774 islpci_private *priv = netdev_priv(ndev);
775 struct obj_ssid *essid;
779 rvalue = mgt_get_request(priv, DOT11_OID_SSID, 0, NULL, &r);
783 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */
784 /* if it is to big, trunk it */
785 dwrq->length = min(IW_ESSID_MAX_SIZE, essid->length + 1);
790 essid->octets[essid->length] = '\0';
791 memcpy(extra, essid->octets, dwrq->length);
797 /* Provides no functionality, just completes the ioctl. In essence this is a
798 * just a cosmetic ioctl.
801 prism54_set_nick(struct net_device *ndev, struct iw_request_info *info,
802 struct iw_point *dwrq, char *extra)
804 islpci_private *priv = netdev_priv(ndev);
806 if (dwrq->length > IW_ESSID_MAX_SIZE)
809 down_write(&priv->mib_sem);
810 memset(priv->nickname, 0, sizeof (priv->nickname));
811 memcpy(priv->nickname, extra, dwrq->length);
812 up_write(&priv->mib_sem);
818 prism54_get_nick(struct net_device *ndev, struct iw_request_info *info,
819 struct iw_point *dwrq, char *extra)
821 islpci_private *priv = netdev_priv(ndev);
825 down_read(&priv->mib_sem);
826 dwrq->length = strlen(priv->nickname) + 1;
827 memcpy(extra, priv->nickname, dwrq->length);
828 up_read(&priv->mib_sem);
833 /* Set the allowed Bitrates */
836 prism54_set_rate(struct net_device *ndev,
837 struct iw_request_info *info,
838 struct iw_param *vwrq, char *extra)
841 islpci_private *priv = netdev_priv(ndev);
847 if (vwrq->value == -1) {
848 /* auto mode. No limit. */
850 return mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile);
854 mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r)))
857 rate = (u32) (vwrq->value / 500000);
862 if (rate && (data[i] == rate)) {
865 if (vwrq->value == i) {
879 /* Now, check if we want a fixed or auto value */
887 printk("prism54 rate: ");
889 printk("%u ", data[i]);
895 ret = mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile);
896 ret |= mgt_set_request(priv, DOT11_OID_EXTENDEDRATES, 0, data);
897 ret |= mgt_set_request(priv, DOT11_OID_RATES, 0, data);
904 /* Get the current bit rate */
906 prism54_get_rate(struct net_device *ndev,
907 struct iw_request_info *info,
908 struct iw_param *vwrq, char *extra)
910 islpci_private *priv = netdev_priv(ndev);
915 /* Get the current bit rate */
916 if ((rvalue = mgt_get_request(priv, GEN_OID_LINKSTATE, 0, NULL, &r)))
918 vwrq->value = r.u * 500000;
920 /* request the device for the enabled rates */
921 if ((rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r)))
924 vwrq->fixed = (data[0] != 0) && (data[1] == 0);
931 prism54_set_rts(struct net_device *ndev, struct iw_request_info *info,
932 struct iw_param *vwrq, char *extra)
934 islpci_private *priv = netdev_priv(ndev);
936 return mgt_set_request(priv, DOT11_OID_RTSTHRESH, 0, &vwrq->value);
940 prism54_get_rts(struct net_device *ndev, struct iw_request_info *info,
941 struct iw_param *vwrq, char *extra)
943 islpci_private *priv = netdev_priv(ndev);
947 /* get the rts threshold */
948 rvalue = mgt_get_request(priv, DOT11_OID_RTSTHRESH, 0, NULL, &r);
955 prism54_set_frag(struct net_device *ndev, struct iw_request_info *info,
956 struct iw_param *vwrq, char *extra)
958 islpci_private *priv = netdev_priv(ndev);
960 return mgt_set_request(priv, DOT11_OID_FRAGTHRESH, 0, &vwrq->value);
964 prism54_get_frag(struct net_device *ndev, struct iw_request_info *info,
965 struct iw_param *vwrq, char *extra)
967 islpci_private *priv = netdev_priv(ndev);
971 rvalue = mgt_get_request(priv, DOT11_OID_FRAGTHRESH, 0, NULL, &r);
977 /* Here we have (min,max) = max retries for (small frames, big frames). Where
978 * big frame <=> bigger than the rts threshold
979 * small frame <=> smaller than the rts threshold
980 * This is not really the behavior expected by the wireless tool but it seems
981 * to be a common behavior in other drivers.
983 * It seems that playing with this tends to hang the card -> DISABLED
987 prism54_set_retry(struct net_device *ndev, struct iw_request_info *info,
988 struct iw_param *vwrq, char *extra)
990 islpci_private *priv = netdev_priv(ndev);
991 u32 slimit = 0, llimit = 0; /* short and long limit */
996 /* we cannot disable this feature */
999 if (vwrq->flags & IW_RETRY_LIMIT) {
1000 if (vwrq->flags & IW_RETRY_MIN)
1001 slimit = vwrq->value;
1002 else if (vwrq->flags & IW_RETRY_MAX)
1003 llimit = vwrq->value;
1005 /* we are asked to set both */
1006 slimit = vwrq->value;
1007 llimit = vwrq->value;
1010 if (vwrq->flags & IW_RETRY_LIFETIME)
1011 /* Wireless tools use us unit while the device uses 1024 us unit */
1012 lifetime = vwrq->value / 1024;
1014 /* now set what is requested */
1018 mgt_set_request(priv, DOT11_OID_SHORTRETRIES, 0, &slimit);
1021 mgt_set_request(priv, DOT11_OID_LONGRETRIES, 0, &llimit);
1024 mgt_set_request(priv, DOT11_OID_MAXTXLIFETIME, 0,
1031 prism54_get_retry(struct net_device *ndev, struct iw_request_info *info,
1032 struct iw_param *vwrq, char *extra)
1034 islpci_private *priv = netdev_priv(ndev);
1037 vwrq->disabled = 0; /* It cannot be disabled */
1039 if ((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
1040 /* we are asked for the life time */
1042 mgt_get_request(priv, DOT11_OID_MAXTXLIFETIME, 0, NULL, &r);
1043 vwrq->value = r.u * 1024;
1044 vwrq->flags = IW_RETRY_LIFETIME;
1045 } else if ((vwrq->flags & IW_RETRY_MAX)) {
1046 /* we are asked for the long retry limit */
1048 mgt_get_request(priv, DOT11_OID_LONGRETRIES, 0, NULL, &r);
1050 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
1052 /* default. get the short retry limit */
1054 mgt_get_request(priv, DOT11_OID_SHORTRETRIES, 0, NULL, &r);
1056 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MIN;
1063 prism54_set_encode(struct net_device *ndev, struct iw_request_info *info,
1064 struct iw_point *dwrq, char *extra)
1066 islpci_private *priv = netdev_priv(ndev);
1067 int rvalue = 0, force = 0;
1068 int authen = DOT11_AUTH_OS, invoke = 0, exunencrypt = 0;
1071 /* with the new API, it's impossible to get a NULL pointer.
1072 * New version of iwconfig set the IW_ENCODE_NOKEY flag
1073 * when no key is given, but older versions don't. */
1075 if (dwrq->length > 0) {
1076 /* we have a key to set */
1077 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1079 struct obj_key key = { DOT11_PRIV_WEP, 0, "" };
1081 /* get the current key index */
1082 rvalue = mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r);
1083 current_index = r.u;
1084 /* Verify that the key is not marked as invalid */
1085 if (!(dwrq->flags & IW_ENCODE_NOKEY)) {
1086 key.length = dwrq->length > sizeof (key.key) ?
1087 sizeof (key.key) : dwrq->length;
1088 memcpy(key.key, extra, key.length);
1089 if (key.length == 32)
1090 /* we want WPA-PSK */
1091 key.type = DOT11_PRIV_TKIP;
1092 if ((index < 0) || (index > 3))
1093 /* no index provided use the current one */
1094 index = current_index;
1096 /* now send the key to the card */
1098 mgt_set_request(priv, DOT11_OID_DEFKEYX, index,
1102 * If a valid key is set, encryption should be enabled
1103 * (user may turn it off later).
1104 * This is also how "iwconfig ethX key on" works
1106 if ((index == current_index) && (key.length > 0))
1109 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1110 if ((index >= 0) && (index <= 3)) {
1111 /* we want to set the key index */
1113 mgt_set_request(priv, DOT11_OID_DEFKEYID, 0,
1116 if (!dwrq->flags & IW_ENCODE_MODE) {
1117 /* we cannot do anything. Complain. */
1123 /* now read the flags */
1124 if (dwrq->flags & IW_ENCODE_DISABLED) {
1125 /* Encoding disabled,
1126 * authen = DOT11_AUTH_OS;
1128 * exunencrypt = 0; */
1130 if (dwrq->flags & IW_ENCODE_OPEN)
1131 /* Encode but accept non-encoded packets. No auth */
1133 if ((dwrq->flags & IW_ENCODE_RESTRICTED) || force) {
1134 /* Refuse non-encoded packets. Auth */
1135 authen = DOT11_AUTH_BOTH;
1139 /* do the change if requested */
1140 if ((dwrq->flags & IW_ENCODE_MODE) || force) {
1142 mgt_set_request(priv, DOT11_OID_AUTHENABLE, 0, &authen);
1144 mgt_set_request(priv, DOT11_OID_PRIVACYINVOKED, 0, &invoke);
1146 mgt_set_request(priv, DOT11_OID_EXUNENCRYPTED, 0,
1153 prism54_get_encode(struct net_device *ndev, struct iw_request_info *info,
1154 struct iw_point *dwrq, char *extra)
1156 islpci_private *priv = netdev_priv(ndev);
1157 struct obj_key *key;
1158 u32 devindex, index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1159 u32 authen = 0, invoke = 0, exunencrypt = 0;
1163 /* first get the flags */
1164 rvalue = mgt_get_request(priv, DOT11_OID_AUTHENABLE, 0, NULL, &r);
1166 rvalue |= mgt_get_request(priv, DOT11_OID_PRIVACYINVOKED, 0, NULL, &r);
1168 rvalue |= mgt_get_request(priv, DOT11_OID_EXUNENCRYPTED, 0, NULL, &r);
1171 if (invoke && (authen == DOT11_AUTH_BOTH) && exunencrypt)
1172 dwrq->flags = IW_ENCODE_RESTRICTED;
1173 else if ((authen == DOT11_AUTH_OS) && !exunencrypt) {
1175 dwrq->flags = IW_ENCODE_OPEN;
1177 dwrq->flags = IW_ENCODE_DISABLED;
1179 /* The card should not work in this state */
1182 /* get the current device key index */
1183 rvalue |= mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r);
1185 /* Now get the key, return it */
1186 if ((index < 0) || (index > 3))
1187 /* no index provided, use the current one */
1189 rvalue |= mgt_get_request(priv, DOT11_OID_DEFKEYX, index, NULL, &r);
1191 dwrq->length = key->length;
1192 memcpy(extra, key->key, dwrq->length);
1194 /* return the used key index */
1195 dwrq->flags |= devindex + 1;
1201 prism54_get_txpower(struct net_device *ndev, struct iw_request_info *info,
1202 struct iw_param *vwrq, char *extra)
1204 islpci_private *priv = netdev_priv(ndev);
1208 rvalue = mgt_get_request(priv, OID_INL_OUTPUTPOWER, 0, NULL, &r);
1209 /* intersil firmware operates in 0.25 dBm (1/4 dBm) */
1210 vwrq->value = (s32) r.u / 4;
1212 /* radio is not turned of
1213 * btw: how is possible to turn off only the radio
1221 prism54_set_txpower(struct net_device *ndev, struct iw_request_info *info,
1222 struct iw_param *vwrq, char *extra)
1224 islpci_private *priv = netdev_priv(ndev);
1225 s32 u = vwrq->value;
1227 /* intersil firmware operates in 0.25 dBm (1/4) */
1229 if (vwrq->disabled) {
1230 /* don't know how to disable radio */
1232 "%s: %s() disabling radio is not yet supported.\n",
1233 priv->ndev->name, __FUNCTION__);
1235 } else if (vwrq->fixed)
1236 /* currently only fixed value is supported */
1237 return mgt_set_request(priv, OID_INL_OUTPUTPOWER, 0, &u);
1240 "%s: %s() auto power will be implemented later.\n",
1241 priv->ndev->name, __FUNCTION__);
1247 prism54_reset(struct net_device *ndev, struct iw_request_info *info,
1248 __u32 * uwrq, char *extra)
1250 islpci_reset(netdev_priv(ndev), 0);
1256 prism54_get_oid(struct net_device *ndev, struct iw_request_info *info,
1257 struct iw_point *dwrq, char *extra)
1261 enum oid_num_t n = dwrq->flags;
1263 rvalue = mgt_get_request((islpci_private *) ndev->priv, n, 0, NULL, &r);
1264 dwrq->length = mgt_response_to_str(n, &r, extra);
1265 if ((isl_oid[n].flags & OID_FLAG_TYPE) != OID_TYPE_U32)
1271 prism54_set_u32(struct net_device *ndev, struct iw_request_info *info,
1272 __u32 * uwrq, char *extra)
1275 u32 *i = (int *) extra;
1279 u32 oid = uwrq[0], u = uwrq[1];
1281 return mgt_set_request((islpci_private *) ndev->priv, oid, 0, &u);
1285 prism54_set_raw(struct net_device *ndev, struct iw_request_info *info,
1286 struct iw_point *dwrq, char *extra)
1288 u32 oid = dwrq->flags;
1290 return mgt_set_request((islpci_private *) ndev->priv, oid, 0, extra);
1294 prism54_acl_init(struct islpci_acl *acl)
1296 sema_init(&acl->sem, 1);
1297 INIT_LIST_HEAD(&acl->mac_list);
1299 acl->policy = MAC_POLICY_OPEN;
1303 prism54_clear_mac(struct islpci_acl *acl)
1305 struct list_head *ptr, *next;
1306 struct mac_entry *entry;
1308 if (down_interruptible(&acl->sem))
1311 if (acl->size == 0) {
1316 for (ptr = acl->mac_list.next, next = ptr->next;
1317 ptr != &acl->mac_list; ptr = next, next = ptr->next) {
1318 entry = list_entry(ptr, struct mac_entry, _list);
1327 prism54_acl_clean(struct islpci_acl *acl)
1329 prism54_clear_mac(acl);
1333 prism54_add_mac(struct net_device *ndev, struct iw_request_info *info,
1334 struct sockaddr *awrq, char *extra)
1336 islpci_private *priv = netdev_priv(ndev);
1337 struct islpci_acl *acl = &priv->acl;
1338 struct mac_entry *entry;
1339 struct sockaddr *addr = (struct sockaddr *) extra;
1341 if (addr->sa_family != ARPHRD_ETHER)
1344 entry = kmalloc(sizeof (struct mac_entry), GFP_KERNEL);
1348 memcpy(entry->addr, addr->sa_data, ETH_ALEN);
1350 if (down_interruptible(&acl->sem)) {
1352 return -ERESTARTSYS;
1354 list_add_tail(&entry->_list, &acl->mac_list);
1362 prism54_del_mac(struct net_device *ndev, struct iw_request_info *info,
1363 struct sockaddr *awrq, char *extra)
1365 islpci_private *priv = netdev_priv(ndev);
1366 struct islpci_acl *acl = &priv->acl;
1367 struct mac_entry *entry;
1368 struct list_head *ptr;
1369 struct sockaddr *addr = (struct sockaddr *) extra;
1371 if (addr->sa_family != ARPHRD_ETHER)
1374 if (down_interruptible(&acl->sem))
1375 return -ERESTARTSYS;
1376 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
1377 entry = list_entry(ptr, struct mac_entry, _list);
1379 if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) {
1392 prism54_get_mac(struct net_device *ndev, struct iw_request_info *info,
1393 struct iw_point *dwrq, char *extra)
1395 islpci_private *priv = netdev_priv(ndev);
1396 struct islpci_acl *acl = &priv->acl;
1397 struct mac_entry *entry;
1398 struct list_head *ptr;
1399 struct sockaddr *dst = (struct sockaddr *) extra;
1403 if (down_interruptible(&acl->sem))
1404 return -ERESTARTSYS;
1406 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
1407 entry = list_entry(ptr, struct mac_entry, _list);
1409 memcpy(dst->sa_data, entry->addr, ETH_ALEN);
1410 dst->sa_family = ARPHRD_ETHER;
1418 /* Setting policy also clears the MAC acl, even if we don't change the defaut
1423 prism54_set_policy(struct net_device *ndev, struct iw_request_info *info,
1424 __u32 * uwrq, char *extra)
1426 islpci_private *priv = netdev_priv(ndev);
1427 struct islpci_acl *acl = &priv->acl;
1430 prism54_clear_mac(acl);
1432 if ((*uwrq < MAC_POLICY_OPEN) || (*uwrq > MAC_POLICY_REJECT))
1435 down_write(&priv->mib_sem);
1437 acl->policy = *uwrq;
1439 /* the ACL code needs an intermediate mlmeautolevel */
1440 if ((priv->iw_mode == IW_MODE_MASTER) &&
1441 (acl->policy != MAC_POLICY_OPEN))
1442 mlmeautolevel = DOT11_MLME_INTERMEDIATE;
1444 mlmeautolevel = CARD_DEFAULT_MLME_MODE;
1446 mlmeautolevel = DOT11_MLME_EXTENDED;
1447 mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &mlmeautolevel);
1448 /* restart the card with our new policy */
1450 up_write(&priv->mib_sem);
1456 prism54_get_policy(struct net_device *ndev, struct iw_request_info *info,
1457 __u32 * uwrq, char *extra)
1459 islpci_private *priv = netdev_priv(ndev);
1460 struct islpci_acl *acl = &priv->acl;
1462 *uwrq = acl->policy;
1467 /* Return 1 only if client should be accepted. */
1470 prism54_mac_accept(struct islpci_acl *acl, char *mac)
1472 struct list_head *ptr;
1473 struct mac_entry *entry;
1476 if (down_interruptible(&acl->sem))
1477 return -ERESTARTSYS;
1479 if (acl->policy == MAC_POLICY_OPEN) {
1484 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) {
1485 entry = list_entry(ptr, struct mac_entry, _list);
1486 if (memcmp(entry->addr, mac, ETH_ALEN) == 0) {
1491 res = (acl->policy == MAC_POLICY_ACCEPT) ? !res : res;
1498 prism54_kick_all(struct net_device *ndev, struct iw_request_info *info,
1499 struct iw_point *dwrq, char *extra)
1501 struct obj_mlme *mlme;
1504 mlme = kmalloc(sizeof (struct obj_mlme), GFP_KERNEL);
1508 /* Tell the card to kick every client */
1511 mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
1518 prism54_kick_mac(struct net_device *ndev, struct iw_request_info *info,
1519 struct sockaddr *awrq, char *extra)
1521 struct obj_mlme *mlme;
1522 struct sockaddr *addr = (struct sockaddr *) extra;
1525 if (addr->sa_family != ARPHRD_ETHER)
1528 mlme = kmalloc(sizeof (struct obj_mlme), GFP_KERNEL);
1532 /* Tell the card to only kick the corresponding bastard */
1533 memcpy(mlme->address, addr->sa_data, ETH_ALEN);
1536 mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
1543 /* Translate a TRAP oid into a wireless event. Called in islpci_mgt_receive. */
1546 format_event(islpci_private *priv, char *dest, const char *str,
1547 const struct obj_mlme *mlme, u16 *length, int error)
1549 const u8 *a = mlme->address;
1550 int n = snprintf(dest, IW_CUSTOM_MAX,
1551 "%s %s %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X %s (%2.2X)",
1553 ((priv->iw_mode == IW_MODE_MASTER) ? "from" : "to"),
1554 a[0], a[1], a[2], a[3], a[4], a[5],
1555 (error ? (mlme->code ? " : REJECTED " : " : ACCEPTED ")
1557 BUG_ON(n > IW_CUSTOM_MAX);
1562 send_formatted_event(islpci_private *priv, const char *str,
1563 const struct obj_mlme *mlme, int error)
1565 union iwreq_data wrqu;
1567 wrqu.data.pointer = kmalloc(IW_CUSTOM_MAX, GFP_KERNEL);
1568 if (!wrqu.data.pointer)
1570 wrqu.data.length = 0;
1571 format_event(priv, wrqu.data.pointer, str, mlme, &wrqu.data.length,
1573 wireless_send_event(priv->ndev, IWEVCUSTOM, &wrqu, wrqu.data.pointer);
1574 kfree(wrqu.data.pointer);
1578 send_simple_event(islpci_private *priv, const char *str)
1580 union iwreq_data wrqu;
1581 int n = strlen(str);
1583 wrqu.data.pointer = kmalloc(IW_CUSTOM_MAX, GFP_KERNEL);
1584 if (!wrqu.data.pointer)
1586 BUG_ON(n > IW_CUSTOM_MAX);
1587 wrqu.data.length = n;
1588 strcpy(wrqu.data.pointer, str);
1589 wireless_send_event(priv->ndev, IWEVCUSTOM, &wrqu, wrqu.data.pointer);
1590 kfree(wrqu.data.pointer);
1594 link_changed(struct net_device *ndev, u32 bitrate)
1596 islpci_private *priv = netdev_priv(ndev);
1599 if (priv->iw_mode == IW_MODE_INFRA) {
1600 union iwreq_data uwrq;
1601 prism54_get_wap(ndev, NULL, (struct sockaddr *) &uwrq,
1603 wireless_send_event(ndev, SIOCGIWAP, &uwrq, NULL);
1605 send_simple_event(netdev_priv(ndev),
1606 "Link established");
1608 send_simple_event(netdev_priv(ndev), "Link lost");
1611 /* Beacon/ProbeResp payload header */
1612 struct ieee80211_beacon_phdr {
1616 } __attribute__ ((packed));
1618 #define WLAN_EID_GENERIC 0xdd
1619 static u8 wpa_oid[4] = { 0x00, 0x50, 0xf2, 1 };
1621 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
1622 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
1625 prism54_wpa_ie_add(islpci_private *priv, u8 *bssid,
1626 u8 *wpa_ie, size_t wpa_ie_len)
1628 struct list_head *ptr;
1629 struct islpci_bss_wpa_ie *bss = NULL;
1631 if (wpa_ie_len > MAX_WPA_IE_LEN)
1632 wpa_ie_len = MAX_WPA_IE_LEN;
1634 if (down_interruptible(&priv->wpa_sem))
1637 /* try to use existing entry */
1638 list_for_each(ptr, &priv->bss_wpa_list) {
1639 bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
1640 if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0) {
1641 list_move(&bss->list, &priv->bss_wpa_list);
1648 /* add a new BSS entry; if max number of entries is already
1649 * reached, replace the least recently updated */
1650 if (priv->num_bss_wpa >= MAX_BSS_WPA_IE_COUNT) {
1651 bss = list_entry(priv->bss_wpa_list.prev,
1652 struct islpci_bss_wpa_ie, list);
1653 list_del(&bss->list);
1655 bss = kmalloc(sizeof (*bss), GFP_ATOMIC);
1657 priv->num_bss_wpa++;
1658 memset(bss, 0, sizeof (*bss));
1662 memcpy(bss->bssid, bssid, ETH_ALEN);
1663 list_add(&bss->list, &priv->bss_wpa_list);
1668 memcpy(bss->wpa_ie, wpa_ie, wpa_ie_len);
1669 bss->wpa_ie_len = wpa_ie_len;
1670 bss->last_update = jiffies;
1672 printk(KERN_DEBUG "Failed to add BSS WPA entry for " MACSTR
1673 "\n", MAC2STR(bssid));
1676 /* expire old entries from WPA list */
1677 while (priv->num_bss_wpa > 0) {
1678 bss = list_entry(priv->bss_wpa_list.prev,
1679 struct islpci_bss_wpa_ie, list);
1680 if (!time_after(jiffies, bss->last_update + 60 * HZ))
1683 list_del(&bss->list);
1684 priv->num_bss_wpa--;
1692 prism54_wpa_ie_get(islpci_private *priv, u8 *bssid, u8 *wpa_ie)
1694 struct list_head *ptr;
1695 struct islpci_bss_wpa_ie *bss = NULL;
1698 if (down_interruptible(&priv->wpa_sem))
1701 list_for_each(ptr, &priv->bss_wpa_list) {
1702 bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
1703 if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0)
1708 len = bss->wpa_ie_len;
1709 memcpy(wpa_ie, bss->wpa_ie, len);
1717 prism54_wpa_ie_init(islpci_private *priv)
1719 INIT_LIST_HEAD(&priv->bss_wpa_list);
1720 sema_init(&priv->wpa_sem, 1);
1724 prism54_wpa_ie_clean(islpci_private *priv)
1726 struct list_head *ptr, *n;
1728 list_for_each_safe(ptr, n, &priv->bss_wpa_list) {
1729 struct islpci_bss_wpa_ie *bss;
1730 bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
1736 prism54_process_bss_data(islpci_private *priv, u32 oid, u8 *addr,
1737 u8 *payload, size_t len)
1739 struct ieee80211_beacon_phdr *hdr;
1745 hdr = (struct ieee80211_beacon_phdr *) payload;
1746 pos = (u8 *) (hdr + 1);
1747 end = payload + len;
1749 if (pos + 2 + pos[1] > end) {
1750 printk(KERN_DEBUG "Parsing Beacon/ProbeResp failed "
1751 "for " MACSTR "\n", MAC2STR(addr));
1754 if (pos[0] == WLAN_EID_GENERIC && pos[1] >= 4 &&
1755 memcmp(pos + 2, wpa_oid, 4) == 0) {
1756 prism54_wpa_ie_add(priv, addr, pos, pos[1] + 2);
1764 handle_request(islpci_private *priv, struct obj_mlme *mlme, enum oid_num_t oid)
1766 if (((mlme->state == DOT11_STATE_AUTHING) ||
1767 (mlme->state == DOT11_STATE_ASSOCING))
1768 && mgt_mlme_answer(priv)) {
1769 /* Someone is requesting auth and we must respond. Just send back
1770 * the trap with error code set accordingly.
1772 mlme->code = prism54_mac_accept(&priv->acl,
1773 mlme->address) ? 0 : 1;
1774 mgt_set_request(priv, oid, 0, mlme);
1779 prism54_process_trap_helper(islpci_private *priv, enum oid_num_t oid,
1782 struct obj_mlme *mlme = (struct obj_mlme *) data;
1784 u8 *payload, *pos = (u8 *) (mlme + 1);
1786 len = pos[0] | (pos[1] << 8); /* little endian data length */
1789 /* I think all trapable objects are listed here.
1790 * Some oids have a EX version. The difference is that they are emitted
1791 * in DOT11_MLME_EXTENDED mode (set with DOT11_OID_MLMEAUTOLEVEL)
1793 * The few events already defined by the wireless tools are not really
1794 * suited. We use the more flexible custom event facility.
1797 /* I fear prism54_process_bss_data won't work with big endian data */
1798 if ((oid == DOT11_OID_BEACON) || (oid == DOT11_OID_PROBE))
1799 prism54_process_bss_data(priv, oid, mlme->address,
1802 mgt_le_to_cpu(isl_oid[oid].flags & OID_FLAG_TYPE, (void *) mlme);
1806 case GEN_OID_LINKSTATE:
1807 link_changed(priv->ndev, (u32) *data);
1810 case DOT11_OID_MICFAILURE:
1811 send_simple_event(priv, "Mic failure");
1814 case DOT11_OID_DEAUTHENTICATE:
1815 send_formatted_event(priv, "DeAuthenticate request", mlme, 0);
1818 case DOT11_OID_AUTHENTICATE:
1819 handle_request(priv, mlme, oid);
1820 send_formatted_event(priv, "Authenticate request", mlme, 1);
1823 case DOT11_OID_DISASSOCIATE:
1824 send_formatted_event(priv, "Disassociate request", mlme, 0);
1827 case DOT11_OID_ASSOCIATE:
1828 handle_request(priv, mlme, oid);
1829 send_formatted_event(priv, "Associate request", mlme, 1);
1832 case DOT11_OID_REASSOCIATE:
1833 handle_request(priv, mlme, oid);
1834 send_formatted_event(priv, "ReAssociate request", mlme, 1);
1837 case DOT11_OID_BEACON:
1838 send_formatted_event(priv,
1839 "Received a beacon from an unkown AP",
1843 case DOT11_OID_PROBE:
1844 /* we received a probe from a client. */
1845 send_formatted_event(priv, "Received a probe from client", mlme,
1849 /* Note : the following should never happen since we don't run the card in
1851 * Note : "mlme" is actually a "struct obj_mlmeex *" here, but this
1852 * is backward compatible layout-wise with "struct obj_mlme".
1855 case DOT11_OID_DEAUTHENTICATEEX:
1856 send_formatted_event(priv, "DeAuthenticate request", mlme, 0);
1859 case DOT11_OID_AUTHENTICATEEX:
1860 handle_request(priv, mlme, oid);
1861 send_formatted_event(priv, "Authenticate request", mlme, 1);
1864 case DOT11_OID_DISASSOCIATEEX:
1865 send_formatted_event(priv, "Disassociate request", mlme, 0);
1868 case DOT11_OID_ASSOCIATEEX:
1869 handle_request(priv, mlme, oid);
1870 send_formatted_event(priv, "Associate request", mlme, 1);
1873 case DOT11_OID_REASSOCIATEEX:
1874 handle_request(priv, mlme, oid);
1875 send_formatted_event(priv, "Reassociate request", mlme, 1);
1886 * Process a device trap. This is called via schedule_work(), outside of
1887 * interrupt context, no locks held.
1890 prism54_process_trap(void *data)
1892 struct islpci_mgmtframe *frame = data;
1893 struct net_device *ndev = frame->ndev;
1894 enum oid_num_t n = mgt_oidtonum(frame->header->oid);
1896 prism54_process_trap_helper(netdev_priv(ndev), n, frame->data);
1897 islpci_mgt_release(frame);
1901 prism54_set_mac_address(struct net_device *ndev, void *addr)
1903 islpci_private *priv = netdev_priv(ndev);
1906 if (ndev->addr_len != 6)
1908 ret = mgt_set_request(priv, GEN_OID_MACADDRESS, 0,
1909 &((struct sockaddr *) addr)->sa_data);
1911 memcpy(priv->ndev->dev_addr,
1912 &((struct sockaddr *) addr)->sa_data, 6);
1918 prism54_set_wpa(struct net_device *ndev, struct iw_request_info *info,
1919 __u32 * uwrq, char *extra)
1921 islpci_private *priv = netdev_priv(ndev);
1923 down_write(&priv->mib_sem);
1927 u32 l = DOT11_MLME_EXTENDED;
1928 mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &l);
1930 /* restart the card with new level. Needed ? */
1932 up_write(&priv->mib_sem);
1938 prism54_get_wpa(struct net_device *ndev, struct iw_request_info *info,
1939 __u32 * uwrq, char *extra)
1941 islpci_private *priv = netdev_priv(ndev);
1947 prism54_set_prismhdr(struct net_device *ndev, struct iw_request_info *info,
1948 __u32 * uwrq, char *extra)
1950 islpci_private *priv = netdev_priv(ndev);
1951 priv->monitor_type =
1952 (*uwrq ? ARPHRD_IEEE80211_PRISM : ARPHRD_IEEE80211);
1953 if (priv->iw_mode == IW_MODE_MONITOR)
1954 priv->ndev->type = priv->monitor_type;
1960 prism54_get_prismhdr(struct net_device *ndev, struct iw_request_info *info,
1961 __u32 * uwrq, char *extra)
1963 islpci_private *priv = netdev_priv(ndev);
1964 *uwrq = (priv->monitor_type == ARPHRD_IEEE80211_PRISM);
1969 prism54_set_maxframeburst(struct net_device *ndev, struct iw_request_info *info,
1970 __u32 * uwrq, char *extra)
1972 islpci_private *priv = netdev_priv(ndev);
1975 max_burst = (*uwrq) ? *uwrq : CARD_DEFAULT_MAXFRAMEBURST;
1976 mgt_set_request(priv, DOT11_OID_MAXFRAMEBURST, 0, &max_burst);
1978 return -EINPROGRESS; /* Call commit handler */
1982 prism54_get_maxframeburst(struct net_device *ndev, struct iw_request_info *info,
1983 __u32 * uwrq, char *extra)
1985 islpci_private *priv = netdev_priv(ndev);
1989 rvalue = mgt_get_request(priv, DOT11_OID_MAXFRAMEBURST, 0, NULL, &r);
1996 prism54_set_profile(struct net_device *ndev, struct iw_request_info *info,
1997 __u32 * uwrq, char *extra)
1999 islpci_private *priv = netdev_priv(ndev);
2002 profile = (*uwrq) ? *uwrq : CARD_DEFAULT_PROFILE;
2003 mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile);
2005 return -EINPROGRESS; /* Call commit handler */
2009 prism54_get_profile(struct net_device *ndev, struct iw_request_info *info,
2010 __u32 * uwrq, char *extra)
2012 islpci_private *priv = netdev_priv(ndev);
2016 rvalue = mgt_get_request(priv, DOT11_OID_PROFILES, 0, NULL, &r);
2023 prism54_debug_oid(struct net_device *ndev, struct iw_request_info *info,
2024 __u32 * uwrq, char *extra)
2026 islpci_private *priv = netdev_priv(ndev);
2028 priv->priv_oid = *uwrq;
2029 printk("%s: oid 0x%08X\n", ndev->name, *uwrq);
2035 prism54_debug_get_oid(struct net_device *ndev, struct iw_request_info *info,
2036 struct iw_point *data, char *extra)
2038 islpci_private *priv = netdev_priv(ndev);
2039 struct islpci_mgmtframe *response = NULL;
2040 int ret = -EIO, response_op = PIMFOR_OP_ERROR;
2042 printk("%s: get_oid 0x%08X\n", ndev->name, priv->priv_oid);
2045 if (islpci_get_state(priv) >= PRV_STATE_INIT) {
2047 islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET,
2048 priv->priv_oid, extra, 256,
2050 response_op = response->header->operation;
2051 printk("%s: ret: %i\n", ndev->name, ret);
2052 printk("%s: response_op: %i\n", ndev->name, response_op);
2053 if (ret || !response
2054 || response->header->operation == PIMFOR_OP_ERROR) {
2056 islpci_mgt_release(response);
2058 printk("%s: EIO\n", ndev->name);
2062 data->length = response->header->length;
2063 memcpy(extra, response->data, data->length);
2064 islpci_mgt_release(response);
2065 printk("%s: len: %i\n", ndev->name, data->length);
2073 prism54_debug_set_oid(struct net_device *ndev, struct iw_request_info *info,
2074 struct iw_point *data, char *extra)
2076 islpci_private *priv = netdev_priv(ndev);
2077 struct islpci_mgmtframe *response = NULL;
2078 int ret = 0, response_op = PIMFOR_OP_ERROR;
2080 printk("%s: set_oid 0x%08X\tlen: %d\n", ndev->name, priv->priv_oid,
2083 if (islpci_get_state(priv) >= PRV_STATE_INIT) {
2085 islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET,
2086 priv->priv_oid, extra, data->length,
2088 printk("%s: ret: %i\n", ndev->name, ret);
2090 response_op = response->header->operation;
2091 printk("%s: response_op: %i\n", ndev->name,
2093 islpci_mgt_release(response);
2095 if (ret || response_op == PIMFOR_OP_ERROR) {
2096 printk("%s: EIO\n", ndev->name);
2105 prism54_set_spy(struct net_device *ndev,
2106 struct iw_request_info *info,
2107 union iwreq_data *uwrq, char *extra)
2109 islpci_private *priv = netdev_priv(ndev);
2110 u32 u, oid = OID_INL_CONFIG;
2112 down_write(&priv->mib_sem);
2113 mgt_get(priv, OID_INL_CONFIG, &u);
2115 if ((uwrq->data.length == 0) && (priv->spy_data.spy_number > 0))
2117 u &= ~INL_CONFIG_RXANNEX;
2118 else if ((uwrq->data.length > 0) && (priv->spy_data.spy_number == 0))
2120 u |= INL_CONFIG_RXANNEX;
2122 mgt_set(priv, OID_INL_CONFIG, &u);
2123 mgt_commit_list(priv, &oid, 1);
2124 up_write(&priv->mib_sem);
2126 return iw_handler_set_spy(ndev, info, uwrq, extra);
2129 static const iw_handler prism54_handler[] = {
2130 (iw_handler) prism54_commit, /* SIOCSIWCOMMIT */
2131 (iw_handler) prism54_get_name, /* SIOCGIWNAME */
2132 (iw_handler) NULL, /* SIOCSIWNWID */
2133 (iw_handler) NULL, /* SIOCGIWNWID */
2134 (iw_handler) prism54_set_freq, /* SIOCSIWFREQ */
2135 (iw_handler) prism54_get_freq, /* SIOCGIWFREQ */
2136 (iw_handler) prism54_set_mode, /* SIOCSIWMODE */
2137 (iw_handler) prism54_get_mode, /* SIOCGIWMODE */
2138 (iw_handler) prism54_set_sens, /* SIOCSIWSENS */
2139 (iw_handler) prism54_get_sens, /* SIOCGIWSENS */
2140 (iw_handler) NULL, /* SIOCSIWRANGE */
2141 (iw_handler) prism54_get_range, /* SIOCGIWRANGE */
2142 (iw_handler) NULL, /* SIOCSIWPRIV */
2143 (iw_handler) NULL, /* SIOCGIWPRIV */
2144 (iw_handler) NULL, /* SIOCSIWSTATS */
2145 (iw_handler) NULL, /* SIOCGIWSTATS */
2146 prism54_set_spy, /* SIOCSIWSPY */
2147 iw_handler_get_spy, /* SIOCGIWSPY */
2148 iw_handler_set_thrspy, /* SIOCSIWTHRSPY */
2149 iw_handler_get_thrspy, /* SIOCGIWTHRSPY */
2150 (iw_handler) prism54_set_wap, /* SIOCSIWAP */
2151 (iw_handler) prism54_get_wap, /* SIOCGIWAP */
2152 (iw_handler) NULL, /* -- hole -- */
2153 (iw_handler) NULL, /* SIOCGIWAPLIST depreciated */
2154 (iw_handler) prism54_set_scan, /* SIOCSIWSCAN */
2155 (iw_handler) prism54_get_scan, /* SIOCGIWSCAN */
2156 (iw_handler) prism54_set_essid, /* SIOCSIWESSID */
2157 (iw_handler) prism54_get_essid, /* SIOCGIWESSID */
2158 (iw_handler) prism54_set_nick, /* SIOCSIWNICKN */
2159 (iw_handler) prism54_get_nick, /* SIOCGIWNICKN */
2160 (iw_handler) NULL, /* -- hole -- */
2161 (iw_handler) NULL, /* -- hole -- */
2162 (iw_handler) prism54_set_rate, /* SIOCSIWRATE */
2163 (iw_handler) prism54_get_rate, /* SIOCGIWRATE */
2164 (iw_handler) prism54_set_rts, /* SIOCSIWRTS */
2165 (iw_handler) prism54_get_rts, /* SIOCGIWRTS */
2166 (iw_handler) prism54_set_frag, /* SIOCSIWFRAG */
2167 (iw_handler) prism54_get_frag, /* SIOCGIWFRAG */
2168 (iw_handler) prism54_set_txpower, /* SIOCSIWTXPOW */
2169 (iw_handler) prism54_get_txpower, /* SIOCGIWTXPOW */
2170 (iw_handler) prism54_set_retry, /* SIOCSIWRETRY */
2171 (iw_handler) prism54_get_retry, /* SIOCGIWRETRY */
2172 (iw_handler) prism54_set_encode, /* SIOCSIWENCODE */
2173 (iw_handler) prism54_get_encode, /* SIOCGIWENCODE */
2174 (iw_handler) NULL, /* SIOCSIWPOWER */
2175 (iw_handler) NULL, /* SIOCGIWPOWER */
2178 /* The low order bit identify a SET (0) or a GET (1) ioctl. */
2180 #define PRISM54_RESET SIOCIWFIRSTPRIV
2181 #define PRISM54_GET_POLICY SIOCIWFIRSTPRIV+1
2182 #define PRISM54_SET_POLICY SIOCIWFIRSTPRIV+2
2183 #define PRISM54_GET_MAC SIOCIWFIRSTPRIV+3
2184 #define PRISM54_ADD_MAC SIOCIWFIRSTPRIV+4
2186 #define PRISM54_DEL_MAC SIOCIWFIRSTPRIV+6
2188 #define PRISM54_KICK_MAC SIOCIWFIRSTPRIV+8
2190 #define PRISM54_KICK_ALL SIOCIWFIRSTPRIV+10
2192 #define PRISM54_GET_WPA SIOCIWFIRSTPRIV+11
2193 #define PRISM54_SET_WPA SIOCIWFIRSTPRIV+12
2195 #define PRISM54_DBG_OID SIOCIWFIRSTPRIV+14
2196 #define PRISM54_DBG_GET_OID SIOCIWFIRSTPRIV+15
2197 #define PRISM54_DBG_SET_OID SIOCIWFIRSTPRIV+16
2199 #define PRISM54_GET_OID SIOCIWFIRSTPRIV+17
2200 #define PRISM54_SET_OID_U32 SIOCIWFIRSTPRIV+18
2201 #define PRISM54_SET_OID_STR SIOCIWFIRSTPRIV+20
2202 #define PRISM54_SET_OID_ADDR SIOCIWFIRSTPRIV+22
2204 #define PRISM54_GET_PRISMHDR SIOCIWFIRSTPRIV+23
2205 #define PRISM54_SET_PRISMHDR SIOCIWFIRSTPRIV+24
2207 #define IWPRIV_SET_U32(n,x) { n, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x }
2208 #define IWPRIV_SET_SSID(n,x) { n, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x }
2209 #define IWPRIV_SET_ADDR(n,x) { n, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x }
2210 #define IWPRIV_GET(n,x) { n, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, "get_"x }
2212 #define IWPRIV_U32(n,x) IWPRIV_SET_U32(n,x), IWPRIV_GET(n,x)
2213 #define IWPRIV_SSID(n,x) IWPRIV_SET_SSID(n,x), IWPRIV_GET(n,x)
2214 #define IWPRIV_ADDR(n,x) IWPRIV_SET_ADDR(n,x), IWPRIV_GET(n,x)
2216 /* Note : limited to 128 private ioctls */
2218 static const struct iw_priv_args prism54_private_args[] = {
2219 /*{ cmd, set_args, get_args, name } */
2220 {PRISM54_RESET, 0, 0, "reset"},
2221 {PRISM54_GET_PRISMHDR, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
2223 {PRISM54_SET_PRISMHDR, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2225 {PRISM54_GET_POLICY, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
2227 {PRISM54_SET_POLICY, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2229 {PRISM54_GET_MAC, 0, IW_PRIV_TYPE_ADDR | 64, "getMac"},
2230 {PRISM54_ADD_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,
2232 {PRISM54_DEL_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,
2234 {PRISM54_KICK_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,
2236 {PRISM54_KICK_ALL, 0, 0, "kickAll"},
2237 {PRISM54_GET_WPA, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
2239 {PRISM54_SET_WPA, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2241 {PRISM54_DBG_OID, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
2243 {PRISM54_DBG_GET_OID, 0, IW_PRIV_TYPE_BYTE | 256, "dbg_get_oid"},
2244 {PRISM54_DBG_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "dbg_get_oid"},
2245 /* --- sub-ioctls handlers --- */
2247 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, ""},
2248 {PRISM54_SET_OID_U32,
2249 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, ""},
2250 {PRISM54_SET_OID_STR,
2251 IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, ""},
2252 {PRISM54_SET_OID_ADDR,
2253 IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, ""},
2254 /* --- sub-ioctls definitions --- */
2255 IWPRIV_ADDR(GEN_OID_MACADDRESS, "addr"),
2256 IWPRIV_GET(GEN_OID_LINKSTATE, "linkstate"),
2257 IWPRIV_U32(DOT11_OID_BSSTYPE, "bsstype"),
2258 IWPRIV_ADDR(DOT11_OID_BSSID, "bssid"),
2259 IWPRIV_U32(DOT11_OID_STATE, "state"),
2260 IWPRIV_U32(DOT11_OID_AID, "aid"),
2262 IWPRIV_SSID(DOT11_OID_SSIDOVERRIDE, "ssidoverride"),
2264 IWPRIV_U32(DOT11_OID_MEDIUMLIMIT, "medlimit"),
2265 IWPRIV_U32(DOT11_OID_BEACONPERIOD, "beacon"),
2266 IWPRIV_U32(DOT11_OID_DTIMPERIOD, "dtimperiod"),
2268 IWPRIV_U32(DOT11_OID_AUTHENABLE, "authenable"),
2269 IWPRIV_U32(DOT11_OID_PRIVACYINVOKED, "privinvok"),
2270 IWPRIV_U32(DOT11_OID_EXUNENCRYPTED, "exunencrypt"),
2272 IWPRIV_U32(DOT11_OID_REKEYTHRESHOLD, "rekeythresh"),
2274 IWPRIV_U32(DOT11_OID_MAXTXLIFETIME, "maxtxlife"),
2275 IWPRIV_U32(DOT11_OID_MAXRXLIFETIME, "maxrxlife"),
2276 IWPRIV_U32(DOT11_OID_ALOFT_FIXEDRATE, "fixedrate"),
2277 IWPRIV_U32(DOT11_OID_MAXFRAMEBURST, "frameburst"),
2278 IWPRIV_U32(DOT11_OID_PSM, "psm"),
2280 IWPRIV_U32(DOT11_OID_BRIDGELOCAL, "bridge"),
2281 IWPRIV_U32(DOT11_OID_CLIENTS, "clients"),
2282 IWPRIV_U32(DOT11_OID_CLIENTSASSOCIATED, "clientassoc"),
2283 IWPRIV_U32(DOT11_OID_DOT1XENABLE, "dot1xenable"),
2284 IWPRIV_U32(DOT11_OID_ANTENNARX, "rxant"),
2285 IWPRIV_U32(DOT11_OID_ANTENNATX, "txant"),
2286 IWPRIV_U32(DOT11_OID_ANTENNADIVERSITY, "antdivers"),
2287 IWPRIV_U32(DOT11_OID_EDTHRESHOLD, "edthresh"),
2288 IWPRIV_U32(DOT11_OID_PREAMBLESETTINGS, "preamble"),
2289 IWPRIV_GET(DOT11_OID_RATES, "rates"),
2290 IWPRIV_U32(DOT11_OID_OUTPUTPOWER, ".11outpower"),
2291 IWPRIV_GET(DOT11_OID_SUPPORTEDRATES, "supprates"),
2292 IWPRIV_GET(DOT11_OID_SUPPORTEDFREQUENCIES, "suppfreq"),
2294 IWPRIV_U32(DOT11_OID_NOISEFLOOR, "noisefloor"),
2295 IWPRIV_GET(DOT11_OID_FREQUENCYACTIVITY, "freqactivity"),
2296 IWPRIV_U32(DOT11_OID_NONERPPROTECTION, "nonerpprotec"),
2297 IWPRIV_U32(DOT11_OID_PROFILES, "profile"),
2298 IWPRIV_GET(DOT11_OID_EXTENDEDRATES, "extrates"),
2299 IWPRIV_U32(DOT11_OID_MLMEAUTOLEVEL, "mlmelevel"),
2301 IWPRIV_GET(DOT11_OID_BSSS, "bsss"),
2302 IWPRIV_GET(DOT11_OID_BSSLIST, "bsslist"),
2303 IWPRIV_U32(OID_INL_MODE, "mode"),
2304 IWPRIV_U32(OID_INL_CONFIG, "config"),
2305 IWPRIV_U32(OID_INL_DOT11D_CONFORMANCE, ".11dconform"),
2306 IWPRIV_GET(OID_INL_PHYCAPABILITIES, "phycapa"),
2307 IWPRIV_U32(OID_INL_OUTPUTPOWER, "outpower"),
2310 static const iw_handler prism54_private_handler[] = {
2311 (iw_handler) prism54_reset,
2312 (iw_handler) prism54_get_policy,
2313 (iw_handler) prism54_set_policy,
2314 (iw_handler) prism54_get_mac,
2315 (iw_handler) prism54_add_mac,
2317 (iw_handler) prism54_del_mac,
2319 (iw_handler) prism54_kick_mac,
2321 (iw_handler) prism54_kick_all,
2322 (iw_handler) prism54_get_wpa,
2323 (iw_handler) prism54_set_wpa,
2325 (iw_handler) prism54_debug_oid,
2326 (iw_handler) prism54_debug_get_oid,
2327 (iw_handler) prism54_debug_set_oid,
2328 (iw_handler) prism54_get_oid,
2329 (iw_handler) prism54_set_u32,
2331 (iw_handler) prism54_set_raw,
2333 (iw_handler) prism54_set_raw,
2334 (iw_handler) prism54_get_prismhdr,
2335 (iw_handler) prism54_set_prismhdr,
2338 const struct iw_handler_def prism54_handler_def = {
2339 .num_standard = sizeof (prism54_handler) / sizeof (iw_handler),
2340 .num_private = sizeof (prism54_private_handler) / sizeof (iw_handler),
2342 sizeof (prism54_private_args) / sizeof (struct iw_priv_args),
2343 .standard = (iw_handler *) prism54_handler,
2344 .private = (iw_handler *) prism54_private_handler,
2345 .private_args = (struct iw_priv_args *) prism54_private_args,
2346 .spy_offset = offsetof(islpci_private, spy_data),
2349 /* For ioctls that don't work with the new API */
2352 prism54_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)