Commit d156a790 authored by Raymond Knopp's avatar Raymond Knopp

added call to NAS for RRCSetupComplete message in UE. other minor modification...

added call to NAS for RRCSetupComplete message in UE. other minor modification in gNB/UE scheduling for SA
parent 2b81ed75
...@@ -721,9 +721,11 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr ...@@ -721,9 +721,11 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
} }
/* PDSCH_TO_HARQ_FEEDBACK_TIME_IND (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI)*/ /* PDSCH_TO_HARQ_FEEDBACK_TIME_IND (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI)*/
if (mac->cg) { if (mac->cg && mac->ULbwp[mac->UL_BWP_Id-1]->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK
dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind = mac->ULbwp[mac->UL_BWP_Id-1]->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0]; dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind = mac->ULbwp[mac->UL_BWP_Id-1]->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0];
} else // take direct offset for format 1_0
dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind = dci->pdsch_to_harq_feedback_timing_indicator.val;
LOG_D(MAC,"(nr_ue_procedures.c) rnti = %x dl_config->number_pdus = %d\n", LOG_D(MAC,"(nr_ue_procedures.c) rnti = %x dl_config->number_pdus = %d\n",
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti, dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti,
dl_config->number_pdus); dl_config->number_pdus);
......
...@@ -1377,7 +1377,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1377,7 +1377,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
dci_payload.pdsch_to_harq_feedback_timing_indicator.val = sched_ctrl->sched_pucch->timing_indicator; dci_payload.pdsch_to_harq_feedback_timing_indicator.val = sched_ctrl->sched_pucch->timing_indicator;
LOG_D(NR_MAC, LOG_D(NR_MAC,
"[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d \n", "[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d pucchres %d harqtiming %d\n",
dci_payload.frequency_domain_assignment.val, dci_payload.frequency_domain_assignment.val,
pdsch_pdu_rel15->rbStart, pdsch_pdu_rel15->rbStart,
pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbSize,
...@@ -1385,7 +1385,9 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1385,7 +1385,9 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
dci_payload.time_domain_assignment.val, dci_payload.time_domain_assignment.val,
dci_payload.vrb_to_prb_mapping.val, dci_payload.vrb_to_prb_mapping.val,
dci_payload.mcs, dci_payload.mcs,
dci_payload.tb_scaling); dci_payload.tb_scaling,
dci_payload.pucch_resource_indicator,
dci_payload.pdsch_to_harq_feedback_timing_indicator.val);
LOG_D(NR_MAC, LOG_D(NR_MAC,
"[RAPROC] DCI params: rnti 0x%x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n", "[RAPROC] DCI params: rnti 0x%x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n",
......
...@@ -383,8 +383,12 @@ bool allocate_retransmission(module_id_t module_id, ...@@ -383,8 +383,12 @@ bool allocate_retransmission(module_id_t module_id,
int current_harq_pid){ int current_harq_pid){
NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[module_id]->UE_info.UE_sched_ctrl[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[module_id]->UE_info.UE_sched_ctrl[UE_id];
NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid]; NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid];
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); NR_BWP_t *genericParameters = sched_ctrl->active_bwp ?
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); &sched_ctrl->active_bwp->bwp_Common->genericParameters :
&RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
int rbStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
sched_ctrl->time_domain_allocation = retInfo->time_domain_allocation; sched_ctrl->time_domain_allocation = retInfo->time_domain_allocation;
......
...@@ -135,7 +135,7 @@ void nr_schedule_pucch(int Mod_idP, ...@@ -135,7 +135,7 @@ void nr_schedule_pucch(int Mod_idP,
|| frameP != curr_pucch->frame || frameP != curr_pucch->frame
|| slotP != curr_pucch->ul_slot) || slotP != curr_pucch->ul_slot)
continue; continue;
LOG_D(NR_MAC,"Scheduling PUCCH[%d] RX for UE %d in %d.%d O_ack %d\n",i,UE_id,curr_pucch->frame,curr_pucch->ul_slot,O_ack);
nr_fill_nfapi_pucch(Mod_idP, frameP, slotP, curr_pucch, UE_id); nr_fill_nfapi_pucch(Mod_idP, frameP, slotP, curr_pucch, UE_id);
memset(curr_pucch, 0, sizeof(*curr_pucch)); memset(curr_pucch, 0, sizeof(*curr_pucch));
} }
......
...@@ -1039,6 +1039,8 @@ void fill_initial_SpCellConfig(rnti_t rnti, ...@@ -1039,6 +1039,8 @@ void fill_initial_SpCellConfig(rnti_t rnti,
schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource)); schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource));
*schedulingRequestResourceConfig->resource = 0; *schedulingRequestResourceConfig->resource = 0;
ASN_SEQUENCE_ADD(&pucch_Config->schedulingRequestResourceToAddModList->list,schedulingRequestResourceConfig); ASN_SEQUENCE_ADD(&pucch_Config->schedulingRequestResourceToAddModList->list,schedulingRequestResourceConfig);
pucch_Config->dl_DataToUL_ACK = calloc(1,sizeof(*pucch_Config->dl_DataToUL_ACK));
} }
void fill_initial_cellGroupConfig(rnti_t rnti, void fill_initial_cellGroupConfig(rnti_t rnti,
......
...@@ -167,6 +167,7 @@ rrc_data_req_ue( ...@@ -167,6 +167,7 @@ rrc_data_req_ue(
TASK_RRC_UE, TASK_RRC_UE,
TASK_PDCP_UE, TASK_PDCP_UE,
sdu_sizeP); sdu_sizeP);
LOG_I(RRC,"Sending RRC message for SRB %d, sdu_size %d\n",rb_idP,sdu_sizeP);
memcpy (message_buffer, buffer_pP, sdu_sizeP); memcpy (message_buffer, buffer_pP, sdu_sizeP);
message_p = itti_alloc_new_message ( TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ); message_p = itti_alloc_new_message ( TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ);
RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame; RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame;
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#include "RRC/NAS/nas_config.h" #include "RRC/NAS/nas_config.h"
#include "RRC/NAS/rb_config.h" #include "RRC/NAS/rb_config.h"
#include "SIMULATION/TOOLS/sim.h" // for taus #include "SIMULATION/TOOLS/sim.h" // for taus
#include <executables/softmodem-common.h>
#if defined(ITTI_SIM) || defined(RFSIM_NAS) #if defined(ITTI_SIM) || defined(RFSIM_NAS)
#include "nr_nas_msg_sim.h" #include "nr_nas_msg_sim.h"
...@@ -1198,7 +1199,8 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message( ...@@ -1198,7 +1199,8 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(
NR_UE_rrc_inst[module_id].ra_trigger = INITIAL_ACCESS_FROM_RRC_IDLE; NR_UE_rrc_inst[module_id].ra_trigger = INITIAL_ACCESS_FROM_RRC_IDLE;
// TODO: remove flag after full RA procedures implemented // TODO: remove flag after full RA procedures implemented
// get_softmodem_params()->do_ra = 1; // get_softmodem_params()->do_ra = 1;
nr_rrc_set_state (module_id, RRC_STATE_IDLE_NR); LOG_I(PHY,"Setting state to NR_RRC_SI_RECEIVED\n");
nr_rrc_set_state (module_id, NR_RRC_SI_RECEIVED);
} }
// take ServingCellConfigCommon and configure L1/L2 // take ServingCellConfigCommon and configure L1/L2
NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon; NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon;
...@@ -1329,8 +1331,8 @@ static void rrc_ue_generate_RRCSetupComplete( ...@@ -1329,8 +1331,8 @@ static void rrc_ue_generate_RRCSetupComplete(
size = do_RRCSetupComplete(ctxt_pP->module_id,buffer,Transaction_id,sel_plmn_id,nas_msg_length,nas_msg); size = do_RRCSetupComplete(ctxt_pP->module_id,buffer,Transaction_id,sel_plmn_id,nas_msg_length,nas_msg);
LOG_I(NR_RRC,"[UE %d][RAPROC] Frame %d : Logical Channel UL-DCCH (SRB1), Generating RRCSetupComplete (bytes%d, gNB %d)\n", LOG_I(NR_RRC,"[UE %d][RAPROC] Frame %d : Logical Channel UL-DCCH (SRB1), Generating RRCSetupComplete (bytes%d, gNB %d)\n",
ctxt_pP->module_id,ctxt_pP->frame, size, gNB_index); ctxt_pP->module_id,ctxt_pP->frame, size, gNB_index);
LOG_D(RLC, LOG_D(NR_RRC,
"[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionSetupComplete to gNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", "[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCSetupComplete to gNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
ctxt_pP->frame, ctxt_pP->module_id+NB_RN_INST, size, gNB_index, nr_rrc_mui, ctxt_pP->module_id+NB_eNB_INST, DCCH); ctxt_pP->frame, ctxt_pP->module_id+NB_RN_INST, size, gNB_index, nr_rrc_mui, ctxt_pP->module_id+NB_eNB_INST, DCCH);
// ctxt_pP_local.rnti = ctxt_pP->rnti; // ctxt_pP_local.rnti = ctxt_pP->rnti;
rrc_data_req_ue( rrc_data_req_ue(
...@@ -1360,1065 +1362,1066 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB ...@@ -1360,1065 +1362,1066 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
asn_dec_rval_t dec_rval; asn_dec_rval_t dec_rval;
int rval=0; int rval=0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_IN);
// LOG_D(RRC,"[UE %d] Decoding DL-CCCH message (%d bytes), State %d\n",ue_mod_idP,Srb_info->Rx_buffer.payload_size, LOG_I(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[ue_mod_idP].Info[gNB_index].State); NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State);
dec_rval = uper_decode(NULL, dec_rval = uper_decode(NULL,
&asn_DEF_NR_DL_CCCH_Message, &asn_DEF_NR_DL_CCCH_Message,
(void **)&dl_ccch_msg, (void **)&dl_ccch_msg,
(uint8_t *)Srb_info->Rx_buffer.Payload, (uint8_t *)Srb_info->Rx_buffer.Payload,
100,0,0); 100,0,0);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { //if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout,&asn_DEF_NR_DL_CCCH_Message,(void *)dl_ccch_msg); xer_fprint(stdout,&asn_DEF_NR_DL_CCCH_Message,(void *)dl_ccch_msg);
} //}
if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) { if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) {
LOG_E(RRC,"[UE %d] Frame %d : Failed to decode DL-CCCH-Message (%zu bytes)\n",ctxt_pP->module_id,ctxt_pP->frame,dec_rval.consumed); LOG_E(RRC,"[UE %d] Frame %d : Failed to decode DL-CCCH-Message (%zu bytes)\n",ctxt_pP->module_id,ctxt_pP->frame,dec_rval.consumed);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_OUT);
return -1; return -1;
} }
if (dl_ccch_msg->message.present == NR_DL_CCCH_MessageType_PR_c1) { if (dl_ccch_msg->message.present == NR_DL_CCCH_MessageType_PR_c1) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State == NR_RRC_SI_RECEIVED) { if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus > 0) {
switch (dl_ccch_msg->message.choice.c1->present) { switch (dl_ccch_msg->message.choice.c1->present) {
case NR_DL_CCCH_MessageType__c1_PR_NOTHING: case NR_DL_CCCH_MessageType__c1_PR_NOTHING:
LOG_I(NR_RRC, "[UE%d] Frame %d : Received PR_NOTHING on DL-CCCH-Message\n", LOG_I(NR_RRC, "[UE%d] Frame %d : Received PR_NOTHING on DL-CCCH-Message\n",
ctxt_pP->module_id, ctxt_pP->module_id,
ctxt_pP->frame); ctxt_pP->frame);
rval = 0; rval = 0;
break; break;
case NR_DL_CCCH_MessageType__c1_PR_rrcReject: case NR_DL_CCCH_MessageType__c1_PR_rrcReject:
LOG_I(NR_RRC, LOG_I(NR_RRC,
"[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n", "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCReject \n",
ctxt_pP->module_id, ctxt_pP->module_id,
ctxt_pP->frame); ctxt_pP->frame);
rval = 0; rval = 0;
break; break;
case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: case NR_DL_CCCH_MessageType__c1_PR_rrcSetup:
LOG_I(NR_RRC, LOG_I(NR_RRC,
"[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received NR_RRCSetup RNTI %x\n", "[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received NR_RRCSetup RNTI %x\n",
ctxt_pP->module_id, ctxt_pP->module_id,
ctxt_pP->frame, ctxt_pP->frame,
ctxt_pP->rnti); ctxt_pP->rnti);
// Get configuration // Get configuration
// Release T300 timer // Release T300 timer
NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T300_active = 0; NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T300_active = 0;
nr_rrc_ue_process_masterCellGroup( nr_rrc_ue_process_masterCellGroup(
ctxt_pP,
gNB_index,
&dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup);
nr_sa_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_rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED);
NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].rnti = ctxt_pP->rnti;
rrc_ue_generate_RRCSetupComplete(
ctxt_pP, ctxt_pP,
gNB_index, gNB_index,
&dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup); dl_ccch_msg->message.choice.c1->choice.rrcSetup->rrc_TransactionIdentifier,
nr_sa_rrc_ue_process_radioBearerConfig( NR_UE_rrc_inst[ctxt_pP->module_id].selected_plmn_identity);
ctxt_pP, rval = 0;
gNB_index, break;
&dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig);
nr_rrc_set_state (ctxt_pP->module_id, RRC_STATE_CONNECTED); default:
nr_rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED); LOG_E(NR_RRC, "[UE%d] Frame %d : Unknown message\n",
NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].rnti = ctxt_pP->rnti; ctxt_pP->module_id,
rrc_ue_generate_RRCSetupComplete( ctxt_pP->frame);
ctxt_pP, rval = -1;
gNB_index, break;
dl_ccch_msg->message.choice.c1->choice.rrcSetup->rrc_TransactionIdentifier, }
NR_UE_rrc_inst[ctxt_pP->module_id].selected_plmn_identity); }
rval = 0; }
break;
default:
LOG_E(NR_RRC, "[UE%d] Frame %d : Unknown message\n",
ctxt_pP->module_id,
ctxt_pP->frame);
rval = -1;
break;
}
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_OUT);
return rval;
}
// from NR SRB3
int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(
const module_id_t module_id,
const uint8_t gNB_index,
const uint8_t *bufferP,
const uint32_t buffer_len ){
// uper_decode by nr R15 rrc_connection_reconfiguration
int32_t i;
NR_DL_DCCH_Message_t *nr_dl_dcch_msg = NULL;
MessageDef *msg_p;
asn_dec_rval_t dec_rval = uper_decode( NULL,
&asn_DEF_NR_DL_DCCH_Message,
(void**)&nr_dl_dcch_msg,
(uint8_t *)bufferP,
buffer_len, 0, 0);
if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) {
for (i=0; i<buffer_len; i++)
printf("%02x ",bufferP[i]);
printf("\n");
// free the memory
SEQUENCE_free( &asn_DEF_NR_DL_DCCH_Message, (void *)nr_dl_dcch_msg, 1 );
return -1;
}
if(nr_dl_dcch_msg != NULL){
switch(nr_dl_dcch_msg->message.present){
case NR_DL_DCCH_MessageType_PR_c1:
switch(nr_dl_dcch_msg->message.choice.c1->present){
case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration:
nr_rrc_ue_process_rrcReconfiguration(module_id,nr_dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration);
break;
case NR_DL_DCCH_MessageType__c1_PR_NOTHING:
case NR_DL_DCCH_MessageType__c1_PR_rrcResume:
case NR_DL_DCCH_MessageType__c1_PR_rrcRelease:
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND);
if((nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) &&
(nr_dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){
nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer =
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5;
nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType =
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency;
}
itti_send_msg_to_task(TASK_RRC_NRUE,module_id,msg_p);
break;
case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment:
case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand:
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer:
case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry:
case NR_DL_DCCH_MessageType__c1_PR_counterCheck:
case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand:
case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16:
case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16:
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16:
case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16:
case NR_DL_DCCH_MessageType__c1_PR_spare3:
case NR_DL_DCCH_MessageType__c1_PR_spare2:
case NR_DL_DCCH_MessageType__c1_PR_spare1:
default:
// not supported or unused
break;
}
break;
case NR_DL_DCCH_MessageType_PR_NOTHING:
case NR_DL_DCCH_MessageType_PR_messageClassExtension:
default:
// not supported or unused
break;
}
// release memory allocation
SEQUENCE_free( &asn_DEF_NR_DL_DCCH_Message, (void *)nr_dl_dcch_msg, 1 );
}else{
// log..
}
return 0;
}
//-----------------------------------------------------------------------------
void
nr_rrc_ue_process_securityModeCommand(
const protocol_ctxt_t *const ctxt_pP,
NR_SecurityModeCommand_t *const securityModeCommand,
const uint8_t gNB_index
)
//-----------------------------------------------------------------------------
{
asn_enc_rval_t enc_rval;
NR_UL_DCCH_Message_t ul_dcch_msg;
uint8_t buffer[200];
int i, securityMode;
LOG_I(NR_RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), Processing securityModeCommand (eNB %d)\n",
ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, gNB_index);
switch (securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm) {
case NR_CipheringAlgorithm_nea0:
LOG_I(NR_RRC,"[UE %d] Security algorithm is set to nea0\n",
ctxt_pP->module_id);
securityMode= NR_CipheringAlgorithm_nea0;
break;
case NR_CipheringAlgorithm_nea1:
LOG_I(NR_RRC,"[UE %d] Security algorithm is set to nea1\n",ctxt_pP->module_id);
securityMode= NR_CipheringAlgorithm_nea1;
break;
case NR_CipheringAlgorithm_nea2:
LOG_I(NR_RRC,"[UE %d] Security algorithm is set to nea2\n",
ctxt_pP->module_id);
securityMode = NR_CipheringAlgorithm_nea2;
break;
default:
LOG_I(NR_RRC,"[UE %d] Security algorithm is set to none\n",ctxt_pP->module_id);
securityMode = NR_CipheringAlgorithm_spare1;
break;
}
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm =
securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm;
if (securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm != NULL)
{
switch (*securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm) {
case NR_IntegrityProtAlgorithm_nia1:
LOG_I(NR_RRC,"[UE %d] Integrity protection algorithm is set to nia1\n",ctxt_pP->module_id);
securityMode |= 1 << 5;
break;
case NR_IntegrityProtAlgorithm_nia2:
LOG_I(NR_RRC,"[UE %d] Integrity protection algorithm is set to nia2\n",ctxt_pP->module_id);
securityMode |= 1 << 6;
break;
default:
LOG_I(NR_RRC,"[UE %d] Integrity protection algorithm is set to none\n",ctxt_pP->module_id);
securityMode |= 0x70 ;
break;
}
NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm =
*securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm;
}
LOG_D(NR_RRC,"[UE %d] security mode is %x \n",ctxt_pP->module_id, securityMode);
memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
//memset((void *)&SecurityModeCommand,0,sizeof(SecurityModeCommand_t));
ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1;
ul_dcch_msg.message.choice.c1 = calloc(1, sizeof(*ul_dcch_msg.message.choice.c1));
if (securityMode >= NO_SECURITY_MODE) {
LOG_I(NR_RRC, "rrc_ue_process_securityModeCommand, security mode complete case \n");
ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_securityModeComplete;
} else {
LOG_I(NR_RRC, "rrc_ue_process_securityModeCommand, security mode failure case \n");
ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_securityModeFailure;
ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_securityModeComplete;
}
uint8_t *kRRCenc = NULL; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_OUT);
uint8_t *kUPenc = NULL; return rval;
uint8_t *kRRCint = NULL; }
pdcp_t *pdcp_p = NULL;
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
hashtable_rc_t h_rc;
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti,
ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES);
h_rc = hashtable_get(pdcp_coll_p, key, (void **) &pdcp_p);
if (h_rc == HASH_TABLE_OK) {
LOG_D(NR_RRC, "PDCP_COLL_KEY_VALUE() returns valid key = %ld\n", key);
LOG_D(NR_RRC, "driving kRRCenc, kRRCint and kUPenc from KgNB="
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x\n",
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[0], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[1], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[2], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[3],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[4], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[5], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[6], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[7],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[8], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[9], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[10], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[11],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[12], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[13], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[14], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[15],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[16], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[17], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[18], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[19],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[20], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[21], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[22], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[23],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[24], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[25], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[26], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[27],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[28], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[29], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[30], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[31]);
derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc);
derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint);
derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc);
if (securityMode != 0xff) {
pdcp_config_set_security(ctxt_pP, pdcp_p, 0, 0,
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm
| (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
kRRCenc, kRRCint, kUPenc);
} else {
LOG_I(NR_RRC, "skipped pdcp_config_set_security() as securityMode == 0x%02x",
securityMode);
}
} else {
LOG_I(NR_RRC, "Could not get PDCP instance where key=0x%ld\n", key);
}
if (securityModeCommand->criticalExtensions.present == NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand) { // from NR SRB3
ul_dcch_msg.message.choice.c1->choice.securityModeComplete = CALLOC(1, sizeof(NR_SecurityModeComplete_t)); int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(
ul_dcch_msg.message.choice.c1->choice.securityModeComplete->rrc_TransactionIdentifier = securityModeCommand->rrc_TransactionIdentifier; const module_id_t module_id,
ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.present = NR_SecurityModeComplete__criticalExtensions_PR_securityModeComplete; const uint8_t gNB_index,
ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.choice.securityModeComplete = CALLOC(1, sizeof(NR_SecurityModeComplete_IEs_t)); const uint8_t *bufferP,
ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.choice.securityModeComplete->nonCriticalExtension =NULL; const uint32_t buffer_len ){
LOG_I(NR_RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (gNB %d), rrc_TransactionIdentifier: %ld\n", // uper_decode by nr R15 rrc_connection_reconfiguration
ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, gNB_index, securityModeCommand->rrc_TransactionIdentifier);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message, int32_t i;
NULL, NR_DL_DCCH_Message_t *nr_dl_dcch_msg = NULL;
(void *)&ul_dcch_msg, MessageDef *msg_p;
buffer,
100); asn_dec_rval_t dec_rval = uper_decode( NULL,
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", &asn_DEF_NR_DL_DCCH_Message,
enc_rval.failed_type->name, enc_rval.encoded); (void**)&nr_dl_dcch_msg,
(uint8_t *)bufferP,
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { buffer_len, 0, 0);
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg);
if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) {
for (i=0; i<buffer_len; i++)
printf("%02x ",bufferP[i]);
printf("\n");
// free the memory
SEQUENCE_free( &asn_DEF_NR_DL_DCCH_Message, (void *)nr_dl_dcch_msg, 1 );
return -1;
} }
log_dump(MAC, buffer, 16, LOG_DUMP_CHAR, "securityModeComplete payload: ");
LOG_D(NR_RRC, "securityModeComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) { if(nr_dl_dcch_msg != NULL){
LOG_T(NR_RRC, "%02x.", buffer[i]); switch(nr_dl_dcch_msg->message.present){
} case NR_DL_DCCH_MessageType_PR_c1:
switch(nr_dl_dcch_msg->message.choice.c1->present){
case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration:
nr_rrc_ue_process_rrcReconfiguration(module_id,nr_dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration);
break;
case NR_DL_DCCH_MessageType__c1_PR_NOTHING:
case NR_DL_DCCH_MessageType__c1_PR_rrcResume:
case NR_DL_DCCH_MessageType__c1_PR_rrcRelease:
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND);
if((nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) &&
(nr_dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){
nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer =
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5;
nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType =
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency;
}
itti_send_msg_to_task(TASK_RRC_NRUE,module_id,msg_p);
break;
case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment:
case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand:
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer:
case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry:
case NR_DL_DCCH_MessageType__c1_PR_counterCheck:
case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand:
case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16:
case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16:
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16:
case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16:
case NR_DL_DCCH_MessageType__c1_PR_spare3:
case NR_DL_DCCH_MessageType__c1_PR_spare2:
case NR_DL_DCCH_MessageType__c1_PR_spare1:
default:
// not supported or unused
break;
}
break;
case NR_DL_DCCH_MessageType_PR_NOTHING:
case NR_DL_DCCH_MessageType_PR_messageClassExtension:
default:
// not supported or unused
break;
}
// release memory allocation
SEQUENCE_free( &asn_DEF_NR_DL_DCCH_Message, (void *)nr_dl_dcch_msg, 1 );
}else{
// log..
}
LOG_T(NR_RRC, "\n"); return 0;
#ifdef ITTI_SIM }
MessageDef *message_p;
uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM,
(enc_rval.encoded + 7) / 8);
memcpy (message_buffer, buffer, (enc_rval.encoded + 7) / 8);
message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_DCCH_DATA_IND);
GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer;
GNB_RRC_DCCH_DATA_IND (message_p).size = (enc_rval.encoded + 7) / 8;
itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
#else
rrc_data_req_ue (
ctxt_pP,
DCCH,
nr_rrc_mui++,
SDU_CONFIRM_NO,
(enc_rval.encoded + 7) / 8,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
#endif
} else
LOG_W(NR_RRC,"securityModeCommand->criticalExtensions.present (%d) != NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand\n",
securityModeCommand->criticalExtensions.present);
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) { void
uint8_t i=0,rv[6]; nr_rrc_ue_process_securityModeCommand(
const protocol_ctxt_t *const ctxt_pP,
NR_SecurityModeCommand_t *const securityModeCommand,
const uint8_t gNB_index
)
//-----------------------------------------------------------------------------
{
asn_enc_rval_t enc_rval;
NR_UL_DCCH_Message_t ul_dcch_msg;
uint8_t buffer[200];
int i, securityMode;
LOG_I(NR_RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), Processing securityModeCommand (eNB %d)\n",
ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, gNB_index);
switch (securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm) {
case NR_CipheringAlgorithm_nea0:
LOG_I(NR_RRC,"[UE %d] Security algorithm is set to nea0\n",
ctxt_pP->module_id);
securityMode= NR_CipheringAlgorithm_nea0;
break;
case NR_CipheringAlgorithm_nea1:
LOG_I(NR_RRC,"[UE %d] Security algorithm is set to nea1\n",ctxt_pP->module_id);
securityMode= NR_CipheringAlgorithm_nea1;
break;
case NR_CipheringAlgorithm_nea2:
LOG_I(NR_RRC,"[UE %d] Security algorithm is set to nea2\n",
ctxt_pP->module_id);
securityMode = NR_CipheringAlgorithm_nea2;
break;
default:
LOG_I(NR_RRC,"[UE %d] Security algorithm is set to none\n",ctxt_pP->module_id);
securityMode = NR_CipheringAlgorithm_spare1;
break;
}
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm =
securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm;
if (securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm != NULL)
{
switch (*securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm) {
case NR_IntegrityProtAlgorithm_nia1:
LOG_I(NR_RRC,"[UE %d] Integrity protection algorithm is set to nia1\n",ctxt_pP->module_id);
securityMode |= 1 << 5;
break;
case NR_IntegrityProtAlgorithm_nia2:
LOG_I(NR_RRC,"[UE %d] Integrity protection algorithm is set to nia2\n",ctxt_pP->module_id);
securityMode |= 1 << 6;
break;
default:
LOG_I(NR_RRC,"[UE %d] Integrity protection algorithm is set to none\n",ctxt_pP->module_id);
securityMode |= 0x70 ;
break;
}
NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm =
*securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm;
if(IS_SOFTMODEM_NOS1) { }
AMF_MODE_ENABLED = 1;
}
if(NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size ==0) {
// Get RRCConnectionRequest, fill random for now
// Generate random byte stream for contention resolution
for (i=0; i<6; i++) {
#ifdef SMBV
// if SMBV is configured the contention resolution needs to be fix for the connection procedure to succeed
rv[i]=i;
#else
rv[i]=taus()&0xff;
#endif
LOG_T(NR_RRC,"%x.",rv[i]);
}
LOG_T(NR_RRC,"\n"); LOG_D(NR_RRC,"[UE %d] security mode is %x \n",ctxt_pP->module_id, securityMode);
NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size = memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
do_RRCSetupRequest( //memset((void *)&SecurityModeCommand,0,sizeof(SecurityModeCommand_t));
module_id, ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1;
(uint8_t *)NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload, ul_dcch_msg.message.choice.c1 = calloc(1, sizeof(*ul_dcch_msg.message.choice.c1));
rv);
LOG_I(NR_RRC,"[UE %d] : Logical Channel UL-CCCH (SRB0), Generating RRCSetupRequest (bytes %d, gNB %d)\n", if (securityMode >= NO_SECURITY_MODE) {
module_id, NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size, gNB_index); LOG_I(NR_RRC, "rrc_ue_process_securityModeCommand, security mode complete case \n");
ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_securityModeComplete;
} else {
LOG_I(NR_RRC, "rrc_ue_process_securityModeCommand, security mode failure case \n");
ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_securityModeFailure;
ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_securityModeComplete;
}
for (i=0; i<NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size; i++) { uint8_t *kRRCenc = NULL;
//LOG_T(NR_RRC,"%x.",NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload[i]); uint8_t *kUPenc = NULL;
printf("%x.",NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload[i]); uint8_t *kRRCint = NULL;
pdcp_t *pdcp_p = NULL;
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
hashtable_rc_t h_rc;
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti,
ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES);
h_rc = hashtable_get(pdcp_coll_p, key, (void **) &pdcp_p);
if (h_rc == HASH_TABLE_OK) {
LOG_D(NR_RRC, "PDCP_COLL_KEY_VALUE() returns valid key = %ld\n", key);
LOG_D(NR_RRC, "driving kRRCenc, kRRCint and kUPenc from KgNB="
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x\n",
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[0], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[1], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[2], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[3],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[4], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[5], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[6], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[7],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[8], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[9], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[10], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[11],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[12], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[13], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[14], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[15],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[16], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[17], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[18], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[19],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[20], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[21], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[22], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[23],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[24], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[25], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[26], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[27],
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[28], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[29], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[30], NR_UE_rrc_inst[ctxt_pP->module_id].kgnb[31]);
derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc);
derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint);
derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc);
if (securityMode != 0xff) {
pdcp_config_set_security(ctxt_pP, pdcp_p, 0, 0,
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm
| (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
kRRCenc, kRRCint, kUPenc);
} else {
LOG_I(NR_RRC, "skipped pdcp_config_set_security() as securityMode == 0x%02x",
securityMode);
}
} else {
LOG_I(NR_RRC, "Could not get PDCP instance where key=0x%ld\n", key);
}
if (securityModeCommand->criticalExtensions.present == NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand) {
ul_dcch_msg.message.choice.c1->choice.securityModeComplete = CALLOC(1, sizeof(NR_SecurityModeComplete_t));
ul_dcch_msg.message.choice.c1->choice.securityModeComplete->rrc_TransactionIdentifier = securityModeCommand->rrc_TransactionIdentifier;
ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.present = NR_SecurityModeComplete__criticalExtensions_PR_securityModeComplete;
ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.choice.securityModeComplete = CALLOC(1, sizeof(NR_SecurityModeComplete_IEs_t));
ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.choice.securityModeComplete->nonCriticalExtension =NULL;
LOG_I(NR_RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (gNB %d), rrc_TransactionIdentifier: %ld\n",
ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, gNB_index, securityModeCommand->rrc_TransactionIdentifier);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message,
NULL,
(void *)&ul_dcch_msg,
buffer,
100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg);
} }
log_dump(MAC, buffer, 16, LOG_DUMP_CHAR, "securityModeComplete payload: ");
LOG_D(NR_RRC, "securityModeComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) {
LOG_T(NR_RRC, "%02x.", buffer[i]);
}
LOG_T(NR_RRC, "\n");
#ifdef ITTI_SIM
MessageDef *message_p;
uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM,
(enc_rval.encoded + 7) / 8);
memcpy (message_buffer, buffer, (enc_rval.encoded + 7) / 8);
message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_DCCH_DATA_IND);
GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer;
GNB_RRC_DCCH_DATA_IND (message_p).size = (enc_rval.encoded + 7) / 8;
itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
#else
rrc_data_req_ue (
ctxt_pP,
DCCH,
nr_rrc_mui++,
SDU_CONFIRM_NO,
(enc_rval.encoded + 7) / 8,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
#endif
} else
LOG_W(NR_RRC,"securityModeCommand->criticalExtensions.present (%d) != NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand\n",
securityModeCommand->criticalExtensions.present);
}
// LOG_T(NR_RRC,"\n"); //-----------------------------------------------------------------------------
printf("\n"); void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) {
/*UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.Payload[i] = taus()&0xff; uint8_t i=0,rv[6];
UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.payload_size =i; */
/*
log_dump(RRC,NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload,NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size,
LOG_DUMP_CHAR,"RRCSetupRequest :\n");
rrc_data_req_ue (
ctxt_pP,
DCCH,
nr_rrc_mui++,
SDU_CONFIRM_NO,
NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size,
(uint8_t *)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload,
PDCP_TRANSMISSION_MODE_CONTROL);
*/
#ifdef ITTI_SIM
MessageDef *message_p;
uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM,
NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size);
memcpy (message_buffer, (uint8_t*)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload,
NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size);
message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_CCCH_DATA_IND);
GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer;
GNB_RRC_CCCH_DATA_IND (message_p).size = NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size;
itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
#endif
}
}
//-----------------------------------------------------------------------------
int32_t
nr_rrc_ue_establish_srb1(
module_id_t ue_mod_idP,
frame_t frameP,
uint8_t gNB_index,
NR_SRB_ToAddMod_t *SRB_config
)
//-----------------------------------------------------------------------------
{
// add descriptor from RRC PDU
NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Active = 1;
NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG
NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Srb_info.Srb_id = 1;
LOG_I(NR_RRC, "[UE %d], CONFIG_SRB1 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH, gNB_index);
return(0);
}
//-----------------------------------------------------------------------------
int32_t
nr_rrc_ue_establish_srb2(
module_id_t ue_mod_idP,
frame_t frameP,
uint8_t gNB_index,
NR_SRB_ToAddMod_t *SRB_config
)
//-----------------------------------------------------------------------------
{
// add descriptor from RRC PDU
NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Active = 1;
NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG
NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Srb_info.Srb_id = 2;
LOG_I(NR_RRC, "[UE %d], CONFIG_SRB2 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH1, gNB_index);
return(0);
}
//----------------------------------------------------------------------------- if(get_softmodem_params()->sa) {
int32_t AMF_MODE_ENABLED = 1;
nr_rrc_ue_establish_drb( }
module_id_t ue_mod_idP, if(NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size ==0) {
frame_t frameP, // Get RRCConnectionRequest, fill random for now
uint8_t gNB_index, // Generate random byte stream for contention resolution
NR_DRB_ToAddMod_t *DRB_config for (i=0; i<6; i++) {
) #ifdef SMBV
//----------------------------------------------------------------------------- // if SMBV is configured the contention resolution needs to be fix for the connection procedure to succeed
{ rv[i]=i;
// add descriptor from RRC PDU #else
int oip_ifup = 0, ip_addr_offset3 = 0, ip_addr_offset4 = 0; rv[i]=taus()&0xff;
/* avoid gcc warnings */ #endif
(void)oip_ifup; LOG_T(NR_RRC,"%x.",rv[i]);
(void)ip_addr_offset3; }
(void)ip_addr_offset4;
LOG_I(NR_RRC,"[UE %d] Frame %d: processing RRCReconfiguration: reconfiguring DRB %ld\n", LOG_T(NR_RRC,"\n");
ue_mod_idP, frameP, DRB_config->drb_Identity); NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size =
do_RRCSetupRequest(
if(!AMF_MODE_ENABLED) { module_id,
ip_addr_offset3 = 0; (uint8_t *)NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload,
ip_addr_offset4 = 1; rv);
LOG_I(OIP, "[UE %d] trying to bring up the OAI interface %d, IP X.Y.%d.%d\n", ue_mod_idP, ip_addr_offset3+ue_mod_idP, LOG_I(NR_RRC,"[UE %d] : Logical Channel UL-CCCH (SRB0), Generating RRCSetupRequest (bytes %d, gNB %d)\n",
ip_addr_offset3+ue_mod_idP+1, ip_addr_offset4+ue_mod_idP+1); module_id, NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size, gNB_index);
oip_ifup = nas_config(ip_addr_offset3+ue_mod_idP+1, // interface_id
UE_NAS_USE_TUN?1:(ip_addr_offset3+ue_mod_idP+1), // third_octet for (i=0; i<NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size; i++) {
ip_addr_offset4+ue_mod_idP+1, // fourth_octet //LOG_T(NR_RRC,"%x.",NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload[i]);
"oip"); // interface suffix (when using kernel module) printf("%x.",NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload[i]);
if (oip_ifup == 0 && (!UE_NAS_USE_TUN)) { // interface is up --> send a config the DRB }
LOG_I(OIP, "[UE %d] Config the ue net interface %d to send/receive pkt on DRB %ld to/from the protocol stack\n",
ue_mod_idP, // LOG_T(NR_RRC,"\n");
ip_addr_offset3+ue_mod_idP, printf("\n");
(long int)((gNB_index * NR_maxDRB) + DRB_config->drb_Identity)); /*UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.Payload[i] = taus()&0xff;
rb_conf_ipv4(0,//add UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.payload_size =i; */
ue_mod_idP,//cx align with the UE index
ip_addr_offset3+ue_mod_idP,//inst num_enb+ue_index /*
(gNB_index * NR_maxDRB) + DRB_config->drb_Identity,//rb log_dump(RRC,NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload,NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size,
0,//dscp LOG_DUMP_CHAR,"RRCSetupRequest :\n");
ipv4_address(ip_addr_offset3+ue_mod_idP+1, ip_addr_offset4+ue_mod_idP+1),//saddr rrc_data_req_ue (
ipv4_address(ip_addr_offset3+ue_mod_idP+1, gNB_index+1));//daddr ctxt_pP,
LOG_D(NR_RRC,"[UE %d] State = Attached (gNB %d)\n",ue_mod_idP,gNB_index); DCCH,
nr_rrc_mui++,
SDU_CONFIRM_NO,
NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size,
(uint8_t *)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload,
PDCP_TRANSMISSION_MODE_CONTROL);
*/
#ifdef ITTI_SIM
MessageDef *message_p;
uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM,
NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size);
memcpy (message_buffer, (uint8_t*)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload,
NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size);
message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_CCCH_DATA_IND);
GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer;
GNB_RRC_CCCH_DATA_IND (message_p).size = NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size;
itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
#endif
} }
} }
return(0); //-----------------------------------------------------------------------------
} int32_t
nr_rrc_ue_establish_srb1(
//----------------------------------------------------------------------------- module_id_t ue_mod_idP,
void frame_t frameP,
nr_rrc_ue_process_measConfig( uint8_t gNB_index,
const protocol_ctxt_t *const ctxt_pP, NR_SRB_ToAddMod_t *SRB_config
const uint8_t gNB_index, )
NR_MeasConfig_t *const measConfig //-----------------------------------------------------------------------------
) {
//----------------------------------------------------------------------------- // add descriptor from RRC PDU
{ NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Active = 1;
int i; NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG
long ind; NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Srb_info.Srb_id = 1;
NR_MeasObjectToAddMod_t *measObj = NULL; LOG_I(NR_RRC, "[UE %d], CONFIG_SRB1 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH, gNB_index);
NR_ReportConfigToAddMod_t *reportConfig = NULL; return(0);
}
if (measConfig->measObjectToRemoveList != NULL) {
for (i = 0; i < measConfig->measObjectToRemoveList->list.count; i++) {
ind = *measConfig->measObjectToRemoveList->list.array[i];
free(NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]);
}
}
if (measConfig->measObjectToAddModList != NULL) {
LOG_I(NR_RRC, "Measurement Object List is present\n");
for (i = 0; i < measConfig->measObjectToAddModList->list.count; i++) {
measObj = measConfig->measObjectToAddModList->list.array[i];
ind = measConfig->measObjectToAddModList->list.array[i]->measObjectId;
if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]) {
LOG_D(NR_RRC, "Modifying measurement object %ld\n",ind);
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1],
(char *)measObj,
sizeof(NR_MeasObjectToAddMod_t));
} else {
LOG_I(NR_RRC, "Adding measurement object %ld\n", ind);
if (measObj->measObject.present == NR_MeasObjectToAddMod__measObject_PR_measObjectNR) {
NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]=measObj;
}
}
}
LOG_I(NR_RRC, "call rrc_mac_config_req \n");
// rrc_mac_config_req_ue
}
if (measConfig->reportConfigToRemoveList != NULL) {
for (i = 0; i < measConfig->reportConfigToRemoveList->list.count; i++) {
ind = *measConfig->reportConfigToRemoveList->list.array[i];
free(NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1]);
}
}
if (measConfig->reportConfigToAddModList != NULL) {
LOG_I(NR_RRC,"Report Configuration List is present\n");
for (i = 0; i < measConfig->reportConfigToAddModList->list.count; i++) {
ind = measConfig->reportConfigToAddModList->list.array[i]->reportConfigId;
reportConfig = measConfig->reportConfigToAddModList->list.array[i];
if (NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1]) {
LOG_I(NR_RRC, "Modifying Report Configuration %ld\n", ind-1);
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1],
(char *)measConfig->reportConfigToAddModList->list.array[i],
sizeof(NR_ReportConfigToAddMod_t));
} else {
LOG_D(NR_RRC,"Adding Report Configuration %ld %p \n", ind-1, measConfig->reportConfigToAddModList->list.array[i]);
if (reportConfig->reportConfig.present == NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR) {
NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1] = measConfig->reportConfigToAddModList->list.array[i];
}
}
}
}
if (measConfig->measIdToRemoveList != NULL) {
for (i = 0; i < measConfig->measIdToRemoveList->list.count; i++) {
ind = *measConfig->measIdToRemoveList->list.array[i];
free(NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1]);
}
}
if (measConfig->measIdToAddModList != NULL) {
for (i = 0; i < measConfig->measIdToAddModList->list.count; i++) {
ind = measConfig->measIdToAddModList->list.array[i]->measId;
if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1]) {
LOG_D(NR_RRC, "Modifying Measurement ID %ld\n",ind-1);
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1],
(char *)measConfig->measIdToAddModList->list.array[i],
sizeof(NR_MeasIdToAddMod_t));
} else {
LOG_D(NR_RRC, "Adding Measurement ID %ld %p\n", ind-1, measConfig->measIdToAddModList->list.array[i]);
NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1] = measConfig->measIdToAddModList->list.array[i];
}
}
}
if (measConfig->quantityConfig != NULL) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index]) {
LOG_D(NR_RRC,"Modifying Quantity Configuration \n");
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index],
(char *)measConfig->quantityConfig,
sizeof(NR_QuantityConfig_t));
} else {
LOG_D(NR_RRC, "Adding Quantity configuration\n");
NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index] = measConfig->quantityConfig;
}
}
if (measConfig->measGapConfig != NULL) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index]) {
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index],
(char *)measConfig->measGapConfig,
sizeof(NR_MeasGapConfig_t));
} else {
NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index] = measConfig->measGapConfig;
}
}
if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_ssb_RSRP) {
NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.ssb_RSRP;
} else if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_csi_RSRP) {
NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.csi_RSRP;
}
}
//-----------------------------------------------------------------------------
void
nr_sa_rrc_ue_process_radioBearerConfig(
const protocol_ctxt_t *const ctxt_pP,
const uint8_t gNB_index,
NR_RadioBearerConfig_t *const radioBearerConfig
)
//-----------------------------------------------------------------------------
{
long SRB_id, DRB_id;
int i, cnt;
if( radioBearerConfig->srb3_ToRelease != NULL){
if( *radioBearerConfig->srb3_ToRelease == TRUE){
//TODO (release the PDCP entity and the srb-Identity of the SRB3.)
}
}
if (radioBearerConfig->srb_ToAddModList != NULL) {
if (radioBearerConfig->securityConfig != NULL) {
if (*radioBearerConfig->securityConfig->keyToUse == NR_SecurityConfig__keyToUse_master) {
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm =
radioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm;
NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm =
*radioBearerConfig->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm;
}
}
uint8_t *kRRCenc = NULL;
uint8_t *kRRCint = NULL;
derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc);
derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint);
// Refresh SRBs
// nr_rrc_pdcp_config_asn1_req(ctxt_pP,
// radioBearerConfig->srb_ToAddModList,
// NULL,
// NULL,
// NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
// (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
// kRRCenc,
// kRRCint,
// NULL,
// NULL,
// NULL,
// NULL,
// NULL);
// Refresh SRBs
// nr_rrc_rlc_config_asn1_req(ctxt_pP,
// radioBearerConfig->srb_ToAddModList,
// NULL,
// NULL,
// NULL,
// NULL
// );
for (cnt = 0; cnt < radioBearerConfig->srb_ToAddModList->list.count; cnt++) {
SRB_id = radioBearerConfig->srb_ToAddModList->list.array[cnt]->srb_Identity;
LOG_D(NR_RRC,"[UE %d]: Frame %d SRB config cnt %d (SRB%ld)\n", ctxt_pP->module_id, ctxt_pP->frame, cnt, SRB_id);
if (SRB_id == 1) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index]) {
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index],
radioBearerConfig->srb_ToAddModList->list.array[cnt], sizeof(NR_SRB_ToAddMod_t));
} else {
NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index] = radioBearerConfig->srb_ToAddModList->list.array[cnt];
nr_rrc_ue_establish_srb1(ctxt_pP->module_id,
ctxt_pP->frame,
gNB_index,
radioBearerConfig->srb_ToAddModList->list.array[cnt]);
LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 gNB %d) --->][MAC_UE][MOD %02d][]\n",
ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id);
// rrc_mac_config_req_ue
}
} else {
if (NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index]) {
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index],
radioBearerConfig->srb_ToAddModList->list.array[cnt], sizeof(NR_SRB_ToAddMod_t));
} else {
NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index] = radioBearerConfig->srb_ToAddModList->list.array[cnt];
nr_rrc_ue_establish_srb2(ctxt_pP->module_id,
ctxt_pP->frame,
gNB_index,
radioBearerConfig->srb_ToAddModList->list.array[cnt]);
LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 gNB %d) --->][MAC_UE][MOD %02d][]\n",
ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id);
// rrc_mac_config_req_ue
}
} // srb2
}
} // srb_ToAddModList
// Establish DRBs if present
if (radioBearerConfig->drb_ToAddModList != NULL) {
if ((NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB == NULL) &&
(radioBearerConfig->drb_ToAddModList->list.count >= 1)) {
NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB = malloc(sizeof(rb_id_t));
*NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB = radioBearerConfig->drb_ToAddModList->list.array[0]->drb_Identity;
}
for (cnt = 0; cnt < radioBearerConfig->drb_ToAddModList->list.count; cnt++) { //-----------------------------------------------------------------------------
DRB_id = radioBearerConfig->drb_ToAddModList->list.array[cnt]->drb_Identity; int32_t
if (NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1]) { nr_rrc_ue_establish_srb2(
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1], module_id_t ue_mod_idP,
radioBearerConfig->drb_ToAddModList->list.array[cnt], sizeof(NR_DRB_ToAddMod_t)); frame_t frameP,
} else { uint8_t gNB_index,
LOG_D(NR_RRC, "Adding DRB %ld %p\n", DRB_id-1, radioBearerConfig->drb_ToAddModList->list.array[cnt]); NR_SRB_ToAddMod_t *SRB_config
NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1] = radioBearerConfig->drb_ToAddModList->list.array[cnt]; )
} //-----------------------------------------------------------------------------
} {
// add descriptor from RRC PDU
NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Active = 1;
NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG
NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Srb_info.Srb_id = 2;
LOG_I(NR_RRC, "[UE %d], CONFIG_SRB2 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH1, gNB_index);
return(0);
}
uint8_t *kUPenc = NULL; //-----------------------------------------------------------------------------
derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm, int32_t
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc); nr_rrc_ue_establish_drb(
MSC_LOG_TX_MESSAGE( module_id_t ue_mod_idP,
MSC_RRC_UE, frame_t frameP,
MSC_PDCP_UE, uint8_t gNB_index,
NULL, NR_DRB_ToAddMod_t *DRB_config
0, )
MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security %X)", //-----------------------------------------------------------------------------
MSC_AS_TIME_ARGS(ctxt_pP), {
ctxt_pP->rnti, // add descriptor from RRC PDU
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | int oip_ifup = 0, ip_addr_offset3 = 0, ip_addr_offset4 = 0;
(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4)); /* avoid gcc warnings */
(void)oip_ifup;
// Refresh DRBs (void)ip_addr_offset3;
// nr_rrc_pdcp_config_asn1_req(ctxt_pP, (void)ip_addr_offset4;
// NULL, LOG_I(NR_RRC,"[UE %d] Frame %d: processing RRCReconfiguration: reconfiguring DRB %ld\n",
// radioBearerConfig->drb_ToAddModList, ue_mod_idP, frameP, DRB_config->drb_Identity);
// NULL,
// NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | if(!AMF_MODE_ENABLED) {
// (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), ip_addr_offset3 = 0;
// NULL, ip_addr_offset4 = 1;
// NULL, LOG_I(OIP, "[UE %d] trying to bring up the OAI interface %d, IP X.Y.%d.%d\n", ue_mod_idP, ip_addr_offset3+ue_mod_idP,
// kUPenc, ip_addr_offset3+ue_mod_idP+1, ip_addr_offset4+ue_mod_idP+1);
// NULL, oip_ifup = nas_config(ip_addr_offset3+ue_mod_idP+1, // interface_id
// NULL, UE_NAS_USE_TUN?1:(ip_addr_offset3+ue_mod_idP+1), // third_octet
// NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB, ip_addr_offset4+ue_mod_idP+1, // fourth_octet
// NULL); "oip"); // interface suffix (when using kernel module)
// Refresh DRBs
// nr_rrc_rlc_config_asn1_req(ctxt_pP, if (oip_ifup == 0 && (!UE_NAS_USE_TUN)) { // interface is up --> send a config the DRB
// NULL, LOG_I(OIP, "[UE %d] Config the ue net interface %d to send/receive pkt on DRB %ld to/from the protocol stack\n",
// radioBearerConfig->drb_ToAddModList, ue_mod_idP,
// NULL, ip_addr_offset3+ue_mod_idP,
// NULL, (long int)((gNB_index * NR_maxDRB) + DRB_config->drb_Identity));
// NULL rb_conf_ipv4(0,//add
// ); ue_mod_idP,//cx align with the UE index
} // drb_ToAddModList ip_addr_offset3+ue_mod_idP,//inst num_enb+ue_index
(gNB_index * NR_maxDRB) + DRB_config->drb_Identity,//rb
if (radioBearerConfig->drb_ToReleaseList != NULL) { 0,//dscp
for (i = 0; i < radioBearerConfig->drb_ToReleaseList->list.count; i++) { ipv4_address(ip_addr_offset3+ue_mod_idP+1, ip_addr_offset4+ue_mod_idP+1),//saddr
DRB_id = *radioBearerConfig->drb_ToReleaseList->list.array[i]; ipv4_address(ip_addr_offset3+ue_mod_idP+1, gNB_index+1));//daddr
free(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1]); LOG_D(NR_RRC,"[UE %d] State = Attached (gNB %d)\n",ue_mod_idP,gNB_index);
} }
} }
NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State = NR_RRC_CONNECTED; return(0);
LOG_I(NR_RRC,"[UE %d] State = NR_RRC_CONNECTED (gNB %d)\n", ctxt_pP->module_id, gNB_index); }
}
//-----------------------------------------------------------------------------
void
rrc_ue_process_rrcReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
NR_RRCReconfiguration_t *rrcReconfiguration,
uint8_t gNB_index
)
//-----------------------------------------------------------------------------
{
LOG_I(NR_RRC, "[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCReconfiguration (gNB %d)\n",
ctxt_pP->module_id, ctxt_pP->frame, gNB_index);
NR_RRCReconfiguration_IEs_t *ie = NULL;
if (rrcReconfiguration->criticalExtensions.present //-----------------------------------------------------------------------------
== NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) { void
ie = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration; nr_rrc_ue_process_measConfig(
if (ie->measConfig != NULL) { const protocol_ctxt_t *const ctxt_pP,
LOG_I(NR_RRC, "Measurement Configuration is present\n"); const uint8_t gNB_index,
// nr_rrc_ue_process_measConfig(ctxt_pP, gNB_index, ie->measConfig); NR_MeasConfig_t *const measConfig
} )
//-----------------------------------------------------------------------------
{
int i;
long ind;
NR_MeasObjectToAddMod_t *measObj = NULL;
NR_ReportConfigToAddMod_t *reportConfig = NULL;
if (measConfig->measObjectToRemoveList != NULL) {
for (i = 0; i < measConfig->measObjectToRemoveList->list.count; i++) {
ind = *measConfig->measObjectToRemoveList->list.array[i];
free(NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]);
}
}
if (ie->radioBearerConfig != NULL) { if (measConfig->measObjectToAddModList != NULL) {
LOG_I(NR_RRC, "radio Bearer Configuration is present\n"); LOG_I(NR_RRC, "Measurement Object List is present\n");
// nr_sa_rrc_ue_process_radioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig); for (i = 0; i < measConfig->measObjectToAddModList->list.count; i++) {
} measObj = measConfig->measObjectToAddModList->list.array[i];
ind = measConfig->measObjectToAddModList->list.array[i]->measObjectId;
if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]) {
LOG_D(NR_RRC, "Modifying measurement object %ld\n",ind);
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1],
(char *)measObj,
sizeof(NR_MeasObjectToAddMod_t));
} else {
LOG_I(NR_RRC, "Adding measurement object %ld\n", ind);
if (measObj->measObject.present == NR_MeasObjectToAddMod__measObject_PR_measObjectNR) {
NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]=measObj;
}
}
}
LOG_I(NR_RRC, "call rrc_mac_config_req \n");
// rrc_mac_config_req_ue
}
/* Check if there is dedicated NAS information to forward to NAS */ if (measConfig->reportConfigToRemoveList != NULL) {
if (ie->nonCriticalExtension->dedicatedNAS_MessageList != NULL) { for (i = 0; i < measConfig->reportConfigToRemoveList->list.count; i++) {
int list_count; ind = *measConfig->reportConfigToRemoveList->list.array[i];
uint32_t pdu_length; free(NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1]);
uint8_t *pdu_buffer; }
MessageDef *msg_p; }
for (list_count = 0; list_count < ie->nonCriticalExtension->dedicatedNAS_MessageList->list.count; list_count++) {
pdu_length = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->size;
pdu_buffer = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->buf;
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_ESTABLI_CNF);
NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS;
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length;
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer;
itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p);
}
free (ie->nonCriticalExtension->dedicatedNAS_MessageList); if (measConfig->reportConfigToAddModList != NULL) {
} LOG_I(NR_RRC,"Report Configuration List is present\n");
} for (i = 0; i < measConfig->reportConfigToAddModList->list.count; i++) {
} ind = measConfig->reportConfigToAddModList->list.array[i]->reportConfigId;
reportConfig = measConfig->reportConfigToAddModList->list.array[i];
if (NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1]) {
LOG_I(NR_RRC, "Modifying Report Configuration %ld\n", ind-1);
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1],
(char *)measConfig->reportConfigToAddModList->list.array[i],
sizeof(NR_ReportConfigToAddMod_t));
} else {
LOG_D(NR_RRC,"Adding Report Configuration %ld %p \n", ind-1, measConfig->reportConfigToAddModList->list.array[i]);
if (reportConfig->reportConfig.present == NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR) {
NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1] = measConfig->reportConfigToAddModList->list.array[i];
}
}
}
}
//----------------------------------------------------------------------------- if (measConfig->measIdToRemoveList != NULL) {
void nr_rrc_ue_generate_RRCReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index, const uint8_t Transaction_id ) { for (i = 0; i < measConfig->measIdToRemoveList->list.count; i++) {
uint8_t buffer[32], size; ind = *measConfig->measIdToRemoveList->list.array[i];
size = do_NR_RRCReconfigurationComplete(ctxt_pP, buffer, Transaction_id); free(NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1]);
LOG_I(NR_RRC,PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel UL-DCCH (SRB1), Generating RRCReconfigurationComplete (bytes %d, gNB_index %d)\n", }
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, gNB_index); }
LOG_D(RLC,
"[FRAME %05d][RRC_UE][INST %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCReconfigurationComplete to gNB %d MUI %d) --->][PDCP][INST %02d][RB %02d]\n",
ctxt_pP->frame,
UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id),
size,
gNB_index,
nr_rrc_mui,
UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id),
DCCH);
#ifdef ITTI_SIM
MessageDef *message_p;
uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM,size);
memcpy (message_buffer, buffer, size);
message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_DCCH_DATA_IND); if (measConfig->measIdToAddModList != NULL) {
UE_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; for (i = 0; i < measConfig->measIdToAddModList->list.count; i++) {
UE_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; ind = measConfig->measIdToAddModList->list.array[i]->measId;
UE_RRC_DCCH_DATA_IND (message_p).size = size;
itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p); if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1]) {
LOG_D(NR_RRC, "Modifying Measurement ID %ld\n",ind-1);
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1],
(char *)measConfig->measIdToAddModList->list.array[i],
sizeof(NR_MeasIdToAddMod_t));
} else {
LOG_D(NR_RRC, "Adding Measurement ID %ld %p\n", ind-1, measConfig->measIdToAddModList->list.array[i]);
NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1] = measConfig->measIdToAddModList->list.array[i];
}
}
}
#else if (measConfig->quantityConfig != NULL) {
rrc_data_req_ue ( if (NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index]) {
ctxt_pP, LOG_D(NR_RRC,"Modifying Quantity Configuration \n");
DCCH, memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index],
nr_rrc_mui++, (char *)measConfig->quantityConfig,
SDU_CONFIRM_NO, sizeof(NR_QuantityConfig_t));
size, } else {
buffer, LOG_D(NR_RRC, "Adding Quantity configuration\n");
PDCP_TRANSMISSION_MODE_CONTROL); NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index] = measConfig->quantityConfig;
#endif }
}
} if (measConfig->measGapConfig != NULL) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index]) {
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index],
(char *)measConfig->measGapConfig,
sizeof(NR_MeasGapConfig_t));
} else {
NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index] = measConfig->measGapConfig;
}
}
// from NR SRB1 if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_ssb_RSRP) {
//----------------------------------------------------------------------------- NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.ssb_RSRP;
int } else if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_csi_RSRP) {
nr_rrc_ue_decode_dcch( NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.csi_RSRP;
const protocol_ctxt_t *const ctxt_pP, }
const srb_id_t Srb_id, }
const uint8_t *const Buffer,
const uint8_t gNB_indexP
)
//-----------------------------------------------------------------------------
{
asn_dec_rval_t dec_rval;
NR_DL_DCCH_Message_t *dl_dcch_msg = NULL;
MessageDef *msg_p;
if (Srb_id != 1) { //-----------------------------------------------------------------------------
LOG_E(NR_RRC,"[UE %d] Frame %d: Received message on DL-DCCH (SRB%ld), should not have ...\n", void
ctxt_pP->module_id, ctxt_pP->frame, Srb_id); nr_sa_rrc_ue_process_radioBearerConfig(
return -1; const protocol_ctxt_t *const ctxt_pP,
} else { const uint8_t gNB_index,
LOG_D(NR_RRC, "Received message on SRB%ld\n", Srb_id); NR_RadioBearerConfig_t *const radioBearerConfig
} )
//-----------------------------------------------------------------------------
{
long SRB_id, DRB_id;
int i, cnt;
if( radioBearerConfig->srb3_ToRelease != NULL){
if( *radioBearerConfig->srb3_ToRelease == TRUE){
//TODO (release the PDCP entity and the srb-Identity of the SRB3.)
}
}
LOG_D(NR_RRC, "Decoding DL-DCCH Message\n"); if (radioBearerConfig->srb_ToAddModList != NULL) {
dec_rval = uper_decode( NULL, if (radioBearerConfig->securityConfig != NULL) {
&asn_DEF_NR_DL_DCCH_Message, if (*radioBearerConfig->securityConfig->keyToUse == NR_SecurityConfig__keyToUse_master) {
(void **)&dl_dcch_msg, NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm =
Buffer, radioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm;
RRC_BUF_SIZE, NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm =
0, *radioBearerConfig->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm;
0); }
}
uint8_t *kRRCenc = NULL;
uint8_t *kRRCint = NULL;
derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc);
derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint);
// Refresh SRBs
// nr_rrc_pdcp_config_asn1_req(ctxt_pP,
// radioBearerConfig->srb_ToAddModList,
// NULL,
// NULL,
// NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
// (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
// kRRCenc,
// kRRCint,
// NULL,
// NULL,
// NULL,
// NULL,
// NULL);
// Refresh SRBs
// nr_rrc_rlc_config_asn1_req(ctxt_pP,
// radioBearerConfig->srb_ToAddModList,
// NULL,
// NULL,
// NULL,
// NULL
// );
for (cnt = 0; cnt < radioBearerConfig->srb_ToAddModList->list.count; cnt++) {
SRB_id = radioBearerConfig->srb_ToAddModList->list.array[cnt]->srb_Identity;
LOG_D(NR_RRC,"[UE %d]: Frame %d SRB config cnt %d (SRB%ld)\n", ctxt_pP->module_id, ctxt_pP->frame, cnt, SRB_id);
if (SRB_id == 1) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index]) {
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index],
radioBearerConfig->srb_ToAddModList->list.array[cnt],
sizeof(NR_SRB_ToAddMod_t));
} else {
NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index] = radioBearerConfig->srb_ToAddModList->list.array[cnt];
nr_rrc_ue_establish_srb1(ctxt_pP->module_id,
ctxt_pP->frame,
gNB_index,
radioBearerConfig->srb_ToAddModList->list.array[cnt]);
LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 gNB %d) --->][MAC_UE][MOD %02d][]\n",
ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id);
// rrc_mac_config_req_ue
}
} else {
if (NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index]) {
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index],
radioBearerConfig->srb_ToAddModList->list.array[cnt], sizeof(NR_SRB_ToAddMod_t));
} else {
NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index] = radioBearerConfig->srb_ToAddModList->list.array[cnt];
nr_rrc_ue_establish_srb2(ctxt_pP->module_id,
ctxt_pP->frame,
gNB_index,
radioBearerConfig->srb_ToAddModList->list.array[cnt]);
LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 gNB %d) --->][MAC_UE][MOD %02d][]\n",
ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id);
// rrc_mac_config_req_ue
}
} // srb2
}
} // srb_ToAddModList
// Establish DRBs if present
if (radioBearerConfig->drb_ToAddModList != NULL) {
if ((NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB == NULL) &&
(radioBearerConfig->drb_ToAddModList->list.count >= 1)) {
NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB = malloc(sizeof(rb_id_t));
*NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB = radioBearerConfig->drb_ToAddModList->list.array[0]->drb_Identity;
}
for (cnt = 0; cnt < radioBearerConfig->drb_ToAddModList->list.count; cnt++) {
DRB_id = radioBearerConfig->drb_ToAddModList->list.array[cnt]->drb_Identity;
if (NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1]) {
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1],
radioBearerConfig->drb_ToAddModList->list.array[cnt], sizeof(NR_DRB_ToAddMod_t));
} else {
LOG_D(NR_RRC, "Adding DRB %ld %p\n", DRB_id-1, radioBearerConfig->drb_ToAddModList->list.array[cnt]);
NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1] = radioBearerConfig->drb_ToAddModList->list.array[cnt];
}
}
uint8_t *kUPenc = NULL;
derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc);
MSC_LOG_TX_MESSAGE(
MSC_RRC_UE,
MSC_PDCP_UE,
NULL,
0,
MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security %X)",
MSC_AS_TIME_ARGS(ctxt_pP),
ctxt_pP->rnti,
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4));
// Refresh DRBs
// nr_rrc_pdcp_config_asn1_req(ctxt_pP,
// NULL,
// radioBearerConfig->drb_ToAddModList,
// NULL,
// NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
// (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
// NULL,
// NULL,
// kUPenc,
// NULL,
// NULL,
// NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB,
// NULL);
// Refresh DRBs
// nr_rrc_rlc_config_asn1_req(ctxt_pP,
// NULL,
// radioBearerConfig->drb_ToAddModList,
// NULL,
// NULL,
// NULL
// );
} // drb_ToAddModList
if (radioBearerConfig->drb_ToReleaseList != NULL) {
for (i = 0; i < radioBearerConfig->drb_ToReleaseList->list.count; i++) {
DRB_id = *radioBearerConfig->drb_ToReleaseList->list.array[i];
free(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1]);
}
}
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State = NR_RRC_CONNECTED;
LOG_E(NR_RRC, "Failed to decode DL-DCCH (%zu bytes)\n", dec_rval.consumed); LOG_I(NR_RRC,"[UE %d] State = NR_RRC_CONNECTED (gNB %d)\n", ctxt_pP->module_id, gNB_index);
return -1; }
}
// if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { //-----------------------------------------------------------------------------
xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message,(void *)dl_dcch_msg); void
// } rrc_ue_process_rrcReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) { NR_RRCReconfiguration_t *rrcReconfiguration,
switch (dl_dcch_msg->message.choice.c1->present) { uint8_t gNB_index
case NR_DL_DCCH_MessageType__c1_PR_NOTHING: )
LOG_I(NR_RRC, "Received PR_NOTHING on DL-DCCH-Message\n"); //-----------------------------------------------------------------------------
break; {
LOG_I(NR_RRC, "[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCReconfiguration (gNB %d)\n",
case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: ctxt_pP->module_id, ctxt_pP->frame, gNB_index);
{
rrc_ue_process_rrcReconfiguration(ctxt_pP, NR_RRCReconfiguration_IEs_t *ie = NULL;
dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration,
gNB_indexP); if (rrcReconfiguration->criticalExtensions.present
nr_rrc_ue_generate_RRCReconfigurationComplete(ctxt_pP, == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) {
gNB_indexP, ie = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration;
dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration->rrc_TransactionIdentifier); if (ie->measConfig != NULL) {
break; LOG_I(NR_RRC, "Measurement Configuration is present\n");
} // nr_rrc_ue_process_measConfig(ctxt_pP, gNB_index, ie->measConfig);
}
if (ie->radioBearerConfig != NULL) {
LOG_I(NR_RRC, "radio Bearer Configuration is present\n");
// nr_sa_rrc_ue_process_radioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig);
}
/* Check if there is dedicated NAS information to forward to NAS */
if (ie->nonCriticalExtension->dedicatedNAS_MessageList != NULL) {
int list_count;
uint32_t pdu_length;
uint8_t *pdu_buffer;
MessageDef *msg_p;
for (list_count = 0; list_count < ie->nonCriticalExtension->dedicatedNAS_MessageList->list.count; list_count++) {
pdu_length = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->size;
pdu_buffer = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->buf;
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_ESTABLI_CNF);
NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS;
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length;
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer;
itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p);
}
free (ie->nonCriticalExtension->dedicatedNAS_MessageList);
}
}
}
case NR_DL_DCCH_MessageType__c1_PR_rrcResume: //-----------------------------------------------------------------------------
case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: void nr_rrc_ue_generate_RRCReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index, const uint8_t Transaction_id ) {
LOG_I(NR_RRC, "[UE %d] Received RRC Release (gNB %d)\n", uint8_t buffer[32], size;
ctxt_pP->module_id, gNB_indexP); size = do_NR_RRCReconfigurationComplete(ctxt_pP, buffer, Transaction_id);
LOG_I(NR_RRC,PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel UL-DCCH (SRB1), Generating RRCReconfigurationComplete (bytes %d, gNB_index %d)\n",
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND); PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, gNB_index);
LOG_D(RLC,
if((dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) && "[FRAME %05d][RRC_UE][INST %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCReconfigurationComplete to gNB %d MUI %d) --->][PDCP][INST %02d][RB %02d]\n",
(dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){ ctxt_pP->frame,
dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer = UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id),
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5; size,
dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType = gNB_index,
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency; nr_rrc_mui,
} UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id),
DCCH);
itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); #ifdef ITTI_SIM
break; MessageDef *message_p;
case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: uint8_t *message_buffer;
LOG_I(NR_RRC, "[UE %d] Received Capability Enquiry (gNB %d)\n", message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM,size);
ctxt_pP->module_id,gNB_indexP); memcpy (message_buffer, buffer, size);
nr_rrc_ue_process_ueCapabilityEnquiry(
ctxt_pP, message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_DCCH_DATA_IND);
dl_dcch_msg->message.choice.c1->choice.ueCapabilityEnquiry, UE_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
gNB_indexP); UE_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer;
break; UE_RRC_DCCH_DATA_IND (message_p).size = size;
case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
LOG_I(NR_RRC,
"[UE%d] Frame %d : Logical Channel DL-DCCH (SRB1), Received RRCReestablishment\n", #else
ctxt_pP->module_id, rrc_data_req_ue (
ctxt_pP->frame); ctxt_pP,
nr_rrc_ue_generate_rrcReestablishmentComplete( DCCH,
ctxt_pP, nr_rrc_mui++,
dl_dcch_msg->message.choice.c1->choice.rrcReestablishment, SDU_CONFIRM_NO,
gNB_indexP); size,
break; buffer,
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: PDCP_TRANSMISSION_MODE_CONTROL);
{ #endif
NR_DLInformationTransfer_t *dlInformationTransfer = dl_dcch_msg->message.choice.c1->choice.dlInformationTransfer;
if (dlInformationTransfer->criticalExtensions.present
== NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer) {
/* This message hold a dedicated info NAS payload, forward it to NAS */
NR_DedicatedNAS_Message_t *dedicatedNAS_Message =
dlInformationTransfer->criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message;
MessageDef *msg_p;
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_DOWNLINK_DATA_IND);
NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ?
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = dedicatedNAS_Message->size;
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = dedicatedNAS_Message->buf;
itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p);
}
}
break; }
case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand:
case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16:
case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16:
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16:
case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16:
case NR_DL_DCCH_MessageType__c1_PR_spare3:
case NR_DL_DCCH_MessageType__c1_PR_spare2:
case NR_DL_DCCH_MessageType__c1_PR_spare1:
case NR_DL_DCCH_MessageType__c1_PR_counterCheck:
break;
case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand:
LOG_I(NR_RRC, "[UE %d] Received securityModeCommand (gNB %d)\n",
ctxt_pP->module_id, gNB_indexP);
nr_rrc_ue_process_securityModeCommand(
ctxt_pP,
dl_dcch_msg->message.choice.c1->choice.securityModeCommand,
gNB_indexP);
break;
}
}
return 0;
}
//----------------------------------------------------------------------------- // from NR SRB1
void *rrc_nrue_task( void *args_p ) { //-----------------------------------------------------------------------------
MessageDef *msg_p; int
instance_t instance; nr_rrc_ue_decode_dcch(
unsigned int ue_mod_id; const protocol_ctxt_t *const ctxt_pP,
int result; const srb_id_t Srb_id,
NR_SRB_INFO *srb_info_p; const uint8_t *const Buffer,
protocol_ctxt_t ctxt; const uint8_t gNB_indexP
itti_mark_task_ready (TASK_RRC_NRUE); )
//-----------------------------------------------------------------------------
while(1) { {
// Wait for a message asn_dec_rval_t dec_rval;
itti_receive_msg (TASK_RRC_NRUE, &msg_p); NR_DL_DCCH_Message_t *dl_dcch_msg = NULL;
instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); MessageDef *msg_p;
ue_mod_id = UE_INSTANCE_TO_MODULE_ID(instance);
if (Srb_id != 1) {
switch (ITTI_MSG_ID(msg_p)) { LOG_E(NR_RRC,"[UE %d] Frame %d: Received message on DL-DCCH (SRB%ld), should not have ...\n",
case TERMINATE_MESSAGE: ctxt_pP->module_id, ctxt_pP->frame, Srb_id);
LOG_W(NR_RRC, " *** Exiting RRC thread\n"); return -1;
itti_exit_task (); } else {
break; LOG_D(NR_RRC, "Received message on SRB%ld\n", Srb_id);
}
case MESSAGE_TEST: LOG_D(NR_RRC, "Decoding DL-DCCH Message\n");
LOG_D(NR_RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p)); dec_rval = uper_decode( NULL,
break; &asn_DEF_NR_DL_DCCH_Message,
(void **)&dl_dcch_msg,
Buffer,
RRC_BUF_SIZE,
0,
0);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E(NR_RRC, "Failed to decode DL-DCCH (%zu bytes)\n", dec_rval.consumed);
return -1;
}
case NR_RRC_MAC_BCCH_DATA_IND: // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, gNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message,(void *)dl_dcch_msg);
NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index); // }
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NOT_A_RNTI, NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index);
nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message (ctxt.module_id, if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) {
NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index, switch (dl_dcch_msg->message.choice.c1->present) {
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu, case NR_DL_DCCH_MessageType__c1_PR_NOTHING:
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size, LOG_I(NR_RRC, "Received PR_NOTHING on DL-DCCH-Message\n");
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrq, break;
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp);
break; case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration:
{
rrc_ue_process_rrcReconfiguration(ctxt_pP,
dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration,
gNB_indexP);
nr_rrc_ue_generate_RRCReconfigurationComplete(ctxt_pP,
gNB_indexP,
dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration->rrc_TransactionIdentifier);
break;
}
case NR_DL_DCCH_MessageType__c1_PR_rrcResume:
case NR_DL_DCCH_MessageType__c1_PR_rrcRelease:
LOG_I(NR_RRC, "[UE %d] Received RRC Release (gNB %d)\n",
ctxt_pP->module_id, gNB_indexP);
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND);
if((dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) &&
(dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){
dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer =
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5;
dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType =
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency;
}
itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p);
break;
case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry:
LOG_I(NR_RRC, "[UE %d] Received Capability Enquiry (gNB %d)\n",
ctxt_pP->module_id,gNB_indexP);
nr_rrc_ue_process_ueCapabilityEnquiry(
ctxt_pP,
dl_dcch_msg->message.choice.c1->choice.ueCapabilityEnquiry,
gNB_indexP);
break;
case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment:
LOG_I(NR_RRC,
"[UE%d] Frame %d : Logical Channel DL-DCCH (SRB1), Received RRCReestablishment\n",
ctxt_pP->module_id,
ctxt_pP->frame);
nr_rrc_ue_generate_rrcReestablishmentComplete(
ctxt_pP,
dl_dcch_msg->message.choice.c1->choice.rrcReestablishment,
gNB_indexP);
break;
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer:
{
NR_DLInformationTransfer_t *dlInformationTransfer = dl_dcch_msg->message.choice.c1->choice.dlInformationTransfer;
if (dlInformationTransfer->criticalExtensions.present
== NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer) {
/* This message hold a dedicated info NAS payload, forward it to NAS */
NR_DedicatedNAS_Message_t *dedicatedNAS_Message =
dlInformationTransfer->criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message;
MessageDef *msg_p;
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_DOWNLINK_DATA_IND);
NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ?
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = dedicatedNAS_Message->size;
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = dedicatedNAS_Message->buf;
itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p);
}
}
break;
case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand:
case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16:
case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16:
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16:
case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16:
case NR_DL_DCCH_MessageType__c1_PR_spare3:
case NR_DL_DCCH_MessageType__c1_PR_spare2:
case NR_DL_DCCH_MessageType__c1_PR_spare1:
case NR_DL_DCCH_MessageType__c1_PR_counterCheck:
break;
case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand:
LOG_I(NR_RRC, "[UE %d] Received securityModeCommand (gNB %d)\n",
ctxt_pP->module_id, gNB_indexP);
nr_rrc_ue_process_securityModeCommand(
ctxt_pP,
dl_dcch_msg->message.choice.c1->choice.securityModeCommand,
gNB_indexP);
break;
}
}
return 0;
}
case NR_RRC_MAC_CCCH_DATA_IND: //-----------------------------------------------------------------------------
LOG_I(NR_RRC, "[UE %d] RNTI %x Received %s: frameP %d, gNB %d\n", void *rrc_nrue_task( void *args_p ) {
ue_mod_id, MessageDef *msg_p;
NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, instance_t instance;
ITTI_MSG_NAME (msg_p), unsigned int ue_mod_id;
NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, int result;
NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index); NR_SRB_INFO *srb_info_p;
srb_info_p = &NR_UE_rrc_inst[ue_mod_id].Srb0[NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index]; protocol_ctxt_t ctxt;
memcpy (srb_info_p->Rx_buffer.Payload, NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu, itti_mark_task_ready (TASK_RRC_NRUE);
NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size);
srb_info_p->Rx_buffer.payload_size = NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size; while(1) {
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_NO, NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0); // Wait for a message
itti_receive_msg (TASK_RRC_NRUE, &msg_p);
instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p);
ue_mod_id = UE_INSTANCE_TO_MODULE_ID(instance);
switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE:
LOG_W(NR_RRC, " *** Exiting RRC thread\n");
itti_exit_task ();
break;
case MESSAGE_TEST:
LOG_D(NR_RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
break;
case NR_RRC_MAC_BCCH_DATA_IND:
LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, gNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NOT_A_RNTI, NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index);
nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message (ctxt.module_id,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrq,
NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp);
break;
case NR_RRC_MAC_CCCH_DATA_IND:
LOG_I(NR_RRC, "[UE %d] RNTI %x Received %s: frameP %d, gNB %d\n",
ue_mod_id,
NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti,
ITTI_MSG_NAME (msg_p),
NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame,
NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index);
srb_info_p = &NR_UE_rrc_inst[ue_mod_id].Srb0[NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index];
memcpy (srb_info_p->Rx_buffer.Payload, NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu,
NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size);
srb_info_p->Rx_buffer.payload_size = NR_RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size;
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_NO, NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0);
// PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0, NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index); // PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0, NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index);
nr_rrc_ue_decode_ccch (&ctxt, nr_rrc_ue_decode_ccch (&ctxt,
srb_info_p, srb_info_p,
......
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