From 59114206aedd99f6962b278db948dc01d658f86d Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 20 Jan 2021 16:42:37 +0100 Subject: [PATCH] SRSUE: Unify PRACH reconfiguration conditions --- srsue/hdr/phy/prach.h | 1 - srsue/src/phy/phy.cc | 22 ++++++++-------------- srsue/src/phy/prach.cc | 14 ++++++-------- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/srsue/hdr/phy/prach.h b/srsue/hdr/phy/prach.h index 3d65dc384..ff963353a 100644 --- a/srsue/hdr/phy/prach.h +++ b/srsue/hdr/phy/prach.h @@ -30,7 +30,6 @@ public: void init(uint32_t max_prb, srslte::log* log_h); void stop(); bool set_cell(srslte_cell_t cell, srslte_prach_cfg_t prach_cfg); - void reset_cfg(); bool prepare_to_send(uint32_t preamble_idx, int allowed_subframe = -1, float target_power_dbm = -1); bool is_ready_to_send(uint32_t current_tti, uint32_t current_pci); bool is_pending() const; diff --git a/srsue/src/phy/phy.cc b/srsue/src/phy/phy.cc index 5a50027e2..413241dee 100644 --- a/srsue/src/phy/phy.cc +++ b/srsue/src/phy/phy.cc @@ -466,18 +466,15 @@ bool phy::set_config(srslte::phy_cfg_t config_, uint32_t cc_idx) Info("Setting configuration\n"); - // The PRACH shall be re-configured only if: + // The PRACH configuration shall be updated only if: // - The new configuration belongs to the primary cell // - The PRACH configuration is present - // - The PRACH configuration has changed - bool reconfigure_prach = !cc_idx && config_.prach_cfg_present && (prach_cfg != config_.prach_cfg); - - if (reconfigure_prach) { - prach_buffer.reset_cfg(); + if (!cc_idx && config_.prach_cfg_present) { + prach_cfg = config_.prach_cfg; } // Apply configuration after the worker is finished to avoid race conditions - cmd_worker.add_cmd([this, config_, cc_idx, reconfigure_prach]() { + cmd_worker.add_cmd([this, config_, cc_idx]() { log_h->info("Setting new PHY configuration cc_idx=%d...\n", cc_idx); for (uint32_t i = 0; i < args.nof_phy_threads; i++) { // set_cell is not protected so run when worker is finished @@ -488,13 +485,10 @@ bool phy::set_config(srslte::phy_cfg_t config_, uint32_t cc_idx) } } log_h->info("Finished setting new PHY configuration cc_idx=%d\n", cc_idx); - if (reconfigure_prach) { - // Reconfigure PRACH parameters only if configuration is different - prach_cfg = config_.prach_cfg; - log_h->info("Setting new PRACH configuration...\n"); - configure_prach_params(); - log_h->info("Finished setting new PRACH configuration.\n"); - } + + // It is up to the PRACH component to detect whether the cell or the configuration have changed to reconfigure + configure_prach_params(); + stack->set_config_complete(true); }); return true; diff --git a/srsue/src/phy/prach.cc b/srsue/src/phy/prach.cc index 31756fea0..0c25d62de 100644 --- a/srsue/src/phy/prach.cc +++ b/srsue/src/phy/prach.cc @@ -12,6 +12,7 @@ #include "srsue/hdr/phy/prach.h" #include "srslte/common/log.h" +#include "srslte/interfaces/phy_interface_types.h" #include "srslte/interfaces/ue_interfaces.h" #include "srslte/srslte.h" @@ -83,11 +84,6 @@ void prach::stop() mem_initiated = false; } -void prach::reset_cfg() -{ - cell_initiated = false; -} - bool prach::set_cell(srslte_cell_t cell_, srslte_prach_cfg_t prach_cfg) { if (!mem_initiated) { @@ -95,8 +91,7 @@ bool prach::set_cell(srslte_cell_t cell_, srslte_prach_cfg_t prach_cfg) return false; } - // TODO: Check if other PRACH parameters changed - if (cell.id == cell_.id && cell_initiated) { + if (cell.id == cell_.id && cell_initiated && prach_cfg == cfg) { return true; } @@ -110,7 +105,8 @@ bool prach::set_cell(srslte_cell_t cell_, srslte_prach_cfg_t prach_cfg) return false; } - Info("PRACH: configIdx=%d, rootSequence=%d, zeroCorrelationConfig=%d, freqOffset=%d\n", + Info("PRACH: cell.id=%d, configIdx=%d, rootSequence=%d, zeroCorrelationConfig=%d, freqOffset=%d\n", + cell.id, prach_cfg.config_idx, prach_cfg.root_seq_idx, prach_cfg.zero_corr_zone, @@ -126,6 +122,8 @@ bool prach::set_cell(srslte_cell_t cell_, srslte_prach_cfg_t prach_cfg) transmitted_tti = -1; cell_initiated = true; + log_h->info("Finished setting new PRACH configuration.\n"); + return true; }