diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965-rs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 169 |
1 files changed, 95 insertions, 74 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index 8e3660ebba7d..a955f9c1b9ee 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c | |||
@@ -282,14 +282,20 @@ static void rs_tl_rm_old_stats(struct iwl4965_traffic_load *tl, u32 curr_time) | |||
282 | * increment traffic load value for tid and also remove | 282 | * increment traffic load value for tid and also remove |
283 | * any old values if passed the certain time period | 283 | * any old values if passed the certain time period |
284 | */ | 284 | */ |
285 | static void rs_tl_add_packet(struct iwl4965_lq_sta *lq_data, u8 tid) | 285 | static void rs_tl_add_packet(struct iwl4965_lq_sta *lq_data, |
286 | struct ieee80211_hdr *hdr) | ||
286 | { | 287 | { |
287 | u32 curr_time = jiffies_to_msecs(jiffies); | 288 | u32 curr_time = jiffies_to_msecs(jiffies); |
288 | u32 time_diff; | 289 | u32 time_diff; |
289 | s32 index; | 290 | s32 index; |
290 | struct iwl4965_traffic_load *tl = NULL; | 291 | struct iwl4965_traffic_load *tl = NULL; |
292 | u16 fc = le16_to_cpu(hdr->frame_control); | ||
293 | u8 tid; | ||
291 | 294 | ||
292 | if (tid >= TID_MAX_LOAD_COUNT) | 295 | if (ieee80211_is_qos_data(fc)) { |
296 | u8 *qc = ieee80211_get_qos_ctrl(hdr, ieee80211_get_hdrlen(fc)); | ||
297 | tid = qc[0] & 0xf; | ||
298 | } else | ||
293 | return; | 299 | return; |
294 | 300 | ||
295 | tl = &lq_data->load[tid]; | 301 | tl = &lq_data->load[tid]; |
@@ -481,7 +487,7 @@ static u32 rate_n_flags_from_tbl(struct iwl4965_scale_tbl_info *tbl, | |||
481 | u32 rate_n_flags = 0; | 487 | u32 rate_n_flags = 0; |
482 | 488 | ||
483 | if (is_legacy(tbl->lq_type)) { | 489 | if (is_legacy(tbl->lq_type)) { |
484 | rate_n_flags = iwl4965_rates[index].plcp; | 490 | rate_n_flags = iwl_rates[index].plcp; |
485 | if (index >= IWL_FIRST_CCK_RATE && index <= IWL_LAST_CCK_RATE) | 491 | if (index >= IWL_FIRST_CCK_RATE && index <= IWL_LAST_CCK_RATE) |
486 | rate_n_flags |= RATE_MCS_CCK_MSK; | 492 | rate_n_flags |= RATE_MCS_CCK_MSK; |
487 | 493 | ||
@@ -493,11 +499,11 @@ static u32 rate_n_flags_from_tbl(struct iwl4965_scale_tbl_info *tbl, | |||
493 | rate_n_flags = RATE_MCS_HT_MSK; | 499 | rate_n_flags = RATE_MCS_HT_MSK; |
494 | 500 | ||
495 | if (is_siso(tbl->lq_type)) | 501 | if (is_siso(tbl->lq_type)) |
496 | rate_n_flags |= iwl4965_rates[index].plcp_siso; | 502 | rate_n_flags |= iwl_rates[index].plcp_siso; |
497 | else if (is_mimo2(tbl->lq_type)) | 503 | else if (is_mimo2(tbl->lq_type)) |
498 | rate_n_flags |= iwl4965_rates[index].plcp_mimo2; | 504 | rate_n_flags |= iwl_rates[index].plcp_mimo2; |
499 | else | 505 | else |
500 | rate_n_flags |= iwl4965_rates[index].plcp_mimo3; | 506 | rate_n_flags |= iwl_rates[index].plcp_mimo3; |
501 | } else { | 507 | } else { |
502 | IWL_ERROR("Invalid tbl->lq_type %d\n", tbl->lq_type); | 508 | IWL_ERROR("Invalid tbl->lq_type %d\n", tbl->lq_type); |
503 | } | 509 | } |
@@ -697,7 +703,7 @@ static u16 rs_get_adjacent_rate(struct iwl_priv *priv, u8 index, u16 rate_mask, | |||
697 | 703 | ||
698 | low = index; | 704 | low = index; |
699 | while (low != IWL_RATE_INVALID) { | 705 | while (low != IWL_RATE_INVALID) { |
700 | low = iwl4965_rates[low].prev_rs; | 706 | low = iwl_rates[low].prev_rs; |
701 | if (low == IWL_RATE_INVALID) | 707 | if (low == IWL_RATE_INVALID) |
702 | break; | 708 | break; |
703 | if (rate_mask & (1 << low)) | 709 | if (rate_mask & (1 << low)) |
@@ -707,7 +713,7 @@ static u16 rs_get_adjacent_rate(struct iwl_priv *priv, u8 index, u16 rate_mask, | |||
707 | 713 | ||
708 | high = index; | 714 | high = index; |
709 | while (high != IWL_RATE_INVALID) { | 715 | while (high != IWL_RATE_INVALID) { |
710 | high = iwl4965_rates[high].next_rs; | 716 | high = iwl_rates[high].next_rs; |
711 | if (high == IWL_RATE_INVALID) | 717 | if (high == IWL_RATE_INVALID) |
712 | break; | 718 | break; |
713 | if (rate_mask & (1 << high)) | 719 | if (rate_mask & (1 << high)) |
@@ -779,8 +785,7 @@ out: | |||
779 | * mac80211 sends us Tx status | 785 | * mac80211 sends us Tx status |
780 | */ | 786 | */ |
781 | static void rs_tx_status(void *priv_rate, struct net_device *dev, | 787 | static void rs_tx_status(void *priv_rate, struct net_device *dev, |
782 | struct sk_buff *skb, | 788 | struct sk_buff *skb) |
783 | struct ieee80211_tx_status *tx_resp) | ||
784 | { | 789 | { |
785 | int status; | 790 | int status; |
786 | u8 retries; | 791 | u8 retries; |
@@ -792,6 +797,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
792 | struct iwl_priv *priv = (struct iwl_priv *)priv_rate; | 797 | struct iwl_priv *priv = (struct iwl_priv *)priv_rate; |
793 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 798 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
794 | struct ieee80211_hw *hw = local_to_hw(local); | 799 | struct ieee80211_hw *hw = local_to_hw(local); |
800 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
795 | struct iwl4965_rate_scale_data *window = NULL; | 801 | struct iwl4965_rate_scale_data *window = NULL; |
796 | struct iwl4965_rate_scale_data *search_win = NULL; | 802 | struct iwl4965_rate_scale_data *search_win = NULL; |
797 | u32 tx_rate; | 803 | u32 tx_rate; |
@@ -807,11 +813,11 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
807 | return; | 813 | return; |
808 | 814 | ||
809 | /* This packet was aggregated but doesn't carry rate scale info */ | 815 | /* This packet was aggregated but doesn't carry rate scale info */ |
810 | if ((tx_resp->control.flags & IEEE80211_TXCTL_AMPDU) && | 816 | if ((info->flags & IEEE80211_TX_CTL_AMPDU) && |
811 | !(tx_resp->flags & IEEE80211_TX_STATUS_AMPDU)) | 817 | !(info->flags & IEEE80211_TX_STAT_AMPDU)) |
812 | return; | 818 | return; |
813 | 819 | ||
814 | retries = tx_resp->retry_count; | 820 | retries = info->status.retry_count; |
815 | 821 | ||
816 | if (retries > 15) | 822 | if (retries > 15) |
817 | retries = 15; | 823 | retries = 15; |
@@ -856,20 +862,20 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
856 | if (priv->band == IEEE80211_BAND_5GHZ) | 862 | if (priv->band == IEEE80211_BAND_5GHZ) |
857 | rs_index -= IWL_FIRST_OFDM_RATE; | 863 | rs_index -= IWL_FIRST_OFDM_RATE; |
858 | 864 | ||
859 | if ((tx_resp->control.tx_rate == NULL) || | 865 | if ((info->tx_rate_idx < 0) || |
860 | (tbl_type.is_SGI ^ | 866 | (tbl_type.is_SGI ^ |
861 | !!(tx_resp->control.flags & IEEE80211_TXCTL_SHORT_GI)) || | 867 | !!(info->flags & IEEE80211_TX_CTL_SHORT_GI)) || |
862 | (tbl_type.is_fat ^ | 868 | (tbl_type.is_fat ^ |
863 | !!(tx_resp->control.flags & IEEE80211_TXCTL_40_MHZ_WIDTH)) || | 869 | !!(info->flags & IEEE80211_TX_CTL_40_MHZ_WIDTH)) || |
864 | (tbl_type.is_dup ^ | 870 | (tbl_type.is_dup ^ |
865 | !!(tx_resp->control.flags & IEEE80211_TXCTL_DUP_DATA)) || | 871 | !!(info->flags & IEEE80211_TX_CTL_DUP_DATA)) || |
866 | (tbl_type.ant_type ^ tx_resp->control.antenna_sel_tx) || | 872 | (tbl_type.ant_type ^ info->antenna_sel_tx) || |
867 | (!!(tx_rate & RATE_MCS_HT_MSK) ^ | 873 | (!!(tx_rate & RATE_MCS_HT_MSK) ^ |
868 | !!(tx_resp->control.flags & IEEE80211_TXCTL_OFDM_HT)) || | 874 | !!(info->flags & IEEE80211_TX_CTL_OFDM_HT)) || |
869 | (!!(tx_rate & RATE_MCS_GF_MSK) ^ | 875 | (!!(tx_rate & RATE_MCS_GF_MSK) ^ |
870 | !!(tx_resp->control.flags & IEEE80211_TXCTL_GREEN_FIELD)) || | 876 | !!(info->flags & IEEE80211_TX_CTL_GREEN_FIELD)) || |
871 | (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate != | 877 | (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate != |
872 | tx_resp->control.tx_rate->bitrate)) { | 878 | hw->wiphy->bands[info->band]->bitrates[info->tx_rate_idx].bitrate)) { |
873 | IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate); | 879 | IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate); |
874 | goto out; | 880 | goto out; |
875 | } | 881 | } |
@@ -923,10 +929,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
923 | rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, &rs_index); | 929 | rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, &rs_index); |
924 | 930 | ||
925 | /* Update frame history window with "success" if Tx got ACKed ... */ | 931 | /* Update frame history window with "success" if Tx got ACKed ... */ |
926 | if (tx_resp->flags & IEEE80211_TX_STATUS_ACK) | 932 | status = !!(info->flags & IEEE80211_TX_STAT_ACK); |
927 | status = 1; | ||
928 | else | ||
929 | status = 0; | ||
930 | 933 | ||
931 | /* If type matches "search" table, | 934 | /* If type matches "search" table, |
932 | * add final tx status to "search" history */ | 935 | * add final tx status to "search" history */ |
@@ -937,10 +940,10 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
937 | tpt = search_tbl->expected_tpt[rs_index]; | 940 | tpt = search_tbl->expected_tpt[rs_index]; |
938 | else | 941 | else |
939 | tpt = 0; | 942 | tpt = 0; |
940 | if (tx_resp->control.flags & IEEE80211_TXCTL_AMPDU) | 943 | if (info->flags & IEEE80211_TX_CTL_AMPDU) |
941 | rs_collect_tx_data(search_win, rs_index, tpt, | 944 | rs_collect_tx_data(search_win, rs_index, tpt, |
942 | tx_resp->ampdu_ack_len, | 945 | info->status.ampdu_ack_len, |
943 | tx_resp->ampdu_ack_map); | 946 | info->status.ampdu_ack_map); |
944 | else | 947 | else |
945 | rs_collect_tx_data(search_win, rs_index, tpt, | 948 | rs_collect_tx_data(search_win, rs_index, tpt, |
946 | 1, status); | 949 | 1, status); |
@@ -953,10 +956,10 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
953 | tpt = curr_tbl->expected_tpt[rs_index]; | 956 | tpt = curr_tbl->expected_tpt[rs_index]; |
954 | else | 957 | else |
955 | tpt = 0; | 958 | tpt = 0; |
956 | if (tx_resp->control.flags & IEEE80211_TXCTL_AMPDU) | 959 | if (info->flags & IEEE80211_TX_CTL_AMPDU) |
957 | rs_collect_tx_data(window, rs_index, tpt, | 960 | rs_collect_tx_data(window, rs_index, tpt, |
958 | tx_resp->ampdu_ack_len, | 961 | info->status.ampdu_ack_len, |
959 | tx_resp->ampdu_ack_map); | 962 | info->status.ampdu_ack_map); |
960 | else | 963 | else |
961 | rs_collect_tx_data(window, rs_index, tpt, | 964 | rs_collect_tx_data(window, rs_index, tpt, |
962 | 1, status); | 965 | 1, status); |
@@ -965,10 +968,10 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
965 | /* If not searching for new mode, increment success/failed counter | 968 | /* If not searching for new mode, increment success/failed counter |
966 | * ... these help determine when to start searching again */ | 969 | * ... these help determine when to start searching again */ |
967 | if (lq_sta->stay_in_tbl) { | 970 | if (lq_sta->stay_in_tbl) { |
968 | if (tx_resp->control.flags & IEEE80211_TXCTL_AMPDU) { | 971 | if (info->flags & IEEE80211_TX_CTL_AMPDU) { |
969 | lq_sta->total_success += tx_resp->ampdu_ack_map; | 972 | lq_sta->total_success += info->status.ampdu_ack_map; |
970 | lq_sta->total_failed += | 973 | lq_sta->total_failed += |
971 | (tx_resp->ampdu_ack_len - tx_resp->ampdu_ack_map); | 974 | (info->status.ampdu_ack_len - info->status.ampdu_ack_map); |
972 | } else { | 975 | } else { |
973 | if (status) | 976 | if (status) |
974 | lq_sta->total_success++; | 977 | lq_sta->total_success++; |
@@ -1333,7 +1336,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv, | |||
1333 | lq_sta->search_better_tbl = 1; | 1336 | lq_sta->search_better_tbl = 1; |
1334 | goto out; | 1337 | goto out; |
1335 | } | 1338 | } |
1336 | 1339 | break; | |
1337 | case IWL_LEGACY_SWITCH_SISO: | 1340 | case IWL_LEGACY_SWITCH_SISO: |
1338 | IWL_DEBUG_RATE("LQ: Legacy switch to SISO\n"); | 1341 | IWL_DEBUG_RATE("LQ: Legacy switch to SISO\n"); |
1339 | 1342 | ||
@@ -1419,9 +1422,9 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, | |||
1419 | lq_sta->search_better_tbl = 1; | 1422 | lq_sta->search_better_tbl = 1; |
1420 | goto out; | 1423 | goto out; |
1421 | } | 1424 | } |
1422 | 1425 | break; | |
1423 | case IWL_SISO_SWITCH_MIMO2: | 1426 | case IWL_SISO_SWITCH_MIMO2: |
1424 | IWL_DEBUG_RATE("LQ: SISO switch to MIMO\n"); | 1427 | IWL_DEBUG_RATE("LQ: SISO switch to MIMO2\n"); |
1425 | memcpy(search_tbl, tbl, sz); | 1428 | memcpy(search_tbl, tbl, sz); |
1426 | search_tbl->is_SGI = 0; | 1429 | search_tbl->is_SGI = 0; |
1427 | search_tbl->ant_type = ANT_AB; /*FIXME:RS*/ | 1430 | search_tbl->ant_type = ANT_AB; /*FIXME:RS*/ |
@@ -1433,6 +1436,15 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, | |||
1433 | } | 1436 | } |
1434 | break; | 1437 | break; |
1435 | case IWL_SISO_SWITCH_GI: | 1438 | case IWL_SISO_SWITCH_GI: |
1439 | if (!tbl->is_fat && | ||
1440 | !(priv->current_ht_config.sgf & | ||
1441 | HT_SHORT_GI_20MHZ)) | ||
1442 | break; | ||
1443 | if (tbl->is_fat && | ||
1444 | !(priv->current_ht_config.sgf & | ||
1445 | HT_SHORT_GI_40MHZ)) | ||
1446 | break; | ||
1447 | |||
1436 | IWL_DEBUG_RATE("LQ: SISO toggle SGI/NGI\n"); | 1448 | IWL_DEBUG_RATE("LQ: SISO toggle SGI/NGI\n"); |
1437 | 1449 | ||
1438 | memcpy(search_tbl, tbl, sz); | 1450 | memcpy(search_tbl, tbl, sz); |
@@ -1515,6 +1527,15 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv, | |||
1515 | break; | 1527 | break; |
1516 | 1528 | ||
1517 | case IWL_MIMO_SWITCH_GI: | 1529 | case IWL_MIMO_SWITCH_GI: |
1530 | if (!tbl->is_fat && | ||
1531 | !(priv->current_ht_config.sgf & | ||
1532 | HT_SHORT_GI_20MHZ)) | ||
1533 | break; | ||
1534 | if (tbl->is_fat && | ||
1535 | !(priv->current_ht_config.sgf & | ||
1536 | HT_SHORT_GI_40MHZ)) | ||
1537 | break; | ||
1538 | |||
1518 | IWL_DEBUG_RATE("LQ: MIMO toggle SGI/NGI\n"); | 1539 | IWL_DEBUG_RATE("LQ: MIMO toggle SGI/NGI\n"); |
1519 | 1540 | ||
1520 | /* Set up new search table for MIMO */ | 1541 | /* Set up new search table for MIMO */ |
@@ -1668,9 +1689,9 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1668 | u8 active_tbl = 0; | 1689 | u8 active_tbl = 0; |
1669 | u8 done_search = 0; | 1690 | u8 done_search = 0; |
1670 | u16 high_low; | 1691 | u16 high_low; |
1692 | s32 sr; | ||
1671 | #ifdef CONFIG_IWL4965_HT | 1693 | #ifdef CONFIG_IWL4965_HT |
1672 | u8 tid = MAX_TID_COUNT; | 1694 | u8 tid = MAX_TID_COUNT; |
1673 | __le16 *qc; | ||
1674 | #endif | 1695 | #endif |
1675 | 1696 | ||
1676 | IWL_DEBUG_RATE("rate scale calculate new rate for skb\n"); | 1697 | IWL_DEBUG_RATE("rate scale calculate new rate for skb\n"); |
@@ -1693,11 +1714,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1693 | lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; | 1714 | lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; |
1694 | 1715 | ||
1695 | #ifdef CONFIG_IWL4965_HT | 1716 | #ifdef CONFIG_IWL4965_HT |
1696 | qc = ieee80211_get_qos_ctrl(hdr); | 1717 | rs_tl_add_packet(lq_sta, hdr); |
1697 | if (qc) { | ||
1698 | tid = (u8)(le16_to_cpu(*qc) & 0xf); | ||
1699 | rs_tl_add_packet(lq_sta, tid); | ||
1700 | } | ||
1701 | #endif | 1718 | #endif |
1702 | /* | 1719 | /* |
1703 | * Select rate-scale / modulation-mode table to work with in | 1720 | * Select rate-scale / modulation-mode table to work with in |
@@ -1848,6 +1865,8 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1848 | low = high_low & 0xff; | 1865 | low = high_low & 0xff; |
1849 | high = (high_low >> 8) & 0xff; | 1866 | high = (high_low >> 8) & 0xff; |
1850 | 1867 | ||
1868 | sr = window->success_ratio; | ||
1869 | |||
1851 | /* Collect measured throughputs for current and adjacent rates */ | 1870 | /* Collect measured throughputs for current and adjacent rates */ |
1852 | current_tpt = window->average_tpt; | 1871 | current_tpt = window->average_tpt; |
1853 | if (low != IWL_RATE_INVALID) | 1872 | if (low != IWL_RATE_INVALID) |
@@ -1855,19 +1874,22 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1855 | if (high != IWL_RATE_INVALID) | 1874 | if (high != IWL_RATE_INVALID) |
1856 | high_tpt = tbl->win[high].average_tpt; | 1875 | high_tpt = tbl->win[high].average_tpt; |
1857 | 1876 | ||
1858 | /* Assume rate increase */ | 1877 | scale_action = 0; |
1859 | scale_action = 1; | ||
1860 | 1878 | ||
1861 | /* Too many failures, decrease rate */ | 1879 | /* Too many failures, decrease rate */ |
1862 | if ((window->success_ratio <= IWL_RATE_DECREASE_TH) || | 1880 | if ((sr <= IWL_RATE_DECREASE_TH) || (current_tpt == 0)) { |
1863 | (current_tpt == 0)) { | ||
1864 | IWL_DEBUG_RATE("decrease rate because of low success_ratio\n"); | 1881 | IWL_DEBUG_RATE("decrease rate because of low success_ratio\n"); |
1865 | scale_action = -1; | 1882 | scale_action = -1; |
1866 | 1883 | ||
1867 | /* No throughput measured yet for adjacent rates; try increase. */ | 1884 | /* No throughput measured yet for adjacent rates; try increase. */ |
1868 | } else if ((low_tpt == IWL_INVALID_VALUE) && | 1885 | } else if ((low_tpt == IWL_INVALID_VALUE) && |
1869 | (high_tpt == IWL_INVALID_VALUE)) | 1886 | (high_tpt == IWL_INVALID_VALUE)) { |
1870 | scale_action = 1; | 1887 | |
1888 | if (high != IWL_RATE_INVALID && sr >= IWL_RATE_INCREASE_TH) | ||
1889 | scale_action = 1; | ||
1890 | else if (low != IWL_RATE_INVALID) | ||
1891 | scale_action = -1; | ||
1892 | } | ||
1871 | 1893 | ||
1872 | /* Both adjacent throughputs are measured, but neither one has better | 1894 | /* Both adjacent throughputs are measured, but neither one has better |
1873 | * throughput; we're using the best rate, don't change it! */ | 1895 | * throughput; we're using the best rate, don't change it! */ |
@@ -1883,9 +1905,10 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1883 | /* Higher adjacent rate's throughput is measured */ | 1905 | /* Higher adjacent rate's throughput is measured */ |
1884 | if (high_tpt != IWL_INVALID_VALUE) { | 1906 | if (high_tpt != IWL_INVALID_VALUE) { |
1885 | /* Higher rate has better throughput */ | 1907 | /* Higher rate has better throughput */ |
1886 | if (high_tpt > current_tpt) | 1908 | if (high_tpt > current_tpt && |
1909 | sr >= IWL_RATE_INCREASE_TH) { | ||
1887 | scale_action = 1; | 1910 | scale_action = 1; |
1888 | else { | 1911 | } else { |
1889 | IWL_DEBUG_RATE | 1912 | IWL_DEBUG_RATE |
1890 | ("decrease rate because of high tpt\n"); | 1913 | ("decrease rate because of high tpt\n"); |
1891 | scale_action = -1; | 1914 | scale_action = -1; |
@@ -1898,23 +1921,17 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1898 | IWL_DEBUG_RATE | 1921 | IWL_DEBUG_RATE |
1899 | ("decrease rate because of low tpt\n"); | 1922 | ("decrease rate because of low tpt\n"); |
1900 | scale_action = -1; | 1923 | scale_action = -1; |
1901 | } else | 1924 | } else if (sr >= IWL_RATE_INCREASE_TH) { |
1902 | scale_action = 1; | 1925 | scale_action = 1; |
1926 | } | ||
1903 | } | 1927 | } |
1904 | } | 1928 | } |
1905 | 1929 | ||
1906 | /* Sanity check; asked for decrease, but success rate or throughput | 1930 | /* Sanity check; asked for decrease, but success rate or throughput |
1907 | * has been good at old rate. Don't change it. */ | 1931 | * has been good at old rate. Don't change it. */ |
1908 | if (scale_action == -1) { | 1932 | if ((scale_action == -1) && (low != IWL_RATE_INVALID) && |
1909 | if ((low != IWL_RATE_INVALID) && | 1933 | ((sr > IWL_RATE_HIGH_TH) || |
1910 | ((window->success_ratio > IWL_RATE_HIGH_TH) || | ||
1911 | (current_tpt > (100 * tbl->expected_tpt[low])))) | 1934 | (current_tpt > (100 * tbl->expected_tpt[low])))) |
1912 | scale_action = 0; | ||
1913 | |||
1914 | /* Sanity check; asked for increase, but success rate has not been great | ||
1915 | * even at old rate, higher rate will be worse. Don't change it. */ | ||
1916 | } else if ((scale_action == 1) && | ||
1917 | (window->success_ratio < IWL_RATE_INCREASE_TH)) | ||
1918 | scale_action = 0; | 1935 | scale_action = 0; |
1919 | 1936 | ||
1920 | switch (scale_action) { | 1937 | switch (scale_action) { |
@@ -1943,7 +1960,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1943 | "high %d type %d\n", | 1960 | "high %d type %d\n", |
1944 | index, scale_action, low, high, tbl->lq_type); | 1961 | index, scale_action, low, high, tbl->lq_type); |
1945 | 1962 | ||
1946 | lq_update: | 1963 | lq_update: |
1947 | /* Replace uCode's rate table for the destination station. */ | 1964 | /* Replace uCode's rate table for the destination station. */ |
1948 | if (update_lq) { | 1965 | if (update_lq) { |
1949 | rate = rate_n_flags_from_tbl(tbl, index, is_green); | 1966 | rate = rate_n_flags_from_tbl(tbl, index, is_green); |
@@ -2088,7 +2105,7 @@ static void rs_initialize_lq(struct iwl_priv *priv, | |||
2088 | i = 0; | 2105 | i = 0; |
2089 | 2106 | ||
2090 | /* FIXME:RS: This is also wrong in 4965 */ | 2107 | /* FIXME:RS: This is also wrong in 4965 */ |
2091 | rate = iwl4965_rates[i].plcp; | 2108 | rate = iwl_rates[i].plcp; |
2092 | rate |= RATE_MCS_ANT_B_MSK; | 2109 | rate |= RATE_MCS_ANT_B_MSK; |
2093 | rate &= ~RATE_MCS_ANT_A_MSK; | 2110 | rate &= ~RATE_MCS_ANT_A_MSK; |
2094 | 2111 | ||
@@ -2135,7 +2152,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
2135 | fc = le16_to_cpu(hdr->frame_control); | 2152 | fc = le16_to_cpu(hdr->frame_control); |
2136 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || | 2153 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || |
2137 | !sta || !sta->rate_ctrl_priv) { | 2154 | !sta || !sta->rate_ctrl_priv) { |
2138 | sel->rate = rate_lowest(local, sband, sta); | 2155 | sel->rate_idx = rate_lowest_index(local, sband, sta); |
2139 | goto out; | 2156 | goto out; |
2140 | } | 2157 | } |
2141 | 2158 | ||
@@ -2150,7 +2167,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
2150 | if (sta_id == IWL_INVALID_STATION) { | 2167 | if (sta_id == IWL_INVALID_STATION) { |
2151 | IWL_DEBUG_RATE("LQ: ADD station %s\n", | 2168 | IWL_DEBUG_RATE("LQ: ADD station %s\n", |
2152 | print_mac(mac, hdr->addr1)); | 2169 | print_mac(mac, hdr->addr1)); |
2153 | sta_id = iwl4965_add_station_flags(priv, hdr->addr1, | 2170 | sta_id = iwl_add_station_flags(priv, hdr->addr1, |
2154 | 0, CMD_ASYNC, NULL); | 2171 | 0, CMD_ASYNC, NULL); |
2155 | } | 2172 | } |
2156 | if ((sta_id != IWL_INVALID_STATION)) { | 2173 | if ((sta_id != IWL_INVALID_STATION)) { |
@@ -2165,11 +2182,13 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
2165 | 2182 | ||
2166 | done: | 2183 | done: |
2167 | if ((i < 0) || (i > IWL_RATE_COUNT)) { | 2184 | if ((i < 0) || (i > IWL_RATE_COUNT)) { |
2168 | sel->rate = rate_lowest(local, sband, sta); | 2185 | sel->rate_idx = rate_lowest_index(local, sband, sta); |
2169 | goto out; | 2186 | goto out; |
2170 | } | 2187 | } |
2171 | 2188 | ||
2172 | sel->rate = &priv->ieee_rates[i]; | 2189 | if (sband->band == IEEE80211_BAND_5GHZ) |
2190 | i -= IWL_FIRST_OFDM_RATE; | ||
2191 | sel->rate_idx = i; | ||
2173 | out: | 2192 | out: |
2174 | rcu_read_unlock(); | 2193 | rcu_read_unlock(); |
2175 | } | 2194 | } |
@@ -2234,7 +2253,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2234 | if (sta_id == IWL_INVALID_STATION) { | 2253 | if (sta_id == IWL_INVALID_STATION) { |
2235 | IWL_DEBUG_RATE("LQ: ADD station %s\n", | 2254 | IWL_DEBUG_RATE("LQ: ADD station %s\n", |
2236 | print_mac(mac, sta->addr)); | 2255 | print_mac(mac, sta->addr)); |
2237 | sta_id = iwl4965_add_station_flags(priv, sta->addr, | 2256 | sta_id = iwl_add_station_flags(priv, sta->addr, |
2238 | 0, CMD_ASYNC, NULL); | 2257 | 0, CMD_ASYNC, NULL); |
2239 | } | 2258 | } |
2240 | if ((sta_id != IWL_INVALID_STATION)) { | 2259 | if ((sta_id != IWL_INVALID_STATION)) { |
@@ -2425,6 +2444,7 @@ static void rs_fill_link_cmd(const struct iwl_priv *priv, | |||
2425 | repeat_rate--; | 2444 | repeat_rate--; |
2426 | } | 2445 | } |
2427 | 2446 | ||
2447 | lq_cmd->agg_params.agg_frame_cnt_limit = 64; | ||
2428 | lq_cmd->agg_params.agg_dis_start_th = 3; | 2448 | lq_cmd->agg_params.agg_dis_start_th = 3; |
2429 | lq_cmd->agg_params.agg_time_limit = cpu_to_le16(4000); | 2449 | lq_cmd->agg_params.agg_time_limit = cpu_to_le16(4000); |
2430 | } | 2450 | } |
@@ -2691,7 +2711,7 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) | |||
2691 | int active = lq_sta->active_tbl; | 2711 | int active = lq_sta->active_tbl; |
2692 | 2712 | ||
2693 | cnt += | 2713 | cnt += |
2694 | sprintf(&buf[cnt], " %2dMbs: ", iwl4965_rates[i].ieee / 2); | 2714 | sprintf(&buf[cnt], " %2dMbs: ", iwl_rates[i].ieee / 2); |
2695 | 2715 | ||
2696 | mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1)); | 2716 | mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1)); |
2697 | for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1) | 2717 | for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1) |
@@ -2702,7 +2722,7 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) | |||
2702 | samples += lq_sta->lq_info[active].win[i].counter; | 2722 | samples += lq_sta->lq_info[active].win[i].counter; |
2703 | good += lq_sta->lq_info[active].win[i].success_counter; | 2723 | good += lq_sta->lq_info[active].win[i].success_counter; |
2704 | success += lq_sta->lq_info[active].win[i].success_counter * | 2724 | success += lq_sta->lq_info[active].win[i].success_counter * |
2705 | iwl4965_rates[i].ieee; | 2725 | iwl_rates[i].ieee; |
2706 | 2726 | ||
2707 | if (lq_sta->lq_info[active].win[i].stamp) { | 2727 | if (lq_sta->lq_info[active].win[i].stamp) { |
2708 | int delta = | 2728 | int delta = |
@@ -2722,10 +2742,11 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) | |||
2722 | i = j; | 2742 | i = j; |
2723 | } | 2743 | } |
2724 | 2744 | ||
2725 | /* Display the average rate of all samples taken. | 2745 | /* |
2726 | * | 2746 | * Display the average rate of all samples taken. |
2727 | * NOTE: We multiply # of samples by 2 since the IEEE measurement | 2747 | * NOTE: We multiply # of samples by 2 since the IEEE measurement |
2728 | * added from iwl4965_rates is actually 2X the rate */ | 2748 | * added from iwl_rates is actually 2X the rate. |
2749 | */ | ||
2729 | if (samples) | 2750 | if (samples) |
2730 | cnt += sprintf(&buf[cnt], | 2751 | cnt += sprintf(&buf[cnt], |
2731 | "\nAverage rate is %3d.%02dMbs over last %4dms\n" | 2752 | "\nAverage rate is %3d.%02dMbs over last %4dms\n" |