diff --git a/lib/include/srsran/interfaces/enb_interfaces.h b/lib/include/srsran/interfaces/enb_interfaces.h index 1e7d3cd4c..e07d3e35d 100644 --- a/lib/include/srsran/interfaces/enb_interfaces.h +++ b/lib/include/srsran/interfaces/enb_interfaces.h @@ -14,8 +14,6 @@ #include "srsran/common/interfaces_common.h" #include "srsran/srsran.h" -#include "srsran/interfaces/enb_rrc_interfaces.h" - #ifndef SRSRAN_ENB_INTERFACES_H #define SRSRAN_ENB_INTERFACES_H diff --git a/lib/include/srsran/interfaces/enb_rrc_interface_mac.h b/lib/include/srsran/interfaces/enb_rrc_interface_mac.h new file mode 100644 index 000000000..f8a806d90 --- /dev/null +++ b/lib/include/srsran/interfaces/enb_rrc_interface_mac.h @@ -0,0 +1,39 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2021 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#ifndef SRSRAN_ENB_RRC_INTERFACE_MAC_H +#define SRSRAN_ENB_RRC_INTERFACE_MAC_H + +#include "srsenb/hdr/stack/mac/sched_interface.h" + +namespace srsenb { + +/// RRC interface for MAC +class rrc_interface_mac +{ +public: + /* Radio Link failure */ + virtual int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) = 0; + virtual void upd_user(uint16_t new_rnti, uint16_t old_rnti) = 0; + virtual void set_activity_user(uint16_t rnti) = 0; + virtual void set_radiolink_dl_state(uint16_t rnti, bool crc_res) = 0; + virtual void set_radiolink_ul_state(uint16_t rnti, bool crc_res) = 0; + virtual bool is_paging_opportunity(uint32_t tti_tx_dl, uint32_t* payload_len) = 0; + virtual void read_pdu_pcch(uint32_t tti_tx_dl, uint8_t* payload, uint32_t payload_size) = 0; + + ///< Provide packed SIB to MAC (buffer is managed by RRC) + virtual uint8_t* read_pdu_bcch_dlsch(const uint8_t enb_cc_idx, const uint32_t sib_index) = 0; +}; + +} // namespace srsenb + +#endif // SRSRAN_ENB_RRC_INTERFACE_MAC_H diff --git a/lib/include/srsran/interfaces/enb_rrc_interface_pdcp.h b/lib/include/srsran/interfaces/enb_rrc_interface_pdcp.h new file mode 100644 index 000000000..600c663a5 --- /dev/null +++ b/lib/include/srsran/interfaces/enb_rrc_interface_pdcp.h @@ -0,0 +1,30 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2021 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#ifndef SRSRAN_ENB_RRC_INTERFACE_PDCP_H +#define SRSRAN_ENB_RRC_INTERFACE_PDCP_H + +#include "srsran/common/byte_buffer.h" + +namespace srsenb { + +/// RRC interface for PDCP +class rrc_interface_pdcp +{ +public: + virtual void write_pdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t pdu) = 0; + virtual void notify_pdcp_integrity_error(uint16_t rnti, uint32_t lcid) = 0; +}; + +} // namespace srsenb + +#endif // SRSRAN_ENB_RRC_INTERFACE_PDCP_H diff --git a/lib/include/srsran/interfaces/enb_rrc_interface_rlc.h b/lib/include/srsran/interfaces/enb_rrc_interface_rlc.h new file mode 100644 index 000000000..baa5aca04 --- /dev/null +++ b/lib/include/srsran/interfaces/enb_rrc_interface_rlc.h @@ -0,0 +1,31 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2021 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#ifndef SRSRAN_ENB_RRC_INTERFACE_RLC_H +#define SRSRAN_ENB_RRC_INTERFACE_RLC_H + +#include "srsran/common/byte_buffer.h" + +namespace srsenb { + +/// RRC interface for RLC +class rrc_interface_rlc +{ +public: + virtual void max_retx_attempted(uint16_t rnti) = 0; + virtual void protocol_failure(uint16_t rnti) = 0; + virtual void write_pdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu) = 0; +}; + +} // namespace srsenb + +#endif // SRSRAN_ENB_RRC_INTERFACE_RLC_H diff --git a/lib/include/srsran/interfaces/enb_rrc_interfaces.h b/lib/include/srsran/interfaces/enb_rrc_interface_s1ap.h similarity index 73% rename from lib/include/srsran/interfaces/enb_rrc_interfaces.h rename to lib/include/srsran/interfaces/enb_rrc_interface_s1ap.h index e8edb0499..780839944 100644 --- a/lib/include/srsran/interfaces/enb_rrc_interfaces.h +++ b/lib/include/srsran/interfaces/enb_rrc_interface_s1ap.h @@ -10,7 +10,6 @@ * */ -#include "srsenb/hdr/stack/mac/sched_interface.h" #include "srsran/asn1/s1ap_utils.h" #include "srsran/interfaces/enb_rrc_interface_types.h" @@ -86,40 +85,6 @@ public: virtual void set_erab_status(uint16_t rnti, const asn1::s1ap::bearers_subject_to_status_transfer_list_l& erabs) = 0; }; -/// RRC interface for RLC -class rrc_interface_rlc -{ -public: - virtual void max_retx_attempted(uint16_t rnti) = 0; - virtual void protocol_failure(uint16_t rnti) = 0; - virtual void write_pdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu) = 0; -}; - -/// RRC interface for MAC -class rrc_interface_mac -{ -public: - /* Radio Link failure */ - virtual int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) = 0; - virtual void upd_user(uint16_t new_rnti, uint16_t old_rnti) = 0; - virtual void set_activity_user(uint16_t rnti) = 0; - virtual void set_radiolink_dl_state(uint16_t rnti, bool crc_res) = 0; - virtual void set_radiolink_ul_state(uint16_t rnti, bool crc_res) = 0; - virtual bool is_paging_opportunity(uint32_t tti_tx_dl, uint32_t* payload_len) = 0; - virtual void read_pdu_pcch(uint32_t tti_tx_dl, uint8_t* payload, uint32_t payload_size) = 0; - - ///< Provide packed SIB to MAC (buffer is managed by RRC) - virtual uint8_t* read_pdu_bcch_dlsch(const uint8_t enb_cc_idx, const uint32_t sib_index) = 0; -}; - -/// RRC interface for PDCP -class rrc_interface_pdcp -{ -public: - virtual void write_pdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t pdu) = 0; - virtual void notify_pdcp_integrity_error(uint16_t rnti, uint32_t lcid) = 0; -}; - } // namespace srsenb #endif // SRSRAN_ENB_RRC_INTERFACES_H diff --git a/lib/include/srsran/interfaces/gnb_interfaces.h b/lib/include/srsran/interfaces/gnb_interfaces.h index 7ac39304f..9f4901134 100644 --- a/lib/include/srsran/interfaces/gnb_interfaces.h +++ b/lib/include/srsran/interfaces/gnb_interfaces.h @@ -19,9 +19,9 @@ #include "srsran/common/security.h" #include "srsran/interfaces/pdcp_interface_types.h" #include "srsran/interfaces/rlc_interface_types.h" -#include "srsran/interfaces/rrc_interface_types.h" // EUTRA interfaces that are used unmodified -#include "srsran/interfaces/enb_rrc_interfaces.h" +#include "srsran/interfaces/enb_rrc_interface_pdcp.h" +#include "srsran/interfaces/enb_rrc_interface_rlc.h" namespace srsenb { diff --git a/srsenb/hdr/stack/rrc/rrc.h b/srsenb/hdr/stack/rrc/rrc.h index 7d85275ab..7ba095c0c 100644 --- a/srsenb/hdr/stack/rrc/rrc.h +++ b/srsenb/hdr/stack/rrc/rrc.h @@ -25,7 +25,10 @@ #include "srsran/common/stack_procedure.h" #include "srsran/common/task_scheduler.h" #include "srsran/common/timeout.h" -#include "srsran/interfaces/enb_rrc_interfaces.h" +#include "srsran/interfaces/enb_rrc_interface_mac.h" +#include "srsran/interfaces/enb_rrc_interface_pdcp.h" +#include "srsran/interfaces/enb_rrc_interface_rlc.h" +#include "srsran/interfaces/enb_rrc_interface_s1ap.h" #include "srsran/interfaces/enb_x2_interfaces.h" #include "srsran/srslog/srslog.h" #include @@ -40,14 +43,6 @@ class phy_interface_rrc_lte; class paging_manager; -static const char rrc_state_text[RRC_STATE_N_ITEMS][100] = {"IDLE", - "WAIT FOR CON SETUP COMPLETE", - "WAIT FOR SECURITY MODE COMPLETE", - "WAIT FOR UE CAPABILITIY INFORMATION", - "WAIT FOR CON RECONF COMPLETE", - "RRC CONNECTED", - "RELEASE REQUEST"}; - class rrc final : public rrc_interface_pdcp, public rrc_interface_mac, public rrc_interface_rlc, diff --git a/srsenb/src/stack/mac/mac.cc b/srsenb/src/stack/mac/mac.cc index 04398bc3b..224dd0343 100644 --- a/srsenb/src/stack/mac/mac.cc +++ b/srsenb/src/stack/mac/mac.cc @@ -20,7 +20,7 @@ #include "srsran/common/time_prof.h" #include "srsran/interfaces/enb_phy_interfaces.h" #include "srsran/interfaces/enb_rlc_interfaces.h" -#include "srsran/interfaces/enb_rrc_interfaces.h" +#include "srsran/interfaces/enb_rrc_interface_mac.h" #include "srsran/srslog/event_trace.h" // #define WRITE_SIB_PCAP @@ -885,9 +885,9 @@ int mac::get_mch_sched(uint32_t tti, bool is_mcch, dl_sched_list_t& dl_sched_res int requested_bytes = (mcs_data.tbs / 8 > (int)mch.mtch_sched[mtch_index].lcid_buffer_size) ? (mch.mtch_sched[mtch_index].lcid_buffer_size) : ((mcs_data.tbs / 8) - 2); - int bytes_received = ue_db[SRSRAN_MRNTI]->read_pdu(current_lcid, mtch_payload_buffer, requested_bytes); - mch.pdu[0].lcid = current_lcid; - mch.pdu[0].nbytes = bytes_received; + int bytes_received = ue_db[SRSRAN_MRNTI]->read_pdu(current_lcid, mtch_payload_buffer, requested_bytes); + mch.pdu[0].lcid = current_lcid; + mch.pdu[0].nbytes = bytes_received; mch.mtch_sched[0].mtch_payload = mtch_payload_buffer; dl_sched_res->pdsch[0].dci.rnti = SRSRAN_MRNTI; if (bytes_received) { diff --git a/srsenb/src/stack/mac/sched_carrier.cc b/srsenb/src/stack/mac/sched_carrier.cc index 52077c66f..0e0d5ef62 100644 --- a/srsenb/src/stack/mac/sched_carrier.cc +++ b/srsenb/src/stack/mac/sched_carrier.cc @@ -16,7 +16,7 @@ #include "srsenb/hdr/stack/mac/schedulers/sched_time_rr.h" #include "srsran/common/standard_streams.h" #include "srsran/common/string_helpers.h" -#include "srsran/interfaces/enb_rrc_interfaces.h" +#include "srsran/interfaces/enb_rrc_interface_mac.h" namespace srsenb { diff --git a/srsenb/src/stack/mac/ue.cc b/srsenb/src/stack/mac/ue.cc index 43a35991f..6b4ecd7ef 100644 --- a/srsenb/src/stack/mac/ue.cc +++ b/srsenb/src/stack/mac/ue.cc @@ -19,7 +19,7 @@ #include "srsran/common/string_helpers.h" #include "srsran/interfaces/enb_phy_interfaces.h" #include "srsran/interfaces/enb_rlc_interfaces.h" -#include "srsran/interfaces/enb_rrc_interfaces.h" +#include "srsran/interfaces/enb_rrc_interface_mac.h" namespace srsenb { diff --git a/srsenb/src/stack/s1ap/s1ap.cc b/srsenb/src/stack/s1ap/s1ap.cc index 928686110..83f2adbff 100644 --- a/srsenb/src/stack/s1ap/s1ap.cc +++ b/srsenb/src/stack/s1ap/s1ap.cc @@ -16,7 +16,7 @@ #include "srsran/common/enb_events.h" #include "srsran/common/int_helpers.h" #include "srsran/common/standard_streams.h" -#include "srsran/interfaces/enb_rrc_interfaces.h" +#include "srsran/interfaces/enb_rrc_interface_s1ap.h" #include //for inet_ntop() #include diff --git a/srsenb/src/stack/upper/pdcp.cc b/srsenb/src/stack/upper/pdcp.cc index 529dbc1cd..5ee2b955c 100644 --- a/srsenb/src/stack/upper/pdcp.cc +++ b/srsenb/src/stack/upper/pdcp.cc @@ -14,7 +14,7 @@ #include "srsenb/hdr/common/common_enb.h" #include "srsran/interfaces/enb_gtpu_interfaces.h" #include "srsran/interfaces/enb_rlc_interfaces.h" -#include "srsran/interfaces/enb_rrc_interfaces.h" +#include "srsran/interfaces/enb_rrc_interface_pdcp.h" namespace srsenb { diff --git a/srsenb/src/stack/upper/rlc.cc b/srsenb/src/stack/upper/rlc.cc index 016d59deb..b0a830518 100644 --- a/srsenb/src/stack/upper/rlc.cc +++ b/srsenb/src/stack/upper/rlc.cc @@ -14,7 +14,7 @@ #include "srsenb/hdr/common/common_enb.h" #include "srsran/interfaces/enb_mac_interfaces.h" #include "srsran/interfaces/enb_pdcp_interfaces.h" -#include "srsran/interfaces/enb_rrc_interfaces.h" +#include "srsran/interfaces/enb_rrc_interface_rlc.h" namespace srsenb { diff --git a/srsenb/test/common/dummy_classes.h b/srsenb/test/common/dummy_classes.h index c3fb2598a..948f914d6 100644 --- a/srsenb/test/common/dummy_classes.h +++ b/srsenb/test/common/dummy_classes.h @@ -18,7 +18,7 @@ #include "srsran/interfaces/enb_mac_interfaces.h" #include "srsran/interfaces/enb_phy_interfaces.h" #include "srsran/interfaces/enb_rlc_interfaces.h" -#include "srsran/interfaces/enb_rrc_interfaces.h" +#include "srsran/interfaces/enb_rrc_interface_s1ap.h" #include "srsran/interfaces/enb_s1ap_interfaces.h" namespace srsenb { diff --git a/srsenb/test/mac/sched_test_common.h b/srsenb/test/mac/sched_test_common.h index 7d51c2891..76cb5c5fc 100644 --- a/srsenb/test/mac/sched_test_common.h +++ b/srsenb/test/mac/sched_test_common.h @@ -16,7 +16,7 @@ #include "sched_sim_ue.h" #include "sched_test_utils.h" #include "srsenb/hdr/stack/mac/sched.h" -#include "srsran/interfaces/enb_rrc_interfaces.h" +#include "srsran/interfaces/enb_rrc_interface_mac.h" #include "srsran/srslog/srslog.h" #include diff --git a/srsgnb/hdr/stack/mac/sched_nr_bwp.h b/srsgnb/hdr/stack/mac/sched_nr_bwp.h index 3b9a3c7e4..fce303f99 100644 --- a/srsgnb/hdr/stack/mac/sched_nr_bwp.h +++ b/srsgnb/hdr/stack/mac/sched_nr_bwp.h @@ -41,10 +41,10 @@ public: private: struct pending_rar_t { - uint16_t ra_rnti = 0; - slot_point prach_slot; - slot_interval rar_win; - srsran::bounded_vector msg3_grant; + uint16_t ra_rnti = 0; + slot_point prach_slot; + slot_interval rar_win; + srsran::bounded_vector msg3_grant; }; alloc_result diff --git a/srsgnb/hdr/stack/mac/sched_nr_interface.h b/srsgnb/hdr/stack/mac/sched_nr_interface.h index 686b8e8c0..52993cbfc 100644 --- a/srsgnb/hdr/stack/mac/sched_nr_interface.h +++ b/srsgnb/hdr/stack/mac/sched_nr_interface.h @@ -13,6 +13,7 @@ #ifndef SRSRAN_SCHED_NR_INTERFACE_H #define SRSRAN_SCHED_NR_INTERFACE_H +#include "srsenb/hdr/stack/mac/common/sched_config.h" #include "srsran/adt/bounded_bitset.h" #include "srsran/adt/bounded_vector.h" #include "srsran/adt/optional.h" diff --git a/srsgnb/hdr/stack/mac/ue_nr.h b/srsgnb/hdr/stack/mac/ue_nr.h index 542d03516..22d792c22 100644 --- a/srsgnb/hdr/stack/mac/ue_nr.h +++ b/srsgnb/hdr/stack/mac/ue_nr.h @@ -42,7 +42,7 @@ public: virtual ~ue_nr(); void reset(); - void ue_cfg(const sched_interface::ue_cfg_t& ue_cfg); + void ue_cfg(const sched_nr_interface::ue_cfg_t& ue_cfg); void set_tti(uint32_t tti); uint16_t get_rnti() const { return rnti; } diff --git a/srsgnb/hdr/stack/rrc/rrc_nr.h b/srsgnb/hdr/stack/rrc/rrc_nr.h index 76ed30972..7ba5cf6e1 100644 --- a/srsgnb/hdr/stack/rrc/rrc_nr.h +++ b/srsgnb/hdr/stack/rrc/rrc_nr.h @@ -26,7 +26,6 @@ #include "srsran/common/timeout.h" #include "srsran/interfaces/enb_pdcp_interfaces.h" #include "srsran/interfaces/enb_rlc_interfaces.h" -#include "srsran/interfaces/enb_rrc_interfaces.h" #include "srsran/interfaces/enb_x2_interfaces.h" #include "srsran/interfaces/gnb_interfaces.h" #include "srsran/interfaces/gnb_mac_interfaces.h" diff --git a/srsgnb/src/stack/mac/ue_nr.cc b/srsgnb/src/stack/mac/ue_nr.cc index bc7b3372f..243ba3353 100644 --- a/srsgnb/src/stack/mac/ue_nr.cc +++ b/srsgnb/src/stack/mac/ue_nr.cc @@ -49,7 +49,7 @@ void ue_nr::reset() nof_failures = 0; } -void ue_nr::ue_cfg(const sched_interface::ue_cfg_t& ue_cfg) +void ue_nr::ue_cfg(const sched_nr_interface::ue_cfg_t& ue_cfg) { // nop } diff --git a/srsgnb/src/stack/rrc/test/CMakeLists.txt b/srsgnb/src/stack/rrc/test/CMakeLists.txt index 04d038c4a..3f8d682bb 100644 --- a/srsgnb/src/stack/rrc/test/CMakeLists.txt +++ b/srsgnb/src/stack/rrc/test/CMakeLists.txt @@ -9,9 +9,9 @@ add_library(rrc_nr_test_helpers rrc_nr_test_helpers.cc) add_executable(rrc_nr_test rrc_nr_test.cc) -target_link_libraries(rrc_nr_test srsgnb_rrc srsgnb_rrc_config_utils srsran_common rrc_nr_asn1 rrc_asn1 rrc_nr_test_helpers ${ATOMIC_LIBS}) +target_link_libraries(rrc_nr_test srsgnb_rrc srsgnb_rrc_config_utils srsran_common rrc_nr_asn1 rrc_nr_test_helpers ${ATOMIC_LIBS}) add_test(rrc_nr_test rrc_nr_test) add_executable(rrc_nr_core_test rrc_nr_core_test.cc) -target_link_libraries(rrc_nr_core_test srsgnb_rrc srsgnb_rrc_config_utils srsran_common rrc_nr_asn1 rrc_asn1 test_helpers rrc_nr_test_helpers srsgnb_ngap ngap_nr_asn1 srsran_gtpu srsenb_upper ${SCTP_LIBRARIES} ${ATOMIC_LIBS} ${Boost_LIBRARIES}) +target_link_libraries(rrc_nr_core_test srsgnb_rrc srsgnb_rrc_config_utils srsran_common rrc_nr_asn1 test_helpers rrc_nr_test_helpers srsgnb_ngap ngap_nr_asn1 srsran_gtpu srsenb_upper ${SCTP_LIBRARIES} ${ATOMIC_LIBS} ${Boost_LIBRARIES})