From 00d78f048ab079f890e15f05f3e9a97d8d1f69fb Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 26 Apr 2024 18:04:43 +0200 Subject: [PATCH] remove a unused global storage of slot number This has no meaning at a global level, we run several slots: one tx, several rx at same time. Some minor cleaning of C style --- executables/nr-gnb.c | 11 ++++------- executables/nr-ru.c | 6 ++++-- executables/softmodem-common.h | 1 - openair1/SCHED_NR/fapi_nr_l1.c | 3 +-- openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c | 3 ++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 -- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 -- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 4 +--- 9 files changed, 13 insertions(+), 21 deletions(-) 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 71c9c5fd73..dbb0c30a95 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1089,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++) { diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index d49c56d11b..40a94e1ec1 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -372,7 +372,6 @@ 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); 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/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;