From d3a100257d73735aa097c6c57927f314f5b79afd Mon Sep 17 00:00:00 2001 From: Francisco Date: Tue, 26 Oct 2021 15:56:36 +0100 Subject: [PATCH] lte,enb,s1 handover: stop ts1 handover timers when an handover cancel occurs after the Handover preparation --- srsenb/hdr/stack/s1ap/s1ap.h | 5 ++++- srsenb/src/stack/s1ap/s1ap.cc | 29 +++++++++++++++++++---------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/srsenb/hdr/stack/s1ap/s1ap.h b/srsenb/hdr/stack/s1ap/s1ap.h index 0be19f3b5..79b58a56a 100644 --- a/srsenb/hdr/stack/s1ap/s1ap.h +++ b/srsenb/hdr/stack/s1ap/s1ap.h @@ -107,7 +107,7 @@ public: // Stack interface bool - handle_mme_rx_msg(srsran::unique_byte_buffer_t pdu, const sockaddr_in& from, const sctp_sndrcvinfo& sri, int flags); + handle_mme_rx_msg(srsran::unique_byte_buffer_t pdu, const sockaddr_in& from, const sctp_sndrcvinfo& sri, int flags); void start_pcap(srsran::s1ap_pcap* pcap_); private: @@ -253,6 +253,9 @@ private: bool send_erab_release_indication(const std::vector& erabs_successfully_released); bool send_ue_cap_info_indication(srsran::unique_byte_buffer_t ue_radio_cap); + /// TS 36.413 8.4.5 - Handover Cancellation + void send_ho_cancel(const asn1::s1ap::cause_c& cause); + bool was_uectxtrelease_requested() const { return release_requested; } void diff --git a/srsenb/src/stack/s1ap/s1ap.cc b/srsenb/src/stack/s1ap/s1ap.cc index 87389ea8c..b714f8b65 100644 --- a/srsenb/src/stack/s1ap/s1ap.cc +++ b/srsenb/src/stack/s1ap/s1ap.cc @@ -1292,16 +1292,7 @@ void s1ap::send_ho_cancel(uint16_t rnti, const asn1::s1ap::cause_c& cause) return; } - s1ap_pdu_c tx_pdu; - - tx_pdu.set_init_msg().load_info_obj(ASN1_S1AP_ID_HO_CANCEL); - ho_cancel_ies_container& container = tx_pdu.init_msg().value.ho_cancel().protocol_ies; - - container.mme_ue_s1ap_id.value = user_ptr->ctxt.mme_ue_s1ap_id.value(); - container.enb_ue_s1ap_id.value = user_ptr->ctxt.enb_ue_s1ap_id; - container.cause.value = cause; - - sctp_send_s1ap_pdu(tx_pdu, rnti, "HandoverCancel"); + user_ptr->send_ho_cancel(cause); } bool s1ap::release_erabs(uint16_t rnti, const std::vector& erabs_successfully_released) @@ -1730,6 +1721,24 @@ bool s1ap::ue::send_ue_cap_info_indication(srsran::unique_byte_buffer_t ue_radio return s1ap_ptr->sctp_send_s1ap_pdu(tx_pdu, ctxt.rnti, "UECapabilityInfoIndication"); } +void s1ap::ue::send_ho_cancel(const asn1::s1ap::cause_c& cause) +{ + // Stop handover timers + ts1_reloc_prep.stop(); + ts1_reloc_overall.stop(); + + // Send S1AP Handover Cancel + s1ap_pdu_c tx_pdu; + tx_pdu.set_init_msg().load_info_obj(ASN1_S1AP_ID_HO_CANCEL); + ho_cancel_ies_container& container = tx_pdu.init_msg().value.ho_cancel().protocol_ies; + + container.mme_ue_s1ap_id.value = ctxt.mme_ue_s1ap_id.value(); + container.enb_ue_s1ap_id.value = ctxt.enb_ue_s1ap_id; + container.cause.value = cause; + + s1ap_ptr->sctp_send_s1ap_pdu(tx_pdu, ctxt.rnti, "HandoverCancel"); +} + void s1ap::ue::set_state(s1ap_proc_id_t next_state, const erab_id_list& erabs_updated, const erab_item_list& erabs_failed_to_modify)