Lines Matching full:rate

77  *   rate, ht rate, prev rate, next rate
79 * If there isn't a valid next or previous rate then INV is used which
121 struct rs_rate *rate,
133 struct rs_rate *rate, in rs_ant_allow() argument
140 struct rs_rate *rate, in rs_mimo_allow() argument
162 struct rs_rate *rate, in rs_siso_allow() argument
172 struct rs_rate *rate, in rs_sgi_allow() argument
178 if (is_ht20(rate) && (ht_cap->cap & in rs_sgi_allow()
181 if (is_ht40(rate) && (ht_cap->cap & in rs_sgi_allow()
184 if (is_ht80(rate) && (vht_cap->cap & in rs_sgi_allow()
187 if (is_ht160(rate) && (vht_cap->cap & in rs_sgi_allow()
368 /* legacy rate format, search for match in table */ in iwl_hwrate_to_plcp_idx()
520 static char *rs_pretty_rate(const struct rs_rate *rate) in rs_pretty_rate() argument
551 if (is_type_legacy(rate->type) && (rate->index <= IWL_RATE_54M_INDEX)) in rs_pretty_rate()
552 rate_str = legacy_rates[rate->index]; in rs_pretty_rate()
553 else if ((is_type_ht(rate->type) || is_type_vht(rate->type)) && in rs_pretty_rate()
554 (rate->index >= IWL_RATE_MCS_0_INDEX) && in rs_pretty_rate()
555 (rate->index <= IWL_RATE_MCS_9_INDEX)) in rs_pretty_rate()
556 rate_str = ht_vht_rates[rate->index]; in rs_pretty_rate()
560 sprintf(buf, "(%s|%s|%s)", rs_pretty_lq_type(rate->type), in rs_pretty_rate()
561 rs_pretty_ant(rate->ant), rate_str); in rs_pretty_rate()
565 static inline void rs_dump_rate(struct iwl_mvm *mvm, const struct rs_rate *rate, in rs_dump_rate() argument
570 prefix, rs_pretty_rate(rate), rate->bw, in rs_dump_rate()
571 rate->sgi, rate->ldpc, rate->stbc); in rs_dump_rate()
676 * at this rate. window->data contains the bitmask of successful
691 * Keep track of only the latest 62 tx frame attempts in this rate's in _rs_collect_tx_data()
809 /* Select window for current tx bit rate */ in rs_collect_tlc_data()
815 /* Convert rs_rate object into ucode rate bitmask */
817 struct rs_rate *rate) in ucode_rate_from_rs_rate() argument
820 int index = rate->index; in ucode_rate_from_rs_rate()
822 ucode_rate |= ((rate->ant << RATE_MCS_ANT_POS) & in ucode_rate_from_rs_rate()
825 if (is_legacy(rate)) { in ucode_rate_from_rs_rate()
838 if (is_ht(rate)) { in ucode_rate_from_rs_rate()
840 IWL_ERR(mvm, "Invalid HT rate index %d\n", index); in ucode_rate_from_rs_rate()
845 if (is_ht_siso(rate)) in ucode_rate_from_rs_rate()
847 else if (is_ht_mimo2(rate)) in ucode_rate_from_rs_rate()
851 } else if (is_vht(rate)) { in ucode_rate_from_rs_rate()
853 IWL_ERR(mvm, "Invalid VHT rate index %d\n", index); in ucode_rate_from_rs_rate()
857 if (is_vht_siso(rate)) in ucode_rate_from_rs_rate()
859 else if (is_vht_mimo2(rate)) in ucode_rate_from_rs_rate()
865 IWL_ERR(mvm, "Invalid rate->type %d\n", rate->type); in ucode_rate_from_rs_rate()
868 if (is_siso(rate) && rate->stbc) { in ucode_rate_from_rs_rate()
874 ucode_rate |= rate->bw; in ucode_rate_from_rs_rate()
875 if (rate->sgi) in ucode_rate_from_rs_rate()
877 if (rate->ldpc) in ucode_rate_from_rs_rate()
883 /* Convert a ucode rate into an rs_rate object */
886 struct rs_rate *rate) in rs_rate_from_ucode_rate() argument
892 memset(rate, 0, sizeof(*rate)); in rs_rate_from_ucode_rate()
893 rate->index = iwl_hwrate_to_plcp_idx(ucode_rate); in rs_rate_from_ucode_rate()
895 if (rate->index == IWL_RATE_INVALID) in rs_rate_from_ucode_rate()
898 rate->ant = (ant_msk >> RATE_MCS_ANT_POS); in rs_rate_from_ucode_rate()
906 rate->type = LQ_LEGACY_A; in rs_rate_from_ucode_rate()
908 rate->type = LQ_LEGACY_G; in rs_rate_from_ucode_rate()
916 rate->sgi = true; in rs_rate_from_ucode_rate()
918 rate->ldpc = true; in rs_rate_from_ucode_rate()
920 rate->stbc = true; in rs_rate_from_ucode_rate()
922 rate->bfer = true; in rs_rate_from_ucode_rate()
924 rate->bw = ucode_rate & RATE_MCS_CHAN_WIDTH_MSK; in rs_rate_from_ucode_rate()
931 rate->type = LQ_HT_SISO; in rs_rate_from_ucode_rate()
932 WARN_ONCE(!rate->stbc && !rate->bfer && num_of_ant != 1, in rs_rate_from_ucode_rate()
934 rate->stbc, rate->bfer); in rs_rate_from_ucode_rate()
936 rate->type = LQ_HT_MIMO2; in rs_rate_from_ucode_rate()
946 rate->type = LQ_VHT_SISO; in rs_rate_from_ucode_rate()
947 WARN_ONCE(!rate->stbc && !rate->bfer && num_of_ant != 1, in rs_rate_from_ucode_rate()
949 rate->stbc, rate->bfer); in rs_rate_from_ucode_rate()
951 rate->type = LQ_VHT_MIMO2; in rs_rate_from_ucode_rate()
961 rate->type = LQ_HE_SISO; in rs_rate_from_ucode_rate()
962 WARN_ONCE(!rate->stbc && !rate->bfer && num_of_ant != 1, in rs_rate_from_ucode_rate()
963 "stbc %d bfer %d", rate->stbc, rate->bfer); in rs_rate_from_ucode_rate()
965 rate->type = LQ_HE_MIMO2; in rs_rate_from_ucode_rate()
972 WARN_ON_ONCE(rate->bw == RATE_MCS_CHAN_WIDTH_80 && in rs_rate_from_ucode_rate()
973 !is_he(rate) && !is_vht(rate)); in rs_rate_from_ucode_rate()
980 static int rs_toggle_antenna(u32 valid_ant, struct rs_rate *rate) in rs_toggle_antenna() argument
984 if (!rate->ant || WARN_ON_ONCE(rate->ant & ANT_C)) in rs_toggle_antenna()
987 if (!rs_is_valid_ant(valid_ant, rate->ant)) in rs_toggle_antenna()
990 new_ant_type = ant_toggle_lookup[rate->ant]; in rs_toggle_antenna()
992 while ((new_ant_type != rate->ant) && in rs_toggle_antenna()
996 if (new_ant_type == rate->ant) in rs_toggle_antenna()
999 rate->ant = new_ant_type; in rs_toggle_antenna()
1005 struct rs_rate *rate) in rs_get_supported_rates() argument
1007 if (is_legacy(rate)) in rs_get_supported_rates()
1009 else if (is_siso(rate)) in rs_get_supported_rates()
1011 else if (is_mimo2(rate)) in rs_get_supported_rates()
1024 /* 802.11A or ht walks to the next literal adjacent rate in in rs_get_adjacent_rate()
1025 * the rate table */ in rs_get_adjacent_rate()
1030 /* Find the previous rate that is in the rate mask */ in rs_get_adjacent_rate()
1041 /* Find the next rate that is in the rate mask */ in rs_get_adjacent_rate()
1075 struct rs_rate *rate) in rs_rate_supported() argument
1077 return BIT(rate->index) & rs_get_supported_rates(lq_sta, rate); in rs_rate_supported()
1080 /* Get the next supported lower rate in the current column.
1081 * Return true if bottom rate in the current column was reached
1084 struct rs_rate *rate) in rs_get_lower_rate_in_column() argument
1091 rate_mask = rs_get_supported_rates(lq_sta, rate); in rs_get_lower_rate_in_column()
1092 high_low = rs_get_adjacent_rate(mvm, rate->index, rate_mask, in rs_get_lower_rate_in_column()
1093 rate->type); in rs_get_lower_rate_in_column()
1096 /* Bottom rate of column reached */ in rs_get_lower_rate_in_column()
1100 rate->index = low; in rs_get_lower_rate_in_column()
1104 /* Get the next rate to use following a column downgrade */
1106 struct rs_rate *rate) in rs_get_lower_rate_down_column() argument
1110 if (is_legacy(rate)) { in rs_get_lower_rate_down_column()
1113 } else if (is_siso(rate)) { in rs_get_lower_rate_down_column()
1116 rate->type = LQ_LEGACY_A; in rs_get_lower_rate_down_column()
1118 rate->type = LQ_LEGACY_G; in rs_get_lower_rate_down_column()
1120 rate->bw = RATE_MCS_CHAN_WIDTH_20; in rs_get_lower_rate_down_column()
1122 WARN_ON_ONCE(rate->index < IWL_RATE_MCS_0_INDEX || in rs_get_lower_rate_down_column()
1123 rate->index > IWL_RATE_MCS_9_INDEX); in rs_get_lower_rate_down_column()
1125 rate->index = rs_ht_to_legacy[rate->index]; in rs_get_lower_rate_down_column()
1126 rate->ldpc = false; in rs_get_lower_rate_down_column()
1129 rate->type = is_vht_mimo2(rate) ? in rs_get_lower_rate_down_column()
1133 if (num_of_ant(rate->ant) > 1) in rs_get_lower_rate_down_column()
1134 rate->ant = first_antenna(iwl_mvm_get_valid_tx_ant(mvm)); in rs_get_lower_rate_down_column()
1137 rate->sgi = false; in rs_get_lower_rate_down_column()
1139 if (!rs_rate_supported(lq_sta, rate)) in rs_get_lower_rate_down_column()
1140 rs_get_lower_rate_in_column(lq_sta, rate); in rs_get_lower_rate_down_column()
1158 static inline enum rs_column rs_get_column_from_rate(struct rs_rate *rate) in rs_get_column_from_rate() argument
1160 if (is_legacy(rate)) { in rs_get_column_from_rate()
1161 if (rate->ant == ANT_A) in rs_get_column_from_rate()
1164 if (rate->ant == ANT_B) in rs_get_column_from_rate()
1170 if (is_siso(rate)) { in rs_get_column_from_rate()
1171 if (rate->ant == ANT_A || rate->stbc || rate->bfer) in rs_get_column_from_rate()
1172 return rate->sgi ? RS_COLUMN_SISO_ANT_A_SGI : in rs_get_column_from_rate()
1175 if (rate->ant == ANT_B) in rs_get_column_from_rate()
1176 return rate->sgi ? RS_COLUMN_SISO_ANT_B_SGI : in rs_get_column_from_rate()
1182 if (is_mimo(rate)) in rs_get_column_from_rate()
1183 return rate->sgi ? RS_COLUMN_MIMO2_SGI : RS_COLUMN_MIMO2; in rs_get_column_from_rate()
1353 struct rs_rate *rate = &tbl->rate; in rs_set_expected_tpt_table() local
1356 tbl->expected_tpt = rs_get_expected_tpt_table(lq_sta, column, rate->bw); in rs_set_expected_tpt_table()
1388 "SR %d high. Find rate exceeding EXPECTED_CURRENT %d\n", in rs_get_best_rate()
1393 "SR %d not that good. Find rate exceeding ACTUAL_TPT %d\n", in rs_get_best_rate()
1404 tbl->rate.type); in rs_get_best_rate()
1409 IWL_DEBUG_RATE(mvm, "Best rate found %d target_tp %d expected_new %d\n", in rs_get_best_rate()
1510 * history bitmaps and rate-specific stats for all rates in in rs_stay_in_table()
1547 if ((!is_vht(&tbl->rate) && !is_ht(&tbl->rate)) || in rs_set_amsdu_len()
1548 tbl->rate.index < IWL_RATE_MCS_5_INDEX || in rs_set_amsdu_len()
1576 * setup rate table in uCode
1583 rs_fill_lq_cmd(mvm, sta, lq_sta, &tbl->rate); in rs_update_rate_tbl()
1596 if (!is_vht_siso(&tbl->rate)) in rs_tweak_rate_tbl()
1599 if ((tbl->rate.bw == RATE_MCS_CHAN_WIDTH_80) && in rs_tweak_rate_tbl()
1600 (tbl->rate.index == IWL_RATE_MCS_0_INDEX) && in rs_tweak_rate_tbl()
1602 tbl->rate.bw = RATE_MCS_CHAN_WIDTH_20; in rs_tweak_rate_tbl()
1603 tbl->rate.index = IWL_RATE_MCS_4_INDEX; in rs_tweak_rate_tbl()
1611 * to 20Mhz MCS4 because the rate stats are cleared. in rs_tweak_rate_tbl()
1613 if ((tbl->rate.bw == RATE_MCS_CHAN_WIDTH_20) && in rs_tweak_rate_tbl()
1614 (((tbl->rate.index == IWL_RATE_MCS_5_INDEX) && in rs_tweak_rate_tbl()
1616 ((tbl->rate.index > IWL_RATE_MCS_5_INDEX) && in rs_tweak_rate_tbl()
1618 tbl->rate.bw = RATE_MCS_CHAN_WIDTH_80; in rs_tweak_rate_tbl()
1619 tbl->rate.index = IWL_RATE_MCS_1_INDEX; in rs_tweak_rate_tbl()
1669 if (allow_func && !allow_func(mvm, sta, &tbl->rate, in rs_get_next_column()
1691 "Skip column %d: no rate is allowed in this column\n", in rs_get_next_column()
1724 struct rs_rate *rate = &search_tbl->rate; in rs_switch_to_column() local
1732 rate->sgi = column->sgi; in rs_switch_to_column()
1733 rate->ant = column->ant; in rs_switch_to_column()
1737 rate->type = LQ_LEGACY_A; in rs_switch_to_column()
1739 rate->type = LQ_LEGACY_G; in rs_switch_to_column()
1741 rate->bw = RATE_MCS_CHAN_WIDTH_20; in rs_switch_to_column()
1742 rate->ldpc = false; in rs_switch_to_column()
1745 rate->type = lq_sta->is_vht ? LQ_VHT_SISO : LQ_HT_SISO; in rs_switch_to_column()
1748 rate->type = lq_sta->is_vht ? LQ_VHT_MIMO2 : LQ_HT_MIMO2; in rs_switch_to_column()
1755 rate->bw = rs_bw_from_sta_bw(sta); in rs_switch_to_column()
1756 rate->ldpc = lq_sta->ldpc; in rs_switch_to_column()
1764 /* Get the best matching rate if we're changing modes. e.g. in rs_switch_to_column()
1769 rate_mask, rate->index); in rs_switch_to_column()
1775 " rate mask %lx\n", in rs_switch_to_column()
1781 rate->index = rate_idx; in rs_switch_to_column()
1785 col_id, rate->index); in rs_switch_to_column()
1790 rate->type = LQ_NONE; in rs_switch_to_column()
1805 "Decrease rate because of low SR\n"); in rs_get_rate_action()
1813 "No data about high/low rates. Increase rate\n"); in rs_get_rate_action()
1822 "No data about high rate and low rate is worse. Increase rate\n"); in rs_get_rate_action()
1829 "Higher rate is better. Increate rate\n"); in rs_get_rate_action()
1838 "Both high and low are worse. Maintain rate\n"); in rs_get_rate_action()
1845 "Lower rate is better\n"); in rs_get_rate_action()
1853 "No data about lower rate\n"); in rs_get_rate_action()
1858 IWL_DEBUG_RATE(mvm, "Maintain rate\n"); in rs_get_rate_action()
1868 "Current TPT is higher than max expected in low rate. Avoid downscale\n"); in rs_get_rate_action()
1871 IWL_DEBUG_RATE(mvm, "Decrease rate\n"); in rs_get_rate_action()
1906 struct rs_rate *rate, enum nl80211_band band) in rs_tpc_allowed() argument
1908 int index = rate->index; in rs_tpc_allowed()
1923 IWL_DEBUG_RATE(mvm, "check rate, table type: %d\n", rate->type); in rs_tpc_allowed()
1924 if (is_legacy(rate)) in rs_tpc_allowed()
1926 if (is_ht(rate)) in rs_tpc_allowed()
1928 if (is_vht(rate)) in rs_tpc_allowed()
2012 struct rs_rate *rate = &tbl->rate; in rs_tpc_perform() local
2037 if (!rs_tpc_allowed(mvm, vif, rate, band)) { in rs_tpc_perform()
2092 * Do rate scaling and search for new modulation mode.
2117 struct rs_rate *rate; in rs_rate_scale_perform() local
2122 * Select rate-scale / modulation-mode table to work with in in rs_rate_scale_perform()
2124 * modulation mode, or "active" if doing rate scaling within a mode. in rs_rate_scale_perform()
2132 rate = &tbl->rate; in rs_rate_scale_perform()
2142 /* current tx rate */ in rs_rate_scale_perform()
2143 index = rate->index; in rs_rate_scale_perform()
2146 rate_mask = rs_get_supported_rates(lq_sta, rate); in rs_rate_scale_perform()
2149 IWL_ERR(mvm, "Current Rate is not valid\n"); in rs_rate_scale_perform()
2152 rate->type = LQ_NONE; in rs_rate_scale_perform()
2160 /* Get expected throughput table and history window for current rate */ in rs_rate_scale_perform()
2172 * changing rate or mode (bypass most of the rest of this function). in rs_rate_scale_perform()
2173 * Set up new rate table in uCode only if old rate is not supported in rs_rate_scale_perform()
2174 * in current association (use new rate found above). in rs_rate_scale_perform()
2181 rs_pretty_rate(rate), in rs_rate_scale_perform()
2220 rate->type = LQ_NONE; in rs_rate_scale_perform()
2226 /* Revert to "active" rate and throughput info */ in rs_rate_scale_perform()
2227 index = tbl->rate.index; in rs_rate_scale_perform()
2230 /* Need to set up a new rate table in uCode */ in rs_rate_scale_perform()
2235 * search is done, allow rate adjustment next time. */ in rs_rate_scale_perform()
2242 * starting rate, while staying in this mode. */ in rs_rate_scale_perform()
2243 high_low = rs_get_adjacent_rate(mvm, index, rate_mask, rate->type); in rs_rate_scale_perform()
2260 rs_pretty_rate(rate), current_tpt, sr, in rs_rate_scale_perform()
2267 if (is_mimo(rate) && in rs_rate_scale_perform()
2277 /* Decrease starting rate, update uCode's rate table */ in rs_rate_scale_perform()
2283 "At the bottom rate. Can't decrease\n"); in rs_rate_scale_perform()
2288 /* Increase starting rate, update uCode's rate table */ in rs_rate_scale_perform()
2294 "At the top rate. Can't increase\n"); in rs_rate_scale_perform()
2308 /* Replace uCode's rate table for the destination station. */ in rs_rate_scale_perform()
2310 tbl->rate.index = index; in rs_rate_scale_perform()
2356 /* Use new "search" start rate */ in rs_rate_scale_perform()
2357 index = tbl->rate.index; in rs_rate_scale_perform()
2359 rs_dump_rate(mvm, &tbl->rate, in rs_rate_scale_perform()
2372 rs_set_stay_in_table(mvm, is_legacy(&tbl1->rate), lq_sta); in rs_rate_scale_perform()
2446 /* Init the optimal rate based on STA caps
2447 * This combined with rssi is used to report the last tx rate
2454 struct rs_rate *rate = &lq_sta->optimal_rate; in rs_init_optimal_rate() local
2457 rate->type = lq_sta->is_vht ? LQ_VHT_MIMO2 : LQ_HT_MIMO2; in rs_init_optimal_rate()
2459 rate->type = lq_sta->is_vht ? LQ_VHT_SISO : LQ_HT_SISO; in rs_init_optimal_rate()
2461 rate->type = LQ_LEGACY_A; in rs_init_optimal_rate()
2463 rate->type = LQ_LEGACY_G; in rs_init_optimal_rate()
2465 rate->bw = rs_bw_from_sta_bw(sta); in rs_init_optimal_rate()
2466 rate->sgi = rs_sgi_allow(mvm, sta, rate, NULL); in rs_init_optimal_rate()
2468 /* ANT/LDPC/STBC aren't relevant for the rate reported to userspace */ in rs_init_optimal_rate()
2470 if (is_mimo(rate)) { in rs_init_optimal_rate()
2472 } else if (is_siso(rate)) { in rs_init_optimal_rate()
2488 if (is_vht(rate)) { in rs_init_optimal_rate()
2489 if (rate->bw == RATE_MCS_CHAN_WIDTH_20) { in rs_init_optimal_rate()
2498 } else if (is_ht(rate)) { in rs_init_optimal_rate()
2504 /* Compute the optimal rate index based on RSSI */
2508 struct rs_rate *rate = &lq_sta->optimal_rate; in rs_get_optimal_rate() local
2511 rate->index = find_first_bit(&lq_sta->optimal_rate_mask, in rs_get_optimal_rate()
2519 rate->index = rate_idx; in rs_get_optimal_rate()
2524 return rate; in rs_get_optimal_rate()
2527 /* Choose an initial legacy rate and antenna to use based on the RSSI
2534 struct rs_rate *rate) in rs_get_initial_rate() argument
2558 rate->ant = first_antenna(valid_tx_ant); in rs_get_initial_rate()
2560 rate->ant = best_ant; in rs_get_initial_rate()
2562 rate->sgi = false; in rs_get_initial_rate()
2563 rate->ldpc = false; in rs_get_initial_rate()
2564 rate->bw = RATE_MCS_CHAN_WIDTH_20; in rs_get_initial_rate()
2566 rate->index = find_first_bit(&lq_sta->active_legacy_rate, in rs_get_initial_rate()
2570 rate->type = LQ_LEGACY_A; in rs_get_initial_rate()
2574 rate->type = LQ_LEGACY_G; in rs_get_initial_rate()
2582 /* Start from a higher rate if the corresponding debug capability in rs_get_initial_rate()
2583 * is enabled. The rate is chosen according to AP capabilities. in rs_get_initial_rate()
2595 * bandwidth rate, and after authorization, when the phy context in rs_get_initial_rate()
2618 rate->type = LQ_VHT_SISO; in rs_get_initial_rate()
2619 rate->bw = bw; in rs_get_initial_rate()
2625 rate->type = LQ_HT_SISO; in rs_get_initial_rate()
2635 rate->index = rate_idx; in rs_get_initial_rate()
2641 rs_dump_rate(mvm, rate, "INITIAL"); in rs_get_initial_rate()
2668 * rs_initialize_lq - Initialize a station's hardware rate table
2674 * if the driver's iwl-agn-rs rate scaling algorithm is used, instead of
2687 struct rs_rate *rate; in rs_initialize_lq() local
2699 rate = &tbl->rate; in rs_initialize_lq()
2701 rs_get_initial_rate(mvm, sta, lq_sta, band, rate); in rs_initialize_lq()
2704 WARN_ONCE(rate->ant != ANT_A && rate->ant != ANT_B, in rs_initialize_lq()
2706 rate->ant, lq_sta->pers.chains, mvm->fw->valid_tx_ant, in rs_initialize_lq()
2709 tbl->column = rs_get_column_from_rate(rate); in rs_initialize_lq()
2712 rs_fill_lq_cmd(mvm, sta, lq_sta, rate); in rs_initialize_lq()
2745 /* Report the optimal rate based on rssi and STA caps if we haven't in rs_drv_get_rate()
2765 IWL_DEBUG_RATE(mvm, "create station rate scale window\n"); in rs_drv_alloc_sta()
2901 void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg) in iwl_mvm_update_frame_stats() argument
2912 switch (rate & RATE_MCS_CHAN_WIDTH_MSK) { in iwl_mvm_update_frame_stats()
2926 WARN_ONCE(1, "bad BW. rate 0x%x", rate); in iwl_mvm_update_frame_stats()
2929 if (rate & RATE_MCS_HT_MSK) { in iwl_mvm_update_frame_stats()
2931 nss = ((rate & RATE_HT_MCS_NSS_MSK) >> RATE_HT_MCS_NSS_POS) + 1; in iwl_mvm_update_frame_stats()
2932 } else if (rate & RATE_MCS_VHT_MSK) { in iwl_mvm_update_frame_stats()
2934 nss = ((rate & RATE_VHT_MCS_NSS_MSK) >> in iwl_mvm_update_frame_stats()
2945 if (rate & RATE_MCS_SGI_MSK) in iwl_mvm_update_frame_stats()
2950 mvm->drv_rx_stats.last_rates[mvm->drv_rx_stats.last_frame_idx] = rate; in iwl_mvm_update_frame_stats()
2960 * Called after adding a new station to initialize rate scaling
2992 "LQ: *** rate scale station global init for station %d ***\n", in rs_drv_rate_init()
2994 /* TODO: what is a good starting rate for STA? About middle? Maybe not in rs_drv_rate_init()
2995 * the lowest or the highest rate.. Could consider using RSSI from in rs_drv_rate_init()
3029 IWL_DEBUG_RATE(mvm, "MAX RATE: LEGACY=%d SISO=%d MIMO2=%d\n", in rs_drv_rate_init()
3088 IWL_DEBUG_RATE(mvm, "Rate scaling not initialized yet.\n"); in __iwl_mvm_rs_tx_status()
3104 /* Disable last tx check if we are debugging with fixed rate but in __iwl_mvm_rs_tx_status()
3114 "Can't map rate 0x%x to column", in __iwl_mvm_rs_tx_status()
3129 IWL_DEBUG_RATE(mvm, "Fixed rate 0x%x success %d attempts %d\n", in __iwl_mvm_rs_tx_status()
3147 /* Ignore this Tx frame response if its initial rate doesn't match in __iwl_mvm_rs_tx_status()
3161 /* Here we actually compare this rate to the latest LQ command */ in __iwl_mvm_rs_tx_status()
3179 /* Regardless, ignore this status info for outdated rate */ in __iwl_mvm_rs_tx_status()
3183 /* Rate did match, so reset the missed_rate_counter */ in __iwl_mvm_rs_tx_status()
3194 if (WARN_ON_ONCE(!rs_rate_column_match(&lq_rate, &curr_tbl->rate))) { in __iwl_mvm_rs_tx_status()
3196 "Neither active nor search matches tx rate\n"); in __iwl_mvm_rs_tx_status()
3198 rs_dump_rate(mvm, &tmp_tbl->rate, "ACTIVE"); in __iwl_mvm_rs_tx_status()
3200 rs_dump_rate(mvm, &tmp_tbl->rate, "SEARCH"); in __iwl_mvm_rs_tx_status()
3204 * and continue to perform rate scale to find the rate table in __iwl_mvm_rs_tx_status()
3213 * For aggregation, all packets were transmitted at the same rate, the in __iwl_mvm_rs_tx_status()
3214 * first index into rate scale table. in __iwl_mvm_rs_tx_status()
3229 * zero power reduction. When FW transmits agg with a rate in __iwl_mvm_rs_tx_status()
3230 * different from the initial rate, it will not use reduced txp in __iwl_mvm_rs_tx_status()
3257 /* Collect data for each rate used during failed TX attempts */ in __iwl_mvm_rs_tx_status()
3266 /* Only collect stats if retried rate is in the same RS in __iwl_mvm_rs_tx_status()
3269 if (rs_rate_column_match(&lq_rate, &curr_tbl->rate)) in __iwl_mvm_rs_tx_status()
3272 &other_tbl->rate)) in __iwl_mvm_rs_tx_status()
3292 /* The last TX rate is cached in lq_sta; it's set in if/else above */ in __iwl_mvm_rs_tx_status()
3296 /* See if there's a better rate or modulation mode to try. */ in __iwl_mvm_rs_tx_status()
3322 struct rs_rate rate; in rs_build_rates_table_from_fixed() local
3331 if (rs_rate_from_ucode_rate(ucode_rate, band, &rate)) { in rs_build_rates_table_from_fixed()
3336 if (is_mimo(&rate)) in rs_build_rates_table_from_fixed()
3356 struct rs_rate *rate, in rs_fill_rates_for_column() argument
3364 int prev_rate_idx = rate->index; in rs_fill_rates_for_column()
3371 rate)); in rs_fill_rates_for_column()
3374 rs_toggle_antenna(valid_tx_ant, rate); in rs_fill_rates_for_column()
3377 prev_rate_idx = rate->index; in rs_fill_rates_for_column()
3378 bottom_reached = rs_get_lower_rate_in_column(lq_sta, rate); in rs_fill_rates_for_column()
3379 if (bottom_reached && !is_legacy(rate)) in rs_fill_rates_for_column()
3383 if (!bottom_reached && !is_legacy(rate)) in rs_fill_rates_for_column()
3384 rate->index = prev_rate_idx; in rs_fill_rates_for_column()
3389 /* Building the rate table is non trivial. When we're in MIMO2/VHT/80Mhz/SGI
3390 * column the rate table should look like this:
3392 * rate[0] 0x400F019 VHT | ANT: AB BW: 80Mhz MCS: 9 NSS: 2 SGI
3393 * rate[1] 0x400F019 VHT | ANT: AB BW: 80Mhz MCS: 9 NSS: 2 SGI
3394 * rate[2] 0x400F018 VHT | ANT: AB BW: 80Mhz MCS: 8 NSS: 2 SGI
3395 * rate[3] 0x400F018 VHT | ANT: AB BW: 80Mhz MCS: 8 NSS: 2 SGI
3396 * rate[4] 0x400F017 VHT | ANT: AB BW: 80Mhz MCS: 7 NSS: 2 SGI
3397 * rate[5] 0x400F017 VHT | ANT: AB BW: 80Mhz MCS: 7 NSS: 2 SGI
3398 * rate[6] 0x4005007 VHT | ANT: A BW: 80Mhz MCS: 7 NSS: 1 NGI
3399 * rate[7] 0x4009006 VHT | ANT: B BW: 80Mhz MCS: 6 NSS: 1 NGI
3400 * rate[8] 0x4005005 VHT | ANT: A BW: 80Mhz MCS: 5 NSS: 1 NGI
3401 * rate[9] 0x800B Legacy | ANT: B Rate: 36 Mbps
3402 * rate[10] 0x4009 Legacy | ANT: A Rate: 24 Mbps
3403 * rate[11] 0x8007 Legacy | ANT: B Rate: 18 Mbps
3404 * rate[12] 0x4005 Legacy | ANT: A Rate: 12 Mbps
3405 * rate[13] 0x800F Legacy | ANT: B Rate: 9 Mbps
3406 * rate[14] 0x400D Legacy | ANT: A Rate: 6 Mbps
3407 * rate[15] 0x800D Legacy | ANT: B Rate: 6 Mbps
3414 struct rs_rate rate; in rs_build_rates_table() local
3421 memcpy(&rate, initial_rate, sizeof(rate)); in rs_build_rates_table()
3428 rate.stbc = true; in rs_build_rates_table()
3430 if (is_siso(&rate)) { in rs_build_rates_table()
3433 } else if (is_mimo(&rate)) { in rs_build_rates_table()
3442 rs_fill_rates_for_column(mvm, lq_sta, &rate, lq_cmd->rs_table, &index, in rs_build_rates_table()
3446 rs_get_lower_rate_down_column(lq_sta, &rate); in rs_build_rates_table()
3448 if (is_siso(&rate)) { in rs_build_rates_table()
3452 } else if (is_legacy(&rate)) { in rs_build_rates_table()
3461 rs_fill_rates_for_column(mvm, lq_sta, &rate, lq_cmd->rs_table, &index, in rs_build_rates_table()
3465 rs_get_lower_rate_down_column(lq_sta, &rate); in rs_build_rates_table()
3470 rs_fill_rates_for_column(mvm, lq_sta, &rate, lq_cmd->rs_table, &index, in rs_build_rates_table()
3676 /* rate scale requires free function to be implemented */
3691 int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate) in rs_pretty_print_rate() argument
3696 u8 ant = (rate & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS; in rs_pretty_print_rate()
3698 if (!(rate & RATE_MCS_HT_MSK) && in rs_pretty_print_rate()
3699 !(rate & RATE_MCS_VHT_MSK) && in rs_pretty_print_rate()
3700 !(rate & RATE_MCS_HE_MSK)) { in rs_pretty_print_rate()
3701 int index = iwl_hwrate_to_plcp_idx(rate); in rs_pretty_print_rate()
3703 return scnprintf(buf, bufsz, "Legacy | ANT: %s Rate: %s Mbps", in rs_pretty_print_rate()
3709 if (rate & RATE_MCS_VHT_MSK) { in rs_pretty_print_rate()
3711 mcs = rate & RATE_VHT_MCS_RATE_CODE_MSK; in rs_pretty_print_rate()
3712 nss = ((rate & RATE_VHT_MCS_NSS_MSK) in rs_pretty_print_rate()
3714 } else if (rate & RATE_MCS_HT_MSK) { in rs_pretty_print_rate()
3716 mcs = rate & RATE_HT_MCS_INDEX_MSK; in rs_pretty_print_rate()
3717 nss = ((rate & RATE_HT_MCS_NSS_MSK) in rs_pretty_print_rate()
3719 } else if (rate & RATE_MCS_HE_MSK) { in rs_pretty_print_rate()
3721 mcs = rate & RATE_VHT_MCS_RATE_CODE_MSK; in rs_pretty_print_rate()
3722 nss = ((rate & RATE_VHT_MCS_NSS_MSK) in rs_pretty_print_rate()
3728 switch (rate & RATE_MCS_CHAN_WIDTH_MSK) { in rs_pretty_print_rate()
3747 rate, type, rs_pretty_ant(ant), bw, mcs, nss, in rs_pretty_print_rate()
3748 (rate & RATE_MCS_SGI_MSK) ? "SGI " : "NGI ", in rs_pretty_print_rate()
3749 (rate & RATE_MCS_STBC_MSK) ? "STBC " : "", in rs_pretty_print_rate()
3750 (rate & RATE_MCS_LDPC_MSK) ? "LDPC " : "", in rs_pretty_print_rate()
3751 (rate & RATE_HE_DUAL_CARRIER_MODE_MSK) ? "DCM " : "", in rs_pretty_print_rate()
3752 (rate & RATE_MCS_BF_MSK) ? "BF " : ""); in rs_pretty_print_rate()
3757 * Program the device to use fixed rate for frame transmit
3759 * once the device start use fixed rate, we need to reload the module
3769 IWL_DEBUG_RATE(mvm, "sta_id %d rate 0x%X\n", in rs_program_fix_rate()
3817 struct rs_rate *rate = &tbl->rate; in rs_sta_dbgfs_scale_table_read() local
3828 "failed=%d success=%d rate=0%lX\n", in rs_sta_dbgfs_scale_table_read()
3831 desc += scnprintf(buff + desc, bufsz - desc, "fixed rate 0x%X\n", in rs_sta_dbgfs_scale_table_read()
3838 (is_legacy(rate)) ? "legacy" : in rs_sta_dbgfs_scale_table_read()
3839 is_vht(rate) ? "VHT" : "HT"); in rs_sta_dbgfs_scale_table_read()
3840 if (!is_legacy(rate)) { in rs_sta_dbgfs_scale_table_read()
3842 (is_siso(rate)) ? "SISO" : "MIMO2"); in rs_sta_dbgfs_scale_table_read()
3844 (is_ht20(rate)) ? "20MHz" : in rs_sta_dbgfs_scale_table_read()
3845 (is_ht40(rate)) ? "40MHz" : in rs_sta_dbgfs_scale_table_read()
3846 (is_ht80(rate)) ? "80MHz" : in rs_sta_dbgfs_scale_table_read()
3847 (is_ht160(rate)) ? "160MHz" : "BAD BW"); in rs_sta_dbgfs_scale_table_read()
3849 (rate->sgi) ? "SGI" : "NGI", in rs_sta_dbgfs_scale_table_read()
3850 (rate->ldpc) ? "LDPC" : "BCC", in rs_sta_dbgfs_scale_table_read()
3854 desc += scnprintf(buff + desc, bufsz - desc, "last tx rate=0x%X\n", in rs_sta_dbgfs_scale_table_read()
3893 " rate[%d] 0x%X ", i, r); in rs_sta_dbgfs_scale_table_read()
3918 struct rs_rate *rate; in rs_sta_dbgfs_stats_table_read() local
3927 rate = &tbl->rate; in rs_sta_dbgfs_stats_table_read()
3932 rate->type, in rs_sta_dbgfs_stats_table_read()
3933 rate->sgi, in rs_sta_dbgfs_stats_table_read()
3934 is_ht20(rate) ? "20MHz" : in rs_sta_dbgfs_stats_table_read()
3935 is_ht40(rate) ? "40MHz" : in rs_sta_dbgfs_stats_table_read()
3936 is_ht80(rate) ? "80MHz" : in rs_sta_dbgfs_stats_table_read()
3937 is_ht160(rate) ? "160MHz" : "ERR", in rs_sta_dbgfs_stats_table_read()
3938 rate->index); in rs_sta_dbgfs_stats_table_read()
3994 int col, rate; in rs_sta_dbgfs_drv_tx_stats_read() local
4008 for (rate = 0; rate < IWL_RATE_COUNT; rate++) in rs_sta_dbgfs_drv_tx_stats_read()
4009 pos += scnprintf(pos, endpos - pos, "%s,", rate_name[rate]); in rs_sta_dbgfs_drv_tx_stats_read()
4016 for (rate = 0; rate < IWL_RATE_COUNT; rate++) { in rs_sta_dbgfs_drv_tx_stats_read()
4017 stats = &(lq_sta->pers.tx_stats[col][rate]); in rs_sta_dbgfs_drv_tx_stats_read()
4137 * Initialization of rate scaling information is done by driver after
4148 /* ops for rate scaling implemented in the driver */