|
|
@ -35,8 +35,6 @@
|
|
|
|
#include "srslte/common/security.h"
|
|
|
|
#include "srslte/common/security.h"
|
|
|
|
#include "srslte/common/bcd_helpers.h"
|
|
|
|
#include "srslte/common/bcd_helpers.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define TIMEOUT_RESYNC_REESTABLISH 100
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using namespace srslte;
|
|
|
|
using namespace srslte;
|
|
|
|
|
|
|
|
|
|
|
|
namespace srsue {
|
|
|
|
namespace srsue {
|
|
|
@ -92,6 +90,8 @@ void rrc::init(phy_interface_rrc *phy_,
|
|
|
|
|
|
|
|
|
|
|
|
pthread_mutex_init(&mutex, NULL);
|
|
|
|
pthread_mutex_init(&mutex, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reestablishment_in_progress = false;
|
|
|
|
|
|
|
|
|
|
|
|
ue_category = SRSLTE_UE_CATEGORY;
|
|
|
|
ue_category = SRSLTE_UE_CATEGORY;
|
|
|
|
t301 = mac_timers->timer_get_unique_id();
|
|
|
|
t301 = mac_timers->timer_get_unique_id();
|
|
|
|
t310 = mac_timers->timer_get_unique_id();
|
|
|
|
t310 = mac_timers->timer_get_unique_id();
|
|
|
@ -207,7 +207,11 @@ void rrc::run_thread() {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case RRC_STATE_CELL_SELECTED:
|
|
|
|
case RRC_STATE_CELL_SELECTED:
|
|
|
|
rrc_log->info("RRC Cell Selected: Sending connection request...\n");
|
|
|
|
rrc_log->info("RRC Cell Selected: Sending connection request...\n");
|
|
|
|
|
|
|
|
if (reestablishment_in_progress) {
|
|
|
|
|
|
|
|
con_restablish_cell_reselected();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
send_con_request();
|
|
|
|
send_con_request();
|
|
|
|
|
|
|
|
}
|
|
|
|
state = RRC_STATE_CONNECTING;
|
|
|
|
state = RRC_STATE_CONNECTING;
|
|
|
|
connecting_timeout = 0;
|
|
|
|
connecting_timeout = 0;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -226,6 +230,7 @@ void rrc::run_thread() {
|
|
|
|
usleep(60000);
|
|
|
|
usleep(60000);
|
|
|
|
rrc_log->info("Leaving RRC_CONNECTED state\n");
|
|
|
|
rrc_log->info("Leaving RRC_CONNECTED state\n");
|
|
|
|
drb_up = false;
|
|
|
|
drb_up = false;
|
|
|
|
|
|
|
|
reestablishment_in_progress = false;
|
|
|
|
pdcp->reset();
|
|
|
|
pdcp->reset();
|
|
|
|
rlc->reset();
|
|
|
|
rlc->reset();
|
|
|
|
phy->reset();
|
|
|
|
phy->reset();
|
|
|
@ -663,6 +668,8 @@ void rrc::send_con_restablish_request() {
|
|
|
|
ul_ccch_msg.msg.rrc_con_reest_req.cause = LIBLTE_RRC_CON_REEST_REQ_CAUSE_OTHER_FAILURE;
|
|
|
|
ul_ccch_msg.msg.rrc_con_reest_req.cause = LIBLTE_RRC_CON_REEST_REQ_CAUSE_OTHER_FAILURE;
|
|
|
|
liblte_rrc_pack_ul_ccch_msg(&ul_ccch_msg, (LIBLTE_BIT_MSG_STRUCT *) &bit_buf);
|
|
|
|
liblte_rrc_pack_ul_ccch_msg(&ul_ccch_msg, (LIBLTE_BIT_MSG_STRUCT *) &bit_buf);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reestablishment_in_progress = true;
|
|
|
|
|
|
|
|
|
|
|
|
rrc_log->info("Initiating RRC Connection Reestablishment Procedure\n");
|
|
|
|
rrc_log->info("Initiating RRC Connection Reestablishment Procedure\n");
|
|
|
|
rrc_log->console("RRC Connection Reestablishment\n");
|
|
|
|
rrc_log->console("RRC Connection Reestablishment\n");
|
|
|
|
mac_timers->timer_get(t310)->stop();
|
|
|
|
mac_timers->timer_get(t310)->stop();
|
|
|
@ -673,19 +680,16 @@ void rrc::send_con_restablish_request() {
|
|
|
|
set_phy_default();
|
|
|
|
set_phy_default();
|
|
|
|
mac->reset();
|
|
|
|
mac->reset();
|
|
|
|
set_mac_default();
|
|
|
|
set_mac_default();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: Cell selection should be different??
|
|
|
|
// Actions following cell reselection 5.3.7.3
|
|
|
|
|
|
|
|
void rrc::con_restablish_cell_reselected()
|
|
|
|
// Wait for cell re-synchronization
|
|
|
|
{
|
|
|
|
uint32_t timeout_cnt = 0;
|
|
|
|
reestablishment_in_progress = false;
|
|
|
|
while (!phy->sync_status() && timeout_cnt < TIMEOUT_RESYNC_REESTABLISH) {
|
|
|
|
rrc_log->info("Cell Selection finished. Initiating transmission of RRC Connection Reestablishment Request\n");
|
|
|
|
usleep(10000);
|
|
|
|
|
|
|
|
timeout_cnt++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mac_timers->timer_get(t301)->reset();
|
|
|
|
mac_timers->timer_get(t301)->reset();
|
|
|
|
mac_timers->timer_get(t301)->run();
|
|
|
|
mac_timers->timer_get(t301)->run();
|
|
|
|
mac_timers->timer_get(t311)->stop();
|
|
|
|
mac_timers->timer_get(t311)->stop();
|
|
|
|
rrc_log->info("Cell Selection finished. Initiating transmission of RRC Connection Reestablishment Request\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Byte align and pack the message bits for PDCP
|
|
|
|
// Byte align and pack the message bits for PDCP
|
|
|
|
if ((bit_buf.N_bits % 8) != 0) {
|
|
|
|
if ((bit_buf.N_bits % 8) != 0) {
|
|
|
|