diff --git a/lib/include/srslte/interfaces/ue_interfaces.h b/lib/include/srslte/interfaces/ue_interfaces.h index 19b4faa05..ee50adb10 100644 --- a/lib/include/srslte/interfaces/ue_interfaces.h +++ b/lib/include/srslte/interfaces/ue_interfaces.h @@ -190,69 +190,6 @@ public: virtual bool is_config_pending() = 0; }; -// RLC interface for RRC -class rlc_interface_rrc -{ -public: - virtual void reset() = 0; - virtual void reestablish() = 0; - virtual void reestablish(uint32_t lcid) = 0; - virtual void add_bearer(uint32_t lcid, const srslte::rlc_config_t& cnfg) = 0; - virtual void add_bearer_mrb(uint32_t lcid) = 0; - virtual void del_bearer(uint32_t lcid) = 0; - virtual void suspend_bearer(uint32_t lcid) = 0; - virtual void resume_bearer(uint32_t lcid) = 0; - virtual void change_lcid(uint32_t old_lcid, uint32_t new_lcid) = 0; - virtual bool has_bearer(uint32_t lcid) = 0; - virtual bool has_data(const uint32_t lcid) = 0; - virtual bool is_suspended(const uint32_t lcid) = 0; - virtual void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0; -}; - -// RLC interface for PDCP -class rlc_interface_pdcp -{ -public: - ///< PDCP calls RLC to push an RLC SDU. SDU gets placed into the buffer - ///< MAC pulls RLC PDUs according to TB size - virtual void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0; - - ///< Indicate RLC that a certain SN can be discarded - virtual void discard_sdu(uint32_t lcid, uint32_t discard_sn) = 0; - - ///< Helper to query RLC mode - virtual bool rb_is_um(uint32_t lcid) = 0; - - ///< Allow PDCP to query SDU queue status - virtual bool sdu_queue_is_full(uint32_t lcid) = 0; -}; - -// RLC interface for MAC -class rlc_interface_mac : public srslte::read_pdu_interface -{ -public: - /* MAC calls has_data() to query whether a logical channel has data to transmit (without - * knowing how much. This function should return quickly. */ - virtual bool has_data_locked(const uint32_t lcid) = 0; - - /* MAC calls RLC to get the buffer state for a logical channel. */ - virtual uint32_t get_buffer_state(const uint32_t lcid) = 0; - - const static int MAX_PDU_SEGMENTS = 20; - - /* MAC calls RLC to get RLC segment of nof_bytes length. - * Segmentation happens in this function. RLC PDU is stored in payload. */ - virtual int read_pdu(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes) = 0; - - /* MAC calls RLC to push an RLC PDU. This function is called from an independent MAC thread. - * PDU gets placed into the buffer and higher layer thread gets notified. */ - virtual void write_pdu(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes) = 0; - virtual void write_pdu_bcch_bch(srslte::unique_byte_buffer_t payload) = 0; - virtual void write_pdu_bcch_dlsch(uint8_t* payload, uint32_t nof_bytes) = 0; - virtual void write_pdu_pcch(srslte::unique_byte_buffer_t payload) = 0; - virtual void write_pdu_mch(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes) = 0; -}; - /** MAC interface * */ diff --git a/lib/include/srslte/interfaces/ue_rlc_interfaces.h b/lib/include/srslte/interfaces/ue_rlc_interfaces.h new file mode 100644 index 000000000..004120eac --- /dev/null +++ b/lib/include/srslte/interfaces/ue_rlc_interfaces.h @@ -0,0 +1,83 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2020 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 SRSLTE_UE_RLC_INTERFACES_H +#define SRSLTE_UE_RLC_INTERFACES_H + +#include "srslte/common/interfaces_common.h" +#include "srslte/interfaces/rlc_interface_types.h" + +namespace srsue { + +class rlc_interface_rrc +{ +public: + virtual void reset() = 0; + virtual void reestablish() = 0; + virtual void reestablish(uint32_t lcid) = 0; + virtual void add_bearer(uint32_t lcid, const srslte::rlc_config_t& cnfg) = 0; + virtual void add_bearer_mrb(uint32_t lcid) = 0; + virtual void del_bearer(uint32_t lcid) = 0; + virtual void suspend_bearer(uint32_t lcid) = 0; + virtual void resume_bearer(uint32_t lcid) = 0; + virtual void change_lcid(uint32_t old_lcid, uint32_t new_lcid) = 0; + virtual bool has_bearer(uint32_t lcid) = 0; + virtual bool has_data(const uint32_t lcid) = 0; + virtual bool is_suspended(const uint32_t lcid) = 0; + virtual void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0; +}; + +class rlc_interface_pdcp +{ +public: + ///< PDCP calls RLC to push an RLC SDU. SDU gets placed into the buffer + ///< MAC pulls RLC PDUs according to TB size + virtual void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0; + + ///< Indicate RLC that a certain SN can be discarded + virtual void discard_sdu(uint32_t lcid, uint32_t discard_sn) = 0; + + ///< Helper to query RLC mode + virtual bool rb_is_um(uint32_t lcid) = 0; + + ///< Allow PDCP to query SDU queue status + virtual bool sdu_queue_is_full(uint32_t lcid) = 0; +}; + +class rlc_interface_mac : public srslte::read_pdu_interface +{ +public: + /* MAC calls has_data() to query whether a logical channel has data to transmit (without + * knowing how much. This function should return quickly. */ + virtual bool has_data_locked(const uint32_t lcid) = 0; + + /* MAC calls RLC to get the buffer state for a logical channel. */ + virtual uint32_t get_buffer_state(const uint32_t lcid) = 0; + + const static int MAX_PDU_SEGMENTS = 20; + + /* MAC calls RLC to get RLC segment of nof_bytes length. + * Segmentation happens in this function. RLC PDU is stored in payload. */ + virtual int read_pdu(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes) = 0; + + /* MAC calls RLC to push an RLC PDU. This function is called from an independent MAC thread. + * PDU gets placed into the buffer and higher layer thread gets notified. */ + virtual void write_pdu(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes) = 0; + virtual void write_pdu_bcch_bch(srslte::unique_byte_buffer_t payload) = 0; + virtual void write_pdu_bcch_dlsch(uint8_t* payload, uint32_t nof_bytes) = 0; + virtual void write_pdu_pcch(srslte::unique_byte_buffer_t payload) = 0; + virtual void write_pdu_mch(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes) = 0; +}; + +} // namespace srsue + +#endif // SRSLTE_UE_RLC_INTERFACES_H diff --git a/lib/include/srslte/test/ue_test_interfaces.h b/lib/include/srslte/test/ue_test_interfaces.h index 27c7b9016..38145b903 100644 --- a/lib/include/srslte/test/ue_test_interfaces.h +++ b/lib/include/srslte/test/ue_test_interfaces.h @@ -15,6 +15,7 @@ #include "srslte/common/task_scheduler.h" #include "srslte/interfaces/ue_interfaces.h" +#include "srslte/interfaces/ue_rlc_interfaces.h" namespace srsue { diff --git a/lib/include/srslte/upper/pdcp_entity_lte.h b/lib/include/srslte/upper/pdcp_entity_lte.h index 786323d43..145f18d5d 100644 --- a/lib/include/srslte/upper/pdcp_entity_lte.h +++ b/lib/include/srslte/upper/pdcp_entity_lte.h @@ -24,8 +24,9 @@ namespace srsue { class gw_interface_pdcp; +class rlc_interface_pdcp; -} +} // namespace srsue namespace srslte { diff --git a/lib/include/srslte/upper/pdcp_entity_nr.h b/lib/include/srslte/upper/pdcp_entity_nr.h index a89a94a61..12baf2903 100644 --- a/lib/include/srslte/upper/pdcp_entity_nr.h +++ b/lib/include/srslte/upper/pdcp_entity_nr.h @@ -23,6 +23,7 @@ #include "srslte/common/threads.h" #include "srslte/interfaces/ue_gw_interfaces.h" #include "srslte/interfaces/ue_interfaces.h" +#include "srslte/interfaces/ue_rlc_interfaces.h" #include namespace srslte { diff --git a/lib/include/srslte/upper/rlc.h b/lib/include/srslte/upper/rlc.h index 8de3fab2a..a962768ec 100644 --- a/lib/include/srslte/upper/rlc.h +++ b/lib/include/srslte/upper/rlc.h @@ -18,6 +18,7 @@ #include "srslte/common/log.h" #include "srslte/interfaces/ue_interfaces.h" #include "srslte/interfaces/ue_pdcp_interfaces.h" +#include "srslte/interfaces/ue_rlc_interfaces.h" #include "srslte/upper/rlc_common.h" #include "srslte/upper/rlc_metrics.h" diff --git a/lib/src/upper/pdcp_entity_lte.cc b/lib/src/upper/pdcp_entity_lte.cc index 85e01abad..f03a7c82a 100644 --- a/lib/src/upper/pdcp_entity_lte.cc +++ b/lib/src/upper/pdcp_entity_lte.cc @@ -14,6 +14,7 @@ #include "srslte/common/int_helpers.h" #include "srslte/common/security.h" #include "srslte/interfaces/ue_gw_interfaces.h" +#include "srslte/interfaces/ue_rlc_interfaces.h" #include namespace srslte { diff --git a/lib/test/upper/pdcp_base_test.h b/lib/test/upper/pdcp_base_test.h index fd8975ca8..63256179e 100644 --- a/lib/test/upper/pdcp_base_test.h +++ b/lib/test/upper/pdcp_base_test.h @@ -20,6 +20,7 @@ #include "srslte/interfaces/pdcp_interface_types.h" #include "srslte/interfaces/ue_gw_interfaces.h" #include "srslte/interfaces/ue_interfaces.h" +#include "srslte/interfaces/ue_rlc_interfaces.h" #include int compare_two_packets(const srslte::unique_byte_buffer_t& msg1, const srslte::unique_byte_buffer_t& msg2) diff --git a/srsenb/hdr/stack/upper/pdcp.h b/srsenb/hdr/stack/upper/pdcp.h index 17aead6f1..14d9469e5 100644 --- a/srsenb/hdr/stack/upper/pdcp.h +++ b/srsenb/hdr/stack/upper/pdcp.h @@ -14,6 +14,7 @@ #include "srslte/interfaces/enb_metrics_interface.h" #include "srslte/interfaces/enb_pdcp_interfaces.h" #include "srslte/interfaces/ue_gw_interfaces.h" +#include "srslte/interfaces/ue_rlc_interfaces.h" #include "srslte/srslog/srslog.h" #include "srslte/upper/pdcp.h" #include diff --git a/srsenb/hdr/stack/upper/pdcp_nr.h b/srsenb/hdr/stack/upper/pdcp_nr.h index eb989a1bf..de50f797e 100644 --- a/srsenb/hdr/stack/upper/pdcp_nr.h +++ b/srsenb/hdr/stack/upper/pdcp_nr.h @@ -15,6 +15,7 @@ #include "srslte/common/logger.h" #include "srslte/interfaces/gnb_interfaces.h" #include "srslte/interfaces/ue_gw_interfaces.h" +#include "srslte/interfaces/ue_rlc_interfaces.h" #include "srslte/upper/pdcp.h" #include diff --git a/srsue/hdr/stack/mac/demux.h b/srsue/hdr/stack/mac/demux.h index d7dd8bc6f..1143aca23 100644 --- a/srsue/hdr/stack/mac/demux.h +++ b/srsue/hdr/stack/mac/demux.h @@ -16,6 +16,7 @@ #include "srslte/common/log.h" #include "srslte/common/timers.h" #include "srslte/interfaces/ue_interfaces.h" +#include "srslte/interfaces/ue_rlc_interfaces.h" #include "srslte/mac/pdu.h" #include "srslte/mac/pdu_queue.h" #include "srslte/srslog/srslog.h" @@ -24,6 +25,8 @@ namespace srsue { +class rlc_interface_mac; + class mac_interface_demux { public: diff --git a/srsue/hdr/stack/mac/proc_bsr.h b/srsue/hdr/stack/mac/proc_bsr.h index ad6fb0dac..f469f529c 100644 --- a/srsue/hdr/stack/mac/proc_bsr.h +++ b/srsue/hdr/stack/mac/proc_bsr.h @@ -26,6 +26,8 @@ namespace srsue { +class rlc_interface_mac; + // BSR interface for MUX class bsr_interface_mux { diff --git a/srsue/hdr/stack/mac_nr/mac_nr.h b/srsue/hdr/stack/mac_nr/mac_nr.h index bec52700d..dc827c1fc 100644 --- a/srsue/hdr/stack/mac_nr/mac_nr.h +++ b/srsue/hdr/stack/mac_nr/mac_nr.h @@ -19,6 +19,7 @@ #include "srslte/common/mac_pcap.h" #include "srslte/interfaces/mac_interface_types.h" #include "srslte/interfaces/ue_nr_interfaces.h" +#include "srslte/interfaces/ue_rlc_interfaces.h" #include "srslte/mac/mac_sch_pdu_nr.h" #include "srslte/srslog/srslog.h" #include "srsue/hdr/stack/mac_nr/mux_nr.h" @@ -26,6 +27,8 @@ namespace srsue { +class rlc_interface_mac; + struct mac_nr_args_t { srsue::pcap_args_t pcap; }; @@ -73,7 +76,7 @@ public: /// procedure ra nr interface uint64_t get_contention_id(); uint16_t get_c_rnti(); - void set_c_rnti(uint64_t c_rnti_); + void set_c_rnti(uint64_t c_rnti_); void msg3_flush() { mux.msg3_flush(); } bool msg3_is_transmitted() { return mux.msg3_is_transmitted(); } @@ -132,8 +135,8 @@ private: /// Tx buffer srslte::mac_sch_pdu_nr tx_pdu; - srslte::unique_byte_buffer_t tx_buffer = nullptr; - srslte::unique_byte_buffer_t rlc_buffer = nullptr; + srslte::unique_byte_buffer_t tx_buffer = nullptr; + srslte::unique_byte_buffer_t rlc_buffer = nullptr; srslte_softbuffer_tx_t softbuffer_tx = {}; /// UL HARQ (temporal) srslte::task_multiqueue::queue_handle stack_task_dispatch_queue; diff --git a/srsue/hdr/stack/rrc/rrc.h b/srsue/hdr/stack/rrc/rrc.h index fb60593ad..69e253941 100644 --- a/srsue/hdr/stack/rrc/rrc.h +++ b/srsue/hdr/stack/rrc/rrc.h @@ -61,6 +61,7 @@ class phy_controller; class usim_interface_rrc; class gw_interface_rrc; class pdcp_interface_rrc; +class rlc_interface_rrc; class rrc : public rrc_interface_nas, public rrc_interface_phy_lte, diff --git a/srsue/hdr/stack/rrc/rrc_nr.h b/srsue/hdr/stack/rrc/rrc_nr.h index 100fdd3d3..2346ad445 100644 --- a/srsue/hdr/stack/rrc/rrc_nr.h +++ b/srsue/hdr/stack/rrc/rrc_nr.h @@ -26,6 +26,7 @@ namespace srsue { class usim_interface_rrc_nr; class pdcp_interface_rrc; +class rlc_interface_rrc; // Expert arguments to create GW without proper RRC struct core_less_args_t { diff --git a/srsue/src/stack/mac/proc_bsr.cc b/srsue/src/stack/mac/proc_bsr.cc index 6e4497873..6b265bbe0 100644 --- a/srsue/src/stack/mac/proc_bsr.cc +++ b/srsue/src/stack/mac/proc_bsr.cc @@ -11,6 +11,7 @@ */ #include "srsue/hdr/stack/mac/proc_bsr.h" +#include "srslte/interfaces/ue_rlc_interfaces.h" #include "srsue/hdr/stack/mac/mux.h" namespace srsue { diff --git a/srsue/src/stack/rrc/rrc.cc b/srsue/src/stack/rrc/rrc.cc index 4f03978d5..b1d219035 100644 --- a/srsue/src/stack/rrc/rrc.cc +++ b/srsue/src/stack/rrc/rrc.cc @@ -16,6 +16,7 @@ #include "srslte/common/security.h" #include "srslte/interfaces/ue_gw_interfaces.h" #include "srslte/interfaces/ue_pdcp_interfaces.h" +#include "srslte/interfaces/ue_rlc_interfaces.h" #include "srslte/interfaces/ue_usim_interfaces.h" #include "srsue/hdr/stack/rrc/phy_controller.h" #include "srsue/hdr/stack/rrc/rrc_meas.h" diff --git a/srsue/src/stack/rrc/rrc_nr.cc b/srsue/src/stack/rrc/rrc_nr.cc index 53a6aae8a..ae11021e8 100644 --- a/srsue/src/stack/rrc/rrc_nr.cc +++ b/srsue/src/stack/rrc/rrc_nr.cc @@ -13,6 +13,7 @@ #include "srsue/hdr/stack/rrc/rrc_nr.h" #include "srslte/common/security.h" #include "srslte/interfaces/ue_pdcp_interfaces.h" +#include "srslte/interfaces/ue_rlc_interfaces.h" #include "srsue/hdr/stack/upper/usim.h" #define Error(fmt, ...) rrc_ptr->log_h->error("Proc \"%s\" - " fmt, name(), ##__VA_ARGS__) diff --git a/srsue/src/stack/rrc/rrc_procedures.cc b/srsue/src/stack/rrc/rrc_procedures.cc index 645714299..853beadf9 100644 --- a/srsue/src/stack/rrc/rrc_procedures.cc +++ b/srsue/src/stack/rrc/rrc_procedures.cc @@ -15,6 +15,7 @@ #include "srslte/common/standard_streams.h" #include "srslte/common/tti_point.h" #include "srslte/interfaces/ue_pdcp_interfaces.h" +#include "srslte/interfaces/ue_rlc_interfaces.h" #include "srslte/interfaces/ue_usim_interfaces.h" #include "srsue/hdr/stack/rrc/rrc_meas.h" #include // for printing uint64_t