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
This commit is contained in:
Max 2018-01-26 11:01:35 +01:00
parent e9fe0e3d06
commit 92b7a50605
4 changed files with 26 additions and 19 deletions

View File

@ -749,7 +749,7 @@ int BTS::rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, bool is_11bit,
// Create new TBF
/* FIXME: Copy and paste with other routines.. */
tbf = tbf_alloc_ul_tbf(&m_bts, NULL, -1, 0, ms_class, 1);
tbf = tbf_alloc_ul_tbf(&m_bts, NULL, -1, 0, ms_class, true);
if (!tbf) {
LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource sending "

View File

@ -403,7 +403,8 @@ gprs_rlcmac_ul_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts,
/* FIXME: Copy and paste with tbf_new_dl_assignment */
/* create new TBF, use same TRX as DL TBF */
/* use multislot class of downlink TBF */
tbf = tbf_alloc_ul_tbf(bts, ms, use_trx, ms_class, egprs_ms_class, 0);
tbf = tbf_alloc_ul_tbf(bts, ms, use_trx, ms_class, egprs_ms_class,
false);
if (!tbf) {
LOGP(DTBF, LOGL_NOTICE, "No PDCH resource\n");
/* FIXME: send reject */
@ -1350,7 +1351,7 @@ int gprs_rlcmac_tbf::establish_dl_tbf_on_pacch()
new_tbf = tbf_alloc_dl_tbf(bts->bts_data(), ms(),
this->trx->trx_no, ms_class(),
ms() ? ms()->egprs_ms_class() : 0, 0);
ms() ? ms()->egprs_ms_class() : 0, false);
if (!new_tbf) {
LOGP(DTBF, LOGL_NOTICE, "No PDCH resource\n");

View File

@ -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++) {

View File

@ -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",