diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c index 217f77a0f3..c56ec01f94 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c @@ -4225,13 +4225,6 @@ ssize_t do_nrMeasurementReport(uint8_t *buffer, long rsrq_s, long rsrp_tar, long rsrq_tar) { - LOG_I(RRC, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~MICHAEL~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); - #if EMIT_ASN_DEBUG - #warning EMIT_ASN_DEBUG is enabled - #else - #error EMIT_ASN_DEBUG is disabled - #endif - LTE_UL_DCCH_Message_t ul_dcch_msg; memset(&ul_dcch_msg, 0, sizeof(ul_dcch_msg)); @@ -4253,14 +4246,9 @@ ssize_t do_nrMeasurementReport(uint8_t *buffer, mr_r8->measResultNeighCells = CALLOC(1, sizeof(*mr_r8->measResultNeighCells)); mr_r8->measResultNeighCells->present = LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15; - - LTE_MeasResultNR_r15_t *measResultNR_r15; - measResultNR_r15 = CALLOC(1, sizeof(*measResultNR_r15)); - measResultNR_r15->rsrpResult_r15 = &rsrp_tar; - measResultNR_r15->rsrqResult_r15 = &rsrq_tar; - LTE_MeasResultCellNR_r15_t *measResultCellNR_r15; measResultCellNR_r15 = CALLOC(1, sizeof(*measResultCellNR_r15)); + measResultCellNR_r15->ext1 //Melissa should be null measResultCellNR_r15->pci_r15 = phy_id; measResultCellNR_r15->measResultCell_r15.rsrpResult_r15 = &rsrp_tar; measResultCellNR_r15->measResultCell_r15.rsrqResult_r15 = &rsrq_tar; diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index 803725ba69..4044d10e07 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -1736,6 +1736,29 @@ rrc_ue_process_ueCapabilityEnquiry( buffer, PDCP_TRANSMISSION_MODE_CONTROL); } + else if (*UECapabilityEnquiry->criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.array[i] + == LTE_RAT_Type_nr) { + ASN_SEQUENCE_ADD( + &ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list, + &ue_CapabilityRAT_Container); + enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_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_LTE_UL_DCCH_Message, (void *)&ul_dcch_msg); + } + + LOG_A(RRC,"NR_UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); + rrc_data_req_ue ( + ctxt_pP, + DCCH, + rrc_mui++, + SDU_CONFIRM_NO, + (enc_rval.encoded + 7) / 8, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + } } } @@ -1777,6 +1800,9 @@ rrc_ue_process_rrcConnectionReconfiguration( LOG_I(RRC,"Radio Resource Configuration is present\n"); rrc_ue_process_radioResourceConfigDedicated(ctxt_pP,eNB_index, rrcConnectionReconfiguration_r8->radioResourceConfigDedicated); } + /* Melissa: Here we need to open up container to get r_15 non-criticalExtensions. Look in + eNB as to how this message is put into the container. Need scg_group_config and scg_RB_config. + These two need to be sent over to the NR UE. */ //TTN for D2D //if RRCConnectionReconfiguration message includes the sl-CommConfig @@ -2259,11 +2285,17 @@ rrc_ue_decode_dcch( LOG_I(RRC, "[UE %d] Received Capability Enquiry (eNB %d)\n", ctxt_pP->module_id, eNB_indexP); - /* Melissa: Here we can see if the UE is now in NSA mode. If it is, then - we will send the nrUECapabilityEnquiry and handle this type of message - differently in the NR UE. */ - #if 0 - if () { + + LTE_UE_CapabilityRequest_t *ue_cap = &dl_dcch_msg->message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions. + choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest; + bool have_received_nrue_cap = false; + for (int i = 0; i < ue_cap->list.count; i++) { + if (*ue_cap->list.array[i] == LTE_RAT_Type_nr || *ue_cap->list.array[i] == LTE_RAT_Type_eutra_nr) { + have_received_nrue_cap = true; + break; + } + } + if (have_received_nrue_cap) { LTE_UECapabilityEnquiry_t *ueCapabilityEnquiry_nsa = &dl_dcch_msg->message.choice.c1.choice.ueCapabilityEnquiry; OCTET_STRING_t * requestedFreqBandsNR = ueCapabilityEnquiry_nsa-> criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.nonCriticalExtension-> @@ -2277,9 +2309,7 @@ rrc_ue_decode_dcch( } info->dl_dcch_msg = dl_dcch_msg; dl_dcch_msg = NULL; - } else if softmodem... - #endif - if (get_softmodem_params()->nsa) { + } else if (get_softmodem_params()->nsa && !have_received_nrue_cap) { LTE_UECapabilityEnquiry_t *ueCapabilityEnquiry_nsa = &dl_dcch_msg->message.choice.c1.choice.ueCapabilityEnquiry; OCTET_STRING_t * requestedFreqBandsNR = ueCapabilityEnquiry_nsa-> criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.nonCriticalExtension-> @@ -6299,8 +6329,7 @@ void process_nr_nsa_msg(nsa_msg_t *msg, int msg_len) { case UE_CAPABILITY_INFO: { - LOG_D(RRC, "Processing a UE_CAPABILITY_INFO message \n"); - LOG_I(RRC, "Send itti msg to trigger processing of capabilites b/c we have a UE_CAPABILITY_INFO\n"); + LOG_I(RRC, "Create itti msg to send received UE_CAPABILITY_INFO to eNB\n"); MessageDef *message_p; rrc_dcch_data_copy_t *dl_dcch_buffer = itti_malloc (TASK_RRC_NSA_UE, TASK_RRC_UE, @@ -6313,16 +6342,7 @@ void process_nr_nsa_msg(nsa_msg_t *msg, int msg_len) RRC_DCCH_DATA_COPY_IND (message_p).sdu_size = sizeof(rrc_dcch_data_copy_t); RRC_DCCH_DATA_COPY_IND (message_p).eNB_index = 0; itti_send_msg_to_task (TASK_RRC_UE, 0, message_p); - LOG_D(RRC, "Sent itti RRC_DCCH_DATA_COPY_IND\n"); - break; - /* Melissa: - 1. Set these parameters if we get UE_CAPABILITY_INFO message: - a. irat-ParametersNR-r15 - b. featureSetsEUTRA-r15 - c. pdcp-ParametersNR-r15 - 2. Print the contents of each parameter - 3. Call OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) - and pass in the UE CAPABILITY INFO */ + LOG_I(RRC, "Sent itti RRC_DCCH_DATA_COPY_IND\n"); break; } case UE_CAPABILITY_DUMMY: diff --git a/openair2/RRC/LTE/rrc_eNB_endc.c b/openair2/RRC/LTE/rrc_eNB_endc.c index 3d3d9787b5..f7113eb6da 100644 --- a/openair2/RRC/LTE/rrc_eNB_endc.c +++ b/openair2/RRC/LTE/rrc_eNB_endc.c @@ -171,8 +171,10 @@ int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt, OCTET_STRING_t dummy_scg_conf; unsigned char scg_conf_buf[4] = { 0, 0, 0, 0 }; - if (scg_group_config!=NULL) + if (scg_group_config!=NULL) { nr.choice.setup.nr_SecondaryCellGroupConfig_r15 = scg_group_config; //&scg_conf; + LOG_E(RRC, "Melissa, setting scg_group_config\n"); + } else{ nr.choice.setup.nr_SecondaryCellGroupConfig_r15 = &dummy_scg_conf; dummy_scg_conf.buf = scg_conf_buf; @@ -197,8 +199,10 @@ int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt, OCTET_STRING_t dummy_nr1_conf; unsigned char nr1_buf[4] = { 0, 0, 0, 0 }; - if(scg_RB_config!=NULL) + if(scg_RB_config!=NULL) { cr_1510.nr_RadioBearerConfig1_r15 = scg_RB_config; + LOG_E(RRC, "Melissa, setting scg_RB_config\n"); + } else{ cr_1510.nr_RadioBearerConfig1_r15 = &dummy_nr1_conf; dummy_nr1_conf.buf = nr1_buf; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index b77a327133..a6073af11f 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -2976,6 +2976,43 @@ static void start_oai_nrue_threads() init_nrUE_standalone_thread(ue_id_g); } +static void nsa_rrc_ue_process_ueCapabilityEnquiry(void) +{ + NR_UE_NR_Capability_t *UE_Capability_nr = CALLOC(1, sizeof(NR_UE_NR_Capability_t)); + NR_BandNR_t *nr_bandnr = CALLOC(1, sizeof(NR_BandNR_t)); + nr_bandnr->bandNR = 78; + ASN_SEQUENCE_ADD(&UE_Capability_nr->rf_Parameters.supportedBandListNR.list, nr_bandnr); + OAI_NR_UECapability_t *UECap = CALLOC(1, sizeof(OAI_NR_UECapability_t)); + UECap->UE_NR_Capability = UE_Capability_nr; + + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UE_NR_Capability, + NULL, + (void *)UE_Capability_nr, + &UECap->sdu[0], + MAX_UE_NR_CAPABILITY_SIZE); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + UECap->sdu_size = (enc_rval.encoded + 7) / 8; + LOG_I(NR_RRC, "[NR_RRC] NRUE Capability encoded, %d bytes (%zd bits)\n", + UECap->sdu_size, enc_rval.encoded + 7); + + NR_UE_rrc_inst[0].UECap = UECap; + NR_UE_rrc_inst[0].UECapability = UECap->sdu; + NR_UE_rrc_inst[0].UECapability_size = UECap->sdu_size; + + NR_UE_CapabilityRAT_Container_t ue_CapabilityRAT_Container; + memset(&ue_CapabilityRAT_Container, 0, sizeof(NR_UE_CapabilityRAT_Container_t)); + ue_CapabilityRAT_Container.rat_Type = NR_RAT_Type_nr; + OCTET_STRING_fromBuf(&ue_CapabilityRAT_Container.ue_CapabilityRAT_Container, + (const char *)NR_UE_rrc_inst[0].UECapability, + NR_UE_rrc_inst[0].UECapability_size); + ue_CapabilityRAT_Container.ue_CapabilityRAT_Container.buf = NR_UE_rrc_inst[0].UECapability; + ue_CapabilityRAT_Container.ue_CapabilityRAT_Container.size = NR_UE_rrc_inst[0].UECapability_size; + nsa_sendmsg_to_lte_ue(ue_CapabilityRAT_Container.ue_CapabilityRAT_Container.buf, + ue_CapabilityRAT_Container.ue_CapabilityRAT_Container.size, + UE_CAPABILITY_INFO); +} + void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len) { LOG_I(NR_RRC, "We are processing an NSA message\n"); @@ -3023,18 +3060,11 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len) if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { SEQUENCE_free(&asn_DEF_NR_FreqBandList, nr_freq_band_list, ASFM_FREE_EVERYTHING); - LOG_E(RRC, "Failed to decode UECapabilityInfo (%zu bits)\n", dec_rval.consumed); + LOG_E(NR_RRC, "Failed to decode UECapabilityInfo (%zu bits)\n", dec_rval.consumed); break; } - for (int i = 0; i < nr_freq_band_list->list.count; i++) - { - LOG_D(NR_RRC, "Received NR band information: %ld.\n", - nr_freq_band_list->list.array[i]->choice.bandInformationNR->bandNR); - } - MessageDef *nrue_cap_info = itti_alloc_new_message(TASK_RRC_NSA_UE, 0, UE_CAPABILITY_INFO); - LOG_I(NR_RRC, "We are calling nsa_sendmsg_to_lte_ue to send a UE_CAPABILITY_INFO\n"); - nsa_sendmsg_to_lte_ue(nrue_cap_info, sizeof(nrue_cap_info), UE_CAPABILITY_INFO); - LOG_I(NR_RRC, "We have sent a UE_CAPABILITY_INFO\n"); + LOG_I(NR_RRC, "Calling nsa_rrc_ue_process_ueCapabilityEnquiry\n"); + nsa_rrc_ue_process_ueCapabilityEnquiry(); break; }