Change in osmo-bts[master]: [VAMOS] Merge bts_trx_init() into gsm_bts_trx_alloc()

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Tue May 11 09:42:20 UTC 2021


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/24177 )

Change subject: [VAMOS] Merge bts_trx_init() into gsm_bts_trx_alloc()
......................................................................

[VAMOS] Merge bts_trx_init() into gsm_bts_trx_alloc()

gsm_bts_trx_alloc() already does initialize some fields of the
allocated 'struct gsm_bts_trx' instance, and having an additional
function for initializing the other fields makes no sense.

Note that I intentionally didn't merge a call to bts_model_trx_init()
into gsm_bts_trx_alloc(), because this would break some assumptions
regarding the order of initialization and cause regressions.

This also allows us to not call bts_model_trx_init() from tests.

Change-Id: I4aefaf47b05a67ec0c4774c1ee7abcc95e04cc13
---
M include/osmo-bts/bts_trx.h
M src/common/bts.c
M src/common/bts_trx.c
M src/common/vty.c
M tests/handover/handover_test.c
M tests/meas/meas_test.c
6 files changed, 11 insertions(+), 44 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved



diff --git a/include/osmo-bts/bts_trx.h b/include/osmo-bts/bts_trx.h
index 100eaba..d4c3f39 100644
--- a/include/osmo-bts/bts_trx.h
+++ b/include/osmo-bts/bts_trx.h
@@ -47,7 +47,6 @@
 }
 
 struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
-int bts_trx_init(struct gsm_bts_trx *trx);
 struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num);
 char *gsm_trx_name(const struct gsm_bts_trx *trx);
 const char *gsm_trx_unit_id(struct gsm_bts_trx *trx);
diff --git a/src/common/bts.c b/src/common/bts.c
index 3860a87..fe4d26e 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -379,7 +379,7 @@
 	}
 
 	/* TRX0 was allocated early during gsm_bts_alloc, not later through VTY */
-	bts_trx_init(bts->c0);
+	bts_model_trx_init(bts->c0);
 	bts_gsmnet.num_bts++;
 
 	if (!initialized) {
diff --git a/src/common/bts_trx.c b/src/common/bts_trx.c
index 9fc18e4..635c4d3 100644
--- a/src/common/bts_trx.c
+++ b/src/common/bts_trx.c
@@ -107,53 +107,29 @@
 			name = gsm_lchan_name_compute(lchan);
 			lchan->name = talloc_strdup(trx, name);
 			INIT_LLIST_HEAD(&lchan->sapi_cmds);
+			INIT_LLIST_HEAD(&lchan->dl_tch_queue);
 		}
 	}
 
 	if (trx->nr != 0)
 		trx->nominal_power = bts->c0->nominal_power;
 
+	/* Default values for the power adjustments */
+	trx->power_params.ramp.max_initial_pout_mdBm = to_mdB(0);
+	trx->power_params.ramp.step_size_mdB = to_mdB(2);
+	trx->power_params.ramp.step_interval_sec = 1;
+
 	/* Default (fall-back) Dynamic Power Control parameters */
 	trx->bs_dpc_params = &bts->bs_dpc_params;
 	trx->ms_dpc_params = &bts->ms_dpc_params;
 
-	llist_add_tail(&trx->list, &bts->trx_list);
-
-	return trx;
-}
-
-/* Initialize the TRX data structures, called before config
- * file reading */
-int bts_trx_init(struct gsm_bts_trx *trx)
-{
-	/* initialize bts data structure */
-	struct trx_power_params *tpp = &trx->power_params;
-	int rc, i;
-
-	for (i = 0; i < ARRAY_SIZE(trx->ts); i++) {
-		struct gsm_bts_trx_ts *ts = &trx->ts[i];
-		int k;
-
-		for (k = 0; k < ARRAY_SIZE(ts->lchan); k++) {
-			struct gsm_lchan *lchan = &ts->lchan[k];
-			INIT_LLIST_HEAD(&lchan->dl_tch_queue);
-		}
-	}
-	/* Default values for the power adjustments */
-	tpp->ramp.max_initial_pout_mdBm = to_mdB(0);
-	tpp->ramp.step_size_mdB = to_mdB(2);
-	tpp->ramp.step_interval_sec = 1;
-
 	/* IF BTS model doesn't DSP/HW support MS Power Control Loop, enable osmo algo by default: */
 	if (!bts_internal_flag_get(trx->bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP))
 		trx->ms_pwr_ctl_soft = true;
 
-	rc = bts_model_trx_init(trx);
-	if (rc < 0) {
-		llist_del(&trx->list);
-		return rc;
-	}
-	return 0;
+	llist_add_tail(&trx->list, &bts->trx_list);
+
+	return trx;
 }
 
 struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num)
diff --git a/src/common/vty.c b/src/common/vty.c
index 3b59316..d4e2902 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -229,7 +229,7 @@
 		 */
 		trx = gsm_bts_trx_alloc(bts);
 		if (trx)
-			bts_trx_init(trx);
+			bts_model_trx_init(trx);
 	} else
 		trx = gsm_bts_trx_num(bts, trx_nr);
 
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 72d8dc8..6af8fac 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -85,10 +85,6 @@
 		fprintf(stderr, "Failed to alloc TRX structure\n");
 		exit(1);
 	}
-	if (bts_trx_init(trx) < 0) {
-		fprintf(stderr, "unable to init TRX\n");
-		exit(1);
-	}
 
 	libosmo_abis_init(NULL);
 
diff --git a/tests/meas/meas_test.c b/tests/meas/meas_test.c
index d129336..ab8ae28 100644
--- a/tests/meas/meas_test.c
+++ b/tests/meas/meas_test.c
@@ -530,10 +530,6 @@
 		fprintf(stderr, "Failed to alloc TRX structure\n");
 		exit(1);
 	}
-	if (bts_trx_init(trx) < 0) {
-		fprintf(stderr, "unable to init TRX\n");
-		exit(1);
-	}
 
 	printf("\n");
 	printf("***********************\n");

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/24177
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I4aefaf47b05a67ec0c4774c1ee7abcc95e04cc13
Gerrit-Change-Number: 24177
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210511/39c3108a/attachment.htm>


More information about the gerrit-log mailing list