diff --git a/srsue/hdr/upper/rrc.h b/srsue/hdr/upper/rrc.h index 1e099351d..fb89fbbe9 100644 --- a/srsue/hdr/upper/rrc.h +++ b/srsue/hdr/upper/rrc.h @@ -564,7 +564,13 @@ private: float get_srxlev(float Qrxlevmeas); float get_squal(float Qqualmeas); - bool cell_selection(); + typedef enum { + CHANGED_CELL = 0, + SAME_CELL = 1, + NO_CELL = 2 + } cs_ret_t; + + cs_ret_t cell_selection(); bool cell_selection_criteria(float rsrp, float rsrq = 0); void cell_reselection(float rsrp, float rsrq); diff --git a/srsue/src/upper/gw.cc b/srsue/src/upper/gw.cc index c4b482b92..4c3cf6301 100644 --- a/srsue/src/upper/gw.cc +++ b/srsue/src/upper/gw.cc @@ -280,8 +280,7 @@ void gw::run_thread() if (!attach_wait) { gw_log->info("LCID=%d not active, requesting NAS attach (%d/%d)\n", cfg.lcid, attach_wait, ATTACH_WAIT_TOUT); if (!nas->attach_request()) { - gw_log->info("Could not re-establish the connection\n"); - break; + gw_log->warning("Could not re-establish the connection\n"); } } usleep(100000); diff --git a/srsue/src/upper/nas.cc b/srsue/src/upper/nas.cc index ad8ae39a8..d6b347977 100644 --- a/srsue/src/upper/nas.cc +++ b/srsue/src/upper/nas.cc @@ -138,7 +138,7 @@ bool nas::attach_request() { nas_log->info("NAS attached successfully.\n"); return true; } else { - nas_log->error("Could not attach\n"); + nas_log->error("Could not attach in attach request\n"); } } else { nas_log->error("PLMN is not selected because no suitable PLMN was found\n"); @@ -154,7 +154,7 @@ bool nas::attach_request() { nas_log->info("NAS attached successfully.\n"); return true; } else { - nas_log->error("Could not attach\n"); + nas_log->error("Could not attach from attach_request\n"); } } break; @@ -181,7 +181,7 @@ void nas::paging(LIBLTE_RRC_S_TMSI_STRUCT *ue_identiy) { if (rrc_connect()) { nas_log->info("Attached successfully\n"); } else { - nas_log->error("Could not attach\n"); + nas_log->error("Could not attach from paging\n"); } } else { nas_log->warning("Received paging while in state %s\n", emm_state_text[state]); diff --git a/srsue/src/upper/rrc.cc b/srsue/src/upper/rrc.cc index 773a46a53..59b1b04a0 100644 --- a/srsue/src/upper/rrc.cc +++ b/srsue/src/upper/rrc.cc @@ -220,11 +220,16 @@ 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()) { - // 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"); + switch(cell_selection()) { + case rrc::CHANGED_CELL: + // New cell has been selected, start receiving PCCH + mac->pcch_start_rx(); + break; + case rrc::NO_CELL: + rrc_log->warning("Could not find any cell to camp on\n"); + break; + case rrc::SAME_CELL: + break; } } break; @@ -768,7 +773,7 @@ phy_interface_rrc::cell_search_ret_t rrc::cell_search() /* Cell selection procedure 36.304 5.2.3 * Select the best cell to camp on among the list of known cells */ -bool rrc::cell_selection() +rrc::cs_ret_t rrc::cell_selection() { // Neighbour cells are sorted in descending order of RSRP for (uint32_t i = 0; i < neighbour_cells.size(); i++) { @@ -791,7 +796,7 @@ bool rrc::cell_selection() if (phy->cell_select(&serving_cell->phy_cell)) { if (configure_serving_cell()) { rrc_log->info("Selected and configured cell successfully\n"); - return true; + return CHANGED_CELL; } else { rrc_log->error("While configuring serving cell\n"); } @@ -803,14 +808,14 @@ bool rrc::cell_selection() } } if (serving_cell->in_sync) { - return true; + return SAME_CELL; } // 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; + return (ret.found == phy_interface_rrc::cell_search_ret_t::CELL_FOUND)?CHANGED_CELL:NO_CELL; } // Cell selection criteria Section 5.2.3.2 of 36.304