From 6d3bf7089f056aa9da5ece06ae3399d2d6eb2fa6 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Fri, 13 Nov 2020 12:31:23 +0100 Subject: [PATCH] SRSUE: use available carriers for inter-frequency measurement --- srsue/src/phy/cc_worker.cc | 5 +++-- srsue/src/phy/phy.cc | 39 ++++++++++++++++++++++++++++++++++++-- srsue/src/phy/sf_worker.cc | 2 +- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/srsue/src/phy/cc_worker.cc b/srsue/src/phy/cc_worker.cc index 2211f74e6..2788e2c82 100644 --- a/srsue/src/phy/cc_worker.cc +++ b/srsue/src/phy/cc_worker.cc @@ -254,8 +254,9 @@ bool cc_worker::work_dl_regular() return false; } - /* Look for DL and UL dci(s) if this is PCell, or no cross-carrier scheduling is enabled */ - if ((cc_idx == 0) || (!ue_dl_cfg.cfg.dci.cif_present)) { + // Look for DL and UL dci(s) if the serving cell is active and it is NOT a secondary serving cell without + // cross-carrier scheduling is enabled + if (phy->cell_state.is_active(cc_idx, sf_cfg_dl.tti) and (cc_idx != 0 or not ue_dl_cfg.cfg.dci.cif_present)) { found_dl_grant = decode_pdcch_dl() > 0; decode_pdcch_ul(); } diff --git a/srsue/src/phy/phy.cc b/srsue/src/phy/phy.cc index ccaa02ed6..aa0ea0073 100644 --- a/srsue/src/phy/phy.cc +++ b/srsue/src/phy/phy.cc @@ -290,6 +290,41 @@ void phy::configure_prach_params() void phy::set_cells_to_meas(uint32_t earfcn, const std::set& pci) { + // Check if the EARFCN matches with serving cell + uint32_t pcell_earfcn = 0; + sfsync.get_current_cell(nullptr, &pcell_earfcn); + bool available = (pcell_earfcn == earfcn); + + // Find if there is secondary serving cell configured with the specified EARFCN + uint32_t cc_empty = 0; + for (uint32_t cc = 1; cc < args.nof_carriers and not available; cc++) { + // If it is configured... + if (common.cell_state.is_configured(cc)) { + // ... Check if the EARFCN match + if (common.cell_state.get_earfcn(cc) == earfcn) { + available = true; + } + } else if (cc_empty == 0) { + // ... otherwise, save the CC as non-configured + cc_empty = cc; + } + } + + // If not available and a non-configured carrier is available, configure it. + if (not available and cc_empty != 0) { + // Copy all attributes from serving cell + srslte_cell_t cell = selected_cell; + + // Select the first PCI in the list + if (not pci.empty()) { + cell.id = *pci.begin(); + } + + // Configure a the empty carrier as it was CA + set_scell(cell, cc_empty, earfcn); + } + + // Finally, set the serving cell measure sfsync.set_cells_to_meas(earfcn, pci); } @@ -454,7 +489,7 @@ bool phy::set_config(srslte::phy_cfg_t config_, uint32_t cc_idx) // Check parameters are valid if (cc_idx >= args.nof_carriers) { srslte::console("Received SCell configuration for index %d but there are not enough CC workers available\n", - cc_idx); + cc_idx); return false; } @@ -509,7 +544,7 @@ bool phy::set_scell(srslte_cell_t cell_info, uint32_t cc_idx, uint32_t earfcn) // Check parameters are valid if (cc_idx >= args.nof_carriers) { srslte::console("Received SCell configuration for index %d but there are not enough CC workers available\n", - cc_idx); + cc_idx); return false; } diff --git a/srsue/src/phy/sf_worker.cc b/srsue/src/phy/sf_worker.cc index 537c8a59e..aa2832270 100644 --- a/srsue/src/phy/sf_worker.cc +++ b/srsue/src/phy/sf_worker.cc @@ -205,7 +205,7 @@ void sf_worker::work_imp() if (carrier_idx == 0 && phy->is_mbsfn_sf(&mbsfn_cfg, tti)) { cc_workers[0]->work_dl_mbsfn(mbsfn_cfg); // Don't do chest_ok in mbsfn since it trigger measurements } else { - if (phy->cell_state.is_active(carrier_idx, tti)) { + if (phy->cell_state.is_configured(carrier_idx)) { rx_signal_ok = cc_workers[carrier_idx]->work_dl_regular(); } }