diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 229ebc7c19..980ab3bbd2 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -49,7 +49,6 @@ #include "PHY/NR_TRANSPORT/nr_dlsch.h" //#include "../../SIMU/USER/init_lte.h" -#include "RRC/LTE/rrc_vars.h" #include "PHY_INTERFACE/phy_interface_vars.h" #include "NR_IF_Module.h" #include "openair1/SIMULATION/TOOLS/sim.h" @@ -64,7 +63,6 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "common/utils/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" -#include "enb_config.h" #include "LAYER2/nr_pdcp/nr_pdcp_oai_api.h" #include "intertask_interface.h" @@ -90,7 +88,6 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "nr_nas_msg.h" #include #include "openair2/GNB_APP/gnb_paramdef.h" -#include "pdcp.h" #include "actor.h" THREAD_STRUCT thread_struct; @@ -302,7 +299,7 @@ void init_openair0() static void init_pdcp(int ue_id) { - if (get_softmodem_params()->nsa && nr_rlc_module_init(0) != 0) { + if (get_softmodem_params()->nsa && nr_rlc_module_init(NR_RLC_OP_MODE_UE) != 0) { LOG_I(RLC, "Problem at RLC initiation \n"); } nr_pdcp_layer_init(); diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index 1bc447cb44..5af21a16e8 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -5,6 +5,9 @@ #include "common/utils/threadPool/thread-pool.h" #include "PHY/defs_nr_UE.h" +extern int NB_UE_INST; +extern uint16_t ue_id_g; + #define CONFIG_HLP_IF_FREQ "IF frequency for RF, if needed\n" #define CONFIG_HLP_IF_FREQ_OFF "UL IF frequency offset for RF, if needed\n" #define CONFIG_HLP_DLSCH_PARA "number of threads for dlsch processing 0 for no parallelization\n" diff --git a/executables/position_interface.c b/executables/position_interface.c index 84509fbb8e..be37515096 100644 --- a/executables/position_interface.c +++ b/executables/position_interface.c @@ -21,8 +21,6 @@ #include "position_interface.h" -extern uint16_t NB_UE_INST; - static void read_position_coordinates(char *sectionName, position_t *position) { paramdef_t position_params[] = POSITION_CONFIG_PARAMS_DEF; @@ -36,4 +34,4 @@ void get_position_coordinates(int Mod_id, position_t *position) char positionName[64]; snprintf(positionName, sizeof(positionName), "position%d", Mod_id); read_position_coordinates(positionName, position); -} \ No newline at end of file +} diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 14adffad9b..a8f97a2f00 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -62,8 +62,6 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; uint64_t downlink_frequency[MAX_NUM_CCs][4]; double cpuf; -//uint8_t nfapi_mode = 0; -const int NB_UE_INST = 1; uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1}; const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 2ce428fc8a..f767734e5f 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -62,7 +62,6 @@ #include "PHY/impl_defs_nr.h" #include "PHY/phy_vars_nr_ue.h" #include "RRC/NR/nr_rrc_config.h" -#include "RRC/NR/nr_rrc_proto.h" #include "SCHED_NR/fapi_nr_l1.h" #include "SCHED_NR/sched_nr.h" #include "SCHED_NR_UE/defs.h" @@ -86,7 +85,6 @@ #include "oai_asn1.h" #include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" #include "openair1/SIMULATION/TOOLS/sim.h" -#include "openair2/RRC/LTE/rrc_vars.h" #include "thread-pool.h" #include "time_meas.h" #include "utils.h" @@ -121,6 +119,43 @@ void nr_derive_key_ng_ran_star(uint16_t pci, uint64_t nr_arfcn_dl, const uint8_t { } +/* Function to set or overwrite PTRS DL RRC parameters */ +static void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, long *ptrsNrb, long *ptrsMcs, long *epre_Ratio, long *reOffset) +{ + int i=0; + NR_DMRS_DownlinkConfig_t *tmp = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; + // struct NR_SetupRelease_PTRS_DownlinkConfig *tmp=bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS; + /* check for memory allocation */ + if (tmp->phaseTrackingRS == NULL) { + asn1cCalloc(tmp->phaseTrackingRS, TrackingRS); + TrackingRS->present = NR_SetupRelease_PTRS_DownlinkConfig_PR_setup; + asn1cCalloc(TrackingRS->choice.setup, setup); + asn1cCalloc(setup->frequencyDensity, freqD); + /* Fill the given values */ + for(i = 0; i < 2; i++) { + asn1cSequenceAdd(freqD->list, long, nbr); + *nbr = ptrsNrb[i]; + } + asn1cCalloc(setup->timeDensity, timeD); + for(i = 0; i < 3; i++) { + asn1cSequenceAdd(timeD->list, long, mcs); + *mcs = ptrsMcs[i]; + } + asn1cCallocOne(setup->epre_Ratio, epre_Ratio[0]); + asn1cCallocOne(setup->resourceElementOffset, reOffset[0]); + } else { + NR_PTRS_DownlinkConfig_t *TrackingRS = tmp->phaseTrackingRS->choice.setup; + for(i = 0; i < 2; i++) { + *TrackingRS->frequencyDensity->list.array[i] = ptrsNrb[i]; + } + for(i = 0; i < 3; i++) { + *TrackingRS->timeDensity->list.array[i] = ptrsMcs[i]; + } + *TrackingRS->epre_Ratio = epre_Ratio[0]; + *TrackingRS->resourceElementOffset = reOffset[0]; + } +} + int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); } void e1_bearer_context_setup(const e1ap_bearer_setup_req_t *req) { abort(); } @@ -261,7 +296,6 @@ void validate_input_pmi(nfapi_nr_config_request_scf_t *gNB_config, } -int NB_UE_INST = 1; configmodule_interface_t *uniqCfg = NULL; int main(int argc, char **argv) { diff --git a/openair1/SIMULATION/NR_PHY/nr_unitary_common.c b/openair1/SIMULATION/NR_PHY/nr_unitary_common.c index 6e23a67d25..734a62d994 100644 --- a/openair1/SIMULATION/NR_PHY/nr_unitary_common.c +++ b/openair1/SIMULATION/NR_PHY/nr_unitary_common.c @@ -178,15 +178,3 @@ void *rrc_nrue(void *notUsed) { return NULL; } -int8_t nr_mac_rrc_sl_mib_ind(const module_id_t module_id, - const int CC_id, - const uint8_t gNB_index, - const frame_t frame, - const int slot, - const int channel, - const uint8_t *pduP, - const sdu_size_t pdu_len, - const uint16_t rx_slss_id) -{ - return 1; -} diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index d032a9d53c..ef92fe23b9 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -59,8 +59,6 @@ RAN_CONTEXT_t RC; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; double cpuf; -//uint8_t nfapi_mode = 0; -const int NB_UE_INST = 1; // needed for some functions openair0_config_t openair0_cfg[MAX_CARDS]; diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index ed872be341..8095dc4b51 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -124,7 +124,6 @@ nrUE_params_t *get_nrUE_params(void) { } void processSlotTX(void *arg) {} -int NB_UE_INST = 1; configmodule_interface_t *uniqCfg = NULL; int main(int argc, char **argv){ diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 2d97a6a536..701023a756 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -59,8 +59,6 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; uint64_t downlink_frequency[MAX_NUM_CCs][4]; double cpuf; -//uint8_t nfapi_mode = 0; -const int NB_UE_INST = 1; uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1}; const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 6e157ac57e..76ab8f1871 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -71,8 +71,6 @@ uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1}; const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; double cpuf; -//uint8_t nfapi_mode = 0; -const int NB_UE_INST = 1; // needed for some functions PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } }; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 7b58853fbe..a23320ee10 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -32,7 +32,6 @@ #include "common/utils/var_array.h" #define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) #include "SIMULATION/LTE_PHY/common_sim.h" -#include "openair2/RRC/LTE/rrc_vars.h" #include "common/utils/assertions.h" #include "executables/softmodem-common.h" #include "NR_BCCH-BCH-Message.h" @@ -160,7 +159,6 @@ uint16_t n_rnti = 0x1234; openair0_config_t openair0_cfg[MAX_CARDS]; channel_desc_t *UE2gNB[MAX_MOBILES_PER_GNB][NUMBER_OF_gNB_MAX]; -int NB_UE_INST = 1; configmodule_interface_t *uniqCfg = NULL; int main(int argc, char *argv[]) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 5d32c96074..a3db7ebba6 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -29,6 +29,7 @@ #ifndef RRC_MESSAGES_TYPES_H_ #define RRC_MESSAGES_TYPES_H_ #include "common/utils/mem/oai_memory.h" +#include "openair1/PHY/defs_common.h" #include "as_message.h" #include "rrc_types.h" #include "s1ap_messages_types.h" @@ -43,6 +44,12 @@ #include "NR_RACH-ConfigCommon.h" #include "NR_ServingCellConfigCommon.h" #include "NR_ServingCellConfig.h" +#include "NR_SIB1.h" +#include "NR_SIB19-r17.h" +#include "NR_CellGroupConfig.h" +#include "NR_BCCH-BCH-Message.h" +#include "NR_ReestablishmentCause.h" +#include "NR_UE-NR-Capability.h" //-------------------------------------------------------------------------------------------// // Messages for RRC logging @@ -463,7 +470,6 @@ typedef struct { int ue_id; } RlcMaxRtxIndication; -#include "openair2/RRC/NR_UE/rrc_defs.h" typedef struct { NR_ReestablishmentCause_t cause; } nr_mac_rrc_config_reset_t; diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c index 21b2e0f41c..3583661475 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c @@ -25,6 +25,7 @@ #include "ran_func_pdcp.h" #include "common/ran_context.h" +#include "common/openairinterface5g_limits.h" #include "openair2/E2AP/flexric/src/util/time_now_us.h" #if defined (NGRAN_GNB_DU) diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index deb272776f..4528a7766f 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -38,6 +38,7 @@ #include "lib/f1ap_interface_management.h" #include "f1ap_cu_paging.h" #include "f1ap_cu_task.h" +#include "openair2/RRC/NR/nr_rrc_defs.h" #include //Fixme: Uniq dirty DU instance, by global var, datamodel need better management diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 693ce4eb5a..c248a3cc53 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -406,15 +406,4 @@ uint8_t sl_determine_sci_1a_len(uint16_t *num_subchannels, int sl_nr_ue_slot_select(const sl_nr_phy_config_request_t *cfg, int nr_slot, uint8_t frame_duplex_type); void nr_ue_sidelink_scheduler(nr_sidelink_indication_t *sl_ind, NR_UE_MAC_INST_t *mac); - -void nr_mac_rrc_sl_mib_ind(const module_id_t module_id, - const int CC_id, - const uint8_t gNB_index, - const frame_t frame, - const int slot, - const channel_t channel, - uint8_t *pduP, - const sdu_size_t pdu_len, - const uint16_t rx_slss_id); - #endif diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 1ca4168b6f..6a6c7633bf 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -141,7 +141,7 @@ NR_UE_MAC_INST_t *nr_l2_init_ue(int nb_inst) ue_init_config_request(mac, get_slots_per_frame_from_scs(get_softmodem_params()->numerology)); } - int rc = nr_rlc_module_init(0); + int rc = nr_rlc_module_init(NR_RLC_OP_MODE_UE); AssertFatal(rc == 0, "Could not initialize RLC layer\n"); for (int j = 0; j < nb_inst; j++) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index b5182550c5..808afc8d86 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -33,6 +33,7 @@ /* MAC */ #include "nr_mac_gNB.h" #include "NR_MAC_gNB/mac_proto.h" +#include "openair2/COMMON/mac_messages_types.h" /* Utils */ #include "common/utils/LOG/log.h" diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index cf71c794b6..c294d2966a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -61,6 +61,11 @@ #include "common/utils/alg/find.h" +// 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs +#define NR_RRC_SETUP_DELAY_MS 10 +#define NR_RRC_RECONFIGURATION_DELAY_MS 10 +#define NR_RRC_BWP_SWITCHING_DELAY_MS 6 + // #define DEBUG_DCI // CQI TABLES (10 times the value in 214 to adequately compare with R) // Table 1 (38.214 5.2.2.1-2) diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 0e0442d77a..4d732bb3eb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -306,7 +306,9 @@ void mac_top_init_gNB(ngran_node_t node_type, mac_rrc_init(RC.nrmac[i], node_type); }//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++) - AssertFatal(nr_rlc_module_init(1) == 0,"Could not initialize RLC layer\n"); + nr_rlc_op_mode_t mode = NODE_IS_MONOLITHIC(node_type) ? NR_RLC_OP_MODE_MONO_GNB : NR_RLC_OP_MODE_SPLIT_GNB; + int success = nr_rlc_module_init(mode); + AssertFatal(success == 0,"Could not initialize RLC layer\n"); // These should be out of here later if (get_softmodem_params()->usim_test == 0 ) nr_pdcp_layer_init(); diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h index b5de4c2b44..f05ba07b02 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h @@ -25,9 +25,7 @@ #include #include #include "common/platform_types.h" - #include "nr_pdcp_sdu.h" -#include "openair2/RRC/NR/rrc_gNB_radio_bearers.h" #include "openair3/SECU/secu_defs.h" /* PDCP Formats according to clause 6.2 of 3GPP TS 38.323 */ @@ -41,6 +39,8 @@ #define LONG_PDCP_HEADER_SIZE 3 /* MAC-I size (unit: byte) */ #define PDCP_INTEGRITY_SIZE 4 +/* K keys have 128 bits length */ +#define NR_K_KEY_SIZE 16 typedef enum { NR_PDCP_DRB_AM, diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h index 9899b0cf56..a30016f5dc 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h @@ -23,7 +23,7 @@ #define _NR_PDCP_UE_MANAGER_H_ #include "nr_pdcp_entity.h" - +#include "common/platform_constants.h" #include "common/platform_types.h" typedef void nr_pdcp_ue_manager_t; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index b48b03847f..94079dada8 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -320,7 +320,7 @@ int nr_rlc_get_available_tx_space(const int ue_id, const logical_chan_id_t chann return ret; } -int nr_rlc_module_init(int gnb_flag) +int nr_rlc_module_init(nr_rlc_op_mode_t mode) { static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static int inited = 0; @@ -328,6 +328,7 @@ int nr_rlc_module_init(int gnb_flag) if (pthread_mutex_lock(&lock)) abort(); + bool gnb_flag = mode != NR_RLC_OP_MODE_UE; if (gnb_flag == 1 && inited) { LOG_E(RLC, "%s:%d:%s: fatal, inited already 1\n", __FILE__, __LINE__, __FUNCTION__); exit(1); @@ -343,7 +344,7 @@ int nr_rlc_module_init(int gnb_flag) if (gnb_flag == 0) inited_ue = 1; - nr_rlc_ue_manager = new_nr_rlc_ue_manager(gnb_flag); + nr_rlc_ue_manager = new_nr_rlc_ue_manager(mode); if (pthread_mutex_unlock(&lock)) abort(); @@ -409,17 +410,14 @@ rb_found: T_INT(0 /*ctxt_pP->module_id*/), T_INT(ue->ue_id), T_INT(rb_id), T_INT(size)); - const ngran_node_t type = RC.nrrrc[0 /*ctxt_pP->module_id*/]->node_type; - AssertFatal(!NODE_IS_CU(type), - "Can't be CU, bad node type %d\n", type); - // if (NODE_IS_DU(type) && is_srb == 0) { // LOG_D(RLC, "call proto_agent_send_pdcp_data_ind() \n"); // proto_agent_send_pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock); // return; // } - if (NODE_IS_DU(type)) { + bool rlc_split = nr_rlc_manager_rlc_is_split(nr_rlc_ue_manager); + if (rlc_split) { if(is_srb) { MessageDef *msg; msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h index 700a29d702..fec65796d9 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h @@ -34,14 +34,13 @@ #include "NR_LogicalChannelIdentity.h" #include "NR_RadioBearerConfig.h" #include "NR_CellGroupConfig.h" -#include "openair2/RRC/NR/nr_rrc_proto.h" #include "nr_rlc_ue_manager.h" struct NR_RLC_Config; struct NR_LogicalChannelConfig; -int nr_rlc_module_init(int gnb_flag); +int nr_rlc_module_init(nr_rlc_op_mode_t mode); void nr_mac_rlc_data_ind(const module_id_t module_idP, const uint16_t ue_id, const bool gnb_flagP, diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c index 52e0f6a6b8..5b7563135e 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c @@ -31,10 +31,10 @@ typedef struct { pthread_mutex_t lock; nr_rlc_ue_t **ue_list; int ue_count; - int gnb_flag; + nr_rlc_op_mode_t mode; } nr_rlc_ue_manager_internal_t; -nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int gnb_flag) +nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(nr_rlc_op_mode_t mode) { nr_rlc_ue_manager_internal_t *ret; @@ -45,15 +45,21 @@ nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int gnb_flag) } if (pthread_mutex_init(&ret->lock, NULL)) abort(); - ret->gnb_flag = gnb_flag; + ret->mode = mode; return ret; } +bool nr_rlc_manager_rlc_is_split(nr_rlc_ue_manager_t *_m) +{ + nr_rlc_ue_manager_internal_t *m = _m; + return m->mode == NR_RLC_OP_MODE_SPLIT_GNB; +} + int nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager_t *_m) { nr_rlc_ue_manager_internal_t *m = _m; - return m->gnb_flag; + return m->mode != NR_RLC_OP_MODE_UE; } void nr_rlc_manager_lock(nr_rlc_ue_manager_t *_m) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h index 799d7afca8..3dec237958 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h @@ -24,11 +24,18 @@ #include "common/platform_types.h" #include "nr_rlc_entity.h" #include "common/platform_constants.h" +#include "common/ngran_types.h" typedef void nr_rlc_ue_manager_t; typedef enum nr_rlc_rb_type { NR_RLC_NONE = 0, NR_RLC_SRB = 1, NR_RLC_DRB = 2 } nr_rlc_rb_type; +typedef enum { + NR_RLC_OP_MODE_SPLIT_GNB, + NR_RLC_OP_MODE_MONO_GNB, + NR_RLC_OP_MODE_UE, +} nr_rlc_op_mode_t; + typedef struct nr_rlc_rb_t { nr_rlc_rb_type type; union { @@ -52,8 +59,9 @@ typedef struct nr_rlc_ue_t { /* manager functions */ /***********************************************************************/ -nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int gnb_flag); +nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(nr_rlc_op_mode_t mode); +bool nr_rlc_manager_rlc_is_split(nr_rlc_ue_manager_t *_m); int nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager_t *m); void nr_rlc_manager_lock(nr_rlc_ue_manager_t *m); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 07343488a2..131b2694b6 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -452,8 +452,8 @@ void free_nr_noS1_bearer_config(NR_RadioBearerConfig_t **rbconfig, } //------------------------------------------------------------------------------ -int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, - uint8_t *const buffer, +int do_RRCSetup(uint8_t *const buffer, + size_t buffer_size, const uint8_t transaction_id, const uint8_t *masterCellGroup, int masterCellGroup_len, @@ -461,9 +461,6 @@ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, NR_SRB_ToAddModList_t *SRBs) //------------------------------------------------------------------------------ { - AssertFatal(ue_context_pP != NULL, "ue_context_p is null\n"); - gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; - NR_DL_CCCH_Message_t dl_ccch_msg = {0}; dl_ccch_msg.message.present = NR_DL_CCCH_MessageType_PR_c1; asn1cCalloc(dl_ccch_msg.message.choice.c1, dl_msg); @@ -488,12 +485,10 @@ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, memcpy(ie->masterCellGroup.buf, masterCellGroup, masterCellGroup_len); ie->masterCellGroup.size = masterCellGroup_len; - if (LOG_DEBUGFLAG(DEBUG_ASN1)) { - xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, ue_p->masterCellGroup); + if (LOG_DEBUGFLAG(DEBUG_ASN1)) xer_fprint(stdout, &asn_DEF_NR_DL_CCCH_Message, (void *)&dl_ccch_msg); - } - asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_CCCH_Message, NULL, (void *)&dl_ccch_msg, buffer, 1000); + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_CCCH_Message, NULL, (void *)&dl_ccch_msg, buffer, buffer_size); AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); // free what we did not allocate ourselves @@ -643,7 +638,7 @@ int do_NR_RRCRelease(uint8_t *buffer, size_t buffer_size, uint8_t Transaction_id } //------------------------------------------------------------------------------ -int do_RRCReconfiguration(const gNB_RRC_UE_t *UE, +int do_RRCReconfiguration(int rrc_ue_id, uint8_t *buffer, size_t buffer_size, uint8_t Transaction_id, @@ -743,7 +738,7 @@ int do_RRCReconfiguration(const gNB_RRC_UE_t *UE, ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_DCCH_Message, &dl_dcch_msg); LOG_D(NR_RRC, "RRCReconfiguration for UE %d: Encoded %zd bits (%zd bytes)\n", - UE->rrc_ue_id, + rrc_ue_id, enc_rval.encoded, (enc_rval.encoded + 7) / 8); @@ -1030,12 +1025,7 @@ int do_RRCReestablishmentRequest(uint8_t *buffer, } //------------------------------------------------------------------------------ -int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, - uint8_t *const buffer, - size_t buffer_size, - const uint8_t Transaction_id, - uint16_t pci, - NR_ARFCN_ValueNR_t absoluteFrequencySSB) +int do_RRCReestablishment(int8_t nh_ncc, uint8_t *const buffer, size_t buffer_size, const uint8_t Transaction_id) { asn_enc_rval_t enc_rval; NR_DL_DCCH_Message_t dl_dcch_msg = {0}; @@ -1052,19 +1042,8 @@ int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, rrcReestablishment->criticalExtensions.present = NR_RRCReestablishment__criticalExtensions_PR_rrcReestablishment; rrcReestablishment->criticalExtensions.choice.rrcReestablishment = CALLOC(1, sizeof(NR_RRCReestablishment_IEs_t)); - LOG_I(NR_RRC, "Reestablishment update key pci=%d, earfcn_dl=%lu\n", pci, absoluteFrequencySSB); - // 3GPP TS 33.501 Section 6.11 Security handling for RRC connection re-establishment procedure - if (ue_context_pP->ue_context.nh_ncc >= 0) { - nr_derive_key_ng_ran_star(pci, absoluteFrequencySSB, ue_context_pP->ue_context.nh, ue_context_pP->ue_context.kgnb); - rrcReestablishment->criticalExtensions.choice.rrcReestablishment->nextHopChainingCount = ue_context_pP->ue_context.nh_ncc; - } else { // first HO - nr_derive_key_ng_ran_star(pci, absoluteFrequencySSB, ue_context_pP->ue_context.kgnb, ue_context_pP->ue_context.kgnb); - // LG: really 1 - rrcReestablishment->criticalExtensions.choice.rrcReestablishment->nextHopChainingCount = 0; - } - - ue_context_pP->ue_context.kgnb_ncc = 0; + rrcReestablishment->criticalExtensions.choice.rrcReestablishment->nextHopChainingCount = nh_ncc >= 0 ? nh_ncc : 0; rrcReestablishment->criticalExtensions.choice.rrcReestablishment->lateNonCriticalExtension = NULL; rrcReestablishment->criticalExtensions.choice.rrcReestablishment->nonCriticalExtension = NULL; @@ -1116,172 +1095,28 @@ int do_RRCReestablishmentComplete(uint8_t *buffer, size_t buffer_size, int64_t r return((enc_rval.encoded+7)/8); } -static NR_ReportConfigToAddMod_t *prepare_periodic_event_report(const nr_per_event_t *per_event) -{ - NR_ReportConfigToAddMod_t *rc = calloc(1, sizeof(*rc)); - rc->reportConfigId = 1; - rc->reportConfig.present = NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR; - - NR_PeriodicalReportConfig_t *prc = calloc(1, sizeof(*prc)); - prc->rsType = NR_NR_RS_Type_ssb; - prc->reportInterval = NR_ReportInterval_ms1024; - prc->reportAmount = NR_PeriodicalReportConfig__reportAmount_infinity; - prc->reportQuantityCell.rsrp = true; - prc->reportQuantityCell.rsrq = true; - prc->reportQuantityCell.sinr = true; - prc->reportQuantityRS_Indexes = calloc(1, sizeof(*prc->reportQuantityRS_Indexes)); - prc->reportQuantityRS_Indexes->rsrp = true; - prc->reportQuantityRS_Indexes->rsrq = true; - prc->reportQuantityRS_Indexes->sinr = true; - asn1cCallocOne(prc->maxNrofRS_IndexesToReport, per_event->maxReportCells); - prc->maxReportCells = per_event->maxReportCells; - prc->includeBeamMeasurements = per_event->includeBeamMeasurements; - - NR_ReportConfigNR_t *rcnr = calloc(1, sizeof(*rcnr)); - rcnr->reportType.present = NR_ReportConfigNR__reportType_PR_periodical; - rcnr->reportType.choice.periodical = prc; - - rc->reportConfig.choice.reportConfigNR = rcnr; - return rc; -} - -static NR_ReportConfigToAddMod_t *prepare_a2_event_report(const nr_a2_event_t *a2_event) -{ - NR_ReportConfigToAddMod_t *rc_A2 = calloc(1, sizeof(*rc_A2)); - rc_A2->reportConfigId = 2; - rc_A2->reportConfig.present = NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR; - NR_EventTriggerConfig_t *etrc_A2 = calloc(1, sizeof(*etrc_A2)); - etrc_A2->eventId.present = NR_EventTriggerConfig__eventId_PR_eventA2; - etrc_A2->eventId.choice.eventA2 = calloc(1, sizeof(*etrc_A2->eventId.choice.eventA2)); - etrc_A2->eventId.choice.eventA2->a2_Threshold.present = NR_MeasTriggerQuantity_PR_rsrp; - etrc_A2->eventId.choice.eventA2->a2_Threshold.choice.rsrp = a2_event->threshold_RSRP; - etrc_A2->eventId.choice.eventA2->reportOnLeave = false; - etrc_A2->eventId.choice.eventA2->hysteresis = 0; - etrc_A2->eventId.choice.eventA2->timeToTrigger = a2_event->timeToTrigger; - etrc_A2->rsType = NR_NR_RS_Type_ssb; - etrc_A2->reportInterval = NR_ReportInterval_ms480; - etrc_A2->reportAmount = NR_EventTriggerConfig__reportAmount_r4; - etrc_A2->reportQuantityCell.rsrp = true; - etrc_A2->reportQuantityCell.rsrq = true; - etrc_A2->reportQuantityCell.sinr = true; - asn1cCallocOne(etrc_A2->maxNrofRS_IndexesToReport, 4); - etrc_A2->maxReportCells = 1; - etrc_A2->includeBeamMeasurements = false; - NR_ReportConfigNR_t *rcnr_A2 = calloc(1, sizeof(*rcnr_A2)); - rcnr_A2->reportType.present = NR_ReportConfigNR__reportType_PR_eventTriggered; - rcnr_A2->reportType.choice.eventTriggered = etrc_A2; - rc_A2->reportConfig.choice.reportConfigNR = rcnr_A2; - - return rc_A2; -} - -static NR_ReportConfigToAddMod_t *prepare_a3_event_report(const nr_a3_event_t *a3_event) -{ - NR_ReportConfigToAddMod_t *rc_A3 = calloc(1, sizeof(*rc_A3)); - // 3 is default A3 Report Config ID. So cellId(0) specific Report Config ID - // starts from 4 - rc_A3->reportConfigId = a3_event->pci == -1 ? 3 : a3_event->pci + 4; - rc_A3->reportConfig.present = NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR; - NR_EventTriggerConfig_t *etrc_A3 = calloc(1, sizeof(*etrc_A3)); - etrc_A3->eventId.present = NR_EventTriggerConfig__eventId_PR_eventA3; - etrc_A3->eventId.choice.eventA3 = calloc(1, sizeof(*etrc_A3->eventId.choice.eventA3)); - etrc_A3->eventId.choice.eventA3->a3_Offset.present = NR_MeasTriggerQuantityOffset_PR_rsrp; - etrc_A3->eventId.choice.eventA3->a3_Offset.choice.rsrp = a3_event->a3_offset; - etrc_A3->eventId.choice.eventA3->reportOnLeave = true; - etrc_A3->eventId.choice.eventA3->hysteresis = a3_event->hysteresis; - etrc_A3->eventId.choice.eventA3->timeToTrigger = a3_event->timeToTrigger; - etrc_A3->rsType = NR_NR_RS_Type_ssb; - etrc_A3->reportInterval = NR_ReportInterval_ms1024; - etrc_A3->reportAmount = NR_EventTriggerConfig__reportAmount_r4; - etrc_A3->reportQuantityCell.rsrp = true; - etrc_A3->reportQuantityCell.rsrq = true; - etrc_A3->reportQuantityCell.sinr = true; - asn1cCallocOne(etrc_A3->maxNrofRS_IndexesToReport, 4); - etrc_A3->maxReportCells = 4; - etrc_A3->includeBeamMeasurements = false; - NR_ReportConfigNR_t *rcnr_A3 = calloc(1, sizeof(*rcnr_A3)); - rcnr_A3->reportType.present = NR_ReportConfigNR__reportType_PR_eventTriggered; - rcnr_A3->reportType.choice.eventTriggered = etrc_A3; - rc_A3->reportConfig.choice.reportConfigNR = rcnr_A3; - return rc_A3; -} - -const nr_a3_event_t *get_a3_configuration(int pci) -{ - gNB_RRC_INST *rrc = RC.nrrrc[0]; - nr_measurement_configuration_t *measurementConfiguration = &rrc->measurementConfiguration; - if (!measurementConfiguration->a3_event_list) - return NULL; - - for (uint8_t i = 0; i < measurementConfiguration->a3_event_list->size; i++) { - nr_a3_event_t *a3_event = (nr_a3_event_t *)seq_arr_at(measurementConfiguration->a3_event_list, i); - if (a3_event->pci == pci) - return a3_event; - } - - if (measurementConfiguration->is_default_a3_configuration_exists) - return get_a3_configuration(-1); - - return NULL; -} - NR_MeasConfig_t *get_MeasConfig(const NR_MeasTiming_t *mt, int band, int scs, - const nr_measurement_configuration_t *const measurementConfiguration, - const seq_arr_t *const neighbourConfiguration) + NR_ReportConfigToAddMod_t *rc_PER, + NR_ReportConfigToAddMod_t *rc_A2, + seq_arr_t *rc_A3_seq, + seq_arr_t *pci_seq) { - if (!measurementConfiguration) - return NULL; - - if (!measurementConfiguration->a2_event && !measurementConfiguration->per_event && !measurementConfiguration->a3_event_list) { - LOG_D(NR_RRC, "NR Measurements are not configured in the conf file\n"); - return NULL; - } - - if (!measurementConfiguration->a2_event && !measurementConfiguration->per_event && measurementConfiguration->a3_event_list - && !neighbourConfiguration) { - LOG_I(NR_RRC, "A2 and Periodical Events are off. A3 Can not be prepared without neighbours!\n"); - return NULL; - } - NR_MeasConfig_t *mc = calloc(1, sizeof(*mc)); mc->measObjectToAddModList = calloc(1, sizeof(*mc->measObjectToAddModList)); mc->reportConfigToAddModList = calloc(1, sizeof(*mc->reportConfigToAddModList)); mc->measIdToAddModList = calloc(1, sizeof(*mc->measIdToAddModList)); - if (measurementConfiguration->per_event) { - NR_ReportConfigToAddMod_t *rc_PER = prepare_periodic_event_report(measurementConfiguration->per_event); + if (rc_PER) asn1cSeqAdd(&mc->reportConfigToAddModList->list, rc_PER); - } - if (measurementConfiguration->a2_event) { - LOG_D(NR_RRC, "HO LOG: Preparing A2 Event Measurement Configuration!\n"); - NR_ReportConfigToAddMod_t *rc_A2 = prepare_a2_event_report(measurementConfiguration->a2_event); + if (rc_A2) asn1cSeqAdd(&mc->reportConfigToAddModList->list, rc_A2); - } - if (neighbourConfiguration && measurementConfiguration->a3_event_list && measurementConfiguration->a3_event_list->size > 0) { - /* Loop through neighbours and find related A3 configuration - If no related A3 but there is default add the default one. - If default one added once as a report, no need to add it again && duplication. - */ - LOG_D(NR_RRC, "HO LOG: Preparing A3 Event Measurement Configuration!\n"); - bool is_default_a3_added = false; - for (uint8_t neighbourIdx = 0; neighbourIdx < neighbourConfiguration->size; neighbourIdx++) { - const nr_neighbour_gnb_configuration_t *neighbourCell = - (const nr_neighbour_gnb_configuration_t *)seq_arr_at(neighbourConfiguration, neighbourIdx); - if (!neighbourCell->isIntraFrequencyNeighbour) - continue; - - const nr_a3_event_t *a3Event = get_a3_configuration(neighbourCell->physicalCellId); - if (!a3Event || is_default_a3_added) - continue; - - if (a3Event->pci == -1) - is_default_a3_added = true; - - NR_ReportConfigToAddMod_t *rc_A3 = prepare_a3_event_report(a3Event); + if (rc_A3_seq) { + for (int i = 0; i < rc_A3_seq->size; i++) { + NR_ReportConfigToAddMod_t *rc_A3 = (NR_ReportConfigToAddMod_t *)seq_arr_at(rc_A3_seq, i); asn1cSeqAdd(&mc->reportConfigToAddModList->list, rc_A3); } } @@ -1310,19 +1145,15 @@ NR_MeasConfig_t *get_MeasConfig(const NR_MeasTiming_t *mt, monr1->ext1 = calloc(1, sizeof(*monr1->ext1)); asn1cCallocOne(monr1->ext1->freqBandIndicatorNR, band); - if (neighbourConfiguration && measurementConfiguration->a3_event_list) { - for (uint8_t nCell = 0; nCell < neighbourConfiguration->size; nCell++) { - const nr_neighbour_gnb_configuration_t *neighbourCell = - (const nr_neighbour_gnb_configuration_t *)seq_arr_at(neighbourConfiguration, nCell); - if (!neighbourCell->isIntraFrequencyNeighbour) - continue; - + if (pci_seq) { + for (int i = 0; i < pci_seq->size; i++) { if (monr1->cellsToAddModList == NULL) { monr1->cellsToAddModList = calloc(1, sizeof(*monr1->cellsToAddModList)); } NR_CellsToAddMod_t *cell = calloc(1, sizeof(*cell)); - cell->physCellId = neighbourCell->physicalCellId; + int *pci = (int *)seq_arr_at(pci_seq, i); + cell->physCellId = *pci; ASN_SEQUENCE_ADD(&monr1->cellsToAddModList->list, cell); } } diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index 2d703912e2..3d09a65bd0 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -50,7 +50,6 @@ #include "NR_ReestablishmentCause.h" #include "NR_SRB-ToAddModList.h" #include "NR_SecurityConfig.h" -#include "RRC/NR/nr_rrc_defs.h" #include "ds/seq_arr.h" #include "rrc_messages_types.h" struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList; @@ -86,8 +85,8 @@ void fill_nr_noS1_bearer_config(NR_RadioBearerConfig_t **rbconfig, void free_nr_noS1_bearer_config(NR_RadioBearerConfig_t **rbconfig, NR_RLC_BearerConfig_t **rlc_rbconfig); -int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, - uint8_t *const buffer, +int do_RRCSetup(uint8_t *const buffer, + size_t buffer_size, const uint8_t transaction_id, const uint8_t *masterCellGroup, int masterCellGroup_len, @@ -103,7 +102,7 @@ int do_NR_SA_UECapabilityEnquiry(uint8_t *const buffer, const uint8_t Transactio int do_NR_RRCRelease(uint8_t *buffer, size_t buffer_size, uint8_t Transaction_id); -int do_RRCReconfiguration(const gNB_RRC_UE_t *UE, +int do_RRCReconfiguration(int rrc_ue_id, uint8_t *buffer, size_t buffer_size, uint8_t Transaction_id, @@ -147,21 +146,17 @@ int do_RRCReestablishmentRequest(uint8_t *buffer, uint32_t cell_id, uint16_t c_rnti); -int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, - uint8_t *const buffer, - size_t buffer_size, - const uint8_t Transaction_id, - uint16_t pci, - NR_ARFCN_ValueNR_t absoluteFrequencySSB); +int do_RRCReestablishment(int8_t nh_ncc, uint8_t *const buffer, size_t buffer_size, const uint8_t Transaction_id); int do_RRCReestablishmentComplete(uint8_t *buffer, size_t buffer_size, int64_t rrc_TransactionIdentifier); -const nr_a3_event_t *get_a3_configuration(int pci); NR_MeasConfig_t *get_MeasConfig(const NR_MeasTiming_t *mt, int band, int scs, - const nr_measurement_configuration_t *const measurementConfiguration, - const seq_arr_t *const neighbourConfiguration); + NR_ReportConfigToAddMod_t *rc_PER, + NR_ReportConfigToAddMod_t *rc_A2, + seq_arr_t *rc_A3_seq, + seq_arr_t *pci_seq); void free_MeasConfig(NR_MeasConfig_t *mc); int do_NR_Paging(uint8_t Mod_id, uint8_t *buffer, uint32_t tmsi); diff --git a/openair2/RRC/NR/MESSAGES/tests/test_asn1_msg.cpp b/openair2/RRC/NR/MESSAGES/tests/test_asn1_msg.cpp index 1b8d5ce4d8..347c35d3ea 100644 --- a/openair2/RRC/NR/MESSAGES/tests/test_asn1_msg.cpp +++ b/openair2/RRC/NR/MESSAGES/tests/test_asn1_msg.cpp @@ -66,12 +66,9 @@ TEST(nr_asn1, rrc_reestablishment_request) TEST(nr_asn1, rrc_reestablishment) { - rrc_gNB_ue_context_t ue_context_pP; - memset(&ue_context_pP, 0, sizeof(ue_context_pP)); unsigned char buf[1000]; - const uint32_t physical_cell_id = 177; - NR_ARFCN_ValueNR_t absoluteFrequencySSB = 2700000; - EXPECT_GT(do_RRCReestablishment(&ue_context_pP, buf, 1000, 0, physical_cell_id, absoluteFrequencySSB), 0); + const uint8_t nh_ncc = 0; + EXPECT_GT(do_RRCReestablishment(nh_ncc, buf, 1000, 0), 0); } TEST(nr_asn1, paging) diff --git a/openair2/RRC/NR/nr_rrc_common.h b/openair2/RRC/NR/nr_rrc_common.h index f3bc3681a9..f6b2cb0d21 100644 --- a/openair2/RRC/NR/nr_rrc_common.h +++ b/openair2/RRC/NR/nr_rrc_common.h @@ -23,9 +23,10 @@ #define __NR_RRC_COMMON_H__ #include +#include "NR_BWP-Downlink.h" #define NR_NUM_SRB 4 /* Number of Signalling Radio Bearers according to clause 4.2.2 of 3GPP TS 38.331 */ -#define NR_K_KEY_SIZE 16 /* K keys have 128 bits length */ +#define NR_RRC_BUF_SIZE 4096 typedef enum UE_STATE_NR_e { NR_RRC_INACTIVE=0, diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index f0dfc2ec02..79d102f9e3 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -55,11 +55,6 @@ #include "NR_UE-NR-Capability.h" #include "intertask_interface.h" -// 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs -#define NR_RRC_SETUP_DELAY_MS 10 -#define NR_RRC_RECONFIGURATION_DELAY_MS 10 -#define NR_RRC_BWP_SWITCHING_DELAY_MS 6 - typedef enum { NR_RRC_OK=0, NR_RRC_ConnSetup_failed, @@ -72,7 +67,6 @@ typedef enum { #define MAX_MEAS_CONFIG 7 #define MAX_MEAS_ID 7 -#define NR_RRC_BUF_SIZE 4096 #define UNDEF_SECURITY_MODE 0xff #define NO_SECURITY_MODE 0x20 diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index f20a5e12a2..dc5e77bbc5 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -66,14 +66,6 @@ void rrc_gNB_generate_RRCRelease(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE); \param args_p Pointer on arguments to start the task. */ void *rrc_gnb_task(void *args_p); -/**\ Function to set or overwrite PTRS DL RRC parameters. - \ *bwp Pointer to dedicated RC config structure - \ *ptrsNrb Pointer to K_ptrs N_RB related parameters - \ *ptrsMcs Pointer to L_ptrs MCS related parameters - \ *epre_Ratio Pointer to ep_ratio - \ *reOffset Pointer to RE Offset Value */ -void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, long *ptrsNrb, long *ptrsMcs, long *epre_Ratio, long *reOffset); - int nr_rrc_reconfiguration_req(gNB_RRC_INST *rrc, gNB_RRC_UE_t *ue_p, const int dl_bwp_id, const int ul_bwp_id); void rrc_gNB_generate_dedicatedRRCReconfiguration_release(gNB_RRC_INST *rrc, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 824cd701fb..6978d0684e 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -94,6 +94,7 @@ #include "xer_encoder.h" #include "E1AP/lib/e1ap_bearer_context_management.h" #include "E1AP/lib/e1ap_interface_management.h" +#include "NR_DL-DCCH-Message.h" #ifdef E2_AGENT #include "openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h" @@ -405,7 +406,7 @@ static void rrc_gNB_generate_RRCSetup(instance_t instance, ue_p->xids[xid] = RRC_SETUP; NR_SRB_ToAddModList_t *SRBs = createSRBlist(ue_p, false); - int size = do_RRCSetup(ue_context_pP, buf, xid, masterCellGroup, masterCellGroup_len, &rrc->configuration, SRBs); + int size = do_RRCSetup(buf, sizeof(buf), xid, masterCellGroup, masterCellGroup_len, &rrc->configuration, SRBs); AssertFatal(size > 0, "do_RRCSetup failed\n"); AssertFatal(size <= 1024, "memory corruption\n"); @@ -470,6 +471,114 @@ static void rrc_gNB_process_RRCSetupComplete(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE rrc_gNB_send_NGAP_NAS_FIRST_REQ(rrc, UE, rrcSetupComplete); } +static nr_a3_event_t *get_a3_configuration(gNB_RRC_INST *rrc, int pci) +{ + nr_measurement_configuration_t *measurementConfiguration = &rrc->measurementConfiguration; + if (!measurementConfiguration->a3_event_list) + return NULL; + + for (uint8_t i = 0; i < measurementConfiguration->a3_event_list->size; i++) { + nr_a3_event_t *a3_event = (nr_a3_event_t *)seq_arr_at(measurementConfiguration->a3_event_list, i); + if (a3_event->pci == pci) + return a3_event; + } + + if (measurementConfiguration->is_default_a3_configuration_exists) + return get_a3_configuration(rrc, -1); + + return NULL; +} + +static NR_ReportConfigToAddMod_t *prepare_periodic_event_report(const nr_per_event_t *per_event) +{ + NR_ReportConfigToAddMod_t *rc = calloc(1, sizeof(*rc)); + rc->reportConfigId = 1; + rc->reportConfig.present = NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR; + + NR_PeriodicalReportConfig_t *prc = calloc(1, sizeof(*prc)); + prc->rsType = NR_NR_RS_Type_ssb; + prc->reportInterval = NR_ReportInterval_ms1024; + prc->reportAmount = NR_PeriodicalReportConfig__reportAmount_infinity; + prc->reportQuantityCell.rsrp = true; + prc->reportQuantityCell.rsrq = true; + prc->reportQuantityCell.sinr = true; + prc->reportQuantityRS_Indexes = calloc(1, sizeof(*prc->reportQuantityRS_Indexes)); + prc->reportQuantityRS_Indexes->rsrp = true; + prc->reportQuantityRS_Indexes->rsrq = true; + prc->reportQuantityRS_Indexes->sinr = true; + asn1cCallocOne(prc->maxNrofRS_IndexesToReport, per_event->maxReportCells); + prc->maxReportCells = per_event->maxReportCells; + prc->includeBeamMeasurements = per_event->includeBeamMeasurements; + + NR_ReportConfigNR_t *rcnr = calloc(1, sizeof(*rcnr)); + rcnr->reportType.present = NR_ReportConfigNR__reportType_PR_periodical; + rcnr->reportType.choice.periodical = prc; + + rc->reportConfig.choice.reportConfigNR = rcnr; + return rc; +} + +static NR_ReportConfigToAddMod_t *prepare_a2_event_report(const nr_a2_event_t *a2_event) +{ + NR_ReportConfigToAddMod_t *rc_A2 = calloc(1, sizeof(*rc_A2)); + rc_A2->reportConfigId = 2; + rc_A2->reportConfig.present = NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR; + NR_EventTriggerConfig_t *etrc_A2 = calloc(1, sizeof(*etrc_A2)); + etrc_A2->eventId.present = NR_EventTriggerConfig__eventId_PR_eventA2; + etrc_A2->eventId.choice.eventA2 = calloc(1, sizeof(*etrc_A2->eventId.choice.eventA2)); + etrc_A2->eventId.choice.eventA2->a2_Threshold.present = NR_MeasTriggerQuantity_PR_rsrp; + etrc_A2->eventId.choice.eventA2->a2_Threshold.choice.rsrp = a2_event->threshold_RSRP; + etrc_A2->eventId.choice.eventA2->reportOnLeave = false; + etrc_A2->eventId.choice.eventA2->hysteresis = 0; + etrc_A2->eventId.choice.eventA2->timeToTrigger = a2_event->timeToTrigger; + etrc_A2->rsType = NR_NR_RS_Type_ssb; + etrc_A2->reportInterval = NR_ReportInterval_ms480; + etrc_A2->reportAmount = NR_EventTriggerConfig__reportAmount_r4; + etrc_A2->reportQuantityCell.rsrp = true; + etrc_A2->reportQuantityCell.rsrq = true; + etrc_A2->reportQuantityCell.sinr = true; + asn1cCallocOne(etrc_A2->maxNrofRS_IndexesToReport, 4); + etrc_A2->maxReportCells = 1; + etrc_A2->includeBeamMeasurements = false; + NR_ReportConfigNR_t *rcnr_A2 = calloc(1, sizeof(*rcnr_A2)); + rcnr_A2->reportType.present = NR_ReportConfigNR__reportType_PR_eventTriggered; + rcnr_A2->reportType.choice.eventTriggered = etrc_A2; + rc_A2->reportConfig.choice.reportConfigNR = rcnr_A2; + + return rc_A2; +} + +static NR_ReportConfigToAddMod_t *prepare_a3_event_report(const nr_a3_event_t *a3_event) +{ + NR_ReportConfigToAddMod_t *rc_A3 = calloc(1, sizeof(*rc_A3)); + // 3 is default A3 Report Config ID. So cellId(0) specific Report Config ID + // starts from 4 + rc_A3->reportConfigId = a3_event->pci == -1 ? 3 : a3_event->pci + 4; + rc_A3->reportConfig.present = NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR; + NR_EventTriggerConfig_t *etrc_A3 = calloc(1, sizeof(*etrc_A3)); + etrc_A3->eventId.present = NR_EventTriggerConfig__eventId_PR_eventA3; + etrc_A3->eventId.choice.eventA3 = calloc(1, sizeof(*etrc_A3->eventId.choice.eventA3)); + etrc_A3->eventId.choice.eventA3->a3_Offset.present = NR_MeasTriggerQuantityOffset_PR_rsrp; + etrc_A3->eventId.choice.eventA3->a3_Offset.choice.rsrp = a3_event->a3_offset; + etrc_A3->eventId.choice.eventA3->reportOnLeave = true; + etrc_A3->eventId.choice.eventA3->hysteresis = a3_event->hysteresis; + etrc_A3->eventId.choice.eventA3->timeToTrigger = a3_event->timeToTrigger; + etrc_A3->rsType = NR_NR_RS_Type_ssb; + etrc_A3->reportInterval = NR_ReportInterval_ms1024; + etrc_A3->reportAmount = NR_EventTriggerConfig__reportAmount_r4; + etrc_A3->reportQuantityCell.rsrp = true; + etrc_A3->reportQuantityCell.rsrq = true; + etrc_A3->reportQuantityCell.sinr = true; + asn1cCallocOne(etrc_A3->maxNrofRS_IndexesToReport, 4); + etrc_A3->maxReportCells = 4; + etrc_A3->includeBeamMeasurements = false; + NR_ReportConfigNR_t *rcnr_A3 = calloc(1, sizeof(*rcnr_A3)); + rcnr_A3->reportType.present = NR_ReportConfigNR__reportType_PR_eventTriggered; + rcnr_A3->reportType.choice.eventTriggered = etrc_A3; + rc_A3->reportConfig.choice.reportConfigNR = rcnr_A3; + return rc_A3; +} + static int rrc_gNB_encode_RRCReconfiguration(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, uint8_t xid, @@ -483,6 +592,10 @@ static int rrc_gNB_encode_RRCReconfiguration(gNB_RRC_INST *rrc, DevAssert(du != NULL); f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; NR_MeasConfig_t *measconfig = NULL; + NR_ReportConfigToAddMod_t *rc_PER = NULL; + NR_ReportConfigToAddMod_t *rc_A2 = NULL; + seq_arr_t *rc_A3_seq = NULL; + seq_arr_t *pci_seq = NULL; if (du->mtc != NULL) { int scs = get_ssb_scs(cell_info); int band = get_dl_band(cell_info); @@ -493,7 +606,38 @@ static int rrc_gNB_encode_RRCReconfiguration(gNB_RRC_INST *rrc, if (neighbour_config) neighbour_cells = neighbour_config->neighbour_cells; - measconfig = get_MeasConfig(mt, band, scs, &rrc->measurementConfiguration, neighbour_cells); + if (neighbour_cells + && rrc->measurementConfiguration.a3_event_list + && rrc->measurementConfiguration.a3_event_list->size > 0) { + /* Loop through neighbours and find related A3 configuration + If no related A3 but there is default add the default one. + If default one added once as a report, no need to add it again && duplication. + */ + rc_A3_seq = malloc(sizeof(seq_arr_t)); + pci_seq = malloc(sizeof(seq_arr_t)); + seq_arr_init(rc_A3_seq, sizeof(NR_ReportConfigToAddMod_t)); + seq_arr_init(pci_seq, sizeof(int)); + LOG_D(NR_RRC, "HO LOG: Preparing A3 Event Measurement Configuration!\n"); + bool is_default_a3_added = false; + for (int i = 0; i < neighbour_cells->size; i++) { + nr_neighbour_gnb_configuration_t *neighbourCell = (nr_neighbour_gnb_configuration_t *)seq_arr_at(neighbour_cells, i); + if (!neighbourCell->isIntraFrequencyNeighbour) + continue; + seq_arr_push_back(pci_seq, &neighbourCell->physicalCellId, sizeof(int)); + const nr_a3_event_t *a3Event = get_a3_configuration(rrc, neighbourCell->physicalCellId); + if (!a3Event || is_default_a3_added) + continue; + if (a3Event->pci == -1) + is_default_a3_added = true; + seq_arr_push_back(rc_A3_seq, prepare_a3_event_report(a3Event), sizeof(NR_ReportConfigToAddMod_t)); + } + } + if (rrc->measurementConfiguration.per_event) + rc_PER = prepare_periodic_event_report(rrc->measurementConfiguration.per_event); + if (rrc->measurementConfiguration.a2_event) + rc_A2 = prepare_a2_event_report(rrc->measurementConfiguration.a2_event); + + measconfig = get_MeasConfig(mt, band, scs, rc_PER, rc_A2, rc_A3_seq, pci_seq); } if (UE->measConfig) @@ -504,7 +648,7 @@ static int rrc_gNB_encode_RRCReconfiguration(gNB_RRC_INST *rrc, NR_SRB_ToAddModList_t *SRBs = createSRBlist(UE, reestablish); NR_DRB_ToAddModList_t *DRBs = createDRBlist(UE, reestablish); - int size = do_RRCReconfiguration(UE, + int size = do_RRCReconfiguration(UE->rrc_ue_id, buf, max_len, xid, @@ -657,7 +801,7 @@ void rrc_gNB_modify_dedicatedRRCReconfiguration(gNB_RRC_INST *rrc, gNB_RRC_UE_t NR_DRB_ToAddModList_t *DRBs = createDRBlist(ue_p, false); uint8_t buffer[NR_RRC_BUF_SIZE]; - int size = do_RRCReconfiguration(ue_p, + int size = do_RRCReconfiguration(ue_p->rrc_ue_id, buffer, NR_RRC_BUF_SIZE, xid, @@ -709,7 +853,7 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration_release(gNB_RRC_INST *rrc, } uint8_t buffer[NR_RRC_BUF_SIZE] = {0}; - int size = do_RRCReconfiguration(ue_p, + int size = do_RRCReconfiguration(ue_p->rrc_ue_id, buffer, NR_RRC_BUF_SIZE, xid, @@ -842,7 +986,10 @@ static void rrc_gNB_generate_RRCReestablishment(rrc_gNB_ue_context_t *ue_context ue_p->xids[xid] = RRC_REESTABLISH; const f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; uint32_t ssb_arfcn = get_ssb_arfcn(du); - int size = do_RRCReestablishment(ue_context_pP, buffer, NR_RRC_BUF_SIZE, xid, cell_info->nr_pci, ssb_arfcn); + LOG_I(NR_RRC, "Reestablishment update key pci=%d, earfcn_dl=%u\n", cell_info->nr_pci, ssb_arfcn); + nr_derive_key_ng_ran_star(cell_info->nr_pci, ssb_arfcn, ue_p->nh_ncc >= 0 ? ue_p->nh : ue_p->kgnb, ue_p->kgnb); + ue_p->kgnb_ncc = 0; + int size = do_RRCReestablishment(ue_context_pP->ue_context.nh_ncc, buffer, NR_RRC_BUF_SIZE, xid); LOG_A(NR_RRC, "Send RRCReestablishment [%d bytes] to RNTI %04x\n", size, ue_p->rnti); @@ -968,7 +1115,7 @@ static void rrc_gNB_process_RRCReestablishmentComplete(gNB_RRC_INST *rrc, gNB_RR uint8_t new_xid = rrc_gNB_get_next_transaction_identifier(rrc->module_id); ue_p->xids[new_xid] = RRC_REESTABLISH_COMPLETE; uint8_t buffer[NR_RRC_BUF_SIZE] = {0}; - int size = do_RRCReconfiguration(ue_p, + int size = do_RRCReconfiguration(ue_p->rrc_ue_id, buffer, NR_RRC_BUF_SIZE, new_xid, @@ -1009,7 +1156,17 @@ int nr_rrc_reconfiguration_req(gNB_RRC_INST *rrc, gNB_RRC_UE_t *ue_p, const int } uint8_t buffer[NR_RRC_BUF_SIZE]; - int size = do_RRCReconfiguration(ue_p, buffer, NR_RRC_BUF_SIZE, xid, NULL, NULL, NULL, NULL, NULL, NULL, masterCellGroup); + int size = do_RRCReconfiguration(ue_p->rrc_ue_id, + buffer, + NR_RRC_BUF_SIZE, + xid, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + masterCellGroup); const uint32_t msg_id = NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration; nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DL_SCH_LCID_DCCH, msg_id, buffer, size); @@ -1265,7 +1422,10 @@ static void process_Periodical_Measurement_Report(gNB_RRC_UE_t *ue_ctxt, NR_Meas measurementReport->criticalExtensions.choice.measurementReport = NULL; } -static void process_Event_Based_Measurement_Report(gNB_RRC_UE_t *ue, NR_ReportConfigNR_t *report, NR_MeasurementReport_t *measurementReport) +static void process_Event_Based_Measurement_Report(gNB_RRC_INST *rrc, + gNB_RRC_UE_t *ue, + NR_ReportConfigNR_t *report, + NR_MeasurementReport_t *measurementReport) { NR_EventTriggerConfig_t *event_triggered = report->reportType.choice.eventTriggered; @@ -1330,7 +1490,7 @@ static void process_Event_Based_Measurement_Report(gNB_RRC_UE_t *ue, NR_ReportCo // neighbour. if (!neigh_cell && neighbour) { // No F1 connection but static neighbour configuration is available - const nr_a3_event_t *a3_event_configuration = get_a3_configuration(neighbour->physicalCellId); + const nr_a3_event_t *a3_event_configuration = get_a3_configuration(rrc, neighbour->physicalCellId); // Additional check - This part can be modified according to additional cell specific Handover Margin if (a3_event_configuration && ((a3_event_configuration->a3_offset + a3_event_configuration->hysteresis) @@ -1356,7 +1516,7 @@ static void process_Event_Based_Measurement_Report(gNB_RRC_UE_t *ue, NR_ReportCo } } -static void rrc_gNB_process_MeasurementReport(gNB_RRC_UE_t *UE, NR_MeasurementReport_t *measurementReport) +static void rrc_gNB_process_MeasurementReport(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, NR_MeasurementReport_t *measurementReport) { NR_MeasurementReport__criticalExtensions_PR p = measurementReport->criticalExtensions.present; if (p != NR_MeasurementReport__criticalExtensions_PR_measurementReport @@ -1408,7 +1568,7 @@ static void rrc_gNB_process_MeasurementReport(gNB_RRC_UE_t *UE, NR_MeasurementRe return process_Periodical_Measurement_Report(UE, measurementReport); if (report_config->choice.reportConfigNR->reportType.present == NR_ReportConfigNR__reportType_PR_eventTriggered) - return process_Event_Based_Measurement_Report(UE, report_config->choice.reportConfigNR, measurementReport); + return process_Event_Based_Measurement_Report(rrc, UE, report_config->choice.reportConfigNR, measurementReport); LOG_E(NR_RRC, "Incoming Report Type: %d is not supported! \n", report_config->choice.reportConfigNR->reportType.present); } @@ -1767,7 +1927,7 @@ static int rrc_gNB_decode_dcch(gNB_RRC_INST *rrc, const f1ap_ul_rrc_message_t *m case NR_UL_DCCH_MessageType__c1_PR_measurementReport: if (ul_dcch_msg->message.choice.c1->choice.measurementReport != NULL) { - rrc_gNB_process_MeasurementReport(UE, ul_dcch_msg->message.choice.c1->choice.measurementReport); + rrc_gNB_process_MeasurementReport(rrc, UE, ul_dcch_msg->message.choice.c1->choice.measurementReport); } else { LOG_E(NR_RRC, "UE %d: No measurementReport CHOICE is given\n", ue_context_p->ue_context.rrc_ue_id); } diff --git a/openair2/RRC/NR/rrc_gNB_du.c b/openair2/RRC/NR/rrc_gNB_du.c index 3df1109778..d6e025309a 100644 --- a/openair2/RRC/NR/rrc_gNB_du.c +++ b/openair2/RRC/NR/rrc_gNB_du.c @@ -30,6 +30,7 @@ #include "asn_codecs.h" #include "assertions.h" #include "common/ran_context.h" +#include "common/utils/nr/nr_common.h" #include "common/utils/T/T.h" #include "common/utils/alg/foreach.h" #include "common/utils/ds/seq_arr.h" diff --git a/openair2/RRC/NR/rrc_gNB_mobility.c b/openair2/RRC/NR/rrc_gNB_mobility.c index be12f2e562..477be84800 100644 --- a/openair2/RRC/NR/rrc_gNB_mobility.c +++ b/openair2/RRC/NR/rrc_gNB_mobility.c @@ -35,6 +35,7 @@ #include "nr_pdcp/nr_pdcp_oai_api.h" #include "openair3/SECU/key_nas_deriver.h" #include "openair2/RRC/NR/rrc_gNB_NGAP.h" +#include "NR_DL-DCCH-MessageType.h" #ifdef E2_AGENT #include "openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h" diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 1f94e21d6c..57e9b28dc6 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -63,41 +63,4 @@ NR_RRCReconfiguration_IEs_t *get_default_reconfig(const NR_CellGroupConfig_t *se reconfig->nonCriticalExtension = NULL; return reconfig; } - -/* Function to set or overwrite PTRS DL RRC parameters */ -void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, long *ptrsNrb, long *ptrsMcs, long *epre_Ratio, long *reOffset) -{ - int i=0; - NR_DMRS_DownlinkConfig_t *tmp = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; - // struct NR_SetupRelease_PTRS_DownlinkConfig *tmp=bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS; - /* check for memory allocation */ - if (tmp->phaseTrackingRS == NULL) { - asn1cCalloc(tmp->phaseTrackingRS, TrackingRS); - TrackingRS->present = NR_SetupRelease_PTRS_DownlinkConfig_PR_setup; - asn1cCalloc(TrackingRS->choice.setup, setup); - asn1cCalloc(setup->frequencyDensity, freqD); - /* Fill the given values */ - for(i = 0; i < 2; i++) { - asn1cSequenceAdd(freqD->list, long, nbr); - *nbr = ptrsNrb[i]; - } - asn1cCalloc(setup->timeDensity, timeD); - for(i = 0; i < 3; i++) { - asn1cSequenceAdd(timeD->list, long, mcs); - *mcs = ptrsMcs[i]; - } - asn1cCallocOne(setup->epre_Ratio, epre_Ratio[0]); - asn1cCallocOne(setup->resourceElementOffset, reOffset[0]); - } else { - NR_PTRS_DownlinkConfig_t *TrackingRS = tmp->phaseTrackingRS->choice.setup; - for(i = 0; i < 2; i++) { - *TrackingRS->frequencyDensity->list.array[i] = ptrsNrb[i]; - } - for(i = 0; i < 3; i++) { - *TrackingRS->timeDensity->list.array[i] = ptrsMcs[i]; - } - *TrackingRS->epre_Ratio = epre_Ratio[0]; - *TrackingRS->resourceElementOffset = reOffset[0]; - } -} #endif diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index 7202943322..09bce459f2 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -30,7 +30,6 @@ * \warning */ -#include "rrc_defs.h" #include "L2_interface_ue.h" #include "assertions.h" #include "LAYER2/NR_MAC_COMMON/nr_mac.h" diff --git a/openair2/RRC/NR_UE/L2_interface_ue.h b/openair2/RRC/NR_UE/L2_interface_ue.h index f394e5e333..e36f6d83fb 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.h +++ b/openair2/RRC/NR_UE/L2_interface_ue.h @@ -19,9 +19,10 @@ * contact@openairinterface.org */ -#include "rrc_defs.h" #include "common/utils/ocp_itti/intertask_interface.h" +typedef uint32_t channel_t; + #ifndef _L2_INTERFACE_UE_H_ #define _L2_INTERFACE_UE_H_ void nr_mac_rrc_sync_ind(const module_id_t module_id, const frame_t frame, const bool in_sync); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 57ba669aeb..f7aa232c71 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -33,6 +33,7 @@ #define RRC_UE #define RRC_UE_C +#include "LTE_MeasObjectToAddMod.h" #include "NR_DL-DCCH-Message.h" //asn_DEF_NR_DL_DCCH_Message #include "NR_DL-CCCH-Message.h" //asn_DEF_NR_DL_CCCH_Message #include "NR_BCCH-BCH-Message.h" //asn_DEF_NR_BCCH_BCH_Message @@ -47,7 +48,6 @@ #include "rrc_defs.h" #include "rrc_proto.h" -#include "openair2/RRC/LTE/rrc_defs.h" #include "L2_interface_ue.h" #include "LAYER2/NR_MAC_UE/mac_proto.h" @@ -2246,9 +2246,8 @@ static void nr_rrc_initiate_rrcReestablishment(NR_UE_RRC_INST_t *rrc, NR_Reestab static void nr_rrc_ue_generate_rrcReestablishmentComplete(const NR_UE_RRC_INST_t *rrc, const NR_RRCReestablishment_t *rrcReestablishment) { - uint8_t buffer[RRC_BUFFER_SIZE] = {0}; - int size = do_RRCReestablishmentComplete(buffer, RRC_BUFFER_SIZE, - rrcReestablishment->rrc_TransactionIdentifier); + uint8_t buffer[NR_RRC_BUF_SIZE] = {0}; + int size = do_RRCReestablishmentComplete(buffer, NR_RRC_BUF_SIZE, rrcReestablishment->rrc_TransactionIdentifier); LOG_I(NR_RRC, "[RAPROC] Logical Channel UL-DCCH (SRB1), Generating RRCReestablishmentComplete (bytes %d)\n", size); int srb_id = 1; // RRC re-establishment complete on SRB1 nr_pdcp_data_req_srb(rrc->ue_id, srb_id, 0, size, buffer, deliver_pdu_srb_rlc, NULL); diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index d300d2a7b8..e428c4c160 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -65,13 +65,11 @@ #include "common/utils/nr/nr_common.h" #define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE -#define MAX_MEAS_OBJ 7 -#define MAX_MEAS_CONFIG 7 -#define MAX_MEAS_ID 7 +#define MAX_MEAS_OBJ 64 +#define MAX_MEAS_CONFIG 64 +#define MAX_MEAS_ID 64 #define MAX_QUANTITY_CONFIG 2 -typedef uint32_t channel_t; - typedef enum { nr_SecondaryCellGroupConfig_r15=0, nr_RadioBearerConfigX_r15=1 diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h index f3f336dc2c..d5226bb972 100644 --- a/openair3/ocp-gtpu/gtp_itf.h +++ b/openair3/ocp-gtpu/gtp_itf.h @@ -5,6 +5,7 @@ # define GTPU_HEADER_OVERHEAD_MAX 64 +#include "openair2/COMMON/gtpv1_u_messages_types.h" #include "common/utils/hashtable/hashtable.h" #ifdef __cplusplus extern "C" {