From 4af30533f0e01a7156ff92f7689ccf35900740c3 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 25 Dec 2013 19:16:55 +0100 Subject: alloc/tests: Create an allocation test for various scenarious The allocation in the TBF/BTS code is quite complex. In parts this is due the assignment and requests occuring under differen circumstances. Attempt to re-create the commono scenarios. Remove the bogus msclass check in gprs_rlcmac_tbf::update as the allocation code will check the ms class anyway. --- tests/alloc/AllocTest.cpp | 141 ++++++++++++++++++++++++++++++++++++++++++++++ tests/alloc/AllocTest.ok | 32 +++++++++++ 2 files changed, 173 insertions(+) (limited to 'tests') diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp index 5790ade1..5c903210 100644 --- a/tests/alloc/AllocTest.cpp +++ b/tests/alloc/AllocTest.cpp @@ -97,6 +97,146 @@ static void test_alloc_a() test_alloc_a(GPRS_RLCMAC_UL_TBF, 7); } +static void dump_assignment(struct gprs_rlcmac_tbf *tbf, const char *dir) +{ + for (int i = 0; i < ARRAY_SIZE(tbf->pdch); ++i) + if (tbf->pdch[i]) + printf("PDCH[%d] is used for %s\n", i, dir); + printf("PDCH[%d] is control_ts for %s\n", tbf->control_ts, dir); + printf("PDCH[%d] is first common for %s\n", tbf->first_common_ts, dir); +} + +static void test_alloc_b() +{ + printf("Going to test multislot assignment.\n"); + /* + * PDCH is on TS 6,7,8 and we start with a UL allocation and + * then follow two DL allocations (once single, once normal). + * + * Uplink assigned and still available.. + */ + { + BTS the_bts; + struct gprs_rlcmac_bts *bts; + struct gprs_rlcmac_trx *trx; + int tfi; + uint8_t ts_no, trx_no; + + gprs_rlcmac_tbf *ul_tbf, *dl_tbf; + + printf("Testing UL then DL assignment.\n"); + + bts = the_bts.bts_data(); + bts->alloc_algorithm = alloc_algorithm_b; + + trx = &bts->trx[0]; + trx->pdch[5].enable(); + trx->pdch[6].enable(); + trx->pdch[7].enable(); + + tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); + OSMO_ASSERT(tfi >= 0); + ul_tbf = tbf_alloc(bts, NULL, GPRS_RLCMAC_UL_TBF, tfi, trx_no, 0, 1); + OSMO_ASSERT(ul_tbf); + dump_assignment(ul_tbf, "UL"); + + /* assume final ack has not been sent */ + tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); + OSMO_ASSERT(tfi >= 0); + dl_tbf = tbf_alloc(bts, ul_tbf, GPRS_RLCMAC_DL_TBF, tfi, trx_no, 0, 0); + OSMO_ASSERT(dl_tbf); + dump_assignment(dl_tbf, "DL"); + + tbf_free(dl_tbf); + tbf_free(ul_tbf); + } + + /** + * Test with the other order.. first DL and then UL + */ + { + BTS the_bts; + struct gprs_rlcmac_bts *bts; + struct gprs_rlcmac_trx *trx; + int tfi; + uint8_t ts_no, trx_no; + + gprs_rlcmac_tbf *ul_tbf, *dl_tbf; + + printf("Testing DL then UL assignment followed by update\n"); + + bts = the_bts.bts_data(); + bts->alloc_algorithm = alloc_algorithm_b; + + trx = &bts->trx[0]; + trx->pdch[5].enable(); + trx->pdch[6].enable(); + trx->pdch[7].enable(); + + tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); + OSMO_ASSERT(tfi >= 0); + dl_tbf = tbf_alloc(bts, NULL, GPRS_RLCMAC_DL_TBF, tfi, trx_no, 0, 1); + dl_tbf->m_tlli = 0x23; + dl_tbf->m_tlli_valid = true; + OSMO_ASSERT(dl_tbf); + dump_assignment(dl_tbf, "DL"); + + tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); + OSMO_ASSERT(tfi >= 0); + ul_tbf = tbf_alloc(bts, dl_tbf, GPRS_RLCMAC_UL_TBF, tfi, trx_no, 0, 0); + ul_tbf->m_tlli = 0x23; + ul_tbf->m_tlli_valid = true; + ul_tbf->dir.ul.contention_resolution_done = 1; + OSMO_ASSERT(ul_tbf); + dump_assignment(ul_tbf, "UL"); + + /* now update the dl_tbf */ + dl_tbf->update(); + dump_assignment(dl_tbf, "DL"); + + tbf_free(dl_tbf); + tbf_free(ul_tbf); + } + + /* Andreas osmocom-pcu example */ + { + BTS the_bts; + struct gprs_rlcmac_bts *bts; + struct gprs_rlcmac_trx *trx; + int tfi; + uint8_t ts_no, trx_no; + + gprs_rlcmac_tbf *ul_tbf, *dl_tbf; + + printf("Testing jolly example\n"); + + bts = the_bts.bts_data(); + bts->alloc_algorithm = alloc_algorithm_b; + + trx = &bts->trx[0]; + trx->pdch[1].enable(); + trx->pdch[2].enable(); + trx->pdch[3].enable(); + trx->pdch[4].enable(); + + tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); + OSMO_ASSERT(tfi >= 0); + ul_tbf = tbf_alloc(bts, NULL, GPRS_RLCMAC_UL_TBF, tfi, trx_no, 0, 0); + OSMO_ASSERT(ul_tbf); + dump_assignment(ul_tbf, "UL"); + + /* assume final ack has not been sent */ + tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); + OSMO_ASSERT(tfi >= 0); + dl_tbf = tbf_alloc(bts, ul_tbf, GPRS_RLCMAC_DL_TBF, tfi, trx_no, 0, 0); + OSMO_ASSERT(dl_tbf); + dump_assignment(dl_tbf, "DL"); + + tbf_free(dl_tbf); + tbf_free(ul_tbf); + } +} + int main(int argc, char **argv) { tall_pcu_ctx = talloc_named_const(NULL, 1, "moiji-mobile AllocTest context"); @@ -109,6 +249,7 @@ int main(int argc, char **argv) log_set_print_filename(osmo_stderr_target, 0); test_alloc_a(); + test_alloc_b(); return EXIT_SUCCESS; } diff --git a/tests/alloc/AllocTest.ok b/tests/alloc/AllocTest.ok index 86a8c193..271a4200 100644 --- a/tests/alloc/AllocTest.ok +++ b/tests/alloc/AllocTest.ok @@ -1,2 +1,34 @@ Testing alloc_a direction(0) Testing alloc_a direction(1) +Going to test multislot assignment. +Testing UL then DL assignment. +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing DL then UL assignment followed by update +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing jolly example +PDCH[3] is used for UL +PDCH[3] is control_ts for UL +PDCH[3] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[3] is control_ts for DL +PDCH[3] is first common for DL -- cgit v1.2.3 From c7b998cc73005fd7da26f8fe2d562e40691a8ae6 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 25 Dec 2013 19:25:10 +0100 Subject: alloc/test: Go through all possible ms_classes for the allocation Generate results for all possible classes. --- tests/alloc/AllocTest.cpp | 29 +- tests/alloc/AllocTest.ok | 935 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 955 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp index 5c903210..68fcb2a4 100644 --- a/tests/alloc/AllocTest.cpp +++ b/tests/alloc/AllocTest.cpp @@ -106,9 +106,9 @@ static void dump_assignment(struct gprs_rlcmac_tbf *tbf, const char *dir) printf("PDCH[%d] is first common for %s\n", tbf->first_common_ts, dir); } -static void test_alloc_b() +static void test_alloc_b(int ms_class) { - printf("Going to test multislot assignment.\n"); + printf("Going to test multislot assignment MS_CLASS=%d\n", ms_class); /* * PDCH is on TS 6,7,8 and we start with a UL allocation and * then follow two DL allocations (once single, once normal). @@ -136,17 +136,19 @@ static void test_alloc_b() tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); OSMO_ASSERT(tfi >= 0); - ul_tbf = tbf_alloc(bts, NULL, GPRS_RLCMAC_UL_TBF, tfi, trx_no, 0, 1); + ul_tbf = tbf_alloc(bts, NULL, GPRS_RLCMAC_UL_TBF, tfi, trx_no, ms_class, 1); OSMO_ASSERT(ul_tbf); dump_assignment(ul_tbf, "UL"); /* assume final ack has not been sent */ tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); OSMO_ASSERT(tfi >= 0); - dl_tbf = tbf_alloc(bts, ul_tbf, GPRS_RLCMAC_DL_TBF, tfi, trx_no, 0, 0); + dl_tbf = tbf_alloc(bts, ul_tbf, GPRS_RLCMAC_DL_TBF, tfi, trx_no, ms_class, 0); OSMO_ASSERT(dl_tbf); dump_assignment(dl_tbf, "DL"); + OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts); + tbf_free(dl_tbf); tbf_free(ul_tbf); } @@ -175,7 +177,7 @@ static void test_alloc_b() tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); OSMO_ASSERT(tfi >= 0); - dl_tbf = tbf_alloc(bts, NULL, GPRS_RLCMAC_DL_TBF, tfi, trx_no, 0, 1); + dl_tbf = tbf_alloc(bts, NULL, GPRS_RLCMAC_DL_TBF, tfi, trx_no, ms_class, 1); dl_tbf->m_tlli = 0x23; dl_tbf->m_tlli_valid = true; OSMO_ASSERT(dl_tbf); @@ -183,16 +185,19 @@ static void test_alloc_b() tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); OSMO_ASSERT(tfi >= 0); - ul_tbf = tbf_alloc(bts, dl_tbf, GPRS_RLCMAC_UL_TBF, tfi, trx_no, 0, 0); + ul_tbf = tbf_alloc(bts, dl_tbf, GPRS_RLCMAC_UL_TBF, tfi, trx_no, ms_class, 0); ul_tbf->m_tlli = 0x23; ul_tbf->m_tlli_valid = true; ul_tbf->dir.ul.contention_resolution_done = 1; OSMO_ASSERT(ul_tbf); dump_assignment(ul_tbf, "UL"); + OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts); + /* now update the dl_tbf */ dl_tbf->update(); dump_assignment(dl_tbf, "DL"); + OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts); tbf_free(dl_tbf); tbf_free(ul_tbf); @@ -221,22 +226,30 @@ static void test_alloc_b() tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); OSMO_ASSERT(tfi >= 0); - ul_tbf = tbf_alloc(bts, NULL, GPRS_RLCMAC_UL_TBF, tfi, trx_no, 0, 0); + ul_tbf = tbf_alloc(bts, NULL, GPRS_RLCMAC_UL_TBF, tfi, trx_no, ms_class, 0); OSMO_ASSERT(ul_tbf); dump_assignment(ul_tbf, "UL"); /* assume final ack has not been sent */ tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); OSMO_ASSERT(tfi >= 0); - dl_tbf = tbf_alloc(bts, ul_tbf, GPRS_RLCMAC_DL_TBF, tfi, trx_no, 0, 0); + dl_tbf = tbf_alloc(bts, ul_tbf, GPRS_RLCMAC_DL_TBF, tfi, trx_no, ms_class, 0); OSMO_ASSERT(dl_tbf); dump_assignment(dl_tbf, "DL"); + OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts); + tbf_free(dl_tbf); tbf_free(ul_tbf); } } +static void test_alloc_b() +{ + for (int i = 0; i < 30; ++i) + test_alloc_b(i); +} + int main(int argc, char **argv) { tall_pcu_ctx = talloc_named_const(NULL, 1, "moiji-mobile AllocTest context"); diff --git a/tests/alloc/AllocTest.ok b/tests/alloc/AllocTest.ok index 271a4200..9fb2db96 100644 --- a/tests/alloc/AllocTest.ok +++ b/tests/alloc/AllocTest.ok @@ -1,6 +1,6 @@ Testing alloc_a direction(0) Testing alloc_a direction(1) -Going to test multislot assignment. +Going to test multislot assignment MS_CLASS=0 Testing UL then DL assignment. PDCH[6] is used for UL PDCH[6] is control_ts for UL @@ -32,3 +32,936 @@ PDCH[3] is used for DL PDCH[4] is used for DL PDCH[3] is control_ts for DL PDCH[3] is first common for DL +Going to test multislot assignment MS_CLASS=1 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[1] is used for UL +PDCH[1] is control_ts for UL +PDCH[1] is first common for UL +PDCH[1] is used for DL +PDCH[1] is control_ts for DL +PDCH[1] is first common for DL +Going to test multislot assignment MS_CLASS=2 +Testing UL then DL assignment. +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing DL then UL assignment followed by update +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=3 +Testing UL then DL assignment. +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing DL then UL assignment followed by update +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=4 +Testing UL then DL assignment. +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing DL then UL assignment followed by update +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=5 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[1] is used for UL +PDCH[1] is control_ts for UL +PDCH[1] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[1] is control_ts for DL +PDCH[1] is first common for DL +Going to test multislot assignment MS_CLASS=6 +Testing UL then DL assignment. +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing DL then UL assignment followed by update +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=7 +Testing UL then DL assignment. +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing DL then UL assignment followed by update +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=8 +Testing UL then DL assignment. +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing DL then UL assignment followed by update +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing jolly example +PDCH[3] is used for UL +PDCH[3] is control_ts for UL +PDCH[3] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[3] is control_ts for DL +PDCH[3] is first common for DL +Going to test multislot assignment MS_CLASS=9 +Testing UL then DL assignment. +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing DL then UL assignment followed by update +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=10 +Testing UL then DL assignment. +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing DL then UL assignment followed by update +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing jolly example +PDCH[3] is used for UL +PDCH[3] is control_ts for UL +PDCH[3] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[3] is control_ts for DL +PDCH[3] is first common for DL +Going to test multislot assignment MS_CLASS=11 +Testing UL then DL assignment. +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing DL then UL assignment followed by update +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing jolly example +PDCH[3] is used for UL +PDCH[3] is control_ts for UL +PDCH[3] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[3] is control_ts for DL +PDCH[3] is first common for DL +Going to test multislot assignment MS_CLASS=12 +Testing UL then DL assignment. +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing DL then UL assignment followed by update +PDCH[6] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +PDCH[6] is used for UL +PDCH[6] is control_ts for UL +PDCH[6] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[6] is control_ts for DL +PDCH[6] is first common for DL +Testing jolly example +PDCH[3] is used for UL +PDCH[3] is control_ts for UL +PDCH[3] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[3] is control_ts for DL +PDCH[3] is first common for DL +Going to test multislot assignment MS_CLASS=13 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[6] is used for UL +PDCH[7] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[1] is used for UL +PDCH[2] is used for UL +PDCH[3] is used for UL +PDCH[1] is control_ts for UL +PDCH[1] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[1] is control_ts for DL +PDCH[1] is first common for DL +Going to test multislot assignment MS_CLASS=14 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[6] is used for UL +PDCH[7] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[1] is used for UL +PDCH[2] is used for UL +PDCH[3] is used for UL +PDCH[4] is used for UL +PDCH[1] is control_ts for UL +PDCH[1] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[1] is control_ts for DL +PDCH[1] is first common for DL +Going to test multislot assignment MS_CLASS=15 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[6] is used for UL +PDCH[7] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[1] is used for UL +PDCH[2] is used for UL +PDCH[3] is used for UL +PDCH[4] is used for UL +PDCH[1] is control_ts for UL +PDCH[1] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[1] is control_ts for DL +PDCH[1] is first common for DL +Going to test multislot assignment MS_CLASS=16 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[6] is used for UL +PDCH[7] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[1] is used for UL +PDCH[2] is used for UL +PDCH[3] is used for UL +PDCH[4] is used for UL +PDCH[1] is control_ts for UL +PDCH[1] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[1] is control_ts for DL +PDCH[1] is first common for DL +Going to test multislot assignment MS_CLASS=17 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[6] is used for UL +PDCH[7] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[1] is used for UL +PDCH[2] is used for UL +PDCH[3] is used for UL +PDCH[4] is used for UL +PDCH[1] is control_ts for UL +PDCH[1] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[1] is control_ts for DL +PDCH[1] is first common for DL +Going to test multislot assignment MS_CLASS=18 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[6] is used for UL +PDCH[7] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[1] is used for UL +PDCH[2] is used for UL +PDCH[3] is used for UL +PDCH[4] is used for UL +PDCH[1] is control_ts for UL +PDCH[1] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[1] is control_ts for DL +PDCH[1] is first common for DL +Going to test multislot assignment MS_CLASS=19 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=20 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=21 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=22 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=23 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=24 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=25 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=26 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=27 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=28 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL +Going to test multislot assignment MS_CLASS=29 +Testing UL then DL assignment. +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing DL then UL assignment followed by update +PDCH[5] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +PDCH[5] is used for UL +PDCH[5] is control_ts for UL +PDCH[5] is first common for UL +PDCH[5] is used for DL +PDCH[6] is used for DL +PDCH[7] is used for DL +PDCH[5] is control_ts for DL +PDCH[5] is first common for DL +Testing jolly example +PDCH[2] is used for UL +PDCH[2] is control_ts for UL +PDCH[2] is first common for UL +PDCH[1] is used for DL +PDCH[2] is used for DL +PDCH[3] is used for DL +PDCH[4] is used for DL +PDCH[2] is control_ts for DL +PDCH[2] is first common for DL -- cgit v1.2.3 From f3eec04655ad0ac629950f3891cb97720ab608e5 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 26 Dec 2013 10:19:18 +0100 Subject: alloc/test: Add a crazy test that tests each possible combination Make a crazy test that will test each possible PDCH configuration and MS Class and verify that the UL/DL assignments work and that they are on the same first_common_ts. --- tests/alloc/AllocTest.cpp | 130 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) (limited to 'tests') diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp index 68fcb2a4..80e8c344 100644 --- a/tests/alloc/AllocTest.cpp +++ b/tests/alloc/AllocTest.cpp @@ -244,10 +244,140 @@ static void test_alloc_b(int ms_class) } } +#define ENABLE_PDCH(ts_no, enable_flag, trx) \ + if (enable_flag) \ + trx->pdch[ts_no].enable(); + +static void test_alloc_b(bool ts0, bool ts1, bool ts2, bool ts3, bool ts4, bool ts5, bool ts6, bool ts7, int ms_class) +{ + /* we can test the allocation failures differently */ + if (!ts0 && !ts1 && !ts2 && !ts3 && !ts4 && !ts5 && !ts6 && !ts7) + return; + + printf("Mass test: TS0(%c%c%c%c%c%c%c%c)TS7 MS_Class=%d\n", + ts0 ? 'O' : 'x', + ts1 ? 'O' : 'x', + ts2 ? 'O' : 'x', + ts3 ? 'O' : 'x', + ts4 ? 'O' : 'x', + ts5 ? 'O' : 'x', + ts6 ? 'O' : 'x', + ts7 ? 'O' : 'x', ms_class); + fflush(stdout); + + { + BTS the_bts; + struct gprs_rlcmac_bts *bts; + struct gprs_rlcmac_trx *trx; + int tfi; + uint8_t ts_no, trx_no; + + gprs_rlcmac_tbf *ul_tbf, *dl_tbf; + + bts = the_bts.bts_data(); + bts->alloc_algorithm = alloc_algorithm_b; + + trx = &bts->trx[0]; + ENABLE_PDCH(0, ts0, trx); + ENABLE_PDCH(1, ts1, trx); + ENABLE_PDCH(2, ts2, trx); + ENABLE_PDCH(3, ts3, trx); + ENABLE_PDCH(4, ts4, trx); + ENABLE_PDCH(5, ts5, trx); + ENABLE_PDCH(6, ts6, trx); + ENABLE_PDCH(7, ts7, trx); + + tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); + + OSMO_ASSERT(tfi >= 0); + ul_tbf = tbf_alloc(bts, NULL, GPRS_RLCMAC_UL_TBF, tfi, trx_no, ms_class, 1); + OSMO_ASSERT(ul_tbf); + + /* assume final ack has not been sent */ + tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); + OSMO_ASSERT(tfi >= 0); + dl_tbf = tbf_alloc(bts, ul_tbf, GPRS_RLCMAC_DL_TBF, tfi, trx_no, ms_class, 0); + OSMO_ASSERT(dl_tbf); + + /* verify that both are on the same ts */ + OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts); + + tbf_free(dl_tbf); + tbf_free(ul_tbf); + } + + /** + * Test with the other order.. first DL and then UL + */ + { + BTS the_bts; + struct gprs_rlcmac_bts *bts; + struct gprs_rlcmac_trx *trx; + int tfi; + uint8_t ts_no, trx_no; + + gprs_rlcmac_tbf *ul_tbf, *dl_tbf; + + bts = the_bts.bts_data(); + bts->alloc_algorithm = alloc_algorithm_b; + + trx = &bts->trx[0]; + ENABLE_PDCH(0, ts0, trx); + ENABLE_PDCH(1, ts1, trx); + ENABLE_PDCH(2, ts2, trx); + ENABLE_PDCH(3, ts3, trx); + ENABLE_PDCH(4, ts4, trx); + ENABLE_PDCH(5, ts5, trx); + ENABLE_PDCH(6, ts6, trx); + ENABLE_PDCH(7, ts7, trx); + + tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); + OSMO_ASSERT(tfi >= 0); + dl_tbf = tbf_alloc(bts, NULL, GPRS_RLCMAC_DL_TBF, tfi, trx_no, ms_class, 1); + OSMO_ASSERT(dl_tbf); + dl_tbf->m_tlli = 0x23; + dl_tbf->m_tlli_valid = true; + + tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); + OSMO_ASSERT(tfi >= 0); + ul_tbf = tbf_alloc(bts, dl_tbf, GPRS_RLCMAC_UL_TBF, tfi, trx_no, ms_class, 0); + OSMO_ASSERT(ul_tbf); + ul_tbf->m_tlli = 0x23; + ul_tbf->m_tlli_valid = true; + ul_tbf->dir.ul.contention_resolution_done = 1; + + OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts); + + /* now update the dl_tbf */ + dl_tbf->update(); + OSMO_ASSERT(dl_tbf->first_common_ts == ul_tbf->first_common_ts); + + tbf_free(dl_tbf); + tbf_free(ul_tbf); + } +} + +static void test_all_alloc_b() +{ + /* it is a bit crazy... */ + for (uint8_t ts0 = 0; ts0 < 2; ++ts0) + for (uint8_t ts1 = 0; ts1 < 2; ++ts1) + for (uint8_t ts2 = 0; ts2 < 2; ++ts2) + for (uint8_t ts3 = 0; ts3 < 2; ++ts3) + for (uint8_t ts4 = 0; ts4 < 2; ++ts4) + for (uint8_t ts5 = 0; ts5 < 2; ++ts5) + for (uint8_t ts6 = 0; ts6 < 2; ++ts6) + for (uint8_t ts7 = 0; ts7 < 2; ++ts7) + for (int ms_class = 0; ms_class < 30; ++ms_class) + test_alloc_b(ts0, ts1, ts2, ts3, ts4, ts5, ts6, ts7, ms_class); +} + static void test_alloc_b() { for (int i = 0; i < 30; ++i) test_alloc_b(i); + + test_all_alloc_b(); } int main(int argc, char **argv) -- cgit v1.2.3