diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-12-26 09:31:31 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-01-15 10:39:08 +0100 |
commit | 1fe69323ad3b5aad8f625f7d1162c7037ceab190 (patch) | |
tree | 6f2435c0d05e40f10ef223d50d9cbe93cafd6d91 /src/gprs_rlcmac_ts_alloc.cpp | |
parent | 3fd2ddf1a2c8c6c471b9996af6fc8f7c4c579fd5 (diff) |
alloc: Move the selection of the first enabled pdch to a new method
Diffstat (limited to 'src/gprs_rlcmac_ts_alloc.cpp')
-rw-r--r-- | src/gprs_rlcmac_ts_alloc.cpp | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp index 2c2636fd..f65e673c 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/gprs_rlcmac_ts_alloc.cpp @@ -375,6 +375,28 @@ static void tx_win_from_rx(const int ms_type, *tx_win_max); } +/* + * Assign the first common ts, which is used for control or + * single slot. + */ +static int select_first_ts(gprs_rlcmac_trx *trx, uint8_t tx_win_min, uint8_t tx_range) +{ + uint8_t ts_no; + int i; + for (ts_no = tx_win_min, i = 0; i < tx_range; ts_no = (ts_no + 1) & 7) { + gprs_rlcmac_pdch *pdch = &trx->pdch[ts_no]; + /* check if enabled */ + if (!pdch->is_enabled()) { + LOGP(DRLCMAC, LOGL_DEBUG, "- Skipping TS %d, " + "because not enabled\n", ts_no); + continue; + } + return ts_no; + } + + return -1; +} + /* Slot Allocation: Algorithm B * * Assign as many downlink slots as possible. @@ -545,20 +567,7 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, return -EBUSY; } } else { - /* assign the first common ts, which is used for control or - * single slot. */ - for (ts = tx_win_min, i = 0; i < tx_range; ts = (ts + 1) & 7) { - struct gprs_rlcmac_pdch *pdch; - pdch = &tbf->trx->pdch[ts]; - /* check if enabled */ - if (!pdch->is_enabled()) { - LOGP(DRLCMAC, LOGL_DEBUG, "- Skipping TS %d, " - "because not enabled\n", ts); - continue; - } - first_common_ts = ts; - break; - } + first_common_ts = select_first_ts(tbf->trx, tx_win_min, tx_range); } if (first_common_ts < 0) { |