From 50272a477673c98a98da9f2e9d5f555830112dc7 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 10 May 2021 12:25:20 +0200 Subject: [PATCH] alloc_algorithm_b: Rearrange variable initialization Untangle variable assignment at the start of the function. Changes end up in same kind of assignment, but are far easier to understand based on the variable use later on. * reserved_{dl,ul}_slots contain mask of TS either "previously-reserved" or "intended to be reserved now" based on MS's ms_class. * {dl,ul}_slots contain a derived mask from the one above, filtered further based on more factors like type of allocation requested (multi vs single), available USFs (UL), etc. Change-Id: If3cfa82f8b793a87e97145ee8a6fc0fe1a61add6 --- src/gprs_rlcmac_ts_alloc.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp index e8c9bc4d..5ccbb9fa 100644 --- a/src/gprs_rlcmac_ts_alloc.cpp +++ b/src/gprs_rlcmac_ts_alloc.cpp @@ -883,10 +883,8 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf_, /* Step 1: Get current state from the MS object */ - OSMO_ASSERT(ms); - - dl_slots = ms_reserved_dl_slots(ms); - ul_slots = ms_reserved_ul_slots(ms); + reserved_dl_slots = ms_reserved_dl_slots(ms); + reserved_ul_slots = ms_reserved_ul_slots(ms); first_common_ts = ms_first_common_ts(ms); trx = ms_current_trx(ms); @@ -901,14 +899,13 @@ int alloc_algorithm_b(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf_, if (!trx) trx = &bts->trx[trx_no]; - if (!dl_slots || !ul_slots) { - rc = find_multi_slots(trx, ms_ms_class(ms), &ul_slots, &dl_slots); + if (!reserved_dl_slots || !reserved_ul_slots) { + rc = find_multi_slots(trx, ms_ms_class(ms), &reserved_ul_slots, &reserved_dl_slots); if (rc < 0) return rc; } - - reserved_dl_slots = dl_slots; - reserved_ul_slots = ul_slots; + dl_slots = reserved_dl_slots; + ul_slots = reserved_ul_slots; /* Step 3a: Derive the slot set for the current TBF */ rc = tbf_select_slot_set(tbf, trx, single, ul_slots, dl_slots, reserved_ul_slots, reserved_dl_slots,