From 9a91ed0eeb1282a4cc1919c9bb4c390d4e636d5f Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Mon, 6 Mar 2023 06:54:55 +0100 Subject: [PATCH 01/13] priorities/policy on usrp-tx-thread. Thread id for ru_thread --- executables/nr-ru.c | 4 ++-- radio/USRP/USERSPACE/LIB/usrp_lib.cpp | 31 ++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 48cf6ebe31..e6b6eeac26 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1083,7 +1083,7 @@ void *ru_thread( void *param ) { ru_thread_status = 0; // set default return value sprintf(threadname,"ru_thread %u",ru->idx); - LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]); + LOG_I(PHY,"Starting RU %d (%s,%s) on core %d\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing],sched_getcpu()); memcpy((void *)&ru->config,(void *)&RC.gNB[0]->gNB_config,sizeof(ru->config)); if(emulate_rf) { @@ -1342,7 +1342,7 @@ void init_RU_proc(RU_t *ru) { pthread_mutex_init( &proc->mutex_emulateRF,NULL); pthread_cond_init( &proc->cond_emulateRF, NULL); - threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "ru_thread", ru->tpcores[0], OAI_PRIORITY_RT_MAX ); + threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "ru_thread", -1 /*ru->tpcores[0]*/, OAI_PRIORITY_RT_MAX ); if(emulate_rf) threadCreate( &proc->pthread_emulateRF, emulatedRF_thread, (void *)proc, "emulateRF", -1, OAI_PRIORITY_RT ); diff --git a/radio/USRP/USERSPACE/LIB/usrp_lib.cpp b/radio/USRP/USERSPACE/LIB/usrp_lib.cpp index 227c2f461c..cb7c9fe3b3 100644 --- a/radio/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/radio/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -556,6 +556,7 @@ void *trx_usrp_write_thread(void * arg){ signed char last_packet; int flags_gpio; + printf("trx_usrp_write_thread started on cpu %d\n",sched_getcpu()); while(1){ pthread_mutex_lock(&write_thread->mutex_write); while (write_thread->count_write == 0) { @@ -658,7 +659,35 @@ int trx_usrp_write_init(openair0_device *device){ printf("end of tx write thread\n"); pthread_mutex_init(&write_thread->mutex_write, NULL); pthread_cond_init(&write_thread->cond_write, NULL); - pthread_create(&write_thread->pthread_write,NULL,trx_usrp_write_thread,(void *)device); + struct sched_param sparam={0}; + sparam.sched_priority = sched_get_priority_max(SCHED_RR); + pthread_attr_t attr; + int ret=pthread_attr_init(&attr); + if (ret!=0) { + printf("error initializing USRP tx-thread attribute ret %d, errno: %d\n",ret,errno); + exit(-1); + } + else printf("USRP tx-thread attribute initialized\n"); + ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + if (ret!=0) { + printf("error setting USRP tx-thread inheritance ret %d, errno: %d\n",ret,errno); + exit(-1); + } + else printf("USRP tx-thread inheritance set\n"); + ret=pthread_attr_setschedpolicy(&attr, SCHED_RR); + if (ret!=0) { + printf("error setting USRP tx-thread scheduling policy ret %d, errno: %d\n",ret,errno); + exit(-1); + } + else printf("USRP tx-thread scheduling policy set to SCHED_RR\n"); + ret = pthread_attr_setschedparam(&attr, &sparam); + if (ret!=0) { + printf("error setting USRP tx-thread priority ret %d, errno: %d\n",ret,errno); + exit(-1); + } + else printf("USRP tx-thread priority set to %d\n",sparam.sched_priority); + + pthread_create(&write_thread->pthread_write,&attr,trx_usrp_write_thread,(void *)device); return(0); } From e3425b1f9e4b71211caebe9fe3e3457e759af236 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Tue, 7 Mar 2023 11:24:26 +0100 Subject: [PATCH 02/13] added msg-q threading options (and CPU thread pinning) from O-RAN 7.2 branch to develop-based for testing with USRP. --- executables/nr-gnb.c | 123 ++++++++++++++++++---- executables/nr-ru.c | 56 ++++++---- executables/softmodem-common.c | 1 + executables/softmodem-common.h | 13 ++- openair1/PHY/defs_RU.h | 2 + openair1/PHY/defs_gNB.h | 7 ++ openair1/SCHED_NR/fapi_nr_l1.c | 24 ++++- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 7 +- openair2/ENB_APP/enb_paramdef.h | 4 + openair2/GNB_APP/L1_nr_paramdef.h | 7 ++ openair2/GNB_APP/gnb_config.c | 3 + 11 files changed, 197 insertions(+), 50 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index d958e772a9..e797b685df 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -87,6 +87,7 @@ #include #include +#define USE_MSGQ 1 //#define USRP_DEBUG 1 // Fix per CC openair rf/if device update // extern openair0_device openair0; @@ -118,6 +119,7 @@ void tx_func(void *param) { int absslot_tx = info->timestamp_tx/info->gNB->frame_parms.get_samples_per_slot(slot_tx,&info->gNB->frame_parms); int absslot_rx = absslot_tx-info->gNB->RU_list[0]->sl_ahead; int rt_prof_idx = absslot_rx % RT_PROF_DEPTH; + start_meas(&info->gNB->phy_proc_tx); clock_gettime(CLOCK_MONOTONIC,&info->gNB->rt_L1_profiling.start_L1_TX[rt_prof_idx]); phy_procedures_gNB_TX(info, @@ -126,8 +128,43 @@ void tx_func(void *param) { 1); clock_gettime(CLOCK_MONOTONIC,&info->gNB->rt_L1_profiling.return_L1_TX[rt_prof_idx]); + if (get_softmodem_params()->reorder_thread_disable) { + PHY_VARS_gNB *gNB = info->gNB; + processingData_RU_t syncMsgRU; + syncMsgRU.frame_tx = frame_tx; + syncMsgRU.slot_tx = slot_tx; + syncMsgRU.ru = gNB->RU_list[0]; + syncMsgRU.timestamp_tx = info->timestamp_tx; + LOG_D(PHY,"gNB: %d.%d : calling RU TX function\n",syncMsgRU.frame_tx,syncMsgRU.slot_tx); + ru_tx_func((void*)&syncMsgRU); + } + stop_meas(&info->gNB->phy_proc_tx); } + +void *L1_rx_thread(void *arg) { + PHY_VARS_gNB *gNB = (PHY_VARS_gNB*)arg; + + while (oai_exit == 0) { + notifiedFIFO_elt_t *res = pullNotifiedFIFO(&gNB->resp_L1); + processingData_L1_t *info = (processingData_L1_t *)NotifiedFifoData(res); + rx_func(info); + delNotifiedFIFO_elt(res); + } + return NULL; +} + +void *L1_tx_thread(void *arg) { + PHY_VARS_gNB *gNB = (PHY_VARS_gNB*)arg; + + while (oai_exit == 0) { + notifiedFIFO_elt_t *res = pullNotifiedFIFO(&gNB->L1_tx_out); + processingData_L1tx_t *info = (processingData_L1tx_t *)NotifiedFifoData(res); + tx_func(info); + delNotifiedFIFO_elt(res); + } + return NULL; +} void rx_func(void *param) { processingData_L1_t *info = (processingData_L1_t *) param; PHY_VARS_gNB *gNB = info->gNB; @@ -220,13 +257,16 @@ void rx_func(void *param) { // Do PRACH RU processing L1_nr_prach_procedures(gNB,frame_rx,slot_rx); - //apply the rx signal rotation here - for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) { - apply_nr_rotation_ul(&gNB->frame_parms, - gNB->common_vars.rxdataF[aa], - slot_rx, - 0, - gNB->frame_parms.Ncp==EXTENDED?12:14); + //WA: comment rotation in tx/rx + if((gNB->num_RU == 1) && (gNB->RU_list[0]->if_south != REMOTE_IF4p5)) { + //apply the rx signal rotation here + for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) { + apply_nr_rotation_ul(&gNB->frame_parms, + gNB->common_vars.rxdataF[aa], + slot_rx, + 0, + gNB->frame_parms.Ncp==EXTENDED?12:14); + } } phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx); } @@ -237,22 +277,26 @@ void rx_func(void *param) { // Call the scheduler start_meas(&gNB->ul_indication_stats); - pthread_mutex_lock(&gNB->UL_INFO_mutex); +// pthread_mutex_lock(&gNB->UL_INFO_mutex); gNB->UL_INFO.frame = frame_rx; gNB->UL_INFO.slot = slot_rx; gNB->UL_INFO.module_id = gNB->Mod_id; gNB->UL_INFO.CC_id = gNB->CC_id; gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); - pthread_mutex_unlock(&gNB->UL_INFO_mutex); +// pthread_mutex_unlock(&gNB->UL_INFO_mutex); stop_meas(&gNB->ul_indication_stats); - int tx_slot_type = nr_slot_select(cfg,frame_rx,slot_tx); + int tx_slot_type = nr_slot_select(cfg,frame_tx,slot_tx); if ((tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) && NFAPI_MODE != NFAPI_MODE_PNF) { notifiedFIFO_elt_t *res; processingData_L1tx_t *syncMsg; // Its a FIFO so it maitains the order in which the MAC fills the messages // so no need for checking for right slot - res = pullTpool(&gNB->L1_tx_filled, &gNB->threadPool); + #ifndef USE_MSGQ + if (get_softmodem_params()->reorder_thread_disable) + res = pullTpool(&gNB->L1_tx_out, &gNB->threadPool); + else + res = pullTpool(&gNB->L1_tx_filled, &gNB->threadPool); if (res == NULL) return; // Tpool has been stopped syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res); @@ -260,6 +304,12 @@ void rx_func(void *param) { syncMsg->timestamp_tx = info->timestamp_tx; res->key = slot_tx; pushTpool(&gNB->threadPool, res); +#else + syncMsg = gNB->msgDataTx; + syncMsg->gNB = gNB; + syncMsg->timestamp_tx = info->timestamp_tx; + tx_func(syncMsg); +#endif } else if (get_softmodem_params()->continuous_tx) { notifiedFIFO_elt_t *res = pullTpool(&gNB->L1_tx_free, &gNB->threadPool); if (res == NULL) @@ -318,6 +368,11 @@ static size_t dump_L1_meas_stats(PHY_VARS_gNB *gNB, RU_t *ru, char *output, size const char *end = output + outputlen; output += print_meas_log(&gNB->phy_proc_tx, "L1 Tx processing", NULL, NULL, output, end - output); output += print_meas_log(&gNB->dlsch_encoding_stats, "DLSCH encoding", NULL, NULL, output, end - output); + output += print_meas_log(&gNB->dlsch_scrambling_stats, "DLSCH scrambling", NULL, NULL, output, end-output); + output += print_meas_log(&gNB->dlsch_modulation_stats, "DLSCH modulation", NULL, NULL, output, end-output); + output += print_meas_log(&gNB->dlsch_layer_mapping_stats, "DLSCH layer mapping", NULL, NULL, output,end-output); + output += print_meas_log(&gNB->dlsch_resource_mapping_stats, "DLSCH resource mapping", NULL, NULL, output,end-output); + output += print_meas_log(&gNB->dlsch_precoding_stats, "DLSCH precoding", NULL, NULL, output,end-output); output += print_meas_log(&gNB->phy_proc_rx, "L1 Rx processing", NULL, NULL, output, end - output); output += print_meas_log(&gNB->ul_indication_stats, "UL Indication", NULL, NULL, output, end - output); output += print_meas_log(&gNB->rx_pusch_stats, "PUSCH inner-receiver", NULL, NULL, output, end - output); @@ -362,7 +417,11 @@ void *nrL1_stats_thread(void *param) { reset_meas(&gNB->rx_pusch_stats); reset_meas(&gNB->ulsch_decoding_stats); reset_meas(&gNB->schedule_response_stats); - + reset_meas(&gNB->dlsch_scrambling_stats); + reset_meas(&gNB->dlsch_modulation_stats); + reset_meas(&gNB->dlsch_layer_mapping_stats); + reset_meas(&gNB->dlsch_resource_mapping_stats); + reset_meas(&gNB->dlsch_precoding_stats); while (!oai_exit) { sleep(1); dump_nr_I0_stats(fd,gNB); @@ -445,31 +504,51 @@ void init_gNB_Tpool(int inst) { // L1 RX result FIFO initNotifiedFIFO(&gNB->resp_L1); +#ifndef USE_MSGQ notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_L1_t), 0, &gNB->resp_L1, rx_func); pushNotifiedFIFO(&gNB->resp_L1, msg); // to unblock the process in the beginning - +#endif // L1 TX result FIFO initNotifiedFIFO(&gNB->L1_tx_free); initNotifiedFIFO(&gNB->L1_tx_filled); initNotifiedFIFO(&gNB->L1_tx_out); - - // we create 2 threads for L1 tx processing - for (int i=0; i < 2; i++) { + +#ifdef USE_MSGQ + threadCreate(&gNB->L1_rx_thread, L1_rx_thread, (void *)gNB, "L1_rx_thread", + gNB->L1_rx_thread_core, OAI_PRIORITY_RT_MAX); +// threadCreate(&gNB->L1_tx_thread, L1_tx_thread, (void *)gNB, "L1_tx_thread", +// gNB->L1_tx_thread_core, OAI_PRIORITY_RT_MAX); +#endif + if (get_softmodem_params()->reorder_thread_disable) { notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t), 0, &gNB->L1_tx_out, tx_func); processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx); memset(msgDataTx, 0, sizeof(processingData_L1tx_t)); init_DLSCH_struct(gNB, msgDataTx); memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t)); - pushNotifiedFIFO(&gNB->L1_tx_free, msgL1Tx); // to unblock the process in the beginning +#ifndef USE_MSGQ + pushNotifiedFIFO(&gNB->L1_tx_out, msgL1Tx); // to unblock the process in the beginning +#else + gNB->msgDataTx = msgDataTx; +#endif + } else { + // we create 2 threads for L1 tx processing + for (int i=0; i < 2; i++) { + notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t), 0, &gNB->L1_tx_out, tx_func); + processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx); + memset(msgDataTx, 0, sizeof(processingData_L1tx_t)); + init_DLSCH_struct(gNB, msgDataTx); + memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t)); + pushNotifiedFIFO(&gNB->L1_tx_free, msgL1Tx); // to unblock the process in the beginning + } + + LOG_I(PHY,"Creating thread for TX reordering and dispatching to RU\n"); + threadCreate(&proc->pthread_tx_reorder, tx_reorder_thread, (void *)gNB, "thread_tx_reorder", + gNB->RU_list[0] ? gNB->RU_list[0]->tpcores[1] : -1, OAI_PRIORITY_RT_MAX); } if ((!get_softmodem_params()->emulate_l1) && (!IS_SOFTMODEM_NOSTATS_BIT) && (NFAPI_MODE!=NFAPI_MODE_VNF)) threadCreate(&proc->L1_stats_thread,nrL1_stats_thread,(void*)gNB,"L1_stats",-1,OAI_PRIORITY_RT_LOW); - LOG_I(PHY,"Creating thread for TX reordering and dispatching to RU\n"); - threadCreate(&proc->pthread_tx_reorder, tx_reorder_thread, (void *)gNB, "thread_tx_reorder", - gNB->RU_list[0] ? gNB->RU_list[0]->tpcores[1] : -1, OAI_PRIORITY_RT_MAX); - } @@ -538,6 +617,7 @@ void init_eNB_afterRU(void) { gNB = RC.gNB[inst]; gNB->ldpc_offload_flag = ldpc_offload_flag; + gNB->reorder_thread_disable = get_softmodem_params()->reorder_thread_disable; phy_init_nr_gNB(gNB); @@ -616,6 +696,7 @@ void init_gNB(int single_thread_flag,int wait_for_sync) { gNB->prach_energy_counter = 0; gNB->chest_time = get_softmodem_params()->chest_time; gNB->chest_freq = get_softmodem_params()->chest_freq; + } diff --git a/executables/nr-ru.c b/executables/nr-ru.c index e6b6eeac26..7edaaf98a8 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -60,6 +60,8 @@ unsigned short config_frames[4] = {2,9,11,13}; #endif +#define USE_MSGQ 1 + /* these variables have to be defined before including ENB_APP/enb_paramdef.h and GNB_APP/gnb_paramdef.h */ static int DEFBANDS[] = {7}; static int DEFENBS[] = {0}; @@ -83,6 +85,8 @@ static int DEFRUTPCORES[] = {-1,-1,-1,-1}; extern int oai_exit; +uint16_t sl_ahead; + extern struct timespec timespec_sub(struct timespec lhs, struct timespec rhs); extern struct timespec timespec_add(struct timespec lhs, struct timespec rhs); extern void nr_phy_free_RU(RU_t *); @@ -1083,7 +1087,7 @@ void *ru_thread( void *param ) { ru_thread_status = 0; // set default return value sprintf(threadname,"ru_thread %u",ru->idx); - LOG_I(PHY,"Starting RU %d (%s,%s) on core %d\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing],sched_getcpu()); + LOG_I(PHY,"Starting RU %d (%s,%s) on cpu %d\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing],sched_getcpu()); memcpy((void *)&ru->config,(void *)&RC.gNB[0]->gNB_config,sizeof(ru->config)); if(emulate_rf) { @@ -1279,9 +1283,13 @@ void *ru_thread( void *param ) { } // end if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT) { // At this point, all information for subframe has been received on FH interface +#ifndef USE_MSGQ res = pullTpool(&gNB->resp_L1, &gNB->threadPool); if (res == NULL) break; // Tpool has been stopped +#else + res=newNotifiedFIFO_elt(sizeof(processingData_L1_t),0, &gNB->resp_L1,NULL); +#endif syncMsg = (processingData_L1_t *)NotifiedFifoData(res); syncMsg->gNB = gNB; syncMsg->frame_rx = proc->frame_rx; @@ -1290,7 +1298,11 @@ void *ru_thread( void *param ) { syncMsg->slot_tx = proc->tti_tx; syncMsg->timestamp_tx = proc->timestamp_tx; res->key = proc->tti_rx; +#ifndef USE_MSGQ pushTpool(&gNB->threadPool, res); +#else + pushNotifiedFIFO(&gNB->resp_L1, res); +#endif } printf( "Exiting ru_thread \n"); @@ -1305,7 +1317,8 @@ int start_streaming(RU_t *ru) { } int nr_start_if(struct RU_t_s *ru, struct PHY_VARS_gNB_s *gNB) { - for (int i=0;inb_rx;i++) ru->openair0_cfg.rxbase[i] = ru->common.rxdata[i]; + if (ru->if_south <= REMOTE_IF5) + for (int i=0;inb_rx;i++) ru->openair0_cfg.rxbase[i] = ru->common.rxdata[i]; ru->openair0_cfg.rxsize = ru->nr_frame_parms->samples_per_subframe*10; reset_meas(&ru->ifdevice.tx_fhaul); return(ru->ifdevice.trx_start_func(&ru->ifdevice)); @@ -1342,7 +1355,7 @@ void init_RU_proc(RU_t *ru) { pthread_mutex_init( &proc->mutex_emulateRF,NULL); pthread_cond_init( &proc->cond_emulateRF, NULL); - threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "ru_thread", -1 /*ru->tpcores[0]*/, OAI_PRIORITY_RT_MAX ); + threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "ru_thread", ru->ru_thread_core, OAI_PRIORITY_RT_MAX ); if(emulate_rf) threadCreate( &proc->pthread_emulateRF, emulatedRF_thread, (void *)proc, "emulateRF", -1, OAI_PRIORITY_RT ); @@ -1668,7 +1681,7 @@ void set_function_spec_param(RU_t *ru) { case REMOTE_IF4p5: ru->do_prach = 0; ru->feprx = NULL; // DFTs - ru->feptx_prec = NULL; // Precoding operation + ru->feptx_prec = nr_feptx_prec; // Precoding operation ru->feptx_ofdm = NULL; // no OFDM mod ru->fh_south_in = fh_if4p5_south_in; // synchronous IF4p5 reception ru->fh_south_out = fh_if4p5_south_out; // synchronous IF4p5 transmission @@ -1780,23 +1793,25 @@ void init_NR_RU(char *rf_config_file) { set_function_spec_param(ru); LOG_I(PHY,"Starting ru_thread %d\n",ru_id); init_RU_proc(ru); - int threadCnt = ru->num_tpcores; - if (threadCnt < 2) LOG_E(PHY,"Number of threads for gNB should be more than 1. Allocated only %d\n",threadCnt); - else LOG_I(PHY,"RU Thread pool size %d\n",threadCnt); - char pool[80]; - int s_offset = sprintf(pool,"%d",ru->tpcores[0]); - for (int icpu=1; icputpcores[icpu]); + if (ru->if_south != REMOTE_IF4p5) { + int threadCnt = ru->num_tpcores; + if (threadCnt < 2) LOG_E(PHY,"Number of threads for gNB should be more than 1. Allocated only %d\n",threadCnt); + else LOG_I(PHY,"RU Thread pool size %d\n",threadCnt); + char pool[80]; + int s_offset = sprintf(pool,"%d",ru->tpcores[0]); + for (int icpu=1; icputpcores[icpu]); + } + LOG_I(PHY,"RU thread-pool core string %s\n",pool); + ru->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); + initTpool(pool, ru->threadPool, cpumeas(CPUMEAS_GETSTATE)); + // FEP RX result FIFO + ru->respfeprx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); + initNotifiedFIFO(ru->respfeprx); + // FEP TX result FIFO + ru->respfeptx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); + initNotifiedFIFO(ru->respfeptx); } - LOG_I(PHY,"RU thread-pool core string %s\n",pool); - ru->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); - initTpool(pool, ru->threadPool, cpumeas(CPUMEAS_GETSTATE)); - // FEP RX result FIFO - ru->respfeprx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); - initNotifiedFIFO(ru->respfeprx); - // FEP TX result FIFO - ru->respfeptx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); - initNotifiedFIFO(ru->respfeptx); } // for ru_id // sleep(1); @@ -1975,6 +1990,7 @@ static void NRRCconfig_RU(void) { RC.ru[j]->openair0_cfg.txfh_cores[0] = *(RUParamList.paramarray[j][RU_TXFH_CORE_ID].iptr); RC.ru[j]->num_tpcores = *(RUParamList.paramarray[j][RU_NUM_TP_CORES].iptr); RC.ru[j]->half_slot_parallelization = *(RUParamList.paramarray[j][RU_HALF_SLOT_PARALLELIZATION].iptr); + RC.ru[j]->ru_thread_core = *(RUParamList.paramarray[j][RU_RU_THREAD_CORE].iptr); printf("[RU %d] Setting half-slot parallelization to %d\n",j,RC.ru[j]->half_slot_parallelization); AssertFatal(RC.ru[j]->num_tpcores <= RUParamList.paramarray[j][RU_TP_CORES].numelt, "Number of TP cores should be <=16\n"); for (i=0; inum_tpcores; i++) RC.ru[j]->tpcores[i] = RUParamList.paramarray[j][RU_TP_CORES].iptr[i]; diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index 2b289b5352..d420b3ac1c 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -46,6 +46,7 @@ static softmodem_params_t softmodem_params; char *parallel_config=NULL; char *worker_config=NULL; int usrp_tx_thread = 0; +char *nfapi_str=NULL; int ldpc_offload_flag=0; uint8_t nfapi_mode=0; diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 09eaea1c92..2b430ee8fb 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -43,6 +43,7 @@ extern "C" default no pool (runs in calling thread),\n\ list of cores, comma separated (negative value is no core affinity)\n\ example: -1,3 launches two working threads one floating, the second set on core 3" +#define CONFIG_HLP_REORDER "Disable reorder thread\n" #define CONFIG_HLP_ULMAXE "set the eNodeB max ULSCH erros\n" #define CONFIG_HLP_CALUER "set UE RX calibration\n" #define CONFIG_HLP_CALUERM "" @@ -109,6 +110,7 @@ extern "C" /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ #define RF_CONFIG_FILE softmodem_params.rf_config_file #define TP_CONFIG softmodem_params.threadPoolConfig +#define CONTINUOUS_TX softmodem_params.continuous_tx #define PHY_TEST softmodem_params.phy_test #define DO_RA softmodem_params.do_ra #define SA softmodem_params.sa @@ -131,13 +133,16 @@ extern "C" #define NON_STOP softmodem_params.non_stop #define EMULATE_L1 softmodem_params.emulate_l1 #define CONTINUOUS_TX softmodem_params.continuous_tx - +#define REORDER_THREAD_DISABLE softmodem_params.reorder_thread_disable #define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat"; extern int usrp_tx_thread; +extern char *nfapi_str; + #define CMDLINE_PARAMS_DESC { \ {"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, 0},\ {"thread-pool", CONFIG_HLP_TPOOL, 0, strptr:&TP_CONFIG, defstrval:"-1,-1,-1,-1,-1,-1,-1,-1", TYPE_STRING, 0}, \ + {"reorder-thread-disable",CONFIG_HLP_REORDER, PARAMFLAG_BOOL, iptr:&REORDER_THREAD_DISABLE, defintval:0, TYPE_INT, 0}, \ {"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \ {"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, iptr:&DO_RA, defintval:0, TYPE_INT, 0}, \ {"sa", CONFIG_HLP_SA, PARAMFLAG_BOOL, iptr:&SA, defintval:0, TYPE_INT, 0}, \ @@ -166,8 +171,8 @@ extern int usrp_tx_thread; {"chest-time", CONFIG_HLP_CHESTTIME, 0, iptr:&CHEST_TIME, defintval:0, TYPE_INT, 0}, \ {"nsa", CONFIG_HLP_NSA, PARAMFLAG_BOOL, iptr:&NSA, defintval:0, TYPE_INT, 0}, \ {"node-number", NULL, 0, u16ptr:&NODE_NUMBER, defuintval:0, TYPE_UINT16, 0}, \ - {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \ - {"nfapi", CONFIG_HLP_NFAPI, 0, strptr:NULL, defstrval:"MONOLITHIC", TYPE_STRING, 0}, \ + {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defintval:0, TYPE_INT, 0}, \ + {"nfapi", CONFIG_HLP_NFAPI, 0, strptr:&nfapi_str, defstrval:"MONOLITHIC", TYPE_STRING, 0}, \ {"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \ {"emulate-l1", CONFIG_L1_EMULATOR, PARAMFLAG_BOOL, iptr:&EMULATE_L1, defintval:0, TYPE_INT, 0}, \ {"continuous-tx", CONFIG_HLP_CONTINUOUS_TX,PARAMFLAG_BOOL, iptr:&CONTINUOUS_TX, defintval:0, TYPE_INT, 0}, \ @@ -208,6 +213,7 @@ extern int usrp_tx_thread; { .s5 = { NULL } }, \ { .s5 = { NULL } }, \ { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ { .s3a = { config_checkstr_assign_integer, \ {"MONOLITHIC", "PNF", "VNF","UE_STUB_PNF","UE_STUB_OFFNET","STANDALONE_PNF"}, \ {NFAPI_MONOLITHIC, NFAPI_MODE_PNF, NFAPI_MODE_VNF,NFAPI_UE_STUB_PNF,NFAPI_UE_STUB_OFFNET,NFAPI_MODE_STANDALONE_PNF}, \ @@ -290,6 +296,7 @@ typedef struct { //THREAD_STRUCT thread_struct; char *rf_config_file; char *threadPoolConfig; + int reorder_thread_disable; int phy_test; int do_ra; int sa; diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 0ee7562346..20f59a1aa8 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -655,6 +655,8 @@ typedef struct RU_t_s { int txfh_core_id; /// number of RU interfaces int num_fd; + /// Core id of ru_thread + int ru_thread_core; /// list of cores for RU ThreadPool int tpcores[16]; /// number of cores for RU ThreadPool diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 60bf49796b..c3dd0caa0b 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -657,6 +657,8 @@ typedef struct PHY_VARS_gNB_s { int ldpc_offload_flag; + int reorder_thread_disable; + int max_ldpc_iterations; /// indicate the channel estimation technique in time domain int chest_time; @@ -739,6 +741,11 @@ typedef struct PHY_VARS_gNB_s { notifiedFIFO_t L1_tx_out; notifiedFIFO_t resp_RU_tx; tpool_t threadPool; + pthread_t L1_rx_thread; + int L1_rx_thread_core; + pthread_t L1_tx_thread; + int L1_tx_thread_core; + struct processingData_L1tx *msgDataTx; int nbDecode; void *scopeData; /// structure for analyzing high-level RT measurements diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index b9f0d8e681..4617189805 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -36,6 +36,8 @@ #include "PHY/NR_TRANSPORT/nr_dci.h" #include "nfapi/oai_integration/vendor_ext.h" +#define USE_MSGQ 1 + extern int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req); extern int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req); extern int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req); @@ -163,13 +165,20 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT) { notifiedFIFO_elt_t *res; - res = pullTpool(&gNB->L1_tx_free, &gNB->threadPool); +#ifndef USE_MSGQ + if (gNB->reorder_thread_disable) + res = pullTpool(&gNB->L1_tx_out, &gNB->threadPool); + else + res = pullTpool(&gNB->L1_tx_free, &gNB->threadPool); if (res == NULL) return; // Tpool has been stopped, nothing to process processingData_L1tx_t *msgTx = (processingData_L1tx_t *)NotifiedFifoData(res); - const time_stats_t ts = exec_time_stats_NotifiedFIFO(res); +#else + processingData_L1tx_t *msgTx = gNB->msgDataTx; //newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0, &gNB->L1_tx_out,NULL); +#endif + /*const time_stats_t ts = exec_time_stats_NotifiedFIFO(res); merge_meas(&gNB->phy_proc_tx, &ts); - +*/ msgTx->num_pdsch_slot=0; msgTx->num_dl_pdcch=0; msgTx->num_ul_pdcch=number_ul_dci_pdu; @@ -212,7 +221,14 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ for (int i=0; iul_pdcch_pdu[i] = UL_dci_req->ul_dci_pdu_list[i]; - pushNotifiedFIFO(&gNB->L1_tx_filled,res); +#ifndef USE_MSGQ + if (gNB->reorder_thread_disable) + pushNotifiedFIFO(&gNB->L1_tx_out,res); + else + pushNotifiedFIFO(&gNB->L1_tx_filled,res); +#else + //pushNotifiedFIFO(&gNB->L1_tx_out, res); +#endif } for (int i = 0; i < number_ul_tti_pdu; i++) { diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 6a1a8f7b36..f5d2cc47a6 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -390,11 +390,13 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH stop_meas(&gNB->ulsch_decoding_stats); } +#define USE_MSGQ 1 void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag, int dtx_flag) { +#ifndef USE_MSGQ pthread_mutex_lock(&gNB->UL_INFO_mutex); - +#endif NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id]; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid]; NR_gNB_SCH_STATS_t *stats=get_ulsch_stats(gNB,ulsch); @@ -507,8 +509,9 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, gNB->UL_INFO.rx_ind.number_of_pdus++; +#ifndef USE_MSGQ pthread_mutex_unlock(&gNB->UL_INFO_mutex); - +#endif } // Function to fill UL RB mask to be used for N0 measurements diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index 647ac96c18..2070e9e2a1 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -111,6 +111,7 @@ typedef enum { #define CONFIG_STRING_RU_NUM_TP_CORES "num_tp_cores" #define CONFIG_STRING_RU_NUM_INTERFACES "num_interfaces" #define CONFIG_STRING_RU_HALF_SLOT_PARALLELIZATION "half_slot_parallelization" +#define CONFIG_STRING_RU_RU_THREAD_CORE "ru_thread_core" #define HLP_RU_SF_AHEAD "LTE TX processing advance" #define HLP_RU_SL_AHEAD "NR TX processing advance" @@ -122,6 +123,7 @@ typedef enum { #define HLP_RU_NUM_TP_CORES "Number of cores for RU ThreadPool" #define HLP_RU_NUM_INTERFACES "Number of network interfaces for RU" #define HLP_RU_HALF_SLOT_PARALLELIZATION "run half slots in parallel in RU FEP" +#define HLP_RU_RU_THREAD_CORE "id of core to pin ru_thread, -1 is default" #define RU_LOCAL_IF_NAME_IDX 0 #define RU_LOCAL_ADDRESS_IDX 1 @@ -164,6 +166,7 @@ typedef enum { #define RU_NUM_TP_CORES 38 #define RU_NUM_INTERFACES 39 #define RU_HALF_SLOT_PARALLELIZATION 40 +#define RU_RU_THREAD_CORE 41 /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* RU configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -210,6 +213,7 @@ typedef enum { {CONFIG_STRING_RU_NUM_TP_CORES, HLP_RU_NUM_TP_CORES, 0, uptr:NULL, defintval:2, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_NUM_INTERFACES, HLP_RU_NUM_INTERFACES, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_HALF_SLOT_PARALLELIZATION, HLP_RU_HALF_SLOT_PARALLELIZATION, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \ + {CONFIG_STRING_RU_RU_THREAD_CORE, HLP_RU_RU_THREAD_CORE, 0, uptr:NULL, defintval:-1, TYPE_INT, 0}, \ } /*---------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/openair2/GNB_APP/L1_nr_paramdef.h b/openair2/GNB_APP/L1_nr_paramdef.h index 62f2f43926..efe378820d 100644 --- a/openair2/GNB_APP/L1_nr_paramdef.h +++ b/openair2/GNB_APP/L1_nr_paramdef.h @@ -53,6 +53,9 @@ #define CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD "pusch_dtx_threshold" #define CONFIG_STRING_L1_SRS_DTX_THRESHOLD "srs_dtx_threshold" #define CONFIG_STRING_L1_MAX_LDPC_ITERATIONS "max_ldpc_iterations" +#define CONFIG_STRING_L1_RX_THREAD_CORE "L1_rx_thread_core" +#define CONFIG_STRING_L1_TX_THREAD_CORE "L1_tx_thread_core" + /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /* L1 configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -74,6 +77,8 @@ {CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:50, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_SRS_DTX_THRESHOLD, NULL, 0, uptr:NULL, defintval:50, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_MAX_LDPC_ITERATIONS, NULL, 0, uptr:NULL, defintval:5, TYPE_UINT, 0}, \ +{CONFIG_STRING_L1_RX_THREAD_CORE, NULL, 0, uptr:NULL, defintval:-1, TYPE_UINT, 0}, \ +{CONFIG_STRING_L1_TX_THREAD_CORE, NULL, 0, uptr:NULL, defintval:-1, TYPE_UINT, 0}, \ } #define L1_CC_IDX 0 #define L1_TRANSPORT_N_PREFERENCE_IDX 1 @@ -91,6 +96,8 @@ #define L1_PUSCH_DTX_THRESHOLD 13 #define L1_SRS_DTX_THRESHOLD 14 #define L1_MAX_LDPC_ITERATIONS 15 +#define L1_RX_THREAD_CORE 16 +#define L1_TX_THREAD_CORE 17 /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ #endif diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index c1fa1d49b9..4a378033dd 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -769,6 +769,9 @@ void RCconfig_NR_L1(void) RC.gNB[j]->pusch_thres = *(L1_ParamList.paramarray[j][L1_PUSCH_DTX_THRESHOLD].uptr); RC.gNB[j]->srs_thres = *(L1_ParamList.paramarray[j][L1_SRS_DTX_THRESHOLD].uptr); RC.gNB[j]->max_ldpc_iterations = *(L1_ParamList.paramarray[j][L1_MAX_LDPC_ITERATIONS].uptr); + RC.gNB[j]->L1_rx_thread_core = *(L1_ParamList.paramarray[j][L1_RX_THREAD_CORE].iptr); + RC.gNB[j]->L1_tx_thread_core = *(L1_ParamList.paramarray[j][L1_TX_THREAD_CORE].iptr); + LOG_I(PHY,"L1_RX_THREAD_CORE %d (%d)\n",*(L1_ParamList.paramarray[j][L1_RX_THREAD_CORE].iptr),L1_RX_THREAD_CORE); if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) { // sf_ahead = 2; // Need 4 subframe gap between RX and TX } else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) { From e4b3757e1e616d841c6f4d42489fa73713759a18 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Wed, 8 Mar 2023 21:43:44 +0100 Subject: [PATCH 03/13] comment L1_tx_thread for now --- executables/nr-gnb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index e797b685df..105465df02 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -153,7 +153,7 @@ void *L1_rx_thread(void *arg) { } return NULL; } - +/* to be added for URLLC, requires MAC scheduling to be split from UL indication void *L1_tx_thread(void *arg) { PHY_VARS_gNB *gNB = (PHY_VARS_gNB*)arg; @@ -165,6 +165,7 @@ void *L1_tx_thread(void *arg) { } return NULL; } +*/ void rx_func(void *param) { processingData_L1_t *info = (processingData_L1_t *) param; PHY_VARS_gNB *gNB = info->gNB; From 2b143370ee7905e78050ed80cc26314233dc9379 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Sun, 12 Mar 2023 22:51:09 +0100 Subject: [PATCH 04/13] small changes in eth_udp.c for AW2S --- common/utils/system.c | 4 +++- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 2 +- radio/ETHERNET/USERSPACE/LIB/eth_udp.c | 26 ++++++++++++++++---------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/common/utils/system.c b/common/utils/system.c index 9d52639b2f..5b30b84f53 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -231,7 +231,9 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int settingPriority = 1; ret=pthread_attr_init(&attr); AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); - + + LOG_I(UTIL,"Creating thread %s with affinity %d and priority %d\n",name,affinity,priority); + if (checkIfFedoraDistribution()) if (checkIfGenericKernelOnFedora()) if (checkIfInsideContainer()) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 9b6adb8702..b98263bbf7 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -466,7 +466,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, for (int rb=0; rbrbSize; rb++) { //get pmi info uint8_t pmi; - if (rel15->precodingAndBeamforming.prg_size > 0) + if (0 /*rel15->precodingAndBeamforming.prg_size > 0*/) pmi = rel15->precodingAndBeamforming.prgs_list[(int)rb/rel15->precodingAndBeamforming.prg_size].pm_idx; else pmi = 0;//no precoding diff --git a/radio/ETHERNET/USERSPACE/LIB/eth_udp.c b/radio/ETHERNET/USERSPACE/LIB/eth_udp.c index 31971f1d1a..0d46d793ba 100644 --- a/radio/ETHERNET/USERSPACE/LIB/eth_udp.c +++ b/radio/ETHERNET/USERSPACE/LIB/eth_udp.c @@ -314,9 +314,15 @@ void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem) { uint64_t last_rxTS = fhstate->TS[0]-fhstate->TS0; uint64_t TS_advance=0; if (timestamp > last_rxTS) TS_advance = timestamp - last_rxTS; - - if (TS_advance < (nsamps/2)) LOG_W(PHY,"Starting TX FH for TS %llu absslot %llu(%llu) last_rxTS %llu TS_advance %llu samples\n",(unsigned long long)timestamp,(unsigned long long)timestamp/nsamps,((unsigned long long)timestamp/nsamps)%20,(unsigned long long)last_rxTS,(unsigned long long)TS_advance); - void *buff2; + else { + LOG_W(PHY,"TS_advance is < 0 TS %llu absslot %llu(%llu) last_rxTS %llu TS_advance %llu samples\n", (unsigned long long)timestamp,(unsigned long long)timestamp/nsamps,((unsigned long long)timestamp/nsamps)%20,(unsigned long long)last_rxTS,(unsigned long long)TS_advance); + free(buff); + return(NULL); + } + if (TS_advance < (nsamps/2)) { + LOG_W(PHY,"Starting TX FH for TS %llu absslot %llu(%llu) last_rxTS %llu TS_advance %llu samples\n",(unsigned long long)timestamp,(unsigned long long)timestamp/nsamps,((unsigned long long)timestamp/nsamps)%20,(unsigned long long)last_rxTS,(unsigned long long)TS_advance); + } + void *buff2; #if defined(__x86_64) || defined(__i386__) int nsamps2 = 256>>3; __m256i buff_tx[nsamps2+1]; @@ -445,7 +451,7 @@ void *udp_read_thread(void *arg) { char buffer[UDP_PACKET_SIZE_BYTES(256)]; int first_read=0; while (oai_exit == 0) { - LOG_I(PHY,"UDP read thread %d, waiting for start sampling_rate_d %d, sampling_rate_n %d\n",u->thread_id,device->sampling_rate_ratio_n,device->sampling_rate_ratio_d); + LOG_I(PHY,"UDP read thread %d on core %d, waiting for start sampling_rate_d %d, sampling_rate_n %d\n",u->thread_id,sched_getcpu(),device->sampling_rate_ratio_n,device->sampling_rate_ratio_d); while (fhstate->active > 0) { ssize_t count = recvfrom(((eth_state_t*)device->priv)->sockfdd[0], buffer,sizeof(buffer),0, @@ -500,23 +506,23 @@ void *udp_read_thread(void *arg) { int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, uint32_t **buff, int nsamps) { fhstate_t *fhstate = &device->fhstate; - openair0_timestamp prev_read_TS= fhstate->TS_read, min_TS; + openair0_timestamp prev_read_TS= fhstate->TS_read; + volatile openair0_timestamp min_TS; // block until FH is ready while (fhstate->r[0] == 0 || fhstate->r[1] == 0 || fhstate->r[2] == 0 || fhstate->r[3] == 0 || fhstate->r[4] == 0 || fhstate->r[5] == 0 || fhstate->r[6] == 0 || fhstate->r[7] == 0) usleep(100); // get minimum TS over all antennas - min_TS = fhstate->TS[0]; + min_TS = (volatile openair0_timestamp)fhstate->TS[0]; for (int i=1;iopenair0_cfg->rx_num_channels;i++) min_TS = min(min_TS,fhstate->TS[i]); // poll/sleep until we accumulated enough samples on each antenna port int count=0; while (fhstate->first_read == 1 && min_TS < (fhstate->TS0+prev_read_TS + nsamps)) { - usleep(50); - min_TS = fhstate->TS[0]; - for (int i=1;iopenair0_cfg->rx_num_channels;i++) min_TS = min(min_TS,fhstate->TS[i]); + usleep(10); + min_TS = (volatile openair0_timestamp)fhstate->TS[0]; + for (int i=1;iopenair0_cfg->rx_num_channels;i++) min_TS = min(min_TS,(volatile openair0_timestamp)fhstate->TS[i]); count++; } - if (fhstate->first_read == 0) { *timestamp = 0; fhstate->TS_read = *timestamp+nsamps; From 80d84d3271b272e1632315fa7eaea0c3e1e8373e Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Mon, 27 Mar 2023 16:15:47 +0200 Subject: [PATCH 05/13] compilation after merge conflicts --- executables/softmodem-common.h | 2 +- openair2/ENB_APP/enb_paramdef.h | 2 +- openair2/GNB_APP/L1_nr_paramdef.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 3044acf851..2499a31ac1 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -141,7 +141,7 @@ extern int usrp_tx_thread; #define CMDLINE_PARAMS_DESC { \ {"rf-config-file", CONFIG_HLP_RFCFGF, 0, .strptr=&RF_CONFIG_FILE, .defstrval=NULL, TYPE_STRING, 0}, \ {"thread-pool", CONFIG_HLP_TPOOL, 0, .strptr=&TP_CONFIG, .defstrval="-1,-1,-1,-1,-1,-1,-1,-1", TYPE_STRING, 0}, \ - {"reorder-thread-disable",CONFIG_HLP_REORDER, PARAMFLAG_BOOL, .iptr:&REORDER_THREAD_DISABLE, .defintval:0, TYPE_INT, 0}, \ + {"reorder-thread-disable",CONFIG_HLP_REORDER, PARAMFLAG_BOOL, .iptr=&REORDER_THREAD_DISABLE, .defintval=0, TYPE_INT, 0}, \ {"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, .iptr=&PHY_TEST, .defintval=0, TYPE_INT, 0}, \ {"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, .iptr=&DO_RA, .defintval=0, TYPE_INT, 0}, \ {"sa", CONFIG_HLP_SA, PARAMFLAG_BOOL, .iptr=&SA, .defintval=0, TYPE_INT, 0}, \ diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index 2f6bf04f58..e37c5388d0 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -214,7 +214,7 @@ typedef enum { {CONFIG_STRING_RU_NUM_TP_CORES, HLP_RU_NUM_TP_CORES, 0, .uptr=NULL, .defintval=2, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_NUM_INTERFACES, HLP_RU_NUM_INTERFACES, 0, .uptr=NULL, .defintval=1, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_HALF_SLOT_PARALLELIZATION, HLP_RU_HALF_SLOT_PARALLELIZATION, 0, .uptr=NULL, .defintval=1, TYPE_UINT, 0}, \ - {CONFIG_STRING_RU_RU_THREAD_CORE, HLP_RU_RU_THREAD_CORE, 0, .uptr:NULL, .defintval:-1, TYPE_UINT, 0}, \ + {CONFIG_STRING_RU_RU_THREAD_CORE, HLP_RU_RU_THREAD_CORE, 0, .uptr=NULL, .defintval=-1, TYPE_UINT, 0}, \ } // clang-format on diff --git a/openair2/GNB_APP/L1_nr_paramdef.h b/openair2/GNB_APP/L1_nr_paramdef.h index dec87bf985..8c4381d8bd 100644 --- a/openair2/GNB_APP/L1_nr_paramdef.h +++ b/openair2/GNB_APP/L1_nr_paramdef.h @@ -78,8 +78,8 @@ {CONFIG_STRING_L1_PUSCH_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=50, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_SRS_DTX_THRESHOLD, NULL, 0, .uptr=NULL, .defintval=50, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_MAX_LDPC_ITERATIONS, NULL, 0, .uptr=NULL, .defintval=5, TYPE_UINT, 0}, \ - {CONFIG_STRING_L1_RX_THREAD_CORE, NULL, 0, .uptr:NULL, .defintval:-1, TYPE_UINT, 0}, \ - {CONFIG_STRING_L1_TX_THREAD_CORE, NULL, 0, .uptr:NULL, .defintval:-1, TYPE_UINT, 0}, \ + {CONFIG_STRING_L1_RX_THREAD_CORE, NULL, 0, .uptr=NULL, .defintval=-1, TYPE_UINT, 0}, \ + {CONFIG_STRING_L1_TX_THREAD_CORE, NULL, 0, .uptr=NULL, .defintval=-1, TYPE_UINT, 0}, \ } // clang-format on #define L1_CC_IDX 0 From 2a6b18863504393340362c92718971604ce169c1 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Thu, 27 Apr 2023 15:17:07 +0200 Subject: [PATCH 06/13] removed temporary "USE_MSGQ" definition. Now, with reorder_thread_disable we use the native message queue and L1_rx_thread instead of the thread-pool for the main L1 thread. There is a single TX thread (no slot parallelization) --- executables/nr-gnb.c | 59 +++++++++++------------ executables/nr-ru.c | 24 +++++---- openair1/SCHED_NR/fapi_nr_l1.c | 27 ++++------- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 11 ++--- 4 files changed, 52 insertions(+), 69 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index d2cd85be59..7161125f89 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -88,7 +88,6 @@ #include #include -#define USE_MSGQ 1 //#define USRP_DEBUG 1 // Fix per CC openair rf/if device update // extern openair0_device openair0; @@ -264,24 +263,22 @@ void rx_func(void *param) processingData_L1tx_t *syncMsg; // Its a FIFO so it maitains the order in which the MAC fills the messages // so no need for checking for right slot - #ifndef USE_MSGQ - if (get_softmodem_params()->reorder_thread_disable) - res = pullTpool(&gNB->L1_tx_out, &gNB->threadPool); - else + if (get_softmodem_params()->reorder_thread_disable) { + // call the TX function directly from this thread + syncMsg = gNB->msgDataTx; + syncMsg->gNB = gNB; + syncMsg->timestamp_tx = info->timestamp_tx; + tx_func(syncMsg); + } else { res = pullTpool(&gNB->L1_tx_filled, &gNB->threadPool); - if (res == NULL) - return; // Tpool has been stopped - syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res); - syncMsg->gNB = gNB; - syncMsg->timestamp_tx = info->timestamp_tx; - res->key = slot_tx; - pushTpool(&gNB->threadPool, res); -#else - syncMsg = gNB->msgDataTx; - syncMsg->gNB = gNB; - syncMsg->timestamp_tx = info->timestamp_tx; - tx_func(syncMsg); -#endif + if (res == NULL) + return; // Tpool has been stopped + syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res); + syncMsg->gNB = gNB; + syncMsg->timestamp_tx = info->timestamp_tx; + res->key = slot_tx; + pushTpool(&gNB->threadPool, res); + } } else if (get_softmodem_params()->continuous_tx) { notifiedFIFO_elt_t *res = pullTpool(&gNB->L1_tx_free, &gNB->threadPool); if (res == NULL) @@ -476,32 +473,30 @@ void init_gNB_Tpool(int inst) { // L1 RX result FIFO initNotifiedFIFO(&gNB->resp_L1); -#ifndef USE_MSGQ - notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_L1_t), 0, &gNB->resp_L1, rx_func); - pushNotifiedFIFO(&gNB->resp_L1, msg); // to unblock the process in the beginning -#endif + if (!get_softmodem_params()->reorder_thread_disable) { + notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_L1_t), 0, &gNB->resp_L1, rx_func); + pushNotifiedFIFO(&gNB->resp_L1, msg); // to unblock the process in the beginning + } // L1 TX result FIFO initNotifiedFIFO(&gNB->L1_tx_free); initNotifiedFIFO(&gNB->L1_tx_filled); initNotifiedFIFO(&gNB->L1_tx_out); -#ifdef USE_MSGQ - threadCreate(&gNB->L1_rx_thread, L1_rx_thread, (void *)gNB, "L1_rx_thread", - gNB->L1_rx_thread_core, OAI_PRIORITY_RT_MAX); -// threadCreate(&gNB->L1_tx_thread, L1_tx_thread, (void *)gNB, "L1_tx_thread", -// gNB->L1_tx_thread_core, OAI_PRIORITY_RT_MAX); -#endif if (get_softmodem_params()->reorder_thread_disable) { + // create the RX thread responsible for triggering RX processing and then TX processing if a single thread is used + threadCreate(&gNB->L1_rx_thread, L1_rx_thread, (void *)gNB, "L1_rx_thread", + gNB->L1_rx_thread_core, OAI_PRIORITY_RT_MAX); + // if separate threads are used for RX and TX, create the TX thread + // threadCreate(&gNB->L1_tx_thread, L1_tx_thread, (void *)gNB, "L1_tx_thread", + // gNB->L1_tx_thread_core, OAI_PRIORITY_RT_MAX); + notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t), 0, &gNB->L1_tx_out, tx_func); processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx); memset(msgDataTx, 0, sizeof(processingData_L1tx_t)); init_DLSCH_struct(gNB, msgDataTx); memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t)); -#ifndef USE_MSGQ - pushNotifiedFIFO(&gNB->L1_tx_out, msgL1Tx); // to unblock the process in the beginning -#else + // this will be removed when the msgDataTx is not necessary anymore gNB->msgDataTx = msgDataTx; -#endif } else { // we create 2 threads for L1 tx processing for (int i=0; i < 2; i++) { diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 4017c8e9ac..01a5e7fea8 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -60,7 +60,6 @@ unsigned short config_frames[4] = {2,9,11,13}; #endif -#define USE_MSGQ 1 /* these variables have to be defined before including ENB_APP/enb_paramdef.h and GNB_APP/gnb_paramdef.h */ static int DEFBANDS[] = {7}; @@ -1285,13 +1284,13 @@ void *ru_thread( void *param ) { } // end if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT) { // At this point, all information for subframe has been received on FH interface -#ifndef USE_MSGQ - res = pullTpool(&gNB->resp_L1, &gNB->threadPool); - if (res == NULL) - break; // Tpool has been stopped -#else - res=newNotifiedFIFO_elt(sizeof(processingData_L1_t),0, &gNB->resp_L1,NULL); -#endif + if (!get_softmodem_params()->reorder_thread_disable) { + res = pullTpool(&gNB->resp_L1, &gNB->threadPool); + if (res == NULL) + break; // Tpool has been stopped + } else { + res=newNotifiedFIFO_elt(sizeof(processingData_L1_t),0, &gNB->resp_L1,NULL); + } syncMsg = (processingData_L1_t *)NotifiedFifoData(res); syncMsg->gNB = gNB; syncMsg->frame_rx = proc->frame_rx; @@ -1300,11 +1299,10 @@ void *ru_thread( void *param ) { syncMsg->slot_tx = proc->tti_tx; syncMsg->timestamp_tx = proc->timestamp_tx; res->key = proc->tti_rx; -#ifndef USE_MSGQ - pushTpool(&gNB->threadPool, res); -#else - pushNotifiedFIFO(&gNB->resp_L1, res); -#endif + if (!get_softmodem_params()->reorder_thread_disable) + pushTpool(&gNB->threadPool, res); + else + pushNotifiedFIFO(&gNB->resp_L1, res); } printf( "Exiting ru_thread \n"); diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index d72eb208c3..9662780737 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -37,7 +37,6 @@ #include "nfapi/oai_integration/vendor_ext.h" #include "openair2/NR_PHY_INTERFACE/nr_sched_response.h" -#define USE_MSGQ 1 extern int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req); extern int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req); @@ -159,18 +158,16 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) if (NFAPI_MODE == NFAPI_MONOLITHIC){ if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT) { - notifiedFIFO_elt_t *res; -#ifndef USE_MSGQ - if (gNB->reorder_thread_disable) - res = pullTpool(&gNB->L1_tx_out, &gNB->threadPool); - else + notifiedFIFO_elt_t *res=NULL; + processingData_L1tx_t *msgTx=NULL; + if (!gNB->reorder_thread_disable) { res = pullTpool(&gNB->L1_tx_free, &gNB->threadPool); - if (res == NULL) - return; // Tpool has been stopped, nothing to process - processingData_L1tx_t *msgTx = (processingData_L1tx_t *)NotifiedFifoData(res); -#else - processingData_L1tx_t *msgTx = gNB->msgDataTx; //newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0, &gNB->L1_tx_out,NULL); -#endif + if (res == NULL) + return; // Tpool has been stopped, nothing to process + msgTx = (processingData_L1tx_t *)NotifiedFifoData(res); + } else { + msgTx = gNB->msgDataTx; //newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0, &gNB->L1_tx_out,NULL); + } /*const time_stats_t ts = exec_time_stats_NotifiedFIFO(res); merge_meas(&gNB->phy_proc_tx, &ts); */ @@ -225,12 +222,8 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) * released only when both threads are done with it. */ inc_ref_sched_response(Sched_INFO->sched_response_id); -#ifndef USE_MSGQ - if (gNB->reorder_thread_disable) - pushNotifiedFIFO(&gNB->L1_tx_out,res); - else + if (!gNB->reorder_thread_disable) pushNotifiedFIFO(&gNB->L1_tx_filled,res); -#endif } for (int i = 0; i < number_ul_tti_pdu; i++) { diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 566da85fb8..e24e17920b 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -395,13 +395,11 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH stop_meas(&gNB->ulsch_decoding_stats); } -#define USE_MSGQ 1 void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag, int dtx_flag) { -#ifndef USE_MSGQ - pthread_mutex_lock(&gNB->UL_INFO_mutex); -#endif + if (!get_softmodem_params()->reorder_thread_disable) + pthread_mutex_lock(&gNB->UL_INFO_mutex); NR_gNB_ULSCH_t *ulsch = &gNB->ulsch[ULSCH_id]; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_process; @@ -560,9 +558,8 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, gNB->UL_INFO.rx_ind.number_of_pdus++; -#ifndef USE_MSGQ - pthread_mutex_unlock(&gNB->UL_INFO_mutex); -#endif + if (!get_softmodem_params()->reorder_thread_disable) + pthread_mutex_unlock(&gNB->UL_INFO_mutex); } // Function to fill UL RB mask to be used for N0 measurements From c68549d861b004d5ca5726411b891f70c1c8cbd8 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Sun, 7 May 2023 15:24:51 +0200 Subject: [PATCH 07/13] modification of get_samplerate_and_bw(): add break where needed --- common/utils/nr/nr_common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 1baf99d1f2..4ffbe71ded 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -449,6 +449,7 @@ void get_samplerate_and_bw(int mu, *tx_bw = 50e6; *rx_bw = 50e6; } + break; case 216: if (threequarter_fs) { *sample_rate=46.08e6; @@ -474,6 +475,7 @@ void get_samplerate_and_bw(int mu, *tx_bw = 20e6; *rx_bw = 20e6; } + break; case 106: if (threequarter_fs) { *sample_rate=23.04e6; @@ -501,6 +503,7 @@ void get_samplerate_and_bw(int mu, *tx_bw = 10e6; *rx_bw = 10e6; } + break; case 25: if (threequarter_fs) { *sample_rate=5.76e6; From 88bcbefed4dc7f26d211f738cd8171c143562229 Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 21 Apr 2023 13:43:27 +0200 Subject: [PATCH 08/13] Clean-up of UE RRC structures --- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 4 +- openair2/RRC/NR/nr_rrc_common.c | 5 +- openair2/RRC/NR/nr_rrc_common.h | 91 +++++ openair2/RRC/NR/nr_rrc_defs.h | 90 +---- openair2/RRC/NR/nr_rrc_proto.h | 1 - openair2/RRC/NR/nr_rrc_types.h | 64 ---- openair2/RRC/NR_UE/L2_interface_ue.c | 13 +- openair2/RRC/NR_UE/rrc_UE.c | 347 ++++++-------------- openair2/RRC/NR_UE/rrc_defs.h | 159 +++++---- openair2/RRC/NR_UE/rrc_list.h | 114 ------- openair2/RRC/NR_UE/rrc_proto.h | 6 +- 11 files changed, 302 insertions(+), 592 deletions(-) create mode 100644 openair2/RRC/NR/nr_rrc_common.h delete mode 100644 openair2/RRC/NR/nr_rrc_types.h delete mode 100644 openair2/RRC/NR_UE/rrc_list.h diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 086d80e477..49eb8416f1 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 #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 c6f27c7325..d8e2abb734 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 0000000000..531332c0ec --- /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 +#include +#include + +#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 9887d89367..1b00c93b9d 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 ee236e1408..8cfc1e9132 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 61f90e3572..0000000000 --- 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 56de3dfa68..b83c791291 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 #include "nr_nas_msg_sim.h" -#include 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; ispCellConfig->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; ispCellConfig->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; ispCellConfig->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 8dbe9159cf..ff5754396e 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -38,9 +38,8 @@ #include #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 20a0adad56..0000000000 --- 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; iteratorid_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 83f6773da7..30919d88d2 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); From 1c4ab73deb721d7026187fa3cdd9a41e074d936c Mon Sep 17 00:00:00 2001 From: francescomani Date: Sun, 7 May 2023 10:24:48 +0200 Subject: [PATCH 09/13] harmonizing RRC physicalCellGroupConfig --- openair2/RRC/NR/nr_rrc_config.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 6626fc2240..3e572c378e 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -2015,10 +2015,18 @@ int encode_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1, uint8_t *buffer, int max_buff return (enc_rval.encoded + 7) / 8; } +static NR_PhysicalCellGroupConfig_t *configure_phy_cellgroup(void) +{ + NR_PhysicalCellGroupConfig_t *physicalCellGroupConfig = calloc(1, sizeof(*physicalCellGroupConfig)); + AssertFatal(physicalCellGroupConfig != NULL, "Couldn't allocate physicalCellGroupConfig. Out of memory!\n"); + physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook = NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic; + return physicalCellGroupConfig; +} + static NR_MAC_CellGroupConfig_t *configure_mac_cellgroup(void) { NR_MAC_CellGroupConfig_t * mac_CellGroupConfig = calloc(1, sizeof(*mac_CellGroupConfig)); - + AssertFatal(mac_CellGroupConfig != NULL, "Couldn't allocate mac-CellGroupConfig. Out of memory!\n"); mac_CellGroupConfig->bsr_Config = calloc(1, sizeof(*mac_CellGroupConfig->bsr_Config)); mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf10; mac_CellGroupConfig->bsr_Config->retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf80; @@ -2313,11 +2321,8 @@ NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, /* mac CellGroup Config */ cellGroupConfig->mac_CellGroupConfig = configure_mac_cellgroup(); - - NR_PhysicalCellGroupConfig_t *physicalCellGroupConfig = calloc(1, sizeof(*physicalCellGroupConfig)); - physicalCellGroupConfig->p_NR_FR1 = NULL; - physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook = NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic; - cellGroupConfig->physicalCellGroupConfig = physicalCellGroupConfig; + + cellGroupConfig->physicalCellGroupConfig = configure_phy_cellgroup(); cellGroupConfig->spCellConfig = get_initial_SpCellConfig(uid, scc, servingcellconfigdedicated, configuration); @@ -2534,19 +2539,7 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC asn1cSeqAdd(&secondaryCellGroup->rlc_BearerToAddModList->list, RLC_BearerConfig); secondaryCellGroup->mac_CellGroupConfig = configure_mac_cellgroup(); - - secondaryCellGroup->physicalCellGroupConfig = calloc(1, sizeof(*secondaryCellGroup->physicalCellGroupConfig)); - secondaryCellGroup->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH = NULL; - secondaryCellGroup->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUSCH = NULL; - secondaryCellGroup->physicalCellGroupConfig->p_NR_FR1 = NULL; - secondaryCellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook = - NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic; - secondaryCellGroup->physicalCellGroupConfig->tpc_SRS_RNTI = NULL; - secondaryCellGroup->physicalCellGroupConfig->tpc_PUCCH_RNTI = NULL; - secondaryCellGroup->physicalCellGroupConfig->tpc_PUSCH_RNTI = NULL; - secondaryCellGroup->physicalCellGroupConfig->sp_CSI_RNTI = NULL; - secondaryCellGroup->physicalCellGroupConfig->cs_RNTI = NULL; - secondaryCellGroup->physicalCellGroupConfig->ext1 = NULL; + secondaryCellGroup->physicalCellGroupConfig = configure_phy_cellgroup(); secondaryCellGroup->spCellConfig = calloc(1, sizeof(*secondaryCellGroup->spCellConfig)); secondaryCellGroup->spCellConfig->servCellIndex = calloc(1, sizeof(*secondaryCellGroup->spCellConfig->servCellIndex)); *secondaryCellGroup->spCellConfig->servCellIndex = servCellIndex; From f4845eb5a02652a179e1c1ace128120941016ea4 Mon Sep 17 00:00:00 2001 From: Angelo Athanassopoulos Date: Wed, 10 May 2023 16:29:11 +0200 Subject: [PATCH 10/13] ASN1 - MCG Config Fill the right DRBs for Master Cell Group Config and drop the bearer_id_start, nb_bearers_to_setup --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 22 +++++++++++++++------- openair2/RRC/NR/MESSAGES/asn1_msg.h | 18 ++++++++++++++---- openair2/RRC/NR/rrc_gNB.c | 21 ++++++++++++++------- 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 01ba86bc98..51cf52bc63 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -472,8 +472,13 @@ void free_nr_noS1_bearer_config(NR_RadioBearerConfig_t **rbconfig, *rlc_rbconfig = NULL; } -void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup, int use_rlc_um_for_drb, uint8_t configure_srb, uint8_t bearer_id_start, uint8_t nb_bearers_to_setup, long *priority) { - +void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, + NR_CellGroupConfig_t *ue_context_mastercellGroup, + int use_rlc_um_for_drb, + uint8_t configure_srb, + NR_DRB_ToAddModList_t *drb_configList, + long *priority) +{ cellGroupConfig->cellGroupId = 0; cellGroupConfig->rlc_BearerToReleaseList = NULL; cellGroupConfig->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList)); @@ -487,11 +492,14 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr } // DRB Configuration - for (int i = bearer_id_start; i < bearer_id_start + nb_bearers_to_setup; i++ ){ - const NR_RLC_Config_PR rlc_conf = use_rlc_um_for_drb ? NR_RLC_Config_PR_um_Bi_Directional : NR_RLC_Config_PR_am; - NR_RLC_BearerConfig_t *rlc_BearerConfig = get_DRB_RLC_BearerConfig(3 + i, i, rlc_conf, priority[i - 1]); - asn1cSeqAdd(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); - asn1cSeqAdd(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig); + if (drb_configList != NULL) { + for (int i = 0; i < drb_configList->list.count; ++i) { + const NR_RLC_Config_PR rlc_conf = use_rlc_um_for_drb ? NR_RLC_Config_PR_um_Bi_Directional : NR_RLC_Config_PR_am; + int rb_id = drb_configList->list.array[i]->drb_Identity; + NR_RLC_BearerConfig_t *rlc_BearerConfig = get_DRB_RLC_BearerConfig(3 + rb_id, rb_id, rlc_conf, priority[rb_id - 1]); + asn1cSeqAdd(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); + asn1cSeqAdd(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig); + } } } diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index 293758c37f..00d4829a92 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -79,14 +79,24 @@ void fill_nr_noS1_bearer_config(NR_RadioBearerConfig_t **rbconfig, NR_RLC_BearerConfig_t **rlc_rbconfig); void free_nr_noS1_bearer_config(NR_RadioBearerConfig_t **rbconfig, NR_RLC_BearerConfig_t **rlc_rbconfig); - - +/** + * @brief Function to fill out the master cell group config to be used in RRCReconfiguration. + * If it is misused the ue_context_mastercellGroup, might lead to ASN1 encoding failure, + * because in ue_context_mastercellGroup the rlc_BearerConfigs are added but never removed, + * so the maximum number of rlc_BearerConfigs is exceeded. + * + * @param cellGroupConfig The MCG that will be used in do_RRCReconfiguration. + * @param ue_context_mastercellGroup The MCG that is stored in the ue context. + * @param[in] use_rlc_um_for_drb Set to 1, if RLC uses 'Unacknowledged Mode' for the DRB. + * @param[in] configure_srb Set to 1, if SRB2 needs be added to MCG. + * @param[in] drb_configList The Data Radio Bearer list, to be added. + * @param[in] priority The priorities set for the Data Radio Bearers. + */ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup, int use_rlc_um_for_drb, uint8_t configure_srb, - uint8_t bearer_id_start, - uint8_t nb_bearers_to_setup, + NR_DRB_ToAddModList_t *drb_configList, long *priority); int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 9c7a58c081..d484834079 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -707,9 +707,13 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( if(cell_groupConfig_from_DU == NULL){ cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); - // FIXME: fill_mastercellGroupConfig() won't fill the right priorities or - // bearer IDs for the DRBs - fill_mastercellGroupConfig(cellGroupConfig, ue_p->masterCellGroup, rrc->um_on_default_drb, (drb_id_to_setup_start < 2) ? 1 : 0, drb_id_to_setup_start, nb_drb_to_setup, drb_priority); + // FIXME: fill_mastercellGroupConfig() won't fill the right priorities + fill_mastercellGroupConfig(cellGroupConfig, + ue_p->masterCellGroup, + rrc->um_on_default_drb, + (drb_id_to_setup_start < 2) ? 1 : 0, + DRB_configList, + drb_priority); } else{ LOG_I(NR_RRC, "Master cell group originating from the DU \n"); @@ -1487,7 +1491,6 @@ void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *const ctx cellGroupConfig->physicalCellGroupConfig = ue_p->masterCellGroup->physicalCellGroupConfig; uint8_t drb_id_to_setup_start = ue_p->DRB_configList ? ue_p->DRB_configList->list.array[0]->drb_Identity : 1; - uint8_t nb_drb_to_setup = ue_p->DRB_configList ? ue_p->DRB_configList->list.count : ue_p->nb_of_pdusessions; /* TODO: hardcoded to 13 for the time being, to be changed? */ long drb_priority[NGAP_MAX_DRBS_PER_UE] = {13}; @@ -1495,8 +1498,7 @@ void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *const ctx ue_p->masterCellGroup, rrc->um_on_default_drb, (drb_id_to_setup_start < 2) ? 1 : 0, - drb_id_to_setup_start, - nb_drb_to_setup, + ue_p->DRB_configList2[new_xid], drb_priority); for (i = 0; i < cellGroupConfig->rlc_BearerToAddModList->list.count; i++) { @@ -2481,7 +2483,12 @@ static void rrc_DU_process_ue_context_modification_request(MessageDef *msg_p, in if(req->srbs_to_be_setup_length>0 || req->drbs_to_be_setup_length>0){ cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); - fill_mastercellGroupConfig(cellGroupConfig, UE->masterCellGroup, rrc->um_on_default_drb, drb_id_to_setup_start < 2 ? 1 : 0, drb_id_to_setup_start, req->drbs_to_be_setup_length, drb_priority); + fill_mastercellGroupConfig(cellGroupConfig, + UE->masterCellGroup, + rrc->um_on_default_drb, + drb_id_to_setup_start < 2 ? 1 : 0, + DRB_configList, + drb_priority); apply_macrlc_config(rrc, ue_context_p, &ctxt); } if(req->ReconfigComplOutcome == RRCreconf_failure){ From c526ceff5a2123cc2851b81a1a61050912507959 Mon Sep 17 00:00:00 2001 From: Angelo Athanassopoulos Date: Wed, 10 May 2023 16:47:43 +0200 Subject: [PATCH 11/13] NR RRC - RRC Reestablishment - Enhancements 1. Avoid using fill_masterCellGroup() function, during reestablishment. 2. Send the existing CellGroupConfig, instead of calling fill_masterCellGroup(). --- openair2/RRC/NR/rrc_gNB.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index d484834079..7941d1642b 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1489,17 +1489,15 @@ void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *const ctx cellGroupConfig->spCellConfig = ue_p->masterCellGroup->spCellConfig; cellGroupConfig->mac_CellGroupConfig = ue_p->masterCellGroup->mac_CellGroupConfig; cellGroupConfig->physicalCellGroupConfig = ue_p->masterCellGroup->physicalCellGroupConfig; + cellGroupConfig->rlc_BearerToReleaseList = NULL; + cellGroupConfig->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList)); - uint8_t drb_id_to_setup_start = ue_p->DRB_configList ? ue_p->DRB_configList->list.array[0]->drb_Identity : 1; - /* TODO: hardcoded to 13 for the time being, to be changed? */ - long drb_priority[NGAP_MAX_DRBS_PER_UE] = {13}; - - fill_mastercellGroupConfig(cellGroupConfig, - ue_p->masterCellGroup, - rrc->um_on_default_drb, - (drb_id_to_setup_start < 2) ? 1 : 0, - ue_p->DRB_configList2[new_xid], - drb_priority); + /* + * Get SRB2, DRB configuration from the existing UE context, + * also start from SRB2 (i=1) and not from SRB1 (i=0). + */ + for (i = 1; i < ue_p->masterCellGroup->rlc_BearerToAddModList->list.count; ++i) + asn1cSeqAdd(&cellGroupConfig->rlc_BearerToAddModList->list, ue_p->masterCellGroup->rlc_BearerToAddModList->list.array[i]); for (i = 0; i < cellGroupConfig->rlc_BearerToAddModList->list.count; i++) { cellGroupConfig->rlc_BearerToAddModList->list.array[i]->reestablishRLC = From 4e7f34cbae1918e3a3476e05fab5e69e079b2460 Mon Sep 17 00:00:00 2001 From: Roberto Louro Magueta Date: Wed, 10 May 2023 19:50:44 +0100 Subject: [PATCH 12/13] Fix segmentation fault in ue_context_setup_request() --- openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index 4fdad6fb81..e9a01d98f7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -103,7 +103,7 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req) NR_SCHED_LOCK(&mac->sched_lock); NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[0]->UE_info, req->rnti); - AssertFatal(UE != NULL, "did not find UE with RNTI %04x, but UE Context Setup Failed not implemented\n", UE->rnti); + AssertFatal(UE != NULL, "did not find UE with RNTI %04x, but UE Context Setup Failed not implemented\n", req->rnti); if (req->srbs_to_be_setup_length > 0) handle_ue_context_srbs_setup(req, &resp, UE->CellGroup); From 0ebac22cf8bd71004193d18d7038f8bf0e4d2b78 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 11 May 2023 14:43:03 +0200 Subject: [PATCH 13/13] chore(ci): PDU session type should support IPV4V6 for IMS DNN Signed-off-by: Raphael Defosseux --- openair2/RRC/NR/rrc_gNB_NGAP.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 102fb56091..d4409c94cb 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -320,7 +320,7 @@ static int decodePDUSessionResourceSetup(pdusession_t *session) /* mandatory PDUSessionType */ case NGAP_ProtocolIE_ID_id_PDUSessionType: session->pdu_session_type = (uint8_t)pdusessionTransfer_ies->value.choice.PDUSessionType; - AssertFatal(session->pdu_session_type == PDUSessionType_ipv4, "To be developped: support not IPv4 sessions\n"); + AssertFatal(session->pdu_session_type == PDUSessionType_ipv4 || session->pdu_session_type == PDUSessionType_ipv4v6, "To be developped: support not IPv4 sessions\n"); break; /* optional SecurityIndication */ @@ -682,7 +682,7 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP( tmp->pdusession_id = session->param.pdusession_id; tmp->nb_of_qos_flow = session->param.nb_qos; tmp->gtp_teid = session->param.gNB_teid_N3; - tmp->pdu_session_type = session->param.pdu_session_type; // FixMe: IPv4 hardcoded here + tmp->pdu_session_type = session->param.pdu_session_type; tmp->gNB_addr.length = session->param.gNB_addr_N3.length; memcpy(tmp->gNB_addr.buffer, session->param.gNB_addr_N3.buffer, tmp->gNB_addr.length); for (int qos_flow_index = 0; qos_flow_index < tmp->nb_of_qos_flow; qos_flow_index++) {