Commit 5697057f authored by Xue Song's avatar Xue Song

Unblock ITTI SIM process

parent a76ef07a
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
typedef struct itti_sim_rrc_ch_s { typedef struct itti_sim_rrc_ch_s {
const rb_id_t rbid; rb_id_t rbid;
uint8_t *sdu; uint8_t *sdu;
int size; int size;
} itti_sim_rrc_ch_t; } itti_sim_rrc_ch_t;
......
...@@ -631,12 +631,12 @@ uint8_t do_RRCReject(uint8_t Mod_id, ...@@ -631,12 +631,12 @@ uint8_t do_RRCReject(uint8_t Mod_id,
100); 100);
if(enc_rval.encoded == -1) { if(enc_rval.encoded == -1) {
LOG_E(RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", LOG_E(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded); enc_rval.failed_type->name, enc_rval.encoded);
return -1; return -1;
} }
LOG_D(RRC,"RRCReject Encoded %zd bits (%zd bytes)\n", LOG_D(NR_RRC,"RRCReject Encoded %zd bits (%zd bytes)\n",
enc_rval.encoded,(enc_rval.encoded+7)/8); enc_rval.encoded,(enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
...@@ -762,13 +762,13 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, ...@@ -762,13 +762,13 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
100); 100);
if(enc_rval.encoded == -1) { if(enc_rval.encoded == -1) {
LOG_E(RRC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n", LOG_E(NR_RRC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded); enc_rval.failed_type->name, enc_rval.encoded);
return -1; return -1;
} }
if (OCTET_STRING_fromBuf(&ie->masterCellGroup, masterCellGroup_buf, (enc_rval.encoded+7)/8) == -1) { if (OCTET_STRING_fromBuf(&ie->masterCellGroup, masterCellGroup_buf, (enc_rval.encoded+7)/8) == -1) {
LOG_E(RRC, "fatal: OCTET_STRING_fromBuf failed\n"); LOG_E(NR_RRC, "fatal: OCTET_STRING_fromBuf failed\n");
return -1; return -1;
} }
...@@ -783,12 +783,12 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, ...@@ -783,12 +783,12 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
100); 100);
if(enc_rval.encoded == -1) { if(enc_rval.encoded == -1) {
LOG_E(RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", LOG_E(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded); enc_rval.failed_type->name, enc_rval.encoded);
return -1; return -1;
} }
LOG_D(RRC,"RRCSetup Encoded %zd bits (%zd bytes)\n", LOG_D(NR_RRC,"RRCSetup Encoded %zd bits (%zd bytes)\n",
enc_rval.encoded,(enc_rval.encoded+7)/8); enc_rval.encoded,(enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
...@@ -890,19 +890,19 @@ uint8_t do_NR_UECapabilityEnquiry_nr( const protocol_ctxt_t *const ctxt_pP, ...@@ -890,19 +890,19 @@ uint8_t do_NR_UECapabilityEnquiry_nr( const protocol_ctxt_t *const ctxt_pP,
100); 100);
if(enc_rval.encoded == -1) { if(enc_rval.encoded == -1) {
LOG_I(RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", LOG_I(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded); enc_rval.failed_type->name, enc_rval.encoded);
return -1; return -1;
} }
LOG_D(RRC,"[gNB %d] NR UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)\n", LOG_D(NR_RRC,"[gNB %d] NR UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)\n",
ctxt_pP->module_id, ctxt_pP->module_id,
ctxt_pP->rnti, ctxt_pP->rnti,
enc_rval.encoded, enc_rval.encoded,
(enc_rval.encoded+7)/8); (enc_rval.encoded+7)/8);
if (enc_rval.encoded==-1) { if (enc_rval.encoded==-1) {
LOG_E(RRC,"[eNB %d] ASN1 : NR UECapabilityRequest encoding failed for UE %x\n", LOG_E(NR_RRC,"[gNB %d] ASN1 : NR UECapabilityRequest encoding failed for UE %x\n",
ctxt_pP->module_id, ctxt_pP->module_id,
ctxt_pP->rnti); ctxt_pP->rnti);
return(-1); return(-1);
...@@ -1106,14 +1106,16 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) { ...@@ -1106,14 +1106,16 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
ul_ccch_msg.message.present = NR_UL_CCCH_MessageType_PR_c1; ul_ccch_msg.message.present = NR_UL_CCCH_MessageType_PR_c1;
ul_ccch_msg.message.choice.c1 = CALLOC(1, sizeof(struct NR_UL_CCCH_MessageType__c1)); ul_ccch_msg.message.choice.c1 = CALLOC(1, sizeof(struct NR_UL_CCCH_MessageType__c1));
ul_ccch_msg.message.choice.c1->present = NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest; ul_ccch_msg.message.choice.c1->present = NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest;
ul_ccch_msg.message.choice.c1->choice.rrcSetupRequest = CALLOC(1, sizeof(NR_RRCSetupRequest_t));
rrcSetupRequest = ul_ccch_msg.message.choice.c1->choice.rrcSetupRequest; rrcSetupRequest = ul_ccch_msg.message.choice.c1->choice.rrcSetupRequest;
if (1) { if (1) {
rrcSetupRequest->rrcSetupRequest.ue_Identity.present = NR_InitialUE_Identity_PR_randomValue; rrcSetupRequest->rrcSetupRequest.ue_Identity.present = NR_InitialUE_Identity_PR_randomValue;
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.size = 5; rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.size = 5;
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.bits_unused = 0; rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.bits_unused = 1;
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf = buf; rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf = buf;
rv[0] = rv[0] & 0x7F;
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf[0] = rv[0]; rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf[0] = rv[0];
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf[1] = rv[1]; rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf[1] = rv[1];
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf[2] = rv[2]; rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.randomValue.buf[2] = rv[2];
...@@ -1132,9 +1134,9 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) { ...@@ -1132,9 +1134,9 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
rrcSetupRequest->rrcSetupRequest.spare.size=1; rrcSetupRequest->rrcSetupRequest.spare.size=1;
rrcSetupRequest->rrcSetupRequest.spare.bits_unused = 7; rrcSetupRequest->rrcSetupRequest.spare.bits_unused = 7;
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_UL_CCCH_Message, (void *)&ul_ccch_msg); xer_fprint(stdout, &asn_DEF_NR_UL_CCCH_Message, (void *)&ul_ccch_msg);
} // }
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_CCCH_Message, enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_CCCH_Message,
NULL, NULL,
...@@ -1142,7 +1144,7 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) { ...@@ -1142,7 +1144,7 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
buffer, buffer,
100); 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
LOG_D(RRC,"[UE] RRCSetupRequest Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); LOG_D(NR_RRC,"[UE] RRCSetupRequest Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -1178,7 +1180,7 @@ do_NR_RRCReconfigurationComplete( ...@@ -1178,7 +1180,7 @@ do_NR_RRCReconfigurationComplete(
100); 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded); enc_rval.failed_type->name, enc_rval.encoded);
LOG_D(RRC,"rrcReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); LOG_D(NR_RRC,"rrcReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
...@@ -1197,16 +1199,20 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Trans ...@@ -1197,16 +1199,20 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Trans
} }
ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1; ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1;
ul_dcch_msg.message.choice.c1 = CALLOC(1,sizeof(struct NR_DL_DCCH_MessageType__c1)); ul_dcch_msg.message.choice.c1 = CALLOC(1,sizeof(struct NR_UL_DCCH_MessageType__c1));
ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete; ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete;
ul_dcch_msg.message.choice.c1->choice.rrcSetupComplete = CALLOC(1, sizeof(NR_RRCSetupComplete_t));
RrcSetupComplete = ul_dcch_msg.message.choice.c1->choice.rrcSetupComplete; RrcSetupComplete = ul_dcch_msg.message.choice.c1->choice.rrcSetupComplete;
RrcSetupComplete->rrc_TransactionIdentifier = Transaction_id; RrcSetupComplete->rrc_TransactionIdentifier = Transaction_id;
RrcSetupComplete->criticalExtensions.present = NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete; RrcSetupComplete->criticalExtensions.present = NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete;
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->nonCriticalExtension = CALLOC(1, RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete = CALLOC(1, sizeof(NR_RRCSetupComplete_IEs_t));
sizeof(*RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->nonCriticalExtension)); // RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->nonCriticalExtension = CALLOC(1,
// sizeof(*RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->nonCriticalExtension));
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->selectedPLMN_Identity = sel_plmn_id; RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->selectedPLMN_Identity = sel_plmn_id;
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->registeredAMF = NULL; RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->registeredAMF = NULL;
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value = CALLOC(1, sizeof(struct NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value));
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->present = NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI;
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.size = 6; RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.size = 6;
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf = buf; RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf = buf;
RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[0] = rv[0]; RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.buf[0] = rv[0];
...@@ -1218,11 +1224,11 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Trans ...@@ -1218,11 +1224,11 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Trans
memset(&RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->dedicatedNAS_Message,0,sizeof(OCTET_STRING_t)); memset(&RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->dedicatedNAS_Message,0,sizeof(OCTET_STRING_t));
OCTET_STRING_fromBuf(&RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->dedicatedNAS_Message,dedicatedInfoNAS,dedicatedInfoNASLength); OCTET_STRING_fromBuf(&RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->dedicatedNAS_Message,dedicatedInfoNAS,dedicatedInfoNASLength);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { //if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&ul_dcch_msg); xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg);
} //}
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message,
NULL, NULL,
(void *)&ul_dcch_msg, (void *)&ul_dcch_msg,
buffer, buffer,
...@@ -1230,7 +1236,7 @@ enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, ...@@ -1230,7 +1236,7 @@ enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message,
AssertFatal(enc_rval.encoded > 0,"ASN1 message encoding failed (%s, %lu)!\n", AssertFatal(enc_rval.encoded > 0,"ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name,enc_rval.encoded); enc_rval.failed_type->name,enc_rval.encoded);
LOG_D(RRC,"RRCConnectionSetupComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); LOG_D(NR_RRC,"RRCSetupComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
......
...@@ -422,7 +422,7 @@ rrc_gNB_generate_RRCSetup( ...@@ -422,7 +422,7 @@ rrc_gNB_generate_RRCSetup(
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0; // ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
#ifdef ITTI_SIM #ifdef ITTI_SIM
MessageDef *message_p; MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, GNB_RRC_CCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_CCCH_DATA_IND);
GNB_RRC_CCCH_DATA_IND (message_p).sdu = (uint8_t*)ue_p->Srb0.Tx_buffer.Payload; GNB_RRC_CCCH_DATA_IND (message_p).sdu = (uint8_t*)ue_p->Srb0.Tx_buffer.Payload;
GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size; GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size;
itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
...@@ -481,7 +481,11 @@ rrc_gNB_process_RRCSetupComplete( ...@@ -481,7 +481,11 @@ rrc_gNB_process_RRCSetupComplete(
// T_INT(ctxt_pP->subframe), // T_INT(ctxt_pP->subframe),
// T_INT(ctxt_pP->rnti)); // T_INT(ctxt_pP->rnti));
rrc_gNB_send_NGAP_NAS_FIRST_REQ(ctxt_pP, ue_context_pP, rrcSetupComplete); // if (AMF_MODE_ENABLED) {
// rrc_gNB_send_NGAP_NAS_FIRST_REQ(ctxt_pP, ue_context_pP, rrcSetupComplete);
// } else {
rrc_gNB_generate_SecurityModeCommand(ctxt_pP, ue_context_pP);
// }
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -890,6 +894,7 @@ rrc_gNB_decode_dcch( ...@@ -890,6 +894,7 @@ rrc_gNB_decode_dcch(
sdu_sizeP, sdu_sizeP,
0, 0,
0); 0);
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg);
{ {
for (i = 0; i < sdu_sizeP; i++) { for (i = 0; i < sdu_sizeP; i++) {
...@@ -981,43 +986,50 @@ rrc_gNB_decode_dcch( ...@@ -981,43 +986,50 @@ rrc_gNB_decode_dcch(
if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.present == if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.present ==
NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete) { NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete) {
if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice. if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
rrcSetupComplete->ng_5G_S_TMSI_Value->present == NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI_Part2) { rrcSetupComplete->ng_5G_S_TMSI_Value != NULL) {
// ng-5G-S-TMSI-Part2 BIT STRING (SIZE (9))
if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice. if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2.size != 2) { rrcSetupComplete->ng_5G_S_TMSI_Value->present == NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI_Part2) {
LOG_E(NR_RRC, "wrong ng_5G_S_TMSI_Part2 size, expected 2, provided %lu", // ng-5G-S-TMSI-Part2 BIT STRING (SIZE (9))
(long unsigned int)ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete-> if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
criticalExtensions.choice.rrcSetupComplete-> rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2.size != 2) {
ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2.size); LOG_E(NR_RRC, "wrong ng_5G_S_TMSI_Part2 size, expected 2, provided %lu",
return -1; (long unsigned int)ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->
} criticalExtensions.choice.rrcSetupComplete->
ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2.size);
return -1;
}
if (ue_context_p->ue_context.ng_5G_S_TMSI_Part1 != 0) { if (ue_context_p->ue_context.ng_5G_S_TMSI_Part1 != 0) {
ue_context_p->ue_context.ng_5G_S_TMSI_Part2 = ue_context_p->ue_context.ng_5G_S_TMSI_Part2 =
BIT_STRING_to_uint16(&ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete-> BIT_STRING_to_uint16(&ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->
criticalExtensions.choice.rrcSetupComplete-> criticalExtensions.choice.rrcSetupComplete->
ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2); ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2);
} }
/* TODO */ /* TODO */
} else if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice. } else if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
rrcSetupComplete->ng_5G_S_TMSI_Value->present == NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI) { rrcSetupComplete->ng_5G_S_TMSI_Value->present == NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI) {
// NG-5G-S-TMSI ::= BIT STRING (SIZE (48)) // NG-5G-S-TMSI ::= BIT STRING (SIZE (48))
if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice. if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.size != 6) { rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.size != 6) {
LOG_E(NR_RRC, "wrong ng_5G_S_TMSI size, expected 6, provided %lu", LOG_E(NR_RRC, "wrong ng_5G_S_TMSI size, expected 6, provided %lu",
(long unsigned int)ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete-> (long unsigned int)ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->
criticalExtensions.choice.rrcSetupComplete-> criticalExtensions.choice.rrcSetupComplete->
ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.size); ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.size);
return -1; return -1;
} }
uint64_t fiveg_s_TMSI = BIT_STRING_to_uint16(&ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete-> uint64_t fiveg_s_TMSI = BIT_STRING_to_uint64(&ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->
criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI); criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI);
if (ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence == TRUE) { LOG_I(NR_RRC, "Received rrcSetupComplete, 5g_s_TMSI: 0x%lX, amf_set_id: 0x%lX(%d), amf_pointer: 0x%lX(%d), 5g TMSI: 0x%lX \n",
ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id = fiveg_s_TMSI >> 38; fiveg_s_TMSI, fiveg_s_TMSI >> 38, fiveg_s_TMSI >> 38,
ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer = (fiveg_s_TMSI >> 32) & 0x3F; (fiveg_s_TMSI >> 32) & 0x3F, (fiveg_s_TMSI >> 32) & 0x3F,
ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.fiveg_tmsi = (uint32_t)fiveg_s_TMSI; (uint32_t)fiveg_s_TMSI);
if (ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence == TRUE) {
ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id = fiveg_s_TMSI >> 38;
ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer = (fiveg_s_TMSI >> 32) & 0x3F;
ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.fiveg_tmsi = (uint32_t)fiveg_s_TMSI;
}
} }
} }
......
This diff is collapsed.
...@@ -118,6 +118,12 @@ int8_t mac_rrc_nr_data_req_ue(const module_id_t Mod_idP, ...@@ -118,6 +118,12 @@ int8_t mac_rrc_nr_data_req_ue(const module_id_t Mod_idP,
/**\brief RRC UE task. /**\brief RRC UE task.
\param void *args_p Pointer on arguments to start the task. */ \param void *args_p Pointer on arguments to start the task. */
void *rrc_nrue_task(void *args_p); void *rrc_nrue_task(void *args_p);
/**\brief RRC UE generate RRCSetupRequest message.
\param ctxt_pP protocol context
\param gNB_index gNB index */
void rrc_ue_generate_RRCSetupRequest( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index );
/** @}*/ /** @}*/
#endif #endif
...@@ -59,6 +59,7 @@ unsigned short config_frames[4] = {2,9,11,13}; ...@@ -59,6 +59,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "x2ap_eNB.h" #include "x2ap_eNB.h"
#include "ngap_gNB.h" #include "ngap_gNB.h"
#include "RRC/NR_UE/rrc_proto.h" #include "RRC/NR_UE/rrc_proto.h"
#include "RRC/NR_UE/rrc_vars.h"
#include "openair3/NAS/UE/nas_ue_task.h" #include "openair3/NAS/UE/nas_ue_task.h"
pthread_cond_t nfapi_sync_cond; pthread_cond_t nfapi_sync_cond;
...@@ -380,7 +381,7 @@ int create_tasks_nrue(uint32_t ue_nb) { ...@@ -380,7 +381,7 @@ int create_tasks_nrue(uint32_t ue_nb) {
if (ue_nb > 0) { if (ue_nb > 0) {
printf("create TASK_RRC_NRUE\n"); printf("create TASK_RRC_NRUE\n");
if (itti_create_task (TASK_RRC_NRUE, rrc_nrue_task, NULL) < 0) { if (itti_create_task (TASK_RRC_NRUE, rrc_nrue_task, NULL) < 0) {
LOG_E(RRC, "Create task for RRC UE failed\n"); LOG_E(NR_RRC, "Create task for RRC UE failed\n");
return -1; return -1;
} }
} }
...@@ -406,12 +407,12 @@ void *itti_sim_ue_rrc_task( void *args_p) { ...@@ -406,12 +407,12 @@ void *itti_sim_ue_rrc_task( void *args_p) {
switch (ITTI_MSG_ID(msg_p)) { switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE: case TERMINATE_MESSAGE:
LOG_W(RRC, " *** Exiting RRC thread\n"); LOG_W(NR_RRC, " *** Exiting RRC thread\n");
itti_exit_task (); itti_exit_task ();
break; break;
case MESSAGE_TEST: case MESSAGE_TEST:
LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p)); LOG_D(NR_RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
break; break;
case GNB_RRC_BCCH_DATA_IND: case GNB_RRC_BCCH_DATA_IND:
message_p = itti_alloc_new_message (TASK_RRC_NRUE, NR_RRC_MAC_BCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_RRC_NRUE, NR_RRC_MAC_BCCH_DATA_IND);
...@@ -433,12 +434,11 @@ void *itti_sim_ue_rrc_task( void *args_p) { ...@@ -433,12 +434,11 @@ void *itti_sim_ue_rrc_task( void *args_p) {
message_p = itti_alloc_new_message (TASK_RRC_NRUE, NR_RRC_DCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_RRC_NRUE, NR_RRC_DCCH_DATA_IND);
NR_RRC_DCCH_DATA_IND (message_p).dcch_index = GNB_RRC_DCCH_DATA_IND(msg_p).rbid; NR_RRC_DCCH_DATA_IND (message_p).dcch_index = GNB_RRC_DCCH_DATA_IND(msg_p).rbid;
NR_RRC_DCCH_DATA_IND (message_p).sdu_size = GNB_RRC_DCCH_DATA_IND(msg_p).size; NR_RRC_DCCH_DATA_IND (message_p).sdu_size = GNB_RRC_DCCH_DATA_IND(msg_p).size;
memset(NR_RRC_DCCH_DATA_IND (message_p).sdu_p, 0, GNB_RRC_DCCH_DATA_IND(msg_p).size); NR_RRC_DCCH_DATA_IND (message_p).sdu_p = GNB_RRC_DCCH_DATA_IND(msg_p).sdu;
memcpy(NR_RRC_DCCH_DATA_IND (message_p).sdu_p, GNB_RRC_DCCH_DATA_IND(msg_p).sdu, GNB_RRC_DCCH_DATA_IND(msg_p).size);
itti_send_msg_to_task (TASK_RRC_NRUE, instance, message_p); itti_send_msg_to_task (TASK_RRC_NRUE, instance, message_p);
break; break;
default: default:
LOG_E(RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p)); LOG_E(NR_RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
break; break;
} }
...@@ -464,30 +464,30 @@ void *itti_sim_gnb_rrc_task( void *args_p) { ...@@ -464,30 +464,30 @@ void *itti_sim_gnb_rrc_task( void *args_p) {
switch (ITTI_MSG_ID(msg_p)) { switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE: case TERMINATE_MESSAGE:
LOG_W(RRC, " *** Exiting RRC thread\n"); LOG_W(NR_RRC, " *** Exiting RRC thread\n");
itti_exit_task (); itti_exit_task ();
break; break;
case MESSAGE_TEST: case MESSAGE_TEST:
LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p)); LOG_D(NR_RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
break; break;
case UE_RRC_CCCH_DATA_IND: case UE_RRC_CCCH_DATA_IND:
message_p = itti_alloc_new_message (TASK_RRC_GNB, NR_RRC_MAC_CCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_RRC_GNB, NR_RRC_MAC_CCCH_DATA_IND);
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = UE_RRC_CCCH_DATA_IND(msg_p).size; NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = UE_RRC_CCCH_DATA_IND(msg_p).size;
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, UE_RRC_CCCH_DATA_IND(msg_p).sdu, UE_RRC_CCCH_DATA_IND(msg_p).size); memcpy (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, UE_RRC_CCCH_DATA_IND(msg_p).sdu, UE_RRC_CCCH_DATA_IND(msg_p).size);
itti_send_msg_to_task (TASK_RRC_GNB, instance, message_p); itti_send_msg_to_task (TASK_RRC_GNB, instance, message_p);
break; break;
case UE_RRC_DCCH_DATA_IND: case UE_RRC_DCCH_DATA_IND:
message_p = itti_alloc_new_message (TASK_RRC_GNB, NR_RRC_DCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_RRC_GNB, NR_RRC_DCCH_DATA_IND);
RRC_DCCH_DATA_IND (message_p).sdu_size = UE_RRC_DCCH_DATA_IND(msg_p).size; NR_RRC_DCCH_DATA_IND (message_p).sdu_size = UE_RRC_DCCH_DATA_IND(msg_p).size;
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, UE_RRC_DCCH_DATA_IND(msg_p).size); NR_RRC_DCCH_DATA_IND (message_p).dcch_index = UE_RRC_DCCH_DATA_IND(msg_p).rbid;
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, UE_RRC_DCCH_DATA_IND(msg_p).sdu, UE_RRC_DCCH_DATA_IND(msg_p).size); NR_RRC_DCCH_DATA_IND (message_p).sdu_p = UE_RRC_DCCH_DATA_IND(msg_p).sdu;
itti_send_msg_to_task (TASK_RRC_GNB, instance, message_p); itti_send_msg_to_task (TASK_RRC_GNB, instance, message_p);
break; break;
default: default:
LOG_E(RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p)); LOG_E(NR_RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
break; break;
} }
...@@ -584,7 +584,25 @@ int main( int argc, char **argv ) ...@@ -584,7 +584,25 @@ int main( int argc, char **argv )
// wait for end of program // wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n"); printf("TYPE <CTRL-C> TO TERMINATE\n");
usleep(10000);
protocol_ctxt_t ctxt;
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[0]);
if(ue_context_p == NULL){
printf("ue_context_p == NULL");
}
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
0,
ENB_FLAG_YES,
0,
0,
0);
NR_UE_rrc_inst[ctxt.module_id].Info[0].State = RRC_SI_RECEIVED;
rrc_ue_generate_RRCSetupRequest(&ctxt, 0);
#if 0 #if 0
// test itti sim // test itti sim
......
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