diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-07-16 15:04:07 +0200 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-07-16 19:24:16 +0200 |
commit | 7af53e61f0a9de8c6ebe412d7bb0ffe11f71dbbd (patch) | |
tree | 5ef442d57d1c38d901d5ce5f1e512931a07d92f0 /src | |
parent | 88fb6136fb8b69f37ded4c868689556f3bde3ac8 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/gprs_rlcmac_ts_alloc.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
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) { |