From 3df635655517a98b488c7a4d7f02c25e4338f128 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 28 Nov 2018 16:55:47 +0100 Subject: bsc: timeslot_fsm: Fix ts_is_lchan_waiting_for_pchan If ts_is_lchan_waiting_for_pchan() wasn't accounting for TCH lchans waiting for TS to deactive PDCH in order to setup the TS as TCH. Since now TCH lchan is catched by ts_is_lchan_waiting_for_pchan() when TS state is TS_ST_WAIT_PDCH_DEACT, there's no need to check for that case in caller ts_is_pchan_switching(), since it will never hit because the callee returns true in that case now. See osmo-bsc I9cedb77d6578597f1febab36c54b2ee427c7a4a2 for similar extensive explanation. Change-Id: Ib03e5a91438a5b74a04e69f81fab565842b02b66 --- src/osmo-bsc/timeslot_fsm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/osmo-bsc/timeslot_fsm.c b/src/osmo-bsc/timeslot_fsm.c index 145049154..269fcd526 100644 --- a/src/osmo-bsc/timeslot_fsm.c +++ b/src/osmo-bsc/timeslot_fsm.c @@ -857,7 +857,7 @@ static struct osmo_fsm ts_fsm = { bool ts_is_lchan_waiting_for_pchan(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config *target_pchan) { struct gsm_lchan *lchan; - ts_for_each_lchan(lchan, ts) { + ts_for_each_potential_lchan(lchan, ts) { if (lchan->fi->state == LCHAN_ST_WAIT_TS_READY) { if (target_pchan) *target_pchan = gsm_pchan_by_lchan_type(lchan->type); @@ -887,13 +887,15 @@ bool ts_is_pchan_switching(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config switch (ts->fi->state) { case TS_ST_WAIT_PDCH_ACT: + /* When switching to PDCH, there are no lchans and we are + * telling the PCU to take over the timeslot. */ if (target_pchan) *target_pchan = GSM_PCHAN_PDCH; return true; case TS_ST_WAIT_PDCH_DEACT: - /* If we were switching to a specific pchan kind, an lchan would be waiting. So this must - * be NONE then. */ + /* If lchan started a PDCH deact but got somehow released while + * waiting for PDCH DEACT (N)ACK */ if (target_pchan) *target_pchan = GSM_PCHAN_NONE; return true; -- cgit v1.2.3