From 92b7a50605793e59b233c537eb870eee3cc08e31 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 26 Jan 2018 11:01:35 +0100 Subject: Simplify TS alloc: fix allocation calls Using the semantic patch below, adjust allocation-related calls to match updated allocator signatures. // spatch --c++ --dir src -I src --sp-file callfix.spatch --in-place --recursive-includes // spatch --c++ --dir tests -I src --sp-file callfix.spatch --in-place --recursive-includes @@ expression A, B, C, D, E; @@ tbf_alloc_ul_tbf(A, B, C, D, E, ( - 1 + true | - 0 + false ) ) @@ expression A, B, C, D, E; @@ tbf_alloc_dl_tbf(A, B, C, D, E, ( - 1 + true | - 0 + false ) ) Change-Id: I43c76cb49093b40eb854d324e898e821270053dc Related: OS#2282 --- tests/alloc/AllocTest.cpp | 25 +++++++++++++++---------- tests/tbf/TbfTest.cpp | 13 +++++++------ 2 files changed, 22 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp index 1aa3f636..6e344dcb 100644 --- a/tests/alloc/AllocTest.cpp +++ b/tests/alloc/AllocTest.cpp @@ -213,7 +213,7 @@ static inline bool test_alloc_b_ul_dl(bool ts0, bool ts1, bool ts2, bool ts3, bo enable_ts_on_bts(bts, ts0, ts1, ts2, ts3, ts4, ts5, ts6, ts7); - ul_tbf = tbf_alloc_ul_tbf(bts, NULL, -1, ms_class, 0, 1); + ul_tbf = tbf_alloc_ul_tbf(bts, NULL, -1, ms_class, 0, true); if (!ul_tbf) return false; @@ -223,7 +223,8 @@ static inline bool test_alloc_b_ul_dl(bool ts0, bool ts1, bool ts2, bool ts3, bo dump_assignment(ul_tbf, "UL", verbose); /* assume final ack has not been sent */ - dl_tbf = tbf_alloc_dl_tbf(bts, ul_tbf->ms(), ul_tbf->ms()->current_trx()->trx_no, ms_class, 0, 0); + dl_tbf = tbf_alloc_dl_tbf(bts, ul_tbf->ms(), ul_tbf->ms()->current_trx()->trx_no, ms_class, 0, + false); if (!dl_tbf) return false; @@ -254,7 +255,7 @@ static inline bool test_alloc_b_dl_ul(bool ts0, bool ts1, bool ts2, bool ts3, bo enable_ts_on_bts(bts, ts0, ts1, ts2, ts3, ts4, ts5, ts6, ts7); - dl_tbf = tbf_alloc_dl_tbf(bts, NULL, -1, ms_class, 0, 1); + dl_tbf = tbf_alloc_dl_tbf(bts, NULL, -1, ms_class, 0, true); if (!dl_tbf) return false; @@ -265,7 +266,8 @@ static inline bool test_alloc_b_dl_ul(bool ts0, bool ts1, bool ts2, bool ts3, bo dump_assignment(dl_tbf, "DL", verbose); - ul_tbf = tbf_alloc_ul_tbf(bts, dl_tbf->ms(), dl_tbf->ms()->current_trx()->trx_no, ms_class, 0, 0); + ul_tbf = tbf_alloc_ul_tbf(bts, dl_tbf->ms(), dl_tbf->ms()->current_trx()->trx_no, ms_class, 0, + false); if (!ul_tbf) return false; @@ -305,7 +307,7 @@ static inline bool test_alloc_b_jolly(uint8_t ms_class) tfi = the_bts.tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1); OSMO_ASSERT(tfi >= 0); - ul_tbf = tbf_alloc_ul_tbf(bts, NULL, .1, ms_class, 0, 0); + ul_tbf = tbf_alloc_ul_tbf(bts, NULL, .1, ms_class, 0, false); if (!ul_tbf) return false; @@ -315,7 +317,8 @@ static inline bool test_alloc_b_jolly(uint8_t ms_class) dump_assignment(ul_tbf, "UL", true); /* assume final ack has not been sent */ - dl_tbf = tbf_alloc_dl_tbf(bts, ul_tbf->ms(), trx_no, ms_class, 0, 0); + dl_tbf = tbf_alloc_dl_tbf(bts, ul_tbf->ms(), trx_no, ms_class, 0, + false); if (!dl_tbf) return false; @@ -466,7 +469,7 @@ static GprsMs *alloc_tbfs(BTS *the_bts, GprsMs *ms, unsigned ms_class, case TEST_MODE_UL_AND_DL: if (ms && ms->ul_tbf()) tbf_free(ms->ul_tbf()); - tbf = tbf_alloc_ul_tbf(bts, ms, trx_no, ms_class, 0, 0); + tbf = tbf_alloc_ul_tbf(bts, ms, trx_no, ms_class, 0, false); if (tbf == NULL) return NULL; break; @@ -475,7 +478,7 @@ static GprsMs *alloc_tbfs(BTS *the_bts, GprsMs *ms, unsigned ms_class, case TEST_MODE_DL_AND_UL: if (ms && ms->dl_tbf()) tbf_free(ms->dl_tbf()); - tbf = tbf_alloc_dl_tbf(bts, ms, trx_no, ms_class, 0, 0); + tbf = tbf_alloc_dl_tbf(bts, ms, trx_no, ms_class, 0, false); if (tbf == NULL) return NULL; } @@ -755,7 +758,8 @@ static void test_2_consecutive_dl_tbfs() trx->pdch[6].enable(); trx->pdch[7].enable(); - dl_tbf1 = tbf_alloc_dl_tbf(bts, NULL, 0, ms_class, egprs_ms_class, 0); + dl_tbf1 = tbf_alloc_dl_tbf(bts, NULL, 0, ms_class, egprs_ms_class, + false); OSMO_ASSERT(dl_tbf1); for (int i = 0; i < 8; i++) { @@ -765,7 +769,8 @@ static void test_2_consecutive_dl_tbfs() OSMO_ASSERT(numTs1 == 4); printf("TBF1: numTs(%d)\n", numTs1); - dl_tbf2 = tbf_alloc_dl_tbf(bts, NULL, 0, ms_class, egprs_ms_class, 0); + dl_tbf2 = tbf_alloc_dl_tbf(bts, NULL, 0, ms_class, egprs_ms_class, + false); OSMO_ASSERT(dl_tbf2); for (int i = 0; i < 8; i++) { diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index aa1d7ac5..fbed45a2 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -83,14 +83,14 @@ static void test_tbf_tlli_update() */ gprs_rlcmac_tbf *dl_tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, - 0, 0, 0, 0); + 0, 0, 0, false); OSMO_ASSERT(dl_tbf != NULL); dl_tbf->update_ms(0x2342, GPRS_RLCMAC_DL_TBF); dl_tbf->set_ta(4); gprs_rlcmac_tbf *ul_tbf = tbf_alloc_ul_tbf(the_bts.bts_data(), dl_tbf->ms(), - 0, 0, 0, 0); + 0, 0, 0, false); OSMO_ASSERT(ul_tbf != NULL); ul_tbf->update_ms(0x2342, GPRS_RLCMAC_UL_TBF); @@ -172,7 +172,8 @@ static gprs_rlcmac_dl_tbf *create_dl_tbf(BTS *the_bts, uint8_t ms_class, tfi = the_bts->tfi_find_free(GPRS_RLCMAC_DL_TBF, &trx_no, -1); OSMO_ASSERT(tfi >= 0); - dl_tbf = tbf_alloc_dl_tbf(bts, NULL, trx_no, ms_class, egprs_ms_class, 1); + dl_tbf = tbf_alloc_dl_tbf(bts, NULL, trx_no, ms_class, egprs_ms_class, + true); dl_tbf->set_ta(0); check_tbf(dl_tbf); @@ -2212,7 +2213,7 @@ static void test_tbf_ws() 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); + dl_tbf = tbf_alloc_dl_tbf(bts, NULL, 0, ms_class, 0, false); OSMO_ASSERT(dl_tbf != NULL); fprintf(stderr, "DL TBF slots: 0x%02x, N: %d, WS: %d\n", dl_tbf->dl_slots(), @@ -2226,7 +2227,7 @@ static void test_tbf_ws() bts->egprs_enabled = 1; /* Does support EGPRS */ - dl_tbf = tbf_alloc_dl_tbf(bts, NULL, 0, ms_class, ms_class, 0); + dl_tbf = tbf_alloc_dl_tbf(bts, NULL, 0, ms_class, ms_class, false); OSMO_ASSERT(dl_tbf != NULL); fprintf(stderr, "DL TBF slots: 0x%02x, N: %d, WS: %d\n", @@ -2270,7 +2271,7 @@ static void test_tbf_update_ws(void) bts->egprs_enabled = 1; /* Does support EGPRS */ - dl_tbf = tbf_alloc_dl_tbf(bts, NULL, 0, ms_class, ms_class, 1); + dl_tbf = tbf_alloc_dl_tbf(bts, NULL, 0, ms_class, ms_class, true); OSMO_ASSERT(dl_tbf != NULL); fprintf(stderr, "DL TBF slots: 0x%02x, N: %d, WS: %d\n", -- cgit v1.2.3