2 * This file contains ioctl functions
4 #include <linux/ctype.h>
5 #include <linux/delay.h>
7 #include <linux/if_arp.h>
8 #include <linux/wireless.h>
9 #include <linux/bitops.h>
11 #include <net/ieee80211.h>
12 #include <net/iw_handler.h>
25 static inline void lbs_postpone_association_work(struct lbs_private
*priv
)
27 if (priv
->surpriseremoved
)
29 cancel_delayed_work(&priv
->assoc_work
);
30 queue_delayed_work(priv
->work_thread
, &priv
->assoc_work
, HZ
/ 2);
33 static inline void lbs_cancel_association_work(struct lbs_private
*priv
)
35 cancel_delayed_work(&priv
->assoc_work
);
36 kfree(priv
->pending_assoc_req
);
37 priv
->pending_assoc_req
= NULL
;
42 * @brief Find the channel frequency power info with specific channel
44 * @param priv A pointer to struct lbs_private structure
45 * @param band it can be BAND_A, BAND_G or BAND_B
46 * @param channel the channel for looking
47 * @return A pointer to struct chan_freq_power structure or NULL if not find.
49 struct chan_freq_power
*lbs_find_cfp_by_band_and_channel(
50 struct lbs_private
*priv
,
54 struct chan_freq_power
*cfp
= NULL
;
55 struct region_channel
*rc
;
58 for (j
= 0; !cfp
&& (j
< ARRAY_SIZE(priv
->region_channel
)); j
++) {
59 rc
= &priv
->region_channel
[j
];
62 rc
= &priv
->universal_channel
[j
];
63 if (!rc
->valid
|| !rc
->CFP
)
67 for (i
= 0; i
< rc
->nrcfp
; i
++) {
68 if (rc
->CFP
[i
].channel
== channel
) {
76 lbs_deb_wext("lbs_find_cfp_by_band_and_channel: can't find "
77 "cfp by band %d / channel %d\n", band
, channel
);
83 * @brief Find the channel frequency power info with specific frequency
85 * @param priv A pointer to struct lbs_private structure
86 * @param band it can be BAND_A, BAND_G or BAND_B
87 * @param freq the frequency for looking
88 * @return A pointer to struct chan_freq_power structure or NULL if not find.
90 static struct chan_freq_power
*find_cfp_by_band_and_freq(
91 struct lbs_private
*priv
,
95 struct chan_freq_power
*cfp
= NULL
;
96 struct region_channel
*rc
;
99 for (j
= 0; !cfp
&& (j
< ARRAY_SIZE(priv
->region_channel
)); j
++) {
100 rc
= &priv
->region_channel
[j
];
103 rc
= &priv
->universal_channel
[j
];
104 if (!rc
->valid
|| !rc
->CFP
)
106 if (rc
->band
!= band
)
108 for (i
= 0; i
< rc
->nrcfp
; i
++) {
109 if (rc
->CFP
[i
].freq
== freq
) {
117 lbs_deb_wext("find_cfp_by_band_and_freql: can't find cfp by "
118 "band %d / freq %d\n", band
, freq
);
124 * @brief Copy active data rates based on adapter mode and status
126 * @param priv A pointer to struct lbs_private structure
127 * @param rate The buf to return the active rates
129 static void copy_active_data_rates(struct lbs_private
*priv
, u8
*rates
)
131 lbs_deb_enter(LBS_DEB_WEXT
);
133 if ((priv
->connect_status
!= LBS_CONNECTED
) &&
134 (priv
->mesh_connect_status
!= LBS_CONNECTED
))
135 memcpy(rates
, lbs_bg_rates
, MAX_RATES
);
137 memcpy(rates
, priv
->curbssparams
.rates
, MAX_RATES
);
139 lbs_deb_leave(LBS_DEB_WEXT
);
142 static int lbs_get_name(struct net_device
*dev
, struct iw_request_info
*info
,
143 char *cwrq
, char *extra
)
146 lbs_deb_enter(LBS_DEB_WEXT
);
148 /* We could add support for 802.11n here as needed. Jean II */
149 snprintf(cwrq
, IFNAMSIZ
, "IEEE 802.11b/g");
151 lbs_deb_leave(LBS_DEB_WEXT
);
155 static int lbs_get_freq(struct net_device
*dev
, struct iw_request_info
*info
,
156 struct iw_freq
*fwrq
, char *extra
)
158 struct lbs_private
*priv
= dev
->priv
;
159 struct chan_freq_power
*cfp
;
161 lbs_deb_enter(LBS_DEB_WEXT
);
163 cfp
= lbs_find_cfp_by_band_and_channel(priv
, 0,
164 priv
->curbssparams
.channel
);
167 if (priv
->curbssparams
.channel
)
168 lbs_deb_wext("invalid channel %d\n",
169 priv
->curbssparams
.channel
);
173 fwrq
->m
= (long)cfp
->freq
* 100000;
176 lbs_deb_wext("freq %u\n", fwrq
->m
);
177 lbs_deb_leave(LBS_DEB_WEXT
);
181 static int lbs_get_wap(struct net_device
*dev
, struct iw_request_info
*info
,
182 struct sockaddr
*awrq
, char *extra
)
184 struct lbs_private
*priv
= dev
->priv
;
186 lbs_deb_enter(LBS_DEB_WEXT
);
188 if (priv
->connect_status
== LBS_CONNECTED
) {
189 memcpy(awrq
->sa_data
, priv
->curbssparams
.bssid
, ETH_ALEN
);
191 memset(awrq
->sa_data
, 0, ETH_ALEN
);
193 awrq
->sa_family
= ARPHRD_ETHER
;
195 lbs_deb_leave(LBS_DEB_WEXT
);
199 static int lbs_set_nick(struct net_device
*dev
, struct iw_request_info
*info
,
200 struct iw_point
*dwrq
, char *extra
)
202 struct lbs_private
*priv
= dev
->priv
;
204 lbs_deb_enter(LBS_DEB_WEXT
);
207 * Check the size of the string
210 if (dwrq
->length
> 16) {
214 mutex_lock(&priv
->lock
);
215 memset(priv
->nodename
, 0, sizeof(priv
->nodename
));
216 memcpy(priv
->nodename
, extra
, dwrq
->length
);
217 mutex_unlock(&priv
->lock
);
219 lbs_deb_leave(LBS_DEB_WEXT
);
223 static int lbs_get_nick(struct net_device
*dev
, struct iw_request_info
*info
,
224 struct iw_point
*dwrq
, char *extra
)
226 struct lbs_private
*priv
= dev
->priv
;
228 lbs_deb_enter(LBS_DEB_WEXT
);
230 dwrq
->length
= strlen(priv
->nodename
);
231 memcpy(extra
, priv
->nodename
, dwrq
->length
);
232 extra
[dwrq
->length
] = '\0';
234 dwrq
->flags
= 1; /* active */
236 lbs_deb_leave(LBS_DEB_WEXT
);
240 static int mesh_get_nick(struct net_device
*dev
, struct iw_request_info
*info
,
241 struct iw_point
*dwrq
, char *extra
)
243 struct lbs_private
*priv
= dev
->priv
;
245 lbs_deb_enter(LBS_DEB_WEXT
);
247 /* Use nickname to indicate that mesh is on */
249 if (priv
->mesh_connect_status
== LBS_CONNECTED
) {
250 strncpy(extra
, "Mesh", 12);
252 dwrq
->length
= strlen(extra
);
260 lbs_deb_leave(LBS_DEB_WEXT
);
264 static int lbs_set_rts(struct net_device
*dev
, struct iw_request_info
*info
,
265 struct iw_param
*vwrq
, char *extra
)
268 struct lbs_private
*priv
= dev
->priv
;
269 u32 rthr
= vwrq
->value
;
271 lbs_deb_enter(LBS_DEB_WEXT
);
273 if (vwrq
->disabled
) {
274 priv
->rtsthsd
= rthr
= MRVDRV_RTS_MAX_VALUE
;
276 if (rthr
< MRVDRV_RTS_MIN_VALUE
|| rthr
> MRVDRV_RTS_MAX_VALUE
)
278 priv
->rtsthsd
= rthr
;
281 ret
= lbs_prepare_and_send_command(priv
, CMD_802_11_SNMP_MIB
,
282 CMD_ACT_SET
, CMD_OPTION_WAITFORRSP
,
283 OID_802_11_RTS_THRESHOLD
, &rthr
);
285 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
289 static int lbs_get_rts(struct net_device
*dev
, struct iw_request_info
*info
,
290 struct iw_param
*vwrq
, char *extra
)
293 struct lbs_private
*priv
= dev
->priv
;
295 lbs_deb_enter(LBS_DEB_WEXT
);
298 ret
= lbs_prepare_and_send_command(priv
, CMD_802_11_SNMP_MIB
,
299 CMD_ACT_GET
, CMD_OPTION_WAITFORRSP
,
300 OID_802_11_RTS_THRESHOLD
, NULL
);
304 vwrq
->value
= priv
->rtsthsd
;
305 vwrq
->disabled
= ((vwrq
->value
< MRVDRV_RTS_MIN_VALUE
)
306 || (vwrq
->value
> MRVDRV_RTS_MAX_VALUE
));
310 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
314 static int lbs_set_frag(struct net_device
*dev
, struct iw_request_info
*info
,
315 struct iw_param
*vwrq
, char *extra
)
318 u32 fthr
= vwrq
->value
;
319 struct lbs_private
*priv
= dev
->priv
;
321 lbs_deb_enter(LBS_DEB_WEXT
);
323 if (vwrq
->disabled
) {
324 priv
->fragthsd
= fthr
= MRVDRV_FRAG_MAX_VALUE
;
326 if (fthr
< MRVDRV_FRAG_MIN_VALUE
327 || fthr
> MRVDRV_FRAG_MAX_VALUE
)
329 priv
->fragthsd
= fthr
;
332 ret
= lbs_prepare_and_send_command(priv
, CMD_802_11_SNMP_MIB
,
333 CMD_ACT_SET
, CMD_OPTION_WAITFORRSP
,
334 OID_802_11_FRAGMENTATION_THRESHOLD
, &fthr
);
336 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
340 static int lbs_get_frag(struct net_device
*dev
, struct iw_request_info
*info
,
341 struct iw_param
*vwrq
, char *extra
)
344 struct lbs_private
*priv
= dev
->priv
;
346 lbs_deb_enter(LBS_DEB_WEXT
);
349 ret
= lbs_prepare_and_send_command(priv
,
351 CMD_ACT_GET
, CMD_OPTION_WAITFORRSP
,
352 OID_802_11_FRAGMENTATION_THRESHOLD
, NULL
);
356 vwrq
->value
= priv
->fragthsd
;
357 vwrq
->disabled
= ((vwrq
->value
< MRVDRV_FRAG_MIN_VALUE
)
358 || (vwrq
->value
> MRVDRV_FRAG_MAX_VALUE
));
362 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
366 static int lbs_get_mode(struct net_device
*dev
,
367 struct iw_request_info
*info
, u32
* uwrq
, char *extra
)
369 struct lbs_private
*priv
= dev
->priv
;
371 lbs_deb_enter(LBS_DEB_WEXT
);
375 lbs_deb_leave(LBS_DEB_WEXT
);
379 static int mesh_wlan_get_mode(struct net_device
*dev
,
380 struct iw_request_info
*info
, u32
* uwrq
,
383 lbs_deb_enter(LBS_DEB_WEXT
);
385 *uwrq
= IW_MODE_REPEAT
;
387 lbs_deb_leave(LBS_DEB_WEXT
);
391 static int lbs_get_txpow(struct net_device
*dev
,
392 struct iw_request_info
*info
,
393 struct iw_param
*vwrq
, char *extra
)
395 struct lbs_private
*priv
= dev
->priv
;
399 lbs_deb_enter(LBS_DEB_WEXT
);
401 if (!priv
->radio_on
) {
402 lbs_deb_wext("tx power off\n");
408 ret
= lbs_get_tx_power(priv
, &curlevel
, NULL
, NULL
);
412 lbs_deb_wext("tx power level %d dbm\n", curlevel
);
413 priv
->txpower_cur
= curlevel
;
415 vwrq
->value
= curlevel
;
418 vwrq
->flags
= IW_TXPOW_DBM
;
421 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
425 static int lbs_set_retry(struct net_device
*dev
, struct iw_request_info
*info
,
426 struct iw_param
*vwrq
, char *extra
)
429 struct lbs_private
*priv
= dev
->priv
;
431 lbs_deb_enter(LBS_DEB_WEXT
);
433 if (vwrq
->flags
== IW_RETRY_LIMIT
) {
434 /* The MAC has a 4-bit Total_Tx_Count register
435 Total_Tx_Count = 1 + Tx_Retry_Count */
436 #define TX_RETRY_MIN 0
437 #define TX_RETRY_MAX 14
438 if (vwrq
->value
< TX_RETRY_MIN
|| vwrq
->value
> TX_RETRY_MAX
)
441 /* Adding 1 to convert retry count to try count */
442 priv
->txretrycount
= vwrq
->value
+ 1;
444 ret
= lbs_prepare_and_send_command(priv
, CMD_802_11_SNMP_MIB
,
446 CMD_OPTION_WAITFORRSP
,
447 OID_802_11_TX_RETRYCOUNT
, NULL
);
456 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
460 static int lbs_get_retry(struct net_device
*dev
, struct iw_request_info
*info
,
461 struct iw_param
*vwrq
, char *extra
)
463 struct lbs_private
*priv
= dev
->priv
;
466 lbs_deb_enter(LBS_DEB_WEXT
);
468 priv
->txretrycount
= 0;
469 ret
= lbs_prepare_and_send_command(priv
,
471 CMD_ACT_GET
, CMD_OPTION_WAITFORRSP
,
472 OID_802_11_TX_RETRYCOUNT
, NULL
);
478 vwrq
->flags
= IW_RETRY_LIMIT
;
479 /* Subtract 1 to convert try count to retry count */
480 vwrq
->value
= priv
->txretrycount
- 1;
484 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
488 static inline void sort_channels(struct iw_freq
*freq
, int num
)
493 for (i
= 0; i
< num
; i
++)
494 for (j
= i
+ 1; j
< num
; j
++)
495 if (freq
[i
].i
> freq
[j
].i
) {
499 freq
[i
].i
= freq
[j
].i
;
500 freq
[i
].m
= freq
[j
].m
;
510 Infra G(12) A(8) B(4) G(12)
511 Adhoc A+B(12) A(8) B(4) B(4)
519 * @brief Get Range Info
521 * @param dev A pointer to net_device structure
522 * @param info A pointer to iw_request_info structure
523 * @param vwrq A pointer to iw_param structure
524 * @param extra A pointer to extra data buf
525 * @return 0 --success, otherwise fail
527 static int lbs_get_range(struct net_device
*dev
, struct iw_request_info
*info
,
528 struct iw_point
*dwrq
, char *extra
)
531 struct lbs_private
*priv
= dev
->priv
;
532 struct iw_range
*range
= (struct iw_range
*)extra
;
533 struct chan_freq_power
*cfp
;
534 u8 rates
[MAX_RATES
+ 1];
538 lbs_deb_enter(LBS_DEB_WEXT
);
540 dwrq
->length
= sizeof(struct iw_range
);
541 memset(range
, 0, sizeof(struct iw_range
));
546 memset(rates
, 0, sizeof(rates
));
547 copy_active_data_rates(priv
, rates
);
548 range
->num_bitrates
= strnlen(rates
, IW_MAX_BITRATES
);
549 for (i
= 0; i
< range
->num_bitrates
; i
++)
550 range
->bitrate
[i
] = rates
[i
] * 500000;
551 range
->num_bitrates
= i
;
552 lbs_deb_wext("IW_MAX_BITRATES %d, num_bitrates %d\n", IW_MAX_BITRATES
,
553 range
->num_bitrates
);
555 range
->num_frequency
= 0;
557 range
->scan_capa
= IW_SCAN_CAPA_ESSID
;
559 if (priv
->enable11d
&&
560 (priv
->connect_status
== LBS_CONNECTED
||
561 priv
->mesh_connect_status
== LBS_CONNECTED
)) {
565 struct parsed_region_chan_11d
*parsed_region_chan
=
566 &priv
->parsed_region_chan
;
568 if (parsed_region_chan
== NULL
) {
569 lbs_deb_wext("11d: parsed_region_chan is NULL\n");
572 band
= parsed_region_chan
->band
;
573 lbs_deb_wext("band %d, nr_char %d\n", band
,
574 parsed_region_chan
->nr_chan
);
576 for (i
= 0; (range
->num_frequency
< IW_MAX_FREQUENCIES
)
577 && (i
< parsed_region_chan
->nr_chan
); i
++) {
578 chan_no
= parsed_region_chan
->chanpwr
[i
].chan
;
579 lbs_deb_wext("chan_no %d\n", chan_no
);
580 range
->freq
[range
->num_frequency
].i
= (long)chan_no
;
581 range
->freq
[range
->num_frequency
].m
=
582 (long)lbs_chan_2_freq(chan_no
) * 100000;
583 range
->freq
[range
->num_frequency
].e
= 1;
584 range
->num_frequency
++;
589 for (j
= 0; (range
->num_frequency
< IW_MAX_FREQUENCIES
)
590 && (j
< ARRAY_SIZE(priv
->region_channel
)); j
++) {
591 cfp
= priv
->region_channel
[j
].CFP
;
592 for (i
= 0; (range
->num_frequency
< IW_MAX_FREQUENCIES
)
593 && priv
->region_channel
[j
].valid
595 && (i
< priv
->region_channel
[j
].nrcfp
); i
++) {
596 range
->freq
[range
->num_frequency
].i
=
598 range
->freq
[range
->num_frequency
].m
=
599 (long)cfp
->freq
* 100000;
600 range
->freq
[range
->num_frequency
].e
= 1;
602 range
->num_frequency
++;
607 lbs_deb_wext("IW_MAX_FREQUENCIES %d, num_frequency %d\n",
608 IW_MAX_FREQUENCIES
, range
->num_frequency
);
610 range
->num_channels
= range
->num_frequency
;
612 sort_channels(&range
->freq
[0], range
->num_frequency
);
615 * Set an indication of the max TCP throughput in bit/s that we can
616 * expect using this interface
619 range
->throughput
= 5000 * 1000;
621 range
->throughput
= 1500 * 1000;
623 range
->min_rts
= MRVDRV_RTS_MIN_VALUE
;
624 range
->max_rts
= MRVDRV_RTS_MAX_VALUE
;
625 range
->min_frag
= MRVDRV_FRAG_MIN_VALUE
;
626 range
->max_frag
= MRVDRV_FRAG_MAX_VALUE
;
628 range
->encoding_size
[0] = 5;
629 range
->encoding_size
[1] = 13;
630 range
->num_encoding_sizes
= 2;
631 range
->max_encoding_tokens
= 4;
634 * Right now we support only "iwconfig ethX power on|off"
636 range
->pm_capa
= IW_POWER_ON
;
639 * Minimum version we recommend
641 range
->we_version_source
= 15;
644 * Version we are compiled with
646 range
->we_version_compiled
= WIRELESS_EXT
;
648 range
->retry_capa
= IW_RETRY_LIMIT
;
649 range
->retry_flags
= IW_RETRY_LIMIT
| IW_RETRY_MAX
;
651 range
->min_retry
= TX_RETRY_MIN
;
652 range
->max_retry
= TX_RETRY_MAX
;
655 * Set the qual, level and noise range values
657 range
->max_qual
.qual
= 100;
658 range
->max_qual
.level
= 0;
659 range
->max_qual
.noise
= 0;
660 range
->max_qual
.updated
= IW_QUAL_ALL_UPDATED
| IW_QUAL_DBM
;
662 range
->avg_qual
.qual
= 70;
663 /* TODO: Find real 'good' to 'bad' threshold value for RSSI */
664 range
->avg_qual
.level
= 0;
665 range
->avg_qual
.noise
= 0;
666 range
->avg_qual
.updated
= IW_QUAL_ALL_UPDATED
| IW_QUAL_DBM
;
668 range
->sensitivity
= 0;
670 /* Setup the supported power level ranges */
671 memset(range
->txpower
, 0, sizeof(range
->txpower
));
672 range
->txpower_capa
= IW_TXPOW_DBM
| IW_TXPOW_RANGE
;
673 range
->txpower
[0] = priv
->txpower_min
;
674 range
->txpower
[1] = priv
->txpower_max
;
675 range
->num_txpower
= 2;
677 range
->event_capa
[0] = (IW_EVENT_CAPA_K_0
|
678 IW_EVENT_CAPA_MASK(SIOCGIWAP
) |
679 IW_EVENT_CAPA_MASK(SIOCGIWSCAN
));
680 range
->event_capa
[1] = IW_EVENT_CAPA_K_1
;
682 if (priv
->fwcapinfo
& FW_CAPINFO_WPA
) {
683 range
->enc_capa
= IW_ENC_CAPA_WPA
685 | IW_ENC_CAPA_CIPHER_TKIP
686 | IW_ENC_CAPA_CIPHER_CCMP
;
690 lbs_deb_leave(LBS_DEB_WEXT
);
694 static int lbs_set_power(struct net_device
*dev
, struct iw_request_info
*info
,
695 struct iw_param
*vwrq
, char *extra
)
697 struct lbs_private
*priv
= dev
->priv
;
699 lbs_deb_enter(LBS_DEB_WEXT
);
701 if (!priv
->ps_supported
) {
708 /* PS is currently supported only in Infrastructure mode
709 * Remove this check if it is to be supported in IBSS mode also
712 if (vwrq
->disabled
) {
713 priv
->psmode
= LBS802_11POWERMODECAM
;
714 if (priv
->psstate
!= PS_STATE_FULL_POWER
) {
715 lbs_ps_wakeup(priv
, CMD_OPTION_WAITFORRSP
);
721 if ((vwrq
->flags
& IW_POWER_TYPE
) == IW_POWER_TIMEOUT
) {
723 "setting power timeout is not supported\n");
725 } else if ((vwrq
->flags
& IW_POWER_TYPE
) == IW_POWER_PERIOD
) {
726 lbs_deb_wext("setting power period not supported\n");
730 if (priv
->psmode
!= LBS802_11POWERMODECAM
) {
734 priv
->psmode
= LBS802_11POWERMODEMAX_PSP
;
736 if (priv
->connect_status
== LBS_CONNECTED
) {
737 lbs_ps_sleep(priv
, CMD_OPTION_WAITFORRSP
);
740 lbs_deb_leave(LBS_DEB_WEXT
);
744 static int lbs_get_power(struct net_device
*dev
, struct iw_request_info
*info
,
745 struct iw_param
*vwrq
, char *extra
)
747 struct lbs_private
*priv
= dev
->priv
;
749 lbs_deb_enter(LBS_DEB_WEXT
);
753 vwrq
->disabled
= priv
->psmode
== LBS802_11POWERMODECAM
754 || priv
->connect_status
== LBS_DISCONNECTED
;
756 lbs_deb_leave(LBS_DEB_WEXT
);
760 static struct iw_statistics
*lbs_get_wireless_stats(struct net_device
*dev
)
770 struct lbs_private
*priv
= dev
->priv
;
777 struct cmd_ds_802_11_get_log log
;
779 lbs_deb_enter(LBS_DEB_WEXT
);
781 priv
->wstats
.status
= priv
->mode
;
783 /* If we're not associated, all quality values are meaningless */
784 if ((priv
->connect_status
!= LBS_CONNECTED
) &&
785 (priv
->mesh_connect_status
!= LBS_CONNECTED
))
788 /* Quality by RSSI */
789 priv
->wstats
.qual
.level
=
790 CAL_RSSI(priv
->SNR
[TYPE_BEACON
][TYPE_NOAVG
],
791 priv
->NF
[TYPE_BEACON
][TYPE_NOAVG
]);
793 if (priv
->NF
[TYPE_BEACON
][TYPE_NOAVG
] == 0) {
794 priv
->wstats
.qual
.noise
= MRVDRV_NF_DEFAULT_SCAN_VALUE
;
796 priv
->wstats
.qual
.noise
=
797 CAL_NF(priv
->NF
[TYPE_BEACON
][TYPE_NOAVG
]);
800 lbs_deb_wext("signal level %#x\n", priv
->wstats
.qual
.level
);
801 lbs_deb_wext("noise %#x\n", priv
->wstats
.qual
.noise
);
803 rssi
= priv
->wstats
.qual
.level
- priv
->wstats
.qual
.noise
;
805 rssi_qual
= rssi
* POOR
/ 10;
807 rssi_qual
= (rssi
- 15) * (FAIR
- POOR
) / 5 + POOR
;
809 rssi_qual
= (rssi
- 20) * (GOOD
- FAIR
) / 5 + FAIR
;
811 rssi_qual
= (rssi
- 30) * (VERY_GOOD
- GOOD
) /
814 rssi_qual
= (rssi
- 40) * (PERFECT
- VERY_GOOD
) /
818 /* Quality by TX errors */
819 priv
->wstats
.discard
.retries
= priv
->stats
.tx_errors
;
821 memset(&log
, 0, sizeof(log
));
822 log
.hdr
.size
= cpu_to_le16(sizeof(log
));
823 lbs_cmd_with_response(priv
, CMD_802_11_GET_LOG
, &log
);
825 tx_retries
= le32_to_cpu(log
.retry
);
828 tx_qual
= (90 - tx_retries
) * POOR
/ 15;
829 else if (tx_retries
> 70)
830 tx_qual
= (75 - tx_retries
) * (FAIR
- POOR
) / 5 + POOR
;
831 else if (tx_retries
> 65)
832 tx_qual
= (70 - tx_retries
) * (GOOD
- FAIR
) / 5 + FAIR
;
833 else if (tx_retries
> 50)
834 tx_qual
= (65 - tx_retries
) * (VERY_GOOD
- GOOD
) /
837 tx_qual
= (50 - tx_retries
) *
838 (PERFECT
- VERY_GOOD
) / 50 + VERY_GOOD
;
839 quality
= min(quality
, tx_qual
);
841 priv
->wstats
.discard
.code
= le32_to_cpu(log
.wepundecryptable
);
842 priv
->wstats
.discard
.retries
= tx_retries
;
843 priv
->wstats
.discard
.misc
= le32_to_cpu(log
.ackfailure
);
845 /* Calculate quality */
846 priv
->wstats
.qual
.qual
= min_t(u8
, quality
, 100);
847 priv
->wstats
.qual
.updated
= IW_QUAL_ALL_UPDATED
| IW_QUAL_DBM
;
850 /* update stats asynchronously for future calls */
851 lbs_prepare_and_send_command(priv
, CMD_802_11_RSSI
, 0,
855 priv
->wstats
.miss
.beacon
= 0;
856 priv
->wstats
.discard
.retries
= 0;
857 priv
->wstats
.qual
.qual
= 0;
858 priv
->wstats
.qual
.level
= 0;
859 priv
->wstats
.qual
.noise
= 0;
860 priv
->wstats
.qual
.updated
= IW_QUAL_ALL_UPDATED
;
861 priv
->wstats
.qual
.updated
|= IW_QUAL_NOISE_INVALID
|
862 IW_QUAL_QUAL_INVALID
| IW_QUAL_LEVEL_INVALID
;
865 lbs_deb_leave(LBS_DEB_WEXT
);
866 return &priv
->wstats
;
871 static int lbs_set_freq(struct net_device
*dev
, struct iw_request_info
*info
,
872 struct iw_freq
*fwrq
, char *extra
)
875 struct lbs_private
*priv
= dev
->priv
;
876 struct chan_freq_power
*cfp
;
877 struct assoc_request
* assoc_req
;
879 lbs_deb_enter(LBS_DEB_WEXT
);
881 mutex_lock(&priv
->lock
);
882 assoc_req
= lbs_get_association_request(priv
);
888 /* If setting by frequency, convert to a channel */
890 long f
= fwrq
->m
/ 100000;
892 cfp
= find_cfp_by_band_and_freq(priv
, 0, f
);
894 lbs_deb_wext("invalid freq %ld\n", f
);
899 fwrq
->m
= (int) cfp
->channel
;
902 /* Setting by channel number */
903 if (fwrq
->m
> 1000 || fwrq
->e
> 0) {
907 cfp
= lbs_find_cfp_by_band_and_channel(priv
, 0, fwrq
->m
);
912 assoc_req
->channel
= fwrq
->m
;
917 set_bit(ASSOC_FLAG_CHANNEL
, &assoc_req
->flags
);
918 lbs_postpone_association_work(priv
);
920 lbs_cancel_association_work(priv
);
922 mutex_unlock(&priv
->lock
);
924 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
928 static int lbs_mesh_set_freq(struct net_device
*dev
,
929 struct iw_request_info
*info
,
930 struct iw_freq
*fwrq
, char *extra
)
932 struct lbs_private
*priv
= dev
->priv
;
933 struct chan_freq_power
*cfp
;
936 lbs_deb_enter(LBS_DEB_WEXT
);
938 /* If setting by frequency, convert to a channel */
940 long f
= fwrq
->m
/ 100000;
942 cfp
= find_cfp_by_band_and_freq(priv
, 0, f
);
944 lbs_deb_wext("invalid freq %ld\n", f
);
949 fwrq
->m
= (int) cfp
->channel
;
952 /* Setting by channel number */
953 if (fwrq
->m
> 1000 || fwrq
->e
> 0) {
957 cfp
= lbs_find_cfp_by_band_and_channel(priv
, 0, fwrq
->m
);
962 if (fwrq
->m
!= priv
->curbssparams
.channel
) {
963 lbs_deb_wext("mesh channel change forces eth disconnect\n");
964 if (priv
->mode
== IW_MODE_INFRA
)
965 lbs_cmd_80211_deauthenticate(priv
,
966 priv
->curbssparams
.bssid
,
967 WLAN_REASON_DEAUTH_LEAVING
);
968 else if (priv
->mode
== IW_MODE_ADHOC
)
969 lbs_adhoc_stop(priv
);
971 lbs_mesh_config(priv
, CMD_ACT_MESH_CONFIG_START
, fwrq
->m
);
972 lbs_update_channel(priv
);
976 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
980 static int lbs_set_rate(struct net_device
*dev
, struct iw_request_info
*info
,
981 struct iw_param
*vwrq
, char *extra
)
983 struct lbs_private
*priv
= dev
->priv
;
986 u8 rates
[MAX_RATES
+ 1];
988 lbs_deb_enter(LBS_DEB_WEXT
);
989 lbs_deb_wext("vwrq->value %d\n", vwrq
->value
);
990 lbs_deb_wext("vwrq->fixed %d\n", vwrq
->fixed
);
992 if (vwrq
->fixed
&& vwrq
->value
== -1)
996 priv
->enablehwauto
= !vwrq
->fixed
;
998 if (vwrq
->value
== -1)
1001 if (vwrq
->value
% 100000)
1004 new_rate
= vwrq
->value
/ 500000;
1005 priv
->cur_rate
= new_rate
;
1006 /* the rest is only needed for lbs_set_data_rate() */
1007 memset(rates
, 0, sizeof(rates
));
1008 copy_active_data_rates(priv
, rates
);
1009 if (!memchr(rates
, new_rate
, sizeof(rates
))) {
1010 lbs_pr_alert("fixed data rate 0x%X out of range\n",
1016 /* Try the newer command first (Firmware Spec 5.1 and above) */
1017 ret
= lbs_cmd_802_11_rate_adapt_rateset(priv
, CMD_ACT_SET
);
1019 /* Fallback to older version */
1021 ret
= lbs_set_data_rate(priv
, new_rate
);
1024 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1028 static int lbs_get_rate(struct net_device
*dev
, struct iw_request_info
*info
,
1029 struct iw_param
*vwrq
, char *extra
)
1031 struct lbs_private
*priv
= dev
->priv
;
1033 lbs_deb_enter(LBS_DEB_WEXT
);
1035 if (priv
->connect_status
== LBS_CONNECTED
) {
1036 vwrq
->value
= priv
->cur_rate
* 500000;
1038 if (priv
->enablehwauto
)
1048 lbs_deb_leave(LBS_DEB_WEXT
);
1052 static int lbs_set_mode(struct net_device
*dev
,
1053 struct iw_request_info
*info
, u32
* uwrq
, char *extra
)
1056 struct lbs_private
*priv
= dev
->priv
;
1057 struct assoc_request
* assoc_req
;
1059 lbs_deb_enter(LBS_DEB_WEXT
);
1061 if ( (*uwrq
!= IW_MODE_ADHOC
)
1062 && (*uwrq
!= IW_MODE_INFRA
)
1063 && (*uwrq
!= IW_MODE_AUTO
)) {
1064 lbs_deb_wext("Invalid mode: 0x%x\n", *uwrq
);
1069 mutex_lock(&priv
->lock
);
1070 assoc_req
= lbs_get_association_request(priv
);
1073 lbs_cancel_association_work(priv
);
1075 assoc_req
->mode
= *uwrq
;
1076 set_bit(ASSOC_FLAG_MODE
, &assoc_req
->flags
);
1077 lbs_postpone_association_work(priv
);
1078 lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq
);
1080 mutex_unlock(&priv
->lock
);
1083 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1089 * @brief Get Encryption key
1091 * @param dev A pointer to net_device structure
1092 * @param info A pointer to iw_request_info structure
1093 * @param vwrq A pointer to iw_param structure
1094 * @param extra A pointer to extra data buf
1095 * @return 0 --success, otherwise fail
1097 static int lbs_get_encode(struct net_device
*dev
,
1098 struct iw_request_info
*info
,
1099 struct iw_point
*dwrq
, u8
* extra
)
1101 struct lbs_private
*priv
= dev
->priv
;
1102 int index
= (dwrq
->flags
& IW_ENCODE_INDEX
) - 1;
1104 lbs_deb_enter(LBS_DEB_WEXT
);
1106 lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n",
1107 dwrq
->flags
, index
, dwrq
->length
, priv
->wep_tx_keyidx
);
1111 /* Authentication method */
1112 switch (priv
->secinfo
.auth_mode
) {
1113 case IW_AUTH_ALG_OPEN_SYSTEM
:
1114 dwrq
->flags
= IW_ENCODE_OPEN
;
1117 case IW_AUTH_ALG_SHARED_KEY
:
1118 case IW_AUTH_ALG_LEAP
:
1119 dwrq
->flags
= IW_ENCODE_RESTRICTED
;
1122 dwrq
->flags
= IW_ENCODE_DISABLED
| IW_ENCODE_OPEN
;
1126 memset(extra
, 0, 16);
1128 mutex_lock(&priv
->lock
);
1130 /* Default to returning current transmit key */
1132 index
= priv
->wep_tx_keyidx
;
1134 if ((priv
->wep_keys
[index
].len
) && priv
->secinfo
.wep_enabled
) {
1135 memcpy(extra
, priv
->wep_keys
[index
].key
,
1136 priv
->wep_keys
[index
].len
);
1137 dwrq
->length
= priv
->wep_keys
[index
].len
;
1139 dwrq
->flags
|= (index
+ 1);
1140 /* Return WEP enabled */
1141 dwrq
->flags
&= ~IW_ENCODE_DISABLED
;
1142 } else if ((priv
->secinfo
.WPAenabled
)
1143 || (priv
->secinfo
.WPA2enabled
)) {
1144 /* return WPA enabled */
1145 dwrq
->flags
&= ~IW_ENCODE_DISABLED
;
1146 dwrq
->flags
|= IW_ENCODE_NOKEY
;
1148 dwrq
->flags
|= IW_ENCODE_DISABLED
;
1151 mutex_unlock(&priv
->lock
);
1153 lbs_deb_wext("key: %02x:%02x:%02x:%02x:%02x:%02x, keylen %d\n",
1154 extra
[0], extra
[1], extra
[2],
1155 extra
[3], extra
[4], extra
[5], dwrq
->length
);
1157 lbs_deb_wext("return flags 0x%x\n", dwrq
->flags
);
1159 lbs_deb_leave(LBS_DEB_WEXT
);
1164 * @brief Set Encryption key (internal)
1166 * @param priv A pointer to private card structure
1167 * @param key_material A pointer to key material
1168 * @param key_length length of key material
1169 * @param index key index to set
1170 * @param set_tx_key Force set TX key (1 = yes, 0 = no)
1171 * @return 0 --success, otherwise fail
1173 static int lbs_set_wep_key(struct assoc_request
*assoc_req
,
1174 const char *key_material
,
1180 struct enc_key
*pkey
;
1182 lbs_deb_enter(LBS_DEB_WEXT
);
1184 /* Paranoid validation of key index */
1190 /* validate max key length */
1191 if (key_length
> KEY_LEN_WEP_104
) {
1196 pkey
= &assoc_req
->wep_keys
[index
];
1198 if (key_length
> 0) {
1199 memset(pkey
, 0, sizeof(struct enc_key
));
1200 pkey
->type
= KEY_TYPE_ID_WEP
;
1202 /* Standardize the key length */
1203 pkey
->len
= (key_length
> KEY_LEN_WEP_40
) ?
1204 KEY_LEN_WEP_104
: KEY_LEN_WEP_40
;
1205 memcpy(pkey
->key
, key_material
, key_length
);
1209 /* Ensure the chosen key is valid */
1211 lbs_deb_wext("key not set, so cannot enable it\n");
1215 assoc_req
->wep_tx_keyidx
= index
;
1218 assoc_req
->secinfo
.wep_enabled
= 1;
1221 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1225 static int validate_key_index(u16 def_index
, u16 raw_index
,
1226 u16
*out_index
, u16
*is_default
)
1228 if (!out_index
|| !is_default
)
1231 /* Verify index if present, otherwise use default TX key index */
1232 if (raw_index
> 0) {
1235 *out_index
= raw_index
- 1;
1237 *out_index
= def_index
;
1243 static void disable_wep(struct assoc_request
*assoc_req
)
1247 lbs_deb_enter(LBS_DEB_WEXT
);
1249 /* Set Open System auth mode */
1250 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1252 /* Clear WEP keys and mark WEP as disabled */
1253 assoc_req
->secinfo
.wep_enabled
= 0;
1254 for (i
= 0; i
< 4; i
++)
1255 assoc_req
->wep_keys
[i
].len
= 0;
1257 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1258 set_bit(ASSOC_FLAG_WEP_KEYS
, &assoc_req
->flags
);
1260 lbs_deb_leave(LBS_DEB_WEXT
);
1263 static void disable_wpa(struct assoc_request
*assoc_req
)
1265 lbs_deb_enter(LBS_DEB_WEXT
);
1267 memset(&assoc_req
->wpa_mcast_key
, 0, sizeof (struct enc_key
));
1268 assoc_req
->wpa_mcast_key
.flags
= KEY_INFO_WPA_MCAST
;
1269 set_bit(ASSOC_FLAG_WPA_MCAST_KEY
, &assoc_req
->flags
);
1271 memset(&assoc_req
->wpa_unicast_key
, 0, sizeof (struct enc_key
));
1272 assoc_req
->wpa_unicast_key
.flags
= KEY_INFO_WPA_UNICAST
;
1273 set_bit(ASSOC_FLAG_WPA_UCAST_KEY
, &assoc_req
->flags
);
1275 assoc_req
->secinfo
.WPAenabled
= 0;
1276 assoc_req
->secinfo
.WPA2enabled
= 0;
1277 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1279 lbs_deb_leave(LBS_DEB_WEXT
);
1283 * @brief Set Encryption key
1285 * @param dev A pointer to net_device structure
1286 * @param info A pointer to iw_request_info structure
1287 * @param vwrq A pointer to iw_param structure
1288 * @param extra A pointer to extra data buf
1289 * @return 0 --success, otherwise fail
1291 static int lbs_set_encode(struct net_device
*dev
,
1292 struct iw_request_info
*info
,
1293 struct iw_point
*dwrq
, char *extra
)
1296 struct lbs_private
*priv
= dev
->priv
;
1297 struct assoc_request
* assoc_req
;
1298 u16 is_default
= 0, index
= 0, set_tx_key
= 0;
1300 lbs_deb_enter(LBS_DEB_WEXT
);
1302 mutex_lock(&priv
->lock
);
1303 assoc_req
= lbs_get_association_request(priv
);
1309 if (dwrq
->flags
& IW_ENCODE_DISABLED
) {
1310 disable_wep (assoc_req
);
1311 disable_wpa (assoc_req
);
1315 ret
= validate_key_index(assoc_req
->wep_tx_keyidx
,
1316 (dwrq
->flags
& IW_ENCODE_INDEX
),
1317 &index
, &is_default
);
1323 /* If WEP isn't enabled, or if there is no key data but a valid
1324 * index, set the TX key.
1326 if (!assoc_req
->secinfo
.wep_enabled
|| (dwrq
->length
== 0 && !is_default
))
1329 ret
= lbs_set_wep_key(assoc_req
, extra
, dwrq
->length
, index
, set_tx_key
);
1334 set_bit(ASSOC_FLAG_WEP_KEYS
, &assoc_req
->flags
);
1336 set_bit(ASSOC_FLAG_WEP_TX_KEYIDX
, &assoc_req
->flags
);
1338 if (dwrq
->flags
& IW_ENCODE_RESTRICTED
) {
1339 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_SHARED_KEY
;
1340 } else if (dwrq
->flags
& IW_ENCODE_OPEN
) {
1341 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1346 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1347 lbs_postpone_association_work(priv
);
1349 lbs_cancel_association_work(priv
);
1351 mutex_unlock(&priv
->lock
);
1353 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1358 * @brief Get Extended Encryption key (WPA/802.1x and WEP)
1360 * @param dev A pointer to net_device structure
1361 * @param info A pointer to iw_request_info structure
1362 * @param vwrq A pointer to iw_param structure
1363 * @param extra A pointer to extra data buf
1364 * @return 0 on success, otherwise failure
1366 static int lbs_get_encodeext(struct net_device
*dev
,
1367 struct iw_request_info
*info
,
1368 struct iw_point
*dwrq
,
1372 struct lbs_private
*priv
= dev
->priv
;
1373 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*)extra
;
1374 int index
, max_key_len
;
1376 lbs_deb_enter(LBS_DEB_WEXT
);
1378 max_key_len
= dwrq
->length
- sizeof(*ext
);
1379 if (max_key_len
< 0)
1382 index
= dwrq
->flags
& IW_ENCODE_INDEX
;
1384 if (index
< 1 || index
> 4)
1388 index
= priv
->wep_tx_keyidx
;
1391 if (!(ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
) &&
1392 ext
->alg
!= IW_ENCODE_ALG_WEP
) {
1393 if (index
!= 0 || priv
->mode
!= IW_MODE_INFRA
)
1397 dwrq
->flags
= index
+ 1;
1398 memset(ext
, 0, sizeof(*ext
));
1400 if ( !priv
->secinfo
.wep_enabled
1401 && !priv
->secinfo
.WPAenabled
1402 && !priv
->secinfo
.WPA2enabled
) {
1403 ext
->alg
= IW_ENCODE_ALG_NONE
;
1405 dwrq
->flags
|= IW_ENCODE_DISABLED
;
1409 if ( priv
->secinfo
.wep_enabled
1410 && !priv
->secinfo
.WPAenabled
1411 && !priv
->secinfo
.WPA2enabled
) {
1413 ext
->alg
= IW_ENCODE_ALG_WEP
;
1414 ext
->key_len
= priv
->wep_keys
[index
].len
;
1415 key
= &priv
->wep_keys
[index
].key
[0];
1416 } else if ( !priv
->secinfo
.wep_enabled
1417 && (priv
->secinfo
.WPAenabled
||
1418 priv
->secinfo
.WPA2enabled
)) {
1420 struct enc_key
* pkey
= NULL
;
1422 if ( priv
->wpa_mcast_key
.len
1423 && (priv
->wpa_mcast_key
.flags
& KEY_INFO_WPA_ENABLED
))
1424 pkey
= &priv
->wpa_mcast_key
;
1425 else if ( priv
->wpa_unicast_key
.len
1426 && (priv
->wpa_unicast_key
.flags
& KEY_INFO_WPA_ENABLED
))
1427 pkey
= &priv
->wpa_unicast_key
;
1430 if (pkey
->type
== KEY_TYPE_ID_AES
) {
1431 ext
->alg
= IW_ENCODE_ALG_CCMP
;
1433 ext
->alg
= IW_ENCODE_ALG_TKIP
;
1435 ext
->key_len
= pkey
->len
;
1436 key
= &pkey
->key
[0];
1438 ext
->alg
= IW_ENCODE_ALG_TKIP
;
1445 if (ext
->key_len
> max_key_len
) {
1451 memcpy(ext
->key
, key
, ext
->key_len
);
1453 dwrq
->flags
|= IW_ENCODE_NOKEY
;
1454 dwrq
->flags
|= IW_ENCODE_ENABLED
;
1459 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1464 * @brief Set Encryption key Extended (WPA/802.1x and WEP)
1466 * @param dev A pointer to net_device structure
1467 * @param info A pointer to iw_request_info structure
1468 * @param vwrq A pointer to iw_param structure
1469 * @param extra A pointer to extra data buf
1470 * @return 0 --success, otherwise fail
1472 static int lbs_set_encodeext(struct net_device
*dev
,
1473 struct iw_request_info
*info
,
1474 struct iw_point
*dwrq
,
1478 struct lbs_private
*priv
= dev
->priv
;
1479 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*)extra
;
1481 struct assoc_request
* assoc_req
;
1483 lbs_deb_enter(LBS_DEB_WEXT
);
1485 mutex_lock(&priv
->lock
);
1486 assoc_req
= lbs_get_association_request(priv
);
1492 if ((alg
== IW_ENCODE_ALG_NONE
) || (dwrq
->flags
& IW_ENCODE_DISABLED
)) {
1493 disable_wep (assoc_req
);
1494 disable_wpa (assoc_req
);
1495 } else if (alg
== IW_ENCODE_ALG_WEP
) {
1496 u16 is_default
= 0, index
, set_tx_key
= 0;
1498 ret
= validate_key_index(assoc_req
->wep_tx_keyidx
,
1499 (dwrq
->flags
& IW_ENCODE_INDEX
),
1500 &index
, &is_default
);
1504 /* If WEP isn't enabled, or if there is no key data but a valid
1505 * index, or if the set-TX-key flag was passed, set the TX key.
1507 if ( !assoc_req
->secinfo
.wep_enabled
1508 || (dwrq
->length
== 0 && !is_default
)
1509 || (ext
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
))
1512 /* Copy key to driver */
1513 ret
= lbs_set_wep_key(assoc_req
, ext
->key
, ext
->key_len
, index
,
1518 if (dwrq
->flags
& IW_ENCODE_RESTRICTED
) {
1519 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_SHARED_KEY
;
1520 } else if (dwrq
->flags
& IW_ENCODE_OPEN
) {
1521 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1524 /* Mark the various WEP bits as modified */
1525 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1527 set_bit(ASSOC_FLAG_WEP_KEYS
, &assoc_req
->flags
);
1529 set_bit(ASSOC_FLAG_WEP_TX_KEYIDX
, &assoc_req
->flags
);
1530 } else if ((alg
== IW_ENCODE_ALG_TKIP
) || (alg
== IW_ENCODE_ALG_CCMP
)) {
1531 struct enc_key
* pkey
;
1533 /* validate key length */
1534 if (((alg
== IW_ENCODE_ALG_TKIP
)
1535 && (ext
->key_len
!= KEY_LEN_WPA_TKIP
))
1536 || ((alg
== IW_ENCODE_ALG_CCMP
)
1537 && (ext
->key_len
!= KEY_LEN_WPA_AES
))) {
1538 lbs_deb_wext("invalid size %d for key of alg "
1546 if (ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
) {
1547 pkey
= &assoc_req
->wpa_mcast_key
;
1548 set_bit(ASSOC_FLAG_WPA_MCAST_KEY
, &assoc_req
->flags
);
1550 pkey
= &assoc_req
->wpa_unicast_key
;
1551 set_bit(ASSOC_FLAG_WPA_UCAST_KEY
, &assoc_req
->flags
);
1554 memset(pkey
, 0, sizeof (struct enc_key
));
1555 memcpy(pkey
->key
, ext
->key
, ext
->key_len
);
1556 pkey
->len
= ext
->key_len
;
1558 pkey
->flags
|= KEY_INFO_WPA_ENABLED
;
1560 /* Do this after zeroing key structure */
1561 if (ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
) {
1562 pkey
->flags
|= KEY_INFO_WPA_MCAST
;
1564 pkey
->flags
|= KEY_INFO_WPA_UNICAST
;
1567 if (alg
== IW_ENCODE_ALG_TKIP
) {
1568 pkey
->type
= KEY_TYPE_ID_TKIP
;
1569 } else if (alg
== IW_ENCODE_ALG_CCMP
) {
1570 pkey
->type
= KEY_TYPE_ID_AES
;
1573 /* If WPA isn't enabled yet, do that now */
1574 if ( assoc_req
->secinfo
.WPAenabled
== 0
1575 && assoc_req
->secinfo
.WPA2enabled
== 0) {
1576 assoc_req
->secinfo
.WPAenabled
= 1;
1577 assoc_req
->secinfo
.WPA2enabled
= 1;
1578 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1581 disable_wep (assoc_req
);
1586 lbs_postpone_association_work(priv
);
1588 lbs_cancel_association_work(priv
);
1590 mutex_unlock(&priv
->lock
);
1592 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1597 static int lbs_set_genie(struct net_device
*dev
,
1598 struct iw_request_info
*info
,
1599 struct iw_point
*dwrq
,
1602 struct lbs_private
*priv
= dev
->priv
;
1604 struct assoc_request
* assoc_req
;
1606 lbs_deb_enter(LBS_DEB_WEXT
);
1608 mutex_lock(&priv
->lock
);
1609 assoc_req
= lbs_get_association_request(priv
);
1615 if (dwrq
->length
> MAX_WPA_IE_LEN
||
1616 (dwrq
->length
&& extra
== NULL
)) {
1622 memcpy(&assoc_req
->wpa_ie
[0], extra
, dwrq
->length
);
1623 assoc_req
->wpa_ie_len
= dwrq
->length
;
1625 memset(&assoc_req
->wpa_ie
[0], 0, sizeof(priv
->wpa_ie
));
1626 assoc_req
->wpa_ie_len
= 0;
1631 set_bit(ASSOC_FLAG_WPA_IE
, &assoc_req
->flags
);
1632 lbs_postpone_association_work(priv
);
1634 lbs_cancel_association_work(priv
);
1636 mutex_unlock(&priv
->lock
);
1638 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1642 static int lbs_get_genie(struct net_device
*dev
,
1643 struct iw_request_info
*info
,
1644 struct iw_point
*dwrq
,
1648 struct lbs_private
*priv
= dev
->priv
;
1650 lbs_deb_enter(LBS_DEB_WEXT
);
1652 if (priv
->wpa_ie_len
== 0) {
1657 if (dwrq
->length
< priv
->wpa_ie_len
) {
1662 dwrq
->length
= priv
->wpa_ie_len
;
1663 memcpy(extra
, &priv
->wpa_ie
[0], priv
->wpa_ie_len
);
1666 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1671 static int lbs_set_auth(struct net_device
*dev
,
1672 struct iw_request_info
*info
,
1673 struct iw_param
*dwrq
,
1676 struct lbs_private
*priv
= dev
->priv
;
1677 struct assoc_request
* assoc_req
;
1681 lbs_deb_enter(LBS_DEB_WEXT
);
1683 mutex_lock(&priv
->lock
);
1684 assoc_req
= lbs_get_association_request(priv
);
1690 switch (dwrq
->flags
& IW_AUTH_INDEX
) {
1691 case IW_AUTH_TKIP_COUNTERMEASURES
:
1692 case IW_AUTH_CIPHER_PAIRWISE
:
1693 case IW_AUTH_CIPHER_GROUP
:
1694 case IW_AUTH_KEY_MGMT
:
1695 case IW_AUTH_DROP_UNENCRYPTED
:
1697 * libertas does not use these parameters
1701 case IW_AUTH_WPA_VERSION
:
1702 if (dwrq
->value
& IW_AUTH_WPA_VERSION_DISABLED
) {
1703 assoc_req
->secinfo
.WPAenabled
= 0;
1704 assoc_req
->secinfo
.WPA2enabled
= 0;
1705 disable_wpa (assoc_req
);
1707 if (dwrq
->value
& IW_AUTH_WPA_VERSION_WPA
) {
1708 assoc_req
->secinfo
.WPAenabled
= 1;
1709 assoc_req
->secinfo
.wep_enabled
= 0;
1710 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1712 if (dwrq
->value
& IW_AUTH_WPA_VERSION_WPA2
) {
1713 assoc_req
->secinfo
.WPA2enabled
= 1;
1714 assoc_req
->secinfo
.wep_enabled
= 0;
1715 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1720 case IW_AUTH_80211_AUTH_ALG
:
1721 if (dwrq
->value
& IW_AUTH_ALG_SHARED_KEY
) {
1722 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_SHARED_KEY
;
1723 } else if (dwrq
->value
& IW_AUTH_ALG_OPEN_SYSTEM
) {
1724 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1725 } else if (dwrq
->value
& IW_AUTH_ALG_LEAP
) {
1726 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_LEAP
;
1733 case IW_AUTH_WPA_ENABLED
:
1735 if (!assoc_req
->secinfo
.WPAenabled
&&
1736 !assoc_req
->secinfo
.WPA2enabled
) {
1737 assoc_req
->secinfo
.WPAenabled
= 1;
1738 assoc_req
->secinfo
.WPA2enabled
= 1;
1739 assoc_req
->secinfo
.wep_enabled
= 0;
1740 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1743 assoc_req
->secinfo
.WPAenabled
= 0;
1744 assoc_req
->secinfo
.WPA2enabled
= 0;
1745 disable_wpa (assoc_req
);
1758 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1759 lbs_postpone_association_work(priv
);
1760 } else if (ret
!= -EOPNOTSUPP
) {
1761 lbs_cancel_association_work(priv
);
1763 mutex_unlock(&priv
->lock
);
1765 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1769 static int lbs_get_auth(struct net_device
*dev
,
1770 struct iw_request_info
*info
,
1771 struct iw_param
*dwrq
,
1775 struct lbs_private
*priv
= dev
->priv
;
1777 lbs_deb_enter(LBS_DEB_WEXT
);
1779 switch (dwrq
->flags
& IW_AUTH_INDEX
) {
1780 case IW_AUTH_WPA_VERSION
:
1782 if (priv
->secinfo
.WPAenabled
)
1783 dwrq
->value
|= IW_AUTH_WPA_VERSION_WPA
;
1784 if (priv
->secinfo
.WPA2enabled
)
1785 dwrq
->value
|= IW_AUTH_WPA_VERSION_WPA2
;
1787 dwrq
->value
|= IW_AUTH_WPA_VERSION_DISABLED
;
1790 case IW_AUTH_80211_AUTH_ALG
:
1791 dwrq
->value
= priv
->secinfo
.auth_mode
;
1794 case IW_AUTH_WPA_ENABLED
:
1795 if (priv
->secinfo
.WPAenabled
&& priv
->secinfo
.WPA2enabled
)
1803 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1808 static int lbs_set_txpow(struct net_device
*dev
, struct iw_request_info
*info
,
1809 struct iw_param
*vwrq
, char *extra
)
1812 struct lbs_private
*priv
= dev
->priv
;
1813 s16 dbm
= (s16
) vwrq
->value
;
1815 lbs_deb_enter(LBS_DEB_WEXT
);
1817 if (vwrq
->disabled
) {
1818 lbs_set_radio(priv
, RADIO_PREAMBLE_AUTO
, 0);
1822 if (vwrq
->fixed
== 0) {
1823 /* Auto power control */
1824 dbm
= priv
->txpower_max
;
1826 /* Userspace check in iwrange if it should use dBm or mW,
1827 * therefore this should never happen... Jean II */
1828 if ((vwrq
->flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
) {
1833 /* Validate requested power level against firmware allowed levels */
1834 if (priv
->txpower_min
&& (dbm
< priv
->txpower_min
)) {
1839 if (priv
->txpower_max
&& (dbm
> priv
->txpower_max
)) {
1845 /* If the radio was off, turn it on */
1846 if (!priv
->radio_on
) {
1847 ret
= lbs_set_radio(priv
, RADIO_PREAMBLE_AUTO
, 1);
1852 lbs_deb_wext("txpower set %d dBm\n", dbm
);
1854 ret
= lbs_set_tx_power(priv
, dbm
);
1857 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1861 static int lbs_get_essid(struct net_device
*dev
, struct iw_request_info
*info
,
1862 struct iw_point
*dwrq
, char *extra
)
1864 struct lbs_private
*priv
= dev
->priv
;
1866 lbs_deb_enter(LBS_DEB_WEXT
);
1869 * Note : if dwrq->flags != 0, we should get the relevant SSID from
1874 * Get the current SSID
1876 if (priv
->connect_status
== LBS_CONNECTED
) {
1877 memcpy(extra
, priv
->curbssparams
.ssid
,
1878 priv
->curbssparams
.ssid_len
);
1879 extra
[priv
->curbssparams
.ssid_len
] = '\0';
1881 memset(extra
, 0, 32);
1882 extra
[priv
->curbssparams
.ssid_len
] = '\0';
1885 * If none, we may want to get the one that was set
1888 dwrq
->length
= priv
->curbssparams
.ssid_len
;
1890 dwrq
->flags
= 1; /* active */
1892 lbs_deb_leave(LBS_DEB_WEXT
);
1896 static int lbs_set_essid(struct net_device
*dev
, struct iw_request_info
*info
,
1897 struct iw_point
*dwrq
, char *extra
)
1899 struct lbs_private
*priv
= dev
->priv
;
1901 u8 ssid
[IW_ESSID_MAX_SIZE
];
1903 struct assoc_request
* assoc_req
;
1904 int in_ssid_len
= dwrq
->length
;
1906 lbs_deb_enter(LBS_DEB_WEXT
);
1908 if (!priv
->radio_on
) {
1913 /* Check the size of the string */
1914 if (in_ssid_len
> IW_ESSID_MAX_SIZE
) {
1919 memset(&ssid
, 0, sizeof(ssid
));
1921 if (!dwrq
->flags
|| !in_ssid_len
) {
1922 /* "any" SSID requested; leave SSID blank */
1924 /* Specific SSID requested */
1925 memcpy(&ssid
, extra
, in_ssid_len
);
1926 ssid_len
= in_ssid_len
;
1930 lbs_deb_wext("requested any SSID\n");
1932 lbs_deb_wext("requested SSID '%s'\n",
1933 escape_essid(ssid
, ssid_len
));
1937 mutex_lock(&priv
->lock
);
1939 /* Get or create the current association request */
1940 assoc_req
= lbs_get_association_request(priv
);
1944 /* Copy the SSID to the association request */
1945 memcpy(&assoc_req
->ssid
, &ssid
, IW_ESSID_MAX_SIZE
);
1946 assoc_req
->ssid_len
= ssid_len
;
1947 set_bit(ASSOC_FLAG_SSID
, &assoc_req
->flags
);
1948 lbs_postpone_association_work(priv
);
1952 /* Cancel the association request if there was an error */
1954 lbs_cancel_association_work(priv
);
1957 mutex_unlock(&priv
->lock
);
1959 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1963 static int lbs_mesh_get_essid(struct net_device
*dev
,
1964 struct iw_request_info
*info
,
1965 struct iw_point
*dwrq
, char *extra
)
1967 struct lbs_private
*priv
= dev
->priv
;
1969 lbs_deb_enter(LBS_DEB_WEXT
);
1971 memcpy(extra
, priv
->mesh_ssid
, priv
->mesh_ssid_len
);
1973 dwrq
->length
= priv
->mesh_ssid_len
;
1975 dwrq
->flags
= 1; /* active */
1977 lbs_deb_leave(LBS_DEB_WEXT
);
1981 static int lbs_mesh_set_essid(struct net_device
*dev
,
1982 struct iw_request_info
*info
,
1983 struct iw_point
*dwrq
, char *extra
)
1985 struct lbs_private
*priv
= dev
->priv
;
1988 lbs_deb_enter(LBS_DEB_WEXT
);
1990 if (!priv
->radio_on
) {
1995 /* Check the size of the string */
1996 if (dwrq
->length
> IW_ESSID_MAX_SIZE
) {
2001 if (!dwrq
->flags
|| !dwrq
->length
) {
2005 /* Specific SSID requested */
2006 memcpy(priv
->mesh_ssid
, extra
, dwrq
->length
);
2007 priv
->mesh_ssid_len
= dwrq
->length
;
2010 lbs_mesh_config(priv
, CMD_ACT_MESH_CONFIG_START
,
2011 priv
->curbssparams
.channel
);
2013 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
2018 * @brief Connect to the AP or Ad-hoc Network with specific bssid
2020 * @param dev A pointer to net_device structure
2021 * @param info A pointer to iw_request_info structure
2022 * @param awrq A pointer to iw_param structure
2023 * @param extra A pointer to extra data buf
2024 * @return 0 --success, otherwise fail
2026 static int lbs_set_wap(struct net_device
*dev
, struct iw_request_info
*info
,
2027 struct sockaddr
*awrq
, char *extra
)
2029 struct lbs_private
*priv
= dev
->priv
;
2030 struct assoc_request
* assoc_req
;
2032 DECLARE_MAC_BUF(mac
);
2034 lbs_deb_enter(LBS_DEB_WEXT
);
2036 if (!priv
->radio_on
)
2039 if (awrq
->sa_family
!= ARPHRD_ETHER
)
2042 lbs_deb_wext("ASSOC: WAP: sa_data %s\n", print_mac(mac
, awrq
->sa_data
));
2044 mutex_lock(&priv
->lock
);
2046 /* Get or create the current association request */
2047 assoc_req
= lbs_get_association_request(priv
);
2049 lbs_cancel_association_work(priv
);
2052 /* Copy the BSSID to the association request */
2053 memcpy(&assoc_req
->bssid
, awrq
->sa_data
, ETH_ALEN
);
2054 set_bit(ASSOC_FLAG_BSSID
, &assoc_req
->flags
);
2055 lbs_postpone_association_work(priv
);
2058 mutex_unlock(&priv
->lock
);
2064 * iwconfig settable callbacks
2066 static const iw_handler lbs_handler
[] = {
2067 (iw_handler
) NULL
, /* SIOCSIWCOMMIT */
2068 (iw_handler
) lbs_get_name
, /* SIOCGIWNAME */
2069 (iw_handler
) NULL
, /* SIOCSIWNWID */
2070 (iw_handler
) NULL
, /* SIOCGIWNWID */
2071 (iw_handler
) lbs_set_freq
, /* SIOCSIWFREQ */
2072 (iw_handler
) lbs_get_freq
, /* SIOCGIWFREQ */
2073 (iw_handler
) lbs_set_mode
, /* SIOCSIWMODE */
2074 (iw_handler
) lbs_get_mode
, /* SIOCGIWMODE */
2075 (iw_handler
) NULL
, /* SIOCSIWSENS */
2076 (iw_handler
) NULL
, /* SIOCGIWSENS */
2077 (iw_handler
) NULL
, /* SIOCSIWRANGE */
2078 (iw_handler
) lbs_get_range
, /* SIOCGIWRANGE */
2079 (iw_handler
) NULL
, /* SIOCSIWPRIV */
2080 (iw_handler
) NULL
, /* SIOCGIWPRIV */
2081 (iw_handler
) NULL
, /* SIOCSIWSTATS */
2082 (iw_handler
) NULL
, /* SIOCGIWSTATS */
2083 iw_handler_set_spy
, /* SIOCSIWSPY */
2084 iw_handler_get_spy
, /* SIOCGIWSPY */
2085 iw_handler_set_thrspy
, /* SIOCSIWTHRSPY */
2086 iw_handler_get_thrspy
, /* SIOCGIWTHRSPY */
2087 (iw_handler
) lbs_set_wap
, /* SIOCSIWAP */
2088 (iw_handler
) lbs_get_wap
, /* SIOCGIWAP */
2089 (iw_handler
) NULL
, /* SIOCSIWMLME */
2090 (iw_handler
) NULL
, /* SIOCGIWAPLIST - deprecated */
2091 (iw_handler
) lbs_set_scan
, /* SIOCSIWSCAN */
2092 (iw_handler
) lbs_get_scan
, /* SIOCGIWSCAN */
2093 (iw_handler
) lbs_set_essid
, /* SIOCSIWESSID */
2094 (iw_handler
) lbs_get_essid
, /* SIOCGIWESSID */
2095 (iw_handler
) lbs_set_nick
, /* SIOCSIWNICKN */
2096 (iw_handler
) lbs_get_nick
, /* SIOCGIWNICKN */
2097 (iw_handler
) NULL
, /* -- hole -- */
2098 (iw_handler
) NULL
, /* -- hole -- */
2099 (iw_handler
) lbs_set_rate
, /* SIOCSIWRATE */
2100 (iw_handler
) lbs_get_rate
, /* SIOCGIWRATE */
2101 (iw_handler
) lbs_set_rts
, /* SIOCSIWRTS */
2102 (iw_handler
) lbs_get_rts
, /* SIOCGIWRTS */
2103 (iw_handler
) lbs_set_frag
, /* SIOCSIWFRAG */
2104 (iw_handler
) lbs_get_frag
, /* SIOCGIWFRAG */
2105 (iw_handler
) lbs_set_txpow
, /* SIOCSIWTXPOW */
2106 (iw_handler
) lbs_get_txpow
, /* SIOCGIWTXPOW */
2107 (iw_handler
) lbs_set_retry
, /* SIOCSIWRETRY */
2108 (iw_handler
) lbs_get_retry
, /* SIOCGIWRETRY */
2109 (iw_handler
) lbs_set_encode
, /* SIOCSIWENCODE */
2110 (iw_handler
) lbs_get_encode
, /* SIOCGIWENCODE */
2111 (iw_handler
) lbs_set_power
, /* SIOCSIWPOWER */
2112 (iw_handler
) lbs_get_power
, /* SIOCGIWPOWER */
2113 (iw_handler
) NULL
, /* -- hole -- */
2114 (iw_handler
) NULL
, /* -- hole -- */
2115 (iw_handler
) lbs_set_genie
, /* SIOCSIWGENIE */
2116 (iw_handler
) lbs_get_genie
, /* SIOCGIWGENIE */
2117 (iw_handler
) lbs_set_auth
, /* SIOCSIWAUTH */
2118 (iw_handler
) lbs_get_auth
, /* SIOCGIWAUTH */
2119 (iw_handler
) lbs_set_encodeext
,/* SIOCSIWENCODEEXT */
2120 (iw_handler
) lbs_get_encodeext
,/* SIOCGIWENCODEEXT */
2121 (iw_handler
) NULL
, /* SIOCSIWPMKSA */
2124 static const iw_handler mesh_wlan_handler
[] = {
2125 (iw_handler
) NULL
, /* SIOCSIWCOMMIT */
2126 (iw_handler
) lbs_get_name
, /* SIOCGIWNAME */
2127 (iw_handler
) NULL
, /* SIOCSIWNWID */
2128 (iw_handler
) NULL
, /* SIOCGIWNWID */
2129 (iw_handler
) lbs_mesh_set_freq
, /* SIOCSIWFREQ */
2130 (iw_handler
) lbs_get_freq
, /* SIOCGIWFREQ */
2131 (iw_handler
) NULL
, /* SIOCSIWMODE */
2132 (iw_handler
) mesh_wlan_get_mode
, /* SIOCGIWMODE */
2133 (iw_handler
) NULL
, /* SIOCSIWSENS */
2134 (iw_handler
) NULL
, /* SIOCGIWSENS */
2135 (iw_handler
) NULL
, /* SIOCSIWRANGE */
2136 (iw_handler
) lbs_get_range
, /* SIOCGIWRANGE */
2137 (iw_handler
) NULL
, /* SIOCSIWPRIV */
2138 (iw_handler
) NULL
, /* SIOCGIWPRIV */
2139 (iw_handler
) NULL
, /* SIOCSIWSTATS */
2140 (iw_handler
) NULL
, /* SIOCGIWSTATS */
2141 iw_handler_set_spy
, /* SIOCSIWSPY */
2142 iw_handler_get_spy
, /* SIOCGIWSPY */
2143 iw_handler_set_thrspy
, /* SIOCSIWTHRSPY */
2144 iw_handler_get_thrspy
, /* SIOCGIWTHRSPY */
2145 (iw_handler
) NULL
, /* SIOCSIWAP */
2146 (iw_handler
) NULL
, /* SIOCGIWAP */
2147 (iw_handler
) NULL
, /* SIOCSIWMLME */
2148 (iw_handler
) NULL
, /* SIOCGIWAPLIST - deprecated */
2149 (iw_handler
) lbs_set_scan
, /* SIOCSIWSCAN */
2150 (iw_handler
) lbs_get_scan
, /* SIOCGIWSCAN */
2151 (iw_handler
) lbs_mesh_set_essid
,/* SIOCSIWESSID */
2152 (iw_handler
) lbs_mesh_get_essid
,/* SIOCGIWESSID */
2153 (iw_handler
) NULL
, /* SIOCSIWNICKN */
2154 (iw_handler
) mesh_get_nick
, /* SIOCGIWNICKN */
2155 (iw_handler
) NULL
, /* -- hole -- */
2156 (iw_handler
) NULL
, /* -- hole -- */
2157 (iw_handler
) lbs_set_rate
, /* SIOCSIWRATE */
2158 (iw_handler
) lbs_get_rate
, /* SIOCGIWRATE */
2159 (iw_handler
) lbs_set_rts
, /* SIOCSIWRTS */
2160 (iw_handler
) lbs_get_rts
, /* SIOCGIWRTS */
2161 (iw_handler
) lbs_set_frag
, /* SIOCSIWFRAG */
2162 (iw_handler
) lbs_get_frag
, /* SIOCGIWFRAG */
2163 (iw_handler
) lbs_set_txpow
, /* SIOCSIWTXPOW */
2164 (iw_handler
) lbs_get_txpow
, /* SIOCGIWTXPOW */
2165 (iw_handler
) lbs_set_retry
, /* SIOCSIWRETRY */
2166 (iw_handler
) lbs_get_retry
, /* SIOCGIWRETRY */
2167 (iw_handler
) lbs_set_encode
, /* SIOCSIWENCODE */
2168 (iw_handler
) lbs_get_encode
, /* SIOCGIWENCODE */
2169 (iw_handler
) lbs_set_power
, /* SIOCSIWPOWER */
2170 (iw_handler
) lbs_get_power
, /* SIOCGIWPOWER */
2171 (iw_handler
) NULL
, /* -- hole -- */
2172 (iw_handler
) NULL
, /* -- hole -- */
2173 (iw_handler
) lbs_set_genie
, /* SIOCSIWGENIE */
2174 (iw_handler
) lbs_get_genie
, /* SIOCGIWGENIE */
2175 (iw_handler
) lbs_set_auth
, /* SIOCSIWAUTH */
2176 (iw_handler
) lbs_get_auth
, /* SIOCGIWAUTH */
2177 (iw_handler
) lbs_set_encodeext
,/* SIOCSIWENCODEEXT */
2178 (iw_handler
) lbs_get_encodeext
,/* SIOCGIWENCODEEXT */
2179 (iw_handler
) NULL
, /* SIOCSIWPMKSA */
2181 struct iw_handler_def lbs_handler_def
= {
2182 .num_standard
= ARRAY_SIZE(lbs_handler
),
2183 .standard
= (iw_handler
*) lbs_handler
,
2184 .get_wireless_stats
= lbs_get_wireless_stats
,
2187 struct iw_handler_def mesh_handler_def
= {
2188 .num_standard
= ARRAY_SIZE(mesh_wlan_handler
),
2189 .standard
= (iw_handler
*) mesh_wlan_handler
,
2190 .get_wireless_stats
= lbs_get_wireless_stats
,