time management module

This commit introduces a time management module.

See doc/time_management.md for details.
This commit is contained in:
Cedric Roux
2025-04-18 09:02:54 +02:00
parent 9bccad31b5
commit 7cbedb1575
30 changed files with 1983 additions and 79 deletions
+8
View File
@@ -31,6 +31,7 @@
#include "openair2/F1AP/f1ap_ids.h"
#include "openair2/GNB_APP/gnb_config.h"
#include "nr_pdcp/nr_pdcp_oai_api.h"
#include "common/utils/time_manager/time_manager.h"
RAN_CONTEXT_t RC;
THREAD_STRUCT thread_struct;
@@ -139,6 +140,11 @@ int main(int argc, char **argv)
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
}
logInit();
// start time manager with some reasonable default for the running mode
// (may be overwritten in configuration file or command line)
time_manager_start(TIME_MANAGER_GNB_CU, TIME_MANAGER_REALTIME);
// strdup to put the sring in the core file for post mortem identification
LOG_I(HW, "Version: %s\n", strdup(OAI_PACKAGE_VERSION));
set_softmodem_sighandler();
@@ -177,6 +183,8 @@ int main(int argc, char **argv)
printf("TYPE <CTRL-C> TO TERMINATE\n");
itti_wait_tasks_end(NULL);
time_manager_finish();
logClean();
printf("Bye.\n");
return 0;
+5
View File
@@ -47,6 +47,7 @@
#include "SCHED_NR/sched_nr.h"
#include "common/utils/LOG/log.h"
#include "common/utils/time_manager/time_manager.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include <executables/softmodem-common.h>
@@ -1249,6 +1250,10 @@ void *ru_thread(void *param)
slot++;
}
// pretend we have 1 iq sample per slot
// and so slots_per_frame * 100 iq samples per second (1 frame being 10ms)
time_manager_iq_samples(1, fp->slots_per_frame * 100);
// synchronization on input FH interface, acquire signals/data and block
LOG_D(PHY,"[RU_thread] read data: frame_rx = %d, tti_rx = %d\n", frame, slot);
+15
View File
@@ -28,6 +28,7 @@
#include "PHY/TOOLS/smbv.h"
unsigned short config_frames[4] = {2,9,11,13};
#endif
#include "common/utils/time_manager/time_manager.h"
#ifdef ENABLE_AERIAL
#include "nfapi/oai_integration/aerial/fapi_nvIPC.h"
#endif
@@ -628,6 +629,18 @@ int main( int argc, char **argv ) {
pthread_mutex_init(&sync_mutex, NULL);
}
// start time manager with some reasonable default for the running mode
// (may be overwritten in configuration file or command line)
time_manager_start(NODE_IS_MONOLITHIC(node_type) ? TIME_MANAGER_GNB_MONOLITHIC
: NODE_IS_CU(node_type) ? TIME_MANAGER_GNB_CU
: TIME_MANAGER_GNB_DU,
// iq_samples time source for monolithic/du with rfsim,
// realtime time source for other cases
IS_SOFTMODEM_RFSIM
&& (NODE_IS_MONOLITHIC(node_type) || NODE_IS_DU(node_type))
? TIME_MANAGER_IQ_SAMPLES
: TIME_MANAGER_REALTIME);
// start the main threads
number_of_cards = 1;
@@ -730,6 +743,8 @@ int main( int argc, char **argv ) {
pthread_cond_destroy(&nfapi_sync_cond);
pthread_mutex_destroy(&nfapi_sync_mutex);
time_manager_finish();
free(pckg);
logClean();
printf("Bye.\n");
+5 -10
View File
@@ -42,6 +42,7 @@
#include "common/utils/threadPool/notified_fifo.h"
#include "position_interface.h"
#include "nr_phy_common.h"
#include "common/utils/time_manager/time_manager.h"
/*
* NR SLOT PROCESSING SEQUENCE
@@ -706,16 +707,6 @@ static int UE_dl_preprocessing(PHY_VARS_NR_UE *UE,
process_msg_rcc_to_mac(msg);
} while (msg);
if (IS_SOFTMODEM_NOS1 || IS_SA_MODE(get_softmodem_params())) {
/* send tick to RLC and PDCP every ms */
if (proc->nr_slot_rx % fp->slots_per_subframe == 0) {
void nr_rlc_tick(int frame, int subframe);
void nr_pdcp_tick(int frame, int subframe);
nr_rlc_tick(proc->frame_rx, proc->nr_slot_rx / fp->slots_per_subframe);
nr_pdcp_tick(proc->frame_rx, proc->nr_slot_rx / fp->slots_per_subframe);
}
}
if (UE->if_inst)
UE->if_inst->slot_indication(UE->Mod_id, false);
@@ -1095,6 +1086,10 @@ void *UE_thread(void *arg)
absolute_slot++;
TracyCFrameMark;
// pretend we have 1 iq sample per slot
// and so nb_slot_frame * 100 iq samples per second (1 frame being 10ms)
time_manager_iq_samples(1, nb_slot_frame * 100);
int slot_nr = absolute_slot % nb_slot_frame;
nr_rxtx_thread_data_t curMsg = {0};
curMsg.UE=UE;
+12
View File
@@ -60,6 +60,7 @@
unsigned short config_frames[4] = {2,9,11,13};
#endif
#include "common/utils/LOG/log.h"
#include "common/utils/time_manager/time_manager.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
@@ -461,6 +462,14 @@ int main(int argc, char **argv)
if (IS_SOFTMODEM_RFSIM && !get_softmodem_params()->phy_test)
sleep(3);
// start time manager with some reasonable default for the running mode
// (may be overwritten in configuration file or command line)
time_manager_start(TIME_MANAGER_UE,
// iq_samples time source for rfsim,
// realtime time source if not
IS_SOFTMODEM_RFSIM ? TIME_MANAGER_IQ_SAMPLES
: TIME_MANAGER_REALTIME);
if (!get_softmodem_params()->nsa && get_softmodem_params()->emulate_l1)
start_oai_nrue_threads();
@@ -586,6 +595,9 @@ int main(int argc, char **argv)
}
free_nrLDPC_coding_interface(&nrLDPC_coding_interface);
time_manager_finish();
free(pckg);
return 0;
}