aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-03-20 04:15:13 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-03-20 23:08:33 +0700
commitef9b27526c38d8f55eed1d450ba14142df783b41 (patch)
treeb36fdf1275a7484795bd3169dc2b18fa199c2b71
parent4bdc5a74cc02b4af2c4fd5d1abe1320b06709eaa (diff)
osmo-bts-virtual: properly handle dynamic TS in vbts_set_ts()
This change fixes a problem that prevents osmo-bts-virtual from starting when dynamic (ipa/osmo) timeslots are in use. Change-Id: I5db5b7dd6a8e84cf9a0d84f04a650c2ed8a4e368
-rw-r--r--src/osmo-bts-virtual/bts_model.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/osmo-bts-virtual/bts_model.c b/src/osmo-bts-virtual/bts_model.c
index 87040566..64e2f8dd 100644
--- a/src/osmo-bts-virtual/bts_model.c
+++ b/src/osmo-bts-virtual/bts_model.c
@@ -100,7 +100,29 @@ static uint8_t vbts_set_trx(struct gsm_bts_trx *trx)
static uint8_t vbts_set_ts(struct gsm_bts_trx_ts *ts)
{
- if (trx_sched_set_pchan(ts, ts->pchan) != 0)
+ enum gsm_phys_chan_config pchan;
+
+ /* For dynamic timeslots, pick the pchan type that should currently be
+ * active. This should only be called during init, PDCH transitions
+ * will call trx_set_ts_as_pchan() directly. */
+ switch (ts->pchan) {
+ case GSM_PCHAN_TCH_F_PDCH:
+ OSMO_ASSERT((ts->flags & TS_F_PDCH_PENDING_MASK) == 0);
+ if (ts->flags & TS_F_PDCH_ACTIVE)
+ pchan = GSM_PCHAN_PDCH;
+ else
+ pchan = GSM_PCHAN_TCH_F;
+ break;
+ case GSM_PCHAN_OSMO_DYN:
+ OSMO_ASSERT(ts->dyn.pchan_is == ts->dyn.pchan_want);
+ pchan = ts->dyn.pchan_is;
+ break;
+ default:
+ pchan = ts->pchan;
+ break;
+ }
+
+ if (trx_sched_set_pchan(ts, pchan) != 0)
return NM_NACK_RES_NOTAVAIL;
return 0;