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
Sat May 8 15:41:30 UTC 2021


fixeria has uploaded this change for review. ( 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()

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 src/osmo-bts-trx/main.c
M tests/handover/handover_test.c
M tests/meas/meas_test.c
7 files changed, 15 insertions(+), 46 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/77/24177/1

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..722725b 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -378,8 +378,6 @@
 		return rc;
 	}
 
-	/* TRX0 was allocated early during gsm_bts_alloc, not later through VTY */
-	bts_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..2adcda1 100644
--- a/src/common/bts_trx.c
+++ b/src/common/bts_trx.c
@@ -107,53 +107,34 @@
 			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;
+	if (bts_model_trx_init(trx) != 0) {
+		talloc_free(trx);
+		return NULL;
 	}
-	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..4134d4d 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -228,8 +228,6 @@
 		 * 	   initialized in bts_init(), not here.
 		 */
 		trx = gsm_bts_trx_alloc(bts);
-		if (trx)
-			bts_trx_init(trx);
 	} else
 		trx = gsm_bts_trx_num(bts, trx_nr);
 
diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c
index e0a99a5..6184acb 100644
--- a/src/osmo-bts-trx/main.c
+++ b/src/osmo-bts-trx/main.c
@@ -156,7 +156,8 @@
 	/* The nominal value for each TRX is later overwritten through VTY cmd
 	 * 'nominal-tx-power' if present, otherwise through TRXC cmd NOMTXPOWER.
 	 */
-	l1if_trx_set_nominal_power(trx, trx->bts->c0->nominal_power);
+	if (trx->bts->c0 != NULL)
+		l1if_trx_set_nominal_power(trx, trx->bts->c0->nominal_power);
 	return 0;
 }
 
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: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210508/c155e8c1/attachment.htm>


More information about the gerrit-log mailing list