aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorBing Zhao <bzhao@marvell.com>2011-03-28 20:55:41 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-04 16:20:04 -0400
commiteecd8250e492ffc4e7b72953cda9c2f3ba0e6ccc (patch)
tree1897ca77a7d7746bd6c2fd8f748e06bee971bdfb /drivers/net
parent6a4c499e86f54ed9316a87e7ddc6b7d33adb4976 (diff)
mwifiex: remove MWIFIEX_BSS_MODE_ macros
replace them with NL80211_IFTYPE_ macros Also remove redundant functions mwifiex_drv_get_mode() and mwifiex_bss_ioctl_mode(). Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/mwifiex/11n.c4
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c85
-rw-r--r--drivers/net/wireless/mwifiex/cfp.c3
-rw-r--r--drivers/net/wireless/mwifiex/init.c2
-rw-r--r--drivers/net/wireless/mwifiex/ioctl.h6
-rw-r--r--drivers/net/wireless/mwifiex/join.c12
-rw-r--r--drivers/net/wireless/mwifiex/main.h7
-rw-r--r--drivers/net/wireless/mwifiex/scan.c29
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmd.c4
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmdresp.c2
-rw-r--r--drivers/net/wireless/mwifiex/sta_event.c2
-rw-r--r--drivers/net/wireless/mwifiex/sta_ioctl.c83
12 files changed, 74 insertions, 165 deletions
diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c
index ce6421f3230b..73a6e62f5680 100644
--- a/drivers/net/wireless/mwifiex/11n.c
+++ b/drivers/net/wireless/mwifiex/11n.c
@@ -109,7 +109,7 @@ mwifiex_fill_cap_info(struct mwifiex_private *priv,
109 memset(&mcs[rx_mcs_supp], 0, 109 memset(&mcs[rx_mcs_supp], 0,
110 sizeof(struct ieee80211_mcs_info) - rx_mcs_supp); 110 sizeof(struct ieee80211_mcs_info) - rx_mcs_supp);
111 111
112 if (priv->bss_mode == MWIFIEX_BSS_MODE_INFRA || 112 if (priv->bss_mode == NL80211_IFTYPE_STATION ||
113 (ht_cap_info & IEEE80211_HT_CAP_SUP_WIDTH_20_40)) 113 (ht_cap_info & IEEE80211_HT_CAP_SUP_WIDTH_20_40))
114 /* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */ 114 /* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */
115 SETHT_MCS32(ht_cap->ht_cap.mcs.rx_mask); 115 SETHT_MCS32(ht_cap->ht_cap.mcs.rx_mask);
@@ -418,7 +418,7 @@ mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv,
418 } 418 }
419 419
420 if (bss_desc->bcn_ht_info) { 420 if (bss_desc->bcn_ht_info) {
421 if (priv->bss_mode == MWIFIEX_BSS_MODE_IBSS) { 421 if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
422 ht_info = (struct mwifiex_ie_types_htinfo *) *buffer; 422 ht_info = (struct mwifiex_ie_types_htinfo *) *buffer;
423 memset(ht_info, 0, 423 memset(ht_info, 0,
424 sizeof(struct mwifiex_ie_types_htinfo)); 424 sizeof(struct mwifiex_ie_types_htinfo));
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index de86ef879509..701c17980f6d 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -398,13 +398,9 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
398 int ret = 0; 398 int ret = 0;
399 int status = 0; 399 int status = 0;
400 struct mwifiex_ds_band_cfg band_cfg; 400 struct mwifiex_ds_band_cfg band_cfg;
401 int mode;
402 u8 wait_option = MWIFIEX_IOCTL_WAIT;
403 u32 config_bands = 0; 401 u32 config_bands = 0;
404 struct wiphy *wiphy = priv->wdev->wiphy; 402 struct wiphy *wiphy = priv->wdev->wiphy;
405 403
406 mode = mwifiex_drv_get_mode(priv, wait_option);
407
408 if (chan) { 404 if (chan) {
409 memset(&band_cfg, 0, sizeof(band_cfg)); 405 memset(&band_cfg, 0, sizeof(band_cfg));
410 /* Set appropriate bands */ 406 /* Set appropriate bands */
@@ -412,10 +408,10 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
412 config_bands = BAND_B | BAND_G | BAND_GN; 408 config_bands = BAND_B | BAND_G | BAND_GN;
413 else 409 else
414 config_bands = BAND_AN | BAND_A; 410 config_bands = BAND_AN | BAND_A;
415 if (mode == MWIFIEX_BSS_MODE_INFRA 411 if (priv->bss_mode == NL80211_IFTYPE_STATION
416 || mode == MWIFIEX_BSS_MODE_AUTO) { 412 || priv->bss_mode == NL80211_IFTYPE_UNSPECIFIED) {
417 band_cfg.config_bands = config_bands; 413 band_cfg.config_bands = config_bands;
418 } else if (mode == MWIFIEX_BSS_MODE_IBSS) { 414 } else if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
419 band_cfg.config_bands = config_bands; 415 band_cfg.config_bands = config_bands;
420 band_cfg.adhoc_start_band = config_bands; 416 band_cfg.adhoc_start_band = config_bands;
421 } 417 }
@@ -432,7 +428,8 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
432 } 428 }
433 429
434 wiphy_dbg(wiphy, "info: setting band %d, channel offset %d and " 430 wiphy_dbg(wiphy, "info: setting band %d, channel offset %d and "
435 "mode %d\n", config_bands, band_cfg.sec_chan_offset, mode); 431 "mode %d\n", config_bands, band_cfg.sec_chan_offset,
432 priv->bss_mode);
436 if (!chan) 433 if (!chan)
437 return ret; 434 return ret;
438 435
@@ -561,14 +558,6 @@ mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
561 558
562/* 559/*
563 * CFG802.11 operation handler to change interface type. 560 * CFG802.11 operation handler to change interface type.
564 *
565 * This function creates an IOCTL request, populates it accordingly
566 * and issues an IOCTL.
567 *
568 * The function also maps the CFG802.11 mode type into driver mode type.
569 * NL80211_IFTYPE_ADHOC -> MWIFIEX_BSS_MODE_IBSS
570 * NL80211_IFTYPE_STATION -> MWIFIEX_BSS_MODE_INFRA
571 * NL80211_IFTYPE_UNSPECIFIED -> MWIFIEX_BSS_MODE_AUTO
572 */ 561 */
573static int 562static int
574mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, 563mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
@@ -578,41 +567,50 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
578{ 567{
579 int ret = 0; 568 int ret = 0;
580 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 569 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
581 int mode = -1;
582 struct mwifiex_wait_queue *wait = NULL; 570 struct mwifiex_wait_queue *wait = NULL;
583 int status = 0;
584 571
585 wait = mwifiex_alloc_fill_wait_queue(priv, MWIFIEX_IOCTL_WAIT); 572 if (priv->bss_mode == type) {
586 if (!wait) 573 wiphy_warn(wiphy, "already set to required type\n");
587 return -ENOMEM; 574 return 0;
575 }
576
577 priv->bss_mode = type;
588 578
589 switch (type) { 579 switch (type) {
590 case NL80211_IFTYPE_ADHOC: 580 case NL80211_IFTYPE_ADHOC:
591 mode = MWIFIEX_BSS_MODE_IBSS;
592 dev->ieee80211_ptr->iftype = NL80211_IFTYPE_ADHOC; 581 dev->ieee80211_ptr->iftype = NL80211_IFTYPE_ADHOC;
593 wiphy_dbg(wiphy, "info: setting interface type to adhoc\n"); 582 wiphy_dbg(wiphy, "info: setting interface type to adhoc\n");
594 break; 583 break;
595 case NL80211_IFTYPE_STATION: 584 case NL80211_IFTYPE_STATION:
596 mode = MWIFIEX_BSS_MODE_INFRA;
597 dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION; 585 dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION;
598 wiphy_dbg(wiphy, "info: Setting interface type to managed\n"); 586 wiphy_dbg(wiphy, "info: setting interface type to managed\n");
599 break; 587 break;
600 case NL80211_IFTYPE_UNSPECIFIED: 588 case NL80211_IFTYPE_UNSPECIFIED:
601 mode = MWIFIEX_BSS_MODE_AUTO;
602 dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION; 589 dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION;
603 wiphy_dbg(wiphy, "info: setting interface type to auto\n"); 590 wiphy_dbg(wiphy, "info: setting interface type to auto\n");
604 break; 591 return 0;
605 default: 592 default:
606 ret = -EINVAL; 593 wiphy_err(wiphy, "unknown interface type: %d\n", type);
594 return -EINVAL;
607 } 595 }
608 if (ret)
609 goto done;
610 status = mwifiex_bss_ioctl_mode(priv, wait, HostCmd_ACT_GEN_SET, &mode);
611 596
612 if (mwifiex_request_ioctl(priv, wait, status, MWIFIEX_IOCTL_WAIT)) 597 wait = mwifiex_alloc_fill_wait_queue(priv, MWIFIEX_IOCTL_WAIT);
598 if (!wait)
599 return -ENOMEM;
600
601 mwifiex_deauthenticate(priv, wait, NULL);
602
603 priv->sec_info.authentication_mode = MWIFIEX_AUTH_MODE_OPEN;
604
605 ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
606 HostCmd_ACT_GEN_SET, 0, wait, NULL);
607 if (!ret)
608 ret = -EINPROGRESS;
609
610 ret = mwifiex_request_ioctl(priv, wait, ret, MWIFIEX_IOCTL_WAIT);
611 if (ret)
613 ret = -EFAULT; 612 ret = -EFAULT;
614 613
615done:
616 kfree(wait); 614 kfree(wait);
617 return ret; 615 return ret;
618} 616}
@@ -1046,7 +1044,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
1046 1044
1047 ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); /* Disable keys */ 1045 ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); /* Disable keys */
1048 1046
1049 if (mode == MWIFIEX_BSS_MODE_IBSS) { 1047 if (mode == NL80211_IFTYPE_ADHOC) {
1050 /* "privacy" is set only for ad-hoc mode */ 1048 /* "privacy" is set only for ad-hoc mode */
1051 if (privacy) { 1049 if (privacy) {
1052 /* 1050 /*
@@ -1108,7 +1106,7 @@ done:
1108 1106
1109 memcpy(&ssid_bssid.ssid, &req_ssid, sizeof(struct mwifiex_802_11_ssid)); 1107 memcpy(&ssid_bssid.ssid, &req_ssid, sizeof(struct mwifiex_802_11_ssid));
1110 1108
1111 if (mode != MWIFIEX_BSS_MODE_IBSS) { 1109 if (mode != NL80211_IFTYPE_ADHOC) {
1112 if (mwifiex_find_best_bss(priv, MWIFIEX_IOCTL_WAIT, 1110 if (mwifiex_find_best_bss(priv, MWIFIEX_IOCTL_WAIT,
1113 &ssid_bssid)) 1111 &ssid_bssid))
1114 return -EFAULT; 1112 return -EFAULT;
@@ -1129,7 +1127,7 @@ done:
1129 if (mwifiex_bss_start(priv, MWIFIEX_IOCTL_WAIT, &ssid_bssid)) 1127 if (mwifiex_bss_start(priv, MWIFIEX_IOCTL_WAIT, &ssid_bssid))
1130 return -EFAULT; 1128 return -EFAULT;
1131 1129
1132 if (mode == MWIFIEX_BSS_MODE_IBSS) { 1130 if (mode == NL80211_IFTYPE_ADHOC) {
1133 /* Inform the BSS information to kernel, otherwise 1131 /* Inform the BSS information to kernel, otherwise
1134 * kernel will give a panic after successful assoc */ 1132 * kernel will give a panic after successful assoc */
1135 if (mwifiex_cfg80211_inform_ibss_bss(priv)) 1133 if (mwifiex_cfg80211_inform_ibss_bss(priv))
@@ -1152,14 +1150,11 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
1152{ 1150{
1153 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 1151 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
1154 int ret = 0; 1152 int ret = 0;
1155 int mode = 0;
1156 1153
1157 if (priv->assoc_request) 1154 if (priv->assoc_request)
1158 return -EBUSY; 1155 return -EBUSY;
1159 1156
1160 mode = mwifiex_drv_get_mode(priv, MWIFIEX_IOCTL_WAIT); 1157 if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
1161
1162 if (mode == MWIFIEX_BSS_MODE_IBSS) {
1163 wiphy_err(wiphy, "received infra assoc request " 1158 wiphy_err(wiphy, "received infra assoc request "
1164 "when station is in ibss mode\n"); 1159 "when station is in ibss mode\n");
1165 goto done; 1160 goto done;
@@ -1171,7 +1166,7 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
1171 (char *) sme->ssid, sme->bssid); 1166 (char *) sme->ssid, sme->bssid);
1172 1167
1173 ret = mwifiex_cfg80211_assoc(priv, sme->ssid_len, sme->ssid, sme->bssid, 1168 ret = mwifiex_cfg80211_assoc(priv, sme->ssid_len, sme->ssid, sme->bssid,
1174 mode, sme->channel, sme, 0); 1169 priv->bss_mode, sme->channel, sme, 0);
1175 1170
1176done: 1171done:
1177 priv->assoc_result = ret; 1172 priv->assoc_result = ret;
@@ -1191,13 +1186,11 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
1191{ 1186{
1192 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 1187 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
1193 int ret = 0; 1188 int ret = 0;
1194 int mode = 0;
1195 1189
1196 if (priv->ibss_join_request) 1190 if (priv->ibss_join_request)
1197 return -EBUSY; 1191 return -EBUSY;
1198 1192
1199 mode = mwifiex_drv_get_mode(priv, MWIFIEX_IOCTL_WAIT); 1193 if (priv->bss_mode != NL80211_IFTYPE_ADHOC) {
1200 if (mode != MWIFIEX_BSS_MODE_IBSS) {
1201 wiphy_err(wiphy, "request to join ibss received " 1194 wiphy_err(wiphy, "request to join ibss received "
1202 "when station is not in ibss mode\n"); 1195 "when station is not in ibss mode\n");
1203 goto done; 1196 goto done;
@@ -1209,8 +1202,8 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
1209 (char *) params->ssid, params->bssid); 1202 (char *) params->ssid, params->bssid);
1210 1203
1211 ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid, 1204 ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid,
1212 params->bssid, mode, params->channel, NULL, 1205 params->bssid, priv->bss_mode,
1213 params->privacy); 1206 params->channel, NULL, params->privacy);
1214done: 1207done:
1215 priv->ibss_join_result = ret; 1208 priv->ibss_join_result = ret;
1216 queue_work(priv->workqueue, &priv->cfg_workqueue); 1209 queue_work(priv->workqueue, &priv->cfg_workqueue);
@@ -1301,7 +1294,7 @@ mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info,
1301 /* Clear all the other values */ 1294 /* Clear all the other values */
1302 memset(&mcs[rx_mcs_supp], 0, 1295 memset(&mcs[rx_mcs_supp], 0,
1303 sizeof(struct ieee80211_mcs_info) - rx_mcs_supp); 1296 sizeof(struct ieee80211_mcs_info) - rx_mcs_supp);
1304 if (priv->bss_mode == MWIFIEX_BSS_MODE_INFRA || 1297 if (priv->bss_mode == NL80211_IFTYPE_STATION ||
1305 ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap)) 1298 ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap))
1306 /* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */ 1299 /* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */
1307 SETHT_MCS32(mcs_set.rx_mask); 1300 SETHT_MCS32(mcs_set.rx_mask);
diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c
index 999ed81512fa..07187a405fee 100644
--- a/drivers/net/wireless/mwifiex/cfp.c
+++ b/drivers/net/wireless/mwifiex/cfp.c
@@ -288,8 +288,7 @@ u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates)
288{ 288{
289 u32 k = 0; 289 u32 k = 0;
290 struct mwifiex_adapter *adapter = priv->adapter; 290 struct mwifiex_adapter *adapter = priv->adapter;
291 if (priv->bss_mode == MWIFIEX_BSS_MODE_INFRA) { 291 if (priv->bss_mode == NL80211_IFTYPE_STATION) {
292 /* Infra. mode */
293 switch (adapter->config_bands) { 292 switch (adapter->config_bands) {
294 case BAND_B: 293 case BAND_B:
295 dev_dbg(adapter->dev, "info: infra band=%d " 294 dev_dbg(adapter->dev, "info: infra band=%d "
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c
index 1c9315d31d9c..00e73eac1af4 100644
--- a/drivers/net/wireless/mwifiex/init.c
+++ b/drivers/net/wireless/mwifiex/init.c
@@ -78,7 +78,7 @@ static int mwifiex_init_priv(struct mwifiex_private *priv)
78 memset(priv->curr_addr, 0xff, ETH_ALEN); 78 memset(priv->curr_addr, 0xff, ETH_ALEN);
79 79
80 priv->pkt_tx_ctrl = 0; 80 priv->pkt_tx_ctrl = 0;
81 priv->bss_mode = MWIFIEX_BSS_MODE_INFRA; 81 priv->bss_mode = NL80211_IFTYPE_STATION;
82 priv->data_rate = 0; /* Initially indicate the rate as auto */ 82 priv->data_rate = 0; /* Initially indicate the rate as auto */
83 priv->is_data_rate_auto = true; 83 priv->is_data_rate_auto = true;
84 priv->bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR; 84 priv->bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR;
diff --git a/drivers/net/wireless/mwifiex/ioctl.h b/drivers/net/wireless/mwifiex/ioctl.h
index b7e457110b4f..7fb81dfdf8f2 100644
--- a/drivers/net/wireless/mwifiex/ioctl.h
+++ b/drivers/net/wireless/mwifiex/ioctl.h
@@ -66,12 +66,6 @@ struct mwifiex_scan_resp {
66 u8 *scan_table; 66 u8 *scan_table;
67}; 67};
68 68
69enum {
70 MWIFIEX_BSS_MODE_INFRA = 1,
71 MWIFIEX_BSS_MODE_IBSS,
72 MWIFIEX_BSS_MODE_AUTO
73};
74
75#define MWIFIEX_PROMISC_MODE 1 69#define MWIFIEX_PROMISC_MODE 1
76#define MWIFIEX_MULTICAST_MODE 2 70#define MWIFIEX_MULTICAST_MODE 2
77#define MWIFIEX_ALL_MULTI_MODE 4 71#define MWIFIEX_ALL_MULTI_MODE 4
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c
index 08fa721580cb..d8c7c5f8464e 100644
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -808,7 +808,7 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
808 808
809 /* Set the BSS mode */ 809 /* Set the BSS mode */
810 adhoc_start->bss_mode = HostCmd_BSS_MODE_IBSS; 810 adhoc_start->bss_mode = HostCmd_BSS_MODE_IBSS;
811 bss_desc->bss_mode = MWIFIEX_BSS_MODE_IBSS; 811 bss_desc->bss_mode = NL80211_IFTYPE_ADHOC;
812 adhoc_start->beacon_period = cpu_to_le16(priv->beacon_period); 812 adhoc_start->beacon_period = cpu_to_le16(priv->beacon_period);
813 bss_desc->beacon_period = priv->beacon_period; 813 bss_desc->beacon_period = priv->beacon_period;
814 814
@@ -1289,8 +1289,8 @@ int mwifiex_associate(struct mwifiex_private *priv,
1289 u8 current_bssid[ETH_ALEN]; 1289 u8 current_bssid[ETH_ALEN];
1290 1290
1291 /* Return error if the adapter or table entry is not marked as infra */ 1291 /* Return error if the adapter or table entry is not marked as infra */
1292 if ((priv->bss_mode != MWIFIEX_BSS_MODE_INFRA) || 1292 if ((priv->bss_mode != NL80211_IFTYPE_STATION) ||
1293 (bss_desc->bss_mode != MWIFIEX_BSS_MODE_INFRA)) 1293 (bss_desc->bss_mode != NL80211_IFTYPE_STATION))
1294 return -1; 1294 return -1;
1295 1295
1296 memcpy(&current_bssid, 1296 memcpy(&current_bssid,
@@ -1358,7 +1358,7 @@ int mwifiex_adhoc_join(struct mwifiex_private *priv,
1358 !mwifiex_ssid_cmp(&bss_desc->ssid, 1358 !mwifiex_ssid_cmp(&bss_desc->ssid,
1359 &priv->curr_bss_params.bss_descriptor.ssid) && 1359 &priv->curr_bss_params.bss_descriptor.ssid) &&
1360 (priv->curr_bss_params.bss_descriptor.bss_mode == 1360 (priv->curr_bss_params.bss_descriptor.bss_mode ==
1361 MWIFIEX_BSS_MODE_IBSS)) { 1361 NL80211_IFTYPE_ADHOC)) {
1362 dev_dbg(priv->adapter->dev, "info: ADHOC_J_CMD: new ad-hoc SSID" 1362 dev_dbg(priv->adapter->dev, "info: ADHOC_J_CMD: new ad-hoc SSID"
1363 " is the same as current; not attempting to re-join\n"); 1363 " is the same as current; not attempting to re-join\n");
1364 return -1; 1364 return -1;
@@ -1421,9 +1421,9 @@ int mwifiex_deauthenticate(struct mwifiex_private *priv,
1421 int ret = 0; 1421 int ret = 0;
1422 1422
1423 if (priv->media_connected) { 1423 if (priv->media_connected) {
1424 if (priv->bss_mode == MWIFIEX_BSS_MODE_INFRA) { 1424 if (priv->bss_mode == NL80211_IFTYPE_STATION) {
1425 ret = mwifiex_deauthenticate_infra(priv, wait, mac); 1425 ret = mwifiex_deauthenticate_infra(priv, wait, mac);
1426 } else if (priv->bss_mode == MWIFIEX_BSS_MODE_IBSS) { 1426 } else if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
1427 ret = mwifiex_prepare_cmd(priv, 1427 ret = mwifiex_prepare_cmd(priv,
1428 HostCmd_CMD_802_11_AD_HOC_STOP, 1428 HostCmd_CMD_802_11_AD_HOC_STOP,
1429 HostCmd_ACT_GEN_SET, 0, wait, NULL); 1429 HostCmd_ACT_GEN_SET, 0, wait, NULL);
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 7bcb2e965aeb..12b9a364d52b 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -877,7 +877,7 @@ mwifiex_queuing_ra_based(struct mwifiex_private *priv)
877 * Currently we assume if we are in Infra, then DA=RA. This might not be 877 * Currently we assume if we are in Infra, then DA=RA. This might not be
878 * true in the future 878 * true in the future
879 */ 879 */
880 if ((priv->bss_mode == MWIFIEX_BSS_MODE_INFRA) && 880 if ((priv->bss_mode == NL80211_IFTYPE_STATION) &&
881 (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA)) 881 (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA))
882 return false; 882 return false;
883 883
@@ -1003,8 +1003,6 @@ int mwifiex_set_user_scan_ioctl(struct mwifiex_private *priv,
1003int mwifiex_change_adhoc_chan(struct mwifiex_private *priv, int channel); 1003int mwifiex_change_adhoc_chan(struct mwifiex_private *priv, int channel);
1004int mwifiex_set_radio(struct mwifiex_private *priv, u8 option); 1004int mwifiex_set_radio(struct mwifiex_private *priv, u8 option);
1005 1005
1006int mwifiex_drv_get_mode(struct mwifiex_private *priv, u8 wait_option);
1007
1008int mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, int channel); 1006int mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, int channel);
1009 1007
1010int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key, 1008int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key,
@@ -1043,9 +1041,6 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, int type, int dbm);
1043 1041
1044int mwifiex_main_process(struct mwifiex_adapter *); 1042int mwifiex_main_process(struct mwifiex_adapter *);
1045 1043
1046int mwifiex_bss_ioctl_mode(struct mwifiex_private *,
1047 struct mwifiex_wait_queue *,
1048 u16 action, int *mode);
1049int mwifiex_bss_ioctl_channel(struct mwifiex_private *, 1044int mwifiex_bss_ioctl_channel(struct mwifiex_private *,
1050 u16 action, 1045 u16 action,
1051 struct mwifiex_chan_freq_power *cfp); 1046 struct mwifiex_chan_freq_power *cfp);
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 1152beb930ab..69ea32fd1fbd 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -455,8 +455,8 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv, u32 index, u32 mode)
455 bss_desc->disable_11n = false; 455 bss_desc->disable_11n = false;
456 456
457 /* Don't check for compatibility if roaming */ 457 /* Don't check for compatibility if roaming */
458 if (priv->media_connected && (priv->bss_mode == MWIFIEX_BSS_MODE_INFRA) 458 if (priv->media_connected && (priv->bss_mode == NL80211_IFTYPE_STATION)
459 && (bss_desc->bss_mode == MWIFIEX_BSS_MODE_INFRA)) 459 && (bss_desc->bss_mode == NL80211_IFTYPE_STATION))
460 return index; 460 return index;
461 461
462 if (priv->wps.session_enable) { 462 if (priv->wps.session_enable) {
@@ -573,8 +573,8 @@ mwifiex_find_best_network_in_list(struct mwifiex_private *priv)
573 573
574 for (i = 0; i < adapter->num_in_scan_table; i++) { 574 for (i = 0; i < adapter->num_in_scan_table; i++) {
575 switch (mode) { 575 switch (mode) {
576 case MWIFIEX_BSS_MODE_INFRA: 576 case NL80211_IFTYPE_STATION:
577 case MWIFIEX_BSS_MODE_IBSS: 577 case NL80211_IFTYPE_ADHOC:
578 if (mwifiex_is_network_compatible(priv, i, mode) >= 0) { 578 if (mwifiex_is_network_compatible(priv, i, mode) >= 0) {
579 if (SCAN_RSSI(adapter->scan_table[i].rssi) > 579 if (SCAN_RSSI(adapter->scan_table[i].rssi) >
580 best_rssi) { 580 best_rssi) {
@@ -584,7 +584,7 @@ mwifiex_find_best_network_in_list(struct mwifiex_private *priv)
584 } 584 }
585 } 585 }
586 break; 586 break;
587 case MWIFIEX_BSS_MODE_AUTO: 587 case NL80211_IFTYPE_UNSPECIFIED:
588 default: 588 default:
589 if (SCAN_RSSI(adapter->scan_table[i].rssi) > 589 if (SCAN_RSSI(adapter->scan_table[i].rssi) >
590 best_rssi) { 590 best_rssi) {
@@ -1314,9 +1314,9 @@ mwifiex_interpret_bss_desc_with_ie(struct mwifiex_adapter *adapter,
1314 } 1314 }
1315 1315
1316 if (bss_entry->cap_info_bitmap & WLAN_CAPABILITY_IBSS) 1316 if (bss_entry->cap_info_bitmap & WLAN_CAPABILITY_IBSS)
1317 bss_entry->bss_mode = MWIFIEX_BSS_MODE_IBSS; 1317 bss_entry->bss_mode = NL80211_IFTYPE_ADHOC;
1318 else 1318 else
1319 bss_entry->bss_mode = MWIFIEX_BSS_MODE_INFRA; 1319 bss_entry->bss_mode = NL80211_IFTYPE_STATION;
1320 1320
1321 1321
1322 /* Process variable IE */ 1322 /* Process variable IE */
@@ -2251,8 +2251,7 @@ mwifiex_scan_delete_ssid_table_entry(struct mwifiex_private *priv,
2251 searching the table for multiple entires for the SSID until no 2251 searching the table for multiple entires for the SSID until no
2252 more are found */ 2252 more are found */
2253 while ((table_idx = mwifiex_find_ssid_in_list(priv, del_ssid, NULL, 2253 while ((table_idx = mwifiex_find_ssid_in_list(priv, del_ssid, NULL,
2254 MWIFIEX_BSS_MODE_AUTO)) >= 2254 NL80211_IFTYPE_UNSPECIFIED)) >= 0) {
2255 0) {
2256 dev_dbg(priv->adapter->dev, 2255 dev_dbg(priv->adapter->dev,
2257 "info: Scan: Delete SSID Entry: Found Idx = %d\n", 2256 "info: Scan: Delete SSID Entry: Found Idx = %d\n",
2258 table_idx); 2257 table_idx);
@@ -2746,8 +2745,8 @@ mwifiex_find_ssid_in_list(struct mwifiex_private *priv,
2746 (priv, (u8) adapter->scan_table[i].bss_band, 2745 (priv, (u8) adapter->scan_table[i].bss_band,
2747 (u16) adapter->scan_table[i].channel))) { 2746 (u16) adapter->scan_table[i].channel))) {
2748 switch (mode) { 2747 switch (mode) {
2749 case MWIFIEX_BSS_MODE_INFRA: 2748 case NL80211_IFTYPE_STATION:
2750 case MWIFIEX_BSS_MODE_IBSS: 2749 case NL80211_IFTYPE_ADHOC:
2751 j = mwifiex_is_network_compatible(priv, i, 2750 j = mwifiex_is_network_compatible(priv, i,
2752 mode); 2751 mode);
2753 2752
@@ -2765,7 +2764,7 @@ mwifiex_find_ssid_in_list(struct mwifiex_private *priv,
2765 net = j; 2764 net = j;
2766 } 2765 }
2767 break; 2766 break;
2768 case MWIFIEX_BSS_MODE_AUTO: 2767 case NL80211_IFTYPE_UNSPECIFIED:
2769 default: 2768 default:
2770 /* 2769 /*
2771 * Do not check compatibility if the mode 2770 * Do not check compatibility if the mode
@@ -2829,8 +2828,8 @@ mwifiex_find_bssid_in_list(struct mwifiex_private *priv, u8 *bssid,
2829 scan_table[i]. 2828 scan_table[i].
2830 channel)) { 2829 channel)) {
2831 switch (mode) { 2830 switch (mode) {
2832 case MWIFIEX_BSS_MODE_INFRA: 2831 case NL80211_IFTYPE_STATION:
2833 case MWIFIEX_BSS_MODE_IBSS: 2832 case NL80211_IFTYPE_ADHOC:
2834 net = mwifiex_is_network_compatible(priv, i, 2833 net = mwifiex_is_network_compatible(priv, i,
2835 mode); 2834 mode);
2836 break; 2835 break;
@@ -2881,7 +2880,7 @@ int mwifiex_find_best_network(struct mwifiex_private *priv,
2881 (u8 *) &req_bss->mac_address, ETH_ALEN); 2880 (u8 *) &req_bss->mac_address, ETH_ALEN);
2882 2881
2883 /* Make sure we are in the right mode */ 2882 /* Make sure we are in the right mode */
2884 if (priv->bss_mode == MWIFIEX_BSS_MODE_AUTO) 2883 if (priv->bss_mode == NL80211_IFTYPE_UNSPECIFIED)
2885 priv->bss_mode = req_bss->bss_mode; 2884 priv->bss_mode = req_bss->bss_mode;
2886 } 2885 }
2887 2886
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c
index 795b1eae768d..6fff26153e26 100644
--- a/drivers/net/wireless/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/mwifiex/sta_cmd.c
@@ -1089,10 +1089,10 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
1089 break; 1089 break;
1090 case HostCmd_CMD_SET_BSS_MODE: 1090 case HostCmd_CMD_SET_BSS_MODE:
1091 cmd_ptr->command = cpu_to_le16(cmd_no); 1091 cmd_ptr->command = cpu_to_le16(cmd_no);
1092 if (priv->bss_mode == MWIFIEX_BSS_MODE_IBSS) 1092 if (priv->bss_mode == NL80211_IFTYPE_ADHOC)
1093 cmd_ptr->params.bss_mode.con_type = 1093 cmd_ptr->params.bss_mode.con_type =
1094 CONNECTION_TYPE_ADHOC; 1094 CONNECTION_TYPE_ADHOC;
1095 else if (priv->bss_mode == MWIFIEX_BSS_MODE_INFRA) 1095 else if (priv->bss_mode == NL80211_IFTYPE_STATION)
1096 cmd_ptr->params.bss_mode.con_type = 1096 cmd_ptr->params.bss_mode.con_type =
1097 CONNECTION_TYPE_INFRA; 1097 CONNECTION_TYPE_INFRA;
1098 cmd_ptr->size = cpu_to_le16(sizeof(struct 1098 cmd_ptr->size = cpu_to_le16(sizeof(struct
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index ae960ddf2bd4..b220b8b62cfa 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -65,7 +65,7 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
65 if (le16_to_cpu(pm->action) == EN_AUTO_PS && 65 if (le16_to_cpu(pm->action) == EN_AUTO_PS &&
66 (le16_to_cpu(pm->params.auto_ps.ps_bitmap) & 66 (le16_to_cpu(pm->params.auto_ps.ps_bitmap) &
67 BITMAP_STA_PS) 67 BITMAP_STA_PS)
68 && priv->bss_mode == MWIFIEX_BSS_MODE_IBSS) 68 && priv->bss_mode == NL80211_IFTYPE_ADHOC)
69 adapter->ps_mode = 69 adapter->ps_mode =
70 MWIFIEX_802_11_POWER_MODE_CAM; 70 MWIFIEX_802_11_POWER_MODE_CAM;
71 } 71 }
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c
index d4a5c1fcefc2..0187185a1fc6 100644
--- a/drivers/net/wireless/mwifiex/sta_event.c
+++ b/drivers/net/wireless/mwifiex/sta_event.c
@@ -82,7 +82,7 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv)
82 priv->is_data_rate_auto = true; 82 priv->is_data_rate_auto = true;
83 priv->data_rate = 0; 83 priv->data_rate = 0;
84 84
85 if (priv->bss_mode == MWIFIEX_BSS_MODE_IBSS) { 85 if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
86 priv->adhoc_state = ADHOC_IDLE; 86 priv->adhoc_state = ADHOC_IDLE;
87 priv->adhoc_is_link_sensed = false; 87 priv->adhoc_is_link_sensed = false;
88 } 88 }
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 362301f417a4..abad07e012f9 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -404,7 +404,7 @@ static int mwifiex_bss_ioctl_start(struct mwifiex_private *priv,
404 if (!ssid_bssid) 404 if (!ssid_bssid)
405 return -1; 405 return -1;
406 406
407 if (priv->bss_mode == MWIFIEX_BSS_MODE_INFRA) { 407 if (priv->bss_mode == NL80211_IFTYPE_STATION) {
408 /* Infra mode */ 408 /* Infra mode */
409 ret = mwifiex_deauthenticate(priv, NULL, NULL); 409 ret = mwifiex_deauthenticate(priv, NULL, NULL);
410 if (ret) 410 if (ret)
@@ -413,11 +413,11 @@ static int mwifiex_bss_ioctl_start(struct mwifiex_private *priv,
413 /* Search for the requested SSID in the scan table */ 413 /* Search for the requested SSID in the scan table */
414 if (ssid_bssid->ssid.ssid_len) 414 if (ssid_bssid->ssid.ssid_len)
415 i = mwifiex_find_ssid_in_list(priv, &ssid_bssid->ssid, 415 i = mwifiex_find_ssid_in_list(priv, &ssid_bssid->ssid,
416 NULL, MWIFIEX_BSS_MODE_INFRA); 416 NULL, NL80211_IFTYPE_STATION);
417 else 417 else
418 i = mwifiex_find_bssid_in_list(priv, 418 i = mwifiex_find_bssid_in_list(priv,
419 (u8 *) &ssid_bssid->bssid, 419 (u8 *) &ssid_bssid->bssid,
420 MWIFIEX_BSS_MODE_INFRA); 420 NL80211_IFTYPE_STATION);
421 if (i < 0) 421 if (i < 0)
422 return -1; 422 return -1;
423 423
@@ -451,11 +451,11 @@ static int mwifiex_bss_ioctl_start(struct mwifiex_private *priv,
451 if (ssid_bssid->ssid.ssid_len) 451 if (ssid_bssid->ssid.ssid_len)
452 i = mwifiex_find_ssid_in_list(priv, 452 i = mwifiex_find_ssid_in_list(priv,
453 &ssid_bssid->ssid, NULL, 453 &ssid_bssid->ssid, NULL,
454 MWIFIEX_BSS_MODE_IBSS); 454 NL80211_IFTYPE_ADHOC);
455 else 455 else
456 i = mwifiex_find_bssid_in_list(priv, 456 i = mwifiex_find_bssid_in_list(priv,
457 (u8 *)&ssid_bssid->bssid, 457 (u8 *)&ssid_bssid->bssid,
458 MWIFIEX_BSS_MODE_IBSS); 458 NL80211_IFTYPE_ADHOC);
459 459
460 if (i >= 0) { 460 if (i >= 0) {
461 dev_dbg(adapter->dev, "info: network found in scan" 461 dev_dbg(adapter->dev, "info: network found in scan"
@@ -1021,50 +1021,6 @@ int mwifiex_bss_ioctl_channel(struct mwifiex_private *priv, u16 action,
1021} 1021}
1022 1022
1023/* 1023/*
1024 * IOCTL request handler to set/get BSS mode.
1025 *
1026 * This function prepares the correct firmware command and
1027 * issues it to set or get the BSS mode.
1028 *
1029 * In case the mode is changed, a deauthentication is performed
1030 * first by the function automatically.
1031 */
1032int mwifiex_bss_ioctl_mode(struct mwifiex_private *priv,
1033 struct mwifiex_wait_queue *wait,
1034 u16 action, int *mode)
1035{
1036 int ret = 0;
1037
1038 if (!mode)
1039 return -1;
1040
1041 if (action == HostCmd_ACT_GEN_GET) {
1042 *mode = priv->bss_mode;
1043 return 0;
1044 }
1045
1046 if ((priv->bss_mode == *mode) || (*mode == MWIFIEX_BSS_MODE_AUTO)) {
1047 dev_dbg(priv->adapter->dev,
1048 "info: Already set to required mode! No change!\n");
1049 priv->bss_mode = *mode;
1050 return 0;
1051 }
1052
1053 ret = mwifiex_deauthenticate(priv, wait, NULL);
1054
1055 priv->sec_info.authentication_mode = MWIFIEX_AUTH_MODE_OPEN;
1056 priv->bss_mode = *mode;
1057 if (priv->bss_mode != MWIFIEX_BSS_MODE_AUTO) {
1058 ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
1059 HostCmd_ACT_GEN_SET, 0, wait, NULL);
1060 if (!ret)
1061 ret = -EINPROGRESS;
1062 }
1063
1064 return ret;
1065}
1066
1067/*
1068 * IOCTL request handler to set/get Ad-Hoc channel. 1024 * IOCTL request handler to set/get Ad-Hoc channel.
1069 * 1025 *
1070 * This function prepares the correct firmware command and 1026 * This function prepares the correct firmware command and
@@ -1237,33 +1193,6 @@ done:
1237} 1193}
1238 1194
1239/* 1195/*
1240 * IOCTL request handler to get current driver mode.
1241 *
1242 * This function allocates the IOCTL request buffer, fills it
1243 * with requisite parameters and calls the IOCTL handler.
1244 */
1245int
1246mwifiex_drv_get_mode(struct mwifiex_private *priv, u8 wait_option)
1247{
1248 struct mwifiex_wait_queue *wait = NULL;
1249 int status = 0;
1250 int mode = -1;
1251
1252 /* Allocate wait buffer */
1253 wait = mwifiex_alloc_fill_wait_queue(priv, wait_option);
1254 if (!wait)
1255 return -1;
1256
1257 status = mwifiex_bss_ioctl_mode(priv, wait, HostCmd_ACT_GEN_GET, &mode);
1258
1259 status = mwifiex_request_ioctl(priv, wait, status, wait_option);
1260
1261 if (wait && (status != -EINPROGRESS))
1262 kfree(wait);
1263 return mode;
1264}
1265
1266/*
1267 * IOCTL request handler to get rate. 1196 * IOCTL request handler to get rate.
1268 * 1197 *
1269 * This function prepares the correct firmware command and 1198 * This function prepares the correct firmware command and
@@ -1780,7 +1709,7 @@ static int mwifiex_sec_ioctl_set_wpa_key(struct mwifiex_adapter *adapter,
1780 return -1; 1709 return -1;
1781 } 1710 }
1782 1711
1783 if (priv->bss_mode == MWIFIEX_BSS_MODE_IBSS) { 1712 if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
1784 /* 1713 /*
1785 * IBSS/WPA-None uses only one key (Group) for both receiving 1714 * IBSS/WPA-None uses only one key (Group) for both receiving
1786 * and sending unicast and multicast packets. 1715 * and sending unicast and multicast packets.