aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2016-07-23 20:08:41 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2016-07-28 11:56:51 +0200
commitd3b7fa837d2300093a8f4fb3c923a3b012108564 (patch)
tree21ee7fdbef0b2d3f751cd77ebf2e5b24ab1f7b36
parentb91e6002a6c97cf1c19b14015f4f17a7ad7ace62 (diff)
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
-rw-r--r--openbsc/include/openbsc/abis_rsl.h5
-rw-r--r--openbsc/src/libbsc/abis_rsl.c6
-rw-r--r--openbsc/src/libbsc/bsc_dyn_pdch.c42
-rw-r--r--openbsc/src/libbsc/bts_ipaccess_nanobts.c2
4 files changed, 41 insertions, 14 deletions
diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h
index 6ff838279..8313f489e 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_start_t3109(struct gsm_lchan *lchan);
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 8af3b9bd4..b84a0b582 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -55,8 +55,6 @@ enum sacch_deact {
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);
@@ -2321,8 +2319,8 @@ static int abis_rsl_rx_ipacc(struct msgb *msg)
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 9d00bbcff..456500a89 100644
--- a/openbsc/src/libbsc/bsc_dyn_pdch.c
+++ b/openbsc/src/libbsc/bsc_dyn_pdch.c
@@ -23,17 +23,10 @@
#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':"
" not activating PDCH.\n",
@@ -49,3 +42,36 @@ void dyn_pdch_init(struct gsm_bts_trx_ts *ts)
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 89d525636..a6c8e29b8 100644
--- a/openbsc/src/libbsc/bts_ipaccess_nanobts.c
+++ b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
@@ -371,7 +371,7 @@ static int nm_statechg_event(int evt, struct nm_statechg_signal_data *nsd)
}
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;