aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/join.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/mwifiex/join.c')
-rw-r--r--drivers/net/wireless/mwifiex/join.c90
1 files changed, 36 insertions, 54 deletions
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c
index 7a9e0b5962ed..60d25c690c07 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 */
592int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, 592int 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
719done: 718done:
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;
@@ -885,9 +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 ret = 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 885
892 if (ret) { 886 if (ret) {
893 dev_err(adapter->dev, 887 dev_err(adapter->dev,
@@ -1066,9 +1060,9 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
1066 priv-> 1060 priv->
1067 curr_pkt_filter | HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON; 1061 curr_pkt_filter | HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON;
1068 1062
1069 ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_MAC_CONTROL, 1063 ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL,
1070 HostCmd_ACT_GEN_SET, 0, NULL, 1064 HostCmd_ACT_GEN_SET, 0,
1071 &curr_pkt_filter); 1065 &curr_pkt_filter);
1072 if (ret) { 1066 if (ret) {
1073 dev_err(priv->adapter->dev, 1067 dev_err(priv->adapter->dev,
1074 "ADHOC_J_CMD: G Protection config failed\n"); 1068 "ADHOC_J_CMD: G Protection config failed\n");
@@ -1192,11 +1186,10 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
1192 * saves the beacon buffer. 1186 * saves the beacon buffer.
1193 */ 1187 */
1194int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, 1188int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
1195 struct host_cmd_ds_command *resp, void *wq_buf) 1189 struct host_cmd_ds_command *resp)
1196{ 1190{
1197 int ret = 0; 1191 int ret = 0;
1198 struct mwifiex_wait_queue *wait_queue = 1192 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; 1193 struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result;
1201 struct mwifiex_bssdescriptor *bss_desc; 1194 struct mwifiex_bssdescriptor *bss_desc;
1202 u16 command = le16_to_cpu(resp->command); 1195 u16 command = le16_to_cpu(resp->command);
@@ -1264,11 +1257,11 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
1264 1257
1265done: 1258done:
1266 /* Need to indicate IOCTL complete */ 1259 /* Need to indicate IOCTL complete */
1267 if (wait_queue) { 1260 if (adapter->curr_cmd->wait_q_enabled) {
1268 if (ret) 1261 if (ret)
1269 wait_queue->status = MWIFIEX_ERROR_ASSOC_FAIL; 1262 adapter->cmd_wait_q.status = -1;
1270 else 1263 else
1271 wait_queue->status = MWIFIEX_ERROR_NO_ERROR; 1264 adapter->cmd_wait_q.status = 0;
1272 1265
1273 } 1266 }
1274 1267
@@ -1283,7 +1276,7 @@ done:
1283 * command to firmware. 1276 * command to firmware.
1284 */ 1277 */
1285int mwifiex_associate(struct mwifiex_private *priv, 1278int mwifiex_associate(struct mwifiex_private *priv,
1286 void *wait_queue, struct mwifiex_bssdescriptor *bss_desc) 1279 struct mwifiex_bssdescriptor *bss_desc)
1287{ 1280{
1288 int ret = 0; 1281 int ret = 0;
1289 u8 current_bssid[ETH_ALEN]; 1282 u8 current_bssid[ETH_ALEN];
@@ -1301,9 +1294,8 @@ int mwifiex_associate(struct mwifiex_private *priv,
1301 retrieval */ 1294 retrieval */
1302 priv->assoc_rsp_size = 0; 1295 priv->assoc_rsp_size = 0;
1303 1296
1304 ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_ASSOCIATE, 1297 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_ASSOCIATE,
1305 HostCmd_ACT_GEN_SET, 0, wait_queue, 1298 HostCmd_ACT_GEN_SET, 0, bss_desc);
1306 bss_desc);
1307 1299
1308 return ret; 1300 return ret;
1309} 1301}
@@ -1315,7 +1307,7 @@ int mwifiex_associate(struct mwifiex_private *priv,
1315 */ 1307 */
1316int 1308int
1317mwifiex_adhoc_start(struct mwifiex_private *priv, 1309mwifiex_adhoc_start(struct mwifiex_private *priv,
1318 void *wait_queue, struct mwifiex_802_11_ssid *adhoc_ssid) 1310 struct mwifiex_802_11_ssid *adhoc_ssid)
1319{ 1311{
1320 int ret = 0; 1312 int ret = 0;
1321 1313
@@ -1326,9 +1318,8 @@ mwifiex_adhoc_start(struct mwifiex_private *priv,
1326 dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %d\n", 1318 dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %d\n",
1327 priv->curr_bss_params.band); 1319 priv->curr_bss_params.band);
1328 1320
1329 ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_AD_HOC_START, 1321 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_AD_HOC_START,
1330 HostCmd_ACT_GEN_SET, 0, wait_queue, 1322 HostCmd_ACT_GEN_SET, 0, adhoc_ssid);
1331 adhoc_ssid);
1332 1323
1333 return ret; 1324 return ret;
1334} 1325}
@@ -1340,7 +1331,7 @@ mwifiex_adhoc_start(struct mwifiex_private *priv,
1340 * if already not connected to the requested SSID. 1331 * if already not connected to the requested SSID.
1341 */ 1332 */
1342int mwifiex_adhoc_join(struct mwifiex_private *priv, 1333int mwifiex_adhoc_join(struct mwifiex_private *priv,
1343 void *wait_queue, struct mwifiex_bssdescriptor *bss_desc) 1334 struct mwifiex_bssdescriptor *bss_desc)
1344{ 1335{
1345 int ret = 0; 1336 int ret = 0;
1346 1337
@@ -1369,9 +1360,8 @@ int mwifiex_adhoc_join(struct mwifiex_private *priv,
1369 dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %c\n", 1360 dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %c\n",
1370 priv->curr_bss_params.band); 1361 priv->curr_bss_params.band);
1371 1362
1372 ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_AD_HOC_JOIN, 1363 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_AD_HOC_JOIN,
1373 HostCmd_ACT_GEN_SET, 0, wait_queue, 1364 HostCmd_ACT_GEN_SET, 0, bss_desc);
1374 bss_desc);
1375 1365
1376 return ret; 1366 return ret;
1377} 1367}
@@ -1380,9 +1370,7 @@ int mwifiex_adhoc_join(struct mwifiex_private *priv,
1380 * This function deauthenticates/disconnects from infra network by sending 1370 * This function deauthenticates/disconnects from infra network by sending
1381 * deauthentication request. 1371 * deauthentication request.
1382 */ 1372 */
1383static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, 1373static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, u8 *mac)
1384 struct mwifiex_wait_queue *wait,
1385 u8 *mac)
1386{ 1374{
1387 u8 mac_address[ETH_ALEN]; 1375 u8 mac_address[ETH_ALEN];
1388 int ret = 0; 1376 int ret = 0;
@@ -1400,11 +1388,8 @@ static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv,
1400 bss_descriptor.mac_address, ETH_ALEN); 1388 bss_descriptor.mac_address, ETH_ALEN);
1401 } 1389 }
1402 1390
1403 ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_DEAUTHENTICATE, 1391 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_DEAUTHENTICATE,
1404 HostCmd_ACT_GEN_SET, 0, wait, &mac_address); 1392 HostCmd_ACT_GEN_SET, 0, &mac_address);
1405
1406 if (!ret && wait)
1407 ret = -EINPROGRESS;
1408 1393
1409 return ret; 1394 return ret;
1410} 1395}
@@ -1415,26 +1400,23 @@ static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv,
1415 * In case of infra made, it sends deauthentication request, and 1400 * 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. 1401 * in case of ad-hoc mode, a stop network request is sent to the firmware.
1417 */ 1402 */
1418int mwifiex_deauthenticate(struct mwifiex_private *priv, 1403int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac)
1419 struct mwifiex_wait_queue *wait, u8 *mac)
1420{ 1404{
1421 int ret = 0; 1405 int ret = 0;
1422 1406
1423 if (priv->media_connected) { 1407 if (priv->media_connected) {
1424 if (priv->bss_mode == NL80211_IFTYPE_STATION) { 1408 if (priv->bss_mode == NL80211_IFTYPE_STATION) {
1425 ret = mwifiex_deauthenticate_infra(priv, wait, mac); 1409 ret = mwifiex_deauthenticate_infra(priv, mac);
1426 } else if (priv->bss_mode == NL80211_IFTYPE_ADHOC) { 1410 } else if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
1427 ret = mwifiex_prepare_cmd(priv, 1411 ret = mwifiex_send_cmd_sync(priv,
1428 HostCmd_CMD_802_11_AD_HOC_STOP, 1412 HostCmd_CMD_802_11_AD_HOC_STOP,
1429 HostCmd_ACT_GEN_SET, 0, wait, NULL); 1413 HostCmd_ACT_GEN_SET, 0, NULL);
1430
1431 if (!ret && wait)
1432 ret = -EINPROGRESS;
1433 } 1414 }
1434 } 1415 }
1435 1416
1436 return ret; 1417 return ret;
1437} 1418}
1419EXPORT_SYMBOL_GPL(mwifiex_deauthenticate);
1438 1420
1439/* 1421/*
1440 * This function converts band to radio type used in channel TLV. 1422 * This function converts band to radio type used in channel TLV.