From e2a3cde4b7c062e95c12560966aef7117c80672b Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 8 Jan 2025 10:27:03 +0100 Subject: [PATCH] Further cleanup: define oai_exit for 4G The parent commit cleans up and groups oai_exit in one place, nr-softmodem-common.h. Therefore, this 5G file is included in the 4G defs_common.h (at least it's mostly 4G), which is not nice. Instead, define oai_exit also in 4G softmodem-common.h, and include this in defs_common.h. Remove the cyclic inclusion of defs_common.h in softmodem-common.h, and resolve all subsequent errors around unknown types and extern definition mismatches. --- common/utils/telnetsrv/telnetsrv.c | 1 + executables/lte-ue.c | 2 +- executables/lte-uesoftmodem.c | 3 +-- executables/main_ru.c | 2 +- executables/nr-ru.c | 2 +- executables/nr-uesoftmodem.c | 2 +- executables/softmodem-common.h | 10 +++++++--- nfapi/oai_integration/aerial/fapi_vnf_p5.c | 5 ++--- nfapi/oai_integration/nfapi_pnf.c | 2 +- nfapi/oai_integration/nfapi_vnf.c | 2 +- nfapi/open-nFAPI/pnf/src/pnf_p7.c | 4 +--- openair1/PHY/defs_common.h | 3 +-- openair1/SCHED/nfapi_lte_dummy.c | 2 +- openair1/SCHED/nfapi_nr_dummy.c | 2 +- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- openair1/SIMULATION/NR_PHY/prachsim.c | 2 +- openair1/SIMULATION/NR_PHY/ulsim.c | 4 ++-- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 1 - openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 1 - openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- openair2/PHY_INTERFACE/phy_stub_UE.c | 2 +- radio/ETHERNET/benetel/4g/benetel.c | 2 +- radio/ETHERNET/benetel/5g/benetel.c | 2 +- radio/fhi_72/oran_isolate.c | 2 +- 24 files changed, 30 insertions(+), 32 deletions(-) diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c index 64d67e13d1..de1c26d2e1 100644 --- a/common/utils/telnetsrv/telnetsrv.c +++ b/common/utils/telnetsrv/telnetsrv.c @@ -54,6 +54,7 @@ #include "common/utils/load_module_shlib.h" #include "common/config/config_userapi.h" #include "executables/softmodem-common.h" +#include "common/utils/threadPool/notified_fifo.h" #include #include "common/oai_version.h" diff --git a/executables/lte-ue.c b/executables/lte-ue.c index 74a2fa240b..41ce61f384 100644 --- a/executables/lte-ue.c +++ b/executables/lte-ue.c @@ -79,7 +79,7 @@ void *UE_thread(void *arg); int init_timer_thread(void); int tx_req_num_elems; -extern uint16_t sf_ahead; +extern int sf_ahead; //extern int tx_req_UE_MAC1(); void ue_stub_rx_handler(unsigned int, char *); diff --git a/executables/lte-uesoftmodem.c b/executables/lte-uesoftmodem.c index f039bc4479..0a4a4e8d0e 100644 --- a/executables/lte-uesoftmodem.c +++ b/executables/lte-uesoftmodem.c @@ -73,8 +73,7 @@ pthread_cond_t nfapi_sync_cond; pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex - -uint16_t sf_ahead=4; +int sf_ahead = 4; int tddflag; char *emul_iface; diff --git a/executables/main_ru.c b/executables/main_ru.c index 92db896cc3..86a26f9ac3 100644 --- a/executables/main_ru.c +++ b/executables/main_ru.c @@ -75,7 +75,7 @@ int sync_var=-1; //!< protected by mutex \ref sync_mutex. int config_sync_var=-1; int oai_exit = 0; -uint16_t sf_ahead = 4; +int sf_ahead = 4; RU_t ru_m; diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 6d0a2044ba..90d7e235de 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -69,7 +69,7 @@ static int DEFRUTPCORES[] = {-1,-1,-1,-1}; #include #include "executables/nr-softmodem-common.h" -uint16_t sl_ahead; +int sl_ahead; static void NRRCconfig_RU(configmodule_interface_t *cfg); /*************************************************************/ diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 503fcc0a76..0d29c3d576 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -98,7 +98,7 @@ nrUE_params_t nrUE_params = {0}; pthread_cond_t nfapi_sync_cond; pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex -uint16_t sf_ahead=6; //??? value ??? +int sf_ahead = 6; //??? value ??? pthread_cond_t sync_cond; pthread_mutex_t sync_mutex; int sync_var=-1; //!< protected by mutex \ref sync_mutex. diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 19d2f4f76f..e593a78210 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -31,11 +31,14 @@ */ #ifndef SOFTMODEM_COMMON_H #define SOFTMODEM_COMMON_H -#include "openair1/PHY/defs_common.h" #ifdef __cplusplus extern "C" { #endif + +#include +#include "common/config/config_load_configmodule.h" + /* help strings definition for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */ #define CONFIG_HLP_RFCFGF "Configuration file for front-end (e.g. LMS7002M)\n" #define CONFIG_HLP_SPLIT73 "Split 7.3 (below rate matching) option: ::\n" @@ -349,8 +352,9 @@ void set_softmodem_sighandler(void); extern uint64_t downlink_frequency[MAX_NUM_CCs][4]; extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; extern int usrp_tx_thread; -extern uint16_t sl_ahead; -extern uint16_t sf_ahead; +extern int sl_ahead; +extern int sf_ahead; +extern int oai_exit; void ru_tx_func(void *param); void configure_ru(void *, void *arg); diff --git a/nfapi/oai_integration/aerial/fapi_vnf_p5.c b/nfapi/oai_integration/aerial/fapi_vnf_p5.c index 1128559b1d..26c59c8301 100644 --- a/nfapi/oai_integration/aerial/fapi_vnf_p5.c +++ b/nfapi/oai_integration/aerial/fapi_vnf_p5.c @@ -38,9 +38,8 @@ extern RAN_CONTEXT_t RC; extern UL_RCC_IND_t UL_RCC_INFO; -extern uint16_t sf_ahead; -extern uint16_t slot_ahead; - +extern int sf_ahead; +extern int slot_ahead; void *aerial_vnf_nr_p7_config_init(void *ptr) { diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index c0a4622aa4..8880a5f315 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -2435,7 +2435,7 @@ void handle_nr_slot_ind(uint16_t sfn, uint16_t slot) { //send VNF slot indication, which is aligned with TX thread, so that it can call the scheduler nfapi_nr_slot_indication_scf_t *ind; ind = (nfapi_nr_slot_indication_scf_t *) malloc(sizeof(nfapi_nr_slot_indication_scf_t)); - uint8_t slot_ahead = 6; + int slot_ahead = 6; uint32_t sfn_slot_tx = sfnslot_add_slot(sfn, slot, slot_ahead); uint16_t sfn_tx = NFAPI_SFNSLOT2SFN(sfn_slot_tx); uint8_t slot_tx = NFAPI_SFNSLOT2SLOT(sfn_slot_tx); diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 76542d3587..9bc3c37452 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -230,7 +230,7 @@ int vnf_nr_unpack_vendor_extension_tlv(nfapi_tl_t *tl, } void install_nr_schedule_handlers(NR_IF_Module_t *if_inst); void install_schedule_handlers(IF_Module_t *if_inst); -extern uint16_t sf_ahead; +extern int sf_ahead; void oai_create_enb(void) { int bodge_counter=0; diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c index a7f0385d9e..4232bb27de 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c +++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c @@ -31,9 +31,7 @@ #define FAPI2_IP_DSCP 0 -extern uint16_t sf_ahead; - -//uint16_t sf_ahead=4; +extern int sf_ahead; void add_slot(uint16_t *frameP, uint16_t *slotP, int offset) { diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index 02eff79320..b0b447e087 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -60,8 +60,7 @@ //#include #include "time_meas.h" #include "common/platform_types.h" -#include "common/ran_context.h" -#include "nr-softmodem-common.h" +#include "softmodem-common.h" #define MAX_NUM_RU_PER_eNB 64 #include diff --git a/openair1/SCHED/nfapi_lte_dummy.c b/openair1/SCHED/nfapi_lte_dummy.c index 14b4f514be..6856d85806 100644 --- a/openair1/SCHED/nfapi_lte_dummy.c +++ b/openair1/SCHED/nfapi_lte_dummy.c @@ -22,7 +22,7 @@ void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx, } int l1_north_init_gNB(void){return 0;} -uint8_t slot_ahead=6; +int slot_ahead = 6; //uint8_t nfapi_mode=0; NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return NULL;} diff --git a/openair1/SCHED/nfapi_nr_dummy.c b/openair1/SCHED/nfapi_nr_dummy.c index ce10797fea..9c9ecea443 100644 --- a/openair1/SCHED/nfapi_nr_dummy.c +++ b/openair1/SCHED/nfapi_nr_dummy.c @@ -22,7 +22,7 @@ void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx, } int l1_north_init_gNB(void){return 0;} -uint8_t slot_ahead=6; +int slot_ahead = 6; //uint8_t nfapi_mode=0; NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return NULL;} diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index b34042a771..95a5b9ea64 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -107,7 +107,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; double cpuf; char *uecap_file; -uint16_t sl_ahead=0; +int sl_ahead = 0; //uint8_t nfapi_mode = 0; uint64_t downlink_frequency[MAX_NUM_CCs][4]; THREAD_STRUCT thread_struct; diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index b61de2082e..5eab1c6974 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -83,7 +83,7 @@ openair0_config_t openair0_cfg[MAX_CARDS]; //uint8_t nfapi_mode=0; uint64_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; -uint16_t sl_ahead = 0; +int sl_ahead = 0; uint32_t N_RB_DL = 106; NR_IF_Module_t *NR_IF_Module_init(int Mod_id) { return (NULL); } diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index bdeab5a139..a778795aa4 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -106,9 +106,9 @@ RAN_CONTEXT_t RC; char *uecap_file; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; -uint16_t sf_ahead=4 ; +int sf_ahead = 4; int slot_ahead=6 ; -uint16_t sl_ahead=0; +int sl_ahead = 0; double cpuf; //uint8_t nfapi_mode = 0; uint64_t downlink_frequency[MAX_NUM_CCs][4]; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 7b1e7ec4f9..45a9fdb484 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -52,7 +52,6 @@ #ifdef PHY_TX_THREAD extern volatile int16_t phy_tx_txdataF_end; - extern int oai_exit; #endif extern uint16_t sfnsf_add_subframe(uint16_t frameP, uint16_t subframeP, int offset); extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index edf0f8c25e..74eb045be1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -48,7 +48,6 @@ #include extern RAN_CONTEXT_t RC; extern const uint8_t nr_slots_per_frame[5]; -extern uint16_t sl_ahead; // forward declaration of functions used in this file static void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 2c51ee5f21..f9fb502338 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -3021,7 +3021,7 @@ int nr_mac_get_reconfig_delay_slots(NR_SubcarrierSpacing_t scs) /* we previously assumed a specific "slot ahead" value for the PHY processing * time. However, we cannot always know it (e.g., third-party PHY), so simply * assume a tentative worst-case slot processing time */ - const uint16_t sl_ahead = 10; + const int sl_ahead = 10; /* 16ms seems to be the most common: See 38.331 Tab 12.1-1 */ int delay_ms = NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS; return (delay_ms << scs) + sl_ahead; diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index af82d6093d..3c0640cd5e 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -74,7 +74,7 @@ extern nfapi_tx_request_pdu_t* tx_request_pdu[1023][NUM_NFAPI_SUBFRAME][10]; //T //extern int timer_frame; extern UE_RRC_INST *UE_rrc_inst; -extern uint16_t sf_ahead; +extern int sf_ahead; static eth_params_t stub_eth_params; void Msg1_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); diff --git a/radio/ETHERNET/benetel/4g/benetel.c b/radio/ETHERNET/benetel/4g/benetel.c index 410a643089..8e221fe929 100644 --- a/radio/ETHERNET/benetel/4g/benetel.c +++ b/radio/ETHERNET/benetel/4g/benetel.c @@ -243,7 +243,7 @@ next: //printf("BENETEL: %s (f.sf %d.%d)\n", __FUNCTION__, *frame, *subframe); RU_proc_t *proc = &ru->proc; - extern uint16_t sf_ahead; + extern int sf_ahead; int f = *frame; int sf = *subframe; diff --git a/radio/ETHERNET/benetel/5g/benetel.c b/radio/ETHERNET/benetel/5g/benetel.c index 79a9109868..90fce2e206 100644 --- a/radio/ETHERNET/benetel/5g/benetel.c +++ b/radio/ETHERNET/benetel/5g/benetel.c @@ -257,7 +257,7 @@ printf("rxdata in benetel_fh_if4p5_south_in %p\n", &ru->common.rxdataF[antenna][ //printf("BENETEL: %s (f.sf %d.%d)\n", __FUNCTION__, *frame, *slot); RU_proc_t *proc = &ru->proc; - extern uint16_t sl_ahead; + extern int sl_ahead; int f = *frame; int sl = *slot; diff --git a/radio/fhi_72/oran_isolate.c b/radio/fhi_72/oran_isolate.c index cb48569989..f922df40bb 100644 --- a/radio/fhi_72/oran_isolate.c +++ b/radio/fhi_72/oran_isolate.c @@ -203,7 +203,7 @@ void oran_fh_if4p5_south_in(RU_t *ru, int *frame, int *slot) ru_info.prach_buf = ru->prach_rxsigF[0]; // index: [prach_oca][ant_id] RU_proc_t *proc = &ru->proc; - extern uint16_t sl_ahead; + extern int sl_ahead; int f, sl; LOG_D(PHY, "Read rxdataF %p,%p\n", ru_info.rxdataF[0], ru_info.rxdataF[1]); start_meas(&ru->rx_fhaul);