2 * Copyright (C) 2002 Intersil Americas Inc.
3 * (C) 2003,2004 Aurelien Alleaume <slts@free.fr>
4 * (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
5 * (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #include <linux/capability.h>
22 #include <linux/module.h>
23 #include <linux/kernel.h>
24 #include <linux/if_arp.h>
25 #include <linux/slab.h>
26 #include <linux/pci.h>
27 #include <linux/etherdevice.h>
29 #include <linux/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 #define KEY_SIZE_WEP104 13 /* 104/128-bit WEP keys */
40 #define KEY_SIZE_WEP40 5 /* 40/64-bit WEP keys */
41 /* KEY_SIZE_TKIP should match isl_oid.h, struct obj_key.key[] size */
42 #define KEY_SIZE_TKIP 32 /* TKIP keys */
44 static void prism54_wpa_bss_ie_add(islpci_private
*priv
, u8
*bssid
,
45 u8
*wpa_ie
, size_t wpa_ie_len
);
46 static size_t prism54_wpa_bss_ie_get(islpci_private
*priv
, u8
*bssid
, u8
*wpa_ie
);
47 static int prism54_set_wpa(struct net_device
*, struct iw_request_info
*,
51 static const unsigned char scan_rate_list
[] = { 2, 4, 11, 22,
56 * prism54_mib_mode_helper - MIB change mode helper function
57 * @priv: the &struct islpci_private object to modify
58 * @iw_mode: new mode (%IW_MODE_*)
60 * This is a helper function, hence it does not lock. Make sure
61 * caller deals with locking *if* necessary. This function sets the
62 * mode-dependent mib values and does the mapping of the Linux
63 * Wireless API modes to Device firmware modes. It also checks for
64 * correct valid Linux wireless modes.
67 prism54_mib_mode_helper(islpci_private
*priv
, u32 iw_mode
)
69 u32 config
= INL_CONFIG_MANUALRUN
;
72 /* For now, just catch early the Repeater and Secondary modes here */
73 if (iw_mode
== IW_MODE_REPEAT
|| iw_mode
== IW_MODE_SECOND
) {
75 "%s(): Sorry, Repeater mode and Secondary mode "
76 "are not yet supported by this driver.\n", __func__
);
80 priv
->iw_mode
= iw_mode
;
84 mode
= INL_MODE_CLIENT
;
85 bsstype
= DOT11_BSSTYPE_ANY
;
88 mode
= INL_MODE_CLIENT
;
89 bsstype
= DOT11_BSSTYPE_IBSS
;
92 mode
= INL_MODE_CLIENT
;
93 bsstype
= DOT11_BSSTYPE_INFRA
;
97 bsstype
= DOT11_BSSTYPE_INFRA
;
100 mode
= INL_MODE_PROMISCUOUS
;
101 bsstype
= DOT11_BSSTYPE_ANY
;
102 config
|= INL_CONFIG_RXANNEX
;
109 config
|= INL_CONFIG_WDS
;
110 mgt_set(priv
, DOT11_OID_BSSTYPE
, &bsstype
);
111 mgt_set(priv
, OID_INL_CONFIG
, &config
);
112 mgt_set(priv
, OID_INL_MODE
, &mode
);
118 * prism54_mib_init - fill MIB cache with defaults
120 * this function initializes the struct given as @mib with defaults,
121 * of which many are retrieved from the global module parameter
125 prism54_mib_init(islpci_private
*priv
)
127 u32 channel
, authen
, wep
, filter
, dot1x
, mlme
, conformance
, power
, mode
;
128 struct obj_buffer psm_buffer
= {
129 .size
= PSM_BUFFER_SIZE
,
130 .addr
= priv
->device_psm_buffer
133 channel
= CARD_DEFAULT_CHANNEL
;
134 authen
= CARD_DEFAULT_AUTHEN
;
135 wep
= CARD_DEFAULT_WEP
;
136 filter
= CARD_DEFAULT_FILTER
; /* (0) Do not filter un-encrypted data */
137 dot1x
= CARD_DEFAULT_DOT1X
;
138 mlme
= CARD_DEFAULT_MLME_MODE
;
139 conformance
= CARD_DEFAULT_CONFORMANCE
;
141 mode
= CARD_DEFAULT_IW_MODE
;
143 mgt_set(priv
, DOT11_OID_CHANNEL
, &channel
);
144 mgt_set(priv
, DOT11_OID_AUTHENABLE
, &authen
);
145 mgt_set(priv
, DOT11_OID_PRIVACYINVOKED
, &wep
);
146 mgt_set(priv
, DOT11_OID_PSMBUFFER
, &psm_buffer
);
147 mgt_set(priv
, DOT11_OID_EXUNENCRYPTED
, &filter
);
148 mgt_set(priv
, DOT11_OID_DOT1XENABLE
, &dot1x
);
149 mgt_set(priv
, DOT11_OID_MLMEAUTOLEVEL
, &mlme
);
150 mgt_set(priv
, OID_INL_DOT11D_CONFORMANCE
, &conformance
);
151 mgt_set(priv
, OID_INL_OUTPUTPOWER
, &power
);
153 /* This sets all of the mode-dependent values */
154 prism54_mib_mode_helper(priv
, mode
);
157 /* this will be executed outside of atomic context thanks to
158 * schedule_work(), thus we can as well use sleeping semaphore
161 prism54_update_stats(struct work_struct
*work
)
163 islpci_private
*priv
= container_of(work
, islpci_private
, stats_work
);
165 struct obj_bss bss
, *bss2
;
168 mutex_lock(&priv
->stats_lock
);
171 * I'm not sure if the unit is dBm.
172 * Note : If we are not connected, this value seems to be irrelevant. */
174 mgt_get_request(priv
, DOT11_OID_NOISEFLOOR
, 0, NULL
, &r
);
175 priv
->local_iwstatistics
.qual
.noise
= r
.u
;
177 /* Get the rssi of the link. To do this we need to retrieve a bss. */
179 /* First get the MAC address of the AP we are associated with. */
180 mgt_get_request(priv
, DOT11_OID_BSSID
, 0, NULL
, &r
);
183 /* copy this MAC to the bss */
184 memcpy(bss
.address
, data
, ETH_ALEN
);
187 /* now ask for the corresponding bss */
188 mgt_get_request(priv
, DOT11_OID_BSSFIND
, 0, (void *) &bss
, &r
);
190 /* report the rssi and use it to calculate
191 * link quality through a signal-noise
193 priv
->local_iwstatistics
.qual
.level
= bss2
->rssi
;
194 priv
->local_iwstatistics
.qual
.qual
=
195 bss2
->rssi
- priv
->iwstatistics
.qual
.noise
;
199 /* report that the stats are new */
200 priv
->local_iwstatistics
.qual
.updated
= 0x7;
202 /* Rx : unable to decrypt the MPDU */
203 mgt_get_request(priv
, DOT11_OID_PRIVRXFAILED
, 0, NULL
, &r
);
204 priv
->local_iwstatistics
.discard
.code
= r
.u
;
206 /* Tx : Max MAC retries num reached */
207 mgt_get_request(priv
, DOT11_OID_MPDUTXFAILED
, 0, NULL
, &r
);
208 priv
->local_iwstatistics
.discard
.retries
= r
.u
;
210 mutex_unlock(&priv
->stats_lock
);
213 struct iw_statistics
*
214 prism54_get_wireless_stats(struct net_device
*ndev
)
216 islpci_private
*priv
= netdev_priv(ndev
);
218 /* If the stats are being updated return old data */
219 if (mutex_trylock(&priv
->stats_lock
)) {
220 memcpy(&priv
->iwstatistics
, &priv
->local_iwstatistics
,
221 sizeof (struct iw_statistics
));
222 /* They won't be marked updated for the next time */
223 priv
->local_iwstatistics
.qual
.updated
= 0;
224 mutex_unlock(&priv
->stats_lock
);
226 priv
->iwstatistics
.qual
.updated
= 0;
228 /* Update our wireless stats, but do not schedule to often
230 if ((priv
->stats_timestamp
== 0) ||
231 time_after(jiffies
, priv
->stats_timestamp
+ 1 * HZ
)) {
232 schedule_work(&priv
->stats_work
);
233 priv
->stats_timestamp
= jiffies
;
236 return &priv
->iwstatistics
;
240 prism54_commit(struct net_device
*ndev
, struct iw_request_info
*info
,
241 char *cwrq
, char *extra
)
243 islpci_private
*priv
= netdev_priv(ndev
);
245 /* simply re-set the last set SSID, this should commit most stuff */
247 /* Commit in Monitor mode is not necessary, also setting essid
248 * in Monitor mode does not make sense and isn't allowed for this
249 * device's firmware */
250 if (priv
->iw_mode
!= IW_MODE_MONITOR
)
251 return mgt_set_request(priv
, DOT11_OID_SSID
, 0, NULL
);
256 prism54_get_name(struct net_device
*ndev
, struct iw_request_info
*info
,
257 char *cwrq
, char *extra
)
259 islpci_private
*priv
= netdev_priv(ndev
);
264 if (islpci_get_state(priv
) < PRV_STATE_INIT
) {
265 strncpy(cwrq
, "NOT READY!", IFNAMSIZ
);
268 rvalue
= mgt_get_request(priv
, OID_INL_PHYCAPABILITIES
, 0, NULL
, &r
);
271 case INL_PHYCAP_5000MHZ
:
272 capabilities
= "IEEE 802.11a/b/g";
275 capabilities
= "IEEE 802.11b/g - FAA Support";
277 case INL_PHYCAP_2400MHZ
:
279 capabilities
= "IEEE 802.11b/g"; /* Default */
282 strncpy(cwrq
, capabilities
, IFNAMSIZ
);
287 prism54_set_freq(struct net_device
*ndev
, struct iw_request_info
*info
,
288 struct iw_freq
*fwrq
, char *extra
)
290 islpci_private
*priv
= netdev_priv(ndev
);
295 /* we have a channel number */
298 c
= (fwrq
->e
== 1) ? channel_of_freq(fwrq
->m
/ 100000) : 0;
300 rvalue
= c
? mgt_set_request(priv
, DOT11_OID_CHANNEL
, 0, &c
) : -EINVAL
;
302 /* Call commit handler */
303 return (rvalue
? rvalue
: -EINPROGRESS
);
307 prism54_get_freq(struct net_device
*ndev
, struct iw_request_info
*info
,
308 struct iw_freq
*fwrq
, char *extra
)
310 islpci_private
*priv
= netdev_priv(ndev
);
314 rvalue
= mgt_get_request(priv
, DOT11_OID_CHANNEL
, 0, NULL
, &r
);
316 rvalue
|= mgt_get_request(priv
, DOT11_OID_FREQUENCY
, 0, NULL
, &r
);
324 prism54_set_mode(struct net_device
*ndev
, struct iw_request_info
*info
,
325 __u32
* uwrq
, char *extra
)
327 islpci_private
*priv
= netdev_priv(ndev
);
328 u32 mlmeautolevel
= CARD_DEFAULT_MLME_MODE
;
330 /* Let's see if the user passed a valid Linux Wireless mode */
331 if (*uwrq
> IW_MODE_MONITOR
|| *uwrq
< IW_MODE_AUTO
) {
333 "%s: %s() You passed a non-valid init_mode.\n",
334 priv
->ndev
->name
, __func__
);
338 down_write(&priv
->mib_sem
);
340 if (prism54_mib_mode_helper(priv
, *uwrq
)) {
341 up_write(&priv
->mib_sem
);
345 /* the ACL code needs an intermediate mlmeautolevel. The wpa stuff an
348 if ((*uwrq
== IW_MODE_MASTER
) && (priv
->acl
.policy
!= MAC_POLICY_OPEN
))
349 mlmeautolevel
= DOT11_MLME_INTERMEDIATE
;
351 mlmeautolevel
= DOT11_MLME_EXTENDED
;
353 mgt_set(priv
, DOT11_OID_MLMEAUTOLEVEL
, &mlmeautolevel
);
355 if (mgt_commit(priv
)) {
356 up_write(&priv
->mib_sem
);
359 priv
->ndev
->type
= (priv
->iw_mode
== IW_MODE_MONITOR
)
360 ? priv
->monitor_type
: ARPHRD_ETHER
;
361 up_write(&priv
->mib_sem
);
368 prism54_get_mode(struct net_device
*ndev
, struct iw_request_info
*info
,
369 __u32
* uwrq
, char *extra
)
371 islpci_private
*priv
= netdev_priv(ndev
);
373 BUG_ON((priv
->iw_mode
< IW_MODE_AUTO
) || (priv
->iw_mode
>
375 *uwrq
= priv
->iw_mode
;
380 /* we use DOT11_OID_EDTHRESHOLD. From what I guess the card will not try to
381 * emit data if (sensitivity > rssi - noise) (in dBm).
382 * prism54_set_sens does not seem to work.
386 prism54_set_sens(struct net_device
*ndev
, struct iw_request_info
*info
,
387 struct iw_param
*vwrq
, char *extra
)
389 islpci_private
*priv
= netdev_priv(ndev
);
392 /* by default the card sets this to 20. */
393 sens
= vwrq
->disabled
? 20 : vwrq
->value
;
395 return mgt_set_request(priv
, DOT11_OID_EDTHRESHOLD
, 0, &sens
);
399 prism54_get_sens(struct net_device
*ndev
, struct iw_request_info
*info
,
400 struct iw_param
*vwrq
, char *extra
)
402 islpci_private
*priv
= netdev_priv(ndev
);
406 rvalue
= mgt_get_request(priv
, DOT11_OID_EDTHRESHOLD
, 0, NULL
, &r
);
409 vwrq
->disabled
= (vwrq
->value
== 0);
416 prism54_get_range(struct net_device
*ndev
, struct iw_request_info
*info
,
417 struct iw_point
*dwrq
, char *extra
)
419 struct iw_range
*range
= (struct iw_range
*) extra
;
420 islpci_private
*priv
= netdev_priv(ndev
);
423 struct obj_frequencies
*freq
;
426 memset(range
, 0, sizeof (struct iw_range
));
427 dwrq
->length
= sizeof (struct iw_range
);
429 /* set the wireless extension version number */
430 range
->we_version_source
= SUPPORTED_WIRELESS_EXT
;
431 range
->we_version_compiled
= WIRELESS_EXT
;
433 /* Now the encoding capabilities */
434 range
->num_encoding_sizes
= 3;
435 /* 64(40) bits WEP */
436 range
->encoding_size
[0] = 5;
437 /* 128(104) bits WEP */
438 range
->encoding_size
[1] = 13;
439 /* 256 bits for WPA-PSK */
440 range
->encoding_size
[2] = 32;
441 /* 4 keys are allowed */
442 range
->max_encoding_tokens
= 4;
444 /* we don't know the quality range... */
445 range
->max_qual
.level
= 0;
446 range
->max_qual
.noise
= 0;
447 range
->max_qual
.qual
= 0;
448 /* these value describe an average quality. Needs more tweaking... */
449 range
->avg_qual
.level
= -80; /* -80 dBm */
450 range
->avg_qual
.noise
= 0; /* don't know what to put here */
451 range
->avg_qual
.qual
= 0;
453 range
->sensitivity
= 200;
455 /* retry limit capabilities */
456 range
->retry_capa
= IW_RETRY_LIMIT
| IW_RETRY_LIFETIME
;
457 range
->retry_flags
= IW_RETRY_LIMIT
;
458 range
->r_time_flags
= IW_RETRY_LIFETIME
;
460 /* I don't know the range. Put stupid things here */
461 range
->min_retry
= 1;
462 range
->max_retry
= 65535;
463 range
->min_r_time
= 1024;
464 range
->max_r_time
= 65535 * 1024;
466 /* txpower is supported in dBm's */
467 range
->txpower_capa
= IW_TXPOW_DBM
;
469 /* Event capability (kernel + driver) */
470 range
->event_capa
[0] = (IW_EVENT_CAPA_K_0
|
471 IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY
) |
472 IW_EVENT_CAPA_MASK(SIOCGIWAP
));
473 range
->event_capa
[1] = IW_EVENT_CAPA_K_1
;
474 range
->event_capa
[4] = IW_EVENT_CAPA_MASK(IWEVCUSTOM
);
476 range
->enc_capa
= IW_ENC_CAPA_WPA
| IW_ENC_CAPA_WPA2
|
477 IW_ENC_CAPA_CIPHER_TKIP
;
479 if (islpci_get_state(priv
) < PRV_STATE_INIT
)
482 /* Request the device for the supported frequencies
483 * not really relevant since some devices will report the 5 GHz band
484 * frequencies even if they don't support them.
487 mgt_get_request(priv
, DOT11_OID_SUPPORTEDFREQUENCIES
, 0, NULL
, &r
);
490 range
->num_channels
= freq
->nr
;
491 range
->num_frequency
= freq
->nr
;
493 m
= min(IW_MAX_FREQUENCIES
, (int) freq
->nr
);
494 for (i
= 0; i
< m
; i
++) {
495 range
->freq
[i
].m
= freq
->mhz
[i
];
496 range
->freq
[i
].e
= 6;
497 range
->freq
[i
].i
= channel_of_freq(freq
->mhz
[i
]);
501 rvalue
|= mgt_get_request(priv
, DOT11_OID_SUPPORTEDRATES
, 0, NULL
, &r
);
504 /* We got an array of char. It is NULL terminated. */
506 while ((i
< IW_MAX_BITRATES
) && (*data
!= 0)) {
507 /* the result must be in bps. The card gives us 500Kbps */
508 range
->bitrate
[i
] = *data
* 500000;
512 range
->num_bitrates
= i
;
521 prism54_set_wap(struct net_device
*ndev
, struct iw_request_info
*info
,
522 struct sockaddr
*awrq
, char *extra
)
524 islpci_private
*priv
= netdev_priv(ndev
);
528 if (awrq
->sa_family
!= ARPHRD_ETHER
)
531 /* prepare the structure for the set object */
532 memcpy(&bssid
[0], awrq
->sa_data
, ETH_ALEN
);
534 /* set the bssid -- does this make sense when in AP mode? */
535 rvalue
= mgt_set_request(priv
, DOT11_OID_BSSID
, 0, &bssid
);
537 return (rvalue
? rvalue
: -EINPROGRESS
); /* Call commit handler */
543 prism54_get_wap(struct net_device
*ndev
, struct iw_request_info
*info
,
544 struct sockaddr
*awrq
, char *extra
)
546 islpci_private
*priv
= netdev_priv(ndev
);
550 rvalue
= mgt_get_request(priv
, DOT11_OID_BSSID
, 0, NULL
, &r
);
551 memcpy(awrq
->sa_data
, r
.ptr
, ETH_ALEN
);
552 awrq
->sa_family
= ARPHRD_ETHER
;
559 prism54_set_scan(struct net_device
*dev
, struct iw_request_info
*info
,
560 struct iw_param
*vwrq
, char *extra
)
562 /* hehe the device does this automagicaly */
566 /* a little helper that will translate our data into a card independent
567 * format that the Wireless Tools will understand. This was inspired by
568 * the "Aironet driver for 4500 and 4800 series cards" (GPL)
572 prism54_translate_bss(struct net_device
*ndev
, struct iw_request_info
*info
,
573 char *current_ev
, char *end_buf
, struct obj_bss
*bss
,
576 struct iw_event iwe
; /* Temporary buffer */
578 islpci_private
*priv
= netdev_priv(ndev
);
579 u8 wpa_ie
[MAX_WPA_IE_LEN
];
582 /* The first entry must be the MAC address */
583 memcpy(iwe
.u
.ap_addr
.sa_data
, bss
->address
, ETH_ALEN
);
584 iwe
.u
.ap_addr
.sa_family
= ARPHRD_ETHER
;
586 current_ev
= iwe_stream_add_event(info
, current_ev
, end_buf
,
587 &iwe
, IW_EV_ADDR_LEN
);
589 /* The following entries will be displayed in the same order we give them */
592 iwe
.u
.data
.length
= bss
->ssid
.length
;
593 iwe
.u
.data
.flags
= 1;
594 iwe
.cmd
= SIOCGIWESSID
;
595 current_ev
= iwe_stream_add_point(info
, current_ev
, end_buf
,
596 &iwe
, bss
->ssid
.octets
);
600 #define CAP_IBSS 0x02
601 #define CAP_CRYPT 0x10
607 iwe
.u
.mode
= IW_MODE_MASTER
;
608 else if (cap
& CAP_IBSS
)
609 iwe
.u
.mode
= IW_MODE_ADHOC
;
610 iwe
.cmd
= SIOCGIWMODE
;
612 current_ev
= iwe_stream_add_event(info
, current_ev
, end_buf
,
613 &iwe
, IW_EV_UINT_LEN
);
615 /* Encryption capability */
617 iwe
.u
.data
.flags
= IW_ENCODE_ENABLED
| IW_ENCODE_NOKEY
;
619 iwe
.u
.data
.flags
= IW_ENCODE_DISABLED
;
620 iwe
.u
.data
.length
= 0;
621 iwe
.cmd
= SIOCGIWENCODE
;
622 current_ev
= iwe_stream_add_point(info
, current_ev
, end_buf
,
625 /* Add frequency. (short) bss->channel is the frequency in MHz */
626 iwe
.u
.freq
.m
= bss
->channel
;
628 iwe
.cmd
= SIOCGIWFREQ
;
629 current_ev
= iwe_stream_add_event(info
, current_ev
, end_buf
,
630 &iwe
, IW_EV_FREQ_LEN
);
632 /* Add quality statistics */
633 iwe
.u
.qual
.level
= bss
->rssi
;
634 iwe
.u
.qual
.noise
= noise
;
635 /* do a simple SNR for quality */
636 iwe
.u
.qual
.qual
= bss
->rssi
- noise
;
638 current_ev
= iwe_stream_add_event(info
, current_ev
, end_buf
,
639 &iwe
, IW_EV_QUAL_LEN
);
641 /* Add WPA/RSN Information Element, if any */
642 wpa_ie_len
= prism54_wpa_bss_ie_get(priv
, bss
->address
, wpa_ie
);
643 if (wpa_ie_len
> 0) {
645 iwe
.u
.data
.length
= min_t(size_t, wpa_ie_len
, MAX_WPA_IE_LEN
);
646 current_ev
= iwe_stream_add_point(info
, current_ev
, end_buf
,
649 /* Do the bitrates */
651 char *current_val
= current_ev
+ iwe_stream_lcp_len(info
);
655 iwe
.cmd
= SIOCGIWRATE
;
656 /* Those two flags are ignored... */
657 iwe
.u
.bitrate
.fixed
= iwe
.u
.bitrate
.disabled
= 0;
659 /* Parse the bitmask */
661 for(i
= 0; i
< sizeof(scan_rate_list
); i
++) {
662 if(bss
->rates
& mask
) {
663 iwe
.u
.bitrate
.value
= (scan_rate_list
[i
] * 500000);
664 current_val
= iwe_stream_add_value(
665 info
, current_ev
, current_val
,
666 end_buf
, &iwe
, IW_EV_PARAM_LEN
);
670 /* Check if we added any event */
671 if ((current_val
- current_ev
) > iwe_stream_lcp_len(info
))
672 current_ev
= current_val
;
679 prism54_get_scan(struct net_device
*ndev
, struct iw_request_info
*info
,
680 struct iw_point
*dwrq
, char *extra
)
682 islpci_private
*priv
= netdev_priv(ndev
);
684 struct obj_bsslist
*bsslist
;
686 char *current_ev
= extra
;
689 if (islpci_get_state(priv
) < PRV_STATE_INIT
) {
690 /* device is not ready, fail gently */
695 /* first get the noise value. We will use it to report the link quality */
696 rvalue
= mgt_get_request(priv
, DOT11_OID_NOISEFLOOR
, 0, NULL
, &r
);
699 /* Ask the device for a list of known bss.
700 * The old API, using SIOCGIWAPLIST, had a hard limit of IW_MAX_AP=64.
701 * The new API, using SIOCGIWSCAN, is only limited by the buffer size.
702 * WE-14->WE-16, the buffer is limited to IW_SCAN_MAX_DATA bytes.
703 * Starting with WE-17, the buffer can be as big as needed.
704 * But the device won't repport anything if you change the value
705 * of IWMAX_BSS=24. */
707 rvalue
|= mgt_get_request(priv
, DOT11_OID_BSSLIST
, 0, NULL
, &r
);
710 /* ok now, scan the list and translate its info */
711 for (i
= 0; i
< (int) bsslist
->nr
; i
++) {
712 current_ev
= prism54_translate_bss(ndev
, info
, current_ev
,
713 extra
+ dwrq
->length
,
714 &(bsslist
->bsslist
[i
]),
717 /* Check if there is space for one more entry */
718 if((extra
+ dwrq
->length
- current_ev
) <= IW_EV_ADDR_LEN
) {
719 /* Ask user space to try again with a bigger buffer */
726 dwrq
->length
= (current_ev
- extra
);
727 dwrq
->flags
= 0; /* todo */
733 prism54_set_essid(struct net_device
*ndev
, struct iw_request_info
*info
,
734 struct iw_point
*dwrq
, char *extra
)
736 islpci_private
*priv
= netdev_priv(ndev
);
737 struct obj_ssid essid
;
739 memset(essid
.octets
, 0, 33);
741 /* Check if we were asked for `any' */
742 if (dwrq
->flags
&& dwrq
->length
) {
743 if (dwrq
->length
> 32)
745 essid
.length
= dwrq
->length
;
746 memcpy(essid
.octets
, extra
, dwrq
->length
);
750 if (priv
->iw_mode
!= IW_MODE_MONITOR
)
751 return mgt_set_request(priv
, DOT11_OID_SSID
, 0, &essid
);
753 /* If in monitor mode, just save to mib */
754 mgt_set(priv
, DOT11_OID_SSID
, &essid
);
760 prism54_get_essid(struct net_device
*ndev
, struct iw_request_info
*info
,
761 struct iw_point
*dwrq
, char *extra
)
763 islpci_private
*priv
= netdev_priv(ndev
);
764 struct obj_ssid
*essid
;
768 rvalue
= mgt_get_request(priv
, DOT11_OID_SSID
, 0, NULL
, &r
);
772 dwrq
->flags
= 1; /* set ESSID to ON for Wireless Extensions */
773 /* if it is too big, trunk it */
774 dwrq
->length
= min((u8
)IW_ESSID_MAX_SIZE
, essid
->length
);
779 essid
->octets
[dwrq
->length
] = '\0';
780 memcpy(extra
, essid
->octets
, dwrq
->length
);
786 /* Provides no functionality, just completes the ioctl. In essence this is a
787 * just a cosmetic ioctl.
790 prism54_set_nick(struct net_device
*ndev
, struct iw_request_info
*info
,
791 struct iw_point
*dwrq
, char *extra
)
793 islpci_private
*priv
= netdev_priv(ndev
);
795 if (dwrq
->length
> IW_ESSID_MAX_SIZE
)
798 down_write(&priv
->mib_sem
);
799 memset(priv
->nickname
, 0, sizeof (priv
->nickname
));
800 memcpy(priv
->nickname
, extra
, dwrq
->length
);
801 up_write(&priv
->mib_sem
);
807 prism54_get_nick(struct net_device
*ndev
, struct iw_request_info
*info
,
808 struct iw_point
*dwrq
, char *extra
)
810 islpci_private
*priv
= netdev_priv(ndev
);
814 down_read(&priv
->mib_sem
);
815 dwrq
->length
= strlen(priv
->nickname
);
816 memcpy(extra
, priv
->nickname
, dwrq
->length
);
817 up_read(&priv
->mib_sem
);
822 /* Set the allowed Bitrates */
825 prism54_set_rate(struct net_device
*ndev
,
826 struct iw_request_info
*info
,
827 struct iw_param
*vwrq
, char *extra
)
830 islpci_private
*priv
= netdev_priv(ndev
);
836 if (vwrq
->value
== -1) {
837 /* auto mode. No limit. */
839 return mgt_set_request(priv
, DOT11_OID_PROFILES
, 0, &profile
);
842 ret
= mgt_get_request(priv
, DOT11_OID_SUPPORTEDRATES
, 0, NULL
, &r
);
848 rate
= (u32
) (vwrq
->value
/ 500000);
853 if (rate
&& (data
[i
] == rate
)) {
856 if (vwrq
->value
== i
) {
871 /* Now, check if we want a fixed or auto value */
879 printk("prism54 rate: ");
881 printk("%u ", data[i]);
887 ret
= mgt_set_request(priv
, DOT11_OID_PROFILES
, 0, &profile
);
888 ret
|= mgt_set_request(priv
, DOT11_OID_EXTENDEDRATES
, 0, data
);
889 ret
|= mgt_set_request(priv
, DOT11_OID_RATES
, 0, data
);
896 /* Get the current bit rate */
898 prism54_get_rate(struct net_device
*ndev
,
899 struct iw_request_info
*info
,
900 struct iw_param
*vwrq
, char *extra
)
902 islpci_private
*priv
= netdev_priv(ndev
);
907 /* Get the current bit rate */
908 if ((rvalue
= mgt_get_request(priv
, GEN_OID_LINKSTATE
, 0, NULL
, &r
)))
910 vwrq
->value
= r
.u
* 500000;
912 /* request the device for the enabled rates */
913 rvalue
= mgt_get_request(priv
, DOT11_OID_RATES
, 0, NULL
, &r
);
919 vwrq
->fixed
= (data
[0] != 0) && (data
[1] == 0);
926 prism54_set_rts(struct net_device
*ndev
, struct iw_request_info
*info
,
927 struct iw_param
*vwrq
, char *extra
)
929 islpci_private
*priv
= netdev_priv(ndev
);
931 return mgt_set_request(priv
, DOT11_OID_RTSTHRESH
, 0, &vwrq
->value
);
935 prism54_get_rts(struct net_device
*ndev
, struct iw_request_info
*info
,
936 struct iw_param
*vwrq
, char *extra
)
938 islpci_private
*priv
= netdev_priv(ndev
);
942 /* get the rts threshold */
943 rvalue
= mgt_get_request(priv
, DOT11_OID_RTSTHRESH
, 0, NULL
, &r
);
950 prism54_set_frag(struct net_device
*ndev
, struct iw_request_info
*info
,
951 struct iw_param
*vwrq
, char *extra
)
953 islpci_private
*priv
= netdev_priv(ndev
);
955 return mgt_set_request(priv
, DOT11_OID_FRAGTHRESH
, 0, &vwrq
->value
);
959 prism54_get_frag(struct net_device
*ndev
, struct iw_request_info
*info
,
960 struct iw_param
*vwrq
, char *extra
)
962 islpci_private
*priv
= netdev_priv(ndev
);
966 rvalue
= mgt_get_request(priv
, DOT11_OID_FRAGTHRESH
, 0, NULL
, &r
);
972 /* Here we have (min,max) = max retries for (small frames, big frames). Where
973 * big frame <=> bigger than the rts threshold
974 * small frame <=> smaller than the rts threshold
975 * This is not really the behavior expected by the wireless tool but it seems
976 * to be a common behavior in other drivers.
980 prism54_set_retry(struct net_device
*ndev
, struct iw_request_info
*info
,
981 struct iw_param
*vwrq
, char *extra
)
983 islpci_private
*priv
= netdev_priv(ndev
);
984 u32 slimit
= 0, llimit
= 0; /* short and long limit */
989 /* we cannot disable this feature */
992 if (vwrq
->flags
& IW_RETRY_LIMIT
) {
993 if (vwrq
->flags
& IW_RETRY_SHORT
)
994 slimit
= vwrq
->value
;
995 else if (vwrq
->flags
& IW_RETRY_LONG
)
996 llimit
= vwrq
->value
;
998 /* we are asked to set both */
999 slimit
= vwrq
->value
;
1000 llimit
= vwrq
->value
;
1003 if (vwrq
->flags
& IW_RETRY_LIFETIME
)
1004 /* Wireless tools use us unit while the device uses 1024 us unit */
1005 lifetime
= vwrq
->value
/ 1024;
1007 /* now set what is requested */
1010 mgt_set_request(priv
, DOT11_OID_SHORTRETRIES
, 0, &slimit
);
1013 mgt_set_request(priv
, DOT11_OID_LONGRETRIES
, 0, &llimit
);
1016 mgt_set_request(priv
, DOT11_OID_MAXTXLIFETIME
, 0,
1022 prism54_get_retry(struct net_device
*ndev
, struct iw_request_info
*info
,
1023 struct iw_param
*vwrq
, char *extra
)
1025 islpci_private
*priv
= netdev_priv(ndev
);
1028 vwrq
->disabled
= 0; /* It cannot be disabled */
1030 if ((vwrq
->flags
& IW_RETRY_TYPE
) == IW_RETRY_LIFETIME
) {
1031 /* we are asked for the life time */
1033 mgt_get_request(priv
, DOT11_OID_MAXTXLIFETIME
, 0, NULL
, &r
);
1034 vwrq
->value
= r
.u
* 1024;
1035 vwrq
->flags
= IW_RETRY_LIFETIME
;
1036 } else if ((vwrq
->flags
& IW_RETRY_LONG
)) {
1037 /* we are asked for the long retry limit */
1039 mgt_get_request(priv
, DOT11_OID_LONGRETRIES
, 0, NULL
, &r
);
1041 vwrq
->flags
= IW_RETRY_LIMIT
| IW_RETRY_LONG
;
1043 /* default. get the short retry limit */
1045 mgt_get_request(priv
, DOT11_OID_SHORTRETRIES
, 0, NULL
, &r
);
1047 vwrq
->flags
= IW_RETRY_LIMIT
| IW_RETRY_SHORT
;
1054 prism54_set_encode(struct net_device
*ndev
, struct iw_request_info
*info
,
1055 struct iw_point
*dwrq
, char *extra
)
1057 islpci_private
*priv
= netdev_priv(ndev
);
1058 int rvalue
= 0, force
= 0;
1059 int authen
= DOT11_AUTH_OS
, invoke
= 0, exunencrypt
= 0;
1062 /* with the new API, it's impossible to get a NULL pointer.
1063 * New version of iwconfig set the IW_ENCODE_NOKEY flag
1064 * when no key is given, but older versions don't. */
1066 if (dwrq
->length
> 0) {
1067 /* we have a key to set */
1068 int index
= (dwrq
->flags
& IW_ENCODE_INDEX
) - 1;
1070 struct obj_key key
= { DOT11_PRIV_WEP
, 0, "" };
1072 /* get the current key index */
1073 rvalue
= mgt_get_request(priv
, DOT11_OID_DEFKEYID
, 0, NULL
, &r
);
1074 current_index
= r
.u
;
1075 /* Verify that the key is not marked as invalid */
1076 if (!(dwrq
->flags
& IW_ENCODE_NOKEY
)) {
1077 if (dwrq
->length
> KEY_SIZE_TKIP
) {
1078 /* User-provided key data too big */
1081 if (dwrq
->length
> KEY_SIZE_WEP104
) {
1083 key
.type
= DOT11_PRIV_TKIP
;
1084 key
.length
= KEY_SIZE_TKIP
;
1085 } else if (dwrq
->length
> KEY_SIZE_WEP40
) {
1087 key
.length
= KEY_SIZE_WEP104
;
1090 key
.length
= KEY_SIZE_WEP40
;
1092 memset(key
.key
, 0, sizeof (key
.key
));
1093 memcpy(key
.key
, extra
, dwrq
->length
);
1095 if ((index
< 0) || (index
> 3))
1096 /* no index provided use the current one */
1097 index
= current_index
;
1099 /* now send the key to the card */
1101 mgt_set_request(priv
, DOT11_OID_DEFKEYX
, index
,
1105 * If a valid key is set, encryption should be enabled
1106 * (user may turn it off later).
1107 * This is also how "iwconfig ethX key on" works
1109 if ((index
== current_index
) && (key
.length
> 0))
1112 int index
= (dwrq
->flags
& IW_ENCODE_INDEX
) - 1;
1113 if ((index
>= 0) && (index
<= 3)) {
1114 /* we want to set the key index */
1116 mgt_set_request(priv
, DOT11_OID_DEFKEYID
, 0,
1119 if (!(dwrq
->flags
& IW_ENCODE_MODE
)) {
1120 /* we cannot do anything. Complain. */
1125 /* now read the flags */
1126 if (dwrq
->flags
& IW_ENCODE_DISABLED
) {
1127 /* Encoding disabled,
1128 * authen = DOT11_AUTH_OS;
1130 * exunencrypt = 0; */
1132 if (dwrq
->flags
& IW_ENCODE_OPEN
)
1133 /* Encode but accept non-encoded packets. No auth */
1135 if ((dwrq
->flags
& IW_ENCODE_RESTRICTED
) || force
) {
1136 /* Refuse non-encoded packets. Auth */
1137 authen
= DOT11_AUTH_BOTH
;
1141 /* do the change if requested */
1142 if ((dwrq
->flags
& IW_ENCODE_MODE
) || force
) {
1144 mgt_set_request(priv
, DOT11_OID_AUTHENABLE
, 0, &authen
);
1146 mgt_set_request(priv
, DOT11_OID_PRIVACYINVOKED
, 0, &invoke
);
1148 mgt_set_request(priv
, DOT11_OID_EXUNENCRYPTED
, 0,
1155 prism54_get_encode(struct net_device
*ndev
, struct iw_request_info
*info
,
1156 struct iw_point
*dwrq
, char *extra
)
1158 islpci_private
*priv
= netdev_priv(ndev
);
1159 struct obj_key
*key
;
1160 u32 devindex
, index
= (dwrq
->flags
& IW_ENCODE_INDEX
) - 1;
1161 u32 authen
= 0, invoke
= 0, exunencrypt
= 0;
1165 /* first get the flags */
1166 rvalue
= mgt_get_request(priv
, DOT11_OID_AUTHENABLE
, 0, NULL
, &r
);
1168 rvalue
|= mgt_get_request(priv
, DOT11_OID_PRIVACYINVOKED
, 0, NULL
, &r
);
1170 rvalue
|= mgt_get_request(priv
, DOT11_OID_EXUNENCRYPTED
, 0, NULL
, &r
);
1173 if (invoke
&& (authen
== DOT11_AUTH_BOTH
) && exunencrypt
)
1174 dwrq
->flags
= IW_ENCODE_RESTRICTED
;
1175 else if ((authen
== DOT11_AUTH_OS
) && !exunencrypt
) {
1177 dwrq
->flags
= IW_ENCODE_OPEN
;
1179 dwrq
->flags
= IW_ENCODE_DISABLED
;
1181 /* The card should not work in this state */
1184 /* get the current device key index */
1185 rvalue
|= mgt_get_request(priv
, DOT11_OID_DEFKEYID
, 0, NULL
, &r
);
1187 /* Now get the key, return it */
1188 if (index
== -1 || index
> 3)
1189 /* no index provided, use the current one */
1191 rvalue
|= mgt_get_request(priv
, DOT11_OID_DEFKEYX
, index
, NULL
, &r
);
1193 dwrq
->length
= key
->length
;
1194 memcpy(extra
, key
->key
, dwrq
->length
);
1196 /* return the used key index */
1197 dwrq
->flags
|= devindex
+ 1;
1203 prism54_get_txpower(struct net_device
*ndev
, struct iw_request_info
*info
,
1204 struct iw_param
*vwrq
, char *extra
)
1206 islpci_private
*priv
= netdev_priv(ndev
);
1210 rvalue
= mgt_get_request(priv
, OID_INL_OUTPUTPOWER
, 0, NULL
, &r
);
1211 /* intersil firmware operates in 0.25 dBm (1/4 dBm) */
1212 vwrq
->value
= (s32
) r
.u
/ 4;
1214 /* radio is not turned of
1215 * btw: how is possible to turn off only the radio
1223 prism54_set_txpower(struct net_device
*ndev
, struct iw_request_info
*info
,
1224 struct iw_param
*vwrq
, char *extra
)
1226 islpci_private
*priv
= netdev_priv(ndev
);
1227 s32 u
= vwrq
->value
;
1229 /* intersil firmware operates in 0.25 dBm (1/4) */
1231 if (vwrq
->disabled
) {
1232 /* don't know how to disable radio */
1234 "%s: %s() disabling radio is not yet supported.\n",
1235 priv
->ndev
->name
, __func__
);
1237 } else if (vwrq
->fixed
)
1238 /* currently only fixed value is supported */
1239 return mgt_set_request(priv
, OID_INL_OUTPUTPOWER
, 0, &u
);
1242 "%s: %s() auto power will be implemented later.\n",
1243 priv
->ndev
->name
, __func__
);
1248 static int prism54_set_genie(struct net_device
*ndev
,
1249 struct iw_request_info
*info
,
1250 struct iw_point
*data
, char *extra
)
1252 islpci_private
*priv
= netdev_priv(ndev
);
1254 struct obj_attachment
*attach
;
1256 if (data
->length
> MAX_WPA_IE_LEN
||
1257 (data
->length
&& extra
== NULL
))
1260 memcpy(priv
->wpa_ie
, extra
, data
->length
);
1261 priv
->wpa_ie_len
= data
->length
;
1263 alen
= sizeof(*attach
) + priv
->wpa_ie_len
;
1264 attach
= kzalloc(alen
, GFP_KERNEL
);
1268 #define WLAN_FC_TYPE_MGMT 0
1269 #define WLAN_FC_STYPE_ASSOC_REQ 0
1270 #define WLAN_FC_STYPE_REASSOC_REQ 2
1272 /* Note: endianness is covered by mgt_set_varlen */
1273 attach
->type
= (WLAN_FC_TYPE_MGMT
<< 2) |
1274 (WLAN_FC_STYPE_ASSOC_REQ
<< 4);
1276 attach
->size
= priv
->wpa_ie_len
;
1277 memcpy(attach
->data
, extra
, priv
->wpa_ie_len
);
1279 ret
= mgt_set_varlen(priv
, DOT11_OID_ATTACHMENT
, attach
,
1282 attach
->type
= (WLAN_FC_TYPE_MGMT
<< 2) |
1283 (WLAN_FC_STYPE_REASSOC_REQ
<< 4);
1285 ret
= mgt_set_varlen(priv
, DOT11_OID_ATTACHMENT
, attach
,
1288 printk(KERN_DEBUG
"%s: WPA IE Attachment was set\n",
1297 static int prism54_get_genie(struct net_device
*ndev
,
1298 struct iw_request_info
*info
,
1299 struct iw_point
*data
, char *extra
)
1301 islpci_private
*priv
= netdev_priv(ndev
);
1302 int len
= priv
->wpa_ie_len
;
1309 if (data
->length
< len
)
1313 memcpy(extra
, priv
->wpa_ie
, len
);
1318 static int prism54_set_auth(struct net_device
*ndev
,
1319 struct iw_request_info
*info
,
1320 union iwreq_data
*wrqu
, char *extra
)
1322 islpci_private
*priv
= netdev_priv(ndev
);
1323 struct iw_param
*param
= &wrqu
->param
;
1324 u32 mlmelevel
= 0, authen
= 0, dot1x
= 0;
1325 u32 exunencrypt
= 0, privinvoked
= 0, wpa
= 0;
1330 if (islpci_get_state(priv
) < PRV_STATE_INIT
)
1333 /* first get the flags */
1334 down_write(&priv
->mib_sem
);
1335 wpa
= old_wpa
= priv
->wpa
;
1336 up_write(&priv
->mib_sem
);
1337 ret
= mgt_get_request(priv
, DOT11_OID_AUTHENABLE
, 0, NULL
, &r
);
1339 ret
= mgt_get_request(priv
, DOT11_OID_PRIVACYINVOKED
, 0, NULL
, &r
);
1341 ret
= mgt_get_request(priv
, DOT11_OID_EXUNENCRYPTED
, 0, NULL
, &r
);
1343 ret
= mgt_get_request(priv
, DOT11_OID_DOT1XENABLE
, 0, NULL
, &r
);
1345 ret
= mgt_get_request(priv
, DOT11_OID_MLMEAUTOLEVEL
, 0, NULL
, &r
);
1351 switch (param
->flags
& IW_AUTH_INDEX
) {
1352 case IW_AUTH_CIPHER_PAIRWISE
:
1353 case IW_AUTH_CIPHER_GROUP
:
1354 case IW_AUTH_KEY_MGMT
:
1357 case IW_AUTH_WPA_ENABLED
:
1358 /* Do the same thing as IW_AUTH_WPA_VERSION */
1361 privinvoked
= 1; /* For privacy invoked */
1362 exunencrypt
= 1; /* Filter out all unencrypted frames */
1363 dot1x
= 0x01; /* To enable eap filter */
1364 mlmelevel
= DOT11_MLME_EXTENDED
;
1365 authen
= DOT11_AUTH_OS
; /* Only WEP uses _SK and _BOTH */
1369 exunencrypt
= 0; /* Do not filter un-encrypted data */
1371 mlmelevel
= DOT11_MLME_AUTO
;
1375 case IW_AUTH_WPA_VERSION
:
1376 if (param
->value
& IW_AUTH_WPA_VERSION_DISABLED
) {
1379 exunencrypt
= 0; /* Do not filter un-encrypted data */
1381 mlmelevel
= DOT11_MLME_AUTO
;
1383 if (param
->value
& IW_AUTH_WPA_VERSION_WPA
)
1385 else if (param
->value
& IW_AUTH_WPA_VERSION_WPA2
)
1387 privinvoked
= 1; /* For privacy invoked */
1388 exunencrypt
= 1; /* Filter out all unencrypted frames */
1389 dot1x
= 0x01; /* To enable eap filter */
1390 mlmelevel
= DOT11_MLME_EXTENDED
;
1391 authen
= DOT11_AUTH_OS
; /* Only WEP uses _SK and _BOTH */
1395 case IW_AUTH_RX_UNENCRYPTED_EAPOL
:
1396 /* dot1x should be the opposite of RX_UNENCRYPTED_EAPOL;
1397 * turn off dot1x when allowing receipt of unencrypted EAPOL
1398 * frames, turn on dot1x when receipt should be disallowed
1400 dot1x
= param
->value
? 0 : 0x01;
1403 case IW_AUTH_PRIVACY_INVOKED
:
1404 privinvoked
= param
->value
? 1 : 0;
1407 case IW_AUTH_DROP_UNENCRYPTED
:
1408 exunencrypt
= param
->value
? 1 : 0;
1411 case IW_AUTH_80211_AUTH_ALG
:
1412 if (param
->value
& IW_AUTH_ALG_SHARED_KEY
) {
1413 /* Only WEP uses _SK and _BOTH */
1418 authen
= DOT11_AUTH_SK
;
1419 } else if (param
->value
& IW_AUTH_ALG_OPEN_SYSTEM
) {
1420 authen
= DOT11_AUTH_OS
;
1431 /* Set all the values */
1432 down_write(&priv
->mib_sem
);
1434 up_write(&priv
->mib_sem
);
1435 mgt_set_request(priv
, DOT11_OID_AUTHENABLE
, 0, &authen
);
1436 mgt_set_request(priv
, DOT11_OID_PRIVACYINVOKED
, 0, &privinvoked
);
1437 mgt_set_request(priv
, DOT11_OID_EXUNENCRYPTED
, 0, &exunencrypt
);
1438 mgt_set_request(priv
, DOT11_OID_DOT1XENABLE
, 0, &dot1x
);
1439 mgt_set_request(priv
, DOT11_OID_MLMEAUTOLEVEL
, 0, &mlmelevel
);
1445 static int prism54_get_auth(struct net_device
*ndev
,
1446 struct iw_request_info
*info
,
1447 union iwreq_data
*wrqu
, char *extra
)
1449 islpci_private
*priv
= netdev_priv(ndev
);
1450 struct iw_param
*param
= &wrqu
->param
;
1455 if (islpci_get_state(priv
) < PRV_STATE_INIT
)
1458 /* first get the flags */
1459 down_write(&priv
->mib_sem
);
1461 up_write(&priv
->mib_sem
);
1463 switch (param
->flags
& IW_AUTH_INDEX
) {
1464 case IW_AUTH_CIPHER_PAIRWISE
:
1465 case IW_AUTH_CIPHER_GROUP
:
1466 case IW_AUTH_KEY_MGMT
:
1468 * wpa_supplicant will control these internally
1473 case IW_AUTH_WPA_VERSION
:
1476 param
->value
= IW_AUTH_WPA_VERSION_WPA
;
1479 param
->value
= IW_AUTH_WPA_VERSION_WPA2
;
1483 param
->value
= IW_AUTH_WPA_VERSION_DISABLED
;
1488 case IW_AUTH_DROP_UNENCRYPTED
:
1489 ret
= mgt_get_request(priv
, DOT11_OID_EXUNENCRYPTED
, 0, NULL
, &r
);
1491 param
->value
= r
.u
> 0 ? 1 : 0;
1494 case IW_AUTH_80211_AUTH_ALG
:
1495 ret
= mgt_get_request(priv
, DOT11_OID_AUTHENABLE
, 0, NULL
, &r
);
1499 param
->value
= IW_AUTH_ALG_OPEN_SYSTEM
;
1501 case DOT11_AUTH_BOTH
:
1503 param
->value
= IW_AUTH_ALG_SHARED_KEY
;
1505 case DOT11_AUTH_NONE
:
1513 case IW_AUTH_WPA_ENABLED
:
1514 param
->value
= wpa
> 0 ? 1 : 0;
1517 case IW_AUTH_RX_UNENCRYPTED_EAPOL
:
1518 ret
= mgt_get_request(priv
, DOT11_OID_DOT1XENABLE
, 0, NULL
, &r
);
1520 param
->value
= r
.u
> 0 ? 1 : 0;
1523 case IW_AUTH_PRIVACY_INVOKED
:
1524 ret
= mgt_get_request(priv
, DOT11_OID_PRIVACYINVOKED
, 0, NULL
, &r
);
1526 param
->value
= r
.u
> 0 ? 1 : 0;
1535 static int prism54_set_encodeext(struct net_device
*ndev
,
1536 struct iw_request_info
*info
,
1537 union iwreq_data
*wrqu
,
1540 islpci_private
*priv
= netdev_priv(ndev
);
1541 struct iw_point
*encoding
= &wrqu
->encoding
;
1542 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*)extra
;
1543 int idx
, alg
= ext
->alg
, set_key
= 1;
1545 int authen
= DOT11_AUTH_OS
, invoke
= 0, exunencrypt
= 0;
1548 if (islpci_get_state(priv
) < PRV_STATE_INIT
)
1551 /* Determine and validate the key index */
1552 idx
= (encoding
->flags
& IW_ENCODE_INDEX
) - 1;
1554 if (idx
< 0 || idx
> 3)
1557 ret
= mgt_get_request(priv
, DOT11_OID_DEFKEYID
, 0, NULL
, &r
);
1563 if (encoding
->flags
& IW_ENCODE_DISABLED
)
1564 alg
= IW_ENCODE_ALG_NONE
;
1566 if (ext
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
) {
1567 /* Only set transmit key index here, actual
1568 * key is set below if needed.
1570 ret
= mgt_set_request(priv
, DOT11_OID_DEFKEYID
, 0, &idx
);
1571 set_key
= ext
->key_len
> 0 ? 1 : 0;
1575 struct obj_key key
= { DOT11_PRIV_WEP
, 0, "" };
1577 case IW_ENCODE_ALG_NONE
:
1579 case IW_ENCODE_ALG_WEP
:
1580 if (ext
->key_len
> KEY_SIZE_WEP104
) {
1584 if (ext
->key_len
> KEY_SIZE_WEP40
)
1585 key
.length
= KEY_SIZE_WEP104
;
1587 key
.length
= KEY_SIZE_WEP40
;
1589 case IW_ENCODE_ALG_TKIP
:
1590 if (ext
->key_len
> KEY_SIZE_TKIP
) {
1594 key
.type
= DOT11_PRIV_TKIP
;
1595 key
.length
= KEY_SIZE_TKIP
;
1602 memset(key
.key
, 0, sizeof(key
.key
));
1603 memcpy(key
.key
, ext
->key
, ext
->key_len
);
1604 ret
= mgt_set_request(priv
, DOT11_OID_DEFKEYX
, idx
,
1611 /* Read the flags */
1612 if (encoding
->flags
& IW_ENCODE_DISABLED
) {
1613 /* Encoding disabled,
1614 * authen = DOT11_AUTH_OS;
1616 * exunencrypt = 0; */
1618 if (encoding
->flags
& IW_ENCODE_OPEN
) {
1619 /* Encode but accept non-encoded packets. No auth */
1622 if (encoding
->flags
& IW_ENCODE_RESTRICTED
) {
1623 /* Refuse non-encoded packets. Auth */
1624 authen
= DOT11_AUTH_BOTH
;
1629 /* do the change if requested */
1630 if (encoding
->flags
& IW_ENCODE_MODE
) {
1631 ret
= mgt_set_request(priv
, DOT11_OID_AUTHENABLE
, 0,
1633 ret
= mgt_set_request(priv
, DOT11_OID_PRIVACYINVOKED
, 0,
1635 ret
= mgt_set_request(priv
, DOT11_OID_EXUNENCRYPTED
, 0,
1644 static int prism54_get_encodeext(struct net_device
*ndev
,
1645 struct iw_request_info
*info
,
1646 union iwreq_data
*wrqu
,
1649 islpci_private
*priv
= netdev_priv(ndev
);
1650 struct iw_point
*encoding
= &wrqu
->encoding
;
1651 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*)extra
;
1652 int idx
, max_key_len
;
1654 int authen
= DOT11_AUTH_OS
, invoke
= 0, exunencrypt
= 0, wpa
= 0;
1657 if (islpci_get_state(priv
) < PRV_STATE_INIT
)
1660 /* first get the flags */
1661 ret
= mgt_get_request(priv
, DOT11_OID_AUTHENABLE
, 0, NULL
, &r
);
1663 ret
= mgt_get_request(priv
, DOT11_OID_PRIVACYINVOKED
, 0, NULL
, &r
);
1665 ret
= mgt_get_request(priv
, DOT11_OID_EXUNENCRYPTED
, 0, NULL
, &r
);
1670 max_key_len
= encoding
->length
- sizeof(*ext
);
1671 if (max_key_len
< 0)
1674 idx
= (encoding
->flags
& IW_ENCODE_INDEX
) - 1;
1676 if (idx
< 0 || idx
> 3)
1679 ret
= mgt_get_request(priv
, DOT11_OID_DEFKEYID
, 0, NULL
, &r
);
1685 encoding
->flags
= idx
+ 1;
1686 memset(ext
, 0, sizeof(*ext
));
1689 case DOT11_AUTH_BOTH
:
1691 wrqu
->encoding
.flags
|= IW_ENCODE_RESTRICTED
;
1695 wrqu
->encoding
.flags
|= IW_ENCODE_OPEN
;
1699 down_write(&priv
->mib_sem
);
1701 up_write(&priv
->mib_sem
);
1703 if (authen
== DOT11_AUTH_OS
&& !exunencrypt
&& !invoke
&& !wpa
) {
1705 ext
->alg
= IW_ENCODE_ALG_NONE
;
1707 wrqu
->encoding
.flags
|= IW_ENCODE_DISABLED
;
1709 struct obj_key
*key
;
1711 ret
= mgt_get_request(priv
, DOT11_OID_DEFKEYX
, idx
, NULL
, &r
);
1715 if (max_key_len
< key
->length
) {
1719 memcpy(ext
->key
, key
->key
, key
->length
);
1720 ext
->key_len
= key
->length
;
1722 switch (key
->type
) {
1723 case DOT11_PRIV_TKIP
:
1724 ext
->alg
= IW_ENCODE_ALG_TKIP
;
1727 case DOT11_PRIV_WEP
:
1728 ext
->alg
= IW_ENCODE_ALG_WEP
;
1731 wrqu
->encoding
.flags
|= IW_ENCODE_ENABLED
;
1740 prism54_reset(struct net_device
*ndev
, struct iw_request_info
*info
,
1741 __u32
* uwrq
, char *extra
)
1743 islpci_reset(netdev_priv(ndev
), 0);
1749 prism54_get_oid(struct net_device
*ndev
, struct iw_request_info
*info
,
1750 struct iw_point
*dwrq
, char *extra
)
1754 enum oid_num_t n
= dwrq
->flags
;
1756 rvalue
= mgt_get_request(netdev_priv(ndev
), n
, 0, NULL
, &r
);
1757 dwrq
->length
= mgt_response_to_str(n
, &r
, extra
);
1758 if ((isl_oid
[n
].flags
& OID_FLAG_TYPE
) != OID_TYPE_U32
)
1764 prism54_set_u32(struct net_device
*ndev
, struct iw_request_info
*info
,
1765 __u32
* uwrq
, char *extra
)
1767 u32 oid
= uwrq
[0], u
= uwrq
[1];
1769 return mgt_set_request(netdev_priv(ndev
), oid
, 0, &u
);
1773 prism54_set_raw(struct net_device
*ndev
, struct iw_request_info
*info
,
1774 struct iw_point
*dwrq
, char *extra
)
1776 u32 oid
= dwrq
->flags
;
1778 return mgt_set_request(netdev_priv(ndev
), oid
, 0, extra
);
1782 prism54_acl_init(struct islpci_acl
*acl
)
1784 mutex_init(&acl
->lock
);
1785 INIT_LIST_HEAD(&acl
->mac_list
);
1787 acl
->policy
= MAC_POLICY_OPEN
;
1791 prism54_clear_mac(struct islpci_acl
*acl
)
1793 struct list_head
*ptr
, *next
;
1794 struct mac_entry
*entry
;
1796 mutex_lock(&acl
->lock
);
1798 if (acl
->size
== 0) {
1799 mutex_unlock(&acl
->lock
);
1803 for (ptr
= acl
->mac_list
.next
, next
= ptr
->next
;
1804 ptr
!= &acl
->mac_list
; ptr
= next
, next
= ptr
->next
) {
1805 entry
= list_entry(ptr
, struct mac_entry
, _list
);
1810 mutex_unlock(&acl
->lock
);
1814 prism54_acl_clean(struct islpci_acl
*acl
)
1816 prism54_clear_mac(acl
);
1820 prism54_add_mac(struct net_device
*ndev
, struct iw_request_info
*info
,
1821 struct sockaddr
*awrq
, char *extra
)
1823 islpci_private
*priv
= netdev_priv(ndev
);
1824 struct islpci_acl
*acl
= &priv
->acl
;
1825 struct mac_entry
*entry
;
1826 struct sockaddr
*addr
= (struct sockaddr
*) extra
;
1828 if (addr
->sa_family
!= ARPHRD_ETHER
)
1831 entry
= kmalloc(sizeof (struct mac_entry
), GFP_KERNEL
);
1835 memcpy(entry
->addr
, addr
->sa_data
, ETH_ALEN
);
1837 if (mutex_lock_interruptible(&acl
->lock
)) {
1839 return -ERESTARTSYS
;
1841 list_add_tail(&entry
->_list
, &acl
->mac_list
);
1843 mutex_unlock(&acl
->lock
);
1849 prism54_del_mac(struct net_device
*ndev
, struct iw_request_info
*info
,
1850 struct sockaddr
*awrq
, char *extra
)
1852 islpci_private
*priv
= netdev_priv(ndev
);
1853 struct islpci_acl
*acl
= &priv
->acl
;
1854 struct mac_entry
*entry
;
1855 struct sockaddr
*addr
= (struct sockaddr
*) extra
;
1857 if (addr
->sa_family
!= ARPHRD_ETHER
)
1860 if (mutex_lock_interruptible(&acl
->lock
))
1861 return -ERESTARTSYS
;
1862 list_for_each_entry(entry
, &acl
->mac_list
, _list
) {
1863 if (ether_addr_equal(entry
->addr
, addr
->sa_data
)) {
1864 list_del(&entry
->_list
);
1867 mutex_unlock(&acl
->lock
);
1871 mutex_unlock(&acl
->lock
);
1876 prism54_get_mac(struct net_device
*ndev
, struct iw_request_info
*info
,
1877 struct iw_point
*dwrq
, char *extra
)
1879 islpci_private
*priv
= netdev_priv(ndev
);
1880 struct islpci_acl
*acl
= &priv
->acl
;
1881 struct mac_entry
*entry
;
1882 struct sockaddr
*dst
= (struct sockaddr
*) extra
;
1886 if (mutex_lock_interruptible(&acl
->lock
))
1887 return -ERESTARTSYS
;
1889 list_for_each_entry(entry
, &acl
->mac_list
, _list
) {
1890 memcpy(dst
->sa_data
, entry
->addr
, ETH_ALEN
);
1891 dst
->sa_family
= ARPHRD_ETHER
;
1895 mutex_unlock(&acl
->lock
);
1899 /* Setting policy also clears the MAC acl, even if we don't change the default
1904 prism54_set_policy(struct net_device
*ndev
, struct iw_request_info
*info
,
1905 __u32
* uwrq
, char *extra
)
1907 islpci_private
*priv
= netdev_priv(ndev
);
1908 struct islpci_acl
*acl
= &priv
->acl
;
1911 prism54_clear_mac(acl
);
1913 if ((*uwrq
< MAC_POLICY_OPEN
) || (*uwrq
> MAC_POLICY_REJECT
))
1916 down_write(&priv
->mib_sem
);
1918 acl
->policy
= *uwrq
;
1920 /* the ACL code needs an intermediate mlmeautolevel */
1921 if ((priv
->iw_mode
== IW_MODE_MASTER
) &&
1922 (acl
->policy
!= MAC_POLICY_OPEN
))
1923 mlmeautolevel
= DOT11_MLME_INTERMEDIATE
;
1925 mlmeautolevel
= CARD_DEFAULT_MLME_MODE
;
1927 mlmeautolevel
= DOT11_MLME_EXTENDED
;
1928 mgt_set(priv
, DOT11_OID_MLMEAUTOLEVEL
, &mlmeautolevel
);
1929 /* restart the card with our new policy */
1930 if (mgt_commit(priv
)) {
1931 up_write(&priv
->mib_sem
);
1934 up_write(&priv
->mib_sem
);
1940 prism54_get_policy(struct net_device
*ndev
, struct iw_request_info
*info
,
1941 __u32
* uwrq
, char *extra
)
1943 islpci_private
*priv
= netdev_priv(ndev
);
1944 struct islpci_acl
*acl
= &priv
->acl
;
1946 *uwrq
= acl
->policy
;
1951 /* Return 1 only if client should be accepted. */
1954 prism54_mac_accept(struct islpci_acl
*acl
, char *mac
)
1956 struct mac_entry
*entry
;
1959 if (mutex_lock_interruptible(&acl
->lock
))
1960 return -ERESTARTSYS
;
1962 if (acl
->policy
== MAC_POLICY_OPEN
) {
1963 mutex_unlock(&acl
->lock
);
1967 list_for_each_entry(entry
, &acl
->mac_list
, _list
) {
1968 if (memcmp(entry
->addr
, mac
, ETH_ALEN
) == 0) {
1973 res
= (acl
->policy
== MAC_POLICY_ACCEPT
) ? !res
: res
;
1974 mutex_unlock(&acl
->lock
);
1980 prism54_kick_all(struct net_device
*ndev
, struct iw_request_info
*info
,
1981 struct iw_point
*dwrq
, char *extra
)
1983 struct obj_mlme
*mlme
;
1986 mlme
= kmalloc(sizeof (struct obj_mlme
), GFP_KERNEL
);
1990 /* Tell the card to kick every client */
1993 mgt_set_request(netdev_priv(ndev
), DOT11_OID_DISASSOCIATE
, 0, mlme
);
2000 prism54_kick_mac(struct net_device
*ndev
, struct iw_request_info
*info
,
2001 struct sockaddr
*awrq
, char *extra
)
2003 struct obj_mlme
*mlme
;
2004 struct sockaddr
*addr
= (struct sockaddr
*) extra
;
2007 if (addr
->sa_family
!= ARPHRD_ETHER
)
2010 mlme
= kmalloc(sizeof (struct obj_mlme
), GFP_KERNEL
);
2014 /* Tell the card to only kick the corresponding bastard */
2015 memcpy(mlme
->address
, addr
->sa_data
, ETH_ALEN
);
2018 mgt_set_request(netdev_priv(ndev
), DOT11_OID_DISASSOCIATE
, 0, mlme
);
2025 /* Translate a TRAP oid into a wireless event. Called in islpci_mgt_receive. */
2028 format_event(islpci_private
*priv
, char *dest
, const char *str
,
2029 const struct obj_mlme
*mlme
, u16
*length
, int error
)
2031 int n
= snprintf(dest
, IW_CUSTOM_MAX
,
2032 "%s %s %pM %s (%2.2X)",
2034 ((priv
->iw_mode
== IW_MODE_MASTER
) ? "from" : "to"),
2036 (error
? (mlme
->code
? " : REJECTED " : " : ACCEPTED ")
2038 WARN_ON(n
>= IW_CUSTOM_MAX
);
2043 send_formatted_event(islpci_private
*priv
, const char *str
,
2044 const struct obj_mlme
*mlme
, int error
)
2046 union iwreq_data wrqu
;
2049 memptr
= kmalloc(IW_CUSTOM_MAX
, GFP_KERNEL
);
2052 wrqu
.data
.pointer
= memptr
;
2053 wrqu
.data
.length
= 0;
2054 format_event(priv
, memptr
, str
, mlme
, &wrqu
.data
.length
,
2056 wireless_send_event(priv
->ndev
, IWEVCUSTOM
, &wrqu
, memptr
);
2061 send_simple_event(islpci_private
*priv
, const char *str
)
2063 union iwreq_data wrqu
;
2065 int n
= strlen(str
);
2067 memptr
= kmalloc(IW_CUSTOM_MAX
, GFP_KERNEL
);
2070 BUG_ON(n
>= IW_CUSTOM_MAX
);
2071 wrqu
.data
.pointer
= memptr
;
2072 wrqu
.data
.length
= n
;
2073 strcpy(memptr
, str
);
2074 wireless_send_event(priv
->ndev
, IWEVCUSTOM
, &wrqu
, memptr
);
2079 link_changed(struct net_device
*ndev
, u32 bitrate
)
2081 islpci_private
*priv
= netdev_priv(ndev
);
2084 netif_carrier_on(ndev
);
2085 if (priv
->iw_mode
== IW_MODE_INFRA
) {
2086 union iwreq_data uwrq
;
2087 prism54_get_wap(ndev
, NULL
, (struct sockaddr
*) &uwrq
,
2089 wireless_send_event(ndev
, SIOCGIWAP
, &uwrq
, NULL
);
2091 send_simple_event(netdev_priv(ndev
),
2092 "Link established");
2094 netif_carrier_off(ndev
);
2095 send_simple_event(netdev_priv(ndev
), "Link lost");
2099 /* Beacon/ProbeResp payload header */
2100 struct ieee80211_beacon_phdr
{
2106 #define WLAN_EID_GENERIC 0xdd
2107 static u8 wpa_oid
[4] = { 0x00, 0x50, 0xf2, 1 };
2110 prism54_wpa_bss_ie_add(islpci_private
*priv
, u8
*bssid
,
2111 u8
*wpa_ie
, size_t wpa_ie_len
)
2113 struct list_head
*ptr
;
2114 struct islpci_bss_wpa_ie
*bss
= NULL
;
2116 if (wpa_ie_len
> MAX_WPA_IE_LEN
)
2117 wpa_ie_len
= MAX_WPA_IE_LEN
;
2119 mutex_lock(&priv
->wpa_lock
);
2121 /* try to use existing entry */
2122 list_for_each(ptr
, &priv
->bss_wpa_list
) {
2123 bss
= list_entry(ptr
, struct islpci_bss_wpa_ie
, list
);
2124 if (memcmp(bss
->bssid
, bssid
, ETH_ALEN
) == 0) {
2125 list_move(&bss
->list
, &priv
->bss_wpa_list
);
2132 /* add a new BSS entry; if max number of entries is already
2133 * reached, replace the least recently updated */
2134 if (priv
->num_bss_wpa
>= MAX_BSS_WPA_IE_COUNT
) {
2135 bss
= list_entry(priv
->bss_wpa_list
.prev
,
2136 struct islpci_bss_wpa_ie
, list
);
2137 list_del(&bss
->list
);
2139 bss
= kzalloc(sizeof (*bss
), GFP_ATOMIC
);
2141 priv
->num_bss_wpa
++;
2144 memcpy(bss
->bssid
, bssid
, ETH_ALEN
);
2145 list_add(&bss
->list
, &priv
->bss_wpa_list
);
2150 memcpy(bss
->wpa_ie
, wpa_ie
, wpa_ie_len
);
2151 bss
->wpa_ie_len
= wpa_ie_len
;
2152 bss
->last_update
= jiffies
;
2154 printk(KERN_DEBUG
"Failed to add BSS WPA entry for "
2158 /* expire old entries from WPA list */
2159 while (priv
->num_bss_wpa
> 0) {
2160 bss
= list_entry(priv
->bss_wpa_list
.prev
,
2161 struct islpci_bss_wpa_ie
, list
);
2162 if (!time_after(jiffies
, bss
->last_update
+ 60 * HZ
))
2165 list_del(&bss
->list
);
2166 priv
->num_bss_wpa
--;
2170 mutex_unlock(&priv
->wpa_lock
);
2174 prism54_wpa_bss_ie_get(islpci_private
*priv
, u8
*bssid
, u8
*wpa_ie
)
2176 struct list_head
*ptr
;
2177 struct islpci_bss_wpa_ie
*bss
= NULL
;
2180 mutex_lock(&priv
->wpa_lock
);
2182 list_for_each(ptr
, &priv
->bss_wpa_list
) {
2183 bss
= list_entry(ptr
, struct islpci_bss_wpa_ie
, list
);
2184 if (memcmp(bss
->bssid
, bssid
, ETH_ALEN
) == 0)
2189 len
= bss
->wpa_ie_len
;
2190 memcpy(wpa_ie
, bss
->wpa_ie
, len
);
2192 mutex_unlock(&priv
->wpa_lock
);
2198 prism54_wpa_bss_ie_init(islpci_private
*priv
)
2200 INIT_LIST_HEAD(&priv
->bss_wpa_list
);
2201 mutex_init(&priv
->wpa_lock
);
2205 prism54_wpa_bss_ie_clean(islpci_private
*priv
)
2207 struct islpci_bss_wpa_ie
*bss
, *n
;
2209 list_for_each_entry_safe(bss
, n
, &priv
->bss_wpa_list
, list
) {
2215 prism54_process_bss_data(islpci_private
*priv
, u32 oid
, u8
*addr
,
2216 u8
*payload
, size_t len
)
2218 struct ieee80211_beacon_phdr
*hdr
;
2224 hdr
= (struct ieee80211_beacon_phdr
*) payload
;
2225 pos
= (u8
*) (hdr
+ 1);
2226 end
= payload
+ len
;
2228 if (pos
+ 2 + pos
[1] > end
) {
2229 printk(KERN_DEBUG
"Parsing Beacon/ProbeResp failed "
2233 if (pos
[0] == WLAN_EID_GENERIC
&& pos
[1] >= 4 &&
2234 memcmp(pos
+ 2, wpa_oid
, 4) == 0) {
2235 prism54_wpa_bss_ie_add(priv
, addr
, pos
, pos
[1] + 2);
2243 handle_request(islpci_private
*priv
, struct obj_mlme
*mlme
, enum oid_num_t oid
)
2245 if (((mlme
->state
== DOT11_STATE_AUTHING
) ||
2246 (mlme
->state
== DOT11_STATE_ASSOCING
))
2247 && mgt_mlme_answer(priv
)) {
2248 /* Someone is requesting auth and we must respond. Just send back
2249 * the trap with error code set accordingly.
2251 mlme
->code
= prism54_mac_accept(&priv
->acl
,
2252 mlme
->address
) ? 0 : 1;
2253 mgt_set_request(priv
, oid
, 0, mlme
);
2258 prism54_process_trap_helper(islpci_private
*priv
, enum oid_num_t oid
,
2261 struct obj_mlme
*mlme
= (struct obj_mlme
*) data
;
2262 struct obj_mlmeex
*mlmeex
= (struct obj_mlmeex
*) data
;
2263 struct obj_mlmeex
*confirm
;
2264 u8 wpa_ie
[MAX_WPA_IE_LEN
];
2266 size_t len
= 0; /* u16, better? */
2267 u8
*payload
= NULL
, *pos
= NULL
;
2270 /* I think all trapable objects are listed here.
2271 * Some oids have a EX version. The difference is that they are emitted
2272 * in DOT11_MLME_EXTENDED mode (set with DOT11_OID_MLMEAUTOLEVEL)
2274 * The few events already defined by the wireless tools are not really
2275 * suited. We use the more flexible custom event facility.
2278 if (oid
>= DOT11_OID_BEACON
) {
2280 payload
= pos
= mlmeex
->data
;
2283 /* I fear prism54_process_bss_data won't work with big endian data */
2284 if ((oid
== DOT11_OID_BEACON
) || (oid
== DOT11_OID_PROBE
))
2285 prism54_process_bss_data(priv
, oid
, mlmeex
->address
,
2288 mgt_le_to_cpu(isl_oid
[oid
].flags
& OID_FLAG_TYPE
, (void *) mlme
);
2292 case GEN_OID_LINKSTATE
:
2293 link_changed(priv
->ndev
, (u32
) *data
);
2296 case DOT11_OID_MICFAILURE
:
2297 send_simple_event(priv
, "Mic failure");
2300 case DOT11_OID_DEAUTHENTICATE
:
2301 send_formatted_event(priv
, "DeAuthenticate request", mlme
, 0);
2304 case DOT11_OID_AUTHENTICATE
:
2305 handle_request(priv
, mlme
, oid
);
2306 send_formatted_event(priv
, "Authenticate request", mlme
, 1);
2309 case DOT11_OID_DISASSOCIATE
:
2310 send_formatted_event(priv
, "Disassociate request", mlme
, 0);
2313 case DOT11_OID_ASSOCIATE
:
2314 handle_request(priv
, mlme
, oid
);
2315 send_formatted_event(priv
, "Associate request", mlme
, 1);
2318 case DOT11_OID_REASSOCIATE
:
2319 handle_request(priv
, mlme
, oid
);
2320 send_formatted_event(priv
, "ReAssociate request", mlme
, 1);
2323 case DOT11_OID_BEACON
:
2324 send_formatted_event(priv
,
2325 "Received a beacon from an unknown AP",
2329 case DOT11_OID_PROBE
:
2330 /* we received a probe from a client. */
2331 send_formatted_event(priv
, "Received a probe from client", mlme
,
2335 /* Note : "mlme" is actually a "struct obj_mlmeex *" here, but this
2336 * is backward compatible layout-wise with "struct obj_mlme".
2339 case DOT11_OID_DEAUTHENTICATEEX
:
2340 send_formatted_event(priv
, "DeAuthenticate request", mlme
, 0);
2343 case DOT11_OID_AUTHENTICATEEX
:
2344 handle_request(priv
, mlme
, oid
);
2345 send_formatted_event(priv
, "Authenticate request (ex)", mlme
, 1);
2347 if (priv
->iw_mode
!= IW_MODE_MASTER
2348 && mlmeex
->state
!= DOT11_STATE_AUTHING
)
2351 confirm
= kmalloc(sizeof(struct obj_mlmeex
) + 6, GFP_ATOMIC
);
2356 memcpy(&confirm
->address
, mlmeex
->address
, ETH_ALEN
);
2357 printk(KERN_DEBUG
"Authenticate from: address:\t%pM\n",
2359 confirm
->id
= -1; /* or mlmeex->id ? */
2360 confirm
->state
= 0; /* not used */
2363 confirm
->data
[0] = 0x00;
2364 confirm
->data
[1] = 0x00;
2365 confirm
->data
[2] = 0x02;
2366 confirm
->data
[3] = 0x00;
2367 confirm
->data
[4] = 0x00;
2368 confirm
->data
[5] = 0x00;
2370 ret
= mgt_set_varlen(priv
, DOT11_OID_ASSOCIATEEX
, confirm
, 6);
2377 case DOT11_OID_DISASSOCIATEEX
:
2378 send_formatted_event(priv
, "Disassociate request (ex)", mlme
, 0);
2381 case DOT11_OID_ASSOCIATEEX
:
2382 handle_request(priv
, mlme
, oid
);
2383 send_formatted_event(priv
, "Associate request (ex)", mlme
, 1);
2385 if (priv
->iw_mode
!= IW_MODE_MASTER
2386 && mlmeex
->state
!= DOT11_STATE_ASSOCING
)
2389 confirm
= kmalloc(sizeof(struct obj_mlmeex
), GFP_ATOMIC
);
2394 memcpy(&confirm
->address
, mlmeex
->address
, ETH_ALEN
);
2396 confirm
->id
= ((struct obj_mlmeex
*)mlme
)->id
;
2397 confirm
->state
= 0; /* not used */
2400 wpa_ie_len
= prism54_wpa_bss_ie_get(priv
, mlmeex
->address
, wpa_ie
);
2403 printk(KERN_DEBUG
"No WPA IE found from address:\t%pM\n",
2409 confirm
->size
= wpa_ie_len
;
2410 memcpy(&confirm
->data
, wpa_ie
, wpa_ie_len
);
2412 mgt_set_varlen(priv
, oid
, confirm
, wpa_ie_len
);
2418 case DOT11_OID_REASSOCIATEEX
:
2419 handle_request(priv
, mlme
, oid
);
2420 send_formatted_event(priv
, "Reassociate request (ex)", mlme
, 1);
2422 if (priv
->iw_mode
!= IW_MODE_MASTER
2423 && mlmeex
->state
!= DOT11_STATE_ASSOCING
)
2426 confirm
= kmalloc(sizeof(struct obj_mlmeex
), GFP_ATOMIC
);
2431 memcpy(&confirm
->address
, mlmeex
->address
, ETH_ALEN
);
2433 confirm
->id
= mlmeex
->id
;
2434 confirm
->state
= 0; /* not used */
2437 wpa_ie_len
= prism54_wpa_bss_ie_get(priv
, mlmeex
->address
, wpa_ie
);
2440 printk(KERN_DEBUG
"No WPA IE found from address:\t%pM\n",
2446 confirm
->size
= wpa_ie_len
;
2447 memcpy(&confirm
->data
, wpa_ie
, wpa_ie_len
);
2449 mgt_set_varlen(priv
, oid
, confirm
, wpa_ie_len
);
2463 * Process a device trap. This is called via schedule_work(), outside of
2464 * interrupt context, no locks held.
2467 prism54_process_trap(struct work_struct
*work
)
2469 struct islpci_mgmtframe
*frame
=
2470 container_of(work
, struct islpci_mgmtframe
, ws
);
2471 struct net_device
*ndev
= frame
->ndev
;
2472 enum oid_num_t n
= mgt_oidtonum(frame
->header
->oid
);
2474 if (n
!= OID_NUM_LAST
)
2475 prism54_process_trap_helper(netdev_priv(ndev
), n
, frame
->data
);
2476 islpci_mgt_release(frame
);
2480 prism54_set_mac_address(struct net_device
*ndev
, void *addr
)
2482 islpci_private
*priv
= netdev_priv(ndev
);
2485 if (ndev
->addr_len
!= 6)
2487 ret
= mgt_set_request(priv
, GEN_OID_MACADDRESS
, 0,
2488 &((struct sockaddr
*) addr
)->sa_data
);
2490 memcpy(priv
->ndev
->dev_addr
,
2491 &((struct sockaddr
*) addr
)->sa_data
, ETH_ALEN
);
2496 #define PRISM54_SET_WPA SIOCIWFIRSTPRIV+12
2499 prism54_set_wpa(struct net_device
*ndev
, struct iw_request_info
*info
,
2500 __u32
* uwrq
, char *extra
)
2502 islpci_private
*priv
= netdev_priv(ndev
);
2503 u32 mlme
, authen
, dot1x
, filter
, wep
;
2505 if (islpci_get_state(priv
) < PRV_STATE_INIT
)
2508 wep
= 1; /* For privacy invoked */
2509 filter
= 1; /* Filter out all unencrypted frames */
2510 dot1x
= 0x01; /* To enable eap filter */
2511 mlme
= DOT11_MLME_EXTENDED
;
2512 authen
= DOT11_AUTH_OS
; /* Only WEP uses _SK and _BOTH */
2514 down_write(&priv
->mib_sem
);
2517 switch (priv
->wpa
) {
2519 case 0: /* Clears/disables WPA and friends */
2521 filter
= 0; /* Do not filter un-encrypted data */
2523 mlme
= DOT11_MLME_AUTO
;
2524 printk("%s: Disabling WPA\n", ndev
->name
);
2528 printk("%s: Enabling WPA\n", ndev
->name
);
2531 up_write(&priv
->mib_sem
);
2533 mgt_set_request(priv
, DOT11_OID_AUTHENABLE
, 0, &authen
);
2534 mgt_set_request(priv
, DOT11_OID_PRIVACYINVOKED
, 0, &wep
);
2535 mgt_set_request(priv
, DOT11_OID_EXUNENCRYPTED
, 0, &filter
);
2536 mgt_set_request(priv
, DOT11_OID_DOT1XENABLE
, 0, &dot1x
);
2537 mgt_set_request(priv
, DOT11_OID_MLMEAUTOLEVEL
, 0, &mlme
);
2543 prism54_get_wpa(struct net_device
*ndev
, struct iw_request_info
*info
,
2544 __u32
* uwrq
, char *extra
)
2546 islpci_private
*priv
= netdev_priv(ndev
);
2552 prism54_set_prismhdr(struct net_device
*ndev
, struct iw_request_info
*info
,
2553 __u32
* uwrq
, char *extra
)
2555 islpci_private
*priv
= netdev_priv(ndev
);
2556 priv
->monitor_type
=
2557 (*uwrq
? ARPHRD_IEEE80211_PRISM
: ARPHRD_IEEE80211
);
2558 if (priv
->iw_mode
== IW_MODE_MONITOR
)
2559 priv
->ndev
->type
= priv
->monitor_type
;
2565 prism54_get_prismhdr(struct net_device
*ndev
, struct iw_request_info
*info
,
2566 __u32
* uwrq
, char *extra
)
2568 islpci_private
*priv
= netdev_priv(ndev
);
2569 *uwrq
= (priv
->monitor_type
== ARPHRD_IEEE80211_PRISM
);
2574 prism54_debug_oid(struct net_device
*ndev
, struct iw_request_info
*info
,
2575 __u32
* uwrq
, char *extra
)
2577 islpci_private
*priv
= netdev_priv(ndev
);
2579 priv
->priv_oid
= *uwrq
;
2580 printk("%s: oid 0x%08X\n", ndev
->name
, *uwrq
);
2586 prism54_debug_get_oid(struct net_device
*ndev
, struct iw_request_info
*info
,
2587 struct iw_point
*data
, char *extra
)
2589 islpci_private
*priv
= netdev_priv(ndev
);
2590 struct islpci_mgmtframe
*response
;
2593 printk("%s: get_oid 0x%08X\n", ndev
->name
, priv
->priv_oid
);
2596 if (islpci_get_state(priv
) >= PRV_STATE_INIT
) {
2598 islpci_mgt_transaction(priv
->ndev
, PIMFOR_OP_GET
,
2599 priv
->priv_oid
, extra
, 256,
2601 printk("%s: ret: %i\n", ndev
->name
, ret
);
2602 if (ret
|| !response
2603 || response
->header
->operation
== PIMFOR_OP_ERROR
) {
2605 islpci_mgt_release(response
);
2607 printk("%s: EIO\n", ndev
->name
);
2611 data
->length
= response
->header
->length
;
2612 memcpy(extra
, response
->data
, data
->length
);
2613 islpci_mgt_release(response
);
2614 printk("%s: len: %i\n", ndev
->name
, data
->length
);
2622 prism54_debug_set_oid(struct net_device
*ndev
, struct iw_request_info
*info
,
2623 struct iw_point
*data
, char *extra
)
2625 islpci_private
*priv
= netdev_priv(ndev
);
2626 struct islpci_mgmtframe
*response
;
2627 int ret
= 0, response_op
= PIMFOR_OP_ERROR
;
2629 printk("%s: set_oid 0x%08X\tlen: %d\n", ndev
->name
, priv
->priv_oid
,
2632 if (islpci_get_state(priv
) >= PRV_STATE_INIT
) {
2634 islpci_mgt_transaction(priv
->ndev
, PIMFOR_OP_SET
,
2635 priv
->priv_oid
, extra
, data
->length
,
2637 printk("%s: ret: %i\n", ndev
->name
, ret
);
2638 if (ret
|| !response
2639 || response
->header
->operation
== PIMFOR_OP_ERROR
) {
2641 islpci_mgt_release(response
);
2643 printk("%s: EIO\n", ndev
->name
);
2647 response_op
= response
->header
->operation
;
2648 printk("%s: response_op: %i\n", ndev
->name
,
2650 islpci_mgt_release(response
);
2654 return (ret
? ret
: -EINPROGRESS
);
2658 prism54_set_spy(struct net_device
*ndev
,
2659 struct iw_request_info
*info
,
2660 union iwreq_data
*uwrq
, char *extra
)
2662 islpci_private
*priv
= netdev_priv(ndev
);
2664 enum oid_num_t oid
= OID_INL_CONFIG
;
2666 down_write(&priv
->mib_sem
);
2667 mgt_get(priv
, OID_INL_CONFIG
, &u
);
2669 if ((uwrq
->data
.length
== 0) && (priv
->spy_data
.spy_number
> 0))
2671 u
&= ~INL_CONFIG_RXANNEX
;
2672 else if ((uwrq
->data
.length
> 0) && (priv
->spy_data
.spy_number
== 0))
2674 u
|= INL_CONFIG_RXANNEX
;
2676 mgt_set(priv
, OID_INL_CONFIG
, &u
);
2677 mgt_commit_list(priv
, &oid
, 1);
2678 up_write(&priv
->mib_sem
);
2680 return iw_handler_set_spy(ndev
, info
, uwrq
, extra
);
2683 static const iw_handler prism54_handler
[] = {
2684 (iw_handler
) prism54_commit
, /* SIOCSIWCOMMIT */
2685 (iw_handler
) prism54_get_name
, /* SIOCGIWNAME */
2686 (iw_handler
) NULL
, /* SIOCSIWNWID */
2687 (iw_handler
) NULL
, /* SIOCGIWNWID */
2688 (iw_handler
) prism54_set_freq
, /* SIOCSIWFREQ */
2689 (iw_handler
) prism54_get_freq
, /* SIOCGIWFREQ */
2690 (iw_handler
) prism54_set_mode
, /* SIOCSIWMODE */
2691 (iw_handler
) prism54_get_mode
, /* SIOCGIWMODE */
2692 (iw_handler
) prism54_set_sens
, /* SIOCSIWSENS */
2693 (iw_handler
) prism54_get_sens
, /* SIOCGIWSENS */
2694 (iw_handler
) NULL
, /* SIOCSIWRANGE */
2695 (iw_handler
) prism54_get_range
, /* SIOCGIWRANGE */
2696 (iw_handler
) NULL
, /* SIOCSIWPRIV */
2697 (iw_handler
) NULL
, /* SIOCGIWPRIV */
2698 (iw_handler
) NULL
, /* SIOCSIWSTATS */
2699 (iw_handler
) NULL
, /* SIOCGIWSTATS */
2700 prism54_set_spy
, /* SIOCSIWSPY */
2701 iw_handler_get_spy
, /* SIOCGIWSPY */
2702 iw_handler_set_thrspy
, /* SIOCSIWTHRSPY */
2703 iw_handler_get_thrspy
, /* SIOCGIWTHRSPY */
2704 (iw_handler
) prism54_set_wap
, /* SIOCSIWAP */
2705 (iw_handler
) prism54_get_wap
, /* SIOCGIWAP */
2706 (iw_handler
) NULL
, /* -- hole -- */
2707 (iw_handler
) NULL
, /* SIOCGIWAPLIST deprecated */
2708 (iw_handler
) prism54_set_scan
, /* SIOCSIWSCAN */
2709 (iw_handler
) prism54_get_scan
, /* SIOCGIWSCAN */
2710 (iw_handler
) prism54_set_essid
, /* SIOCSIWESSID */
2711 (iw_handler
) prism54_get_essid
, /* SIOCGIWESSID */
2712 (iw_handler
) prism54_set_nick
, /* SIOCSIWNICKN */
2713 (iw_handler
) prism54_get_nick
, /* SIOCGIWNICKN */
2714 (iw_handler
) NULL
, /* -- hole -- */
2715 (iw_handler
) NULL
, /* -- hole -- */
2716 (iw_handler
) prism54_set_rate
, /* SIOCSIWRATE */
2717 (iw_handler
) prism54_get_rate
, /* SIOCGIWRATE */
2718 (iw_handler
) prism54_set_rts
, /* SIOCSIWRTS */
2719 (iw_handler
) prism54_get_rts
, /* SIOCGIWRTS */
2720 (iw_handler
) prism54_set_frag
, /* SIOCSIWFRAG */
2721 (iw_handler
) prism54_get_frag
, /* SIOCGIWFRAG */
2722 (iw_handler
) prism54_set_txpower
, /* SIOCSIWTXPOW */
2723 (iw_handler
) prism54_get_txpower
, /* SIOCGIWTXPOW */
2724 (iw_handler
) prism54_set_retry
, /* SIOCSIWRETRY */
2725 (iw_handler
) prism54_get_retry
, /* SIOCGIWRETRY */
2726 (iw_handler
) prism54_set_encode
, /* SIOCSIWENCODE */
2727 (iw_handler
) prism54_get_encode
, /* SIOCGIWENCODE */
2728 (iw_handler
) NULL
, /* SIOCSIWPOWER */
2729 (iw_handler
) NULL
, /* SIOCGIWPOWER */
2730 NULL
, /* -- hole -- */
2731 NULL
, /* -- hole -- */
2732 (iw_handler
) prism54_set_genie
, /* SIOCSIWGENIE */
2733 (iw_handler
) prism54_get_genie
, /* SIOCGIWGENIE */
2734 (iw_handler
) prism54_set_auth
, /* SIOCSIWAUTH */
2735 (iw_handler
) prism54_get_auth
, /* SIOCGIWAUTH */
2736 (iw_handler
) prism54_set_encodeext
, /* SIOCSIWENCODEEXT */
2737 (iw_handler
) prism54_get_encodeext
, /* SIOCGIWENCODEEXT */
2738 NULL
, /* SIOCSIWPMKSA */
2741 /* The low order bit identify a SET (0) or a GET (1) ioctl. */
2743 #define PRISM54_RESET SIOCIWFIRSTPRIV
2744 #define PRISM54_GET_POLICY SIOCIWFIRSTPRIV+1
2745 #define PRISM54_SET_POLICY SIOCIWFIRSTPRIV+2
2746 #define PRISM54_GET_MAC SIOCIWFIRSTPRIV+3
2747 #define PRISM54_ADD_MAC SIOCIWFIRSTPRIV+4
2749 #define PRISM54_DEL_MAC SIOCIWFIRSTPRIV+6
2751 #define PRISM54_KICK_MAC SIOCIWFIRSTPRIV+8
2753 #define PRISM54_KICK_ALL SIOCIWFIRSTPRIV+10
2755 #define PRISM54_GET_WPA SIOCIWFIRSTPRIV+11
2756 #define PRISM54_SET_WPA SIOCIWFIRSTPRIV+12
2758 #define PRISM54_DBG_OID SIOCIWFIRSTPRIV+14
2759 #define PRISM54_DBG_GET_OID SIOCIWFIRSTPRIV+15
2760 #define PRISM54_DBG_SET_OID SIOCIWFIRSTPRIV+16
2762 #define PRISM54_GET_OID SIOCIWFIRSTPRIV+17
2763 #define PRISM54_SET_OID_U32 SIOCIWFIRSTPRIV+18
2764 #define PRISM54_SET_OID_STR SIOCIWFIRSTPRIV+20
2765 #define PRISM54_SET_OID_ADDR SIOCIWFIRSTPRIV+22
2767 #define PRISM54_GET_PRISMHDR SIOCIWFIRSTPRIV+23
2768 #define PRISM54_SET_PRISMHDR SIOCIWFIRSTPRIV+24
2770 #define IWPRIV_SET_U32(n,x) { n, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x }
2771 #define IWPRIV_SET_SSID(n,x) { n, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x }
2772 #define IWPRIV_SET_ADDR(n,x) { n, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x }
2773 #define IWPRIV_GET(n,x) { n, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, "g_"x }
2775 #define IWPRIV_U32(n,x) IWPRIV_SET_U32(n,x), IWPRIV_GET(n,x)
2776 #define IWPRIV_SSID(n,x) IWPRIV_SET_SSID(n,x), IWPRIV_GET(n,x)
2777 #define IWPRIV_ADDR(n,x) IWPRIV_SET_ADDR(n,x), IWPRIV_GET(n,x)
2779 /* Note : limited to 128 private ioctls (wireless tools 26) */
2781 static const struct iw_priv_args prism54_private_args
[] = {
2782 /*{ cmd, set_args, get_args, name } */
2783 {PRISM54_RESET
, 0, 0, "reset"},
2784 {PRISM54_GET_PRISMHDR
, 0, IW_PRIV_TYPE_INT
| IW_PRIV_SIZE_FIXED
| 1,
2786 {PRISM54_SET_PRISMHDR
, IW_PRIV_TYPE_INT
| IW_PRIV_SIZE_FIXED
| 1, 0,
2788 {PRISM54_GET_POLICY
, 0, IW_PRIV_TYPE_INT
| IW_PRIV_SIZE_FIXED
| 1,
2790 {PRISM54_SET_POLICY
, IW_PRIV_TYPE_INT
| IW_PRIV_SIZE_FIXED
| 1, 0,
2792 {PRISM54_GET_MAC
, 0, IW_PRIV_TYPE_ADDR
| 64, "getMac"},
2793 {PRISM54_ADD_MAC
, IW_PRIV_TYPE_ADDR
| IW_PRIV_SIZE_FIXED
| 1, 0,
2795 {PRISM54_DEL_MAC
, IW_PRIV_TYPE_ADDR
| IW_PRIV_SIZE_FIXED
| 1, 0,
2797 {PRISM54_KICK_MAC
, IW_PRIV_TYPE_ADDR
| IW_PRIV_SIZE_FIXED
| 1, 0,
2799 {PRISM54_KICK_ALL
, 0, 0, "kickAll"},
2800 {PRISM54_GET_WPA
, 0, IW_PRIV_TYPE_INT
| IW_PRIV_SIZE_FIXED
| 1,
2802 {PRISM54_SET_WPA
, IW_PRIV_TYPE_INT
| IW_PRIV_SIZE_FIXED
| 1, 0,
2804 {PRISM54_DBG_OID
, IW_PRIV_TYPE_INT
| IW_PRIV_SIZE_FIXED
| 1, 0,
2806 {PRISM54_DBG_GET_OID
, 0, IW_PRIV_TYPE_BYTE
| 256, "dbg_get_oid"},
2807 {PRISM54_DBG_SET_OID
, IW_PRIV_TYPE_BYTE
| 256, 0, "dbg_set_oid"},
2808 /* --- sub-ioctls handlers --- */
2810 0, IW_PRIV_TYPE_CHAR
| IW_PRIV_SIZE_FIXED
| PRIV_STR_SIZE
, ""},
2811 {PRISM54_SET_OID_U32
,
2812 IW_PRIV_TYPE_INT
| IW_PRIV_SIZE_FIXED
| 1, 0, ""},
2813 {PRISM54_SET_OID_STR
,
2814 IW_PRIV_TYPE_CHAR
| IW_PRIV_SIZE_FIXED
| 1, 0, ""},
2815 {PRISM54_SET_OID_ADDR
,
2816 IW_PRIV_TYPE_ADDR
| IW_PRIV_SIZE_FIXED
| 1, 0, ""},
2817 /* --- sub-ioctls definitions --- */
2818 IWPRIV_ADDR(GEN_OID_MACADDRESS
, "addr"),
2819 IWPRIV_GET(GEN_OID_LINKSTATE
, "linkstate"),
2820 IWPRIV_U32(DOT11_OID_BSSTYPE
, "bsstype"),
2821 IWPRIV_ADDR(DOT11_OID_BSSID
, "bssid"),
2822 IWPRIV_U32(DOT11_OID_STATE
, "state"),
2823 IWPRIV_U32(DOT11_OID_AID
, "aid"),
2825 IWPRIV_SSID(DOT11_OID_SSIDOVERRIDE
, "ssidoverride"),
2827 IWPRIV_U32(DOT11_OID_MEDIUMLIMIT
, "medlimit"),
2828 IWPRIV_U32(DOT11_OID_BEACONPERIOD
, "beacon"),
2829 IWPRIV_U32(DOT11_OID_DTIMPERIOD
, "dtimperiod"),
2831 IWPRIV_U32(DOT11_OID_AUTHENABLE
, "authenable"),
2832 IWPRIV_U32(DOT11_OID_PRIVACYINVOKED
, "privinvok"),
2833 IWPRIV_U32(DOT11_OID_EXUNENCRYPTED
, "exunencrypt"),
2835 IWPRIV_U32(DOT11_OID_REKEYTHRESHOLD
, "rekeythresh"),
2837 IWPRIV_U32(DOT11_OID_MAXTXLIFETIME
, "maxtxlife"),
2838 IWPRIV_U32(DOT11_OID_MAXRXLIFETIME
, "maxrxlife"),
2839 IWPRIV_U32(DOT11_OID_ALOFT_FIXEDRATE
, "fixedrate"),
2840 IWPRIV_U32(DOT11_OID_MAXFRAMEBURST
, "frameburst"),
2841 IWPRIV_U32(DOT11_OID_PSM
, "psm"),
2843 IWPRIV_U32(DOT11_OID_BRIDGELOCAL
, "bridge"),
2844 IWPRIV_U32(DOT11_OID_CLIENTS
, "clients"),
2845 IWPRIV_U32(DOT11_OID_CLIENTSASSOCIATED
, "clientassoc"),
2846 IWPRIV_U32(DOT11_OID_DOT1XENABLE
, "dot1xenable"),
2847 IWPRIV_U32(DOT11_OID_ANTENNARX
, "rxant"),
2848 IWPRIV_U32(DOT11_OID_ANTENNATX
, "txant"),
2849 IWPRIV_U32(DOT11_OID_ANTENNADIVERSITY
, "antdivers"),
2850 IWPRIV_U32(DOT11_OID_EDTHRESHOLD
, "edthresh"),
2851 IWPRIV_U32(DOT11_OID_PREAMBLESETTINGS
, "preamble"),
2852 IWPRIV_GET(DOT11_OID_RATES
, "rates"),
2853 IWPRIV_U32(DOT11_OID_OUTPUTPOWER
, ".11outpower"),
2854 IWPRIV_GET(DOT11_OID_SUPPORTEDRATES
, "supprates"),
2855 IWPRIV_GET(DOT11_OID_SUPPORTEDFREQUENCIES
, "suppfreq"),
2857 IWPRIV_U32(DOT11_OID_NOISEFLOOR
, "noisefloor"),
2858 IWPRIV_GET(DOT11_OID_FREQUENCYACTIVITY
, "freqactivity"),
2859 IWPRIV_U32(DOT11_OID_NONERPPROTECTION
, "nonerpprotec"),
2860 IWPRIV_U32(DOT11_OID_PROFILES
, "profile"),
2861 IWPRIV_GET(DOT11_OID_EXTENDEDRATES
, "extrates"),
2862 IWPRIV_U32(DOT11_OID_MLMEAUTOLEVEL
, "mlmelevel"),
2864 IWPRIV_GET(DOT11_OID_BSSS
, "bsss"),
2865 IWPRIV_GET(DOT11_OID_BSSLIST
, "bsslist"),
2866 IWPRIV_U32(OID_INL_MODE
, "mode"),
2867 IWPRIV_U32(OID_INL_CONFIG
, "config"),
2868 IWPRIV_U32(OID_INL_DOT11D_CONFORMANCE
, ".11dconform"),
2869 IWPRIV_GET(OID_INL_PHYCAPABILITIES
, "phycapa"),
2870 IWPRIV_U32(OID_INL_OUTPUTPOWER
, "outpower"),
2873 static const iw_handler prism54_private_handler
[] = {
2874 (iw_handler
) prism54_reset
,
2875 (iw_handler
) prism54_get_policy
,
2876 (iw_handler
) prism54_set_policy
,
2877 (iw_handler
) prism54_get_mac
,
2878 (iw_handler
) prism54_add_mac
,
2880 (iw_handler
) prism54_del_mac
,
2882 (iw_handler
) prism54_kick_mac
,
2884 (iw_handler
) prism54_kick_all
,
2885 (iw_handler
) prism54_get_wpa
,
2886 (iw_handler
) prism54_set_wpa
,
2888 (iw_handler
) prism54_debug_oid
,
2889 (iw_handler
) prism54_debug_get_oid
,
2890 (iw_handler
) prism54_debug_set_oid
,
2891 (iw_handler
) prism54_get_oid
,
2892 (iw_handler
) prism54_set_u32
,
2894 (iw_handler
) prism54_set_raw
,
2896 (iw_handler
) prism54_set_raw
,
2897 (iw_handler
) prism54_get_prismhdr
,
2898 (iw_handler
) prism54_set_prismhdr
,
2901 const struct iw_handler_def prism54_handler_def
= {
2902 .num_standard
= ARRAY_SIZE(prism54_handler
),
2903 .num_private
= ARRAY_SIZE(prism54_private_handler
),
2904 .num_private_args
= ARRAY_SIZE(prism54_private_args
),
2905 .standard
= (iw_handler
*) prism54_handler
,
2906 .private = (iw_handler
*) prism54_private_handler
,
2907 .private_args
= (struct iw_priv_args
*) prism54_private_args
,
2908 .get_wireless_stats
= prism54_get_wireless_stats
,