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

@ -242,6 +242,7 @@ bool nas::rrc_connect() {
} }
} else { } else {
nas_log->error("Could not establish RRC connection\n"); nas_log->error("Could not establish RRC connection\n");
pool->deallocate(dedicatedInfoNAS);
} }
return false; 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 attached but not camping on the cell, perform cell reselection
if (nas->is_attached()) { if (nas->is_attached()) {
rrc_log->debug("Running cell selection and reselection in IDLE\n"); rrc_log->debug("Running cell selection and reselection in IDLE\n");
if (!cell_selection()) { 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 {
// New cell has been selected, start receiving PCCH // New cell has been selected, start receiving PCCH
mac->pcch_start_rx(); mac->pcch_start_rx();
} else {
rrc_log->warning("Could not find any cell to camp on\n");
} }
} }
break; break;
@ -780,14 +770,12 @@ phy_interface_rrc::cell_search_ret_t rrc::cell_search()
*/ */
bool rrc::cell_selection() bool rrc::cell_selection()
{ {
int candidates = 0;
// Neighbour cells are sorted in descending order of RSRP // Neighbour cells are sorted in descending order of RSRP
for (uint32_t i = 0; i < neighbour_cells.size(); i++) { 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 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]->plmn_equals(selected_plmn_id) && */
neighbour_cells[i]->in_sync) // matches S criteria neighbour_cells[i]->in_sync) // matches S criteria
{ {
candidates++;
// If currently connected, verify cell selection criteria // If currently connected, verify cell selection criteria
if (!serving_cell->in_sync || if (!serving_cell->in_sync ||
(cell_selection_criteria(neighbour_cells[i]->get_rsrp()) && (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 // Cell selection criteria Section 5.2.3.2 of 36.304

Loading…
Cancel
Save