From bdc19643357b75f38ce5cdcd6927c2b456e7bb3d Mon Sep 17 00:00:00 2001 From: yagoda Date: Tue, 17 Nov 2020 09:16:25 +0100 Subject: [PATCH] consolidating RRC eMBMS configuration into single function, setting some parameters to const --- .../srslte/interfaces/enb_interfaces.h | 10 +- srsenb/hdr/stack/mac/mac.h | 10 +- srsenb/hdr/stack/rrc/rrc.h | 2 +- srsenb/src/stack/mac/mac.cc | 10 +- srsenb/src/stack/rrc/rrc.cc | 105 +++++++++--------- srsenb/test/common/dummy_classes.h | 10 +- 6 files changed, 75 insertions(+), 72 deletions(-) diff --git a/lib/include/srslte/interfaces/enb_interfaces.h b/lib/include/srslte/interfaces/enb_interfaces.h index f4b7d06a8..601c9a12d 100644 --- a/lib/include/srslte/interfaces/enb_interfaces.h +++ b/lib/include/srslte/interfaces/enb_interfaces.h @@ -284,11 +284,11 @@ public: virtual int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg) = 0; virtual int bearer_ue_rem(uint16_t rnti, uint32_t lc_id) = 0; virtual void phy_config_enabled(uint16_t rnti, bool enabled) = 0; - virtual void write_mcch(srslte::sib2_mbms_t* sib2_, - srslte::sib13_t* sib13_, - srslte::mcch_msg_t* mcch_, - uint8_t* mcch_payload, - uint8_t mcch_payload_length) = 0; + virtual void write_mcch(const srslte::sib2_mbms_t* sib2_, + const srslte::sib13_t* sib13_, + const srslte::mcch_msg_t* mcch_, + const uint8_t* mcch_payload, + const uint8_t mcch_payload_length) = 0; /** * Allocate a C-RNTI for a new user, without adding it to the phy layer and scheduler yet diff --git a/srsenb/hdr/stack/mac/mac.h b/srsenb/hdr/stack/mac/mac.h index 68638d209..81712c57e 100644 --- a/srsenb/hdr/stack/mac/mac.h +++ b/srsenb/hdr/stack/mac/mac.h @@ -99,11 +99,11 @@ public: bool process_pdus(); void get_metrics(mac_metrics_t metrics[ENB_METRICS_MAX_USERS]); - void write_mcch(srslte::sib2_mbms_t* sib2_, - srslte::sib13_t* sib13_, - srslte::mcch_msg_t* mcch_, - uint8_t* mcch_payload, - uint8_t mcch_payload_length) override; + void write_mcch(const srslte::sib2_mbms_t* sib2_, + const srslte::sib13_t* sib13_, + const srslte::mcch_msg_t* mcch_, + const uint8_t* mcch_payload, + const uint8_t mcch_payload_length) override; private: static const uint32_t cfi = 3; diff --git a/srsenb/hdr/stack/rrc/rrc.h b/srsenb/hdr/stack/rrc/rrc.h index 180b68a64..4baa63c01 100644 --- a/srsenb/hdr/stack/rrc/rrc.h +++ b/srsenb/hdr/stack/rrc/rrc.h @@ -152,7 +152,7 @@ private: void process_release_complete(uint16_t rnti); void rem_user(uint16_t rnti); uint32_t generate_sibs(); - void configure_mbsfn_sibs(srslte::sib2_mbms_t* sib2_, srslte::sib13_t* sib13_); + void configure_mbsfn_sibs(); int pack_mcch(); void config_mac(); diff --git a/srsenb/src/stack/mac/mac.cc b/srsenb/src/stack/mac/mac.cc index 90b764815..d1345ac51 100644 --- a/srsenb/src/stack/mac/mac.cc +++ b/srsenb/src/stack/mac/mac.cc @@ -924,11 +924,11 @@ bool mac::process_pdus() return ret; } -void mac::write_mcch(srslte::sib2_mbms_t* sib2_, - srslte::sib13_t* sib13_, - srslte::mcch_msg_t* mcch_, - uint8_t* mcch_payload, - uint8_t mcch_payload_length) +void mac::write_mcch(const srslte::sib2_mbms_t* sib2_, + const srslte::sib13_t* sib13_, + const srslte::mcch_msg_t* mcch_, + const uint8_t* mcch_payload, + const uint8_t mcch_payload_length) { mcch = *mcch_; mch.num_mtch_sched = this->mcch.pmch_info_list[0].nof_mbms_session_info; diff --git a/srsenb/src/stack/rrc/rrc.cc b/srsenb/src/stack/rrc/rrc.cc index 8aa866771..b1f0454f3 100644 --- a/srsenb/src/stack/rrc/rrc.cc +++ b/srsenb/src/stack/rrc/rrc.cc @@ -65,53 +65,7 @@ void rrc::init(const rrc_cfg_t& cfg_, if (cfg.sibs[12].type() == asn1::rrc::sys_info_r8_ies_s::sib_type_and_info_item_c_::types::sib13_v920 && cfg.enable_mbsfn) { - srslte::sib2_mbms_t sibs2; - sibs2.mbsfn_sf_cfg_list_present = cfg.sibs[1].sib2().mbsfn_sf_cfg_list_present; - sibs2.nof_mbsfn_sf_cfg = cfg.sibs[1].sib2().mbsfn_sf_cfg_list.size(); - for (int i = 0; i < sibs2.nof_mbsfn_sf_cfg; i++) { - sibs2.mbsfn_sf_cfg_list[i].nof_alloc_subfrs = srslte::mbsfn_sf_cfg_t::sf_alloc_type_t::one_frame; - sibs2.mbsfn_sf_cfg_list[i].radioframe_alloc_offset = - cfg.sibs[1].sib2().mbsfn_sf_cfg_list[i].radioframe_alloc_offset; - sibs2.mbsfn_sf_cfg_list[i].radioframe_alloc_period = - (srslte::mbsfn_sf_cfg_t::alloc_period_t)cfg.sibs[1].sib2().mbsfn_sf_cfg_list[i].radioframe_alloc_period.value; - sibs2.mbsfn_sf_cfg_list[i].sf_alloc = - (uint32_t)cfg.sibs[1].sib2().mbsfn_sf_cfg_list[i].sf_alloc.one_frame().to_number(); - } - srslte::sib13_t sibs13; - sibs13.notif_cfg.notif_offset = cfg.sibs[12].sib13_v920().notif_cfg_r9.notif_offset_r9; - sibs13.notif_cfg.notif_repeat_coeff = - (srslte::mbms_notif_cfg_t::coeff_t)cfg.sibs[12].sib13_v920().notif_cfg_r9.notif_repeat_coeff_r9.value; - sibs13.notif_cfg.notif_sf_idx = cfg.sibs[12].sib13_v920().notif_cfg_r9.notif_sf_idx_r9; - sibs13.nof_mbsfn_area_info = cfg.sibs[12].sib13_v920().mbsfn_area_info_list_r9.size(); - for (uint32_t i = 0; i < sibs13.nof_mbsfn_area_info; i++) { - sibs13.mbsfn_area_info_list[i].mbsfn_area_id = - cfg.sibs[12].sib13_v920().mbsfn_area_info_list_r9[i].mbsfn_area_id_r9; - sibs13.mbsfn_area_info_list[i].notif_ind = cfg.sibs[12].sib13_v920().mbsfn_area_info_list_r9[i].notif_ind_r9; - sibs13.mbsfn_area_info_list[i].mcch_cfg.sig_mcs = (srslte::mbsfn_area_info_t::mcch_cfg_t::sig_mcs_t)cfg.sibs[12] - .sib13_v920() - .mbsfn_area_info_list_r9[i] - .mcch_cfg_r9.sig_mcs_r9.value; - sibs13.mbsfn_area_info_list[i].mcch_cfg.sf_alloc_info = - cfg.sibs[12].sib13_v920().mbsfn_area_info_list_r9[i].mcch_cfg_r9.sf_alloc_info_r9.to_number(); - sibs13.mbsfn_area_info_list[i].mcch_cfg.mcch_repeat_period = - (srslte::mbsfn_area_info_t::mcch_cfg_t::repeat_period_t)cfg.sibs[12] - .sib13_v920() - .mbsfn_area_info_list_r9[i] - .mcch_cfg_r9.mcch_repeat_period_r9.value; - sibs13.mbsfn_area_info_list[i].mcch_cfg.mcch_offset = - cfg.sibs[12].sib13_v920().mbsfn_area_info_list_r9[i].mcch_cfg_r9.mcch_offset_r9; - sibs13.mbsfn_area_info_list[i].mcch_cfg.mcch_mod_period = - (srslte::mbsfn_area_info_t::mcch_cfg_t::mod_period_t)cfg.sibs[12] - .sib13_v920() - .mbsfn_area_info_list_r9[i] - .mcch_cfg_r9.mcch_mod_period_r9.value; - sibs13.mbsfn_area_info_list[i].non_mbsfn_region_len = (srslte::mbsfn_area_info_t::region_len_t)cfg.sibs[12] - .sib13_v920() - .mbsfn_area_info_list_r9[i] - .non_mbsfn_region_len.value; - sibs13.mbsfn_area_info_list[i].notif_ind = cfg.sibs[12].sib13_v920().mbsfn_area_info_list_r9[i].notif_ind_r9; - } - configure_mbsfn_sibs(&sibs2, &sibs13); + configure_mbsfn_sibs(); } cell_res_list.reset(new freq_res_common_list{cfg}); @@ -748,8 +702,58 @@ uint32_t rrc::generate_sibs() return nof_messages; } -void rrc::configure_mbsfn_sibs(srslte::sib2_mbms_t* sib2_, srslte::sib13_t* sib13_) +void rrc::configure_mbsfn_sibs() { + // populate struct with sib2 values needed in PHY/MAC + srslte::sib2_mbms_t sibs2; + sibs2.mbsfn_sf_cfg_list_present = cfg.sibs[1].sib2().mbsfn_sf_cfg_list_present; + sibs2.nof_mbsfn_sf_cfg = cfg.sibs[1].sib2().mbsfn_sf_cfg_list.size(); + for (int i = 0; i < sibs2.nof_mbsfn_sf_cfg; i++) { + sibs2.mbsfn_sf_cfg_list[i].nof_alloc_subfrs = srslte::mbsfn_sf_cfg_t::sf_alloc_type_t::one_frame; + sibs2.mbsfn_sf_cfg_list[i].radioframe_alloc_offset = + cfg.sibs[1].sib2().mbsfn_sf_cfg_list[i].radioframe_alloc_offset; + sibs2.mbsfn_sf_cfg_list[i].radioframe_alloc_period = + (srslte::mbsfn_sf_cfg_t::alloc_period_t)cfg.sibs[1].sib2().mbsfn_sf_cfg_list[i].radioframe_alloc_period.value; + sibs2.mbsfn_sf_cfg_list[i].sf_alloc = + (uint32_t)cfg.sibs[1].sib2().mbsfn_sf_cfg_list[i].sf_alloc.one_frame().to_number(); + } + // populate struct with sib13 values needed for PHY/MAC + srslte::sib13_t sibs13; + sibs13.notif_cfg.notif_offset = cfg.sibs[12].sib13_v920().notif_cfg_r9.notif_offset_r9; + sibs13.notif_cfg.notif_repeat_coeff = + (srslte::mbms_notif_cfg_t::coeff_t)cfg.sibs[12].sib13_v920().notif_cfg_r9.notif_repeat_coeff_r9.value; + sibs13.notif_cfg.notif_sf_idx = cfg.sibs[12].sib13_v920().notif_cfg_r9.notif_sf_idx_r9; + sibs13.nof_mbsfn_area_info = cfg.sibs[12].sib13_v920().mbsfn_area_info_list_r9.size(); + for (uint32_t i = 0; i < sibs13.nof_mbsfn_area_info; i++) { + sibs13.mbsfn_area_info_list[i].mbsfn_area_id = + cfg.sibs[12].sib13_v920().mbsfn_area_info_list_r9[i].mbsfn_area_id_r9; + sibs13.mbsfn_area_info_list[i].notif_ind = cfg.sibs[12].sib13_v920().mbsfn_area_info_list_r9[i].notif_ind_r9; + sibs13.mbsfn_area_info_list[i].mcch_cfg.sig_mcs = (srslte::mbsfn_area_info_t::mcch_cfg_t::sig_mcs_t)cfg.sibs[12] + .sib13_v920() + .mbsfn_area_info_list_r9[i] + .mcch_cfg_r9.sig_mcs_r9.value; + sibs13.mbsfn_area_info_list[i].mcch_cfg.sf_alloc_info = + cfg.sibs[12].sib13_v920().mbsfn_area_info_list_r9[i].mcch_cfg_r9.sf_alloc_info_r9.to_number(); + sibs13.mbsfn_area_info_list[i].mcch_cfg.mcch_repeat_period = + (srslte::mbsfn_area_info_t::mcch_cfg_t::repeat_period_t)cfg.sibs[12] + .sib13_v920() + .mbsfn_area_info_list_r9[i] + .mcch_cfg_r9.mcch_repeat_period_r9.value; + sibs13.mbsfn_area_info_list[i].mcch_cfg.mcch_offset = + cfg.sibs[12].sib13_v920().mbsfn_area_info_list_r9[i].mcch_cfg_r9.mcch_offset_r9; + sibs13.mbsfn_area_info_list[i].mcch_cfg.mcch_mod_period = + (srslte::mbsfn_area_info_t::mcch_cfg_t::mod_period_t)cfg.sibs[12] + .sib13_v920() + .mbsfn_area_info_list_r9[i] + .mcch_cfg_r9.mcch_mod_period_r9.value; + sibs13.mbsfn_area_info_list[i].non_mbsfn_region_len = (srslte::mbsfn_area_info_t::region_len_t)cfg.sibs[12] + .sib13_v920() + .mbsfn_area_info_list_r9[i] + .non_mbsfn_region_len.value; + sibs13.mbsfn_area_info_list[i].notif_ind = cfg.sibs[12].sib13_v920().mbsfn_area_info_list_r9[i].notif_ind_r9; + } + + // pack MCCH for transmission and pass relevant MCCH values to PHY/MAC pack_mcch(); srslte::mcch_msg_t mcch_t; mcch_t.common_sf_alloc_period = srslte::mcch_msg_t::common_sf_alloc_period_t::rf64; @@ -775,14 +779,13 @@ void rrc::configure_mbsfn_sibs(srslte::sib2_mbms_t* sib2_, srslte::sib13_t* sib1 pmch_item->data_mcs = mbms_mcs; pmch_item->mch_sched_period = srslte::pmch_info_t::mch_sched_period_t::rf64; pmch_item->sf_alloc_end = 64 * 6; - phy->configure_mbsfn(sib2_, sib13_, mcch_t); - mac->write_mcch(sib2_, sib13_, &mcch_t, mcch_payload_buffer, current_mcch_length); + phy->configure_mbsfn(&sibs2, &sibs13, mcch_t); + mac->write_mcch(&sibs2, &sibs13, &mcch_t, mcch_payload_buffer, current_mcch_length); } int rrc::pack_mcch() { - mcch.msg.set_c1(); mcch.msg.set_c1(); mbsfn_area_cfg_r9_s& area_cfg_r9 = mcch.msg.c1().mbsfn_area_cfg_r9(); area_cfg_r9.common_sf_alloc_period_r9 = mbsfn_area_cfg_r9_s::common_sf_alloc_period_r9_e_::rf64; diff --git a/srsenb/test/common/dummy_classes.h b/srsenb/test/common/dummy_classes.h index 1a1911b30..514149af8 100644 --- a/srsenb/test/common/dummy_classes.h +++ b/srsenb/test/common/dummy_classes.h @@ -37,11 +37,11 @@ public: int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg) override { return 0; } int bearer_ue_rem(uint16_t rnti, uint32_t lc_id) override { return 0; } void phy_config_enabled(uint16_t rnti, bool enabled) override {} - void write_mcch(srslte::sib2_mbms_t* sib2_, - srslte::sib13_t* sib13_, - srslte::mcch_msg_t* mcch_, - uint8_t* mcch_payload, - uint8_t mcch_payload_length) override + void write_mcch(const srslte::sib2_mbms_t* sib2_, + const srslte::sib13_t* sib13_, + const srslte::mcch_msg_t* mcch_, + const uint8_t* mcch_payload, + const uint8_t mcch_payload_length) override {} uint16_t reserve_new_crnti(const sched_interface::ue_cfg_t& ue_cfg) override { return last_rnti++; }