From 7af53e61f0a9de8c6ebe412d7bb0ffe11f71dbbd Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Thu, 16 Jul 2015 15:04:07 +0200 Subject: alloc: Use a separate usage computation for algo A Currently algorithm A can select an TBF even when there is no free TBF in the reverse direction. While this does not necessarily lead to an allocation failure, the probabily is higher. In addition, the current slot reservations are not taken into account. This commit changes the selection algorithm to prefer slots where TFI are available in both directions and which are less reserved. Sponsored-by: On-Waves ehf --- src/gprs_rlcmac_ts_alloc.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp index ffbbe2b8..e2c2a0f4 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/gprs_rlcmac_ts_alloc.cpp @@ -211,6 +211,22 @@ static int compute_usage_by_reservation(struct gprs_rlcmac_pdch *pdch, pdch->num_reserved(GPRS_RLCMAC_UL_TBF); } +static int compute_usage_for_algo_a(struct gprs_rlcmac_pdch *pdch, + enum gprs_rlcmac_tbf_direction dir) +{ + int usage = + pdch->num_tbfs(GPRS_RLCMAC_DL_TBF) + + pdch->num_tbfs(GPRS_RLCMAC_UL_TBF) + + compute_usage_by_reservation(pdch, dir); + + if (pdch->assigned_tfi(reverse(dir)) == 0xffffffff) + /* No TFI in the opposite direction, avoid it */ + usage += 32; + + return usage; + +} + static int find_least_busy_pdch(struct gprs_rlcmac_trx *trx, enum gprs_rlcmac_tbf_direction dir, uint8_t mask, @@ -417,7 +433,7 @@ int alloc_algorithm_a(struct gprs_rlcmac_bts *bts, return -EINVAL; ts = find_least_busy_pdch(trx, tbf->direction, mask, - compute_usage_by_reservation, + compute_usage_for_algo_a, &tfi, &usf); if (tbf->direction == GPRS_RLCMAC_UL_TBF && usf < 0) { -- cgit v1.2.3