Do sell reselection on IDLE by phch_recv thread instead of worker

master
Ismael Gomez 7 years ago
parent 650f433532
commit 91664ef2be

@ -582,7 +582,7 @@ public:
virtual void cell_search_start() = 0;
virtual void cell_search_stop() = 0;
virtual void cell_search_next() = 0;
virtual bool cell_select(uint32_t earfcn, srslte_cell_t cell) = 0;
virtual void cell_select(uint32_t earfcn, srslte_cell_t cell) = 0;
virtual bool cell_handover(srslte_cell_t cell) = 0;
/* Is the PHY downlink synchronized? */

@ -63,7 +63,7 @@ public:
void cell_search_start();
void cell_search_stop();
void cell_search_next(bool reset = false);
bool cell_select(uint32_t earfcn, srslte_cell_t cell);
void cell_select(uint32_t earfcn, srslte_cell_t cell);
bool cell_handover(srslte_cell_t cell);
void meas_reset();
@ -103,6 +103,10 @@ private:
bool set_cell();
void cell_search_inc();
void cell_reselect();
uint32_t new_earfcn;
srslte_cell_t new_cell;
bool running;
@ -299,6 +303,7 @@ private:
IDLE = 0,
CELL_SEARCH,
CELL_SELECT,
CELL_RESELECT,
CELL_MEASURE,
CELL_CAMP,
} phy_state;

@ -87,7 +87,7 @@ public:
void cell_search_start();
void cell_search_stop();
void cell_search_next();
bool cell_select(uint32_t earfcn, srslte_cell_t phy_cell);
void cell_select(uint32_t earfcn, srslte_cell_t phy_cell);
bool cell_handover(srslte_cell_t cell);
void meas_reset();

@ -361,9 +361,21 @@ bool phch_recv::cell_handover(srslte_cell_t cell)
return ret;
}
bool phch_recv::cell_select(uint32_t earfcn, srslte_cell_t cell) {
/* interface from higher layers to select a new cell */
void phch_recv::cell_select(uint32_t earfcn, srslte_cell_t cell) {
// Check if we are already camping in this cell
new_earfcn = earfcn;
new_cell = cell;
phy_state = CELL_RESELECT;
}
/* Perform cell (re)-selection on IDLE or CAMP */
void phch_recv::cell_reselect()
{
uint32_t earfcn = new_earfcn;
srslte_cell_t cell = new_cell;
// If we are already in the new cell, just resynchronize
if (earfcn == current_earfcn && this->cell.id == cell.id) {
log_h->info("Cell Select: Already in cell EARFCN=%d\n", earfcn);
cell_search_in_progress = false;
@ -371,15 +383,14 @@ bool phch_recv::cell_select(uint32_t earfcn, srslte_cell_t cell) {
set_sampling_rate();
}
phy_state = CELL_SELECT;
return true;
} else {
/* If we are going to a new cell, configure it */
cell_search_in_progress = false;
if (earfcn != current_earfcn) {
if (set_frequency()) {
log_h->error("Cell Select: Configuring cell in EARFCN=%d, PCI=%d\n", earfcn, cell.id);
return false;
}
current_earfcn = earfcn;
}
@ -390,9 +401,7 @@ bool phch_recv::cell_select(uint32_t earfcn, srslte_cell_t cell) {
if (set_cell()) {
log_h->info("Cell Select: Synchronizing on cell...\n");
phy_state = CELL_SELECT;
return true;
}
return false;
}
}
@ -559,6 +568,9 @@ void phch_recv::run_thread()
}
}
break;
case CELL_RESELECT:
cell_reselect();
break;
case CELL_SELECT:
switch (sfn_p.run_subframe(&cell, &tti))
{

@ -282,9 +282,9 @@ int phy::meas_stop(uint32_t earfcn, int pci) {
return sf_recv.meas_stop(earfcn, pci);
}
bool phy::cell_select(uint32_t earfcn, srslte_cell_t phy_cell)
void phy::cell_select(uint32_t earfcn, srslte_cell_t phy_cell)
{
return sf_recv.cell_select(earfcn, phy_cell);
sf_recv.cell_select(earfcn, phy_cell);
}
bool phy::cell_handover(srslte_cell_t cell) {

@ -525,20 +525,14 @@ void rrc::select_next_cell_in_plmn() {
neighbour_cells[i]->in_sync) // matches S criteria
{
// Try to select Cell
if (phy->cell_select(neighbour_cells[i]->get_earfcn(), neighbour_cells[i]->phy_cell)) {
set_serving_cell(i);
rrc_log->info("Selected cell PCI=%d, EARFCN=%d, Cell ID=0x%x\n",
serving_cell->phy_cell.id, serving_cell->get_earfcn(),
serving_cell->get_cell_id());
rrc_log->console("Selected cell PCI=%d, EARFCN=%d, Cell ID=0x%x\n",
serving_cell->phy_cell.id, serving_cell->get_earfcn(),
serving_cell->get_cell_id());
} else {
// Set to out-of-sync if can't synchronize
neighbour_cells[i]->in_sync = false;
rrc_log->warning("Selecting cell EARFCN=%d, Cell ID=0x%x.\n",
neighbour_cells[i]->get_earfcn(), neighbour_cells[i]->get_cell_id());
}
phy->cell_select(neighbour_cells[i]->get_earfcn(), neighbour_cells[i]->phy_cell);
set_serving_cell(i);
rrc_log->info("Selected cell PCI=%d, EARFCN=%d, Cell ID=0x%x\n",
serving_cell->phy_cell.id, serving_cell->get_earfcn(),
serving_cell->get_cell_id());
rrc_log->console("Selected cell PCI=%d, EARFCN=%d, Cell ID=0x%x\n",
serving_cell->phy_cell.id, serving_cell->get_earfcn(),
serving_cell->get_cell_id());
return;
}
}

Loading…
Cancel
Save