From becbb0a45f8abda27baf65b0c6ced7d793eee17c Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Mon, 23 Sep 2019 15:26:32 +0200 Subject: [PATCH] added UE reading of configuration files (RRCReconfiguration,RadioBearerConfig) for static NSA without LTE --- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 4 +- openair2/RRC/NR/rrc_gNB_internode.c | 7 ++ openair2/RRC/NR_UE/rrc_UE.c | 80 +++++++++++++++++++-- openair2/RRC/NR_UE/rrc_defs.h | 5 ++ 4 files changed, 89 insertions(+), 7 deletions(-) diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index a57f42b88a..9758e1bc3e 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -2598,14 +2598,14 @@ void nr_ue_measurement_procedures(uint16_t l, // symbol index of each slot [0 if (l==2) { // UE measurements on symbol 0 LOG_D(PHY,"Calling measurements nr_tti_rx %d, rxdata %p\n",nr_tti_rx,ue->common_vars.rxdata); - + /* nr_ue_measurements(ue, 0, 0, 0, 0, nr_tti_rx); - + */ //(nr_tti_rx*frame_parms->samples_per_tti+ue->rx_offset)%(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME) #if T_TRACER diff --git a/openair2/RRC/NR/rrc_gNB_internode.c b/openair2/RRC/NR/rrc_gNB_internode.c index 02ff805bc8..6ce7607dd4 100644 --- a/openair2/RRC/NR/rrc_gNB_internode.c +++ b/openair2/RRC/NR/rrc_gNB_internode.c @@ -104,6 +104,10 @@ int generate_CG_Config(gNB_RRC_INST *rrc, printf("%02x",((uint8_t *)buffer)[i]); } printf("\n"); + FILE *fd = fopen("reconfig.raw","w"); + fwrite((void*)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd); + fclose(fd); + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RadioBearerConfig, NULL, (void *)rbconfig, buffer, 1024); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", enc_rval.failed_type->name, enc_rval.encoded); @@ -116,6 +120,9 @@ int generate_CG_Config(gNB_RRC_INST *rrc, printf("%02x",((uint8_t*)buffer)[i]); } printf("\n"); + fd = fopen("rbconfig.raw","w"); + fwrite((void*)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd); + fclose(fd); return(0); } diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 0a5c597e1f..a7082915e3 100755 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -45,7 +45,7 @@ #include "mac_proto.h" - +extern int phy_test; // from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded) int8_t nr_rrc_ue_decode_secondary_cellgroup_config( @@ -85,6 +85,14 @@ int8_t nr_rrc_ue_decode_secondary_cellgroup_config( return 0; } +int8_t nr_rrc_ue_process_RadioBearerConfig(NR_RadioBearerConfig_t *RadioBearerConfig){ + + + xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)RadioBearerConfig); + // Configure PDCP + + return 0; +} // from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (decoded) // RRCReconfiguration @@ -96,7 +104,7 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(NR_RRCReconfiguration_t *rrcReconfig if(NR_UE_rrc_inst->radio_bearer_config == NULL){ NR_UE_rrc_inst->radio_bearer_config = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig; }else{ - nr_rrc_ue_process_radio_bearer_config(rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig); + nr_rrc_ue_process_RadioBearerConfig(rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig); } } @@ -108,6 +116,8 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(NR_RRCReconfiguration_t *rrcReconfig (uint8_t *)rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->secondaryCellGroup->buf, rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->secondaryCellGroup->size, 0, 0); + xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)cellGroupConfig); + if(NR_UE_rrc_inst->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->cell_group_config = cellGroupConfig; @@ -148,6 +158,8 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(NR_RRCReconfiguration_t *rrcReconfig return 0; } + + int8_t nr_rrc_ue_process_meas_config(NR_MeasConfig_t *meas_config){ return 0; @@ -197,12 +209,56 @@ int8_t nr_rrc_ue_process_scg_config(NR_CellGroupConfig_t *cell_group_config){ return 0; } -int8_t nr_rrc_ue_process_radio_bearer_config(NR_RadioBearerConfig_t *radio_bearer_config){ - return 0; + + + +void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, void *message,int msg_len) { + + switch (nsa_message_type) { + case nr_SecondaryCellGroupConfig_r15: + { + NR_RRCReconfiguration_t *RRCReconfiguration; + asn_dec_rval_t dec_rval = uper_decode_complete( NULL, + &asn_DEF_NR_RRCReconfiguration, + (void **)&RRCReconfiguration, + (uint8_t *)message, + msg_len); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(RRC,"NR_RRCReconfiguration decode error\n"); + // free the memory + SEQUENCE_free( &asn_DEF_NR_RRCReconfiguration, RRCReconfiguration, 1 ); + return; + } + nr_rrc_ue_process_rrcReconfiguration(RRCReconfiguration); + } + break; + case nr_RadioBearerConfigX_r15: + { + NR_RadioBearerConfig_t *RadioBearerConfig; + asn_dec_rval_t dec_rval = uper_decode_complete( NULL, + &asn_DEF_NR_RadioBearerConfig, + (void **)&RadioBearerConfig, + (uint8_t *)message, + msg_len); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(RRC,"NR_RadioBearerConfig decode error\n"); + // free the memory + SEQUENCE_free( &asn_DEF_NR_RadioBearerConfig, RadioBearerConfig, 1 ); + return; + } + nr_rrc_ue_process_RadioBearerConfig(RadioBearerConfig); + } + break; + default: + AssertFatal(1==0,"Unknown message %d\n",nsa_message_type); + break; + } + } - int8_t openair_rrc_top_init_ue_nr(void){ if(NB_NR_UE_INST > 0){ @@ -264,6 +320,20 @@ int8_t openair_rrc_top_init_ue_nr(void){ RRC_LIST_INIT(NR_UE_rrc_inst->CSI_SSB_ResourceSet_list, NR_maxNrofCSI_SSB_ResourceSets); RRC_LIST_INIT(NR_UE_rrc_inst->CSI_ResourceConfig_list, NR_maxNrofCSI_ResourceConfigurations); RRC_LIST_INIT(NR_UE_rrc_inst->CSI_ReportConfig_list, NR_maxNrofCSI_ReportConfigurations); + + if (phy_test==1) { + // read in files for RRCReconfiguration and RBconfig + FILE *fd; + fd = fopen("reconfig.raw","r"); + char *buffer[1024]; + int msg_len=fread(buffer,1,1024,fd); + fclose(fd); + process_nsa_message(NR_UE_rrc_inst, nr_SecondaryCellGroupConfig_r15, buffer,msg_len); + fd = fopen("rbconfig.raw","r"); + msg_len=fread(buffer,1,1024,fd); + fclose(fd); + process_nsa_message(NR_UE_rrc_inst, nr_RadioBearerConfigX_r15, buffer,msg_len); + } }else{ NR_UE_rrc_inst = NULL; } diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index af8971e5ed..da636fed99 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -57,6 +57,11 @@ typedef uint32_t channel_t; +typedef enum { + nr_SecondaryCellGroupConfig_r15=0, + nr_RadioBearerConfigX_r15=1 +} nsa_message_t; + typedef struct NR_UE_RRC_INST_s { NR_MeasConfig_t *meas_config;