diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 8e5751a190..12362105bd 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -476,11 +476,11 @@ int main( int argc, char **argv ) { #endif LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); - PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE **)); - PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE *) * MAX_NUM_CCs); + PHY_vars_UE_g = malloc(sizeof(*PHY_vars_UE_g)); + PHY_vars_UE_g[0] = malloc(sizeof(*PHY_vars_UE_g[0]) * MAX_NUM_CCs); for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - PHY_vars_UE_g[0][CC_id] = (PHY_VARS_NR_UE *)malloc(sizeof(PHY_VARS_NR_UE)); - memset(PHY_vars_UE_g[0][CC_id], 0, sizeof(PHY_VARS_NR_UE)); + PHY_vars_UE_g[0][CC_id] = malloc(sizeof(*PHY_vars_UE_g[0][CC_id])); + memset(PHY_vars_UE_g[0][CC_id], 0, sizeof(*PHY_vars_UE_g[0][CC_id])); } init_NR_UE(1, uecap_file, reconfig_file, rbconfig_file); diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 867ec10b05..aceec80613 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -3278,7 +3278,7 @@ uint16_t get_rb_bwp_dci(nr_dci_format_t format, uint16_t nr_dci_size(const NR_UE_DL_BWP_t *DL_BWP, const NR_UE_UL_BWP_t *UL_BWP, - NR_CrossCarrierSchedulingConfig_t *crossCarrierSchedulingConfig, + const NR_CrossCarrierSchedulingConfig_t *crossCarrierSchedulingConfig, long pdsch_HARQ_ACK_Codebook, dci_pdu_rel15_t *dci_pdu, nr_dci_format_t format, diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index c460119612..fab681d8f0 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -95,7 +95,7 @@ NR_tda_info_t get_dl_tda_info(const NR_UE_DL_BWP_t *dl_BWP, int ss_type, int tda uint16_t nr_dci_size(const NR_UE_DL_BWP_t *DL_BWP, const NR_UE_UL_BWP_t *UL_BWP, - NR_CrossCarrierSchedulingConfig_t *crossCarrierSchedulingConfig, + const NR_CrossCarrierSchedulingConfig_t *crossCarrierSchedulingConfig, long pdsch_HARQ_ACK_Codebook, dci_pdu_rel15_t *dci_pdu, nr_dci_format_t format, diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 6cb0ef23ef..8de21221f1 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -802,7 +802,6 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id, LOG_I(MAC,"Applying CellGroupConfig from gNodeB\n"); AssertFatal(cell_group_config, "CellGroupConfig should not be NULL\n"); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); - mac->cg = cell_group_config; if (cell_group_config->mac_CellGroupConfig) { // TODO handle MAC-CellGroupConfig diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 6182a0bf72..bec654260c 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -427,16 +427,12 @@ typedef struct ssb_list_info { /*!\brief Top level UE MAC structure */ typedef struct { NR_UE_L2_STATE_t state; - NR_CellGroupConfig_t *cg; int servCellIndex; long physCellId; //// MAC config int first_sync_frame; bool get_sib1; bool get_otherSI; - NR_DRX_Config_t *drx_Config; - NR_SchedulingRequestConfig_t *schedulingRequestConfig; - NR_RNTI_Value_t *cs_RNTI; NR_MIB_t *mib; struct NR_SI_SchedulingInfo *si_SchedulingInfo; int si_window_start; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index ccd92df77a..d77cfd6a47 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -147,7 +147,6 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, static void nr_rrc_ue_generate_RRCSetupRequest(rnti_t rnti); static void nr_rrc_ue_generate_rrcReestablishmentComplete(NR_RRCReestablishment_t *rrcReestablishment); static void process_lte_nsa_msg(NR_UE_RRC_INST_t *rrc, nsa_msg_t *msg, int msg_len); -static void configure_spcell(NR_UE_RRC_INST_t *rrc, NR_SpCellConfig_t *spcell_config); static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, int gNB_index, rnti_t rnti, @@ -175,8 +174,6 @@ static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, NR_RRCReconfiguration_IEs_t *ie = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration; if (ie->radioBearerConfig != NULL) { - if (rrc->radio_bearer_config == NULL) - rrc->radio_bearer_config = ie->radioBearerConfig; LOG_I(NR_RRC, "radio Bearer Configuration is present\n"); nr_rrc_ue_process_RadioBearerConfig(rrc, rnti, rrcNB, ie->radioBearerConfig); if (LOG_DEBUGFLAG(DEBUG_ASN1)) @@ -328,11 +325,11 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file) rrcPerNB_t *ptr = &rrc->perNB[i]; ptr->SInfo = (NR_UE_RRC_SI_INFO){0}; for (int j = 0; j < NR_NUM_SRB; j++) - ptr->Srb[j] = (NR_UE_RRC_SRB_INFO_t){0}; + ptr->Srb[j] = RB_NOT_PRESENT; for (int j = 0; j < MAX_DRBS_PER_UE; j++) ptr->status_DRBs[j] = RB_NOT_PRESENT; // SRB0 activated by default - ptr->Srb[0].status = RB_ESTABLISHED; + ptr->Srb[0] = RB_ESTABLISHED; } } @@ -695,7 +692,9 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(instance_t instance, if(SI_info->sib1) ASN_STRUCT_FREE(asn_DEF_NR_SIB1, SI_info->sib1); NR_SIB1_t *sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; - SI_info->sib1 = sib1; + if(!SI_info->sib1) + SI_info->sib1 = calloc(1, sizeof(*SI_info->sib1)); + memcpy(SI_info->sib1, sib1, sizeof(NR_SIB1_t)); if(g_log->log_component[NR_RRC].level >= OAILOG_DEBUG) xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void *) SI_info->sib1); LOG_A(NR_RRC, "SIB1 decoded\n"); @@ -794,8 +793,8 @@ void nr_rrc_cellgroup_configuration(rrcPerNB_t *rrcNB, rrc->rnti = reconfigurationWithSync->newUE_Identity; // resume suspended radio bearers for (int i = 0; i < NR_NUM_SRB; i++) { - if (rrcNB->Srb[i].status == RB_SUSPENDED) - rrcNB->Srb[i].status = RB_ESTABLISHED; + if (rrcNB->Srb[i] == RB_SUSPENDED) + rrcNB->Srb[i] = RB_ESTABLISHED; } for (int i = 0; i < MAX_DRBS_PER_UE; i++) { if (rrcNB->status_DRBs[i] == RB_SUSPENDED) @@ -1030,7 +1029,7 @@ static void nr_rrc_ue_process_securityModeCommand(NR_UE_RRC_INST_t *ue_rrc, uint8_t security_mode = ue_rrc->cipheringAlgorithm | (ue_rrc->integrityProtAlgorithm << 4); // configure lower layers to apply SRB integrity protection and ciphering for (int i = 1; i < NR_NUM_SRB; i++) { - if (ue_rrc->perNB[gNB_index].Srb[i].status == RB_ESTABLISHED) + if (ue_rrc->perNB[gNB_index].Srb[i] == RB_ESTABLISHED) nr_pdcp_config_set_security(rnti, i, security_mode, kRRCenc, kRRCint, kUPenc); } } else { @@ -1223,8 +1222,7 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, if (radioBearerConfig->srb_ToAddModList != NULL) { for (int cnt = 0; cnt < radioBearerConfig->srb_ToAddModList->list.count; cnt++) { struct NR_SRB_ToAddMod *srb = radioBearerConfig->srb_ToAddModList->list.array[cnt]; - NR_UE_RRC_SRB_INFO_t *Srb_info = &rrcNB->Srb[srb->srb_Identity]; - if (Srb_info->status == RB_NOT_PRESENT) + if (rrcNB->Srb[srb->srb_Identity] == RB_NOT_PRESENT) add_srb(false, rnti, radioBearerConfig->srb_ToAddModList->list.array[cnt], @@ -1238,7 +1236,7 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, if (srb->pdcp_Config && srb->pdcp_Config->t_Reordering) nr_pdcp_reconfigure_srb(rnti, srb->srb_Identity, *srb->pdcp_Config->t_Reordering); } - Srb_info->status = RB_ESTABLISHED; + rrcNB->Srb[srb->srb_Identity] = RB_ESTABLISHED; } } @@ -1413,10 +1411,10 @@ void nr_rrc_handle_ra_indication(NR_UE_RRC_INST_t *rrc, bool ra_succeeded) // reconfigurationWithSync is included in spCellConfig } } + void *rrc_nrue_task(void *args_p) { itti_mark_task_ready(TASK_RRC_NRUE); - while (1) { rrc_nrue(NULL); } @@ -1506,7 +1504,7 @@ void *rrc_nrue(void *notUsed) /* Transfer data to PDCP */ // check if SRB2 is created, if yes request data_req on SRB2 // error: the remote gNB is hardcoded here - rb_id_t srb_id = rrc->perNB[0].Srb[2].status == RB_ESTABLISHED ? 2 : 1; + rb_id_t srb_id = rrc->perNB[0].Srb[2] == RB_ESTABLISHED ? 2 : 1; nr_pdcp_data_req_srb(rrc->rnti, srb_id, 0, length, buffer, deliver_pdu_srb_rlc, NULL); break; } diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index 7160ff19c7..998f83e75c 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -180,17 +180,13 @@ typedef enum { typedef enum { RB_NOT_PRESENT, RB_ESTABLISHED, RB_SUSPENDED } NR_RB_status_t; -typedef struct NR_UE_RRC_SRB_INFO_s { - NR_RB_status_t status; -} NR_UE_RRC_SRB_INFO_t; - typedef struct rrcPerNB { NR_MeasObjectToAddMod_t *MeasObj[MAX_MEAS_OBJ]; NR_ReportConfigToAddMod_t *ReportConfig[MAX_MEAS_CONFIG]; NR_QuantityConfig_t *QuantityConfig; NR_MeasIdToAddMod_t *MeasId[MAX_MEAS_ID]; NR_MeasGapConfig_t *measGapConfig; - NR_UE_RRC_SRB_INFO_t Srb[NR_NUM_SRB]; + NR_RB_status_t Srb[NR_NUM_SRB]; NR_RB_status_t status_DRBs[MAX_DRBS_PER_UE]; bool active_RLC_entity[NR_MAX_NUM_LCID]; NR_UE_RRC_SI_INFO SInfo; @@ -199,7 +195,6 @@ typedef struct rrcPerNB { typedef struct NR_UE_RRC_INST_s { NR_MeasConfig_t *meas_config; - NR_RadioBearerConfig_t *radio_bearer_config; rrcPerNB_t perNB[NB_CNX_UE];