Fix UE blocking on Reestablishment when Overflow

master
Ismael Gomez 7 years ago
parent 49c0455b4a
commit 28dc194e2f

@ -257,19 +257,21 @@ phy_interface_rrc::cell_search_ret_t phch_recv::cell_search(phy_interface_rrc::p
bool phch_recv::cell_select(phy_interface_rrc::phy_cell_t *new_cell) {
pthread_mutex_lock(&rrc_mutex);
bool ret = false;
int cnt = 0;
// Move state to IDLE
if (!new_cell) {
Info("Cell Select: Starting cell resynchronization\n");
} else {
if (!srslte_cell_isvalid(&cell)) {
log_h->error("Cell Select: Invalid cell. ID=%d, PRB=%d, ports=%d\n", cell.id, cell.nof_prb, cell.nof_ports);
return false;
goto unlock;
}
Info("Cell Select: Starting cell selection for PCI=%d, EARFCN=%d\n", new_cell->cell.id, new_cell->earfcn);
}
// Wait for any pending PHICH
int cnt = 0;
while(worker_com->is_any_pending_ack() && cnt < 10) {
usleep(1000);
cnt++;
@ -296,7 +298,7 @@ bool phch_recv::cell_select(phy_interface_rrc::phy_cell_t *new_cell) {
cell = new_cell->cell;
if (!set_cell()) {
Error("Cell Select: Reconfiguring cell\n");
return false;
goto unlock;
}
}
@ -305,7 +307,7 @@ bool phch_recv::cell_select(phy_interface_rrc::phy_cell_t *new_cell) {
Info("Cell Select: Setting new frequency EARFCN=%d\n", new_cell->earfcn);
if (set_frequency()) {
Error("Cell Select: Setting new frequency EARFCN=%d\n", new_cell->earfcn);
return false;
goto unlock;
}
current_earfcn = new_cell->earfcn;
}
@ -318,7 +320,6 @@ bool phch_recv::cell_select(phy_interface_rrc::phy_cell_t *new_cell) {
}
/* SFN synchronization */
bool ret = false;
phy_state.run_sfn_sync();
if (phy_state.is_camping()) {
Info("Cell Select: SFN synchronized. CAMPING...\n");
@ -327,6 +328,7 @@ bool phch_recv::cell_select(phy_interface_rrc::phy_cell_t *new_cell) {
Info("Cell Select: Could not synchronize SFN\n");
}
unlock:
pthread_mutex_unlock(&rrc_mutex);
return ret;
}

@ -242,6 +242,7 @@ bool nas::rrc_connect() {
}
} else {
nas_log->error("Could not establish RRC connection\n");
pool->deallocate(dedicatedInfoNAS);
}
return false;
}

@ -220,21 +220,11 @@ void rrc::run_tti(uint32_t tti) {
// If attached but not camping on the cell, perform cell reselection
if (nas->is_attached()) {
rrc_log->debug("Running cell selection and reselection in IDLE\n");
if (!cell_selection()) {
if (!serving_cell->in_sync) {
rrc_log->info("Cell selection and reselection in IDLE did not find any suitable cell. Searching again\n");
// If can not camp on any cell, search again for new cells
phy_interface_rrc::cell_search_ret_t ret = cell_search();
// TODO: Should not camp on it until we have checked is a valid PLMN
if (ret.found == phy_interface_rrc::cell_search_ret_t::CELL_FOUND) {
// New cell has been selected, start receiving PCCH
mac->pcch_start_rx();
}
}
} else {
if (cell_selection()) {
// New cell has been selected, start receiving PCCH
mac->pcch_start_rx();
} else {
rrc_log->warning("Could not find any cell to camp on\n");
}
}
break;
@ -780,14 +770,12 @@ phy_interface_rrc::cell_search_ret_t rrc::cell_search()
*/
bool rrc::cell_selection()
{
int candidates = 0;
// Neighbour cells are sorted in descending order of RSRP
for (uint32_t i = 0; i < neighbour_cells.size(); i++) {
if (/*TODO: CHECK that PLMN matches. Currently we don't receive SIB1 of neighbour cells
* neighbour_cells[i]->plmn_equals(selected_plmn_id) && */
neighbour_cells[i]->in_sync) // matches S criteria
{
candidates++;
// If currently connected, verify cell selection criteria
if (!serving_cell->in_sync ||
(cell_selection_criteria(neighbour_cells[i]->get_rsrp()) &&
@ -814,7 +802,15 @@ bool rrc::cell_selection()
}
}
}
return false;
if (serving_cell->in_sync) {
return true;
}
// If can not find any suitable cell, search again
rrc_log->info("Cell selection and reselection in IDLE did not find any suitable cell. Searching again\n");
// If can not camp on any cell, search again for new cells
phy_interface_rrc::cell_search_ret_t ret = cell_search();
return ret.found == phy_interface_rrc::cell_search_ret_t::CELL_FOUND;
}
// Cell selection criteria Section 5.2.3.2 of 36.304

Loading…
Cancel
Save