Commit bef00a70 authored by francescomani's avatar francescomani

removing functions to get/set RRC state (it's easier to do it directly)

parent cef099d3
......@@ -120,22 +120,6 @@ nr_rrc_ue_generate_rrcReestablishmentComplete(
mui_t nr_rrc_mui=0;
static Rrc_State_NR_t nr_rrc_get_state (module_id_t ue_mod_idP) {
return NR_UE_rrc_inst[ue_mod_idP].nrRrcState;
}
static int nr_rrc_set_state (module_id_t ue_mod_idP, Rrc_State_NR_t state) {
AssertFatal ((RRC_STATE_FIRST_NR <= state) && (state <= RRC_STATE_LAST_NR),
"Invalid state %d!\n", state);
if (NR_UE_rrc_inst[ue_mod_idP].nrRrcState != state) {
NR_UE_rrc_inst[ue_mod_idP].nrRrcState = state;
return (1);
}
return (0);
}
static void nr_rrc_addmod_srbs(int rnti,
const NR_SRB_ToAddModList_t *srb_list,
const struct NR_CellGroupConfig__rlc_BearerToAddModList *bearer_list)
......@@ -766,7 +750,8 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
const uint8_t rsrp)
{
NR_BCCH_DL_SCH_Message_t *bcch_message = NULL;
NR_UE_RRC_SI_INFO *SI_info = &NR_UE_rrc_inst[module_id].SInfo[gNB_index];
NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[module_id];
NR_UE_RRC_SI_INFO *SI_info = &rrc->SInfo[gNB_index];
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_IN);
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
......@@ -802,17 +787,16 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
LOG_A(NR_RRC, "SIB1 decoded\n");
SI_info->sib1_timer = 0;
// FIXME: improve condition for the RA trigger
if(nr_rrc_get_state(module_id) <= RRC_STATE_IDLE_NR) {
NR_UE_rrc_inst[module_id].ra_trigger = INITIAL_ACCESS_FROM_RRC_IDLE;
if(rrc->nrRrcState == RRC_STATE_IDLE_NR) {
rrc->ra_trigger = INITIAL_ACCESS_FROM_RRC_IDLE;
LOG_D(PHY,"Setting state to RRC_STATE_IDLE_NR\n");
nr_rrc_set_state(module_id, RRC_STATE_IDLE_NR);
}
// configure default SI
nr_rrc_configure_default_SI(SI_info, sib1);
// configure timers and constant
nr_rrc_set_sib1_timers_and_constants(&NR_UE_rrc_inst[module_id].timers_and_constants, sib1);
nr_rrc_set_sib1_timers_and_constants(&rrc->timers_and_constants, sib1);
// take ServingCellConfigCommon and configure L1/L2
NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon;
rrc->servingCellConfigCommonSIB = sib1->servingCellConfigCommon;
nr_rrc_mac_config_req_sib1(module_id, 0, sib1->si_SchedulingInfo, sib1->servingCellConfigCommon);
nr_rrc_ue_generate_ra_msg(module_id, gNB_index);
break;
......@@ -1019,14 +1003,15 @@ static void rrc_ue_generate_RRCSetupComplete(
nr_pdcp_data_req_srb(ctxt_pP->rntiMaybeUEid, DCCH, nr_rrc_mui++, size, buffer, deliver_pdu_srb_rlc, NULL);
}
int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB_INFO *const Srb_info, const uint8_t gNB_index ){
int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB_INFO *const Srb_info, const uint8_t gNB_index )
{
NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[ctxt_pP->module_id];
NR_DL_CCCH_Message_t *dl_ccch_msg=NULL;
asn_dec_rval_t dec_rval;
int rval=0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_IN);
LOG_D(RRC,"[NR UE%d] Decoding DL-CCCH message (%d bytes), State %d\n",ctxt_pP->module_id,Srb_info->Rx_buffer.payload_size,
NR_UE_rrc_inst[ctxt_pP->module_id].nrRrcState);
rrc->nrRrcState);
dec_rval = uper_decode(NULL,
&asn_DEF_NR_DL_CCCH_Message,
(void **)&dl_ccch_msg,
......@@ -1065,13 +1050,13 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
// Get configuration
// Release T300 timer
NR_UE_rrc_inst[ctxt_pP->module_id].timers_and_constants.T300_active = 0;
rrc->timers_and_constants.T300_active = 0;
nr_rrc_ue_process_masterCellGroup(ctxt_pP, gNB_index, &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup, NULL);
nr_rrc_ue_process_RadioBearerConfig(ctxt_pP, gNB_index, &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig);
nr_rrc_set_state(ctxt_pP->module_id, RRC_STATE_CONNECTED_NR);
NR_UE_rrc_inst[ctxt_pP->module_id].rnti = ctxt_pP->rntiMaybeUEid;
rrc_ue_generate_RRCSetupComplete(ctxt_pP, gNB_index, dl_ccch_msg->message.choice.c1->choice.rrcSetup->rrc_TransactionIdentifier, NR_UE_rrc_inst[ctxt_pP->module_id].selected_plmn_identity);
rrc->nrRrcState = RRC_STATE_CONNECTED_NR;
rrc->rnti = ctxt_pP->rntiMaybeUEid;
rrc_ue_generate_RRCSetupComplete(ctxt_pP, gNB_index, dl_ccch_msg->message.choice.c1->choice.rrcSetup->rrc_TransactionIdentifier, rrc->selected_plmn_identity);
rval = 0;
break;
......@@ -2107,7 +2092,7 @@ void *rrc_nrue_task(void *args_p)
LOG_E(NR_RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
break;
}
LOG_D(NR_RRC, "[UE %d] RRC Status %d\n", ue_mod_id, nr_rrc_get_state(ue_mod_id));
LOG_D(NR_RRC, "[UE %d] RRC Status %d\n", ue_mod_id, NR_UE_rrc_inst[ue_mod_id].nrRrcState);
result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
msg_p = NULL;
......
......@@ -80,7 +80,7 @@ typedef struct OAI_NR_UECapability_s {
} OAI_NR_UECapability_t;
typedef enum Rrc_State_NR_e {
RRC_STATE_IDLE_NR=0,
RRC_STATE_IDLE_NR = 0,
RRC_STATE_INACTIVE_NR,
RRC_STATE_CONNECTED_NR,
......
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