diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-10-16 18:09:19 +0200 |
---|---|---|
committer | Ivan Kluchnikov <kluchnikovi@gmail.com> | 2013-10-28 12:53:49 +0400 |
commit | 7380babdba39faa090e5dff442e2afbeec202c16 (patch) | |
tree | 823f3d948455e1b31136c61936d4467461f4b71f /src/gprs_rlcmac.cpp | |
parent | 0946f99b08f0f8dd08f42be4e9b2ed0b70e8500b (diff) |
tbf: Move the tbf_timer_cb into the tbf class
Introduce the first instance method for printing out diagonistic
about itself and create a jump function for it.
Diffstat (limited to 'src/gprs_rlcmac.cpp')
-rw-r--r-- | src/gprs_rlcmac.cpp | 150 |
1 files changed, 0 insertions, 150 deletions
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp index 8841445d..9b4e6436 100644 --- a/src/gprs_rlcmac.cpp +++ b/src/gprs_rlcmac.cpp @@ -253,156 +253,6 @@ static inline int8_t find_free_usf(struct gprs_rlcmac_pdch *pdch, uint8_t ts) return -1; } -/* lookup TBF Entity (by TFI) */ -struct gprs_rlcmac_tbf *tbf_by_tfi(struct gprs_rlcmac_bts *bts, - uint8_t tfi, uint8_t trx, enum gprs_rlcmac_tbf_direction dir) -{ - struct gprs_rlcmac_tbf *tbf; - - if (tfi >= 32 || trx >= 8) - return NULL; - - if (dir == GPRS_RLCMAC_UL_TBF) - tbf = bts->trx[trx].ul_tbf[tfi]; - else - tbf = bts->trx[trx].dl_tbf[tfi]; - if (!tbf) - return NULL; - - if (tbf->state != GPRS_RLCMAC_RELEASING) - return tbf; - - return NULL; -} - -/* search for active downlink or uplink tbf */ -struct gprs_rlcmac_tbf *tbf_by_tlli(uint32_t tlli, - enum gprs_rlcmac_tbf_direction dir) -{ - struct gprs_rlcmac_tbf *tbf; - if (dir == GPRS_RLCMAC_UL_TBF) { - llist_for_each_entry(tbf, &gprs_rlcmac_ul_tbfs, list) { - if (tbf->state != GPRS_RLCMAC_RELEASING - && tbf->tlli == tlli && tbf->tlli_valid) - return tbf; - } - } else { - llist_for_each_entry(tbf, &gprs_rlcmac_dl_tbfs, list) { - if (tbf->state != GPRS_RLCMAC_RELEASING - && tbf->tlli == tlli) - return tbf; - } - } - return NULL; -} - -struct gprs_rlcmac_tbf *tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts) -{ - struct gprs_rlcmac_tbf *tbf; - - /* only one TBF can poll on specific TS/FN, because scheduler can only - * schedule one downlink control block (with polling) at a FN per TS */ - llist_for_each_entry(tbf, &gprs_rlcmac_ul_tbfs, list) { - if (tbf->state != GPRS_RLCMAC_RELEASING - && tbf->poll_state == GPRS_RLCMAC_POLL_SCHED - && tbf->poll_fn == fn && tbf->trx == trx - && tbf->control_ts == ts) - return tbf; - } - llist_for_each_entry(tbf, &gprs_rlcmac_dl_tbfs, list) { - if (tbf->state != GPRS_RLCMAC_RELEASING - && tbf->poll_state == GPRS_RLCMAC_POLL_SCHED - && tbf->poll_fn == fn && tbf->trx == trx - && tbf->control_ts == ts) - return tbf; - } - return NULL; -} - -struct gprs_rlcmac_tbf *tbf_alloc(struct gprs_rlcmac_bts *bts, - struct gprs_rlcmac_tbf *old_tbf, enum gprs_rlcmac_tbf_direction dir, - uint8_t tfi, uint8_t trx, - uint8_t ms_class, uint8_t single_slot) -{ - struct gprs_rlcmac_tbf *tbf; - int rc; - -#ifdef DEBUG_DIAGRAM - /* hunt for first free number in diagram */ - int diagram_num; - for (diagram_num = 0; ; diagram_num++) { - llist_for_each_entry(tbf, &gprs_rlcmac_ul_tbfs, list) { - if (tbf->diag == diagram_num) - goto next_diagram; - } - llist_for_each_entry(tbf, &gprs_rlcmac_dl_tbfs, list) { - if (tbf->diag == diagram_num) - goto next_diagram; - } - break; -next_diagram: - continue; - } -#endif - - LOGP(DRLCMAC, LOGL_DEBUG, "********** TBF starts here **********\n"); - LOGP(DRLCMAC, LOGL_INFO, "Allocating %s TBF: TFI=%d TRX=%d " - "MS_CLASS=%d\n", (dir == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL", - tfi, trx, ms_class); - - if (trx >= 8 || tfi >= 32) - return NULL; - - tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_tbf); - if (!tbf) - return NULL; - -#ifdef DEBUG_DIAGRAM - tbf->diag = diagram_num; -#endif - tbf->direction = dir; - tbf->tfi = tfi; - tbf->trx = trx; - tbf->arfcn = bts->trx[trx].arfcn; - tbf->ms_class = ms_class; - tbf->ws = 64; - tbf->sns = 128; - /* select algorithm */ - rc = bts->alloc_algorithm(bts, old_tbf, tbf, bts->alloc_algorithm_curst, - single_slot); - /* if no ressource */ - if (rc < 0) { - talloc_free(tbf); - return NULL; - } - /* assign control ts */ - tbf->control_ts = 0xff; - rc = tbf_assign_control_ts(tbf); - /* if no ressource */ - if (rc < 0) { - talloc_free(tbf); - return NULL; - } - - /* set timestamp */ - gettimeofday(&tbf->meas.dl_bw_tv, NULL); - gettimeofday(&tbf->meas.rssi_tv, NULL); - gettimeofday(&tbf->meas.dl_loss_tv, NULL); - - INIT_LLIST_HEAD(&tbf->llc_queue); - if (dir == GPRS_RLCMAC_UL_TBF) - llist_add(&tbf->list, &gprs_rlcmac_ul_tbfs); - else - llist_add(&tbf->list, &gprs_rlcmac_dl_tbfs); - - debug_diagram(tbf->diag, "+-----------------+"); - debug_diagram(tbf->diag, "|NEW %s TBF TFI=%2d|", - (dir == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL", tfi); - debug_diagram(tbf->diag, "+-----------------+"); - - return tbf; -} - /* Slot Allocation: Algorithm A * * Assign single slot for uplink and downlink |