aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tbf/TbfTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tbf/TbfTest.cpp')
-rw-r--r--tests/tbf/TbfTest.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index 895ba8e..c868ca2 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -1105,6 +1105,61 @@ static void test_tbf_gprs_egprs()
gprs_bssgp_destroy();
}
+static void test_tbf_ws()
+{
+ BTS the_bts;
+ gprs_rlcmac_bts *bts;
+ uint8_t ts_no = 4;
+ uint8_t ms_class = 12;
+ gprs_rlcmac_dl_tbf *dl_tbf;
+
+ printf("=== start %s ===\n", __func__);
+
+ bts = the_bts.bts_data();
+ setup_bts(&the_bts, ts_no);
+
+ bts->ws_base = 128;
+ bts->ws_pdch = 64;
+ bts->alloc_algorithm = alloc_algorithm_b;
+ bts->trx[0].pdch[2].enable();
+ bts->trx[0].pdch[3].enable();
+ bts->trx[0].pdch[4].enable();
+ bts->trx[0].pdch[5].enable();
+
+ gprs_bssgp_create_and_connect(bts, 33001, 0, 33001,
+ 1234, 1234, 1234, 1, 1, 0, 0, 0);
+
+ /* Does no support EGPRS */
+ dl_tbf = tbf_alloc_dl_tbf(bts, NULL, 0, ms_class, 0, 0);
+ OSMO_ASSERT(dl_tbf != NULL);
+ fprintf(stderr, "DL TBF slots: 0x%02x, N: %d, WS: %d\n",
+ dl_tbf->dl_slots(),
+ pcu_bitcount(dl_tbf->dl_slots()),
+ dl_tbf->window()->ws());
+ OSMO_ASSERT(pcu_bitcount(dl_tbf->dl_slots()) == 4);
+ OSMO_ASSERT(dl_tbf->window()->ws() == 64);
+ tbf_free(dl_tbf);
+
+ /* EGPRS-only */
+ bts->egprs_enabled = 1;
+
+ /* Does support EGPRS */
+ dl_tbf = tbf_alloc_dl_tbf(bts, NULL, 0, ms_class, ms_class, 0);
+
+ OSMO_ASSERT(dl_tbf != NULL);
+ fprintf(stderr, "DL TBF slots: 0x%02x, N: %d, WS: %d\n",
+ dl_tbf->dl_slots(),
+ pcu_bitcount(dl_tbf->dl_slots()),
+ dl_tbf->window()->ws());
+ OSMO_ASSERT(pcu_bitcount(dl_tbf->dl_slots()) == 4);
+ OSMO_ASSERT(dl_tbf->window()->ws() == 128 + 4 * 64);
+ tbf_free(dl_tbf);
+
+ printf("=== end %s ===\n", __func__);
+
+ gprs_bssgp_destroy();
+}
+
static const struct log_info_cat default_categories[] = {
{"DCSN1", "\033[1;31m", "Concrete Syntax Notation One (CSN1)", LOGL_INFO, 0},
{"DL1IF", "\033[1;32m", "GPRS PCU L1 interface (L1IF)", LOGL_DEBUG, 1},
@@ -1163,6 +1218,7 @@ int main(int argc, char **argv)
test_tbf_dl_flow_and_rach_single_phase();
test_tbf_dl_reuse();
test_tbf_gprs_egprs();
+ test_tbf_ws();
if (getenv("TALLOC_REPORT_FULL"))
talloc_report_full(tall_pcu_ctx, stderr);