aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2021-10-02 12:03:19 +0200
committerneels <nhofmeyr@sysmocom.de>2021-10-04 11:04:21 +0000
commit62c4097dcf3e6fdf57f47fcc8f45076572a25d9f (patch)
tree13088832fb4e82fdc8c9806ad523b2933855e209 /include
parent335d7f730e525da5a2f0e3c15498a726749e827f (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 'include')
-rw-r--r--include/osmocom/bsc/gsm_data.h48
1 files changed, 30 insertions, 18 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 03f210f7d..21828d4f4 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -138,6 +138,14 @@ extern const struct value_string assign_for_names[];
static inline const char *assign_for_name(enum assign_for assign_for)
{ return get_value_string(assign_for_names, assign_for); }
+/* If .present is false, use the default value defined elsewhere. If true, use .val below.
+ * (A practical benefit of this is that the default initialization sets .present to false, so that even if a .val == 0
+ * is a valid value, a struct containing this as member does not need to explicitly set .val = INVALID_VAL_CONSTANT.) */
+struct optional_val {
+ bool present;
+ int val;
+};
+
/* Information retrieved during an Assignment Request from the MSC. This is storage of the Assignment instructions
* parsed from the Assignment Request message, to pass on until the gscon and assignment FSMs have decided whether an
* Assignment is actually going to be carried out. Should remain unchanged after initial decoding. */
@@ -165,12 +173,12 @@ struct assignment_request {
* target_lchan to it. */
struct gsm_lchan *target_lchan;
- /* TSC Set to use, or -1 for automatically determining the TSC Set to use. Valid range is 1 to 4, as described
- * in 3GPP TS 45.002. */
- int tsc_set;
- /* TSC to use, or -1 for automatically determining the TSC to use. Valid range is 0 to 7, as described in 3GPP
- * TS 45.002. */
- int tsc;
+ /* The TSC Set to use if 'use' is true, otherwise automatically determine the TSC Set value to use. Valid range
+ * is 1 to 4, as described in 3GPP TS 45.002. */
+ struct optional_val tsc_set;
+ /* The TSC to use if 'use' is true, otherwise automatically determine the TSC value to use. Valid range is 0 to
+ * 7, as described in 3GPP TS 45.002. */
+ struct optional_val tsc;
};
/* State of an ongoing Assignment, while the assignment_fsm is still busy. This serves as state separation to keep the
@@ -621,12 +629,12 @@ struct lchan_activate_info {
bool ta_known;
uint8_t ta;
- /* TSC Set to use, or -1 for automatically determining the TSC Set to use. Valid range is 1 to 4, as described
- * in 3GPP TS 45.002. */
- int tsc_set;
- /* TSC to use, or -1 for automatically determining the TSC to use. Valid range is 0 to 7, as described in 3GPP
- * TS 45.002. */
- int tsc;
+ /* The TSC Set to use if 'use' is true, otherwise automatically determine the TSC Set value to use. Valid range
+ * is 1 to 4, as described in 3GPP TS 45.002. */
+ struct optional_val tsc_set;
+ /* The TSC to use if 'use' is true, otherwise automatically determine the TSC value to use. Valid range is 0 to
+ * 7, as described in 3GPP TS 45.002. */
+ struct optional_val tsc;
bool vamos;
@@ -652,12 +660,12 @@ struct lchan_modify_info {
bool requires_voice_stream;
uint16_t msc_assigned_cic;
- /* TSC Set to use, or -1 for automatically determining the TSC Set to use. Valid range is 1 to 4, as described
- * in 3GPP TS 45.002. */
- int tsc_set;
- /* TSC to use, or -1 for automatically determining the TSC to use. Valid range is 0 to 7, as described in 3GPP
- * TS 45.002. */
- int tsc;
+ /* The TSC Set to use if 'use' is true, otherwise automatically determine the TSC Set value to use. Valid range
+ * is 1 to 4, as described in 3GPP TS 45.002. */
+ struct optional_val tsc_set;
+ /* The TSC to use if 'use' is true, otherwise automatically determine the TSC value to use. Valid range is 0 to
+ * 7, as described in 3GPP TS 45.002. */
+ struct optional_val tsc;
bool vamos;
};
@@ -695,7 +703,9 @@ struct gsm_lchan {
* occur later, e.g. during release, that we don't send a NACK out of context. */
bool concluded;
enum gsm0808_cause gsm0808_error_cause;
+ /* Actually used TSC Set. */
int tsc_set;
+ /* Actually used TSC. */
uint8_t tsc;
} activate;
@@ -709,7 +719,9 @@ struct gsm_lchan {
struct channel_mode_and_rate ch_mode_rate;
struct gsm48_multi_rate_conf mr_conf_filtered;
+ /* Actually used TSC Set. */
int tsc_set;
+ /* Actually used TSC. */
uint8_t tsc;
bool concluded;
} modify;