From e4d2d2b8277d530f0f47def702cee74527b39241 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Fri, 20 Mar 2026 11:09:19 +0100 Subject: [PATCH] Cleanup common_lib.h This change reduces the number of dependecies of common_lib.h and simplifies the task of implementing an external OAI radio library. --- common/utils/threadPool/measurement_display.c | 3 +- executables/lte-ue.c | 2 - executables/nr-ru.c | 1 - executables/nr-ue-ru.c | 2 + executables/nr-uesoftmodem.c | 1 - executables/position_interface.c | 1 + .../nrLDPC_coding_aal/nrLDPC_coding_aal.c | 1 + openair1/PHY/INIT/nr_init_ue.c | 1 + .../PHY/INIT/tests/test_nr_frame_params.cpp | 1 + openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h | 1 + openair1/PHY/LTE_TRANSPORT/transport_eNB.h | 1 + openair1/PHY/TOOLS/calibration_test.c | 1 + openair1/PHY/defs_L1_NB_IoT.h | 1 + openair1/PHY/defs_RU.h | 1 + openair2/E1AP/e1ap_setup.c | 2 + openair2/GNB_APP/gnb_config_ng.c | 1 + .../tests/test_nr_ue_power_procedures.cpp | 2 +- .../tests/test_nr_ue_ra_procedures.cpp | 2 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 1 + openair3/NRPPA/nrppa_gNB_config.c | 1 + radio/BLADERF/bladerf_lib.c | 1 + radio/COMMON/common_lib.c | 10 ++++- radio/COMMON/common_lib.h | 22 +---------- radio/COMMON/record_player.c | 2 + radio/COMMON/record_player.h | 2 - radio/ETHERNET/eth_udp.c | 8 ++-- radio/ETHERNET/ethernet_lib.c | 39 ++++++++++++------- radio/ETHERNET/ethernet_lib.h | 11 ++++++ radio/emulator/rf_emulator.c | 1 + radio/fhi_72/oran-config.c | 1 + radio/fhi_72/oran-params.h | 1 + radio/rfsimulator/simulator.cpp | 1 + tests/nr-cuup/nr-cuup-load-test.c | 1 + 33 files changed, 77 insertions(+), 50 deletions(-) diff --git a/common/utils/threadPool/measurement_display.c b/common/utils/threadPool/measurement_display.c index c1ef6bc9f2..111c3ce9aa 100644 --- a/common/utils/threadPool/measurement_display.c +++ b/common/utils/threadPool/measurement_display.c @@ -3,8 +3,7 @@ */ #include - -#include "thread-pool.h" +#include "notified_fifo.h" #define SEP "\t" diff --git a/executables/lte-ue.c b/executables/lte-ue.c index ccdf2d5525..f96de51f16 100644 --- a/executables/lte-ue.c +++ b/executables/lte-ue.c @@ -300,8 +300,6 @@ void init_UE(int nb_inst, UE_thread, (void *)UE), ""); } - - printf("UE threads created by %ld\n", gettid()); } // Initiating all UEs within a single set of threads for PHY_STUB. Future extensions -> multiple diff --git a/executables/nr-ru.c b/executables/nr-ru.c index f6e73b9e6a..ebe0f82efe 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1016,7 +1016,6 @@ int nr_start_if(struct RU_t_s *ru, struct PHY_VARS_gNB_s *gNB) { for (int i = 0; i < ru->nb_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); } diff --git a/executables/nr-ue-ru.c b/executables/nr-ue-ru.c index e2c8cc5f40..52b234a137 100644 --- a/executables/nr-ue-ru.c +++ b/executables/nr-ue-ru.c @@ -5,6 +5,8 @@ #include "nr-ue-ru.h" #include "nr-uesoftmodem.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" +#include "common/config/config_paramdesc.h" +#include "common/config/config_userapi.h" /* NR UE RU configuration section name */ #define CONFIG_STRING_NRUE_RU_LIST "RUs" diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 50a1c7352b..8c97a98548 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -450,7 +450,6 @@ int main(int argc, char **argv) LOG_I(PHY,"Intializing UE Threads for instance %d ...\n", inst); init_NR_UE_threads(PHY_vars_UE_g[inst][0]); } - printf("UE threads created by %ld\n", gettid()); // wait for end of program printf("TYPE TO TERMINATE\n"); diff --git a/executables/position_interface.c b/executables/position_interface.c index 195677f64d..f3c336745c 100644 --- a/executables/position_interface.c +++ b/executables/position_interface.c @@ -4,6 +4,7 @@ #include "position_interface.h" #include "executables/nr-uesoftmodem.h" +#include "common/config/config_userapi.h" static void read_position_coordinates(char *sectionName, position_t *position) { diff --git a/openair1/PHY/CODING/nrLDPC_coding/nrLDPC_coding_aal/nrLDPC_coding_aal.c b/openair1/PHY/CODING/nrLDPC_coding/nrLDPC_coding_aal/nrLDPC_coding_aal.c index 0da16183eb..b1fe8b8ac2 100644 --- a/openair1/PHY/CODING/nrLDPC_coding/nrLDPC_coding_aal/nrLDPC_coding_aal.c +++ b/openair1/PHY/CODING/nrLDPC_coding/nrLDPC_coding_aal/nrLDPC_coding_aal.c @@ -11,6 +11,7 @@ #include "PHY/CODING/nrLDPC_decoder/nrLDPCdecoder_defs.h" #include "PHY/CODING/coding_defs.h" +#include "common/config/config_userapi.h" #include #include diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 8fb5c3b124..c10bce1b2d 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -17,6 +17,7 @@ #include "openair2/COMMON/prs_nr_paramdef.h" #include "SCHED_NR_UE/harq_nr.h" #include "nr-uesoftmodem.h" +#include "common/config/config_userapi.h" void RCconfig_nrUE_prs(void *cfg) { diff --git a/openair1/PHY/INIT/tests/test_nr_frame_params.cpp b/openair1/PHY/INIT/tests/test_nr_frame_params.cpp index 5c44308170..0d600b96bb 100644 --- a/openair1/PHY/INIT/tests/test_nr_frame_params.cpp +++ b/openair1/PHY/INIT/tests/test_nr_frame_params.cpp @@ -7,6 +7,7 @@ extern "C" { #include #include "openair1/PHY/defs_nr_common.h" #include "openair1/PHY/INIT/nr_phy_init.h" +#include "common/config/config_userapi.h" static softmodem_params_t softmodem_params; softmodem_params_t *get_softmodem_params(void) diff --git a/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h b/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h index a68bccda64..d2a0c8f656 100644 --- a/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h +++ b/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h @@ -17,6 +17,7 @@ #include "common/platform_types.h" //#include "dci.h" #include "PHY/LTE_TRANSPORT/uci_NB_IoT.h" +#include "common/cmake_defs.h" //#include "dci.h" //#include "uci.h" //#ifndef STANDALONE_COMPILE diff --git a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h index 9d04aba1cf..b08fe834bb 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h @@ -12,6 +12,7 @@ #include "dci.h" #include "mdci.h" #include "uci_common.h" +#include "common/cmake_defs.h" //#ifndef STANDALONE_COMPILE // #include "UTIL/LISTS/list.h" //#endif diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c index 6301f496d5..93bcd3601a 100644 --- a/openair1/PHY/TOOLS/calibration_test.c +++ b/openair1/PHY/TOOLS/calibration_test.c @@ -8,6 +8,7 @@ #include #include #include "nfapi/oai_integration/vendor_ext.h" +#include "common/config/config_userapi.h" int oai_exit=false; diff --git a/openair1/PHY/defs_L1_NB_IoT.h b/openair1/PHY/defs_L1_NB_IoT.h index 1b663c101f..f07cb4a3d4 100644 --- a/openair1/PHY/defs_L1_NB_IoT.h +++ b/openair1/PHY/defs_L1_NB_IoT.h @@ -22,6 +22,7 @@ //#include #include "assertions.h" #include "common/utils/LOG/log.h" +#include "common/cmake_defs.h" #define msg(aRGS...) LOG_D(PHY, ##aRGS) //use msg in the real-time thread context #define msg_nrt printf diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index dbdcf8693d..5be28b6a52 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -17,6 +17,7 @@ #include "nfapi_nr_interface_scf.h" #include "common/utils/threadPool/task_ans.h" #include "common/utils/threadPool/thread-pool.h" +#include "common/utils/threadPool/notified_fifo.h" #define MAX_BANDS_PER_RRU 4 #define MAX_RRU_CONFIG_SIZE 1024 diff --git a/openair2/E1AP/e1ap_setup.c b/openair2/E1AP/e1ap_setup.c index 2247b47d9c..b14fe65fae 100644 --- a/openair2/E1AP/e1ap_setup.c +++ b/openair2/E1AP/e1ap_setup.c @@ -11,6 +11,8 @@ #include "common/utils/ocp_itti/intertask_interface.h" #include "openair2/GNB_APP/gnb_paramdef.h" #include "openair3/ocp-gtpu/gtp_itf.h" +#include "common/config/config_paramdesc.h" +#include "common/config/config_userapi.h" static void get_NGU_S1U_addr(char **addr, uint16_t *port) { diff --git a/openair2/GNB_APP/gnb_config_ng.c b/openair2/GNB_APP/gnb_config_ng.c index 5ab77969c8..102b4efcf1 100644 --- a/openair2/GNB_APP/gnb_config_ng.c +++ b/openair2/GNB_APP/gnb_config_ng.c @@ -10,6 +10,7 @@ #include "common/config/config_paramdesc.h" #include "sctp_default_values.h" #include "gnb_paramdef.h" +#include "common/config/config_userapi.h" int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) { diff --git a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_power_procedures.cpp b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_power_procedures.cpp index a6b051a7c2..c6ac903a4c 100644 --- a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_power_procedures.cpp +++ b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_power_procedures.cpp @@ -691,7 +691,7 @@ TEST(test_srs_power, tpc_accumulation) int main(int argc, char** argv) { logInit(); - uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY); + load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY); g_log->log_component[MAC].level = OAILOG_DEBUG; g_log->log_component[NR_MAC].level = OAILOG_DEBUG; testing::InitGoogleTest(&argc, argv); diff --git a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp index 296d1e2ab6..47c7ad4027 100644 --- a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp +++ b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp @@ -134,7 +134,7 @@ TEST(test_init_ra, four_step_cfra) int main(int argc, char **argv) { logInit(); - uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY); + load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY); g_log->log_component[MAC].level = OAILOG_DEBUG; g_log->log_component[NR_MAC].level = OAILOG_DEBUG; testing::InitGoogleTest(&argc, argv); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 6fedbd430e..af9d027566 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -26,6 +26,7 @@ #include "LTE_PMCH-InfoList-r9.h" #include "openair3/SECU/secu_defs.h" +#include "common/utils/threadPool/notified_fifo.h" #define MAX_NUMBER_NETIF 1 //16 #define ENB_NAS_USE_TUN_W_MBMS_BIT (1<< 10) diff --git a/openair3/NRPPA/nrppa_gNB_config.c b/openair3/NRPPA/nrppa_gNB_config.c index ba6771fe1a..eaafb3b954 100644 --- a/openair3/NRPPA/nrppa_gNB_config.c +++ b/openair3/NRPPA/nrppa_gNB_config.c @@ -8,6 +8,7 @@ #include "openair1/PHY/defs_gNB.h" #include "common/ran_context.h" #include "positioning_nr_paramdef.h" +#include "common/config/config_userapi.h" positioning_config_t RCconfig_nr_positioning(void) { diff --git a/radio/BLADERF/bladerf_lib.c b/radio/BLADERF/bladerf_lib.c index 19d8a825af..43b2704226 100644 --- a/radio/BLADERF/bladerf_lib.c +++ b/radio/BLADERF/bladerf_lib.c @@ -8,6 +8,7 @@ #include #include "common_lib.h" +#include "log.h" /*! \brief BladeRF specific data structure */ typedef struct { diff --git a/radio/COMMON/common_lib.c b/radio/COMMON/common_lib.c index 0e02ded87c..000ae26703 100644 --- a/radio/COMMON/common_lib.c +++ b/radio/COMMON/common_lib.c @@ -17,6 +17,9 @@ #include "common/utils/load_module_shlib.h" #include "common/utils/LOG/log.h" #include "executables/softmodem-common.h" +#include "common/config/config_paramdesc.h" +#include "common/config/config_userapi.h" +#include "common/cmake_defs.h" #define MAX_GAP 100ULL const char *const devtype_names[MAX_RF_DEV_TYPE] = @@ -224,6 +227,9 @@ int openair0_write_reorder_common(nrue_ru_write_t nrue_ru_write, ctx->nextTS = timestamp; pthread_mutex_init(&ctx->mutex_write, NULL); pthread_mutex_init(&ctx->mutex_store, NULL); + for (int i = 0; i < WRITE_QUEUE_SZ; i++) { + ctx->queue[i].txp = malloc(sizeof(void *) * NB_ANTENNAS_TX); + } ctx->initDone = true; } if (pthread_mutex_trylock(&ctx->mutex_write) == 0) { @@ -270,8 +276,10 @@ void openair0_write_reorder_clear_context(openair0_device_t *device) LOG_E(HW, "write_reorder_clear_context call while still writing on the device\n"); pthread_mutex_destroy(&ctx->mutex_write); pthread_mutex_lock(&ctx->mutex_store); - for (int i = 0; i < WRITE_QUEUE_SZ; i++) + for (int i = 0; i < WRITE_QUEUE_SZ; i++) { ctx->queue[i].active = false; + free(ctx->queue[i].txp); + } pthread_mutex_unlock(&ctx->mutex_store); pthread_mutex_destroy(&ctx->mutex_store); ctx->initDone = false; diff --git a/radio/COMMON/common_lib.h b/radio/COMMON/common_lib.h index 42eaa46f89..72b24ca13e 100644 --- a/radio/COMMON/common_lib.h +++ b/radio/COMMON/common_lib.h @@ -11,10 +11,8 @@ #include #include #include -#include "common/cmake_defs.h" -#include +#include #include "record_player.h" -#include "common/utils/threadPool/notified_fifo.h" /* default name of shared library implementing the radio front end */ #define OAI_RF_LIBNAME "oai_device" @@ -140,14 +138,6 @@ typedef enum { TX_GPIO_CHANGE = 0x1000, } radio_tx_gpio_flag_t; -/*! \brief Structure used for initializing UDP read threads */ -typedef struct { - openair0_device_t *device; - int thread_id; - pthread_t pthread; - notifiedFIFO_t *resp; -} udp_ctx_t; - typedef enum { RU_GPIO_CONTROL_NONE, RU_GPIO_CONTROL_GENERIC, @@ -351,7 +341,7 @@ typedef struct { struct { bool active; openair0_timestamp_t timestamp; - void *txp[NB_ANTENNAS_TX]; + void **txp; int nsamps; int nbAnt; int flags; @@ -393,9 +383,6 @@ struct openair0_device { /*!brief pointer to FH state, used in ECPRI split 8*/ fhstate_t fhstate; - /*!brief UDP TX thread context*/ - udp_ctx_t **utx; - /*!brief Used in ECPRI split 8 to indicate numerator of sampling rate ratio*/ int sampling_rate_ratio_n; @@ -631,7 +618,6 @@ struct openair0_device { void *(*get_internal_parameter)(char *id); /* \brief timing statistics for TX fronthaul (ethernet) */ - time_stats_t tx_fhaul; re_order_t reOrder; }; @@ -689,10 +675,6 @@ extern void iqrecorder_end(openair0_device_t *device); int openair0_write_reorder(openair0_device_t *device, openair0_timestamp_t timestamp, void **txp, int nsamps, int nbAnt, int flags); void openair0_write_reorder_clear_context(openair0_device_t *device); -#include -#ifndef gettid -#define gettid() syscall(__NR_gettid) -#endif /**@}*/ #ifdef __cplusplus diff --git a/radio/COMMON/record_player.c b/radio/COMMON/record_player.c index 33567b3a7b..b54f745e22 100644 --- a/radio/COMMON/record_player.c +++ b/radio/COMMON/record_player.c @@ -11,6 +11,8 @@ #include "assertions.h" #include "common_lib.h" #include "record_player.h" +#include "common/config/config_paramdesc.h" +#include "common/config/config_userapi.h" /*! \brief read the oai recorder or player configuration, called from common device code * \param recplay_conf: store parameters diff --git a/radio/COMMON/record_player.h b/radio/COMMON/record_player.h index 5015ad56c3..be5b7381a7 100644 --- a/radio/COMMON/record_player.h +++ b/radio/COMMON/record_player.h @@ -9,8 +9,6 @@ #include #include #include -#include "common/config/config_paramdesc.h" -#include "common/config/config_userapi.h" #ifdef __cplusplus extern "C" diff --git a/radio/ETHERNET/eth_udp.c b/radio/ETHERNET/eth_udp.c index 56999f9846..935bc88396 100644 --- a/radio/ETHERNET/eth_udp.c +++ b/radio/ETHERNET/eth_udp.c @@ -365,7 +365,8 @@ void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem) int trx_eth_write_udp(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int fd_ind, int nsamps, int flags, int nant) { union udpTXReqUnion id = {.s={(uint64_t)timestamp,nsamps,0}}; - notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(udpTXelem_t), id.p, device->utx[fd_ind]->resp,NULL); + eth_state_t *eth = (eth_state_t*)device->priv; + notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(udpTXelem_t), id.p, eth->utx[fd_ind]->resp,NULL); udpTXelem_t * udptxelem=(udpTXelem_t *) NotifiedFifoData(req); udptxelem->device = device; udptxelem->timestamp = timestamp; @@ -375,7 +376,7 @@ int trx_eth_write_udp(openair0_device_t *device, openair0_timestamp_t timestamp, udptxelem->nsamps = nsamps; udptxelem->flags = flags; udptxelem->nant = nant; - pushNotifiedFIFO(device->utx[fd_ind]->resp, req); + pushNotifiedFIFO(eth->utx[fd_ind]->resp, req); LOG_D(PHY,"Pushed to TX FH FIFO, TS %llu, nsamps %d, nant %d buffs[0] %p buffs[1] %p\n", (unsigned long long)timestamp,nsamps,nant,udptxelem->buff[0],udptxelem->buff[1]); return(0); @@ -386,14 +387,11 @@ void *udp_write_thread(void *arg) { utx->resp = malloc(sizeof(*utx->resp)); initNotifiedFIFO(utx->resp); LOG_D(PHY,"UDP write thread started on core %d\n",sched_getcpu()); - reset_meas(&utx->device->tx_fhaul); while (oai_exit == 0) { notifiedFIFO_elt_t *res = pullNotifiedFIFO(utx->resp); udpTXelem_t *udptxelem = (udpTXelem_t *)NotifiedFifoData(res); LOG_D(PHY,"Pulled from TX FH FIFO, TS %llu, nsamps %d, nant %d\n",(unsigned long long)udptxelem->timestamp,udptxelem->nsamps,udptxelem->nant); - start_meas(&utx->device->tx_fhaul); trx_eth_write_udp_cmd(udptxelem); - stop_meas(&utx->device->tx_fhaul); // send data to RU delNotifiedFIFO_elt(res); } diff --git a/radio/ETHERNET/ethernet_lib.c b/radio/ETHERNET/ethernet_lib.c index dccb16095a..f1942f9f04 100644 --- a/radio/ETHERNET/ethernet_lib.c +++ b/radio/ETHERNET/ethernet_lib.c @@ -6,6 +6,7 @@ * \brief API to stream I/Q samples over standard ethernet */ +#include "utils.h" #include #include #include @@ -37,20 +38,30 @@ int trx_eth_start(openair0_device_t *device) AssertFatal(device->thirdparty_init != NULL, "device->thirdparty_init is null\n"); AssertFatal(device->thirdparty_init(device) == 0, "third-party init failed\n"); device->openair0_cfg->samples_per_packet = 256; - eth->num_fd = 1; //max(device->openair0_cfg->rx_num_channels,device->openair0_cfg->tx_num_channels); - udp_ctx_t *u[1+eth->num_fd]; - device->utx = (udp_ctx_t**)malloc(sizeof(device->utx)); - for (int i=0;inum_fd;i++) { - u[i] = malloc(sizeof(udp_ctx_t)); - u[i]->thread_id=i; - u[i]->device = device; - printf("UDP Read Thread %d on core %d\n",i,device->openair0_cfg->rxfh_cores[i]); - threadCreate(&u[i]->pthread,udp_read_thread,u[i],"udp read thread",device->openair0_cfg->rxfh_cores[i],OAI_PRIORITY_RT_MAX); - device->utx[i] = malloc(sizeof(udp_ctx_t)); - device->utx[i]->thread_id=i; - device->utx[i]->device = device; - printf("UDP Write Thread %d on core %d\n",i,device->openair0_cfg->txfh_cores[i]); - threadCreate(&device->utx[i]->pthread,udp_write_thread,device->utx[i],"udp write thread",device->openair0_cfg->txfh_cores[i],OAI_PRIORITY_RT_MAX); + eth->num_fd = 1; //max(device->openair0_cfg->rx_num_channels,device->openair0_cfg->tx_num_channels); + udp_ctx_t *u[1 + eth->num_fd]; + eth->utx = malloc_or_fail(sizeof(eth->utx)); + for (int i = 0; i < eth->num_fd; i++) { + u[i] = malloc_or_fail(sizeof(udp_ctx_t)); + u[i]->thread_id = i; + u[i]->device = device; + printf("UDP Read Thread %d on core %d\n", i, device->openair0_cfg->rxfh_cores[i]); + threadCreate(&u[i]->pthread, + udp_read_thread, + u[i], + "udp read thread", + device->openair0_cfg->rxfh_cores[i], + OAI_PRIORITY_RT_MAX); + eth->utx[i] = malloc_or_fail(sizeof(udp_ctx_t)); + eth->utx[i]->thread_id = i; + eth->utx[i]->device = device; + printf("UDP Write Thread %d on core %d\n", i, device->openair0_cfg->txfh_cores[i]); + threadCreate(ð->utx[i]->pthread, + udp_write_thread, + eth->utx[i], + "udp write thread", + device->openair0_cfg->txfh_cores[i], + OAI_PRIORITY_RT_MAX); } device->sampling_rate_ratio_n=1; device->sampling_rate_ratio_d=1; diff --git a/radio/ETHERNET/ethernet_lib.h b/radio/ETHERNET/ethernet_lib.h index 14c583a76e..8662f63d6b 100644 --- a/radio/ETHERNET/ethernet_lib.h +++ b/radio/ETHERNET/ethernet_lib.h @@ -17,6 +17,7 @@ #include #include #include +#include "common/utils/threadPool/notified_fifo.h" #define MAX_INST 4 @@ -29,6 +30,14 @@ #define APP_HEADER_SIZE_BYTES (ECPRICOMMON_BYTES + ECPRIPCID_BYTES + sizeof(openair0_timestamp_t)) #define ECPRIREV 1 // ECPRI Version 1, C=0 - single ECPRI message per OAI TX packet +/*! \brief Structure used for initializing UDP read threads */ +typedef struct { + openair0_device_t *device; + int thread_id; + pthread_t pthread; + notifiedFIFO_t *resp; +} udp_ctx_t; + /*!\brief opaque ethernet data structure */ typedef struct { @@ -115,6 +124,8 @@ typedef struct { struct ether_header ehd; /*!\brief local address (user) for RAW socket*/ struct sockaddr_ll local_addrd_ll; + /*!brief UDP TX thread context*/ + udp_ctx_t **utx; } eth_state_t; diff --git a/radio/emulator/rf_emulator.c b/radio/emulator/rf_emulator.c index 34b306c4fe..d0d32215b4 100644 --- a/radio/emulator/rf_emulator.c +++ b/radio/emulator/rf_emulator.c @@ -16,6 +16,7 @@ #include "radio/vrtsim/noise_device.h" #include "simde/x86/avx512.h" #include "SIMULATION/TOOLS/sim.h" +#include "common/config/config_userapi.h" #define RF_EMULATOR_SECTION "rf_emulator" // clang-format off diff --git a/radio/fhi_72/oran-config.c b/radio/fhi_72/oran-config.c index 5209c34abe..8da11c64ed 100644 --- a/radio/fhi_72/oran-config.c +++ b/radio/fhi_72/oran-config.c @@ -14,6 +14,7 @@ #include "stdio.h" #include "string.h" +#include "log.h" #ifdef OAI_MPLANE #include "mplane/ru-mplane-api.h" diff --git a/radio/fhi_72/oran-params.h b/radio/fhi_72/oran-params.h index 8d2e65dc74..8ae5c18abc 100644 --- a/radio/fhi_72/oran-params.h +++ b/radio/fhi_72/oran-params.h @@ -7,6 +7,7 @@ #include "stdbool.h" #include "stdint.h" +#include "common/config/config_userapi.h" #define CONFIG_STRING_ORAN "fhi_72" diff --git a/radio/rfsimulator/simulator.cpp b/radio/rfsimulator/simulator.cpp index 38b5351e40..ee2eb01343 100644 --- a/radio/rfsimulator/simulator.cpp +++ b/radio/rfsimulator/simulator.cpp @@ -30,6 +30,7 @@ #include #include #include "common_lib.h" +#include "common/utils/threadPool/pthread_utils.h" extern "C" { #include #include diff --git a/tests/nr-cuup/nr-cuup-load-test.c b/tests/nr-cuup/nr-cuup-load-test.c index f45ab2a0ff..e39dd9d267 100644 --- a/tests/nr-cuup/nr-cuup-load-test.c +++ b/tests/nr-cuup/nr-cuup-load-test.c @@ -12,6 +12,7 @@ #include "openair2/E1AP/e1ap.h" #include "openair3/ocp-gtpu/gtp_itf.h" #include "openair2/E1AP/lib/e1ap_interface_management.h" +#include "common/config/config_userapi.h" configmodule_interface_t *uniqCfg;