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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/24949 ) Change subject: Add new lchan_select_set_type() API helper ...................................................................... Add new lchan_select_set_type() API helper It's an easy helper, but it helps in standarizing and finding similar places in code. Morevoer, it will be used in follow-up commit where we first use lchan_avail_by_type and finally we select it in a later stage. Change-Id: I025a40962a5e5d40543b297a0760e47618fb525c --- M include/osmocom/bsc/lchan_select.h M src/osmo-bsc/bsc_vty.c M src/osmo-bsc/lchan_select.c 3 files changed, 21 insertions(+), 10 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve daniel: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/bsc/lchan_select.h b/include/osmocom/bsc/lchan_select.h index aa2f40e..3bb0d1c 100644 --- a/include/osmocom/bsc/lchan_select.h +++ b/include/osmocom/bsc/lchan_select.h @@ -6,3 +6,4 @@ struct gsm_lchan *lchan_select_by_chan_mode(struct gsm_bts *bts, enum gsm48_chan_mode chan_mode, enum channel_rate chan_rate); struct gsm_lchan *lchan_avail_by_type(struct gsm_bts *bts, enum gsm_chan_t type, bool log); +void lchan_select_set_type(struct gsm_lchan *lchan, enum gsm_chan_t type); diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index d76d02d..9b6fa62 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -6299,7 +6299,7 @@ } /* configure the lchan */ - lchan->type = lchan_t; + lchan_select_set_type(lchan, lchan_t); if (!strcmp(codec_str, "hr") || !strcmp(codec_str, "fr")) { info = (struct lchan_activate_info) { .activ_for = ACTIVATE_FOR_VTY, @@ -6792,9 +6792,9 @@ return CMD_WARNING; } - /* lchan_select_*() sets the lchan->type, we need to do the same here, so that activation will work out. */ - to_lchan->type = chan_mode_to_chan_type(from_lchan->current_ch_mode_rate.chan_mode, - from_lchan->current_ch_mode_rate.chan_rate); + /* Set lchan type, so that activation will work out. */ + lchan_select_set_type(to_lchan, chan_mode_to_chan_type(from_lchan->current_ch_mode_rate.chan_mode, + from_lchan->current_ch_mode_rate.chan_rate)); LOG_LCHAN(from_lchan, LOGL_NOTICE, "VTY requests re-assignment of this lchan to %s%s\n", gsm_lchan_name(to_lchan), to_lchan->vamos.is_secondary ? " (to VAMOS mode)" : ""); diff --git a/src/osmo-bsc/lchan_select.c b/src/osmo-bsc/lchan_select.c index 3618fb4..022d516 100644 --- a/src/osmo-bsc/lchan_select.c +++ b/src/osmo-bsc/lchan_select.c @@ -296,16 +296,26 @@ { struct gsm_lchan *lchan = NULL; - lchan = lchan_avail_by_type(bts, type, true); - LOG_BTS(bts, DRLL, LOGL_DEBUG, "lchan_select_by_type(%s)\n", gsm_lchant_name(type)); - if (lchan) { - lchan->type = type; - LOG_LCHAN(lchan, LOGL_INFO, "Selected\n"); - } else + lchan = lchan_avail_by_type(bts, type, true); + + if (!lchan) { LOG_BTS(bts, DRLL, LOGL_NOTICE, "Failed to select %s channel\n", gsm_lchant_name(type)); + return NULL; + } + lchan_select_set_type(lchan, type); return lchan; } + +/* Set available lchan to given type. Usually used on lchan obtained with + * lchan_avail_by_type. The next logical step is lchan_activate() on it, which + * would possibly cause dynamic timeslot pchan switching, taken care of by the + * lchan and timeslot FSMs. */ +void lchan_select_set_type(struct gsm_lchan *lchan, enum gsm_chan_t type) +{ + lchan->type = type; + LOG_LCHAN(lchan, LOGL_INFO, "Selected\n"); +} -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/24949 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I025a40962a5e5d40543b297a0760e47618fb525c Gerrit-Change-Number: 24949 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann at sysmocom.de> 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/20210720/833c7edc/attachment.htm>