diff --git a/lib/include/srsran/asn1/rrc_nr_utils.h b/lib/include/srsran/asn1/rrc_nr_utils.h index 025b68ce1..60657b918 100644 --- a/lib/include/srsran/asn1/rrc_nr_utils.h +++ b/lib/include/srsran/asn1/rrc_nr_utils.h @@ -50,6 +50,7 @@ struct beta_offsets_s; struct uci_on_pusch_s; struct zp_csi_rs_res_s; struct nzp_csi_rs_res_s; +struct pdsch_serving_cell_cfg_s; } // namespace rrc_nr } // namespace asn1 @@ -98,6 +99,8 @@ bool make_phy_nzp_csi_rs_resource(const asn1::rrc_nr::nzp_csi_rs_res_s & nzp_csi logical_channel_config_t make_mac_logical_channel_cfg_t(uint8_t lcid, const asn1::rrc_nr::lc_ch_cfg_s& asn1_type); rach_nr_cfg_t make_mac_rach_cfg(const asn1::rrc_nr::rach_cfg_common_s& asn1_type); bool make_mac_phr_cfg_t(const asn1::rrc_nr::phr_cfg_s& asn1_type, phr_cfg_nr_t* phr_cfg_nr); +bool make_mac_dl_harq_cfg_nr_t(const asn1::rrc_nr::pdsch_serving_cell_cfg_s& asn1_type, + dl_harq_cfg_nr_t* out_dl_harq_cfg_nr); /*************************** * RLC Config **************************/ diff --git a/lib/include/srsran/interfaces/ue_nr_interfaces.h b/lib/include/srsran/interfaces/ue_nr_interfaces.h index 5e003d33a..c355440cc 100644 --- a/lib/include/srsran/interfaces/ue_nr_interfaces.h +++ b/lib/include/srsran/interfaces/ue_nr_interfaces.h @@ -149,6 +149,7 @@ public: virtual int setup_lcid(const srsran::logical_channel_config_t& config) = 0; virtual int set_config(const srsran::bsr_cfg_nr_t& bsr_cfg) = 0; virtual int set_config(const srsran::sr_cfg_nr_t& sr_cfg) = 0; + virtual int set_config(const srsran::dl_harq_cfg_nr_t& dl_hrq_cfg) = 0; virtual void set_config(const srsran::rach_nr_cfg_t& rach_cfg) = 0; virtual int add_tag_config(const srsran::tag_cfg_nr_t& tag_cfg) = 0; virtual int set_config(const srsran::phr_cfg_nr_t& phr_cfg) = 0; diff --git a/lib/src/asn1/rrc_nr_utils.cc b/lib/src/asn1/rrc_nr_utils.cc index 21d6a3d9f..0692cffcd 100644 --- a/lib/src/asn1/rrc_nr_utils.cc +++ b/lib/src/asn1/rrc_nr_utils.cc @@ -66,6 +66,19 @@ logical_channel_config_t make_mac_logical_channel_cfg_t(uint8_t lcid, const lc_c return logical_channel_config; } +bool make_mac_dl_harq_cfg_nr_t(const pdsch_serving_cell_cfg_s& asn1_type, dl_harq_cfg_nr_t* out_dl_harq_cfg_nr) +{ + dl_harq_cfg_nr_t dl_harq_cfg_nr; + if (asn1_type.nrof_harq_processes_for_pdsch_present) { + dl_harq_cfg_nr.nof_procs = asn1_type.nrof_harq_processes_for_pdsch; + } else { + asn1::log_warning("Option nrof_harq_processes_for_pdsch not present"); + return false; + } + *out_dl_harq_cfg_nr = dl_harq_cfg_nr; + return true; +} + bool make_mac_phr_cfg_t(const phr_cfg_s& asn1_type, phr_cfg_nr_t* phr_cfg_nr) { phr_cfg_nr->extended = asn1_type.ext; diff --git a/srsue/hdr/stack/mac_nr/mac_nr.h b/srsue/hdr/stack/mac_nr/mac_nr.h index c6dc63d13..883011dc3 100644 --- a/srsue/hdr/stack/mac_nr/mac_nr.h +++ b/srsue/hdr/stack/mac_nr/mac_nr.h @@ -79,6 +79,7 @@ public: int set_config(const srsran::bsr_cfg_nr_t& bsr_cfg); int set_config(const srsran::sr_cfg_nr_t& sr_cfg); void set_config(const srsran::rach_nr_cfg_t& rach_cfg); + int set_config(const srsran::dl_harq_cfg_nr_t& dl_hrq_cfg); void set_contention_id(const uint64_t ue_identity); bool set_crnti(const uint16_t crnti); int add_tag_config(const srsran::tag_cfg_nr_t& tag_cfg); diff --git a/srsue/src/stack/mac_nr/mac_nr.cc b/srsue/src/stack/mac_nr/mac_nr.cc index 0c4f10778..b360ee679 100644 --- a/srsue/src/stack/mac_nr/mac_nr.cc +++ b/srsue/src/stack/mac_nr/mac_nr.cc @@ -75,14 +75,6 @@ int mac_nr::init(const mac_nr_args_t& args_, return SRSRAN_ERROR; } - // Set default config until RRC - dl_harq_cfg_nr_t harq_cfg = {}; - harq_cfg.reset(); - if (dl_harq.at(PCELL_CC_IDX)->set_config(harq_cfg) != SRSRAN_SUCCESS) { - logger.error("Couldn't configure DL HARQ entity."); - return SRSRAN_ERROR; - } - started = true; return SRSRAN_SUCCESS; @@ -412,6 +404,19 @@ int mac_nr::set_config(const srsran::phr_cfg_nr_t& phr_cfg) return SRSRAN_SUCCESS; } +int mac_nr::set_config(const srsran::dl_harq_cfg_nr_t& dl_hrq_cfg) +{ + for (const auto& cc : dl_harq) { + if (cc != nullptr) { + if (cc->set_config(dl_hrq_cfg) != SRSRAN_SUCCESS) { + logger.error("Couldn't configure DL HARQ entity."); + return SRSRAN_ERROR; + } + } + } + return SRSRAN_SUCCESS; +} + int mac_nr::set_config(const srsran::bsr_cfg_nr_t& bsr_cfg) { return proc_bsr.set_config(bsr_cfg); diff --git a/srsue/src/stack/rrc/rrc_nr.cc b/srsue/src/stack/rrc/rrc_nr.cc index 5aae159ae..18dbecf05 100644 --- a/srsue/src/stack/rrc/rrc_nr.cc +++ b/srsue/src/stack/rrc/rrc_nr.cc @@ -1140,6 +1140,23 @@ bool rrc_nr::apply_sp_cell_cfg(const sp_cell_cfg_s& sp_cell_cfg) logger.warning("Option ul_cfg not present"); return false; } + + if (sp_cell_cfg.sp_cell_cfg_ded.pdsch_serving_cell_cfg_present) { + if (sp_cell_cfg.sp_cell_cfg_ded.pdsch_serving_cell_cfg.type() == + setup_release_c::types_opts::setup) { + dl_harq_cfg_nr_t dl_harq_cfg_nr; + if (make_mac_dl_harq_cfg_nr_t(sp_cell_cfg.sp_cell_cfg_ded.pdsch_serving_cell_cfg.setup(), &dl_harq_cfg_nr) == + false) { + logger.warning("Failed to make dl_harq_cfg_nr config"); + return false; + } + mac->set_config(dl_harq_cfg_nr); + } + } else { + logger.warning("Option pdsch_serving_cell_cfg not present"); + return false; + } + if (sp_cell_cfg.sp_cell_cfg_ded.csi_meas_cfg_present) { if (sp_cell_cfg.sp_cell_cfg_ded.csi_meas_cfg.type() == setup_release_c::types_opts::setup) { if (apply_csi_meas_cfg(sp_cell_cfg.sp_cell_cfg_ded.csi_meas_cfg.setup()) == false) {