[PATCH] openbsc[master]: dyn TS: fix: bs11, om2000: two switch(pchan) for dyn TS

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
Sun Sep 25 15:40:34 UTC 2016


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

dyn TS: fix: bs11, om2000: two switch(pchan) for dyn TS

Add ts_is_tch() in gsm_data_shared.h/.c and use it to replace a switch on the
pchan in two (unrelated) places: libbsc/bts_siemens_bs11.c and e1_config.c.

This patch is not due to an actual observed failure. A general grep for switch
on pchan turned up these two instances that don't handle dyn TS properly. Hence
this patch is not actually tested with real equipment.

Change-Id: Ide4f156034bab77140d2d9a8c462d68ae6f0d6a6
---
M openbsc/include/openbsc/gsm_data_shared.h
M openbsc/src/libbsc/bts_siemens_bs11.c
M openbsc/src/libbsc/e1_config.c
M openbsc/src/libcommon/gsm_data_shared.c
4 files changed, 19 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/40/940/1

diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h
index 7c8fb59..368ac6b 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -855,5 +855,6 @@
 				   int *rc);
 
 uint8_t ts_subslots(struct gsm_bts_trx_ts *ts);
+bool ts_is_tch(struct gsm_bts_trx_ts *ts);
 
 #endif
diff --git a/openbsc/src/libbsc/bts_siemens_bs11.c b/openbsc/src/libbsc/bts_siemens_bs11.c
index 160563b..c083b1e 100644
--- a/openbsc/src/libbsc/bts_siemens_bs11.c
+++ b/openbsc/src/libbsc/bts_siemens_bs11.c
@@ -400,15 +400,9 @@
 	if (is_ipaccess_bts(ts->trx->bts))
 		return;
 
-	switch (ts->pchan) {
-	case GSM_PCHAN_TCH_F:
-	case GSM_PCHAN_TCH_H:
+	if (ts_is_tch(ts))
 		abis_nm_conn_terr_traf(ts, e1l->e1_nr, e1l->e1_ts,
 					e1l->e1_ts_ss);
-		break;
-	default:
-		break;
-	}
 }
 
 static void nm_reconfig_trx(struct gsm_bts_trx *trx)
diff --git a/openbsc/src/libbsc/e1_config.c b/openbsc/src/libbsc/e1_config.c
index d82b009..0c3250f 100644
--- a/openbsc/src/libbsc/e1_config.c
+++ b/openbsc/src/libbsc/e1_config.c
@@ -63,15 +63,10 @@
 		return -ENOMEM;
 	}
 
-	switch (ts->pchan) {
-	case GSM_PCHAN_TCH_F:
-	case GSM_PCHAN_TCH_H:
+	if (ts_is_tch(ts)) {
 		e1_ts = &line->ts[e1_link->e1_ts-1];
 		e1inp_ts_config_trau(e1_ts, line, subch_cb);
 		subch_demux_activate(&e1_ts->trau.demux, e1_link->e1_ts_ss);
-		break;
-	default:
-		break;
 	}
 
 	return 0;
diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c
index 371e479..4eea21e 100644
--- a/openbsc/src/libcommon/gsm_data_shared.c
+++ b/openbsc/src/libcommon/gsm_data_shared.c
@@ -747,3 +747,19 @@
 {
 	return subslots_per_pchan[ts_pchan(ts)];
 }
+
+static bool pchan_is_tch(enum gsm_phys_chan_config pchan)
+{
+	switch (pchan) {
+	case GSM_PCHAN_TCH_F:
+	case GSM_PCHAN_TCH_H:
+		return true;
+	default:
+		return false;
+	}
+}
+
+bool ts_is_tch(struct gsm_bts_trx_ts *ts)
+{
+	return pchan_is_tch(ts_pchan(ts));
+}

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

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



More information about the gerrit-log mailing list