aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/bsc/gsm_data.h13
-rw-r--r--src/osmo-bsc/timeslot_fsm.c2
2 files changed, 14 insertions, 1 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 2f60e4dfe..0b472a47b 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -478,6 +478,19 @@ struct gsm_encr {
*/
#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.
+ * Iterate all lchan instances set up by this \ref ts type, including those
+ * lchans currently disabled or in process of being enabled (e.g. due to dynamic
+ * timeslot in switchover). Compare ts_for_each_lchan(), which iterates only the
+ * enabled lchans.
+ * For example, it 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_potential_lchan(lchan, ts) ts_as_pchan_for_each_lchan(lchan, ts, (ts)->pchan_on_init)
+
enum lchan_activate_mode {
FOR_NONE,
FOR_MS_CHANNEL_REQUEST,
diff --git a/src/osmo-bsc/timeslot_fsm.c b/src/osmo-bsc/timeslot_fsm.c
index 8351ff7ef..a39549b54 100644
--- a/src/osmo-bsc/timeslot_fsm.c
+++ b/src/osmo-bsc/timeslot_fsm.c
@@ -550,7 +550,7 @@ static void ts_fsm_in_use_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
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_potential_lchan(lchan, ts) {
if (lchan_state_is(lchan, LCHAN_ST_UNUSED))
continue;