Commit 4766f3a6 authored by Xue Song's avatar Xue Song

fix RRCReconfiguration/RRCReconfigurationComplete

parent 4421bc56
...@@ -65,6 +65,9 @@ ...@@ -65,6 +65,9 @@
#include "NR_SecurityConfig.h" #include "NR_SecurityConfig.h"
#include "NR_RRCReconfiguration-v1530-IEs.h" #include "NR_RRCReconfiguration-v1530-IEs.h"
#include "NR_UL-DCCH-Message.h" #include "NR_UL-DCCH-Message.h"
#include "NR_SDAP-Config.h"
#include "NR_RRCReconfigurationComplete.h"
#include "NR_RRCReconfigurationComplete-IEs.h"
#if defined(NR_Rel16) #if defined(NR_Rel16)
#include "NR_SCS-SpecificCarrier.h" #include "NR_SCS-SpecificCarrier.h"
#include "NR_TDD-UL-DL-ConfigCommon.h" #include "NR_TDD-UL-DL-ConfigCommon.h"
...@@ -952,6 +955,7 @@ uint16_t do_RRCReconfiguration( ...@@ -952,6 +955,7 @@ uint16_t do_RRCReconfiguration(
NR_DRB_ToAddModList_t *DRB_configList = NULL; NR_DRB_ToAddModList_t *DRB_configList = NULL;
NR_DRB_ToAddModList_t *DRB_configList2 = NULL; NR_DRB_ToAddModList_t *DRB_configList2 = NULL;
NR_DRB_ToAddMod_t *DRB_config = NULL; NR_DRB_ToAddMod_t *DRB_config = NULL;
NR_SDAP_Config_t *sdap_config = NULL;
NR_SecurityConfig_t *security_config = NULL; NR_SecurityConfig_t *security_config = NULL;
NR_DedicatedNAS_Message_t *dedicatedNAS_Message = NULL; NR_DedicatedNAS_Message_t *dedicatedNAS_Message = NULL;
...@@ -1003,6 +1007,9 @@ uint16_t do_RRCReconfiguration( ...@@ -1003,6 +1007,9 @@ uint16_t do_RRCReconfiguration(
DRB_config->cnAssociation = CALLOC(1, sizeof(*DRB_config->cnAssociation)); DRB_config->cnAssociation = CALLOC(1, sizeof(*DRB_config->cnAssociation));
DRB_config->cnAssociation->present = NR_DRB_ToAddMod__cnAssociation_PR_sdap_Config; DRB_config->cnAssociation->present = NR_DRB_ToAddMod__cnAssociation_PR_sdap_Config;
// TODO sdap_Config // TODO sdap_Config
sdap_config = CALLOC(1, sizeof(NR_SDAP_Config_t));
memset(sdap_config, 0, sizeof(NR_SDAP_Config_t));
DRB_config->cnAssociation->choice.sdap_Config = sdap_config;
// TODO pdcp_Config // TODO pdcp_Config
DRB_config->reestablishPDCP = NULL; DRB_config->reestablishPDCP = NULL;
DRB_config->recoverPDCP = NULL; DRB_config->recoverPDCP = NULL;
...@@ -1068,6 +1075,10 @@ uint16_t do_RRCReconfiguration( ...@@ -1068,6 +1075,10 @@ uint16_t do_RRCReconfiguration(
dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration = ie; dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration = ie;
// if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg);
// }
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message,
NULL, NULL,
(void *)&dl_dcch_msg, (void *)&dl_dcch_msg,
...@@ -1093,6 +1104,15 @@ uint16_t do_RRCReconfiguration( ...@@ -1093,6 +1104,15 @@ uint16_t do_RRCReconfiguration(
return(-1); return(-1);
} }
#ifdef ITTI_SIM
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_DCCH_DATA_IND);
GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
GNB_RRC_DCCH_DATA_IND (message_p).sdu = (uint8_t*)buffer;
GNB_RRC_DCCH_DATA_IND (message_p).size = (enc_rval.encoded+7)/8;
itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
#endif
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
...@@ -1162,8 +1182,10 @@ do_NR_RRCReconfigurationComplete( ...@@ -1162,8 +1182,10 @@ do_NR_RRCReconfigurationComplete(
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_UL_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_rrcReconfigurationComplete; ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete;
ul_dcch_msg.message.choice.c1->choice.rrcReconfigurationComplete = CALLOC(1, sizeof(NR_RRCReconfigurationComplete_t));
rrcReconfigurationComplete = ul_dcch_msg.message.choice.c1->choice.rrcReconfigurationComplete; rrcReconfigurationComplete = ul_dcch_msg.message.choice.c1->choice.rrcReconfigurationComplete;
rrcReconfigurationComplete->rrc_TransactionIdentifier = Transaction_id; rrcReconfigurationComplete->rrc_TransactionIdentifier = Transaction_id;
rrcReconfigurationComplete->criticalExtensions.choice.rrcReconfigurationComplete = CALLOC(1, sizeof(NR_RRCReconfigurationComplete_IEs_t));
rrcReconfigurationComplete->criticalExtensions.present = rrcReconfigurationComplete->criticalExtensions.present =
NR_RRCReconfigurationComplete__criticalExtensions_PR_rrcReconfigurationComplete; NR_RRCReconfigurationComplete__criticalExtensions_PR_rrcReconfigurationComplete;
rrcReconfigurationComplete->criticalExtensions.choice.rrcReconfigurationComplete->nonCriticalExtension = NULL; rrcReconfigurationComplete->criticalExtensions.choice.rrcReconfigurationComplete->nonCriticalExtension = NULL;
......
...@@ -535,6 +535,14 @@ rrc_gNB_generate_defaultRRCReconfiguration( ...@@ -535,6 +535,14 @@ rrc_gNB_generate_defaultRRCReconfiguration(
ue_context_pP->ue_context.rnti, ue_context_pP->ue_context.rnti,
rrc_gNB_mui, rrc_gNB_mui,
size); size);
#ifdef ITTI_SIM
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_DCCH_DATA_IND);
GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
GNB_RRC_DCCH_DATA_IND (message_p).sdu = (uint8_t*)buffer;
GNB_RRC_DCCH_DATA_IND (message_p).size = size;
itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
#else
rrc_data_req(ctxt_pP, rrc_data_req(ctxt_pP,
DCCH, DCCH,
rrc_gNB_mui++, rrc_gNB_mui++,
...@@ -542,7 +550,7 @@ rrc_gNB_generate_defaultRRCReconfiguration( ...@@ -542,7 +550,7 @@ rrc_gNB_generate_defaultRRCReconfiguration(
size, size,
buffer, buffer,
PDCP_TRANSMISSION_MODE_CONTROL); PDCP_TRANSMISSION_MODE_CONTROL);
#endif
// rrc_pdcp_config_asn1_req // rrc_pdcp_config_asn1_req
// rrc_rlc_config_asn1_req // rrc_rlc_config_asn1_req
} }
...@@ -571,12 +579,12 @@ rrc_gNB_process_RRCReconfigurationComplete( ...@@ -571,12 +579,12 @@ rrc_gNB_process_RRCReconfigurationComplete(
rnti_t rnti = ue_context_pP->ue_id_rnti; rnti_t rnti = ue_context_pP->ue_id_rnti;
module_id_t module_id = ctxt_pP->module_id; module_id_t module_id = ctxt_pP->module_id;
int UE_id_mac = find_UE_id(module_id, rnti); // int UE_id_mac = find_UE_id(module_id, rnti);
if (UE_id_mac == -1) { // if (UE_id_mac == -1) {
LOG_E(RRC, "Can't find UE_id(MAC) of UE rnti %x\n", rnti); // LOG_E(RRC, "Can't find UE_id(MAC) of UE rnti %x\n", rnti);
return; // return;
} // }
/* Derive the keys from kgnb */ /* Derive the keys from kgnb */
if (DRB_configList != NULL) { if (DRB_configList != NULL) {
...@@ -597,24 +605,24 @@ rrc_gNB_process_RRCReconfigurationComplete( ...@@ -597,24 +605,24 @@ rrc_gNB_process_RRCReconfigurationComplete(
MSC_AS_TIME_ARGS(ctxt_pP), MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP->ue_context.rnti); ue_context_pP->ue_context.rnti);
nr_rrc_pdcp_config_asn1_req(ctxt_pP, // nr_rrc_pdcp_config_asn1_req(ctxt_pP,
SRB_configList, // NULL, // SRB_configList, // NULL,
DRB_configList, // DRB_configList,
DRB_Release_configList2, // DRB_Release_configList2,
0xff, // already configured during the securitymodecommand // 0xff, // already configured during the securitymodecommand
kRRCenc, // kRRCenc,
kRRCint, // kRRCint,
kUPenc, // kUPenc,
NULL, // NULL,
NULL, // NULL,
NULL); // NULL);
/* Refresh SRBs/DRBs */ // /* Refresh SRBs/DRBs */
nr_rrc_rlc_config_asn1_req(ctxt_pP, // nr_rrc_rlc_config_asn1_req(ctxt_pP,
SRB_configList, // NULL, // SRB_configList, // NULL,
DRB_configList, // DRB_configList,
DRB_Release_configList2, // DRB_Release_configList2,
NULL, // NULL,
NULL); // NULL);
/* Loop through DRBs and establish if necessary */ /* Loop through DRBs and establish if necessary */
if (DRB_configList != NULL) { if (DRB_configList != NULL) {
...@@ -1092,6 +1100,8 @@ rrc_gNB_decode_dcch( ...@@ -1092,6 +1100,8 @@ rrc_gNB_decode_dcch(
// if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)ul_dcch_msg); xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)ul_dcch_msg);
// } // }
rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p);
break; break;
case NR_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: case NR_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation:
...@@ -1281,13 +1291,6 @@ void *rrc_gnb_task(void *args_p) { ...@@ -1281,13 +1291,6 @@ void *rrc_gnb_task(void *args_p) {
NR_RRC_DCCH_DATA_IND(msg_p).dcch_index, NR_RRC_DCCH_DATA_IND(msg_p).dcch_index,
NR_RRC_DCCH_DATA_IND(msg_p).sdu_p, NR_RRC_DCCH_DATA_IND(msg_p).sdu_p,
NR_RRC_DCCH_DATA_IND(msg_p).sdu_size); NR_RRC_DCCH_DATA_IND(msg_p).sdu_size);
// Message buffer has been processed, free it now.
result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), NR_RRC_DCCH_DATA_IND(msg_p).sdu_p);
if (result != EXIT_SUCCESS) {
LOG_I(NR_RRC, "Failed to free memory (%d)!\n", result);
break;
}
break; break;
......
...@@ -1663,11 +1663,30 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t)); ...@@ -1663,11 +1663,30 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
(enc_rval.encoded + 7) / 8); (enc_rval.encoded + 7) / 8);
memcpy (message_buffer, buffer, (enc_rval.encoded + 7) / 8); memcpy (message_buffer, buffer, (enc_rval.encoded + 7) / 8);
message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, UE_RRC_CCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, UE_RRC_DCCH_DATA_IND);
GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
GNB_RRC_DCCH_DATA_IND (message_p).sdu = buffer; GNB_RRC_DCCH_DATA_IND (message_p).sdu = buffer;
GNB_RRC_DCCH_DATA_IND (message_p).size = (enc_rval.encoded + 7) / 8; 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); itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
asn_dec_rval_t dec_rval;
NR_UL_DCCH_Message_t *ul_dcch_msg = NULL;
dec_rval = uper_decode(
NULL,
&asn_DEF_NR_UL_DCCH_Message,
(void **)&ul_dcch_msg,
buffer,
(enc_rval.encoded + 7) / 8,
0,
0);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E(NR_RRC, " Failed to decode UL-DCCH (%zu bytes)\n",
dec_rval.consumed);
return -1;
} else {
LOG_I(NR_RRC, "decode securityModeComplete success\n");
}
#else #else
rrc_data_req ( rrc_data_req (
ctxt_pP, ctxt_pP,
...@@ -2159,6 +2178,14 @@ void nr_rrc_ue_generate_RRCReconfigurationComplete( const protocol_ctxt_t *const ...@@ -2159,6 +2178,14 @@ void nr_rrc_ue_generate_RRCReconfigurationComplete( const protocol_ctxt_t *const
nr_rrc_mui, nr_rrc_mui,
UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id),
DCCH); DCCH);
#ifdef ITTI_SIM
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, UE_RRC_DCCH_DATA_IND);
UE_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
UE_RRC_DCCH_DATA_IND (message_p).sdu = (uint8_t*)buffer;
UE_RRC_DCCH_DATA_IND (message_p).size = size;
itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
#else
rrc_data_req_ue ( rrc_data_req_ue (
ctxt_pP, ctxt_pP,
DCCH, DCCH,
...@@ -2167,6 +2194,8 @@ void nr_rrc_ue_generate_RRCReconfigurationComplete( const protocol_ctxt_t *const ...@@ -2167,6 +2194,8 @@ void nr_rrc_ue_generate_RRCReconfigurationComplete( const protocol_ctxt_t *const
size, size,
buffer, buffer,
PDCP_TRANSMISSION_MODE_CONTROL); PDCP_TRANSMISSION_MODE_CONTROL);
#endif
} }
// from NR SRB1 // from NR SRB1
...@@ -2340,9 +2369,6 @@ void *rrc_nrue_task( void *args_p ) { ...@@ -2340,9 +2369,6 @@ void *rrc_nrue_task( void *args_p ) {
NR_RRC_DCCH_DATA_IND (msg_p).dcch_index, NR_RRC_DCCH_DATA_IND (msg_p).dcch_index,
NR_RRC_DCCH_DATA_IND (msg_p).sdu_p, NR_RRC_DCCH_DATA_IND (msg_p).sdu_p,
NR_RRC_DCCH_DATA_IND (msg_p).gNB_index); NR_RRC_DCCH_DATA_IND (msg_p).gNB_index);
// Message buffer has been processed, free it now.
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), NR_RRC_DCCH_DATA_IND (msg_p).sdu_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
break; break;
default: default:
......
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