aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-03-29 12:13:13 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-03-31 17:39:50 +0200
commitce3bd2522a3cbe4fbdd0b5dba86a15b54cb2162c (patch)
tree330032e7c9ab82ead7b990e519ad085c9fd4b395 /tests
parent222f6741167044c2bb965a73cec0afeb5ca5302e (diff)
Pick unreserved UL FN when allocating an SBA
Make sure an unreserved FN is picked and reserved when allocating and scheduling an SBA. In practice this has no change in behavior right now, since anyway using an offset of 52 FNs ensure no USF or POLL has alredy been scheduled that far in the future. Since it's also impossible to allocate more than 1 SBA per PDCH and RTS FN, we are also safe about multiple SBAs being allocated, because we use a hardcoded offset of 52. However, that could change in the future, when we dynamically tweak the current offset of 52 FN based on information from BTS about its AGCH queue load: * If load is high, we may need to increase the offset since it will take more time for the BTS to transmit the TBF and hence we must reserve a TBF starting time further in the future (higher FN). * If load turns low, we may schedule next SBA a bit more nearby in time than the previously allocated SBA, hence here there could be a collision. Related: OS#5020 Change-Id: I2d4e21e2307de6c17748e8da5c7e149c947a7eb9
Diffstat (limited to 'tests')
-rw-r--r--tests/ulc/PdchUlcTest.cpp25
-rw-r--r--tests/ulc/PdchUlcTest.ok9
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/ulc/PdchUlcTest.cpp b/tests/ulc/PdchUlcTest.cpp
index 00991012..f0e8dd91 100644
--- a/tests/ulc/PdchUlcTest.cpp
+++ b/tests/ulc/PdchUlcTest.cpp
@@ -212,6 +212,30 @@ static void test_fn_wrap_around()
printf("=== end: %s ===\n", __FUNCTION__);
}
+static void test_next_free_fn_sba()
+{
+ printf("=== start: %s ===\n", __FUNCTION__);
+ struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
+ struct gprs_rlcmac_pdch *pdch = &bts->trx[0].pdch[0];
+ struct gprs_rlcmac_sba *sba1, *sba2, *sba3, *sba4;
+
+ pdch->last_rts_fn = 52;
+ printf("*** ALLOC 1 SBA FN=%" PRIu32 ":\n", pdch->last_rts_fn);
+ sba1 = sba_alloc(bts, pdch, 0);
+ print_ulc_nodes(pdch->ulc);
+
+ pdch->last_rts_fn = 65;
+ printf("*** ALLOC 3 SBA FN=%" PRIu32 ":\n", pdch->last_rts_fn);
+ sba2 = sba_alloc(bts, pdch, 0);
+ sba3 = sba_alloc(bts, pdch, 0);
+ sba4 = sba_alloc(bts, pdch, 0);
+ print_ulc_nodes(pdch->ulc);
+ (void)sba1; (void)sba2; (void)sba3; (void)sba4;
+
+ talloc_free(bts);
+ printf("=== end: %s ===\n", __FUNCTION__);
+}
+
int main(int argc, char **argv)
{
tall_pcu_ctx = talloc_named_const(NULL, 1, "pdch_ulc test context");
@@ -231,6 +255,7 @@ int main(int argc, char **argv)
test_reserve_multiple();
test_fn_wrap_around();
+ test_next_free_fn_sba();
talloc_free(the_pcu);
return EXIT_SUCCESS;
diff --git a/tests/ulc/PdchUlcTest.ok b/tests/ulc/PdchUlcTest.ok
index f20fb309..5bab5cc4 100644
--- a/tests/ulc/PdchUlcTest.ok
+++ b/tests/ulc/PdchUlcTest.ok
@@ -247,3 +247,12 @@ FN=34 type=POLL
FN=39 type=POLL
*** EXPIRE FN=43:
=== end: test_fn_wrap_around ===
+=== start: test_next_free_fn_sba ===
+*** ALLOC 1 SBA FN=52:
+FN=104 type=SBA
+*** ALLOC 3 SBA FN=65:
+FN=104 type=SBA
+FN=117 type=SBA
+FN=121 type=SBA
+FN=125 type=SBA
+=== end: test_next_free_fn_sba ===