fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/31977 )
Change subject: osmo-bts-virtual: properly handle dynamic TS in vbts_set_ts() ......................................................................
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 --- M src/osmo-bts-virtual/bts_model.c 1 file changed, 35 insertions(+), 1 deletion(-)
Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve fixeria: Looks good to me, approved
diff --git a/src/osmo-bts-virtual/bts_model.c b/src/osmo-bts-virtual/bts_model.c index 8704056..64e2f8d 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_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;