Declaration of all functions used for rate control algorithm. More...
|
Data Structures | |
| struct | rc_rate_stats |
| Statistics table. More... | |
| struct | rc_sta_stats |
| Rate control structure. More... | |
Defines | |
| #define | RC_USE_MAX_BW 0 |
| Set 1 to always use maximum allowed BW. | |
| #define | RC_MAX_NUM_RETRY (2) |
| Maximum number of retries of each step of the retry chain. | |
| #define | RC_PERIOD_TOUT (100000) |
| Rate control algorithm execution period (us). | |
| #define | RC_TRIAL_PERIOD (10) |
| Rate control algorithm trial TX interval (number of TX). | |
| #define | RC_MAX_N_SAMPLE (10) |
| Maximum number of samples to be maintained in the statistics structure. | |
| #define | RC_HE_STATS_IDX RC_MAX_N_SAMPLE |
| Index of the HE statistics element in the table. | |
| #define | RC_SCALE (16) |
| Scaling used for the fractional computation. | |
| #define | EWMA_LEVEL (96) |
| Default weight used in the Exponentially Weighted Moving Average computation. | |
| #define | EWMA_DIV (128) |
| Divisor used in the Exponentially Weighted Moving Average computation. | |
| #define | RC_FRAC(val, div) (((val) << RC_SCALE) / (div)) |
| Compute a fractional number. | |
| #define | RC_TRUNC(val) ((val) >> RC_SCALE) |
| Get the integer part of a fractional number. | |
| #define | DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) |
| Divide and round to the upper integer. | |
| #define | RC_FIXED_RATE_NOT_SET (0xFFFF) |
| Disabled fixed rate configuration. | |
Functions | |
| static void | rc_calc_prob_ewma (struct rc_rate_stats *rc_rs) |
| Calculates probability of success with EWMA. | |
| static uint16_t | rc_set_previous_mcs_index (struct rc_sta_stats *rc_ss, uint16_t rate_config) |
| Updates the MCS / rate index of the rate configuration, setting the previous if available. | |
| static uint16_t | rc_set_next_mcs_index (struct rc_sta_stats *rc_ss, uint16_t rate_config) |
| Updates the MCS / rate index of the rate configuration, setting the next if available. | |
| static bool | rc_check_rate_duplicated (struct rc_sta_stats *rc_ss, uint16_t rate_config) |
| Checks if the rate configuration is already present in the sample table. | |
| static uint16_t | rc_new_random_rate (struct rc_sta_stats *rc_ss) |
| Gets a new random rate configuration. | |
| static bool | rc_set_trial_tx (struct rc_sta_stats *rc_ss) |
| Selects a new rate to be used as trial rate and stores its index. | |
| static bool | rc_update_stats (struct rc_sta_stats *rc_ss, bool init) |
| Calculate statistics, fills the new retry chain, updates the sample table. | |
| static void | rc_update_retry_chain (struct rc_sta_stats *rc_ss, uint32_t *cur_tp) |
| Updates the retry chain. | |
| static void | rc_get_new_samples (struct rc_sta_stats *rc_ss) |
| Replaces not useful samples of the sample table with new ones. | |
| static bool | rc_update_stats_fixed_rate (struct rc_sta_stats *rc_ss) |
| Update the retry chain and statistics when a fix rate is set. | |
| static uint32_t | ewma (uint32_t old_val, uint32_t new_val, uint32_t weight) |
| Perform EWMA (Exponentially Weighted Moving Average) calculation;. | |
| static uint8_t | rc_get_format_mod (uint16_t rate_config) |
| Extract the format from the rate configuration. | |
| static uint8_t | rc_get_bw (uint16_t rate_config) |
| Extract the bandwidth from the rate configuration. | |
| static uint8_t | rc_get_nss (uint16_t rate_config) |
| Extract the number of spatial streams from the rate configuration. | |
| static uint8_t | rc_get_mcs_index (uint16_t rate_config) |
| Extract the MCS / rate index from the rate configuration. | |
| static uint8_t | rc_get_sgi (uint32_t rate_config) |
| Extract the Short Guard interval setting from the rate configuration. | |
| static uint8_t | rc_get_pre_type (uint16_t rate_config) |
| Extract the preamble type from the rate configuration. | |
| static bool | is_cck_group (uint16_t rate_config) |
| Checks if the rate configuration corresponds to a CCK rate. | |
| static bool | rc_check_trial_tx (struct rc_sta_stats *rc_ss) |
| Checks if a trial transmission is requested. | |
| static void | rc_sort_samples_tp (struct rc_sta_stats *rc_ss, uint32_t *cur_tp) |
| Sort sample table from lower to higher throughput. | |
| static bool | rc_check_valid_rate (struct rc_sta_stats *rc_ss, uint16_t rate_config) |
| Checks if the rate configuration is allowed. | |
| static void | rc_get_new_sample_rates (struct rc_sta_stats *rc_ss, uint16_t *new_rate_cfg_array, uint8_t n_new_samples) |
| Selects new samples for the sample table. | |
| static uint16_t | rc_get_lowest_rate_config (struct rc_sta_stats *rc_ss) |
| Gets the rate configuration of the lowest allowed rate for the station. | |
| static uint16_t | rc_get_initial_rate_config (struct rc_sta_stats *rc_ss) |
| Gets the rate configuration of the initial rate for the station. | |
| static uint16_t | rc_get_num_samples (struct rc_sta_stats *rc_ss) |
| Gets the number of samples to be used by the RC algorithm. | |
| static void | rc_set_rate_configs (struct rc_sta_stats *rc_ss) |
| Sets the rate configurations of the sample table entries. | |
| static void | rc_init_rates (uint8_t sta_idx) |
| RC algorithm retry chain and sample table initialization. | |
| static void | rc_set_max_amsdu_len (struct rc_sta_stats *rc_ss) |
| Sets the maximum AMSDU length, depending on the number of spatial streams. | |
| static void | rc_set_aggregation_flag (struct rc_sta_stats *rc_ss, bool *tx_ampdu) |
| Sets/resets the aggregation flag This function updates the value of the aggregation flag depending on the rates set in the retry chain. | |
| static void | rc_update_counters (struct txdesc *txdesc, uint32_t attempts, uint32_t failures, bool tx_ampdu) |
| Updates Rate Control statistics after sending an A-MPDU. | |
| void | rc_cfm_singleton (struct txdesc *txdesc) |
| Updates Rate Control statistics after sending a singleton frame. | |
| void | rc_cfm_ampdu (struct txdesc *txdesc, uint32_t txed, uint32_t txok) |
| Updates Rate Control statistics after sending an A-MPDU. | |
| void | rc_check (struct txdesc *txdesc) |
| RC algorithm check. | |
| void | rc_init (struct sta_info_tag *sta) |
| RC algorithm initialization. | |
| uint32_t | rc_get_duration (struct rc_rate_stats *rate_stats) |
| Gets the TX duration of a packet of 1200 bytes. | |
| void | rc_update_sample_table (uint8_t sta_idx) |
| Resets the sample table and fills it with new random samples. | |
| void | rc_update_bw_nss_max (uint8_t sta_idx, uint8_t bw_max, uint8_t nss_max) |
| Updates the maximum bandwidth and spatial streams allowed by the station. | |
| void | rc_update_preamble_type (uint8_t sta_idx, uint8_t preamble_type) |
| Updates the preamble type allowed by the station. | |
| void | rc_init_bcmc_rate (struct sta_info_tag *sta, uint8_t basic_rate_idx) |
| Initializes the RC algorithm for BC/MC transmissions. | |
| bool | rc_check_fixed_rate_config (struct rc_sta_stats *rc_ss, uint16_t fixed_rate_config) |
| Checks whether the requested fixed rate is compliant with the peer STA capabilities. | |
| uint32_t | rc_calc_tp (struct rc_sta_stats *rc_ss, uint8_t sample_idx) |
| Calculates the throughput of an entry of the sample table. | |
| void | rc_trial_check_bfm_stbc_htc (struct txl_buffer_control *buf_ctrl, uint32_t trial_rate, bool can_use_bfm, bool use_stbc, uint8_t stbc_nss, uint8_t nc, uint8_t ntx, bool can_use_htc) |
| Checks if STBC, beamforming and +HTC can be used for the trial transmission and sets the tx_flags in the buffer control structure accordingly. | |
| __INLINE uint16_t | rc_get_max_amsdu_len (struct sta_info_tag *sta) |
| Gets the maximum AMSDU length we can transmit to a given station. | |
| __INLINE struct rc_sta_stats * | rc_get_sta_stats (uint8_t sta_idx) |
| Gets the pointer to the rate control station statistics structure. | |
| __INLINE bool | rc_check_aggregation (struct sta_info_tag *sta) |
| Gets the aggregation enabled flag for given station. | |
Variables | |
| struct me_env_tag | me_env |
| ME module environment variable. | |
| struct rc_sta_stats | sta_stats [NX_REMOTE_STA_MAX] |
| Array of rate control statistics. | |
| static const uint32_t | rc_duration_ht_ampdu [10 *4 *2] |
| Transmission duration in nsecs of 1200 bytes for a HT/VHT MCS. | |
| static const uint32_t | rc_duration_cck [4 *2] |
| Transmission duration in nsecs of 1200 bytes. | |
| static const uint32_t | rc_duration_non_ht [8] |
| Transmission duration in nsecs of 1200 bytes. | |
RC information flags | |
Flag indicating whether next transmission could be part of a AMPDU | |
| #define | RC_AGG_TX_MASK CO_BIT(1) |
| Offset of the aggregation flag. | |
| #define | RC_AGG_ALLOWED_OFT (2) |
| Offset of the aggregation flag. | |
| #define | RC_AGG_ALLOWED_MASK CO_BIT(RC_AGG_ALLOWED_OFT) |
| Flag indicating whether aggregation is allowed by the rate control. | |
| #define | RC_FIX_RATE_STATUS_OFT (4) |
| Offset of fixed rate status. | |
| #define | RC_FIX_RATE_STATUS_MASK (3 << RC_FIX_RATE_STATUS_OFT) |
| Mask of the fixed rate status. | |
| #define | RC_FIX_RATE_NOTEN_MASK (0 << RC_FIX_RATE_STATUS_OFT) |
| Fixed rate not enabled. | |
| #define | RC_FIX_RATE_REQ_MASK (1 << RC_FIX_RATE_STATUS_OFT) |
| Fixed rate requested. | |
| #define | RC_FIX_RATE_EN_MASK (2 << RC_FIX_RATE_STATUS_OFT) |
| Fixed rate enabled. | |
| #define | RC_SS_UPD_REQ_MASK CO_BIT(6) |
| Flag indicating whether the rate control station statistics table needs to be updated. | |
| #define | RC_FIX_RATE_UPD_SS_REQ_MASK CO_BIT(7) |
| Flag indicating whether the rates should be re-initialised after the fixed rate period. | |
RC control information inside TX descriptor | |
|
| |
| #define | RC_SW_RETRY_STEP_OFT 0 |
| SW retry step mask. | |
| #define | RC_SW_RETRY_STEP_MSK (0x03 << RC_SW_RETRY_STEP_OFT) |
| SW retry step mask. | |
| #define | RC_RETRY_CHAIN_VER_OFT 2 |
| Retry chain version offset. | |
| #define | RC_RETRY_CHAIN_VER_MSK (0x03 << RC_RETRY_CHAIN_VER_OFT) |
| Retry chain version mask. | |
| #define | RC_CONTROL_GET(rc_control, field) (((rc_control) & RC_##field##_MSK) >> RC_##field##_OFT) |
| Macro used to retrieve a field from the RC control field. | |
RC trial states | |
Wait for the next time to transmit a trial rate | |
| #define | RC_TRIAL_STATUS_WAIT (0) |
| Wait the trial rate transmission confirmation. | |
| #define | RC_TRIAL_STATUS_WAIT_CFM (1) |
| Wait the trial rate transmission confirmation. | |
Declaration of all functions used for rate control algorithm.
| #define DIV_ROUND_UP | ( | n, | |||
| d | ) | (((n) + (d) - 1) / (d)) |
| #define RC_FRAC | ( | val, | |||
| div | ) | (((val) << RC_SCALE) / (div)) |
Compute a fractional number.
| [in] | val | Value to be divided |
| [in] | div | Divisor |
Definition at line 74 of file rc.h.
Referenced by rc_calc_prob_ewma(), rc_get_new_samples(), rc_init_rates(), rc_set_aggregation_flag(), rc_set_trial_tx(), rc_update_retry_chain(), and rc_update_stats().
| #define RC_PERIOD_TOUT (100000) |
Rate control algorithm execution period (us).
Definition at line 49 of file rc.h.
Referenced by rc_update_counters().
| #define RC_TRUNC | ( | val | ) | ((val) >> RC_SCALE) |
Get the integer part of a fractional number.
| [in] | val | Value to be checked |
Definition at line 81 of file rc.h.
Referenced by rc_set_trial_tx().
| static uint32_t ewma | ( | uint32_t | old_val, | |
| uint32_t | new_val, | |||
| uint32_t | weight | |||
| ) | [inline, static] |
Perform EWMA (Exponentially Weighted Moving Average) calculation;.
| [in] | old_val | old value |
| [in] | new_val | new value |
| [in] | weight | weight to be used in the EWMA |
Definition at line 232 of file rc.c.
References EWMA_DIV.
Referenced by rc_calc_prob_ewma(), and rc_update_stats().
| static bool is_cck_group | ( | uint16_t | rate_config | ) | [static] |
Checks if the rate configuration corresponds to a CCK rate.
| [in] | rate_config | rate configuration |
Definition at line 967 of file rc.c.
References FORMATMOD_HT_MF, HW_RATE_6MBPS, rc_get_format_mod(), and rc_get_mcs_index().
Referenced by rc_update_retry_chain().
| static void rc_calc_prob_ewma | ( | struct rc_rate_stats * | rc_rs | ) | [static] |
Calculates probability of success with EWMA.
| [in] | rc_rs | pointer to rate control station statistics structure |
Definition at line 382 of file rc.c.
References rc_rate_stats::attempts, ewma(), EWMA_LEVEL, rc_rate_stats::old_prob_available, rc_rate_stats::probability, RC_FRAC, rc_rate_stats::sample_skipped, and rc_rate_stats::success.
Referenced by rc_update_stats(), and rc_update_stats_fixed_rate().
| uint32_t rc_calc_tp | ( | struct rc_sta_stats * | rc_ss, | |
| uint8_t | sample_idx | |||
| ) |
Calculates the throughput of an entry of the sample table.
Calculates the throughput based on the average A-MPDU length, taking into account the expected number of retransmissions and their expected length.
| [in] | rc_ss | Pointer to rate control station statistics structure |
| [in] | sample_idx | Index of the entry of the sample table |
Referenced by me_rc_stats_req_handler(), and rc_update_stats().
| void rc_cfm_ampdu | ( | struct txdesc * | txdesc, | |
| uint32_t | txed, | |||
| uint32_t | txok | |||
| ) |
Updates Rate Control statistics after sending an A-MPDU.
| [in] | txdesc | TX descriptor of the first MPDU of the A-MPDU |
| [in] | txed | Number of frame transmitted in the A-MDPU |
| [in] | txok | Number of frame successfully transmitted in the A-MDPU |
Referenced by txl_cfm_evt().
| void rc_cfm_singleton | ( | struct txdesc * | txdesc | ) |
Updates Rate Control statistics after sending a singleton frame.
| [in] | txdesc | TX descriptor of the singleton sent |
Referenced by txl_cfm_evt().
| void rc_check | ( | struct txdesc * | txdesc | ) |
RC algorithm check.
This function shall be called upon queuing of every packets within the TX path. It checks if:
| [in,out] | txdesc | TX descriptor of the packet to be transmitted |
Referenced by txu_cntrl_check_rate().
| __INLINE bool rc_check_aggregation | ( | struct sta_info_tag * | sta | ) |
Gets the aggregation enabled flag for given station.
| [in] | sta | Pointer to the station entry |
Definition at line 324 of file rc.h.
References rc_sta_stats::info, sta_info_tag::pol_tbl, RC_AGG_ALLOWED_MASK, RC_AGG_ALLOWED_OFT, and sta_pol_tbl_cntl::sta_stats.
| bool rc_check_fixed_rate_config | ( | struct rc_sta_stats * | rc_ss, | |
| uint16_t | fixed_rate_config | |||
| ) |
Checks whether the requested fixed rate is compliant with the peer STA capabilities.
| [in] | rc_ss | Pointer to rate control station statistics structure |
| [in] | fixed_rate_config | Fixed rate configuration |
Referenced by me_rc_set_rate_req_handler().
| static bool rc_check_rate_duplicated | ( | struct rc_sta_stats * | rc_ss, | |
| uint16_t | rate_config | |||
| ) | [static] |
Checks if the rate configuration is already present in the sample table.
| [in] | rc_ss | pointer to rate control station statistics structure |
| [in] | rate_config | rate configuration to be checked |
Definition at line 605 of file rc.c.
References rc_sta_stats::no_samples, rc_rate_stats::rate_config, and rc_sta_stats::rate_stats.
Referenced by rc_get_new_samples(), and rc_set_rate_configs().
| static bool rc_check_trial_tx | ( | struct rc_sta_stats * | rc_ss | ) | [static] |
Checks if a trial transmission is requested.
| [in] | rc_ss | pointer to rate control station statistics structure |
Definition at line 1106 of file rc.c.
References rc_sta_stats::info, RC_FIX_RATE_EN_MASK, rc_get_new_samples(), rc_set_trial_tx(), RC_SS_UPD_REQ_MASK, RC_TRIAL_STATUS_WAIT, rc_sta_stats::sample_wait, and rc_sta_stats::trial_status.
| static bool rc_check_valid_rate | ( | struct rc_sta_stats * | rc_ss, | |
| uint16_t | rate_config | |||
| ) | [static] |
Checks if the rate configuration is allowed.
| [in] | rc_ss | pointer to rate control station statistics structure |
| [in] | rate_config | rate configuration to be verified |
Definition at line 1383 of file rc.c.
References BW_160MHZ, BW_20MHZ, BW_80MHZ, CO_BIT, FORMATMOD_HE_SU, FORMATMOD_HT_GF, FORMATMOD_HT_MF, FORMATMOD_NON_HT, FORMATMOD_NON_HT_DUP_OFDM, FORMATMOD_VHT, rc_sta_stats::ht, MAC_VHT_MCS_MAP_MSK, rc_rate_stats::rate_allowed, rc_sta_stats::rate_map, rc_sta_stats::rate_map_l, rc_get_bw(), rc_get_format_mod(), rc_get_mcs_index(), and rc_get_nss().
Referenced by rc_get_new_sample_rates().
| static uint8_t rc_get_bw | ( | uint16_t | rate_config | ) | [static] |
Extract the bandwidth from the rate configuration.
| [in] | rate_config | rate configuration to be updated |
Definition at line 256 of file rc.c.
References BW_TX_RCX_MASK, and BW_TX_RCX_OFT.
Referenced by rc_check_valid_rate().
| uint32_t rc_get_duration | ( | struct rc_rate_stats * | rate_stats | ) |
Gets the TX duration of a packet of 1200 bytes.
| [in] | rate_stats | Rate statistics element (including the rate configuration info) |
Referenced by rc_set_trial_tx().
| static uint8_t rc_get_format_mod | ( | uint16_t | rate_config | ) | [static] |
Extract the format from the rate configuration.
| [in] | rate_config | rate configuration to be updated |
Definition at line 244 of file rc.c.
References FORMAT_MOD_TX_RCX_MASK, and FORMAT_MOD_TX_RCX_OFT.
Referenced by is_cck_group(), rc_check_valid_rate(), rc_get_mcs_index(), rc_get_new_sample_rates(), rc_get_nss(), rc_set_aggregation_flag(), rc_set_next_mcs_index(), rc_set_previous_mcs_index(), and rc_set_trial_tx().
| static uint16_t rc_get_initial_rate_config | ( | struct rc_sta_stats * | rc_ss | ) | [static] |
Gets the rate configuration of the initial rate for the station.
Highest rate index for NON-HT, MCS7 or highest allowed for HT, MCS7 for VHT
| [in] | rc_ss | Pointer to rate control station statistics structure |
Definition at line 1727 of file rc.c.
References rc_sta_stats::bw_max, BW_TX_RCX_OFT, co_clz(), rc_sta_stats::format_mod, FORMAT_MOD_TX_RCX_OFT, FORMATMOD_HE_SU, FORMATMOD_HT_GF, FORMATMOD_HT_MF, FORMATMOD_NON_HT, FORMATMOD_NON_HT_DUP_OFDM, FORMATMOD_VHT, GI_TYPE_0_8, rc_sta_stats::ht, HT_NSS_OFT, MCS_INDEX_TX_RCX_OFT, rc_sta_stats::no_ss, PRE_TYPE_TX_RCX_OFT, rc_sta_stats::r_idx_max, rc_sta_stats::rate_map, rc_sta_stats::short_gi, SHORT_GI_TX_RCX_OFT, rc_sta_stats::type, and VHT_NSS_OFT.
Referenced by rc_set_rate_configs().
| static uint16_t rc_get_lowest_rate_config | ( | struct rc_sta_stats * | rc_ss | ) | [static] |
Gets the rate configuration of the lowest allowed rate for the station.
| [in] | rc_ss | pointer to rate control station statistics structure |
Definition at line 1647 of file rc.c.
References rc_sta_stats::format_mod, FORMAT_MOD_TX_RCX_OFT, FORMATMOD_HE_SU, FORMATMOD_HT_GF, FORMATMOD_HT_MF, FORMATMOD_NON_HT, FORMATMOD_NON_HT_DUP_OFDM, FORMATMOD_VHT, GI_TYPE_1_6, MCS_INDEX_TX_RCX_OFT, PRE_TYPE_TX_RCX_OFT, and rc_sta_stats::r_idx_min.
Referenced by rc_set_rate_configs().
| __INLINE uint16_t rc_get_max_amsdu_len | ( | struct sta_info_tag * | sta | ) |
Gets the maximum AMSDU length we can transmit to a given station.
| [in] | sta | Pointer to the station entry |
Definition at line 288 of file rc.h.
References rc_sta_stats::curr_amsdu_len, sta_info_tag::pol_tbl, and sta_pol_tbl_cntl::sta_stats.
Referenced by me_tx_cfm_amsdu().
| static uint8_t rc_get_mcs_index | ( | uint16_t | rate_config | ) | [static] |
Extract the MCS / rate index from the rate configuration.
| [in] | rate_config | rate configuration to be updated |
Definition at line 304 of file rc.c.
References rc_sta_stats::format_mod, FORMATMOD_HE_MU, FORMATMOD_HE_SU, FORMATMOD_HT_GF, FORMATMOD_HT_MF, FORMATMOD_NON_HT, FORMATMOD_NON_HT_DUP_OFDM, FORMATMOD_VHT, HT_MCS_MASK, HT_MCS_OFT, MCS_INDEX_TX_RCX_MASK, MCS_INDEX_TX_RCX_OFT, rc_get_format_mod(), VHT_MCS_MASK, and VHT_MCS_OFT.
Referenced by is_cck_group(), rc_check_valid_rate(), rc_set_aggregation_flag(), rc_set_max_amsdu_len(), rc_set_next_mcs_index(), and rc_set_previous_mcs_index().
| static void rc_get_new_sample_rates | ( | struct rc_sta_stats * | rc_ss, | |
| uint16_t * | new_rate_cfg_array, | |||
| uint8_t | n_new_samples | |||
| ) | [static] |
Selects new samples for the sample table.
This function selects a new set of samples:
| [in] | rc_ss | pointer to rate control station statistics structure |
| [in] | new_rate_cfg_array | pointer to the array of new samples rate configuration |
| [in] | n_new_samples | number of new samples to be set |
Definition at line 1481 of file rc.c.
References FORMATMOD_HE_SU, FORMATMOD_HT_MF, HE_GI_TYPE_TX_RCX_MASK, HE_GI_TYPE_TX_RCX_OFT, rc_rate_stats::rate_config, rc_sta_stats::rate_stats, rc_check_valid_rate(), rc_get_format_mod(), rc_new_random_rate(), rc_set_next_mcs_index(), rc_set_previous_mcs_index(), rc_sta_stats::retry_step_idx, rc_sta_stats::short_gi, and SHORT_GI_TX_RCX_MASK.
Referenced by rc_get_new_samples().
| static void rc_get_new_samples | ( | struct rc_sta_stats * | rc_ss | ) | [static] |
Replaces not useful samples of the sample table with new ones.
This function discards some of the samples from the sample table and replaces them with new ones. The samples are discarded if:
| [in] | rc_ss | pointer to rate control station statistics structure |
Definition at line 1590 of file rc.c.
References rc_sta_stats::no_samples, rc_rate_stats::old_prob_available, rc_rate_stats::probability, rc_rate_stats::rate_config, rc_sta_stats::rate_stats, rc_check_rate_duplicated(), RC_FRAC, rc_get_new_sample_rates(), RC_MAX_N_SAMPLE, rc_sta_stats::retry_step_idx, and rc_rate_stats::sample_skipped.
Referenced by rc_check_trial_tx().
| static uint8_t rc_get_nss | ( | uint16_t | rate_config | ) | [static] |
Extract the number of spatial streams from the rate configuration.
| [in] | rate_config | rate configuration to be updated |
Definition at line 268 of file rc.c.
References rc_sta_stats::format_mod, FORMATMOD_HE_MU, FORMATMOD_HE_SU, FORMATMOD_HT_GF, FORMATMOD_HT_MF, FORMATMOD_VHT, HT_NSS_MASK, HT_NSS_OFT, rc_get_format_mod(), VHT_NSS_MASK, and VHT_NSS_OFT.
Referenced by rc_check_valid_rate(), rc_set_aggregation_flag(), rc_set_next_mcs_index(), rc_set_previous_mcs_index(), and rc_set_trial_tx().
| static uint16_t rc_get_num_samples | ( | struct rc_sta_stats * | rc_ss | ) | [static] |
Gets the number of samples to be used by the RC algorithm.
This function calculates the number of samples to be used for the sample table of the RC algorithm, depending on the number of available rates for the station. The maximum number of samples is limited to RC_MAX_N_SAMPLE.
| [in] | rc_ss | pointer to rate control station statistics structure |
Definition at line 1789 of file rc.c.
References rc_sta_stats::bw_max, rc_sta_stats::format_mod, FORMATMOD_HE_SU, FORMATMOD_HT_GF, FORMATMOD_HT_MF, FORMATMOD_NON_HT, FORMATMOD_NON_HT_DUP_OFDM, FORMATMOD_VHT, rc_sta_stats::ht, HW_RATE_11MBPS, HW_RATE_2MBPS, HW_RATE_54MBPS, HW_RATE_6MBPS, MAC_HE_MCS_MAP_MSK, MAC_VHT_MCS_MAP_MSK, rc_sta_stats::no_ss, rc_sta_stats::rate_map, rc_sta_stats::rate_map_l, RC_MAX_N_SAMPLE, rc_sta_stats::short_gi, and rc_sta_stats::type.
| static uint8_t rc_get_pre_type | ( | uint16_t | rate_config | ) | [static] |
Extract the preamble type from the rate configuration.
| [in] | rate_config | rate configuration to be updated |
Definition at line 371 of file rc.c.
References PRE_TYPE_TX_RCX_MASK, and PRE_TYPE_TX_RCX_OFT.
| static uint8_t rc_get_sgi | ( | uint32_t | rate_config | ) | [static] |
Extract the Short Guard interval setting from the rate configuration.
| [in] | rate_config | rate configuration to be updated |
Definition at line 359 of file rc.c.
References SHORT_GI_TX_RCX_MASK, and SHORT_GI_TX_RCX_OFT.
| __INLINE struct rc_sta_stats* rc_get_sta_stats | ( | uint8_t | sta_idx | ) | [read] |
Gets the pointer to the rate control station statistics structure.
| [in] | sta_idx | Station index |
Definition at line 305 of file rc.h.
References ASSERT_ERR, sta_info_tag::pol_tbl, sta_info_tab, and sta_pol_tbl_cntl::sta_stats.
Referenced by txl_buffer_control_trial().
| void rc_init | ( | struct sta_info_tag * | sta | ) |
RC algorithm initialization.
This function sets the pointer to the statics structure for the station, reads the capability informations about the station (format, max bw, max spatial streams, max MCS, guard interval, min and max rate index, preamble type) and sets them into the RC statistics structure, initializes the rate control algorithm.
| [in] | sta | pointer to STA Info Table |
Referenced by me_init_rate().
| void rc_init_bcmc_rate | ( | struct sta_info_tag * | sta, | |
| uint8_t | basic_rate_idx | |||
| ) |
Initializes the RC algorithm for BC/MC transmissions.
| [in] | sta | Pointer to the station entry |
| [in] | basic_rate_idx | Rate index of the basic rate to be set |
Referenced by me_init_bcmc_rate().
| static void rc_init_rates | ( | uint8_t | sta_idx | ) | [static] |
RC algorithm retry chain and sample table initialization.
This function initializes the rates of the sample table and then it sets the retry chain:
| [in] | sta_idx | index of the station |
Definition at line 1950 of file rc.c.
References ASSERT_ERR, rc_sta_stats::avg_ampdu_len, rc_sta_stats::fixed_rate_cfg, rc_sta_stats::info, rc_sta_stats::no_samples, sta_info_tag::pol_tbl, RATE_CONTROL_STEPS, RC_FIXED_RATE_NOT_SET, RC_FRAC, rc_set_rate_configs(), RC_TRIAL_STATUS_WAIT, rc_update_stats(), rc_sta_stats::retry_step_idx, rc_sta_stats::sample_wait, sta_info_tab, sta_pol_tbl_cntl::sta_stats, rc_sta_stats::trial_idx, and rc_sta_stats::trial_status.
| static uint16_t rc_new_random_rate | ( | struct rc_sta_stats * | rc_ss | ) | [static] |
Gets a new random rate configuration.
| [in] | rc_ss | pointer to rate control station statistics structure |
Definition at line 789 of file rc.c.
References BW_160MHZ, BW_20MHZ, BW_80MHZ, rc_sta_stats::bw_max, BW_TX_RCX_MASK, BW_TX_RCX_OFT, CO_BIT, co_rand_hword(), rc_sta_stats::format_mod, FORMAT_MOD_TX_RCX_MASK, FORMAT_MOD_TX_RCX_OFT, FORMATMOD_HE_SU, FORMATMOD_HT_GF, FORMATMOD_HT_MF, FORMATMOD_NON_HT, FORMATMOD_NON_HT_DUP_OFDM, FORMATMOD_VHT, HE_GI_TYPE_TX_RCX_MASK, HE_GI_TYPE_TX_RCX_OFT, rc_sta_stats::ht, HT_MCS_MASK, HT_MCS_OFT, HT_NSS_MASK, HT_NSS_OFT, HW_RATE_11MBPS, HW_RATE_1MBPS, MAC_HE_MCS_MAP_MSK, MAC_VHT_MCS_MAP_MSK, MCS_INDEX_TX_RCX_MASK, MCS_INDEX_TX_RCX_OFT, rc_sta_stats::mcs_max, rc_sta_stats::no_ss, PRE_TYPE_TX_RCX_MASK, PRE_TYPE_TX_RCX_OFT, rc_sta_stats::r_idx_max, rc_sta_stats::r_idx_min, rc_sta_stats::rate_map, rc_sta_stats::rate_map_l, rc_sta_stats::short_gi, SHORT_GI_TX_RCX_MASK, SHORT_GI_TX_RCX_OFT, rc_sta_stats::type, VHT_MCS_MASK, VHT_MCS_OFT, VHT_NSS_MASK, and VHT_NSS_OFT.
Referenced by rc_get_new_sample_rates(), and rc_set_rate_configs().
| static void rc_set_aggregation_flag | ( | struct rc_sta_stats * | rc_ss, | |
| bool * | tx_ampdu | |||
| ) | [static] |
Sets/resets the aggregation flag This function updates the value of the aggregation flag depending on the rates set in the retry chain.
The aggregation is disabled only for legacy rates, since it's not supported. The aggregation is disabled if:
| [in] | rc_ss | pointer to rate control station statistics structure |
| [in] | tx_ampdu | pointer to the aggregation flag |
Definition at line 2038 of file rc.c.
References FORMATMOD_HT_MF, HW_RATE_54MBPS, rc_sta_stats::info, rc_rate_stats::probability, rc_sta_stats::r_idx_min, rc_rate_stats::rate_config, rc_sta_stats::rate_stats, RC_AGG_ALLOWED_MASK, RC_AGG_ALLOWED_OFT, RC_FIX_RATE_EN_MASK, RC_FRAC, rc_get_format_mod(), rc_get_mcs_index(), rc_get_nss(), rc_sta_stats::retry_step_idx, and rc_sta_stats::sw_retry_step.
| static void rc_set_max_amsdu_len | ( | struct rc_sta_stats * | rc_ss | ) | [static] |
Sets the maximum AMSDU length, depending on the number of spatial streams.
| [in] | rc_ss | pointer to rate control station statistics structure |
Definition at line 1991 of file rc.c.
References co_min(), rc_sta_stats::curr_amsdu_len, rc_sta_stats::max_amsdu_len, rc_sta_stats::no_ss, rc_rate_stats::rate_config, rc_sta_stats::rate_stats, rc_get_mcs_index(), rc_sta_stats::retry_step_idx, and rc_sta_stats::sw_retry_step.
| static uint16_t rc_set_next_mcs_index | ( | struct rc_sta_stats * | rc_ss, | |
| uint16_t | rate_config | |||
| ) | [static] |
Updates the MCS / rate index of the rate configuration, setting the next if available.
| [in] | rc_ss | pointer to rate control station statistics structure |
| [in] | rate_config | rate configuration to be updated |
Definition at line 514 of file rc.c.
References CO_BIT, co_min(), rc_sta_stats::format_mod, FORMATMOD_HE_SU, FORMATMOD_HT_GF, FORMATMOD_HT_MF, FORMATMOD_NON_HT, FORMATMOD_NON_HT_DUP_OFDM, FORMATMOD_VHT, rc_sta_stats::ht, HT_MCS_MASK, HW_RATE_11MBPS, HW_RATE_6MBPS, MAC_HE_MCS_MAP_MSK, MAC_VHT_MCS_MAP_MSK, MCS_INDEX_TX_RCX_MASK, rc_sta_stats::mcs_max, rc_sta_stats::r_idx_max, rc_sta_stats::rate_map, rc_sta_stats::rate_map_l, rc_get_format_mod(), rc_get_mcs_index(), rc_get_nss(), rc_sta_stats::short_gi, SHORT_GI_TX_RCX_MASK, and VHT_MCS_MASK.
Referenced by rc_get_new_sample_rates().
| static uint16_t rc_set_previous_mcs_index | ( | struct rc_sta_stats * | rc_ss, | |
| uint16_t | rate_config | |||
| ) | [static] |
Updates the MCS / rate index of the rate configuration, setting the previous if available.
| [in] | rc_ss | pointer to rate control station statistics structure |
| [in] | rate_config | rate configuration to be updated |
Definition at line 427 of file rc.c.
References CO_BIT, co_max(), rc_sta_stats::format_mod, FORMATMOD_HE_SU, FORMATMOD_HT_GF, FORMATMOD_HT_MF, FORMATMOD_NON_HT, FORMATMOD_NON_HT_DUP_OFDM, FORMATMOD_VHT, rc_sta_stats::ht, HT_MCS_MASK, HW_RATE_6MBPS, MCS_INDEX_TX_RCX_MASK, rc_sta_stats::r_idx_min, rc_sta_stats::rate_map, rc_sta_stats::rate_map_l, rc_get_format_mod(), rc_get_mcs_index(), rc_get_nss(), rc_sta_stats::short_gi, SHORT_GI_TX_RCX_MASK, and VHT_MCS_MASK.
Referenced by rc_get_new_sample_rates().
| static void rc_set_rate_configs | ( | struct rc_sta_stats * | rc_ss | ) | [static] |
Sets the rate configurations of the sample table entries.
This function initializes the rates of the sample table:
| [in] | rc_ss | pointer to rate control station statistics structure |
Definition at line 1900 of file rc.c.
References rc_rate_stats::attempts, rc_sta_stats::no_samples, rc_rate_stats::old_prob_available, rc_rate_stats::probability, rc_rate_stats::rate_allowed, rc_rate_stats::rate_config, rc_sta_stats::rate_stats, rc_check_rate_duplicated(), rc_get_initial_rate_config(), rc_get_lowest_rate_config(), rc_new_random_rate(), rc_rate_stats::sample_skipped, and rc_rate_stats::success.
Referenced by rc_init_rates().
| static bool rc_set_trial_tx | ( | struct rc_sta_stats * | rc_ss | ) | [static] |
Selects a new rate to be used as trial rate and stores its index.
This function updates the trial period value, depending on the average AMPDU size, and picks a new random rate from the sample table. The index of the selected rate is stored in the station statistics structrure. The new rate is discarded if:
| [in] | rc_ss | pointer to rate control station statistics structure |
Definition at line 1005 of file rc.c.
References rc_sta_stats::avg_ampdu_len, co_rand_hword(), rc_sta_stats::format_mod, FORMATMOD_HT_MF, rc_sta_stats::info, rc_sta_stats::no_samples, rc_rate_stats::old_prob_available, rc_rate_stats::probability, rc_rate_stats::rate_config, rc_sta_stats::rate_stats, RC_AGG_TX_MASK, RC_FRAC, rc_get_duration(), rc_get_format_mod(), rc_get_nss(), RC_TRIAL_PERIOD, RC_TRIAL_STATUS_WAIT_CFM, RC_TRUNC, rc_sta_stats::retry_step_idx, rc_rate_stats::sample_skipped, rc_sta_stats::sample_slow, rc_sta_stats::sample_wait, rc_sta_stats::trial_idx, and rc_sta_stats::trial_status.
Referenced by rc_check_trial_tx().
| static void rc_sort_samples_tp | ( | struct rc_sta_stats * | rc_ss, | |
| uint32_t * | cur_tp | |||
| ) | [static] |
Sort sample table from lower to higher throughput.
| [in] | rc_ss | pointer to rate control station statistics structure |
| [in] | cur_tp | pointer to the array of current throughputs |
Definition at line 1142 of file rc.c.
References rc_sta_stats::no_samples, and rc_sta_stats::rate_stats.
Referenced by rc_update_stats().
| void rc_trial_check_bfm_stbc_htc | ( | struct txl_buffer_control * | buf_ctrl, | |
| uint32_t | trial_rate, | |||
| bool | can_use_bfm, | |||
| bool | use_stbc, | |||
| uint8_t | stbc_nss, | |||
| uint8_t | nc, | |||
| uint8_t | ntx, | |||
| bool | can_use_htc | |||
| ) |
Checks if STBC, beamforming and +HTC can be used for the trial transmission and sets the tx_flags in the buffer control structure accordingly.
| [in] | buf_ctrl | pointer to the buffer control structure to be used |
| [in] | trial_rate | trial rate configuration |
| [in] | can_use_bfm | '1' if beamforming can be used with the current policy table; '0' otherwise |
| [in] | use_stbc | '1' if STBC can be used with the current policy table; '0' otherwise |
| [in] | stbc_nss | number of streams to use with STBC |
| [in] | nc | NC value received in the latest beamforming report |
| [in] | ntx | number of antennas |
| [in] | can_use_htc | '1' if +HTC can be used with the current policy table; '0' otherwise |
Referenced by me_update_buffer_control().
| void rc_update_bw_nss_max | ( | uint8_t | sta_idx, | |
| uint8_t | bw_max, | |||
| uint8_t | nss_max | |||
| ) |
Updates the maximum bandwidth and spatial streams allowed by the station.
| [in] | sta_idx | index of the station |
| [in] | bw_max | maximum bandwith |
| [in] | nss_max | maximum number of spatial streams |
Referenced by me_pol_tbl_bw_upd(), and me_sta_bw_nss_max_upd().
| static void rc_update_counters | ( | struct txdesc * | txdesc, | |
| uint32_t | attempts, | |||
| uint32_t | failures, | |||
| bool | tx_ampdu | |||
| ) | [static] |
Updates Rate Control statistics after sending an A-MPDU.
| [in] | txdesc | TX descriptor of the MPDU just transmitted (or of the first MPDU of the transmitted A-MPDU) |
| [in] | attempts | Number of attempts with the current retry chain |
| [in] | failures | Number of failures with the current retry chain |
| [in] | tx_ampdu | '1' if the transmitted message is an AMPDU, '0' otherwise |
Definition at line 2172 of file rc.c.
References rc_sta_stats::ampdu_len, rc_sta_stats::ampdu_packets, ASSERT_ERR, rc_rate_stats::attempts, hostdesc::flags, HE_TB_TX_BIT, txdesc::host, lmacdesc::hw_desc, sta_info_tag::inst_nbr, rc_sta_stats::last_rc_time, txdesc::lmac, NX_HE, NX_REMOTE_STA_MAX, sta_info_tag::pol_tbl, PROF_RC_SW_RETRY_CLR, PROF_RC_SW_RETRY_SET, PROF_RC_UPD_COUNTERS_CLR, PROF_RC_UPD_COUNTERS_SET, PROF_RC_UPD_COUNTERS_TRIAL_CLR, PROF_RC_UPD_COUNTERS_TRIAL_SET, rc_sta_stats::rate_stats, umacdesc::rc_control, RC_CONTROL_GET, RC_HE_STATS_IDX, RC_MAX_NUM_RETRY, RC_PERIOD_TOUT, RC_TRIAL_STATUS_WAIT, rc_sta_stats::retry_chain_ver, rc_sta_stats::retry_step_idx, sta_info_tab, sta_pol_tbl_cntl::sta_stats, hostdesc::staid, tx_hd::statinfo, rc_rate_stats::success, rc_sta_stats::sw_retry_step, tx_hw_desc::thd, rc_sta_stats::trial_idx, rc_sta_stats::trial_status, TXU_CNTRL_RC_TRIAL, and txdesc::umac.
| void rc_update_preamble_type | ( | uint8_t | sta_idx, | |
| uint8_t | preamble_type | |||
| ) |
Updates the preamble type allowed by the station.
| [in] | sta_idx | index of the station |
| [in] | preamble_type | preamble type to set |
Referenced by me_pol_tbl_prot_upd().
| static void rc_update_retry_chain | ( | struct rc_sta_stats * | rc_ss, | |
| uint32_t * | cur_tp | |||
| ) | [static] |
Updates the retry chain.
This function populates steps 0 and 1 of the retry chain table with the two highest throughputs. Then the function searches the rate, different from the previous two, with max throughput if proability is greater than 95% or with highest probability and uses its index for step 2 of the retry chain. Step 3 is set to the lowest rate (sample 0 of the table) and its TP value is updated.
| [in] | rc_ss | pointer to rate control station statistics structure |
| [in] | cur_tp | pointer to the array of current throughputs |
Definition at line 1290 of file rc.c.
References rc_sta_stats::info, is_cck_group(), rc_sta_stats::no_samples, rc_rate_stats::probability, rc_rate_stats::rate_allowed, rc_rate_stats::rate_config, rc_sta_stats::rate_stats, RC_AGG_TX_MASK, RC_FRAC, and rc_sta_stats::retry_step_idx.
Referenced by rc_update_stats().
| void rc_update_sample_table | ( | uint8_t | sta_idx | ) |
Resets the sample table and fills it with new random samples.
| [in] | sta_idx | index of the station |
Referenced by me_rc_set_rate_req_handler().
| static bool rc_update_stats | ( | struct rc_sta_stats * | rc_ss, | |
| bool | init | |||
| ) | [static] |
Calculate statistics, fills the new retry chain, updates the sample table.
This function updates throughput and probabilities of the sample table rates; selects the 1st and 2nd maximum throughput rates, maximum probability rate and updates the retry chain table. Then it replaces not useful samples of the sample table with new ones.
| [in] | rc_ss | pointer to rate control station statistics structure |
| [in] | init | indicate if the statistics are updated during the initialization |
Definition at line 1183 of file rc.c.
References rc_sta_stats::ampdu_len, rc_sta_stats::ampdu_packets, rc_rate_stats::attempts, rc_sta_stats::avg_ampdu_len, ewma(), EWMA_LEVEL, rc_sta_stats::fixed_rate_cfg, rc_sta_stats::info, rc_sta_stats::no_samples, rc_rate_stats::rate_allowed, rc_rate_stats::rate_config, RATE_CONTROL_STEPS, rc_sta_stats::rate_stats, rc_calc_prob_ewma(), rc_calc_tp(), RC_FIXED_RATE_NOT_SET, RC_FRAC, RC_HE_STATS_IDX, RC_MAX_N_SAMPLE, rc_sort_samples_tp(), RC_SS_UPD_REQ_MASK, rc_update_retry_chain(), rc_update_stats_fixed_rate(), rc_sta_stats::retry_step_idx, rc_sta_stats::sample_slow, and rc_rate_stats::success.
Referenced by rc_init_rates().
| static bool rc_update_stats_fixed_rate | ( | struct rc_sta_stats * | rc_ss | ) | [static] |
Update the retry chain and statistics when a fix rate is set.
This function inserts the fix rate in the sample table and updates the retry chain, if a fixed rate request is pending. Otherwise, it updates the statistics for the fixed rate.
| [in] | rc_ss | pointer to rate control station statistics structure |
Definition at line 2100 of file rc.c.
References rc_rate_stats::attempts, rc_sta_stats::fixed_rate_cfg, rc_sta_stats::info, rc_sta_stats::no_samples, rc_rate_stats::probability, rc_rate_stats::rate_config, rc_sta_stats::rate_stats, rc_calc_prob_ewma(), RC_FIX_RATE_EN_MASK, RC_FIX_RATE_REQ_MASK, RC_FIX_RATE_STATUS_MASK, RC_TRIAL_STATUS_WAIT, rc_sta_stats::retry_step_idx, rc_rate_stats::success, and rc_sta_stats::trial_status.
Referenced by rc_update_stats().
const uint32_t rc_duration_cck[4 *2] [static] |
{
[ 0] = 10452000, [ 1] = 10548000,
[ 2] = 5380000, [ 3] = 5476000,
[ 4] = 2315000, [ 5] = 2411000,
[ 6] = 1439000, [ 7] = 1535000,
}
Transmission duration in nsecs of 1200 bytes.
Index of the table is (MCS_IDX<<1) | (pre_type) where pre_type is 0 for long and short preamble 1 for long preamble only
const uint32_t rc_duration_ht_ampdu[10 *4 *2] [static] |
{
[ 0] = 1476923, [ 1] = 1329231, [ 2] = 711111, [ 3] = 640000,
[ 8] = 738462, [ 9] = 664615, [ 10] = 355556, [ 11] = 320000,
[ 16] = 492308, [ 17] = 443077, [ 18] = 237037, [ 19] = 213333,
[ 24] = 369231, [ 25] = 332308, [ 26] = 177778, [ 27] = 160000,
[ 32] = 246154, [ 33] = 221538, [ 34] = 118519, [ 35] = 106667,
[ 40] = 184615, [ 41] = 166154, [ 42] = 88889, [ 43] = 80000,
[ 48] = 164103, [ 49] = 147692, [ 50] = 79012, [ 51] = 71111,
[ 56] = 147692, [ 57] = 132923, [ 58] = 71111, [ 59] = 64000,
[ 64] = 123077, [ 65] = 110769, [ 66] = 59259, [ 67] = 53333,
[ 72] = 110769, [ 73] = 99692, [ 74] = 53333, [ 75] = 48000,
[ 4] = 328205, [ 5] = 295385, [ 6] = 164103, [ 7] = 147692,
[ 12] = 164103, [ 13] = 147692, [ 14] = 82051, [ 15] = 73846,
[ 20] = 109402, [ 21] = 98462, [ 22] = 54701, [ 23] = 49231,
[ 28] = 82051, [ 29] = 73846, [ 30] = 41026, [ 31] = 36923,
[ 36] = 54701, [ 37] = 49231, [ 38] = 27350, [ 39] = 24615,
[ 44] = 41026, [ 45] = 36923, [ 46] = 20513, [ 47] = 18462,
[ 52] = 36467, [ 53] = 32821, [ 54] = 18234, [ 55] = 16410,
[ 60] = 32821, [ 61] = 29538, [ 62] = 16410, [ 63] = 14769,
[ 68] = 27350, [ 69] = 24615, [ 70] = 13675, [ 71] = 12308,
[ 76] = 24615, [ 77] = 22154, [ 78] = 12308, [ 79] = 11077,
}
Transmission duration in nsecs of 1200 bytes for a HT/VHT MCS.
Index of the table is (MCS_IDX << 3) | (BW << 1) | (GI_400) where BW is 0 for 20 MHz, 1 for 40MHz and 2 for 80MHz GI_400 is 1 if packet is being sent with 400ns GI, 0 if 800ns GI
const uint32_t rc_duration_non_ht[8] [static] |
1.6.1