From 40772eae1976819e12f785df4d845da2459a2709 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 5 Feb 2020 17:54:26 +0100 Subject: [PATCH] SRSENB: UE PHY dedicated takes a flat configuration structure --- lib/include/srslte/common/interfaces_common.h | 6 +- .../srslte/interfaces/enb_interfaces.h | 2 +- lib/include/srslte/interfaces/ue_interfaces.h | 6 +- srsenb/hdr/phy/cc_worker.h | 2 +- srsenb/hdr/phy/phy.h | 2 +- srsenb/hdr/phy/phy_interfaces.h | 16 ++-- srsenb/hdr/phy/sf_worker.h | 2 +- srsenb/src/phy/cc_worker.cc | 76 +------------------ srsenb/src/phy/phy.cc | 2 +- srsenb/src/phy/sf_worker.cc | 2 +- 10 files changed, 22 insertions(+), 94 deletions(-) diff --git a/lib/include/srslte/common/interfaces_common.h b/lib/include/srslte/common/interfaces_common.h index 90dec92b1..b4b7c9353 100644 --- a/lib/include/srslte/common/interfaces_common.h +++ b/lib/include/srslte/common/interfaces_common.h @@ -29,9 +29,9 @@ namespace srslte { typedef struct { - std::string phy_level; - std::string phy_lib_level; - int phy_hex_limit; + std::string phy_level = "none"; + std::string phy_lib_level = "none"; + int phy_hex_limit = -1; } phy_log_args_t; // RF/radio args diff --git a/lib/include/srslte/interfaces/enb_interfaces.h b/lib/include/srslte/interfaces/enb_interfaces.h index 642ae16c1..7e7ee1465 100644 --- a/lib/include/srslte/interfaces/enb_interfaces.h +++ b/lib/include/srslte/interfaces/enb_interfaces.h @@ -127,7 +127,7 @@ public: virtual void configure_mbsfn(asn1::rrc::sib_type2_s* sib2, asn1::rrc::sib_type13_r9_s* sib13, asn1::rrc::mcch_msg_s mcch) = 0; - virtual void set_config_dedicated(uint16_t rnti, asn1::rrc::phys_cfg_ded_s* dedicated) = 0; + virtual void set_config_dedicated(uint16_t rnti, const srslte::phy_cfg_t& dedicated) = 0; }; class mac_interface_rrc diff --git a/lib/include/srslte/interfaces/ue_interfaces.h b/lib/include/srslte/interfaces/ue_interfaces.h index 8c9e102bd..3490185f6 100644 --- a/lib/include/srslte/interfaces/ue_interfaces.h +++ b/lib/include/srslte/interfaces/ue_interfaces.h @@ -473,11 +473,7 @@ typedef struct { typedef struct { std::string type = "lte"; - srslte::phy_log_args_t log = { - .phy_level = "none", - .phy_lib_level = "none", - .phy_hex_limit = -1, - }; + srslte::phy_log_args_t log; std::string dl_earfcn = "3400"; // comma-separated list of EARFCNs std::vector earfcn_list = {3400}; // vectorized version of dl_earfcn that gets populated during init diff --git a/srsenb/hdr/phy/cc_worker.h b/srsenb/hdr/phy/cc_worker.h index 6877b6cc2..09a548164 100644 --- a/srsenb/hdr/phy/cc_worker.h +++ b/srsenb/hdr/phy/cc_worker.h @@ -53,7 +53,7 @@ public: int read_pucch_d(cf_t* pusch_d); void start_plot(); - void set_config_dedicated(uint16_t rnti, asn1::rrc::phys_cfg_ded_s* dedicated); + void set_config_dedicated(uint16_t rnti, const srslte::phy_cfg_t& dedicated); void work_ul(const srslte_ul_sf_cfg_t& ul_sf, stack_interface_phy_lte::ul_sched_t& ul_grants); void work_dl(const srslte_dl_sf_cfg_t& dl_sf_cfg, stack_interface_phy_lte::dl_sched_t& dl_grants, diff --git a/srsenb/hdr/phy/phy.h b/srsenb/hdr/phy/phy.h index 07d5caa40..b50235dfc 100644 --- a/srsenb/hdr/phy/phy.h +++ b/srsenb/hdr/phy/phy.h @@ -62,7 +62,7 @@ public: static uint32_t tti_to_subf(uint32_t tti); void start_plot(); - void set_config_dedicated(uint16_t rnti, asn1::rrc::phys_cfg_ded_s* dedicated); + void set_config_dedicated(uint16_t rnti, const srslte::phy_cfg_t& dedicated); void get_metrics(phy_metrics_t metrics[ENB_METRICS_MAX_USERS]); diff --git a/srsenb/hdr/phy/phy_interfaces.h b/srsenb/hdr/phy/phy_interfaces.h index 054ac007c..3fdc94b39 100644 --- a/srsenb/hdr/phy/phy_interfaces.h +++ b/srsenb/hdr/phy/phy_interfaces.h @@ -45,14 +45,14 @@ struct phy_args_t { std::string type; srslte::phy_log_args_t log; - float max_prach_offset_us; - int pusch_max_its; - bool pusch_8bit_decoder; - float tx_amplitude; - int nof_phy_threads; - std::string equalizer_mode; - float estimator_fil_w; - bool pregenerate_signals; + float max_prach_offset_us = 10; + int pusch_max_its = 10; + bool pusch_8bit_decoder = false; + float tx_amplitude = 1.0f; + int nof_phy_threads = 1; + std::string equalizer_mode = "mmse"; + float estimator_fil_w = 1.0f; + bool pregenerate_signals = false; srslte::channel::args_t dl_channel_args; srslte::channel::args_t ul_channel_args; diff --git a/srsenb/hdr/phy/sf_worker.h b/srsenb/hdr/phy/sf_worker.h index 6a3102f4b..14515ad4a 100644 --- a/srsenb/hdr/phy/sf_worker.h +++ b/srsenb/hdr/phy/sf_worker.h @@ -53,7 +53,7 @@ public: int read_pucch_d(cf_t* pusch_d); void start_plot(); - void set_config_dedicated(uint16_t rnti, asn1::rrc::phys_cfg_ded_s* dedicated); + void set_config_dedicated(uint16_t rnti, const srslte::phy_cfg_t& dedicated); uint32_t get_metrics(phy_metrics_t metrics[ENB_METRICS_MAX_USERS]); diff --git a/srsenb/src/phy/cc_worker.cc b/srsenb/src/phy/cc_worker.cc index 7bae4f023..bd974a22e 100644 --- a/srsenb/src/phy/cc_worker.cc +++ b/srsenb/src/phy/cc_worker.cc @@ -246,81 +246,13 @@ uint32_t cc_worker::get_nof_rnti() return ue_db.size(); } -void cc_worker::set_config_dedicated(uint16_t rnti, asn1::rrc::phys_cfg_ded_s* dedicated) +void cc_worker::set_config_dedicated(uint16_t rnti, const srslte::phy_cfg_t& dedicated) { std::lock_guard lock(mutex); if (ue_db.count(rnti)) { - - if (dedicated->pusch_cfg_ded_present && dedicated->sched_request_cfg_present) { - ue_db[rnti]->ul_cfg.pusch.uci_offset.I_offset_ack = dedicated->pusch_cfg_ded.beta_offset_ack_idx; - ue_db[rnti]->ul_cfg.pusch.uci_offset.I_offset_cqi = dedicated->pusch_cfg_ded.beta_offset_cqi_idx; - ue_db[rnti]->ul_cfg.pusch.uci_offset.I_offset_ri = dedicated->pusch_cfg_ded.beta_offset_ri_idx; - - ue_db[rnti]->ul_cfg.pucch.n_pucch_2 = dedicated->cqi_report_cfg.cqi_report_periodic.setup().cqi_pucch_res_idx; - ue_db[rnti]->ul_cfg.pucch.n_pucch_sr = dedicated->sched_request_cfg.setup().sr_pucch_res_idx; - } - - if (dedicated->sched_request_cfg_present) { - ue_db[rnti]->ul_cfg.pucch.I_sr = dedicated->sched_request_cfg.setup().sr_cfg_idx; - ue_db[rnti]->ul_cfg.pucch.sr_configured = true; - } - - /* CQI Reporting */ - if (dedicated->cqi_report_cfg.cqi_report_periodic_present and - dedicated->cqi_report_cfg.cqi_report_periodic.type() == setup_e::setup) { - ue_db[rnti]->dl_cfg.cqi_report.periodic_configured = true; - ue_db[rnti]->dl_cfg.cqi_report.pmi_idx = dedicated->cqi_report_cfg.cqi_report_periodic.setup().cqi_pmi_cfg_idx; - ue_db[rnti]->ul_cfg.pucch.simul_cqi_ack = - dedicated->cqi_report_cfg.cqi_report_periodic.setup().simul_ack_nack_and_cqi; - } else { - ue_db[rnti]->dl_cfg.cqi_report.pmi_idx = 0; - } - - /* RI reporting */ - if (dedicated->cqi_report_cfg.cqi_report_periodic.setup().ri_cfg_idx_present) { - ue_db[rnti]->dl_cfg.cqi_report.ri_idx = dedicated->cqi_report_cfg.cqi_report_periodic.setup().ri_cfg_idx; - ue_db[rnti]->dl_cfg.cqi_report.ri_idx_present = true; - } else { - ue_db[rnti]->dl_cfg.cqi_report.ri_idx_present = false; - } - - if (dedicated->ant_info_present) { - /* If default antenna info then follow 3GPP 36.331 clause 9.2.4 Default physical channel configuration */ - if (dedicated->ant_info.type() == phys_cfg_ded_s::ant_info_c_::types::default_value) { - if (enb_dl.cell.nof_ports == 1) { - ue_db[rnti]->dl_cfg.tm = SRSLTE_TM1; - } else { - ue_db[rnti]->dl_cfg.tm = SRSLTE_TM2; - } - ue_db[rnti]->dl_cfg.cqi_report.ri_idx = 0; - ue_db[rnti]->dl_cfg.cqi_report.ri_idx_present = false; - } else { - /* Physical channel reconfiguration according to 3GPP 36.331 clause 5.3.10.6 */ - switch (dedicated->ant_info.explicit_value().tx_mode) { - case ant_info_ded_s::tx_mode_e_::tm1: - ue_db[rnti]->dl_cfg.cqi_report.ri_idx = 0; - ue_db[rnti]->dl_cfg.cqi_report.ri_idx_present = false; - ue_db[rnti]->dl_cfg.tm = SRSLTE_TM1; - break; - case ant_info_ded_s::tx_mode_e_::tm2: - ue_db[rnti]->dl_cfg.cqi_report.ri_idx = 0; - ue_db[rnti]->dl_cfg.cqi_report.ri_idx_present = false; - ue_db[rnti]->dl_cfg.tm = SRSLTE_TM2; - break; - case ant_info_ded_s::tx_mode_e_::tm3: - ue_db[rnti]->dl_cfg.tm = SRSLTE_TM3; - break; - case ant_info_ded_s::tx_mode_e_::tm4: - ue_db[rnti]->dl_cfg.tm = SRSLTE_TM4; - break; - default: - ue_db[rnti]->dl_cfg.tm = SRSLTE_TM1; - Error("TM mode %s not supported\n", dedicated->ant_info.explicit_value().tx_mode.to_string().c_str()); - break; - } - } - } + ue_db[rnti]->ul_cfg = dedicated.ul_cfg; + ue_db[rnti]->dl_cfg = dedicated.dl_cfg; } else { Error("Setting config dedicated: rnti=0x%x does not exist\n", rnti); } @@ -720,7 +652,7 @@ int cc_worker::encode_pdsch(stack_interface_phy_lte::dl_sched_grant_t* grants, u // Logging char str[512]; srslte_pdsch_tx_info(&ue_db[rnti]->dl_cfg.pdsch, str, 512); - Info("PDSCH: %s, tti_tx_dl=%d\n", str, tti_tx_dl); + Info("PDSCH: cc=%d, %s, tti_tx_dl=%d\n", cc_idx, str, tti_tx_dl); } // Save metrics stats diff --git a/srsenb/src/phy/phy.cc b/srsenb/src/phy/phy.cc index 19a75b90b..6501e93c3 100644 --- a/srsenb/src/phy/phy.cc +++ b/srsenb/src/phy/phy.cc @@ -253,7 +253,7 @@ void phy::get_metrics(phy_metrics_t metrics[ENB_METRICS_MAX_USERS]) /***** RRC->PHY interface **********/ -void phy::set_config_dedicated(uint16_t rnti, phys_cfg_ded_s* dedicated) +void phy::set_config_dedicated(uint16_t rnti, const srslte::phy_cfg_t& dedicated) { for (uint32_t i = 0; i < nof_workers; i++) { workers[i].set_config_dedicated(rnti, dedicated); diff --git a/srsenb/src/phy/sf_worker.cc b/srsenb/src/phy/sf_worker.cc index 0603574a1..edf20953b 100644 --- a/srsenb/src/phy/sf_worker.cc +++ b/srsenb/src/phy/sf_worker.cc @@ -156,7 +156,7 @@ uint32_t sf_worker::get_nof_rnti() return cc_workers[0]->get_nof_rnti(); } -void sf_worker::set_config_dedicated(uint16_t rnti, asn1::rrc::phys_cfg_ded_s* dedicated) +void sf_worker::set_config_dedicated(uint16_t rnti, const srslte::phy_cfg_t& dedicated) { for (auto& w : cc_workers) { w->set_config_dedicated(rnti, dedicated);