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 * @brief Find the channel frequency power info with specific channel
27 * @param adapter A pointer to wlan_adapter structure
28 * @param band it can be BAND_A, BAND_G or BAND_B
29 * @param channel the channel for looking
30 * @return A pointer to struct chan_freq_power structure or NULL if not find.
32 struct chan_freq_power
*libertas_find_cfp_by_band_and_channel(wlan_adapter
* adapter
,
35 struct chan_freq_power
*cfp
= NULL
;
36 struct region_channel
*rc
;
37 int count
= sizeof(adapter
->region_channel
) /
38 sizeof(adapter
->region_channel
[0]);
41 for (j
= 0; !cfp
&& (j
< count
); j
++) {
42 rc
= &adapter
->region_channel
[j
];
44 if (adapter
->enable11d
)
45 rc
= &adapter
->universal_channel
[j
];
46 if (!rc
->valid
|| !rc
->CFP
)
50 for (i
= 0; i
< rc
->nrcfp
; i
++) {
51 if (rc
->CFP
[i
].channel
== channel
) {
59 lbs_deb_wext("libertas_find_cfp_by_band_and_channel: can't find "
60 "cfp by band %d / channel %d\n", band
, channel
);
66 * @brief Find the channel frequency power info with specific frequency
68 * @param adapter A pointer to wlan_adapter structure
69 * @param band it can be BAND_A, BAND_G or BAND_B
70 * @param freq the frequency for looking
71 * @return A pointer to struct chan_freq_power structure or NULL if not find.
73 static struct chan_freq_power
*find_cfp_by_band_and_freq(wlan_adapter
* adapter
,
76 struct chan_freq_power
*cfp
= NULL
;
77 struct region_channel
*rc
;
78 int count
= sizeof(adapter
->region_channel
) /
79 sizeof(adapter
->region_channel
[0]);
82 for (j
= 0; !cfp
&& (j
< count
); j
++) {
83 rc
= &adapter
->region_channel
[j
];
85 if (adapter
->enable11d
)
86 rc
= &adapter
->universal_channel
[j
];
87 if (!rc
->valid
|| !rc
->CFP
)
91 for (i
= 0; i
< rc
->nrcfp
; i
++) {
92 if (rc
->CFP
[i
].freq
== freq
) {
100 lbs_deb_wext("find_cfp_by_band_and_freql: can't find cfp by "
101 "band %d / freq %d\n", band
, freq
);
108 * @brief Set Radio On/OFF
110 * @param priv A pointer to wlan_private structure
111 * @option Radio Option
112 * @return 0 --success, otherwise fail
114 static int wlan_radio_ioctl(wlan_private
* priv
, u8 option
)
117 wlan_adapter
*adapter
= priv
->adapter
;
119 lbs_deb_enter(LBS_DEB_WEXT
);
121 if (adapter
->radioon
!= option
) {
122 lbs_deb_wext("switching radio %s\n", option
? "on" : "off");
123 adapter
->radioon
= option
;
125 ret
= libertas_prepare_and_send_command(priv
,
126 CMD_802_11_RADIO_CONTROL
,
128 CMD_OPTION_WAITFORRSP
, 0, NULL
);
131 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
136 * @brief Copy active data rates based on adapter mode and status
138 * @param adapter A pointer to wlan_adapter structure
139 * @param rate The buf to return the active rates
141 static void copy_active_data_rates(wlan_adapter
* adapter
, u8
* rates
)
143 lbs_deb_enter(LBS_DEB_WEXT
);
145 if (adapter
->connect_status
!= LIBERTAS_CONNECTED
)
146 memcpy(rates
, libertas_bg_rates
, MAX_RATES
);
148 memcpy(rates
, adapter
->curbssparams
.rates
, MAX_RATES
);
150 lbs_deb_leave(LBS_DEB_WEXT
);
153 static int wlan_get_name(struct net_device
*dev
, struct iw_request_info
*info
,
154 char *cwrq
, char *extra
)
157 lbs_deb_enter(LBS_DEB_WEXT
);
159 /* We could add support for 802.11n here as needed. Jean II */
160 snprintf(cwrq
, IFNAMSIZ
, "IEEE 802.11b/g");
162 lbs_deb_leave(LBS_DEB_WEXT
);
166 static int wlan_get_freq(struct net_device
*dev
, struct iw_request_info
*info
,
167 struct iw_freq
*fwrq
, char *extra
)
169 wlan_private
*priv
= dev
->priv
;
170 wlan_adapter
*adapter
= priv
->adapter
;
171 struct chan_freq_power
*cfp
;
173 lbs_deb_enter(LBS_DEB_WEXT
);
175 cfp
= libertas_find_cfp_by_band_and_channel(adapter
, 0,
176 adapter
->curbssparams
.channel
);
179 if (adapter
->curbssparams
.channel
)
180 lbs_deb_wext("invalid channel %d\n",
181 adapter
->curbssparams
.channel
);
185 fwrq
->m
= (long)cfp
->freq
* 100000;
188 lbs_deb_wext("freq %u\n", fwrq
->m
);
189 lbs_deb_leave(LBS_DEB_WEXT
);
193 static int wlan_get_wap(struct net_device
*dev
, struct iw_request_info
*info
,
194 struct sockaddr
*awrq
, char *extra
)
196 wlan_private
*priv
= dev
->priv
;
197 wlan_adapter
*adapter
= priv
->adapter
;
199 lbs_deb_enter(LBS_DEB_WEXT
);
201 if (adapter
->connect_status
== LIBERTAS_CONNECTED
) {
202 memcpy(awrq
->sa_data
, adapter
->curbssparams
.bssid
, ETH_ALEN
);
204 memset(awrq
->sa_data
, 0, ETH_ALEN
);
206 awrq
->sa_family
= ARPHRD_ETHER
;
208 lbs_deb_leave(LBS_DEB_WEXT
);
212 static int wlan_set_nick(struct net_device
*dev
, struct iw_request_info
*info
,
213 struct iw_point
*dwrq
, char *extra
)
215 wlan_private
*priv
= dev
->priv
;
216 wlan_adapter
*adapter
= priv
->adapter
;
218 lbs_deb_enter(LBS_DEB_WEXT
);
221 * Check the size of the string
224 if (dwrq
->length
> 16) {
228 mutex_lock(&adapter
->lock
);
229 memset(adapter
->nodename
, 0, sizeof(adapter
->nodename
));
230 memcpy(adapter
->nodename
, extra
, dwrq
->length
);
231 mutex_unlock(&adapter
->lock
);
233 lbs_deb_leave(LBS_DEB_WEXT
);
237 static int wlan_get_nick(struct net_device
*dev
, struct iw_request_info
*info
,
238 struct iw_point
*dwrq
, char *extra
)
241 char comm
[6] = { "COMM-" };
242 char mrvl
[6] = { "MRVL-" };
245 lbs_deb_enter(LBS_DEB_WEXT
);
248 * Nick Name is not used internally in this mode,
249 * therefore return something useful instead. Jean II
254 cp
= strstr(libertas_driver_version
, comm
);
255 if (cp
== libertas_driver_version
) //skip leading "COMM-"
256 cp
= libertas_driver_version
+ strlen(comm
);
258 cp
= libertas_driver_version
;
262 while (cnt
< 16 && (*cp
!= '-')) {
263 *extra
++ = toupper(*cp
++);
272 lbs_deb_leave(LBS_DEB_WEXT
);
276 static int mesh_get_nick(struct net_device
*dev
, struct iw_request_info
*info
,
277 struct iw_point
*dwrq
, char *extra
)
279 wlan_private
*priv
= dev
->priv
;
280 wlan_adapter
*adapter
= priv
->adapter
;
282 lbs_deb_enter(LBS_DEB_WEXT
);
284 /* Use nickname to indicate that mesh is on */
286 if (adapter
->connect_status
== LIBERTAS_CONNECTED
) {
287 strncpy(extra
, "Mesh", 12);
289 dwrq
->length
= strlen(extra
);
297 lbs_deb_leave(LBS_DEB_WEXT
);
300 static int wlan_set_rts(struct net_device
*dev
, struct iw_request_info
*info
,
301 struct iw_param
*vwrq
, char *extra
)
304 wlan_private
*priv
= dev
->priv
;
305 wlan_adapter
*adapter
= priv
->adapter
;
306 u32 rthr
= vwrq
->value
;
308 lbs_deb_enter(LBS_DEB_WEXT
);
310 if (vwrq
->disabled
) {
311 adapter
->rtsthsd
= rthr
= MRVDRV_RTS_MAX_VALUE
;
313 if (rthr
< MRVDRV_RTS_MIN_VALUE
|| rthr
> MRVDRV_RTS_MAX_VALUE
)
315 adapter
->rtsthsd
= rthr
;
318 ret
= libertas_prepare_and_send_command(priv
, CMD_802_11_SNMP_MIB
,
319 CMD_ACT_SET
, CMD_OPTION_WAITFORRSP
,
320 OID_802_11_RTS_THRESHOLD
, &rthr
);
322 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
326 static int wlan_get_rts(struct net_device
*dev
, struct iw_request_info
*info
,
327 struct iw_param
*vwrq
, char *extra
)
330 wlan_private
*priv
= dev
->priv
;
331 wlan_adapter
*adapter
= priv
->adapter
;
333 lbs_deb_enter(LBS_DEB_WEXT
);
335 adapter
->rtsthsd
= 0;
336 ret
= libertas_prepare_and_send_command(priv
, CMD_802_11_SNMP_MIB
,
337 CMD_ACT_GET
, CMD_OPTION_WAITFORRSP
,
338 OID_802_11_RTS_THRESHOLD
, NULL
);
342 vwrq
->value
= adapter
->rtsthsd
;
343 vwrq
->disabled
= ((vwrq
->value
< MRVDRV_RTS_MIN_VALUE
)
344 || (vwrq
->value
> MRVDRV_RTS_MAX_VALUE
));
348 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
352 static int wlan_set_frag(struct net_device
*dev
, struct iw_request_info
*info
,
353 struct iw_param
*vwrq
, char *extra
)
356 u32 fthr
= vwrq
->value
;
357 wlan_private
*priv
= dev
->priv
;
358 wlan_adapter
*adapter
= priv
->adapter
;
360 lbs_deb_enter(LBS_DEB_WEXT
);
362 if (vwrq
->disabled
) {
363 adapter
->fragthsd
= fthr
= MRVDRV_FRAG_MAX_VALUE
;
365 if (fthr
< MRVDRV_FRAG_MIN_VALUE
366 || fthr
> MRVDRV_FRAG_MAX_VALUE
)
368 adapter
->fragthsd
= fthr
;
371 ret
= libertas_prepare_and_send_command(priv
, CMD_802_11_SNMP_MIB
,
372 CMD_ACT_SET
, CMD_OPTION_WAITFORRSP
,
373 OID_802_11_FRAGMENTATION_THRESHOLD
, &fthr
);
375 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
379 static int wlan_get_frag(struct net_device
*dev
, struct iw_request_info
*info
,
380 struct iw_param
*vwrq
, char *extra
)
383 wlan_private
*priv
= dev
->priv
;
384 wlan_adapter
*adapter
= priv
->adapter
;
386 lbs_deb_enter(LBS_DEB_WEXT
);
388 adapter
->fragthsd
= 0;
389 ret
= libertas_prepare_and_send_command(priv
,
391 CMD_ACT_GET
, CMD_OPTION_WAITFORRSP
,
392 OID_802_11_FRAGMENTATION_THRESHOLD
, NULL
);
396 vwrq
->value
= adapter
->fragthsd
;
397 vwrq
->disabled
= ((vwrq
->value
< MRVDRV_FRAG_MIN_VALUE
)
398 || (vwrq
->value
> MRVDRV_FRAG_MAX_VALUE
));
402 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
406 static int wlan_get_mode(struct net_device
*dev
,
407 struct iw_request_info
*info
, u32
* uwrq
, char *extra
)
409 wlan_private
*priv
= dev
->priv
;
410 wlan_adapter
*adapter
= priv
->adapter
;
412 lbs_deb_enter(LBS_DEB_WEXT
);
414 *uwrq
= adapter
->mode
;
416 lbs_deb_leave(LBS_DEB_WEXT
);
420 static int mesh_wlan_get_mode(struct net_device
*dev
,
421 struct iw_request_info
*info
, u32
* uwrq
,
424 lbs_deb_enter(LBS_DEB_WEXT
);
426 *uwrq
= IW_MODE_REPEAT
;
428 lbs_deb_leave(LBS_DEB_WEXT
);
432 static int wlan_get_txpow(struct net_device
*dev
,
433 struct iw_request_info
*info
,
434 struct iw_param
*vwrq
, char *extra
)
437 wlan_private
*priv
= dev
->priv
;
438 wlan_adapter
*adapter
= priv
->adapter
;
440 lbs_deb_enter(LBS_DEB_WEXT
);
442 ret
= libertas_prepare_and_send_command(priv
,
443 CMD_802_11_RF_TX_POWER
,
444 CMD_ACT_TX_POWER_OPT_GET
,
445 CMD_OPTION_WAITFORRSP
, 0, NULL
);
450 lbs_deb_wext("tx power level %d dbm\n", adapter
->txpowerlevel
);
451 vwrq
->value
= adapter
->txpowerlevel
;
453 if (adapter
->radioon
) {
455 vwrq
->flags
= IW_TXPOW_DBM
;
461 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
465 static int wlan_set_retry(struct net_device
*dev
, struct iw_request_info
*info
,
466 struct iw_param
*vwrq
, char *extra
)
469 wlan_private
*priv
= dev
->priv
;
470 wlan_adapter
*adapter
= priv
->adapter
;
472 lbs_deb_enter(LBS_DEB_WEXT
);
474 if (vwrq
->flags
== IW_RETRY_LIMIT
) {
475 /* The MAC has a 4-bit Total_Tx_Count register
476 Total_Tx_Count = 1 + Tx_Retry_Count */
477 #define TX_RETRY_MIN 0
478 #define TX_RETRY_MAX 14
479 if (vwrq
->value
< TX_RETRY_MIN
|| vwrq
->value
> TX_RETRY_MAX
)
482 /* Adding 1 to convert retry count to try count */
483 adapter
->txretrycount
= vwrq
->value
+ 1;
485 ret
= libertas_prepare_and_send_command(priv
, CMD_802_11_SNMP_MIB
,
487 CMD_OPTION_WAITFORRSP
,
488 OID_802_11_TX_RETRYCOUNT
, NULL
);
497 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
501 static int wlan_get_retry(struct net_device
*dev
, struct iw_request_info
*info
,
502 struct iw_param
*vwrq
, char *extra
)
504 wlan_private
*priv
= dev
->priv
;
505 wlan_adapter
*adapter
= priv
->adapter
;
508 lbs_deb_enter(LBS_DEB_WEXT
);
510 adapter
->txretrycount
= 0;
511 ret
= libertas_prepare_and_send_command(priv
,
513 CMD_ACT_GET
, CMD_OPTION_WAITFORRSP
,
514 OID_802_11_TX_RETRYCOUNT
, NULL
);
520 vwrq
->flags
= IW_RETRY_LIMIT
;
521 /* Subtract 1 to convert try count to retry count */
522 vwrq
->value
= adapter
->txretrycount
- 1;
526 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
530 static inline void sort_channels(struct iw_freq
*freq
, int num
)
535 for (i
= 0; i
< num
; i
++)
536 for (j
= i
+ 1; j
< num
; j
++)
537 if (freq
[i
].i
> freq
[j
].i
) {
541 freq
[i
].i
= freq
[j
].i
;
542 freq
[i
].m
= freq
[j
].m
;
552 Infra G(12) A(8) B(4) G(12)
553 Adhoc A+B(12) A(8) B(4) B(4)
561 * @brief Get Range Info
563 * @param dev A pointer to net_device structure
564 * @param info A pointer to iw_request_info structure
565 * @param vwrq A pointer to iw_param structure
566 * @param extra A pointer to extra data buf
567 * @return 0 --success, otherwise fail
569 static int wlan_get_range(struct net_device
*dev
, struct iw_request_info
*info
,
570 struct iw_point
*dwrq
, char *extra
)
573 wlan_private
*priv
= dev
->priv
;
574 wlan_adapter
*adapter
= priv
->adapter
;
575 struct iw_range
*range
= (struct iw_range
*)extra
;
576 struct chan_freq_power
*cfp
;
577 u8 rates
[MAX_RATES
+ 1];
581 lbs_deb_enter(LBS_DEB_WEXT
);
583 dwrq
->length
= sizeof(struct iw_range
);
584 memset(range
, 0, sizeof(struct iw_range
));
589 memset(rates
, 0, sizeof(rates
));
590 copy_active_data_rates(adapter
, rates
);
591 range
->num_bitrates
= strnlen(rates
, IW_MAX_BITRATES
);
592 for (i
= 0; i
< range
->num_bitrates
; i
++)
593 range
->bitrate
[i
] = rates
[i
] * 500000;
594 range
->num_bitrates
= i
;
595 lbs_deb_wext("IW_MAX_BITRATES %d, num_bitrates %d\n", IW_MAX_BITRATES
,
596 range
->num_bitrates
);
598 range
->num_frequency
= 0;
599 if (priv
->adapter
->enable11d
&&
600 adapter
->connect_status
== LIBERTAS_CONNECTED
) {
604 struct parsed_region_chan_11d
*parsed_region_chan
=
605 &adapter
->parsed_region_chan
;
607 if (parsed_region_chan
== NULL
) {
608 lbs_deb_wext("11d: parsed_region_chan is NULL\n");
611 band
= parsed_region_chan
->band
;
612 lbs_deb_wext("band %d, nr_char %d\n", band
,
613 parsed_region_chan
->nr_chan
);
615 for (i
= 0; (range
->num_frequency
< IW_MAX_FREQUENCIES
)
616 && (i
< parsed_region_chan
->nr_chan
); i
++) {
617 chan_no
= parsed_region_chan
->chanpwr
[i
].chan
;
618 lbs_deb_wext("chan_no %d\n", chan_no
);
619 range
->freq
[range
->num_frequency
].i
= (long)chan_no
;
620 range
->freq
[range
->num_frequency
].m
=
621 (long)libertas_chan_2_freq(chan_no
, band
) * 100000;
622 range
->freq
[range
->num_frequency
].e
= 1;
623 range
->num_frequency
++;
628 for (j
= 0; (range
->num_frequency
< IW_MAX_FREQUENCIES
)
629 && (j
< sizeof(adapter
->region_channel
)
630 / sizeof(adapter
->region_channel
[0])); j
++) {
631 cfp
= adapter
->region_channel
[j
].CFP
;
632 for (i
= 0; (range
->num_frequency
< IW_MAX_FREQUENCIES
)
633 && adapter
->region_channel
[j
].valid
635 && (i
< adapter
->region_channel
[j
].nrcfp
); i
++) {
636 range
->freq
[range
->num_frequency
].i
=
638 range
->freq
[range
->num_frequency
].m
=
639 (long)cfp
->freq
* 100000;
640 range
->freq
[range
->num_frequency
].e
= 1;
642 range
->num_frequency
++;
647 lbs_deb_wext("IW_MAX_FREQUENCIES %d, num_frequency %d\n",
648 IW_MAX_FREQUENCIES
, range
->num_frequency
);
650 range
->num_channels
= range
->num_frequency
;
652 sort_channels(&range
->freq
[0], range
->num_frequency
);
655 * Set an indication of the max TCP throughput in bit/s that we can
656 * expect using this interface
659 range
->throughput
= 5000 * 1000;
661 range
->throughput
= 1500 * 1000;
663 range
->min_rts
= MRVDRV_RTS_MIN_VALUE
;
664 range
->max_rts
= MRVDRV_RTS_MAX_VALUE
;
665 range
->min_frag
= MRVDRV_FRAG_MIN_VALUE
;
666 range
->max_frag
= MRVDRV_FRAG_MAX_VALUE
;
668 range
->encoding_size
[0] = 5;
669 range
->encoding_size
[1] = 13;
670 range
->num_encoding_sizes
= 2;
671 range
->max_encoding_tokens
= 4;
673 range
->min_pmp
= 1000000;
674 range
->max_pmp
= 120000000;
675 range
->min_pmt
= 1000;
676 range
->max_pmt
= 1000000;
677 range
->pmp_flags
= IW_POWER_PERIOD
;
678 range
->pmt_flags
= IW_POWER_TIMEOUT
;
679 range
->pm_capa
= IW_POWER_PERIOD
| IW_POWER_TIMEOUT
| IW_POWER_ALL_R
;
682 * Minimum version we recommend
684 range
->we_version_source
= 15;
687 * Version we are compiled with
689 range
->we_version_compiled
= WIRELESS_EXT
;
691 range
->retry_capa
= IW_RETRY_LIMIT
;
692 range
->retry_flags
= IW_RETRY_LIMIT
| IW_RETRY_MAX
;
694 range
->min_retry
= TX_RETRY_MIN
;
695 range
->max_retry
= TX_RETRY_MAX
;
698 * Set the qual, level and noise range values
700 range
->max_qual
.qual
= 100;
701 range
->max_qual
.level
= 0;
702 range
->max_qual
.noise
= 0;
703 range
->max_qual
.updated
= IW_QUAL_ALL_UPDATED
| IW_QUAL_DBM
;
705 range
->avg_qual
.qual
= 70;
706 /* TODO: Find real 'good' to 'bad' threshold value for RSSI */
707 range
->avg_qual
.level
= 0;
708 range
->avg_qual
.noise
= 0;
709 range
->avg_qual
.updated
= IW_QUAL_ALL_UPDATED
| IW_QUAL_DBM
;
711 range
->sensitivity
= 0;
714 * Setup the supported power level ranges
716 memset(range
->txpower
, 0, sizeof(range
->txpower
));
717 range
->txpower
[0] = 5;
718 range
->txpower
[1] = 7;
719 range
->txpower
[2] = 9;
720 range
->txpower
[3] = 11;
721 range
->txpower
[4] = 13;
722 range
->txpower
[5] = 15;
723 range
->txpower
[6] = 17;
724 range
->txpower
[7] = 19;
726 range
->num_txpower
= 8;
727 range
->txpower_capa
= IW_TXPOW_DBM
;
728 range
->txpower_capa
|= IW_TXPOW_RANGE
;
730 range
->event_capa
[0] = (IW_EVENT_CAPA_K_0
|
731 IW_EVENT_CAPA_MASK(SIOCGIWAP
) |
732 IW_EVENT_CAPA_MASK(SIOCGIWSCAN
));
733 range
->event_capa
[1] = IW_EVENT_CAPA_K_1
;
735 if (adapter
->fwcapinfo
& FW_CAPINFO_WPA
) {
736 range
->enc_capa
= IW_ENC_CAPA_WPA
738 | IW_ENC_CAPA_CIPHER_TKIP
739 | IW_ENC_CAPA_CIPHER_CCMP
;
743 lbs_deb_leave(LBS_DEB_WEXT
);
747 static int wlan_set_power(struct net_device
*dev
, struct iw_request_info
*info
,
748 struct iw_param
*vwrq
, char *extra
)
750 wlan_private
*priv
= dev
->priv
;
751 wlan_adapter
*adapter
= priv
->adapter
;
753 lbs_deb_enter(LBS_DEB_WEXT
);
755 /* PS is currently supported only in Infrastructure mode
756 * Remove this check if it is to be supported in IBSS mode also
759 if (vwrq
->disabled
) {
760 adapter
->psmode
= WLAN802_11POWERMODECAM
;
761 if (adapter
->psstate
!= PS_STATE_FULL_POWER
) {
762 libertas_ps_wakeup(priv
, CMD_OPTION_WAITFORRSP
);
768 if ((vwrq
->flags
& IW_POWER_TYPE
) == IW_POWER_TIMEOUT
) {
770 "setting power timeout is not supported\n");
772 } else if ((vwrq
->flags
& IW_POWER_TYPE
) == IW_POWER_PERIOD
) {
773 lbs_deb_wext("setting power period not supported\n");
777 if (adapter
->psmode
!= WLAN802_11POWERMODECAM
) {
781 adapter
->psmode
= WLAN802_11POWERMODEMAX_PSP
;
783 if (adapter
->connect_status
== LIBERTAS_CONNECTED
) {
784 libertas_ps_sleep(priv
, CMD_OPTION_WAITFORRSP
);
787 lbs_deb_leave(LBS_DEB_WEXT
);
791 static int wlan_get_power(struct net_device
*dev
, struct iw_request_info
*info
,
792 struct iw_param
*vwrq
, char *extra
)
794 wlan_private
*priv
= dev
->priv
;
795 wlan_adapter
*adapter
= priv
->adapter
;
798 lbs_deb_enter(LBS_DEB_WEXT
);
800 mode
= adapter
->psmode
;
802 if ((vwrq
->disabled
= (mode
== WLAN802_11POWERMODECAM
))
803 || adapter
->connect_status
== LIBERTAS_DISCONNECTED
)
811 lbs_deb_leave(LBS_DEB_WEXT
);
815 static struct iw_statistics
*wlan_get_wireless_stats(struct net_device
*dev
)
825 wlan_private
*priv
= dev
->priv
;
826 wlan_adapter
*adapter
= priv
->adapter
;
834 lbs_deb_enter(LBS_DEB_WEXT
);
836 priv
->wstats
.status
= adapter
->mode
;
838 /* If we're not associated, all quality values are meaningless */
839 if (adapter
->connect_status
!= LIBERTAS_CONNECTED
)
842 /* Quality by RSSI */
843 priv
->wstats
.qual
.level
=
844 CAL_RSSI(adapter
->SNR
[TYPE_BEACON
][TYPE_NOAVG
],
845 adapter
->NF
[TYPE_BEACON
][TYPE_NOAVG
]);
847 if (adapter
->NF
[TYPE_BEACON
][TYPE_NOAVG
] == 0) {
848 priv
->wstats
.qual
.noise
= MRVDRV_NF_DEFAULT_SCAN_VALUE
;
850 priv
->wstats
.qual
.noise
=
851 CAL_NF(adapter
->NF
[TYPE_BEACON
][TYPE_NOAVG
]);
854 lbs_deb_wext("signal level %#x\n", priv
->wstats
.qual
.level
);
855 lbs_deb_wext("noise %#x\n", priv
->wstats
.qual
.noise
);
857 rssi
= priv
->wstats
.qual
.level
- priv
->wstats
.qual
.noise
;
859 rssi_qual
= rssi
* POOR
/ 10;
861 rssi_qual
= (rssi
- 15) * (FAIR
- POOR
) / 5 + POOR
;
863 rssi_qual
= (rssi
- 20) * (GOOD
- FAIR
) / 5 + FAIR
;
865 rssi_qual
= (rssi
- 30) * (VERY_GOOD
- GOOD
) /
868 rssi_qual
= (rssi
- 40) * (PERFECT
- VERY_GOOD
) /
872 /* Quality by TX errors */
873 priv
->wstats
.discard
.retries
= priv
->stats
.tx_errors
;
875 tx_retries
= le32_to_cpu(adapter
->logmsg
.retry
);
878 tx_qual
= (90 - tx_retries
) * POOR
/ 15;
879 else if (tx_retries
> 70)
880 tx_qual
= (75 - tx_retries
) * (FAIR
- POOR
) / 5 + POOR
;
881 else if (tx_retries
> 65)
882 tx_qual
= (70 - tx_retries
) * (GOOD
- FAIR
) / 5 + FAIR
;
883 else if (tx_retries
> 50)
884 tx_qual
= (65 - tx_retries
) * (VERY_GOOD
- GOOD
) /
887 tx_qual
= (50 - tx_retries
) *
888 (PERFECT
- VERY_GOOD
) / 50 + VERY_GOOD
;
889 quality
= min(quality
, tx_qual
);
891 priv
->wstats
.discard
.code
= le32_to_cpu(adapter
->logmsg
.wepundecryptable
);
892 priv
->wstats
.discard
.fragment
= le32_to_cpu(adapter
->logmsg
.rxfrag
);
893 priv
->wstats
.discard
.retries
= tx_retries
;
894 priv
->wstats
.discard
.misc
= le32_to_cpu(adapter
->logmsg
.ackfailure
);
896 /* Calculate quality */
897 priv
->wstats
.qual
.qual
= min_t(u8
, quality
, 100);
898 priv
->wstats
.qual
.updated
= IW_QUAL_ALL_UPDATED
| IW_QUAL_DBM
;
901 /* update stats asynchronously for future calls */
902 libertas_prepare_and_send_command(priv
, CMD_802_11_RSSI
, 0,
904 libertas_prepare_and_send_command(priv
, CMD_802_11_GET_LOG
, 0,
908 priv
->wstats
.miss
.beacon
= 0;
909 priv
->wstats
.discard
.retries
= 0;
910 priv
->wstats
.qual
.qual
= 0;
911 priv
->wstats
.qual
.level
= 0;
912 priv
->wstats
.qual
.noise
= 0;
913 priv
->wstats
.qual
.updated
= IW_QUAL_ALL_UPDATED
;
914 priv
->wstats
.qual
.updated
|= IW_QUAL_NOISE_INVALID
|
915 IW_QUAL_QUAL_INVALID
| IW_QUAL_LEVEL_INVALID
;
918 lbs_deb_leave(LBS_DEB_WEXT
);
919 return &priv
->wstats
;
924 static int wlan_set_freq(struct net_device
*dev
, struct iw_request_info
*info
,
925 struct iw_freq
*fwrq
, char *extra
)
928 wlan_private
*priv
= dev
->priv
;
929 wlan_adapter
*adapter
= priv
->adapter
;
930 struct chan_freq_power
*cfp
;
931 struct assoc_request
* assoc_req
;
933 lbs_deb_enter(LBS_DEB_WEXT
);
935 mutex_lock(&adapter
->lock
);
936 assoc_req
= wlan_get_association_request(adapter
);
942 /* If setting by frequency, convert to a channel */
944 long f
= fwrq
->m
/ 100000;
946 cfp
= find_cfp_by_band_and_freq(adapter
, 0, f
);
948 lbs_deb_wext("invalid freq %ld\n", f
);
953 fwrq
->m
= (int) cfp
->channel
;
956 /* Setting by channel number */
957 if (fwrq
->m
> 1000 || fwrq
->e
> 0) {
961 cfp
= libertas_find_cfp_by_band_and_channel(adapter
, 0, fwrq
->m
);
966 assoc_req
->channel
= fwrq
->m
;
971 set_bit(ASSOC_FLAG_CHANNEL
, &assoc_req
->flags
);
972 wlan_postpone_association_work(priv
);
974 wlan_cancel_association_work(priv
);
976 mutex_unlock(&adapter
->lock
);
978 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
982 static int wlan_set_rate(struct net_device
*dev
, struct iw_request_info
*info
,
983 struct iw_param
*vwrq
, char *extra
)
985 wlan_private
*priv
= dev
->priv
;
986 wlan_adapter
*adapter
= priv
->adapter
;
990 u8 rates
[MAX_RATES
+ 1];
992 lbs_deb_enter(LBS_DEB_WEXT
);
993 lbs_deb_wext("vwrq->value %d\n", vwrq
->value
);
996 if (vwrq
->value
== -1) {
997 action
= CMD_ACT_SET_TX_AUTO
;
998 adapter
->auto_rate
= 1;
999 adapter
->cur_rate
= 0;
1001 if (vwrq
->value
% 100000)
1004 memset(rates
, 0, sizeof(rates
));
1005 copy_active_data_rates(adapter
, rates
);
1006 new_rate
= vwrq
->value
/ 500000;
1007 if (!memchr(rates
, new_rate
, sizeof(rates
))) {
1008 lbs_pr_alert("fixed data rate 0x%X out of range\n",
1013 adapter
->cur_rate
= new_rate
;
1014 action
= CMD_ACT_SET_TX_FIX_RATE
;
1015 adapter
->auto_rate
= 0;
1018 ret
= libertas_prepare_and_send_command(priv
, CMD_802_11_DATA_RATE
,
1019 action
, CMD_OPTION_WAITFORRSP
, 0, NULL
);
1022 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1026 static int wlan_get_rate(struct net_device
*dev
, struct iw_request_info
*info
,
1027 struct iw_param
*vwrq
, char *extra
)
1029 wlan_private
*priv
= dev
->priv
;
1030 wlan_adapter
*adapter
= priv
->adapter
;
1032 lbs_deb_enter(LBS_DEB_WEXT
);
1034 if (adapter
->connect_status
== LIBERTAS_CONNECTED
) {
1035 vwrq
->value
= adapter
->cur_rate
* 500000;
1037 if (adapter
->auto_rate
)
1047 lbs_deb_leave(LBS_DEB_WEXT
);
1051 static int wlan_set_mode(struct net_device
*dev
,
1052 struct iw_request_info
*info
, u32
* uwrq
, char *extra
)
1055 wlan_private
*priv
= dev
->priv
;
1056 wlan_adapter
*adapter
= priv
->adapter
;
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(&adapter
->lock
);
1070 assoc_req
= wlan_get_association_request(adapter
);
1073 wlan_cancel_association_work(priv
);
1075 assoc_req
->mode
= *uwrq
;
1076 set_bit(ASSOC_FLAG_MODE
, &assoc_req
->flags
);
1077 wlan_postpone_association_work(priv
);
1078 lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq
);
1080 mutex_unlock(&adapter
->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 wlan_get_encode(struct net_device
*dev
,
1098 struct iw_request_info
*info
,
1099 struct iw_point
*dwrq
, u8
* extra
)
1101 wlan_private
*priv
= dev
->priv
;
1102 wlan_adapter
*adapter
= priv
->adapter
;
1103 int index
= (dwrq
->flags
& IW_ENCODE_INDEX
) - 1;
1105 lbs_deb_enter(LBS_DEB_WEXT
);
1107 lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n",
1108 dwrq
->flags
, index
, dwrq
->length
, adapter
->wep_tx_keyidx
);
1112 /* Authentication method */
1113 switch (adapter
->secinfo
.auth_mode
) {
1114 case IW_AUTH_ALG_OPEN_SYSTEM
:
1115 dwrq
->flags
= IW_ENCODE_OPEN
;
1118 case IW_AUTH_ALG_SHARED_KEY
:
1119 case IW_AUTH_ALG_LEAP
:
1120 dwrq
->flags
= IW_ENCODE_RESTRICTED
;
1123 dwrq
->flags
= IW_ENCODE_DISABLED
| IW_ENCODE_OPEN
;
1127 if ( adapter
->secinfo
.wep_enabled
1128 || adapter
->secinfo
.WPAenabled
1129 || adapter
->secinfo
.WPA2enabled
) {
1130 dwrq
->flags
&= ~IW_ENCODE_DISABLED
;
1132 dwrq
->flags
|= IW_ENCODE_DISABLED
;
1135 memset(extra
, 0, 16);
1137 mutex_lock(&adapter
->lock
);
1139 /* Default to returning current transmit key */
1141 index
= adapter
->wep_tx_keyidx
;
1143 if ((adapter
->wep_keys
[index
].len
) && adapter
->secinfo
.wep_enabled
) {
1144 memcpy(extra
, adapter
->wep_keys
[index
].key
,
1145 adapter
->wep_keys
[index
].len
);
1146 dwrq
->length
= adapter
->wep_keys
[index
].len
;
1148 dwrq
->flags
|= (index
+ 1);
1149 /* Return WEP enabled */
1150 dwrq
->flags
&= ~IW_ENCODE_DISABLED
;
1151 } else if ((adapter
->secinfo
.WPAenabled
)
1152 || (adapter
->secinfo
.WPA2enabled
)) {
1153 /* return WPA enabled */
1154 dwrq
->flags
&= ~IW_ENCODE_DISABLED
;
1156 dwrq
->flags
|= IW_ENCODE_DISABLED
;
1159 mutex_unlock(&adapter
->lock
);
1161 dwrq
->flags
|= IW_ENCODE_NOKEY
;
1163 lbs_deb_wext("key: %02x:%02x:%02x:%02x:%02x:%02x, keylen %d\n",
1164 extra
[0], extra
[1], extra
[2],
1165 extra
[3], extra
[4], extra
[5], dwrq
->length
);
1167 lbs_deb_wext("return flags 0x%x\n", dwrq
->flags
);
1169 lbs_deb_leave(LBS_DEB_WEXT
);
1174 * @brief Set Encryption key (internal)
1176 * @param priv A pointer to private card structure
1177 * @param key_material A pointer to key material
1178 * @param key_length length of key material
1179 * @param index key index to set
1180 * @param set_tx_key Force set TX key (1 = yes, 0 = no)
1181 * @return 0 --success, otherwise fail
1183 static int wlan_set_wep_key(struct assoc_request
*assoc_req
,
1184 const char *key_material
,
1190 struct enc_key
*pkey
;
1192 lbs_deb_enter(LBS_DEB_WEXT
);
1194 /* Paranoid validation of key index */
1200 /* validate max key length */
1201 if (key_length
> KEY_LEN_WEP_104
) {
1206 pkey
= &assoc_req
->wep_keys
[index
];
1208 if (key_length
> 0) {
1209 memset(pkey
, 0, sizeof(struct enc_key
));
1210 pkey
->type
= KEY_TYPE_ID_WEP
;
1212 /* Standardize the key length */
1213 pkey
->len
= (key_length
> KEY_LEN_WEP_40
) ?
1214 KEY_LEN_WEP_104
: KEY_LEN_WEP_40
;
1215 memcpy(pkey
->key
, key_material
, key_length
);
1219 /* Ensure the chosen key is valid */
1221 lbs_deb_wext("key not set, so cannot enable it\n");
1225 assoc_req
->wep_tx_keyidx
= index
;
1228 assoc_req
->secinfo
.wep_enabled
= 1;
1231 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1235 static int validate_key_index(u16 def_index
, u16 raw_index
,
1236 u16
*out_index
, u16
*is_default
)
1238 if (!out_index
|| !is_default
)
1241 /* Verify index if present, otherwise use default TX key index */
1242 if (raw_index
> 0) {
1245 *out_index
= raw_index
- 1;
1247 *out_index
= def_index
;
1253 static void disable_wep(struct assoc_request
*assoc_req
)
1257 lbs_deb_enter(LBS_DEB_WEXT
);
1259 /* Set Open System auth mode */
1260 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1262 /* Clear WEP keys and mark WEP as disabled */
1263 assoc_req
->secinfo
.wep_enabled
= 0;
1264 for (i
= 0; i
< 4; i
++)
1265 assoc_req
->wep_keys
[i
].len
= 0;
1267 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1268 set_bit(ASSOC_FLAG_WEP_KEYS
, &assoc_req
->flags
);
1270 lbs_deb_leave(LBS_DEB_WEXT
);
1273 static void disable_wpa(struct assoc_request
*assoc_req
)
1275 lbs_deb_enter(LBS_DEB_WEXT
);
1277 memset(&assoc_req
->wpa_mcast_key
, 0, sizeof (struct enc_key
));
1278 assoc_req
->wpa_mcast_key
.flags
= KEY_INFO_WPA_MCAST
;
1279 set_bit(ASSOC_FLAG_WPA_MCAST_KEY
, &assoc_req
->flags
);
1281 memset(&assoc_req
->wpa_unicast_key
, 0, sizeof (struct enc_key
));
1282 assoc_req
->wpa_unicast_key
.flags
= KEY_INFO_WPA_UNICAST
;
1283 set_bit(ASSOC_FLAG_WPA_UCAST_KEY
, &assoc_req
->flags
);
1285 assoc_req
->secinfo
.WPAenabled
= 0;
1286 assoc_req
->secinfo
.WPA2enabled
= 0;
1287 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1289 lbs_deb_leave(LBS_DEB_WEXT
);
1293 * @brief Set Encryption key
1295 * @param dev A pointer to net_device structure
1296 * @param info A pointer to iw_request_info structure
1297 * @param vwrq A pointer to iw_param structure
1298 * @param extra A pointer to extra data buf
1299 * @return 0 --success, otherwise fail
1301 static int wlan_set_encode(struct net_device
*dev
,
1302 struct iw_request_info
*info
,
1303 struct iw_point
*dwrq
, char *extra
)
1306 wlan_private
*priv
= dev
->priv
;
1307 wlan_adapter
*adapter
= priv
->adapter
;
1308 struct assoc_request
* assoc_req
;
1309 u16 is_default
= 0, index
= 0, set_tx_key
= 0;
1311 lbs_deb_enter(LBS_DEB_WEXT
);
1313 mutex_lock(&adapter
->lock
);
1314 assoc_req
= wlan_get_association_request(adapter
);
1320 if (dwrq
->flags
& IW_ENCODE_DISABLED
) {
1321 disable_wep (assoc_req
);
1322 disable_wpa (assoc_req
);
1326 ret
= validate_key_index(assoc_req
->wep_tx_keyidx
,
1327 (dwrq
->flags
& IW_ENCODE_INDEX
),
1328 &index
, &is_default
);
1334 /* If WEP isn't enabled, or if there is no key data but a valid
1335 * index, set the TX key.
1337 if (!assoc_req
->secinfo
.wep_enabled
|| (dwrq
->length
== 0 && !is_default
))
1340 ret
= wlan_set_wep_key(assoc_req
, extra
, dwrq
->length
, index
, set_tx_key
);
1345 set_bit(ASSOC_FLAG_WEP_KEYS
, &assoc_req
->flags
);
1347 set_bit(ASSOC_FLAG_WEP_TX_KEYIDX
, &assoc_req
->flags
);
1349 if (dwrq
->flags
& IW_ENCODE_RESTRICTED
) {
1350 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_SHARED_KEY
;
1351 } else if (dwrq
->flags
& IW_ENCODE_OPEN
) {
1352 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1357 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1358 wlan_postpone_association_work(priv
);
1360 wlan_cancel_association_work(priv
);
1362 mutex_unlock(&adapter
->lock
);
1364 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1369 * @brief Get Extended Encryption key (WPA/802.1x and WEP)
1371 * @param dev A pointer to net_device structure
1372 * @param info A pointer to iw_request_info structure
1373 * @param vwrq A pointer to iw_param structure
1374 * @param extra A pointer to extra data buf
1375 * @return 0 on success, otherwise failure
1377 static int wlan_get_encodeext(struct net_device
*dev
,
1378 struct iw_request_info
*info
,
1379 struct iw_point
*dwrq
,
1383 wlan_private
*priv
= dev
->priv
;
1384 wlan_adapter
*adapter
= priv
->adapter
;
1385 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*)extra
;
1386 int index
, max_key_len
;
1388 lbs_deb_enter(LBS_DEB_WEXT
);
1390 max_key_len
= dwrq
->length
- sizeof(*ext
);
1391 if (max_key_len
< 0)
1394 index
= dwrq
->flags
& IW_ENCODE_INDEX
;
1396 if (index
< 1 || index
> 4)
1400 index
= adapter
->wep_tx_keyidx
;
1403 if (!ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
&&
1404 ext
->alg
!= IW_ENCODE_ALG_WEP
) {
1405 if (index
!= 0 || adapter
->mode
!= IW_MODE_INFRA
)
1409 dwrq
->flags
= index
+ 1;
1410 memset(ext
, 0, sizeof(*ext
));
1412 if ( !adapter
->secinfo
.wep_enabled
1413 && !adapter
->secinfo
.WPAenabled
1414 && !adapter
->secinfo
.WPA2enabled
) {
1415 ext
->alg
= IW_ENCODE_ALG_NONE
;
1417 dwrq
->flags
|= IW_ENCODE_DISABLED
;
1421 if ( adapter
->secinfo
.wep_enabled
1422 && !adapter
->secinfo
.WPAenabled
1423 && !adapter
->secinfo
.WPA2enabled
) {
1425 ext
->alg
= IW_ENCODE_ALG_WEP
;
1426 ext
->key_len
= adapter
->wep_keys
[index
].len
;
1427 key
= &adapter
->wep_keys
[index
].key
[0];
1428 } else if ( !adapter
->secinfo
.wep_enabled
1429 && (adapter
->secinfo
.WPAenabled
||
1430 adapter
->secinfo
.WPA2enabled
)) {
1432 struct enc_key
* pkey
= NULL
;
1434 if ( adapter
->wpa_mcast_key
.len
1435 && (adapter
->wpa_mcast_key
.flags
& KEY_INFO_WPA_ENABLED
))
1436 pkey
= &adapter
->wpa_mcast_key
;
1437 else if ( adapter
->wpa_unicast_key
.len
1438 && (adapter
->wpa_unicast_key
.flags
& KEY_INFO_WPA_ENABLED
))
1439 pkey
= &adapter
->wpa_unicast_key
;
1442 if (pkey
->type
== KEY_TYPE_ID_AES
) {
1443 ext
->alg
= IW_ENCODE_ALG_CCMP
;
1445 ext
->alg
= IW_ENCODE_ALG_TKIP
;
1447 ext
->key_len
= pkey
->len
;
1448 key
= &pkey
->key
[0];
1450 ext
->alg
= IW_ENCODE_ALG_TKIP
;
1457 if (ext
->key_len
> max_key_len
) {
1463 memcpy(ext
->key
, key
, ext
->key_len
);
1465 dwrq
->flags
|= IW_ENCODE_NOKEY
;
1466 dwrq
->flags
|= IW_ENCODE_ENABLED
;
1471 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1476 * @brief Set Encryption key Extended (WPA/802.1x and WEP)
1478 * @param dev A pointer to net_device structure
1479 * @param info A pointer to iw_request_info structure
1480 * @param vwrq A pointer to iw_param structure
1481 * @param extra A pointer to extra data buf
1482 * @return 0 --success, otherwise fail
1484 static int wlan_set_encodeext(struct net_device
*dev
,
1485 struct iw_request_info
*info
,
1486 struct iw_point
*dwrq
,
1490 wlan_private
*priv
= dev
->priv
;
1491 wlan_adapter
*adapter
= priv
->adapter
;
1492 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*)extra
;
1494 struct assoc_request
* assoc_req
;
1496 lbs_deb_enter(LBS_DEB_WEXT
);
1498 mutex_lock(&adapter
->lock
);
1499 assoc_req
= wlan_get_association_request(adapter
);
1505 if ((alg
== IW_ENCODE_ALG_NONE
) || (dwrq
->flags
& IW_ENCODE_DISABLED
)) {
1506 disable_wep (assoc_req
);
1507 disable_wpa (assoc_req
);
1508 } else if (alg
== IW_ENCODE_ALG_WEP
) {
1509 u16 is_default
= 0, index
, set_tx_key
= 0;
1511 ret
= validate_key_index(assoc_req
->wep_tx_keyidx
,
1512 (dwrq
->flags
& IW_ENCODE_INDEX
),
1513 &index
, &is_default
);
1517 /* If WEP isn't enabled, or if there is no key data but a valid
1518 * index, or if the set-TX-key flag was passed, set the TX key.
1520 if ( !assoc_req
->secinfo
.wep_enabled
1521 || (dwrq
->length
== 0 && !is_default
)
1522 || (ext
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
))
1525 /* Copy key to driver */
1526 ret
= wlan_set_wep_key (assoc_req
, ext
->key
, ext
->key_len
, index
,
1531 if (dwrq
->flags
& IW_ENCODE_RESTRICTED
) {
1532 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_SHARED_KEY
;
1533 } else if (dwrq
->flags
& IW_ENCODE_OPEN
) {
1534 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1537 /* Mark the various WEP bits as modified */
1538 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1540 set_bit(ASSOC_FLAG_WEP_KEYS
, &assoc_req
->flags
);
1542 set_bit(ASSOC_FLAG_WEP_TX_KEYIDX
, &assoc_req
->flags
);
1543 } else if ((alg
== IW_ENCODE_ALG_TKIP
) || (alg
== IW_ENCODE_ALG_CCMP
)) {
1544 struct enc_key
* pkey
;
1546 /* validate key length */
1547 if (((alg
== IW_ENCODE_ALG_TKIP
)
1548 && (ext
->key_len
!= KEY_LEN_WPA_TKIP
))
1549 || ((alg
== IW_ENCODE_ALG_CCMP
)
1550 && (ext
->key_len
!= KEY_LEN_WPA_AES
))) {
1551 lbs_deb_wext("invalid size %d for key of alg"
1559 if (ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
) {
1560 pkey
= &assoc_req
->wpa_mcast_key
;
1561 set_bit(ASSOC_FLAG_WPA_MCAST_KEY
, &assoc_req
->flags
);
1563 pkey
= &assoc_req
->wpa_unicast_key
;
1564 set_bit(ASSOC_FLAG_WPA_UCAST_KEY
, &assoc_req
->flags
);
1567 memset(pkey
, 0, sizeof (struct enc_key
));
1568 memcpy(pkey
->key
, ext
->key
, ext
->key_len
);
1569 pkey
->len
= ext
->key_len
;
1571 pkey
->flags
|= KEY_INFO_WPA_ENABLED
;
1573 /* Do this after zeroing key structure */
1574 if (ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
) {
1575 pkey
->flags
|= KEY_INFO_WPA_MCAST
;
1577 pkey
->flags
|= KEY_INFO_WPA_UNICAST
;
1580 if (alg
== IW_ENCODE_ALG_TKIP
) {
1581 pkey
->type
= KEY_TYPE_ID_TKIP
;
1582 } else if (alg
== IW_ENCODE_ALG_CCMP
) {
1583 pkey
->type
= KEY_TYPE_ID_AES
;
1586 /* If WPA isn't enabled yet, do that now */
1587 if ( assoc_req
->secinfo
.WPAenabled
== 0
1588 && assoc_req
->secinfo
.WPA2enabled
== 0) {
1589 assoc_req
->secinfo
.WPAenabled
= 1;
1590 assoc_req
->secinfo
.WPA2enabled
= 1;
1591 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1594 disable_wep (assoc_req
);
1599 wlan_postpone_association_work(priv
);
1601 wlan_cancel_association_work(priv
);
1603 mutex_unlock(&adapter
->lock
);
1605 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1610 static int wlan_set_genie(struct net_device
*dev
,
1611 struct iw_request_info
*info
,
1612 struct iw_point
*dwrq
,
1615 wlan_private
*priv
= dev
->priv
;
1616 wlan_adapter
*adapter
= priv
->adapter
;
1618 struct assoc_request
* assoc_req
;
1620 lbs_deb_enter(LBS_DEB_WEXT
);
1622 mutex_lock(&adapter
->lock
);
1623 assoc_req
= wlan_get_association_request(adapter
);
1629 if (dwrq
->length
> MAX_WPA_IE_LEN
||
1630 (dwrq
->length
&& extra
== NULL
)) {
1636 memcpy(&assoc_req
->wpa_ie
[0], extra
, dwrq
->length
);
1637 assoc_req
->wpa_ie_len
= dwrq
->length
;
1639 memset(&assoc_req
->wpa_ie
[0], 0, sizeof(adapter
->wpa_ie
));
1640 assoc_req
->wpa_ie_len
= 0;
1645 set_bit(ASSOC_FLAG_WPA_IE
, &assoc_req
->flags
);
1646 wlan_postpone_association_work(priv
);
1648 wlan_cancel_association_work(priv
);
1650 mutex_unlock(&adapter
->lock
);
1652 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1656 static int wlan_get_genie(struct net_device
*dev
,
1657 struct iw_request_info
*info
,
1658 struct iw_point
*dwrq
,
1662 wlan_private
*priv
= dev
->priv
;
1663 wlan_adapter
*adapter
= priv
->adapter
;
1665 lbs_deb_enter(LBS_DEB_WEXT
);
1667 if (adapter
->wpa_ie_len
== 0) {
1672 if (dwrq
->length
< adapter
->wpa_ie_len
) {
1677 dwrq
->length
= adapter
->wpa_ie_len
;
1678 memcpy(extra
, &adapter
->wpa_ie
[0], adapter
->wpa_ie_len
);
1681 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1686 static int wlan_set_auth(struct net_device
*dev
,
1687 struct iw_request_info
*info
,
1688 struct iw_param
*dwrq
,
1691 wlan_private
*priv
= dev
->priv
;
1692 wlan_adapter
*adapter
= priv
->adapter
;
1693 struct assoc_request
* assoc_req
;
1697 lbs_deb_enter(LBS_DEB_WEXT
);
1699 mutex_lock(&adapter
->lock
);
1700 assoc_req
= wlan_get_association_request(adapter
);
1706 switch (dwrq
->flags
& IW_AUTH_INDEX
) {
1707 case IW_AUTH_TKIP_COUNTERMEASURES
:
1708 case IW_AUTH_CIPHER_PAIRWISE
:
1709 case IW_AUTH_CIPHER_GROUP
:
1710 case IW_AUTH_KEY_MGMT
:
1711 case IW_AUTH_DROP_UNENCRYPTED
:
1713 * libertas does not use these parameters
1717 case IW_AUTH_WPA_VERSION
:
1718 if (dwrq
->value
& IW_AUTH_WPA_VERSION_DISABLED
) {
1719 assoc_req
->secinfo
.WPAenabled
= 0;
1720 assoc_req
->secinfo
.WPA2enabled
= 0;
1721 disable_wpa (assoc_req
);
1723 if (dwrq
->value
& IW_AUTH_WPA_VERSION_WPA
) {
1724 assoc_req
->secinfo
.WPAenabled
= 1;
1725 assoc_req
->secinfo
.wep_enabled
= 0;
1726 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1728 if (dwrq
->value
& IW_AUTH_WPA_VERSION_WPA2
) {
1729 assoc_req
->secinfo
.WPA2enabled
= 1;
1730 assoc_req
->secinfo
.wep_enabled
= 0;
1731 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1736 case IW_AUTH_80211_AUTH_ALG
:
1737 if (dwrq
->value
& IW_AUTH_ALG_SHARED_KEY
) {
1738 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_SHARED_KEY
;
1739 } else if (dwrq
->value
& IW_AUTH_ALG_OPEN_SYSTEM
) {
1740 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1741 } else if (dwrq
->value
& IW_AUTH_ALG_LEAP
) {
1742 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_LEAP
;
1749 case IW_AUTH_WPA_ENABLED
:
1751 if (!assoc_req
->secinfo
.WPAenabled
&&
1752 !assoc_req
->secinfo
.WPA2enabled
) {
1753 assoc_req
->secinfo
.WPAenabled
= 1;
1754 assoc_req
->secinfo
.WPA2enabled
= 1;
1755 assoc_req
->secinfo
.wep_enabled
= 0;
1756 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1759 assoc_req
->secinfo
.WPAenabled
= 0;
1760 assoc_req
->secinfo
.WPA2enabled
= 0;
1761 disable_wpa (assoc_req
);
1774 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1775 wlan_postpone_association_work(priv
);
1776 } else if (ret
!= -EOPNOTSUPP
) {
1777 wlan_cancel_association_work(priv
);
1779 mutex_unlock(&adapter
->lock
);
1781 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1785 static int wlan_get_auth(struct net_device
*dev
,
1786 struct iw_request_info
*info
,
1787 struct iw_param
*dwrq
,
1791 wlan_private
*priv
= dev
->priv
;
1792 wlan_adapter
*adapter
= priv
->adapter
;
1794 lbs_deb_enter(LBS_DEB_WEXT
);
1796 switch (dwrq
->flags
& IW_AUTH_INDEX
) {
1797 case IW_AUTH_WPA_VERSION
:
1799 if (adapter
->secinfo
.WPAenabled
)
1800 dwrq
->value
|= IW_AUTH_WPA_VERSION_WPA
;
1801 if (adapter
->secinfo
.WPA2enabled
)
1802 dwrq
->value
|= IW_AUTH_WPA_VERSION_WPA2
;
1804 dwrq
->value
|= IW_AUTH_WPA_VERSION_DISABLED
;
1807 case IW_AUTH_80211_AUTH_ALG
:
1808 dwrq
->value
= adapter
->secinfo
.auth_mode
;
1811 case IW_AUTH_WPA_ENABLED
:
1812 if (adapter
->secinfo
.WPAenabled
&& adapter
->secinfo
.WPA2enabled
)
1820 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1825 static int wlan_set_txpow(struct net_device
*dev
, struct iw_request_info
*info
,
1826 struct iw_param
*vwrq
, char *extra
)
1829 wlan_private
*priv
= dev
->priv
;
1830 wlan_adapter
*adapter
= priv
->adapter
;
1834 lbs_deb_enter(LBS_DEB_WEXT
);
1836 if (vwrq
->disabled
) {
1837 wlan_radio_ioctl(priv
, RADIO_OFF
);
1841 adapter
->preamble
= CMD_TYPE_AUTO_PREAMBLE
;
1843 wlan_radio_ioctl(priv
, RADIO_ON
);
1845 /* Userspace check in iwrange if it should use dBm or mW,
1846 * therefore this should never happen... Jean II */
1847 if ((vwrq
->flags
& IW_TXPOW_TYPE
) == IW_TXPOW_MWATT
) {
1850 dbm
= (u16
) vwrq
->value
;
1852 /* auto tx power control */
1854 if (vwrq
->fixed
== 0)
1857 lbs_deb_wext("txpower set %d dbm\n", dbm
);
1859 ret
= libertas_prepare_and_send_command(priv
,
1860 CMD_802_11_RF_TX_POWER
,
1861 CMD_ACT_TX_POWER_OPT_SET_LOW
,
1862 CMD_OPTION_WAITFORRSP
, 0, (void *)&dbm
);
1864 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1868 static int wlan_get_essid(struct net_device
*dev
, struct iw_request_info
*info
,
1869 struct iw_point
*dwrq
, char *extra
)
1871 wlan_private
*priv
= dev
->priv
;
1872 wlan_adapter
*adapter
= priv
->adapter
;
1874 lbs_deb_enter(LBS_DEB_WEXT
);
1877 * Note : if dwrq->flags != 0, we should get the relevant SSID from
1882 * Get the current SSID
1884 if (adapter
->connect_status
== LIBERTAS_CONNECTED
) {
1885 memcpy(extra
, adapter
->curbssparams
.ssid
,
1886 adapter
->curbssparams
.ssid_len
);
1887 extra
[adapter
->curbssparams
.ssid_len
] = '\0';
1889 memset(extra
, 0, 32);
1890 extra
[adapter
->curbssparams
.ssid_len
] = '\0';
1893 * If none, we may want to get the one that was set
1896 dwrq
->length
= adapter
->curbssparams
.ssid_len
;
1898 dwrq
->flags
= 1; /* active */
1900 lbs_deb_leave(LBS_DEB_WEXT
);
1904 static int wlan_set_essid(struct net_device
*dev
, struct iw_request_info
*info
,
1905 struct iw_point
*dwrq
, char *extra
)
1907 wlan_private
*priv
= dev
->priv
;
1908 wlan_adapter
*adapter
= priv
->adapter
;
1910 u8 ssid
[IW_ESSID_MAX_SIZE
];
1912 struct assoc_request
* assoc_req
;
1913 int in_ssid_len
= dwrq
->length
;
1915 lbs_deb_enter(LBS_DEB_WEXT
);
1917 /* Check the size of the string */
1918 if (in_ssid_len
> IW_ESSID_MAX_SIZE
) {
1923 memset(&ssid
, 0, sizeof(ssid
));
1925 if (!dwrq
->flags
|| !in_ssid_len
) {
1926 /* "any" SSID requested; leave SSID blank */
1928 /* Specific SSID requested */
1929 memcpy(&ssid
, extra
, in_ssid_len
);
1930 ssid_len
= in_ssid_len
;
1934 lbs_deb_wext("requested any SSID\n");
1936 lbs_deb_wext("requested SSID '%s'\n",
1937 escape_essid(ssid
, ssid_len
));
1941 mutex_lock(&adapter
->lock
);
1943 /* Get or create the current association request */
1944 assoc_req
= wlan_get_association_request(adapter
);
1948 /* Copy the SSID to the association request */
1949 memcpy(&assoc_req
->ssid
, &ssid
, IW_ESSID_MAX_SIZE
);
1950 assoc_req
->ssid_len
= ssid_len
;
1951 set_bit(ASSOC_FLAG_SSID
, &assoc_req
->flags
);
1952 wlan_postpone_association_work(priv
);
1956 /* Cancel the association request if there was an error */
1958 wlan_cancel_association_work(priv
);
1961 mutex_unlock(&adapter
->lock
);
1963 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1968 * @brief Connect to the AP or Ad-hoc Network with specific bssid
1970 * @param dev A pointer to net_device structure
1971 * @param info A pointer to iw_request_info structure
1972 * @param awrq A pointer to iw_param structure
1973 * @param extra A pointer to extra data buf
1974 * @return 0 --success, otherwise fail
1976 static int wlan_set_wap(struct net_device
*dev
, struct iw_request_info
*info
,
1977 struct sockaddr
*awrq
, char *extra
)
1979 wlan_private
*priv
= dev
->priv
;
1980 wlan_adapter
*adapter
= priv
->adapter
;
1981 struct assoc_request
* assoc_req
;
1983 DECLARE_MAC_BUF(mac
);
1985 lbs_deb_enter(LBS_DEB_WEXT
);
1987 if (awrq
->sa_family
!= ARPHRD_ETHER
)
1990 lbs_deb_wext("ASSOC: WAP: sa_data %s\n", print_mac(mac
, awrq
->sa_data
));
1992 mutex_lock(&adapter
->lock
);
1994 /* Get or create the current association request */
1995 assoc_req
= wlan_get_association_request(adapter
);
1997 wlan_cancel_association_work(priv
);
2000 /* Copy the BSSID to the association request */
2001 memcpy(&assoc_req
->bssid
, awrq
->sa_data
, ETH_ALEN
);
2002 set_bit(ASSOC_FLAG_BSSID
, &assoc_req
->flags
);
2003 wlan_postpone_association_work(priv
);
2006 mutex_unlock(&adapter
->lock
);
2011 void libertas_get_fwversion(wlan_adapter
* adapter
, char *fwversion
, int maxlen
)
2015 mutex_lock(&adapter
->lock
);
2017 if (adapter
->fwreleasenumber
[3] == 0)
2018 sprintf(fwver
, "%u.%u.%u",
2019 adapter
->fwreleasenumber
[2],
2020 adapter
->fwreleasenumber
[1],
2021 adapter
->fwreleasenumber
[0]);
2023 sprintf(fwver
, "%u.%u.%u.p%u",
2024 adapter
->fwreleasenumber
[2],
2025 adapter
->fwreleasenumber
[1],
2026 adapter
->fwreleasenumber
[0],
2027 adapter
->fwreleasenumber
[3]);
2029 mutex_unlock(&adapter
->lock
);
2030 snprintf(fwversion
, maxlen
, fwver
);
2035 * iwconfig settable callbacks
2037 static const iw_handler wlan_handler
[] = {
2038 (iw_handler
) NULL
, /* SIOCSIWCOMMIT */
2039 (iw_handler
) wlan_get_name
, /* SIOCGIWNAME */
2040 (iw_handler
) NULL
, /* SIOCSIWNWID */
2041 (iw_handler
) NULL
, /* SIOCGIWNWID */
2042 (iw_handler
) wlan_set_freq
, /* SIOCSIWFREQ */
2043 (iw_handler
) wlan_get_freq
, /* SIOCGIWFREQ */
2044 (iw_handler
) wlan_set_mode
, /* SIOCSIWMODE */
2045 (iw_handler
) wlan_get_mode
, /* SIOCGIWMODE */
2046 (iw_handler
) NULL
, /* SIOCSIWSENS */
2047 (iw_handler
) NULL
, /* SIOCGIWSENS */
2048 (iw_handler
) NULL
, /* SIOCSIWRANGE */
2049 (iw_handler
) wlan_get_range
, /* SIOCGIWRANGE */
2050 (iw_handler
) NULL
, /* SIOCSIWPRIV */
2051 (iw_handler
) NULL
, /* SIOCGIWPRIV */
2052 (iw_handler
) NULL
, /* SIOCSIWSTATS */
2053 (iw_handler
) NULL
, /* SIOCGIWSTATS */
2054 iw_handler_set_spy
, /* SIOCSIWSPY */
2055 iw_handler_get_spy
, /* SIOCGIWSPY */
2056 iw_handler_set_thrspy
, /* SIOCSIWTHRSPY */
2057 iw_handler_get_thrspy
, /* SIOCGIWTHRSPY */
2058 (iw_handler
) wlan_set_wap
, /* SIOCSIWAP */
2059 (iw_handler
) wlan_get_wap
, /* SIOCGIWAP */
2060 (iw_handler
) NULL
, /* SIOCSIWMLME */
2061 (iw_handler
) NULL
, /* SIOCGIWAPLIST - deprecated */
2062 (iw_handler
) libertas_set_scan
, /* SIOCSIWSCAN */
2063 (iw_handler
) libertas_get_scan
, /* SIOCGIWSCAN */
2064 (iw_handler
) wlan_set_essid
, /* SIOCSIWESSID */
2065 (iw_handler
) wlan_get_essid
, /* SIOCGIWESSID */
2066 (iw_handler
) wlan_set_nick
, /* SIOCSIWNICKN */
2067 (iw_handler
) wlan_get_nick
, /* SIOCGIWNICKN */
2068 (iw_handler
) NULL
, /* -- hole -- */
2069 (iw_handler
) NULL
, /* -- hole -- */
2070 (iw_handler
) wlan_set_rate
, /* SIOCSIWRATE */
2071 (iw_handler
) wlan_get_rate
, /* SIOCGIWRATE */
2072 (iw_handler
) wlan_set_rts
, /* SIOCSIWRTS */
2073 (iw_handler
) wlan_get_rts
, /* SIOCGIWRTS */
2074 (iw_handler
) wlan_set_frag
, /* SIOCSIWFRAG */
2075 (iw_handler
) wlan_get_frag
, /* SIOCGIWFRAG */
2076 (iw_handler
) wlan_set_txpow
, /* SIOCSIWTXPOW */
2077 (iw_handler
) wlan_get_txpow
, /* SIOCGIWTXPOW */
2078 (iw_handler
) wlan_set_retry
, /* SIOCSIWRETRY */
2079 (iw_handler
) wlan_get_retry
, /* SIOCGIWRETRY */
2080 (iw_handler
) wlan_set_encode
, /* SIOCSIWENCODE */
2081 (iw_handler
) wlan_get_encode
, /* SIOCGIWENCODE */
2082 (iw_handler
) wlan_set_power
, /* SIOCSIWPOWER */
2083 (iw_handler
) wlan_get_power
, /* SIOCGIWPOWER */
2084 (iw_handler
) NULL
, /* -- hole -- */
2085 (iw_handler
) NULL
, /* -- hole -- */
2086 (iw_handler
) wlan_set_genie
, /* SIOCSIWGENIE */
2087 (iw_handler
) wlan_get_genie
, /* SIOCGIWGENIE */
2088 (iw_handler
) wlan_set_auth
, /* SIOCSIWAUTH */
2089 (iw_handler
) wlan_get_auth
, /* SIOCGIWAUTH */
2090 (iw_handler
) wlan_set_encodeext
,/* SIOCSIWENCODEEXT */
2091 (iw_handler
) wlan_get_encodeext
,/* SIOCGIWENCODEEXT */
2092 (iw_handler
) NULL
, /* SIOCSIWPMKSA */
2095 static const iw_handler mesh_wlan_handler
[] = {
2096 (iw_handler
) NULL
, /* SIOCSIWCOMMIT */
2097 (iw_handler
) wlan_get_name
, /* SIOCGIWNAME */
2098 (iw_handler
) NULL
, /* SIOCSIWNWID */
2099 (iw_handler
) NULL
, /* SIOCGIWNWID */
2100 (iw_handler
) wlan_set_freq
, /* SIOCSIWFREQ */
2101 (iw_handler
) wlan_get_freq
, /* SIOCGIWFREQ */
2102 (iw_handler
) NULL
, /* SIOCSIWMODE */
2103 (iw_handler
) mesh_wlan_get_mode
, /* SIOCGIWMODE */
2104 (iw_handler
) NULL
, /* SIOCSIWSENS */
2105 (iw_handler
) NULL
, /* SIOCGIWSENS */
2106 (iw_handler
) NULL
, /* SIOCSIWRANGE */
2107 (iw_handler
) wlan_get_range
, /* SIOCGIWRANGE */
2108 (iw_handler
) NULL
, /* SIOCSIWPRIV */
2109 (iw_handler
) NULL
, /* SIOCGIWPRIV */
2110 (iw_handler
) NULL
, /* SIOCSIWSTATS */
2111 (iw_handler
) NULL
, /* SIOCGIWSTATS */
2112 iw_handler_set_spy
, /* SIOCSIWSPY */
2113 iw_handler_get_spy
, /* SIOCGIWSPY */
2114 iw_handler_set_thrspy
, /* SIOCSIWTHRSPY */
2115 iw_handler_get_thrspy
, /* SIOCGIWTHRSPY */
2116 (iw_handler
) NULL
, /* SIOCSIWAP */
2117 (iw_handler
) NULL
, /* SIOCGIWAP */
2118 (iw_handler
) NULL
, /* SIOCSIWMLME */
2119 (iw_handler
) NULL
, /* SIOCGIWAPLIST - deprecated */
2120 (iw_handler
) libertas_set_scan
, /* SIOCSIWSCAN */
2121 (iw_handler
) libertas_get_scan
, /* SIOCGIWSCAN */
2122 (iw_handler
) NULL
, /* SIOCSIWESSID */
2123 (iw_handler
) NULL
, /* SIOCGIWESSID */
2124 (iw_handler
) NULL
, /* SIOCSIWNICKN */
2125 (iw_handler
) mesh_get_nick
, /* SIOCGIWNICKN */
2126 (iw_handler
) NULL
, /* -- hole -- */
2127 (iw_handler
) NULL
, /* -- hole -- */
2128 (iw_handler
) wlan_set_rate
, /* SIOCSIWRATE */
2129 (iw_handler
) wlan_get_rate
, /* SIOCGIWRATE */
2130 (iw_handler
) wlan_set_rts
, /* SIOCSIWRTS */
2131 (iw_handler
) wlan_get_rts
, /* SIOCGIWRTS */
2132 (iw_handler
) wlan_set_frag
, /* SIOCSIWFRAG */
2133 (iw_handler
) wlan_get_frag
, /* SIOCGIWFRAG */
2134 (iw_handler
) wlan_set_txpow
, /* SIOCSIWTXPOW */
2135 (iw_handler
) wlan_get_txpow
, /* SIOCGIWTXPOW */
2136 (iw_handler
) wlan_set_retry
, /* SIOCSIWRETRY */
2137 (iw_handler
) wlan_get_retry
, /* SIOCGIWRETRY */
2138 (iw_handler
) wlan_set_encode
, /* SIOCSIWENCODE */
2139 (iw_handler
) wlan_get_encode
, /* SIOCGIWENCODE */
2140 (iw_handler
) wlan_set_power
, /* SIOCSIWPOWER */
2141 (iw_handler
) wlan_get_power
, /* SIOCGIWPOWER */
2142 (iw_handler
) NULL
, /* -- hole -- */
2143 (iw_handler
) NULL
, /* -- hole -- */
2144 (iw_handler
) wlan_set_genie
, /* SIOCSIWGENIE */
2145 (iw_handler
) wlan_get_genie
, /* SIOCGIWGENIE */
2146 (iw_handler
) wlan_set_auth
, /* SIOCSIWAUTH */
2147 (iw_handler
) wlan_get_auth
, /* SIOCGIWAUTH */
2148 (iw_handler
) wlan_set_encodeext
,/* SIOCSIWENCODEEXT */
2149 (iw_handler
) wlan_get_encodeext
,/* SIOCGIWENCODEEXT */
2150 (iw_handler
) NULL
, /* SIOCSIWPMKSA */
2152 struct iw_handler_def libertas_handler_def
= {
2153 .num_standard
= ARRAY_SIZE(wlan_handler
),
2154 .standard
= (iw_handler
*) wlan_handler
,
2155 .get_wireless_stats
= wlan_get_wireless_stats
,
2158 struct iw_handler_def mesh_handler_def
= {
2159 .num_standard
= ARRAY_SIZE(mesh_wlan_handler
),
2160 .standard
= (iw_handler
*) mesh_wlan_handler
,
2161 .get_wireless_stats
= wlan_get_wireless_stats
,