Change in osmo-bsc[master]: Add a bts_model->bts_init() and trx_init() call-back function

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

laforge gerrit-no-reply at lists.osmocom.org
Tue Dec 29 17:30:53 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/21825 )

Change subject: Add a bts_model->bts_init() and trx_init() call-back function
......................................................................

Add a bts_model->bts_init() and trx_init() call-back function

This allows a given BTS model driver to initialize data structures
specific cor this BTS instance (or a TRX for this BTS instance).

Change-Id: Icbad9cdc12221c9ad997267d77e5414edcbac538
---
M include/osmocom/bsc/bts.h
M src/osmo-bsc/bts.c
M src/osmo-bsc/bts_trx.c
3 files changed, 28 insertions(+), 0 deletions(-)

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



diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index 7d070af..aef0e03 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -178,7 +178,15 @@
 	const char *name;
 
 	bool started;
+	/* start the model itself */
 	int (*start)(struct gsm_network *net);
+
+	/* initialize a single BTS for this model */
+	int (*bts_init)(struct gsm_bts *bts);
+
+	/* initialize a single TRX for this model */
+	int (*trx_init)(struct gsm_bts_trx *trx);
+
 	int (*oml_rcvmsg)(struct msgb *msg);
 	char * (*oml_status)(const struct gsm_bts *bts);
 
diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c
index 747e8b7..39122ae 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -503,6 +503,19 @@
 		model->started = true;
 	}
 
+	if (model->bts_init) {
+		int rc = model->bts_init(bts);
+		if (rc < 0)
+			return rc;
+	}
+
+	/* handle those TRX which are already allocated at the time we set the type */
+	if (model->trx_init) {
+		struct gsm_bts_trx *trx;
+		llist_for_each_entry(trx, &bts->trx_list, list)
+			model->trx_init(trx);
+	}
+
 	switch (bts->type) {
 	case GSM_BTS_TYPE_OSMOBTS:
 		/* Enable dynamic Uplink power control by default */
diff --git a/src/osmo-bsc/bts_trx.c b/src/osmo-bsc/bts_trx.c
index 0e52238..6d98929 100644
--- a/src/osmo-bsc/bts_trx.c
+++ b/src/osmo-bsc/bts_trx.c
@@ -120,6 +120,13 @@
 	if (trx->nr != 0)
 		trx->nominal_power = bts->c0->nominal_power;
 
+	if (bts->model && bts->model->trx_init) {
+		if (bts->model->trx_init(trx) < 0) {
+			talloc_free(trx);
+			return NULL;
+		}
+	}
+
 	llist_add_tail(&trx->list, &bts->trx_list);
 
 	return trx;

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Icbad9cdc12221c9ad997267d77e5414edcbac538
Gerrit-Change-Number: 21825
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-CC: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201229/e295d804/attachment.htm>


More information about the gerrit-log mailing list