diff options
Diffstat (limited to 'drivers/net/wireless/mwifiex/join.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/join.c | 128 |
1 files changed, 44 insertions, 84 deletions
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c index 7a9e0b5962ed..23d2d0b9a527 100644 --- a/drivers/net/wireless/mwifiex/join.c +++ b/drivers/net/wireless/mwifiex/join.c | |||
@@ -590,11 +590,10 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, | |||
590 | * an association success (0) or failure (non-zero). | 590 | * an association success (0) or failure (non-zero). |
591 | */ | 591 | */ |
592 | int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, | 592 | int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, |
593 | struct host_cmd_ds_command *resp, void *wq_buf) | 593 | struct host_cmd_ds_command *resp) |
594 | { | 594 | { |
595 | struct mwifiex_adapter *adapter = priv->adapter; | ||
595 | int ret = 0; | 596 | int ret = 0; |
596 | struct mwifiex_wait_queue *wait_queue = | ||
597 | (struct mwifiex_wait_queue *) wq_buf; | ||
598 | struct ieee_types_assoc_rsp *assoc_rsp; | 597 | struct ieee_types_assoc_rsp *assoc_rsp; |
599 | struct mwifiex_bssdescriptor *bss_desc; | 598 | struct mwifiex_bssdescriptor *bss_desc; |
600 | u8 enable_data = true; | 599 | u8 enable_data = true; |
@@ -718,16 +717,11 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, | |||
718 | 717 | ||
719 | done: | 718 | done: |
720 | /* Need to indicate IOCTL complete */ | 719 | /* Need to indicate IOCTL complete */ |
721 | if (wait_queue) { | 720 | if (adapter->curr_cmd->wait_q_enabled) { |
722 | if (ret) { | 721 | if (ret) |
723 | if (assoc_rsp->status_code) | 722 | adapter->cmd_wait_q.status = -1; |
724 | wait_queue->status = | 723 | else |
725 | le16_to_cpu(assoc_rsp->status_code); | 724 | adapter->cmd_wait_q.status = 0; |
726 | else | ||
727 | wait_queue->status = MWIFIEX_ERROR_ASSOC_FAIL; | ||
728 | } else { | ||
729 | wait_queue->status = MWIFIEX_ERROR_NO_ERROR; | ||
730 | } | ||
731 | } | 725 | } |
732 | 726 | ||
733 | return ret; | 727 | return ret; |
@@ -755,7 +749,7 @@ int | |||
755 | mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, | 749 | mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, |
756 | struct host_cmd_ds_command *cmd, void *data_buf) | 750 | struct host_cmd_ds_command *cmd, void *data_buf) |
757 | { | 751 | { |
758 | int ret = 0, rsn_ie_len = 0; | 752 | int rsn_ie_len = 0; |
759 | struct mwifiex_adapter *adapter = priv->adapter; | 753 | struct mwifiex_adapter *adapter = priv->adapter; |
760 | struct host_cmd_ds_802_11_ad_hoc_start *adhoc_start = | 754 | struct host_cmd_ds_802_11_ad_hoc_start *adhoc_start = |
761 | &cmd->params.adhoc_start; | 755 | &cmd->params.adhoc_start; |
@@ -885,11 +879,9 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, | |||
885 | mwifiex_get_active_data_rates(priv, adhoc_start->DataRate); | 879 | mwifiex_get_active_data_rates(priv, adhoc_start->DataRate); |
886 | if ((adapter->adhoc_start_band & BAND_G) && | 880 | if ((adapter->adhoc_start_band & BAND_G) && |
887 | (priv->curr_pkt_filter & HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON)) { | 881 | (priv->curr_pkt_filter & HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON)) { |
888 | ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_MAC_CONTROL, | 882 | if (mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL, |
889 | HostCmd_ACT_GEN_SET, | 883 | HostCmd_ACT_GEN_SET, 0, |
890 | 0, NULL, &priv->curr_pkt_filter); | 884 | &priv->curr_pkt_filter)) { |
891 | |||
892 | if (ret) { | ||
893 | dev_err(adapter->dev, | 885 | dev_err(adapter->dev, |
894 | "ADHOC_S_CMD: G Protection config failed\n"); | 886 | "ADHOC_S_CMD: G Protection config failed\n"); |
895 | return -1; | 887 | return -1; |
@@ -1003,7 +995,7 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, | |||
1003 | IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; | 995 | IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; |
1004 | } | 996 | } |
1005 | ht_info->ht_info.operation_mode = | 997 | ht_info->ht_info.operation_mode = |
1006 | cpu_to_le16(NON_GREENFIELD_STAS); | 998 | cpu_to_le16(IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); |
1007 | ht_info->ht_info.basic_set[0] = 0xff; | 999 | ht_info->ht_info.basic_set[0] = 0xff; |
1008 | pos += sizeof(struct mwifiex_ie_types_htinfo); | 1000 | pos += sizeof(struct mwifiex_ie_types_htinfo); |
1009 | cmd_append_size += | 1001 | cmd_append_size += |
@@ -1045,7 +1037,7 @@ int | |||
1045 | mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, | 1037 | mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, |
1046 | struct host_cmd_ds_command *cmd, void *data_buf) | 1038 | struct host_cmd_ds_command *cmd, void *data_buf) |
1047 | { | 1039 | { |
1048 | int ret = 0, rsn_ie_len = 0; | 1040 | int rsn_ie_len = 0; |
1049 | struct host_cmd_ds_802_11_ad_hoc_join *adhoc_join = | 1041 | struct host_cmd_ds_802_11_ad_hoc_join *adhoc_join = |
1050 | &cmd->params.adhoc_join; | 1042 | &cmd->params.adhoc_join; |
1051 | struct mwifiex_bssdescriptor *bss_desc = | 1043 | struct mwifiex_bssdescriptor *bss_desc = |
@@ -1066,10 +1058,9 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, | |||
1066 | priv-> | 1058 | priv-> |
1067 | curr_pkt_filter | HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON; | 1059 | curr_pkt_filter | HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON; |
1068 | 1060 | ||
1069 | ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_MAC_CONTROL, | 1061 | if (mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL, |
1070 | HostCmd_ACT_GEN_SET, 0, NULL, | 1062 | HostCmd_ACT_GEN_SET, 0, |
1071 | &curr_pkt_filter); | 1063 | &curr_pkt_filter)) { |
1072 | if (ret) { | ||
1073 | dev_err(priv->adapter->dev, | 1064 | dev_err(priv->adapter->dev, |
1074 | "ADHOC_J_CMD: G Protection config failed\n"); | 1065 | "ADHOC_J_CMD: G Protection config failed\n"); |
1075 | return -1; | 1066 | return -1; |
@@ -1180,7 +1171,7 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, | |||
1180 | 1171 | ||
1181 | adhoc_join->bss_descriptor.cap_info_bitmap = cpu_to_le16(tmp_cap); | 1172 | adhoc_join->bss_descriptor.cap_info_bitmap = cpu_to_le16(tmp_cap); |
1182 | 1173 | ||
1183 | return ret; | 1174 | return 0; |
1184 | } | 1175 | } |
1185 | 1176 | ||
1186 | /* | 1177 | /* |
@@ -1192,22 +1183,19 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, | |||
1192 | * saves the beacon buffer. | 1183 | * saves the beacon buffer. |
1193 | */ | 1184 | */ |
1194 | int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, | 1185 | int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, |
1195 | struct host_cmd_ds_command *resp, void *wq_buf) | 1186 | struct host_cmd_ds_command *resp) |
1196 | { | 1187 | { |
1197 | int ret = 0; | 1188 | int ret = 0; |
1198 | struct mwifiex_wait_queue *wait_queue = | 1189 | struct mwifiex_adapter *adapter = priv->adapter; |
1199 | (struct mwifiex_wait_queue *) wq_buf; | ||
1200 | struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result; | 1190 | struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result; |
1201 | struct mwifiex_bssdescriptor *bss_desc; | 1191 | struct mwifiex_bssdescriptor *bss_desc; |
1202 | u16 command = le16_to_cpu(resp->command); | ||
1203 | u16 result = le16_to_cpu(resp->result); | ||
1204 | 1192 | ||
1205 | adhoc_result = &resp->params.adhoc_result; | 1193 | adhoc_result = &resp->params.adhoc_result; |
1206 | 1194 | ||
1207 | bss_desc = priv->attempted_bss_desc; | 1195 | bss_desc = priv->attempted_bss_desc; |
1208 | 1196 | ||
1209 | /* Join result code 0 --> SUCCESS */ | 1197 | /* Join result code 0 --> SUCCESS */ |
1210 | if (result) { | 1198 | if (le16_to_cpu(resp->result)) { |
1211 | dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n"); | 1199 | dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n"); |
1212 | if (priv->media_connected) | 1200 | if (priv->media_connected) |
1213 | mwifiex_reset_connect_state(priv); | 1201 | mwifiex_reset_connect_state(priv); |
@@ -1222,7 +1210,7 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, | |||
1222 | /* Send a Media Connected event, according to the Spec */ | 1210 | /* Send a Media Connected event, according to the Spec */ |
1223 | priv->media_connected = true; | 1211 | priv->media_connected = true; |
1224 | 1212 | ||
1225 | if (command == HostCmd_CMD_802_11_AD_HOC_START) { | 1213 | if (le16_to_cpu(resp->command) == HostCmd_CMD_802_11_AD_HOC_START) { |
1226 | dev_dbg(priv->adapter->dev, "info: ADHOC_S_RESP %s\n", | 1214 | dev_dbg(priv->adapter->dev, "info: ADHOC_S_RESP %s\n", |
1227 | bss_desc->ssid.ssid); | 1215 | bss_desc->ssid.ssid); |
1228 | 1216 | ||
@@ -1264,11 +1252,11 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, | |||
1264 | 1252 | ||
1265 | done: | 1253 | done: |
1266 | /* Need to indicate IOCTL complete */ | 1254 | /* Need to indicate IOCTL complete */ |
1267 | if (wait_queue) { | 1255 | if (adapter->curr_cmd->wait_q_enabled) { |
1268 | if (ret) | 1256 | if (ret) |
1269 | wait_queue->status = MWIFIEX_ERROR_ASSOC_FAIL; | 1257 | adapter->cmd_wait_q.status = -1; |
1270 | else | 1258 | else |
1271 | wait_queue->status = MWIFIEX_ERROR_NO_ERROR; | 1259 | adapter->cmd_wait_q.status = 0; |
1272 | 1260 | ||
1273 | } | 1261 | } |
1274 | 1262 | ||
@@ -1283,9 +1271,8 @@ done: | |||
1283 | * command to firmware. | 1271 | * command to firmware. |
1284 | */ | 1272 | */ |
1285 | int mwifiex_associate(struct mwifiex_private *priv, | 1273 | int mwifiex_associate(struct mwifiex_private *priv, |
1286 | void *wait_queue, struct mwifiex_bssdescriptor *bss_desc) | 1274 | struct mwifiex_bssdescriptor *bss_desc) |
1287 | { | 1275 | { |
1288 | int ret = 0; | ||
1289 | u8 current_bssid[ETH_ALEN]; | 1276 | u8 current_bssid[ETH_ALEN]; |
1290 | 1277 | ||
1291 | /* Return error if the adapter or table entry is not marked as infra */ | 1278 | /* Return error if the adapter or table entry is not marked as infra */ |
@@ -1301,11 +1288,8 @@ int mwifiex_associate(struct mwifiex_private *priv, | |||
1301 | retrieval */ | 1288 | retrieval */ |
1302 | priv->assoc_rsp_size = 0; | 1289 | priv->assoc_rsp_size = 0; |
1303 | 1290 | ||
1304 | ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_ASSOCIATE, | 1291 | return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_ASSOCIATE, |
1305 | HostCmd_ACT_GEN_SET, 0, wait_queue, | 1292 | HostCmd_ACT_GEN_SET, 0, bss_desc); |
1306 | bss_desc); | ||
1307 | |||
1308 | return ret; | ||
1309 | } | 1293 | } |
1310 | 1294 | ||
1311 | /* | 1295 | /* |
@@ -1315,10 +1299,8 @@ int mwifiex_associate(struct mwifiex_private *priv, | |||
1315 | */ | 1299 | */ |
1316 | int | 1300 | int |
1317 | mwifiex_adhoc_start(struct mwifiex_private *priv, | 1301 | mwifiex_adhoc_start(struct mwifiex_private *priv, |
1318 | void *wait_queue, struct mwifiex_802_11_ssid *adhoc_ssid) | 1302 | struct mwifiex_802_11_ssid *adhoc_ssid) |
1319 | { | 1303 | { |
1320 | int ret = 0; | ||
1321 | |||
1322 | dev_dbg(priv->adapter->dev, "info: Adhoc Channel = %d\n", | 1304 | dev_dbg(priv->adapter->dev, "info: Adhoc Channel = %d\n", |
1323 | priv->adhoc_channel); | 1305 | priv->adhoc_channel); |
1324 | dev_dbg(priv->adapter->dev, "info: curr_bss_params.channel = %d\n", | 1306 | dev_dbg(priv->adapter->dev, "info: curr_bss_params.channel = %d\n", |
@@ -1326,11 +1308,8 @@ mwifiex_adhoc_start(struct mwifiex_private *priv, | |||
1326 | dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %d\n", | 1308 | dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %d\n", |
1327 | priv->curr_bss_params.band); | 1309 | priv->curr_bss_params.band); |
1328 | 1310 | ||
1329 | ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_AD_HOC_START, | 1311 | return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_AD_HOC_START, |
1330 | HostCmd_ACT_GEN_SET, 0, wait_queue, | 1312 | HostCmd_ACT_GEN_SET, 0, adhoc_ssid); |
1331 | adhoc_ssid); | ||
1332 | |||
1333 | return ret; | ||
1334 | } | 1313 | } |
1335 | 1314 | ||
1336 | /* | 1315 | /* |
@@ -1340,10 +1319,8 @@ mwifiex_adhoc_start(struct mwifiex_private *priv, | |||
1340 | * if already not connected to the requested SSID. | 1319 | * if already not connected to the requested SSID. |
1341 | */ | 1320 | */ |
1342 | int mwifiex_adhoc_join(struct mwifiex_private *priv, | 1321 | int mwifiex_adhoc_join(struct mwifiex_private *priv, |
1343 | void *wait_queue, struct mwifiex_bssdescriptor *bss_desc) | 1322 | struct mwifiex_bssdescriptor *bss_desc) |
1344 | { | 1323 | { |
1345 | int ret = 0; | ||
1346 | |||
1347 | dev_dbg(priv->adapter->dev, "info: adhoc join: curr_bss ssid =%s\n", | 1324 | dev_dbg(priv->adapter->dev, "info: adhoc join: curr_bss ssid =%s\n", |
1348 | priv->curr_bss_params.bss_descriptor.ssid.ssid); | 1325 | priv->curr_bss_params.bss_descriptor.ssid.ssid); |
1349 | dev_dbg(priv->adapter->dev, "info: adhoc join: curr_bss ssid_len =%u\n", | 1326 | dev_dbg(priv->adapter->dev, "info: adhoc join: curr_bss ssid_len =%u\n", |
@@ -1369,20 +1346,15 @@ int mwifiex_adhoc_join(struct mwifiex_private *priv, | |||
1369 | dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %c\n", | 1346 | dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %c\n", |
1370 | priv->curr_bss_params.band); | 1347 | priv->curr_bss_params.band); |
1371 | 1348 | ||
1372 | ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_AD_HOC_JOIN, | 1349 | return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_AD_HOC_JOIN, |
1373 | HostCmd_ACT_GEN_SET, 0, wait_queue, | 1350 | HostCmd_ACT_GEN_SET, 0, bss_desc); |
1374 | bss_desc); | ||
1375 | |||
1376 | return ret; | ||
1377 | } | 1351 | } |
1378 | 1352 | ||
1379 | /* | 1353 | /* |
1380 | * This function deauthenticates/disconnects from infra network by sending | 1354 | * This function deauthenticates/disconnects from infra network by sending |
1381 | * deauthentication request. | 1355 | * deauthentication request. |
1382 | */ | 1356 | */ |
1383 | static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, | 1357 | static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, u8 *mac) |
1384 | struct mwifiex_wait_queue *wait, | ||
1385 | u8 *mac) | ||
1386 | { | 1358 | { |
1387 | u8 mac_address[ETH_ALEN]; | 1359 | u8 mac_address[ETH_ALEN]; |
1388 | int ret = 0; | 1360 | int ret = 0; |
@@ -1400,11 +1372,8 @@ static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, | |||
1400 | bss_descriptor.mac_address, ETH_ALEN); | 1372 | bss_descriptor.mac_address, ETH_ALEN); |
1401 | } | 1373 | } |
1402 | 1374 | ||
1403 | ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_DEAUTHENTICATE, | 1375 | ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_DEAUTHENTICATE, |
1404 | HostCmd_ACT_GEN_SET, 0, wait, &mac_address); | 1376 | HostCmd_ACT_GEN_SET, 0, &mac_address); |
1405 | |||
1406 | if (!ret && wait) | ||
1407 | ret = -EINPROGRESS; | ||
1408 | 1377 | ||
1409 | return ret; | 1378 | return ret; |
1410 | } | 1379 | } |
@@ -1415,26 +1384,23 @@ static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, | |||
1415 | * In case of infra made, it sends deauthentication request, and | 1384 | * In case of infra made, it sends deauthentication request, and |
1416 | * in case of ad-hoc mode, a stop network request is sent to the firmware. | 1385 | * in case of ad-hoc mode, a stop network request is sent to the firmware. |
1417 | */ | 1386 | */ |
1418 | int mwifiex_deauthenticate(struct mwifiex_private *priv, | 1387 | int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac) |
1419 | struct mwifiex_wait_queue *wait, u8 *mac) | ||
1420 | { | 1388 | { |
1421 | int ret = 0; | 1389 | int ret = 0; |
1422 | 1390 | ||
1423 | if (priv->media_connected) { | 1391 | if (priv->media_connected) { |
1424 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { | 1392 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { |
1425 | ret = mwifiex_deauthenticate_infra(priv, wait, mac); | 1393 | ret = mwifiex_deauthenticate_infra(priv, mac); |
1426 | } else if (priv->bss_mode == NL80211_IFTYPE_ADHOC) { | 1394 | } else if (priv->bss_mode == NL80211_IFTYPE_ADHOC) { |
1427 | ret = mwifiex_prepare_cmd(priv, | 1395 | ret = mwifiex_send_cmd_sync(priv, |
1428 | HostCmd_CMD_802_11_AD_HOC_STOP, | 1396 | HostCmd_CMD_802_11_AD_HOC_STOP, |
1429 | HostCmd_ACT_GEN_SET, 0, wait, NULL); | 1397 | HostCmd_ACT_GEN_SET, 0, NULL); |
1430 | |||
1431 | if (!ret && wait) | ||
1432 | ret = -EINPROGRESS; | ||
1433 | } | 1398 | } |
1434 | } | 1399 | } |
1435 | 1400 | ||
1436 | return ret; | 1401 | return ret; |
1437 | } | 1402 | } |
1403 | EXPORT_SYMBOL_GPL(mwifiex_deauthenticate); | ||
1438 | 1404 | ||
1439 | /* | 1405 | /* |
1440 | * This function converts band to radio type used in channel TLV. | 1406 | * This function converts band to radio type used in channel TLV. |
@@ -1442,21 +1408,15 @@ int mwifiex_deauthenticate(struct mwifiex_private *priv, | |||
1442 | u8 | 1408 | u8 |
1443 | mwifiex_band_to_radio_type(u8 band) | 1409 | mwifiex_band_to_radio_type(u8 band) |
1444 | { | 1410 | { |
1445 | u8 ret_radio_type; | ||
1446 | |||
1447 | switch (band) { | 1411 | switch (band) { |
1448 | case BAND_A: | 1412 | case BAND_A: |
1449 | case BAND_AN: | 1413 | case BAND_AN: |
1450 | case BAND_A | BAND_AN: | 1414 | case BAND_A | BAND_AN: |
1451 | ret_radio_type = HostCmd_SCAN_RADIO_TYPE_A; | 1415 | return HostCmd_SCAN_RADIO_TYPE_A; |
1452 | break; | ||
1453 | case BAND_B: | 1416 | case BAND_B: |
1454 | case BAND_G: | 1417 | case BAND_G: |
1455 | case BAND_B | BAND_G: | 1418 | case BAND_B | BAND_G: |
1456 | default: | 1419 | default: |
1457 | ret_radio_type = HostCmd_SCAN_RADIO_TYPE_BG; | 1420 | return HostCmd_SCAN_RADIO_TYPE_BG; |
1458 | break; | ||
1459 | } | 1421 | } |
1460 | |||
1461 | return ret_radio_type; | ||
1462 | } | 1422 | } |