diff options
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 287 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/cfp.c | 31 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/decl.h | 9 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/fw.h | 10 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/init.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/ioctl.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 20 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_cmd.c | 38 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_cmdresp.c | 70 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_ioctl.c | 287 |
11 files changed, 175 insertions, 588 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index c7a177c62625..fe42137384da 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -48,10 +48,9 @@ static const struct ieee80211_iface_combination mwifiex_iface_comb_ap_sta = { | |||
48 | * Others -> IEEE80211_HT_PARAM_CHA_SEC_NONE | 48 | * Others -> IEEE80211_HT_PARAM_CHA_SEC_NONE |
49 | */ | 49 | */ |
50 | static u8 | 50 | static u8 |
51 | mwifiex_cfg80211_channel_type_to_sec_chan_offset(enum nl80211_channel_type | 51 | mwifiex_chan_type_to_sec_chan_offset(enum nl80211_channel_type chan_type) |
52 | channel_type) | ||
53 | { | 52 | { |
54 | switch (channel_type) { | 53 | switch (chan_type) { |
55 | case NL80211_CHAN_NO_HT: | 54 | case NL80211_CHAN_NO_HT: |
56 | case NL80211_CHAN_HT20: | 55 | case NL80211_CHAN_HT20: |
57 | return IEEE80211_HT_PARAM_CHA_SEC_NONE; | 56 | return IEEE80211_HT_PARAM_CHA_SEC_NONE; |
@@ -339,79 +338,6 @@ static int mwifiex_reg_notifier(struct wiphy *wiphy, | |||
339 | } | 338 | } |
340 | 339 | ||
341 | /* | 340 | /* |
342 | * This function sets the RF channel. | ||
343 | * | ||
344 | * This function creates multiple IOCTL requests, populates them accordingly | ||
345 | * and issues them to set the band/channel and frequency. | ||
346 | */ | ||
347 | static int | ||
348 | mwifiex_set_rf_channel(struct mwifiex_private *priv, | ||
349 | struct ieee80211_channel *chan, | ||
350 | enum nl80211_channel_type channel_type) | ||
351 | { | ||
352 | struct mwifiex_chan_freq_power cfp; | ||
353 | u32 config_bands = 0; | ||
354 | struct wiphy *wiphy = priv->wdev->wiphy; | ||
355 | struct mwifiex_adapter *adapter = priv->adapter; | ||
356 | |||
357 | if (chan) { | ||
358 | /* Set appropriate bands */ | ||
359 | if (chan->band == IEEE80211_BAND_2GHZ) { | ||
360 | if (channel_type == NL80211_CHAN_NO_HT) | ||
361 | if (priv->adapter->config_bands == BAND_B || | ||
362 | priv->adapter->config_bands == BAND_G) | ||
363 | config_bands = | ||
364 | priv->adapter->config_bands; | ||
365 | else | ||
366 | config_bands = BAND_B | BAND_G; | ||
367 | else | ||
368 | config_bands = BAND_B | BAND_G | BAND_GN; | ||
369 | } else { | ||
370 | if (channel_type == NL80211_CHAN_NO_HT) | ||
371 | config_bands = BAND_A; | ||
372 | else | ||
373 | config_bands = BAND_AN | BAND_A; | ||
374 | } | ||
375 | |||
376 | if (!((config_bands | adapter->fw_bands) & | ||
377 | ~adapter->fw_bands)) { | ||
378 | adapter->config_bands = config_bands; | ||
379 | if (priv->bss_mode == NL80211_IFTYPE_ADHOC) { | ||
380 | adapter->adhoc_start_band = config_bands; | ||
381 | if ((config_bands & BAND_GN) || | ||
382 | (config_bands & BAND_AN)) | ||
383 | adapter->adhoc_11n_enabled = true; | ||
384 | else | ||
385 | adapter->adhoc_11n_enabled = false; | ||
386 | } | ||
387 | } | ||
388 | adapter->sec_chan_offset = | ||
389 | mwifiex_cfg80211_channel_type_to_sec_chan_offset | ||
390 | (channel_type); | ||
391 | adapter->channel_type = channel_type; | ||
392 | |||
393 | mwifiex_send_domain_info_cmd_fw(wiphy); | ||
394 | } | ||
395 | |||
396 | wiphy_dbg(wiphy, "info: setting band %d, chan offset %d, mode %d\n", | ||
397 | config_bands, adapter->sec_chan_offset, priv->bss_mode); | ||
398 | if (!chan) | ||
399 | return 0; | ||
400 | |||
401 | memset(&cfp, 0, sizeof(cfp)); | ||
402 | cfp.freq = chan->center_freq; | ||
403 | cfp.channel = ieee80211_frequency_to_channel(chan->center_freq); | ||
404 | |||
405 | if (priv->bss_type == MWIFIEX_BSS_TYPE_STA) { | ||
406 | if (mwifiex_bss_set_channel(priv, &cfp)) | ||
407 | return -EFAULT; | ||
408 | return mwifiex_drv_change_adhoc_chan(priv, cfp.channel); | ||
409 | } | ||
410 | |||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | /* | ||
415 | * This function sets the fragmentation threshold. | 341 | * This function sets the fragmentation threshold. |
416 | * | 342 | * |
417 | * The fragmentation threshold value must lie between MWIFIEX_FRAG_MIN_VALUE | 343 | * The fragmentation threshold value must lie between MWIFIEX_FRAG_MIN_VALUE |
@@ -626,7 +552,7 @@ static int | |||
626 | mwifiex_dump_station_info(struct mwifiex_private *priv, | 552 | mwifiex_dump_station_info(struct mwifiex_private *priv, |
627 | struct station_info *sinfo) | 553 | struct station_info *sinfo) |
628 | { | 554 | { |
629 | struct mwifiex_rate_cfg rate; | 555 | u32 rate; |
630 | 556 | ||
631 | sinfo->filled = STATION_INFO_RX_BYTES | STATION_INFO_TX_BYTES | | 557 | sinfo->filled = STATION_INFO_RX_BYTES | STATION_INFO_TX_BYTES | |
632 | STATION_INFO_RX_PACKETS | STATION_INFO_TX_PACKETS | | 558 | STATION_INFO_RX_PACKETS | STATION_INFO_TX_PACKETS | |
@@ -652,9 +578,9 @@ mwifiex_dump_station_info(struct mwifiex_private *priv, | |||
652 | 578 | ||
653 | /* | 579 | /* |
654 | * Bit 0 in tx_htinfo indicates that current Tx rate is 11n rate. Valid | 580 | * Bit 0 in tx_htinfo indicates that current Tx rate is 11n rate. Valid |
655 | * MCS index values for us are 0 to 7. | 581 | * MCS index values for us are 0 to 15. |
656 | */ | 582 | */ |
657 | if ((priv->tx_htinfo & BIT(0)) && (priv->tx_rate < 8)) { | 583 | if ((priv->tx_htinfo & BIT(0)) && (priv->tx_rate < 16)) { |
658 | sinfo->txrate.mcs = priv->tx_rate; | 584 | sinfo->txrate.mcs = priv->tx_rate; |
659 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; | 585 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
660 | /* 40MHz rate */ | 586 | /* 40MHz rate */ |
@@ -672,7 +598,7 @@ mwifiex_dump_station_info(struct mwifiex_private *priv, | |||
672 | sinfo->tx_packets = priv->stats.tx_packets; | 598 | sinfo->tx_packets = priv->stats.tx_packets; |
673 | sinfo->signal = priv->bcn_rssi_avg; | 599 | sinfo->signal = priv->bcn_rssi_avg; |
674 | /* bit rate is in 500 kb/s units. Convert it to 100kb/s units */ | 600 | /* bit rate is in 500 kb/s units. Convert it to 100kb/s units */ |
675 | sinfo->txrate.legacy = rate.rate * 5; | 601 | sinfo->txrate.legacy = rate * 5; |
676 | 602 | ||
677 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { | 603 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { |
678 | sinfo->filled |= STATION_INFO_BSS_PARAM; | 604 | sinfo->filled |= STATION_INFO_BSS_PARAM; |
@@ -827,8 +753,8 @@ static const u32 mwifiex_cipher_suites[] = { | |||
827 | /* | 753 | /* |
828 | * CFG802.11 operation handler for setting bit rates. | 754 | * CFG802.11 operation handler for setting bit rates. |
829 | * | 755 | * |
830 | * Function selects legacy bang B/G/BG from corresponding bitrates selection. | 756 | * Function configures data rates to firmware using bitrate mask |
831 | * Currently only 2.4GHz band is supported. | 757 | * provided by cfg80211. |
832 | */ | 758 | */ |
833 | static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy, | 759 | static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy, |
834 | struct net_device *dev, | 760 | struct net_device *dev, |
@@ -836,43 +762,36 @@ static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy, | |||
836 | const struct cfg80211_bitrate_mask *mask) | 762 | const struct cfg80211_bitrate_mask *mask) |
837 | { | 763 | { |
838 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 764 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
839 | int index = 0, mode = 0, i; | 765 | u16 bitmap_rates[MAX_BITMAP_RATES_SIZE]; |
840 | struct mwifiex_adapter *adapter = priv->adapter; | 766 | enum ieee80211_band band; |
841 | 767 | ||
842 | /* Currently only 2.4GHz is supported */ | 768 | if (!priv->media_connected) { |
843 | for (i = 0; i < mwifiex_band_2ghz.n_bitrates; i++) { | 769 | dev_err(priv->adapter->dev, |
844 | /* | 770 | "Can not set Tx data rate in disconnected state\n"); |
845 | * Rates below 6 Mbps in the table are CCK rates; 802.11b | 771 | return -EINVAL; |
846 | * and from 6 they are OFDM; 802.11G | ||
847 | */ | ||
848 | if (mwifiex_rates[i].bitrate == 60) { | ||
849 | index = 1 << i; | ||
850 | break; | ||
851 | } | ||
852 | } | 772 | } |
853 | 773 | ||
854 | if (mask->control[IEEE80211_BAND_2GHZ].legacy < index) { | 774 | band = mwifiex_band_to_radio_type(priv->curr_bss_params.band); |
855 | mode = BAND_B; | ||
856 | } else { | ||
857 | mode = BAND_G; | ||
858 | if (mask->control[IEEE80211_BAND_2GHZ].legacy % index) | ||
859 | mode |= BAND_B; | ||
860 | } | ||
861 | 775 | ||
862 | if (!((mode | adapter->fw_bands) & ~adapter->fw_bands)) { | 776 | memset(bitmap_rates, 0, sizeof(bitmap_rates)); |
863 | adapter->config_bands = mode; | ||
864 | if (priv->bss_mode == NL80211_IFTYPE_ADHOC) { | ||
865 | adapter->adhoc_start_band = mode; | ||
866 | adapter->adhoc_11n_enabled = false; | ||
867 | } | ||
868 | } | ||
869 | adapter->sec_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; | ||
870 | adapter->channel_type = NL80211_CHAN_NO_HT; | ||
871 | 777 | ||
872 | wiphy_debug(wiphy, "info: device configured in 802.11%s%s mode\n", | 778 | /* Fill HR/DSSS rates. */ |
873 | (mode & BAND_B) ? "b" : "", (mode & BAND_G) ? "g" : ""); | 779 | if (band == IEEE80211_BAND_2GHZ) |
780 | bitmap_rates[0] = mask->control[band].legacy & 0x000f; | ||
874 | 781 | ||
875 | return 0; | 782 | /* Fill OFDM rates */ |
783 | if (band == IEEE80211_BAND_2GHZ) | ||
784 | bitmap_rates[1] = (mask->control[band].legacy & 0x0ff0) >> 4; | ||
785 | else | ||
786 | bitmap_rates[1] = mask->control[band].legacy; | ||
787 | |||
788 | /* Fill MCS rates */ | ||
789 | bitmap_rates[2] = mask->control[band].mcs[0]; | ||
790 | if (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2) | ||
791 | bitmap_rates[2] |= mask->control[band].mcs[1] << 8; | ||
792 | |||
793 | return mwifiex_send_cmd_sync(priv, HostCmd_CMD_TX_RATE_CFG, | ||
794 | HostCmd_ACT_GEN_SET, 0, bitmap_rates); | ||
876 | } | 795 | } |
877 | 796 | ||
878 | /* | 797 | /* |
@@ -1007,6 +926,7 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, | |||
1007 | { | 926 | { |
1008 | struct mwifiex_uap_bss_param *bss_cfg; | 927 | struct mwifiex_uap_bss_param *bss_cfg; |
1009 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 928 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
929 | u8 config_bands = 0; | ||
1010 | 930 | ||
1011 | if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) | 931 | if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) |
1012 | return -1; | 932 | return -1; |
@@ -1047,13 +967,25 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, | |||
1047 | (u8)ieee80211_frequency_to_channel(params->channel->center_freq); | 967 | (u8)ieee80211_frequency_to_channel(params->channel->center_freq); |
1048 | bss_cfg->band_cfg = BAND_CONFIG_MANUAL; | 968 | bss_cfg->band_cfg = BAND_CONFIG_MANUAL; |
1049 | 969 | ||
1050 | if (mwifiex_set_rf_channel(priv, params->channel, | 970 | /* Set appropriate bands */ |
1051 | params->channel_type)) { | 971 | if (params->channel->band == IEEE80211_BAND_2GHZ) { |
1052 | kfree(bss_cfg); | 972 | if (params->channel_type == NL80211_CHAN_NO_HT) |
1053 | wiphy_err(wiphy, "Failed to set band config information!\n"); | 973 | config_bands = BAND_B | BAND_G; |
1054 | return -1; | 974 | else |
975 | config_bands = BAND_B | BAND_G | BAND_GN; | ||
976 | } else { | ||
977 | if (params->channel_type == NL80211_CHAN_NO_HT) | ||
978 | config_bands = BAND_A; | ||
979 | else | ||
980 | config_bands = BAND_AN | BAND_A; | ||
1055 | } | 981 | } |
1056 | 982 | ||
983 | if (!((config_bands | priv->adapter->fw_bands) & | ||
984 | ~priv->adapter->fw_bands)) | ||
985 | priv->adapter->config_bands = config_bands; | ||
986 | |||
987 | mwifiex_send_domain_info_cmd_fw(wiphy); | ||
988 | |||
1057 | if (mwifiex_set_secure_params(priv, bss_cfg, params)) { | 989 | if (mwifiex_set_secure_params(priv, bss_cfg, params)) { |
1058 | kfree(bss_cfg); | 990 | kfree(bss_cfg); |
1059 | wiphy_err(wiphy, "Failed to parse secuirty parameters!\n"); | 991 | wiphy_err(wiphy, "Failed to parse secuirty parameters!\n"); |
@@ -1187,7 +1119,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
1187 | struct cfg80211_ssid req_ssid; | 1119 | struct cfg80211_ssid req_ssid; |
1188 | int ret, auth_type = 0; | 1120 | int ret, auth_type = 0; |
1189 | struct cfg80211_bss *bss = NULL; | 1121 | struct cfg80211_bss *bss = NULL; |
1190 | u8 is_scanning_required = 0; | 1122 | u8 is_scanning_required = 0, config_bands = 0; |
1191 | 1123 | ||
1192 | memset(&req_ssid, 0, sizeof(struct cfg80211_ssid)); | 1124 | memset(&req_ssid, 0, sizeof(struct cfg80211_ssid)); |
1193 | 1125 | ||
@@ -1206,9 +1138,19 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
1206 | /* disconnect before try to associate */ | 1138 | /* disconnect before try to associate */ |
1207 | mwifiex_deauthenticate(priv, NULL); | 1139 | mwifiex_deauthenticate(priv, NULL); |
1208 | 1140 | ||
1209 | if (channel) | 1141 | if (channel) { |
1210 | ret = mwifiex_set_rf_channel(priv, channel, | 1142 | if (mode == NL80211_IFTYPE_STATION) { |
1211 | priv->adapter->channel_type); | 1143 | if (channel->band == IEEE80211_BAND_2GHZ) |
1144 | config_bands = BAND_B | BAND_G | BAND_GN; | ||
1145 | else | ||
1146 | config_bands = BAND_A | BAND_AN; | ||
1147 | |||
1148 | if (!((config_bands | priv->adapter->fw_bands) & | ||
1149 | ~priv->adapter->fw_bands)) | ||
1150 | priv->adapter->config_bands = config_bands; | ||
1151 | } | ||
1152 | mwifiex_send_domain_info_cmd_fw(priv->wdev->wiphy); | ||
1153 | } | ||
1212 | 1154 | ||
1213 | /* As this is new association, clear locally stored | 1155 | /* As this is new association, clear locally stored |
1214 | * keys and security related flags */ | 1156 | * keys and security related flags */ |
@@ -1373,6 +1315,76 @@ done: | |||
1373 | } | 1315 | } |
1374 | 1316 | ||
1375 | /* | 1317 | /* |
1318 | * This function sets following parameters for ibss network. | ||
1319 | * - channel | ||
1320 | * - start band | ||
1321 | * - 11n flag | ||
1322 | * - secondary channel offset | ||
1323 | */ | ||
1324 | static int mwifiex_set_ibss_params(struct mwifiex_private *priv, | ||
1325 | struct cfg80211_ibss_params *params) | ||
1326 | { | ||
1327 | struct wiphy *wiphy = priv->wdev->wiphy; | ||
1328 | struct mwifiex_adapter *adapter = priv->adapter; | ||
1329 | int index = 0, i; | ||
1330 | u8 config_bands = 0; | ||
1331 | |||
1332 | if (params->channel->band == IEEE80211_BAND_2GHZ) { | ||
1333 | if (!params->basic_rates) { | ||
1334 | config_bands = BAND_B | BAND_G; | ||
1335 | } else { | ||
1336 | for (i = 0; i < mwifiex_band_2ghz.n_bitrates; i++) { | ||
1337 | /* | ||
1338 | * Rates below 6 Mbps in the table are CCK | ||
1339 | * rates; 802.11b and from 6 they are OFDM; | ||
1340 | * 802.11G | ||
1341 | */ | ||
1342 | if (mwifiex_rates[i].bitrate == 60) { | ||
1343 | index = 1 << i; | ||
1344 | break; | ||
1345 | } | ||
1346 | } | ||
1347 | |||
1348 | if (params->basic_rates < index) { | ||
1349 | config_bands = BAND_B; | ||
1350 | } else { | ||
1351 | config_bands = BAND_G; | ||
1352 | if (params->basic_rates % index) | ||
1353 | config_bands |= BAND_B; | ||
1354 | } | ||
1355 | } | ||
1356 | |||
1357 | if (params->channel_type != NL80211_CHAN_NO_HT) | ||
1358 | config_bands |= BAND_GN; | ||
1359 | } else { | ||
1360 | if (params->channel_type == NL80211_CHAN_NO_HT) | ||
1361 | config_bands = BAND_A; | ||
1362 | else | ||
1363 | config_bands = BAND_AN | BAND_A; | ||
1364 | } | ||
1365 | |||
1366 | if (!((config_bands | adapter->fw_bands) & ~adapter->fw_bands)) { | ||
1367 | adapter->config_bands = config_bands; | ||
1368 | adapter->adhoc_start_band = config_bands; | ||
1369 | |||
1370 | if ((config_bands & BAND_GN) || (config_bands & BAND_AN)) | ||
1371 | adapter->adhoc_11n_enabled = true; | ||
1372 | else | ||
1373 | adapter->adhoc_11n_enabled = false; | ||
1374 | } | ||
1375 | |||
1376 | adapter->sec_chan_offset = | ||
1377 | mwifiex_chan_type_to_sec_chan_offset(params->channel_type); | ||
1378 | priv->adhoc_channel = | ||
1379 | ieee80211_frequency_to_channel(params->channel->center_freq); | ||
1380 | |||
1381 | wiphy_dbg(wiphy, "info: set ibss band %d, chan %d, chan offset %d\n", | ||
1382 | config_bands, priv->adhoc_channel, adapter->sec_chan_offset); | ||
1383 | |||
1384 | return 0; | ||
1385 | } | ||
1386 | |||
1387 | /* | ||
1376 | * CFG802.11 operation handler to join an IBSS. | 1388 | * CFG802.11 operation handler to join an IBSS. |
1377 | * | 1389 | * |
1378 | * This function does not work in any mode other than Ad-Hoc, or if | 1390 | * This function does not work in any mode other than Ad-Hoc, or if |
@@ -1394,6 +1406,8 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, | |||
1394 | wiphy_dbg(wiphy, "info: trying to join to %s and bssid %pM\n", | 1406 | wiphy_dbg(wiphy, "info: trying to join to %s and bssid %pM\n", |
1395 | (char *) params->ssid, params->bssid); | 1407 | (char *) params->ssid, params->bssid); |
1396 | 1408 | ||
1409 | mwifiex_set_ibss_params(priv, params); | ||
1410 | |||
1397 | ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid, | 1411 | ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid, |
1398 | params->bssid, priv->bss_mode, | 1412 | params->bssid, priv->bss_mode, |
1399 | params->channel, NULL, params->privacy); | 1413 | params->channel, NULL, params->privacy); |
@@ -1440,9 +1454,10 @@ mwifiex_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) | |||
1440 | * it also informs the results. | 1454 | * it also informs the results. |
1441 | */ | 1455 | */ |
1442 | static int | 1456 | static int |
1443 | mwifiex_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, | 1457 | mwifiex_cfg80211_scan(struct wiphy *wiphy, |
1444 | struct cfg80211_scan_request *request) | 1458 | struct cfg80211_scan_request *request) |
1445 | { | 1459 | { |
1460 | struct net_device *dev = request->wdev->netdev; | ||
1446 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 1461 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
1447 | int i; | 1462 | int i; |
1448 | struct ieee80211_channel *chan; | 1463 | struct ieee80211_channel *chan; |
@@ -1576,11 +1591,11 @@ mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info, | |||
1576 | /* | 1591 | /* |
1577 | * create a new virtual interface with the given name | 1592 | * create a new virtual interface with the given name |
1578 | */ | 1593 | */ |
1579 | struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | 1594 | struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, |
1580 | char *name, | 1595 | char *name, |
1581 | enum nl80211_iftype type, | 1596 | enum nl80211_iftype type, |
1582 | u32 *flags, | 1597 | u32 *flags, |
1583 | struct vif_params *params) | 1598 | struct vif_params *params) |
1584 | { | 1599 | { |
1585 | struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); | 1600 | struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); |
1586 | struct mwifiex_private *priv; | 1601 | struct mwifiex_private *priv; |
@@ -1701,16 +1716,16 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
1701 | #ifdef CONFIG_DEBUG_FS | 1716 | #ifdef CONFIG_DEBUG_FS |
1702 | mwifiex_dev_debugfs_init(priv); | 1717 | mwifiex_dev_debugfs_init(priv); |
1703 | #endif | 1718 | #endif |
1704 | return dev; | 1719 | return wdev; |
1705 | } | 1720 | } |
1706 | EXPORT_SYMBOL_GPL(mwifiex_add_virtual_intf); | 1721 | EXPORT_SYMBOL_GPL(mwifiex_add_virtual_intf); |
1707 | 1722 | ||
1708 | /* | 1723 | /* |
1709 | * del_virtual_intf: remove the virtual interface determined by dev | 1724 | * del_virtual_intf: remove the virtual interface determined by dev |
1710 | */ | 1725 | */ |
1711 | int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev) | 1726 | int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) |
1712 | { | 1727 | { |
1713 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 1728 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); |
1714 | 1729 | ||
1715 | #ifdef CONFIG_DEBUG_FS | 1730 | #ifdef CONFIG_DEBUG_FS |
1716 | mwifiex_dev_debugfs_remove(priv); | 1731 | mwifiex_dev_debugfs_remove(priv); |
@@ -1722,11 +1737,11 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev) | |||
1722 | if (netif_carrier_ok(priv->netdev)) | 1737 | if (netif_carrier_ok(priv->netdev)) |
1723 | netif_carrier_off(priv->netdev); | 1738 | netif_carrier_off(priv->netdev); |
1724 | 1739 | ||
1725 | if (dev->reg_state == NETREG_REGISTERED) | 1740 | if (wdev->netdev->reg_state == NETREG_REGISTERED) |
1726 | unregister_netdevice(dev); | 1741 | unregister_netdevice(wdev->netdev); |
1727 | 1742 | ||
1728 | if (dev->reg_state == NETREG_UNREGISTERED) | 1743 | if (wdev->netdev->reg_state == NETREG_UNREGISTERED) |
1729 | free_netdev(dev); | 1744 | free_netdev(wdev->netdev); |
1730 | 1745 | ||
1731 | /* Clear the priv in adapter */ | 1746 | /* Clear the priv in adapter */ |
1732 | priv->netdev = NULL; | 1747 | priv->netdev = NULL; |
@@ -1818,6 +1833,8 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) | |||
1818 | wiphy->available_antennas_tx = BIT(adapter->number_of_antenna) - 1; | 1833 | wiphy->available_antennas_tx = BIT(adapter->number_of_antenna) - 1; |
1819 | wiphy->available_antennas_rx = BIT(adapter->number_of_antenna) - 1; | 1834 | wiphy->available_antennas_rx = BIT(adapter->number_of_antenna) - 1; |
1820 | 1835 | ||
1836 | wiphy->features = NL80211_FEATURE_HT_IBSS; | ||
1837 | |||
1821 | /* Reserve space for mwifiex specific private data for BSS */ | 1838 | /* Reserve space for mwifiex specific private data for BSS */ |
1822 | wiphy->bss_priv_size = sizeof(struct mwifiex_bss_priv); | 1839 | wiphy->bss_priv_size = sizeof(struct mwifiex_bss_priv); |
1823 | 1840 | ||
diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c index 560871b0e236..f69300f93f42 100644 --- a/drivers/net/wireless/mwifiex/cfp.c +++ b/drivers/net/wireless/mwifiex/cfp.c | |||
@@ -167,23 +167,6 @@ u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv, u8 index, | |||
167 | } | 167 | } |
168 | 168 | ||
169 | /* | 169 | /* |
170 | * This function maps a data rate value into corresponding index in supported | ||
171 | * rates table. | ||
172 | */ | ||
173 | u8 mwifiex_data_rate_to_index(u32 rate) | ||
174 | { | ||
175 | u16 *ptr; | ||
176 | |||
177 | if (rate) { | ||
178 | ptr = memchr(mwifiex_data_rates, rate, | ||
179 | sizeof(mwifiex_data_rates)); | ||
180 | if (ptr) | ||
181 | return (u8) (ptr - mwifiex_data_rates); | ||
182 | } | ||
183 | return 0; | ||
184 | } | ||
185 | |||
186 | /* | ||
187 | * This function returns the current active data rates. | 170 | * This function returns the current active data rates. |
188 | * | 171 | * |
189 | * The result may vary depending upon connection status. | 172 | * The result may vary depending upon connection status. |
@@ -277,20 +260,6 @@ mwifiex_is_rate_auto(struct mwifiex_private *priv) | |||
277 | } | 260 | } |
278 | 261 | ||
279 | /* | 262 | /* |
280 | * This function converts rate bitmap into rate index. | ||
281 | */ | ||
282 | int mwifiex_get_rate_index(u16 *rate_bitmap, int size) | ||
283 | { | ||
284 | int i; | ||
285 | |||
286 | for (i = 0; i < size * 8; i++) | ||
287 | if (rate_bitmap[i / 16] & (1 << (i % 16))) | ||
288 | return i; | ||
289 | |||
290 | return 0; | ||
291 | } | ||
292 | |||
293 | /* | ||
294 | * This function gets the supported data rates. | 263 | * This function gets the supported data rates. |
295 | * | 264 | * |
296 | * The function works in both Ad-Hoc and infra mode by printing the | 265 | * The function works in both Ad-Hoc and infra mode by printing the |
diff --git a/drivers/net/wireless/mwifiex/decl.h b/drivers/net/wireless/mwifiex/decl.h index f918f66e5e27..070ef25f5186 100644 --- a/drivers/net/wireless/mwifiex/decl.h +++ b/drivers/net/wireless/mwifiex/decl.h | |||
@@ -41,16 +41,7 @@ | |||
41 | #define MWIFIEX_AMPDU_DEF_RXWINSIZE 16 | 41 | #define MWIFIEX_AMPDU_DEF_RXWINSIZE 16 |
42 | #define MWIFIEX_DEFAULT_BLOCK_ACK_TIMEOUT 0xffff | 42 | #define MWIFIEX_DEFAULT_BLOCK_ACK_TIMEOUT 0xffff |
43 | 43 | ||
44 | #define MWIFIEX_RATE_INDEX_HRDSSS0 0 | ||
45 | #define MWIFIEX_RATE_INDEX_HRDSSS3 3 | ||
46 | #define MWIFIEX_RATE_INDEX_OFDM0 4 | ||
47 | #define MWIFIEX_RATE_INDEX_OFDM7 11 | ||
48 | #define MWIFIEX_RATE_INDEX_MCS0 12 | ||
49 | |||
50 | #define MWIFIEX_RATE_BITMAP_OFDM0 16 | ||
51 | #define MWIFIEX_RATE_BITMAP_OFDM7 23 | ||
52 | #define MWIFIEX_RATE_BITMAP_MCS0 32 | 44 | #define MWIFIEX_RATE_BITMAP_MCS0 32 |
53 | #define MWIFIEX_RATE_BITMAP_MCS127 159 | ||
54 | 45 | ||
55 | #define MWIFIEX_RX_DATA_BUF_SIZE (4 * 1024) | 46 | #define MWIFIEX_RX_DATA_BUF_SIZE (4 * 1024) |
56 | #define MWIFIEX_RX_CMD_BUF_SIZE (2 * 1024) | 47 | #define MWIFIEX_RX_CMD_BUF_SIZE (2 * 1024) |
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index 14e985d01dee..e831b440a24a 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h | |||
@@ -225,7 +225,6 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
225 | #define HostCmd_CMD_BBP_REG_ACCESS 0x001a | 225 | #define HostCmd_CMD_BBP_REG_ACCESS 0x001a |
226 | #define HostCmd_CMD_RF_REG_ACCESS 0x001b | 226 | #define HostCmd_CMD_RF_REG_ACCESS 0x001b |
227 | #define HostCmd_CMD_PMIC_REG_ACCESS 0x00ad | 227 | #define HostCmd_CMD_PMIC_REG_ACCESS 0x00ad |
228 | #define HostCmd_CMD_802_11_RF_CHANNEL 0x001d | ||
229 | #define HostCmd_CMD_RF_TX_PWR 0x001e | 228 | #define HostCmd_CMD_RF_TX_PWR 0x001e |
230 | #define HostCmd_CMD_RF_ANTENNA 0x0020 | 229 | #define HostCmd_CMD_RF_ANTENNA 0x0020 |
231 | #define HostCmd_CMD_802_11_DEAUTHENTICATE 0x0024 | 230 | #define HostCmd_CMD_802_11_DEAUTHENTICATE 0x0024 |
@@ -1292,14 +1291,6 @@ struct host_cmd_tlv_channel_band { | |||
1292 | u8 channel; | 1291 | u8 channel; |
1293 | } __packed; | 1292 | } __packed; |
1294 | 1293 | ||
1295 | struct host_cmd_ds_802_11_rf_channel { | ||
1296 | __le16 action; | ||
1297 | __le16 current_channel; | ||
1298 | __le16 rf_type; | ||
1299 | __le16 reserved; | ||
1300 | u8 reserved_1[32]; | ||
1301 | } __packed; | ||
1302 | |||
1303 | struct host_cmd_ds_version_ext { | 1294 | struct host_cmd_ds_version_ext { |
1304 | u8 version_str_sel; | 1295 | u8 version_str_sel; |
1305 | char version_str[128]; | 1296 | char version_str[128]; |
@@ -1384,7 +1375,6 @@ struct host_cmd_ds_command { | |||
1384 | struct host_cmd_ds_802_11_rssi_info rssi_info; | 1375 | struct host_cmd_ds_802_11_rssi_info rssi_info; |
1385 | struct host_cmd_ds_802_11_rssi_info_rsp rssi_info_rsp; | 1376 | struct host_cmd_ds_802_11_rssi_info_rsp rssi_info_rsp; |
1386 | struct host_cmd_ds_802_11_snmp_mib smib; | 1377 | struct host_cmd_ds_802_11_snmp_mib smib; |
1387 | struct host_cmd_ds_802_11_rf_channel rf_channel; | ||
1388 | struct host_cmd_ds_tx_rate_query tx_rate; | 1378 | struct host_cmd_ds_tx_rate_query tx_rate; |
1389 | struct host_cmd_ds_tx_rate_cfg tx_rate_cfg; | 1379 | struct host_cmd_ds_tx_rate_cfg tx_rate_cfg; |
1390 | struct host_cmd_ds_txpwr_cfg txp_cfg; | 1380 | struct host_cmd_ds_txpwr_cfg txp_cfg; |
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index b543a4d82ff3..21fdc6c02775 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c | |||
@@ -344,7 +344,6 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) | |||
344 | adapter->adhoc_awake_period = 0; | 344 | adapter->adhoc_awake_period = 0; |
345 | memset(&adapter->arp_filter, 0, sizeof(adapter->arp_filter)); | 345 | memset(&adapter->arp_filter, 0, sizeof(adapter->arp_filter)); |
346 | adapter->arp_filter_size = 0; | 346 | adapter->arp_filter_size = 0; |
347 | adapter->channel_type = NL80211_CHAN_HT20; | ||
348 | adapter->max_mgmt_ie_index = MAX_MGMT_IE_INDEX; | 347 | adapter->max_mgmt_ie_index = MAX_MGMT_IE_INDEX; |
349 | } | 348 | } |
350 | 349 | ||
diff --git a/drivers/net/wireless/mwifiex/ioctl.h b/drivers/net/wireless/mwifiex/ioctl.h index e121294cc1ac..50191539bb32 100644 --- a/drivers/net/wireless/mwifiex/ioctl.h +++ b/drivers/net/wireless/mwifiex/ioctl.h | |||
@@ -225,12 +225,6 @@ struct mwifiex_ds_encrypt_key { | |||
225 | u8 wapi_rxpn[WAPI_RXPN_LEN]; | 225 | u8 wapi_rxpn[WAPI_RXPN_LEN]; |
226 | }; | 226 | }; |
227 | 227 | ||
228 | struct mwifiex_rate_cfg { | ||
229 | u32 action; | ||
230 | u32 is_rate_auto; | ||
231 | u32 rate; | ||
232 | }; | ||
233 | |||
234 | struct mwifiex_power_cfg { | 228 | struct mwifiex_power_cfg { |
235 | u32 is_power_auto; | 229 | u32 is_power_auto; |
236 | u32 power_level; | 230 | u32 power_level; |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index f0219efc8953..46803621d015 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -377,7 +377,7 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) | |||
377 | goto done; | 377 | goto done; |
378 | 378 | ||
379 | err_add_intf: | 379 | err_add_intf: |
380 | mwifiex_del_virtual_intf(adapter->wiphy, priv->netdev); | 380 | mwifiex_del_virtual_intf(adapter->wiphy, priv->wdev); |
381 | rtnl_unlock(); | 381 | rtnl_unlock(); |
382 | err_init_fw: | 382 | err_init_fw: |
383 | pr_debug("info: %s: unregister device\n", __func__); | 383 | pr_debug("info: %s: unregister device\n", __func__); |
@@ -844,7 +844,7 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) | |||
844 | 844 | ||
845 | rtnl_lock(); | 845 | rtnl_lock(); |
846 | if (priv->wdev && priv->netdev) | 846 | if (priv->wdev && priv->netdev) |
847 | mwifiex_del_virtual_intf(adapter->wiphy, priv->netdev); | 847 | mwifiex_del_virtual_intf(adapter->wiphy, priv->wdev); |
848 | rtnl_unlock(); | 848 | rtnl_unlock(); |
849 | } | 849 | } |
850 | 850 | ||
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 9e636535cbf6..e7c2a82fd610 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -678,7 +678,6 @@ struct mwifiex_adapter { | |||
678 | u8 hw_dev_mcs_support; | 678 | u8 hw_dev_mcs_support; |
679 | u8 adhoc_11n_enabled; | 679 | u8 adhoc_11n_enabled; |
680 | u8 sec_chan_offset; | 680 | u8 sec_chan_offset; |
681 | enum nl80211_channel_type channel_type; | ||
682 | struct mwifiex_dbg dbg; | 681 | struct mwifiex_dbg dbg; |
683 | u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE]; | 682 | u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE]; |
684 | u32 arp_filter_size; | 683 | u32 arp_filter_size; |
@@ -824,9 +823,7 @@ int mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv, u16 vsie_mask, | |||
824 | u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv, | 823 | u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv, |
825 | u8 *rates); | 824 | u8 *rates); |
826 | u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates); | 825 | u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates); |
827 | u8 mwifiex_data_rate_to_index(u32 rate); | ||
828 | u8 mwifiex_is_rate_auto(struct mwifiex_private *priv); | 826 | u8 mwifiex_is_rate_auto(struct mwifiex_private *priv); |
829 | int mwifiex_get_rate_index(u16 *rateBitmap, int size); | ||
830 | extern u16 region_code_index[MWIFIEX_MAX_REGION_CODE]; | 827 | extern u16 region_code_index[MWIFIEX_MAX_REGION_CODE]; |
831 | void mwifiex_save_curr_bcn(struct mwifiex_private *priv); | 828 | void mwifiex_save_curr_bcn(struct mwifiex_private *priv); |
832 | void mwifiex_free_curr_bcn(struct mwifiex_private *priv); | 829 | void mwifiex_free_curr_bcn(struct mwifiex_private *priv); |
@@ -945,16 +942,13 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, | |||
945 | int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type); | 942 | int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type); |
946 | int mwifiex_enable_hs(struct mwifiex_adapter *adapter); | 943 | int mwifiex_enable_hs(struct mwifiex_adapter *adapter); |
947 | int mwifiex_disable_auto_ds(struct mwifiex_private *priv); | 944 | int mwifiex_disable_auto_ds(struct mwifiex_private *priv); |
948 | int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, | 945 | int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate); |
949 | struct mwifiex_rate_cfg *rate); | ||
950 | int mwifiex_request_scan(struct mwifiex_private *priv, | 946 | int mwifiex_request_scan(struct mwifiex_private *priv, |
951 | struct cfg80211_ssid *req_ssid); | 947 | struct cfg80211_ssid *req_ssid); |
952 | int mwifiex_scan_networks(struct mwifiex_private *priv, | 948 | int mwifiex_scan_networks(struct mwifiex_private *priv, |
953 | const struct mwifiex_user_scan_cfg *user_scan_in); | 949 | const struct mwifiex_user_scan_cfg *user_scan_in); |
954 | int mwifiex_set_radio(struct mwifiex_private *priv, u8 option); | 950 | int mwifiex_set_radio(struct mwifiex_private *priv, u8 option); |
955 | 951 | ||
956 | int mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, u16 channel); | ||
957 | |||
958 | int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key, | 952 | int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key, |
959 | int key_len, u8 key_index, const u8 *mac_addr, | 953 | int key_len, u8 key_index, const u8 *mac_addr, |
960 | int disable); | 954 | int disable); |
@@ -993,8 +987,6 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, | |||
993 | 987 | ||
994 | int mwifiex_main_process(struct mwifiex_adapter *); | 988 | int mwifiex_main_process(struct mwifiex_adapter *); |
995 | 989 | ||
996 | int mwifiex_bss_set_channel(struct mwifiex_private *, | ||
997 | struct mwifiex_chan_freq_power *cfp); | ||
998 | int mwifiex_get_bss_info(struct mwifiex_private *, | 990 | int mwifiex_get_bss_info(struct mwifiex_private *, |
999 | struct mwifiex_bss_info *); | 991 | struct mwifiex_bss_info *); |
1000 | int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, | 992 | int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, |
@@ -1005,10 +997,12 @@ int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter, | |||
1005 | int mwifiex_check_network_compatibility(struct mwifiex_private *priv, | 997 | int mwifiex_check_network_compatibility(struct mwifiex_private *priv, |
1006 | struct mwifiex_bssdescriptor *bss_desc); | 998 | struct mwifiex_bssdescriptor *bss_desc); |
1007 | 999 | ||
1008 | struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | 1000 | struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, |
1009 | char *name, enum nl80211_iftype type, | 1001 | char *name, |
1010 | u32 *flags, struct vif_params *params); | 1002 | enum nl80211_iftype type, |
1011 | int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev); | 1003 | u32 *flags, |
1004 | struct vif_params *params); | ||
1005 | int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev); | ||
1012 | 1006 | ||
1013 | void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config); | 1007 | void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config); |
1014 | 1008 | ||
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c index 225d4c776177..df3a33c530cf 100644 --- a/drivers/net/wireless/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/mwifiex/sta_cmd.c | |||
@@ -745,40 +745,6 @@ static int mwifiex_cmd_802_11d_domain_info(struct mwifiex_private *priv, | |||
745 | } | 745 | } |
746 | 746 | ||
747 | /* | 747 | /* |
748 | * This function prepares command to set/get RF channel. | ||
749 | * | ||
750 | * Preparation includes - | ||
751 | * - Setting command ID, action and proper size | ||
752 | * - Setting RF type and current RF channel (for SET only) | ||
753 | * - Ensuring correct endian-ness | ||
754 | */ | ||
755 | static int mwifiex_cmd_802_11_rf_channel(struct mwifiex_private *priv, | ||
756 | struct host_cmd_ds_command *cmd, | ||
757 | u16 cmd_action, u16 *channel) | ||
758 | { | ||
759 | struct host_cmd_ds_802_11_rf_channel *rf_chan = | ||
760 | &cmd->params.rf_channel; | ||
761 | uint16_t rf_type = le16_to_cpu(rf_chan->rf_type); | ||
762 | |||
763 | cmd->command = cpu_to_le16(HostCmd_CMD_802_11_RF_CHANNEL); | ||
764 | cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_rf_channel) | ||
765 | + S_DS_GEN); | ||
766 | |||
767 | if (cmd_action == HostCmd_ACT_GEN_SET) { | ||
768 | if ((priv->adapter->adhoc_start_band & BAND_A) || | ||
769 | (priv->adapter->adhoc_start_band & BAND_AN)) | ||
770 | rf_chan->rf_type = | ||
771 | cpu_to_le16(HostCmd_SCAN_RADIO_TYPE_A); | ||
772 | |||
773 | rf_type = le16_to_cpu(rf_chan->rf_type); | ||
774 | SET_SECONDARYCHAN(rf_type, priv->adapter->sec_chan_offset); | ||
775 | rf_chan->current_channel = cpu_to_le16(*channel); | ||
776 | } | ||
777 | rf_chan->action = cpu_to_le16(cmd_action); | ||
778 | return 0; | ||
779 | } | ||
780 | |||
781 | /* | ||
782 | * This function prepares command to set/get IBSS coalescing status. | 748 | * This function prepares command to set/get IBSS coalescing status. |
783 | * | 749 | * |
784 | * Preparation includes - | 750 | * Preparation includes - |
@@ -1169,10 +1135,6 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no, | |||
1169 | S_DS_GEN); | 1135 | S_DS_GEN); |
1170 | ret = 0; | 1136 | ret = 0; |
1171 | break; | 1137 | break; |
1172 | case HostCmd_CMD_802_11_RF_CHANNEL: | ||
1173 | ret = mwifiex_cmd_802_11_rf_channel(priv, cmd_ptr, cmd_action, | ||
1174 | data_buf); | ||
1175 | break; | ||
1176 | case HostCmd_CMD_FUNC_INIT: | 1138 | case HostCmd_CMD_FUNC_INIT: |
1177 | if (priv->adapter->hw_status == MWIFIEX_HW_STATUS_RESET) | 1139 | if (priv->adapter->hw_status == MWIFIEX_HW_STATUS_RESET) |
1178 | priv->adapter->hw_status = MWIFIEX_HW_STATUS_READY; | 1140 | priv->adapter->hw_status = MWIFIEX_HW_STATUS_READY; |
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c index 97715dfbdf58..0b09004ebb25 100644 --- a/drivers/net/wireless/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c | |||
@@ -267,12 +267,10 @@ static int mwifiex_ret_get_log(struct mwifiex_private *priv, | |||
267 | * | 267 | * |
268 | * Based on the new rate bitmaps, the function re-evaluates if | 268 | * Based on the new rate bitmaps, the function re-evaluates if |
269 | * auto data rate has been activated. If not, it sends another | 269 | * auto data rate has been activated. If not, it sends another |
270 | * query to the firmware to get the current Tx data rate and updates | 270 | * query to the firmware to get the current Tx data rate. |
271 | * the driver value. | ||
272 | */ | 271 | */ |
273 | static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, | 272 | static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, |
274 | struct host_cmd_ds_command *resp, | 273 | struct host_cmd_ds_command *resp) |
275 | struct mwifiex_rate_cfg *ds_rate) | ||
276 | { | 274 | { |
277 | struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg; | 275 | struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg; |
278 | struct mwifiex_rate_scope *rate_scope; | 276 | struct mwifiex_rate_scope *rate_scope; |
@@ -280,7 +278,6 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, | |||
280 | u16 tlv, tlv_buf_len; | 278 | u16 tlv, tlv_buf_len; |
281 | u8 *tlv_buf; | 279 | u8 *tlv_buf; |
282 | u32 i; | 280 | u32 i; |
283 | int ret = 0; | ||
284 | 281 | ||
285 | tlv_buf = ((u8 *)rate_cfg) + | 282 | tlv_buf = ((u8 *)rate_cfg) + |
286 | sizeof(struct host_cmd_ds_tx_rate_cfg); | 283 | sizeof(struct host_cmd_ds_tx_rate_cfg); |
@@ -318,33 +315,11 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, | |||
318 | if (priv->is_data_rate_auto) | 315 | if (priv->is_data_rate_auto) |
319 | priv->data_rate = 0; | 316 | priv->data_rate = 0; |
320 | else | 317 | else |
321 | ret = mwifiex_send_cmd_async(priv, | 318 | return mwifiex_send_cmd_async(priv, |
322 | HostCmd_CMD_802_11_TX_RATE_QUERY, | 319 | HostCmd_CMD_802_11_TX_RATE_QUERY, |
323 | HostCmd_ACT_GEN_GET, 0, NULL); | 320 | HostCmd_ACT_GEN_GET, 0, NULL); |
324 | |||
325 | if (!ds_rate) | ||
326 | return ret; | ||
327 | |||
328 | if (le16_to_cpu(rate_cfg->action) == HostCmd_ACT_GEN_GET) { | ||
329 | if (priv->is_data_rate_auto) { | ||
330 | ds_rate->is_rate_auto = 1; | ||
331 | return ret; | ||
332 | } | ||
333 | ds_rate->rate = mwifiex_get_rate_index(priv->bitmap_rates, | ||
334 | sizeof(priv->bitmap_rates)); | ||
335 | |||
336 | if (ds_rate->rate >= MWIFIEX_RATE_BITMAP_OFDM0 && | ||
337 | ds_rate->rate <= MWIFIEX_RATE_BITMAP_OFDM7) | ||
338 | ds_rate->rate -= (MWIFIEX_RATE_BITMAP_OFDM0 - | ||
339 | MWIFIEX_RATE_INDEX_OFDM0); | ||
340 | |||
341 | if (ds_rate->rate >= MWIFIEX_RATE_BITMAP_MCS0 && | ||
342 | ds_rate->rate <= MWIFIEX_RATE_BITMAP_MCS127) | ||
343 | ds_rate->rate -= (MWIFIEX_RATE_BITMAP_MCS0 - | ||
344 | MWIFIEX_RATE_INDEX_MCS0); | ||
345 | } | ||
346 | 321 | ||
347 | return ret; | 322 | return 0; |
348 | } | 323 | } |
349 | 324 | ||
350 | /* | 325 | /* |
@@ -656,34 +631,6 @@ static int mwifiex_ret_802_11d_domain_info(struct mwifiex_private *priv, | |||
656 | } | 631 | } |
657 | 632 | ||
658 | /* | 633 | /* |
659 | * This function handles the command response of get RF channel. | ||
660 | * | ||
661 | * Handling includes changing the header fields into CPU format | ||
662 | * and saving the new channel in driver. | ||
663 | */ | ||
664 | static int mwifiex_ret_802_11_rf_channel(struct mwifiex_private *priv, | ||
665 | struct host_cmd_ds_command *resp, | ||
666 | u16 *data_buf) | ||
667 | { | ||
668 | struct host_cmd_ds_802_11_rf_channel *rf_channel = | ||
669 | &resp->params.rf_channel; | ||
670 | u16 new_channel = le16_to_cpu(rf_channel->current_channel); | ||
671 | |||
672 | if (priv->curr_bss_params.bss_descriptor.channel != new_channel) { | ||
673 | dev_dbg(priv->adapter->dev, "cmd: Channel Switch: %d to %d\n", | ||
674 | priv->curr_bss_params.bss_descriptor.channel, | ||
675 | new_channel); | ||
676 | /* Update the channel again */ | ||
677 | priv->curr_bss_params.bss_descriptor.channel = new_channel; | ||
678 | } | ||
679 | |||
680 | if (data_buf) | ||
681 | *data_buf = new_channel; | ||
682 | |||
683 | return 0; | ||
684 | } | ||
685 | |||
686 | /* | ||
687 | * This function handles the command response of get extended version. | 634 | * This function handles the command response of get extended version. |
688 | * | 635 | * |
689 | * Handling includes forming the extended version string and sending it | 636 | * Handling includes forming the extended version string and sending it |
@@ -878,7 +825,7 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no, | |||
878 | ret = mwifiex_ret_mac_multicast_adr(priv, resp); | 825 | ret = mwifiex_ret_mac_multicast_adr(priv, resp); |
879 | break; | 826 | break; |
880 | case HostCmd_CMD_TX_RATE_CFG: | 827 | case HostCmd_CMD_TX_RATE_CFG: |
881 | ret = mwifiex_ret_tx_rate_cfg(priv, resp, data_buf); | 828 | ret = mwifiex_ret_tx_rate_cfg(priv, resp); |
882 | break; | 829 | break; |
883 | case HostCmd_CMD_802_11_SCAN: | 830 | case HostCmd_CMD_802_11_SCAN: |
884 | ret = mwifiex_ret_802_11_scan(priv, resp); | 831 | ret = mwifiex_ret_802_11_scan(priv, resp); |
@@ -929,9 +876,6 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no, | |||
929 | case HostCmd_CMD_802_11_TX_RATE_QUERY: | 876 | case HostCmd_CMD_802_11_TX_RATE_QUERY: |
930 | ret = mwifiex_ret_802_11_tx_rate_query(priv, resp); | 877 | ret = mwifiex_ret_802_11_tx_rate_query(priv, resp); |
931 | break; | 878 | break; |
932 | case HostCmd_CMD_802_11_RF_CHANNEL: | ||
933 | ret = mwifiex_ret_802_11_rf_channel(priv, resp, data_buf); | ||
934 | break; | ||
935 | case HostCmd_CMD_VERSION_EXT: | 879 | case HostCmd_CMD_VERSION_EXT: |
936 | ret = mwifiex_ret_ver_ext(priv, resp, data_buf); | 880 | ret = mwifiex_ret_ver_ext(priv, resp, data_buf); |
937 | break; | 881 | break; |
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index f2fd2423214f..fb2136089a22 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -497,297 +497,24 @@ int mwifiex_disable_auto_ds(struct mwifiex_private *priv) | |||
497 | EXPORT_SYMBOL_GPL(mwifiex_disable_auto_ds); | 497 | EXPORT_SYMBOL_GPL(mwifiex_disable_auto_ds); |
498 | 498 | ||
499 | /* | 499 | /* |
500 | * IOCTL request handler to set/get active channel. | ||
501 | * | ||
502 | * This function performs validity checking on channel/frequency | ||
503 | * compatibility and returns failure if not valid. | ||
504 | */ | ||
505 | int mwifiex_bss_set_channel(struct mwifiex_private *priv, | ||
506 | struct mwifiex_chan_freq_power *chan) | ||
507 | { | ||
508 | struct mwifiex_adapter *adapter = priv->adapter; | ||
509 | struct mwifiex_chan_freq_power *cfp = NULL; | ||
510 | |||
511 | if (!chan) | ||
512 | return -1; | ||
513 | |||
514 | if (!chan->channel && !chan->freq) | ||
515 | return -1; | ||
516 | if (adapter->adhoc_start_band & BAND_AN) | ||
517 | adapter->adhoc_start_band = BAND_G | BAND_B | BAND_GN; | ||
518 | else if (adapter->adhoc_start_band & BAND_A) | ||
519 | adapter->adhoc_start_band = BAND_G | BAND_B; | ||
520 | if (chan->channel) { | ||
521 | if (chan->channel <= MAX_CHANNEL_BAND_BG) | ||
522 | cfp = mwifiex_get_cfp(priv, 0, (u16) chan->channel, 0); | ||
523 | if (!cfp) { | ||
524 | cfp = mwifiex_get_cfp(priv, BAND_A, | ||
525 | (u16) chan->channel, 0); | ||
526 | if (cfp) { | ||
527 | if (adapter->adhoc_11n_enabled) | ||
528 | adapter->adhoc_start_band = BAND_A | ||
529 | | BAND_AN; | ||
530 | else | ||
531 | adapter->adhoc_start_band = BAND_A; | ||
532 | } | ||
533 | } | ||
534 | } else { | ||
535 | if (chan->freq <= MAX_FREQUENCY_BAND_BG) | ||
536 | cfp = mwifiex_get_cfp(priv, 0, 0, chan->freq); | ||
537 | if (!cfp) { | ||
538 | cfp = mwifiex_get_cfp(priv, BAND_A, 0, chan->freq); | ||
539 | if (cfp) { | ||
540 | if (adapter->adhoc_11n_enabled) | ||
541 | adapter->adhoc_start_band = BAND_A | ||
542 | | BAND_AN; | ||
543 | else | ||
544 | adapter->adhoc_start_band = BAND_A; | ||
545 | } | ||
546 | } | ||
547 | } | ||
548 | if (!cfp || !cfp->channel) { | ||
549 | dev_err(adapter->dev, "invalid channel/freq\n"); | ||
550 | return -1; | ||
551 | } | ||
552 | priv->adhoc_channel = (u8) cfp->channel; | ||
553 | chan->channel = cfp->channel; | ||
554 | chan->freq = cfp->freq; | ||
555 | |||
556 | return 0; | ||
557 | } | ||
558 | |||
559 | /* | ||
560 | * IOCTL request handler to set/get Ad-Hoc channel. | ||
561 | * | ||
562 | * This function prepares the correct firmware command and | ||
563 | * issues it to set or get the ad-hoc channel. | ||
564 | */ | ||
565 | static int mwifiex_bss_ioctl_ibss_channel(struct mwifiex_private *priv, | ||
566 | u16 action, u16 *channel) | ||
567 | { | ||
568 | if (action == HostCmd_ACT_GEN_GET) { | ||
569 | if (!priv->media_connected) { | ||
570 | *channel = priv->adhoc_channel; | ||
571 | return 0; | ||
572 | } | ||
573 | } else { | ||
574 | priv->adhoc_channel = (u8) *channel; | ||
575 | } | ||
576 | |||
577 | return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_RF_CHANNEL, | ||
578 | action, 0, channel); | ||
579 | } | ||
580 | |||
581 | /* | ||
582 | * IOCTL request handler to change Ad-Hoc channel. | ||
583 | * | ||
584 | * This function allocates the IOCTL request buffer, fills it | ||
585 | * with requisite parameters and calls the IOCTL handler. | ||
586 | * | ||
587 | * The function follows the following steps to perform the change - | ||
588 | * - Get current IBSS information | ||
589 | * - Get current channel | ||
590 | * - If no change is required, return | ||
591 | * - If not connected, change channel and return | ||
592 | * - If connected, | ||
593 | * - Disconnect | ||
594 | * - Change channel | ||
595 | * - Perform specific SSID scan with same SSID | ||
596 | * - Start/Join the IBSS | ||
597 | */ | ||
598 | int | ||
599 | mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, u16 channel) | ||
600 | { | ||
601 | int ret; | ||
602 | struct mwifiex_bss_info bss_info; | ||
603 | struct mwifiex_ssid_bssid ssid_bssid; | ||
604 | u16 curr_chan = 0; | ||
605 | struct cfg80211_bss *bss = NULL; | ||
606 | struct ieee80211_channel *chan; | ||
607 | enum ieee80211_band band; | ||
608 | |||
609 | memset(&bss_info, 0, sizeof(bss_info)); | ||
610 | |||
611 | /* Get BSS information */ | ||
612 | if (mwifiex_get_bss_info(priv, &bss_info)) | ||
613 | return -1; | ||
614 | |||
615 | /* Get current channel */ | ||
616 | ret = mwifiex_bss_ioctl_ibss_channel(priv, HostCmd_ACT_GEN_GET, | ||
617 | &curr_chan); | ||
618 | |||
619 | if (curr_chan == channel) { | ||
620 | ret = 0; | ||
621 | goto done; | ||
622 | } | ||
623 | dev_dbg(priv->adapter->dev, "cmd: updating channel from %d to %d\n", | ||
624 | curr_chan, channel); | ||
625 | |||
626 | if (!bss_info.media_connected) { | ||
627 | ret = 0; | ||
628 | goto done; | ||
629 | } | ||
630 | |||
631 | /* Do disonnect */ | ||
632 | memset(&ssid_bssid, 0, ETH_ALEN); | ||
633 | ret = mwifiex_deauthenticate(priv, ssid_bssid.bssid); | ||
634 | |||
635 | ret = mwifiex_bss_ioctl_ibss_channel(priv, HostCmd_ACT_GEN_SET, | ||
636 | &channel); | ||
637 | |||
638 | /* Do specific SSID scanning */ | ||
639 | if (mwifiex_request_scan(priv, &bss_info.ssid)) { | ||
640 | ret = -1; | ||
641 | goto done; | ||
642 | } | ||
643 | |||
644 | band = mwifiex_band_to_radio_type(priv->curr_bss_params.band); | ||
645 | chan = __ieee80211_get_channel(priv->wdev->wiphy, | ||
646 | ieee80211_channel_to_frequency(channel, | ||
647 | band)); | ||
648 | |||
649 | /* Find the BSS we want using available scan results */ | ||
650 | bss = cfg80211_get_bss(priv->wdev->wiphy, chan, bss_info.bssid, | ||
651 | bss_info.ssid.ssid, bss_info.ssid.ssid_len, | ||
652 | WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); | ||
653 | if (!bss) | ||
654 | wiphy_warn(priv->wdev->wiphy, "assoc: bss %pM not in scan results\n", | ||
655 | bss_info.bssid); | ||
656 | |||
657 | ret = mwifiex_bss_start(priv, bss, &bss_info.ssid); | ||
658 | done: | ||
659 | return ret; | ||
660 | } | ||
661 | |||
662 | /* | ||
663 | * IOCTL request handler to get rate. | ||
664 | * | ||
665 | * This function prepares the correct firmware command and | ||
666 | * issues it to get the current rate if it is connected, | ||
667 | * otherwise, the function returns the lowest supported rate | ||
668 | * for the band. | ||
669 | */ | ||
670 | static int mwifiex_rate_ioctl_get_rate_value(struct mwifiex_private *priv, | ||
671 | struct mwifiex_rate_cfg *rate_cfg) | ||
672 | { | ||
673 | rate_cfg->is_rate_auto = priv->is_data_rate_auto; | ||
674 | return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_TX_RATE_QUERY, | ||
675 | HostCmd_ACT_GEN_GET, 0, NULL); | ||
676 | } | ||
677 | |||
678 | /* | ||
679 | * IOCTL request handler to set rate. | ||
680 | * | ||
681 | * This function prepares the correct firmware command and | ||
682 | * issues it to set the current rate. | ||
683 | * | ||
684 | * The function also performs validation checking on the supplied value. | ||
685 | */ | ||
686 | static int mwifiex_rate_ioctl_set_rate_value(struct mwifiex_private *priv, | ||
687 | struct mwifiex_rate_cfg *rate_cfg) | ||
688 | { | ||
689 | u8 rates[MWIFIEX_SUPPORTED_RATES]; | ||
690 | u8 *rate; | ||
691 | int rate_index, ret; | ||
692 | u16 bitmap_rates[MAX_BITMAP_RATES_SIZE]; | ||
693 | u32 i; | ||
694 | struct mwifiex_adapter *adapter = priv->adapter; | ||
695 | |||
696 | if (rate_cfg->is_rate_auto) { | ||
697 | memset(bitmap_rates, 0, sizeof(bitmap_rates)); | ||
698 | /* Support all HR/DSSS rates */ | ||
699 | bitmap_rates[0] = 0x000F; | ||
700 | /* Support all OFDM rates */ | ||
701 | bitmap_rates[1] = 0x00FF; | ||
702 | /* Support all HT-MCSs rate */ | ||
703 | for (i = 0; i < ARRAY_SIZE(priv->bitmap_rates) - 3; i++) | ||
704 | bitmap_rates[i + 2] = 0xFFFF; | ||
705 | bitmap_rates[9] = 0x3FFF; | ||
706 | } else { | ||
707 | memset(rates, 0, sizeof(rates)); | ||
708 | mwifiex_get_active_data_rates(priv, rates); | ||
709 | rate = rates; | ||
710 | for (i = 0; (rate[i] && i < MWIFIEX_SUPPORTED_RATES); i++) { | ||
711 | dev_dbg(adapter->dev, "info: rate=%#x wanted=%#x\n", | ||
712 | rate[i], rate_cfg->rate); | ||
713 | if ((rate[i] & 0x7f) == (rate_cfg->rate & 0x7f)) | ||
714 | break; | ||
715 | } | ||
716 | if ((i == MWIFIEX_SUPPORTED_RATES) || !rate[i]) { | ||
717 | dev_err(adapter->dev, "fixed data rate %#x is out " | ||
718 | "of range\n", rate_cfg->rate); | ||
719 | return -1; | ||
720 | } | ||
721 | memset(bitmap_rates, 0, sizeof(bitmap_rates)); | ||
722 | |||
723 | rate_index = mwifiex_data_rate_to_index(rate_cfg->rate); | ||
724 | |||
725 | /* Only allow b/g rates to be set */ | ||
726 | if (rate_index >= MWIFIEX_RATE_INDEX_HRDSSS0 && | ||
727 | rate_index <= MWIFIEX_RATE_INDEX_HRDSSS3) { | ||
728 | bitmap_rates[0] = 1 << rate_index; | ||
729 | } else { | ||
730 | rate_index -= 1; /* There is a 0x00 in the table */ | ||
731 | if (rate_index >= MWIFIEX_RATE_INDEX_OFDM0 && | ||
732 | rate_index <= MWIFIEX_RATE_INDEX_OFDM7) | ||
733 | bitmap_rates[1] = 1 << (rate_index - | ||
734 | MWIFIEX_RATE_INDEX_OFDM0); | ||
735 | } | ||
736 | } | ||
737 | |||
738 | ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_TX_RATE_CFG, | ||
739 | HostCmd_ACT_GEN_SET, 0, bitmap_rates); | ||
740 | |||
741 | return ret; | ||
742 | } | ||
743 | |||
744 | /* | ||
745 | * IOCTL request handler to set/get rate. | ||
746 | * | ||
747 | * This function can be used to set/get either the rate value or the | ||
748 | * rate index. | ||
749 | */ | ||
750 | static int mwifiex_rate_ioctl_cfg(struct mwifiex_private *priv, | ||
751 | struct mwifiex_rate_cfg *rate_cfg) | ||
752 | { | ||
753 | int status; | ||
754 | |||
755 | if (!rate_cfg) | ||
756 | return -1; | ||
757 | |||
758 | if (rate_cfg->action == HostCmd_ACT_GEN_GET) | ||
759 | status = mwifiex_rate_ioctl_get_rate_value(priv, rate_cfg); | ||
760 | else | ||
761 | status = mwifiex_rate_ioctl_set_rate_value(priv, rate_cfg); | ||
762 | |||
763 | return status; | ||
764 | } | ||
765 | |||
766 | /* | ||
767 | * Sends IOCTL request to get the data rate. | 500 | * Sends IOCTL request to get the data rate. |
768 | * | 501 | * |
769 | * This function allocates the IOCTL request buffer, fills it | 502 | * This function allocates the IOCTL request buffer, fills it |
770 | * with requisite parameters and calls the IOCTL handler. | 503 | * with requisite parameters and calls the IOCTL handler. |
771 | */ | 504 | */ |
772 | int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, | 505 | int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate) |
773 | struct mwifiex_rate_cfg *rate) | ||
774 | { | 506 | { |
775 | int ret; | 507 | int ret; |
776 | 508 | ||
777 | memset(rate, 0, sizeof(struct mwifiex_rate_cfg)); | 509 | ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_TX_RATE_QUERY, |
778 | rate->action = HostCmd_ACT_GEN_GET; | 510 | HostCmd_ACT_GEN_GET, 0, NULL); |
779 | ret = mwifiex_rate_ioctl_cfg(priv, rate); | ||
780 | 511 | ||
781 | if (!ret) { | 512 | if (!ret) { |
782 | if (rate->is_rate_auto) | 513 | if (priv->is_data_rate_auto) |
783 | rate->rate = mwifiex_index_to_data_rate(priv, | 514 | *rate = mwifiex_index_to_data_rate(priv, priv->tx_rate, |
784 | priv->tx_rate, | 515 | priv->tx_htinfo); |
785 | priv->tx_htinfo | ||
786 | ); | ||
787 | else | 516 | else |
788 | rate->rate = priv->data_rate; | 517 | *rate = priv->data_rate; |
789 | } else { | ||
790 | ret = -1; | ||
791 | } | 518 | } |
792 | 519 | ||
793 | return ret; | 520 | return ret; |