[PATCH] osmo-bsc[master]: cosmetic: dyn ts init: undup logging for gprs = none

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
Thu May 10 03:47:01 UTC 2018


Review at  https://gerrit.osmocom.org/8102

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
---
M src/libbsc/abis_rsl.c
M src/libbsc/bsc_dyn_ts.c
2 files changed, 20 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/02/8102/1

diff --git a/src/libbsc/abis_rsl.c b/src/libbsc/abis_rsl.c
index 167ef6b..ffbf630 100644
--- a/src/libbsc/abis_rsl.c
+++ b/src/libbsc/abis_rsl.c
@@ -2495,6 +2495,16 @@
 	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 @@
 	}
 
 	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 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 @@
 		}
 	}
 
+	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;
 
diff --git a/src/libbsc/bsc_dyn_ts.c b/src/libbsc/bsc_dyn_ts.c
index aa3c252..6a1cff7 100644
--- a/src/libbsc/bsc_dyn_ts.c
+++ b/src/libbsc/bsc_dyn_ts.c
@@ -27,31 +27,14 @@
 {
 	int rc;
 
-	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;
-	}
-
-	LOGP(DRSL, LOGL_DEBUG, "%s: trying to PDCH ACT\n",
-	     gsm_ts_and_pchan_name(ts));
-
 	rc = rsl_ipacc_pdch_activate(ts, 1);
-	if (rc != 0)
+	if (rc != 0 && rc != -ENOTSUP)
 		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, GSM_PCHAN_PDCH);
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib26642f08044d71a2469e6dbabf1e6fbcb02044d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list