From 67a056c122ed588e74835771a3cfda0f2055c284 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 29 Jul 2016 17:54:57 +0200 Subject: dyn TS: complete for TRX Apply similar fixes as for TCH/F_PDCH also for TCH/F_TCH/H_PDCH: Detect dyn TS in PDCH mode in ts_is_pdch(). In trx_set_ts(), enhance the "if (TCH_F_PDCH)" to a switch statement including both dynamic channel types. Adjust the comment to include both kinds. Change-Id: I6669739cd08780cd9ffb9451cdae9f6b9704c4fe --- src/common/l1sap.c | 5 ++++- src/osmo-bts-trx/l1_if.c | 27 +++++++++++++++++++-------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 304f7185..64981033 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -299,7 +299,10 @@ 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->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) diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index 4d6dc3fc..b89a3594 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -398,9 +398,10 @@ static uint8_t trx_set_ts_as_pchan(struct gsm_bts_trx_ts *ts, if (!(l1h->config.slotmask & (1 << tn))) return NM_NACK_RES_NOTAVAIL; - /* set physical channel. For dynamic TCH/F_PDCH, the caller should have + /* set physical channel. For dynamic timeslots, the caller should have * decided on a more specific PCHAN type already. */ OSMO_ASSERT(pchan != GSM_PCHAN_TCH_F_PDCH); + OSMO_ASSERT(pchan != GSM_PCHAN_TCH_F_TCH_H_PDCH); rc = trx_sched_set_pchan(&l1h->l1s, tn, pchan); if (rc) return NM_NACK_RES_NOTAVAIL; @@ -426,15 +427,25 @@ static uint8_t trx_set_ts_as_pchan(struct gsm_bts_trx_ts *ts, static uint8_t trx_set_ts(struct gsm_bts_trx_ts *ts) { - enum gsm_phys_chan_config pchan = ts->pchan; - - /* For dynamic TCH/F_PDCH, pick the pchan type that should currently be - * active according to TS flags. This should only be called during - * init, PDCH transitions will call trx_set_ts_as_pchan() directly. */ - OSMO_ASSERT((ts->flags & TS_F_PDCH_PENDING_MASK) == 0); - if (pchan == GSM_PCHAN_TCH_F_PDCH) + 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); pchan = (ts->flags & TS_F_PDCH_ACTIVE)? GSM_PCHAN_PDCH : GSM_PCHAN_TCH_F; + break; + case GSM_PCHAN_TCH_F_TCH_H_PDCH: + OSMO_ASSERT(ts->dyn.pchan_is == ts->dyn.pchan_want); + pchan = ts->dyn.pchan_is; + break; + default: + pchan = ts->pchan; + break; + } return trx_set_ts_as_pchan(ts, pchan); } -- cgit v1.2.3