From 170fbefbf5c7f2ba48dd7f2fcb6c9beb885b3261 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Mon, 17 May 2021 12:06:37 +0200 Subject: [PATCH] Avoid SCell receiver to copy --- srsue/hdr/phy/scell/scell_recv.h | 26 ++++++++++++++++-------- srsue/src/phy/scell/intra_measure_lte.cc | 7 +------ srsue/src/phy/scell/scell_recv.cc | 15 +++++++------- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/srsue/hdr/phy/scell/scell_recv.h b/srsue/hdr/phy/scell/scell_recv.h index 4242c2360..0ac24d40a 100644 --- a/srsue/hdr/phy/scell/scell_recv.h +++ b/srsue/hdr/phy/scell/scell_recv.h @@ -26,18 +26,26 @@ class scell_recv public: explicit scell_recv(srslog::basic_logger& logger) : logger(logger) {} - void init(uint32_t max_sf_window); - void deinit(); - void reset(); - std::set find_cells(const cf_t* input_buffer, const srsran_cell_t serving_cell, const uint32_t nof_sf); + void init(uint32_t max_sf_window); + void deinit(); + void reset(); + + /** + * @brief Find neighbour cells in a given buffer + * @param input_buffer Provides the baseband samples + * @param serving_cell Current serving cell + * @param nof_sf Number of subframes contained in the baseband buffer + * @param found_cell_ids Provides a set where to insert the found cell identifiers (PCIs) + */ + void find_cells(const cf_t* input_buffer, + const srsran_cell_t& serving_cell, + const uint32_t& nof_sf, + std::set& found_cell_ids); private: - // 36.133 9.1.2.1 for band 7 - constexpr static float ABSOLUTE_RSRP_THRESHOLD_DBM = -125; - - cf_t* sf_buffer[SRSRAN_MAX_PORTS]; + cf_t* sf_buffer[SRSRAN_MAX_PORTS] = {}; srslog::basic_logger& logger; - srsran_sync_t sync_find; + srsran_sync_t sync_find = {}; uint32_t current_fft_sz; }; diff --git a/srsue/src/phy/scell/intra_measure_lte.cc b/srsue/src/phy/scell/intra_measure_lte.cc index 9a09c8320..75a09b14a 100644 --- a/srsue/src/phy/scell/intra_measure_lte.cc +++ b/srsue/src/phy/scell/intra_measure_lte.cc @@ -52,12 +52,7 @@ void intra_measure_lte::measure_rat(const measure_context_t& context, std::vecto std::set cells_to_measure = context.active_pci; // Detect new cells using PSS/SSS - std::set detected_cells = scell_rx.find_cells(buffer.data(), serving_cell, context.meas_len_ms); - - // Add detected cells to the list of cells to measure - for (const uint32_t& c : detected_cells) { - cells_to_measure.insert(c); - } + scell_rx.find_cells(buffer.data(), serving_cell, context.meas_len_ms, cells_to_measure); // Initialise empty neighbour cell list std::vector neighbour_cells = {}; diff --git a/srsue/src/phy/scell/scell_recv.cc b/srsue/src/phy/scell/scell_recv.cc index e15a0e524..a84ba6e19 100644 --- a/srsue/src/phy/scell/scell_recv.cc +++ b/srsue/src/phy/scell/scell_recv.cc @@ -68,18 +68,18 @@ void scell_recv::reset() current_fft_sz = 0; } -std::set -scell_recv::find_cells(const cf_t* input_buffer, const srsran_cell_t serving_cell, const uint32_t nof_sf) +void scell_recv::find_cells(const cf_t* input_buffer, + const srsran_cell_t& serving_cell, + const uint32_t& nof_sf, + std::set& found_cell_ids) { - std::set found_cell_ids = {}; - uint32_t fft_sz = srsran_symbol_sz(serving_cell.nof_prb); uint32_t sf_len = SRSRAN_SF_LEN(fft_sz); if (fft_sz != current_fft_sz) { if (srsran_sync_resize(&sync_find, nof_sf * sf_len, 5 * sf_len, fft_sz)) { logger.error("Error resizing sync nof_sf=%d, sf_len=%d, fft_sz=%d", nof_sf, sf_len, fft_sz); - return found_cell_ids; + return; } current_fft_sz = fft_sz; } @@ -88,7 +88,6 @@ scell_recv::find_cells(const cf_t* input_buffer, const srsran_cell_t serving_cel int cell_id = 0; for (uint32_t n_id_2 = 0; n_id_2 < 3; n_id_2++) { - if (n_id_2 != (serving_cell.id % 3)) { srsran_sync_set_N_id_2(&sync_find, n_id_2); @@ -108,7 +107,7 @@ scell_recv::find_cells(const cf_t* input_buffer, const srsran_cell_t serving_cel sync_res = srsran_sync_find(&sync_find, input_buffer, sf5_cnt * 5 * sf_len, &peak_idx); if (sync_res == SRSRAN_SYNC_ERROR) { logger.error("INTRA: Error calling sync_find()"); - return found_cell_ids; + return; } if (sync_find.peak_value > max_peak && sync_res == SRSRAN_SYNC_FOUND && srsran_sync_sss_detected(&sync_find)) { @@ -144,7 +143,7 @@ scell_recv::find_cells(const cf_t* input_buffer, const srsran_cell_t serving_cel } } } - return found_cell_ids; + return; } } // namespace scell