[PATCH] openbsc[master]: dyn TS: split dyn_pdch_init() for new dyn type and rename

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Jul 25 16:12:30 UTC 2016


dyn TS: split dyn_pdch_init() for new dyn type and rename

Init both TCH/F_PDCH and TCH/F_TCH/H_PDCH via dyn_ts_init(), which
refactors dyn_pdch_init().

Make dyn_ts_switchover_start from abis_rsl.c public in abis_rsl.h, so we can
start the initial switchover to PDCH from dyn_ts_init(); in abis_rsl.h include
gsm_utils.h for enum gsm_phys_chan_config.

Change-Id: I5c0b257ba8ff0e9c9a2268681a84b0681a778368
---
M openbsc/include/openbsc/abis_rsl.h
M openbsc/src/libbsc/abis_rsl.c
M openbsc/src/libbsc/bsc_dyn_pdch.c
M openbsc/src/libbsc/bts_ipaccess_nanobts.c
4 files changed, 41 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/01/601/2

diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h
index 6ff8382..8313f48 100644
--- a/openbsc/include/openbsc/abis_rsl.h
+++ b/openbsc/include/openbsc/abis_rsl.h
@@ -23,6 +23,7 @@
 #define _RSL_H
 
 #include <osmocom/gsm/protocol/gsm_08_58.h>
+#include <osmocom/gsm/gsm_utils.h>
 
 #include <osmocom/core/msgb.h>
 
@@ -106,7 +107,9 @@
 
 int rsl_direct_rf_release(struct gsm_lchan *lchan);
 
-void dyn_pdch_init(struct gsm_bts_trx_ts *ts);
+void dyn_ts_init(struct gsm_bts_trx_ts *ts);
+int dyn_ts_switchover_start(struct gsm_lchan *lchan,
+			    enum gsm_phys_chan_config to_pchan);
 
 #endif /* RSL_MT_H */
 
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index f86022a..fead80a 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -55,8 +55,6 @@
 
 static int rsl_send_imm_assignment(struct gsm_lchan *lchan);
 static void error_timeout_cb(void *data);
-static int dyn_ts_switchover_start(struct gsm_lchan *lchan,
-				   enum gsm_phys_chan_config to_pchan);
 static int dyn_ts_switchover_continue(struct gsm_lchan *lchan);
 static int dyn_ts_switchover_failed(struct gsm_lchan *lchan, int rc);
 static void dyn_ts_switchover_complete(struct gsm_lchan *lchan);
@@ -2318,8 +2316,8 @@
 	return rc;
 }
 
-static int dyn_ts_switchover_start(struct gsm_lchan *lchan,
-				   enum gsm_phys_chan_config to_pchan)
+int dyn_ts_switchover_start(struct gsm_lchan *lchan,
+			    enum gsm_phys_chan_config to_pchan)
 {
 	int ss;
 	struct gsm_bts_trx_ts *ts = lchan->ts;
diff --git a/openbsc/src/libbsc/bsc_dyn_pdch.c b/openbsc/src/libbsc/bsc_dyn_pdch.c
index 9d00bbc..456500a 100644
--- a/openbsc/src/libbsc/bsc_dyn_pdch.c
+++ b/openbsc/src/libbsc/bsc_dyn_pdch.c
@@ -23,16 +23,9 @@
 #include <openbsc/gsm_data.h>
 #include <openbsc/abis_rsl.h>
 
-void dyn_pdch_init(struct gsm_bts_trx_ts *ts)
+void tchf_pdch_ts_init(struct gsm_bts_trx_ts *ts)
 {
 	int rc;
-
-	/* Clear all dyn PDCH flags */
-	ts->flags &= ~(TS_F_PDCH_PENDING_MASK | TS_F_PDCH_ACTIVE);
-
-	/* Nothing to do if not a dynamic channel. */
-	if (ts->pchan != GSM_PCHAN_TCH_F_PDCH)
-		return;
 
 	if (ts->trx->bts->gprs.mode == BTS_GPRS_NONE) {
 		LOGP(DRSL, LOGL_NOTICE, "%s: GPRS mode is 'none':"
@@ -49,3 +42,36 @@
 		LOGP(DRSL, LOGL_ERROR, "%s %s: PDCH ACT failed\n",
 		     gsm_ts_name(ts), gsm_pchan_name(ts->pchan));
 }
+
+void tchf_tchh_pdch_ts_init(struct gsm_bts_trx_ts *ts)
+{
+	if (ts->trx->bts->gprs.mode == BTS_GPRS_NONE) {
+		LOGP(DRSL, LOGL_NOTICE, "%s: GPRS mode is 'none':"
+		     " not activating PDCH.\n",
+		     gsm_ts_and_pchan_name(ts));
+		return;
+	}
+
+	dyn_ts_switchover_start(ts->lchan, GSM_PCHAN_PDCH);
+}
+
+void dyn_ts_init(struct gsm_bts_trx_ts *ts)
+{
+	/* Clear all TCH/F_PDCH flags */
+	ts->flags &= ~(TS_F_PDCH_PENDING_MASK | TS_F_PDCH_ACTIVE);
+
+	/* Clear TCH/F_TCH/H_PDCH state */
+	ts->dyn.pchan_is = ts->dyn.pchan_want = GSM_PCHAN_NONE;
+	ts->dyn.pending_chan_activ = NULL;
+
+	switch (ts->pchan) {
+	case GSM_PCHAN_TCH_F_PDCH:
+		tchf_pdch_ts_init(ts);
+		break;
+	case GSM_PCHAN_TCH_F_TCH_H_PDCH:
+		tchf_tchh_pdch_ts_init(ts);
+		break;
+	default:
+		break;
+	}
+}
diff --git a/openbsc/src/libbsc/bts_ipaccess_nanobts.c b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
index 89d5256..a6c8e29 100644
--- a/openbsc/src/libbsc/bts_ipaccess_nanobts.c
+++ b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
@@ -371,7 +371,7 @@
 		}
 		if (new_state->operational == NM_OPSTATE_ENABLED
 		    && new_state->availability == NM_AVSTATE_OK)
-			dyn_pdch_init(ts);
+			dyn_ts_init(ts);
 		break;
 	case NM_OC_RADIO_CARRIER:
 		trx = obj;

-- 
To view, visit https://gerrit.osmocom.org/601
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I5c0b257ba8ff0e9c9a2268681a84b0681a778368
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list