[PATCH] osmo-pcu[master]: Simplify TS alloc: fix allocation calls

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Fri Jan 26 10:18:48 UTC 2018


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/4084

to look at the new patch set (#2).

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#228
---
M src/bts.cpp
M src/tbf.cpp
M tests/alloc/AllocTest.cpp
M tests/tbf/TbfTest.cpp
4 files changed, 26 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/84/4084/2

diff --git a/src/bts.cpp b/src/bts.cpp
index 94354f2..d652c59 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -749,7 +749,7 @@
 		// 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 "
diff --git a/src/tbf.cpp b/src/tbf.cpp
index ea3ffe3..8cfca3a 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -403,7 +403,8 @@
 /* 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 @@
 
 	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");
diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp
index 1aa3f63..6e344dc 100644
--- a/tests/alloc/AllocTest.cpp
+++ b/tests/alloc/AllocTest.cpp
@@ -213,7 +213,7 @@
 
 	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 @@
 	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 @@
 
 	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 @@
 
 	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 @@
 
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 aa1d7ac..fbed45a 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -83,14 +83,14 @@
 	 */
 	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 @@
 
 	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 @@
 		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 @@
 	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 @@
 	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",

-- 
To view, visit https://gerrit.osmocom.org/4084
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I43c76cb49093b40eb854d324e898e821270053dc
Gerrit-PatchSet: 2
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list