diff options
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/join.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/scan.c | 38 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_cmdresp.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_event.c | 31 |
6 files changed, 69 insertions, 39 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 2691620393ea..0679458a1bac 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1596,8 +1596,9 @@ done: | |||
1596 | } | 1596 | } |
1597 | } | 1597 | } |
1598 | 1598 | ||
1599 | if (mwifiex_bss_start(priv, bss, &req_ssid)) | 1599 | ret = mwifiex_bss_start(priv, bss, &req_ssid); |
1600 | return -EFAULT; | 1600 | if (ret) |
1601 | return ret; | ||
1601 | 1602 | ||
1602 | if (mode == NL80211_IFTYPE_ADHOC) { | 1603 | if (mode == NL80211_IFTYPE_ADHOC) { |
1603 | /* Inform the BSS information to kernel, otherwise | 1604 | /* Inform the BSS information to kernel, otherwise |
@@ -1652,9 +1653,19 @@ done: | |||
1652 | "info: association to bssid %pM failed\n", | 1653 | "info: association to bssid %pM failed\n", |
1653 | priv->cfg_bssid); | 1654 | priv->cfg_bssid); |
1654 | memset(priv->cfg_bssid, 0, ETH_ALEN); | 1655 | memset(priv->cfg_bssid, 0, ETH_ALEN); |
1656 | |||
1657 | if (ret > 0) | ||
1658 | cfg80211_connect_result(priv->netdev, priv->cfg_bssid, | ||
1659 | NULL, 0, NULL, 0, ret, | ||
1660 | GFP_KERNEL); | ||
1661 | else | ||
1662 | cfg80211_connect_result(priv->netdev, priv->cfg_bssid, | ||
1663 | NULL, 0, NULL, 0, | ||
1664 | WLAN_STATUS_UNSPECIFIED_FAILURE, | ||
1665 | GFP_KERNEL); | ||
1655 | } | 1666 | } |
1656 | 1667 | ||
1657 | return ret; | 1668 | return 0; |
1658 | } | 1669 | } |
1659 | 1670 | ||
1660 | /* | 1671 | /* |
@@ -1802,7 +1813,7 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, | |||
1802 | { | 1813 | { |
1803 | struct net_device *dev = request->wdev->netdev; | 1814 | struct net_device *dev = request->wdev->netdev; |
1804 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 1815 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
1805 | int i, offset; | 1816 | int i, offset, ret; |
1806 | struct ieee80211_channel *chan; | 1817 | struct ieee80211_channel *chan; |
1807 | struct ieee_types_header *ie; | 1818 | struct ieee_types_header *ie; |
1808 | 1819 | ||
@@ -1855,8 +1866,12 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, | |||
1855 | 1866 | ||
1856 | priv->user_scan_cfg->chan_list[i].scan_time = 0; | 1867 | priv->user_scan_cfg->chan_list[i].scan_time = 0; |
1857 | } | 1868 | } |
1858 | if (mwifiex_scan_networks(priv, priv->user_scan_cfg)) | 1869 | |
1859 | return -EFAULT; | 1870 | ret = mwifiex_scan_networks(priv, priv->user_scan_cfg); |
1871 | if (ret) { | ||
1872 | dev_err(priv->adapter->dev, "scan failed: %d\n", ret); | ||
1873 | return ret; | ||
1874 | } | ||
1860 | 1875 | ||
1861 | if (request->ie && request->ie_len) { | 1876 | if (request->ie && request->ie_len) { |
1862 | for (i = 0; i < MWIFIEX_MAX_VSIE_NUM; i++) { | 1877 | for (i = 0; i < MWIFIEX_MAX_VSIE_NUM; i++) { |
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c index 82e63cee1e97..7b0858af8f5d 100644 --- a/drivers/net/wireless/mwifiex/join.c +++ b/drivers/net/wireless/mwifiex/join.c | |||
@@ -1180,16 +1180,18 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, | |||
1180 | struct mwifiex_adapter *adapter = priv->adapter; | 1180 | struct mwifiex_adapter *adapter = priv->adapter; |
1181 | struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result; | 1181 | struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result; |
1182 | struct mwifiex_bssdescriptor *bss_desc; | 1182 | struct mwifiex_bssdescriptor *bss_desc; |
1183 | u16 reason_code; | ||
1183 | 1184 | ||
1184 | adhoc_result = &resp->params.adhoc_result; | 1185 | adhoc_result = &resp->params.adhoc_result; |
1185 | 1186 | ||
1186 | bss_desc = priv->attempted_bss_desc; | 1187 | bss_desc = priv->attempted_bss_desc; |
1187 | 1188 | ||
1188 | /* Join result code 0 --> SUCCESS */ | 1189 | /* Join result code 0 --> SUCCESS */ |
1189 | if (le16_to_cpu(resp->result)) { | 1190 | reason_code = le16_to_cpu(resp->result); |
1191 | if (reason_code) { | ||
1190 | dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n"); | 1192 | dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n"); |
1191 | if (priv->media_connected) | 1193 | if (priv->media_connected) |
1192 | mwifiex_reset_connect_state(priv); | 1194 | mwifiex_reset_connect_state(priv, reason_code); |
1193 | 1195 | ||
1194 | memset(&priv->curr_bss_params.bss_descriptor, | 1196 | memset(&priv->curr_bss_params.bss_descriptor, |
1195 | 0x00, sizeof(struct mwifiex_bssdescriptor)); | 1197 | 0x00, sizeof(struct mwifiex_bssdescriptor)); |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index bfb3fa69805c..c2d0ab146af5 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -847,7 +847,7 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, | |||
847 | struct mwifiex_bssdescriptor *bss_desc); | 847 | struct mwifiex_bssdescriptor *bss_desc); |
848 | int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, | 848 | int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, |
849 | struct host_cmd_ds_command *resp); | 849 | struct host_cmd_ds_command *resp); |
850 | void mwifiex_reset_connect_state(struct mwifiex_private *priv); | 850 | void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason); |
851 | u8 mwifiex_band_to_radio_type(u8 band); | 851 | u8 mwifiex_band_to_radio_type(u8 band); |
852 | int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac); | 852 | int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac); |
853 | int mwifiex_adhoc_start(struct mwifiex_private *priv, | 853 | int mwifiex_adhoc_start(struct mwifiex_private *priv, |
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index e36a75988f87..00b658d3b6ec 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -1296,7 +1296,7 @@ mwifiex_radio_type_to_band(u8 radio_type) | |||
1296 | int mwifiex_scan_networks(struct mwifiex_private *priv, | 1296 | int mwifiex_scan_networks(struct mwifiex_private *priv, |
1297 | const struct mwifiex_user_scan_cfg *user_scan_in) | 1297 | const struct mwifiex_user_scan_cfg *user_scan_in) |
1298 | { | 1298 | { |
1299 | int ret = 0; | 1299 | int ret; |
1300 | struct mwifiex_adapter *adapter = priv->adapter; | 1300 | struct mwifiex_adapter *adapter = priv->adapter; |
1301 | struct cmd_ctrl_node *cmd_node; | 1301 | struct cmd_ctrl_node *cmd_node; |
1302 | union mwifiex_scan_cmd_config_tlv *scan_cfg_out; | 1302 | union mwifiex_scan_cmd_config_tlv *scan_cfg_out; |
@@ -1309,25 +1309,26 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, | |||
1309 | unsigned long flags; | 1309 | unsigned long flags; |
1310 | 1310 | ||
1311 | if (adapter->scan_processing) { | 1311 | if (adapter->scan_processing) { |
1312 | dev_dbg(adapter->dev, "cmd: Scan already in process...\n"); | 1312 | dev_err(adapter->dev, "cmd: Scan already in process...\n"); |
1313 | return ret; | 1313 | return -EBUSY; |
1314 | } | 1314 | } |
1315 | 1315 | ||
1316 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); | ||
1317 | adapter->scan_processing = true; | ||
1318 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); | ||
1319 | |||
1320 | if (priv->scan_block) { | 1316 | if (priv->scan_block) { |
1321 | dev_dbg(adapter->dev, | 1317 | dev_err(adapter->dev, |
1322 | "cmd: Scan is blocked during association...\n"); | 1318 | "cmd: Scan is blocked during association...\n"); |
1323 | return ret; | 1319 | return -EBUSY; |
1324 | } | 1320 | } |
1325 | 1321 | ||
1322 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); | ||
1323 | adapter->scan_processing = true; | ||
1324 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); | ||
1325 | |||
1326 | scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv), | 1326 | scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv), |
1327 | GFP_KERNEL); | 1327 | GFP_KERNEL); |
1328 | if (!scan_cfg_out) { | 1328 | if (!scan_cfg_out) { |
1329 | dev_err(adapter->dev, "failed to alloc scan_cfg_out\n"); | 1329 | dev_err(adapter->dev, "failed to alloc scan_cfg_out\n"); |
1330 | return -ENOMEM; | 1330 | ret = -ENOMEM; |
1331 | goto done; | ||
1331 | } | 1332 | } |
1332 | 1333 | ||
1333 | buf_size = sizeof(struct mwifiex_chan_scan_param_set) * | 1334 | buf_size = sizeof(struct mwifiex_chan_scan_param_set) * |
@@ -1336,7 +1337,8 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, | |||
1336 | if (!scan_chan_list) { | 1337 | if (!scan_chan_list) { |
1337 | dev_err(adapter->dev, "failed to alloc scan_chan_list\n"); | 1338 | dev_err(adapter->dev, "failed to alloc scan_chan_list\n"); |
1338 | kfree(scan_cfg_out); | 1339 | kfree(scan_cfg_out); |
1339 | return -ENOMEM; | 1340 | ret = -ENOMEM; |
1341 | goto done; | ||
1340 | } | 1342 | } |
1341 | 1343 | ||
1342 | mwifiex_config_scan(priv, user_scan_in, &scan_cfg_out->config, | 1344 | mwifiex_config_scan(priv, user_scan_in, &scan_cfg_out->config, |
@@ -1364,14 +1366,16 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, | |||
1364 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, | 1366 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, |
1365 | flags); | 1367 | flags); |
1366 | } | 1368 | } |
1367 | } else { | ||
1368 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); | ||
1369 | adapter->scan_processing = true; | ||
1370 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); | ||
1371 | } | 1369 | } |
1372 | 1370 | ||
1373 | kfree(scan_cfg_out); | 1371 | kfree(scan_cfg_out); |
1374 | kfree(scan_chan_list); | 1372 | kfree(scan_chan_list); |
1373 | done: | ||
1374 | if (ret) { | ||
1375 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); | ||
1376 | adapter->scan_processing = false; | ||
1377 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); | ||
1378 | } | ||
1375 | return ret; | 1379 | return ret; |
1376 | } | 1380 | } |
1377 | 1381 | ||
@@ -1430,8 +1434,8 @@ int mwifiex_check_network_compatibility(struct mwifiex_private *priv, | |||
1430 | ret = mwifiex_is_network_compatible(priv, bss_desc, | 1434 | ret = mwifiex_is_network_compatible(priv, bss_desc, |
1431 | priv->bss_mode); | 1435 | priv->bss_mode); |
1432 | if (ret) | 1436 | if (ret) |
1433 | dev_err(priv->adapter->dev, "cannot find ssid " | 1437 | dev_err(priv->adapter->dev, |
1434 | "%s\n", bss_desc->ssid.ssid); | 1438 | "Incompatible network settings\n"); |
1435 | break; | 1439 | break; |
1436 | default: | 1440 | default: |
1437 | ret = 0; | 1441 | ret = 0; |
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c index e380171c4c5d..09e6a267f566 100644 --- a/drivers/net/wireless/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c | |||
@@ -545,7 +545,7 @@ static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv, | |||
545 | if (!memcmp(resp->params.deauth.mac_addr, | 545 | if (!memcmp(resp->params.deauth.mac_addr, |
546 | &priv->curr_bss_params.bss_descriptor.mac_address, | 546 | &priv->curr_bss_params.bss_descriptor.mac_address, |
547 | sizeof(resp->params.deauth.mac_addr))) | 547 | sizeof(resp->params.deauth.mac_addr))) |
548 | mwifiex_reset_connect_state(priv); | 548 | mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING); |
549 | 549 | ||
550 | return 0; | 550 | return 0; |
551 | } | 551 | } |
@@ -558,7 +558,7 @@ static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv, | |||
558 | static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv, | 558 | static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv, |
559 | struct host_cmd_ds_command *resp) | 559 | struct host_cmd_ds_command *resp) |
560 | { | 560 | { |
561 | mwifiex_reset_connect_state(priv); | 561 | mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING); |
562 | return 0; | 562 | return 0; |
563 | } | 563 | } |
564 | 564 | ||
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c index aafde30e714a..8132119e1a21 100644 --- a/drivers/net/wireless/mwifiex/sta_event.c +++ b/drivers/net/wireless/mwifiex/sta_event.c | |||
@@ -41,7 +41,7 @@ | |||
41 | * - Sends a disconnect event to upper layers/applications. | 41 | * - Sends a disconnect event to upper layers/applications. |
42 | */ | 42 | */ |
43 | void | 43 | void |
44 | mwifiex_reset_connect_state(struct mwifiex_private *priv) | 44 | mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code) |
45 | { | 45 | { |
46 | struct mwifiex_adapter *adapter = priv->adapter; | 46 | struct mwifiex_adapter *adapter = priv->adapter; |
47 | 47 | ||
@@ -117,10 +117,10 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv) | |||
117 | priv->media_connected = false; | 117 | priv->media_connected = false; |
118 | dev_dbg(adapter->dev, | 118 | dev_dbg(adapter->dev, |
119 | "info: successfully disconnected from %pM: reason code %d\n", | 119 | "info: successfully disconnected from %pM: reason code %d\n", |
120 | priv->cfg_bssid, WLAN_REASON_DEAUTH_LEAVING); | 120 | priv->cfg_bssid, reason_code); |
121 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { | 121 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { |
122 | cfg80211_disconnected(priv->netdev, WLAN_REASON_DEAUTH_LEAVING, | 122 | cfg80211_disconnected(priv->netdev, reason_code, NULL, 0, |
123 | NULL, 0, GFP_KERNEL); | 123 | GFP_KERNEL); |
124 | } | 124 | } |
125 | memset(priv->cfg_bssid, 0, ETH_ALEN); | 125 | memset(priv->cfg_bssid, 0, ETH_ALEN); |
126 | 126 | ||
@@ -186,7 +186,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
186 | struct mwifiex_adapter *adapter = priv->adapter; | 186 | struct mwifiex_adapter *adapter = priv->adapter; |
187 | int ret = 0; | 187 | int ret = 0; |
188 | u32 eventcause = adapter->event_cause; | 188 | u32 eventcause = adapter->event_cause; |
189 | u16 ctrl; | 189 | u16 ctrl, reason_code; |
190 | 190 | ||
191 | switch (eventcause) { | 191 | switch (eventcause) { |
192 | case EVENT_DUMMY_HOST_WAKEUP_SIGNAL: | 192 | case EVENT_DUMMY_HOST_WAKEUP_SIGNAL: |
@@ -204,22 +204,31 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
204 | case EVENT_DEAUTHENTICATED: | 204 | case EVENT_DEAUTHENTICATED: |
205 | dev_dbg(adapter->dev, "event: Deauthenticated\n"); | 205 | dev_dbg(adapter->dev, "event: Deauthenticated\n"); |
206 | adapter->dbg.num_event_deauth++; | 206 | adapter->dbg.num_event_deauth++; |
207 | if (priv->media_connected) | 207 | if (priv->media_connected) { |
208 | mwifiex_reset_connect_state(priv); | 208 | reason_code = |
209 | le16_to_cpu(*(__le16 *)adapter->event_body); | ||
210 | mwifiex_reset_connect_state(priv, reason_code); | ||
211 | } | ||
209 | break; | 212 | break; |
210 | 213 | ||
211 | case EVENT_DISASSOCIATED: | 214 | case EVENT_DISASSOCIATED: |
212 | dev_dbg(adapter->dev, "event: Disassociated\n"); | 215 | dev_dbg(adapter->dev, "event: Disassociated\n"); |
213 | adapter->dbg.num_event_disassoc++; | 216 | adapter->dbg.num_event_disassoc++; |
214 | if (priv->media_connected) | 217 | if (priv->media_connected) { |
215 | mwifiex_reset_connect_state(priv); | 218 | reason_code = |
219 | le16_to_cpu(*(__le16 *)adapter->event_body); | ||
220 | mwifiex_reset_connect_state(priv, reason_code); | ||
221 | } | ||
216 | break; | 222 | break; |
217 | 223 | ||
218 | case EVENT_LINK_LOST: | 224 | case EVENT_LINK_LOST: |
219 | dev_dbg(adapter->dev, "event: Link lost\n"); | 225 | dev_dbg(adapter->dev, "event: Link lost\n"); |
220 | adapter->dbg.num_event_link_lost++; | 226 | adapter->dbg.num_event_link_lost++; |
221 | if (priv->media_connected) | 227 | if (priv->media_connected) { |
222 | mwifiex_reset_connect_state(priv); | 228 | reason_code = |
229 | le16_to_cpu(*(__le16 *)adapter->event_body); | ||
230 | mwifiex_reset_connect_state(priv, reason_code); | ||
231 | } | ||
223 | break; | 232 | break; |
224 | 233 | ||
225 | case EVENT_PS_SLEEP: | 234 | case EVENT_PS_SLEEP: |