aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/wext.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/wireless/libertas/wext.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/wireless/libertas/wext.c')
-rw-r--r--drivers/net/wireless/libertas/wext.c225
1 files changed, 153 insertions, 72 deletions
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index be837a0d2517..9b555884b08a 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -2,6 +2,7 @@
2 * This file contains ioctl functions 2 * This file contains ioctl functions
3 */ 3 */
4#include <linux/ctype.h> 4#include <linux/ctype.h>
5#include <linux/slab.h>
5#include <linux/delay.h> 6#include <linux/delay.h>
6#include <linux/if.h> 7#include <linux/if.h>
7#include <linux/if_arp.h> 8#include <linux/if_arp.h>
@@ -45,6 +46,63 @@ static inline void lbs_cancel_association_work(struct lbs_private *priv)
45 priv->pending_assoc_req = NULL; 46 priv->pending_assoc_req = NULL;
46} 47}
47 48
49void lbs_send_disconnect_notification(struct lbs_private *priv)
50{
51 union iwreq_data wrqu;
52
53 memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN);
54 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
55 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
56}
57
58static void lbs_send_iwevcustom_event(struct lbs_private *priv, s8 *str)
59{
60 union iwreq_data iwrq;
61 u8 buf[50];
62
63 lbs_deb_enter(LBS_DEB_WEXT);
64
65 memset(&iwrq, 0, sizeof(union iwreq_data));
66 memset(buf, 0, sizeof(buf));
67
68 snprintf(buf, sizeof(buf) - 1, "%s", str);
69
70 iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN;
71
72 /* Send Event to upper layer */
73 lbs_deb_wext("event indication string %s\n", (char *)buf);
74 lbs_deb_wext("event indication length %d\n", iwrq.data.length);
75 lbs_deb_wext("sending wireless event IWEVCUSTOM for %s\n", str);
76
77 wireless_send_event(priv->dev, IWEVCUSTOM, &iwrq, buf);
78
79 lbs_deb_leave(LBS_DEB_WEXT);
80}
81
82/**
83 * @brief This function handles MIC failure event.
84 *
85 * @param priv A pointer to struct lbs_private structure
86 * @para event the event id
87 * @return n/a
88 */
89void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event)
90{
91 char buf[50];
92
93 lbs_deb_enter(LBS_DEB_CMD);
94 memset(buf, 0, sizeof(buf));
95
96 sprintf(buf, "%s", "MLME-MICHAELMICFAILURE.indication ");
97
98 if (event == MACREG_INT_CODE_MIC_ERR_UNICAST)
99 strcat(buf, "unicast ");
100 else
101 strcat(buf, "multicast ");
102
103 lbs_send_iwevcustom_event(priv, buf);
104 lbs_deb_leave(LBS_DEB_CMD);
105}
48 106
49/** 107/**
50 * @brief Find the channel frequency power info with specific channel 108 * @brief Find the channel frequency power info with specific channel
@@ -66,8 +124,6 @@ struct chan_freq_power *lbs_find_cfp_by_band_and_channel(
66 for (j = 0; !cfp && (j < ARRAY_SIZE(priv->region_channel)); j++) { 124 for (j = 0; !cfp && (j < ARRAY_SIZE(priv->region_channel)); j++) {
67 rc = &priv->region_channel[j]; 125 rc = &priv->region_channel[j];
68 126
69 if (priv->enable11d)
70 rc = &priv->universal_channel[j];
71 if (!rc->valid || !rc->CFP) 127 if (!rc->valid || !rc->CFP)
72 continue; 128 continue;
73 if (rc->band != band) 129 if (rc->band != band)
@@ -107,8 +163,6 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(
107 for (j = 0; !cfp && (j < ARRAY_SIZE(priv->region_channel)); j++) { 163 for (j = 0; !cfp && (j < ARRAY_SIZE(priv->region_channel)); j++) {
108 rc = &priv->region_channel[j]; 164 rc = &priv->region_channel[j];
109 165
110 if (priv->enable11d)
111 rc = &priv->universal_channel[j];
112 if (!rc->valid || !rc->CFP) 166 if (!rc->valid || !rc->CFP)
113 continue; 167 continue;
114 if (rc->band != band) 168 if (rc->band != band)
@@ -139,7 +193,7 @@ static void copy_active_data_rates(struct lbs_private *priv, u8 *rates)
139 lbs_deb_enter(LBS_DEB_WEXT); 193 lbs_deb_enter(LBS_DEB_WEXT);
140 194
141 if ((priv->connect_status != LBS_CONNECTED) && 195 if ((priv->connect_status != LBS_CONNECTED) &&
142 (priv->mesh_connect_status != LBS_CONNECTED)) 196 !lbs_mesh_connected(priv))
143 memcpy(rates, lbs_bg_rates, MAX_RATES); 197 memcpy(rates, lbs_bg_rates, MAX_RATES);
144 else 198 else
145 memcpy(rates, priv->curbssparams.rates, MAX_RATES); 199 memcpy(rates, priv->curbssparams.rates, MAX_RATES);
@@ -169,12 +223,12 @@ static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info,
169 lbs_deb_enter(LBS_DEB_WEXT); 223 lbs_deb_enter(LBS_DEB_WEXT);
170 224
171 cfp = lbs_find_cfp_by_band_and_channel(priv, 0, 225 cfp = lbs_find_cfp_by_band_and_channel(priv, 0,
172 priv->curbssparams.channel); 226 priv->channel);
173 227
174 if (!cfp) { 228 if (!cfp) {
175 if (priv->curbssparams.channel) 229 if (priv->channel)
176 lbs_deb_wext("invalid channel %d\n", 230 lbs_deb_wext("invalid channel %d\n",
177 priv->curbssparams.channel); 231 priv->channel);
178 return -EINVAL; 232 return -EINVAL;
179 } 233 }
180 234
@@ -245,6 +299,7 @@ static int lbs_get_nick(struct net_device *dev, struct iw_request_info *info,
245 return 0; 299 return 0;
246} 300}
247 301
302#ifdef CONFIG_LIBERTAS_MESH
248static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info, 303static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info,
249 struct iw_point *dwrq, char *extra) 304 struct iw_point *dwrq, char *extra)
250{ 305{
@@ -254,7 +309,7 @@ static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info,
254 309
255 /* Use nickname to indicate that mesh is on */ 310 /* Use nickname to indicate that mesh is on */
256 311
257 if (priv->mesh_connect_status == LBS_CONNECTED) { 312 if (lbs_mesh_connected(priv)) {
258 strncpy(extra, "Mesh", 12); 313 strncpy(extra, "Mesh", 12);
259 extra[12] = '\0'; 314 extra[12] = '\0';
260 dwrq->length = strlen(extra); 315 dwrq->length = strlen(extra);
@@ -268,6 +323,7 @@ static int mesh_get_nick(struct net_device *dev, struct iw_request_info *info,
268 lbs_deb_leave(LBS_DEB_WEXT); 323 lbs_deb_leave(LBS_DEB_WEXT);
269 return 0; 324 return 0;
270} 325}
326#endif
271 327
272static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info, 328static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info,
273 struct iw_param *vwrq, char *extra) 329 struct iw_param *vwrq, char *extra)
@@ -369,6 +425,7 @@ static int lbs_get_mode(struct net_device *dev,
369 return 0; 425 return 0;
370} 426}
371 427
428#ifdef CONFIG_LIBERTAS_MESH
372static int mesh_wlan_get_mode(struct net_device *dev, 429static int mesh_wlan_get_mode(struct net_device *dev,
373 struct iw_request_info *info, u32 * uwrq, 430 struct iw_request_info *info, u32 * uwrq,
374 char *extra) 431 char *extra)
@@ -380,6 +437,7 @@ static int mesh_wlan_get_mode(struct net_device *dev,
380 lbs_deb_leave(LBS_DEB_WEXT); 437 lbs_deb_leave(LBS_DEB_WEXT);
381 return 0; 438 return 0;
382} 439}
440#endif
383 441
384static int lbs_get_txpow(struct net_device *dev, 442static int lbs_get_txpow(struct net_device *dev,
385 struct iw_request_info *info, 443 struct iw_request_info *info,
@@ -547,8 +605,6 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
547 struct chan_freq_power *cfp; 605 struct chan_freq_power *cfp;
548 u8 rates[MAX_RATES + 1]; 606 u8 rates[MAX_RATES + 1];
549 607
550 u8 flag = 0;
551
552 lbs_deb_enter(LBS_DEB_WEXT); 608 lbs_deb_enter(LBS_DEB_WEXT);
553 609
554 dwrq->length = sizeof(struct iw_range); 610 dwrq->length = sizeof(struct iw_range);
@@ -570,52 +626,21 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
570 626
571 range->scan_capa = IW_SCAN_CAPA_ESSID; 627 range->scan_capa = IW_SCAN_CAPA_ESSID;
572 628
573 if (priv->enable11d && 629 for (j = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
574 (priv->connect_status == LBS_CONNECTED || 630 && (j < ARRAY_SIZE(priv->region_channel)); j++) {
575 priv->mesh_connect_status == LBS_CONNECTED)) { 631 cfp = priv->region_channel[j].CFP;
576 u8 chan_no;
577 u8 band;
578
579 struct parsed_region_chan_11d *parsed_region_chan =
580 &priv->parsed_region_chan;
581
582 if (parsed_region_chan == NULL) {
583 lbs_deb_wext("11d: parsed_region_chan is NULL\n");
584 goto out;
585 }
586 band = parsed_region_chan->band;
587 lbs_deb_wext("band %d, nr_char %d\n", band,
588 parsed_region_chan->nr_chan);
589
590 for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) 632 for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
591 && (i < parsed_region_chan->nr_chan); i++) { 633 && priv->region_channel[j].valid
592 chan_no = parsed_region_chan->chanpwr[i].chan; 634 && cfp
593 lbs_deb_wext("chan_no %d\n", chan_no); 635 && (i < priv->region_channel[j].nrcfp); i++) {
594 range->freq[range->num_frequency].i = (long)chan_no; 636 range->freq[range->num_frequency].i =
637 (long)cfp->channel;
595 range->freq[range->num_frequency].m = 638 range->freq[range->num_frequency].m =
596 (long)lbs_chan_2_freq(chan_no) * 100000; 639 (long)cfp->freq * 100000;
597 range->freq[range->num_frequency].e = 1; 640 range->freq[range->num_frequency].e = 1;
641 cfp++;
598 range->num_frequency++; 642 range->num_frequency++;
599 } 643 }
600 flag = 1;
601 }
602 if (!flag) {
603 for (j = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
604 && (j < ARRAY_SIZE(priv->region_channel)); j++) {
605 cfp = priv->region_channel[j].CFP;
606 for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
607 && priv->region_channel[j].valid
608 && cfp
609 && (i < priv->region_channel[j].nrcfp); i++) {
610 range->freq[range->num_frequency].i =
611 (long)cfp->channel;
612 range->freq[range->num_frequency].m =
613 (long)cfp->freq * 100000;
614 range->freq[range->num_frequency].e = 1;
615 cfp++;
616 range->num_frequency++;
617 }
618 }
619 } 644 }
620 645
621 lbs_deb_wext("IW_MAX_FREQUENCIES %d, num_frequency %d\n", 646 lbs_deb_wext("IW_MAX_FREQUENCIES %d, num_frequency %d\n",
@@ -700,7 +725,6 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
700 | IW_ENC_CAPA_CIPHER_CCMP; 725 | IW_ENC_CAPA_CIPHER_CCMP;
701 } 726 }
702 727
703out:
704 lbs_deb_leave(LBS_DEB_WEXT); 728 lbs_deb_leave(LBS_DEB_WEXT);
705 return 0; 729 return 0;
706} 730}
@@ -709,6 +733,7 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info,
709 struct iw_param *vwrq, char *extra) 733 struct iw_param *vwrq, char *extra)
710{ 734{
711 struct lbs_private *priv = dev->ml_priv; 735 struct lbs_private *priv = dev->ml_priv;
736 int ret = 0;
712 737
713 lbs_deb_enter(LBS_DEB_WEXT); 738 lbs_deb_enter(LBS_DEB_WEXT);
714 739
@@ -737,8 +762,54 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info,
737 "setting power timeout is not supported\n"); 762 "setting power timeout is not supported\n");
738 return -EINVAL; 763 return -EINVAL;
739 } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { 764 } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
740 lbs_deb_wext("setting power period not supported\n"); 765 vwrq->value = vwrq->value / 1000;
741 return -EINVAL; 766 if (!priv->enter_deep_sleep) {
767 lbs_pr_err("deep sleep feature is not implemented "
768 "for this interface driver\n");
769 return -EINVAL;
770 }
771
772 if (priv->connect_status == LBS_CONNECTED) {
773 if ((priv->is_auto_deep_sleep_enabled) &&
774 (vwrq->value == -1000)) {
775 lbs_exit_auto_deep_sleep(priv);
776 return 0;
777 } else {
778 lbs_pr_err("can't use deep sleep cmd in "
779 "connected state\n");
780 return -EINVAL;
781 }
782 }
783
784 if ((vwrq->value < 0) && (vwrq->value != -1000)) {
785 lbs_pr_err("unknown option\n");
786 return -EINVAL;
787 }
788
789 if (vwrq->value > 0) {
790 if (!priv->is_auto_deep_sleep_enabled) {
791 priv->is_activity_detected = 0;
792 priv->auto_deep_sleep_timeout = vwrq->value;
793 lbs_enter_auto_deep_sleep(priv);
794 } else {
795 priv->auto_deep_sleep_timeout = vwrq->value;
796 lbs_deb_debugfs("auto deep sleep: "
797 "already enabled\n");
798 }
799 return 0;
800 } else {
801 if (priv->is_auto_deep_sleep_enabled) {
802 lbs_exit_auto_deep_sleep(priv);
803 /* Try to exit deep sleep if auto */
804 /*deep sleep disabled */
805 ret = lbs_set_deep_sleep(priv, 0);
806 }
807 if (vwrq->value == 0)
808 ret = lbs_set_deep_sleep(priv, 1);
809 else if (vwrq->value == -1000)
810 ret = lbs_set_deep_sleep(priv, 0);
811 return ret;
812 }
742 } 813 }
743 814
744 if (priv->psmode != LBS802_11POWERMODECAM) { 815 if (priv->psmode != LBS802_11POWERMODECAM) {
@@ -752,6 +823,7 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info,
752 } 823 }
753 824
754 lbs_deb_leave(LBS_DEB_WEXT); 825 lbs_deb_leave(LBS_DEB_WEXT);
826
755 return 0; 827 return 0;
756} 828}
757 829
@@ -785,7 +857,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
785 u32 rssi_qual; 857 u32 rssi_qual;
786 u32 tx_qual; 858 u32 tx_qual;
787 u32 quality = 0; 859 u32 quality = 0;
788 int stats_valid = 0; 860 int ret, stats_valid = 0;
789 u8 rssi; 861 u8 rssi;
790 u32 tx_retries; 862 u32 tx_retries;
791 struct cmd_ds_802_11_get_log log; 863 struct cmd_ds_802_11_get_log log;
@@ -796,7 +868,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
796 868
797 /* If we're not associated, all quality values are meaningless */ 869 /* If we're not associated, all quality values are meaningless */
798 if ((priv->connect_status != LBS_CONNECTED) && 870 if ((priv->connect_status != LBS_CONNECTED) &&
799 (priv->mesh_connect_status != LBS_CONNECTED)) 871 !lbs_mesh_connected(priv))
800 goto out; 872 goto out;
801 873
802 /* Quality by RSSI */ 874 /* Quality by RSSI */
@@ -834,7 +906,9 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
834 906
835 memset(&log, 0, sizeof(log)); 907 memset(&log, 0, sizeof(log));
836 log.hdr.size = cpu_to_le16(sizeof(log)); 908 log.hdr.size = cpu_to_le16(sizeof(log));
837 lbs_cmd_with_response(priv, CMD_802_11_GET_LOG, &log); 909 ret = lbs_cmd_with_response(priv, CMD_802_11_GET_LOG, &log);
910 if (ret)
911 goto out;
838 912
839 tx_retries = le32_to_cpu(log.retry); 913 tx_retries = le32_to_cpu(log.retry);
840 914
@@ -862,8 +936,10 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
862 stats_valid = 1; 936 stats_valid = 1;
863 937
864 /* update stats asynchronously for future calls */ 938 /* update stats asynchronously for future calls */
865 lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, 939 ret = lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
866 0, 0, NULL); 940 0, 0, NULL);
941 if (ret)
942 lbs_pr_err("RSSI command failed\n");
867out: 943out:
868 if (!stats_valid) { 944 if (!stats_valid) {
869 priv->wstats.miss.beacon = 0; 945 priv->wstats.miss.beacon = 0;
@@ -939,6 +1015,7 @@ out:
939 return ret; 1015 return ret;
940} 1016}
941 1017
1018#ifdef CONFIG_LIBERTAS_MESH
942static int lbs_mesh_set_freq(struct net_device *dev, 1019static int lbs_mesh_set_freq(struct net_device *dev,
943 struct iw_request_info *info, 1020 struct iw_request_info *info,
944 struct iw_freq *fwrq, char *extra) 1021 struct iw_freq *fwrq, char *extra)
@@ -973,7 +1050,7 @@ static int lbs_mesh_set_freq(struct net_device *dev,
973 goto out; 1050 goto out;
974 } 1051 }
975 1052
976 if (fwrq->m != priv->curbssparams.channel) { 1053 if (fwrq->m != priv->channel) {
977 lbs_deb_wext("mesh channel change forces eth disconnect\n"); 1054 lbs_deb_wext("mesh channel change forces eth disconnect\n");
978 if (priv->mode == IW_MODE_INFRA) 1055 if (priv->mode == IW_MODE_INFRA)
979 lbs_cmd_80211_deauthenticate(priv, 1056 lbs_cmd_80211_deauthenticate(priv,
@@ -990,6 +1067,7 @@ out:
990 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); 1067 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
991 return ret; 1068 return ret;
992} 1069}
1070#endif
993 1071
994static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, 1072static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info,
995 struct iw_param *vwrq, char *extra) 1073 struct iw_param *vwrq, char *extra)
@@ -1000,6 +1078,7 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info,
1000 u8 rates[MAX_RATES + 1]; 1078 u8 rates[MAX_RATES + 1];
1001 1079
1002 lbs_deb_enter(LBS_DEB_WEXT); 1080 lbs_deb_enter(LBS_DEB_WEXT);
1081
1003 lbs_deb_wext("vwrq->value %d\n", vwrq->value); 1082 lbs_deb_wext("vwrq->value %d\n", vwrq->value);
1004 lbs_deb_wext("vwrq->fixed %d\n", vwrq->fixed); 1083 lbs_deb_wext("vwrq->fixed %d\n", vwrq->fixed);
1005 1084
@@ -1953,10 +2032,8 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info,
1953 if (priv->connect_status == LBS_CONNECTED) { 2032 if (priv->connect_status == LBS_CONNECTED) {
1954 memcpy(extra, priv->curbssparams.ssid, 2033 memcpy(extra, priv->curbssparams.ssid,
1955 priv->curbssparams.ssid_len); 2034 priv->curbssparams.ssid_len);
1956 extra[priv->curbssparams.ssid_len] = '\0';
1957 } else { 2035 } else {
1958 memset(extra, 0, 32); 2036 memset(extra, 0, 32);
1959 extra[priv->curbssparams.ssid_len] = '\0';
1960 } 2037 }
1961 /* 2038 /*
1962 * If none, we may want to get the one that was set 2039 * If none, we may want to get the one that was set
@@ -1975,7 +2052,7 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info,
1975{ 2052{
1976 struct lbs_private *priv = dev->ml_priv; 2053 struct lbs_private *priv = dev->ml_priv;
1977 int ret = 0; 2054 int ret = 0;
1978 u8 ssid[IW_ESSID_MAX_SIZE]; 2055 u8 ssid[IEEE80211_MAX_SSID_LEN];
1979 u8 ssid_len = 0; 2056 u8 ssid_len = 0;
1980 struct assoc_request * assoc_req; 2057 struct assoc_request * assoc_req;
1981 int in_ssid_len = dwrq->length; 2058 int in_ssid_len = dwrq->length;
@@ -1989,7 +2066,7 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info,
1989 } 2066 }
1990 2067
1991 /* Check the size of the string */ 2068 /* Check the size of the string */
1992 if (in_ssid_len > IW_ESSID_MAX_SIZE) { 2069 if (in_ssid_len > IEEE80211_MAX_SSID_LEN) {
1993 ret = -E2BIG; 2070 ret = -E2BIG;
1994 goto out; 2071 goto out;
1995 } 2072 }
@@ -2020,7 +2097,7 @@ out:
2020 ret = -ENOMEM; 2097 ret = -ENOMEM;
2021 } else { 2098 } else {
2022 /* Copy the SSID to the association request */ 2099 /* Copy the SSID to the association request */
2023 memcpy(&assoc_req->ssid, &ssid, IW_ESSID_MAX_SIZE); 2100 memcpy(&assoc_req->ssid, &ssid, IEEE80211_MAX_SSID_LEN);
2024 assoc_req->ssid_len = ssid_len; 2101 assoc_req->ssid_len = ssid_len;
2025 set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); 2102 set_bit(ASSOC_FLAG_SSID, &assoc_req->flags);
2026 lbs_postpone_association_work(priv); 2103 lbs_postpone_association_work(priv);
@@ -2038,6 +2115,7 @@ out:
2038 return ret; 2115 return ret;
2039} 2116}
2040 2117
2118#ifdef CONFIG_LIBERTAS_MESH
2041static int lbs_mesh_get_essid(struct net_device *dev, 2119static int lbs_mesh_get_essid(struct net_device *dev,
2042 struct iw_request_info *info, 2120 struct iw_request_info *info,
2043 struct iw_point *dwrq, char *extra) 2121 struct iw_point *dwrq, char *extra)
@@ -2071,7 +2149,7 @@ static int lbs_mesh_set_essid(struct net_device *dev,
2071 } 2149 }
2072 2150
2073 /* Check the size of the string */ 2151 /* Check the size of the string */
2074 if (dwrq->length > IW_ESSID_MAX_SIZE) { 2152 if (dwrq->length > IEEE80211_MAX_SSID_LEN) {
2075 ret = -E2BIG; 2153 ret = -E2BIG;
2076 goto out; 2154 goto out;
2077 } 2155 }
@@ -2086,11 +2164,12 @@ static int lbs_mesh_set_essid(struct net_device *dev,
2086 } 2164 }
2087 2165
2088 lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, 2166 lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START,
2089 priv->curbssparams.channel); 2167 priv->channel);
2090 out: 2168 out:
2091 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); 2169 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2092 return ret; 2170 return ret;
2093} 2171}
2172#endif
2094 2173
2095/** 2174/**
2096 * @brief Connect to the AP or Ad-hoc Network with specific bssid 2175 * @brief Connect to the AP or Ad-hoc Network with specific bssid
@@ -2197,7 +2276,13 @@ static const iw_handler lbs_handler[] = {
2197 (iw_handler) lbs_get_encodeext,/* SIOCGIWENCODEEXT */ 2276 (iw_handler) lbs_get_encodeext,/* SIOCGIWENCODEEXT */
2198 (iw_handler) NULL, /* SIOCSIWPMKSA */ 2277 (iw_handler) NULL, /* SIOCSIWPMKSA */
2199}; 2278};
2279struct iw_handler_def lbs_handler_def = {
2280 .num_standard = ARRAY_SIZE(lbs_handler),
2281 .standard = (iw_handler *) lbs_handler,
2282 .get_wireless_stats = lbs_get_wireless_stats,
2283};
2200 2284
2285#ifdef CONFIG_LIBERTAS_MESH
2201static const iw_handler mesh_wlan_handler[] = { 2286static const iw_handler mesh_wlan_handler[] = {
2202 (iw_handler) NULL, /* SIOCSIWCOMMIT */ 2287 (iw_handler) NULL, /* SIOCSIWCOMMIT */
2203 (iw_handler) lbs_get_name, /* SIOCGIWNAME */ 2288 (iw_handler) lbs_get_name, /* SIOCGIWNAME */
@@ -2255,14 +2340,10 @@ static const iw_handler mesh_wlan_handler[] = {
2255 (iw_handler) lbs_get_encodeext,/* SIOCGIWENCODEEXT */ 2340 (iw_handler) lbs_get_encodeext,/* SIOCGIWENCODEEXT */
2256 (iw_handler) NULL, /* SIOCSIWPMKSA */ 2341 (iw_handler) NULL, /* SIOCSIWPMKSA */
2257}; 2342};
2258struct iw_handler_def lbs_handler_def = {
2259 .num_standard = ARRAY_SIZE(lbs_handler),
2260 .standard = (iw_handler *) lbs_handler,
2261 .get_wireless_stats = lbs_get_wireless_stats,
2262};
2263 2343
2264struct iw_handler_def mesh_handler_def = { 2344struct iw_handler_def mesh_handler_def = {
2265 .num_standard = ARRAY_SIZE(mesh_wlan_handler), 2345 .num_standard = ARRAY_SIZE(mesh_wlan_handler),
2266 .standard = (iw_handler *) mesh_wlan_handler, 2346 .standard = (iw_handler *) mesh_wlan_handler,
2267 .get_wireless_stats = lbs_get_wireless_stats, 2347 .get_wireless_stats = lbs_get_wireless_stats,
2268}; 2348};
2349#endif