ue: store new EARFCN in the foreground of cell_select to avoid race conditions with the other cmd_worker

master
Ismael Gomez 3 years ago
parent 99632d6b41
commit 120ad5c72f

@ -190,6 +190,9 @@ private:
// Tracks the current selected cell (last call to cell_select) // Tracks the current selected cell (last call to cell_select)
srsran_cell_t selected_cell = {}; srsran_cell_t selected_cell = {};
// Tracks the current selected EARFCN (last call to cell_select)
uint32_t selected_earfcn = 0;
static void set_default_args(phy_args_t& args); static void set_default_args(phy_args_t& args);
bool check_args(const phy_args_t& args); bool check_args(const phy_args_t& args);
}; };

@ -244,8 +244,7 @@ void phy::set_cells_to_meas(uint32_t earfcn, const std::set<uint32_t>& pci)
// measurements to avoid a concurrency issue // measurements to avoid a concurrency issue
cmd_worker.add_cmd([this, earfcn, pci]() { cmd_worker.add_cmd([this, earfcn, pci]() {
// Check if the EARFCN matches with serving cell // Check if the EARFCN matches with serving cell
uint32_t pcell_earfcn = 0; uint32_t pcell_earfcn = selected_earfcn;
sfsync.get_current_cell(nullptr, &pcell_earfcn);
bool available = (pcell_earfcn == earfcn); bool available = (pcell_earfcn == earfcn);
// Find if there is secondary serving cell configured with the specified EARFCN // Find if there is secondary serving cell configured with the specified EARFCN
@ -303,6 +302,10 @@ bool phy::cell_select(phy_cell_t cell)
// Indicate workers that cell selection is in progress // Indicate workers that cell selection is in progress
common.cell_is_selecting = true; common.cell_is_selecting = true;
// Update EARCN before starting the background task to make sure is taken into account when finding carriers to
// measure inter-frequency neighbours (see set_cells_to_meas)
selected_earfcn = cell.earfcn;
cmd_worker_cell.add_cmd([this, cell]() { cmd_worker_cell.add_cmd([this, cell]() {
// Wait SYNC transitions to IDLE // Wait SYNC transitions to IDLE
sfsync.wait_idle(); sfsync.wait_idle();

Loading…
Cancel
Save