Commit 96cf622e authored by yaojie's avatar yaojie

fix errors and add RRCReestablishmentComplete of UE

parent 40e3c0ce
...@@ -377,6 +377,7 @@ typedef struct gNB_MAC_INST_s { ...@@ -377,6 +377,7 @@ typedef struct gNB_MAC_INST_s {
/// UL handle /// UL handle
uint32_t ul_handle; uint32_t ul_handle;
UE_info_t UE_info;
// MAC function execution peformance profiler // MAC function execution peformance profiler
/// processing time of eNB scheduler /// processing time of eNB scheduler
......
...@@ -1295,7 +1295,7 @@ uint8_t do_RRCReestablishmentRequest(uint8_t Mod_id, uint8_t *buffer, uint16_t c ...@@ -1295,7 +1295,7 @@ uint8_t do_RRCReestablishmentRequest(uint8_t Mod_id, uint8_t *buffer, uint16_t c
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(NR_RRC,"[UE] RRCSetupRequest Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); LOG_D(NR_RRC,"[UE] RRCReestablishmentRequest 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);
} }
...@@ -1331,9 +1331,10 @@ const uint8_t Transaction_id ...@@ -1331,9 +1331,10 @@ const uint8_t Transaction_id
*SRB_configList2 = CALLOC(1, sizeof(NR_SRB_ToAddModList_t)); *SRB_configList2 = CALLOC(1, sizeof(NR_SRB_ToAddModList_t));
memset((void *)&dl_dcch_msg, 0, sizeof(NR_DL_DCCH_Message_t)); memset((void *)&dl_dcch_msg, 0, sizeof(NR_DL_DCCH_Message_t));
dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1; dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1;
dl_dcch_msg.message.choice.c1 = calloc(1,sizeof(struct NR_DL_DCCH_MessageType__c1));
dl_dcch_msg.message.choice.c1->present = NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment; dl_dcch_msg.message.choice.c1->present = NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment;
dl_dcch_msg.message.choice.c1->choice.rrcReestablishment = CALLOC(1,sizeof(NR_RRCReestablishment_t));
rrcReestablishment = dl_dcch_msg.message.choice.c1->choice.rrcReestablishment; rrcReestablishment = dl_dcch_msg.message.choice.c1->choice.rrcReestablishment;
rrcReestablishment = CALLOC(1,sizeof(NR_RRCReestablishment_t));
/* /*
// RRCReestablishment // RRCReestablishment
// Configure SRB1 // Configure SRB1
...@@ -1406,6 +1407,7 @@ const uint8_t Transaction_id ...@@ -1406,6 +1407,7 @@ const uint8_t Transaction_id
// copy KgNB_star to ue_context_pP->ue_context.kgnb // copy KgNB_star to ue_context_pP->ue_context.kgnb
memcpy (ue_context_pP->ue_context.kgnb, KgNB_star, 32); memcpy (ue_context_pP->ue_context.kgnb, KgNB_star, 32);
ue_context_pP->ue_context.kgnb_ncc = 0; ue_context_pP->ue_context.kgnb_ncc = 0;
rrcReestablishment->criticalExtensions.choice.rrcReestablishment->lateNonCriticalExtension = NULL;
rrcReestablishment->criticalExtensions.choice.rrcReestablishment->nonCriticalExtension = NULL; rrcReestablishment->criticalExtensions.choice.rrcReestablishment->nonCriticalExtension = NULL;
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
...@@ -1429,3 +1431,37 @@ const uint8_t Transaction_id ...@@ -1429,3 +1431,37 @@ const uint8_t Transaction_id
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
uint8_t
do_RRCReestablishmentComplete(uint8_t *buffer, int64_t rrc_TransactionIdentifier) {
asn_enc_rval_t enc_rval;
NR_UL_DCCH_Message_t ul_dcch_msg;
NR_RRCReestablishmentComplete_t *rrcReestablishmentComplete;
memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_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_rrcReestablishmentComplete;
ul_dcch_msg.message.choice.c1->choice.rrcReestablishmentComplete = CALLOC(1, sizeof(NR_RRCReestablishmentComplete_t));
rrcReestablishmentComplete = ul_dcch_msg.message.choice.c1->choice.rrcReestablishmentComplete;
rrcReestablishmentComplete->rrc_TransactionIdentifier = rrc_TransactionIdentifier;
rrcReestablishmentComplete->criticalExtensions.present = NR_RRCReestablishmentComplete__criticalExtensions_PR_rrcReestablishmentComplete;
rrcReestablishmentComplete->criticalExtensions.choice.rrcReestablishmentComplete = CALLOC(1, sizeof(NR_RRCReestablishmentComplete_IEs_t));
rrcReestablishmentComplete->criticalExtensions.choice.rrcReestablishmentComplete->lateNonCriticalExtension = NULL;
rrcReestablishmentComplete->criticalExtensions.choice.rrcReestablishmentComplete->nonCriticalExtension = NULL;
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_UL_CCCH_Message, (void *)&ul_dcch_msg);
}
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, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
LOG_D(NR_RRC,"[UE] RRCReestablishmentComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
}
...@@ -160,3 +160,9 @@ do_RRCReestablishment( ...@@ -160,3 +160,9 @@ do_RRCReestablishment(
//NR_SRB_ToAddModList_t **SRB_configList, //NR_SRB_ToAddModList_t **SRB_configList,
//struct LTE_PhysicalConfigDedicated **physicalConfigDedicated //struct LTE_PhysicalConfigDedicated **physicalConfigDedicated
); );
uint8_t
do_RRCReestablishmentComplete(
uint8_t *buffer,
int64_t rrc_TransactionIdentifier);
...@@ -1032,7 +1032,7 @@ rrc_gNB_generate_RRCReestablishment( ...@@ -1032,7 +1032,7 @@ rrc_gNB_generate_RRCReestablishment(
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-DCCH, Generating NR_RRCReestablishment (bytes %d)\n", LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-DCCH, Generating NR_RRCReestablishment (bytes %d)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_context->Srb0.Tx_buffer.payload_size); ue_context->Srb0.Tx_buffer.payload_size);
UE_id = find_UE_id(module_id, rnti); UE_id = find_nr_UE_id(module_id, rnti);
if (UE_id != -1) { if (UE_id != -1) {
/* Activate reject timer, if RRCComplete not received after 10 frames, reject UE */ /* Activate reject timer, if RRCComplete not received after 10 frames, reject UE */
...@@ -2175,7 +2175,7 @@ rrc_gNB_decode_dcch( ...@@ -2175,7 +2175,7 @@ rrc_gNB_decode_dcch(
} }
//clear //clear
int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); int UE_id = find_nr_UE_id(ctxt_pP->module_id, ctxt_pP->rnti);
if(UE_id == -1) { if(UE_id == -1) {
LOG_E(NR_RRC, LOG_E(NR_RRC,
......
...@@ -117,6 +117,15 @@ uint8_t do_NR_RRCReconfigurationComplete( ...@@ -117,6 +117,15 @@ uint8_t do_NR_RRCReconfigurationComplete(
const uint8_t Transaction_id const uint8_t Transaction_id
); );
void rrc_ue_generate_RRCReestablishmentRequest( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index );
void
nr_rrc_ue_generate_rrcReestablishmentComplete(
const protocol_ctxt_t *const ctxt_pP,
NR_RRCReestablishment_t *rrcReestablishment,
uint8_t gNB_index
);
mui_t nr_rrc_mui=0; mui_t nr_rrc_mui=0;
uint8_t first_rrcreconfigurationcomplete = 0; uint8_t first_rrcreconfigurationcomplete = 0;
uint8_t rrcReestablishmentRequest_flag = 1; uint8_t rrcReestablishmentRequest_flag = 1;
...@@ -2386,7 +2395,7 @@ nr_rrc_ue_decode_dcch( ...@@ -2386,7 +2395,7 @@ nr_rrc_ue_decode_dcch(
if (rrcReestablishmentRequest_flag == 1) { if (rrcReestablishmentRequest_flag == 1) {
rrcReestablishmentRequest_flag = 0; rrcReestablishmentRequest_flag = 0;
rnti = 2; rnti = 2;
rrc_ue_generate_RRCReestablishmentRequest(ctxt_pP, gNB_indexP, rnti); rrc_ue_generate_RRCReestablishmentRequest(ctxt_pP, gNB_indexP);
NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_indexP].State = NR_RRC_SI_RECEIVED; NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_indexP].State = NR_RRC_SI_RECEIVED;
NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_indexP].rnti = rnti; NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_indexP].rnti = rnti;
} }
...@@ -2421,6 +2430,14 @@ nr_rrc_ue_decode_dcch( ...@@ -2421,6 +2430,14 @@ nr_rrc_ue_decode_dcch(
gNB_indexP); gNB_indexP);
break; break;
case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: 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; break;
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer:
{ {
...@@ -2804,3 +2821,29 @@ void rrc_ue_generate_RRCReestablishmentRequest( const protocol_ctxt_t *const ctx ...@@ -2804,3 +2821,29 @@ void rrc_ue_generate_RRCReestablishmentRequest( const protocol_ctxt_t *const ctx
itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p); itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
#endif #endif
} }
void
nr_rrc_ue_generate_rrcReestablishmentComplete(
const protocol_ctxt_t *const ctxt_pP,
NR_RRCReestablishment_t *rrcReestablishment,
uint8_t gNB_index
)
//-----------------------------------------------------------------------------
{
uint32_t length;
uint8_t buffer[100];
length = do_RRCReestablishmentComplete(buffer, rrcReestablishment->rrc_TransactionIdentifier);
#ifdef ITTI_SIM
MessageDef *message_p;
uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM,length);
memcpy (message_buffer, buffer, length);
message_p = itti_alloc_new_message (TASK_RRC_NRUE, UE_RRC_DCCH_DATA_IND);
UE_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
UE_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer;
UE_RRC_DCCH_DATA_IND (message_p).size = length;
itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
#endif
}
\ No newline at end of file
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