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/.
neels gerrit-no-reply at lists.osmocom.orgneels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/21203 ) Change subject: fix TCH/H allocation: use half occupied dyn TS instead of switching more dyn TS ...................................................................... fix TCH/H allocation: use half occupied dyn TS instead of switching more dyn TS Change-Id: I5a8d943f31774af00664d037550be14e767d312a --- M include/osmocom/bsc/timeslot_fsm.h M src/osmo-bsc/lchan_select.c M src/osmo-bsc/timeslot_fsm.c M tests/handover/handover_test.c 4 files changed, 40 insertions(+), 22 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/include/osmocom/bsc/timeslot_fsm.h b/include/osmocom/bsc/timeslot_fsm.h index d02e156..da66136 100644 --- a/include/osmocom/bsc/timeslot_fsm.h +++ b/include/osmocom/bsc/timeslot_fsm.h @@ -50,4 +50,4 @@ bool ts_is_capable_of_lchant(struct gsm_bts_trx_ts *ts, enum gsm_chan_t type); bool ts_is_lchan_waiting_for_pchan(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config *target_pchan); bool ts_is_pchan_switching(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config *target_pchan); -bool ts_usable_as_pchan(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config as_pchan); +bool ts_usable_as_pchan(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config as_pchan, bool allow_pchan_switch); diff --git a/src/osmo-bsc/lchan_select.c b/src/osmo-bsc/lchan_select.c index 6d3caac..64f4939 100644 --- a/src/osmo-bsc/lchan_select.c +++ b/src/osmo-bsc/lchan_select.c @@ -32,17 +32,19 @@ static struct gsm_lchan * _lc_find_trx(struct gsm_bts_trx *trx, enum gsm_phys_chan_config pchan, - enum gsm_phys_chan_config as_pchan) + enum gsm_phys_chan_config as_pchan, bool allow_pchan_switch) { struct gsm_lchan *lchan; struct gsm_bts_trx_ts *ts; int j, start, stop, dir; #define LOGPLCHANALLOC(fmt, args...) \ - LOGP(DRLL, LOGL_DEBUG, "looking for lchan %s%s%s: " fmt, \ + LOGP(DRLL, LOGL_DEBUG, "looking for lchan %s%s%s%s: " fmt, \ gsm_pchan_name(pchan), \ pchan == as_pchan ? "" : " as ", \ - pchan == as_pchan ? "" : gsm_pchan_name(as_pchan), ## args) + pchan == as_pchan ? "" : gsm_pchan_name(as_pchan), \ + ((pchan != as_pchan) && !allow_pchan_switch) ? " without pchan switch" : "", \ + ## args) if (!trx_is_usable(trx)) { LOGPLCHANALLOC("%s trx not usable\n", gsm_trx_name(trx)); @@ -73,9 +75,10 @@ continue; } /* Next, is this timeslot in or can it be switched to the pchan we want to use it for? */ - if (!ts_usable_as_pchan(ts, as_pchan)) { - LOGPLCHANALLOC("%s is not usable as %s\n", gsm_ts_and_pchan_name(ts), - gsm_pchan_name(as_pchan)); + if (!ts_usable_as_pchan(ts, as_pchan, allow_pchan_switch)) { + LOGPLCHANALLOC("%s is not usable as %s%s\n", gsm_ts_and_pchan_name(ts), + gsm_pchan_name(as_pchan), + allow_pchan_switch ? "" : " without pchan switch"); continue; } @@ -104,18 +107,28 @@ { struct gsm_bts_trx *trx; struct gsm_lchan *lc; + int allow_pchan_switch; + bool try_pchan_switch; - if (bts->chan_alloc_reverse) { - llist_for_each_entry_reverse(trx, &bts->trx_list, list) { - lc = _lc_find_trx(trx, pchan, dyn_as_pchan); - if (lc) - return lc; - } - } else { - llist_for_each_entry(trx, &bts->trx_list, list) { - lc = _lc_find_trx(trx, pchan, dyn_as_pchan); - if (lc) - return lc; + /* First find an lchan that needs no change in its timeslot pchan mode. + * In particular, this ensures that handover to a dynamic timeslot in TCH/H favors timeslots that are currently + * using only one of two TCH/H, so that we don't switch more dynamic timeslots to TCH/H than necessary. + * For non-dynamic timeslots, it is not necessary to do a second pass with allow_pchan_switch == + * true, because they never switch anyway. */ + try_pchan_switch = (pchan != dyn_as_pchan); + for (allow_pchan_switch = 0; allow_pchan_switch <= (try_pchan_switch ? 1 : 0); allow_pchan_switch++) { + if (bts->chan_alloc_reverse) { + llist_for_each_entry_reverse(trx, &bts->trx_list, list) { + lc = _lc_find_trx(trx, pchan, dyn_as_pchan, (bool)allow_pchan_switch); + if (lc) + return lc; + } + } else { + llist_for_each_entry(trx, &bts->trx_list, list) { + lc = _lc_find_trx(trx, pchan, dyn_as_pchan, (bool)allow_pchan_switch); + if (lc) + return lc; + } } } diff --git a/src/osmo-bsc/timeslot_fsm.c b/src/osmo-bsc/timeslot_fsm.c index 106e6a1..d8636a1 100644 --- a/src/osmo-bsc/timeslot_fsm.c +++ b/src/osmo-bsc/timeslot_fsm.c @@ -1004,7 +1004,7 @@ /* Does the timeslot's *current* state allow use as this PCHAN kind? If the ts is in switchover, return * true if the switchover's target PCHAN matches, i.e. an lchan for this pchan kind could be requested * and will be served after the switch. (Do not check whether any lchans are actually available.) */ -bool ts_usable_as_pchan(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config as_pchan) +bool ts_usable_as_pchan(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config as_pchan, bool allow_pchan_switch) { enum gsm_phys_chan_config target_pchan; @@ -1022,5 +1022,11 @@ if (ts_is_lchan_waiting_for_pchan(ts, &target_pchan)) return target_pchan == as_pchan; - return ts_is_capable_of_pchan(ts, as_pchan); + if (!ts_is_capable_of_pchan(ts, as_pchan)) + return false; + + if (!allow_pchan_switch && ts->pchan_is != as_pchan) + return false; + + return true; } diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c index d2d3229..6befc5a 100644 --- a/tests/handover/handover_test.c +++ b/tests/handover/handover_test.c @@ -1702,8 +1702,7 @@ "create-bts", "1", "c+s4", "TCH/F", "TCH/F", "TCH/F", "dyn", "dyn", "dyn", "PDCH", "set-ts-use", "0", "0", "*", "-", "-", "-", "PDCH", "TCH/H-", "PDCH", "PDCH", "create-ms", "0", "TCH/H", "AMR", - /* bad: should re-use existing dyn TS instead of switching another one */ - "expect-ts-use", "0", "0", "*", "-", "-", "-", "TCH/H-", "TCH/H-", "PDCH", "PDCH", + "expect-ts-use", "0", "0", "*", "-", "-", "-", "PDCH", "TCH/HH", "PDCH", "PDCH", NULL }; -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/21203 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I5a8d943f31774af00664d037550be14e767d312a Gerrit-Change-Number: 21203 Gerrit-PatchSet: 3 Gerrit-Owner: neels <nhofmeyr at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201118/1b4d56b5/attachment.htm>