diff options
-rw-r--r-- | src/common/scheduler.c | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/src/common/scheduler.c b/src/common/scheduler.c index 9af67c84..3dc4db53 100644 --- a/src/common/scheduler.c +++ b/src/common/scheduler.c @@ -979,36 +979,38 @@ int trx_sched_set_lchan(struct l1sched_trx *l1t, uint8_t chan_nr, uint8_t link_i /* look for all matching chan_nr/link_id */ for (i = 0; i < _TRX_CHAN_MAX; i++) { - struct l1sched_chan_state *chan_state; - chan_state = &l1ts->chan_state[i]; - if (trx_chan_desc[i].chan_nr == (chan_nr & RSL_CHAN_NR_MASK) - && trx_chan_desc[i].link_id == link_id) { - rc = 0; - if (chan_state->active == active) - continue; - LOGP(DL1C, LOGL_NOTICE, "%s %s on trx=%d ts=%d\n", - (active) ? "Activating" : "Deactivating", - trx_chan_desc[i].name, l1t->trx->nr, tn); - /* free burst memory, to cleanly start with burst 0 */ - if (chan_state->dl_bursts) { - talloc_free(chan_state->dl_bursts); - chan_state->dl_bursts = NULL; - } - if (chan_state->ul_bursts) { - talloc_free(chan_state->ul_bursts); - chan_state->ul_bursts = NULL; - } + struct l1sched_chan_state *chan_state = &l1ts->chan_state[i]; - if (active) - memset(chan_state, 0, sizeof(*chan_state)); - else - chan_state->ho_rach_detect = 0; - chan_state->active = active; + if (trx_chan_desc[i].chan_nr != (chan_nr & RSL_CHAN_NR_MASK)) + continue; + if (trx_chan_desc[i].link_id != link_id) + continue; - if (active) { - chan_state->lchan = get_lchan_by_chan_nr(l1t->trx, chan_nr); - OSMO_ASSERT(chan_state->lchan != NULL); - } + rc = 0; + if (chan_state->active == active) + continue; + LOGP(DL1C, LOGL_NOTICE, "%s %s on trx=%d ts=%d\n", + (active) ? "Activating" : "Deactivating", + trx_chan_desc[i].name, l1t->trx->nr, tn); + /* free burst memory, to cleanly start with burst 0 */ + if (chan_state->dl_bursts) { + talloc_free(chan_state->dl_bursts); + chan_state->dl_bursts = NULL; + } + if (chan_state->ul_bursts) { + talloc_free(chan_state->ul_bursts); + chan_state->ul_bursts = NULL; + } + + if (active) + memset(chan_state, 0, sizeof(*chan_state)); + else + chan_state->ho_rach_detect = 0; + chan_state->active = active; + + if (active) { + chan_state->lchan = get_lchan_by_chan_nr(l1t->trx, chan_nr); + OSMO_ASSERT(chan_state->lchan != NULL); } } |