[PATCH] osmo-bts[master]: cosmetic: common ts_is_pdch()

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
Tue Aug 9 18:47:37 UTC 2016


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

cosmetic: common ts_is_pdch()

Have one common ts_is_pdch(), placed in lchan.c, since this file is pretty
empty and pretty close to ts. Publish in gsm_data.h.

Remove the if-style implementation from l1sap.c, and instead implement in a
switch statement.

This prepares for upcoming ts_is_pdch() usage in ph_data_req() for sysmo and
lc15.

Change-Id: Ib78d663fdbac5a1d7053f1b9d543649b66da00e2
---
M include/osmo-bts/gsm_data.h
M src/common/l1sap.c
M src/common/lchan.c
3 files changed, 17 insertions(+), 11 deletions(-)


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

diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index c75f828..f1c9601 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -135,5 +135,6 @@
 
 int bts_supports_cipher(struct gsm_bts_role_bts *bts, int rsl_cipher);
 
+bool ts_is_pdch(const struct gsm_bts_trx_ts *ts);
 
 #endif /* _GSM_DATA_H */
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 6498103..584f9f4 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -294,17 +294,6 @@
 	return 0;
 }
 
-static bool ts_is_pdch(const struct gsm_bts_trx_ts *ts)
-{
-	return ts->pchan == GSM_PCHAN_PDCH
-		|| (ts->pchan == GSM_PCHAN_TCH_F_PDCH
-		    && (ts->flags & TS_F_PDCH_ACTIVE)
-		    && !(ts->flags & TS_F_PDCH_PENDING_MASK))
-		|| (ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH
-		    && ts->dyn.pchan_want == ts->dyn.pchan_is
-		    && ts->dyn.pchan_is == GSM_PCHAN_PDCH);
-}
-
 static int to_gsmtap(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
 {
 	uint8_t *data;
diff --git a/src/common/lchan.c b/src/common/lchan.c
index fbc2636..9e98166 100644
--- a/src/common/lchan.c
+++ b/src/common/lchan.c
@@ -31,3 +31,19 @@
 	       gsm_lchans_name(state));
 	lchan->state = state;
 }
+
+bool ts_is_pdch(const struct gsm_bts_trx_ts *ts)
+{
+	switch (ts->pchan) {
+	case GSM_PCHAN_PDCH:
+		return true;
+	case GSM_PCHAN_TCH_F_PDCH:
+		return (ts->flags & TS_F_PDCH_ACTIVE)
+		       && !(ts->flags & TS_F_PDCH_PENDING_MASK);
+	case GSM_PCHAN_TCH_F_TCH_H_PDCH:
+		return ts->dyn.pchan_is == GSM_PCHAN_PDCH
+		       && ts->dyn.pchan_want == ts->dyn.pchan_is;
+	default:
+		return false;
+	}
+}

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

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



More information about the gerrit-log mailing list