aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gprs_rlcmac_ts_alloc.cpp20
-rw-r--r--tests/tbf/TbfTest.err2
2 files changed, 12 insertions, 10 deletions
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index 116cabe..8d4357e 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -241,25 +241,26 @@ int alloc_algorithm_a(struct gprs_rlcmac_bts *bts,
{
struct gprs_rlcmac_pdch *pdch;
int ts = -1;
+ uint8_t ul_slots, dl_slots;
int usf = -1;
int mask = 0xff;
const char *mask_reason = NULL;
- struct gprs_rlcmac_tbf *ref_tbf;
LOGP(DRLCMAC, LOGL_DEBUG, "Slot Allocation (Algorithm A) for class "
"%d\n", tbf->ms_class());
- if ((ref_tbf = ms->tbf(tbf->direction)))
- mask_reason = "need to reuse TS";
- else if ((ref_tbf = ms->tbf(reverse(tbf->direction))))
- mask_reason = ref_tbf->direction == GPRS_RLCMAC_UL_TBF ?
- "not an uplink TBF" : "not a downlink TBF";
+ dl_slots = ms->reserved_dl_slots();
+ ul_slots = ms->reserved_ul_slots();
- if (ref_tbf)
- ts = ref_tbf->first_common_ts;
+ ts = ms->first_common_ts();
- if (ts >= 0)
+ if (ts >= 0) {
+ mask_reason = "need to reuse TS";
mask = 1 << ts;
+ } else if (dl_slots || ul_slots) {
+ mask_reason = "need to use a reserved common TS";
+ mask = dl_slots & ul_slots;
+ }
mask = find_possible_pdchs(tbf->trx, 1, mask, mask_reason);
if (!mask)
@@ -296,6 +297,7 @@ int alloc_algorithm_a(struct gprs_rlcmac_bts *bts,
}
/* the only one TS is the common TS */
tbf->first_ts = tbf->first_common_ts = ts;
+ ms->set_reserved_slots(tbf->trx, 1 << ts, 1 << ts);
tbf->upgrade_to_multislot = 0;
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index 317196c..1f016ed 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -20,7 +20,7 @@ Allocating UL TBF: TFI=0 TRX=0 MS_CLASS=0
Slot Allocation (Algorithm A) for class 0
- Skipping TS 0, because not enabled
- Skipping TS 1, because not enabled
-- Skipping TS 3, because not a downlink TBF
+- Skipping TS 3, because need to reuse TS
- Skipping TS 4, because not enabled
- Skipping TS 5, because not enabled
- Skipping TS 6, because not enabled