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

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

`#include "co_int.h"`
`#include "hal_desc.h"`
`#include "sta_mgmt.h"`

Go to the source code of this file.

## 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.
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
SW retry step offset
#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.
## Functions
__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.
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_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_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.
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.
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.
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.
void | rc_update_sample_table (uint8_t sta_idx)
| Resets the sample table and fills it with new random samples.

## Detailed Description

Copyright (C) RivieraWaves 2015-2019.

Declaration of the initialization functions used in UMAC RC.

Definition in file rc.h.