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()
521 static char *rs_pretty_rate(const struct rs_rate *rate) in rs_pretty_rate() argument
552 if (is_type_legacy(rate->type) && (rate->index <= IWL_RATE_54M_INDEX)) in rs_pretty_rate()
553 rate_str = legacy_rates[rate->index]; in rs_pretty_rate()
554 else if ((is_type_ht(rate->type) || is_type_vht(rate->type)) && in rs_pretty_rate()
555 (rate->index >= IWL_RATE_MCS_0_INDEX) && in rs_pretty_rate()
556 (rate->index <= IWL_RATE_MCS_9_INDEX)) in rs_pretty_rate()
557 rate_str = ht_vht_rates[rate->index]; in rs_pretty_rate()
561 sprintf(buf, "(%s|%s|%s)", rs_pretty_lq_type(rate->type), in rs_pretty_rate()
562 rs_pretty_ant(rate->ant), rate_str); in rs_pretty_rate()
566 static inline void rs_dump_rate(struct iwl_mvm *mvm, const struct rs_rate *rate, in rs_dump_rate() argument
571 prefix, rs_pretty_rate(rate), rate->bw, in rs_dump_rate()
572 rate->sgi, rate->ldpc, rate->stbc); in rs_dump_rate()
677 * at this rate. window->data contains the bitmask of successful
692 * Keep track of only the latest 62 tx frame attempts in this rate's in _rs_collect_tx_data()
810 /* Select window for current tx bit rate */ in rs_collect_tlc_data()
816 /* Convert rs_rate object into ucode rate bitmask */
818 struct rs_rate *rate) in ucode_rate_from_rs_rate() argument
821 int index = rate->index; in ucode_rate_from_rs_rate()
823 ucode_rate |= ((rate->ant << RATE_MCS_ANT_POS) & in ucode_rate_from_rs_rate()
826 if (is_legacy(rate)) { in ucode_rate_from_rs_rate()
839 if (is_ht(rate)) { in ucode_rate_from_rs_rate()
841 IWL_ERR(mvm, "Invalid HT rate index %d\n", index); in ucode_rate_from_rs_rate()
846 if (is_ht_siso(rate)) in ucode_rate_from_rs_rate()
848 else if (is_ht_mimo2(rate)) in ucode_rate_from_rs_rate()
852 } else if (is_vht(rate)) { in ucode_rate_from_rs_rate()
854 IWL_ERR(mvm, "Invalid VHT rate index %d\n", index); in ucode_rate_from_rs_rate()
858 if (is_vht_siso(rate)) in ucode_rate_from_rs_rate()
860 else if (is_vht_mimo2(rate)) in ucode_rate_from_rs_rate()
866 IWL_ERR(mvm, "Invalid rate->type %d\n", rate->type); in ucode_rate_from_rs_rate()
869 if (is_siso(rate) && rate->stbc) { in ucode_rate_from_rs_rate()
875 ucode_rate |= rate->bw; in ucode_rate_from_rs_rate()
876 if (rate->sgi) in ucode_rate_from_rs_rate()
878 if (rate->ldpc) in ucode_rate_from_rs_rate()
884 /* Convert a ucode rate into an rs_rate object */
887 struct rs_rate *rate) in rs_rate_from_ucode_rate() argument
893 memset(rate, 0, sizeof(*rate)); in rs_rate_from_ucode_rate()
894 rate->index = iwl_hwrate_to_plcp_idx(ucode_rate); in rs_rate_from_ucode_rate()
896 if (rate->index == IWL_RATE_INVALID) in rs_rate_from_ucode_rate()
899 rate->ant = (ant_msk >> RATE_MCS_ANT_POS); in rs_rate_from_ucode_rate()
907 rate->type = LQ_LEGACY_A; in rs_rate_from_ucode_rate()
909 rate->type = LQ_LEGACY_G; in rs_rate_from_ucode_rate()
917 rate->sgi = true; in rs_rate_from_ucode_rate()
919 rate->ldpc = true; in rs_rate_from_ucode_rate()
921 rate->stbc = true; in rs_rate_from_ucode_rate()
923 rate->bfer = true; in rs_rate_from_ucode_rate()
925 rate->bw = ucode_rate & RATE_MCS_CHAN_WIDTH_MSK; in rs_rate_from_ucode_rate()
932 rate->type = LQ_HT_SISO; in rs_rate_from_ucode_rate()
933 WARN_ONCE(!rate->stbc && !rate->bfer && num_of_ant != 1, in rs_rate_from_ucode_rate()
935 rate->stbc, rate->bfer); in rs_rate_from_ucode_rate()
937 rate->type = LQ_HT_MIMO2; in rs_rate_from_ucode_rate()
947 rate->type = LQ_VHT_SISO; in rs_rate_from_ucode_rate()
948 WARN_ONCE(!rate->stbc && !rate->bfer && num_of_ant != 1, in rs_rate_from_ucode_rate()
950 rate->stbc, rate->bfer); in rs_rate_from_ucode_rate()
952 rate->type = LQ_VHT_MIMO2; in rs_rate_from_ucode_rate()
962 rate->type = LQ_HE_SISO; in rs_rate_from_ucode_rate()
963 WARN_ONCE(!rate->stbc && !rate->bfer && num_of_ant != 1, in rs_rate_from_ucode_rate()
964 "stbc %d bfer %d", rate->stbc, rate->bfer); in rs_rate_from_ucode_rate()
966 rate->type = LQ_HE_MIMO2; in rs_rate_from_ucode_rate()
973 WARN_ON_ONCE(rate->bw == RATE_MCS_CHAN_WIDTH_80 && in rs_rate_from_ucode_rate()
974 !is_he(rate) && !is_vht(rate)); in rs_rate_from_ucode_rate()
981 static int rs_toggle_antenna(u32 valid_ant, struct rs_rate *rate) in rs_toggle_antenna() argument
985 if (!rate->ant || WARN_ON_ONCE(rate->ant & ANT_C)) in rs_toggle_antenna()
988 if (!rs_is_valid_ant(valid_ant, rate->ant)) in rs_toggle_antenna()
991 new_ant_type = ant_toggle_lookup[rate->ant]; in rs_toggle_antenna()
993 while ((new_ant_type != rate->ant) && in rs_toggle_antenna()
997 if (new_ant_type == rate->ant) in rs_toggle_antenna()
1000 rate->ant = new_ant_type; in rs_toggle_antenna()
1006 struct rs_rate *rate) in rs_get_supported_rates() argument
1008 if (is_legacy(rate)) in rs_get_supported_rates()
1010 else if (is_siso(rate)) in rs_get_supported_rates()
1012 else if (is_mimo2(rate)) in rs_get_supported_rates()
1025 /* 802.11A or ht walks to the next literal adjacent rate in in rs_get_adjacent_rate()
1026 * the rate table */ in rs_get_adjacent_rate()
1031 /* Find the previous rate that is in the rate mask */ in rs_get_adjacent_rate()
1042 /* Find the next rate that is in the rate mask */ in rs_get_adjacent_rate()
1076 struct rs_rate *rate) in rs_rate_supported() argument
1078 return BIT(rate->index) & rs_get_supported_rates(lq_sta, rate); in rs_rate_supported()
1081 /* Get the next supported lower rate in the current column.
1082 * Return true if bottom rate in the current column was reached
1085 struct rs_rate *rate) in rs_get_lower_rate_in_column() argument
1092 rate_mask = rs_get_supported_rates(lq_sta, rate); in rs_get_lower_rate_in_column()
1093 high_low = rs_get_adjacent_rate(mvm, rate->index, rate_mask, in rs_get_lower_rate_in_column()
1094 rate->type); in rs_get_lower_rate_in_column()
1097 /* Bottom rate of column reached */ in rs_get_lower_rate_in_column()
1101 rate->index = low; in rs_get_lower_rate_in_column()
1105 /* Get the next rate to use following a column downgrade */
1107 struct rs_rate *rate) in rs_get_lower_rate_down_column() argument
1111 if (is_legacy(rate)) { in rs_get_lower_rate_down_column()
1114 } else if (is_siso(rate)) { in rs_get_lower_rate_down_column()
1117 rate->type = LQ_LEGACY_A; in rs_get_lower_rate_down_column()
1119 rate->type = LQ_LEGACY_G; in rs_get_lower_rate_down_column()
1121 rate->bw = RATE_MCS_CHAN_WIDTH_20; in rs_get_lower_rate_down_column()
1123 WARN_ON_ONCE(rate->index < IWL_RATE_MCS_0_INDEX || in rs_get_lower_rate_down_column()
1124 rate->index > IWL_RATE_MCS_9_INDEX); in rs_get_lower_rate_down_column()
1126 rate->index = rs_ht_to_legacy[rate->index]; in rs_get_lower_rate_down_column()
1127 rate->ldpc = false; in rs_get_lower_rate_down_column()
1130 rate->type = is_vht_mimo2(rate) ? in rs_get_lower_rate_down_column()
1134 if (num_of_ant(rate->ant) > 1) in rs_get_lower_rate_down_column()
1135 rate->ant = first_antenna(iwl_mvm_get_valid_tx_ant(mvm)); in rs_get_lower_rate_down_column()
1138 rate->sgi = false; in rs_get_lower_rate_down_column()
1140 if (!rs_rate_supported(lq_sta, rate)) in rs_get_lower_rate_down_column()
1141 rs_get_lower_rate_in_column(lq_sta, rate); in rs_get_lower_rate_down_column()
1159 static inline enum rs_column rs_get_column_from_rate(struct rs_rate *rate) in rs_get_column_from_rate() argument
1161 if (is_legacy(rate)) { in rs_get_column_from_rate()
1162 if (rate->ant == ANT_A) in rs_get_column_from_rate()
1165 if (rate->ant == ANT_B) in rs_get_column_from_rate()
1171 if (is_siso(rate)) { in rs_get_column_from_rate()
1172 if (rate->ant == ANT_A || rate->stbc || rate->bfer) in rs_get_column_from_rate()
1173 return rate->sgi ? RS_COLUMN_SISO_ANT_A_SGI : in rs_get_column_from_rate()
1176 if (rate->ant == ANT_B) in rs_get_column_from_rate()
1177 return rate->sgi ? RS_COLUMN_SISO_ANT_B_SGI : in rs_get_column_from_rate()
1183 if (is_mimo(rate)) in rs_get_column_from_rate()
1184 return rate->sgi ? RS_COLUMN_MIMO2_SGI : RS_COLUMN_MIMO2; in rs_get_column_from_rate()
1354 struct rs_rate *rate = &tbl->rate; in rs_set_expected_tpt_table() local
1357 tbl->expected_tpt = rs_get_expected_tpt_table(lq_sta, column, rate->bw); in rs_set_expected_tpt_table()
1389 "SR %d high. Find rate exceeding EXPECTED_CURRENT %d\n", in rs_get_best_rate()
1394 "SR %d not that good. Find rate exceeding ACTUAL_TPT %d\n", in rs_get_best_rate()
1405 tbl->rate.type); in rs_get_best_rate()
1410 IWL_DEBUG_RATE(mvm, "Best rate found %d target_tp %d expected_new %d\n", in rs_get_best_rate()
1511 * history bitmaps and rate-specific stats for all rates in in rs_stay_in_table()
1548 if ((!is_vht(&tbl->rate) && !is_ht(&tbl->rate)) || in rs_set_amsdu_len()
1549 tbl->rate.index < IWL_RATE_MCS_5_INDEX || in rs_set_amsdu_len()
1577 * setup rate table in uCode
1584 rs_fill_lq_cmd(mvm, sta, lq_sta, &tbl->rate); in rs_update_rate_tbl()
1597 if (!is_vht_siso(&tbl->rate)) in rs_tweak_rate_tbl()
1600 if ((tbl->rate.bw == RATE_MCS_CHAN_WIDTH_80) && in rs_tweak_rate_tbl()
1601 (tbl->rate.index == IWL_RATE_MCS_0_INDEX) && in rs_tweak_rate_tbl()
1603 tbl->rate.bw = RATE_MCS_CHAN_WIDTH_20; in rs_tweak_rate_tbl()
1604 tbl->rate.index = IWL_RATE_MCS_4_INDEX; in rs_tweak_rate_tbl()
1612 * to 20Mhz MCS4 because the rate stats are cleared. in rs_tweak_rate_tbl()
1614 if ((tbl->rate.bw == RATE_MCS_CHAN_WIDTH_20) && in rs_tweak_rate_tbl()
1615 (((tbl->rate.index == IWL_RATE_MCS_5_INDEX) && in rs_tweak_rate_tbl()
1617 ((tbl->rate.index > IWL_RATE_MCS_5_INDEX) && in rs_tweak_rate_tbl()
1619 tbl->rate.bw = RATE_MCS_CHAN_WIDTH_80; in rs_tweak_rate_tbl()
1620 tbl->rate.index = IWL_RATE_MCS_1_INDEX; in rs_tweak_rate_tbl()
1670 if (allow_func && !allow_func(mvm, sta, &tbl->rate, in rs_get_next_column()
1692 "Skip column %d: no rate is allowed in this column\n", in rs_get_next_column()
1725 struct rs_rate *rate = &search_tbl->rate; in rs_switch_to_column() local
1733 rate->sgi = column->sgi; in rs_switch_to_column()
1734 rate->ant = column->ant; in rs_switch_to_column()
1738 rate->type = LQ_LEGACY_A; in rs_switch_to_column()
1740 rate->type = LQ_LEGACY_G; in rs_switch_to_column()
1742 rate->bw = RATE_MCS_CHAN_WIDTH_20; in rs_switch_to_column()
1743 rate->ldpc = false; in rs_switch_to_column()
1746 rate->type = lq_sta->is_vht ? LQ_VHT_SISO : LQ_HT_SISO; in rs_switch_to_column()
1749 rate->type = lq_sta->is_vht ? LQ_VHT_MIMO2 : LQ_HT_MIMO2; in rs_switch_to_column()
1756 rate->bw = rs_bw_from_sta_bw(sta); in rs_switch_to_column()
1757 rate->ldpc = lq_sta->ldpc; in rs_switch_to_column()
1765 /* Get the best matching rate if we're changing modes. e.g. in rs_switch_to_column()
1770 rate_mask, rate->index); in rs_switch_to_column()
1776 " rate mask %lx\n", in rs_switch_to_column()
1782 rate->index = rate_idx; in rs_switch_to_column()
1786 col_id, rate->index); in rs_switch_to_column()
1791 rate->type = LQ_NONE; in rs_switch_to_column()
1806 "Decrease rate because of low SR\n"); in rs_get_rate_action()
1814 "No data about high/low rates. Increase rate\n"); in rs_get_rate_action()
1823 "No data about high rate and low rate is worse. Increase rate\n"); in rs_get_rate_action()
1830 "Higher rate is better. Increate rate\n"); in rs_get_rate_action()
1839 "Both high and low are worse. Maintain rate\n"); in rs_get_rate_action()
1846 "Lower rate is better\n"); in rs_get_rate_action()
1854 "No data about lower rate\n"); in rs_get_rate_action()
1859 IWL_DEBUG_RATE(mvm, "Maintain rate\n"); in rs_get_rate_action()
1869 "Current TPT is higher than max expected in low rate. Avoid downscale\n"); in rs_get_rate_action()
1872 IWL_DEBUG_RATE(mvm, "Decrease rate\n"); in rs_get_rate_action()
1907 struct rs_rate *rate, enum nl80211_band band) in rs_tpc_allowed() argument
1909 int index = rate->index; in rs_tpc_allowed()
1924 IWL_DEBUG_RATE(mvm, "check rate, table type: %d\n", rate->type); in rs_tpc_allowed()
1925 if (is_legacy(rate)) in rs_tpc_allowed()
1927 if (is_ht(rate)) in rs_tpc_allowed()
1929 if (is_vht(rate)) in rs_tpc_allowed()
2015 struct rs_rate *rate = &tbl->rate; in rs_tpc_perform() local
2040 if (!rs_tpc_allowed(mvm, vif, rate, band)) { in rs_tpc_perform()
2095 * Do rate scaling and search for new modulation mode.
2120 struct rs_rate *rate; in rs_rate_scale_perform() local
2125 * Select rate-scale / modulation-mode table to work with in in rs_rate_scale_perform()
2127 * modulation mode, or "active" if doing rate scaling within a mode. in rs_rate_scale_perform()
2135 rate = &tbl->rate; in rs_rate_scale_perform()
2145 /* current tx rate */ in rs_rate_scale_perform()
2146 index = rate->index; in rs_rate_scale_perform()
2149 rate_mask = rs_get_supported_rates(lq_sta, rate); in rs_rate_scale_perform()
2152 IWL_ERR(mvm, "Current Rate is not valid\n"); in rs_rate_scale_perform()
2155 rate->type = LQ_NONE; in rs_rate_scale_perform()
2163 /* Get expected throughput table and history window for current rate */ in rs_rate_scale_perform()
2175 * changing rate or mode (bypass most of the rest of this function). in rs_rate_scale_perform()
2176 * Set up new rate table in uCode only if old rate is not supported in rs_rate_scale_perform()
2177 * in current association (use new rate found above). in rs_rate_scale_perform()
2184 rs_pretty_rate(rate), in rs_rate_scale_perform()
2223 rate->type = LQ_NONE; in rs_rate_scale_perform()
2229 /* Revert to "active" rate and throughput info */ in rs_rate_scale_perform()
2230 index = tbl->rate.index; in rs_rate_scale_perform()
2233 /* Need to set up a new rate table in uCode */ in rs_rate_scale_perform()
2238 * search is done, allow rate adjustment next time. */ in rs_rate_scale_perform()
2245 * starting rate, while staying in this mode. */ in rs_rate_scale_perform()
2246 high_low = rs_get_adjacent_rate(mvm, index, rate_mask, rate->type); in rs_rate_scale_perform()
2263 rs_pretty_rate(rate), current_tpt, sr, in rs_rate_scale_perform()
2270 if (is_mimo(rate) && in rs_rate_scale_perform()
2280 /* Decrease starting rate, update uCode's rate table */ in rs_rate_scale_perform()
2286 "At the bottom rate. Can't decrease\n"); in rs_rate_scale_perform()
2291 /* Increase starting rate, update uCode's rate table */ in rs_rate_scale_perform()
2297 "At the top rate. Can't increase\n"); in rs_rate_scale_perform()
2311 /* Replace uCode's rate table for the destination station. */ in rs_rate_scale_perform()
2313 tbl->rate.index = index; in rs_rate_scale_perform()
2359 /* Use new "search" start rate */ in rs_rate_scale_perform()
2360 index = tbl->rate.index; in rs_rate_scale_perform()
2362 rs_dump_rate(mvm, &tbl->rate, in rs_rate_scale_perform()
2375 rs_set_stay_in_table(mvm, is_legacy(&tbl1->rate), lq_sta); in rs_rate_scale_perform()
2449 /* Init the optimal rate based on STA caps
2450 * This combined with rssi is used to report the last tx rate
2457 struct rs_rate *rate = &lq_sta->optimal_rate; in rs_init_optimal_rate() local
2460 rate->type = lq_sta->is_vht ? LQ_VHT_MIMO2 : LQ_HT_MIMO2; in rs_init_optimal_rate()
2462 rate->type = lq_sta->is_vht ? LQ_VHT_SISO : LQ_HT_SISO; in rs_init_optimal_rate()
2464 rate->type = LQ_LEGACY_A; in rs_init_optimal_rate()
2466 rate->type = LQ_LEGACY_G; in rs_init_optimal_rate()
2468 rate->bw = rs_bw_from_sta_bw(sta); in rs_init_optimal_rate()
2469 rate->sgi = rs_sgi_allow(mvm, sta, rate, NULL); in rs_init_optimal_rate()
2471 /* ANT/LDPC/STBC aren't relevant for the rate reported to userspace */ in rs_init_optimal_rate()
2473 if (is_mimo(rate)) { in rs_init_optimal_rate()
2475 } else if (is_siso(rate)) { in rs_init_optimal_rate()
2491 if (is_vht(rate)) { in rs_init_optimal_rate()
2492 if (rate->bw == RATE_MCS_CHAN_WIDTH_20) { in rs_init_optimal_rate()
2501 } else if (is_ht(rate)) { in rs_init_optimal_rate()
2507 /* Compute the optimal rate index based on RSSI */
2511 struct rs_rate *rate = &lq_sta->optimal_rate; in rs_get_optimal_rate() local
2514 rate->index = find_first_bit(&lq_sta->optimal_rate_mask, in rs_get_optimal_rate()
2522 rate->index = rate_idx; in rs_get_optimal_rate()
2527 return rate; in rs_get_optimal_rate()
2530 /* Choose an initial legacy rate and antenna to use based on the RSSI
2537 struct rs_rate *rate) in rs_get_initial_rate() argument
2561 rate->ant = first_antenna(valid_tx_ant); in rs_get_initial_rate()
2563 rate->ant = best_ant; in rs_get_initial_rate()
2565 rate->sgi = false; in rs_get_initial_rate()
2566 rate->ldpc = false; in rs_get_initial_rate()
2567 rate->bw = RATE_MCS_CHAN_WIDTH_20; in rs_get_initial_rate()
2569 rate->index = find_first_bit(&lq_sta->active_legacy_rate, in rs_get_initial_rate()
2573 rate->type = LQ_LEGACY_A; in rs_get_initial_rate()
2577 rate->type = LQ_LEGACY_G; in rs_get_initial_rate()
2585 /* Start from a higher rate if the corresponding debug capability in rs_get_initial_rate()
2586 * is enabled. The rate is chosen according to AP capabilities. in rs_get_initial_rate()
2598 * bandwidth rate, and after authorization, when the phy context in rs_get_initial_rate()
2621 rate->type = LQ_VHT_SISO; in rs_get_initial_rate()
2622 rate->bw = bw; in rs_get_initial_rate()
2628 rate->type = LQ_HT_SISO; in rs_get_initial_rate()
2638 rate->index = rate_idx; in rs_get_initial_rate()
2644 rs_dump_rate(mvm, rate, "INITIAL"); in rs_get_initial_rate()
2671 * rs_initialize_lq - Initialize a station's hardware rate table
2677 * if the driver's iwl-agn-rs rate scaling algorithm is used, instead of
2690 struct rs_rate *rate; in rs_initialize_lq() local
2702 rate = &tbl->rate; in rs_initialize_lq()
2704 rs_get_initial_rate(mvm, sta, lq_sta, band, rate); in rs_initialize_lq()
2707 WARN_ONCE(rate->ant != ANT_A && rate->ant != ANT_B, in rs_initialize_lq()
2709 rate->ant, lq_sta->pers.chains, mvm->fw->valid_tx_ant, in rs_initialize_lq()
2712 tbl->column = rs_get_column_from_rate(rate); in rs_initialize_lq()
2715 rs_fill_lq_cmd(mvm, sta, lq_sta, rate); in rs_initialize_lq()
2748 /* Report the optimal rate based on rssi and STA caps if we haven't in rs_drv_get_rate()
2768 IWL_DEBUG_RATE(mvm, "create station rate scale window\n"); in rs_drv_alloc_sta()
2904 void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg) in iwl_mvm_update_frame_stats() argument
2915 switch (rate & RATE_MCS_CHAN_WIDTH_MSK) { in iwl_mvm_update_frame_stats()
2929 WARN_ONCE(1, "bad BW. rate 0x%x", rate); in iwl_mvm_update_frame_stats()
2932 if (rate & RATE_MCS_HT_MSK) { in iwl_mvm_update_frame_stats()
2934 nss = ((rate & RATE_HT_MCS_NSS_MSK) >> RATE_HT_MCS_NSS_POS) + 1; in iwl_mvm_update_frame_stats()
2935 } else if (rate & RATE_MCS_VHT_MSK) { in iwl_mvm_update_frame_stats()
2937 nss = ((rate & RATE_VHT_MCS_NSS_MSK) >> in iwl_mvm_update_frame_stats()
2948 if (rate & RATE_MCS_SGI_MSK) in iwl_mvm_update_frame_stats()
2953 mvm->drv_rx_stats.last_rates[mvm->drv_rx_stats.last_frame_idx] = rate; in iwl_mvm_update_frame_stats()
2963 * Called after adding a new station to initialize rate scaling
2995 "LQ: *** rate scale station global init for station %d ***\n", in rs_drv_rate_init()
2997 /* TODO: what is a good starting rate for STA? About middle? Maybe not in rs_drv_rate_init()
2998 * the lowest or the highest rate.. Could consider using RSSI from in rs_drv_rate_init()
3032 IWL_DEBUG_RATE(mvm, "MAX RATE: LEGACY=%d SISO=%d MIMO2=%d\n", in rs_drv_rate_init()
3091 IWL_DEBUG_RATE(mvm, "Rate scaling not initialized yet.\n"); in __iwl_mvm_rs_tx_status()
3107 /* Disable last tx check if we are debugging with fixed rate but in __iwl_mvm_rs_tx_status()
3117 "Can't map rate 0x%x to column", in __iwl_mvm_rs_tx_status()
3132 IWL_DEBUG_RATE(mvm, "Fixed rate 0x%x success %d attempts %d\n", in __iwl_mvm_rs_tx_status()
3150 /* Ignore this Tx frame response if its initial rate doesn't match in __iwl_mvm_rs_tx_status()
3164 /* Here we actually compare this rate to the latest LQ command */ in __iwl_mvm_rs_tx_status()
3182 /* Regardless, ignore this status info for outdated rate */ in __iwl_mvm_rs_tx_status()
3186 /* Rate did match, so reset the missed_rate_counter */ in __iwl_mvm_rs_tx_status()
3197 if (WARN_ON_ONCE(!rs_rate_column_match(&lq_rate, &curr_tbl->rate))) { in __iwl_mvm_rs_tx_status()
3199 "Neither active nor search matches tx rate\n"); in __iwl_mvm_rs_tx_status()
3201 rs_dump_rate(mvm, &tmp_tbl->rate, "ACTIVE"); in __iwl_mvm_rs_tx_status()
3203 rs_dump_rate(mvm, &tmp_tbl->rate, "SEARCH"); in __iwl_mvm_rs_tx_status()
3207 * and continue to perform rate scale to find the rate table in __iwl_mvm_rs_tx_status()
3216 * For aggregation, all packets were transmitted at the same rate, the in __iwl_mvm_rs_tx_status()
3217 * first index into rate scale table. in __iwl_mvm_rs_tx_status()
3232 * zero power reduction. When FW transmits agg with a rate in __iwl_mvm_rs_tx_status()
3233 * different from the initial rate, it will not use reduced txp in __iwl_mvm_rs_tx_status()
3260 /* Collect data for each rate used during failed TX attempts */ in __iwl_mvm_rs_tx_status()
3269 /* Only collect stats if retried rate is in the same RS in __iwl_mvm_rs_tx_status()
3272 if (rs_rate_column_match(&lq_rate, &curr_tbl->rate)) in __iwl_mvm_rs_tx_status()
3275 &other_tbl->rate)) in __iwl_mvm_rs_tx_status()
3295 /* The last TX rate is cached in lq_sta; it's set in if/else above */ in __iwl_mvm_rs_tx_status()
3299 /* See if there's a better rate or modulation mode to try. */ in __iwl_mvm_rs_tx_status()
3325 struct rs_rate rate; in rs_build_rates_table_from_fixed() local
3334 if (rs_rate_from_ucode_rate(ucode_rate, band, &rate)) { in rs_build_rates_table_from_fixed()
3339 if (is_mimo(&rate)) in rs_build_rates_table_from_fixed()
3359 struct rs_rate *rate, in rs_fill_rates_for_column() argument
3367 int prev_rate_idx = rate->index; in rs_fill_rates_for_column()
3374 rate)); in rs_fill_rates_for_column()
3377 rs_toggle_antenna(valid_tx_ant, rate); in rs_fill_rates_for_column()
3380 prev_rate_idx = rate->index; in rs_fill_rates_for_column()
3381 bottom_reached = rs_get_lower_rate_in_column(lq_sta, rate); in rs_fill_rates_for_column()
3382 if (bottom_reached && !is_legacy(rate)) in rs_fill_rates_for_column()
3386 if (!bottom_reached && !is_legacy(rate)) in rs_fill_rates_for_column()
3387 rate->index = prev_rate_idx; in rs_fill_rates_for_column()
3392 /* Building the rate table is non trivial. When we're in MIMO2/VHT/80Mhz/SGI
3393 * column the rate table should look like this:
3395 * rate[0] 0x400F019 VHT | ANT: AB BW: 80Mhz MCS: 9 NSS: 2 SGI
3396 * rate[1] 0x400F019 VHT | ANT: AB BW: 80Mhz MCS: 9 NSS: 2 SGI
3397 * rate[2] 0x400F018 VHT | ANT: AB BW: 80Mhz MCS: 8 NSS: 2 SGI
3398 * rate[3] 0x400F018 VHT | ANT: AB BW: 80Mhz MCS: 8 NSS: 2 SGI
3399 * rate[4] 0x400F017 VHT | ANT: AB BW: 80Mhz MCS: 7 NSS: 2 SGI
3400 * rate[5] 0x400F017 VHT | ANT: AB BW: 80Mhz MCS: 7 NSS: 2 SGI
3401 * rate[6] 0x4005007 VHT | ANT: A BW: 80Mhz MCS: 7 NSS: 1 NGI
3402 * rate[7] 0x4009006 VHT | ANT: B BW: 80Mhz MCS: 6 NSS: 1 NGI
3403 * rate[8] 0x4005005 VHT | ANT: A BW: 80Mhz MCS: 5 NSS: 1 NGI
3404 * rate[9] 0x800B Legacy | ANT: B Rate: 36 Mbps
3405 * rate[10] 0x4009 Legacy | ANT: A Rate: 24 Mbps
3406 * rate[11] 0x8007 Legacy | ANT: B Rate: 18 Mbps
3407 * rate[12] 0x4005 Legacy | ANT: A Rate: 12 Mbps
3408 * rate[13] 0x800F Legacy | ANT: B Rate: 9 Mbps
3409 * rate[14] 0x400D Legacy | ANT: A Rate: 6 Mbps
3410 * rate[15] 0x800D Legacy | ANT: B Rate: 6 Mbps
3417 struct rs_rate rate; in rs_build_rates_table() local
3424 memcpy(&rate, initial_rate, sizeof(rate)); in rs_build_rates_table()
3431 rate.stbc = true; in rs_build_rates_table()
3433 if (is_siso(&rate)) { in rs_build_rates_table()
3436 } else if (is_mimo(&rate)) { in rs_build_rates_table()
3445 rs_fill_rates_for_column(mvm, lq_sta, &rate, lq_cmd->rs_table, &index, in rs_build_rates_table()
3449 rs_get_lower_rate_down_column(lq_sta, &rate); in rs_build_rates_table()
3451 if (is_siso(&rate)) { in rs_build_rates_table()
3455 } else if (is_legacy(&rate)) { in rs_build_rates_table()
3464 rs_fill_rates_for_column(mvm, lq_sta, &rate, lq_cmd->rs_table, &index, in rs_build_rates_table()
3468 rs_get_lower_rate_down_column(lq_sta, &rate); in rs_build_rates_table()
3473 rs_fill_rates_for_column(mvm, lq_sta, &rate, lq_cmd->rs_table, &index, in rs_build_rates_table()
3679 /* rate scale requires free function to be implemented */
3694 int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate) in rs_pretty_print_rate() argument
3699 u8 ant = (rate & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS; in rs_pretty_print_rate()
3701 if (!(rate & RATE_MCS_HT_MSK) && in rs_pretty_print_rate()
3702 !(rate & RATE_MCS_VHT_MSK) && in rs_pretty_print_rate()
3703 !(rate & RATE_MCS_HE_MSK)) { in rs_pretty_print_rate()
3704 int index = iwl_hwrate_to_plcp_idx(rate); in rs_pretty_print_rate()
3706 return scnprintf(buf, bufsz, "Legacy | ANT: %s Rate: %s Mbps", in rs_pretty_print_rate()
3712 if (rate & RATE_MCS_VHT_MSK) { in rs_pretty_print_rate()
3714 mcs = rate & RATE_VHT_MCS_RATE_CODE_MSK; in rs_pretty_print_rate()
3715 nss = ((rate & RATE_VHT_MCS_NSS_MSK) in rs_pretty_print_rate()
3717 } else if (rate & RATE_MCS_HT_MSK) { in rs_pretty_print_rate()
3719 mcs = rate & RATE_HT_MCS_INDEX_MSK; in rs_pretty_print_rate()
3720 nss = ((rate & RATE_HT_MCS_NSS_MSK) in rs_pretty_print_rate()
3722 } else if (rate & RATE_MCS_HE_MSK) { in rs_pretty_print_rate()
3724 mcs = rate & RATE_VHT_MCS_RATE_CODE_MSK; in rs_pretty_print_rate()
3725 nss = ((rate & RATE_VHT_MCS_NSS_MSK) in rs_pretty_print_rate()
3731 switch (rate & RATE_MCS_CHAN_WIDTH_MSK) { in rs_pretty_print_rate()
3750 rate, type, rs_pretty_ant(ant), bw, mcs, nss, in rs_pretty_print_rate()
3751 (rate & RATE_MCS_SGI_MSK) ? "SGI " : "NGI ", in rs_pretty_print_rate()
3752 (rate & RATE_MCS_STBC_MSK) ? "STBC " : "", in rs_pretty_print_rate()
3753 (rate & RATE_MCS_LDPC_MSK) ? "LDPC " : "", in rs_pretty_print_rate()
3754 (rate & RATE_HE_DUAL_CARRIER_MODE_MSK) ? "DCM " : "", in rs_pretty_print_rate()
3755 (rate & RATE_MCS_BF_MSK) ? "BF " : ""); in rs_pretty_print_rate()
3760 * Program the device to use fixed rate for frame transmit
3762 * once the device start use fixed rate, we need to reload the module
3772 IWL_DEBUG_RATE(mvm, "sta_id %d rate 0x%X\n", in rs_program_fix_rate()
3820 struct rs_rate *rate = &tbl->rate; in rs_sta_dbgfs_scale_table_read() local
3831 "failed=%d success=%d rate=0%lX\n", in rs_sta_dbgfs_scale_table_read()
3834 desc += scnprintf(buff + desc, bufsz - desc, "fixed rate 0x%X\n", in rs_sta_dbgfs_scale_table_read()
3841 (is_legacy(rate)) ? "legacy" : in rs_sta_dbgfs_scale_table_read()
3842 is_vht(rate) ? "VHT" : "HT"); in rs_sta_dbgfs_scale_table_read()
3843 if (!is_legacy(rate)) { in rs_sta_dbgfs_scale_table_read()
3845 (is_siso(rate)) ? "SISO" : "MIMO2"); in rs_sta_dbgfs_scale_table_read()
3847 (is_ht20(rate)) ? "20MHz" : in rs_sta_dbgfs_scale_table_read()
3848 (is_ht40(rate)) ? "40MHz" : in rs_sta_dbgfs_scale_table_read()
3849 (is_ht80(rate)) ? "80MHz" : in rs_sta_dbgfs_scale_table_read()
3850 (is_ht160(rate)) ? "160MHz" : "BAD BW"); in rs_sta_dbgfs_scale_table_read()
3852 (rate->sgi) ? "SGI" : "NGI", in rs_sta_dbgfs_scale_table_read()
3853 (rate->ldpc) ? "LDPC" : "BCC", in rs_sta_dbgfs_scale_table_read()
3857 desc += scnprintf(buff + desc, bufsz - desc, "last tx rate=0x%X\n", in rs_sta_dbgfs_scale_table_read()
3896 " rate[%d] 0x%X ", i, r); in rs_sta_dbgfs_scale_table_read()
3921 struct rs_rate *rate; in rs_sta_dbgfs_stats_table_read() local
3930 rate = &tbl->rate; in rs_sta_dbgfs_stats_table_read()
3935 rate->type, in rs_sta_dbgfs_stats_table_read()
3936 rate->sgi, in rs_sta_dbgfs_stats_table_read()
3937 is_ht20(rate) ? "20MHz" : in rs_sta_dbgfs_stats_table_read()
3938 is_ht40(rate) ? "40MHz" : in rs_sta_dbgfs_stats_table_read()
3939 is_ht80(rate) ? "80MHz" : in rs_sta_dbgfs_stats_table_read()
3940 is_ht160(rate) ? "160MHz" : "ERR", in rs_sta_dbgfs_stats_table_read()
3941 rate->index); in rs_sta_dbgfs_stats_table_read()
3997 int col, rate; in rs_sta_dbgfs_drv_tx_stats_read() local
4011 for (rate = 0; rate < IWL_RATE_COUNT; rate++) in rs_sta_dbgfs_drv_tx_stats_read()
4012 pos += scnprintf(pos, endpos - pos, "%s,", rate_name[rate]); in rs_sta_dbgfs_drv_tx_stats_read()
4019 for (rate = 0; rate < IWL_RATE_COUNT; rate++) { in rs_sta_dbgfs_drv_tx_stats_read()
4020 stats = &(lq_sta->pers.tx_stats[col][rate]); in rs_sta_dbgfs_drv_tx_stats_read()
4140 * Initialization of rate scaling information is done by driver after
4151 /* ops for rate scaling implemented in the driver */