From 53d05951a5ae0344101fccb58f89c4c1c4d2f8aa Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sun, 13 Mar 2022 18:20:15 +0300 Subject: [PATCH] gsm48_make_ho_cmd(): optionally add Synchronization Indication IE Change-Id: I4e5b1163a71443d706f14ce4bfd5c2294c320432 Related: SYS#5838 --- include/osmocom/bsc/gsm_04_08_rr.h | 2 +- src/osmo-bsc/gsm_04_08_rr.c | 16 ++++++++++++++-- src/osmo-bsc/handover_fsm.c | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/osmocom/bsc/gsm_04_08_rr.h b/include/osmocom/bsc/gsm_04_08_rr.h index 75307d63f..7d68fc85f 100644 --- a/include/osmocom/bsc/gsm_04_08_rr.h +++ b/include/osmocom/bsc/gsm_04_08_rr.h @@ -27,7 +27,7 @@ int gsm48_multirate_config(struct msgb *msg, const struct gsm48_multi_rate_conf *mr_conf, const struct amr_mode *modes, unsigned int num_modes); struct msgb *gsm48_make_ho_cmd(const struct gsm_lchan *new_lchan, - enum handover_scope ho_scope, + enum handover_scope ho_scope, bool async, uint8_t power_command, uint8_t ho_ref); int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, uint8_t power_command); int gsm48_send_rr_app_info(struct gsm_lchan *lchan, uint8_t apdu_id, uint8_t apdu_flags, diff --git a/src/osmo-bsc/gsm_04_08_rr.c b/src/osmo-bsc/gsm_04_08_rr.c index cf7411866..368ad733c 100644 --- a/src/osmo-bsc/gsm_04_08_rr.c +++ b/src/osmo-bsc/gsm_04_08_rr.c @@ -534,7 +534,7 @@ return_msg: /* Chapter 9.1.15: Handover Command */ struct msgb *gsm48_make_ho_cmd(const struct gsm_lchan *new_lchan, - enum handover_scope ho_scope, + enum handover_scope ho_scope, bool async, uint8_t power_command, uint8_t ho_ref) { struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 HO CMD"); @@ -555,6 +555,19 @@ struct msgb *gsm48_make_ho_cmd(const struct gsm_lchan *new_lchan, ho->ho_ref = ho_ref; ho->power_command = power_command; + /* Synchronization Indication, TV (see 3GPP TS 44.018, 9.1.15.1). + * In the case of inter-RAT handover, always include this IE for the sake of + * explicitness. In the case of intra-RAT handover, include this IE only for + * the synchronized handover. If omitted, non-synchronized handover is assumed. */ + if (!async || (ho_scope & HO_INTER_BSC_IN)) { + /* Only the SI field (Non-synchronized/Synchronized) is present. + * TODO: ROT (Report Observed Time Difference), currently 0. + * TODO: NCI (Normal cell indication), currently 0. */ + const uint8_t sync_ind = async ? 0x00 : 0x01; + /* T (4 bit) + V (4 bit), see 3GPP TS 44.018, 10.5.2.39 */ + msgb_v_put(msg, GSM48_IE_SYNC_IND | (sync_ind & 0x0f)); + } + if (new_lchan->ts->hopping.enabled) { struct gsm48_system_information_type_1 *si1; @@ -564,7 +577,6 @@ struct msgb *gsm48_make_ho_cmd(const struct gsm_lchan *new_lchan, GSM48_HOCMD_CCHDESC_LEN, si1->cell_channel_description); } - /* FIXME: optional bits for type of synchronization? */ msgb_tv_put(msg, GSM48_IE_CHANMODE_1, new_lchan->current_ch_mode_rate.chan_mode); diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c index b3f78c0c0..5ae3787be 100644 --- a/src/osmo-bsc/handover_fsm.c +++ b/src/osmo-bsc/handover_fsm.c @@ -1216,7 +1216,7 @@ static void ho_fsm_wait_rr_ho_detect_onenter(struct osmo_fsm_inst *fi, uint32_t struct handover *ho = &conn->ho; struct msgb *rr_ho_cmd = gsm48_make_ho_cmd(ho->new_lchan, - ho->scope, + ho->async, ho->scope, ho->new_lchan->ms_power, ho->ho_ref); if (!rr_ho_cmd) {