aboutsummaryrefslogtreecommitdiffstats
path: root/src/libbsc/abis_rsl.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-05-07 23:26:34 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2018-05-14 11:56:11 +0000
commit5deea620dced57d06795ef2c22d9a918383f9376 (patch)
treec495994f5f6eda02ec991fc99c7337c4f734abe9 /src/libbsc/abis_rsl.c
parentd16732f693018f4732580b01dc27e51c5a37bf4e (diff)
cosmetic: dyn ts init: undup logging for gprs = none
Reshuffle the decision not to activate PDCH when GPRS is off: Even though all current callers should avoid passing a PDCH activation in case GPRS is off, it's a better idea to not assert on it and crash osmo-bsc. Move the decision to omit PDCH activation and logging about it into the actual functions that do PDCH activation. If PDCH activation is skipped, the lchan then just stays as it was, and that's what it should anyway be doing. Change-Id: Ib26642f08044d71a2469e6dbabf1e6fbcb02044d
Diffstat (limited to 'src/libbsc/abis_rsl.c')
-rw-r--r--src/libbsc/abis_rsl.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/libbsc/abis_rsl.c b/src/libbsc/abis_rsl.c
index 167ef6bfb..ffbf63038 100644
--- a/src/libbsc/abis_rsl.c
+++ b/src/libbsc/abis_rsl.c
@@ -2495,6 +2495,16 @@ int rsl_ipacc_mdcx(struct gsm_lchan *lchan, uint32_t ip, uint16_t port,
return abis_rsl_sendmsg(msg);
}
+static bool check_gprs_enabled(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 false;
+ }
+ return true;
+}
+
int rsl_ipacc_pdch_activate(struct gsm_bts_trx_ts *ts, int act)
{
struct msgb *msg = rsl_msgb_alloc();
@@ -2512,8 +2522,9 @@ int rsl_ipacc_pdch_activate(struct gsm_bts_trx_ts *ts, int act)
}
if (act){
- /* Callers should heed the GPRS mode. */
- OSMO_ASSERT(ts->trx->bts->gprs.mode != BTS_GPRS_NONE);
+ if (!check_gprs_enabled(ts))
+ return -ENOTSUP;
+
msg_type = RSL_MT_IPAC_PDCH_ACT;
ts->flags |= TS_F_PDCH_ACT_PENDING;
} else {
@@ -2647,8 +2658,6 @@ int dyn_ts_switchover_start(struct gsm_bts_trx_ts *ts,
int rc = -EIO;
OSMO_ASSERT(ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH);
- DEBUGP(DRSL, "%s starting switchover to %s\n",
- gsm_ts_and_pchan_name(ts), gsm_pchan_name(to_pchan));
if (ts->dyn.pchan_is != ts->dyn.pchan_want) {
LOGP(DRSL, LOGL_ERROR,
@@ -2680,6 +2689,12 @@ int dyn_ts_switchover_start(struct gsm_bts_trx_ts *ts,
}
}
+ if (to_pchan == GSM_PCHAN_PDCH && !check_gprs_enabled(ts))
+ return -ENOTSUP;
+
+ DEBUGP(DRSL, "%s starting switchover to %s\n",
+ gsm_ts_and_pchan_name(ts), gsm_pchan_name(to_pchan));
+
/* Record that we're busy switching. */
ts->dyn.pchan_want = to_pchan;