diff options
Diffstat (limited to 'src/bts.h')
-rw-r--r-- | src/bts.h | 68 |
1 files changed, 32 insertions, 36 deletions
@@ -27,7 +27,6 @@ extern "C" { #include <osmocom/core/rate_ctr.h> #include <osmocom/core/stat_item.h> #include <osmocom/core/timer.h> -#include <osmocom/core/gsmtap.h> } #include "poll_controller.h" @@ -45,6 +44,20 @@ extern "C" { struct BTS; struct GprsMs; +#define MAX_CDWDTBL_LEN 79 /* total number of codewords */ +#define BITS_TO_BYTES(X) (X ? (X/8):0)+1 +#define MOD8(X) (((X)+8)&0x07) +#define MOD64(X) ((X + 64) & 0x3F) +extern const uint8_t* one_run_len_code_list[MAX_CDWDTBL_LEN]; +extern const uint8_t* zero_run_len_code_list[MAX_CDWDTBL_LEN]; + +typedef struct node +{ + struct node* left; + struct node* right; + uint16_t *run_length; +} Node; + /* * PDCH instance */ @@ -67,7 +80,7 @@ struct gprs_rlcmac_pdch { struct pcu_l1_meas *meas); int rcv_block_gprs(uint8_t *data, uint32_t fn, struct pcu_l1_meas *meas, GprsCodingScheme cs); - int rcv_data_block(uint8_t *data, uint32_t fn, + int rcv_data_data_block(uint8_t *data, uint32_t fn, struct pcu_l1_meas *meas, GprsCodingScheme cs); gprs_rlcmac_bts *bts_data() const; @@ -108,11 +121,10 @@ private: void rcv_control_ack(Packet_Control_Acknowledgement_t *, uint32_t fn); void rcv_control_dl_ack_nack(Packet_Downlink_Ack_Nack_t *, uint32_t fn); - void rcv_control_egprs_dl_ack_nack(EGPRS_PD_AckNack_t *, uint32_t fn); + void rcv_control_egprs_dl_ack_nack(EGPRS_PD_AckNack_t *ack_nack, uint32_t fn); void rcv_resource_request(Packet_Resource_Request_t *t, uint32_t fn); void rcv_measurement_report(Packet_Measurement_Report_t *t, uint32_t fn); - gprs_rlcmac_tbf *tbf_from_list_by_tfi( - LListHead<gprs_rlcmac_tbf> *tbf_list, uint8_t tfi, + gprs_rlcmac_tbf *tbf_from_list_by_tfi(struct llist_head *tbf_list, uint8_t tfi, enum gprs_rlcmac_tbf_direction dir); gprs_rlcmac_tbf *tbf_by_tfi(uint8_t tfi, enum gprs_rlcmac_tbf_direction dir); @@ -157,9 +169,7 @@ struct gprs_rlcmac_bts { uint8_t cs3; uint8_t cs4; uint8_t initial_cs_dl, initial_cs_ul; - uint8_t initial_mcs_dl, initial_mcs_ul; uint8_t max_cs_dl, max_cs_ul; - uint8_t max_mcs_dl, max_mcs_ul; uint8_t force_cs; /* 0=use from BTS 1=use from VTY */ uint16_t force_llc_lifetime; /* overrides lifetime from SGSN */ uint32_t llc_discard_csec; @@ -173,7 +183,6 @@ struct gprs_rlcmac_bts { uint8_t n3101; uint8_t n3103; uint8_t n3105; - struct gsmtap_inst *gsmtap; struct gprs_rlcmac_trx trx[8]; int (*alloc_algorithm)(struct gprs_rlcmac_bts *bts, struct GprsMs *ms, @@ -183,6 +192,11 @@ struct gprs_rlcmac_bts { uint8_t force_two_phase; uint8_t alpha, gamma; uint8_t egprs_enabled; + uint8_t initial_mcs_dl; + uint8_t initial_mcs_ul; + uint8_t max_mcs_dl; + uint8_t max_mcs_ul; + uint8_t force_mcs; uint32_t dl_tbf_idle_msec; /* hold time for idle DL TBFs */ uint32_t ms_idle_sec; uint8_t cs_adj_enabled; @@ -190,8 +204,12 @@ struct gprs_rlcmac_bts { uint8_t cs_adj_lower_limit; struct {int16_t low; int16_t high;} cs_lqual_ranges[4]; uint16_t cs_downgrade_threshold; /* downgrade if less packets left (DL) */ - uint16_t ws_base; - uint16_t ws_pdch; /* increase WS by this value per PDCH */ + + /* TBF handling, make private or move into TBFController */ + /* list of uplink TBFs */ + struct llist_head ul_tbfs; + /* list of downlink TBFs */ + struct llist_head dl_tbfs; /* State for dynamic algorithm selection */ int multislot_disabled; @@ -214,14 +232,11 @@ public: enum { CTR_TBF_DL_ALLOCATED, CTR_TBF_DL_FREED, - CTR_TBF_DL_ABORTED, CTR_TBF_UL_ALLOCATED, CTR_TBF_UL_FREED, - CTR_TBF_UL_ABORTED, CTR_TBF_REUSED, CTR_TBF_ALLOC_ALGO_A, CTR_TBF_ALLOC_ALGO_B, - CTR_TBF_FAILED_EGPRS_ONLY, CTR_RLC_SENT, CTR_RLC_RESENT, CTR_RLC_RESTARTED, @@ -272,6 +287,10 @@ public: gprs_rlcmac_dl_tbf *dl_tbf_by_tfi(uint8_t tfi, uint8_t trx, uint8_t ts); gprs_rlcmac_ul_tbf *ul_tbf_by_tfi(uint8_t tfi, uint8_t trx, uint8_t ts); + void build_codeword(Node *root, const uint8_t* cdwd[]); + Node *ones_list; + Node *zeros_list; + int tfi_find_free(enum gprs_rlcmac_tbf_direction dir, uint8_t *_trx, int8_t use_trx); int rcv_imm_ass_cnf(const uint8_t *data, uint32_t fn); @@ -290,14 +309,11 @@ public: */ void tbf_dl_created(); void tbf_dl_freed(); - void tbf_dl_aborted(); void tbf_ul_created(); void tbf_ul_freed(); - void tbf_ul_aborted(); void tbf_reused(); void tbf_alloc_algo_a(); void tbf_alloc_algo_b(); - void tbf_failed_egprs_only(); void rlc_sent(); void rlc_resent(); void rlc_restarted(); @@ -327,8 +343,6 @@ public: struct rate_ctr_group *rate_counters() const; struct osmo_stat_item_group *stat_items() const; - LListHead<gprs_rlcmac_tbf>& ul_tbfs(); - LListHead<gprs_rlcmac_tbf>& dl_tbfs(); private: int m_cur_fn; int m_cur_blk_fn; @@ -340,11 +354,6 @@ private: GprsMsStorage m_ms_store; - /* list of uplink TBFs */ - LListHead<gprs_rlcmac_tbf> m_ul_tbfs; - /* list of downlink TBFs */ - LListHead<gprs_rlcmac_tbf> m_dl_tbfs; - private: /* disable copying to avoid slicing */ BTS(const BTS&); @@ -376,16 +385,6 @@ inline GprsMs *BTS::ms_by_imsi(const char *imsi) return ms_store().get_ms(0, 0, imsi); } -inline LListHead<gprs_rlcmac_tbf>& BTS::ul_tbfs() -{ - return m_ul_tbfs; -} - -inline LListHead<gprs_rlcmac_tbf>& BTS::dl_tbfs() -{ - return m_dl_tbfs; -} - inline BTS *gprs_rlcmac_pdch::bts() const { return trx->bts; @@ -430,14 +429,11 @@ inline struct osmo_stat_item_group *BTS::stat_items() const CREATE_COUNT_INLINE(tbf_dl_created, CTR_TBF_DL_ALLOCATED) CREATE_COUNT_INLINE(tbf_dl_freed, CTR_TBF_DL_FREED) -CREATE_COUNT_INLINE(tbf_dl_aborted, CTR_TBF_DL_ABORTED) CREATE_COUNT_INLINE(tbf_ul_created, CTR_TBF_UL_ALLOCATED) CREATE_COUNT_INLINE(tbf_ul_freed, CTR_TBF_UL_FREED) -CREATE_COUNT_INLINE(tbf_ul_aborted, CTR_TBF_UL_ABORTED) CREATE_COUNT_INLINE(tbf_reused, CTR_TBF_REUSED) CREATE_COUNT_INLINE(tbf_alloc_algo_a, CTR_TBF_ALLOC_ALGO_A) CREATE_COUNT_INLINE(tbf_alloc_algo_b, CTR_TBF_ALLOC_ALGO_B) -CREATE_COUNT_INLINE(tbf_failed_egprs_only, CTR_TBF_FAILED_EGPRS_ONLY) CREATE_COUNT_INLINE(rlc_sent, CTR_RLC_SENT) CREATE_COUNT_INLINE(rlc_resent, CTR_RLC_RESENT) CREATE_COUNT_INLINE(rlc_restarted, CTR_RLC_RESTARTED) |