Commit e930c7c7 authored by francescomani's avatar francescomani

handling of T300

parent 1d042eab
...@@ -167,6 +167,7 @@ typedef enum { ...@@ -167,6 +167,7 @@ typedef enum {
typedef enum { typedef enum {
GO_TO_IDLE, GO_TO_IDLE,
T300_EXPIRY,
RE_ESTABLISHMENT RE_ESTABLISHMENT
} NR_UE_MAC_reset_cause_t; } NR_UE_MAC_reset_cause_t;
......
...@@ -143,7 +143,7 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, ...@@ -143,7 +143,7 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc,
rnti_t rnti, rnti_t rnti,
rrcPerNB_t *rrcNB, rrcPerNB_t *rrcNB,
NR_RadioBearerConfig_t *const radioBearerConfig); NR_RadioBearerConfig_t *const radioBearerConfig);
static void nr_rrc_ue_generate_RRCSetupRequest(rnti_t rnti); static void nr_rrc_ue_generate_RRCSetupRequest(NR_UE_RRC_INST_t *rrc, rnti_t rnti);
static void nr_rrc_ue_generate_rrcReestablishmentComplete(NR_RRCReestablishment_t *rrcReestablishment); static void nr_rrc_ue_generate_rrcReestablishmentComplete(NR_RRCReestablishment_t *rrcReestablishment);
static void process_lte_nsa_msg(NR_UE_RRC_INST_t *rrc, nsa_msg_t *msg, int msg_len); static void process_lte_nsa_msg(NR_UE_RRC_INST_t *rrc, nsa_msg_t *msg, int msg_len);
static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance,
...@@ -575,12 +575,12 @@ static int nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si) ...@@ -575,12 +575,12 @@ static int nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si)
return 0; return 0;
} }
void nr_rrc_ue_generate_ra_msg(instance_t instance, RA_trigger_t trigger, rnti_t rnti) void nr_rrc_ue_generate_ra_msg(NR_UE_RRC_INST_t *rrc, RA_trigger_t trigger, rnti_t rnti)
{ {
switch (trigger) { switch (trigger) {
case INITIAL_ACCESS_FROM_RRC_IDLE: case INITIAL_ACCESS_FROM_RRC_IDLE:
// After SIB1 is received, prepare RRCConnectionRequest // After SIB1 is received, prepare RRCConnectionRequest
nr_rrc_ue_generate_RRCSetupRequest(rnti); nr_rrc_ue_generate_RRCSetupRequest(rrc, rnti);
break; break;
case RRC_CONNECTION_REESTABLISHMENT: case RRC_CONNECTION_REESTABLISHMENT:
AssertFatal(1==0, "ra_trigger not implemented yet!\n"); AssertFatal(1==0, "ra_trigger not implemented yet!\n");
...@@ -609,8 +609,9 @@ void nr_rrc_ue_generate_ra_msg(instance_t instance, RA_trigger_t trigger, rnti_t ...@@ -609,8 +609,9 @@ void nr_rrc_ue_generate_ra_msg(instance_t instance, RA_trigger_t trigger, rnti_t
} }
} }
static void nr_rrc_ue_generate_RRCSetupRequest(rnti_t rnti) static void nr_rrc_ue_generate_RRCSetupRequest(NR_UE_RRC_INST_t *rrc, rnti_t rnti)
{ {
LOG_D(NR_RRC, "Generation of RRCSetupRequest\n");
uint8_t rv[6]; uint8_t rv[6];
// Get RRCConnectionRequest, fill random for now // Get RRCConnectionRequest, fill random for now
// Generate random byte stream for contention resolution // Generate random byte stream for contention resolution
...@@ -626,6 +627,10 @@ static void nr_rrc_ue_generate_RRCSetupRequest(rnti_t rnti) ...@@ -626,6 +627,10 @@ static void nr_rrc_ue_generate_RRCSetupRequest(rnti_t rnti)
uint8_t buf[1024]; uint8_t buf[1024];
int len = do_RRCSetupRequest(buf, sizeof(buf), rv); int len = do_RRCSetupRequest(buf, sizeof(buf), rv);
// start timer T300
NR_UE_Timers_Constants_t *tac = &rrc->timers_and_constants;
tac->T300_active = true;
/* convention: RNTI for SRB0 is zero, as it changes all the time */ /* convention: RNTI for SRB0 is zero, as it changes all the time */
nr_rlc_srb_recv_sdu(rnti, 0, buf, len); nr_rlc_srb_recv_sdu(rnti, 0, buf, len);
} }
...@@ -1476,7 +1481,7 @@ void *rrc_nrue(void *notUsed) ...@@ -1476,7 +1481,7 @@ void *rrc_nrue(void *notUsed)
break; break;
case NR_RRC_MAC_MSG3_IND: case NR_RRC_MAC_MSG3_IND:
nr_rrc_ue_generate_ra_msg(instance, INITIAL_ACCESS_FROM_RRC_IDLE, NR_RRC_MAC_MSG3_IND(msg_p).rnti); nr_rrc_ue_generate_ra_msg(rrc, INITIAL_ACCESS_FROM_RRC_IDLE, NR_RRC_MAC_MSG3_IND(msg_p).rnti);
break; break;
case NR_RRC_MAC_RA_IND: case NR_RRC_MAC_RA_IND:
...@@ -1981,6 +1986,15 @@ void nr_rrc_going_to_IDLE(instance_t instance, ...@@ -1981,6 +1986,15 @@ void nr_rrc_going_to_IDLE(instance_t instance,
itti_send_msg_to_task(TASK_NAS_NRUE, instance, msg_p); itti_send_msg_to_task(TASK_NAS_NRUE, instance, msg_p);
} }
void handle_t300_expiry(instance_t instance)
{
// reset MAC, release the MAC configuration
NR_UE_MAC_reset_cause_t cause = T300_EXPIRY;
nr_rrc_mac_config_req_reset(instance, cause);
// TODO handle connEstFailureControl
// TODO inform upper layers about the failure to establish the RRC connection
}
void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id) void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id)
{ {
MessageDef *message_p; MessageDef *message_p;
......
...@@ -122,6 +122,7 @@ int get_from_lte_ue_fd(); ...@@ -122,6 +122,7 @@ int get_from_lte_ue_fd();
void nr_rrc_SI_timers(NR_UE_RRC_SI_INFO *SInfo); void nr_rrc_SI_timers(NR_UE_RRC_SI_INFO *SInfo);
void nr_ue_rrc_timer_trigger(int module_id, int frame, int gnb_id); void nr_ue_rrc_timer_trigger(int module_id, int frame, int gnb_id);
void handle_t300_expiry(instance_t instance);
void reset_rlf_timers_and_constants(NR_UE_Timers_Constants_t *tac); void reset_rlf_timers_and_constants(NR_UE_Timers_Constants_t *tac);
void set_default_timers_and_constants(NR_UE_Timers_Constants_t *tac); void set_default_timers_and_constants(NR_UE_Timers_Constants_t *tac);
......
...@@ -101,7 +101,15 @@ void nr_rrc_SI_timers(NR_UE_RRC_SI_INFO *SInfo) ...@@ -101,7 +101,15 @@ void nr_rrc_SI_timers(NR_UE_RRC_SI_INFO *SInfo)
void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc, instance_t instance) void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc, instance_t instance)
{ {
NR_UE_Timers_Constants_t *timers = &rrc->timers_and_constants; NR_UE_Timers_Constants_t *timers = &rrc->timers_and_constants;
// T304
if (timers->T300_active == true) {
timers->T300_cnt += 10;
if(timers->T300_cnt >= timers->T300_k) {
timers->T300_active = false;
timers->T300_cnt = 0;
handle_t300_expiry(instance);
}
}
if (timers->T304_active == true) { if (timers->T304_active == true) {
timers->T304_cnt += 10; timers->T304_cnt += 10;
if(timers->T304_cnt >= timers->T304_k) { if(timers->T304_cnt >= timers->T304_k) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment