- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

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

Go to the documentation of this file.

    00001
    00013 #ifndef _RC_ENABLE_H_
    00014 #define _RC_ENABLE_H_
    00015
    00026 /*
    00027  * INCLUDE FILES
    00028  ****************************************************************************************
    00029  */
    00030 // standard includes
    00031 #include "co_int.h"
    00032
    00033 // for number of rate control steps
    00034 #include "hal_desc.h"
    00035 // for struct sta_pol_tbl_cntl and struct sta_info_tag
    00036 #include "sta_mgmt.h"
    00037
    00038 /*
    00039  * DEFINES
    00040  ****************************************************************************************
    00041  */
    00043 #define RC_USE_MAX_BW         0
    00045 #define RC_MAX_NUM_RETRY         (2)
    00049 #define RC_PERIOD_TOUT           (100000)
    00050 #if RC_PERIOD_TOUT > 200000
    00051 #error "RC_PERIOD_TOUT shall be 200ms maximum"
    00052 #endif
    00053
    00055 #define RC_TRIAL_PERIOD          (10)
    00057 #define RC_MAX_N_SAMPLE          (10)
    00059 #define RC_HE_STATS_IDX          RC_MAX_N_SAMPLE
    00060
    00062 #define RC_SCALE                 (16)
    00064 #define EWMA_LEVEL               (96)
    00066 #define EWMA_DIV                 (128)
    00067
    00074 #define RC_FRAC(val, div)        (((val) << RC_SCALE) / (div))
    00075
    00081 #define RC_TRUNC(val)            ((val) >> RC_SCALE)
    00082
    00089 #define DIV_ROUND_UP(n, d)       (((n) + (d) - 1) / (d))
    00090
    00092 #define RC_FIXED_RATE_NOT_SET    (0xFFFF)
    00093
    00096 #define RC_AGG_TX_MASK           CO_BIT(1)
    00098 #define RC_AGG_ALLOWED_OFT       (2)
    00100 #define RC_AGG_ALLOWED_MASK      CO_BIT(RC_AGG_ALLOWED_OFT)
    00102 #define RC_FIX_RATE_STATUS_OFT   (4)
    00104 #define RC_FIX_RATE_STATUS_MASK  (3 << RC_FIX_RATE_STATUS_OFT)
    00106 #define RC_FIX_RATE_NOTEN_MASK   (0 << RC_FIX_RATE_STATUS_OFT)
    00108 #define RC_FIX_RATE_REQ_MASK     (1 << RC_FIX_RATE_STATUS_OFT)
    00110 #define RC_FIX_RATE_EN_MASK      (2 << RC_FIX_RATE_STATUS_OFT)
    00112 #define RC_SS_UPD_REQ_MASK       CO_BIT(6)
    00114 #define RC_FIX_RATE_UPD_SS_REQ_MASK   CO_BIT(7)
    00115
    00118 #define RC_SW_RETRY_STEP_OFT     0
    00120 #define RC_SW_RETRY_STEP_MSK     (0x03 << RC_SW_RETRY_STEP_OFT)
    00122 #define RC_RETRY_CHAIN_VER_OFT   2
    00124 #define RC_RETRY_CHAIN_VER_MSK   (0x03 << RC_RETRY_CHAIN_VER_OFT)
    00126 #define RC_CONTROL_GET(rc_control, field) (((rc_control) & RC_##field##_MSK) >> RC_##field##_OFT)
    00127
    00130 #define RC_TRIAL_STATUS_WAIT       (0)
    00132 #define RC_TRIAL_STATUS_WAIT_CFM   (1)
    00134
    00135
    00136 /*
    00137  * STRUCTURES/TYPES DEFINITION
    00138  ****************************************************************************************
    00139  */
    00140
    00142 struct rc_rate_stats
    00143 {
    00145     uint16_t attempts;
    00147     uint16_t success;
    00149     uint16_t probability;
    00151     uint16_t rate_config;
    00152     union
    00153     {
    00154         struct {
    00156             uint8_t  sample_skipped;
    00158             bool  old_prob_available;
    00160             bool rate_allowed;
    00161         };
    00162         struct {
    00164             uint16_t ru_and_length;
    00165         };
    00166     };
    00167 };
    00168
    00170 struct rc_sta_stats
    00171 {
    00173     uint32_t last_rc_time;
    00175     struct rc_rate_stats rate_stats[RC_MAX_N_SAMPLE + NX_HE];
    00177     uint16_t retry_step_idx[RATE_CONTROL_STEPS];
    00179     uint16_t ampdu_len;
    00181     uint16_t ampdu_packets;
    00183     uint32_t avg_ampdu_len;
    00185     uint16_t sample_wait;
    00187     uint8_t sample_slow;
    00189     uint8_t trial_status;
    00191     uint32_t trial_rate;
    00193     uint8_t trial_idx;
    00202     uint8_t info;
    00204     uint8_t retry_chain_ver;
    00206     uint8_t sw_retry_step;
    00208     uint8_t format_mod;
    00210     union
    00211     {
    00217         uint8_t     ht[4];
    00218         #if NX_VHT
    00227         uint16_t    vht;
    00228         #endif
    00229         #if NX_HE
    00238         uint16_t    he;
    00239         #endif
    00240     } rate_map;
    00244     uint16_t rate_map_l;
    00246     uint8_t mcs_max;
    00248     uint8_t r_idx_min;
    00250     uint8_t r_idx_max;
    00252     uint8_t bw_max;
    00254     uint8_t no_ss;
    00256     uint8_t short_gi;
    00258     uint8_t type;
    00260     uint16_t no_samples;
    00262     uint16_t max_amsdu_len;
    00264     uint16_t curr_amsdu_len;
    00266     uint16_t fixed_rate_cfg;
    00267 };
    00268
    00269 /*
    00270  * GLOBAL VARIABLES
    00271  ****************************************************************************************
    00272  */
    00273
    00274 /*
    00275  * FUNCTION PROTOTYPES
    00276  ****************************************************************************************
    00277  */
    00278
    00288 __INLINE uint16_t rc_get_max_amsdu_len(struct sta_info_tag *sta)
    00289 {
    00290     struct sta_pol_tbl_cntl *pt = &sta->pol_tbl;
    00291     struct rc_sta_stats *rc_ss = pt->sta_stats;
    00292
    00293     return rc_ss->curr_amsdu_len;
    00294 }
    00295
    00305 __INLINE struct rc_sta_stats* rc_get_sta_stats(uint8_t sta_idx)
    00306 {
    00307     struct sta_info_tag *sta = &sta_info_tab[sta_idx];
    00308     struct sta_pol_tbl_cntl *rc = &sta->pol_tbl;
    00309     struct rc_sta_stats *rc_ss = rc->sta_stats;
    00310     ASSERT_ERR(rc_ss != NULL);
    00311
    00312     return rc_ss;
    00313 }
    00314
    00324 __INLINE bool rc_check_aggregation(struct sta_info_tag *sta)
    00325 {
    00326     struct sta_pol_tbl_cntl *pt = &sta->pol_tbl;
    00327     struct rc_sta_stats *rc_ss = pt->sta_stats;
    00328
    00329     return ((rc_ss->info & RC_AGG_ALLOWED_MASK) >> RC_AGG_ALLOWED_OFT);
    00330 }
    00331
    00343 void rc_init(struct sta_info_tag *sta);
    00344
    00352 uint32_t rc_get_duration(struct rc_rate_stats *rate_stats);
    00353
    00361 void rc_cfm_singleton(struct txdesc *txdesc);
    00362
    00372 void rc_cfm_ampdu(struct txdesc *txdesc, uint32_t txed, uint32_t txok);
    00373
    00388 void rc_check(struct txdesc *txdesc);
    00389
    00399 void rc_update_bw_nss_max(uint8_t sta_idx, uint8_t bw_max, uint8_t nss_max);
    00400
    00409 void rc_update_preamble_type(uint8_t sta_idx, uint8_t preamble_type);
    00410
    00419 void rc_init_bcmc_rate(struct sta_info_tag *sta, uint8_t basic_rate_idx);
    00420
    00433 uint32_t rc_calc_tp(struct rc_sta_stats *rc_ss, uint8_t sample_idx);
    00434
    00446 bool rc_check_fixed_rate_config(struct rc_sta_stats *rc_ss, uint16_t fixed_rate_config);
    00447
    00467 void rc_trial_check_bfm_stbc_htc(struct txl_buffer_control *buf_ctrl, uint32_t trial_rate,
    00468                                  bool can_use_bfm, bool use_stbc, uint8_t stbc_nss,
    00469                                  uint8_t nc, uint8_t ntx, bool can_use_htc);
    00470
    00478 void rc_update_sample_table(uint8_t sta_idx);
    00479
    00481
    00482 #endif /* _RC_ENABLE_H_ */