[PATCH] osmo-bts[master]: cosmetic: dyn TS: clarify chan_nr composition

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
Sat May 5 18:37:20 UTC 2018


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

cosmetic: dyn TS: clarify chan_nr composition

In gsm_lchan2chan_nr(), use a switch to reflect both dyn TS kinds and enrich
with comments. Move GSM_PCHAN_TCH_F_PDCH out of gsm_pchan2chan_nr(), which is
now back to pure standard PCHAN values.

Rationale: it's easier to figure out what is going on and why.

Change-Id: I6a31b44220d97c9173c52d3567a1382541710d10
---
M src/common/gsm_data_shared.c
1 file changed, 14 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/39/8039/1

diff --git a/src/common/gsm_data_shared.c b/src/common/gsm_data_shared.c
index 553c09b..328b57e 100644
--- a/src/common/gsm_data_shared.c
+++ b/src/common/gsm_data_shared.c
@@ -597,9 +597,11 @@
 {
 	uint8_t cbits, chan_nr;
 
+	OSMO_ASSERT(pchan != GSM_PCHAN_TCH_F_TCH_H_PDCH);
+	OSMO_ASSERT(pchan != GSM_PCHAN_TCH_F_PDCH);
+
 	switch (pchan) {
 	case GSM_PCHAN_TCH_F:
-	case GSM_PCHAN_TCH_F_PDCH:
 		OSMO_ASSERT(lchan_nr == 0);
 		cbits = 0x01;
 		break;
@@ -652,11 +654,19 @@
 
 uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan)
 {
-	enum gsm_phys_chan_config pchan = lchan->ts->pchan;
-	if (pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH)
+	switch (lchan->ts->pchan) {
+	case GSM_PCHAN_TCH_F_TCH_H_PDCH:
+		/* Return chan_nr reflecting the current TS pchan, either a standard TCH kind, or the
+		 * nonstandard value reflecting PDCH for Osmocom style dyn TS. */
 		return gsm_lchan_as_pchan2chan_nr(lchan,
 						  lchan->ts->dyn.pchan_is);
-	return gsm_pchan2chan_nr(lchan->ts->pchan, lchan->ts->nr, lchan->nr);
+	case GSM_PCHAN_TCH_F_PDCH:
+		/* For ip.access style dyn TS, we always want to use the chan_nr as if it was TCH/F.
+		 * We're using custom PDCH ACT and DEACT messages that use the usual chan_nr values. */
+		return gsm_lchan_as_pchan2chan_nr(lchan, GSM_PCHAN_TCH_F);
+	default:
+		return gsm_pchan2chan_nr(lchan->ts->pchan, lchan->ts->nr, lchan->nr);
+	}
 }
 
 uint8_t gsm_lchan_as_pchan2chan_nr(const struct gsm_lchan *lchan,

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

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



More information about the gerrit-log mailing list