diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 086d80e4772bf8a2ced67e230d35008cc9aeda44..49eb8416f11bb40adc9b5303ac71f018501ce40e 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -53,6 +53,7 @@ #include <executables/softmodem-common.h> #include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" +#include "LAYER2/RLC/rlc.h" //#define SRS_DEBUG @@ -1153,7 +1154,6 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info) bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t gNB_index) { - mac_rlc_status_resp_t rlc_status; bool bsr_regular_triggered = false; uint8_t lcid; uint8_t lcgid; @@ -1196,7 +1196,7 @@ bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t lcgid_buffer_remain[lcgid] += mac->scheduling_info.LCID_buffer_remain[lcid]; } - rlc_status = mac_rlc_status_ind(module_idP, mac->crnti,gNB_index,frameP,slotP,ENB_FLAG_NO,MBMS_FLAG_NO, lcid, 0, 0); + mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(module_idP, mac->crnti,gNB_index,frameP,slotP,ENB_FLAG_NO,MBMS_FLAG_NO, lcid, 0, 0); lcid_bytes_in_buffer[lcid] = rlc_status.bytes_in_buffer; diff --git a/openair2/RRC/NR/nr_rrc_common.c b/openair2/RRC/NR/nr_rrc_common.c index c6f27c73256588c0ad54e1971e45aed48b452ea0..d8e2abb7348bf95f87c92d0d239796945ee1d74e 100644 --- a/openair2/RRC/NR/nr_rrc_common.c +++ b/openair2/RRC/NR/nr_rrc_common.c @@ -58,9 +58,8 @@ void rrc_init_nr_srb_param(NR_LCHAN_DESC *chan) //----------------------------------------------------------------------------- void rrc_config_nr_buffer(NR_SRB_INFO* Srb_info, uint8_t Lchan_type, - uint8_t Role - ){ - + uint8_t Role) +{ Srb_info->Rx_buffer.payload_size = 0; Srb_info->Tx_buffer.payload_size = 0; } diff --git a/openair2/RRC/NR/nr_rrc_common.h b/openair2/RRC/NR/nr_rrc_common.h new file mode 100644 index 0000000000000000000000000000000000000000..531332c0ece1db74ee095f7d95ce0de7acf038d3 --- /dev/null +++ b/openair2/RRC/NR/nr_rrc_common.h @@ -0,0 +1,91 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef __NR_RRC_COMMON_H__ +#define __NR_RRC_COMMON_H__ + +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> + +#define NR_RRC_HEADER_SIZE_MAX 64 +#define NR_RRC_BUFFER_SIZE_MAX 1024 + +typedef struct { + char Payload[NR_RRC_BUFFER_SIZE_MAX]; + char Header[NR_RRC_HEADER_SIZE_MAX]; + uint16_t payload_size; +} NR_RRC_BUFFER; + +typedef enum UE_STATE_NR_e { + NR_RRC_INACTIVE=0, + NR_RRC_IDLE, + NR_RRC_SI_RECEIVED, + NR_RRC_CONNECTED, + NR_RRC_RECONFIGURED, + NR_RRC_HO_EXECUTION +} NR_UE_STATE_t; + +typedef struct { + unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */ + unsigned short max_transport_blocks; /*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */ + unsigned long Guaranteed_bit_rate; /*!< \brief Guaranteed Bit Rate (average) to be offered by MAC layer scheduling*/ + unsigned long Max_bit_rate; /*!< \brief Maximum Bit Rate that can be offered by MAC layer scheduling*/ + uint8_t Delay_class; /*!< \brief Delay class offered by MAC layer scheduling*/ + uint8_t Target_bler; /*!< \brief Target Average Transport Block Error rate*/ + uint8_t Lchan_t; /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/ +} __attribute__ ((__packed__)) NR_LCHAN_DESC; + +typedef struct RB_INFO_NR_s { + uint16_t Rb_id; //=Lchan_id + NR_LCHAN_DESC Lchan_desc[2]; + //MAC_MEAS_REQ_ENTRY *Meas_entry; //may not needed for NB-IoT +} NR_RB_INFO; + +typedef struct NR_SRB_INFO_s { + uint16_t Srb_id; //=Lchan_id + NR_RRC_BUFFER Rx_buffer; + NR_RRC_BUFFER Tx_buffer; + NR_LCHAN_DESC Lchan_desc[2]; + unsigned int Trans_id; + uint8_t Active; +} NR_SRB_INFO; + + +typedef struct RB_INFO_TABLE_ENTRY_NR_s { + NR_RB_INFO Rb_info; + uint8_t Active; + uint32_t Next_check_frame; + uint8_t status; +} NR_RB_INFO_TABLE_ENTRY; + +typedef struct SRB_INFO_TABLE_ENTRY_NR_s { + NR_SRB_INFO Srb_info; + uint8_t Active; + uint8_t status; + uint32_t Next_check_frame; +} NR_SRB_INFO_TABLE_ENTRY; + +void rrc_init_nr_srb_param(NR_LCHAN_DESC *chan); +void rrc_config_nr_buffer(NR_SRB_INFO* Srb_info, + uint8_t Lchan_type, + uint8_t Role); +#endif diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 9887d8936740f8c5324950dcef60dbefc5bae18f..1b00c93b9d1cb3968c235cc4405e0b4e7dadd862 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -37,7 +37,7 @@ #include "collection/tree.h" #include "collection/linear_alloc.h" -#include "nr_rrc_types.h" +#include "nr_rrc_common.h" #include "common/ngran_types.h" #include "common/platform_constants.h" @@ -62,7 +62,7 @@ #include "NR_CellGroupConfig.h" #include "NR_ServingCellConfigCommon.h" #include "NR_EstablishmentCause.h" -#include "NR_SIB1.h" + //------------------- #include "intertask_interface.h" @@ -103,16 +103,6 @@ typedef enum { NR_RRC_HO_STARTED } NR_RRC_status_t; -typedef enum UE_STATE_NR_e { - NR_RRC_INACTIVE=0, - NR_RRC_IDLE, - NR_RRC_SI_RECEIVED, - NR_RRC_CONNECTED, - NR_RRC_RECONFIGURED, - NR_RRC_HO_EXECUTION -} NR_UE_STATE_t; - - #define RRM_FREE(p) if ( (p) != NULL) { free(p) ; p=NULL ; } #define RRM_MALLOC(t,n) (t *) malloc16( sizeof(t) * n ) #define RRM_CALLOC(t,n) (t *) malloc16( sizeof(t) * n) @@ -130,39 +120,6 @@ typedef enum UE_STATE_NR_e { /* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */ #define NR_RRC_TRANSACTION_IDENTIFIER_NUMBER 4 -typedef struct { - unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */ - unsigned short max_transport_blocks; /*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */ - unsigned long Guaranteed_bit_rate; /*!< \brief Guaranteed Bit Rate (average) to be offered by MAC layer scheduling*/ - unsigned long Max_bit_rate; /*!< \brief Maximum Bit Rate that can be offered by MAC layer scheduling*/ - uint8_t Delay_class; /*!< \brief Delay class offered by MAC layer scheduling*/ - uint8_t Target_bler; /*!< \brief Target Average Transport Block Error rate*/ - uint8_t Lchan_t; /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/ -} __attribute__ ((__packed__)) NR_LCHAN_DESC; - -typedef struct UE_RRC_INFO_NR_s { - NR_UE_STATE_t State; - uint8_t SIB1systemInfoValueTag; - uint32_t SIStatus; - uint32_t SIcnt; - uint8_t MCCHStatus[8]; // MAX_MBSFN_AREA - uint16_t SIwindowsize; //!< Corresponds to the SIB1 si-WindowLength parameter. The unit is ms. Possible values are (final): 1,2,5,10,15,20,40 - uint8_t handoverTarget; - //HO_STATE_t ho_state; - uint16_t - SIperiod; //!< Corresponds to the SIB1 si-Periodicity parameter (multiplied by 10). Possible values are (final): 80,160,320,640,1280,2560,5120 - unsigned short UE_index; - uint32_t T300_active; - uint32_t T300_cnt; - uint32_t T304_active; - uint32_t T304_cnt; - uint32_t T310_active; - uint32_t T310_cnt; - uint32_t N310_cnt; - uint32_t N311_cnt; - rnti_t rnti; -} __attribute__ ((__packed__)) NR_UE_RRC_INFO; - typedef struct UE_S_TMSI_NR_s { bool presence; uint16_t amf_set_id; @@ -201,49 +158,8 @@ typedef struct HANDOVER_INFO_NR_s { int size; /* size of above message in bytes */ } NR_HANDOVER_INFO; - -#define NR_RRC_HEADER_SIZE_MAX 64 -#define NR_RRC_BUFFER_SIZE_MAX 1024 - -typedef struct { - char Payload[NR_RRC_BUFFER_SIZE_MAX]; - char Header[NR_RRC_HEADER_SIZE_MAX]; - uint16_t payload_size; -} NR_RRC_BUFFER; - #define NR_RRC_BUFFER_SIZE sizeof(RRC_BUFFER_NR) - -typedef struct RB_INFO_NR_s { - uint16_t Rb_id; //=Lchan_id - NR_LCHAN_DESC Lchan_desc[2]; - //MAC_MEAS_REQ_ENTRY *Meas_entry; //may not needed for NB-IoT -} NR_RB_INFO; - -typedef struct NR_SRB_INFO_s { - uint16_t Srb_id; //=Lchan_id - NR_RRC_BUFFER Rx_buffer; - NR_RRC_BUFFER Tx_buffer; - NR_LCHAN_DESC Lchan_desc[2]; - unsigned int Trans_id; - uint8_t Active; -} NR_SRB_INFO; - - -typedef struct RB_INFO_TABLE_ENTRY_NR_s { - NR_RB_INFO Rb_info; - uint8_t Active; - uint32_t Next_check_frame; - uint8_t status; -} NR_RB_INFO_TABLE_ENTRY; - -typedef struct SRB_INFO_TABLE_ENTRY_NR_s { - NR_SRB_INFO Srb_info; - uint8_t Active; - uint8_t status; - uint32_t Next_check_frame; -} NR_SRB_INFO_TABLE_ENTRY; - typedef struct nr_rrc_guami_s { uint16_t mcc; uint16_t mnc; @@ -360,7 +276,7 @@ typedef struct gNB_RRC_UE_s { NR_CipheringAlgorithm_t ciphering_algorithm; e_NR_IntegrityProtAlgorithm integrity_algorithm; - uint8_t StatusRrc; + NR_UE_STATE_t StatusRrc; rnti_t rnti; uint64_t random_ue_identity; diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index ee236e14084fd57e9bcf88e8d758c2af16f0b7b8..8cfc1e91322e6c017ed8217cb98270c62eeffe7d 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -45,7 +45,6 @@ #include "NR_CellGroupConfig.h" #define NR_MAX_SUPPORTED_DL_LAYERS 2 -void rrc_init_nr_srb_param(NR_LCHAN_DESC *chan); uint16_t mac_rrc_nr_data_req(const module_id_t Mod_idP, const int CC_id, diff --git a/openair2/RRC/NR/nr_rrc_types.h b/openair2/RRC/NR/nr_rrc_types.h deleted file mode 100644 index 61f90e35727dc8b2f638870bcc0b089dcd019881..0000000000000000000000000000000000000000 --- a/openair2/RRC/NR/nr_rrc_types.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file nr_rrc_types.h -* \brief rrc types and subtypes -* \author Navid Nikaein and Raymond Knopp, WIE_TAI CHEN -* \date 2011 - 2014, 2018 -* \version 1.0 -* \company Eurecom, NTUST -* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr, kroempa@gmail.com -*/ - -#ifndef RRC_TYPES_NR_H_ -#define RRC_TYPES_NR_H_ - -typedef enum Rrc_State_NR_e { - RRC_STATE_IDLE_NR=0, - RRC_STATE_INACTIVE_NR, - RRC_STATE_CONNECTED_NR, - - RRC_STATE_FIRST_NR = RRC_STATE_IDLE_NR, - RRC_STATE_LAST_NR = RRC_STATE_CONNECTED_NR, -} Rrc_State_NR_t; - -typedef enum Rrc_Sub_State_NR_e { - RRC_SUB_STATE_INACTIVE_NR=0, - - RRC_SUB_STATE_IDLE_SEARCHING_NR, - RRC_SUB_STATE_IDLE_RECEIVING_SIB_NR, - RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR, - RRC_SUB_STATE_IDLE_CONNECTING_NR, - RRC_SUB_STATE_IDLE_NR, - - RRC_SUB_STATE_CONNECTED_NR, - - RRC_SUB_STATE_INACTIVE_FIRST_NR = RRC_SUB_STATE_INACTIVE_NR, - RRC_SUB_STATE_INACTIVE_LAST_NR = RRC_SUB_STATE_INACTIVE_NR, - - RRC_SUB_STATE_IDLE_FIRST_NR = RRC_SUB_STATE_IDLE_SEARCHING_NR, - RRC_SUB_STATE_IDLE_LAST_NR = RRC_SUB_STATE_IDLE_NR, - - RRC_SUB_STATE_CONNECTED_FIRST_NR = RRC_SUB_STATE_CONNECTED_NR, - RRC_SUB_STATE_CONNECTED_LAST_NR = RRC_SUB_STATE_CONNECTED_NR, -} Rrc_Sub_State_NR_t; - -#endif /* RRC_TYPES_H_ */ diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index 56de3dfa68df46773050bc26e36edfb8e5c8dd8c..b83c791291ee9db233259970349e27a8fff23a27 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -35,6 +35,7 @@ #include "assertions.h" #include "rrc_vars.h" #include "MAC/mac.h" +#include "LAYER2/NR_MAC_COMMON/nr_mac.h" typedef uint32_t channel_t; @@ -126,10 +127,6 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP, case CCCH: - // TODO: Enable timer T300 - //NR_UE_rrc_inst[Mod_idP].Info[gNB_id].T300_active = 1; - //NR_UE_rrc_inst[Mod_idP].Info[gNB_id].T300_cnt = 0; - LOG_D(NR_RRC, "nr_mac_rrc_data_req_ue: Payload size = %i\n", NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size); memcpy(buffer_pP, (uint8_t*)NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.Payload, NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size); for(int i = 0; i<NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size; i++) { @@ -151,10 +148,10 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP, int8_t nr_rrc_RA_succeeded(const module_id_t mod_id, const uint8_t gNB_index) { - if (NR_UE_rrc_inst[mod_id].Info[gNB_index].T304_active == 1) { - LOG_W(NR_RRC, "T304 was stoped with value %i\n", NR_UE_rrc_inst[mod_id].Info[gNB_index].T304_cnt); - NR_UE_rrc_inst[mod_id].Info[gNB_index].T304_active = 0; - NR_UE_rrc_inst[mod_id].Info[gNB_index].T304_cnt = 0; + if (NR_UE_rrc_inst[mod_id].timers_and_constants.T304_active == 1) { + LOG_W(NR_RRC, "T304 was stoped with value %i\n", NR_UE_rrc_inst[mod_id].timers_and_constants.T304_cnt); + NR_UE_rrc_inst[mod_id].timers_and_constants.T304_active = 0; + NR_UE_rrc_inst[mod_id].timers_and_constants.T304_cnt = 0; } return 0; } diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 0bffcfdc26d30ca708d3b79cd12e64252c6873e6..a3397a8de8ac040b8e828494dd968773f9308d89 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -45,18 +45,16 @@ #include "NR_MeasConfig.h" #include "NR_UL-DCCH-Message.h" -#include "rrc_list.h" #include "rrc_defs.h" #include "rrc_proto.h" #include "rrc_vars.h" -#include "rrc_extern.h" #include "LAYER2/NR_MAC_UE/mac_proto.h" +#include "COMMON/mac_rrc_primitives.h" #include "intertask_interface.h" #include "LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "nr-uesoftmodem.h" -#include "executables/softmodem-common.h" #include "plmn_data.h" #include "nr_pdcp/nr_pdcp_oai_api.h" #include "UTIL/OSA/osa_defs.h" @@ -70,10 +68,8 @@ #include "RRC/NAS/nas_config.h" #include "RRC/NAS/rb_config.h" #include "SIMULATION/TOOLS/sim.h" // for taus -#include <executables/softmodem-common.h> #include "nr_nas_msg_sim.h" -#include <openair2/RRC/NR/nr_rrc_proto.h> NR_UE_RRC_INST_t *NR_UE_rrc_inst; /* NAS Attach request with IMSI */ @@ -233,13 +229,10 @@ int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const module_id_t module_id, return -1; } - if(NR_UE_rrc_inst[module_id].scell_group_config == NULL){ + if(NR_UE_rrc_inst[module_id].scell_group_config == NULL) NR_UE_rrc_inst[module_id].scell_group_config = cell_group_config; - nr_rrc_ue_process_scg_config(module_id,cell_group_config); - }else{ - nr_rrc_ue_process_scg_config(module_id,cell_group_config); + else SEQUENCE_free(&asn_DEF_NR_CellGroupConfig, (void *)cell_group_config, 0); - } return 0; } @@ -275,15 +268,13 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *) cellGroupConfig); } - if(NR_UE_rrc_inst[module_id].cell_group_config == NULL){ + if(NR_UE_rrc_inst[module_id].cell_group_config == NULL) { // first time receive the configuration, just use the memory allocated from uper_decoder. TODO this is not good implementation, need to maintain RRC_INST own structure every time. NR_UE_rrc_inst[module_id].cell_group_config = cellGroupConfig; - nr_rrc_ue_process_scg_config(module_id,cellGroupConfig); - }else{ + }else { // after first time, update it and free the memory after. SEQUENCE_free(&asn_DEF_NR_CellGroupConfig, (void *)NR_UE_rrc_inst[module_id].cell_group_config, 0); NR_UE_rrc_inst[module_id].cell_group_config = cellGroupConfig; - nr_rrc_ue_process_scg_config(module_id,cellGroupConfig); } if (get_softmodem_params()->nsa) { nr_rrc_mac_config_req_scg(0, 0, cellGroupConfig); @@ -326,47 +317,6 @@ int8_t nr_rrc_ue_process_meas_config(NR_MeasConfig_t *meas_config){ return 0; } -int8_t nr_rrc_ue_process_scg_config(const module_id_t module_id, NR_CellGroupConfig_t *cell_group_config){ - int i; - if(cell_group_config==NULL){ - // initial list - if(cell_group_config->spCellConfig != NULL){ - if(cell_group_config->spCellConfig->spCellConfigDedicated != NULL){ - if(cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList != NULL){ - for(i=0; i<cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; ++i){ - RRC_LIST_MOD_ADD(NR_UE_rrc_inst[module_id].BWP_Downlink_list, cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[i], bwp_Id); - } - } - } - } - }else{ - // maintain list - if(cell_group_config->spCellConfig != NULL){ - if(cell_group_config->spCellConfig->spCellConfigDedicated != NULL){ - // process element of list to be add by RRC message - if(cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList != NULL){ - for(i=0; i<cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; ++i){ - RRC_LIST_MOD_ADD(NR_UE_rrc_inst[module_id].BWP_Downlink_list, cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[i], bwp_Id); - } - } - - // process element of list to be release by RRC message - if(cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToReleaseList != NULL){ - for(i=0; i<cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToReleaseList->list.count; ++i){ - NR_BWP_Downlink_t *freeP = NULL; - RRC_LIST_MOD_REL(NR_UE_rrc_inst[module_id].BWP_Downlink_list, bwp_Id, *cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToReleaseList->list.array[i], freeP); - if(freeP != NULL){ - SEQUENCE_free(&asn_DEF_NR_BWP_Downlink, (void *)freeP, 0); - } - } - } - } - } - } - - return 0; -} - void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, void *message,int msg_len) { module_id_t module_id=0; // TODO @@ -450,60 +400,6 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file, char* rrc_config_ NR_UE_rrc_inst[nr_ue].requested_SI_List.bits_unused= 0; NR_UE_rrc_inst[nr_ue].ra_trigger = RA_NOT_RUNNING; - - // init RRC lists - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].RLC_Bearer_Config_list, NR_maxLC_ID); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SchedulingRequest_list, NR_maxNrofSR_ConfigPerCellGroup); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].TAG_list, NR_maxNrofTAGs); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].TDD_UL_DL_SlotConfig_list, NR_maxNrofSlots); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].BWP_Downlink_list, NR_maxNrofBWPs); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].ControlResourceSet_list[0], 3); // for init-dl-bwp - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].ControlResourceSet_list[1], 3); // for dl-bwp id=0 - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].ControlResourceSet_list[2], 3); // for dl-bwp id=1 - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].ControlResourceSet_list[3], 3); // for dl-bwp id=2 - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].ControlResourceSet_list[4], 3); // for dl-bwp id=3 - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SearchSpace_list[0], 10); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SearchSpace_list[1], 10); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SearchSpace_list[2], 10); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SearchSpace_list[3], 10); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SearchSpace_list[4], 10); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SlotFormatCombinationsPerCell_list[0], NR_maxNrofAggregatedCellsPerCellGroup); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SlotFormatCombinationsPerCell_list[1], NR_maxNrofAggregatedCellsPerCellGroup); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SlotFormatCombinationsPerCell_list[2], NR_maxNrofAggregatedCellsPerCellGroup); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SlotFormatCombinationsPerCell_list[3], NR_maxNrofAggregatedCellsPerCellGroup); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SlotFormatCombinationsPerCell_list[4], NR_maxNrofAggregatedCellsPerCellGroup); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].TCI_State_list[0], NR_maxNrofTCI_States); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].TCI_State_list[1], NR_maxNrofTCI_States); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].TCI_State_list[2], NR_maxNrofTCI_States); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].TCI_State_list[3], NR_maxNrofTCI_States); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].TCI_State_list[4], NR_maxNrofTCI_States); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].RateMatchPattern_list[0], NR_maxNrofRateMatchPatterns); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].RateMatchPattern_list[1], NR_maxNrofRateMatchPatterns); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].RateMatchPattern_list[2], NR_maxNrofRateMatchPatterns); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].RateMatchPattern_list[3], NR_maxNrofRateMatchPatterns); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].RateMatchPattern_list[4], NR_maxNrofRateMatchPatterns); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].ZP_CSI_RS_Resource_list[0], NR_maxNrofZP_CSI_RS_Resources); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].ZP_CSI_RS_Resource_list[1], NR_maxNrofZP_CSI_RS_Resources); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].ZP_CSI_RS_Resource_list[2], NR_maxNrofZP_CSI_RS_Resources); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].ZP_CSI_RS_Resource_list[3], NR_maxNrofZP_CSI_RS_Resources); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].ZP_CSI_RS_Resource_list[4], NR_maxNrofZP_CSI_RS_Resources); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].Aperidic_ZP_CSI_RS_ResourceSet_list[0], NR_maxNrofZP_CSI_RS_ResourceSets); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].Aperidic_ZP_CSI_RS_ResourceSet_list[1], NR_maxNrofZP_CSI_RS_ResourceSets); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].Aperidic_ZP_CSI_RS_ResourceSet_list[2], NR_maxNrofZP_CSI_RS_ResourceSets); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].Aperidic_ZP_CSI_RS_ResourceSet_list[3], NR_maxNrofZP_CSI_RS_ResourceSets); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].Aperidic_ZP_CSI_RS_ResourceSet_list[4], NR_maxNrofZP_CSI_RS_ResourceSets); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SP_ZP_CSI_RS_ResourceSet_list[0], NR_maxNrofZP_CSI_RS_ResourceSets); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SP_ZP_CSI_RS_ResourceSet_list[1], NR_maxNrofZP_CSI_RS_ResourceSets); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SP_ZP_CSI_RS_ResourceSet_list[2], NR_maxNrofZP_CSI_RS_ResourceSets); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SP_ZP_CSI_RS_ResourceSet_list[3], NR_maxNrofZP_CSI_RS_ResourceSets); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].SP_ZP_CSI_RS_ResourceSet_list[4], NR_maxNrofZP_CSI_RS_ResourceSets); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].NZP_CSI_RS_Resource_list, NR_maxNrofNZP_CSI_RS_Resources); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].NZP_CSI_RS_ResourceSet_list, NR_maxNrofNZP_CSI_RS_ResourceSets); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].CSI_IM_Resource_list, NR_maxNrofCSI_IM_Resources); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].CSI_IM_ResourceSet_list, NR_maxNrofCSI_IM_ResourceSets); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].CSI_SSB_ResourceSet_list, NR_maxNrofCSI_SSB_ResourceSets); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].CSI_ResourceConfig_list, NR_maxNrofCSI_ResourceConfigurations); - RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].CSI_ReportConfig_list, NR_maxNrofCSI_ReportConfigurations); } NR_UE_rrc_inst->uecap_file = uecap_file; @@ -598,7 +494,8 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const u NR_UE_rrc_inst[module_id].mib = bcch_message->message.choice.mib; bcch_message->message.choice.mib = NULL; - NR_SIB1_t *sib1 = NR_UE_rrc_inst[module_id].sib1[gNB_index]; + NR_UE_RRC_SI_INFO *SI_info = &NR_UE_rrc_inst[module_id].SInfo[gNB_index]; + NR_SIB1_t *sib1 = SI_info->sib1; // if no sib1 because not acquired yet or expired, get a new one bool get_sib1 = sib1 == NULL; nr_rrc_mac_config_req_mib(module_id, 0, NR_UE_rrc_inst[module_id].mib, get_sib1); @@ -820,199 +717,170 @@ void nr_dump_sib3( NR_SIB3_t *sib3 ) { LOG_I( RRC, "lateNonCriticalExtension : not defined\n" ); } -int nr_decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index ) { - NR_SystemInformation_t **si = &NR_UE_rrc_inst[ctxt_pP->module_id].si[gNB_index]; +int nr_decode_SI(const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index) +{ + NR_UE_RRC_SI_INFO *SI_info = &NR_UE_rrc_inst[ctxt_pP->module_id].SInfo[gNB_index]; + NR_SystemInformation_t *si = SI_info->si; int new_sib = 0; - NR_SIB1_t *sib1 = NR_UE_rrc_inst[ctxt_pP->module_id].sib1[gNB_index]; + NR_SIB1_t *sib1 = SI_info->sib1; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_IN ); // Dump contents - if ((*si)->criticalExtensions.present == NR_SystemInformation__criticalExtensions_PR_systemInformation || - (*si)->criticalExtensions.present == NR_SystemInformation__criticalExtensions_PR_criticalExtensionsFuture_r16) { - LOG_D( RRC, "[UE] (*si)->criticalExtensions.choice.NR_SystemInformation_t->sib_TypeAndInfo.list.count %d\n", - (*si)->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count ); + if (si->criticalExtensions.present == NR_SystemInformation__criticalExtensions_PR_systemInformation || + si->criticalExtensions.present == NR_SystemInformation__criticalExtensions_PR_criticalExtensionsFuture_r16) { + LOG_D( RRC, "[UE] si->criticalExtensions.choice.NR_SystemInformation_t->sib_TypeAndInfo.list.count %d\n", + si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count ); } else { LOG_D( RRC, "[UE] Unknown criticalExtension version (not Rel16)\n" ); return -1; } - for (int i=0; i<(*si)->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count; i++) { + for (int i = 0; i < si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count; i++) { SystemInformation_IEs__sib_TypeAndInfo__Member *typeandinfo; - typeandinfo = (*si)->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.array[i]; + typeandinfo = si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.array[i]; switch(typeandinfo->present) { case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib2: - if ((NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus&2) == 0) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus|=2; + if ((SI_info->SIStatus & 2) == 0) { + SI_info->SIStatus |= 2; //new_sib=1; - memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib2[gNB_index], &typeandinfo->choice.sib2, sizeof(NR_SIB2_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB2 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); - nr_dump_sib2( NR_UE_rrc_inst[ctxt_pP->module_id].sib2[gNB_index] ); - LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB2 params gNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", - ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id ); + memcpy(SI_info->sib2, &typeandinfo->choice.sib2, sizeof(NR_SIB2_t)); + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB2 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + nr_dump_sib2(SI_info->sib2); + LOG_I(RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB2 params gNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", + ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id ); //TODO rrc_mac_config_req_ue // After SI is received, prepare RRCConnectionRequest - if (NR_UE_rrc_inst[ctxt_pP->module_id].MBMS_flag < 3) // see -Q option - if (get_softmodem_params()->sa) { + if (NR_UE_rrc_inst[ctxt_pP->module_id].MBMS_flag < 3) { // see -Q option + if (get_softmodem_params()->sa) nr_rrc_ue_generate_RRCSetupRequest( ctxt_pP->module_id, gNB_index ); - } - - if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State == NR_RRC_IDLE) { - LOG_I( RRC, "[UE %d] Received SIB1/SIB2/SIB3 Switching to RRC_SI_RECEIVED\n", ctxt_pP->module_id ); - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State = NR_RRC_SI_RECEIVED; -#if ENABLE_RAL - /* TODO { - MessageDef *message_ral_p = NULL; - rrc_ral_system_information_ind_t ral_si_ind; - message_ral_p = itti_alloc_new_message (TASK_RRC_UE, 0, RRC_RAL_SYSTEM_INFORMATION_IND); - memset(&ral_si_ind, 0, sizeof(rrc_ral_system_information_ind_t)); - ral_si_ind.plmn_id.MCCdigit2 = '0'; - ral_si_ind.plmn_id.MCCdigit1 = '2'; - ral_si_ind.plmn_id.MNCdigit3 = '0'; - ral_si_ind.plmn_id.MCCdigit3 = '8'; - ral_si_ind.plmn_id.MNCdigit2 = '9'; - ral_si_ind.plmn_id.MNCdigit1 = '9'; - ral_si_ind.cell_id = 1; - ral_si_ind.dbm = 0; - //ral_si_ind.dbm = fifo_dump_emos_UE.PHY_measurements->rx_rssi_dBm[gNB_index]; - // TO DO - ral_si_ind.sinr = 0; - //ral_si_ind.sinr = fifo_dump_emos_UE.PHY_measurements->subband_cqi_dB[gNB_index][phy_vars_ue->lte_frame_parms.nb_antennas_rx][0]; - // TO DO - ral_si_ind.link_data_rate = 0; - memcpy (&message_ral_p->ittiMsg, (void *) &ral_si_ind, sizeof(rrc_ral_system_information_ind_t)); -#warning "ue_mod_idP ? for instance ?" - itti_send_msg_to_task (TASK_RAL_UE, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_ral_p); - }*/ -#endif } } break; // case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib3: - if ((NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus&4) == 0) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus|=4; + if ((SI_info->SIStatus & 4) == 0) { + SI_info->SIStatus |= 4; new_sib=1; - memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib3[gNB_index], &typeandinfo->choice.sib3, sizeof(LTE_SystemInformationBlockType3_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB3 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); - nr_dump_sib3( NR_UE_rrc_inst[ctxt_pP->module_id].sib3[gNB_index] ); + memcpy(SI_info->sib3, &typeandinfo->choice.sib3, sizeof(LTE_SystemInformationBlockType3_t)); + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB3 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); + nr_dump_sib3(SI_info->sib3); } break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib4: - if ((NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus&8) == 0) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus|=8; + if ((SI_info->SIStatus & 8) == 0) { + SI_info->SIStatus |= 8; new_sib=1; - memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib4[gNB_index], typeandinfo->choice.sib4, sizeof(NR_SIB4_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB4 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); + memcpy(SI_info->sib4, typeandinfo->choice.sib4, sizeof(NR_SIB4_t)); + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB4 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); } break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib5: - if ((NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus&16) == 0) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus|=16; + if ((SI_info->SIStatus & 16) == 0) { + SI_info->SIStatus |= 16; new_sib=1; - memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib5[gNB_index], typeandinfo->choice.sib5, sizeof(NR_SIB5_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB5 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); - //dump_sib5(NR_UE_rrc_inst[ctxt_pP->module_id].sib5[gNB_index]); + memcpy(SI_info->sib5, typeandinfo->choice.sib5, sizeof(NR_SIB5_t)); + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB5 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); } break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib6: - if ((NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus&32) == 0) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus|=32; + if ((SI_info->SIStatus & 32) == 0) { + SI_info->SIStatus |= 32; new_sib=1; - memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib6[gNB_index], typeandinfo->choice.sib6, sizeof(NR_SIB6_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB6 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); + memcpy(SI_info->sib6, typeandinfo->choice.sib6, sizeof(NR_SIB6_t)); + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB6 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); } break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib7: - if ((NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus&64) == 0) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus|=64; + if ((SI_info->SIStatus & 64) == 0) { + SI_info->SIStatus |= 64; new_sib=1; - memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib7[gNB_index], typeandinfo->choice.sib7, sizeof(NR_SIB7_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB7 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); + memcpy(SI_info->sib7, typeandinfo->choice.sib7, sizeof(NR_SIB7_t)); + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB7 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); } break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib8: - if ((NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus&128) == 0) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus|=128; + if ((SI_info->SIStatus & 128) == 0) { + SI_info->SIStatus |= 128; new_sib=1; - memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib8[gNB_index], typeandinfo->choice.sib8, sizeof(NR_SIB8_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB8 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); + memcpy(SI_info->sib8, typeandinfo->choice.sib8, sizeof(NR_SIB8_t)); + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB8 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); } break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib9: - if ((NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus&256) == 0) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus|=256; + if ((SI_info->SIStatus & 256) == 0) { + SI_info->SIStatus |= 256; new_sib=1; - memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib9[gNB_index], typeandinfo->choice.sib9, sizeof(NR_SIB9_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB9 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); + memcpy(SI_info->sib9, typeandinfo->choice.sib9, sizeof(NR_SIB9_t)); + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB9 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); } break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib10_v1610: - if ((NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus&512) == 0) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus|=512; + if ((SI_info->SIStatus & 512) == 0) { + SI_info->SIStatus |= 512; new_sib=1; - memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib10[gNB_index], typeandinfo->choice.sib10_v1610, sizeof(NR_SIB10_r16_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB10 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); + memcpy(SI_info->sib10, typeandinfo->choice.sib10_v1610, sizeof(NR_SIB10_r16_t)); + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB10 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); } break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib11_v1610: - if ((NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus&1024) == 0) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus|=1024; + if ((SI_info->SIStatus & 1024) == 0) { + SI_info->SIStatus |= 1024; new_sib=1; - memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib11[gNB_index], typeandinfo->choice.sib11_v1610, sizeof(NR_SIB11_r16_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB11 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); + memcpy(SI_info->sib11, typeandinfo->choice.sib11_v1610, sizeof(NR_SIB11_r16_t)); + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB11 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); } break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib12_v1610: - if ((NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus&2048) == 0) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus|=2048; + if ((SI_info->SIStatus & 2048) == 0) { + SI_info->SIStatus |= 2048; new_sib=1; - memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib12[gNB_index], typeandinfo->choice.sib12_v1610, sizeof(NR_SIB12_r16_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB12 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); + memcpy(SI_info->sib12, typeandinfo->choice.sib12_v1610, sizeof(NR_SIB12_r16_t)); + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB12 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); } break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib13_v1610: - if ((NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus&4096) == 0) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus|=4096; + if ((SI_info->SIStatus & 4096) == 0) { + SI_info->SIStatus |= 4096; new_sib=1; - memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib13[gNB_index], typeandinfo->choice.sib13_v1610, sizeof(NR_SIB13_r16_t) ); + memcpy(SI_info->sib13, typeandinfo->choice.sib13_v1610, sizeof(NR_SIB13_r16_t)); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB13 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); - //dump_sib13( NR_UE_rrc_inst[ctxt_pP->module_id].sib13[gNB_index] ); + //dump_sib13(SI_info->sib13); // adding here function to store necessary parameters for using in decode_MCCH_Message + maybe transfer to PHY layer - LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB13 params gNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", - ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id); + LOG_I(RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB13 params gNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", + ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id); // TODO rrc_mac_config_req_ue } break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib14_v1610: - if ((NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus&8192) == 0) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus|=8192; + if ((SI_info->SIStatus & 8192) == 0) { + SI_info->SIStatus |= 8192; new_sib=1; - memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib12[gNB_index], typeandinfo->choice.sib14_v1610, sizeof(NR_SIB14_r16_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB14 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); + memcpy(SI_info->sib12, typeandinfo->choice.sib14_v1610, sizeof(NR_SIB14_r16_t)); + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB14 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); } break; @@ -1021,13 +889,13 @@ int nr_decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index break; } if (new_sib == 1) { - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt++; - if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt == sib1->si_SchedulingInfo->schedulingInfoList.list.count) + SI_info->SIcnt++; + if (SI_info->SIcnt == sib1->si_SchedulingInfo->schedulingInfoList.list.count) nr_rrc_set_sub_state(ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR); LOG_I(NR_RRC,"SIStatus %x, SIcnt %d/%d\n", - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus, - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt, + SI_info->SIStatus, + SI_info->SIcnt, sib1->si_SchedulingInfo->schedulingInfoList.list.count); } } @@ -1150,11 +1018,12 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id, const uint8_t rsrp) { NR_BCCH_DL_SCH_Message_t *bcch_message = NULL; - NR_SIB1_t *sib1 = NR_UE_rrc_inst[module_id].sib1[gNB_index]; + NR_UE_RRC_SI_INFO *SI_info = &NR_UE_rrc_inst[module_id].SInfo[gNB_index]; + NR_SIB1_t *sib1 = SI_info->sib1; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_IN ); - if (((NR_UE_rrc_inst[module_id].Info[gNB_index].SIStatus&1) == 1) && sib1->si_SchedulingInfo &&// SIB1 received - (NR_UE_rrc_inst[module_id].Info[gNB_index].SIcnt == sib1->si_SchedulingInfo->schedulingInfoList.list.count)) { + if (((SI_info->SIStatus & 1) == 1) && sib1->si_SchedulingInfo &&// SIB1 received + (SI_info->SIcnt == sib1->si_SchedulingInfo->schedulingInfoList.list.count)) { // to prevent memory bloating VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT ); return 0; @@ -1186,17 +1055,16 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id, if (bcch_message->message.present == NR_BCCH_DL_SCH_MessageType_PR_c1) { switch (bcch_message->message.choice.c1->present) { case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: - if ((NR_UE_rrc_inst[module_id].Info[gNB_index].SIStatus&1) == 0) { - NR_SIB1_t *sib1 = NR_UE_rrc_inst[module_id].sib1[gNB_index]; + if ((SI_info->SIStatus & 1) == 0) { if(sib1 != NULL){ SEQUENCE_free(&asn_DEF_NR_SIB1, (void *)sib1, 1 ); } - NR_UE_rrc_inst[module_id].Info[gNB_index].SIStatus|=1; + SI_info->SIStatus |= 1; sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; if (*(int64_t*)sib1 != 1) { - NR_UE_rrc_inst[module_id].sib1[gNB_index] = sib1; + SI_info->sib1 = sib1; if( g_log->log_component[NR_RRC].level >= OAILOG_DEBUG ) { - xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void *) NR_UE_rrc_inst[module_id].sib1[gNB_index]); + xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void *) SI_info->sib1); } LOG_A(NR_RRC, "SIB1 decoded\n"); @@ -1220,7 +1088,7 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id, break; case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation: - if ((NR_UE_rrc_inst[module_id].Info[gNB_index].SIStatus&1) == 1) { + if ((SI_info->SIStatus & 1) == 1) { LOG_W(NR_RRC, "Decoding SI not implemented yet\n"); // TODO: Decode SI /* @@ -1279,31 +1147,32 @@ void nr_rrc_ue_process_masterCellGroup(const protocol_ctxt_t *const ctxt_pP, LOG_A(NR_RRC, "Received the reconfigurationWithSync in %s\n", __FUNCTION__); NR_ReconfigurationWithSync_t *reconfigurationWithSync = cellGroupConfig->spCellConfig->reconfigurationWithSync; - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T304_active = 1; + NR_UE_Timers_Constants_t *timers_and_constants = &NR_UE_rrc_inst[ctxt_pP->module_id].timers_and_constants; + timers_and_constants->T304_active = 1; switch (reconfigurationWithSync->t304) { case NR_ReconfigurationWithSync__t304_ms100: - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T304_cnt = 100; + timers_and_constants->T304_cnt = 100; break; case NR_ReconfigurationWithSync__t304_ms150: - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T304_cnt = 150; + timers_and_constants->T304_cnt = 150; break; case NR_ReconfigurationWithSync__t304_ms200: - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T304_cnt = 200; + timers_and_constants->T304_cnt = 200; break; case NR_ReconfigurationWithSync__t304_ms500: - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T304_cnt = 500; + timers_and_constants->T304_cnt = 500; break; case NR_ReconfigurationWithSync__t304_ms1000: - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T304_cnt = 1000; + timers_and_constants->T304_cnt = 1000; break; case NR_ReconfigurationWithSync__t304_ms2000: - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T304_cnt = 2000; + timers_and_constants->T304_cnt = 2000; break; case NR_ReconfigurationWithSync__t304_ms10000: - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T304_cnt = 10000; + timers_and_constants->T304_cnt = 10000; break; default: - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T304_cnt = 50; + timers_and_constants->T304_cnt = 50; } } @@ -1423,7 +1292,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB int rval=0; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_IN); LOG_D(RRC,"[NR UE%d] Decoding DL-CCCH message (%d bytes), State %d\n",ctxt_pP->module_id,Srb_info->Rx_buffer.payload_size, - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State); + NR_UE_rrc_inst[ctxt_pP->module_id].nrRrcState); dec_rval = uper_decode(NULL, &asn_DEF_NR_DL_CCCH_Message, (void **)&dl_ccch_msg, @@ -1441,7 +1310,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB } if (dl_ccch_msg->message.present == NR_DL_CCCH_MessageType_PR_c1) { - if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus > 0) { + if (NR_UE_rrc_inst[ctxt_pP->module_id].SInfo[gNB_index].SIStatus > 0) { switch (dl_ccch_msg->message.choice.c1->present) { case NR_DL_CCCH_MessageType__c1_PR_NOTHING: LOG_I(NR_RRC, "[UE%d] Frame %d : Received PR_NOTHING on DL-CCCH-Message\n", @@ -1463,13 +1332,13 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB // Get configuration // Release T300 timer - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T300_active = 0; + NR_UE_rrc_inst[ctxt_pP->module_id].timers_and_constants.T300_active = 0; nr_rrc_ue_process_masterCellGroup(ctxt_pP, gNB_index, &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup); nr_rrc_ue_process_RadioBearerConfig(ctxt_pP, gNB_index, &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig); nr_rrc_set_state(ctxt_pP->module_id, RRC_STATE_CONNECTED_NR); nr_rrc_set_sub_state(ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED_NR); - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].rnti = ctxt_pP->rntiMaybeUEid; + NR_UE_rrc_inst[ctxt_pP->module_id].rnti = ctxt_pP->rntiMaybeUEid; rrc_ue_generate_RRCSetupComplete(ctxt_pP, gNB_index, dl_ccch_msg->message.choice.c1->choice.rrcSetup->rrc_TransactionIdentifier, NR_UE_rrc_inst[ctxt_pP->module_id].selected_plmn_identity); rval = 0; break; @@ -2129,7 +1998,7 @@ nr_rrc_ue_establish_srb2( } } - NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State = NR_RRC_CONNECTED; + NR_UE_rrc_inst[ctxt_pP->module_id].nrRrcState = RRC_STATE_CONNECTED_NR; LOG_I(NR_RRC,"[UE %d] State = NR_RRC_CONNECTED (gNB %d)\n", ctxt_pP->module_id, gNB_index); } @@ -2446,7 +2315,7 @@ nr_rrc_ue_establish_srb2( /* Create message for PDCP (ULInformationTransfer_t) */ length = do_NR_ULInformationTransfer(&buffer, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.length, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.data); /* Transfer data to PDCP */ - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NR_UE_rrc_inst[ue_mod_id].Info[0].rnti, 0, 0,0); + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NR_UE_rrc_inst[ue_mod_id].rnti, 0, 0,0); // check if SRB2 is created, if yes request data_req on DCCH1 (SRB2) rb_id_t srb_id = NR_UE_rrc_inst[ue_mod_id].SRB2_config[0] == NULL ? DCCH : DCCH1; nr_pdcp_data_req_srb(ctxt.rntiMaybeUEid, srb_id, nr_rrc_mui++, length, buffer, deliver_pdu_srb_rlc, NULL); @@ -2839,7 +2708,7 @@ void *nr_rrc_timers_update() { for (int mod_id = 0; mod_id < NB_NR_UE_INST; mod_id++) { for (int i = 0; i < NB_SIG_CNX_UE; i++) { - NR_UE_RRC_INFO *timers = &NR_UE_rrc_inst[mod_id].Info[i]; + NR_UE_Timers_Constants_t *timers = &NR_UE_rrc_inst[mod_id].timers_and_constants; // T304 if (timers->T304_active == 1) { diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index 8dbe9159cf6ab592c65c6fda0c2553bf647a2551..ff5754396eb4278247eff9b3e593668ea9ed3a45 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -38,9 +38,8 @@ #include <string.h> #include "platform_types.h" +#include "commonDef.h" -#include "NR_MAC_COMMON/nr_mac.h" -#include "rrc_list.h" #include "NR_asn_constant.h" #include "NR_MeasConfig.h" #include "NR_CellGroupConfig.h" @@ -48,12 +47,15 @@ #include "NR_RLC-BearerConfig.h" #include "NR_TAG.h" #include "NR_asn_constant.h" -#include "NR_SchedulingRequestToAddMod.h" #include "NR_MIB.h" #include "NR_SIB1.h" #include "NR_BCCH-BCH-Message.h" #include "NR_DL-DCCH-Message.h" -#include "../NR/nr_rrc_defs.h" +#include "NR_SystemInformation.h" +#include "NR_UE-NR-Capability.h" + +#include "RRC/NR/nr_rrc_common.h" +#include "as_message.h" #define NB_NR_UE_INST 1 #define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE @@ -77,6 +79,36 @@ typedef struct OAI_NR_UECapability_s { NR_UE_NR_Capability_t *UE_NR_Capability; } OAI_NR_UECapability_t; +typedef enum Rrc_State_NR_e { + RRC_STATE_IDLE_NR=0, + RRC_STATE_INACTIVE_NR, + RRC_STATE_CONNECTED_NR, + + RRC_STATE_FIRST_NR = RRC_STATE_IDLE_NR, + RRC_STATE_LAST_NR = RRC_STATE_CONNECTED_NR, +} Rrc_State_NR_t; + +typedef enum Rrc_Sub_State_NR_e { + RRC_SUB_STATE_INACTIVE_NR=0, + + RRC_SUB_STATE_IDLE_SEARCHING_NR, + RRC_SUB_STATE_IDLE_RECEIVING_SIB_NR, + RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR, + RRC_SUB_STATE_IDLE_CONNECTING_NR, + RRC_SUB_STATE_IDLE_NR, + + RRC_SUB_STATE_CONNECTED_NR, + + RRC_SUB_STATE_INACTIVE_FIRST_NR = RRC_SUB_STATE_INACTIVE_NR, + RRC_SUB_STATE_INACTIVE_LAST_NR = RRC_SUB_STATE_INACTIVE_NR, + + RRC_SUB_STATE_IDLE_FIRST_NR = RRC_SUB_STATE_IDLE_SEARCHING_NR, + RRC_SUB_STATE_IDLE_LAST_NR = RRC_SUB_STATE_IDLE_NR, + + RRC_SUB_STATE_CONNECTED_FIRST_NR = RRC_SUB_STATE_CONNECTED_NR, + RRC_SUB_STATE_CONNECTED_LAST_NR = RRC_SUB_STATE_CONNECTED_NR, +} Rrc_Sub_State_NR_t; + typedef enum requested_SI_List_e { SIB2 = 1, SIB3 = 2, @@ -101,6 +133,55 @@ typedef enum RA_trigger_e { BEAM_FAILURE_RECOVERY, } RA_trigger_t; +typedef struct UE_RRC_SI_INFO_NR_s { + uint32_t SIStatus; + uint32_t SIcnt; + NR_SystemInformation_t *si; + NR_SIB1_t *sib1; + NR_SIB2_t *sib2; + NR_SIB3_t *sib3; + NR_SIB4_t *sib4; + NR_SIB5_t *sib5; + NR_SIB6_t *sib6; + NR_SIB7_t *sib7; + NR_SIB8_t *sib8; + NR_SIB9_t *sib9; + NR_SIB10_r16_t *sib10; + NR_SIB11_r16_t *sib11; + NR_SIB12_r16_t *sib12; + NR_SIB13_r16_t *sib13; + NR_SIB14_r16_t *sib14; +} __attribute__ ((__packed__)) NR_UE_RRC_SI_INFO; + +typedef struct NR_UE_Timers_Constants_s { + // timers status + bool T300_active; + bool T301_active; + bool T304_active; + bool T310_active; + bool T311_active; + bool T319_active; + // timers + uint32_t T300_cnt; + uint32_t T301_cnt; + uint32_t T304_cnt; + uint32_t T310_cnt; + uint32_t T311_cnt; + uint32_t T319_cnt; + // counters + uint32_t N310_cnt; + uint32_t N311_cnt; + // constants (limits configured by the network) + uint32_t N310_k; + uint32_t N311_k; + uint32_t T300_k; + uint32_t T301_k; + uint32_t T304_k; + uint32_t T310_k; + uint32_t T311_k; + uint32_t T319_k; +} NR_UE_Timers_Constants_t; + typedef struct NR_UE_RRC_INST_s { NR_MeasConfig_t *meas_config; @@ -121,6 +202,7 @@ typedef struct NR_UE_RRC_INST_s { rb_id_t *defaultDRB; // remember the ID of the default DRB char *uecap_file; + rnti_t rnti; NR_SRB_INFO Srb0[NB_SIG_CNX_UE]; NR_SRB_INFO_TABLE_ENTRY Srb1[NB_CNX_UE]; @@ -131,27 +213,14 @@ typedef struct NR_UE_RRC_INST_s { uint8_t *UECapability; uint16_t UECapability_size; + NR_UE_Timers_Constants_t timers_and_constants; + RA_trigger_t ra_trigger; - BIT_STRING_t requested_SI_List; - - NR_SystemInformation_t *si[NB_CNX_UE]; - NR_SIB1_t *sib1[NB_CNX_UE]; - NR_SIB2_t *sib2[NB_CNX_UE]; - NR_SIB3_t *sib3[NB_CNX_UE]; - NR_SIB4_t *sib4[NB_CNX_UE]; - NR_SIB5_t *sib5[NB_CNX_UE]; - NR_SIB6_t *sib6[NB_CNX_UE]; - NR_SIB7_t *sib7[NB_CNX_UE]; - NR_SIB8_t *sib8[NB_CNX_UE]; - NR_SIB9_t *sib9[NB_CNX_UE]; - NR_SIB10_r16_t *sib10[NB_CNX_UE]; - NR_SIB11_r16_t *sib11[NB_CNX_UE]; - NR_SIB12_r16_t *sib12[NB_CNX_UE]; - NR_SIB13_r16_t *sib13[NB_CNX_UE]; - NR_SIB14_r16_t *sib14[NB_CNX_UE]; + plmn_t plmnID; - NR_UE_RRC_INFO Info[NB_SIG_CNX_UE]; + BIT_STRING_t requested_SI_List; + NR_UE_RRC_SI_INFO SInfo[NB_SIG_CNX_UE]; NR_MIB_t *mib; @@ -161,54 +230,6 @@ typedef struct NR_UE_RRC_INST_s { //RRC_LIST_TYPE(NR_SecurityAlgorithmConfig_t, NR_SecurityAlgorithmConfig) SecurityAlgorithmConfig_list; NR_CipheringAlgorithm_t cipheringAlgorithm; e_NR_IntegrityProtAlgorithm integrityProtAlgorithm; - - // lists - // CellGroupConfig.rlc-BearerToAddModList - RRC_LIST_TYPE(NR_RLC_BearerConfig_t, NR_maxLC_ID) RLC_Bearer_Config_list; - // CellGroupConfig.mac-CellGroupConfig.schedulingrequest - RRC_LIST_TYPE(NR_SchedulingRequestToAddMod_t, NR_maxNrofSR_ConfigPerCellGroup) SchedulingRequest_list; - // CellGroupConfig.mac-CellGroupConfig.TAG - RRC_LIST_TYPE(NR_TAG_t, NR_maxNrofTAGs) TAG_list; - // CellGroupConfig.spCellConfig.spCellConfigDedicated.tdduldlslotconfig - RRC_LIST_TYPE(NR_TDD_UL_DL_SlotConfig_t, NR_maxNrofSlots) TDD_UL_DL_SlotConfig_list; - - // CellGroupConfig.spCellConfig.spCellConfigDedicated.bwps - RRC_LIST_TYPE(NR_BWP_Downlink_t, NR_maxNrofBWPs) BWP_Downlink_list; - //BWP-DownlinkDedicated 0=INIT-DL-BWP, 1..4 for DL-BWPs - // CellGroupConfig.spCellConfig.spCellConfigDedicated.initialdlbwp.pdcchconfig.controlresourceset - RRC_LIST_TYPE(NR_ControlResourceSet_t, 3) ControlResourceSet_list[5]; - // CellGroupConfig.spCellConfig.spCellConfigDedicated.initialdlbwp.pdcchconfig.searchspace - RRC_LIST_TYPE(NR_SearchSpace_t, 10) SearchSpace_list[5]; - // CellGroupConfig.spCellConfig.spCellConfigDedicated.initialdlbwp.pdcchconfig.slotformatindicator - RRC_LIST_TYPE(NR_SlotFormatCombinationsPerCell_t, NR_maxNrofAggregatedCellsPerCellGroup) SlotFormatCombinationsPerCell_list[5]; - // CellGroupConfig.spCellConfig.spCellConfigDedicated.initialdlbwp.pdschconfig - RRC_LIST_TYPE(NR_TCI_State_t, NR_maxNrofTCI_States) TCI_State_list[5]; - // CellGroupConfig.spCellConfig.spCellConfigDedicated.initialdlbwp.pdschconfig - RRC_LIST_TYPE(NR_RateMatchPattern_t, NR_maxNrofRateMatchPatterns) RateMatchPattern_list[5]; - // CellGroupConfig.spCellConfig.spCellConfigDedicated.initialdlbwp.pdschconfig - RRC_LIST_TYPE(NR_ZP_CSI_RS_Resource_t, NR_maxNrofZP_CSI_RS_Resources) ZP_CSI_RS_Resource_list[5]; - // CellGroupConfig.spCellConfig.spCellConfigDedicated.initialdlbwp.pdschconfig - RRC_LIST_TYPE(NR_ZP_CSI_RS_ResourceSet_t, NR_maxNrofZP_CSI_RS_ResourceSets) Aperidic_ZP_CSI_RS_ResourceSet_list[5]; - // CellGroupConfig.spCellConfig.spCellConfigDedicated.initialdlbwp.pdschconfig - RRC_LIST_TYPE(NR_ZP_CSI_RS_ResourceSet_t, NR_maxNrofZP_CSI_RS_ResourceSets) SP_ZP_CSI_RS_ResourceSet_list[5]; - - // TODO check the way to implement mutiple list inside bwps - // uplink bwp also - - // CellGroupConfig.spCellConfig.spCellConfigDedicated - RRC_LIST_TYPE(NR_NZP_CSI_RS_Resource_t, NR_maxNrofNZP_CSI_RS_Resources) NZP_CSI_RS_Resource_list; - // CellGroupConfig.spCellConfig.spCellConfigDedicated - RRC_LIST_TYPE(NR_NZP_CSI_RS_ResourceSet_t, NR_maxNrofNZP_CSI_RS_ResourceSets) NZP_CSI_RS_ResourceSet_list; - // CellGroupConfig.spCellConfig.spCellConfigDedicated - RRC_LIST_TYPE(NR_CSI_IM_Resource_t, NR_maxNrofCSI_IM_Resources) CSI_IM_Resource_list; - // CellGroupConfig.spCellConfig.spCellConfigDedicated - RRC_LIST_TYPE(NR_CSI_IM_ResourceSet_t, NR_maxNrofCSI_IM_ResourceSets) CSI_IM_ResourceSet_list; - // CellGroupConfig.spCellConfig.spCellConfigDedicated - RRC_LIST_TYPE(NR_CSI_SSB_ResourceSet_t, NR_maxNrofCSI_SSB_ResourceSets) CSI_SSB_ResourceSet_list; - // CellGroupConfig.spCellConfig.spCellConfigDedicated - RRC_LIST_TYPE(NR_CSI_ResourceConfig_t, NR_maxNrofCSI_ResourceConfigurations) CSI_ResourceConfig_list; - // CellGroupConfig.spCellConfig.spCellConfigDedicated - RRC_LIST_TYPE(NR_CSI_ReportConfig_t, NR_maxNrofCSI_ReportConfigurations) CSI_ReportConfig_list; long selected_plmn_identity; Rrc_State_NR_t nrRrcState; diff --git a/openair2/RRC/NR_UE/rrc_list.h b/openair2/RRC/NR_UE/rrc_list.h deleted file mode 100644 index 20a0adad56639cac726dea8cb345f8804e22022c..0000000000000000000000000000000000000000 --- a/openair2/RRC/NR_UE/rrc_list.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/* \file rrc_list.h - * \brief linked list implementation for ToAddModList mechanism in RRC layer - * \author R. Knopp, K.H. HSU - * \date 2018 - * \version 0.1 - * \company Eurecom / NTUST - * \email: knopp@eurecom.fr, kai-hsiang.hsu@eurecom.fr - * \note - * \warning - */ - -#ifndef _RRC_LIST_H_ -#define _RRC_LIST_H_ - - -#define RRC_LIST_TYPE(T, N) \ - struct { \ - T *entries[N]; \ - int next[N]; \ - int prev[N]; \ - int start; \ - int count; \ - } - -// initial function for the certain list, storage number of entry, initial pointer and corresponding links -#define RRC_LIST_INIT(list, c) \ - do { \ - int iterator; \ - (list).count = (c); \ - for(iterator=0; iterator<c; ++iterator){ \ - (list).entries[iterator] = NULL; \ - (list).next[iterator] = -1; \ - (list).prev[iterator] = -1; \ - (list).start = -1; \ - } \ - }while(0) - - -// check the entry by id first then update or create new entry. -#define RRC_LIST_MOD_ADD(list, new, id_name) \ - do { \ - int iterator; \ - for(iterator=(list).start; iterator!=-1; iterator=(list).next[iterator]){ \ - if((new)->id_name == (list).entries[iterator]->id_name){ \ - (list).entries[iterator] = (new); \ - break; \ - } \ - } \ - if(iterator==-1){ \ - for(iterator=0; iterator<(list).count; ++iterator){ \ - if((list).entries[iterator] == NULL){ \ - (list).next[iterator] = (list).start; \ - (list).prev[iterator] = -1; \ - if((list).start != -1){ \ - (list).prev[list.start] = iterator; \ - } \ - (list).start = iterator; \ - (list).entries[iterator] = (new); \ - break; \ - } \ - } \ - } \ - }while(0) - -// search entries by id, unlink from the list and output free pointer for upper function to release memory -#define RRC_LIST_MOD_REL(list, id_name, id, free) \ - do{ \ - int iterator; \ - for(iterator=(list).start; iterator!=-1; iterator=(list).next[iterator]){ \ - if(id == (list).entries[iterator]->id_name){ \ - if((list).prev[iterator] == -1){ \ - (list).start = (list).next[iterator]; \ - }else{ \ - (list).next[(list).prev[iterator]] = (list).next[iterator]; \ - } \ - if((list).next[iterator] != -1){ \ - (list).prev[(list).next[iterator]] = (list).prev[iterator]; \ - } \ - (free) = (list).entries[iterator]; \ - (list).entries[iterator] = NULL; \ - break; \ - } \ - } \ - }while(0) - - -#define RRC_LIST_FOREACH(list, i) \ - for((i)=(list).start; (i) != -1; (i)=(list).next[i]) - -#define RRC_LIST_ENTRY(list, i) \ - list.entries[i] - -#endif diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 83f6773da78df9b4ac5d1cd30dea66133c3fd4ff..30919d88d2828b50efb5289dbf8af8b969fbe0e2 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -40,6 +40,7 @@ #include "NR_CellGroupConfig.h" #include "NR_RadioBearerConfig.h" #include "openair2/PHY_INTERFACE/queue_t.h" +#include "common/utils/ocp_itti/intertask_interface.h" extern queue_t nr_rach_ind_queue; extern queue_t nr_rx_ind_queue; @@ -82,11 +83,6 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR \param meas_config measurement configuration*/ int8_t nr_rrc_ue_process_meas_config(NR_MeasConfig_t *meas_config); -/**\prief Process secondary cell group config from NR RRC connection reconfiguration message or EN-DC primitives - \param cell_group_config secondary cell group configuration*/ -//TODO check EN-DC function call flow. -int8_t nr_rrc_ue_process_scg_config(const module_id_t module_id, NR_CellGroupConfig_t *cell_group_config); - /**\prief Process radio bearer config from NR RRC connection reconfiguration message \param radio_bearer_config radio bearer configuration*/ int8_t nr_rrc_ue_process_radio_bearer_config(NR_RadioBearerConfig_t *radio_bearer_config);