Commit 2cf4ee08 authored by francescomani's avatar francescomani Committed by Laurent THOMAS

MR2526 prepare MSG3 in advance at RRC UE to be sure it is always ready when requested by MAC

parent aa096ee8
......@@ -488,7 +488,6 @@ void nr_Msg1_transmitted(module_id_t mod_id);
void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, slot_t slotP, uint8_t gNB_id);
void nr_get_msg3_payload(module_id_t mod_id, uint8_t *buf, int TBS_max);
void send_msg3_rrc_request(module_id_t mod_id, int rnti);
void nr_ue_msg2_scheduler(module_id_t mod_id, uint16_t rach_frame, uint16_t rach_slot, uint16_t *msg2_frame, uint16_t *msg2_slot);
......
......@@ -53,12 +53,6 @@ void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data
itti_send_msg_to_task(TASK_RRC_NRUE, ue_id, message_p);
}
void send_msg3_rrc_request(module_id_t mod_id, int rnti)
{
nr_rlc_activate_srb0(mod_id, NULL, send_srb0_rrc);
nr_mac_rrc_msg3_ind(mod_id, rnti);
}
void nr_ue_init_mac(module_id_t module_idP)
{
LOG_I(NR_MAC, "[UE%d] Applying default macMainConfig\n", module_idP);
......@@ -131,6 +125,10 @@ NR_UE_MAC_INST_t *nr_l2_init_ue(int nb_inst)
int rc = rlc_module_init(0);
AssertFatal(rc == 0, "Could not initialize RLC layer\n");
for (int j = 0; j < nb_inst; j++) {
nr_rlc_activate_srb0(j, NULL, send_srb0_rrc);
}
return (nr_ue_mac_inst);
}
......
......@@ -4237,7 +4237,7 @@ static void nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id)
if (!ra->cfra) {
ra->t_crnti = rar->TCRNTI_2 + (rar->TCRNTI_1 << 8);
rnti = ra->t_crnti;
send_msg3_rrc_request(mod_id, rnti);
nr_mac_rrc_msg3_ind(mod_id, rnti);
}
fapi_nr_ul_config_request_pdu_t *pdu = lockGet_ul_config(mac, frame_tx, slot_tx, FAPI_NR_UL_CONFIG_TYPE_PUSCH);
if (!pdu)
......
......@@ -141,7 +141,6 @@ static void nr_rrc_manage_rlc_bearers(const NR_UE_RRC_INST_t *rrc,
static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc,
rrcPerNB_t *rrcNB,
NR_RadioBearerConfig_t *const radioBearerConfig);
static void nr_rrc_ue_generate_RRCSetupRequest(NR_UE_RRC_INST_t *rrc);
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 nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc,
......@@ -309,7 +308,7 @@ NR_UE_RRC_INST_t* nr_rrc_init_ue(char* uecap_file, int nb_inst)
rrc->dl_bwp_id = 0;
rrc->ul_bwp_id = 0;
rrc->as_security_activated = false;
rrc->ra_trigger = RA_NOT_RUNNING;
rrc->uecap_file = uecap_file;
for (int i = 0; i < NB_CNX_UE; i++) {
......@@ -566,13 +565,15 @@ static int nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si)
return 0;
}
static void nr_rrc_ue_generate_ra_msg(NR_UE_RRC_INST_t *rrc, RA_trigger_t trigger, rnti_t rnti)
static void nr_rrc_handle_msg3_indication(NR_UE_RRC_INST_t *rrc, int rnti)
{
switch (trigger) {
switch (rrc->ra_trigger) {
case INITIAL_ACCESS_FROM_RRC_IDLE:
// After SIB1 is received, prepare RRCConnectionRequest
rrc->rnti = rnti;
nr_rrc_ue_generate_RRCSetupRequest(rrc);
// start timer T300
NR_UE_Timers_Constants_t *tac = &rrc->timers_and_constants;
tac->T300_active = true;
break;
case RRC_CONNECTION_REESTABLISHMENT:
AssertFatal(1==0, "ra_trigger not implemented yet!\n");
......@@ -601,7 +602,7 @@ static void nr_rrc_ue_generate_ra_msg(NR_UE_RRC_INST_t *rrc, RA_trigger_t trigge
}
}
static void nr_rrc_ue_generate_RRCSetupRequest(NR_UE_RRC_INST_t *rrc)
static void nr_rrc_ue_prepare_RRCSetupRequest(NR_UE_RRC_INST_t *rrc)
{
LOG_D(NR_RRC, "Generation of RRCSetupRequest\n");
uint8_t rv[6];
......@@ -619,11 +620,6 @@ static void nr_rrc_ue_generate_RRCSetupRequest(NR_UE_RRC_INST_t *rrc)
uint8_t buf[1024];
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 */
nr_rlc_srb_recv_sdu(rrc->ue_id, 0, buf, len);
}
......@@ -687,9 +683,10 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(NR_UE_RRC_INST_t *rrc,
xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void *) SI_info->sib1);
LOG_A(NR_RRC, "SIB1 decoded\n");
SI_info->sib1_timer = 0;
// FIXME: improve condition for the RA trigger
if (rrc->nrRrcState == RRC_STATE_IDLE_NR) {
LOG_D(PHY,"Setting state to RRC_STATE_IDLE_NR\n");
rrc->ra_trigger = INITIAL_ACCESS_FROM_RRC_IDLE;
// preparing RRC setup request payload in advance
nr_rrc_ue_prepare_RRCSetupRequest(rrc);
}
// configure default SI
nr_rrc_configure_default_SI(SI_info, sib1);
......@@ -1440,7 +1437,7 @@ void *rrc_nrue(void *notUsed)
break;
case NR_RRC_MAC_MSG3_IND:
nr_rrc_ue_generate_ra_msg(rrc, INITIAL_ACCESS_FROM_RRC_IDLE, NR_RRC_MAC_MSG3_IND(msg_p).rnti);
nr_rrc_handle_msg3_indication(rrc, NR_RRC_MAC_MSG3_IND(msg_p).rnti);
break;
case NR_RRC_MAC_RA_IND:
......
......@@ -213,9 +213,8 @@ typedef struct NR_UE_RRC_INST_s {
OAI_NR_UECapability_t UECap;
NR_UE_Timers_Constants_t timers_and_constants;
plmn_t plmnID;
// NR_MIB_t *mib;
RA_trigger_t ra_trigger;
plmn_t plmnID;
NR_BWP_Id_t dl_bwp_id;
NR_BWP_Id_t ul_bwp_id;
......
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