diff --git a/srsue/hdr/stack/mac/dl_harq.h b/srsue/hdr/stack/mac/dl_harq.h index df770c531..30ed84c8f 100644 --- a/srsue/hdr/stack/mac/dl_harq.h +++ b/srsue/hdr/stack/mac/dl_harq.h @@ -37,7 +37,7 @@ namespace srsue { class dl_harq_entity { public: - dl_harq_entity(); + dl_harq_entity(uint8_t cc_idx_); bool init(srslte::log* log_h, mac_interface_rrc::ue_rnti_t* rntis, @@ -120,15 +120,16 @@ private: std::vector proc; dl_harq_process bcch_proc; - demux* demux_unit; - srslte::log* log_h; - srslte::mac_pcap* pcap; - mac_interface_rrc::ue_rnti_t* rntis; - uint16_t last_temporal_crnti; - int si_window_start; - - float average_retx; - uint64_t nof_pkts; + demux* demux_unit = nullptr; + srslte::log* log_h = nullptr; + srslte::mac_pcap* pcap = nullptr; + mac_interface_rrc::ue_rnti_t* rntis = nullptr; + uint16_t last_temporal_crnti = 0; + int si_window_start = 0; + + float average_retx = 0.0; + uint64_t nof_pkts = 0; + uint8_t cc_idx = 0; }; typedef std::unique_ptr dl_harq_entity_ptr; diff --git a/srsue/hdr/stack/mac/mac.h b/srsue/hdr/stack/mac/mac.h index 5cbc0af29..74b987252 100644 --- a/srsue/hdr/stack/mac/mac.h +++ b/srsue/hdr/stack/mac/mac.h @@ -178,6 +178,8 @@ private: mac_metrics_t metrics[SRSLTE_MAX_CARRIERS] = {}; bool initialized = false; + + const uint8_t PCELL_CC_IDX = 0; }; } // namespace srsue diff --git a/srsue/hdr/stack/mac/ul_harq.h b/srsue/hdr/stack/mac/ul_harq.h index 1614bd46a..449f5ee4e 100644 --- a/srsue/hdr/stack/mac/ul_harq.h +++ b/srsue/hdr/stack/mac/ul_harq.h @@ -43,7 +43,7 @@ namespace srsue { class ul_harq_entity { public: - ul_harq_entity(); + ul_harq_entity(const uint8_t cc_idx_); bool init(srslte::log* log_h_, mac_interface_rrc_common::ue_rnti_t* rntis_, ra_proc* ra_proc_h_, mux* mux_unit_); @@ -108,16 +108,18 @@ private: std::vector proc; - mux* mux_unit; - srslte::mac_pcap* pcap; - srslte::log* log_h; + mux* mux_unit = nullptr; + srslte::mac_pcap* pcap = nullptr; + srslte::log* log_h = nullptr; - mac_interface_rrc_common::ue_rnti_t* rntis; - srslte::ul_harq_cfg_t harq_cfg; + mac_interface_rrc_common::ue_rnti_t* rntis = nullptr; + srslte::ul_harq_cfg_t harq_cfg = {}; - float average_retx; - uint64_t nof_pkts; - ra_proc* ra_procedure; + float average_retx = 0.0; + uint64_t nof_pkts = 0; + ra_proc* ra_procedure = nullptr; + + uint8_t cc_idx = 0; }; typedef std::unique_ptr ul_harq_entity_ptr; diff --git a/srsue/src/stack/mac/dl_harq.cc b/srsue/src/stack/mac/dl_harq.cc index ffc30f1e3..ba9cc8143 100644 --- a/srsue/src/stack/mac/dl_harq.cc +++ b/srsue/src/stack/mac/dl_harq.cc @@ -32,16 +32,7 @@ namespace srsue { -dl_harq_entity::dl_harq_entity() : proc(SRSLTE_MAX_HARQ_PROC) -{ - pcap = nullptr; - demux_unit = nullptr; - log_h = nullptr; - si_window_start = 0; - last_temporal_crnti = 0; - average_retx = 0; - nof_pkts = 0; -} +dl_harq_entity::dl_harq_entity(uint8_t cc_idx_) : proc(SRSLTE_MAX_HARQ_PROC), cc_idx(cc_idx_) {} bool dl_harq_entity::init(srslte::log* log_h_, mac_interface_rrc::ue_rnti_t* rntis_, demux* demux_unit_) { diff --git a/srsue/src/stack/mac/mac.cc b/srsue/src/stack/mac/mac.cc index 52af4de28..0091784be 100644 --- a/srsue/src/stack/mac/mac.cc +++ b/srsue/src/stack/mac/mac.cc @@ -40,8 +40,8 @@ namespace srsue { mac::mac(srslte::log* log_) : mch_msg(10, log_), mux_unit(log_), demux_unit(log_), pcap(nullptr), log_h(log_) { // Create PCell HARQ entities - auto ul = ul_harq_entity_ptr(new ul_harq_entity()); - auto dl = dl_harq_entity_ptr(new dl_harq_entity()); + auto ul = ul_harq_entity_ptr(new ul_harq_entity(PCELL_CC_IDX)); + auto dl = dl_harq_entity_ptr(new dl_harq_entity(PCELL_CC_IDX)); ul_harq.clear(); dl_harq.clear(); @@ -130,13 +130,13 @@ void mac::reconfiguration(const uint32_t& cc_idx, const bool& enable) if (cc_idx < SRSLTE_MAX_CARRIERS) { // Create as many HARQ entities as carriers required while (ul_harq.size() < cc_idx + 1) { - auto ul = ul_harq_entity_ptr(new ul_harq_entity()); + auto ul = ul_harq_entity_ptr(new ul_harq_entity(cc_idx)); ul->init(log_h, &uernti, &ra_procedure, &mux_unit); ul->set_config(ul_harq_cfg); ul_harq.push_back(std::move(ul)); } while (dl_harq.size() < cc_idx + 1) { - auto dl = dl_harq_entity_ptr(new dl_harq_entity()); + auto dl = dl_harq_entity_ptr(new dl_harq_entity(cc_idx)); dl->init(log_h, &uernti, &demux_unit); if (pcap) { diff --git a/srsue/src/stack/mac/ul_harq.cc b/srsue/src/stack/mac/ul_harq.cc index 698355ea3..9272377c2 100644 --- a/srsue/src/stack/mac/ul_harq.cc +++ b/srsue/src/stack/mac/ul_harq.cc @@ -33,16 +33,7 @@ namespace srsue { -ul_harq_entity::ul_harq_entity() : proc(SRSLTE_MAX_HARQ_PROC) -{ - pcap = NULL; - mux_unit = NULL; - ra_procedure = NULL; - log_h = NULL; - rntis = NULL; - average_retx = 0; - nof_pkts = 0; -} +ul_harq_entity::ul_harq_entity(const uint8_t cc_idx_) : proc(SRSLTE_MAX_HARQ_PROC), cc_idx(cc_idx_) {} bool ul_harq_entity::init(srslte::log* log_h_, mac_interface_rrc_common::ue_rnti_t* rntis_,