diff options
Diffstat (limited to 'drivers/net/wireless/mwifiex/cfg80211.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 224 |
1 files changed, 79 insertions, 145 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index ec0895f4e8d3..b99ae2677d78 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -34,22 +34,17 @@ static int | |||
34 | mwifiex_cfg80211_channel_type_to_mwifiex_channels(enum nl80211_channel_type | 34 | mwifiex_cfg80211_channel_type_to_mwifiex_channels(enum nl80211_channel_type |
35 | channel_type) | 35 | channel_type) |
36 | { | 36 | { |
37 | int channel; | ||
38 | switch (channel_type) { | 37 | switch (channel_type) { |
39 | case NL80211_CHAN_NO_HT: | 38 | case NL80211_CHAN_NO_HT: |
40 | case NL80211_CHAN_HT20: | 39 | case NL80211_CHAN_HT20: |
41 | channel = NO_SEC_CHANNEL; | 40 | return NO_SEC_CHANNEL; |
42 | break; | ||
43 | case NL80211_CHAN_HT40PLUS: | 41 | case NL80211_CHAN_HT40PLUS: |
44 | channel = SEC_CHANNEL_ABOVE; | 42 | return SEC_CHANNEL_ABOVE; |
45 | break; | ||
46 | case NL80211_CHAN_HT40MINUS: | 43 | case NL80211_CHAN_HT40MINUS: |
47 | channel = SEC_CHANNEL_BELOW; | 44 | return SEC_CHANNEL_BELOW; |
48 | break; | ||
49 | default: | 45 | default: |
50 | channel = NO_SEC_CHANNEL; | 46 | return NO_SEC_CHANNEL; |
51 | } | 47 | } |
52 | return channel; | ||
53 | } | 48 | } |
54 | 49 | ||
55 | /* | 50 | /* |
@@ -64,21 +59,16 @@ mwifiex_cfg80211_channel_type_to_mwifiex_channels(enum nl80211_channel_type | |||
64 | static enum nl80211_channel_type | 59 | static enum nl80211_channel_type |
65 | mwifiex_channels_to_cfg80211_channel_type(int channel_type) | 60 | mwifiex_channels_to_cfg80211_channel_type(int channel_type) |
66 | { | 61 | { |
67 | int channel; | ||
68 | switch (channel_type) { | 62 | switch (channel_type) { |
69 | case NO_SEC_CHANNEL: | 63 | case NO_SEC_CHANNEL: |
70 | channel = NL80211_CHAN_HT20; | 64 | return NL80211_CHAN_HT20; |
71 | break; | ||
72 | case SEC_CHANNEL_ABOVE: | 65 | case SEC_CHANNEL_ABOVE: |
73 | channel = NL80211_CHAN_HT40PLUS; | 66 | return NL80211_CHAN_HT40PLUS; |
74 | break; | ||
75 | case SEC_CHANNEL_BELOW: | 67 | case SEC_CHANNEL_BELOW: |
76 | channel = NL80211_CHAN_HT40MINUS; | 68 | return NL80211_CHAN_HT40MINUS; |
77 | break; | ||
78 | default: | 69 | default: |
79 | channel = NL80211_CHAN_HT20; | 70 | return NL80211_CHAN_HT20; |
80 | } | 71 | } |
81 | return channel; | ||
82 | } | 72 | } |
83 | 73 | ||
84 | /* | 74 | /* |
@@ -117,10 +107,8 @@ mwifiex_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev, | |||
117 | u8 key_index, bool pairwise, const u8 *mac_addr) | 107 | u8 key_index, bool pairwise, const u8 *mac_addr) |
118 | { | 108 | { |
119 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); | 109 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); |
120 | int ret = 0; | ||
121 | 110 | ||
122 | ret = mwifiex_set_encode(priv, NULL, 0, key_index, 1); | 111 | if (mwifiex_set_encode(priv, NULL, 0, key_index, 1)) { |
123 | if (ret) { | ||
124 | wiphy_err(wiphy, "deleting the crypto keys\n"); | 112 | wiphy_err(wiphy, "deleting the crypto keys\n"); |
125 | return -EFAULT; | 113 | return -EFAULT; |
126 | } | 114 | } |
@@ -137,12 +125,17 @@ mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy, | |||
137 | enum nl80211_tx_power_setting type, | 125 | enum nl80211_tx_power_setting type, |
138 | int dbm) | 126 | int dbm) |
139 | { | 127 | { |
140 | int ret = 0; | ||
141 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); | 128 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); |
129 | struct mwifiex_power_cfg power_cfg; | ||
142 | 130 | ||
143 | ret = mwifiex_set_tx_power(priv, type, dbm); | 131 | if (type == NL80211_TX_POWER_FIXED) { |
132 | power_cfg.is_power_auto = 0; | ||
133 | power_cfg.power_level = dbm; | ||
134 | } else { | ||
135 | power_cfg.is_power_auto = 1; | ||
136 | } | ||
144 | 137 | ||
145 | return ret; | 138 | return mwifiex_set_tx_power(priv, &power_cfg); |
146 | } | 139 | } |
147 | 140 | ||
148 | /* | 141 | /* |
@@ -155,17 +148,17 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy, | |||
155 | struct net_device *dev, | 148 | struct net_device *dev, |
156 | bool enabled, int timeout) | 149 | bool enabled, int timeout) |
157 | { | 150 | { |
158 | int ret = 0; | ||
159 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); | 151 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); |
152 | u32 ps_mode; | ||
160 | 153 | ||
161 | if (timeout) | 154 | if (timeout) |
162 | wiphy_dbg(wiphy, | 155 | wiphy_dbg(wiphy, |
163 | "info: ignoring the timeout value" | 156 | "info: ignoring the timeout value" |
164 | " for IEEE power save\n"); | 157 | " for IEEE power save\n"); |
165 | 158 | ||
166 | ret = mwifiex_drv_set_power(priv, enabled); | 159 | ps_mode = enabled; |
167 | 160 | ||
168 | return ret; | 161 | return mwifiex_drv_set_power(priv, &ps_mode); |
169 | } | 162 | } |
170 | 163 | ||
171 | /* | 164 | /* |
@@ -177,18 +170,15 @@ mwifiex_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *netdev, | |||
177 | bool multicast) | 170 | bool multicast) |
178 | { | 171 | { |
179 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); | 172 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); |
180 | int ret; | ||
181 | 173 | ||
182 | /* Return if WEP key not configured */ | 174 | /* Return if WEP key not configured */ |
183 | if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_DISABLED) | 175 | if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_DISABLED) |
184 | return 0; | 176 | return 0; |
185 | 177 | ||
186 | ret = mwifiex_set_encode(priv, NULL, 0, key_index, 0); | 178 | if (mwifiex_set_encode(priv, NULL, 0, key_index, 0)) { |
187 | 179 | wiphy_err(wiphy, "set default Tx key index\n"); | |
188 | wiphy_dbg(wiphy, "info: set default Tx key index\n"); | ||
189 | |||
190 | if (ret) | ||
191 | return -EFAULT; | 180 | return -EFAULT; |
181 | } | ||
192 | 182 | ||
193 | return 0; | 183 | return 0; |
194 | } | 184 | } |
@@ -202,15 +192,12 @@ mwifiex_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev, | |||
202 | struct key_params *params) | 192 | struct key_params *params) |
203 | { | 193 | { |
204 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); | 194 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); |
205 | int ret = 0; | ||
206 | 195 | ||
207 | ret = mwifiex_set_encode(priv, params->key, params->key_len, | 196 | if (mwifiex_set_encode(priv, params->key, params->key_len, |
208 | key_index, 0); | 197 | key_index, 0)) { |
209 | 198 | wiphy_err(wiphy, "crypto keys added\n"); | |
210 | wiphy_dbg(wiphy, "info: crypto keys added\n"); | ||
211 | |||
212 | if (ret) | ||
213 | return -EFAULT; | 199 | return -EFAULT; |
200 | } | ||
214 | 201 | ||
215 | return 0; | 202 | return 0; |
216 | } | 203 | } |
@@ -235,7 +222,6 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy) | |||
235 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); | 222 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); |
236 | struct mwifiex_adapter *adapter = priv->adapter; | 223 | struct mwifiex_adapter *adapter = priv->adapter; |
237 | struct mwifiex_802_11d_domain_reg *domain_info = &adapter->domain_reg; | 224 | struct mwifiex_802_11d_domain_reg *domain_info = &adapter->domain_reg; |
238 | int ret = 0; | ||
239 | 225 | ||
240 | /* Set country code */ | 226 | /* Set country code */ |
241 | domain_info->country_code[0] = priv->country_code[0]; | 227 | domain_info->country_code[0] = priv->country_code[0]; |
@@ -290,13 +276,14 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy) | |||
290 | } | 276 | } |
291 | 277 | ||
292 | domain_info->no_of_triplet = no_of_triplet; | 278 | domain_info->no_of_triplet = no_of_triplet; |
293 | /* Send cmd to FW to set domain info */ | 279 | |
294 | ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11D_DOMAIN_INFO, | 280 | if (mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11D_DOMAIN_INFO, |
295 | HostCmd_ACT_GEN_SET, 0, NULL, NULL); | 281 | HostCmd_ACT_GEN_SET, 0, NULL)) { |
296 | if (ret) | ||
297 | wiphy_err(wiphy, "11D: setting domain info in FW\n"); | 282 | wiphy_err(wiphy, "11D: setting domain info in FW\n"); |
283 | return -1; | ||
284 | } | ||
298 | 285 | ||
299 | return ret; | 286 | return 0; |
300 | } | 287 | } |
301 | 288 | ||
302 | /* | 289 | /* |
@@ -346,8 +333,6 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv, | |||
346 | enum nl80211_channel_type channel_type) | 333 | enum nl80211_channel_type channel_type) |
347 | { | 334 | { |
348 | struct mwifiex_chan_freq_power cfp; | 335 | struct mwifiex_chan_freq_power cfp; |
349 | int ret = 0; | ||
350 | int status = 0; | ||
351 | struct mwifiex_ds_band_cfg band_cfg; | 336 | struct mwifiex_ds_band_cfg band_cfg; |
352 | u32 config_bands = 0; | 337 | u32 config_bands = 0; |
353 | struct wiphy *wiphy = priv->wdev->wiphy; | 338 | struct wiphy *wiphy = priv->wdev->wiphy; |
@@ -366,15 +351,14 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv, | |||
366 | band_cfg.config_bands = config_bands; | 351 | band_cfg.config_bands = config_bands; |
367 | band_cfg.adhoc_start_band = config_bands; | 352 | band_cfg.adhoc_start_band = config_bands; |
368 | } | 353 | } |
369 | /* Set channel offset */ | 354 | |
370 | band_cfg.sec_chan_offset = | 355 | band_cfg.sec_chan_offset = |
371 | mwifiex_cfg80211_channel_type_to_mwifiex_channels | 356 | mwifiex_cfg80211_channel_type_to_mwifiex_channels |
372 | (channel_type); | 357 | (channel_type); |
373 | status = mwifiex_radio_ioctl_band_cfg(priv, HostCmd_ACT_GEN_SET, | ||
374 | &band_cfg); | ||
375 | 358 | ||
376 | if (status) | 359 | if (mwifiex_set_radio_band_cfg(priv, &band_cfg)) |
377 | return -EFAULT; | 360 | return -EFAULT; |
361 | |||
378 | mwifiex_send_domain_info_cmd_fw(wiphy); | 362 | mwifiex_send_domain_info_cmd_fw(wiphy); |
379 | } | 363 | } |
380 | 364 | ||
@@ -382,20 +366,16 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv, | |||
382 | "mode %d\n", config_bands, band_cfg.sec_chan_offset, | 366 | "mode %d\n", config_bands, band_cfg.sec_chan_offset, |
383 | priv->bss_mode); | 367 | priv->bss_mode); |
384 | if (!chan) | 368 | if (!chan) |
385 | return ret; | 369 | return 0; |
386 | 370 | ||
387 | memset(&cfp, 0, sizeof(cfp)); | 371 | memset(&cfp, 0, sizeof(cfp)); |
388 | cfp.freq = chan->center_freq; | 372 | cfp.freq = chan->center_freq; |
389 | /* Convert frequency to channel */ | ||
390 | cfp.channel = ieee80211_frequency_to_channel(chan->center_freq); | 373 | cfp.channel = ieee80211_frequency_to_channel(chan->center_freq); |
391 | 374 | ||
392 | status = mwifiex_bss_ioctl_channel(priv, HostCmd_ACT_GEN_SET, &cfp); | 375 | if (mwifiex_bss_set_channel(priv, &cfp)) |
393 | if (status) | ||
394 | return -EFAULT; | 376 | return -EFAULT; |
395 | 377 | ||
396 | ret = mwifiex_drv_change_adhoc_chan(priv, cfp.channel); | 378 | return mwifiex_drv_change_adhoc_chan(priv, cfp.channel); |
397 | |||
398 | return ret; | ||
399 | } | 379 | } |
400 | 380 | ||
401 | /* | 381 | /* |
@@ -422,67 +402,41 @@ mwifiex_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev, | |||
422 | /* | 402 | /* |
423 | * This function sets the fragmentation threshold. | 403 | * This function sets the fragmentation threshold. |
424 | * | 404 | * |
425 | * This function creates an IOCTL request, populates it accordingly | 405 | * The fragmentation threshold value must lie between MWIFIEX_FRAG_MIN_VALUE |
426 | * and issues an IOCTL. | ||
427 | * | ||
428 | * The fragmentation threshold value must lies between MWIFIEX_FRAG_MIN_VALUE | ||
429 | * and MWIFIEX_FRAG_MAX_VALUE. | 406 | * and MWIFIEX_FRAG_MAX_VALUE. |
430 | */ | 407 | */ |
431 | static int | 408 | static int |
432 | mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr) | 409 | mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr) |
433 | { | 410 | { |
434 | int ret = 0; | 411 | int ret = 0; |
435 | int status = 0; | ||
436 | struct mwifiex_wait_queue *wait = NULL; | ||
437 | u8 wait_option = MWIFIEX_IOCTL_WAIT; | ||
438 | 412 | ||
439 | if (frag_thr < MWIFIEX_FRAG_MIN_VALUE | 413 | if (frag_thr < MWIFIEX_FRAG_MIN_VALUE |
440 | || frag_thr > MWIFIEX_FRAG_MAX_VALUE) | 414 | || frag_thr > MWIFIEX_FRAG_MAX_VALUE) |
441 | return -EINVAL; | 415 | return -EINVAL; |
442 | 416 | ||
443 | wait = mwifiex_alloc_fill_wait_queue(priv, wait_option); | 417 | /* Send request to firmware */ |
444 | if (!wait) | 418 | ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB, |
445 | return -ENOMEM; | 419 | HostCmd_ACT_GEN_SET, FRAG_THRESH_I, |
446 | 420 | &frag_thr); | |
447 | status = mwifiex_snmp_mib_ioctl(priv, wait, FRAG_THRESH_I, | ||
448 | HostCmd_ACT_GEN_SET, &frag_thr); | ||
449 | |||
450 | if (mwifiex_request_ioctl(priv, wait, status, wait_option)) | ||
451 | ret = -EFAULT; | ||
452 | 421 | ||
453 | kfree(wait); | ||
454 | return ret; | 422 | return ret; |
455 | } | 423 | } |
456 | 424 | ||
457 | /* | 425 | /* |
458 | * This function sets the RTS threshold. | 426 | * This function sets the RTS threshold. |
459 | * | 427 | |
460 | * This function creates an IOCTL request, populates it accordingly | 428 | * The rts value must lie between MWIFIEX_RTS_MIN_VALUE |
461 | * and issues an IOCTL. | 429 | * and MWIFIEX_RTS_MAX_VALUE. |
462 | */ | 430 | */ |
463 | static int | 431 | static int |
464 | mwifiex_set_rts(struct mwifiex_private *priv, u32 rts_thr) | 432 | mwifiex_set_rts(struct mwifiex_private *priv, u32 rts_thr) |
465 | { | 433 | { |
466 | int ret = 0; | ||
467 | struct mwifiex_wait_queue *wait = NULL; | ||
468 | int status = 0; | ||
469 | u8 wait_option = MWIFIEX_IOCTL_WAIT; | ||
470 | |||
471 | if (rts_thr < MWIFIEX_RTS_MIN_VALUE || rts_thr > MWIFIEX_RTS_MAX_VALUE) | 434 | if (rts_thr < MWIFIEX_RTS_MIN_VALUE || rts_thr > MWIFIEX_RTS_MAX_VALUE) |
472 | rts_thr = MWIFIEX_RTS_MAX_VALUE; | 435 | rts_thr = MWIFIEX_RTS_MAX_VALUE; |
473 | 436 | ||
474 | wait = mwifiex_alloc_fill_wait_queue(priv, wait_option); | 437 | return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB, |
475 | if (!wait) | 438 | HostCmd_ACT_GEN_SET, RTS_THRESH_I, |
476 | return -ENOMEM; | 439 | &rts_thr); |
477 | |||
478 | status = mwifiex_snmp_mib_ioctl(priv, wait, RTS_THRESH_I, | ||
479 | HostCmd_ACT_GEN_SET, &rts_thr); | ||
480 | |||
481 | if (mwifiex_request_ioctl(priv, wait, status, wait_option)) | ||
482 | ret = -EFAULT; | ||
483 | |||
484 | kfree(wait); | ||
485 | return ret; | ||
486 | } | 440 | } |
487 | 441 | ||
488 | /* | 442 | /* |
@@ -498,8 +452,11 @@ mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) | |||
498 | 452 | ||
499 | int ret = 0; | 453 | int ret = 0; |
500 | 454 | ||
501 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) | 455 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) { |
502 | ret = mwifiex_set_rts(priv, wiphy->rts_threshold); | 456 | ret = mwifiex_set_rts(priv, wiphy->rts_threshold); |
457 | if (ret) | ||
458 | return ret; | ||
459 | } | ||
503 | 460 | ||
504 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) | 461 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
505 | ret = mwifiex_set_frag(priv, wiphy->frag_threshold); | 462 | ret = mwifiex_set_frag(priv, wiphy->frag_threshold); |
@@ -518,7 +475,6 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, | |||
518 | { | 475 | { |
519 | int ret = 0; | 476 | int ret = 0; |
520 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 477 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
521 | struct mwifiex_wait_queue *wait = NULL; | ||
522 | 478 | ||
523 | if (priv->bss_mode == type) { | 479 | if (priv->bss_mode == type) { |
524 | wiphy_warn(wiphy, "already set to required type\n"); | 480 | wiphy_warn(wiphy, "already set to required type\n"); |
@@ -545,24 +501,13 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, | |||
545 | return -EINVAL; | 501 | return -EINVAL; |
546 | } | 502 | } |
547 | 503 | ||
548 | wait = mwifiex_alloc_fill_wait_queue(priv, MWIFIEX_IOCTL_WAIT); | 504 | mwifiex_deauthenticate(priv, NULL); |
549 | if (!wait) | ||
550 | return -ENOMEM; | ||
551 | |||
552 | mwifiex_deauthenticate(priv, wait, NULL); | ||
553 | 505 | ||
554 | priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM; | 506 | priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM; |
555 | 507 | ||
556 | ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_SET_BSS_MODE, | 508 | ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_SET_BSS_MODE, |
557 | HostCmd_ACT_GEN_SET, 0, wait, NULL); | 509 | HostCmd_ACT_GEN_SET, 0, NULL); |
558 | if (!ret) | ||
559 | ret = -EINPROGRESS; | ||
560 | |||
561 | ret = mwifiex_request_ioctl(priv, wait, ret, MWIFIEX_IOCTL_WAIT); | ||
562 | if (ret) | ||
563 | ret = -EFAULT; | ||
564 | 510 | ||
565 | kfree(wait); | ||
566 | return ret; | 511 | return ret; |
567 | } | 512 | } |
568 | 513 | ||
@@ -592,7 +537,7 @@ mwifiex_dump_station_info(struct mwifiex_private *priv, | |||
592 | 537 | ||
593 | /* Get signal information from the firmware */ | 538 | /* Get signal information from the firmware */ |
594 | memset(&signal, 0, sizeof(struct mwifiex_ds_get_signal)); | 539 | memset(&signal, 0, sizeof(struct mwifiex_ds_get_signal)); |
595 | if (mwifiex_get_signal_info(priv, MWIFIEX_IOCTL_WAIT, &signal)) { | 540 | if (mwifiex_get_signal_info(priv, &signal)) { |
596 | dev_err(priv->adapter->dev, "getting signal information\n"); | 541 | dev_err(priv->adapter->dev, "getting signal information\n"); |
597 | ret = -EFAULT; | 542 | ret = -EFAULT; |
598 | } | 543 | } |
@@ -623,7 +568,6 @@ mwifiex_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, | |||
623 | u8 *mac, struct station_info *sinfo) | 568 | u8 *mac, struct station_info *sinfo) |
624 | { | 569 | { |
625 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 570 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
626 | int ret = 0; | ||
627 | 571 | ||
628 | mwifiex_dump_station_info(priv, sinfo); | 572 | mwifiex_dump_station_info(priv, sinfo); |
629 | 573 | ||
@@ -632,10 +576,7 @@ mwifiex_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, | |||
632 | if (memcmp(mac, priv->cfg_bssid, ETH_ALEN)) | 576 | if (memcmp(mac, priv->cfg_bssid, ETH_ALEN)) |
633 | return -ENOENT; | 577 | return -ENOENT; |
634 | 578 | ||
635 | 579 | return mwifiex_dump_station_info(priv, sinfo); | |
636 | ret = mwifiex_dump_station_info(priv, sinfo); | ||
637 | |||
638 | return ret; | ||
639 | } | 580 | } |
640 | 581 | ||
641 | /* Supported rates to be advertised to the cfg80211 */ | 582 | /* Supported rates to be advertised to the cfg80211 */ |
@@ -750,7 +691,7 @@ mwifiex_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, | |||
750 | return -EBUSY; | 691 | return -EBUSY; |
751 | 692 | ||
752 | priv->disconnect = 1; | 693 | priv->disconnect = 1; |
753 | if (mwifiex_disconnect(priv, MWIFIEX_IOCTL_WAIT, NULL)) | 694 | if (mwifiex_deauthenticate(priv, NULL)) |
754 | return -EFAULT; | 695 | return -EFAULT; |
755 | 696 | ||
756 | wiphy_dbg(wiphy, "info: successfully disconnected from %pM:" | 697 | wiphy_dbg(wiphy, "info: successfully disconnected from %pM:" |
@@ -774,15 +715,13 @@ mwifiex_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, | |||
774 | */ | 715 | */ |
775 | static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv) | 716 | static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv) |
776 | { | 717 | { |
777 | int ret = 0; | ||
778 | struct ieee80211_channel *chan; | 718 | struct ieee80211_channel *chan; |
779 | struct mwifiex_bss_info bss_info; | 719 | struct mwifiex_bss_info bss_info; |
780 | int ie_len = 0; | 720 | int ie_len = 0; |
781 | u8 ie_buf[IEEE80211_MAX_SSID_LEN + sizeof(struct ieee_types_header)]; | 721 | u8 ie_buf[IEEE80211_MAX_SSID_LEN + sizeof(struct ieee_types_header)]; |
782 | 722 | ||
783 | ret = mwifiex_get_bss_info(priv, &bss_info); | 723 | if (mwifiex_get_bss_info(priv, &bss_info)) |
784 | if (ret) | 724 | return -1; |
785 | return ret; | ||
786 | 725 | ||
787 | ie_buf[0] = WLAN_EID_SSID; | 726 | ie_buf[0] = WLAN_EID_SSID; |
788 | ie_buf[1] = bss_info.ssid.ssid_len; | 727 | ie_buf[1] = bss_info.ssid.ssid_len; |
@@ -801,7 +740,7 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv) | |||
801 | 0, ie_buf, ie_len, 0, GFP_KERNEL); | 740 | 0, ie_buf, ie_len, 0, GFP_KERNEL); |
802 | memcpy(priv->cfg_bssid, bss_info.bssid, ETH_ALEN); | 741 | memcpy(priv->cfg_bssid, bss_info.bssid, ETH_ALEN); |
803 | 742 | ||
804 | return ret; | 743 | return 0; |
805 | } | 744 | } |
806 | 745 | ||
807 | /* | 746 | /* |
@@ -830,16 +769,15 @@ static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv, | |||
830 | struct mwifiex_bssdescriptor *scan_table; | 769 | struct mwifiex_bssdescriptor *scan_table; |
831 | int i, j; | 770 | int i, j; |
832 | struct ieee80211_channel *chan; | 771 | struct ieee80211_channel *chan; |
833 | u8 *ie, *tmp, *ie_buf; | 772 | u8 *ie, *ie_buf; |
834 | u32 ie_len; | 773 | u32 ie_len; |
835 | u64 ts = 0; | ||
836 | u8 *beacon; | 774 | u8 *beacon; |
837 | int beacon_size; | 775 | int beacon_size; |
838 | u8 element_id, element_len; | 776 | u8 element_id, element_len; |
839 | 777 | ||
840 | memset(&scan_resp, 0, sizeof(scan_resp)); | 778 | memset(&scan_resp, 0, sizeof(scan_resp)); |
841 | if (mwifiex_get_scan_table(priv, MWIFIEX_IOCTL_WAIT, &scan_resp)) | 779 | scan_resp.scan_table = (u8 *) priv->adapter->scan_table; |
842 | return -EFAULT; | 780 | scan_resp.num_in_scan_table = priv->adapter->num_in_scan_table; |
843 | 781 | ||
844 | #define MAX_IE_BUF 2048 | 782 | #define MAX_IE_BUF 2048 |
845 | ie_buf = kzalloc(MAX_IE_BUF, GFP_KERNEL); | 783 | ie_buf = kzalloc(MAX_IE_BUF, GFP_KERNEL); |
@@ -914,9 +852,9 @@ static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv, | |||
914 | case WLAN_EID_BSS_AC_ACCESS_DELAY: | 852 | case WLAN_EID_BSS_AC_ACCESS_DELAY: |
915 | ie[0] = element_id; | 853 | ie[0] = element_id; |
916 | ie[1] = element_len; | 854 | ie[1] = element_len; |
917 | tmp = (u8 *) beacon; | ||
918 | memcpy(&ie[sizeof(struct ieee_types_header)], | 855 | memcpy(&ie[sizeof(struct ieee_types_header)], |
919 | tmp + sizeof(struct ieee_types_header), | 856 | (u8 *) beacon |
857 | + sizeof(struct ieee_types_header), | ||
920 | element_len); | 858 | element_len); |
921 | ie_len += ie[1] + | 859 | ie_len += ie[1] + |
922 | sizeof(struct ieee_types_header); | 860 | sizeof(struct ieee_types_header); |
@@ -933,7 +871,7 @@ static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv, | |||
933 | scan_table[i].freq); | 871 | scan_table[i].freq); |
934 | cfg80211_inform_bss(priv->wdev->wiphy, chan, | 872 | cfg80211_inform_bss(priv->wdev->wiphy, chan, |
935 | scan_table[i].mac_address, | 873 | scan_table[i].mac_address, |
936 | ts, scan_table[i].cap_info_bitmap, | 874 | 0, scan_table[i].cap_info_bitmap, |
937 | scan_table[i].beacon_period, | 875 | scan_table[i].beacon_period, |
938 | ie_buf, ie_len, | 876 | ie_buf, ie_len, |
939 | scan_table[i].rssi, GFP_KERNEL); | 877 | scan_table[i].rssi, GFP_KERNEL); |
@@ -966,9 +904,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
966 | struct mwifiex_802_11_ssid req_ssid; | 904 | struct mwifiex_802_11_ssid req_ssid; |
967 | struct mwifiex_ssid_bssid ssid_bssid; | 905 | struct mwifiex_ssid_bssid ssid_bssid; |
968 | int ret = 0; | 906 | int ret = 0; |
969 | int auth_type = 0, pairwise_encrypt_mode = 0; | 907 | int auth_type = 0; |
970 | int group_encrypt_mode = 0; | ||
971 | int alg_is_wep = 0; | ||
972 | 908 | ||
973 | memset(&req_ssid, 0, sizeof(struct mwifiex_802_11_ssid)); | 909 | memset(&req_ssid, 0, sizeof(struct mwifiex_802_11_ssid)); |
974 | memset(&ssid_bssid, 0, sizeof(struct mwifiex_ssid_bssid)); | 910 | memset(&ssid_bssid, 0, sizeof(struct mwifiex_ssid_bssid)); |
@@ -986,7 +922,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
986 | } | 922 | } |
987 | 923 | ||
988 | /* disconnect before try to associate */ | 924 | /* disconnect before try to associate */ |
989 | mwifiex_disconnect(priv, MWIFIEX_IOCTL_WAIT, NULL); | 925 | mwifiex_deauthenticate(priv, NULL); |
990 | 926 | ||
991 | if (channel) | 927 | if (channel) |
992 | ret = mwifiex_set_rf_channel(priv, channel, | 928 | ret = mwifiex_set_rf_channel(priv, channel, |
@@ -1034,9 +970,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
1034 | ret = mwifiex_set_gen_ie(priv, sme->ie, sme->ie_len); | 970 | ret = mwifiex_set_gen_ie(priv, sme->ie, sme->ie_len); |
1035 | 971 | ||
1036 | if (sme->key) { | 972 | if (sme->key) { |
1037 | alg_is_wep = mwifiex_is_alg_wep(pairwise_encrypt_mode) | 973 | if (mwifiex_is_alg_wep(0) | mwifiex_is_alg_wep(0)) { |
1038 | | mwifiex_is_alg_wep(group_encrypt_mode); | ||
1039 | if (alg_is_wep) { | ||
1040 | dev_dbg(priv->adapter->dev, | 974 | dev_dbg(priv->adapter->dev, |
1041 | "info: setting wep encryption" | 975 | "info: setting wep encryption" |
1042 | " with key len %d\n", sme->key_len); | 976 | " with key len %d\n", sme->key_len); |
@@ -1046,7 +980,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
1046 | } | 980 | } |
1047 | done: | 981 | done: |
1048 | /* Do specific SSID scanning */ | 982 | /* Do specific SSID scanning */ |
1049 | if (mwifiex_request_scan(priv, MWIFIEX_IOCTL_WAIT, &req_ssid)) { | 983 | if (mwifiex_request_scan(priv, &req_ssid)) { |
1050 | dev_err(priv->adapter->dev, "scan error\n"); | 984 | dev_err(priv->adapter->dev, "scan error\n"); |
1051 | return -EFAULT; | 985 | return -EFAULT; |
1052 | } | 986 | } |
@@ -1055,8 +989,7 @@ done: | |||
1055 | memcpy(&ssid_bssid.ssid, &req_ssid, sizeof(struct mwifiex_802_11_ssid)); | 989 | memcpy(&ssid_bssid.ssid, &req_ssid, sizeof(struct mwifiex_802_11_ssid)); |
1056 | 990 | ||
1057 | if (mode != NL80211_IFTYPE_ADHOC) { | 991 | if (mode != NL80211_IFTYPE_ADHOC) { |
1058 | if (mwifiex_find_best_bss(priv, MWIFIEX_IOCTL_WAIT, | 992 | if (mwifiex_find_best_bss(priv, &ssid_bssid)) |
1059 | &ssid_bssid)) | ||
1060 | return -EFAULT; | 993 | return -EFAULT; |
1061 | /* Inform the BSS information to kernel, otherwise | 994 | /* Inform the BSS information to kernel, otherwise |
1062 | * kernel will give a panic after successful assoc */ | 995 | * kernel will give a panic after successful assoc */ |
@@ -1072,7 +1005,10 @@ done: | |||
1072 | /* Connect to BSS by ESSID */ | 1005 | /* Connect to BSS by ESSID */ |
1073 | memset(&ssid_bssid.bssid, 0, ETH_ALEN); | 1006 | memset(&ssid_bssid.bssid, 0, ETH_ALEN); |
1074 | 1007 | ||
1075 | if (mwifiex_bss_start(priv, MWIFIEX_IOCTL_WAIT, &ssid_bssid)) | 1008 | if (!netif_queue_stopped(priv->netdev)) |
1009 | netif_stop_queue(priv->netdev); | ||
1010 | |||
1011 | if (mwifiex_bss_start(priv, &ssid_bssid)) | ||
1076 | return -EFAULT; | 1012 | return -EFAULT; |
1077 | 1013 | ||
1078 | if (mode == NL80211_IFTYPE_ADHOC) { | 1014 | if (mode == NL80211_IFTYPE_ADHOC) { |
@@ -1176,7 +1112,7 @@ mwifiex_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) | |||
1176 | 1112 | ||
1177 | wiphy_dbg(wiphy, "info: disconnecting from essid %pM\n", | 1113 | wiphy_dbg(wiphy, "info: disconnecting from essid %pM\n", |
1178 | priv->cfg_bssid); | 1114 | priv->cfg_bssid); |
1179 | if (mwifiex_disconnect(priv, MWIFIEX_IOCTL_WAIT, NULL)) | 1115 | if (mwifiex_deauthenticate(priv, NULL)) |
1180 | return -EFAULT; | 1116 | return -EFAULT; |
1181 | 1117 | ||
1182 | queue_work(priv->workqueue, &priv->cfg_workqueue); | 1118 | queue_work(priv->workqueue, &priv->cfg_workqueue); |
@@ -1451,6 +1387,4 @@ done: | |||
1451 | memset(priv->cfg_bssid, 0, ETH_ALEN); | 1387 | memset(priv->cfg_bssid, 0, ETH_ALEN); |
1452 | priv->disconnect = 0; | 1388 | priv->disconnect = 0; |
1453 | } | 1389 | } |
1454 | |||
1455 | return; | ||
1456 | } | 1390 | } |