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/+/24461 ) Change subject: update the lchan name to always reflect VAMOS shadowness ...................................................................... update the lchan name to always reflect VAMOS shadowness Change gsm_lchan_name_compute() to a function that in-place updates the lchan->name. That allows calling it numerous times with the talloc handled internally. Rename it to lchan_update_name(). Add 'shadow' to lchan_update_name() and lchan_fsm_update_id() for VAMOS shadow lchans, and also print the lchan index that it is a shadow for, instead of the index in the lchan array. When set_pchan_is() updates the VAMOSness of the lchans, call lchan_fsm_update_id(). From lchan_fsm_update_id() also call lchan_update_name(). This is a bit convoluted for legacy reasons. There are utility programs and C tests using bts_trx.c but not lchan_fsm.c. lchan_update_name() lives in gsm_data.c for that reason. This patch calls lchan_update_name() from lchan_fsm_update_id() and not vice versa to avoid having to add stubbed lchan_fsm_update_id() functions to all utility programs and C tests. We can't easily unify the lchan->name and lchan->fi->id without lots of refactoring rippling through all those little utility programs and C tests. Change-Id: I7c2bae3b895a91f1b99b4147ecc0e3009cb7439a --- M include/osmocom/bsc/gsm_data.h M include/osmocom/bsc/lchan_fsm.h M src/osmo-bsc/assignment_fsm.c M src/osmo-bsc/bts_trx.c M src/osmo-bsc/gsm_data.c M src/osmo-bsc/lchan_fsm.c M src/osmo-bsc/timeslot_fsm.c 7 files changed, 25 insertions(+), 12 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve neels: Looks good to me, approved laforge: Looks good to me, but someone else must approve diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 88adb9f..8ea199b 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -1008,7 +1008,7 @@ const char *gsm_chreq_name(enum gsm_chreq_reason_t c); char *gsm_ts_name(const struct gsm_bts_trx_ts *ts); char *gsm_ts_and_pchan_name(const struct gsm_bts_trx_ts *ts); -char *gsm_lchan_name_compute(void *ctx, const struct gsm_lchan *lchan); +void lchan_update_name(struct gsm_lchan *lchan); static inline char *gsm_lchan_name(const struct gsm_lchan *lchan) { diff --git a/include/osmocom/bsc/lchan_fsm.h b/include/osmocom/bsc/lchan_fsm.h index 74e2a96..e7a06d5 100644 --- a/include/osmocom/bsc/lchan_fsm.h +++ b/include/osmocom/bsc/lchan_fsm.h @@ -83,3 +83,4 @@ void lchan_forget_conn(struct gsm_lchan *lchan); void lchan_fsm_skip_error(struct gsm_lchan *lchan); +void lchan_fsm_update_id(struct gsm_lchan *lchan); diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c index b6de293..a54bee5 100644 --- a/src/osmo-bsc/assignment_fsm.c +++ b/src/osmo-bsc/assignment_fsm.c @@ -302,14 +302,15 @@ return; } - osmo_fsm_inst_update_id_f(conn->assignment.fi, "%s_%u-%u-%u-%s%s%s-%u", + osmo_fsm_inst_update_id_f(conn->assignment.fi, "%s_%u-%u-%u-%s%s%s-%s%u", conn->fi->id, new_lchan->ts->trx->bts->nr, new_lchan->ts->trx->nr, new_lchan->ts->nr, gsm_pchan_id(new_lchan->ts->pchan_on_init), (new_lchan->ts->pchan_on_init == new_lchan->ts->pchan_is)? "" : "as", (new_lchan->ts->pchan_on_init == new_lchan->ts->pchan_is)? "" : gsm_pchan_id(new_lchan->ts->pchan_is), - new_lchan->nr); + new_lchan->vamos.is_secondary ? "shadow" : "", + new_lchan->nr - (new_lchan->vamos.is_secondary ? new_lchan->ts->max_primary_lchans : 0)); } static bool lchan_type_compat_with_mode(enum gsm_chan_t type, const struct channel_mode_and_rate *ch_mode_rate) diff --git a/src/osmo-bsc/bts_trx.c b/src/osmo-bsc/bts_trx.c index 64c7985..1f3cb0a 100644 --- a/src/osmo-bsc/bts_trx.c +++ b/src/osmo-bsc/bts_trx.c @@ -111,7 +111,7 @@ lchan->nr = l; lchan->type = GSM_LCHAN_NONE; - lchan->name = gsm_lchan_name_compute(trx, lchan); + lchan_update_name(lchan); } } diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c index 4d2d811..5f647e2 100644 --- a/src/osmo-bsc/gsm_data.c +++ b/src/osmo-bsc/gsm_data.c @@ -334,12 +334,15 @@ return ts2str; } -char *gsm_lchan_name_compute(void *ctx, const struct gsm_lchan *lchan) +void lchan_update_name(struct gsm_lchan *lchan) { struct gsm_bts_trx_ts *ts = lchan->ts; - return talloc_asprintf(ctx, "(bts=%d,trx=%d,ts=%d,ss=%d%s)", - ts->trx->bts->nr, ts->trx->nr, ts->nr, lchan->nr, - lchan->vamos.is_secondary ? "-VAMOS" : ""); + if (lchan->name) + talloc_free(lchan->name); + lchan->name = talloc_asprintf(ts->trx, "(bts=%d,trx=%d,ts=%d,ss=%s%d)", + ts->trx->bts->nr, ts->trx->nr, ts->nr, + lchan->vamos.is_secondary ? "shadow" : "", + lchan->nr - (lchan->vamos.is_secondary ? ts->max_primary_lchans : 0)); } /* obtain the MO structure for a given object instance */ diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c index c429243..c56be8d 100644 --- a/src/osmo-bsc/lchan_fsm.c +++ b/src/osmo-bsc/lchan_fsm.c @@ -411,11 +411,16 @@ } } -static void lchan_fsm_update_id(struct gsm_lchan *lchan) +void lchan_fsm_update_id(struct gsm_lchan *lchan) { - osmo_fsm_inst_update_id_f(lchan->fi, "%u-%u-%u-%s-%u", + lchan_update_name(lchan); + if (!lchan->fi) + return; + osmo_fsm_inst_update_id_f(lchan->fi, "%u-%u-%u-%s-%s%u", lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr, - gsm_pchan_id(lchan->ts->pchan_on_init), lchan->nr); + gsm_pchan_id(lchan->ts->pchan_on_init), + lchan->vamos.is_secondary ? "shadow" : "", + lchan->nr - (lchan->vamos.is_secondary ? lchan->ts->max_primary_lchans : 0)); if (lchan->fi_rtp) osmo_fsm_inst_update_id_f(lchan->fi_rtp, lchan->fi->id); } diff --git a/src/osmo-bsc/timeslot_fsm.c b/src/osmo-bsc/timeslot_fsm.c index 64b98a6..b9c86df 100644 --- a/src/osmo-bsc/timeslot_fsm.c +++ b/src/osmo-bsc/timeslot_fsm.c @@ -204,11 +204,14 @@ lchan->vamos.is_secondary = false; else lchan->vamos.is_secondary = true; + lchan_fsm_update_id(lchan); } break; default: - ts_for_n_lchans(lchan, ts, ts->max_lchans_possible) + ts_for_n_lchans(lchan, ts, ts->max_lchans_possible) { lchan->vamos.is_secondary = false; + lchan_fsm_update_id(lchan); + } break; } } -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/24461 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I7c2bae3b895a91f1b99b4147ecc0e3009cb7439a Gerrit-Change-Number: 24461 Gerrit-PatchSet: 13 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/20210610/862d8333/attachment.htm>