diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 756b4fde82..a62b780349 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -476,93 +476,6 @@ void set_default_frame_parms(nfapi_nr_config_request_scf_t *config[MAX_NUM_CCs], } } -/* -void init_openair0(void) { - - int card; - int i; - - for (card=0; cardrf_config.dl_carrier_bandwidth.value == 100) { - if (frame_parms[0]->threequarter_fs) { - openair0_cfg[card].sample_rate=23.04e6; - openair0_cfg[card].samples_per_frame = 230400; - openair0_cfg[card].tx_bw = 10e6; - openair0_cfg[card].rx_bw = 10e6; - } else { - openair0_cfg[card].sample_rate=30.72e6; - openair0_cfg[card].samples_per_frame = 307200; - openair0_cfg[card].tx_bw = 10e6; - openair0_cfg[card].rx_bw = 10e6; - } - } else if(config[0]->rf_config.dl_carrier_bandwidth.value == 50) { - openair0_cfg[card].sample_rate=15.36e6; - openair0_cfg[card].samples_per_frame = 153600; - openair0_cfg[card].tx_bw = 5e6; - openair0_cfg[card].rx_bw = 5e6; - } else if (config[0]->rf_config.dl_carrier_bandwidth.value == 25) { - openair0_cfg[card].sample_rate=7.68e6; - openair0_cfg[card].samples_per_frame = 76800; - openair0_cfg[card].tx_bw = 2.5e6; - openair0_cfg[card].rx_bw = 2.5e6; - } else if (config[0]->rf_config.dl_carrier_bandwidth.value == 6) { - openair0_cfg[card].sample_rate=1.92e6; - openair0_cfg[card].samples_per_frame = 19200; - openair0_cfg[card].tx_bw = 1.5e6; - openair0_cfg[card].rx_bw = 1.5e6; - } - - - if (config[0]->subframe_config.duplex_mode.value==TDD) - openair0_cfg[card].duplex_mode = duplex_mode_TDD; - else //FDD - openair0_cfg[card].duplex_mode = duplex_mode_FDD; - - printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card, - RC.gNB[0]->gNB_config.rf_config.tx_antenna_ports.value, - RC.gNB[0]->gNB_config.rf_config.tx_antenna_ports.value ); - openair0_cfg[card].Mod_id = 0; - - openair0_cfg[card].num_rb_dl=config[0]->rf_config.dl_carrier_bandwidth.value; - - openair0_cfg[card].clock_source = clock_source; - - - openair0_cfg[card].tx_num_channels=min(2,RC.gNB[0]->gNB_config.rf_config.tx_antenna_ports.value ); - openair0_cfg[card].rx_num_channels=min(2,RC.gNB[0]->gNB_config.rf_config.tx_antenna_ports.value ); - - for (i=0; i<4; i++) { - - if (irx_total_gain_dB; - - - openair0_cfg[card].configFilename = get_softmodem_params()->rf_config_file; - printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n", - card,i, openair0_cfg[card].tx_gain[i], - openair0_cfg[card].rx_gain[i], - openair0_cfg[card].tx_freq[i], - openair0_cfg[card].rx_freq[i]); - } - } // for loop on cards -} -*/ - void wait_RUs(void) { LOG_I(PHY,"Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask); // wait for all RUs to be configured over fronthaul @@ -807,12 +720,12 @@ if(!IS_SOFTMODEM_NOS1) if(IS_SOFTMODEM_NOS1) init_pdcp(); + if (RC.nb_nr_L1_inst > 0) + RCconfig_NR_L1(); + if (RC.nb_nr_inst > 0) { // don't create if node doesn't connect to RRC/S1/GTP AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n"); - } else { - printf("No ITTI, Initializing L1\n"); - RCconfig_NR_L1(); } /* Start the agent. If it is turned off in the configuration, it won't start */ diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 6be23582b1..5bf0a2c438 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -761,23 +761,6 @@ void init_NR_UE(int nb_inst, char* rrc_config_path) { AssertFatal((rrc_inst = nr_l3_init_ue(rrc_config_path)) != NULL, "can not initialize RRC module\n"); AssertFatal((mac_inst = nr_l2_init_ue(rrc_inst)) != NULL, "can not initialize L2 module\n"); AssertFatal((mac_inst->if_module = nr_ue_if_module_init(inst)) != NULL, "can not initialize IF module\n"); - - NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL; - if (mac_inst->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList) { - pusch_TimeDomainAllocationList = mac_inst->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList->choice.setup; - } - else if (mac_inst->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { - pusch_TimeDomainAllocationList = mac_inst->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; - } - - if (pusch_TimeDomainAllocationList) { - for(int i = 0; i < pusch_TimeDomainAllocationList->list.count; i++) { - AssertFatal(*pusch_TimeDomainAllocationList->list.array[i]->k2 >= DURATION_RX_TO_TX, - "Slot offset K2 (%ld) cannot be less than DURATION_RX_TO_TX (%d)\n", - *pusch_TimeDomainAllocationList->list.array[i]->k2, - DURATION_RX_TO_TX); - } - } } } diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index 5902c8cca8..4701e8fbdb 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -85,5 +85,7 @@ extern void reset_opp_meas(void); extern void print_opp_meas(void); void *UE_thread(void *arg); void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id, uint8_t abstraction_flag); +void init_nrUE_standalone_thread(int ue_idx); +extern void init_nrUE_single_thread_stub(int nb_inst); #endif diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index 67b72a6251..066f631a8d 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -130,7 +130,6 @@ typedef struct rrc_dcch_data_copy_t LTE_DL_DCCH_Message_t *dl_dcch_msg; } rrc_dcch_data_copy_t; - /** \brief Generates/Encodes RRCConnnectionSetupComplete message at UE * \param ctxt_pP Running context * \param eNB_index Index of corresponding eNB/CH @@ -176,7 +175,6 @@ rrc_ue_process_MBMSCountingRequest( static void process_nr_nsa_msg(nsa_msg_t *msg, int msg_len); static void nsa_sendmsg_to_nrue(const void *message, size_t msg_len, Rrc_Msg_Type_t msg_type); - protocol_ctxt_t ctxt_pP_local; @@ -788,7 +786,7 @@ rrc_ue_process_measConfig( } if (measConfig->measObjectToAddModList != NULL) { - LOG_D(RRC,"Measurement Object List is present\n"); + LOG_I(RRC,"Measurement Object List is present\n"); for (i=0; imeasObjectToAddModList->list.count; i++) { measObj = measConfig->measObjectToAddModList->list.array[i]; @@ -1998,12 +1996,19 @@ rrc_ue_decode_dcch( return; } - uper_decode(NULL, + asn_dec_rval_t dec_rval = uper_decode(NULL, &asn_DEF_LTE_DL_DCCH_Message, (void **)&dl_dcch_msg, (uint8_t *)Buffer, RRC_BUF_SIZE,0,0); + if (dec_rval.code != RC_OK && dec_rval.consumed == 0) + { + LOG_E(RRC, "%s: Failed to decode LTE_DL_DCC_Msg\n", __FUNCTION__); + SEQUENCE_free(&asn_DEF_LTE_DL_DCCH_Message, dl_dcch_msg, ASFM_FREE_EVERYTHING); + return; + } + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout,&asn_DEF_LTE_DL_DCCH_Message,(void *)dl_dcch_msg); } @@ -2297,6 +2302,10 @@ rrc_ue_decode_dcch( #ifndef NO_RRM send_msg(&S_rrc,msg_rrc_end_scan_req(ctxt_pP->module_id,eNB_indexP)); #endif + if (dl_dcch_msg != NULL) + { + SEQUENCE_free(&asn_DEF_LTE_DL_DCCH_Message, dl_dcch_msg, ASFM_FREE_EVERYTHING); + } } const char siWindowLength[9][5] = {"1ms","2ms","5ms","10ms","15ms","20ms","40ms","80ms","ERR"}; @@ -4149,6 +4158,7 @@ void rrc_ue_generate_MeasurementReport(protocol_ctxt_t *const ctxt_pP, uint8_t e // } } } + /* Melissa: also need to generate report based on MeasObj for 5G (can look in eNB for these)*/ } // Measurement report triggering, described in 36.331 Section 5.5.4.1: called periodically @@ -4207,7 +4217,7 @@ void ue_measurement_report_triggering(protocol_ctxt_t *const ctxt_pP, const uint LOG_D(RRC,"[UE %d] Frame %d : A3 event: check if a neighboring cell becomes offset better than serving to trigger a measurement event \n", ctxt_pP->module_id, ctxt_pP->frame); - if ((check_trigger_meas_event( + if ((check_trigger_meas_event( //Melissa: Need a similar check for 5G UE which will go ask NR UE for the report (measu report) ctxt_pP->module_id, ctxt_pP->frame, eNB_index, @@ -4506,6 +4516,7 @@ void *rrc_ue_task( void *args_p ) { instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); ue_mod_id = UE_INSTANCE_TO_MODULE_ID(instance); + /* TODO: Add case to handle nr-UE messages we want from nrUE RRC layer */ switch (ITTI_MSG_ID(msg_p)) { case TERMINATE_MESSAGE: LOG_W(RRC, " *** Exiting RRC thread\n"); @@ -4631,6 +4642,22 @@ void *rrc_ue_task( void *args_p ) { AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); break; + case RRC_DCCH_DATA_COPY_IND: + { + LOG_I(RRC, "[UE %d] Received %s. Now calling rrc_ue_process_ueCapabilityEnquiry\n", + ue_mod_id, ITTI_MSG_NAME (msg_p)); + rrc_dcch_data_copy_t *dl_dcch_buffer = (void *)RRC_DCCH_DATA_COPY_IND (msg_p).sdu_p; + AssertFatal(RRC_DCCH_DATA_COPY_IND (msg_p).sdu_size == sizeof(*dl_dcch_buffer), "Size of dl_dcch_buffer incorrect\n"); + rrc_ue_process_ueCapabilityEnquiry( + &ctxt, + &dl_dcch_buffer->dl_dcch_msg->message.choice.c1.choice.ueCapabilityEnquiry, + RRC_DCCH_DATA_COPY_IND (msg_p).eNB_index); + SEQUENCE_free(&asn_DEF_LTE_DL_DCCH_Message, dl_dcch_buffer->dl_dcch_msg, ASFM_FREE_EVERYTHING); + result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_COPY_IND (msg_p).sdu_p); + AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + break; + } + case NAS_KENB_REFRESH_REQ: memcpy((void *)UE_rrc_inst[ue_mod_id].kenb, (void *)NAS_KENB_REFRESH_REQ(msg_p).kenb, sizeof(UE_rrc_inst[ue_mod_id].kenb)); LOG_D(RRC, "[UE %d] Received %s: refreshed RRC::KeNB = " @@ -4980,9 +5007,10 @@ openair_rrc_top_init_ue( //init_SL_preconfig(&UE_rrc_inst[module_id],0); if (get_softmodem_params()->nsa == 1) { - LOG_I(RRC, "Calling process_nsa_message\n"); + //LOG_I(RRC, "Calling process_nsa_message\n"); //process_nsa_message(NR_UE_rrc_inst, nr_SecondaryCellGroupConfig_r15, buffer,msg_len); } + } else { UE_rrc_inst = NULL; } @@ -6196,4 +6224,3 @@ void process_nr_nsa_msg(nsa_msg_t *msg, int msg_len) LOG_E(RRC, "No NSA Message Found\n"); } } - diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 4d57ab4e16..fbf3a19fc6 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -60,10 +60,9 @@ int create_tasks(uint32_t enb_nb) { rc = itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL); AssertFatal(rc >= 0, "Create task for RRC eNB failed\n"); - if (EPC_MODE_ENABLED && ! ( split73==SPLIT73_DU ) ) { - rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for SCTP failed\n"); - } + rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for SCTP failed\n"); + if (EPC_MODE_ENABLED && !NODE_IS_DU(type) && ! ( split73==SPLIT73_DU ) ) { rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL); @@ -74,12 +73,13 @@ int create_tasks(uint32_t enb_nb) { } rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL); AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); - if (is_x2ap_enabled()) { + } + + if (is_x2ap_enabled()) { rc = itti_create_task(TASK_X2AP, x2ap_task, NULL); AssertFatal(rc >= 0, "Create task for X2AP failed\n"); - } else { + } else { LOG_I(X2AP, "X2AP is disabled.\n"); - } } if (NODE_IS_CU(type)) {