Commit fce87828 authored by Wang He's avatar Wang He

fix error for CU and DU

parent 19fd05a9
...@@ -581,7 +581,7 @@ int main( int argc, char **argv ) { ...@@ -581,7 +581,7 @@ int main( int argc, char **argv ) {
ctxt_pP.enb_flag = ENB_FLAG_NO; ctxt_pP.enb_flag = ENB_FLAG_NO;
ctxt_pP.rnti = 0x1234; ctxt_pP.rnti = 0x1234;
node_type = ngran_UE; node_type = ngran_UE;
nr_rrc_ue_generate_RRCSetupRequest(&ctxt_pP, 0); nr_rrc_ue_generate_RRCSetupRequest(ctxt_pP.module_id, 0);
if (create_tasks_nrue(1) < 0) { if (create_tasks_nrue(1) < 0) {
printf("cannot create ITTI tasks\n"); printf("cannot create ITTI tasks\n");
exit(-1); // need a softer mode exit(-1); // need a softer mode
......
...@@ -96,7 +96,7 @@ void mac_top_init_gNB(void) ...@@ -96,7 +96,7 @@ void mac_top_init_gNB(void)
// These should be out of here later // These should be out of here later
pdcp_layer_init(); pdcp_layer_init();
if(IS_SOFTMODEM_NOS1 && !(get_softmodem_params()->do_ra || get_softmodem_params()->sa) ) // if(IS_SOFTMODEM_NOS1 && !(get_softmodem_params()->do_ra || get_softmodem_params()->sa) )
nr_DRB_preconfiguration(0x1234); nr_DRB_preconfiguration(0x1234);
rrc_init_nr_global_param(); rrc_init_nr_global_param();
......
...@@ -708,13 +708,13 @@ printf("\n"); ...@@ -708,13 +708,13 @@ printf("\n");
memcpy (message_buffer, buf, size); memcpy (message_buffer, buf, size);
if (first_dcch == 1) { if (first_dcch == 1) {
dec_rval = uper_decode(NULL, /* dec_rval = uper_decode(NULL,
&asn_DEF_NR_DL_DCCH_Message, &asn_DEF_NR_DL_DCCH_Message,
(void**)&dl_dcch_msg, (void**)&dl_dcch_msg,
&buf[2], &buf[2],
size-6,0,0); size-6,0,0);
if (dec_rval.code == RC_OK) { if (dec_rval.code == RC_OK) {
if (dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_securityModeCommand) { if (dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_securityModeCommand) { */
LOG_I(PDCP, "CU send securityModeCommand by F1AP_UE_CONTEXT_SETUP_REQ\n"); LOG_I(PDCP, "CU send securityModeCommand by F1AP_UE_CONTEXT_SETUP_REQ\n");
message_p = itti_alloc_new_message (TASK_PDCP_ENB, 0, F1AP_UE_CONTEXT_SETUP_REQ); message_p = itti_alloc_new_message (TASK_PDCP_ENB, 0, F1AP_UE_CONTEXT_SETUP_REQ);
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = message_buffer; F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = message_buffer;
...@@ -736,7 +736,7 @@ printf("\n"); ...@@ -736,7 +736,7 @@ printf("\n");
F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length = 1; F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length = 1;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup = &drb; F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup = &drb;
itti_send_msg_to_task (TASK_CU_F1, ctxt.module_id, message_p); itti_send_msg_to_task (TASK_CU_F1, ctxt.module_id, message_p);
} else { /* } else {
LOG_I(PDCP, "other NR_DL_DCCH_Message \n"); LOG_I(PDCP, "other NR_DL_DCCH_Message \n");
message_p = itti_alloc_new_message (TASK_PDCP_ENB, 0, F1AP_DL_RRC_MESSAGE); message_p = itti_alloc_new_message (TASK_PDCP_ENB, 0, F1AP_DL_RRC_MESSAGE);
F1AP_DL_RRC_MESSAGE (message_p).rrc_container = message_buffer; F1AP_DL_RRC_MESSAGE (message_p).rrc_container = message_buffer;
...@@ -752,7 +752,7 @@ printf("\n"); ...@@ -752,7 +752,7 @@ printf("\n");
} }
} else { } else {
LOG_E(PDCP, "error NR_DL_DCCH_Message \n"); LOG_E(PDCP, "error NR_DL_DCCH_Message \n");
} } */
} else { } else {
first_dcch = 1; first_dcch = 1;
message_p = itti_alloc_new_message (TASK_PDCP_ENB, 0, F1AP_DL_RRC_MESSAGE); message_p = itti_alloc_new_message (TASK_PDCP_ENB, 0, F1AP_DL_RRC_MESSAGE);
...@@ -882,12 +882,14 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP) ...@@ -882,12 +882,14 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP)
} }
} }
static void add_srb(int rnti, struct NR_SRB_ToAddMod *s) static void add_srb(int is_gnb, int rnti, struct NR_SRB_ToAddMod *s)
{ {
nr_pdcp_entity_t *pdcp_srb; nr_pdcp_entity_t *pdcp_srb;
nr_pdcp_ue_t *ue; nr_pdcp_ue_t *ue;
int srb_id = s->srb_Identity; int srb_id = s->srb_Identity;
int t_reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering);
int sn_size = 12;
if (srb_id > 3) { if (srb_id > 3) {
LOG_E(PDCP, "%s:%d:%s: fatal, bad srb id %d\n", LOG_E(PDCP, "%s:%d:%s: fatal, bad srb id %d\n",
...@@ -901,7 +903,11 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s) ...@@ -901,7 +903,11 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s)
LOG_W(PDCP, "%s:%d:%s: warning SRB %d already exist for ue %d, do nothing\n", LOG_W(PDCP, "%s:%d:%s: warning SRB %d already exist for ue %d, do nothing\n",
__FILE__, __LINE__, __FUNCTION__, srb_id, rnti); __FILE__, __LINE__, __FUNCTION__, srb_id, rnti);
} else { } else {
pdcp_srb = new_nr_pdcp_entity_srb(1, srb_id, deliver_sdu_srb, ue, deliver_pdu_srb, ue); // pdcp_srb = new_nr_pdcp_entity_srb(1, srb_id, deliver_sdu_srb, ue, deliver_pdu_srb, ue);
pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id,
deliver_sdu_srb, ue, deliver_pdu_srb, ue,
sn_size, t_reordering, 0,
0, 0, NULL, NULL);
nr_pdcp_ue_add_srb_pdcp_entity(ue, srb_id, pdcp_srb); nr_pdcp_ue_add_srb_pdcp_entity(ue, srb_id, pdcp_srb);
LOG_I(PDCP, "%s:%d:%s: added srb %d to ue 0x%x\n", LOG_I(PDCP, "%s:%d:%s: added srb %d to ue 0x%x\n",
...@@ -1021,7 +1027,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req( ...@@ -1021,7 +1027,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req(
if (srb2add_list != NULL) { if (srb2add_list != NULL) {
for (i = 0; i < srb2add_list->list.count; i++) { for (i = 0; i < srb2add_list->list.count; i++) {
add_srb(rnti, srb2add_list->list.array[i]); add_srb(ctxt_pP->enb_flag, rnti, srb2add_list->list.array[i]);
} }
} }
...@@ -1079,7 +1085,10 @@ void nr_DRB_preconfiguration(uint16_t crnti) ...@@ -1079,7 +1085,10 @@ void nr_DRB_preconfiguration(uint16_t crnti)
srb_ToAddMod->srb_Identity = 1; srb_ToAddMod->srb_Identity = 1;
srb_ToAddMod->reestablishPDCP = NULL; srb_ToAddMod->reestablishPDCP = NULL;
srb_ToAddMod->discardOnPDCP = NULL; srb_ToAddMod->discardOnPDCP = NULL;
srb_ToAddMod->pdcp_Config = NULL; // srb_ToAddMod->pdcp_Config = NULL;
srb_ToAddMod->pdcp_Config = calloc(1,sizeof(*srb_ToAddMod->pdcp_Config));
srb_ToAddMod->pdcp_Config->t_Reordering = calloc(1,sizeof(*srb_ToAddMod->pdcp_Config->t_Reordering));
*srb_ToAddMod->pdcp_Config->t_Reordering = NR_PDCP_Config__t_Reordering_ms0;
ASN_SEQUENCE_ADD(&rbconfig->srb_ToAddModList->list,srb_ToAddMod); ASN_SEQUENCE_ADD(&rbconfig->srb_ToAddModList->list,srb_ToAddMod);
rbconfig->srb3_ToRelease = NULL; rbconfig->srb3_ToRelease = NULL;
......
...@@ -493,6 +493,9 @@ rb_found: ...@@ -493,6 +493,9 @@ rb_found:
if (ccch_flag) { if (ccch_flag) {
/* for rfsim, because UE send RRCSetupRequest in SRB1 */ /* for rfsim, because UE send RRCSetupRequest in SRB1 */
LOG_I(RLC, "[MSG] RRC Setup Request\n"); LOG_I(RLC, "[MSG] RRC Setup Request\n");
uint8_t *message_buffer;
message_buffer = itti_malloc(TASK_RLC_ENB, TASK_DU_F1, size);
memcpy (message_buffer, buf, size);
msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_INITIAL_UL_RRC_MESSAGE); msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_INITIAL_UL_RRC_MESSAGE);
F1AP_INITIAL_UL_RRC_MESSAGE(msg).gNB_DU_ue_id = 0; F1AP_INITIAL_UL_RRC_MESSAGE(msg).gNB_DU_ue_id = 0;
F1AP_INITIAL_UL_RRC_MESSAGE(msg).mcc = RC.nrrrc[0]->configuration.mcc[0]; F1AP_INITIAL_UL_RRC_MESSAGE(msg).mcc = RC.nrrrc[0]->configuration.mcc[0];
...@@ -500,7 +503,9 @@ rb_found: ...@@ -500,7 +503,9 @@ rb_found:
F1AP_INITIAL_UL_RRC_MESSAGE(msg).mnc_digit_length = RC.nrrrc[0]->configuration.mnc_digit_length[0]; F1AP_INITIAL_UL_RRC_MESSAGE(msg).mnc_digit_length = RC.nrrrc[0]->configuration.mnc_digit_length[0];
F1AP_INITIAL_UL_RRC_MESSAGE(msg).nr_cellid = RC.nrrrc[0]->nr_cellid; F1AP_INITIAL_UL_RRC_MESSAGE(msg).nr_cellid = RC.nrrrc[0]->nr_cellid;
F1AP_INITIAL_UL_RRC_MESSAGE(msg).crnti = ue->rnti; F1AP_INITIAL_UL_RRC_MESSAGE(msg).crnti = ue->rnti;
F1AP_INITIAL_UL_RRC_MESSAGE(msg).rrc_container = (unsigned char *)buf; // F1AP_INITIAL_UL_RRC_MESSAGE(msg).rrc_container = (unsigned char *)buf;
F1AP_INITIAL_UL_RRC_MESSAGE(msg).rrc_container = message_buffer;
F1AP_INITIAL_UL_RRC_MESSAGE(msg).rrc_container_length = size; F1AP_INITIAL_UL_RRC_MESSAGE(msg).rrc_container_length = size;
itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0), msg); itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0), msg);
ccch_flag = 0; ccch_flag = 0;
......
...@@ -1023,6 +1023,9 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, ...@@ -1023,6 +1023,9 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
SRB1_config = calloc(1, sizeof(NR_SRB_ToAddMod_t)); SRB1_config = calloc(1, sizeof(NR_SRB_ToAddMod_t));
SRB1_config->srb_Identity = 1; SRB1_config->srb_Identity = 1;
// pdcp_Config->t_Reordering // pdcp_Config->t_Reordering
pdcp_Config = calloc(1,sizeof(*pdcp_Config));
pdcp_Config->t_Reordering = calloc(1,sizeof(*pdcp_Config->t_Reordering));
*pdcp_Config->t_Reordering = NR_PDCP_Config__t_Reordering_ms0;
SRB1_config->pdcp_Config = pdcp_Config; SRB1_config->pdcp_Config = pdcp_Config;
ie->radioBearerConfig.srb_ToAddModList = *SRB_configList; ie->radioBearerConfig.srb_ToAddModList = *SRB_configList;
ASN_SEQUENCE_ADD(&(*SRB_configList)->list, SRB1_config); ASN_SEQUENCE_ADD(&(*SRB_configList)->list, SRB1_config);
......
...@@ -706,6 +706,9 @@ rrc_gNB_generate_defaultRRCReconfiguration( ...@@ -706,6 +706,9 @@ rrc_gNB_generate_defaultRRCReconfiguration(
memset(*SRB_configList2, 0, sizeof(**SRB_configList2)); memset(*SRB_configList2, 0, sizeof(**SRB_configList2));
SRB2_config = CALLOC(1, sizeof(*SRB2_config)); SRB2_config = CALLOC(1, sizeof(*SRB2_config));
SRB2_config->srb_Identity = 2; SRB2_config->srb_Identity = 2;
SRB2_config->pdcp_Config = calloc(1,sizeof(*SRB2_config->pdcp_Config));
SRB2_config->pdcp_Config->t_Reordering = calloc(1,sizeof(*SRB2_config->pdcp_Config->t_Reordering));
*SRB2_config->pdcp_Config->t_Reordering = NR_PDCP_Config__t_Reordering_ms0;
ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config);
ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
......
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