summaryrefslogtreecommitdiff
path: root/srsue/hdr/stack/mac_nr
diff options
context:
space:
mode:
Diffstat (limited to 'srsue/hdr/stack/mac_nr')
-rw-r--r--srsue/hdr/stack/mac_nr/demux_nr.h25
-rw-r--r--srsue/hdr/stack/mac_nr/mac_nr.h7
-rw-r--r--srsue/hdr/stack/mac_nr/mac_nr_interfaces.h15
-rw-r--r--srsue/hdr/stack/mac_nr/mux_nr.h2
-rw-r--r--srsue/hdr/stack/mac_nr/proc_ra_nr.h10
5 files changed, 35 insertions, 24 deletions
diff --git a/srsue/hdr/stack/mac_nr/demux_nr.h b/srsue/hdr/stack/mac_nr/demux_nr.h
index 5a579902d..d45e4675d 100644
--- a/srsue/hdr/stack/mac_nr/demux_nr.h
+++ b/srsue/hdr/stack/mac_nr/demux_nr.h
@@ -29,6 +29,12 @@
namespace srsue {
+class mac_nr_interface_demux
+{
+public:
+ virtual bool received_contention_id(uint64_t id) = 0;
+};
+
/**
* @brief Logical Channel Demultiplexing and MAC CE dissassemble according to TS 38.321
*
@@ -45,25 +51,26 @@ public:
demux_nr(srslog::basic_logger& logger_);
~demux_nr();
- int32_t init(rlc_interface_mac* rlc_, phy_interface_mac_nr* phy_);
+ int32_t init(rlc_interface_mac* rlc_, phy_interface_mac_nr* phy_, mac_nr_interface_demux* mac_);
void process_pdus(); /// Called by MAC to process received PDUs
// HARQ interface
- void push_bcch(srsran::unique_byte_buffer_t pdu);
- void push_pdu(srsran::unique_byte_buffer_t pdu, uint32_t tti);
- void push_pdu_temp_crnti(srsran::unique_byte_buffer_t pdu, uint32_t tti);
- uint64_t get_received_crueid();
+ void push_bcch(srsran::unique_byte_buffer_t pdu);
+ void push_pdu(srsran::unique_byte_buffer_t pdu, uint32_t tti);
+ void push_pdu_temp_crnti(srsran::unique_byte_buffer_t pdu, uint32_t tti);
+ bool get_uecrid_successful();
private:
// internal helpers
void handle_pdu(srsran::mac_sch_pdu_nr& pdu_buffer, srsran::unique_byte_buffer_t pdu);
- srslog::basic_logger& logger;
- rlc_interface_mac* rlc = nullptr;
- phy_interface_mac_nr* phy = nullptr;
+ srslog::basic_logger& logger;
+ rlc_interface_mac* rlc = nullptr;
+ phy_interface_mac_nr* phy = nullptr;
+ mac_nr_interface_demux* mac = nullptr;
- uint64_t received_crueid = 0;
+ bool is_uecrid_successful = false;
///< currently only DCH & BCH PDUs supported (add PCH, etc)
srsran::block_queue<srsran::unique_byte_buffer_t> pdu_queue;
diff --git a/srsue/hdr/stack/mac_nr/mac_nr.h b/srsue/hdr/stack/mac_nr/mac_nr.h
index 27577eaa1..5223bd0d8 100644
--- a/srsue/hdr/stack/mac_nr/mac_nr.h
+++ b/srsue/hdr/stack/mac_nr/mac_nr.h
@@ -48,7 +48,8 @@ class mac_nr final : public mac_interface_phy_nr,
public mac_interface_proc_ra_nr,
public mac_interface_sr_nr,
public mac_interface_mux_nr,
- public mac_interface_harq_nr
+ public mac_interface_harq_nr,
+ public mac_nr_interface_demux
{
public:
mac_nr(srsran::ext_task_sched_handle task_sched_);
@@ -97,7 +98,6 @@ public:
void start_ra_procedure();
/// Interface for internal procedures (RA, MUX, HARQ)
- bool received_contention_id(uint64_t rx_contention_id);
uint16_t get_crnti();
uint16_t get_temp_crnti();
uint16_t get_csrnti() { return SRSRAN_INVALID_RNTI; }; // SPS not supported
@@ -111,6 +111,9 @@ public:
srsran::mac_sch_subpdu_nr::lcg_bsr_t generate_sbsr();
void set_padding_bytes(uint32_t nof_bytes);
+ /// Interface for DEMUX
+ bool received_contention_id(uint64_t rx_contention_id);
+
void msg3_flush() { mux.msg3_flush(); }
bool msg3_is_transmitted() { return mux.msg3_is_transmitted(); }
void msg3_prepare() { mux.msg3_prepare(); }
diff --git a/srsue/hdr/stack/mac_nr/mac_nr_interfaces.h b/srsue/hdr/stack/mac_nr/mac_nr_interfaces.h
index d9f20d9af..a7d8da8c4 100644
--- a/srsue/hdr/stack/mac_nr/mac_nr_interfaces.h
+++ b/srsue/hdr/stack/mac_nr/mac_nr_interfaces.h
@@ -33,8 +33,8 @@ class mac_interface_proc_ra_nr
{
public:
// Functions for identity handling, e.g., contention id and c-rnti
- virtual uint16_t get_crnti() = 0;
- virtual bool set_crnti(uint16_t c_rnti) = 0;
+ virtual uint16_t get_crnti() = 0;
+ virtual bool set_crnti(uint16_t c_rnti) = 0;
virtual void set_temp_crnti(uint16_t c_rnti) = 0;
virtual void set_crnti_to_temp() = 0;
@@ -90,9 +90,6 @@ public:
// MAC also provides Temp C-RNTI (through RA proc)
virtual uint16_t get_temp_crnti() = 0;
- // HARQ can query MAC for current C-RNTI
- virtual bool received_contention_id(uint64_t rx_contention_id) = 0;
-
// MAC provides the Currently Scheduled RNTI (for SPS)
virtual uint16_t get_csrnti() = 0;
};
@@ -104,10 +101,10 @@ class demux_interface_harq_nr
{
public:
/// Inform demux unit about a newly decoded TB.
- virtual void push_bcch(srsran::unique_byte_buffer_t pdu) = 0;
- virtual void push_pdu(srsran::unique_byte_buffer_t pdu, uint32_t tti) = 0;
- virtual void push_pdu_temp_crnti(srsran::unique_byte_buffer_t pdu, uint32_t tti) = 0;
- virtual uint64_t get_received_crueid() = 0;
+ virtual void push_bcch(srsran::unique_byte_buffer_t pdu) = 0;
+ virtual void push_pdu(srsran::unique_byte_buffer_t pdu, uint32_t tti) = 0;
+ virtual void push_pdu_temp_crnti(srsran::unique_byte_buffer_t pdu, uint32_t tti) = 0;
+ virtual bool get_uecrid_successful() = 0;
};
} // namespace srsue
diff --git a/srsue/hdr/stack/mac_nr/mux_nr.h b/srsue/hdr/stack/mac_nr/mux_nr.h
index 0e99bc4bf..bc034dc42 100644
--- a/srsue/hdr/stack/mac_nr/mux_nr.h
+++ b/srsue/hdr/stack/mac_nr/mux_nr.h
@@ -48,6 +48,7 @@ public:
bool msg3_is_transmitted();
bool msg3_is_pending();
bool msg3_is_empty();
+ srsran::unique_byte_buffer_t get_msg3(uint32_t max_pdu_len);
// MAC interface
int setup_lcid(const srsran::logical_channel_config_t& config);
@@ -60,6 +61,7 @@ public:
private:
// internal helper methods
+ srsran::unique_byte_buffer_t pdu_get_nolock(uint32_t max_pdu_len);
// ctor configured members
mac_interface_mux_nr& mac;
diff --git a/srsue/hdr/stack/mac_nr/proc_ra_nr.h b/srsue/hdr/stack/mac_nr/proc_ra_nr.h
index 252fba994..37338df42 100644
--- a/srsue/hdr/stack/mac_nr/proc_ra_nr.h
+++ b/srsue/hdr/stack/mac_nr/proc_ra_nr.h
@@ -38,7 +38,7 @@ class proc_ra_nr
{
public:
proc_ra_nr(mac_interface_proc_ra_nr& mac_, srslog::basic_logger& logger_);
- ~proc_ra_nr(){};
+ ~proc_ra_nr() { srsran_random_free(random_gen); };
void init(phy_interface_mac_nr* phy_h_, srsran::ext_task_sched_handle* task_sched_);
void set_config(const srsran::rach_cfg_nr_t& rach_cfg_nr);
@@ -66,8 +66,10 @@ private:
16 * 10; ///< Limited from frame system number opportunity period in TS 38.211 tables 6.3.3.2-2, 6.3.3.2-3
///< and 6.3.3.2-4
- mac_interface_proc_ra_nr& mac;
- srslog::basic_logger& logger;
+ mac_interface_proc_ra_nr& mac;
+ srslog::basic_logger& logger;
+ srsran_random_t random_gen;
+
phy_interface_mac_nr* phy = nullptr;
srsran::ext_task_sched_handle* task_sched = nullptr;
srsran::task_multiqueue::queue_handle task_queue;
@@ -120,7 +122,7 @@ private:
void ra_resource_selection();
void ra_preamble_transmission();
void ra_response_reception(const mac_interface_phy_nr::tb_action_dl_result_t& tb);
- void ra_contention_resolution(bool received_con_res_matches_ue_id);
+ void ra_contention_resolution(bool is_successful, bool is_ul_grant);
void ra_completion();
void ra_error();
};