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
This commit is contained in:
Neels Hofmeyr 2016-07-23 20:08:41 +02:00
parent b91e6002a6
commit d3b7fa837d
4 changed files with 41 additions and 14 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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;