Commit c6e5ead2 authored by francescomani's avatar francescomani

some more RRC cleanup

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