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>
26 * @brief Convert mw value to dbm value
28 * @param mw the value of mw
29 * @return the value of dbm
31 static int mw_to_dbm(int mw)
72 * @brief Find the channel frequency power info with specific channel
74 * @param adapter A pointer to wlan_adapter structure
75 * @param band it can be BAND_A, BAND_G or BAND_B
76 * @param channel the channel for looking
77 * @return A pointer to struct chan_freq_power structure or NULL if not find.
79 struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * adapter,
82 struct chan_freq_power *cfp = NULL;
83 struct region_channel *rc;
84 int count = sizeof(adapter->region_channel) /
85 sizeof(adapter->region_channel[0]);
88 for (j = 0; !cfp && (j < count); j++) {
89 rc = &adapter->region_channel[j];
91 if (adapter->enable11d)
92 rc = &adapter->universal_channel[j];
93 if (!rc->valid || !rc->CFP)
97 for (i = 0; i < rc->nrcfp; i++) {
98 if (rc->CFP[i].channel == channel) {
106 lbs_pr_debug(1, "libertas_find_cfp_by_band_and_channel(): cannot find "
107 "cfp by band %d & channel %d\n", band, channel);
113 * @brief Find the channel frequency power info with specific frequency
115 * @param adapter A pointer to wlan_adapter structure
116 * @param band it can be BAND_A, BAND_G or BAND_B
117 * @param freq the frequency for looking
118 * @return A pointer to struct chan_freq_power structure or NULL if not find.
120 static struct chan_freq_power *find_cfp_by_band_and_freq(wlan_adapter * adapter,
123 struct chan_freq_power *cfp = NULL;
124 struct region_channel *rc;
125 int count = sizeof(adapter->region_channel) /
126 sizeof(adapter->region_channel[0]);
129 for (j = 0; !cfp && (j < count); j++) {
130 rc = &adapter->region_channel[j];
132 if (adapter->enable11d)
133 rc = &adapter->universal_channel[j];
134 if (!rc->valid || !rc->CFP)
136 if (rc->band != band)
138 for (i = 0; i < rc->nrcfp; i++) {
139 if (rc->CFP[i].freq == freq) {
147 lbs_pr_debug(1, "find_cfp_by_band_and_freql(): cannot find cfp by "
148 "band %d & freq %d\n", band, freq);
153 static int updatecurrentchannel(wlan_private * priv)
158 ** the channel in f/w could be out of sync, get the current channel
160 ret = libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel,
161 cmd_opt_802_11_rf_channel_get,
162 cmd_option_waitforrsp, 0, NULL);
164 lbs_pr_debug(1, "Current channel = %d\n",
165 priv->adapter->curbssparams.channel);
170 static int setcurrentchannel(wlan_private * priv, int channel)
172 lbs_pr_debug(1, "Set channel = %d\n", channel);
175 ** Current channel is not set to adhocchannel requested, set channel
177 return (libertas_prepare_and_send_command(priv, cmd_802_11_rf_channel,
178 cmd_opt_802_11_rf_channel_set,
179 cmd_option_waitforrsp, 0, &channel));
182 static int changeadhocchannel(wlan_private * priv, int channel)
185 wlan_adapter *adapter = priv->adapter;
187 adapter->adhocchannel = channel;
189 updatecurrentchannel(priv);
191 if (adapter->curbssparams.channel == adapter->adhocchannel) {
192 /* adhocchannel is set to the current channel already */
197 lbs_pr_debug(1, "Updating channel from %d to %d\n",
198 adapter->curbssparams.channel, adapter->adhocchannel);
200 setcurrentchannel(priv, adapter->adhocchannel);
202 updatecurrentchannel(priv);
204 if (adapter->curbssparams.channel != adapter->adhocchannel) {
205 lbs_pr_debug(1, "failed to updated channel to %d, channel = %d\n",
206 adapter->adhocchannel, adapter->curbssparams.channel);
211 if (adapter->connect_status == libertas_connected) {
213 struct WLAN_802_11_SSID curadhocssid;
215 lbs_pr_debug(1, "channel Changed while in an IBSS\n");
217 /* Copy the current ssid */
218 memcpy(&curadhocssid, &adapter->curbssparams.ssid,
219 sizeof(struct WLAN_802_11_SSID));
221 /* Exit Adhoc mode */
222 lbs_pr_debug(1, "In changeadhocchannel(): Sending Adhoc Stop\n");
223 ret = libertas_stop_adhoc_network(priv);
229 /* Scan for the network, do not save previous results. Stale
230 * scan data will cause us to join a non-existant adhoc network
232 libertas_send_specific_SSID_scan(priv, &curadhocssid, 0);
234 // find out the BSSID that matches the current SSID
235 i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL,
239 lbs_pr_debug(1, "SSID found at %d in List,"
241 libertas_join_adhoc_network(priv, &adapter->scantable[i]);
243 // else send START command
244 lbs_pr_debug(1, "SSID not found in list, "
245 "so creating adhoc with ssid = %s\n",
247 libertas_start_adhoc_network(priv, &curadhocssid);
248 } // end of else (START command)
256 * @brief Set Radio On/OFF
258 * @param priv A pointer to wlan_private structure
259 * @option Radio Option
260 * @return 0 --success, otherwise fail
262 int wlan_radio_ioctl(wlan_private * priv, u8 option)
265 wlan_adapter *adapter = priv->adapter;
269 if (adapter->radioon != option) {
270 lbs_pr_debug(1, "Switching %s the Radio\n", option ? "On" : "Off");
271 adapter->radioon = option;
273 ret = libertas_prepare_and_send_command(priv,
274 cmd_802_11_radio_control,
276 cmd_option_waitforrsp, 0, NULL);
286 * @param dest A pointer to Dest Buf
287 * @param src A pointer to Src Buf
288 * @param len The len of Src Buf
289 * @return Number of rates copyed
291 static inline int copyrates(u8 * dest, int pos, u8 * src, int len)
295 for (i = 0; i < len && src[i]; i++, pos++) {
296 if (pos >= sizeof(u8) * WLAN_SUPPORTED_RATES)
305 * @brief Get active data rates
307 * @param adapter A pointer to wlan_adapter structure
308 * @param rate The buf to return the active rates
309 * @return The number of rates
311 static int get_active_data_rates(wlan_adapter * adapter,
318 if (adapter->connect_status != libertas_connected) {
319 if (adapter->inframode == wlan802_11infrastructure) {
321 lbs_pr_debug(1, "Infra\n");
322 k = copyrates(rates, k, libertas_supported_rates,
323 sizeof(libertas_supported_rates));
326 lbs_pr_debug(1, "Adhoc G\n");
327 k = copyrates(rates, k, libertas_adhoc_rates_g,
328 sizeof(libertas_adhoc_rates_g));
331 k = copyrates(rates, 0, adapter->curbssparams.datarates,
332 adapter->curbssparams.numofrates);
340 static int wlan_get_name(struct net_device *dev, struct iw_request_info *info,
341 char *cwrq, char *extra)
344 char comm[6] = { "COMM-" };
345 char mrvl[6] = { "MRVL-" };
352 cp = strstr(libertas_driver_version, comm);
353 if (cp == libertas_driver_version) //skip leading "COMM-"
354 cp = libertas_driver_version + strlen(comm);
356 cp = libertas_driver_version;
360 while (cnt < 16 && (*cp != '-')) {
361 *cwrq++ = toupper(*cp++);
371 static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info,
372 struct iw_freq *fwrq, char *extra)
374 wlan_private *priv = dev->priv;
375 wlan_adapter *adapter = priv->adapter;
376 struct chan_freq_power *cfp;
380 cfp = libertas_find_cfp_by_band_and_channel(adapter, 0,
381 adapter->curbssparams.channel);
384 if (adapter->curbssparams.channel)
385 lbs_pr_debug(1, "Invalid channel=%d\n",
386 adapter->curbssparams.channel);
390 fwrq->m = (long)cfp->freq * 100000;
393 lbs_pr_debug(1, "freq=%u\n", fwrq->m);
399 static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
400 struct sockaddr *awrq, char *extra)
402 wlan_private *priv = dev->priv;
403 wlan_adapter *adapter = priv->adapter;
407 if (adapter->connect_status == libertas_connected) {
408 memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN);
410 memset(awrq->sa_data, 0, ETH_ALEN);
412 awrq->sa_family = ARPHRD_ETHER;
418 static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info,
419 struct iw_point *dwrq, char *extra)
421 wlan_private *priv = dev->priv;
422 wlan_adapter *adapter = priv->adapter;
427 * Check the size of the string
430 if (dwrq->length > 16) {
434 mutex_lock(&adapter->lock);
435 memset(adapter->nodename, 0, sizeof(adapter->nodename));
436 memcpy(adapter->nodename, extra, dwrq->length);
437 mutex_unlock(&adapter->lock);
443 static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info,
444 struct iw_point *dwrq, char *extra)
446 wlan_private *priv = dev->priv;
447 wlan_adapter *adapter = priv->adapter;
452 * Get the Nick Name saved
455 mutex_lock(&adapter->lock);
456 strncpy(extra, adapter->nodename, 16);
457 mutex_unlock(&adapter->lock);
462 * If none, we may want to get the one that was set
468 dwrq->length = strlen(extra) + 1;
474 static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
475 struct iw_param *vwrq, char *extra)
478 wlan_private *priv = dev->priv;
479 wlan_adapter *adapter = priv->adapter;
480 int rthr = vwrq->value;
484 if (vwrq->disabled) {
485 adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE;
487 if (rthr < MRVDRV_RTS_MIN_VALUE || rthr > MRVDRV_RTS_MAX_VALUE)
489 adapter->rtsthsd = rthr;
492 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
493 cmd_act_set, cmd_option_waitforrsp,
494 OID_802_11_RTS_THRESHOLD, &rthr);
500 static int wlan_get_rts(struct net_device *dev, struct iw_request_info *info,
501 struct iw_param *vwrq, char *extra)
504 wlan_private *priv = dev->priv;
505 wlan_adapter *adapter = priv->adapter;
509 adapter->rtsthsd = 0;
510 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
511 cmd_act_get, cmd_option_waitforrsp,
512 OID_802_11_RTS_THRESHOLD, NULL);
518 vwrq->value = adapter->rtsthsd;
519 vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE)
520 || (vwrq->value > MRVDRV_RTS_MAX_VALUE));
527 static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
528 struct iw_param *vwrq, char *extra)
531 int fthr = vwrq->value;
532 wlan_private *priv = dev->priv;
533 wlan_adapter *adapter = priv->adapter;
537 if (vwrq->disabled) {
538 adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE;
540 if (fthr < MRVDRV_FRAG_MIN_VALUE
541 || fthr > MRVDRV_FRAG_MAX_VALUE)
543 adapter->fragthsd = fthr;
546 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
547 cmd_act_set, cmd_option_waitforrsp,
548 OID_802_11_FRAGMENTATION_THRESHOLD, &fthr);
553 static int wlan_get_frag(struct net_device *dev, struct iw_request_info *info,
554 struct iw_param *vwrq, char *extra)
557 wlan_private *priv = dev->priv;
558 wlan_adapter *adapter = priv->adapter;
562 adapter->fragthsd = 0;
563 ret = libertas_prepare_and_send_command(priv,
565 cmd_act_get, cmd_option_waitforrsp,
566 OID_802_11_FRAGMENTATION_THRESHOLD, NULL);
572 vwrq->value = adapter->fragthsd;
573 vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE)
574 || (vwrq->value > MRVDRV_FRAG_MAX_VALUE));
581 static int wlan_get_mode(struct net_device *dev,
582 struct iw_request_info *info, u32 * uwrq, char *extra)
584 wlan_private *priv = dev->priv;
585 wlan_adapter *adapter = priv->adapter;
589 switch (adapter->inframode) {
591 *uwrq = IW_MODE_ADHOC;
594 case wlan802_11infrastructure:
595 *uwrq = IW_MODE_INFRA;
599 case wlan802_11autounknown:
600 *uwrq = IW_MODE_AUTO;
608 static int wlan_get_txpow(struct net_device *dev,
609 struct iw_request_info *info,
610 struct iw_param *vwrq, char *extra)
613 wlan_private *priv = dev->priv;
614 wlan_adapter *adapter = priv->adapter;
618 ret = libertas_prepare_and_send_command(priv,
619 cmd_802_11_rf_tx_power,
620 cmd_act_tx_power_opt_get,
621 cmd_option_waitforrsp, 0, NULL);
628 lbs_pr_debug(1, "TXPOWER GET %d dbm.\n", adapter->txpowerlevel);
629 vwrq->value = adapter->txpowerlevel;
631 if (adapter->radioon) {
633 vwrq->flags = IW_TXPOW_DBM;
642 static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info,
643 struct iw_param *vwrq, char *extra)
646 wlan_private *priv = dev->priv;
647 wlan_adapter *adapter = priv->adapter;
651 if (vwrq->flags == IW_RETRY_LIMIT) {
652 /* The MAC has a 4-bit Total_Tx_Count register
653 Total_Tx_Count = 1 + Tx_Retry_Count */
654 #define TX_RETRY_MIN 0
655 #define TX_RETRY_MAX 14
656 if (vwrq->value < TX_RETRY_MIN || vwrq->value > TX_RETRY_MAX)
659 /* Adding 1 to convert retry count to try count */
660 adapter->txretrycount = vwrq->value + 1;
662 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
664 cmd_option_waitforrsp,
665 OID_802_11_TX_RETRYCOUNT, NULL);
679 static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
680 struct iw_param *vwrq, char *extra)
682 wlan_private *priv = dev->priv;
683 wlan_adapter *adapter = priv->adapter;
687 adapter->txretrycount = 0;
688 ret = libertas_prepare_and_send_command(priv,
690 cmd_act_get, cmd_option_waitforrsp,
691 OID_802_11_TX_RETRYCOUNT, NULL);
698 vwrq->flags = IW_RETRY_LIMIT;
699 /* Subtract 1 to convert try count to retry count */
700 vwrq->value = adapter->txretrycount - 1;
707 static inline void sort_channels(struct iw_freq *freq, int num)
712 for (i = 0; i < num; i++)
713 for (j = i + 1; j < num; j++)
714 if (freq[i].i > freq[j].i) {
718 freq[i].i = freq[j].i;
719 freq[i].m = freq[j].m;
729 Infra G(12) A(8) B(4) G(12)
730 Adhoc A+B(12) A(8) B(4) B(4)
738 * @brief Get Range Info
740 * @param dev A pointer to net_device structure
741 * @param info A pointer to iw_request_info structure
742 * @param vwrq A pointer to iw_param structure
743 * @param extra A pointer to extra data buf
744 * @return 0 --success, otherwise fail
746 static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
747 struct iw_point *dwrq, char *extra)
750 wlan_private *priv = dev->priv;
751 wlan_adapter *adapter = priv->adapter;
752 struct iw_range *range = (struct iw_range *)extra;
753 struct chan_freq_power *cfp;
754 u8 rates[WLAN_SUPPORTED_RATES];
760 dwrq->length = sizeof(struct iw_range);
761 memset(range, 0, sizeof(struct iw_range));
766 memset(rates, 0, sizeof(rates));
767 range->num_bitrates = get_active_data_rates(adapter, rates);
769 for (i = 0; i < min_t(__u8, range->num_bitrates, IW_MAX_BITRATES) && rates[i];
771 range->bitrate[i] = (rates[i] & 0x7f) * 500000;
773 range->num_bitrates = i;
774 lbs_pr_debug(1, "IW_MAX_BITRATES=%d num_bitrates=%d\n", IW_MAX_BITRATES,
775 range->num_bitrates);
777 range->num_frequency = 0;
778 if (priv->adapter->enable11d &&
779 adapter->connect_status == libertas_connected) {
783 struct parsed_region_chan_11d *parsed_region_chan =
784 &adapter->parsed_region_chan;
786 if (parsed_region_chan == NULL) {
787 lbs_pr_debug(1, "11D:parsed_region_chan is NULL\n");
791 band = parsed_region_chan->band;
792 lbs_pr_debug(1, "band=%d NoOfChan=%d\n", band,
793 parsed_region_chan->nr_chan);
795 for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
796 && (i < parsed_region_chan->nr_chan); i++) {
797 chan_no = parsed_region_chan->chanpwr[i].chan;
798 lbs_pr_debug(1, "chan_no=%d\n", chan_no);
799 range->freq[range->num_frequency].i = (long)chan_no;
800 range->freq[range->num_frequency].m =
801 (long)libertas_chan_2_freq(chan_no, band) * 100000;
802 range->freq[range->num_frequency].e = 1;
803 range->num_frequency++;
808 for (j = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
809 && (j < sizeof(adapter->region_channel)
810 / sizeof(adapter->region_channel[0])); j++) {
811 cfp = adapter->region_channel[j].CFP;
812 for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
813 && adapter->region_channel[j].valid
815 && (i < adapter->region_channel[j].nrcfp); i++) {
816 range->freq[range->num_frequency].i =
818 range->freq[range->num_frequency].m =
819 (long)cfp->freq * 100000;
820 range->freq[range->num_frequency].e = 1;
822 range->num_frequency++;
827 lbs_pr_debug(1, "IW_MAX_FREQUENCIES=%d num_frequency=%d\n",
828 IW_MAX_FREQUENCIES, range->num_frequency);
830 range->num_channels = range->num_frequency;
832 sort_channels(&range->freq[0], range->num_frequency);
835 * Set an indication of the max TCP throughput in bit/s that we can
836 * expect using this interface
839 range->throughput = 5000 * 1000;
841 range->throughput = 1500 * 1000;
843 range->min_rts = MRVDRV_RTS_MIN_VALUE;
844 range->max_rts = MRVDRV_RTS_MAX_VALUE;
845 range->min_frag = MRVDRV_FRAG_MIN_VALUE;
846 range->max_frag = MRVDRV_FRAG_MAX_VALUE;
848 range->encoding_size[0] = 5;
849 range->encoding_size[1] = 13;
850 range->num_encoding_sizes = 2;
851 range->max_encoding_tokens = 4;
853 range->min_pmp = 1000000;
854 range->max_pmp = 120000000;
855 range->min_pmt = 1000;
856 range->max_pmt = 1000000;
857 range->pmp_flags = IW_POWER_PERIOD;
858 range->pmt_flags = IW_POWER_TIMEOUT;
859 range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R;
862 * Minimum version we recommend
864 range->we_version_source = 15;
867 * Version we are compiled with
869 range->we_version_compiled = WIRELESS_EXT;
871 range->retry_capa = IW_RETRY_LIMIT;
872 range->retry_flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
874 range->min_retry = TX_RETRY_MIN;
875 range->max_retry = TX_RETRY_MAX;
878 * Set the qual, level and noise range values
880 range->max_qual.qual = 100;
881 range->max_qual.level = 0;
882 range->max_qual.noise = 0;
883 range->max_qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
885 range->avg_qual.qual = 70;
886 /* TODO: Find real 'good' to 'bad' threshold value for RSSI */
887 range->avg_qual.level = 0;
888 range->avg_qual.noise = 0;
889 range->avg_qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
891 range->sensitivity = 0;
894 * Setup the supported power level ranges
896 memset(range->txpower, 0, sizeof(range->txpower));
897 range->txpower[0] = 5;
898 range->txpower[1] = 7;
899 range->txpower[2] = 9;
900 range->txpower[3] = 11;
901 range->txpower[4] = 13;
902 range->txpower[5] = 15;
903 range->txpower[6] = 17;
904 range->txpower[7] = 19;
906 range->num_txpower = 8;
907 range->txpower_capa = IW_TXPOW_DBM;
908 range->txpower_capa |= IW_TXPOW_RANGE;
910 range->event_capa[0] = (IW_EVENT_CAPA_K_0 |
911 IW_EVENT_CAPA_MASK(SIOCGIWAP) |
912 IW_EVENT_CAPA_MASK(SIOCGIWSCAN));
913 range->event_capa[1] = IW_EVENT_CAPA_K_1;
915 if (adapter->fwcapinfo & FW_CAPINFO_WPA) {
916 range->enc_capa = IW_ENC_CAPA_WPA
918 | IW_ENC_CAPA_CIPHER_TKIP
919 | IW_ENC_CAPA_CIPHER_CCMP;
926 static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
927 struct iw_param *vwrq, char *extra)
929 wlan_private *priv = dev->priv;
930 wlan_adapter *adapter = priv->adapter;
934 /* PS is currently supported only in Infrastructure mode
935 * Remove this check if it is to be supported in IBSS mode also
938 if (vwrq->disabled) {
939 adapter->psmode = wlan802_11powermodecam;
940 if (adapter->psstate != PS_STATE_FULL_POWER) {
941 libertas_ps_wakeup(priv, cmd_option_waitforrsp);
947 if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
949 "Setting power timeout command is not supported\n");
951 } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
952 lbs_pr_debug(1, "Setting power period command is not supported\n");
956 if (adapter->psmode != wlan802_11powermodecam) {
960 adapter->psmode = wlan802_11powermodemax_psp;
962 if (adapter->connect_status == libertas_connected) {
963 libertas_ps_sleep(priv, cmd_option_waitforrsp);
970 static int wlan_get_power(struct net_device *dev, struct iw_request_info *info,
971 struct iw_param *vwrq, char *extra)
973 wlan_private *priv = dev->priv;
974 wlan_adapter *adapter = priv->adapter;
979 mode = adapter->psmode;
981 if ((vwrq->disabled = (mode == wlan802_11powermodecam))
982 || adapter->connect_status == libertas_disconnected) {
994 * iwpriv settable callbacks
997 static const iw_handler wlan_private_handler[] = {
998 NULL, /* SIOCIWFIRSTPRIV */
1001 static const struct iw_priv_args wlan_private_args[] = {
1003 * { cmd, set_args, get_args, name }
1007 IW_PRIV_TYPE_CHAR | 8,
1008 IW_PRIV_TYPE_CHAR | 8,
1013 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1014 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1018 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1019 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1023 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1024 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1028 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1029 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1033 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1034 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1038 WLAN_SUBCMD_SET_PRESCAN,
1039 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1040 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1043 WLAN_SETONEINT_GETONEINT,
1044 IW_PRIV_TYPE_INT | 1,
1045 IW_PRIV_TYPE_INT | 1,
1048 WLAN_BEACON_INTERVAL,
1049 IW_PRIV_TYPE_INT | 1,
1050 IW_PRIV_TYPE_INT | 1,
1054 IW_PRIV_TYPE_INT | 1,
1055 IW_PRIV_TYPE_INT | 1,
1059 IW_PRIV_TYPE_INT | 1,
1060 IW_PRIV_TYPE_INT | 1,
1063 WLAN_NULLPKTINTERVAL,
1064 IW_PRIV_TYPE_INT | 1,
1065 IW_PRIV_TYPE_INT | 1,
1067 /* Using iwpriv sub-command feature */
1069 WLAN_SETONEINT_GETNONE, /* IOCTL: 24 */
1070 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1075 WLAN_SUBCMD_SETRXANTENNA,
1076 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1080 WLAN_SUBCMD_SETTXANTENNA,
1081 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1085 WLANSETENCRYPTIONMODE,
1086 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1092 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1096 WLAN_SET_LISTEN_INTERVAL,
1097 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1101 WLAN_SET_MULTIPLE_DTIM,
1102 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1106 WLAN_SET_ATIM_WINDOW,
1107 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1112 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1117 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1122 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1127 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1132 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1136 WLAN_SUBCMD_MESH_SET_TTL,
1137 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1141 WLAN_SETNONE_GETONEINT,
1143 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1148 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1151 WLAN_GET_LISTEN_INTERVAL,
1153 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1156 WLAN_GET_MULTIPLE_DTIM,
1158 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1163 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1168 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1173 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1178 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1183 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1186 WLAN_SUBCMD_FWT_CLEANUP,
1188 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1191 WLAN_SUBCMD_FWT_TIME,
1193 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1196 WLAN_SUBCMD_MESH_GET_TTL,
1198 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1201 WLAN_SETNONE_GETTWELVE_CHAR,
1203 IW_PRIV_TYPE_CHAR | 12,
1206 WLAN_SUBCMD_GETRXANTENNA,
1208 IW_PRIV_TYPE_CHAR | 12,
1211 WLAN_SUBCMD_GETTXANTENNA,
1213 IW_PRIV_TYPE_CHAR | 12,
1218 IW_PRIV_TYPE_CHAR | 12,
1221 WLAN_SETNONE_GETNONE,
1256 WLAN_SUBCMD_FWT_RESET,
1261 WLAN_SUBCMD_BT_RESET,
1266 WLAN_SET128CHAR_GET128CHAR,
1267 IW_PRIV_TYPE_CHAR | 128,
1268 IW_PRIV_TYPE_CHAR | 128,
1273 IW_PRIV_TYPE_CHAR | 128,
1274 IW_PRIV_TYPE_CHAR | 128,
1278 IW_PRIV_TYPE_CHAR | 128,
1279 IW_PRIV_TYPE_CHAR | 128,
1282 WLAN_SUBCMD_BT_LIST,
1283 IW_PRIV_TYPE_CHAR | 128,
1284 IW_PRIV_TYPE_CHAR | 128,
1286 /* FWT Management */
1288 WLAN_SUBCMD_FWT_ADD,
1289 IW_PRIV_TYPE_CHAR | 128,
1290 IW_PRIV_TYPE_CHAR | 128,
1293 WLAN_SUBCMD_FWT_DEL,
1294 IW_PRIV_TYPE_CHAR | 128,
1295 IW_PRIV_TYPE_CHAR | 128,
1298 WLAN_SUBCMD_FWT_LOOKUP,
1299 IW_PRIV_TYPE_CHAR | 128,
1300 IW_PRIV_TYPE_CHAR | 128,
1303 WLAN_SUBCMD_FWT_LIST_NEIGHBOR,
1304 IW_PRIV_TYPE_CHAR | 128,
1305 IW_PRIV_TYPE_CHAR | 128,
1308 WLAN_SUBCMD_FWT_LIST,
1309 IW_PRIV_TYPE_CHAR | 128,
1310 IW_PRIV_TYPE_CHAR | 128,
1313 WLAN_SUBCMD_FWT_LIST_ROUTE,
1314 IW_PRIV_TYPE_CHAR | 128,
1315 IW_PRIV_TYPE_CHAR | 128,
1319 IW_PRIV_TYPE_CHAR | 128,
1320 IW_PRIV_TYPE_CHAR | 128,
1323 WLAN_GET_ADHOC_STATUS,
1324 IW_PRIV_TYPE_CHAR | 128,
1325 IW_PRIV_TYPE_CHAR | 128,
1328 WLAN_SETNONE_GETWORDCHAR,
1330 IW_PRIV_TYPE_CHAR | 128,
1335 IW_PRIV_TYPE_CHAR | GETLOG_BUFSIZE,
1338 WLAN_SET_GET_SIXTEEN_INT,
1339 IW_PRIV_TYPE_INT | 16,
1340 IW_PRIV_TYPE_INT | 16,
1344 IW_PRIV_TYPE_INT | 16,
1345 IW_PRIV_TYPE_INT | 16,
1349 IW_PRIV_TYPE_INT | 16,
1350 IW_PRIV_TYPE_INT | 16,
1354 IW_PRIV_TYPE_INT | 16,
1355 IW_PRIV_TYPE_INT | 16,
1359 IW_PRIV_TYPE_INT | 16,
1360 IW_PRIV_TYPE_INT | 16,
1364 IW_PRIV_TYPE_INT | 16,
1365 IW_PRIV_TYPE_INT | 16,
1369 IW_PRIV_TYPE_INT | 16,
1370 IW_PRIV_TYPE_INT | 16,
1374 IW_PRIV_TYPE_INT | 16,
1375 IW_PRIV_TYPE_INT | 16,
1378 WLAN_INACTIVITY_TIMEOUT,
1379 IW_PRIV_TYPE_INT | 16,
1380 IW_PRIV_TYPE_INT | 16,
1384 IW_PRIV_TYPE_INT | 16,
1385 IW_PRIV_TYPE_INT | 16,
1389 IW_PRIV_TYPE_INT | 16,
1390 IW_PRIV_TYPE_INT | 16,
1394 IW_PRIV_TYPE_INT | 16,
1395 IW_PRIV_TYPE_INT | 16,
1399 static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1409 wlan_private *priv = dev->priv;
1410 wlan_adapter *adapter = priv->adapter;
1414 int stats_valid = 0;
1420 priv->wstats.status = adapter->inframode;
1422 /* If we're not associated, all quality values are meaningless */
1423 if (adapter->connect_status != libertas_connected)
1426 /* Quality by RSSI */
1427 priv->wstats.qual.level =
1428 CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG],
1429 adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
1431 if (adapter->NF[TYPE_BEACON][TYPE_NOAVG] == 0) {
1432 priv->wstats.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE;
1434 priv->wstats.qual.noise =
1435 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
1438 lbs_pr_debug(1, "Signal Level = %#x\n", priv->wstats.qual.level);
1439 lbs_pr_debug(1, "Noise = %#x\n", priv->wstats.qual.noise);
1441 rssi = priv->wstats.qual.level - priv->wstats.qual.noise;
1443 rssi_qual = rssi * POOR / 10;
1445 rssi_qual = (rssi - 15) * (FAIR - POOR) / 5 + POOR;
1447 rssi_qual = (rssi - 20) * (GOOD - FAIR) / 5 + FAIR;
1449 rssi_qual = (rssi - 30) * (VERY_GOOD - GOOD) /
1452 rssi_qual = (rssi - 40) * (PERFECT - VERY_GOOD) /
1454 quality = rssi_qual;
1456 /* Quality by TX errors */
1457 priv->wstats.discard.retries = priv->stats.tx_errors;
1459 tx_retries = adapter->logmsg.retry;
1461 if (tx_retries > 75)
1462 tx_qual = (90 - tx_retries) * POOR / 15;
1463 else if (tx_retries > 70)
1464 tx_qual = (75 - tx_retries) * (FAIR - POOR) / 5 + POOR;
1465 else if (tx_retries > 65)
1466 tx_qual = (70 - tx_retries) * (GOOD - FAIR) / 5 + FAIR;
1467 else if (tx_retries > 50)
1468 tx_qual = (65 - tx_retries) * (VERY_GOOD - GOOD) /
1471 tx_qual = (50 - tx_retries) *
1472 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD;
1473 quality = min(quality, tx_qual);
1475 priv->wstats.discard.code = adapter->logmsg.wepundecryptable;
1476 priv->wstats.discard.fragment = adapter->logmsg.fcserror;
1477 priv->wstats.discard.retries = tx_retries;
1478 priv->wstats.discard.misc = adapter->logmsg.ackfailure;
1480 /* Calculate quality */
1481 priv->wstats.qual.qual = max(quality, (u32)100);
1482 priv->wstats.qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
1485 /* update stats asynchronously for future calls */
1486 libertas_prepare_and_send_command(priv, cmd_802_11_rssi, 0,
1488 libertas_prepare_and_send_command(priv, cmd_802_11_get_log, 0,
1492 priv->wstats.miss.beacon = 0;
1493 priv->wstats.discard.retries = 0;
1494 priv->wstats.qual.qual = 0;
1495 priv->wstats.qual.level = 0;
1496 priv->wstats.qual.noise = 0;
1497 priv->wstats.qual.updated = IW_QUAL_ALL_UPDATED;
1498 priv->wstats.qual.updated |= IW_QUAL_NOISE_INVALID |
1499 IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID;
1503 return &priv->wstats;
1508 static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1509 struct iw_freq *fwrq, char *extra)
1512 wlan_private *priv = dev->priv;
1513 wlan_adapter *adapter = priv->adapter;
1514 int rc = -EINPROGRESS; /* Call commit handler */
1515 struct chan_freq_power *cfp;
1520 * If setting by frequency, convert to a channel
1524 long f = fwrq->m / 100000;
1527 cfp = find_cfp_by_band_and_freq(adapter, 0, f);
1529 lbs_pr_debug(1, "Invalid freq=%ld\n", f);
1533 c = (int)cfp->channel;
1543 * Setting by channel number
1545 if (fwrq->m > 1000 || fwrq->e > 0) {
1548 int channel = fwrq->m;
1550 cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, channel);
1554 if (adapter->inframode == wlan802_11ibss) {
1555 rc = changeadhocchannel(priv, channel);
1556 /* If station is WEP enabled, send the
1557 * command to set WEP in firmware
1559 if (adapter->secinfo.wep_enabled) {
1560 lbs_pr_debug(1, "set_freq: WEP enabled\n");
1561 ret = libertas_prepare_and_send_command(priv,
1564 cmd_option_waitforrsp,
1573 adapter->currentpacketfilter |=
1574 cmd_act_mac_wep_enable;
1576 libertas_set_mac_packet_filter(priv);
1589 * @brief use index to get the data rate
1591 * @param index The index of data rate
1592 * @return data rate or 0
1594 u32 libertas_index_to_data_rate(u8 index)
1596 if (index >= sizeof(libertas_wlan_data_rates))
1599 return libertas_wlan_data_rates[index];
1603 * @brief use rate to get the index
1605 * @param rate data rate
1606 * @return index or 0
1608 u8 libertas_data_rate_to_index(u32 rate)
1613 if ((ptr = memchr(libertas_wlan_data_rates, (u8) rate,
1614 sizeof(libertas_wlan_data_rates))))
1615 return (ptr - libertas_wlan_data_rates);
1620 static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
1621 struct iw_param *vwrq, char *extra)
1623 wlan_private *priv = dev->priv;
1624 wlan_adapter *adapter = priv->adapter;
1628 u8 rates[WLAN_SUPPORTED_RATES];
1633 lbs_pr_debug(1, "Vwrq->value = %d\n", vwrq->value);
1635 if (vwrq->value == -1) {
1636 action = cmd_act_set_tx_auto; // Auto
1637 adapter->is_datarate_auto = 1;
1638 adapter->datarate = 0;
1640 if (vwrq->value % 100000) {
1644 data_rate = vwrq->value / 500000;
1646 memset(rates, 0, sizeof(rates));
1647 get_active_data_rates(adapter, rates);
1650 lbs_pr_debug(1, "Rate=0x%X Wanted=0x%X\n", *rate,
1652 if ((*rate & 0x7f) == (data_rate & 0x7f))
1657 lbs_pr_alert( "The fixed data rate 0x%X is out "
1658 "of range.\n", data_rate);
1662 adapter->datarate = data_rate;
1663 action = cmd_act_set_tx_fix_rate;
1664 adapter->is_datarate_auto = 0;
1667 ret = libertas_prepare_and_send_command(priv, cmd_802_11_data_rate,
1668 action, cmd_option_waitforrsp, 0, NULL);
1674 static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info,
1675 struct iw_param *vwrq, char *extra)
1677 wlan_private *priv = dev->priv;
1678 wlan_adapter *adapter = priv->adapter;
1682 if (adapter->is_datarate_auto) {
1688 vwrq->value = adapter->datarate * 500000;
1694 static int wlan_set_mode(struct net_device *dev,
1695 struct iw_request_info *info, u32 * uwrq, char *extra)
1698 wlan_private *priv = dev->priv;
1699 wlan_adapter *adapter = priv->adapter;
1700 struct assoc_request * assoc_req;
1701 enum WLAN_802_11_NETWORK_INFRASTRUCTURE new_mode;
1707 lbs_pr_debug(1, "Wanted mode is ad-hoc: current datarate=%#x\n",
1709 new_mode = wlan802_11ibss;
1710 adapter->adhocchannel = DEFAULT_AD_HOC_CHANNEL;
1714 lbs_pr_debug(1, "Wanted mode is Infrastructure\n");
1715 new_mode = wlan802_11infrastructure;
1719 lbs_pr_debug(1, "Wanted mode is Auto\n");
1720 new_mode = wlan802_11autounknown;
1724 lbs_pr_debug(1, "Wanted mode is Unknown: 0x%x\n", *uwrq);
1728 mutex_lock(&adapter->lock);
1729 assoc_req = wlan_get_association_request(adapter);
1733 assoc_req->mode = new_mode;
1737 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags);
1738 wlan_postpone_association_work(priv);
1740 wlan_cancel_association_work(priv);
1742 mutex_unlock(&adapter->lock);
1750 * @brief Get Encryption key
1752 * @param dev A pointer to net_device structure
1753 * @param info A pointer to iw_request_info structure
1754 * @param vwrq A pointer to iw_param structure
1755 * @param extra A pointer to extra data buf
1756 * @return 0 --success, otherwise fail
1758 static int wlan_get_encode(struct net_device *dev,
1759 struct iw_request_info *info,
1760 struct iw_point *dwrq, u8 * extra)
1762 wlan_private *priv = dev->priv;
1763 wlan_adapter *adapter = priv->adapter;
1764 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1768 lbs_pr_debug(1, "flags=0x%x index=%d length=%d wep_tx_keyidx=%d\n",
1769 dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx);
1773 /* Authentication method */
1774 switch (adapter->secinfo.auth_mode) {
1775 case IW_AUTH_ALG_OPEN_SYSTEM:
1776 dwrq->flags = IW_ENCODE_OPEN;
1779 case IW_AUTH_ALG_SHARED_KEY:
1780 case IW_AUTH_ALG_LEAP:
1781 dwrq->flags = IW_ENCODE_RESTRICTED;
1784 dwrq->flags = IW_ENCODE_DISABLED | IW_ENCODE_OPEN;
1788 if ( adapter->secinfo.wep_enabled
1789 || adapter->secinfo.WPAenabled
1790 || adapter->secinfo.WPA2enabled) {
1791 dwrq->flags &= ~IW_ENCODE_DISABLED;
1793 dwrq->flags |= IW_ENCODE_DISABLED;
1796 memset(extra, 0, 16);
1798 mutex_lock(&adapter->lock);
1800 /* Default to returning current transmit key */
1802 index = adapter->wep_tx_keyidx;
1804 if ((adapter->wep_keys[index].len) && adapter->secinfo.wep_enabled) {
1805 memcpy(extra, adapter->wep_keys[index].key,
1806 adapter->wep_keys[index].len);
1807 dwrq->length = adapter->wep_keys[index].len;
1809 dwrq->flags |= (index + 1);
1810 /* Return WEP enabled */
1811 dwrq->flags &= ~IW_ENCODE_DISABLED;
1812 } else if ((adapter->secinfo.WPAenabled)
1813 || (adapter->secinfo.WPA2enabled)) {
1814 /* return WPA enabled */
1815 dwrq->flags &= ~IW_ENCODE_DISABLED;
1817 dwrq->flags |= IW_ENCODE_DISABLED;
1820 mutex_unlock(&adapter->lock);
1822 dwrq->flags |= IW_ENCODE_NOKEY;
1824 lbs_pr_debug(1, "key:%02x:%02x:%02x:%02x:%02x:%02x keylen=%d\n",
1825 extra[0], extra[1], extra[2],
1826 extra[3], extra[4], extra[5], dwrq->length);
1828 lbs_pr_debug(1, "Return flags=0x%x\n", dwrq->flags);
1835 * @brief Set Encryption key (internal)
1837 * @param priv A pointer to private card structure
1838 * @param key_material A pointer to key material
1839 * @param key_length length of key material
1840 * @param index key index to set
1841 * @param set_tx_key Force set TX key (1 = yes, 0 = no)
1842 * @return 0 --success, otherwise fail
1844 static int wlan_set_wep_key(struct assoc_request *assoc_req,
1845 const char *key_material,
1850 struct WLAN_802_11_KEY *pkey;
1854 /* Paranoid validation of key index */
1860 /* validate max key length */
1861 if (key_length > KEY_LEN_WEP_104) {
1866 pkey = &assoc_req->wep_keys[index];
1868 if (key_length > 0) {
1869 memset(pkey, 0, sizeof(struct WLAN_802_11_KEY));
1870 pkey->type = KEY_TYPE_ID_WEP;
1872 /* Standardize the key length */
1873 pkey->len = (key_length > KEY_LEN_WEP_40) ?
1874 KEY_LEN_WEP_104 : KEY_LEN_WEP_40;
1875 memcpy(pkey->key, key_material, key_length);
1879 /* Ensure the chosen key is valid */
1881 lbs_pr_debug(1, "key not set, so cannot enable it\n");
1885 assoc_req->wep_tx_keyidx = index;
1888 assoc_req->secinfo.wep_enabled = 1;
1894 static int validate_key_index(u16 def_index, u16 raw_index,
1895 u16 *out_index, u16 *is_default)
1897 if (!out_index || !is_default)
1900 /* Verify index if present, otherwise use default TX key index */
1901 if (raw_index > 0) {
1904 *out_index = raw_index - 1;
1906 *out_index = def_index;
1912 static void disable_wep(struct assoc_request *assoc_req)
1916 /* Set Open System auth mode */
1917 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
1919 /* Clear WEP keys and mark WEP as disabled */
1920 assoc_req->secinfo.wep_enabled = 0;
1921 for (i = 0; i < 4; i++)
1922 assoc_req->wep_keys[i].len = 0;
1924 set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags);
1925 set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags);
1929 * @brief Set Encryption key
1931 * @param dev A pointer to net_device structure
1932 * @param info A pointer to iw_request_info structure
1933 * @param vwrq A pointer to iw_param structure
1934 * @param extra A pointer to extra data buf
1935 * @return 0 --success, otherwise fail
1937 static int wlan_set_encode(struct net_device *dev,
1938 struct iw_request_info *info,
1939 struct iw_point *dwrq, char *extra)
1942 wlan_private *priv = dev->priv;
1943 wlan_adapter *adapter = priv->adapter;
1944 struct assoc_request * assoc_req;
1945 u16 is_default = 0, index = 0, set_tx_key = 0;
1949 mutex_lock(&adapter->lock);
1950 assoc_req = wlan_get_association_request(adapter);
1956 if (dwrq->flags & IW_ENCODE_DISABLED) {
1957 disable_wep (assoc_req);
1961 ret = validate_key_index(assoc_req->wep_tx_keyidx,
1962 (dwrq->flags & IW_ENCODE_INDEX),
1963 &index, &is_default);
1969 /* If WEP isn't enabled, or if there is no key data but a valid
1970 * index, set the TX key.
1972 if (!assoc_req->secinfo.wep_enabled || (dwrq->length == 0 && !is_default))
1975 ret = wlan_set_wep_key(assoc_req, extra, dwrq->length, index, set_tx_key);
1980 set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags);
1982 set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags);
1984 if (dwrq->flags & IW_ENCODE_RESTRICTED) {
1985 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY;
1986 } else if (dwrq->flags & IW_ENCODE_OPEN) {
1987 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
1992 set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags);
1993 wlan_postpone_association_work(priv);
1995 wlan_cancel_association_work(priv);
1997 mutex_unlock(&adapter->lock);
2004 * @brief Get Extended Encryption key (WPA/802.1x and WEP)
2006 * @param dev A pointer to net_device structure
2007 * @param info A pointer to iw_request_info structure
2008 * @param vwrq A pointer to iw_param structure
2009 * @param extra A pointer to extra data buf
2010 * @return 0 on success, otherwise failure
2012 static int wlan_get_encodeext(struct net_device *dev,
2013 struct iw_request_info *info,
2014 struct iw_point *dwrq,
2018 wlan_private *priv = dev->priv;
2019 wlan_adapter *adapter = priv->adapter;
2020 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
2021 int index, max_key_len;
2025 max_key_len = dwrq->length - sizeof(*ext);
2026 if (max_key_len < 0)
2029 index = dwrq->flags & IW_ENCODE_INDEX;
2031 if (index < 1 || index > 4)
2035 index = adapter->wep_tx_keyidx;
2038 if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY &&
2039 ext->alg != IW_ENCODE_ALG_WEP) {
2040 if (index != 0 || adapter->inframode != wlan802_11infrastructure)
2044 dwrq->flags = index + 1;
2045 memset(ext, 0, sizeof(*ext));
2047 if ( !adapter->secinfo.wep_enabled
2048 && !adapter->secinfo.WPAenabled
2049 && !adapter->secinfo.WPA2enabled) {
2050 ext->alg = IW_ENCODE_ALG_NONE;
2052 dwrq->flags |= IW_ENCODE_DISABLED;
2056 if ( adapter->secinfo.wep_enabled
2057 && !adapter->secinfo.WPAenabled
2058 && !adapter->secinfo.WPA2enabled) {
2059 ext->alg = IW_ENCODE_ALG_WEP;
2060 ext->key_len = adapter->wep_keys[index].len;
2061 key = &adapter->wep_keys[index].key[0];
2062 } else if ( !adapter->secinfo.wep_enabled
2063 && (adapter->secinfo.WPAenabled ||
2064 adapter->secinfo.WPA2enabled)) {
2066 ext->alg = IW_ENCODE_ALG_TKIP;
2072 if (ext->key_len > max_key_len) {
2078 memcpy(ext->key, key, ext->key_len);
2080 dwrq->flags |= IW_ENCODE_NOKEY;
2081 dwrq->flags |= IW_ENCODE_ENABLED;
2091 * @brief Set Encryption key Extended (WPA/802.1x and WEP)
2093 * @param dev A pointer to net_device structure
2094 * @param info A pointer to iw_request_info structure
2095 * @param vwrq A pointer to iw_param structure
2096 * @param extra A pointer to extra data buf
2097 * @return 0 --success, otherwise fail
2099 static int wlan_set_encodeext(struct net_device *dev,
2100 struct iw_request_info *info,
2101 struct iw_point *dwrq,
2105 wlan_private *priv = dev->priv;
2106 wlan_adapter *adapter = priv->adapter;
2107 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
2109 struct assoc_request * assoc_req;
2113 mutex_lock(&adapter->lock);
2114 assoc_req = wlan_get_association_request(adapter);
2120 if ((alg == IW_ENCODE_ALG_NONE) || (dwrq->flags & IW_ENCODE_DISABLED)) {
2121 disable_wep (assoc_req);
2122 } else if (alg == IW_ENCODE_ALG_WEP) {
2123 u16 is_default = 0, index, set_tx_key = 0;
2125 ret = validate_key_index(assoc_req->wep_tx_keyidx,
2126 (dwrq->flags & IW_ENCODE_INDEX),
2127 &index, &is_default);
2131 /* If WEP isn't enabled, or if there is no key data but a valid
2132 * index, or if the set-TX-key flag was passed, set the TX key.
2134 if ( !assoc_req->secinfo.wep_enabled
2135 || (dwrq->length == 0 && !is_default)
2136 || (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY))
2139 /* Copy key to driver */
2140 ret = wlan_set_wep_key (assoc_req, ext->key, ext->key_len, index,
2145 if (dwrq->flags & IW_ENCODE_RESTRICTED) {
2146 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY;
2147 } else if (dwrq->flags & IW_ENCODE_OPEN) {
2148 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2151 /* Mark the various WEP bits as modified */
2152 set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags);
2154 set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags);
2156 set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags);
2158 } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) {
2159 struct WLAN_802_11_KEY * pkey;
2161 /* validate key length */
2162 if (((alg == IW_ENCODE_ALG_TKIP)
2163 && (ext->key_len != KEY_LEN_WPA_TKIP))
2164 || ((alg == IW_ENCODE_ALG_CCMP)
2165 && (ext->key_len != KEY_LEN_WPA_AES))) {
2166 lbs_pr_debug(1, "Invalid size %d for key of alg"
2174 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY)
2175 pkey = &assoc_req->wpa_mcast_key;
2177 pkey = &assoc_req->wpa_unicast_key;
2179 memset(pkey, 0, sizeof (struct WLAN_802_11_KEY));
2180 memcpy(pkey->key, ext->key, ext->key_len);
2181 pkey->len = ext->key_len;
2182 pkey->flags = KEY_INFO_WPA_ENABLED;
2184 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
2185 pkey->flags |= KEY_INFO_WPA_MCAST;
2186 set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags);
2188 pkey->flags |= KEY_INFO_WPA_UNICAST;
2189 set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags);
2192 if (alg == IW_ENCODE_ALG_TKIP)
2193 pkey->type = KEY_TYPE_ID_TKIP;
2194 else if (alg == IW_ENCODE_ALG_CCMP)
2195 pkey->type = KEY_TYPE_ID_AES;
2197 /* If WPA isn't enabled yet, do that now */
2198 if ( assoc_req->secinfo.WPAenabled == 0
2199 && assoc_req->secinfo.WPA2enabled == 0) {
2200 assoc_req->secinfo.WPAenabled = 1;
2201 assoc_req->secinfo.WPA2enabled = 1;
2202 set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags);
2205 disable_wep (assoc_req);
2210 wlan_postpone_association_work(priv);
2212 wlan_cancel_association_work(priv);
2214 mutex_unlock(&adapter->lock);
2221 static int wlan_set_genie(struct net_device *dev,
2222 struct iw_request_info *info,
2223 struct iw_point *dwrq,
2226 wlan_private *priv = dev->priv;
2227 wlan_adapter *adapter = priv->adapter;
2229 struct assoc_request * assoc_req;
2233 mutex_lock(&adapter->lock);
2234 assoc_req = wlan_get_association_request(adapter);
2240 if (dwrq->length > MAX_WPA_IE_LEN ||
2241 (dwrq->length && extra == NULL)) {
2247 memcpy(&assoc_req->wpa_ie[0], extra, dwrq->length);
2248 assoc_req->wpa_ie_len = dwrq->length;
2250 memset(&assoc_req->wpa_ie[0], 0, sizeof(adapter->wpa_ie));
2251 assoc_req->wpa_ie_len = 0;
2256 set_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags);
2257 wlan_postpone_association_work(priv);
2259 wlan_cancel_association_work(priv);
2261 mutex_unlock(&adapter->lock);
2267 static int wlan_get_genie(struct net_device *dev,
2268 struct iw_request_info *info,
2269 struct iw_point *dwrq,
2272 wlan_private *priv = dev->priv;
2273 wlan_adapter *adapter = priv->adapter;
2277 if (adapter->wpa_ie_len == 0) {
2283 if (dwrq->length < adapter->wpa_ie_len) {
2288 dwrq->length = adapter->wpa_ie_len;
2289 memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len);
2296 static int wlan_set_auth(struct net_device *dev,
2297 struct iw_request_info *info,
2298 struct iw_param *dwrq,
2301 wlan_private *priv = dev->priv;
2302 wlan_adapter *adapter = priv->adapter;
2303 struct assoc_request * assoc_req;
2309 mutex_lock(&adapter->lock);
2310 assoc_req = wlan_get_association_request(adapter);
2316 switch (dwrq->flags & IW_AUTH_INDEX) {
2317 case IW_AUTH_TKIP_COUNTERMEASURES:
2318 case IW_AUTH_CIPHER_PAIRWISE:
2319 case IW_AUTH_CIPHER_GROUP:
2320 case IW_AUTH_KEY_MGMT:
2322 * libertas does not use these parameters
2326 case IW_AUTH_WPA_VERSION:
2327 if (dwrq->value & IW_AUTH_WPA_VERSION_DISABLED) {
2328 assoc_req->secinfo.WPAenabled = 0;
2329 assoc_req->secinfo.WPA2enabled = 0;
2331 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) {
2332 assoc_req->secinfo.WPAenabled = 1;
2333 assoc_req->secinfo.wep_enabled = 0;
2334 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2336 if (dwrq->value & IW_AUTH_WPA_VERSION_WPA2) {
2337 assoc_req->secinfo.WPA2enabled = 1;
2338 assoc_req->secinfo.wep_enabled = 0;
2339 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2344 case IW_AUTH_DROP_UNENCRYPTED:
2346 adapter->currentpacketfilter |=
2347 cmd_act_mac_strict_protection_enable;
2349 adapter->currentpacketfilter &=
2350 ~cmd_act_mac_strict_protection_enable;
2355 case IW_AUTH_80211_AUTH_ALG:
2356 if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) {
2357 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY;
2358 } else if (dwrq->value & IW_AUTH_ALG_OPEN_SYSTEM) {
2359 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2360 } else if (dwrq->value & IW_AUTH_ALG_LEAP) {
2361 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_LEAP;
2368 case IW_AUTH_WPA_ENABLED:
2370 if (!assoc_req->secinfo.WPAenabled &&
2371 !assoc_req->secinfo.WPA2enabled) {
2372 assoc_req->secinfo.WPAenabled = 1;
2373 assoc_req->secinfo.WPA2enabled = 1;
2374 assoc_req->secinfo.wep_enabled = 0;
2375 assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
2378 assoc_req->secinfo.WPAenabled = 0;
2379 assoc_req->secinfo.WPA2enabled = 0;
2392 set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags);
2393 wlan_postpone_association_work(priv);
2394 } else if (ret != -EOPNOTSUPP) {
2395 wlan_cancel_association_work(priv);
2397 mutex_unlock(&adapter->lock);
2403 static int wlan_get_auth(struct net_device *dev,
2404 struct iw_request_info *info,
2405 struct iw_param *dwrq,
2408 wlan_private *priv = dev->priv;
2409 wlan_adapter *adapter = priv->adapter;
2413 switch (dwrq->flags & IW_AUTH_INDEX) {
2414 case IW_AUTH_WPA_VERSION:
2416 if (adapter->secinfo.WPAenabled)
2417 dwrq->value |= IW_AUTH_WPA_VERSION_WPA;
2418 if (adapter->secinfo.WPA2enabled)
2419 dwrq->value |= IW_AUTH_WPA_VERSION_WPA2;
2421 dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED;
2424 case IW_AUTH_DROP_UNENCRYPTED:
2426 if (adapter->currentpacketfilter &
2427 cmd_act_mac_strict_protection_enable)
2431 case IW_AUTH_80211_AUTH_ALG:
2432 dwrq->value = adapter->secinfo.auth_mode;
2435 case IW_AUTH_WPA_ENABLED:
2436 if (adapter->secinfo.WPAenabled && adapter->secinfo.WPA2enabled)
2450 static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info,
2451 struct iw_param *vwrq, char *extra)
2454 wlan_private *priv = dev->priv;
2455 wlan_adapter *adapter = priv->adapter;
2461 if (vwrq->disabled) {
2462 wlan_radio_ioctl(priv, RADIO_OFF);
2466 adapter->preamble = cmd_type_auto_preamble;
2468 wlan_radio_ioctl(priv, RADIO_ON);
2470 if ((vwrq->flags & IW_TXPOW_TYPE) == IW_TXPOW_MWATT) {
2471 dbm = (u16) mw_to_dbm(vwrq->value);
2473 dbm = (u16) vwrq->value;
2475 /* auto tx power control */
2477 if (vwrq->fixed == 0)
2480 lbs_pr_debug(1, "<1>TXPOWER SET %d dbm.\n", dbm);
2482 ret = libertas_prepare_and_send_command(priv,
2483 cmd_802_11_rf_tx_power,
2484 cmd_act_tx_power_opt_set_low,
2485 cmd_option_waitforrsp, 0, (void *)&dbm);
2491 static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
2492 struct iw_point *dwrq, char *extra)
2494 wlan_private *priv = dev->priv;
2495 wlan_adapter *adapter = priv->adapter;
2499 * Note : if dwrq->flags != 0, we should get the relevant SSID from
2504 * Get the current SSID
2506 if (adapter->connect_status == libertas_connected) {
2507 memcpy(extra, adapter->curbssparams.ssid.ssid,
2508 adapter->curbssparams.ssid.ssidlength);
2509 extra[adapter->curbssparams.ssid.ssidlength] = '\0';
2511 memset(extra, 0, 32);
2512 extra[adapter->curbssparams.ssid.ssidlength] = '\0';
2515 * If none, we may want to get the one that was set
2518 /* To make the driver backward compatible with WPA supplicant v0.2.4 */
2519 if (dwrq->length == 32) /* check with WPA supplicant buffer size */
2520 dwrq->length = min_t(size_t, adapter->curbssparams.ssid.ssidlength,
2523 dwrq->length = adapter->curbssparams.ssid.ssidlength + 1;
2525 dwrq->flags = 1; /* active */
2531 static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info,
2532 struct iw_point *dwrq, char *extra)
2534 wlan_private *priv = dev->priv;
2535 wlan_adapter *adapter = priv->adapter;
2537 struct WLAN_802_11_SSID ssid;
2538 struct assoc_request * assoc_req;
2539 int ssid_len = dwrq->length;
2544 * WE-20 and earlier NULL pad the end of the SSID and increment
2545 * SSID length so it can be used like a string. WE-21 and later don't,
2546 * but some userspace tools aren't able to cope with the change.
2548 if ((ssid_len > 0) && (extra[ssid_len - 1] == '\0'))
2551 /* Check the size of the string */
2552 if (ssid_len > IW_ESSID_MAX_SIZE) {
2557 memset(&ssid, 0, sizeof(struct WLAN_802_11_SSID));
2559 if (!dwrq->flags || !ssid_len) {
2560 /* "any" SSID requested; leave SSID blank */
2562 /* Specific SSID requested */
2563 memcpy(&ssid.ssid, extra, ssid_len);
2564 ssid.ssidlength = ssid_len;
2567 lbs_pr_debug(1, "Requested new SSID = %s\n",
2568 (ssid.ssidlength > 0) ? (char *)ssid.ssid : "any");
2571 mutex_lock(&adapter->lock);
2573 /* Get or create the current association request */
2574 assoc_req = wlan_get_association_request(adapter);
2578 /* Copy the SSID to the association request */
2579 memcpy(&assoc_req->ssid, &ssid, sizeof(struct WLAN_802_11_SSID));
2580 set_bit(ASSOC_FLAG_SSID, &assoc_req->flags);
2581 wlan_postpone_association_work(priv);
2585 /* Cancel the association request if there was an error */
2587 wlan_cancel_association_work(priv);
2590 mutex_unlock(&adapter->lock);
2597 * @brief Connect to the AP or Ad-hoc Network with specific bssid
2599 * @param dev A pointer to net_device structure
2600 * @param info A pointer to iw_request_info structure
2601 * @param awrq A pointer to iw_param structure
2602 * @param extra A pointer to extra data buf
2603 * @return 0 --success, otherwise fail
2605 static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
2606 struct sockaddr *awrq, char *extra)
2608 wlan_private *priv = dev->priv;
2609 wlan_adapter *adapter = priv->adapter;
2610 struct assoc_request * assoc_req;
2615 if (awrq->sa_family != ARPHRD_ETHER)
2618 lbs_pr_debug(1, "ASSOC: WAP: sa_data: " MAC_FMT "\n", MAC_ARG(awrq->sa_data));
2620 mutex_lock(&adapter->lock);
2622 /* Get or create the current association request */
2623 assoc_req = wlan_get_association_request(adapter);
2625 wlan_cancel_association_work(priv);
2628 /* Copy the BSSID to the association request */
2629 memcpy(&assoc_req->bssid, awrq->sa_data, ETH_ALEN);
2630 set_bit(ASSOC_FLAG_BSSID, &assoc_req->flags);
2631 wlan_postpone_association_work(priv);
2634 mutex_unlock(&adapter->lock);
2639 void libertas_get_fwversion(wlan_adapter * adapter, char *fwversion, int maxlen)
2647 mutex_lock(&adapter->lock);
2648 ver.l = adapter->fwreleasenumber;
2649 mutex_unlock(&adapter->lock);
2652 sprintf(fwver, "%u.%u.%u", ver.c[2], ver.c[1], ver.c[0]);
2654 sprintf(fwver, "%u.%u.%u.p%u",
2655 ver.c[2], ver.c[1], ver.c[0], ver.c[3]);
2657 snprintf(fwversion, maxlen, fwver);
2662 * iwconfig settable callbacks
2664 static const iw_handler wlan_handler[] = {
2665 (iw_handler) NULL, /* SIOCSIWCOMMIT */
2666 (iw_handler) wlan_get_name, /* SIOCGIWNAME */
2667 (iw_handler) NULL, /* SIOCSIWNWID */
2668 (iw_handler) NULL, /* SIOCGIWNWID */
2669 (iw_handler) wlan_set_freq, /* SIOCSIWFREQ */
2670 (iw_handler) wlan_get_freq, /* SIOCGIWFREQ */
2671 (iw_handler) wlan_set_mode, /* SIOCSIWMODE */
2672 (iw_handler) wlan_get_mode, /* SIOCGIWMODE */
2673 (iw_handler) NULL, /* SIOCSIWSENS */
2674 (iw_handler) NULL, /* SIOCGIWSENS */
2675 (iw_handler) NULL, /* SIOCSIWRANGE */
2676 (iw_handler) wlan_get_range, /* SIOCGIWRANGE */
2677 (iw_handler) NULL, /* SIOCSIWPRIV */
2678 (iw_handler) NULL, /* SIOCGIWPRIV */
2679 (iw_handler) NULL, /* SIOCSIWSTATS */
2680 (iw_handler) NULL, /* SIOCGIWSTATS */
2681 iw_handler_set_spy, /* SIOCSIWSPY */
2682 iw_handler_get_spy, /* SIOCGIWSPY */
2683 iw_handler_set_thrspy, /* SIOCSIWTHRSPY */
2684 iw_handler_get_thrspy, /* SIOCGIWTHRSPY */
2685 (iw_handler) wlan_set_wap, /* SIOCSIWAP */
2686 (iw_handler) wlan_get_wap, /* SIOCGIWAP */
2687 (iw_handler) NULL, /* SIOCSIWMLME */
2688 (iw_handler) NULL, /* SIOCGIWAPLIST - deprecated */
2689 (iw_handler) libertas_set_scan, /* SIOCSIWSCAN */
2690 (iw_handler) libertas_get_scan, /* SIOCGIWSCAN */
2691 (iw_handler) wlan_set_essid, /* SIOCSIWESSID */
2692 (iw_handler) wlan_get_essid, /* SIOCGIWESSID */
2693 (iw_handler) wlan_set_nick, /* SIOCSIWNICKN */
2694 (iw_handler) wlan_get_nick, /* SIOCGIWNICKN */
2695 (iw_handler) NULL, /* -- hole -- */
2696 (iw_handler) NULL, /* -- hole -- */
2697 (iw_handler) wlan_set_rate, /* SIOCSIWRATE */
2698 (iw_handler) wlan_get_rate, /* SIOCGIWRATE */
2699 (iw_handler) wlan_set_rts, /* SIOCSIWRTS */
2700 (iw_handler) wlan_get_rts, /* SIOCGIWRTS */
2701 (iw_handler) wlan_set_frag, /* SIOCSIWFRAG */
2702 (iw_handler) wlan_get_frag, /* SIOCGIWFRAG */
2703 (iw_handler) wlan_set_txpow, /* SIOCSIWTXPOW */
2704 (iw_handler) wlan_get_txpow, /* SIOCGIWTXPOW */
2705 (iw_handler) wlan_set_retry, /* SIOCSIWRETRY */
2706 (iw_handler) wlan_get_retry, /* SIOCGIWRETRY */
2707 (iw_handler) wlan_set_encode, /* SIOCSIWENCODE */
2708 (iw_handler) wlan_get_encode, /* SIOCGIWENCODE */
2709 (iw_handler) wlan_set_power, /* SIOCSIWPOWER */
2710 (iw_handler) wlan_get_power, /* SIOCGIWPOWER */
2711 (iw_handler) NULL, /* -- hole -- */
2712 (iw_handler) NULL, /* -- hole -- */
2713 (iw_handler) wlan_set_genie, /* SIOCSIWGENIE */
2714 (iw_handler) wlan_get_genie, /* SIOCGIWGENIE */
2715 (iw_handler) wlan_set_auth, /* SIOCSIWAUTH */
2716 (iw_handler) wlan_get_auth, /* SIOCGIWAUTH */
2717 (iw_handler) wlan_set_encodeext,/* SIOCSIWENCODEEXT */
2718 (iw_handler) wlan_get_encodeext,/* SIOCGIWENCODEEXT */
2719 (iw_handler) NULL, /* SIOCSIWPMKSA */
2722 struct iw_handler_def libertas_handler_def = {
2723 .num_standard = sizeof(wlan_handler) / sizeof(iw_handler),
2724 .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler),
2725 .num_private_args = sizeof(wlan_private_args) /
2726 sizeof(struct iw_priv_args),
2727 .standard = (iw_handler *) wlan_handler,
2728 .private = (iw_handler *) wlan_private_handler,
2729 .private_args = (struct iw_priv_args *)wlan_private_args,
2730 .get_wireless_stats = wlan_get_wireless_stats,