since we moved cell search to the background thread, cell reselection prints a error message that it cannot start. In fact it already started. It is just waiting for the cell search to finish. This PR fixes this

This commit is contained in:
Francisco Paisana 2019-10-11 17:39:30 +01:00 committed by Andre Puschmann
parent 4238c045a4
commit 81a466a641
4 changed files with 66 additions and 31 deletions

View File

@ -615,6 +615,7 @@ private:
class plmn_search_proc;
class process_pcch_proc;
class go_idle_proc;
class cell_reselection_proc;
srslte::proc_t<cell_search_proc> cell_searcher;
srslte::proc_t<si_acquire_proc> si_acquirer;
srslte::proc_t<serving_cell_config_proc> serv_cell_cfg;
@ -623,6 +624,7 @@ private:
srslte::proc_t<process_pcch_proc> pcch_processor;
srslte::proc_t<connection_request_proc> conn_req_proc;
srslte::proc_t<plmn_search_proc> plmn_searcher;
srslte::proc_t<cell_reselection_proc> cell_reselector;
srslte::callback_list_t callback_list;

View File

@ -205,6 +205,17 @@ private:
uint32_t rlc_flush_counter;
};
class rrc::cell_reselection_proc : public srslte::proc_impl_t
{
public:
srslte::proc_outcome_t init(rrc* rrc_);
srslte::proc_outcome_t step() final;
static const char* name() { return "Cell Reselection"; }
private:
rrc* rrc_ptr;
};
} // namespace srsue
#endif // SRSLTE_RRC_PROCEDURES_H

View File

@ -1445,40 +1445,15 @@ void rrc::start_cell_reselection()
return;
}
if (not cell_selector.launch(this)) {
rrc_log->error("Failed to initiate a Cell Selection procedure...\n");
if (cell_reselector.is_active()) {
// it is already running
return;
}
rrc_log->info("Cell Reselection - Starting...\n");
callback_list.defer_task([this]() {
if (cell_selector.run()) {
return srslte::proc_outcome_t::yield;
}
cell_selection_proc ret = cell_selector.pop();
if (ret.is_error()) {
rrc_log->error("Cell Reselection - Error while selecting a cell\n");
return srslte::proc_outcome_t::error;
} else {
switch (ret.get_cs_result()) {
case cs_result_t::changed_cell:
// New cell has been selected, start receiving PCCH
mac->pcch_start_rx();
break;
case cs_result_t::no_cell:
rrc_log->warning("Could not find any cell to camp on\n");
break;
case cs_result_t::same_cell:
if (!phy->cell_is_camping()) {
rrc_log->warning("Did not reselect cell but serving cell is out-of-sync.\n");
serving_cell->in_sync = false;
}
break;
}
}
rrc_log->info("Cell Reselection - Finished successfully\n");
return srslte::proc_outcome_t::success;
});
if (not cell_reselector.launch(this)) {
rrc_log->error("Failed to initiate a Cell Reselection procedure...\n");
}
callback_list.defer_proc(cell_reselector);
}
void rrc::cell_search_completed(const phy_interface_rrc_lte::cell_search_ret_t& cs_ret,

View File

@ -826,4 +826,51 @@ proc_outcome_t rrc::go_idle_proc::step()
return proc_outcome_t::yield;
}
/**************************************
* Cell Reselection procedure
*************************************/
proc_outcome_t rrc::cell_reselection_proc::init(srsue::rrc* rrc_)
{
rrc_ptr = rrc_;
Info("Cell Reselection - Starting...\n");
if (not rrc_ptr->cell_selector.launch(rrc_ptr)) {
Error("Failed to initiate a Cell Selection procedure...\n");
return proc_outcome_t::error;
}
return proc_outcome_t::yield;
}
proc_outcome_t rrc::cell_reselection_proc::step()
{
if (rrc_ptr->cell_selector.run()) {
return srslte::proc_outcome_t::yield;
}
cell_selection_proc ret = rrc_ptr->cell_selector.pop();
if (ret.is_error()) {
Error("Cell Reselection - Error while selecting a cell\n");
return srslte::proc_outcome_t::error;
}
switch (ret.get_cs_result()) {
case cs_result_t::changed_cell:
// New cell has been selected, start receiving PCCH
rrc_ptr->mac->pcch_start_rx();
break;
case cs_result_t::no_cell:
Warning("Could not find any cell to camp on\n");
break;
case cs_result_t::same_cell:
if (!rrc_ptr->phy->cell_is_camping()) {
Warning("Did not reselect cell but serving cell is out-of-sync.\n");
rrc_ptr->serving_cell->in_sync = false;
}
break;
}
Info("Cell Reselection - Finished successfully\n");
return srslte::proc_outcome_t::success;
}
} // namespace srsue