diff --git a/executables/lte-ru.c b/executables/lte-ru.c index 2cee48ffbc..54747a9578 100644 --- a/executables/lte-ru.c +++ b/executables/lte-ru.c @@ -93,12 +93,6 @@ void stop_RU(RU_t **rup,int nb_ru); static void do_ru_synch(RU_t *ru); -void configure_ru(int idx, - void *arg); - -void configure_rru(int idx, - void *arg); - void reset_proc(RU_t *ru); int connect_rau(RU_t *ru); @@ -2183,8 +2177,6 @@ int stop_rf(RU_t *ru) { return 0; } - -extern void configure_ru(int idx, void *arg); extern void fep_full(RU_t *ru, int subframe); extern void feptx_ofdm(RU_t *ru, int frame_tx, int tti_tx); extern void feptx_ofdm_2thread(RU_t *ru, int frame_tx, int tti_tx); diff --git a/executables/lte-softmodem.h b/executables/lte-softmodem.h index 058018001b..643c8c6572 100644 --- a/executables/lte-softmodem.h +++ b/executables/lte-softmodem.h @@ -189,8 +189,6 @@ void kill_feptx_thread(RU_t *ru); void init_fep_thread(RU_t *ru, pthread_attr_t *attr_fep); void init_feptx_thread(RU_t *ru, pthread_attr_t *attr_feptx); void fep_full(RU_t *ru, int subframe); -void configure_ru(int, void *arg); -void configure_rru(int, void *arg); void ru_fep_full_2thread(RU_t *ru,int subframe); void feptx_ofdm(RU_t*ru, int frame_tx, int tti_tx); void feptx_prec(struct RU_t_s *ru, int frame_tx, int tti_tx); diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 9df218fe1b..38315bd578 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -106,11 +106,10 @@ time_stats_t softmodem_stats_rx_sf; // total rx time //#define TICK_TO_US(ts) (ts.diff) #define TICK_TO_US(ts) (ts.trials==0?0:ts.diff/ts.trials) #define L1STATSSTRLEN 16384 +static void rx_func(processingData_L1_t *param); -static void tx_func(void *param) +static void tx_func(processingData_L1tx_t *info) { - processingData_L1tx_t *info = (processingData_L1tx_t *) param; - int frame_tx = info->frame; int slot_tx = info->slot; int frame_rx = info->frame_rx; @@ -176,7 +175,6 @@ static void tx_func(void *param) deref_sched_response(info->sched_response_id); } - void *L1_rx_thread(void *arg) { PHY_VARS_gNB *gNB = (PHY_VARS_gNB*)arg; @@ -206,9 +204,8 @@ void *L1_tx_thread(void *arg) { return NULL; } -void rx_func(void *param) +static void rx_func(processingData_L1_t *info) { - processingData_L1_t *info = (processingData_L1_t *) param; PHY_VARS_gNB *gNB = info->gNB; int frame_rx = info->frame_rx; int slot_rx = info->slot_rx; @@ -387,7 +384,7 @@ void init_gNB_Tpool(int inst) { // create the TX thread responsible for TX processing start event (L1_tx_out msg queue), then launch tx_func() 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); + notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t), 0, &gNB->L1_tx_out, NULL); processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx); memset(msgDataTx, 0, sizeof(processingData_L1tx_t)); init_DLSCH_struct(gNB, msgDataTx); diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 41adc59bf6..dbb0c30a95 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -53,14 +53,6 @@ #include "common/utils/LOG/vcd_signal_dumper.h" #include - -#ifdef SMBV -#include "PHY/TOOLS/smbv.h" -unsigned short config_frames[4] = {2,9,11,13}; -#endif - - - /* 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}; @@ -81,35 +73,14 @@ static int DEFRUTPCORES[] = {-1,-1,-1,-1}; #include "T.h" #include "nfapi_interface.h" #include - -extern int oai_exit; +#include "executables/nr-softmodem-common.h" 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 *); -extern void nr_phy_config_request(NR_PHY_Config_t *gNB); -#include "executables/thread-common.h" -//extern PARALLEL_CONF_t get_thread_parallel_conf(void); -//extern WORKER_CONF_t get_thread_worker_conf(void); - -void stop_RU(int nb_ru); - -void configure_ru(int idx, void *arg); -void configure_rru(int idx, void *arg); -int attach_rru(RU_t *ru); -int connect_rau(RU_t *ru); static void NRRCconfig_RU(configmodule_interface_t *cfg); -extern int emulate_rf; -extern int numerology; - /*************************************************************/ /* Functions to attach and configure RRU */ -extern void wait_gNBs(void); - int attach_rru(RU_t *ru) { ssize_t msg_len,len; RRU_CONFIG_msg_t rru_config_msg; @@ -146,8 +117,7 @@ int attach_rru(RU_t *ru) { } } - configure_ru(ru->idx, - (RRU_capabilities_t *)&rru_config_msg.msg[0]); + configure_ru(ru, (RRU_capabilities_t *)&rru_config_msg.msg[0]); rru_config_msg.type = RRU_config; rru_config_msg.len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE+sizeof(RRU_config_t); LOG_I(PHY,"Sending Configuration to RRU %d (num_bands %d,band0 %d,txfreq %u,rxfreq %u,att_tx %d,att_rx %d,N_RB_DL %d,N_RB_UL %d,3/4FS %d, prach_FO %d, prach_CI %d)\n",ru->idx, @@ -263,8 +233,7 @@ int connect_rau(RU_t *ru) { ((RRU_config_t *)&rru_config_msg.msg[0])->threequarter_fs[0], ((RRU_config_t *)&rru_config_msg.msg[0])->prach_FreqOffset[0], ((RRU_config_t *)&rru_config_msg.msg[0])->prach_ConfigIndex[0]); - configure_rru(ru->idx, - (void *)&rru_config_msg.msg[0]); + configure_rru(ru, (void *)&rru_config_msg.msg[0]); configuration_received = 1; } } @@ -1120,9 +1089,11 @@ void ru_tx_func(void *param) { if(!emulate_rf) { // do outgoing fronthaul (south) if needed - if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,frame_tx,slot_tx,info->timestamp_tx); + if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) + ru->fh_south_out(ru, frame_tx, slot_tx, info->timestamp_tx); - if (ru->fh_north_out) ru->fh_north_out(ru); + if (ru->fh_north_out) + ru->fh_north_out(ru); } else { if(frame_tx == print_frame) { for (int i=0; inb_tx; i++) { @@ -1289,13 +1260,12 @@ void *ru_thread( void *param ) { // We should make a VNF main loop with proper tasks calls in case of VNF slot_start = timespec_add(slot_start,slot_duration); struct timespec curr_time; - clock_gettime(CLOCK_MONOTONIC, &curr_time); - + clock_gettime(CLOCK_MONOTONIC, &curr_time); struct timespec sleep_time; - if((slot_start.tv_sec > curr_time.tv_sec) || (slot_start.tv_sec == curr_time.tv_sec && slot_start.tv_nsec > curr_time.tv_nsec)){ + if((slot_start.tv_sec > curr_time.tv_sec) || + (slot_start.tv_sec == curr_time.tv_sec && slot_start.tv_nsec > curr_time.tv_nsec)){ sleep_time = timespec_sub(slot_start,curr_time); - usleep(sleep_time.tv_nsec * 1e-3); } } @@ -1377,10 +1347,10 @@ void *ru_thread( void *param ) { if (!res) break; } - ru->feprx(ru,proc->tti_rx); // set the tti that was generated to busy - LOG_D(NR_PHY, "Setting %d.%d (%d) to busy\n", proc->frame_rx, proc->tti_rx, proc->tti_rx % RU_RX_SLOT_DEPTH); rx_tti_busy[proc->tti_rx % RU_RX_SLOT_DEPTH] = true; + ru->feprx(ru,proc->tti_rx); + LOG_D(NR_PHY, "Setting %d.%d (%d) to busy\n", proc->frame_rx, proc->tti_rx, proc->tti_rx % RU_RX_SLOT_DEPTH); clock_gettime(CLOCK_MONOTONIC,&ru->rt_ru_profiling.return_RU_feprx[rt_prof_idx]); //LOG_M("rxdata.m","rxs",ru->common.rxdata[0],1228800,1,1); LOG_D(PHY,"RU proc: frame_rx = %d, tti_rx = %d\n", proc->frame_rx, proc->tti_rx); @@ -1486,10 +1456,8 @@ void init_RU_proc(RU_t *ru) { if(emulate_rf) threadCreate( &proc->pthread_emulateRF, emulatedRF_thread, (void *)proc, "emulateRF", -1, OAI_PRIORITY_RT ); - if (opp_enabled == 1) - threadCreate( &ru->ru_stats_thread, ru_stats_thread, (void *)ru,"ru_stats", -1, OAI_PRIORITY_RT ); - if (get_thread_worker_conf() == WORKER_ENABLE) { - } + if (opp_enabled == 1) + threadCreate(&ru->ru_stats_thread, ru_stats_thread, (void *)ru, "ru_stats", -1, OAI_PRIORITY_RT); LOG_I(PHY, "Initialized RU proc %d (%s,%s),\n", ru->idx, NB_functions[ru->function], NB_timing[ru->if_timing]); } @@ -1585,19 +1553,19 @@ const char rru_format_options[4][20] = {"OAI_IF5_only", "OAI_IF4p5_only", "OAI_I const char rru_formats[3][20] = {"OAI_IF5", "MBP_IF5", "OAI_IF4p5"}; const char ru_if_formats[4][20] = {"LOCAL_RF", "REMOTE_OAI_IF5", "REMOTE_MBP_IF5", "REMOTE_OAI_IF4p5"}; -void configure_ru(int idx, - void *arg) { - RU_t *ru = RC.ru[idx]; +void configure_ru(void *ruu, void *arg) +{ + RU_t *ru = (RU_t *)ruu; RRU_config_t *config = (RRU_config_t *)arg; RRU_capabilities_t *capabilities = (RRU_capabilities_t *)arg; nfapi_nr_config_request_scf_t *cfg = &ru->config; int ret; - LOG_I(PHY, "Received capabilities from RRU %d\n",idx); + LOG_I(PHY, "Received capabilities from RRU %d\n", ru->idx); if (capabilities->FH_fmt < MAX_FH_FMTs) LOG_I(PHY, "RU FH options %s\n",rru_format_options[capabilities->FH_fmt]); ret = check_capabilities(ru,capabilities); - AssertFatal(ret == 0, "Cannot configure RRU %d, check_capabilities returned %d\n", idx, ret); + AssertFatal(ret == 0, "Cannot configure RRU %d, check_capabilities returned %d\n", ru->idx, ret); // take antenna capabilities of RRU ru->nb_tx = capabilities->nb_tx[0]; ru->nb_rx = capabilities->nb_rx[0]; @@ -1625,10 +1593,10 @@ void configure_ru(int idx, nr_phy_init_RU(ru); } -void configure_rru(int idx, - void *arg) { +void configure_rru(void *ruu, void *arg) +{ RRU_config_t *config = (RRU_config_t *)arg; - RU_t *ru = RC.ru[idx]; + RU_t *ru = (RU_t *)ruu; nfapi_nr_config_request_scf_t *cfg = &ru->config; ru->nr_frame_parms->nr_band = config->band_list[0]; ru->nr_frame_parms->dl_CarrierFreq = config->tx_freq[0]; diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h index 46763d6995..5ff6a0b323 100644 --- a/executables/nr-softmodem-common.h +++ b/executables/nr-softmodem-common.h @@ -151,5 +151,5 @@ extern double cpuf; extern int emulate_rf; extern int numerology; extern int usrp_tx_thread; - +void wait_gNBs(void); #endif diff --git a/executables/ru_control.c b/executables/ru_control.c index b7d71be89f..2136e5ff53 100644 --- a/executables/ru_control.c +++ b/executables/ru_control.c @@ -62,13 +62,11 @@ #include "SCHED/sched_eNB.h" #include "PHY/LTE_ESTIMATION/lte_estimation.h" #include "PHY/INIT/phy_init.h" +#include "executables/softmodem-common.h" #include "common/utils/LOG/log.h" - int attach_rru(RU_t *ru); -void configure_ru(RU_t *ru, void *arg); -void configure_rru(RU_t *ru, void *arg); void fill_rf_config(RU_t *ru, char *rf_config_file); void* ru_thread_control( void* param ); @@ -372,9 +370,9 @@ int check_capabilities(RU_t *ru, return(-1); } -void configure_ru(RU_t *ru, - void *arg) +void configure_ru(void *ruu, void *arg) { + RU_t *ru = (RU_t *)ruu; RRU_config_t *config = (RRU_config_t *)arg; RRU_capabilities_t *capabilities = (RRU_capabilities_t*)arg; int ret; @@ -423,9 +421,9 @@ void configure_ru(RU_t *ru, phy_init_RU(ru); } -void configure_rru(RU_t *ru, - void *arg) +void configure_rru(void *ruu, void *arg) { + RU_t *ru = (RU_t *)ruu; RRU_config_t *config = (RRU_config_t *)arg; ru->frame_parms->eutra_band = config->band_list[0]; diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 43c8b4625e..40a94e1ec1 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -372,8 +372,11 @@ extern uint16_t sl_ahead; extern uint16_t sf_ahead; extern int oai_exit; -void rx_func(void *param); void ru_tx_func(void *param); +void configure_ru(void *, void *arg); +void configure_rru(void *, void *arg); +struct timespec timespec_add(struct timespec lhs, struct timespec rhs); +struct timespec timespec_sub(struct timespec lhs, struct timespec rhs); extern uint8_t nfapi_mode; extern int16_t vnf_pnf_sfnslot_delta; #ifdef __cplusplus diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index 0a1a0322c5..a9f630198d 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -98,7 +98,7 @@ int nr_phy_init_RU(RU_t *ru) { ru->common.rxdataF = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) ); for (i=0; inb_rx; i++) { // allocate 4 slots of I/Q signal data (frequency) - ru->common.rxdataF[i] = (int32_t*)malloc16_clear(sizeof(int32_t)*(4*fp->symbols_per_slot*fp->ofdm_symbol_size) ); + ru->common.rxdataF[i] = (int32_t*)malloc16_clear(sizeof(**ru->common.rxdataF)*(RU_RX_SLOT_DEPTH*fp->symbols_per_slot*fp->ofdm_symbol_size) ); LOG_I(PHY,"rxdataF[%d] %p for RU %d\n",i,ru->common.rxdataF[i],ru->idx); } diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index 504c5fabe0..f990d6c157 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -159,8 +159,7 @@ 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) { - processingData_L1tx_t *msgTx=NULL; - msgTx = gNB->msgDataTx; + processingData_L1tx_t *msgTx = gNB->msgDataTx; msgTx->num_pdsch_slot = 0; msgTx->num_dl_pdcch = 0; msgTx->num_ul_pdcch = number_ul_dci_pdu; diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c index f6a152627c..56633f53e0 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c @@ -54,7 +54,8 @@ bool read_mac_sm(void* data) mac_ue_stats_impl_t* rd = &mac->msg.ue_stats[i]; rd->frame = RC.nrmac[mod_id]->frame; - rd->slot = RC.nrmac[mod_id]->slot; + rd->slot = 0; // previously had slot info, but the gNB runs multiple slots + // in parallel, so this has no real meaning rd->dl_aggr_tbs = UE->mac_stats.dl.total_bytes; rd->ul_aggr_tbs = UE->mac_stats.ul.total_bytes; diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index 235a7582d5..e406a1ad7f 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -93,7 +93,6 @@ typedef struct ru_config_s { */ void RCconfig_verify(configmodule_interface_t *cfg, ngran_node_t node_type); -extern void NRRCconfig_RU(void); extern void RCconfig_nr_prs(void); extern void RCconfig_NR_L1(void); extern void RCconfig_nr_macrlc(configmodule_interface_t *cfg); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 2c3ca94393..34a372247c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -210,8 +210,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_ } gNB->frame = frame; - gNB->slot = slot; - start_meas(&gNB->eNB_scheduler); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 9a1be26024..06429b61d3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2997,7 +2997,7 @@ int nr_mac_enable_ue_rrc_processing_timer(gNB_MAC_INST *mac, NR_UE_info_t *UE, b // frames, after RRC processing timer. UE->UE_sched_ctrl.ta_frame = (mac->frame - 1 + 1024) % 1024; - LOG_D(NR_MAC, "%4d.%2d UE %04x: Activate RRC processing timer (%d ms)\n", mac->frame, mac->slot, UE->rnti, delay); + LOG_D(NR_MAC, "UE %04x: Activate RRC processing timer (%d ms)\n", UE->rnti, delay); return 0; } diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 02b5f54a56..64aff46937 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -836,9 +836,7 @@ typedef struct gNB_MAC_INST_s { nr_mac_rrc_ul_if_t mac_rrc; f1_config_t f1_config; - int16_t frame; - int16_t slot; pthread_mutex_t sched_lock; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 6f3cd0a744..a2d508531c 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -388,11 +388,9 @@ static void match_crc_rx_pdu(nfapi_nr_rx_data_indication_t *rx_ind, nfapi_nr_crc static void run_scheduler(module_id_t module_id, int CC_id, int frame, int slot) { NR_IF_Module_t *ifi = nr_if_inst[module_id]; - // gNB_MAC_INST *mac = RC.nrmac[module_id]; - NR_Sched_Rsp_t *sched_info; LOG_D(NR_MAC, "Calling scheduler for %d.%d\n", frame, slot); - sched_info = allocate_sched_response(); + NR_Sched_Rsp_t *sched_info = allocate_sched_response(); // clear UL DCI prior to handling ULSCH sched_info->UL_dci_req.numPdus = 0; diff --git a/radio/COMMON/common_lib.h b/radio/COMMON/common_lib.h index ee7a9543f6..074007dd10 100644 --- a/radio/COMMON/common_lib.h +++ b/radio/COMMON/common_lib.h @@ -567,12 +567,11 @@ struct openair0_device_t { * \param idx RU index * \param arg pointer to capabilities or configuration */ - void (*configure_rru)(int idx, void *arg); + void (*configure_rru)(void *, void *arg); -/*! \brief Pointer to generic RRU private information + /*! \brief Pointer to generic RRU private information */ - void *thirdparty_priv; /*! \brief Callback for Third-party RRU Initialization routine