diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2021-10-02 12:03:19 +0200 |
---|---|---|
committer | neels <nhofmeyr@sysmocom.de> | 2021-10-04 11:04:21 +0000 |
commit | 62c4097dcf3e6fdf57f47fcc8f45076572a25d9f (patch) | |
tree | 13088832fb4e82fdc8c9806ad523b2933855e209 /src | |
parent | 335d7f730e525da5a2f0e3c15498a726749e827f (diff) |
fix TSC / TSC Set used for Handover
From the nature of the lchan_activate_info.tsc_set and .tsc, it is easy
to forget to set tsc_set,tsc = -1 to use default TSC Set and TSC values.
Handover code is one such instance that forgets to set -1.
Change the semantics of tsc_set and tsc so that this kind of error can
not happen again as easily: use a separate bool to flag whether to use
the default config or explicit values.
Implicitly fix the lchan_activate_infos "launched" in handover_fsm.c as
well as abis_rsl_chan_rqd_queue_poll().
Related: OS#5244 SYS#4895
Related: I1ed6f068c85b01e5a2d7b5f2651498a1521f89af (osmo-ttcn3-hacks)
Change-Id: Iae20df4387c3d75752301bd5daeeea7508966393
Diffstat (limited to 'src')
-rw-r--r-- | src/osmo-bsc/abis_rsl.c | 2 | ||||
-rw-r--r-- | src/osmo-bsc/assignment_fsm.c | 20 | ||||
-rw-r--r-- | src/osmo-bsc/bsc_vty.c | 24 | ||||
-rw-r--r-- | src/osmo-bsc/lchan_fsm.c | 14 | ||||
-rw-r--r-- | src/osmo-bsc/osmo_bsc_bssap.c | 4 |
5 files changed, 38 insertions, 26 deletions
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c index fb8e3867a..98822521f 100644 --- a/src/osmo-bsc/abis_rsl.c +++ b/src/osmo-bsc/abis_rsl.c @@ -2087,8 +2087,6 @@ void abis_rsl_chan_rqd_queue_poll(struct gsm_bts *bts) }, .ta = rqd->ta, .ta_known = true, - .tsc_set = -1, - .tsc = -1, .imm_ass_time = bts->imm_ass_time, }; diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c index 07e7239b8..a1b423f48 100644 --- a/src/osmo-bsc/assignment_fsm.c +++ b/src/osmo-bsc/assignment_fsm.c @@ -452,8 +452,14 @@ static int _reassignment_request(enum assign_for assign_for, struct gsm_lchan *l .n_ch_mode_rate = 1, .ch_mode_rate_list = { lchan->current_ch_mode_rate }, .target_lchan = to_lchan, - .tsc_set = tsc_set, - .tsc = tsc, + .tsc_set = { + .present = (tsc_set >= 0), + .val = tsc_set, + }, + .tsc = { + .present = (tsc >= 0), + .val = tsc, + }, }; if (to_lchan) @@ -831,8 +837,14 @@ static void assignment_fsm_wait_lchan_modified_onenter(struct osmo_fsm_inst *fi, .requires_voice_stream = conn->assignment.requires_voice_stream, .msc_assigned_cic = req->msc_assigned_cic, /* keep previous training sequence code */ - .tsc_set = lchan->tsc_set, - .tsc = lchan->tsc, + .tsc_set = { + .present = (lchan->tsc_set >= 0), + .val = lchan->tsc_set, + }, + .tsc = { + .present = (lchan->tsc >= 0), + .val = lchan->tsc, + }, }; lchan_mode_modify(lchan, &modif_info); } diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index 5ccd78487..bd6155519 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -849,6 +849,7 @@ static int ho_or_as(struct vty *vty, const char *argv[], int argc) return CMD_WARNING; } +/* tsc_set and tsc: -1 to automatically determine which TSC Set / which TSC to use. */ static int trigger_vamos_mode_modify(struct vty *vty, struct gsm_lchan *lchan, bool vamos, int tsc_set, int tsc) { struct lchan_modify_info info = { @@ -856,8 +857,14 @@ static int trigger_vamos_mode_modify(struct vty *vty, struct gsm_lchan *lchan, b .ch_mode_rate = lchan->current_ch_mode_rate, .requires_voice_stream = (lchan->fi_rtp != NULL), .vamos = vamos, - .tsc_set = tsc_set, - .tsc = tsc, + .tsc_set = { + .present = (tsc_set >= 0), + .val = tsc_set, + }, + .tsc = { + .present = (tsc >= 0), + .val = tsc, + }, }; lchan_mode_modify(lchan, &info); @@ -1540,10 +1547,7 @@ DEFUN(pdch_act, pdch_act_cmd, /* Activate / Deactivate a single lchan with a specific codec mode */ static int lchan_act_single(struct vty *vty, struct gsm_lchan *lchan, const char *codec_str, int amr_mode, int activate) { - struct lchan_activate_info info = { - .tsc_set = -1, - .tsc = -1, - }; + struct lchan_activate_info info = {0}; uint16_t amr_modes[8] = { GSM0808_SC_CFG_AMR_4_75, GSM0808_SC_CFG_AMR_4_75_5_90_7_40_12_20, GSM0808_SC_CFG_AMR_5_90, GSM0808_SC_CFG_AMR_6_70, GSM0808_SC_CFG_AMR_7_40, GSM0808_SC_CFG_AMR_7_95, GSM0808_SC_CFG_AMR_10_2, @@ -1612,8 +1616,12 @@ static int lchan_act_single(struct vty *vty, struct gsm_lchan *lchan, const char if (activate == 2 || lchan->vamos.is_secondary) { info.vamos = true; - info.tsc_set = lchan->vamos.is_secondary ? 1 : 0; - info.tsc = 0; + if (lchan->vamos.is_secondary) { + info.tsc_set.present = true; + info.tsc_set.val = 1; + } + info.tsc.present = true; + info.tsc.val = 0; info.ch_mode_rate.chan_mode = gsm48_chan_mode_to_vamos(info.ch_mode_rate.chan_mode); } diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c index 0faafdb94..2f6248708 100644 --- a/src/osmo-bsc/lchan_fsm.c +++ b/src/osmo-bsc/lchan_fsm.c @@ -714,13 +714,13 @@ static void lchan_fsm_wait_ts_ready_onenter(struct osmo_fsm_inst *fi, uint32_t p /* If enabling VAMOS mode and no specific TSC Set was selected, make sure to select a sane TSC Set by * default: Set 1 for the primary and Set 2 for the shadow lchan. For non-VAMOS lchans, TSC Set 1. */ - if (lchan->activate.info.tsc_set > 0) - lchan->activate.tsc_set = lchan->activate.info.tsc_set; + if (lchan->activate.info.tsc_set.present) + lchan->activate.tsc_set = lchan->activate.info.tsc_set.val; else lchan->activate.tsc_set = lchan->vamos.is_secondary ? 2 : 1; /* Use the TSC provided in the activation request, if any. Otherwise use the timeslot's configured TSC. */ - lchan->activate.tsc = (lchan->activate.info.tsc >= 0) ? lchan->activate.info.tsc : gsm_ts_tsc(lchan->ts); + lchan->activate.tsc = lchan->activate.info.tsc.present ? lchan->activate.info.tsc.val : gsm_ts_tsc(lchan->ts); use_mgwep_ci = lchan_use_mgw_endpoint_ci_bts(lchan); @@ -1095,8 +1095,6 @@ static void lchan_fsm_wait_rsl_chan_mode_modify_ack(struct osmo_fsm_inst *fi, ui .ch_mode_rate = lchan->modify.ch_mode_rate, .requires_voice_stream = true, .msc_assigned_cic = lchan->modify.info.msc_assigned_cic, - .tsc_set = -1, - .tsc = -1, }; if (lchan_activate_set_ch_mode_rate_and_mr_config(lchan)) return; @@ -1250,14 +1248,14 @@ static void lchan_fsm_established(struct osmo_fsm_inst *fi, uint32_t event, void /* If enabling VAMOS mode and no specific TSC Set was selected, make sure to select a sane TSC Set by * default: Set 1 for the primary and Set 2 for the shadow lchan. For non-VAMOS lchans, TSC Set 1. */ - if (lchan->modify.info.tsc_set > 0) - lchan->modify.tsc_set = lchan->modify.info.tsc_set; + if (lchan->modify.info.tsc_set.present) + lchan->modify.tsc_set = lchan->modify.info.tsc_set.val; else lchan->modify.tsc_set = lchan->vamos.is_secondary ? 2 : 1; /* Use the TSC provided in the modification request, if any. Otherwise use the timeslot's configured * TSC. */ - lchan->modify.tsc = (lchan->modify.info.tsc >= 0) ? lchan->modify.info.tsc : gsm_ts_tsc(lchan->ts); + lchan->modify.tsc = lchan->modify.info.tsc.present ? lchan->modify.info.tsc.val : gsm_ts_tsc(lchan->ts); LOG_LCHAN(lchan, LOGL_INFO, "Modification requested: %s voice=%s MGW-ci=%s type=%s tch-mode=%s tsc=%d/%u\n", diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index d786ec6ff..aab251424 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -940,8 +940,6 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn, .msc_assigned_cic = cic, .use_osmux = use_osmux, .osmux_cid = osmux_cid, - .tsc_set = -1, - .tsc = -1, }; /* Match codec information from the assignment command against the @@ -968,8 +966,6 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn, req = (struct assignment_request){ .assign_for = ASSIGN_FOR_BSSMAP_REQ, .aoip = aoip, - .tsc_set = -1, - .tsc = -1, }; rc = select_sign_chan(&req, &ct); |