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 val
= vwrq
->value
;
271 lbs_deb_enter(LBS_DEB_WEXT
);
274 val
= MRVDRV_RTS_MAX_VALUE
;
276 if (val
< MRVDRV_RTS_MIN_VALUE
|| val
> MRVDRV_RTS_MAX_VALUE
)
279 ret
= lbs_set_snmp_mib(priv
, SNMP_MIB_OID_RTS_THRESHOLD
, (u16
) val
);
281 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
285 static int lbs_get_rts(struct net_device
*dev
, struct iw_request_info
*info
,
286 struct iw_param
*vwrq
, char *extra
)
288 struct lbs_private
*priv
= dev
->priv
;
292 lbs_deb_enter(LBS_DEB_WEXT
);
294 ret
= lbs_get_snmp_mib(priv
, SNMP_MIB_OID_RTS_THRESHOLD
, &val
);
299 vwrq
->disabled
= ((val
< MRVDRV_RTS_MIN_VALUE
)
300 || (val
> MRVDRV_RTS_MAX_VALUE
));
304 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
308 static int lbs_set_frag(struct net_device
*dev
, struct iw_request_info
*info
,
309 struct iw_param
*vwrq
, char *extra
)
311 struct lbs_private
*priv
= dev
->priv
;
313 u32 val
= vwrq
->value
;
315 lbs_deb_enter(LBS_DEB_WEXT
);
318 val
= MRVDRV_FRAG_MAX_VALUE
;
320 if (val
< MRVDRV_FRAG_MIN_VALUE
|| val
> MRVDRV_FRAG_MAX_VALUE
)
323 ret
= lbs_set_snmp_mib(priv
, SNMP_MIB_OID_FRAG_THRESHOLD
, (u16
) val
);
325 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
329 static int lbs_get_frag(struct net_device
*dev
, struct iw_request_info
*info
,
330 struct iw_param
*vwrq
, char *extra
)
332 struct lbs_private
*priv
= dev
->priv
;
336 lbs_deb_enter(LBS_DEB_WEXT
);
338 ret
= lbs_get_snmp_mib(priv
, SNMP_MIB_OID_FRAG_THRESHOLD
, &val
);
343 vwrq
->disabled
= ((val
< MRVDRV_FRAG_MIN_VALUE
)
344 || (val
> MRVDRV_FRAG_MAX_VALUE
));
348 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
352 static int lbs_get_mode(struct net_device
*dev
,
353 struct iw_request_info
*info
, u32
* uwrq
, char *extra
)
355 struct lbs_private
*priv
= dev
->priv
;
357 lbs_deb_enter(LBS_DEB_WEXT
);
361 lbs_deb_leave(LBS_DEB_WEXT
);
365 static int mesh_wlan_get_mode(struct net_device
*dev
,
366 struct iw_request_info
*info
, u32
* uwrq
,
369 lbs_deb_enter(LBS_DEB_WEXT
);
371 *uwrq
= IW_MODE_REPEAT
;
373 lbs_deb_leave(LBS_DEB_WEXT
);
377 static int lbs_get_txpow(struct net_device
*dev
,
378 struct iw_request_info
*info
,
379 struct iw_param
*vwrq
, char *extra
)
381 struct lbs_private
*priv
= dev
->priv
;
385 lbs_deb_enter(LBS_DEB_WEXT
);
387 if (!priv
->radio_on
) {
388 lbs_deb_wext("tx power off\n");
394 ret
= lbs_get_tx_power(priv
, &curlevel
, NULL
, NULL
);
398 lbs_deb_wext("tx power level %d dbm\n", curlevel
);
399 priv
->txpower_cur
= curlevel
;
401 vwrq
->value
= curlevel
;
404 vwrq
->flags
= IW_TXPOW_DBM
;
407 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
411 static int lbs_set_retry(struct net_device
*dev
, struct iw_request_info
*info
,
412 struct iw_param
*vwrq
, char *extra
)
414 struct lbs_private
*priv
= dev
->priv
;
416 u16 slimit
= 0, llimit
= 0;
418 lbs_deb_enter(LBS_DEB_WEXT
);
420 if ((vwrq
->flags
& IW_RETRY_TYPE
) != IW_RETRY_LIMIT
)
423 /* The MAC has a 4-bit Total_Tx_Count register
424 Total_Tx_Count = 1 + Tx_Retry_Count */
425 #define TX_RETRY_MIN 0
426 #define TX_RETRY_MAX 14
427 if (vwrq
->value
< TX_RETRY_MIN
|| vwrq
->value
> TX_RETRY_MAX
)
430 /* Add 1 to convert retry count to try count */
431 if (vwrq
->flags
& IW_RETRY_SHORT
)
432 slimit
= (u16
) (vwrq
->value
+ 1);
433 else if (vwrq
->flags
& IW_RETRY_LONG
)
434 llimit
= (u16
) (vwrq
->value
+ 1);
436 slimit
= llimit
= (u16
) (vwrq
->value
+ 1); /* set both */
439 ret
= lbs_set_snmp_mib(priv
, SNMP_MIB_OID_LONG_RETRY_LIMIT
,
446 /* txretrycount follows the short retry limit */
447 priv
->txretrycount
= slimit
;
448 ret
= lbs_set_snmp_mib(priv
, SNMP_MIB_OID_SHORT_RETRY_LIMIT
,
455 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
459 static int lbs_get_retry(struct net_device
*dev
, struct iw_request_info
*info
,
460 struct iw_param
*vwrq
, char *extra
)
462 struct lbs_private
*priv
= dev
->priv
;
466 lbs_deb_enter(LBS_DEB_WEXT
);
470 if (vwrq
->flags
& IW_RETRY_LONG
) {
471 ret
= lbs_get_snmp_mib(priv
, SNMP_MIB_OID_LONG_RETRY_LIMIT
, &val
);
475 /* Subtract 1 to convert try count to retry count */
476 vwrq
->value
= val
- 1;
477 vwrq
->flags
= IW_RETRY_LIMIT
| IW_RETRY_LONG
;
479 ret
= lbs_get_snmp_mib(priv
, SNMP_MIB_OID_SHORT_RETRY_LIMIT
, &val
);
483 /* txretry count follows the short retry limit */
484 priv
->txretrycount
= val
;
485 /* Subtract 1 to convert try count to retry count */
486 vwrq
->value
= val
- 1;
487 vwrq
->flags
= IW_RETRY_LIMIT
| IW_RETRY_SHORT
;
491 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
495 static inline void sort_channels(struct iw_freq
*freq
, int num
)
500 for (i
= 0; i
< num
; i
++)
501 for (j
= i
+ 1; j
< num
; j
++)
502 if (freq
[i
].i
> freq
[j
].i
) {
506 freq
[i
].i
= freq
[j
].i
;
507 freq
[i
].m
= freq
[j
].m
;
517 Infra G(12) A(8) B(4) G(12)
518 Adhoc A+B(12) A(8) B(4) B(4)
526 * @brief Get Range Info
528 * @param dev A pointer to net_device structure
529 * @param info A pointer to iw_request_info structure
530 * @param vwrq A pointer to iw_param structure
531 * @param extra A pointer to extra data buf
532 * @return 0 --success, otherwise fail
534 static int lbs_get_range(struct net_device
*dev
, struct iw_request_info
*info
,
535 struct iw_point
*dwrq
, char *extra
)
538 struct lbs_private
*priv
= dev
->priv
;
539 struct iw_range
*range
= (struct iw_range
*)extra
;
540 struct chan_freq_power
*cfp
;
541 u8 rates
[MAX_RATES
+ 1];
545 lbs_deb_enter(LBS_DEB_WEXT
);
547 dwrq
->length
= sizeof(struct iw_range
);
548 memset(range
, 0, sizeof(struct iw_range
));
553 memset(rates
, 0, sizeof(rates
));
554 copy_active_data_rates(priv
, rates
);
555 range
->num_bitrates
= strnlen(rates
, IW_MAX_BITRATES
);
556 for (i
= 0; i
< range
->num_bitrates
; i
++)
557 range
->bitrate
[i
] = rates
[i
] * 500000;
558 range
->num_bitrates
= i
;
559 lbs_deb_wext("IW_MAX_BITRATES %d, num_bitrates %d\n", IW_MAX_BITRATES
,
560 range
->num_bitrates
);
562 range
->num_frequency
= 0;
564 range
->scan_capa
= IW_SCAN_CAPA_ESSID
;
566 if (priv
->enable11d
&&
567 (priv
->connect_status
== LBS_CONNECTED
||
568 priv
->mesh_connect_status
== LBS_CONNECTED
)) {
572 struct parsed_region_chan_11d
*parsed_region_chan
=
573 &priv
->parsed_region_chan
;
575 if (parsed_region_chan
== NULL
) {
576 lbs_deb_wext("11d: parsed_region_chan is NULL\n");
579 band
= parsed_region_chan
->band
;
580 lbs_deb_wext("band %d, nr_char %d\n", band
,
581 parsed_region_chan
->nr_chan
);
583 for (i
= 0; (range
->num_frequency
< IW_MAX_FREQUENCIES
)
584 && (i
< parsed_region_chan
->nr_chan
); i
++) {
585 chan_no
= parsed_region_chan
->chanpwr
[i
].chan
;
586 lbs_deb_wext("chan_no %d\n", chan_no
);
587 range
->freq
[range
->num_frequency
].i
= (long)chan_no
;
588 range
->freq
[range
->num_frequency
].m
=
589 (long)lbs_chan_2_freq(chan_no
) * 100000;
590 range
->freq
[range
->num_frequency
].e
= 1;
591 range
->num_frequency
++;
596 for (j
= 0; (range
->num_frequency
< IW_MAX_FREQUENCIES
)
597 && (j
< ARRAY_SIZE(priv
->region_channel
)); j
++) {
598 cfp
= priv
->region_channel
[j
].CFP
;
599 for (i
= 0; (range
->num_frequency
< IW_MAX_FREQUENCIES
)
600 && priv
->region_channel
[j
].valid
602 && (i
< priv
->region_channel
[j
].nrcfp
); i
++) {
603 range
->freq
[range
->num_frequency
].i
=
605 range
->freq
[range
->num_frequency
].m
=
606 (long)cfp
->freq
* 100000;
607 range
->freq
[range
->num_frequency
].e
= 1;
609 range
->num_frequency
++;
614 lbs_deb_wext("IW_MAX_FREQUENCIES %d, num_frequency %d\n",
615 IW_MAX_FREQUENCIES
, range
->num_frequency
);
617 range
->num_channels
= range
->num_frequency
;
619 sort_channels(&range
->freq
[0], range
->num_frequency
);
622 * Set an indication of the max TCP throughput in bit/s that we can
623 * expect using this interface
626 range
->throughput
= 5000 * 1000;
628 range
->throughput
= 1500 * 1000;
630 range
->min_rts
= MRVDRV_RTS_MIN_VALUE
;
631 range
->max_rts
= MRVDRV_RTS_MAX_VALUE
;
632 range
->min_frag
= MRVDRV_FRAG_MIN_VALUE
;
633 range
->max_frag
= MRVDRV_FRAG_MAX_VALUE
;
635 range
->encoding_size
[0] = 5;
636 range
->encoding_size
[1] = 13;
637 range
->num_encoding_sizes
= 2;
638 range
->max_encoding_tokens
= 4;
641 * Right now we support only "iwconfig ethX power on|off"
643 range
->pm_capa
= IW_POWER_ON
;
646 * Minimum version we recommend
648 range
->we_version_source
= 15;
651 * Version we are compiled with
653 range
->we_version_compiled
= WIRELESS_EXT
;
655 range
->retry_capa
= IW_RETRY_LIMIT
;
656 range
->retry_flags
= IW_RETRY_LIMIT
| IW_RETRY_MAX
;
658 range
->min_retry
= TX_RETRY_MIN
;
659 range
->max_retry
= TX_RETRY_MAX
;
662 * Set the qual, level and noise range values
664 range
->max_qual
.qual
= 100;
665 range
->max_qual
.level
= 0;
666 range
->max_qual
.noise
= 0;
667 range
->max_qual
.updated
= IW_QUAL_ALL_UPDATED
| IW_QUAL_DBM
;
669 range
->avg_qual
.qual
= 70;
670 /* TODO: Find real 'good' to 'bad' threshold value for RSSI */
671 range
->avg_qual
.level
= 0;
672 range
->avg_qual
.noise
= 0;
673 range
->avg_qual
.updated
= IW_QUAL_ALL_UPDATED
| IW_QUAL_DBM
;
675 range
->sensitivity
= 0;
677 /* Setup the supported power level ranges */
678 memset(range
->txpower
, 0, sizeof(range
->txpower
));
679 range
->txpower_capa
= IW_TXPOW_DBM
| IW_TXPOW_RANGE
;
680 range
->txpower
[0] = priv
->txpower_min
;
681 range
->txpower
[1] = priv
->txpower_max
;
682 range
->num_txpower
= 2;
684 range
->event_capa
[0] = (IW_EVENT_CAPA_K_0
|
685 IW_EVENT_CAPA_MASK(SIOCGIWAP
) |
686 IW_EVENT_CAPA_MASK(SIOCGIWSCAN
));
687 range
->event_capa
[1] = IW_EVENT_CAPA_K_1
;
689 if (priv
->fwcapinfo
& FW_CAPINFO_WPA
) {
690 range
->enc_capa
= IW_ENC_CAPA_WPA
692 | IW_ENC_CAPA_CIPHER_TKIP
693 | IW_ENC_CAPA_CIPHER_CCMP
;
697 lbs_deb_leave(LBS_DEB_WEXT
);
701 static int lbs_set_power(struct net_device
*dev
, struct iw_request_info
*info
,
702 struct iw_param
*vwrq
, char *extra
)
704 struct lbs_private
*priv
= dev
->priv
;
706 lbs_deb_enter(LBS_DEB_WEXT
);
708 if (!priv
->ps_supported
) {
715 /* PS is currently supported only in Infrastructure mode
716 * Remove this check if it is to be supported in IBSS mode also
719 if (vwrq
->disabled
) {
720 priv
->psmode
= LBS802_11POWERMODECAM
;
721 if (priv
->psstate
!= PS_STATE_FULL_POWER
) {
722 lbs_ps_wakeup(priv
, CMD_OPTION_WAITFORRSP
);
728 if ((vwrq
->flags
& IW_POWER_TYPE
) == IW_POWER_TIMEOUT
) {
730 "setting power timeout is not supported\n");
732 } else if ((vwrq
->flags
& IW_POWER_TYPE
) == IW_POWER_PERIOD
) {
733 lbs_deb_wext("setting power period not supported\n");
737 if (priv
->psmode
!= LBS802_11POWERMODECAM
) {
741 priv
->psmode
= LBS802_11POWERMODEMAX_PSP
;
743 if (priv
->connect_status
== LBS_CONNECTED
) {
744 lbs_ps_sleep(priv
, CMD_OPTION_WAITFORRSP
);
747 lbs_deb_leave(LBS_DEB_WEXT
);
751 static int lbs_get_power(struct net_device
*dev
, struct iw_request_info
*info
,
752 struct iw_param
*vwrq
, char *extra
)
754 struct lbs_private
*priv
= dev
->priv
;
756 lbs_deb_enter(LBS_DEB_WEXT
);
760 vwrq
->disabled
= priv
->psmode
== LBS802_11POWERMODECAM
761 || priv
->connect_status
== LBS_DISCONNECTED
;
763 lbs_deb_leave(LBS_DEB_WEXT
);
767 static struct iw_statistics
*lbs_get_wireless_stats(struct net_device
*dev
)
777 struct lbs_private
*priv
= dev
->priv
;
784 struct cmd_ds_802_11_get_log log
;
786 lbs_deb_enter(LBS_DEB_WEXT
);
788 priv
->wstats
.status
= priv
->mode
;
790 /* If we're not associated, all quality values are meaningless */
791 if ((priv
->connect_status
!= LBS_CONNECTED
) &&
792 (priv
->mesh_connect_status
!= LBS_CONNECTED
))
795 /* Quality by RSSI */
796 priv
->wstats
.qual
.level
=
797 CAL_RSSI(priv
->SNR
[TYPE_BEACON
][TYPE_NOAVG
],
798 priv
->NF
[TYPE_BEACON
][TYPE_NOAVG
]);
800 if (priv
->NF
[TYPE_BEACON
][TYPE_NOAVG
] == 0) {
801 priv
->wstats
.qual
.noise
= MRVDRV_NF_DEFAULT_SCAN_VALUE
;
803 priv
->wstats
.qual
.noise
=
804 CAL_NF(priv
->NF
[TYPE_BEACON
][TYPE_NOAVG
]);
807 lbs_deb_wext("signal level %#x\n", priv
->wstats
.qual
.level
);
808 lbs_deb_wext("noise %#x\n", priv
->wstats
.qual
.noise
);
810 rssi
= priv
->wstats
.qual
.level
- priv
->wstats
.qual
.noise
;
812 rssi_qual
= rssi
* POOR
/ 10;
814 rssi_qual
= (rssi
- 15) * (FAIR
- POOR
) / 5 + POOR
;
816 rssi_qual
= (rssi
- 20) * (GOOD
- FAIR
) / 5 + FAIR
;
818 rssi_qual
= (rssi
- 30) * (VERY_GOOD
- GOOD
) /
821 rssi_qual
= (rssi
- 40) * (PERFECT
- VERY_GOOD
) /
825 /* Quality by TX errors */
826 priv
->wstats
.discard
.retries
= priv
->stats
.tx_errors
;
828 memset(&log
, 0, sizeof(log
));
829 log
.hdr
.size
= cpu_to_le16(sizeof(log
));
830 lbs_cmd_with_response(priv
, CMD_802_11_GET_LOG
, &log
);
832 tx_retries
= le32_to_cpu(log
.retry
);
835 tx_qual
= (90 - tx_retries
) * POOR
/ 15;
836 else if (tx_retries
> 70)
837 tx_qual
= (75 - tx_retries
) * (FAIR
- POOR
) / 5 + POOR
;
838 else if (tx_retries
> 65)
839 tx_qual
= (70 - tx_retries
) * (GOOD
- FAIR
) / 5 + FAIR
;
840 else if (tx_retries
> 50)
841 tx_qual
= (65 - tx_retries
) * (VERY_GOOD
- GOOD
) /
844 tx_qual
= (50 - tx_retries
) *
845 (PERFECT
- VERY_GOOD
) / 50 + VERY_GOOD
;
846 quality
= min(quality
, tx_qual
);
848 priv
->wstats
.discard
.code
= le32_to_cpu(log
.wepundecryptable
);
849 priv
->wstats
.discard
.retries
= tx_retries
;
850 priv
->wstats
.discard
.misc
= le32_to_cpu(log
.ackfailure
);
852 /* Calculate quality */
853 priv
->wstats
.qual
.qual
= min_t(u8
, quality
, 100);
854 priv
->wstats
.qual
.updated
= IW_QUAL_ALL_UPDATED
| IW_QUAL_DBM
;
857 /* update stats asynchronously for future calls */
858 lbs_prepare_and_send_command(priv
, CMD_802_11_RSSI
, 0,
862 priv
->wstats
.miss
.beacon
= 0;
863 priv
->wstats
.discard
.retries
= 0;
864 priv
->wstats
.qual
.qual
= 0;
865 priv
->wstats
.qual
.level
= 0;
866 priv
->wstats
.qual
.noise
= 0;
867 priv
->wstats
.qual
.updated
= IW_QUAL_ALL_UPDATED
;
868 priv
->wstats
.qual
.updated
|= IW_QUAL_NOISE_INVALID
|
869 IW_QUAL_QUAL_INVALID
| IW_QUAL_LEVEL_INVALID
;
872 lbs_deb_leave(LBS_DEB_WEXT
);
873 return &priv
->wstats
;
878 static int lbs_set_freq(struct net_device
*dev
, struct iw_request_info
*info
,
879 struct iw_freq
*fwrq
, char *extra
)
882 struct lbs_private
*priv
= dev
->priv
;
883 struct chan_freq_power
*cfp
;
884 struct assoc_request
* assoc_req
;
886 lbs_deb_enter(LBS_DEB_WEXT
);
888 mutex_lock(&priv
->lock
);
889 assoc_req
= lbs_get_association_request(priv
);
895 /* If setting by frequency, convert to a channel */
897 long f
= fwrq
->m
/ 100000;
899 cfp
= find_cfp_by_band_and_freq(priv
, 0, f
);
901 lbs_deb_wext("invalid freq %ld\n", f
);
906 fwrq
->m
= (int) cfp
->channel
;
909 /* Setting by channel number */
910 if (fwrq
->m
> 1000 || fwrq
->e
> 0) {
914 cfp
= lbs_find_cfp_by_band_and_channel(priv
, 0, fwrq
->m
);
919 assoc_req
->channel
= fwrq
->m
;
924 set_bit(ASSOC_FLAG_CHANNEL
, &assoc_req
->flags
);
925 lbs_postpone_association_work(priv
);
927 lbs_cancel_association_work(priv
);
929 mutex_unlock(&priv
->lock
);
931 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
935 static int lbs_mesh_set_freq(struct net_device
*dev
,
936 struct iw_request_info
*info
,
937 struct iw_freq
*fwrq
, char *extra
)
939 struct lbs_private
*priv
= dev
->priv
;
940 struct chan_freq_power
*cfp
;
943 lbs_deb_enter(LBS_DEB_WEXT
);
945 /* If setting by frequency, convert to a channel */
947 long f
= fwrq
->m
/ 100000;
949 cfp
= find_cfp_by_band_and_freq(priv
, 0, f
);
951 lbs_deb_wext("invalid freq %ld\n", f
);
956 fwrq
->m
= (int) cfp
->channel
;
959 /* Setting by channel number */
960 if (fwrq
->m
> 1000 || fwrq
->e
> 0) {
964 cfp
= lbs_find_cfp_by_band_and_channel(priv
, 0, fwrq
->m
);
969 if (fwrq
->m
!= priv
->curbssparams
.channel
) {
970 lbs_deb_wext("mesh channel change forces eth disconnect\n");
971 if (priv
->mode
== IW_MODE_INFRA
)
972 lbs_cmd_80211_deauthenticate(priv
,
973 priv
->curbssparams
.bssid
,
974 WLAN_REASON_DEAUTH_LEAVING
);
975 else if (priv
->mode
== IW_MODE_ADHOC
)
976 lbs_adhoc_stop(priv
);
978 lbs_mesh_config(priv
, CMD_ACT_MESH_CONFIG_START
, fwrq
->m
);
979 lbs_update_channel(priv
);
983 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
987 static int lbs_set_rate(struct net_device
*dev
, struct iw_request_info
*info
,
988 struct iw_param
*vwrq
, char *extra
)
990 struct lbs_private
*priv
= dev
->priv
;
993 u8 rates
[MAX_RATES
+ 1];
995 lbs_deb_enter(LBS_DEB_WEXT
);
996 lbs_deb_wext("vwrq->value %d\n", vwrq
->value
);
997 lbs_deb_wext("vwrq->fixed %d\n", vwrq
->fixed
);
999 if (vwrq
->fixed
&& vwrq
->value
== -1)
1003 priv
->enablehwauto
= !vwrq
->fixed
;
1005 if (vwrq
->value
== -1)
1008 if (vwrq
->value
% 100000)
1011 new_rate
= vwrq
->value
/ 500000;
1012 priv
->cur_rate
= new_rate
;
1013 /* the rest is only needed for lbs_set_data_rate() */
1014 memset(rates
, 0, sizeof(rates
));
1015 copy_active_data_rates(priv
, rates
);
1016 if (!memchr(rates
, new_rate
, sizeof(rates
))) {
1017 lbs_pr_alert("fixed data rate 0x%X out of range\n",
1023 /* Try the newer command first (Firmware Spec 5.1 and above) */
1024 ret
= lbs_cmd_802_11_rate_adapt_rateset(priv
, CMD_ACT_SET
);
1026 /* Fallback to older version */
1028 ret
= lbs_set_data_rate(priv
, new_rate
);
1031 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1035 static int lbs_get_rate(struct net_device
*dev
, struct iw_request_info
*info
,
1036 struct iw_param
*vwrq
, char *extra
)
1038 struct lbs_private
*priv
= dev
->priv
;
1040 lbs_deb_enter(LBS_DEB_WEXT
);
1042 if (priv
->connect_status
== LBS_CONNECTED
) {
1043 vwrq
->value
= priv
->cur_rate
* 500000;
1045 if (priv
->enablehwauto
)
1055 lbs_deb_leave(LBS_DEB_WEXT
);
1059 static int lbs_set_mode(struct net_device
*dev
,
1060 struct iw_request_info
*info
, u32
* uwrq
, char *extra
)
1063 struct lbs_private
*priv
= dev
->priv
;
1064 struct assoc_request
* assoc_req
;
1066 lbs_deb_enter(LBS_DEB_WEXT
);
1068 if ( (*uwrq
!= IW_MODE_ADHOC
)
1069 && (*uwrq
!= IW_MODE_INFRA
)
1070 && (*uwrq
!= IW_MODE_AUTO
)) {
1071 lbs_deb_wext("Invalid mode: 0x%x\n", *uwrq
);
1076 mutex_lock(&priv
->lock
);
1077 assoc_req
= lbs_get_association_request(priv
);
1080 lbs_cancel_association_work(priv
);
1082 assoc_req
->mode
= *uwrq
;
1083 set_bit(ASSOC_FLAG_MODE
, &assoc_req
->flags
);
1084 lbs_postpone_association_work(priv
);
1085 lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq
);
1087 mutex_unlock(&priv
->lock
);
1090 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1096 * @brief Get Encryption key
1098 * @param dev A pointer to net_device structure
1099 * @param info A pointer to iw_request_info structure
1100 * @param vwrq A pointer to iw_param structure
1101 * @param extra A pointer to extra data buf
1102 * @return 0 --success, otherwise fail
1104 static int lbs_get_encode(struct net_device
*dev
,
1105 struct iw_request_info
*info
,
1106 struct iw_point
*dwrq
, u8
* extra
)
1108 struct lbs_private
*priv
= dev
->priv
;
1109 int index
= (dwrq
->flags
& IW_ENCODE_INDEX
) - 1;
1111 lbs_deb_enter(LBS_DEB_WEXT
);
1113 lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n",
1114 dwrq
->flags
, index
, dwrq
->length
, priv
->wep_tx_keyidx
);
1118 /* Authentication method */
1119 switch (priv
->secinfo
.auth_mode
) {
1120 case IW_AUTH_ALG_OPEN_SYSTEM
:
1121 dwrq
->flags
= IW_ENCODE_OPEN
;
1124 case IW_AUTH_ALG_SHARED_KEY
:
1125 case IW_AUTH_ALG_LEAP
:
1126 dwrq
->flags
= IW_ENCODE_RESTRICTED
;
1129 dwrq
->flags
= IW_ENCODE_DISABLED
| IW_ENCODE_OPEN
;
1133 memset(extra
, 0, 16);
1135 mutex_lock(&priv
->lock
);
1137 /* Default to returning current transmit key */
1139 index
= priv
->wep_tx_keyidx
;
1141 if ((priv
->wep_keys
[index
].len
) && priv
->secinfo
.wep_enabled
) {
1142 memcpy(extra
, priv
->wep_keys
[index
].key
,
1143 priv
->wep_keys
[index
].len
);
1144 dwrq
->length
= priv
->wep_keys
[index
].len
;
1146 dwrq
->flags
|= (index
+ 1);
1147 /* Return WEP enabled */
1148 dwrq
->flags
&= ~IW_ENCODE_DISABLED
;
1149 } else if ((priv
->secinfo
.WPAenabled
)
1150 || (priv
->secinfo
.WPA2enabled
)) {
1151 /* return WPA enabled */
1152 dwrq
->flags
&= ~IW_ENCODE_DISABLED
;
1153 dwrq
->flags
|= IW_ENCODE_NOKEY
;
1155 dwrq
->flags
|= IW_ENCODE_DISABLED
;
1158 mutex_unlock(&priv
->lock
);
1160 lbs_deb_wext("key: %02x:%02x:%02x:%02x:%02x:%02x, keylen %d\n",
1161 extra
[0], extra
[1], extra
[2],
1162 extra
[3], extra
[4], extra
[5], dwrq
->length
);
1164 lbs_deb_wext("return flags 0x%x\n", dwrq
->flags
);
1166 lbs_deb_leave(LBS_DEB_WEXT
);
1171 * @brief Set Encryption key (internal)
1173 * @param priv A pointer to private card structure
1174 * @param key_material A pointer to key material
1175 * @param key_length length of key material
1176 * @param index key index to set
1177 * @param set_tx_key Force set TX key (1 = yes, 0 = no)
1178 * @return 0 --success, otherwise fail
1180 static int lbs_set_wep_key(struct assoc_request
*assoc_req
,
1181 const char *key_material
,
1187 struct enc_key
*pkey
;
1189 lbs_deb_enter(LBS_DEB_WEXT
);
1191 /* Paranoid validation of key index */
1197 /* validate max key length */
1198 if (key_length
> KEY_LEN_WEP_104
) {
1203 pkey
= &assoc_req
->wep_keys
[index
];
1205 if (key_length
> 0) {
1206 memset(pkey
, 0, sizeof(struct enc_key
));
1207 pkey
->type
= KEY_TYPE_ID_WEP
;
1209 /* Standardize the key length */
1210 pkey
->len
= (key_length
> KEY_LEN_WEP_40
) ?
1211 KEY_LEN_WEP_104
: KEY_LEN_WEP_40
;
1212 memcpy(pkey
->key
, key_material
, key_length
);
1216 /* Ensure the chosen key is valid */
1218 lbs_deb_wext("key not set, so cannot enable it\n");
1222 assoc_req
->wep_tx_keyidx
= index
;
1225 assoc_req
->secinfo
.wep_enabled
= 1;
1228 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1232 static int validate_key_index(u16 def_index
, u16 raw_index
,
1233 u16
*out_index
, u16
*is_default
)
1235 if (!out_index
|| !is_default
)
1238 /* Verify index if present, otherwise use default TX key index */
1239 if (raw_index
> 0) {
1242 *out_index
= raw_index
- 1;
1244 *out_index
= def_index
;
1250 static void disable_wep(struct assoc_request
*assoc_req
)
1254 lbs_deb_enter(LBS_DEB_WEXT
);
1256 /* Set Open System auth mode */
1257 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1259 /* Clear WEP keys and mark WEP as disabled */
1260 assoc_req
->secinfo
.wep_enabled
= 0;
1261 for (i
= 0; i
< 4; i
++)
1262 assoc_req
->wep_keys
[i
].len
= 0;
1264 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1265 set_bit(ASSOC_FLAG_WEP_KEYS
, &assoc_req
->flags
);
1267 lbs_deb_leave(LBS_DEB_WEXT
);
1270 static void disable_wpa(struct assoc_request
*assoc_req
)
1272 lbs_deb_enter(LBS_DEB_WEXT
);
1274 memset(&assoc_req
->wpa_mcast_key
, 0, sizeof (struct enc_key
));
1275 assoc_req
->wpa_mcast_key
.flags
= KEY_INFO_WPA_MCAST
;
1276 set_bit(ASSOC_FLAG_WPA_MCAST_KEY
, &assoc_req
->flags
);
1278 memset(&assoc_req
->wpa_unicast_key
, 0, sizeof (struct enc_key
));
1279 assoc_req
->wpa_unicast_key
.flags
= KEY_INFO_WPA_UNICAST
;
1280 set_bit(ASSOC_FLAG_WPA_UCAST_KEY
, &assoc_req
->flags
);
1282 assoc_req
->secinfo
.WPAenabled
= 0;
1283 assoc_req
->secinfo
.WPA2enabled
= 0;
1284 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1286 lbs_deb_leave(LBS_DEB_WEXT
);
1290 * @brief Set Encryption key
1292 * @param dev A pointer to net_device structure
1293 * @param info A pointer to iw_request_info structure
1294 * @param vwrq A pointer to iw_param structure
1295 * @param extra A pointer to extra data buf
1296 * @return 0 --success, otherwise fail
1298 static int lbs_set_encode(struct net_device
*dev
,
1299 struct iw_request_info
*info
,
1300 struct iw_point
*dwrq
, char *extra
)
1303 struct lbs_private
*priv
= dev
->priv
;
1304 struct assoc_request
* assoc_req
;
1305 u16 is_default
= 0, index
= 0, set_tx_key
= 0;
1307 lbs_deb_enter(LBS_DEB_WEXT
);
1309 mutex_lock(&priv
->lock
);
1310 assoc_req
= lbs_get_association_request(priv
);
1316 if (dwrq
->flags
& IW_ENCODE_DISABLED
) {
1317 disable_wep (assoc_req
);
1318 disable_wpa (assoc_req
);
1322 ret
= validate_key_index(assoc_req
->wep_tx_keyidx
,
1323 (dwrq
->flags
& IW_ENCODE_INDEX
),
1324 &index
, &is_default
);
1330 /* If WEP isn't enabled, or if there is no key data but a valid
1331 * index, set the TX key.
1333 if (!assoc_req
->secinfo
.wep_enabled
|| (dwrq
->length
== 0 && !is_default
))
1336 ret
= lbs_set_wep_key(assoc_req
, extra
, dwrq
->length
, index
, set_tx_key
);
1341 set_bit(ASSOC_FLAG_WEP_KEYS
, &assoc_req
->flags
);
1343 set_bit(ASSOC_FLAG_WEP_TX_KEYIDX
, &assoc_req
->flags
);
1345 if (dwrq
->flags
& IW_ENCODE_RESTRICTED
) {
1346 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_SHARED_KEY
;
1347 } else if (dwrq
->flags
& IW_ENCODE_OPEN
) {
1348 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1353 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1354 lbs_postpone_association_work(priv
);
1356 lbs_cancel_association_work(priv
);
1358 mutex_unlock(&priv
->lock
);
1360 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1365 * @brief Get Extended Encryption key (WPA/802.1x and WEP)
1367 * @param dev A pointer to net_device structure
1368 * @param info A pointer to iw_request_info structure
1369 * @param vwrq A pointer to iw_param structure
1370 * @param extra A pointer to extra data buf
1371 * @return 0 on success, otherwise failure
1373 static int lbs_get_encodeext(struct net_device
*dev
,
1374 struct iw_request_info
*info
,
1375 struct iw_point
*dwrq
,
1379 struct lbs_private
*priv
= dev
->priv
;
1380 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*)extra
;
1381 int index
, max_key_len
;
1383 lbs_deb_enter(LBS_DEB_WEXT
);
1385 max_key_len
= dwrq
->length
- sizeof(*ext
);
1386 if (max_key_len
< 0)
1389 index
= dwrq
->flags
& IW_ENCODE_INDEX
;
1391 if (index
< 1 || index
> 4)
1395 index
= priv
->wep_tx_keyidx
;
1398 if (!(ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
) &&
1399 ext
->alg
!= IW_ENCODE_ALG_WEP
) {
1400 if (index
!= 0 || priv
->mode
!= IW_MODE_INFRA
)
1404 dwrq
->flags
= index
+ 1;
1405 memset(ext
, 0, sizeof(*ext
));
1407 if ( !priv
->secinfo
.wep_enabled
1408 && !priv
->secinfo
.WPAenabled
1409 && !priv
->secinfo
.WPA2enabled
) {
1410 ext
->alg
= IW_ENCODE_ALG_NONE
;
1412 dwrq
->flags
|= IW_ENCODE_DISABLED
;
1416 if ( priv
->secinfo
.wep_enabled
1417 && !priv
->secinfo
.WPAenabled
1418 && !priv
->secinfo
.WPA2enabled
) {
1420 ext
->alg
= IW_ENCODE_ALG_WEP
;
1421 ext
->key_len
= priv
->wep_keys
[index
].len
;
1422 key
= &priv
->wep_keys
[index
].key
[0];
1423 } else if ( !priv
->secinfo
.wep_enabled
1424 && (priv
->secinfo
.WPAenabled
||
1425 priv
->secinfo
.WPA2enabled
)) {
1427 struct enc_key
* pkey
= NULL
;
1429 if ( priv
->wpa_mcast_key
.len
1430 && (priv
->wpa_mcast_key
.flags
& KEY_INFO_WPA_ENABLED
))
1431 pkey
= &priv
->wpa_mcast_key
;
1432 else if ( priv
->wpa_unicast_key
.len
1433 && (priv
->wpa_unicast_key
.flags
& KEY_INFO_WPA_ENABLED
))
1434 pkey
= &priv
->wpa_unicast_key
;
1437 if (pkey
->type
== KEY_TYPE_ID_AES
) {
1438 ext
->alg
= IW_ENCODE_ALG_CCMP
;
1440 ext
->alg
= IW_ENCODE_ALG_TKIP
;
1442 ext
->key_len
= pkey
->len
;
1443 key
= &pkey
->key
[0];
1445 ext
->alg
= IW_ENCODE_ALG_TKIP
;
1452 if (ext
->key_len
> max_key_len
) {
1458 memcpy(ext
->key
, key
, ext
->key_len
);
1460 dwrq
->flags
|= IW_ENCODE_NOKEY
;
1461 dwrq
->flags
|= IW_ENCODE_ENABLED
;
1466 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1471 * @brief Set Encryption key Extended (WPA/802.1x and WEP)
1473 * @param dev A pointer to net_device structure
1474 * @param info A pointer to iw_request_info structure
1475 * @param vwrq A pointer to iw_param structure
1476 * @param extra A pointer to extra data buf
1477 * @return 0 --success, otherwise fail
1479 static int lbs_set_encodeext(struct net_device
*dev
,
1480 struct iw_request_info
*info
,
1481 struct iw_point
*dwrq
,
1485 struct lbs_private
*priv
= dev
->priv
;
1486 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*)extra
;
1488 struct assoc_request
* assoc_req
;
1490 lbs_deb_enter(LBS_DEB_WEXT
);
1492 mutex_lock(&priv
->lock
);
1493 assoc_req
= lbs_get_association_request(priv
);
1499 if ((alg
== IW_ENCODE_ALG_NONE
) || (dwrq
->flags
& IW_ENCODE_DISABLED
)) {
1500 disable_wep (assoc_req
);
1501 disable_wpa (assoc_req
);
1502 } else if (alg
== IW_ENCODE_ALG_WEP
) {
1503 u16 is_default
= 0, index
, set_tx_key
= 0;
1505 ret
= validate_key_index(assoc_req
->wep_tx_keyidx
,
1506 (dwrq
->flags
& IW_ENCODE_INDEX
),
1507 &index
, &is_default
);
1511 /* If WEP isn't enabled, or if there is no key data but a valid
1512 * index, or if the set-TX-key flag was passed, set the TX key.
1514 if ( !assoc_req
->secinfo
.wep_enabled
1515 || (dwrq
->length
== 0 && !is_default
)
1516 || (ext
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
))
1519 /* Copy key to driver */
1520 ret
= lbs_set_wep_key(assoc_req
, ext
->key
, ext
->key_len
, index
,
1525 if (dwrq
->flags
& IW_ENCODE_RESTRICTED
) {
1526 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_SHARED_KEY
;
1527 } else if (dwrq
->flags
& IW_ENCODE_OPEN
) {
1528 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1531 /* Mark the various WEP bits as modified */
1532 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1534 set_bit(ASSOC_FLAG_WEP_KEYS
, &assoc_req
->flags
);
1536 set_bit(ASSOC_FLAG_WEP_TX_KEYIDX
, &assoc_req
->flags
);
1537 } else if ((alg
== IW_ENCODE_ALG_TKIP
) || (alg
== IW_ENCODE_ALG_CCMP
)) {
1538 struct enc_key
* pkey
;
1540 /* validate key length */
1541 if (((alg
== IW_ENCODE_ALG_TKIP
)
1542 && (ext
->key_len
!= KEY_LEN_WPA_TKIP
))
1543 || ((alg
== IW_ENCODE_ALG_CCMP
)
1544 && (ext
->key_len
!= KEY_LEN_WPA_AES
))) {
1545 lbs_deb_wext("invalid size %d for key of alg "
1553 if (ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
) {
1554 pkey
= &assoc_req
->wpa_mcast_key
;
1555 set_bit(ASSOC_FLAG_WPA_MCAST_KEY
, &assoc_req
->flags
);
1557 pkey
= &assoc_req
->wpa_unicast_key
;
1558 set_bit(ASSOC_FLAG_WPA_UCAST_KEY
, &assoc_req
->flags
);
1561 memset(pkey
, 0, sizeof (struct enc_key
));
1562 memcpy(pkey
->key
, ext
->key
, ext
->key_len
);
1563 pkey
->len
= ext
->key_len
;
1565 pkey
->flags
|= KEY_INFO_WPA_ENABLED
;
1567 /* Do this after zeroing key structure */
1568 if (ext
->ext_flags
& IW_ENCODE_EXT_GROUP_KEY
) {
1569 pkey
->flags
|= KEY_INFO_WPA_MCAST
;
1571 pkey
->flags
|= KEY_INFO_WPA_UNICAST
;
1574 if (alg
== IW_ENCODE_ALG_TKIP
) {
1575 pkey
->type
= KEY_TYPE_ID_TKIP
;
1576 } else if (alg
== IW_ENCODE_ALG_CCMP
) {
1577 pkey
->type
= KEY_TYPE_ID_AES
;
1580 /* If WPA isn't enabled yet, do that now */
1581 if ( assoc_req
->secinfo
.WPAenabled
== 0
1582 && assoc_req
->secinfo
.WPA2enabled
== 0) {
1583 assoc_req
->secinfo
.WPAenabled
= 1;
1584 assoc_req
->secinfo
.WPA2enabled
= 1;
1585 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1588 disable_wep (assoc_req
);
1593 lbs_postpone_association_work(priv
);
1595 lbs_cancel_association_work(priv
);
1597 mutex_unlock(&priv
->lock
);
1599 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1604 static int lbs_set_genie(struct net_device
*dev
,
1605 struct iw_request_info
*info
,
1606 struct iw_point
*dwrq
,
1609 struct lbs_private
*priv
= dev
->priv
;
1611 struct assoc_request
* assoc_req
;
1613 lbs_deb_enter(LBS_DEB_WEXT
);
1615 mutex_lock(&priv
->lock
);
1616 assoc_req
= lbs_get_association_request(priv
);
1622 if (dwrq
->length
> MAX_WPA_IE_LEN
||
1623 (dwrq
->length
&& extra
== NULL
)) {
1629 memcpy(&assoc_req
->wpa_ie
[0], extra
, dwrq
->length
);
1630 assoc_req
->wpa_ie_len
= dwrq
->length
;
1632 memset(&assoc_req
->wpa_ie
[0], 0, sizeof(priv
->wpa_ie
));
1633 assoc_req
->wpa_ie_len
= 0;
1638 set_bit(ASSOC_FLAG_WPA_IE
, &assoc_req
->flags
);
1639 lbs_postpone_association_work(priv
);
1641 lbs_cancel_association_work(priv
);
1643 mutex_unlock(&priv
->lock
);
1645 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1649 static int lbs_get_genie(struct net_device
*dev
,
1650 struct iw_request_info
*info
,
1651 struct iw_point
*dwrq
,
1655 struct lbs_private
*priv
= dev
->priv
;
1657 lbs_deb_enter(LBS_DEB_WEXT
);
1659 if (priv
->wpa_ie_len
== 0) {
1664 if (dwrq
->length
< priv
->wpa_ie_len
) {
1669 dwrq
->length
= priv
->wpa_ie_len
;
1670 memcpy(extra
, &priv
->wpa_ie
[0], priv
->wpa_ie_len
);
1673 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1678 static int lbs_set_auth(struct net_device
*dev
,
1679 struct iw_request_info
*info
,
1680 struct iw_param
*dwrq
,
1683 struct lbs_private
*priv
= dev
->priv
;
1684 struct assoc_request
* assoc_req
;
1688 lbs_deb_enter(LBS_DEB_WEXT
);
1690 mutex_lock(&priv
->lock
);
1691 assoc_req
= lbs_get_association_request(priv
);
1697 switch (dwrq
->flags
& IW_AUTH_INDEX
) {
1698 case IW_AUTH_TKIP_COUNTERMEASURES
:
1699 case IW_AUTH_CIPHER_PAIRWISE
:
1700 case IW_AUTH_CIPHER_GROUP
:
1701 case IW_AUTH_KEY_MGMT
:
1702 case IW_AUTH_DROP_UNENCRYPTED
:
1704 * libertas does not use these parameters
1708 case IW_AUTH_WPA_VERSION
:
1709 if (dwrq
->value
& IW_AUTH_WPA_VERSION_DISABLED
) {
1710 assoc_req
->secinfo
.WPAenabled
= 0;
1711 assoc_req
->secinfo
.WPA2enabled
= 0;
1712 disable_wpa (assoc_req
);
1714 if (dwrq
->value
& IW_AUTH_WPA_VERSION_WPA
) {
1715 assoc_req
->secinfo
.WPAenabled
= 1;
1716 assoc_req
->secinfo
.wep_enabled
= 0;
1717 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1719 if (dwrq
->value
& IW_AUTH_WPA_VERSION_WPA2
) {
1720 assoc_req
->secinfo
.WPA2enabled
= 1;
1721 assoc_req
->secinfo
.wep_enabled
= 0;
1722 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1727 case IW_AUTH_80211_AUTH_ALG
:
1728 if (dwrq
->value
& IW_AUTH_ALG_SHARED_KEY
) {
1729 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_SHARED_KEY
;
1730 } else if (dwrq
->value
& IW_AUTH_ALG_OPEN_SYSTEM
) {
1731 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1732 } else if (dwrq
->value
& IW_AUTH_ALG_LEAP
) {
1733 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_LEAP
;
1740 case IW_AUTH_WPA_ENABLED
:
1742 if (!assoc_req
->secinfo
.WPAenabled
&&
1743 !assoc_req
->secinfo
.WPA2enabled
) {
1744 assoc_req
->secinfo
.WPAenabled
= 1;
1745 assoc_req
->secinfo
.WPA2enabled
= 1;
1746 assoc_req
->secinfo
.wep_enabled
= 0;
1747 assoc_req
->secinfo
.auth_mode
= IW_AUTH_ALG_OPEN_SYSTEM
;
1750 assoc_req
->secinfo
.WPAenabled
= 0;
1751 assoc_req
->secinfo
.WPA2enabled
= 0;
1752 disable_wpa (assoc_req
);
1765 set_bit(ASSOC_FLAG_SECINFO
, &assoc_req
->flags
);
1766 lbs_postpone_association_work(priv
);
1767 } else if (ret
!= -EOPNOTSUPP
) {
1768 lbs_cancel_association_work(priv
);
1770 mutex_unlock(&priv
->lock
);
1772 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1776 static int lbs_get_auth(struct net_device
*dev
,
1777 struct iw_request_info
*info
,
1778 struct iw_param
*dwrq
,
1782 struct lbs_private
*priv
= dev
->priv
;
1784 lbs_deb_enter(LBS_DEB_WEXT
);
1786 switch (dwrq
->flags
& IW_AUTH_INDEX
) {
1787 case IW_AUTH_WPA_VERSION
:
1789 if (priv
->secinfo
.WPAenabled
)
1790 dwrq
->value
|= IW_AUTH_WPA_VERSION_WPA
;
1791 if (priv
->secinfo
.WPA2enabled
)
1792 dwrq
->value
|= IW_AUTH_WPA_VERSION_WPA2
;
1794 dwrq
->value
|= IW_AUTH_WPA_VERSION_DISABLED
;
1797 case IW_AUTH_80211_AUTH_ALG
:
1798 dwrq
->value
= priv
->secinfo
.auth_mode
;
1801 case IW_AUTH_WPA_ENABLED
:
1802 if (priv
->secinfo
.WPAenabled
&& priv
->secinfo
.WPA2enabled
)
1810 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1815 static int lbs_set_txpow(struct net_device
*dev
, struct iw_request_info
*info
,
1816 struct iw_param
*vwrq
, char *extra
)
1819 struct lbs_private
*priv
= dev
->priv
;
1820 s16 dbm
= (s16
) vwrq
->value
;
1822 lbs_deb_enter(LBS_DEB_WEXT
);
1824 if (vwrq
->disabled
) {
1825 lbs_set_radio(priv
, RADIO_PREAMBLE_AUTO
, 0);
1829 if (vwrq
->fixed
== 0) {
1830 /* User requests automatic tx power control, however there are
1831 * many auto tx settings. For now use firmware defaults until
1832 * we come up with a good way to expose these to the user. */
1833 if (priv
->fwrelease
< 0x09000000) {
1834 ret
= lbs_set_power_adapt_cfg(priv
, 1,
1835 POW_ADAPT_DEFAULT_P0
,
1836 POW_ADAPT_DEFAULT_P1
,
1837 POW_ADAPT_DEFAULT_P2
);
1841 ret
= lbs_set_tpc_cfg(priv
, 0, TPC_DEFAULT_P0
, TPC_DEFAULT_P1
,
1845 dbm
= priv
->txpower_max
;
1847 /* Userspace check in iwrange if it should use dBm or mW,
1848 * therefore this should never happen... Jean II */
1849 if ((vwrq
->flags
& IW_TXPOW_TYPE
) != IW_TXPOW_DBM
) {
1854 /* Validate requested power level against firmware allowed
1856 if (priv
->txpower_min
&& (dbm
< priv
->txpower_min
)) {
1861 if (priv
->txpower_max
&& (dbm
> priv
->txpower_max
)) {
1865 if (priv
->fwrelease
< 0x09000000) {
1866 ret
= lbs_set_power_adapt_cfg(priv
, 0,
1867 POW_ADAPT_DEFAULT_P0
,
1868 POW_ADAPT_DEFAULT_P1
,
1869 POW_ADAPT_DEFAULT_P2
);
1873 ret
= lbs_set_tpc_cfg(priv
, 0, TPC_DEFAULT_P0
, TPC_DEFAULT_P1
,
1879 /* If the radio was off, turn it on */
1880 if (!priv
->radio_on
) {
1881 ret
= lbs_set_radio(priv
, RADIO_PREAMBLE_AUTO
, 1);
1886 lbs_deb_wext("txpower set %d dBm\n", dbm
);
1888 ret
= lbs_set_tx_power(priv
, dbm
);
1891 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1895 static int lbs_get_essid(struct net_device
*dev
, struct iw_request_info
*info
,
1896 struct iw_point
*dwrq
, char *extra
)
1898 struct lbs_private
*priv
= dev
->priv
;
1900 lbs_deb_enter(LBS_DEB_WEXT
);
1903 * Note : if dwrq->flags != 0, we should get the relevant SSID from
1908 * Get the current SSID
1910 if (priv
->connect_status
== LBS_CONNECTED
) {
1911 memcpy(extra
, priv
->curbssparams
.ssid
,
1912 priv
->curbssparams
.ssid_len
);
1913 extra
[priv
->curbssparams
.ssid_len
] = '\0';
1915 memset(extra
, 0, 32);
1916 extra
[priv
->curbssparams
.ssid_len
] = '\0';
1919 * If none, we may want to get the one that was set
1922 dwrq
->length
= priv
->curbssparams
.ssid_len
;
1924 dwrq
->flags
= 1; /* active */
1926 lbs_deb_leave(LBS_DEB_WEXT
);
1930 static int lbs_set_essid(struct net_device
*dev
, struct iw_request_info
*info
,
1931 struct iw_point
*dwrq
, char *extra
)
1933 struct lbs_private
*priv
= dev
->priv
;
1935 u8 ssid
[IW_ESSID_MAX_SIZE
];
1937 struct assoc_request
* assoc_req
;
1938 int in_ssid_len
= dwrq
->length
;
1940 lbs_deb_enter(LBS_DEB_WEXT
);
1942 if (!priv
->radio_on
) {
1947 /* Check the size of the string */
1948 if (in_ssid_len
> IW_ESSID_MAX_SIZE
) {
1953 memset(&ssid
, 0, sizeof(ssid
));
1955 if (!dwrq
->flags
|| !in_ssid_len
) {
1956 /* "any" SSID requested; leave SSID blank */
1958 /* Specific SSID requested */
1959 memcpy(&ssid
, extra
, in_ssid_len
);
1960 ssid_len
= in_ssid_len
;
1964 lbs_deb_wext("requested any SSID\n");
1966 lbs_deb_wext("requested SSID '%s'\n",
1967 escape_essid(ssid
, ssid_len
));
1971 mutex_lock(&priv
->lock
);
1973 /* Get or create the current association request */
1974 assoc_req
= lbs_get_association_request(priv
);
1978 /* Copy the SSID to the association request */
1979 memcpy(&assoc_req
->ssid
, &ssid
, IW_ESSID_MAX_SIZE
);
1980 assoc_req
->ssid_len
= ssid_len
;
1981 set_bit(ASSOC_FLAG_SSID
, &assoc_req
->flags
);
1982 lbs_postpone_association_work(priv
);
1986 /* Cancel the association request if there was an error */
1988 lbs_cancel_association_work(priv
);
1991 mutex_unlock(&priv
->lock
);
1993 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
1997 static int lbs_mesh_get_essid(struct net_device
*dev
,
1998 struct iw_request_info
*info
,
1999 struct iw_point
*dwrq
, char *extra
)
2001 struct lbs_private
*priv
= dev
->priv
;
2003 lbs_deb_enter(LBS_DEB_WEXT
);
2005 memcpy(extra
, priv
->mesh_ssid
, priv
->mesh_ssid_len
);
2007 dwrq
->length
= priv
->mesh_ssid_len
;
2009 dwrq
->flags
= 1; /* active */
2011 lbs_deb_leave(LBS_DEB_WEXT
);
2015 static int lbs_mesh_set_essid(struct net_device
*dev
,
2016 struct iw_request_info
*info
,
2017 struct iw_point
*dwrq
, char *extra
)
2019 struct lbs_private
*priv
= dev
->priv
;
2022 lbs_deb_enter(LBS_DEB_WEXT
);
2024 if (!priv
->radio_on
) {
2029 /* Check the size of the string */
2030 if (dwrq
->length
> IW_ESSID_MAX_SIZE
) {
2035 if (!dwrq
->flags
|| !dwrq
->length
) {
2039 /* Specific SSID requested */
2040 memcpy(priv
->mesh_ssid
, extra
, dwrq
->length
);
2041 priv
->mesh_ssid_len
= dwrq
->length
;
2044 lbs_mesh_config(priv
, CMD_ACT_MESH_CONFIG_START
,
2045 priv
->curbssparams
.channel
);
2047 lbs_deb_leave_args(LBS_DEB_WEXT
, "ret %d", ret
);
2052 * @brief Connect to the AP or Ad-hoc Network with specific bssid
2054 * @param dev A pointer to net_device structure
2055 * @param info A pointer to iw_request_info structure
2056 * @param awrq A pointer to iw_param structure
2057 * @param extra A pointer to extra data buf
2058 * @return 0 --success, otherwise fail
2060 static int lbs_set_wap(struct net_device
*dev
, struct iw_request_info
*info
,
2061 struct sockaddr
*awrq
, char *extra
)
2063 struct lbs_private
*priv
= dev
->priv
;
2064 struct assoc_request
* assoc_req
;
2066 DECLARE_MAC_BUF(mac
);
2068 lbs_deb_enter(LBS_DEB_WEXT
);
2070 if (!priv
->radio_on
)
2073 if (awrq
->sa_family
!= ARPHRD_ETHER
)
2076 lbs_deb_wext("ASSOC: WAP: sa_data %s\n", print_mac(mac
, awrq
->sa_data
));
2078 mutex_lock(&priv
->lock
);
2080 /* Get or create the current association request */
2081 assoc_req
= lbs_get_association_request(priv
);
2083 lbs_cancel_association_work(priv
);
2086 /* Copy the BSSID to the association request */
2087 memcpy(&assoc_req
->bssid
, awrq
->sa_data
, ETH_ALEN
);
2088 set_bit(ASSOC_FLAG_BSSID
, &assoc_req
->flags
);
2089 lbs_postpone_association_work(priv
);
2092 mutex_unlock(&priv
->lock
);
2098 * iwconfig settable callbacks
2100 static const iw_handler lbs_handler
[] = {
2101 (iw_handler
) NULL
, /* SIOCSIWCOMMIT */
2102 (iw_handler
) lbs_get_name
, /* SIOCGIWNAME */
2103 (iw_handler
) NULL
, /* SIOCSIWNWID */
2104 (iw_handler
) NULL
, /* SIOCGIWNWID */
2105 (iw_handler
) lbs_set_freq
, /* SIOCSIWFREQ */
2106 (iw_handler
) lbs_get_freq
, /* SIOCGIWFREQ */
2107 (iw_handler
) lbs_set_mode
, /* SIOCSIWMODE */
2108 (iw_handler
) lbs_get_mode
, /* SIOCGIWMODE */
2109 (iw_handler
) NULL
, /* SIOCSIWSENS */
2110 (iw_handler
) NULL
, /* SIOCGIWSENS */
2111 (iw_handler
) NULL
, /* SIOCSIWRANGE */
2112 (iw_handler
) lbs_get_range
, /* SIOCGIWRANGE */
2113 (iw_handler
) NULL
, /* SIOCSIWPRIV */
2114 (iw_handler
) NULL
, /* SIOCGIWPRIV */
2115 (iw_handler
) NULL
, /* SIOCSIWSTATS */
2116 (iw_handler
) NULL
, /* SIOCGIWSTATS */
2117 iw_handler_set_spy
, /* SIOCSIWSPY */
2118 iw_handler_get_spy
, /* SIOCGIWSPY */
2119 iw_handler_set_thrspy
, /* SIOCSIWTHRSPY */
2120 iw_handler_get_thrspy
, /* SIOCGIWTHRSPY */
2121 (iw_handler
) lbs_set_wap
, /* SIOCSIWAP */
2122 (iw_handler
) lbs_get_wap
, /* SIOCGIWAP */
2123 (iw_handler
) NULL
, /* SIOCSIWMLME */
2124 (iw_handler
) NULL
, /* SIOCGIWAPLIST - deprecated */
2125 (iw_handler
) lbs_set_scan
, /* SIOCSIWSCAN */
2126 (iw_handler
) lbs_get_scan
, /* SIOCGIWSCAN */
2127 (iw_handler
) lbs_set_essid
, /* SIOCSIWESSID */
2128 (iw_handler
) lbs_get_essid
, /* SIOCGIWESSID */
2129 (iw_handler
) lbs_set_nick
, /* SIOCSIWNICKN */
2130 (iw_handler
) lbs_get_nick
, /* SIOCGIWNICKN */
2131 (iw_handler
) NULL
, /* -- hole -- */
2132 (iw_handler
) NULL
, /* -- hole -- */
2133 (iw_handler
) lbs_set_rate
, /* SIOCSIWRATE */
2134 (iw_handler
) lbs_get_rate
, /* SIOCGIWRATE */
2135 (iw_handler
) lbs_set_rts
, /* SIOCSIWRTS */
2136 (iw_handler
) lbs_get_rts
, /* SIOCGIWRTS */
2137 (iw_handler
) lbs_set_frag
, /* SIOCSIWFRAG */
2138 (iw_handler
) lbs_get_frag
, /* SIOCGIWFRAG */
2139 (iw_handler
) lbs_set_txpow
, /* SIOCSIWTXPOW */
2140 (iw_handler
) lbs_get_txpow
, /* SIOCGIWTXPOW */
2141 (iw_handler
) lbs_set_retry
, /* SIOCSIWRETRY */
2142 (iw_handler
) lbs_get_retry
, /* SIOCGIWRETRY */
2143 (iw_handler
) lbs_set_encode
, /* SIOCSIWENCODE */
2144 (iw_handler
) lbs_get_encode
, /* SIOCGIWENCODE */
2145 (iw_handler
) lbs_set_power
, /* SIOCSIWPOWER */
2146 (iw_handler
) lbs_get_power
, /* SIOCGIWPOWER */
2147 (iw_handler
) NULL
, /* -- hole -- */
2148 (iw_handler
) NULL
, /* -- hole -- */
2149 (iw_handler
) lbs_set_genie
, /* SIOCSIWGENIE */
2150 (iw_handler
) lbs_get_genie
, /* SIOCGIWGENIE */
2151 (iw_handler
) lbs_set_auth
, /* SIOCSIWAUTH */
2152 (iw_handler
) lbs_get_auth
, /* SIOCGIWAUTH */
2153 (iw_handler
) lbs_set_encodeext
,/* SIOCSIWENCODEEXT */
2154 (iw_handler
) lbs_get_encodeext
,/* SIOCGIWENCODEEXT */
2155 (iw_handler
) NULL
, /* SIOCSIWPMKSA */
2158 static const iw_handler mesh_wlan_handler
[] = {
2159 (iw_handler
) NULL
, /* SIOCSIWCOMMIT */
2160 (iw_handler
) lbs_get_name
, /* SIOCGIWNAME */
2161 (iw_handler
) NULL
, /* SIOCSIWNWID */
2162 (iw_handler
) NULL
, /* SIOCGIWNWID */
2163 (iw_handler
) lbs_mesh_set_freq
, /* SIOCSIWFREQ */
2164 (iw_handler
) lbs_get_freq
, /* SIOCGIWFREQ */
2165 (iw_handler
) NULL
, /* SIOCSIWMODE */
2166 (iw_handler
) mesh_wlan_get_mode
, /* SIOCGIWMODE */
2167 (iw_handler
) NULL
, /* SIOCSIWSENS */
2168 (iw_handler
) NULL
, /* SIOCGIWSENS */
2169 (iw_handler
) NULL
, /* SIOCSIWRANGE */
2170 (iw_handler
) lbs_get_range
, /* SIOCGIWRANGE */
2171 (iw_handler
) NULL
, /* SIOCSIWPRIV */
2172 (iw_handler
) NULL
, /* SIOCGIWPRIV */
2173 (iw_handler
) NULL
, /* SIOCSIWSTATS */
2174 (iw_handler
) NULL
, /* SIOCGIWSTATS */
2175 iw_handler_set_spy
, /* SIOCSIWSPY */
2176 iw_handler_get_spy
, /* SIOCGIWSPY */
2177 iw_handler_set_thrspy
, /* SIOCSIWTHRSPY */
2178 iw_handler_get_thrspy
, /* SIOCGIWTHRSPY */
2179 (iw_handler
) NULL
, /* SIOCSIWAP */
2180 (iw_handler
) NULL
, /* SIOCGIWAP */
2181 (iw_handler
) NULL
, /* SIOCSIWMLME */
2182 (iw_handler
) NULL
, /* SIOCGIWAPLIST - deprecated */
2183 (iw_handler
) lbs_set_scan
, /* SIOCSIWSCAN */
2184 (iw_handler
) lbs_get_scan
, /* SIOCGIWSCAN */
2185 (iw_handler
) lbs_mesh_set_essid
,/* SIOCSIWESSID */
2186 (iw_handler
) lbs_mesh_get_essid
,/* SIOCGIWESSID */
2187 (iw_handler
) NULL
, /* SIOCSIWNICKN */
2188 (iw_handler
) mesh_get_nick
, /* SIOCGIWNICKN */
2189 (iw_handler
) NULL
, /* -- hole -- */
2190 (iw_handler
) NULL
, /* -- hole -- */
2191 (iw_handler
) lbs_set_rate
, /* SIOCSIWRATE */
2192 (iw_handler
) lbs_get_rate
, /* SIOCGIWRATE */
2193 (iw_handler
) lbs_set_rts
, /* SIOCSIWRTS */
2194 (iw_handler
) lbs_get_rts
, /* SIOCGIWRTS */
2195 (iw_handler
) lbs_set_frag
, /* SIOCSIWFRAG */
2196 (iw_handler
) lbs_get_frag
, /* SIOCGIWFRAG */
2197 (iw_handler
) lbs_set_txpow
, /* SIOCSIWTXPOW */
2198 (iw_handler
) lbs_get_txpow
, /* SIOCGIWTXPOW */
2199 (iw_handler
) lbs_set_retry
, /* SIOCSIWRETRY */
2200 (iw_handler
) lbs_get_retry
, /* SIOCGIWRETRY */
2201 (iw_handler
) lbs_set_encode
, /* SIOCSIWENCODE */
2202 (iw_handler
) lbs_get_encode
, /* SIOCGIWENCODE */
2203 (iw_handler
) lbs_set_power
, /* SIOCSIWPOWER */
2204 (iw_handler
) lbs_get_power
, /* SIOCGIWPOWER */
2205 (iw_handler
) NULL
, /* -- hole -- */
2206 (iw_handler
) NULL
, /* -- hole -- */
2207 (iw_handler
) lbs_set_genie
, /* SIOCSIWGENIE */
2208 (iw_handler
) lbs_get_genie
, /* SIOCGIWGENIE */
2209 (iw_handler
) lbs_set_auth
, /* SIOCSIWAUTH */
2210 (iw_handler
) lbs_get_auth
, /* SIOCGIWAUTH */
2211 (iw_handler
) lbs_set_encodeext
,/* SIOCSIWENCODEEXT */
2212 (iw_handler
) lbs_get_encodeext
,/* SIOCGIWENCODEEXT */
2213 (iw_handler
) NULL
, /* SIOCSIWPMKSA */
2215 struct iw_handler_def lbs_handler_def
= {
2216 .num_standard
= ARRAY_SIZE(lbs_handler
),
2217 .standard
= (iw_handler
*) lbs_handler
,
2218 .get_wireless_stats
= lbs_get_wireless_stats
,
2221 struct iw_handler_def mesh_handler_def
= {
2222 .num_standard
= ARRAY_SIZE(mesh_wlan_handler
),
2223 .standard
= (iw_handler
*) mesh_wlan_handler
,
2224 .get_wireless_stats
= lbs_get_wireless_stats
,