# /space/home/slher/rel/Beken/v6_4_5/macsw/ip/umac/src/rc/rc.c File Reference

Copyright (C) RivieraWaves 2015-2019. More...

`#include "me.h"`
`#include "mm.h"`
`#include "me_utils.h"`
`#include "txl_cfm.h"`
`#include "rc.h"`
`#include "vif_mgmt.h"`
`#include "bfr.h"`

Go to the source code of this file.

## 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.
## 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.

## Detailed Description

Copyright (C) RivieraWaves 2015-2019.

The Rate Control module implementation.

Definition in file rc.c.