aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c90
-rw-r--r--drivers/net/wireless/mwifiex/cfp.c4
-rw-r--r--drivers/net/wireless/mwifiex/cmdevt.c166
3 files changed, 133 insertions, 127 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 84508b065265..65050384c42b 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -127,8 +127,7 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
127 127
128 if (timeout) 128 if (timeout)
129 wiphy_dbg(wiphy, 129 wiphy_dbg(wiphy,
130 "info: ignoring the timeout value" 130 "info: ignore timeout value for IEEE Power Save\n");
131 " for IEEE power save\n");
132 131
133 ps_mode = enabled; 132 ps_mode = enabled;
134 133
@@ -168,7 +167,7 @@ mwifiex_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev,
168 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev); 167 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev);
169 168
170 if (mwifiex_set_encode(priv, params->key, params->key_len, 169 if (mwifiex_set_encode(priv, params->key, params->key_len,
171 key_index, 0)) { 170 key_index, 0)) {
172 wiphy_err(wiphy, "crypto keys added\n"); 171 wiphy_err(wiphy, "crypto keys added\n");
173 return -EFAULT; 172 return -EFAULT;
174 } 173 }
@@ -225,7 +224,7 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)
225 } 224 }
226 225
227 if (ch->hw_value == next_chan + 1 && 226 if (ch->hw_value == next_chan + 1 &&
228 ch->max_power == max_pwr) { 227 ch->max_power == max_pwr) {
229 next_chan++; 228 next_chan++;
230 no_of_parsed_chan++; 229 no_of_parsed_chan++;
231 } else { 230 } else {
@@ -252,7 +251,7 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)
252 domain_info->no_of_triplet = no_of_triplet; 251 domain_info->no_of_triplet = no_of_triplet;
253 252
254 if (mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11D_DOMAIN_INFO, 253 if (mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11D_DOMAIN_INFO,
255 HostCmd_ACT_GEN_SET, 0, NULL)) { 254 HostCmd_ACT_GEN_SET, 0, NULL)) {
256 wiphy_err(wiphy, "11D: setting domain info in FW\n"); 255 wiphy_err(wiphy, "11D: setting domain info in FW\n");
257 return -1; 256 return -1;
258 } 257 }
@@ -271,7 +270,7 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)
271 * - Set bt Country IE 270 * - Set bt Country IE
272 */ 271 */
273static int mwifiex_reg_notifier(struct wiphy *wiphy, 272static int mwifiex_reg_notifier(struct wiphy *wiphy,
274 struct regulatory_request *request) 273 struct regulatory_request *request)
275{ 274{
276 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 275 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
277 276
@@ -316,7 +315,7 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
316 if (chan->band == IEEE80211_BAND_2GHZ) { 315 if (chan->band == IEEE80211_BAND_2GHZ) {
317 if (channel_type == NL80211_CHAN_NO_HT) 316 if (channel_type == NL80211_CHAN_NO_HT)
318 if (priv->adapter->config_bands == BAND_B || 317 if (priv->adapter->config_bands == BAND_B ||
319 priv->adapter->config_bands == BAND_G) 318 priv->adapter->config_bands == BAND_G)
320 config_bands = 319 config_bands =
321 priv->adapter->config_bands; 320 priv->adapter->config_bands;
322 else 321 else
@@ -336,7 +335,7 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
336 if (priv->bss_mode == NL80211_IFTYPE_ADHOC) { 335 if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
337 adapter->adhoc_start_band = config_bands; 336 adapter->adhoc_start_band = config_bands;
338 if ((config_bands & BAND_GN) || 337 if ((config_bands & BAND_GN) ||
339 (config_bands & BAND_AN)) 338 (config_bands & BAND_AN))
340 adapter->adhoc_11n_enabled = true; 339 adapter->adhoc_11n_enabled = true;
341 else 340 else
342 adapter->adhoc_11n_enabled = false; 341 adapter->adhoc_11n_enabled = false;
@@ -350,9 +349,8 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
350 mwifiex_send_domain_info_cmd_fw(wiphy); 349 mwifiex_send_domain_info_cmd_fw(wiphy);
351 } 350 }
352 351
353 wiphy_dbg(wiphy, "info: setting band %d, channel offset %d and " 352 wiphy_dbg(wiphy, "info: setting band %d, chan offset %d, mode %d\n",
354 "mode %d\n", config_bands, adapter->sec_chan_offset, 353 config_bands, adapter->sec_chan_offset, priv->bss_mode);
355 priv->bss_mode);
356 if (!chan) 354 if (!chan)
357 return 0; 355 return 0;
358 356
@@ -403,8 +401,8 @@ mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr)
403{ 401{
404 int ret; 402 int ret;
405 403
406 if (frag_thr < MWIFIEX_FRAG_MIN_VALUE 404 if (frag_thr < MWIFIEX_FRAG_MIN_VALUE ||
407 || frag_thr > MWIFIEX_FRAG_MAX_VALUE) 405 frag_thr > MWIFIEX_FRAG_MAX_VALUE)
408 return -EINVAL; 406 return -EINVAL;
409 407
410 /* Send request to firmware */ 408 /* Send request to firmware */
@@ -746,8 +744,7 @@ static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
746 adapter->channel_type = NL80211_CHAN_NO_HT; 744 adapter->channel_type = NL80211_CHAN_NO_HT;
747 745
748 wiphy_debug(wiphy, "info: device configured in 802.11%s%s mode\n", 746 wiphy_debug(wiphy, "info: device configured in 802.11%s%s mode\n",
749 (mode & BAND_B) ? "b" : "", 747 (mode & BAND_B) ? "b" : "", (mode & BAND_G) ? "g" : "");
750 (mode & BAND_G) ? "g" : "");
751 748
752 return 0; 749 return 0;
753} 750}
@@ -802,8 +799,7 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv)
802 ie_buf[1] = bss_info.ssid.ssid_len; 799 ie_buf[1] = bss_info.ssid.ssid_len;
803 800
804 memcpy(&ie_buf[sizeof(struct ieee_types_header)], 801 memcpy(&ie_buf[sizeof(struct ieee_types_header)],
805 &bss_info.ssid.ssid, 802 &bss_info.ssid.ssid, bss_info.ssid.ssid_len);
806 bss_info.ssid.ssid_len);
807 ie_len = ie_buf[1] + sizeof(struct ieee_types_header); 803 ie_len = ie_buf[1] + sizeof(struct ieee_types_header);
808 804
809 band = mwifiex_band_to_radio_type(priv->curr_bss_params.band); 805 band = mwifiex_band_to_radio_type(priv->curr_bss_params.band);
@@ -812,8 +808,8 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv)
812 band)); 808 band));
813 809
814 bss = cfg80211_inform_bss(priv->wdev->wiphy, chan, 810 bss = cfg80211_inform_bss(priv->wdev->wiphy, chan,
815 bss_info.bssid, 0, WLAN_CAPABILITY_IBSS, 811 bss_info.bssid, 0, WLAN_CAPABILITY_IBSS,
816 0, ie_buf, ie_len, 0, GFP_KERNEL); 812 0, ie_buf, ie_len, 0, GFP_KERNEL);
817 cfg80211_put_bss(bss); 813 cfg80211_put_bss(bss);
818 memcpy(priv->cfg_bssid, bss_info.bssid, ETH_ALEN); 814 memcpy(priv->cfg_bssid, bss_info.bssid, ETH_ALEN);
819 815
@@ -952,14 +948,15 @@ done:
952 948
953 if (!bss) { 949 if (!bss) {
954 if (is_scanning_required) { 950 if (is_scanning_required) {
955 dev_warn(priv->adapter->dev, "assoc: requested " 951 dev_warn(priv->adapter->dev,
956 "bss not found in scan results\n"); 952 "assoc: requested bss not found in scan results\n");
957 break; 953 break;
958 } 954 }
959 is_scanning_required = 1; 955 is_scanning_required = 1;
960 } else { 956 } else {
961 dev_dbg(priv->adapter->dev, "info: trying to associate to %s and bssid %pM\n", 957 dev_dbg(priv->adapter->dev,
962 (char *) req_ssid.ssid, bss->bssid); 958 "info: trying to associate to '%s' bssid %pM\n",
959 (char *) req_ssid.ssid, bss->bssid);
963 memcpy(&priv->cfg_bssid, bss->bssid, ETH_ALEN); 960 memcpy(&priv->cfg_bssid, bss->bssid, ETH_ALEN);
964 break; 961 break;
965 } 962 }
@@ -999,7 +996,7 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
999 } 996 }
1000 997
1001 wiphy_dbg(wiphy, "info: Trying to associate to %s and bssid %pM\n", 998 wiphy_dbg(wiphy, "info: Trying to associate to %s and bssid %pM\n",
1002 (char *) sme->ssid, sme->bssid); 999 (char *) sme->ssid, sme->bssid);
1003 1000
1004 ret = mwifiex_cfg80211_assoc(priv, sme->ssid_len, sme->ssid, sme->bssid, 1001 ret = mwifiex_cfg80211_assoc(priv, sme->ssid_len, sme->ssid, sme->bssid,
1005 priv->bss_mode, sme->channel, sme, 0); 1002 priv->bss_mode, sme->channel, sme, 0);
@@ -1041,11 +1038,11 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
1041 } 1038 }
1042 1039
1043 wiphy_dbg(wiphy, "info: trying to join to %s and bssid %pM\n", 1040 wiphy_dbg(wiphy, "info: trying to join to %s and bssid %pM\n",
1044 (char *) params->ssid, params->bssid); 1041 (char *) params->ssid, params->bssid);
1045 1042
1046 ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid, 1043 ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid,
1047 params->bssid, priv->bss_mode, 1044 params->bssid, priv->bss_mode,
1048 params->channel, NULL, params->privacy); 1045 params->channel, NULL, params->privacy);
1049done: 1046done:
1050 if (!ret) { 1047 if (!ret) {
1051 cfg80211_ibss_joined(priv->netdev, priv->cfg_bssid, GFP_KERNEL); 1048 cfg80211_ibss_joined(priv->netdev, priv->cfg_bssid, GFP_KERNEL);
@@ -1072,7 +1069,7 @@ mwifiex_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
1072 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 1069 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
1073 1070
1074 wiphy_dbg(wiphy, "info: disconnecting from essid %pM\n", 1071 wiphy_dbg(wiphy, "info: disconnecting from essid %pM\n",
1075 priv->cfg_bssid); 1072 priv->cfg_bssid);
1076 if (mwifiex_deauthenticate(priv, NULL)) 1073 if (mwifiex_deauthenticate(priv, NULL))
1077 return -EFAULT; 1074 return -EFAULT;
1078 1075
@@ -1101,7 +1098,7 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev,
1101 priv->scan_request = request; 1098 priv->scan_request = request;
1102 1099
1103 priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), 1100 priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg),
1104 GFP_KERNEL); 1101 GFP_KERNEL);
1105 if (!priv->user_scan_cfg) { 1102 if (!priv->user_scan_cfg) {
1106 dev_err(priv->adapter->dev, "failed to alloc scan_req\n"); 1103 dev_err(priv->adapter->dev, "failed to alloc scan_req\n");
1107 return -ENOMEM; 1104 return -ENOMEM;
@@ -1117,10 +1114,10 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev,
1117 1114
1118 if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) 1115 if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)
1119 priv->user_scan_cfg->chan_list[i].scan_type = 1116 priv->user_scan_cfg->chan_list[i].scan_type =
1120 MWIFIEX_SCAN_TYPE_PASSIVE; 1117 MWIFIEX_SCAN_TYPE_PASSIVE;
1121 else 1118 else
1122 priv->user_scan_cfg->chan_list[i].scan_type = 1119 priv->user_scan_cfg->chan_list[i].scan_type =
1123 MWIFIEX_SCAN_TYPE_ACTIVE; 1120 MWIFIEX_SCAN_TYPE_ACTIVE;
1124 1121
1125 priv->user_scan_cfg->chan_list[i].scan_time = 0; 1122 priv->user_scan_cfg->chan_list[i].scan_time = 0;
1126 } 1123 }
@@ -1191,9 +1188,9 @@ mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info,
1191 memset(mcs, 0xff, rx_mcs_supp); 1188 memset(mcs, 0xff, rx_mcs_supp);
1192 /* Clear all the other values */ 1189 /* Clear all the other values */
1193 memset(&mcs[rx_mcs_supp], 0, 1190 memset(&mcs[rx_mcs_supp], 0,
1194 sizeof(struct ieee80211_mcs_info) - rx_mcs_supp); 1191 sizeof(struct ieee80211_mcs_info) - rx_mcs_supp);
1195 if (priv->bss_mode == NL80211_IFTYPE_STATION || 1192 if (priv->bss_mode == NL80211_IFTYPE_STATION ||
1196 ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap)) 1193 ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap))
1197 /* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */ 1194 /* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */
1198 SETHT_MCS32(mcs_set.rx_mask); 1195 SETHT_MCS32(mcs_set.rx_mask);
1199 1196
@@ -1206,10 +1203,10 @@ mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info,
1206 * create a new virtual interface with the given name 1203 * create a new virtual interface with the given name
1207 */ 1204 */
1208struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, 1205struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
1209 char *name, 1206 char *name,
1210 enum nl80211_iftype type, 1207 enum nl80211_iftype type,
1211 u32 *flags, 1208 u32 *flags,
1212 struct vif_params *params) 1209 struct vif_params *params)
1213{ 1210{
1214 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 1211 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
1215 struct mwifiex_adapter *adapter; 1212 struct mwifiex_adapter *adapter;
@@ -1367,11 +1364,12 @@ int mwifiex_register_cfg80211(struct mwifiex_private *priv)
1367 int ret; 1364 int ret;
1368 void *wdev_priv; 1365 void *wdev_priv;
1369 struct wireless_dev *wdev; 1366 struct wireless_dev *wdev;
1367 struct ieee80211_sta_ht_cap *ht_info;
1370 1368
1371 wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); 1369 wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
1372 if (!wdev) { 1370 if (!wdev) {
1373 dev_err(priv->adapter->dev, "%s: allocating wireless device\n", 1371 dev_err(priv->adapter->dev, "%s: allocating wireless device\n",
1374 __func__); 1372 __func__);
1375 return -ENOMEM; 1373 return -ENOMEM;
1376 } 1374 }
1377 wdev->wiphy = 1375 wdev->wiphy =
@@ -1383,17 +1381,17 @@ int mwifiex_register_cfg80211(struct mwifiex_private *priv)
1383 } 1381 }
1384 wdev->iftype = NL80211_IFTYPE_STATION; 1382 wdev->iftype = NL80211_IFTYPE_STATION;
1385 wdev->wiphy->max_scan_ssids = 10; 1383 wdev->wiphy->max_scan_ssids = 10;
1386 wdev->wiphy->interface_modes = 1384 wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
1387 BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); 1385 BIT(NL80211_IFTYPE_ADHOC);
1388 1386
1389 wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &mwifiex_band_2ghz; 1387 wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &mwifiex_band_2ghz;
1390 mwifiex_setup_ht_caps( 1388 ht_info = &wdev->wiphy->bands[IEEE80211_BAND_2GHZ]->ht_cap;
1391 &wdev->wiphy->bands[IEEE80211_BAND_2GHZ]->ht_cap, priv); 1389 mwifiex_setup_ht_caps(ht_info, priv);
1392 1390
1393 if (priv->adapter->config_bands & BAND_A) { 1391 if (priv->adapter->config_bands & BAND_A) {
1394 wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &mwifiex_band_5ghz; 1392 wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &mwifiex_band_5ghz;
1395 mwifiex_setup_ht_caps( 1393 ht_info = &wdev->wiphy->bands[IEEE80211_BAND_5GHZ]->ht_cap;
1396 &wdev->wiphy->bands[IEEE80211_BAND_5GHZ]->ht_cap, priv); 1394 mwifiex_setup_ht_caps(ht_info, priv);
1397 } else { 1395 } else {
1398 wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL; 1396 wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL;
1399 } 1397 }
@@ -1420,13 +1418,13 @@ int mwifiex_register_cfg80211(struct mwifiex_private *priv)
1420 ret = wiphy_register(wdev->wiphy); 1418 ret = wiphy_register(wdev->wiphy);
1421 if (ret < 0) { 1419 if (ret < 0) {
1422 dev_err(priv->adapter->dev, "%s: registering cfg80211 device\n", 1420 dev_err(priv->adapter->dev, "%s: registering cfg80211 device\n",
1423 __func__); 1421 __func__);
1424 wiphy_free(wdev->wiphy); 1422 wiphy_free(wdev->wiphy);
1425 kfree(wdev); 1423 kfree(wdev);
1426 return ret; 1424 return ret;
1427 } else { 1425 } else {
1428 dev_dbg(priv->adapter->dev, 1426 dev_dbg(priv->adapter->dev,
1429 "info: successfully registered wiphy device\n"); 1427 "info: successfully registered wiphy device\n");
1430 } 1428 }
1431 1429
1432 priv->wdev = wdev; 1430 priv->wdev = wdev;
diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c
index 7541d9a4a6ed..2fe1c33765b8 100644
--- a/drivers/net/wireless/mwifiex/cfp.c
+++ b/drivers/net/wireless/mwifiex/cfp.c
@@ -163,8 +163,8 @@ u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv, u8 *rates)
163 return mwifiex_get_supported_rates(priv, rates); 163 return mwifiex_get_supported_rates(priv, rates);
164 else 164 else
165 return mwifiex_copy_rates(rates, 0, 165 return mwifiex_copy_rates(rates, 0,
166 priv->curr_bss_params.data_rates, 166 priv->curr_bss_params.data_rates,
167 priv->curr_bss_params.num_of_rates); 167 priv->curr_bss_params.num_of_rates);
168} 168}
169 169
170/* 170/*
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index c82eb7ff2fa2..07f6e0092552 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -67,7 +67,7 @@ mwifiex_get_cmd_node(struct mwifiex_adapter *adapter)
67 return NULL; 67 return NULL;
68 } 68 }
69 cmd_node = list_first_entry(&adapter->cmd_free_q, 69 cmd_node = list_first_entry(&adapter->cmd_free_q,
70 struct cmd_ctrl_node, list); 70 struct cmd_ctrl_node, list);
71 list_del(&cmd_node->list); 71 list_del(&cmd_node->list);
72 spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags); 72 spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags);
73 73
@@ -158,8 +158,9 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
158 /* Set command sequence number */ 158 /* Set command sequence number */
159 adapter->seq_num++; 159 adapter->seq_num++;
160 host_cmd->seq_num = cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO 160 host_cmd->seq_num = cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO
161 (adapter->seq_num, cmd_node->priv->bss_num, 161 (adapter->seq_num,
162 cmd_node->priv->bss_type)); 162 cmd_node->priv->bss_num,
163 cmd_node->priv->bss_type));
163 164
164 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); 165 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
165 adapter->curr_cmd = cmd_node; 166 adapter->curr_cmd = cmd_node;
@@ -174,8 +175,8 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
174 dev_dbg(adapter->dev, "cmd: DNLD_CMD: (%lu.%lu): %#x, act %#x, len %d," 175 dev_dbg(adapter->dev, "cmd: DNLD_CMD: (%lu.%lu): %#x, act %#x, len %d,"
175 " seqno %#x\n", 176 " seqno %#x\n",
176 tstamp.tv_sec, tstamp.tv_usec, cmd_code, 177 tstamp.tv_sec, tstamp.tv_usec, cmd_code,
177 le16_to_cpu(*(__le16 *) ((u8 *) host_cmd + S_DS_GEN)), cmd_size, 178 le16_to_cpu(*(__le16 *) ((u8 *) host_cmd + S_DS_GEN)), cmd_size,
178 le16_to_cpu(host_cmd->seq_num)); 179 le16_to_cpu(host_cmd->seq_num));
179 180
180 skb_push(cmd_node->cmd_skb, INTF_HEADER_LEN); 181 skb_push(cmd_node->cmd_skb, INTF_HEADER_LEN);
181 182
@@ -200,17 +201,17 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
200 201
201 /* Save the last command id and action to debug log */ 202 /* Save the last command id and action to debug log */
202 adapter->dbg.last_cmd_index = 203 adapter->dbg.last_cmd_index =
203 (adapter->dbg.last_cmd_index + 1) % DBG_CMD_NUM; 204 (adapter->dbg.last_cmd_index + 1) % DBG_CMD_NUM;
204 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index] = cmd_code; 205 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index] = cmd_code;
205 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index] = 206 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index] =
206 le16_to_cpu(*(__le16 *) ((u8 *) host_cmd + S_DS_GEN)); 207 le16_to_cpu(*(__le16 *) ((u8 *) host_cmd + S_DS_GEN));
207 208
208 /* Clear BSS_NO_BITS from HostCmd */ 209 /* Clear BSS_NO_BITS from HostCmd */
209 cmd_code &= HostCmd_CMD_ID_MASK; 210 cmd_code &= HostCmd_CMD_ID_MASK;
210 211
211 /* Setup the timer after transmit command */ 212 /* Setup the timer after transmit command */
212 mod_timer(&adapter->cmd_timer, 213 mod_timer(&adapter->cmd_timer,
213 jiffies + (MWIFIEX_TIMER_10S * HZ) / 1000); 214 jiffies + (MWIFIEX_TIMER_10S * HZ) / 1000);
214 215
215 return 0; 216 return 0;
216} 217}
@@ -230,7 +231,7 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
230 struct mwifiex_private *priv; 231 struct mwifiex_private *priv;
231 struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = 232 struct mwifiex_opt_sleep_confirm *sleep_cfm_buf =
232 (struct mwifiex_opt_sleep_confirm *) 233 (struct mwifiex_opt_sleep_confirm *)
233 adapter->sleep_cfm->data; 234 adapter->sleep_cfm->data;
234 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); 235 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
235 236
236 sleep_cfm_buf->seq_num = 237 sleep_cfm_buf->seq_num =
@@ -250,7 +251,7 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
250 return -1; 251 return -1;
251 } 252 }
252 if (GET_BSS_ROLE(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY)) 253 if (GET_BSS_ROLE(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY))
253 == MWIFIEX_BSS_ROLE_STA) { 254 == MWIFIEX_BSS_ROLE_STA) {
254 if (!sleep_cfm_buf->resp_ctrl) 255 if (!sleep_cfm_buf->resp_ctrl)
255 /* Response is not needed for sleep 256 /* Response is not needed for sleep
256 confirm command */ 257 confirm command */
@@ -258,12 +259,12 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
258 else 259 else
259 adapter->ps_state = PS_STATE_SLEEP_CFM; 260 adapter->ps_state = PS_STATE_SLEEP_CFM;
260 261
261 if (!sleep_cfm_buf->resp_ctrl 262 if (!sleep_cfm_buf->resp_ctrl &&
262 && (adapter->is_hs_configured 263 (adapter->is_hs_configured &&
263 && !adapter->sleep_period.period)) { 264 !adapter->sleep_period.period)) {
264 adapter->pm_wakeup_card_req = true; 265 adapter->pm_wakeup_card_req = true;
265 mwifiex_hs_activated_event(mwifiex_get_priv(adapter, 266 mwifiex_hs_activated_event(mwifiex_get_priv
266 MWIFIEX_BSS_ROLE_STA), true); 267 (adapter, MWIFIEX_BSS_ROLE_STA), true);
267 } 268 }
268 } 269 }
269 270
@@ -293,7 +294,7 @@ int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter)
293 cmd_array = kzalloc(buf_size, GFP_KERNEL); 294 cmd_array = kzalloc(buf_size, GFP_KERNEL);
294 if (!cmd_array) { 295 if (!cmd_array) {
295 dev_err(adapter->dev, "%s: failed to alloc cmd_array\n", 296 dev_err(adapter->dev, "%s: failed to alloc cmd_array\n",
296 __func__); 297 __func__);
297 return -ENOMEM; 298 return -ENOMEM;
298 } 299 }
299 300
@@ -376,9 +377,9 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter)
376 377
377 /* Save the last event to debug log */ 378 /* Save the last event to debug log */
378 adapter->dbg.last_event_index = 379 adapter->dbg.last_event_index =
379 (adapter->dbg.last_event_index + 1) % DBG_CMD_NUM; 380 (adapter->dbg.last_event_index + 1) % DBG_CMD_NUM;
380 adapter->dbg.last_event[adapter->dbg.last_event_index] = 381 adapter->dbg.last_event[adapter->dbg.last_event_index] =
381 (u16) eventcause; 382 (u16) eventcause;
382 383
383 /* Get BSS number and corresponding priv */ 384 /* Get BSS number and corresponding priv */
384 priv = mwifiex_get_priv_by_id(adapter, EVENT_GET_BSS_NUM(eventcause), 385 priv = mwifiex_get_priv_by_id(adapter, EVENT_GET_BSS_NUM(eventcause),
@@ -398,7 +399,7 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter)
398 if (eventcause != EVENT_PS_SLEEP && eventcause != EVENT_PS_AWAKE) { 399 if (eventcause != EVENT_PS_SLEEP && eventcause != EVENT_PS_AWAKE) {
399 do_gettimeofday(&tstamp); 400 do_gettimeofday(&tstamp);
400 dev_dbg(adapter->dev, "event: %lu.%lu: cause: %#x\n", 401 dev_dbg(adapter->dev, "event: %lu.%lu: cause: %#x\n",
401 tstamp.tv_sec, tstamp.tv_usec, eventcause); 402 tstamp.tv_sec, tstamp.tv_usec, eventcause);
402 } 403 }
403 404
404 ret = mwifiex_process_sta_event(priv); 405 ret = mwifiex_process_sta_event(priv);
@@ -509,7 +510,7 @@ int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no,
509 /* Return error, since the command preparation failed */ 510 /* Return error, since the command preparation failed */
510 if (ret) { 511 if (ret) {
511 dev_err(adapter->dev, "PREP_CMD: cmd %#x preparation failed\n", 512 dev_err(adapter->dev, "PREP_CMD: cmd %#x preparation failed\n",
512 cmd_no); 513 cmd_no);
513 mwifiex_insert_cmd_to_free_q(adapter, cmd_node); 514 mwifiex_insert_cmd_to_free_q(adapter, cmd_node);
514 return -1; 515 return -1;
515 } 516 }
@@ -577,9 +578,9 @@ mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter,
577 /* Exit_PS command needs to be queued in the header always. */ 578 /* Exit_PS command needs to be queued in the header always. */
578 if (command == HostCmd_CMD_802_11_PS_MODE_ENH) { 579 if (command == HostCmd_CMD_802_11_PS_MODE_ENH) {
579 struct host_cmd_ds_802_11_ps_mode_enh *pm = 580 struct host_cmd_ds_802_11_ps_mode_enh *pm =
580 &host_cmd->params.psmode_enh; 581 &host_cmd->params.psmode_enh;
581 if ((le16_to_cpu(pm->action) == DIS_PS) 582 if ((le16_to_cpu(pm->action) == DIS_PS) ||
582 || (le16_to_cpu(pm->action) == DIS_AUTO_PS)) { 583 (le16_to_cpu(pm->action) == DIS_AUTO_PS)) {
583 if (adapter->ps_state != PS_STATE_AWAKE) 584 if (adapter->ps_state != PS_STATE_AWAKE)
584 add_tail = false; 585 add_tail = false;
585 } 586 }
@@ -692,7 +693,7 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
692 if (!adapter->curr_cmd || !adapter->curr_cmd->resp_skb) { 693 if (!adapter->curr_cmd || !adapter->curr_cmd->resp_skb) {
693 resp = (struct host_cmd_ds_command *) adapter->upld_buf; 694 resp = (struct host_cmd_ds_command *) adapter->upld_buf;
694 dev_err(adapter->dev, "CMD_RESP: NULL curr_cmd, %#x\n", 695 dev_err(adapter->dev, "CMD_RESP: NULL curr_cmd, %#x\n",
695 le16_to_cpu(resp->command)); 696 le16_to_cpu(resp->command));
696 return -1; 697 return -1;
697 } 698 }
698 699
@@ -701,7 +702,7 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
701 resp = (struct host_cmd_ds_command *) adapter->curr_cmd->resp_skb->data; 702 resp = (struct host_cmd_ds_command *) adapter->curr_cmd->resp_skb->data;
702 if (adapter->curr_cmd->cmd_flag & CMD_F_CANCELED) { 703 if (adapter->curr_cmd->cmd_flag & CMD_F_CANCELED) {
703 dev_err(adapter->dev, "CMD_RESP: %#x been canceled\n", 704 dev_err(adapter->dev, "CMD_RESP: %#x been canceled\n",
704 le16_to_cpu(resp->command)); 705 le16_to_cpu(resp->command));
705 mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd); 706 mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd);
706 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); 707 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
707 adapter->curr_cmd = NULL; 708 adapter->curr_cmd = NULL;
@@ -725,8 +726,8 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
725 726
726 /* Get BSS number and corresponding priv */ 727 /* Get BSS number and corresponding priv */
727 priv = mwifiex_get_priv_by_id(adapter, 728 priv = mwifiex_get_priv_by_id(adapter,
728 HostCmd_GET_BSS_NO(le16_to_cpu(resp->seq_num)), 729 HostCmd_GET_BSS_NO(le16_to_cpu(resp->seq_num)),
729 HostCmd_GET_BSS_TYPE(le16_to_cpu(resp->seq_num))); 730 HostCmd_GET_BSS_TYPE(le16_to_cpu(resp->seq_num)));
730 if (!priv) 731 if (!priv)
731 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); 732 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
732 /* Clear RET_BIT from HostCmd */ 733 /* Clear RET_BIT from HostCmd */
@@ -737,9 +738,9 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
737 738
738 /* Save the last command response to debug log */ 739 /* Save the last command response to debug log */
739 adapter->dbg.last_cmd_resp_index = 740 adapter->dbg.last_cmd_resp_index =
740 (adapter->dbg.last_cmd_resp_index + 1) % DBG_CMD_NUM; 741 (adapter->dbg.last_cmd_resp_index + 1) % DBG_CMD_NUM;
741 adapter->dbg.last_cmd_resp_id[adapter->dbg.last_cmd_resp_index] = 742 adapter->dbg.last_cmd_resp_id[adapter->dbg.last_cmd_resp_index] =
742 orig_cmdresp_no; 743 orig_cmdresp_no;
743 744
744 do_gettimeofday(&tstamp); 745 do_gettimeofday(&tstamp);
745 dev_dbg(adapter->dev, "cmd: CMD_RESP: (%lu.%lu): 0x%x, result %d," 746 dev_dbg(adapter->dev, "cmd: CMD_RESP: (%lu.%lu): 0x%x, result %d,"
@@ -761,8 +762,8 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
761 762
762 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { 763 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) {
763 adapter->curr_cmd->cmd_flag &= ~CMD_F_HOSTCMD; 764 adapter->curr_cmd->cmd_flag &= ~CMD_F_HOSTCMD;
764 if ((cmdresp_result == HostCmd_RESULT_OK) 765 if ((cmdresp_result == HostCmd_RESULT_OK) &&
765 && (cmdresp_no == HostCmd_CMD_802_11_HS_CFG_ENH)) 766 (cmdresp_no == HostCmd_CMD_802_11_HS_CFG_ENH))
766 ret = mwifiex_ret_802_11_hs_cfg(priv, resp); 767 ret = mwifiex_ret_802_11_hs_cfg(priv, resp);
767 } else { 768 } else {
768 /* handle response */ 769 /* handle response */
@@ -824,44 +825,45 @@ mwifiex_cmd_timeout_func(unsigned long function_context)
824 adapter->dbg.timeout_cmd_act = 825 adapter->dbg.timeout_cmd_act =
825 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index]; 826 adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index];
826 do_gettimeofday(&tstamp); 827 do_gettimeofday(&tstamp);
827 dev_err(adapter->dev, "%s: Timeout cmd id (%lu.%lu) = %#x," 828 dev_err(adapter->dev,
828 " act = %#x\n", __func__, 829 "%s: Timeout cmd id (%lu.%lu) = %#x, act = %#x\n",
829 tstamp.tv_sec, tstamp.tv_usec, 830 __func__, tstamp.tv_sec, tstamp.tv_usec,
830 adapter->dbg.timeout_cmd_id, 831 adapter->dbg.timeout_cmd_id,
831 adapter->dbg.timeout_cmd_act); 832 adapter->dbg.timeout_cmd_act);
832 833
833 dev_err(adapter->dev, "num_data_h2c_failure = %d\n", 834 dev_err(adapter->dev, "num_data_h2c_failure = %d\n",
834 adapter->dbg.num_tx_host_to_card_failure); 835 adapter->dbg.num_tx_host_to_card_failure);
835 dev_err(adapter->dev, "num_cmd_h2c_failure = %d\n", 836 dev_err(adapter->dev, "num_cmd_h2c_failure = %d\n",
836 adapter->dbg.num_cmd_host_to_card_failure); 837 adapter->dbg.num_cmd_host_to_card_failure);
837 838
838 dev_err(adapter->dev, "num_cmd_timeout = %d\n", 839 dev_err(adapter->dev, "num_cmd_timeout = %d\n",
839 adapter->dbg.num_cmd_timeout); 840 adapter->dbg.num_cmd_timeout);
840 dev_err(adapter->dev, "num_tx_timeout = %d\n", 841 dev_err(adapter->dev, "num_tx_timeout = %d\n",
841 adapter->dbg.num_tx_timeout); 842 adapter->dbg.num_tx_timeout);
842 843
843 dev_err(adapter->dev, "last_cmd_index = %d\n", 844 dev_err(adapter->dev, "last_cmd_index = %d\n",
844 adapter->dbg.last_cmd_index); 845 adapter->dbg.last_cmd_index);
845 print_hex_dump_bytes("last_cmd_id: ", DUMP_PREFIX_OFFSET, 846 print_hex_dump_bytes("last_cmd_id: ", DUMP_PREFIX_OFFSET,
846 adapter->dbg.last_cmd_id, DBG_CMD_NUM); 847 adapter->dbg.last_cmd_id, DBG_CMD_NUM);
847 print_hex_dump_bytes("last_cmd_act: ", DUMP_PREFIX_OFFSET, 848 print_hex_dump_bytes("last_cmd_act: ", DUMP_PREFIX_OFFSET,
848 adapter->dbg.last_cmd_act, DBG_CMD_NUM); 849 adapter->dbg.last_cmd_act, DBG_CMD_NUM);
849 850
850 dev_err(adapter->dev, "last_cmd_resp_index = %d\n", 851 dev_err(adapter->dev, "last_cmd_resp_index = %d\n",
851 adapter->dbg.last_cmd_resp_index); 852 adapter->dbg.last_cmd_resp_index);
852 print_hex_dump_bytes("last_cmd_resp_id: ", DUMP_PREFIX_OFFSET, 853 print_hex_dump_bytes("last_cmd_resp_id: ", DUMP_PREFIX_OFFSET,
853 adapter->dbg.last_cmd_resp_id, DBG_CMD_NUM); 854 adapter->dbg.last_cmd_resp_id,
855 DBG_CMD_NUM);
854 856
855 dev_err(adapter->dev, "last_event_index = %d\n", 857 dev_err(adapter->dev, "last_event_index = %d\n",
856 adapter->dbg.last_event_index); 858 adapter->dbg.last_event_index);
857 print_hex_dump_bytes("last_event: ", DUMP_PREFIX_OFFSET, 859 print_hex_dump_bytes("last_event: ", DUMP_PREFIX_OFFSET,
858 adapter->dbg.last_event, DBG_CMD_NUM); 860 adapter->dbg.last_event, DBG_CMD_NUM);
859 861
860 dev_err(adapter->dev, "data_sent=%d cmd_sent=%d\n", 862 dev_err(adapter->dev, "data_sent=%d cmd_sent=%d\n",
861 adapter->data_sent, adapter->cmd_sent); 863 adapter->data_sent, adapter->cmd_sent);
862 864
863 dev_err(adapter->dev, "ps_mode=%d ps_state=%d\n", 865 dev_err(adapter->dev, "ps_mode=%d ps_state=%d\n",
864 adapter->ps_mode, adapter->ps_state); 866 adapter->ps_mode, adapter->ps_state);
865 } 867 }
866 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) 868 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING)
867 mwifiex_init_fw_complete(adapter); 869 mwifiex_init_fw_complete(adapter);
@@ -942,7 +944,7 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter)
942 uint16_t cancel_scan_cmd = false; 944 uint16_t cancel_scan_cmd = false;
943 945
944 if ((adapter->curr_cmd) && 946 if ((adapter->curr_cmd) &&
945 (adapter->curr_cmd->wait_q_enabled)) { 947 (adapter->curr_cmd->wait_q_enabled)) {
946 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); 948 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags);
947 cmd_node = adapter->curr_cmd; 949 cmd_node = adapter->curr_cmd;
948 cmd_node->wait_q_enabled = false; 950 cmd_node->wait_q_enabled = false;
@@ -996,9 +998,9 @@ mwifiex_check_ps_cond(struct mwifiex_adapter *adapter)
996 else 998 else
997 dev_dbg(adapter->dev, 999 dev_dbg(adapter->dev,
998 "cmd: Delay Sleep Confirm (%s%s%s)\n", 1000 "cmd: Delay Sleep Confirm (%s%s%s)\n",
999 (adapter->cmd_sent) ? "D" : "", 1001 (adapter->cmd_sent) ? "D" : "",
1000 (adapter->curr_cmd) ? "C" : "", 1002 (adapter->curr_cmd) ? "C" : "",
1001 (IS_CARD_RX_RCVD(adapter)) ? "R" : ""); 1003 (IS_CARD_RX_RCVD(adapter)) ? "R" : "");
1002} 1004}
1003 1005
1004/* 1006/*
@@ -1050,8 +1052,8 @@ int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
1050 dev_dbg(adapter->dev, "cmd: CMD_RESP: HS_CFG cmd reply" 1052 dev_dbg(adapter->dev, "cmd: CMD_RESP: HS_CFG cmd reply"
1051 " result=%#x, conditions=0x%x gpio=0x%x gap=0x%x\n", 1053 " result=%#x, conditions=0x%x gpio=0x%x gap=0x%x\n",
1052 resp->result, conditions, 1054 resp->result, conditions,
1053 phs_cfg->params.hs_config.gpio, 1055 phs_cfg->params.hs_config.gpio,
1054 phs_cfg->params.hs_config.gap); 1056 phs_cfg->params.hs_config.gap);
1055 } 1057 }
1056 if (conditions != HOST_SLEEP_CFG_CANCEL) { 1058 if (conditions != HOST_SLEEP_CFG_CANCEL) {
1057 adapter->is_hs_configured = true; 1059 adapter->is_hs_configured = true;
@@ -1078,7 +1080,8 @@ mwifiex_process_hs_config(struct mwifiex_adapter *adapter)
1078 adapter->hs_activated = false; 1080 adapter->hs_activated = false;
1079 adapter->is_hs_configured = false; 1081 adapter->is_hs_configured = false;
1080 mwifiex_hs_activated_event(mwifiex_get_priv(adapter, 1082 mwifiex_hs_activated_event(mwifiex_get_priv(adapter,
1081 MWIFIEX_BSS_ROLE_ANY), false); 1083 MWIFIEX_BSS_ROLE_ANY),
1084 false);
1082} 1085}
1083 1086
1084/* 1087/*
@@ -1114,22 +1117,24 @@ mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *adapter,
1114 command &= HostCmd_CMD_ID_MASK; 1117 command &= HostCmd_CMD_ID_MASK;
1115 1118
1116 if (command != HostCmd_CMD_802_11_PS_MODE_ENH) { 1119 if (command != HostCmd_CMD_802_11_PS_MODE_ENH) {
1117 dev_err(adapter->dev, "%s: received unexpected response for" 1120 dev_err(adapter->dev,
1118 " cmd %x, result = %x\n", __func__, command, result); 1121 "%s: rcvd unexpected resp for cmd %#x, result = %x\n",
1122 __func__, command, result);
1119 return; 1123 return;
1120 } 1124 }
1121 1125
1122 if (result) { 1126 if (result) {
1123 dev_err(adapter->dev, "%s: sleep confirm cmd failed\n", 1127 dev_err(adapter->dev, "%s: sleep confirm cmd failed\n",
1124 __func__); 1128 __func__);
1125 adapter->pm_wakeup_card_req = false; 1129 adapter->pm_wakeup_card_req = false;
1126 adapter->ps_state = PS_STATE_AWAKE; 1130 adapter->ps_state = PS_STATE_AWAKE;
1127 return; 1131 return;
1128 } 1132 }
1129 adapter->pm_wakeup_card_req = true; 1133 adapter->pm_wakeup_card_req = true;
1130 if (adapter->is_hs_configured) 1134 if (adapter->is_hs_configured)
1131 mwifiex_hs_activated_event(mwifiex_get_priv(adapter, 1135 mwifiex_hs_activated_event(mwifiex_get_priv
1132 MWIFIEX_BSS_ROLE_ANY), true); 1136 (adapter, MWIFIEX_BSS_ROLE_ANY),
1137 true);
1133 adapter->ps_state = PS_STATE_SLEEP; 1138 adapter->ps_state = PS_STATE_SLEEP;
1134 cmd->command = cpu_to_le16(command); 1139 cmd->command = cpu_to_le16(command);
1135 cmd->seq_num = cpu_to_le16(seq_num); 1140 cmd->seq_num = cpu_to_le16(seq_num);
@@ -1163,17 +1168,17 @@ int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
1163 psmode_enh->action = cpu_to_le16(DIS_AUTO_PS); 1168 psmode_enh->action = cpu_to_le16(DIS_AUTO_PS);
1164 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap); 1169 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap);
1165 cmd->size = cpu_to_le16(S_DS_GEN + sizeof(psmode_enh->action) + 1170 cmd->size = cpu_to_le16(S_DS_GEN + sizeof(psmode_enh->action) +
1166 sizeof(psmode_enh->params.ps_bitmap)); 1171 sizeof(psmode_enh->params.ps_bitmap));
1167 } else if (cmd_action == GET_PS) { 1172 } else if (cmd_action == GET_PS) {
1168 psmode_enh->action = cpu_to_le16(GET_PS); 1173 psmode_enh->action = cpu_to_le16(GET_PS);
1169 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap); 1174 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap);
1170 cmd->size = cpu_to_le16(S_DS_GEN + sizeof(psmode_enh->action) + 1175 cmd->size = cpu_to_le16(S_DS_GEN + sizeof(psmode_enh->action) +
1171 sizeof(psmode_enh->params.ps_bitmap)); 1176 sizeof(psmode_enh->params.ps_bitmap));
1172 } else if (cmd_action == EN_AUTO_PS) { 1177 } else if (cmd_action == EN_AUTO_PS) {
1173 psmode_enh->action = cpu_to_le16(EN_AUTO_PS); 1178 psmode_enh->action = cpu_to_le16(EN_AUTO_PS);
1174 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap); 1179 psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap);
1175 cmd_size = S_DS_GEN + sizeof(psmode_enh->action) + 1180 cmd_size = S_DS_GEN + sizeof(psmode_enh->action) +
1176 sizeof(psmode_enh->params.ps_bitmap); 1181 sizeof(psmode_enh->params.ps_bitmap);
1177 tlv = (u8 *) cmd + cmd_size; 1182 tlv = (u8 *) cmd + cmd_size;
1178 if (ps_bitmap & BITMAP_STA_PS) { 1183 if (ps_bitmap & BITMAP_STA_PS) {
1179 struct mwifiex_adapter *adapter = priv->adapter; 1184 struct mwifiex_adapter *adapter = priv->adapter;
@@ -1187,19 +1192,18 @@ int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
1187 tlv += sizeof(*ps_tlv); 1192 tlv += sizeof(*ps_tlv);
1188 dev_dbg(adapter->dev, "cmd: PS Command: Enter PS\n"); 1193 dev_dbg(adapter->dev, "cmd: PS Command: Enter PS\n");
1189 ps_mode->null_pkt_interval = 1194 ps_mode->null_pkt_interval =
1190 cpu_to_le16(adapter->null_pkt_interval); 1195 cpu_to_le16(adapter->null_pkt_interval);
1191 ps_mode->multiple_dtims = 1196 ps_mode->multiple_dtims =
1192 cpu_to_le16(adapter->multiple_dtim); 1197 cpu_to_le16(adapter->multiple_dtim);
1193 ps_mode->bcn_miss_timeout = 1198 ps_mode->bcn_miss_timeout =
1194 cpu_to_le16(adapter->bcn_miss_time_out); 1199 cpu_to_le16(adapter->bcn_miss_time_out);
1195 ps_mode->local_listen_interval = 1200 ps_mode->local_listen_interval =
1196 cpu_to_le16(adapter->local_listen_interval); 1201 cpu_to_le16(adapter->local_listen_interval);
1197 ps_mode->adhoc_wake_period = 1202 ps_mode->adhoc_wake_period =
1198 cpu_to_le16(adapter->adhoc_awake_period); 1203 cpu_to_le16(adapter->adhoc_awake_period);
1199 ps_mode->delay_to_ps = 1204 ps_mode->delay_to_ps =
1200 cpu_to_le16(adapter->delay_to_ps); 1205 cpu_to_le16(adapter->delay_to_ps);
1201 ps_mode->mode = 1206 ps_mode->mode = cpu_to_le16(adapter->enhanced_ps_mode);
1202 cpu_to_le16(adapter->enhanced_ps_mode);
1203 1207
1204 } 1208 }
1205 if (ps_bitmap & BITMAP_AUTO_DS) { 1209 if (ps_bitmap & BITMAP_AUTO_DS) {
@@ -1217,7 +1221,7 @@ int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
1217 if (auto_ds) 1221 if (auto_ds)
1218 idletime = auto_ds->idle_time; 1222 idletime = auto_ds->idle_time;
1219 dev_dbg(priv->adapter->dev, 1223 dev_dbg(priv->adapter->dev,
1220 "cmd: PS Command: Enter Auto Deep Sleep\n"); 1224 "cmd: PS Command: Enter Auto Deep Sleep\n");
1221 auto_ds_tlv->deep_sleep_timeout = cpu_to_le16(idletime); 1225 auto_ds_tlv->deep_sleep_timeout = cpu_to_le16(idletime);
1222 } 1226 }
1223 cmd->size = cpu_to_le16(cmd_size); 1227 cmd->size = cpu_to_le16(cmd_size);
@@ -1244,8 +1248,9 @@ int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
1244 uint16_t auto_ps_bitmap = 1248 uint16_t auto_ps_bitmap =
1245 le16_to_cpu(ps_mode->params.ps_bitmap); 1249 le16_to_cpu(ps_mode->params.ps_bitmap);
1246 1250
1247 dev_dbg(adapter->dev, "info: %s: PS_MODE cmd reply result=%#x action=%#X\n", 1251 dev_dbg(adapter->dev,
1248 __func__, resp->result, action); 1252 "info: %s: PS_MODE cmd reply result=%#x action=%#X\n",
1253 __func__, resp->result, action);
1249 if (action == EN_AUTO_PS) { 1254 if (action == EN_AUTO_PS) {
1250 if (auto_ps_bitmap & BITMAP_AUTO_DS) { 1255 if (auto_ps_bitmap & BITMAP_AUTO_DS) {
1251 dev_dbg(adapter->dev, "cmd: Enabled auto deep sleep\n"); 1256 dev_dbg(adapter->dev, "cmd: Enabled auto deep sleep\n");
@@ -1254,7 +1259,8 @@ int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
1254 if (auto_ps_bitmap & BITMAP_STA_PS) { 1259 if (auto_ps_bitmap & BITMAP_STA_PS) {
1255 dev_dbg(adapter->dev, "cmd: Enabled STA power save\n"); 1260 dev_dbg(adapter->dev, "cmd: Enabled STA power save\n");
1256 if (adapter->sleep_period.period) 1261 if (adapter->sleep_period.period)
1257 dev_dbg(adapter->dev, "cmd: set to uapsd/pps mode\n"); 1262 dev_dbg(adapter->dev,
1263 "cmd: set to uapsd/pps mode\n");
1258 } 1264 }
1259 } else if (action == DIS_AUTO_PS) { 1265 } else if (action == DIS_AUTO_PS) {
1260 if (ps_bitmap & BITMAP_AUTO_DS) { 1266 if (ps_bitmap & BITMAP_AUTO_DS) {
@@ -1373,12 +1379,13 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
1373 adapter->number_of_antenna = le16_to_cpu(hw_spec->number_of_antenna); 1379 adapter->number_of_antenna = le16_to_cpu(hw_spec->number_of_antenna);
1374 1380
1375 dev_dbg(adapter->dev, "info: GET_HW_SPEC: fw_release_number- %#x\n", 1381 dev_dbg(adapter->dev, "info: GET_HW_SPEC: fw_release_number- %#x\n",
1376 adapter->fw_release_number); 1382 adapter->fw_release_number);
1377 dev_dbg(adapter->dev, "info: GET_HW_SPEC: permanent addr: %pM\n", 1383 dev_dbg(adapter->dev, "info: GET_HW_SPEC: permanent addr: %pM\n",
1378 hw_spec->permanent_addr); 1384 hw_spec->permanent_addr);
1379 dev_dbg(adapter->dev, "info: GET_HW_SPEC: hw_if_version=%#x version=%#x\n", 1385 dev_dbg(adapter->dev,
1386 "info: GET_HW_SPEC: hw_if_version=%#x version=%#x\n",
1380 le16_to_cpu(hw_spec->hw_if_version), 1387 le16_to_cpu(hw_spec->hw_if_version),
1381 le16_to_cpu(hw_spec->version)); 1388 le16_to_cpu(hw_spec->version));
1382 1389
1383 if (priv->curr_addr[0] == 0xff) 1390 if (priv->curr_addr[0] == 0xff)
1384 memmove(priv->curr_addr, hw_spec->permanent_addr, ETH_ALEN); 1391 memmove(priv->curr_addr, hw_spec->permanent_addr, ETH_ALEN);
@@ -1393,7 +1400,8 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
1393 /* If it's unidentified region code, use the default (USA) */ 1400 /* If it's unidentified region code, use the default (USA) */
1394 if (i >= MWIFIEX_MAX_REGION_CODE) { 1401 if (i >= MWIFIEX_MAX_REGION_CODE) {
1395 adapter->region_code = 0x10; 1402 adapter->region_code = 0x10;
1396 dev_dbg(adapter->dev, "cmd: unknown region code, use default (USA)\n"); 1403 dev_dbg(adapter->dev,
1404 "cmd: unknown region code, use default (USA)\n");
1397 } 1405 }
1398 1406
1399 adapter->hw_dot_11n_dev_cap = le32_to_cpu(hw_spec->dot_11n_dev_cap); 1407 adapter->hw_dot_11n_dev_cap = le32_to_cpu(hw_spec->dot_11n_dev_cap);