Change in osmo-bsc[master]: Introduce gsm48_lchan2chan_desc_as_configured()

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Sep 9 15:37:45 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10853 )

Change subject: Introduce gsm48_lchan2chan_desc_as_configured()
......................................................................

Introduce gsm48_lchan2chan_desc_as_configured()

gsm48_lchan2chan_desc_as_configured() is similar to gsm48_lchan2chan_desc(),
but uses the *configured* channel combination, rather than the currently
active one.

Change-Id: Id4043218fb770e8420f19a4ef9428680ecdfd286
Related: OS#3532
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/gsm_data.c
2 files changed, 20 insertions(+), 5 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 68f888f..e408ff9 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -1200,6 +1200,7 @@
 
 void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd,
 			   const struct gsm_lchan *lchan);
+void gsm48_lchan2chan_desc_as_configured(struct gsm48_chan_desc *cd, const struct gsm_lchan *lchan);
 
 /* return the gsm_lchan for the CBCH (if it exists at all) */
 struct gsm_lchan *gsm_bts_get_cbch(struct gsm_bts *bts);
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index ac965e2..12ab66e 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -1329,13 +1329,10 @@
 		gsm_trx_all_ts_dispatch(trx, ts_ev, data);
 }
 
-void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd,
-			   const struct gsm_lchan *lchan)
+static void _chan_desc_fill_tail(struct gsm48_chan_desc *cd, const struct gsm_lchan *lchan)
 {
-	uint16_t arfcn = lchan->ts->trx->arfcn & 0x3ff;
-
-	cd->chan_nr = gsm_lchan2chan_nr(lchan);
 	if (!lchan->ts->hopping.enabled) {
+		uint16_t arfcn = lchan->ts->trx->arfcn & 0x3ff;
 		cd->h0.tsc = gsm_ts_tsc(lchan->ts);
 		cd->h0.h = 0;
 		cd->h0.arfcn_high = arfcn >> 8;
@@ -1349,6 +1346,23 @@
 	}
 }
 
+void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd,
+			   const struct gsm_lchan *lchan)
+{
+	cd->chan_nr = gsm_lchan2chan_nr(lchan);
+	_chan_desc_fill_tail(cd, lchan);
+}
+
+/* like gsm48_lchan2chan_desc() above, but use ts->pchan_from_config to
+ * return a channel description based on what is configured, rather than
+ * what the current state of the pchan type is */
+void gsm48_lchan2chan_desc_as_configured(struct gsm48_chan_desc *cd,
+					 const struct gsm_lchan *lchan)
+{
+	cd->chan_nr = gsm_pchan2chan_nr(lchan->ts->pchan_from_config, lchan->ts->nr, lchan->nr);
+	_chan_desc_fill_tail(cd, lchan);
+}
+
 bool nm_is_running(const struct gsm_nm_state *s) {
 	return (s->operational == NM_OPSTATE_ENABLED) && (
 		(s->availability == NM_AVSTATE_OK) ||

-- 
To view, visit https://gerrit.osmocom.org/10853
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id4043218fb770e8420f19a4ef9428680ecdfd286
Gerrit-Change-Number: 10853
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180909/b552a505/attachment.htm>


More information about the gerrit-log mailing list