Change in osmo-bsc[master]: bsc: Add define for ts_as_pchan_for_each_lchan with ts->pchan_on_init

Pau Espin Pedrol gerrit-no-reply at
Wed Nov 28 16:16:37 UTC 2018

Pau Espin Pedrol has uploaded this change for review. (

Change subject: bsc: Add define for ts_as_pchan_for_each_lchan with ts->pchan_on_init

bsc: Add define for ts_as_pchan_for_each_lchan with ts->pchan_on_init

It will be used further in follow-up patches. It also provides a place
to document its (intrincate) logic around it and its possible uses.

Change-Id: Ia1d4bdbfca6b9719f54ee609b6bfadf7f3a4bb43
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/timeslot_fsm.c
2 files changed, 16 insertions(+), 1 deletion(-)

  git pull ssh:// refs/changes/80/11980/1

diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 2f60e4d..68b2289 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -478,6 +478,21 @@
 #define ts_for_each_lchan(lchan, ts) ts_as_pchan_for_each_lchan(lchan, ts, (ts)->pchan_is)
+/* Iterate over all possible lchans available that have an FSM allocated based
+ * on PCHAN \ref ts (dynamic) configuration.
+ * List of \ref lchan iterated through this loop is different than \ref
+ * ts_for_each_lchan only if \ref ts is configured as a dynamic timeslot. In
+ * this case, instead of using the currently set mode (among all
+ * possible in the dynamic group) the number of \ref lchan iterated is that of
+ * the channel mode in the dynamic mode group which supports the maximum amount
+ * of \ref lchan.
+ * This is useful in case dynamic timeslot \ref ts is in process of switching from
+ * configuration PDCH (no lchans) to TCH_F (1 lchan), where pchan_is is still
+ * set to PDCH but \ref ts may contain already an \ref lchan of type TCH_F which
+ * initiated the request to switch the \ts configuration.
+ */
+#define ts_for_each_lchan_slot(lchan, ts) ts_as_pchan_for_each_lchan(lchan, ts, (ts)->pchan_on_init)
 enum lchan_activate_mode {
diff --git a/src/osmo-bsc/timeslot_fsm.c b/src/osmo-bsc/timeslot_fsm.c
index 8351ff7..994d438 100644
--- a/src/osmo-bsc/timeslot_fsm.c
+++ b/src/osmo-bsc/timeslot_fsm.c
@@ -550,7 +550,7 @@
 	ts->pdch_act_allowed = true;
 	/* For static TS, check validity. For dyn TS, figure out which PCHAN this should become. */
-	ts_as_pchan_for_each_lchan(lchan, ts, ts->pchan_on_init) {
+	ts_for_each_lchan_slot(lchan, ts) {
 		if (lchan_state_is(lchan, LCHAN_ST_UNUSED))

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1d4bdbfca6b9719f54ee609b6bfadf7f3a4bb43
Gerrit-Change-Number: 11980
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list