Change in osmo-bts[master]: [VAMOS] Implement the concept of 'shadow' transceiver

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
Thu May 6 00:46:40 UTC 2021


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/24153 )


Change subject: [VAMOS] Implement the concept of 'shadow' transceiver
......................................................................

[VAMOS] Implement the concept of 'shadow' transceiver

Change-Id: I48b44b4df9ffb1cca105aebbd868c29b21f3b1d6
Related: SYS#5315, OS#4940
---
M include/osmo-bts/bts_trx.h
M src/common/bts_trx.c
M src/common/oml.c
3 files changed, 86 insertions(+), 33 deletions(-)



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

diff --git a/include/osmo-bts/bts_trx.h b/include/osmo-bts/bts_trx.h
index 8513a12..86d5167 100644
--- a/include/osmo-bts/bts_trx.h
+++ b/include/osmo-bts/bts_trx.h
@@ -41,6 +41,11 @@
 	} role_bts;
 
 	struct gsm_bts_trx_ts ts[TRX_NR_TS];
+
+	/* If this is a primary TRX that has a shadow TRX, this points at the shadow TRX.
+	 * NULL when this TRX is a shadow TRX itself, or when there is no shadow TRX set up. */
+	struct gsm_bts_trx *shadow;
+	bool is_shadow;
 };
 
 static inline struct gsm_bts_trx *gsm_bts_bb_trx_get_trx(struct gsm_bts_bb_trx *bb_transc) {
@@ -48,6 +53,7 @@
 }
 
 struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
+void gsm_bts_trx_alloc_shadow(struct gsm_bts_trx *trx);
 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);
diff --git a/src/common/bts_trx.c b/src/common/bts_trx.c
index 9fc18e4..5ee4e7f 100644
--- a/src/common/bts_trx.c
+++ b/src/common/bts_trx.c
@@ -52,10 +52,76 @@
 	return 0;
 }
 
+static void gsm_bts_trx_init_ts_lchan(struct gsm_bts_trx *trx)
+{
+	unsigned int tn, ln;
+
+	for (tn = 0; tn < TRX_NR_TS; tn++) {
+		struct gsm_bts_trx_ts *ts = &trx->ts[tn];
+
+		ts->trx = trx;
+		ts->nr = tn;
+		ts->pchan = GSM_PCHAN_NONE;
+		ts->dyn.pchan_is = GSM_PCHAN_NONE;
+		ts->dyn.pchan_want = GSM_PCHAN_NONE;
+		ts->tsc = -1;
+
+		ts->mo.fi = osmo_fsm_inst_alloc(&nm_chan_fsm, trx, ts,
+						LOGL_INFO, NULL);
+		osmo_fsm_inst_update_id_f(ts->mo.fi, "%s-ts%u",
+					  trx->bb_transc.mo.fi->id, ts->nr);
+		gsm_mo_init(&ts->mo, trx->bts, NM_OC_CHANNEL,
+			    trx->bts->nr, trx->nr, ts->nr);
+
+		for (ln = 0; ln < TS_MAX_LCHAN; ln++) {
+			struct gsm_lchan *lchan = &ts->lchan[ln];
+			char *name;
+
+			lchan->ts = ts;
+			lchan->nr = ln;
+			lchan->type = GSM_LCHAN_NONE;
+
+			name = gsm_lchan_name_compute(lchan);
+			lchan->name = talloc_strdup(trx, name);
+			INIT_LLIST_HEAD(&lchan->sapi_cmds);
+		}
+	}
+}
+
+void gsm_bts_trx_alloc_shadow(struct gsm_bts_trx *prim)
+{
+	struct gsm_bts_trx *shadow;
+
+	/* The can be only one shadow TRX */
+	OSMO_ASSERT(prim->shadow == NULL);
+
+	shadow = talloc_zero(prim, struct gsm_bts_trx);
+	OSMO_ASSERT(shadow != NULL);
+	prim->shadow = shadow;
+
+	talloc_set_destructor(shadow, gsm_bts_trx_talloc_destructor);
+
+	shadow->is_shadow = true;
+	shadow->bts = prim->bts;
+	shadow->nr = prim->nr;
+
+	/* The shadow TRX has its own BASEBAND-TRANSCEIVER and CHANNEL MOs,
+	 * but due to its virtual nature has no dedicated RADIO-CARRIER MO. */
+	shadow->bb_transc.mo.fi = osmo_fsm_inst_alloc(&nm_bb_transc_fsm,
+						      shadow, &shadow->bb_transc,
+						      LOGL_INFO, NULL);
+	osmo_fsm_inst_update_id_f(shadow->bb_transc.mo.fi,
+				  "bts%d-shadow-trx%d",
+				  prim->bts->nr, shadow->nr);
+	gsm_mo_init(&shadow->bb_transc.mo, prim->bts, NM_OC_OSMO_SHADOW_TRANSC,
+		    prim->bts->nr, shadow->nr, 0xff);
+
+	gsm_bts_trx_init_ts_lchan(shadow);
+}
+
 struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
 {
 	struct gsm_bts_trx *trx = talloc_zero(bts, struct gsm_bts_trx);
-	int k;
 
 	if (!trx)
 		return NULL;
@@ -77,38 +143,7 @@
 	gsm_mo_init(&trx->bb_transc.mo, bts, NM_OC_BASEB_TRANSC,
 		    bts->nr, trx->nr, 0xff);
 
-	for (k = 0; k < TRX_NR_TS; k++) {
-		struct gsm_bts_trx_ts *ts = &trx->ts[k];
-		int l;
-
-		ts->trx = trx;
-		ts->nr = k;
-		ts->pchan = GSM_PCHAN_NONE;
-		ts->dyn.pchan_is = GSM_PCHAN_NONE;
-		ts->dyn.pchan_want = GSM_PCHAN_NONE;
-		ts->tsc = -1;
-
-		ts->mo.fi = osmo_fsm_inst_alloc(&nm_chan_fsm, trx, ts,
-						     LOGL_INFO, NULL);
-		osmo_fsm_inst_update_id_f(ts->mo.fi, "bts%d-trx%d-ts%d",
-					  bts->nr, trx->nr, ts->nr);
-		gsm_mo_init(&ts->mo, bts, NM_OC_CHANNEL,
-			    bts->nr, trx->nr, ts->nr);
-
-		for (l = 0; l < TS_MAX_LCHAN; l++) {
-			struct gsm_lchan *lchan;
-			char *name;
-			lchan = &ts->lchan[l];
-
-			lchan->ts = ts;
-			lchan->nr = l;
-			lchan->type = GSM_LCHAN_NONE;
-
-			name = gsm_lchan_name_compute(lchan);
-			lchan->name = talloc_strdup(trx, name);
-			INIT_LLIST_HEAD(&lchan->sapi_cmds);
-		}
-	}
+	gsm_bts_trx_init_ts_lchan(trx);
 
 	if (trx->nr != 0)
 		trx->nominal_power = bts->c0->nominal_power;
diff --git a/src/common/oml.c b/src/common/oml.c
index c32260b..bd9a86e 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -1596,10 +1596,16 @@
 		mo = &trx->mo;
 		break;
 	case NM_OC_BASEB_TRANSC:
+	case NM_OC_OSMO_SHADOW_TRANSC:
 		if (obj_inst->trx_nr >= bts->num_trx) {
 			return NULL;
 		}
 		trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
+		if (obj_class == NM_OC_OSMO_SHADOW_TRANSC) {
+			if (trx->shadow == NULL)
+				return NULL;
+			trx = trx->shadow;
+		}
 		mo = &trx->bb_transc.mo;
 		break;
 	case NM_OC_CHANNEL:
@@ -1663,10 +1669,16 @@
 		obj = trx;
 		break;
 	case NM_OC_BASEB_TRANSC:
+	case NM_OC_OSMO_SHADOW_TRANSC:
 		if (obj_inst->trx_nr >= bts->num_trx) {
 			return NULL;
 		}
 		trx = gsm_bts_trx_num(bts, obj_inst->trx_nr);
+		if (obj_class == NM_OC_OSMO_SHADOW_TRANSC) {
+			if (trx->shadow == NULL)
+				return NULL;
+			trx = trx->shadow;
+		}
 		obj = &trx->bb_transc;
 		break;
 	case NM_OC_CHANNEL:

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I48b44b4df9ffb1cca105aebbd868c29b21f3b1d6
Gerrit-Change-Number: 24153
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/20210506/eb7f33dd/attachment.htm>


More information about the gerrit-log mailing list