This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. Change subject: dyn TS: move check whether to switch to PDCH to separate function ...................................................................... dyn TS: move check whether to switch to PDCH to separate function Prepares for an upcoming commit using the same check in error_timeout_cb(). Change-Id: I8abfa964631040f798212cc3e360f67f9e09b7c5 --- M openbsc/src/libbsc/abis_rsl.c 1 file changed, 33 insertions(+), 17 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 092ec4e..2752c0d 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -723,6 +723,38 @@ return abis_rsl_sendmsg(msg); } +static bool dyn_ts_should_switch_to_pdch(struct gsm_bts_trx_ts *ts) +{ + int ss; + + if (ts->pchan != GSM_PCHAN_TCH_F_TCH_H_PDCH) + return false; + + if (ts->trx->bts->gprs.mode == BTS_GPRS_NONE) + return false; + + /* Already in PDCH mode? */ + if (ts->dyn.pchan_is == GSM_PCHAN_PDCH) + return false; + + /* See if all lchans are released. */ + for (ss = 0; ss < ts_subslots(ts); ss++) { + struct gsm_lchan *lc = &ts->lchan[ss]; + if (lc->state != LCHAN_S_NONE) { + DEBUGP(DRSL, "%s lchan %u still in use\n", + gsm_ts_and_pchan_name(ts), + lc->nr); + /* An lchan is still used. */ + return false; + } + } + + /* All channels are released, go to PDCH mode. */ + DEBUGP(DRSL, "%s back to PDCH\n", + gsm_ts_and_pchan_name(ts)); + return true; +} + static void error_timeout_cb(void *data) { struct gsm_lchan *lchan = data; @@ -824,7 +856,6 @@ static int rsl_rx_rf_chan_rel_ack(struct gsm_lchan *lchan) { - int ss; struct gsm_bts_trx_ts *ts = lchan->ts; DEBUGP(DRSL, "%s RF CHANNEL RELEASE ACK\n", gsm_lchan_name(lchan)); @@ -879,23 +910,8 @@ return dyn_ts_switchover_continue(lchan); /* (b) */ - if (ts->dyn.pchan_is != GSM_PCHAN_PDCH - && ts->trx->bts->gprs.mode != BTS_GPRS_NONE) { - for (ss = 0; ss < ts_subslots(ts); ss++) { - struct gsm_lchan *lc = &ts->lchan[ss]; - if (lc->state != LCHAN_S_NONE) { - DEBUGP(DRSL, "%s lchan %u still in use\n", - gsm_ts_and_pchan_name(ts), - lc->nr); - /* An lchan is still used. */ - return 0; - } - } - /* All channels are released, go to PDCH mode. */ - DEBUGP(DRSL, "%s back to PDCH\n", - gsm_ts_and_pchan_name(ts)); + if (dyn_ts_should_switch_to_pdch(ts)) return dyn_ts_switchover_start(lchan, GSM_PCHAN_PDCH); - } } /* -- To view, visit https://gerrit.osmocom.org/756 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8abfa964631040f798212cc3e360f67f9e09b7c5 Gerrit-PatchSet: 2 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder