From 75ad3da9d978c9101baf7cec3041308b4f2cb457 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Thu, 21 Jan 2021 15:51:30 +0100 Subject: [PATCH 01/66] start new gtpu --- cmake_targets/CMakeLists.txt | 43 +- common/utils/msc/msc.h | 2 +- common/utils/ocp_itti/intertask_interface.h | 1 + executables/main-ocp.c | 1 - executables/nr-ru.c | 1 - executables/nr-softmodem.c | 1 - executables/nr-uesoftmodem.c | 1 - executables/ocp-gnb.c | 1 - executables/softmodem-common.c | 2 + executables/softmodem-common.h | 3 + openair1/PHY/TOOLS/time_meas.c | 1 + openair1/PHY/TOOLS/time_meas.h | 2 +- openair1/SIMULATION/NR_PHY/prachsim.c | 1 + openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h | 2 - openair2/LAYER2/RLC/rlc.c | 2 + openair2/LAYER2/RLC/rlc.h | 12 +- openair2/NETWORK_DRIVER/MESH/device.c | 4 + openair2/NETWORK_DRIVER/UE_IP/device.c | 4 + openair2/RRC/LTE/rrc_eNB.c | 1 + openair2/RRC/LTE/rrc_eNB_GTPV1U.c | 18 +- openair2/RRC/LTE/rrc_eNB_S1AP.c | 3 +- openair2/SIMULATION/NR_RRC/itti_sim.c | 1 - openair3/ocp-gtpu/gtp_itf.cpp | 623 +++++++++++++++++++ openair3/ocp-gtpu/gtp_itf.h | 49 ++ targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 2 +- targets/COMMON/create_tasks.c | 1 + targets/COMMON/create_tasks_mbms.c | 1 + targets/RT/USER/lte-softmodem.c | 1 - targets/RT/USER/lte-uesoftmodem.c | 1 - 29 files changed, 734 insertions(+), 51 deletions(-) create mode 100644 openair3/ocp-gtpu/gtp_itf.cpp create mode 100644 openair3/ocp-gtpu/gtp_itf.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 0b9d925017..0e13d14f0b 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -405,6 +405,7 @@ add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace") add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace") add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering") +add_boolean_option(NEW_GTPU False "NEW_GTP") set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti) add_library(ITTI @@ -413,7 +414,6 @@ add_library(ITTI ) add_dependencies(ITTI rrc_flag) set(ITTI_LIB ITTI) - set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c) ################################################## @@ -2217,15 +2217,19 @@ set (GTPV1U_SRC add_library(GTPV1U ${GTPV1U_SRC}) add_dependencies(GTPV1U rrc_flag) -#add_library (GTPV1U_OCP -#${OPENAIR3_DIR}/ocp-gtp/gtp_itf.cpp -#) -#include_directories(${OPENAIR3_DIR}/ocp-gtp) +add_library (GTPV1U_OCP + ${NR_RRC_DIR}/rrc_gNB_GTPV1U.c + ${RRC_DIR}/rrc_eNB_GTPV1U.c +${OPENAIR3_DIR}/ocp-gtpu/gtp_itf.cpp +) +add_dependencies(GTPV1U_OCP rrc_flag) +include_directories(${OPENAIR3_DIR}/ocp-gtp) #NR case set (NR_GTPV1U_SRC ${NR_RRC_DIR}/rrc_gNB_GTPV1U.c ${RRC_DIR}/rrc_eNB_GTPV1U.c + ${GTPV1U_DIR}/gtpv1u_eNB.c ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c @@ -2235,6 +2239,12 @@ set (NR_GTPV1U_SRC add_library(NR_GTPV1U ${NR_GTPV1U_SRC}) add_dependencies(NR_GTPV1U rrc_flag) +if (${NEW_GTPU}) +set(GTPV1U GTPV1U_OCP) +else() +set(GTPV1U NR_GTPV1U) +endif() + set (MME_APP_SRC ${OPENAIR3_DIR}/MME_APP/mme_app.c ${OPENAIR3_DIR}/MME_APP/mme_config.c @@ -2864,7 +2874,6 @@ add_executable(lte-softmodem ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c - ${GTPU_need_ITTI} ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} @@ -2874,7 +2883,7 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer) target_link_libraries (lte-softmodem -Wl,--start-group - RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB + RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB ${GTPV1U} SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} -Wl,--end-group z dl) @@ -2905,7 +2914,6 @@ add_executable(ocp-enb ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c - ${GTPU_need_ITTI} ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} @@ -2915,7 +2923,7 @@ add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer coding params_l target_link_libraries (ocp-enb -Wl,--start-group - RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB + RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB ${GTPV1U} SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} -Wl,--end-group z dl) @@ -2985,7 +2993,7 @@ endif() target_link_libraries (lte-uesoftmodem -Wl,--start-group RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP F1AP_LIB - GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON + ${GTPV1U} SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES} -Wl,--end-group z dl) @@ -3018,7 +3026,6 @@ add_executable(nr-softmodem ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c - ${GTPU_need_ITTI} ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} @@ -3027,7 +3034,7 @@ add_executable(nr-softmodem target_link_libraries (nr-softmodem -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA + UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS ${GTPV1U} SECU_CN SECU_OSA ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} @@ -3057,7 +3064,6 @@ add_executable(ocp-gnb ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c - ${GTPU_need_ITTI} ${XFORMS_SOURCE_NR} ${T_SOURCE} ${CONFIG_SOURCES} @@ -3067,7 +3073,7 @@ add_executable(ocp-gnb target_link_libraries (ocp-gnb -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA + UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS ${GTPV1U} SECU_CN SECU_OSA ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON @@ -3371,7 +3377,7 @@ add_executable(test_epc_generate_scenario ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h ) target_link_libraries (test_epc_generate_scenario - -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} + -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP ${GTPV1U} LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ) add_executable(test_epc_play_scenario @@ -3390,7 +3396,7 @@ add_executable(test_epc_play_scenario ) target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c) target_link_libraries (test_epc_play_scenario - -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} + -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP ${GTPV1U} LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ) @@ -3436,7 +3442,7 @@ if (${T_TRACER}) NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_NR MAC_UE_NR NGAP_GNB - CN_UTILS GTPV1U NR_GTPV1U SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB + CN_UTILS ${GTPV1U} SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts) if (TARGET ${i}) add_dependencies(${i} generate_T) @@ -3534,7 +3540,6 @@ add_executable(nr-ittisim ${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c - ${GTPU_need_ITTI} ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} @@ -3543,7 +3548,7 @@ add_executable(nr-ittisim target_link_libraries (nr-ittisim -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA + UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS ${GTPV1U} SECU_CN SECU_OSA ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_SIM_LIB} RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} diff --git a/common/utils/msc/msc.h b/common/utils/msc/msc.h index b218d58e3d..68b05ffce3 100644 --- a/common/utils/msc/msc.h +++ b/common/utils/msc/msc.h @@ -115,7 +115,7 @@ void msc_log_message( #define MESSAGE_CHART_GENERATOR msc_interface.msc_loaded -msc_interface_t msc_interface; +extern msc_interface_t msc_interface; #define MSC_INIT(arg1,arg2) if(msc_interface.msc_loaded) msc_interface.msc_init(arg1,arg2) #define MSC_START_USE if(msc_interface.msc_loaded) msc_interface.msc_start_use #define MSC_END if(msc_interface.msc_loaded) msc_interface.msc_end diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index a40660eb9e..140340bacd 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -341,6 +341,7 @@ void * rrc_enb_process_msg(void*); TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200, NULL, NULL)\ TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\ + TASK_DEF(OCP_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\ TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000, NULL, NULL)\ TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \ diff --git a/executables/main-ocp.c b/executables/main-ocp.c index 6e5857d6d1..e6ce40e808 100644 --- a/executables/main-ocp.c +++ b/executables/main-ocp.c @@ -78,7 +78,6 @@ int otg_enabled; uint64_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int split73; -int usrp_tx_thread = 0; char * split73_config; int split73; AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]= {0}; diff --git a/executables/nr-ru.c b/executables/nr-ru.c index feff0c29c2..3a90edbf20 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -118,7 +118,6 @@ uint16_t sl_ahead; extern int emulate_rf; extern int numerology; -extern int usrp_tx_thread; /*************************************************************/ /* Functions to attach and configure RRU */ diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index fb757a9f47..a46e65624a 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -181,7 +181,6 @@ extern void *udp_eNB_task(void *args_p); int transmission_mode=1; int emulate_rf = 0; int numerology = 0; -int usrp_tx_thread = 0; static char *parallel_config = NULL; diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 1d3288862d..052fb561a0 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -155,7 +155,6 @@ int card_offset = 0; uint64_t num_missed_slots = 0; // counter for the number of missed slots int transmission_mode = 1; int numerology = 0; -int usrp_tx_thread = 0; int oaisim_flag = 0; int emulate_rf = 0; diff --git a/executables/ocp-gnb.c b/executables/ocp-gnb.c index 67f68f43e3..db416d1487 100644 --- a/executables/ocp-gnb.c +++ b/executables/ocp-gnb.c @@ -70,7 +70,6 @@ uint32_t timing_advance = 0; int transmission_mode=1; int emulate_rf = 0; int numerology = 0; -int usrp_tx_thread = 0; int config_sync_var=-1; diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index 04a58413b5..b88fe29956 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -43,6 +43,8 @@ static softmodem_params_t softmodem_params; char *parallel_config=NULL; char *worker_config=NULL; +msc_interface_t msc_interface; +int usrp_tx_thread = 0; static mapping softmodem_funcs[] = MAPPING_SOFTMODEM_FUNCTIONS; diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index f8e9b0959f..51f14f218c 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -90,6 +90,7 @@ extern "C" #define CONFIG_HLP_RFSIM "Run in rf simulator mode (also known as basic simulator)\n" #define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n" #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" +#define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n" /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ /* command line parameters common to eNodeB and UE */ @@ -113,6 +114,7 @@ extern "C" #define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat"; +extern int usrp_tx_thread; #define CMDLINE_PARAMS_DESC { \ {"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)},\ {"split73", CONFIG_HLP_SPLIT73, 0, strptr:(char **)&SPLIT73, defstrval:NULL, TYPE_STRING, sizeof(SPLIT73)},\ @@ -139,6 +141,7 @@ extern "C" {"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \ {"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \ {"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \ + {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \ } diff --git a/openair1/PHY/TOOLS/time_meas.c b/openair1/PHY/TOOLS/time_meas.c index cfa3b93007..37cb93e96b 100644 --- a/openair1/PHY/TOOLS/time_meas.c +++ b/openair1/PHY/TOOLS/time_meas.c @@ -26,6 +26,7 @@ // global var for openair performance profiler int opp_enabled = 0; +double cpu_freq_GHz __attribute__ ((aligned(32))); double get_cpu_freq_GHz(void) { diff --git a/openair1/PHY/TOOLS/time_meas.h b/openair1/PHY/TOOLS/time_meas.h index 2deab40f27..e2ceef8405 100644 --- a/openair1/PHY/TOOLS/time_meas.h +++ b/openair1/PHY/TOOLS/time_meas.h @@ -33,7 +33,7 @@ #include // global var to enable openair performance profiler extern int opp_enabled; -double cpu_freq_GHz __attribute__ ((aligned(32)));; +extern double cpu_freq_GHz __attribute__ ((aligned(32)));; #if defined(__x86_64__) || defined(__i386__) typedef struct { diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 1f4db3138a..324a70fb37 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -68,6 +68,7 @@ int sl_ahead = 0; //void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe); /* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */ +msc_interface_t msc_interface; uint64_t get_softmodem_optmask(void) {return 0;} softmodem_params_t *get_softmodem_params(void) {return 0;} diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h index 6da464aa28..bfde1b31f3 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h @@ -21,8 +21,6 @@ # ifndef __RLC_UM_TEST_H__ # define __RLC_UM_TEST_H__ -rlc_um_entity_t um_tx; -rlc_um_entity_t um_rx; void rlc_um_v9_3_0_test_windows_5(void); void rlc_um_v9_3_0_test_windows_10(void); diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 98c8c3e252..84a9cb57bd 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -52,6 +52,8 @@ extern boolean_t pdcp_data_ind( //#define TRACE_RLC_PAYLOAD 1 #define DEBUG_RLC_DATA_REQ 1 +logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ //----------------------------------------------------------------------------- void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, const signed long sizeP) //----------------------------------------------------------------------------- diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index 7e4920a579..3a37723f53 100644 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -133,13 +133,13 @@ typedef struct { #define RLC_MAX_MBMS_LC (LTE_maxSessionPerPMCH * LTE_maxServiceCount) #define RLC_MAX_LC ((max_val_LTE_DRB_Identity+1)* MAX_MOBILES_PER_ENB) -void (*rlc_rrc_data_ind)( +extern void (*rlc_rrc_data_ind)( const protocol_ctxt_t *const ctxtP, const rb_id_t rb_idP, const sdu_size_t sdu_sizeP, const uint8_t *const sduP) __attribute__ ((aligned(32))); -void (*rlc_rrc_data_conf)( +extern void (*rlc_rrc_data_conf)( const protocol_ctxt_t *const ctxtP, const rb_id_t rb_idP, const mui_t muiP, @@ -184,8 +184,8 @@ typedef struct rlc_mbms_id_s { //rlc_mbms_t rlc_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h //rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +extern rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +extern rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h #define rlc_mbms_enb_get_lcid_by_rb_id(Enb_mOD,rB_iD) rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD] ; @@ -201,8 +201,6 @@ rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_ rlc_mbms_rbid2lcid_ue[uE_mOD][rB_iD] = lOG_cH_iD; \ } while (0); -logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ -logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ #define RLC_COLL_KEY_VALUE(eNB_iD, rNTI, iS_eNB, rB_iD, iS_sRB) \ @@ -250,7 +248,7 @@ logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; (((hash_key_t)(sESSION_ID)) << 37) | \ (((hash_key_t)(0x0000000000000001)) << 63)) -hash_table_t *rlc_coll_p __attribute__ ((aligned(32))); +extern hash_table_t *rlc_coll_p __attribute__ ((aligned(32))); /*! \fn tbs_size_t mac_rlc_serialize_tb (char* bufferP, list_t transport_blocksP) * \brief Serialize a list of transport blocks coming from RLC in order to be processed by MAC. diff --git a/openair2/NETWORK_DRIVER/MESH/device.c b/openair2/NETWORK_DRIVER/MESH/device.c index 5690b9b153..181899cd6e 100644 --- a/openair2/NETWORK_DRIVER/MESH/device.c +++ b/openair2/NETWORK_DRIVER/MESH/device.c @@ -297,7 +297,11 @@ int nas_change_mtu(struct net_device *dev, int mtu) } //--------------------------------------------------------------------------- +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,7,0) void nas_tx_timeout(struct net_device *dev) +#else +void nas_tx_timeout(struct net_device *dev, unsigned int x) +#endif { //--------------------------------------------------------------------------- // Transmitter timeout, serious problems. diff --git a/openair2/NETWORK_DRIVER/UE_IP/device.c b/openair2/NETWORK_DRIVER/UE_IP/device.c index 32f9442747..e3c0f92ec7 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/device.c +++ b/openair2/NETWORK_DRIVER/UE_IP/device.c @@ -302,7 +302,11 @@ void ue_ip_change_rx_flags(struct net_device *dev_pP, int flagsP) { } //--------------------------------------------------------------------------- +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,7,0) void ue_ip_tx_timeout(struct net_device *dev_pP) { +#else +void ue_ip_tx_timeout(struct net_device *dev_pP, unsigned int x) { +#endif //--------------------------------------------------------------------------- // Transmitter timeout, serious problems. ue_ip_priv_t *priv_p = netdev_priv(dev_pP); diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 18b7173a08..2564983d47 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -87,6 +87,7 @@ #include "pdcp.h" #include "gtpv1u_eNB_task.h" +#include #include "intertask_interface.h" diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c index 5c25d2dbcf..6111bec6a5 100644 --- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c @@ -40,6 +40,7 @@ # include "common/ran_context.h" +#include extern RAN_CONTEXT_t RC; @@ -181,21 +182,16 @@ void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ( LOG_W(RRC, "[eNB] In %s: invalid UE\n", __func__); return; } + gtpv1u_enb_delete_tunnel_req_t tmp={0}; - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL, 0, - "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", - ue_context_pP->ue_context.eNB_ue_s1ap_id); - - MessageDef *msg = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); - memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg))); - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).rnti = ue_context_pP->ue_context.rnti; - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).from_gnb = 0; - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).num_erab = ue_context_pP->ue_context.nb_of_e_rabs; + tmp.rnti = ue_context_pP->ue_context.rnti; + tmp.from_gnb = 0; + tmp.num_erab = ue_context_pP->ue_context.nb_of_e_rabs; for (int e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_e_rabs; e_rab++) { const rb_id_t gtp_ebi = ue_context_pP->ue_context.enb_gtp_ebi[e_rab]; - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).eps_bearer_id[e_rab] = gtp_ebi; + tmp.eps_bearer_id[e_rab] = gtp_ebi; } - itti_send_msg_to_task(TASK_GTPV1_U, ENB_MODULE_ID_TO_INSTANCE(enb_mod_idP), msg); + gtpv1u_delete_s1u_tunnel(enb_mod_idP,&tmp); } diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 4be9a50b32..9edfa50f12 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -48,11 +48,12 @@ #include "pdcp_primitives.h" #include "UTIL/OSA/osa_defs.h" -#include "msc.h" +#include #include "LTE_UERadioAccessCapabilityInformation.h" #include "gtpv1u_eNB_task.h" +#include #include "RRC/LTE/rrc_eNB_GTPV1U.h" #include "TLVDecoder.h" diff --git a/openair2/SIMULATION/NR_RRC/itti_sim.c b/openair2/SIMULATION/NR_RRC/itti_sim.c index d9352f2d0a..86779e0ad9 100644 --- a/openair2/SIMULATION/NR_RRC/itti_sim.c +++ b/openair2/SIMULATION/NR_RRC/itti_sim.c @@ -148,7 +148,6 @@ extern void *udp_eNB_task(void *args_p); int transmission_mode=1; int emulate_rf = 0; int numerology = 0; -int usrp_tx_thread = 0; double cpuf; diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp new file mode 100644 index 0000000000..5a5717c726 --- /dev/null +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -0,0 +1,623 @@ +#include +#include +#include +#include +#include + +#include +#include +#include "common/utils/LOG/log.h" +#include +#include +#include +//#include +#include +using namespace std; + +#pragma pack(1) + +typedef struct Gtpv1uMsgHeader { + uint8_t PN:1; + uint8_t S:1; + uint8_t E:1; + uint8_t spare:1; + uint8_t PT:1; + uint8_t version:3; + uint8_t msgType; + uint16_t msgLength; + uint32_t teid; +} __attribute__((packed)) Gtpv1uMsgHeaderT; + +#pragma pack() + + // TS 29.060, table 7.1 defines the possible message types + // here are all the possible messages (3GPP R16) +#define GTP_ECHO_REQ (1) +#define GTP_ECHO_RSP (2) +#define GTP_ERROR_INDICATION (26) +#define GTP_SUPPORTED_EXTENSION_HEADER_INDICATION (31) +#define GTP_END_MARKER (254) +#define GTP_GPDU (255) + + +typedef struct ocp_gtpv1u_bearer_s { + /* TEID used in dl and ul */ + teid_t teid_incoming; ///< eNB TEID + teid_t teid_outgoing; ///< Remote TEID + in_addr_t outgoing_ip_addr; + struct in6_addr outgoing_ip6_addr; + tcp_udp_port_t outgoing_port; + uint16_t seqNum; + uint8_t npduNum; +} ocp_gtpv1u_bearer_t; + +typedef struct { + map bearers; +} teidData_t; + +typedef struct { + rnti_t rnti; +} rntiData_t; + +class gtpEndPoint { + public: + openAddr_t addr; + map ue2te_mapping; + map te2ue_mapping; +}; + +class gtpEndPoints { + public: + pthread_mutex_t gtp_lock=PTHREAD_MUTEX_INITIALIZER; + // the instance id will be the Linux socket handler, as this is uniq + map instances; +}; + +gtpEndPoints globGtp; + +#ifdef __cplusplus +extern "C" { +#endif + +static uint32_t gtpv1uNewTeid(void) { +#ifdef GTPV1U_LINEAR_TEID_ALLOCATION + g_gtpv1u_teid = g_gtpv1u_teid + 1; + return g_gtpv1u_teid; +#else + return random() + random() % (RAND_MAX - 1) + 1; +#endif +} + + +#define GTPV1U_HEADER_SIZE (8) +static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, uint32_t teid, uint8_t *Msg,int msgLen, + bool seqNumFlag, bool npduNumFlag, bool extHdrFlag, int seqNum, int npduNum, int extHdrType) { + AssertFatal(extHdrFlag==false,"Not developped"); + int headerAdditional=0; + + if ( seqNumFlag || npduNumFlag || extHdrFlag) + headerAdditional=4; + + uint8_t *buffer; + int fullSize=GTPV1U_HEADER_SIZE+headerAdditional+msgLen; + AssertFatal((buffer=(uint8_t *) malloc(fullSize)) != NULL, ""); + Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *)buffer ; + msgHdr->PN=npduNumFlag; + msgHdr->S=seqNumFlag; + msgHdr->E=extHdrFlag; + msgHdr->spare=0; + msgHdr->PT=1; + msgHdr->version=1; + msgHdr->msgType=GTP_GPDU; + msgHdr->msgLength=htons(msgLen); + msgHdr->teid=htonl(teid); + + if(seqNumFlag || extHdrFlag || npduNumFlag) { + *((uint16_t *) (buffer+8)) = seqNumFlag ? htons(seqNum) : 0x0000; + *((uint8_t *) (buffer+10)) = npduNumFlag ? htons(npduNum) : 0x00; + *((uint8_t *) (buffer+11)) = extHdrFlag ? htons(extHdrType) : 0x00; + } + + memcpy(buffer+GTPV1U_HEADER_SIZE+headerAdditional, Msg, msgLen); + static struct sockaddr_in to= {0}; + to.sin_family = AF_INET; + to.sin_port = htons(peerPort); + to.sin_addr.s_addr = peerIp ; + LOG_D(GTPU,"sending packet size: %d to %s\n",fullSize, inet_ntoa(to.sin_addr) ); + + if (sendto(h, (void *)buffer, (size_t)fullSize, 0,(struct sockaddr *)&to, sizeof(to) ) != fullSize ) { + LOG_E(GTPU, + "[SD %d] Failed to send data to " IPV4_ADDR " on port %d, buffer size %u\n", + h, IPV4_ADDR_FORMAT(peerIp), peerPort, fullSize); + free(buffer); + return GTPNOK; + } + + free(buffer); + return !GTPNOK; +} + +static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, bool seqNumFlag, bool npduNumFlag) { + uint8_t *buffer=req->buffer+req->offset; + size_t length=req->length; + uint64_t rnti=req->rnti; + int rab_id=req->rab_id; + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[instance]; + auto ptrRnti=inst->ue2te_mapping.find(rnti); + + if ( ptrRnti==inst->ue2te_mapping.end() ) { + LOG_E(GTPU, "Gtpv1uProcessUlpReq failed: while getting ue rnti %lx in hashtable ue_mapping\n", rnti); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; + } + + auto ptr=ptrRnti->second.bearers; + + if ( ptr.find(rab_id) == ptr.end() ) { + LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %lx/%x\n", rnti, rab_id); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; + } else + LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %lx/%x/%x, len %lu, oldseq %d, oldnum %d\n", + rnti, rab_id,ptr[rab_id].teid_outgoing,length, ptr[rab_id].seqNum,ptr[rab_id].npduNum ); + + if(seqNumFlag) + ptr[rab_id].seqNum++; + + if(npduNumFlag) + ptr[rab_id].npduNum++; + + pthread_mutex_unlock(&globGtp.gtp_lock); + gtpv1uCreateAndSendMsg(instance, + ptr[rab_id].outgoing_ip_addr, + ptr[rab_id].outgoing_port, + ptr[rab_id].teid_outgoing, + buffer, length, false, false, false, ptr[rab_id].seqNum, ptr[rab_id].npduNum, 0) ; +} + +static int udpServerSocket(openAddr_s addr) { + LOG_I(GTPU, "Initializing UDP for local address %s with port %s\n", addr.originHost, addr.originService); + int status; + struct addrinfo hints= {0}, *servinfo, *p; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_PASSIVE; + + if ((status = getaddrinfo(addr.originHost, addr.originService, &hints, &servinfo)) != 0) { + LOG_E(GTPU,"getaddrinfo error: %s\n", gai_strerror(status)); + return -1; + } + + int sockfd=-1; + + // loop through all the results and bind to the first we can + for(p = servinfo; p != NULL; p = p->ai_next) { + if ((sockfd = socket(p->ai_family, p->ai_socktype, + p->ai_protocol)) == -1) { + LOG_W(GTPU,"socket: %s\n", strerror(errno)); + continue; + } + + if (bind(sockfd, p->ai_addr, p->ai_addrlen) == -1) { + close(sockfd); + LOG_W(GTPU,"bind: %s\n", strerror(errno)); + continue; + } + + break; // if we get here, we must have connected successfully + } + + if (p == NULL) { + // looped off the end of the list with no successful bind + LOG_E(GTPU,"failed to bind socket: %s %s \n", addr.originHost, addr.originService); + return -1; + } + + freeaddrinfo(servinfo); // all done with this structure + int sendbuff = 1000*1000*10; + AssertFatal(0==setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &sendbuff, sizeof(sendbuff)),""); + LOG_D(GTPU,"Created listener for paquets to: %s:%s, send buffer size: %d\n", addr.originHost, addr.originService,sendbuff); + return sockfd; +} + +instance_t ocp_gtpv1Init(openAddr_t context) { + pthread_mutex_lock(&globGtp.gtp_lock); + int id=udpServerSocket(context); + + if (id>=0) { + globGtp.instances[id].addr=context; + itti_subscribe_event_fd(OCP_GTPV1_U, id); + } else + LOG_E(GTPU,"can't create GTP-U instance\n"); + + pthread_mutex_unlock(&globGtp.gtp_lock); + + return id; +} + +int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, + const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, + gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { + LOG_D(GTPU, "Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %d\n", + create_tunnel_req->rnti, + create_tunnel_req->num_tunnels, + create_tunnel_req->sgw_S1u_teid[0]); + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[instance]; + auto it=inst->ue2te_mapping.find(create_tunnel_req->rnti); + + if ( it != inst->ue2te_mapping.end() ) { + LOG_W(GTPU,"Create a config for a already existing GTP tunnel (rnti %x)\n", create_tunnel_req->rnti); + inst->ue2te_mapping.erase(it); + } + + rntiData_t rntiData= {create_tunnel_req->rnti}; + + for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { + ocp_gtpv1u_bearer_t gtpv1u_ue_data; + uint32_t s1u_teid=gtpv1uNewTeid(); + + while ( inst->te2ue_mapping.find(s1u_teid) != inst->te2ue_mapping.end() ) { + LOG_W(GTPU, "generated a random Teid that exists, re-generating (%u)\n",s1u_teid); + s1u_teid=gtpv1uNewTeid(); + }; + + inst->te2ue_mapping[s1u_teid]=rntiData; + + int addrs_length_in_bytes = create_tunnel_req->sgw_addr[i].length / 8; + + switch (addrs_length_in_bytes) { + case 4: + memcpy(>pv1u_ue_data.outgoing_ip_addr,create_tunnel_req->sgw_addr[i].buffer,4); + break; + + case 16: + memcpy(>pv1u_ue_data.outgoing_ip6_addr.s6_addr, + create_tunnel_req->sgw_addr[i].buffer, + 16); + break; + + case 20: + memcpy(>pv1u_ue_data.outgoing_ip_addr,create_tunnel_req->sgw_addr[i].buffer,4); + memcpy(>pv1u_ue_data.outgoing_ip6_addr.s6_addr, + create_tunnel_req->sgw_addr[i].buffer+4, + 16); + + default: + AssertFatal(false, "SGW Address size impossible"); + } + + gtpv1u_ue_data.teid_incoming = s1u_teid; + gtpv1u_ue_data.outgoing_port=2152; + gtpv1u_ue_data.teid_outgoing= create_tunnel_req->sgw_S1u_teid[i]; + inst->ue2te_mapping[create_tunnel_req->rnti].bearers[create_tunnel_req->eps_bearer_id[i]]=gtpv1u_ue_data; + LOG_D(GTPU, "Created tunnel %x for RNTI %x, SGW: " IPV4_ADDR ":%d\n", + s1u_teid, create_tunnel_req->rnti, + IPV4_ADDR_FORMAT(inst->ue2te_mapping[create_tunnel_req->rnti].bearers[create_tunnel_req->eps_bearer_id[i]].outgoing_ip_addr), + inst->ue2te_mapping[create_tunnel_req->rnti].bearers[create_tunnel_req->eps_bearer_id[i]].outgoing_port ); + create_tunnel_resp->status=0; + create_tunnel_resp->rnti=create_tunnel_req->rnti; + create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels; + create_tunnel_resp->enb_S1u_teid[i]=gtpv1u_ue_data.teid_incoming; + create_tunnel_resp->eps_bearer_id[i] = create_tunnel_req->eps_bearer_id[i]; + //TBD: fix me this is quite bad, for IPv4 only and + // Overcomplex stuff to fill InitialContextSetupResponse in S1AP + int status; + struct addrinfo hints= {0}, *servinfo, *p; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_PASSIVE; + openAddr_t *addr=&globGtp.instances[instance].addr; + + if ((status = getaddrinfo(addr->originHost, addr->originService, &hints, &servinfo)) != 0) { + LOG_E(GTPU,"getaddrinfo error: %s\n", gai_strerror(status)); + pthread_mutex_unlock(&globGtp.gtp_lock); + return -1; + } + + // TBD: we take the first IPv4 addr, but it should be coded in the right way + for(p = servinfo; p != NULL; p = p->ai_next) + if (p->ai_family == AF_INET) { + struct sockaddr_in *ipv4P=(struct sockaddr_in *)p->ai_addr; + memcpy(create_tunnel_resp->enb_addr.buffer, + &ipv4P->sin_addr.s_addr, sizeof(ipv4P->sin_addr.s_addr)); + create_tunnel_resp->enb_addr.length = sizeof(ipv4P->sin_addr.s_addr); + break; + } + + if ( p == NULL ) + LOG_E(GTPU,"can't translate IP address string: %s\n",addr->originHost); + + freeaddrinfo(servinfo); // all done with this structure + } + + pthread_mutex_unlock(&globGtp.gtp_lock); + return !GTPNOK; +} + +int ocp_gtpv1u_update_s1u_tunnel( + const instance_t instance, + const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req, + const rnti_t prior_rnti +) { + LOG_D(GTPU, "Start update tunnels for old RNTI %x, new RNTI %x, num_tunnels %d, sgw_S1u_teid %d, eps_bearer_id %d\n", + prior_rnti, + create_tunnel_req->rnti, + create_tunnel_req->num_tunnels, + create_tunnel_req->sgw_S1u_teid[0], + create_tunnel_req->eps_bearer_id[0]); + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[instance]; + + if ( inst->ue2te_mapping.find(create_tunnel_req->rnti) != inst->ue2te_mapping.end() ) { + LOG_E(GTPU,"Update a existing GTP tunnel to a already existing tunnel (new rnti %x, old rnti %x)\n", create_tunnel_req->rnti, prior_rnti); + } + + auto it=inst->ue2te_mapping.find(prior_rnti); + + if ( it != inst->ue2te_mapping.end() ) { + LOG_W(GTPU,"Update a not existing tunnel, start create the new one (new rnti %x, old rnti %x)\n", create_tunnel_req->rnti, prior_rnti); + gtpv1u_enb_create_tunnel_resp_t tmp; + (void)ocp_gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp); + pthread_mutex_unlock(&globGtp.gtp_lock); + return 0; + } + + inst->ue2te_mapping[create_tunnel_req->rnti]=it->second; + inst->ue2te_mapping.erase(it); + pthread_mutex_unlock(&globGtp.gtp_lock); + return 0; +} + +int ocp_gtpv1u_create_x2u_tunnel( + const instance_t instanceP, + const gtpv1u_enb_create_x2u_tunnel_req_t * const create_tunnel_req_pP, + gtpv1u_enb_create_x2u_tunnel_resp_t * const create_tunnel_resp_pP){ + AssertFatal( false, "to be developped\n"); +} + +int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, + const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { + LOG_D(GTPU, "Start delete tunnels for RNTI %x, num_erab %d, eps_bearer_id %d \n", + req_pP->rnti, + req_pP->num_erab, + req_pP->eps_bearer_id[0]); + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[instance]; + auto it=inst->ue2te_mapping.find(req_pP->rnti); + + if ( it == inst->ue2te_mapping.end() ) { + LOG_W(GTPU,"Delete a non existing GTP tunnel\n"); + pthread_mutex_unlock(&globGtp.gtp_lock); + return -1; + } + + for (auto j=it->second.bearers.begin(); + j!=it->second.bearers.end(); + ++j) + inst->te2ue_mapping.erase(j->second.teid_incoming); + + inst->ue2te_mapping.erase(it); + pthread_mutex_unlock(&globGtp.gtp_lock); + return !GTPNOK; +} + +static int Gtpv1uHandleEchoReq(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + LOG_E(GTPU,"to be dev\n"); + int rc = GTPNOK; + return rc; +} + +static int Gtpv1uHandleError(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + LOG_E(GTPU,"to be dev\n"); + int rc = GTPNOK; + return rc; +} + +static int Gtpv1uHandleSupportedExt(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + LOG_E(GTPU,"to be dev\n"); + int rc = GTPNOK; + return rc; +} + + static int Gtpv1uHandleEndMarker(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + LOG_E(GTPU,"to be dev\n"); + int rc = GTPNOK; + return rc; +} +static int Gtpv1uHandleGpdu(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *) msgBuf; + + if ( msgHdr->version != 1 || msgHdr->PT != 1 ) { + LOG_E(GTPU, "Received a packet that is not GTP header\n"); + return GTPNOK; + } + + pthread_mutex_lock(&globGtp.gtp_lock); + // the socket Linux file handler is the instance id + auto inst=&globGtp.instances[h]; + auto tunnel=inst->te2ue_mapping.find(ntohl(msgHdr->teid)); + + if ( tunnel == inst->te2ue_mapping.end() ) { + LOG_E(GTPU,"Received a incoming packet on non open teid (%d)\n", msgHdr->teid); + pthread_mutex_unlock(&globGtp.gtp_lock); + return GTPNOK; + } + + int offset=8; + if( msgHdr->E || msgHdr->S ||msgHdr->PN) + offset+=4; + /* + gtpv1u_enb_tunnel_data_ind_t tmp; + protocol_ctxt_t ctxt; + ctxt.module_id = 0; + ctxt.enb_flag = 1; + ctxt.instance = 0; + ctxt.frame = 0; + ctxt.subframe = 0; + ctxt.eNB_index = 0; + ctxt.configured = 1; + ctxt.brOption = 0; + result = pdcp_data_req(&ctxt, + SRB_FLAG_YES, + RRC_DCCH_DATA_REQ(msg_p).rb_id, + RRC_DCCH_DATA_REQ(msg_p).muip, + RRC_DCCH_DATA_REQ(msg_p).confirmp, + RRC_DCCH_DATA_REQ(msg_p).sdu_size, + RRC_DCCH_DATA_REQ(msg_p).sdu_p, + RRC_DCCH_DATA_REQ(msg_p).mode, + NULL, NULL); + + + ctxt.rnti = rnti; + pdcp_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, + RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf, + PDCP_TRANSMISSION_MODE_DATA, NULL, NULL); + + MessageDef *msg_p=itti_alloc_new_message_sized(OCP_GTPV1_U,GTPV1U_ENB_TUNNEL_DATA_IND, + sizeof(MessageDef) + msgBufLen); + GTPV1U_ENB_TUNNEL_DATA_IND(msg_p).buffer=(uint8_t *)(msg_p+1); + memcpy(GTPV1U_ENB_TUNNEL_DATA_IND(msg_p).buffer,msgBuf,msgBufLen); + GTPV1U_ENB_TUNNEL_DATA_IND(msg_p).length=msgBufLen; + GTPV1U_ENB_TUNNEL_DATA_IND(msg_p).offset=offset; + pthread_mutex_unlock(&globGtp.gtp_lock); + inst->addr.dlCallBack(msg_p); + */ + // could be a full itti msg, make it in the call back if you need + //itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(0), msg_p); + LOG_D(GTPU,"Received a %d bytes packet for: teid:%x\n", + msgBufLen-offset, + ntohl(msgHdr->teid)); + return !GTPNOK; +} + +void gtpv1uReceiver(int h) { + uint8_t udpData[65536]; + int udpDataLen; + socklen_t from_len; + struct sockaddr_in addr; + from_len = (socklen_t)sizeof(struct sockaddr_in); + + if ((udpDataLen = recvfrom(h, udpData, sizeof(udpData), 0, + (struct sockaddr *)&addr, &from_len)) < 0) { + LOG_E(GTPU, "Recvfrom failed %s\n", strerror(errno)); + return; + } else if (udpDataLen == 0) { + LOG_W(GTPU, "Recvfrom returned 0\n"); + return; + } else { + uint8_t msgType = *((uint8_t *)(udpData + 1)); + LOG_D(GTPU, "Received GTP data, msg type: %x\n", msgType); + + switch(msgType) { + case GTP_ECHO_RSP: + break; + + case GTP_ECHO_REQ: + Gtpv1uHandleEchoReq( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + case GTP_ERROR_INDICATION: + Gtpv1uHandleError( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + case GTP_SUPPORTED_EXTENSION_HEADER_INDICATION: + Gtpv1uHandleSupportedExt( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + case GTP_END_MARKER: + Gtpv1uHandleEndMarker( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + case GTP_GPDU: + Gtpv1uHandleGpdu( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + default: + LOG_E(GTPU, "Received a GTP packet of unknown type: %d\n",msgType); + break; + } + } +} + +void *ocp_gtpv1uTask(void *args) { + while(1) { + /* Trying to fetch a message from the message queue. + If the queue is empty, this function will block till a + message is sent to the task. + */ + MessageDef *message_p = NULL; + itti_receive_msg(OCP_GTPV1_U, &message_p); + + if (message_p != NULL ) { + switch (ITTI_MSG_ID(message_p)) { + // DATA TO BE SENT TO UDP + case GTPV1U_ENB_TUNNEL_DATA_REQ: { + gtpv1uSend(ITTI_MESSAGE_GET_INSTANCE(message_p), + >PV1U_ENB_TUNNEL_DATA_REQ(message_p), false, false); + itti_free(OCP_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer); + } + break; + + case TERMINATE_MESSAGE: + break; + + case TIMER_HAS_EXPIRED: + LOG_E(GTPU, "Received unexpected timer expired (no need of timers in this version) %s\n", ITTI_MSG_NAME(message_p)); + break; + + + case GTPV1U_ENB_DATA_FORWARDING_REQ: + case GTPV1U_ENB_DATA_FORWARDING_IND: + case GTPV1U_ENB_END_MARKER_REQ: + case GTPV1U_ENB_END_MARKER_IND: + case GTPV1U_ENB_S1_REQ: + LOG_E(GTPU, "to be developped %s\n", ITTI_MSG_NAME(message_p)); + abort(); + break; + + default: + LOG_E(GTPU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p)); + abort(); + break; + } + + AssertFatal(EXIT_SUCCESS==itti_free(OCP_GTPV1_U, message_p), "Failed to free memory!\n"); + } + + struct epoll_event *events; + + int nb_events = itti_get_events(OCP_GTPV1_U, &events); + + if (nb_events > 0 && events!= NULL ) + for (int i = 0; i < nb_events; i++) + gtpv1uReceiver(events[i].data.fd); + } + + return NULL; +} + +#ifdef __cplusplus +} +#endif diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h new file mode 100644 index 0000000000..e09f2194eb --- /dev/null +++ b/openair3/ocp-gtpu/gtp_itf.h @@ -0,0 +1,49 @@ +#ifndef __UDP_ITF_H__ +#define __UDP_ITF_H__ +#define GTPNOK -1 + +# define GTPU_HEADER_OVERHEAD_MAX 64 +#ifdef __cplusplus +extern "C" { +#endif + +#include +#if defined(NEW_GTPU) + #define gtpv1u_create_s1u_tunnel ocp_gtpv1u_create_s1u_tunnel + #define gtpv1u_update_s1u_tunnel ocp_gtpv1u_update_s1u_tunnel + #define gtpv1u_delete_s1u_tunnel ocp_gtpv1u_delete_s1u_tunnel + #define gtpv1u_create_x2u_tunnel ocp_gtpv1u_create_x2u_tunnel + #endif + +typedef struct openAddr_s { + char originHost[HOST_NAME_MAX]; + char originService[HOST_NAME_MAX]; + char destinationHost[HOST_NAME_MAX]; + char destinationService[HOST_NAME_MAX]; + instance_t originInstance; +} openAddr_t; + +// the init function create a gtp instance and return the gtp instance id +// the parameter originInstance will be sent back in each message from gtp to the creator +instance_t ocp_gtpv1Init(openAddr_t context); +void ocp_gtpv1uReceiver(int h); +void ocp_gtpv1uProcessTimeout(int handle,void *arg); +int ocp_gtpv1u_create_s1u_tunnel(const instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, + gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp); +int ocp_gtpv1u_update_s1u_tunnel(const instance_t instanceP, + const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req_pP, + const rnti_t prior_rnti + ); +int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); +int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); + + int ocp_gtpv1u_create_x2u_tunnel( + const instance_t instanceP, + const gtpv1u_enb_create_x2u_tunnel_req_t * const create_tunnel_req_pP, + gtpv1u_enb_create_x2u_tunnel_resp_t * const create_tunnel_resp_pP); + void *ocp_gtpv1uTask(void *args); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index dd29d01fae..851082f44b 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -1329,7 +1329,7 @@ extern "C" { if(is_equal(s->sample_rate, (double)7.68e6)) s->tx_forward_nsamps = 50; - + if (device->recplay_state != NULL) { // record mode device->recplay_state->ms_sample = (iqrec_t *) malloc(openair0_cfg[0].recplay_conf->u_sf_max * sizeof(iqrec_t)); diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 4d57ab4e16..3e0d97f60a 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -42,6 +42,7 @@ # include "enb_app.h" # include "openair2/LAYER2/MAC/mac_proto.h" #include +#include extern RAN_CONTEXT_t RC; diff --git a/targets/COMMON/create_tasks_mbms.c b/targets/COMMON/create_tasks_mbms.c index 5f81592b96..579e851ea7 100644 --- a/targets/COMMON/create_tasks_mbms.c +++ b/targets/COMMON/create_tasks_mbms.c @@ -47,6 +47,7 @@ # include "mce_app.h" # include "mme_app.h" +#include //extern RAN_CONTEXT_t RC; int create_tasks_mbms(uint32_t enb_nb) { diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 0d0dde4ac4..1fa6c594d6 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -170,7 +170,6 @@ extern void init_eNB_afterRU(void); int transmission_mode=1; int emulate_rf = 0; int numerology = 0; -int usrp_tx_thread = 0; THREAD_STRUCT thread_struct; /* struct for ethernet specific parameters given in eNB conf file */ diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 2bf2314f1b..f7dfed80e5 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -168,7 +168,6 @@ extern void get_uethreads_params(void); int transmission_mode=1; -int usrp_tx_thread = 0; char *usrp_args=NULL; From 954b0f559d83304754ee06be8b338e7fc4628eba Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Mon, 25 Jan 2021 12:59:38 +0100 Subject: [PATCH 02/66] new gtp before tests --- cmake_targets/CMakeLists.txt | 4 +- doc/SW_archi.md | 22 ++ openair2/COMMON/gtpv1_u_messages_types.h | 2 + openair2/ENB_APP/enb_config.c | 5 +- openair2/GNB_APP/gnb_config.c | 6 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 3 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 7 +- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 3 +- openair2/RRC/LTE/rrc_eNB.c | 2 +- openair2/RRC/LTE/rrc_eNB_S1AP.c | 2 +- openair2/RRC/NR/rrc_gNB_nsa.c | 3 +- openair3/ocp-gtpu/gtp_itf.cpp | 369 +++++++++++----------- openair3/ocp-gtpu/gtp_itf.h | 49 ++- 13 files changed, 274 insertions(+), 203 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 1b93dea0c0..1a4a0a88f7 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2883,8 +2883,8 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer) target_link_libraries (lte-softmodem -Wl,--start-group - RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB ${GTPV1U} SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB - PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 + RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB + PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE ${GTPV1U} NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} -Wl,--end-group z dl) diff --git a/doc/SW_archi.md b/doc/SW_archi.md index 412dad402d..f6114c33c2 100644 --- a/doc/SW_archi.md +++ b/doc/SW_archi.md @@ -296,6 +296,28 @@ gtp thread calls directly pdcp_data_req(), so it runs inside it's context intern ## inside other threads gtpv1u_create_s1u_tunnel(), delete tunnel, ... functions are called inside the other threads, without mutex. +# New GTP +## initialization +Coexistance until full merge with legacy GTP +cmake new option: NEW_GTPU to use the new implementation (it changes for the entire executable) +It is possible to use both old and new GTP in same executable because the itti task and all functions names are different +Current status of new implementation: not tested, X2 not developped, 5G new GTP option not developped, remain issues on data coming from void: muid, enb_flag, ... + +ocp_gtpv1uTask(): this creates only the thread, doesn't configure anything +gtpv1Init(): creates a listening socket to Linux for a given reception and select a local IP address + +newGtpuCreateTunnel() this function will replace the xxx_create_tunnel_xxx() for various cases +This creates a outgoing context for a teid (in input), it computes and return the incoming teid that will be used for incoming packets +These teids and in a "instance", so in a Linux socket: same teid can co-exist for different sockets + Remain here a lack to fill: the information given in the legacy funtions is not enough to fullfil the data needed by the callback +stuff like enb_flag, but also mui and more important data are not given explicitly by any legacy function (gtpv1u_create_s1u_tunnel), but the legacy and the new interface to lower layer (like pdcp) require this data. +The datamodel is still not fully understood, so this data source remain unknown +A new parameter is the callback function: will be pdpcp_data_req() and gtpv_data_req() (x2 case) for existing implementation and later other call backs like the F1-U implementation. + +incoming packets +the gtp layer retrieves the data, the teid, find out the related data: rnti, bearer and quite a lot of other parameters (not clear why, because it looks like all is statefull, so the lower layer should have the context) +if lower layers can be stateless, it is a good idea to keep the context in the gtp layer and pass it to the callback, but the design remain obfuscated. + # NGAP NGAP would be a itti thread as is S1AP (+twin thread SCTP that is almost void processing)? About all messages are exchanged with RRC thread diff --git a/openair2/COMMON/gtpv1_u_messages_types.h b/openair2/COMMON/gtpv1_u_messages_types.h index 14b6e7c0b1..a0c1a9e817 100644 --- a/openair2/COMMON/gtpv1_u_messages_types.h +++ b/openair2/COMMON/gtpv1_u_messages_types.h @@ -170,6 +170,8 @@ typedef struct gtpv1u_enb_end_marker_ind_s { typedef struct { in_addr_t enb_ip_address_for_S1u_S12_S4_up; tcp_udp_port_t enb_port_for_S1u_S12_S4_up; + char addrStr[256]; + char portStr[256]; } Gtpv1uS1Req; #endif /* GTPV1_U_MESSAGES_TYPES_H_ */ diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index de77d783c7..9b0bc14f70 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -57,6 +57,7 @@ #include "enb_paramdef.h" #include "proto_agent.h" #include "executables/thread-common.h" +#include extern uint32_t to_earfcn_DL(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw); extern uint32_t to_earfcn_UL(int eutra_bandP, uint32_t ul_CarrierFreq, uint32_t bw); @@ -2055,7 +2056,9 @@ int RCconfig_gtpu(void ) { IPV4_STR_ADDR_TO_INT_NWBO ( address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up); GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = enb_port_for_S1U; - itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) + strcpy(GTPV1U_ENB_S1_REQ(message).addrStr,address); + sprintf(GTPV1U_ENB_S1_REQ(message).portStr,"%d", enb_port_for_S1U); + itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) } else LOG_E(GTPU,"invalid address for S1U\n"); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 3785ded9e9..19ff268668 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -57,6 +57,7 @@ //#include "RRC_config_tools.h" #include "gnb_paramdef.h" #include "NR_MAC_gNB/mac_proto.h" +#include #include "NR_asn_constant.h" #include "executables/thread-common.h" @@ -740,8 +741,9 @@ int RCconfig_nr_gtpu(void ) { LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up); GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = gnb_port_for_NGU; } - - itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) + strcpy(GTPV1U_ENB_S1_REQ(message).addrStr,address); + sprintf(GTPV1U_ENB_S1_REQ(message).portStr,"%d", gnb_port_for_NGU); + itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) } else LOG_E(GTPU,"invalid address for NGU\n"); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 9b6de7c168..9c5438b589 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -61,6 +61,7 @@ # include "gtpv1u_eNB_task.h" # include "gtpv1u.h" +#include #include "ENB_APP/enb_config.h" @@ -937,7 +938,7 @@ pdcp_data_ind( GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ctxt_pP->rnti; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4; - itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); + itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); packet_forwarded = TRUE; } } else { diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index c8ab4499ee..52efc3c03e 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -242,17 +242,18 @@ typedef struct pdcp_mbms_s { * \note None * @ingroup _pdcp */ + boolean_t pdcp_data_req( protocol_ctxt_t *ctxt_pP, const srb_flag_t srb_flagP, const rb_id_t rb_id, const mui_t muiP, - const confirm_t confirmP, \ + const confirm_t confirmP, const sdu_size_t sdu_buffer_size, unsigned char *const sdu_buffer, const pdcp_transmission_mode_t mode, - const uint32_t *const sourceL2Id, - const uint32_t *const destinationL2Id + const uint32_t * sourceL2Id, + const uint32_t * destinationL2Id ); /*! \fn boolean_t pdcp_data_ind(const protocol_ctxt_t* const, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, boolean_t) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 9b33b2715d..1e5ec1ee59 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -33,6 +33,7 @@ /* from OAI */ #include "pdcp.h" #include "LAYER2/nr_rlc/nr_rlc_oai_api.h" +#include #define TODO do { \ printf("%s:%d:%s: todo\n", __FILE__, __LINE__, __FUNCTION__); \ @@ -442,7 +443,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size); //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)buf[i]); //printf("\n"); - itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); + itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); } } diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 2564983d47..5624bf80d8 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -5034,7 +5034,7 @@ void rrc_eNB_handover_ue_context_release( ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; } - itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->module_id, msg_delete_tunnels_p); + itti_send_msg_to_task(TASK_VARIABLE, ctxt_pP->module_id, msg_delete_tunnels_p); struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL; rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[ctxt_pP->module_id], 0, eNB_ue_s1ap_id); diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 9edfa50f12..49450e2deb 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -1763,7 +1763,7 @@ int rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *ms } } - itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p); + itti_send_msg_to_task(TASK_VARIABLE, instance, msg_delete_tunnels_p); //S1AP_E_RAB_RELEASE_RESPONSE rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(&ctxt, ue_context_p, xid); } diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 8f1fa9f81f..e1c511c4f9 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -39,6 +39,7 @@ #include "openair2/RRC/LTE/rrc_eNB_GTPV1U.h" #include "executables/softmodem-common.h" #include +#include extern boolean_t nr_rrc_pdcp_config_asn1_req( const protocol_ctxt_t *const ctxt_pP, @@ -341,7 +342,7 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { ue_context->ue_context.gnb_gtp_ebi[e_rab] = 0; } - itti_send_msg_to_task(TASK_GTPV1_U, rrc->module_id, msg_delete_tunnels_p); + itti_send_msg_to_task(TASK_VARIABLE, rrc->module_id, msg_delete_tunnels_p); /* remove context */ rrc_gNB_remove_ue_context(&ctxt, rrc, ue_context); diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 5a5717c726..f9fc506860 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -1,3 +1,9 @@ +#include +using namespace std; + +#ifdef __cplusplus +extern "C" { +#endif #include #include #include @@ -10,9 +16,8 @@ #include #include #include +#include //#include -#include -using namespace std; #pragma pack(1) @@ -25,13 +30,13 @@ typedef struct Gtpv1uMsgHeader { uint8_t version:3; uint8_t msgType; uint16_t msgLength; - uint32_t teid; + teid_t teid; } __attribute__((packed)) Gtpv1uMsgHeaderT; #pragma pack() - // TS 29.060, table 7.1 defines the possible message types - // here are all the possible messages (3GPP R16) +// TS 29.060, table 7.1 defines the possible message types +// here are all the possible messages (3GPP R16) #define GTP_ECHO_REQ (1) #define GTP_ECHO_RSP (2) #define GTP_ERROR_INDICATION (26) @@ -57,11 +62,14 @@ typedef struct { typedef struct { rnti_t rnti; + gtpCallback callBack; } rntiData_t; class gtpEndPoint { public: openAddr_t addr; + uint8_t foundAddr[20]; + int foundAddrLen; map ue2te_mapping; map te2ue_mapping; }; @@ -75,10 +83,6 @@ class gtpEndPoints { gtpEndPoints globGtp; -#ifdef __cplusplus -extern "C" { -#endif - static uint32_t gtpv1uNewTeid(void) { #ifdef GTPV1U_LINEAR_TEID_ALLOCATION g_gtpv1u_teid = g_gtpv1u_teid + 1; @@ -90,7 +94,7 @@ static uint32_t gtpv1uNewTeid(void) { #define GTPV1U_HEADER_SIZE (8) -static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, uint32_t teid, uint8_t *Msg,int msgLen, +static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, teid_t teid, uint8_t *Msg,int msgLen, bool seqNumFlag, bool npduNumFlag, bool extHdrFlag, int seqNum, int npduNum, int extHdrType) { AssertFatal(extHdrFlag==false,"Not developped"); int headerAdditional=0; @@ -203,6 +207,11 @@ static int udpServerSocket(openAddr_s addr) { close(sockfd); LOG_W(GTPU,"bind: %s\n", strerror(errno)); continue; + } else { + // We create the gtp instance on the socket + globGtp.instances[sockfd].addr=addr; + memcpy(globGtp.instances[sockfd].foundAddr, p->ai_addr, p->ai_addrlen); + globGtp.instances[sockfd].foundAddrLen=p->ai_addrlen; } break; // if we get here, we must have connected successfully @@ -215,6 +224,28 @@ static int udpServerSocket(openAddr_s addr) { } freeaddrinfo(servinfo); // all done with this structure + + if (strlen(addr.destinationHost)>1) { + struct addrinfo hints; + memset(&hints,0,sizeof(hints)); + hints.ai_family=AF_UNSPEC; + hints.ai_socktype=SOCK_DGRAM; + hints.ai_protocol=0; + hints.ai_flags=AI_PASSIVE|AI_ADDRCONFIG; + struct addrinfo *res=0; + int err=getaddrinfo(addr.destinationHost,addr.destinationService,&hints,&res); + + if (err==0) { + for(p = res; p != NULL; p = p->ai_next) { + if ((err=connect(sockfd, p->ai_addr, p->ai_addrlen))==0) + break; + } + } + + if (err) + LOG_E(GTPU,"Can't filter remote host: %s, %s\n", addr.destinationHost,addr.destinationService); + } + int sendbuff = 1000*1000*10; AssertFatal(0==setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &sendbuff, sizeof(sendbuff)),""); LOG_D(GTPU,"Created listener for paquets to: %s:%s, send buffer size: %d\n", addr.originHost, addr.originService,sendbuff); @@ -226,16 +257,66 @@ instance_t ocp_gtpv1Init(openAddr_t context) { int id=udpServerSocket(context); if (id>=0) { - globGtp.instances[id].addr=context; itti_subscribe_event_fd(OCP_GTPV1_U, id); } else LOG_E(GTPU,"can't create GTP-U instance\n"); pthread_mutex_unlock(&globGtp.gtp_lock); - return id; } +teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int bearer_id, teid_t teid, transport_layer_addr_t remoteAddr, int port, gtpCallback callBack) { + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[instance]; + auto it=inst->ue2te_mapping.find(rnti); + + if ( it != inst->ue2te_mapping.end() ) { + LOG_W(GTPU,"Create a config for a already existing GTP tunnel (rnti %x)\n", rnti); + inst->ue2te_mapping.erase(it); + } + + uint32_t s1u_teid=gtpv1uNewTeid(); + + while ( inst->te2ue_mapping.find(s1u_teid) != inst->te2ue_mapping.end() ) { + LOG_W(GTPU, "generated a random Teid that exists, re-generating (%u)\n",s1u_teid); + s1u_teid=gtpv1uNewTeid(); + }; + + inst->te2ue_mapping[s1u_teid].rnti=rnti; + + inst->te2ue_mapping[s1u_teid].callBack=callBack; + + auto tmp=&inst->ue2te_mapping[rnti].bearers[bearer_id]; + + int addrs_length_in_bytes = remoteAddr.length / 8; + + switch (addrs_length_in_bytes) { + case 4: + memcpy(&tmp->outgoing_ip_addr,remoteAddr.buffer,4); + break; + + case 16: + memcpy(tmp->outgoing_ip6_addr.s6_addr,remoteAddr.buffer, + 16); + break; + + case 20: + memcpy(&tmp->outgoing_ip_addr,remoteAddr.buffer,4); + memcpy(&tmp->outgoing_ip6_addr.s6_addr, + remoteAddr.buffer+4, + 16); + + default: + AssertFatal(false, "SGW Address size impossible"); + } + + tmp->teid_incoming = s1u_teid; + tmp->outgoing_port=port; + tmp->teid_outgoing= teid; + pthread_mutex_unlock(&globGtp.gtp_lock); + return s1u_teid; +} + int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { @@ -243,96 +324,23 @@ int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, create_tunnel_req->sgw_S1u_teid[0]); - pthread_mutex_lock(&globGtp.gtp_lock); - auto inst=&globGtp.instances[instance]; - auto it=inst->ue2te_mapping.find(create_tunnel_req->rnti); - - if ( it != inst->ue2te_mapping.end() ) { - LOG_W(GTPU,"Create a config for a already existing GTP tunnel (rnti %x)\n", create_tunnel_req->rnti); - inst->ue2te_mapping.erase(it); - } - - rntiData_t rntiData= {create_tunnel_req->rnti}; for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { - ocp_gtpv1u_bearer_t gtpv1u_ue_data; - uint32_t s1u_teid=gtpv1uNewTeid(); - - while ( inst->te2ue_mapping.find(s1u_teid) != inst->te2ue_mapping.end() ) { - LOG_W(GTPU, "generated a random Teid that exists, re-generating (%u)\n",s1u_teid); - s1u_teid=gtpv1uNewTeid(); - }; - - inst->te2ue_mapping[s1u_teid]=rntiData; - - int addrs_length_in_bytes = create_tunnel_req->sgw_addr[i].length / 8; - - switch (addrs_length_in_bytes) { - case 4: - memcpy(>pv1u_ue_data.outgoing_ip_addr,create_tunnel_req->sgw_addr[i].buffer,4); - break; - - case 16: - memcpy(>pv1u_ue_data.outgoing_ip6_addr.s6_addr, - create_tunnel_req->sgw_addr[i].buffer, - 16); - break; - - case 20: - memcpy(>pv1u_ue_data.outgoing_ip_addr,create_tunnel_req->sgw_addr[i].buffer,4); - memcpy(>pv1u_ue_data.outgoing_ip6_addr.s6_addr, - create_tunnel_req->sgw_addr[i].buffer+4, - 16); - - default: - AssertFatal(false, "SGW Address size impossible"); - } - - gtpv1u_ue_data.teid_incoming = s1u_teid; - gtpv1u_ue_data.outgoing_port=2152; - gtpv1u_ue_data.teid_outgoing= create_tunnel_req->sgw_S1u_teid[i]; - inst->ue2te_mapping[create_tunnel_req->rnti].bearers[create_tunnel_req->eps_bearer_id[i]]=gtpv1u_ue_data; - LOG_D(GTPU, "Created tunnel %x for RNTI %x, SGW: " IPV4_ADDR ":%d\n", - s1u_teid, create_tunnel_req->rnti, - IPV4_ADDR_FORMAT(inst->ue2te_mapping[create_tunnel_req->rnti].bearers[create_tunnel_req->eps_bearer_id[i]].outgoing_ip_addr), - inst->ue2te_mapping[create_tunnel_req->rnti].bearers[create_tunnel_req->eps_bearer_id[i]].outgoing_port ); + teid_t teid=newGtpuCreateTunnel(instance, create_tunnel_req->rnti, + create_tunnel_req->eps_bearer_id[i], + create_tunnel_req->eps_bearer_id[i], + create_tunnel_req->sgw_addr[i], 2152, + pdcp_data_req); create_tunnel_resp->status=0; create_tunnel_resp->rnti=create_tunnel_req->rnti; create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels; - create_tunnel_resp->enb_S1u_teid[i]=gtpv1u_ue_data.teid_incoming; + create_tunnel_resp->enb_S1u_teid[i]=teid; create_tunnel_resp->eps_bearer_id[i] = create_tunnel_req->eps_bearer_id[i]; - //TBD: fix me this is quite bad, for IPv4 only and - // Overcomplex stuff to fill InitialContextSetupResponse in S1AP - int status; - struct addrinfo hints= {0}, *servinfo, *p; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_DGRAM; - hints.ai_flags = AI_PASSIVE; - openAddr_t *addr=&globGtp.instances[instance].addr; - - if ((status = getaddrinfo(addr->originHost, addr->originService, &hints, &servinfo)) != 0) { - LOG_E(GTPU,"getaddrinfo error: %s\n", gai_strerror(status)); - pthread_mutex_unlock(&globGtp.gtp_lock); - return -1; - } - - // TBD: we take the first IPv4 addr, but it should be coded in the right way - for(p = servinfo; p != NULL; p = p->ai_next) - if (p->ai_family == AF_INET) { - struct sockaddr_in *ipv4P=(struct sockaddr_in *)p->ai_addr; - memcpy(create_tunnel_resp->enb_addr.buffer, - &ipv4P->sin_addr.s_addr, sizeof(ipv4P->sin_addr.s_addr)); - create_tunnel_resp->enb_addr.length = sizeof(ipv4P->sin_addr.s_addr); - break; - } - - if ( p == NULL ) - LOG_E(GTPU,"can't translate IP address string: %s\n",addr->originHost); - - freeaddrinfo(servinfo); // all done with this structure + memcpy(create_tunnel_resp->enb_addr.buffer,globGtp.instances[instance].foundAddr, + globGtp.instances[instance].foundAddrLen); + create_tunnel_resp->enb_addr.length= globGtp.instances[instance].foundAddrLen; } - pthread_mutex_unlock(&globGtp.gtp_lock); return !GTPNOK; } @@ -358,9 +366,9 @@ int ocp_gtpv1u_update_s1u_tunnel( if ( it != inst->ue2te_mapping.end() ) { LOG_W(GTPU,"Update a not existing tunnel, start create the new one (new rnti %x, old rnti %x)\n", create_tunnel_req->rnti, prior_rnti); + pthread_mutex_unlock(&globGtp.gtp_lock); gtpv1u_enb_create_tunnel_resp_t tmp; (void)ocp_gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp); - pthread_mutex_unlock(&globGtp.gtp_lock); return 0; } @@ -369,16 +377,16 @@ int ocp_gtpv1u_update_s1u_tunnel( pthread_mutex_unlock(&globGtp.gtp_lock); return 0; } - + int ocp_gtpv1u_create_x2u_tunnel( const instance_t instanceP, - const gtpv1u_enb_create_x2u_tunnel_req_t * const create_tunnel_req_pP, - gtpv1u_enb_create_x2u_tunnel_resp_t * const create_tunnel_resp_pP){ + const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, + gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP) { AssertFatal( false, "to be developped\n"); } - + int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, - const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { + const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { LOG_D(GTPU, "Start delete tunnels for RNTI %x, num_erab %d, eps_bearer_id %d \n", req_pP->rnti, req_pP->num_erab, @@ -422,22 +430,22 @@ static int Gtpv1uHandleError(int h, int rc = GTPNOK; return rc; } - + static int Gtpv1uHandleSupportedExt(int h, - uint8_t *msgBuf, - uint32_t msgBufLen, - uint16_t peerPort, - uint32_t peerIp) { + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { LOG_E(GTPU,"to be dev\n"); int rc = GTPNOK; return rc; } - - static int Gtpv1uHandleEndMarker(int h, - uint8_t *msgBuf, - uint32_t msgBufLen, - uint16_t peerPort, - uint32_t peerIp) { + +static int Gtpv1uHandleEndMarker(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { LOG_E(GTPU,"to be dev\n"); int rc = GTPNOK; return rc; @@ -460,52 +468,52 @@ static int Gtpv1uHandleGpdu(int h, auto tunnel=inst->te2ue_mapping.find(ntohl(msgHdr->teid)); if ( tunnel == inst->te2ue_mapping.end() ) { - LOG_E(GTPU,"Received a incoming packet on non open teid (%d)\n", msgHdr->teid); + LOG_E(GTPU,"Received a incoming packet on unknown teid (%d) Dropping!\n", msgHdr->teid); pthread_mutex_unlock(&globGtp.gtp_lock); return GTPNOK; } int offset=8; + if( msgHdr->E || msgHdr->S ||msgHdr->PN) offset+=4; - /* - gtpv1u_enb_tunnel_data_ind_t tmp; + + // This context is not good for gtp + // frame, ... has no meaning + // manyother attributes may come from create tunnel protocol_ctxt_t ctxt; - ctxt.module_id = 0; - ctxt.enb_flag = 1; - ctxt.instance = 0; - ctxt.frame = 0; - ctxt.subframe = 0; - ctxt.eNB_index = 0; - ctxt.configured = 1; - ctxt.brOption = 0; - result = pdcp_data_req(&ctxt, - SRB_FLAG_YES, - RRC_DCCH_DATA_REQ(msg_p).rb_id, - RRC_DCCH_DATA_REQ(msg_p).muip, - RRC_DCCH_DATA_REQ(msg_p).confirmp, - RRC_DCCH_DATA_REQ(msg_p).sdu_size, - RRC_DCCH_DATA_REQ(msg_p).sdu_p, - RRC_DCCH_DATA_REQ(msg_p).mode, - NULL, NULL); - - - ctxt.rnti = rnti; - pdcp_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, - RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf, - PDCP_TRANSMISSION_MODE_DATA, NULL, NULL); - - MessageDef *msg_p=itti_alloc_new_message_sized(OCP_GTPV1_U,GTPV1U_ENB_TUNNEL_DATA_IND, - sizeof(MessageDef) + msgBufLen); - GTPV1U_ENB_TUNNEL_DATA_IND(msg_p).buffer=(uint8_t *)(msg_p+1); - memcpy(GTPV1U_ENB_TUNNEL_DATA_IND(msg_p).buffer,msgBuf,msgBufLen); - GTPV1U_ENB_TUNNEL_DATA_IND(msg_p).length=msgBufLen; - GTPV1U_ENB_TUNNEL_DATA_IND(msg_p).offset=offset; + ctxt.module_id = 0; + ctxt.enb_flag = 1; + ctxt.instance = inst->addr.originInstance; + ctxt.rnti = tunnel->second.rnti; + ctxt.frame = 0; + ctxt.subframe = 0; + ctxt.eNB_index = 0; + ctxt.configured = 1; + ctxt.brOption = 0; + const srb_flag_t srb_flag=SRB_FLAG_NO; + const rb_id_t rb_id=0; + const mui_t mui=RLC_MUI_UNDEFINED; + const confirm_t confirm=RLC_SDU_CONFIRM_NO; + const sdu_size_t sdu_buffer_size=msgBufLen-offset; + unsigned char *const sdu_buffer=msgBuf+offset; + const pdcp_transmission_mode_t mode=PDCP_TRANSMISSION_MODE_DATA; + const uint32_t sourceL2Id=0; + const uint32_t destinationL2Id=0; pthread_mutex_unlock(&globGtp.gtp_lock); - inst->addr.dlCallBack(msg_p); - */ - // could be a full itti msg, make it in the call back if you need - //itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(0), msg_p); + + if ( !tunnel->second.callBack(&ctxt, + srb_flag, + rb_id, + mui, + confirm, + sdu_buffer_size, + sdu_buffer, + mode, + &sourceL2Id, + &destinationL2Id) ) + LOG_E(GTPU,"down layer refused incoming packet\n"); + LOG_D(GTPU,"Received a %d bytes packet for: teid:%x\n", msgBufLen-offset, ntohl(msgHdr->teid)); @@ -541,26 +549,28 @@ void gtpv1uReceiver(int h) { case GTP_ERROR_INDICATION: Gtpv1uHandleError( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); break; - - case GTP_SUPPORTED_EXTENSION_HEADER_INDICATION: + + case GTP_SUPPORTED_EXTENSION_HEADER_INDICATION: Gtpv1uHandleSupportedExt( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); - break; - - case GTP_END_MARKER: - Gtpv1uHandleEndMarker( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); - break; - - case GTP_GPDU: - Gtpv1uHandleGpdu( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); - break; - - default: - LOG_E(GTPU, "Received a GTP packet of unknown type: %d\n",msgType); - break; + break; + + case GTP_END_MARKER: + Gtpv1uHandleEndMarker( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + case GTP_GPDU: + Gtpv1uHandleGpdu( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + default: + LOG_E(GTPU, "Received a GTP packet of unknown type: %d\n",msgType); + break; } } } +#include + void *ocp_gtpv1uTask(void *args) { while(1) { /* Trying to fetch a message from the message queue. @@ -571,6 +581,8 @@ void *ocp_gtpv1uTask(void *args) { itti_receive_msg(OCP_GTPV1_U, &message_p); if (message_p != NULL ) { + openAddr_t addr= {0}; + switch (ITTI_MSG_ID(message_p)) { // DATA TO BE SENT TO UDP case GTPV1U_ENB_TUNNEL_DATA_REQ: { @@ -587,19 +599,24 @@ void *ocp_gtpv1uTask(void *args) { LOG_E(GTPU, "Received unexpected timer expired (no need of timers in this version) %s\n", ITTI_MSG_NAME(message_p)); break; - - case GTPV1U_ENB_DATA_FORWARDING_REQ: - case GTPV1U_ENB_DATA_FORWARDING_IND: - case GTPV1U_ENB_END_MARKER_REQ: - case GTPV1U_ENB_END_MARKER_IND: - case GTPV1U_ENB_S1_REQ: - LOG_E(GTPU, "to be developped %s\n", ITTI_MSG_NAME(message_p)); - abort(); - break; - - default: - LOG_E(GTPU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p)); - abort(); + case GTPV1U_ENB_DATA_FORWARDING_REQ: + case GTPV1U_ENB_DATA_FORWARDING_IND: + case GTPV1U_ENB_END_MARKER_REQ: + case GTPV1U_ENB_END_MARKER_IND: + LOG_E(GTPU, "to be developped %s\n", ITTI_MSG_NAME(message_p)); + abort(); + break; + + case GTPV1U_ENB_S1_REQ: + // to be dev: should be removed, to use API + strcpy(addr.originHost, GTPV1U_ENB_S1_REQ(message_p).addrStr); + strcpy(addr.originService, GTPV1U_ENB_S1_REQ(message_p).portStr); + AssertFatal(ocp_gtpv1Init(addr),"Only one instance 0 supprted\n"); + break; + + default: + LOG_E(GTPU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p)); + abort(); break; } diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h index e09f2194eb..24b1adaa6f 100644 --- a/openair3/ocp-gtpu/gtp_itf.h +++ b/openair3/ocp-gtpu/gtp_itf.h @@ -1,5 +1,5 @@ -#ifndef __UDP_ITF_H__ -#define __UDP_ITF_H__ +#ifndef __GTPUNEW_ITF_H__ +#define __GTPUNEW_ITF_H__ #define GTPNOK -1 # define GTPU_HEADER_OVERHEAD_MAX 64 @@ -9,11 +9,27 @@ extern "C" { #include #if defined(NEW_GTPU) - #define gtpv1u_create_s1u_tunnel ocp_gtpv1u_create_s1u_tunnel - #define gtpv1u_update_s1u_tunnel ocp_gtpv1u_update_s1u_tunnel - #define gtpv1u_delete_s1u_tunnel ocp_gtpv1u_delete_s1u_tunnel - #define gtpv1u_create_x2u_tunnel ocp_gtpv1u_create_x2u_tunnel - #endif +#define gtpv1u_create_s1u_tunnel ocp_gtpv1u_create_s1u_tunnel +#define gtpv1u_update_s1u_tunnel ocp_gtpv1u_update_s1u_tunnel +#define gtpv1u_delete_s1u_tunnel ocp_gtpv1u_delete_s1u_tunnel +#define gtpv1u_create_x2u_tunnel ocp_gtpv1u_create_x2u_tunnel +#define gtpv1u_eNB_task ocp_gtpv1uTask +#define TASK_VARIABLE OCP_GTPV1_U +#else +#define TASK_VARIABLE TASK_GTPV1_U +#endif + +typedef boolean_t (*gtpCallback)( + protocol_ctxt_t *ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_sizeP, + unsigned char *const sdu_buffer_pP, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id); typedef struct openAddr_s { char originHost[HOST_NAME_MAX]; @@ -25,7 +41,6 @@ typedef struct openAddr_s { // the init function create a gtp instance and return the gtp instance id // the parameter originInstance will be sent back in each message from gtp to the creator -instance_t ocp_gtpv1Init(openAddr_t context); void ocp_gtpv1uReceiver(int h); void ocp_gtpv1uProcessTimeout(int handle,void *arg); int ocp_gtpv1u_create_s1u_tunnel(const instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, @@ -36,13 +51,19 @@ int ocp_gtpv1u_update_s1u_tunnel(const instance_t instanceP, ); int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); - - int ocp_gtpv1u_create_x2u_tunnel( + +int ocp_gtpv1u_create_x2u_tunnel( const instance_t instanceP, - const gtpv1u_enb_create_x2u_tunnel_req_t * const create_tunnel_req_pP, - gtpv1u_enb_create_x2u_tunnel_resp_t * const create_tunnel_resp_pP); - void *ocp_gtpv1uTask(void *args); - + const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, + gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP); + + +// New API +teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int bearer_id, teid_t teid, + transport_layer_addr_t remoteAddr, int port, gtpCallback callBack); +instance_t ocp_gtpv1Init(openAddr_t context); +void *ocp_gtpv1uTask(void *args); + #ifdef __cplusplus } #endif From 4b345f1589bdeaf8cae9cd5bd022aa19ababceb2 Mon Sep 17 00:00:00 2001 From: laurent Date: Wed, 27 Jan 2021 15:09:00 +0100 Subject: [PATCH 03/66] tested with one UE, better intergration with legacy gtpu --- common/utils/ocp_itti/intertask_interface.h | 3 + openair2/LAYER2/MAC/eNB_scheduler_mch.c | 2 +- openair2/LAYER2/MAC/mac_extern.h | 1 + openair2/LAYER2/MAC/pre_processor.c | 3 +- openair2/LAYER2/MAC/ue_procedures.c | 2 +- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 3 - openair3/ocp-gtpu/gtp_itf.cpp | 74 +++++++++++++-------- 7 files changed, 56 insertions(+), 32 deletions(-) diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index 140340bacd..7df88c20a6 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -472,6 +472,9 @@ void itti_subscribe_event_fd(task_id_t task_id, int fd); void itti_unsubscribe_event_fd(task_id_t task_id, int fd); /** \brief Return the list of events excluding the fd associated with itti + \the fd associated with itti can return, but it is marked events[i].events &= ~EPOLLIN + \as it is not EPOLLIN, the reader should ignore this fd + \or it can manage the list of fd's in his interest, so ignore the other ones \param task_id Task ID of the task \param events events list @returns number of events to handle diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c index f3a77ed703..1272b16ec0 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c @@ -84,7 +84,7 @@ get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id, static uint32_t bytes_in_buffer=0; static uint32_t msi_pmch_stop=0; -uint16_t mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; +rb_id_t mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; static uint32_t msi_sfs=0; diff --git a/openair2/LAYER2/MAC/mac_extern.h b/openair2/LAYER2/MAC/mac_extern.h index cee6066a9e..bc11c5aad6 100644 --- a/openair2/LAYER2/MAC/mac_extern.h +++ b/openair2/LAYER2/MAC/mac_extern.h @@ -77,4 +77,5 @@ extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; extern mac_rlc_am_muilist_t rlc_am_mui; extern SCHEDULER_MODES global_scheduler_mode; +extern rb_id_t mbms_rab_id; #endif //DEF_H diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index e720c1dfec..206f9f2255 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -734,7 +734,8 @@ void calculate_max_mcs_min_rb(module_id_t mod_id, /* find maximum MCS */ while ((phr - *tx_power < 0 || tbs > bytes) && *mcs > 3) { - mcs--; + *mcs=*mcs-1; + AssertFatal(*rb_index < 34, ""); tbs = get_TBS_UL(*mcs, rb_table[*rb_index]); *tx_power = estimate_ue_tx_power(tbs * 8, rb_table[*rb_index], 0, Ncp, 0); } diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 8c4ee72380..6d5c2fc395 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -72,7 +72,7 @@ extern UL_IND_t *UL_INFO; extern int next_ra_frame; extern module_id_t next_Mod_id; -int mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; +rb_id_t mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; static int mbms_mch_i=0; //static int num_msi_per_CSA[28]; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 04b9e188e6..0153d80401 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -78,9 +78,6 @@ extern int nas_sock_fd[MAX_MOBILES_PER_ENB]; extern int nas_sock_mbms_fd; -extern int mbms_rab_id; - - extern struct msghdr nas_msg_tx; extern struct msghdr nas_msg_rx; diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index f9fc506860..0776a3863e 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -62,6 +62,7 @@ typedef struct { typedef struct { rnti_t rnti; + ebi_t rb_id; gtpCallback callBack; } rntiData_t; @@ -92,6 +93,8 @@ static uint32_t gtpv1uNewTeid(void) { #endif } +int legacyInstanceMapping=0; +#define compatInst(a) ((a)==0 || (a)==INSTANCE_DEFAULT?legacyInstanceMapping:a) #define GTPV1U_HEADER_SIZE (8) static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, teid_t teid, uint8_t *Msg,int msgLen, @@ -147,11 +150,11 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b uint64_t rnti=req->rnti; int rab_id=req->rab_id; pthread_mutex_lock(&globGtp.gtp_lock); - auto inst=&globGtp.instances[instance]; + auto inst=&globGtp.instances[compatInst(instance)]; auto ptrRnti=inst->ue2te_mapping.find(rnti); if ( ptrRnti==inst->ue2te_mapping.end() ) { - LOG_E(GTPU, "Gtpv1uProcessUlpReq failed: while getting ue rnti %lx in hashtable ue_mapping\n", rnti); + LOG_E(GTPU, "gtpv1uSend failed: while getting ue rnti %lx in hashtable ue_mapping\n", rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -173,7 +176,7 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b ptr[rab_id].npduNum++; pthread_mutex_unlock(&globGtp.gtp_lock); - gtpv1uCreateAndSendMsg(instance, + gtpv1uCreateAndSendMsg(compatInst(instance), ptr[rab_id].outgoing_ip_addr, ptr[rab_id].outgoing_port, ptr[rab_id].teid_outgoing, @@ -210,8 +213,21 @@ static int udpServerSocket(openAddr_s addr) { } else { // We create the gtp instance on the socket globGtp.instances[sockfd].addr=addr; - memcpy(globGtp.instances[sockfd].foundAddr, p->ai_addr, p->ai_addrlen); - globGtp.instances[sockfd].foundAddrLen=p->ai_addrlen; + + if (p->ai_family == AF_INET) { + struct sockaddr_in *ipv4=(struct sockaddr_in *)p->ai_addr; + memcpy(globGtp.instances[sockfd].foundAddr, + &ipv4->sin_addr.s_addr, sizeof(ipv4->sin_addr.s_addr)); + globGtp.instances[sockfd].foundAddrLen=sizeof(ipv4->sin_addr.s_addr); + break; + } else if (p->ai_family == AF_INET6) { + LOG_W(GTPU,"Local address is IP v6\n"); + struct sockaddr_in6 *ipv6=(struct sockaddr_in6 *)p->ai_addr; + memcpy(globGtp.instances[sockfd].foundAddr, + &ipv6->sin6_addr.s6_addr, sizeof(ipv6->sin6_addr.s6_addr)); + globGtp.instances[sockfd].foundAddrLen=sizeof(ipv6->sin6_addr.s6_addr); + } else + AssertFatal(false,"Local address is not IPv4 or IPv6"); } break; // if we get here, we must have connected successfully @@ -284,6 +300,8 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int bearer_id, teid inst->te2ue_mapping[s1u_teid].rnti=rnti; + inst->te2ue_mapping[s1u_teid].rb_id= teid; + inst->te2ue_mapping[s1u_teid].callBack=callBack; auto tmp=&inst->ue2te_mapping[rnti].bearers[bearer_id]; @@ -326,9 +344,9 @@ int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, create_tunnel_req->sgw_S1u_teid[0]); for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { - teid_t teid=newGtpuCreateTunnel(instance, create_tunnel_req->rnti, - create_tunnel_req->eps_bearer_id[i], + teid_t teid=newGtpuCreateTunnel(compatInst(instance), create_tunnel_req->rnti, create_tunnel_req->eps_bearer_id[i], + create_tunnel_req->sgw_S1u_teid[i], create_tunnel_req->sgw_addr[i], 2152, pdcp_data_req); create_tunnel_resp->status=0; @@ -336,9 +354,9 @@ int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels; create_tunnel_resp->enb_S1u_teid[i]=teid; create_tunnel_resp->eps_bearer_id[i] = create_tunnel_req->eps_bearer_id[i]; - memcpy(create_tunnel_resp->enb_addr.buffer,globGtp.instances[instance].foundAddr, - globGtp.instances[instance].foundAddrLen); - create_tunnel_resp->enb_addr.length= globGtp.instances[instance].foundAddrLen; + memcpy(create_tunnel_resp->enb_addr.buffer,globGtp.instances[compatInst(instance)].foundAddr, + globGtp.instances[compatInst(instance)].foundAddrLen); + create_tunnel_resp->enb_addr.length= globGtp.instances[compatInst(instance)].foundAddrLen; } return !GTPNOK; @@ -356,7 +374,7 @@ int ocp_gtpv1u_update_s1u_tunnel( create_tunnel_req->sgw_S1u_teid[0], create_tunnel_req->eps_bearer_id[0]); pthread_mutex_lock(&globGtp.gtp_lock); - auto inst=&globGtp.instances[instance]; + auto inst=&globGtp.instances[compatInst(instance)]; if ( inst->ue2te_mapping.find(create_tunnel_req->rnti) != inst->ue2te_mapping.end() ) { LOG_E(GTPU,"Update a existing GTP tunnel to a already existing tunnel (new rnti %x, old rnti %x)\n", create_tunnel_req->rnti, prior_rnti); @@ -385,15 +403,12 @@ int ocp_gtpv1u_create_x2u_tunnel( AssertFatal( false, "to be developped\n"); } -int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, - const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { - LOG_D(GTPU, "Start delete tunnels for RNTI %x, num_erab %d, eps_bearer_id %d \n", - req_pP->rnti, - req_pP->num_erab, - req_pP->eps_bearer_id[0]); +int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) { + LOG_D(GTPU, "Start delete tunnels for RNTI %x\n", + rnti); pthread_mutex_lock(&globGtp.gtp_lock); - auto inst=&globGtp.instances[instance]; - auto it=inst->ue2te_mapping.find(req_pP->rnti); + auto inst=&globGtp.instances[compatInst(instance)]; + auto it=inst->ue2te_mapping.find(rnti); if ( it == inst->ue2te_mapping.end() ) { LOG_W(GTPU,"Delete a non existing GTP tunnel\n"); @@ -411,6 +426,13 @@ int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, return !GTPNOK; } +// Legacy delete tunnel finish by deleting all the rnti +// so the list of bearer provided is only a design bug +int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, + const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { + return newGtpuDeleteTunnel(instance, req_pP->rnti); +} + static int Gtpv1uHandleEchoReq(int h, uint8_t *msgBuf, uint32_t msgBufLen, @@ -489,10 +511,10 @@ static int Gtpv1uHandleGpdu(int h, ctxt.frame = 0; ctxt.subframe = 0; ctxt.eNB_index = 0; - ctxt.configured = 1; + ctxt.configured = 0; ctxt.brOption = 0; const srb_flag_t srb_flag=SRB_FLAG_NO; - const rb_id_t rb_id=0; + const rb_id_t rb_id=tunnel->second.rb_id; const mui_t mui=RLC_MUI_UNDEFINED; const confirm_t confirm=RLC_SDU_CONFIRM_NO; const sdu_size_t sdu_buffer_size=msgBufLen-offset; @@ -529,7 +551,7 @@ void gtpv1uReceiver(int h) { if ((udpDataLen = recvfrom(h, udpData, sizeof(udpData), 0, (struct sockaddr *)&addr, &from_len)) < 0) { - LOG_E(GTPU, "Recvfrom failed %s\n", strerror(errno)); + LOG_E(GTPU, "Recvfrom failed on %d (%s)\n", h, strerror(errno)); return; } else if (udpDataLen == 0) { LOG_W(GTPU, "Recvfrom returned 0\n"); @@ -586,7 +608,7 @@ void *ocp_gtpv1uTask(void *args) { switch (ITTI_MSG_ID(message_p)) { // DATA TO BE SENT TO UDP case GTPV1U_ENB_TUNNEL_DATA_REQ: { - gtpv1uSend(ITTI_MESSAGE_GET_INSTANCE(message_p), + gtpv1uSend(compatInst(ITTI_MESSAGE_GET_INSTANCE(message_p)), >PV1U_ENB_TUNNEL_DATA_REQ(message_p), false, false); itti_free(OCP_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer); } @@ -611,7 +633,7 @@ void *ocp_gtpv1uTask(void *args) { // to be dev: should be removed, to use API strcpy(addr.originHost, GTPV1U_ENB_S1_REQ(message_p).addrStr); strcpy(addr.originService, GTPV1U_ENB_S1_REQ(message_p).portStr); - AssertFatal(ocp_gtpv1Init(addr),"Only one instance 0 supprted\n"); + AssertFatal((legacyInstanceMapping=ocp_gtpv1Init(addr))!=0,"Instance 0 reserved for legacy\n"); break; default: @@ -627,8 +649,8 @@ void *ocp_gtpv1uTask(void *args) { int nb_events = itti_get_events(OCP_GTPV1_U, &events); - if (nb_events > 0 && events!= NULL ) - for (int i = 0; i < nb_events; i++) + for (int i = 0; i < nb_events; i++) + if ((events[i].events&EPOLLIN)) gtpv1uReceiver(events[i].data.fd); } From 7eda2b7409c1e176c6f07ea600b34388a97b5387 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Mon, 1 Feb 2021 15:35:17 +0100 Subject: [PATCH 04/66] remainign bug after merge develop --- cmake_targets/CMakeLists.txt | 15 ++------------- executables/nr-softmodem.c | 1 + openair3/ocp-gtpu/gtp_itf.h | 1 + 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index a210524220..51287a8ba4 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -405,7 +405,7 @@ add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace") add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace") add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering") -add_boolean_option(NEW_GTPU True "NEW_GTP") +add_boolean_option(NEW_GTPU False "NEW_GTP") set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti) add_library(ITTI @@ -2207,16 +2207,6 @@ add_library(CN_UTILS ) set(GTPV1U_DIR ${OPENAIR3_DIR}/GTPV1-U) -set (GTPV1U_SRC - ${RRC_DIR}/rrc_eNB_GTPV1U.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1u.c - ${GTPV1U_DIR}/gtpv1u_teid_pool.c -) -add_library(GTPV1U ${GTPV1U_SRC}) -add_dependencies(GTPV1U rrc_flag) add_library (GTPV1U_OCP ${NR_RRC_DIR}/rrc_gNB_GTPV1U.c @@ -2231,6 +2221,7 @@ set (NR_GTPV1U_SRC ${NR_RRC_DIR}/rrc_gNB_GTPV1U.c ${RRC_DIR}/rrc_eNB_GTPV1U.c ${GTPV1U_DIR}/gtpv1u_eNB.c + ${GTPV1U_DIR}/gtpv1u_gNB.c ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c @@ -3022,7 +3013,6 @@ add_executable(nr-softmodem ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_gNB.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c @@ -3539,7 +3529,6 @@ add_executable(nr-ittisim ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_gNB.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/utils.c diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 82dcec1220..7884ca9e81 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -85,6 +85,7 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "x2ap_eNB.h" #include "ngap_gNB.h" #include "gnb_paramdef.h" +#include pthread_cond_t nfapi_sync_cond; pthread_mutex_t nfapi_sync_mutex; diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h index 24b1adaa6f..507aa1338e 100644 --- a/openair3/ocp-gtpu/gtp_itf.h +++ b/openair3/ocp-gtpu/gtp_itf.h @@ -14,6 +14,7 @@ extern "C" { #define gtpv1u_delete_s1u_tunnel ocp_gtpv1u_delete_s1u_tunnel #define gtpv1u_create_x2u_tunnel ocp_gtpv1u_create_x2u_tunnel #define gtpv1u_eNB_task ocp_gtpv1uTask +#define gtpv1u_gNB_task ocp_gtpv1uTask #define TASK_VARIABLE OCP_GTPV1_U #else #define TASK_VARIABLE TASK_GTPV1_U From 3b1b74cfd2512cd1195b1b029128dbbba03fa310 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 4 Mar 2021 13:22:14 +0100 Subject: [PATCH 05/66] starting --- .../install_external_packages.ubuntu20 | 22 +++++++++++++------ openair1/SIMULATION/TOOLS/random_channel.c | 14 ++++++++---- openair1/SIMULATION/TOOLS/sim.h | 4 +++- targets/ARCH/rfsimulator/apply_channelmod.c | 2 +- targets/ARCH/rfsimulator/simulator.c | 8 +++++-- targets/RT/USER/rfsim.c | 2 ++ 6 files changed, 37 insertions(+), 15 deletions(-) diff --git a/cmake_targets/install_external_packages.ubuntu20 b/cmake_targets/install_external_packages.ubuntu20 index 9ef79be9c2..db6e324eab 100755 --- a/cmake_targets/install_external_packages.ubuntu20 +++ b/cmake_targets/install_external_packages.ubuntu20 @@ -157,8 +157,16 @@ install_protobuf_from_source(){ #cd protobuf-2.6.1/ rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz - tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner "$USER" --group "$(groups | cut -d" " -f1)" --no-same-owner - cd protobuf-3.3.0/ || exit + tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner + cd protobuf-3.3.0/ + else + export LD_LIBRARY_PATH=/usr/local/lib #protoc needs to know where toclook for shared libs + rm -rf /tmp/protobuf + git clone --depth=1 --branch=v3.3.0 https://github.com/protocolbuffers/protobuf.git /tmp/protobuf + cd /tmp/protobuf + git submodule update --init --recursive + ./autogen.sh + fi ./configure echo "Compiling protobuf" make -j"$(nproc)" @@ -198,15 +206,15 @@ install_usrp_uhd_driver_from_source(){ rm -rf /tmp/uhd git clone https://github.com/EttusResearch/uhd.git cd uhd || exit - git checkout tags/v3.13.0.2 + git checkout UHD-3.15.LTS mkdir -p host/build cd host/build || exit - $CMAKE ../ + $CMAKE ../ -GNinja echo "Compiling UHD" - make -j"$(nproc)" - make test - $SUDO make install + ninja + $SUDO ninja install $SUDO ldconfig + $SUDO /usr/lib/uhd/utils/uhd_images_downloader.py ) >& "$uhd_install_log" } diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c index 8c063fadc0..6ce3d27ec1 100644 --- a/openair1/SIMULATION/TOOLS/random_channel.c +++ b/openair1/SIMULATION/TOOLS/random_channel.c @@ -502,7 +502,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, double DS_TDL, double forgetting_factor, int32_t channel_offset, - double path_loss_dB) { + double path_loss_dB, + float noise_power_dB) { channel_desc_t *chan_desc = (channel_desc_t *)calloc(1,sizeof(channel_desc_t)); for(int i=0; ipath_loss_dB = path_loss_dB; chan_desc->first_run = 1; chan_desc->ip = 0.0; + chan_desc->noise_power_dB = noise_power_dB; + LOG_I(OCM,"Channel Model (inside of new_channel_desc_scm)=%d\n\n", channel_model); int tdl_paths=0; @@ -1861,7 +1864,7 @@ static int channelmod_print_help(char *buff, int debug, telnet_printfunc_t prnt prnt("channelmod show current: display the currently used models in the running executable\n"); prnt("channelmod modify : set the specified parameters in a current model to the given value\n"); prnt(" specifies the model, the show current model command can be used to list the current models indexes\n"); - prnt(" can be one of \"riceanf\", \"aoa\", \"randaoa\", \"ploss\", \"offset\", \"forgetf\"\n"); + prnt(" can be one of \"riceanf\", \"aoa\", \"randaoa\", \"ploss\", \"noise_power_dB\", \"offset\", \"forgetf\"\n"); return CMDSTATUS_FOUND; } @@ -1874,8 +1877,8 @@ static void display_channelmodel(channel_desc_t *cd,int debug, telnet_printfunc_ prnt("nb_tx: %i nb_rx: %i taps: %i bandwidth: %lf sampling: %lf\n",cd->nb_tx, cd->nb_rx, cd->nb_taps, cd->channel_bandwidth, cd->sampling_rate); prnt("channel length: %i Max path delay: %lf ricean fact.: %lf angle of arrival: %lf (randomized:%s)\n", cd->channel_length, cd->Td, cd->ricean_factor, cd->aoa, (cd->random_aoa?"Yes":"No")); - prnt("max Doppler: %lf path loss: %lf rchannel offset: %i forget factor; %lf\n", - cd->max_Doppler, cd->path_loss_dB, cd->channel_offset, cd->forgetting_factor); + prnt("max Doppler: %lf path loss: %lf noise: %lf rchannel offset: %i forget factor; %lf\n", + cd->max_Doppler, cd->path_loss_dB, cd->noise_power_dB, cd->channel_offset, cd->forgetting_factor); prnt("Initial phase: %lf nb_path: %i \n", cd->ip, cd->nb_paths); for (int i=0; inb_taps ; i++) { @@ -1945,6 +1948,9 @@ static int channelmod_modify_cmd(char *buff, int debug, telnet_printfunc_t prnt) } else if ( strcmp(param,"ploss") == 0) { double dbl = atof(value); defined_channels[cd_id]->path_loss_dB=dbl; + } else if ( strcmp(param,"noise_power_dB") == 0) { + double dbl = atof(value); + defined_channels[cd_id]->noise_power_dB=dbl; } else if ( strcmp(param,"offset") == 0) { int i = atoi(value); defined_channels[cd_id]->channel_offset=i; diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h index 55a78e9778..97be5bf7e9 100644 --- a/openair1/SIMULATION/TOOLS/sim.h +++ b/openair1/SIMULATION/TOOLS/sim.h @@ -89,6 +89,7 @@ typedef struct { double path_loss_dB; ///additional delay of channel in samples. int32_t channel_offset; + float noise_power_dB; ///This parameter (0...1) allows for simple 1st order temporal variation. 0 means a new channel every call, 1 means keep channel constant all the time double forgetting_factor; ///needs to be set to 1 for the first call, 0 otherwise. @@ -280,7 +281,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, double TDL_DS, double forgetting_factor, int32_t channel_offset, - double path_loss_dB); + double path_loss_dB, + float noise_power_dB); /** \brief free memory allocated for a model descriptor \param ch points to the model, which cannot be used after calling this fuction diff --git a/targets/ARCH/rfsimulator/apply_channelmod.c b/targets/ARCH/rfsimulator/apply_channelmod.c index 3f4c0e1517..9ff9eda4d3 100644 --- a/targets/ARCH/rfsimulator/apply_channelmod.c +++ b/targets/ARCH/rfsimulator/apply_channelmod.c @@ -72,7 +72,7 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si // Fixme: how to convert a noise in Watt into a 12 bits value out of the RF ADC ? // the parameter "-s" is declared as SNR, but the input power is not well defined // −132.24 dBm is a LTE subcarrier noise, that was used in origin code (15KHz BW thermal noise) - const double rxGain= 132.24 - channelmod_get_snr_dB(); + const double rxGain= 132.24 - channelDesc->noise_power_dB; // sqrt(4*noise_figure_watt) is the thermal noise factor (volts) // fixme: the last constant is pure trial results to make decent noise const double noise_per_sample = sqrt(4*noise_figure_watt) * pow(10,rxGain/20) *10; diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index cd35c46a15..6a4db361df 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -133,6 +133,7 @@ typedef struct { double chan_pathloss; double chan_forgetfact; int chan_offset; + float noise_power_dB; void *telnetcmd_qid; poll_telnetcmdq_func_t poll_telnetcmdq; } rfsimulator_state_t; @@ -190,7 +191,8 @@ static void allocCirBuf(rfsimulator_state_t *bridge, int sock) { 30e-9, // TDL delay-spread parameter bridge->chan_forgetfact, // forgetting_factor bridge->chan_offset, // maybe used for TA - bridge->chan_pathloss); // path_loss in dB + bridge->chan_pathloss, + bridge->noise_power_dB); // path_loss in dB set_channeldesc_owner(ptr->channel_model, RFSIMU_MODULEID); random_channel(ptr->channel_model,false); } @@ -341,7 +343,9 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, 30e-9, // TDL delay-spread parameter t->chan_forgetfact, // forgetting_factor t->chan_offset, // maybe used for TA - t->chan_pathloss); // path_loss in dB + t->chan_pathloss, + t->noise_power_dB + ); // path_loss in dB set_channeldesc_owner(newmodel, RFSIMU_MODULEID); random_channel(newmodel,false); channel_desc_t *oldmodel=b->channel_model; diff --git a/targets/RT/USER/rfsim.c b/targets/RT/USER/rfsim.c index eb380b9518..2bd95507c3 100644 --- a/targets/RT/USER/rfsim.c +++ b/targets/RT/USER/rfsim.c @@ -361,6 +361,7 @@ void init_ocm(void) { DS_TDL, 0.0, 0, + 0, 0); random_channel(sim.RU2UE[ru_id][UE_id][CC_id],0); LOG_D(OCM,"[SIM] Initializing channel (%s) from UE %d to ru %d\n", "AWGN", UE_id, ru_id); @@ -374,6 +375,7 @@ void init_ocm(void) { DS_TDL, 0.0, 0, + 0, 0); random_channel(sim.UE2RU[UE_id][ru_id][CC_id],0); // to make channel reciprocal uncomment following line instead of previous. However this only works for SISO at the moment. For MIMO the channel would need to be transposed. From 782053f03ff26991b5729cac6d69404f4bf9802e Mon Sep 17 00:00:00 2001 From: frtabu Date: Tue, 9 Mar 2021 01:19:39 +0100 Subject: [PATCH 06/66] enhance channel model configuration --- ci-scripts/conf_files/channelmod_rfsimu.conf | 48 ++++++++++ common/config/config_cmdline.c | 2 +- openair1/SIMULATION/TOOLS/random_channel.c | 95 +++++++++++++++++--- openair1/SIMULATION/TOOLS/sim.h | 47 ++++++++-- targets/ARCH/rfsimulator/simulator.c | 44 +++++---- 5 files changed, 193 insertions(+), 43 deletions(-) create mode 100644 ci-scripts/conf_files/channelmod_rfsimu.conf diff --git a/ci-scripts/conf_files/channelmod_rfsimu.conf b/ci-scripts/conf_files/channelmod_rfsimu.conf new file mode 100644 index 0000000000..c7abffa878 --- /dev/null +++ b/ci-scripts/conf_files/channelmod_rfsimu.conf @@ -0,0 +1,48 @@ +/* configuration for channel modelisation */ +/* To be included in main config file when */ +/* channel modelisation is used (rfsimulator with chanmod options enabled) */ +channelmod = { + max_chan=10; + modellist="modellist_rfsimu_1"; + modellist_rfsimu_1 = ( + { + model_name = "rfsimu_channel_ue0" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + { + model_name = "rfsimu_channel_ue0" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + ); + modellist_rfsimu_2 = ( + { + model_name = "rfsimu_channel_ue0" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + { + model_name = "rfsimu_channel_ue0" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + ); +}; + diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c index 6d01d98c65..1df1bc16f7 100644 --- a/common/config/config_cmdline.c +++ b/common/config/config_cmdline.c @@ -255,7 +255,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */ ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) || /* long option beginning with "--" */ ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgoptions[n].optname) == 0) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) || - ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) { + ((strlen(oneargv) > 2) && (strcmp(oneargv + 2, cfgoptions[n].optname) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) { char *valptr=NULL; int ret; config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED; diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c index 6ce3d27ec1..7d8ef0a27c 100644 --- a/openair1/SIMULATION/TOOLS/random_channel.c +++ b/openair1/SIMULATION/TOOLS/random_channel.c @@ -61,7 +61,9 @@ static telnetshell_vardef_t channelmod_vardef[] = { static double snr_dB=25; static double sinr_dB=0; static unsigned int max_chan; -static channel_desc_t** defined_channels; +static channel_desc_t **defined_channels; +static char modellist_name[MAX_OPTNAME_SIZE]; + void fill_channel_desc(channel_desc_t *chan_desc, uint8_t nb_tx, uint8_t nb_rx, @@ -494,16 +496,17 @@ struct complex *R_sqrt_22_EPA_medium[1] = {R_sqrt_22_EPA_medium_tap}; //Rayleigh1_orth_eff_ch_TM4 + channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, uint8_t nb_rx, SCM_t channel_model, double sampling_rate, double channel_bandwidth, - double DS_TDL, + double DS_TDL, double forgetting_factor, int32_t channel_offset, double path_loss_dB, - float noise_power_dB) { + float noise_power_dB) { channel_desc_t *chan_desc = (channel_desc_t *)calloc(1,sizeof(channel_desc_t)); for(int i=0; inb_paths = 10; return(chan_desc); -} - +} /* channel_desc_t *new_channel_desc_scm */ + +channel_desc_t * find_channel_desc_fromname( char *modelname ) { + for(int i=0; imodel_name,modelname) == 0) + return defined_channels[i]; + } + } + LOG_E(OCM,"Model %s not found \n", modelname); + return NULL; +} /* channel_desc_t * new_channel_desc_fromconfig */ + + + void free_channel_desc_scm(channel_desc_t *ch) { // Must be made cleanly, a lot of leaks... defined_channels[ch->chan_idx]=NULL; @@ -1657,7 +1675,8 @@ void free_channel_desc_scm(channel_desc_t *ch) { free(ch->R_sqrt); free(ch->ch); free(ch->chF); - free(ch->a); + free(ch->a); + free(ch->model_name); free(ch); } @@ -1851,7 +1870,7 @@ double N_RB2channel_bandwidth(uint16_t N_RB) { break; default: - LOG_E(PHY,"Unknown N_PRB\n"); + LOG_E(OCM,"Unknown N_PRB\n"); return(-1); } return(channel_bandwidth); @@ -1989,18 +2008,74 @@ double channelmod_get_sinr_dB(void) { void init_channelmod(void) { paramdef_t channelmod_params[] = CHANNELMOD_PARAMS_DESC; - int ret = config_get( channelmod_params,sizeof(channelmod_params)/sizeof(paramdef_t),CHANNELMOD_SECTION); + + int numparams=sizeof(channelmod_params)/sizeof(paramdef_t); + int ret = config_get( channelmod_params,numparams,CHANNELMOD_SECTION); AssertFatal(ret >= 0, "configuration couldn't be performed"); defined_channels=calloc(max_chan,sizeof( channel_desc_t*)); AssertFatal(defined_channels!=NULL, "couldn't allocate %u channel descriptors\n",max_chan); - + /* look for telnet server, if it is loaded, add the channel modeling commands to it */ add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME); if (addcmd != NULL) { addcmd("channelmod",channelmod_vardef,channelmod_cmdarray); } -} +} /* init_channelmod */ + +void load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) { + + paramdef_t channelmod_params[] = CHANNELMOD_PARAMS_DESC; + + int numparams=sizeof(channelmod_params)/sizeof(paramdef_t); + int ret = config_get( channelmod_params,numparams,CHANNELMOD_SECTION); + AssertFatal(ret >= 0, "configuration couldn't be performed"); + defined_channels=calloc(max_chan,sizeof( channel_desc_t*)); + AssertFatal(defined_channels!=NULL, "couldn't allocate %u channel descriptors\n",max_chan); + + + paramdef_t achannel_params[] = CHANNELMOD_MODEL_PARAMS_DESC; + paramlist_def_t channel_list; + memset(&channel_list,0,sizeof(paramlist_def_t)); + strncpy(channel_list.listname,modellist_name,MAX_OPTNAME_SIZE-1); + + numparams = sizeof(achannel_params)/sizeof(paramdef_t); + config_getlist( &channel_list,achannel_params,numparams, CHANNELMOD_SECTION); + AssertFatal(channel_list.numelt>0, "List %s.%s not found in config filee\n",CHANNELMOD_SECTION,CHANNELMOD_MODELLIST_PARANAME); + int pindex_NAME = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_NAME_PNAME); + int pindex_DT = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_DT_PNAME ); + int pindex_FF = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_FF_PNAME ); + int pindex_CO = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_CO_PNAME ); + int pindex_PL = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_PL_PNAME ); + int pindex_NP = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_NP_PNAME ); + int pindex_TYPE = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_TYPE_PNAME); + + for (int i=0; imodel_name = strdup(*(channel_list.paramarray[i][pindex_NAME].strptr)); + LOG_I(OCM,"Model %s type %s allocated from config file, list %s\n",*(channel_list.paramarray[i][pindex_NAME].strptr), + *(channel_list.paramarray[i][pindex_TYPE].strptr), modellist_name); + } /* for loop on channel_list */ + /* look for telnet server, if it is loaded, add the channel modeling commands to it */ + add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME); + + if (addcmd != NULL) { + addcmd("channelmod",channelmod_vardef,channelmod_cmdarray); + } +} /* load_channelist */ #ifdef RANDOM_CHANNEL_MAIN #define sampling_rate 5.0 diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h index 97be5bf7e9..69e9871a7a 100644 --- a/openair1/SIMULATION/TOOLS/sim.h +++ b/openair1/SIMULATION/TOOLS/sim.h @@ -107,8 +107,10 @@ typedef struct { unsigned int chan_idx; /// id of the channel modeling algorithm int modelid; - /// identifies channel descriptor owner (the module which created this descriptor) + /// identifies channel descriptor owner (the module which created this descriptor channelmod_moduleid_t module_id; + /// name of this descriptor,used for model created from config file at init time + char *model_name; /// flags to properly trigger memory free unsigned int free_flags; } channel_desc_t; @@ -242,12 +244,37 @@ typedef enum { #define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n" #define CHANNELMOD_SECTION "channelmod" + +/* global channel modelization parameters */ +#define CHANNELMOD_MODELLIST_PARANAME "modellist" + +#define CHANNELMOD_HELP_MODELLIST " channel list name in config file describing the model type and its parameters\n" #define CHANNELMOD_PARAMS_DESC { \ - {"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\ - {"sinr_dB", NULL, 0 , dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\ - {"max_chan, CONFIG_HLP_MAX_CHAN", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\ + {"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\ + {"sinr_dB", NULL, 0, dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\ + {"max_chan", "Max number of runtime models", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\ + {CHANNELMOD_MODELLIST_PARANAME, CHANNELMOD_HELP_MODELLIST, 0, strptr:(char **)&modellist_name, defstrval:"DefaultChannelList", TYPE_STRING, 0 },\ } +/* parameters for one model */ +#define CHANNELMOD_MODEL_NAME_PNAME "model_name" +#define CHANNELMOD_MODEL_TYPE_PNAME "type" +#define CHANNELMOD_MODEL_PL_PNAME "ploss_dB" +#define CHANNELMOD_MODEL_NP_PNAME "noise_power_dB" +#define CHANNELMOD_MODEL_FF_PNAME "forgetfact" +#define CHANNELMOD_MODEL_CO_PNAME "offset" +#define CHANNELMOD_MODEL_DT_PNAME "ds_tdl" + +#define CHANNELMOD_MODEL_PARAMS_DESC { \ + {CHANNELMOD_MODEL_NAME_PNAME, "name of the model\n", 0, strptr:NULL , defstrval:"", TYPE_STRING, 0 },\ + {CHANNELMOD_MODEL_TYPE_PNAME, "name of the model type\n", 0, strptr:NULL , defstrval:"AWGN", TYPE_STRING, 0 },\ + {CHANNELMOD_MODEL_PL_PNAME, "channel path loss in dB\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\ + {CHANNELMOD_MODEL_NP_PNAME, "channel noise in dB\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\ + {CHANNELMOD_MODEL_FF_PNAME, "channel forget factor ((0 to 1)\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\ + {CHANNELMOD_MODEL_CO_PNAME, "channel offset in samps\n", 0, iptr:NULL, defintval:0, TYPE_INT, 0 },\ + {CHANNELMOD_MODEL_DT_PNAME, "delay spread for TDL models\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 }\ +} + #include "platform_constants.h" typedef struct { @@ -276,13 +303,17 @@ typedef struct { channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, uint8_t nb_rx, SCM_t channel_model, - double sampling_rate, + double sampling_rate, double channel_bandwidth, - double TDL_DS, + double TDL_DS, double forgetting_factor, int32_t channel_offset, double path_loss_dB, - float noise_power_dB); + float noise_power_dB); + +channel_desc_t *find_channel_desc_fromname( char *modelname ); + + /** \brief free memory allocated for a model descriptor \param ch points to the model, which cannot be used after calling this fuction @@ -458,7 +489,7 @@ int modelid_fromname(char *modelname); double channelmod_get_snr_dB(void); double channelmod_get_sinr_dB(void); void init_channelmod(void) ; - +void load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) ; double N_RB2sampling_rate(uint16_t N_RB); double N_RB2channel_bandwidth(uint16_t N_RB); diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index 6a4db361df..3d9b000331 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -69,7 +69,9 @@ extern RAN_CONTEXT_t RC; #define RFSIMU_SECTION "rfsimulator" #define RFSIMU_OPTIONS_PARAMNAME "options" -# define RFSIM_CONFIG_HELP_OPTIONS " list of comma separated options to enable rf simulator functionalities. Available options: \n"\ + + +#define RFSIM_CONFIG_HELP_OPTIONS " list of comma separated options to enable rf simulator functionalities. Available options: \n"\ " chanmod: enable channel modelisation\n"\ " saviq: enable saving written iqs to a file\n" /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -78,14 +80,14 @@ extern RAN_CONTEXT_t RC; /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define simOpt PARAMFLAG_NOFREE|PARAMFLAG_CMDLINE_NOPREFIXENABLED #define RFSIMULATOR_PARAMS_DESC { \ - {"serveraddr", "\n", simOpt , strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\ - {"serverport", "\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\ - {RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\ - {"IQfile", "\n",simOpt, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\ - {"modelname", "\n", simOpt, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\ - {"ploss", "\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\ - {"forgetfact", "\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\ - {"offset", "\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\ + {"serveraddr", "\n", simOpt, strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\ + {"serverport", "\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\ + {RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\ + {"IQfile", "\n",simOpt, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\ + {"modelname", "\n", simOpt, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\ + {"ploss", "\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\ + {"forgetfact", "\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\ + {"offset", "\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\ }; @@ -183,16 +185,8 @@ static void allocCirBuf(rfsimulator_state_t *bridge, int sock) { tableNor(rand); init_done=true; } - - ptr->channel_model=new_channel_desc_scm(bridge->tx_num_channels,bridge->rx_num_channels, - bridge->channelmod, - bridge->sample_rate, - bridge->tx_bw, - 30e-9, // TDL delay-spread parameter - bridge->chan_forgetfact, // forgetting_factor - bridge->chan_offset, // maybe used for TA - bridge->chan_pathloss, - bridge->noise_power_dB); // path_loss in dB + char *modelname = (bridge->typeStamp == ENB_MAGICDL) ? "rfsimu_channel_ue0":"rfsimu_channel_enB0"; + ptr->channel_model=find_channel_desc_fromname(modelname); // path_loss in dB set_channeldesc_owner(ptr->channel_model, RFSIMU_MODULEID); random_channel(ptr->channel_model,false); } @@ -301,6 +295,7 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) { break; } else if (strcmp(rfsimu_params[p].strlistptr[i],"chanmod") == 0) { init_channelmod(); + load_channellist(rfsimulator->tx_num_channels, rfsimulator->rx_num_channels, rfsimulator->sample_rate, rfsimulator->tx_bw); rfsimulator->channelmod=modelid_fromname(modelname); } else { fprintf(stderr,"Unknown rfsimulator option: %s\n",rfsimu_params[p].strlistptr[i]); @@ -778,6 +773,11 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { // to change the log level, use this on command line // --log_config.hw_log_level debug rfsimulator_state_t *rfsimulator = (rfsimulator_state_t *)calloc(sizeof(rfsimulator_state_t),1); + // initialize channel simulation + rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels; + rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels; + rfsimulator->sample_rate=openair0_cfg->sample_rate; + rfsimulator->tx_bw=openair0_cfg->tx_bw; rfsimulator_readconfig(rfsimulator); pthread_mutex_init(&Sockmutex, NULL); LOG_I(HW,"rfsimulator: running as %s\n", rfsimulator-> typeStamp == ENB_MAGICDL ? "server waiting opposite rfsimulators to connect" : "client: will connect to a rfsimulator server side"); @@ -802,11 +802,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { rfsimulator->buf[i].conn_sock=-1; AssertFatal((rfsimulator->epollfd = epoll_create1(0)) != -1,""); - // initialize channel simulation - rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels; - rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels; - rfsimulator->sample_rate=openair0_cfg->sample_rate; - rfsimulator->tx_bw=openair0_cfg->tx_bw; + //randominit(0); set_taus_seed(0); /* look for telnet server, if it is loaded, add the channel modeling commands to it */ From 1f0e82664f180c1b3cfaf42cacf901b30e401e27 Mon Sep 17 00:00:00 2001 From: frtabu Date: Tue, 9 Mar 2021 01:19:39 +0100 Subject: [PATCH 07/66] enhance channel model configuration --- ci-scripts/conf_files/channelmod_rfsimu.conf | 48 ++++++++++ common/config/config_cmdline.c | 2 +- common/utils/telnetsrv/telnetsrv.c | 2 +- openair1/SIMULATION/TOOLS/random_channel.c | 99 ++++++++++++++++---- openair1/SIMULATION/TOOLS/sim.h | 55 +++++++++-- targets/ARCH/rfsimulator/simulator.c | 86 +++++++++-------- 6 files changed, 226 insertions(+), 66 deletions(-) create mode 100644 ci-scripts/conf_files/channelmod_rfsimu.conf diff --git a/ci-scripts/conf_files/channelmod_rfsimu.conf b/ci-scripts/conf_files/channelmod_rfsimu.conf new file mode 100644 index 0000000000..c7abffa878 --- /dev/null +++ b/ci-scripts/conf_files/channelmod_rfsimu.conf @@ -0,0 +1,48 @@ +/* configuration for channel modelisation */ +/* To be included in main config file when */ +/* channel modelisation is used (rfsimulator with chanmod options enabled) */ +channelmod = { + max_chan=10; + modellist="modellist_rfsimu_1"; + modellist_rfsimu_1 = ( + { + model_name = "rfsimu_channel_ue0" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + { + model_name = "rfsimu_channel_ue0" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + ); + modellist_rfsimu_2 = ( + { + model_name = "rfsimu_channel_ue0" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + { + model_name = "rfsimu_channel_ue0" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + ); +}; + diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c index 6d01d98c65..1df1bc16f7 100644 --- a/common/config/config_cmdline.c +++ b/common/config/config_cmdline.c @@ -255,7 +255,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */ ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) || /* long option beginning with "--" */ ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgoptions[n].optname) == 0) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) || - ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) { + ((strlen(oneargv) > 2) && (strcmp(oneargv + 2, cfgoptions[n].optname) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) { char *valptr=NULL; int ret; config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED; diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c index 03f7af99bc..5a1fefbf3d 100644 --- a/common/utils/telnetsrv/telnetsrv.c +++ b/common/utils/telnetsrv/telnetsrv.c @@ -495,7 +495,7 @@ int process_command(char *buf) { memset(cmdb,0,sizeof(cmdb)); bufbck=strdup(buf); rt=CMDSTATUS_NOTFOUND; - j = sscanf(buf,"%19s %19s %19[^\t\n]",modulename,cmd,cmdb); + j = sscanf(buf,"%19s %19s %[^\t\n]",modulename,cmd,cmdb); if (telnetparams.telnetdbg > 0) printf("process_command: %i words, module=%s cmd=%s, parameters= %s\n",j,modulename,cmd,cmdb); diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c index 6ce3d27ec1..a6877cd9e1 100644 --- a/openair1/SIMULATION/TOOLS/random_channel.c +++ b/openair1/SIMULATION/TOOLS/random_channel.c @@ -61,7 +61,9 @@ static telnetshell_vardef_t channelmod_vardef[] = { static double snr_dB=25; static double sinr_dB=0; static unsigned int max_chan; -static channel_desc_t** defined_channels; +static channel_desc_t **defined_channels; +static char modellist_name[MAX_OPTNAME_SIZE]=""; + void fill_channel_desc(channel_desc_t *chan_desc, uint8_t nb_tx, uint8_t nb_rx, @@ -494,16 +496,17 @@ struct complex *R_sqrt_22_EPA_medium[1] = {R_sqrt_22_EPA_medium_tap}; //Rayleigh1_orth_eff_ch_TM4 + channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, uint8_t nb_rx, SCM_t channel_model, double sampling_rate, double channel_bandwidth, - double DS_TDL, + double DS_TDL, double forgetting_factor, int32_t channel_offset, double path_loss_dB, - float noise_power_dB) { + float noise_power_dB) { channel_desc_t *chan_desc = (channel_desc_t *)calloc(1,sizeof(channel_desc_t)); for(int i=0; inb_paths = 10; return(chan_desc); -} - +} /* channel_desc_t *new_channel_desc_scm */ + +channel_desc_t * find_channel_desc_fromname( char *modelname ) { + for(int i=0; imodel_name,modelname) == 0) + return defined_channels[i]; + } + } + LOG_E(OCM,"Model %s not found \n", modelname); + return NULL; +} /* channel_desc_t * new_channel_desc_fromconfig */ + + + void free_channel_desc_scm(channel_desc_t *ch) { // Must be made cleanly, a lot of leaks... defined_channels[ch->chan_idx]=NULL; @@ -1657,7 +1675,8 @@ void free_channel_desc_scm(channel_desc_t *ch) { free(ch->R_sqrt); free(ch->ch); free(ch->chF); - free(ch->a); + free(ch->a); + free(ch->model_name); free(ch); } @@ -1665,6 +1684,12 @@ void set_channeldesc_owner(channel_desc_t *cdesc, uint32_t module_id) { cdesc->module_id=module_id; } +void set_channeldesc_name(channel_desc_t *cdesc,char *modelname) { + if(cdesc->model_name != NULL) + free(cdesc->model_name); + cdesc->model_name=strdup(modelname); +} + int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { double s; int i,k,l,aarx,aatx; @@ -1851,7 +1876,7 @@ double N_RB2channel_bandwidth(uint16_t N_RB) { break; default: - LOG_E(PHY,"Unknown N_PRB\n"); + LOG_E(OCM,"Unknown N_PRB\n"); return(-1); } return(channel_bandwidth); @@ -1871,9 +1896,7 @@ static int channelmod_print_help(char *buff, int debug, telnet_printfunc_t prnt static void display_channelmodel(channel_desc_t *cd,int debug, telnet_printfunc_t prnt) { char *module_id_str[]=MODULEID_STR_INIT; - if (cd->module_id != 0) { - prnt("model owner: %s\n",module_id_str[cd->module_id]); - } + prnt("model owner: %s\n",(cd->module_id != 0)?module_id_str[cd->module_id]:"not set"); prnt("nb_tx: %i nb_rx: %i taps: %i bandwidth: %lf sampling: %lf\n",cd->nb_tx, cd->nb_rx, cd->nb_taps, cd->channel_bandwidth, cd->sampling_rate); prnt("channel length: %i Max path delay: %lf ricean fact.: %lf angle of arrival: %lf (randomized:%s)\n", cd->channel_length, cd->Td, cd->ricean_factor, cd->aoa, (cd->random_aoa?"Yes":"No")); @@ -1899,7 +1922,8 @@ static int channelmod_show_cmd(char *buff, int debug, telnet_printfunc_t prnt) { } else if ( strcmp(subcmd,"current") == 0) { for (int i=0; i < max_chan ; i++) { if (defined_channels[i] != NULL) { - prnt("model %i %s: \n----------------\n", i, map_int_to_str(channelmod_names,defined_channels[i]->modelid)); + prnt("model %i %s type %s: \n----------------\n", i, (defined_channels[i]->model_name !=NULL)?defined_channels[i]->model_name:"(no name set)", + map_int_to_str(channelmod_names,defined_channels[i]->modelid)); display_channelmodel(defined_channels[i],debug,prnt); } } @@ -1972,10 +1996,10 @@ static int channelmod_modify_cmd(char *buff, int debug, telnet_printfunc_t prnt) return CMDSTATUS_FOUND; } -int modelid_fromname(char *modelname) { - int modelid=map_str_to_int(channelmod_names,modelname); +int modelid_fromstrtype(char *modeltype) { + int modelid=map_str_to_int(channelmod_names,modeltype); if (modelid < 0) - LOG_E(OCM,"random_channel.c: Error channel model %s unknown\n",modelname); + LOG_E(OCM,"random_channel.c: Error channel model %s unknown\n",modeltype); return modelid; } @@ -1989,18 +2013,59 @@ double channelmod_get_sinr_dB(void) { void init_channelmod(void) { paramdef_t channelmod_params[] = CHANNELMOD_PARAMS_DESC; - int ret = config_get( channelmod_params,sizeof(channelmod_params)/sizeof(paramdef_t),CHANNELMOD_SECTION); + + int numparams=sizeof(channelmod_params)/sizeof(paramdef_t); + int ret = config_get( channelmod_params,numparams,CHANNELMOD_SECTION); AssertFatal(ret >= 0, "configuration couldn't be performed"); defined_channels=calloc(max_chan,sizeof( channel_desc_t*)); AssertFatal(defined_channels!=NULL, "couldn't allocate %u channel descriptors\n",max_chan); - + /* look for telnet server, if it is loaded, add the channel modeling commands to it */ add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME); if (addcmd != NULL) { addcmd("channelmod",channelmod_vardef,channelmod_cmdarray); } -} +} /* init_channelmod */ + +int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) { + paramdef_t achannel_params[] = CHANNELMOD_MODEL_PARAMS_DESC; + paramlist_def_t channel_list; + memset(&channel_list,0,sizeof(paramlist_def_t)); + strncpy(channel_list.listname,modellist_name,MAX_OPTNAME_SIZE-1); + + int numparams = sizeof(achannel_params)/sizeof(paramdef_t); + config_getlist( &channel_list,achannel_params,numparams, CHANNELMOD_SECTION); + AssertFatal(channel_list.numelt>0, "List %s.%s not found in config file\n",CHANNELMOD_SECTION,channel_list.listname); + int pindex_NAME = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_NAME_PNAME); + int pindex_DT = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_DT_PNAME ); + int pindex_FF = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_FF_PNAME ); + int pindex_CO = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_CO_PNAME ); + int pindex_PL = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_PL_PNAME ); + int pindex_NP = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_NP_PNAME ); + int pindex_TYPE = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_TYPE_PNAME); + + for (int i=0; imodel_name = strdup(*(channel_list.paramarray[i][pindex_NAME].strptr)); + LOG_I(OCM,"Model %s type %s allocated from config file, list %s\n",*(channel_list.paramarray[i][pindex_NAME].strptr), + *(channel_list.paramarray[i][pindex_TYPE].strptr), modellist_name); + } /* for loop on channel_list */ + return channel_list.numelt; +} /* load_channelist */ #ifdef RANDOM_CHANNEL_MAIN #define sampling_rate 5.0 diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h index 97be5bf7e9..0b154dbcc4 100644 --- a/openair1/SIMULATION/TOOLS/sim.h +++ b/openair1/SIMULATION/TOOLS/sim.h @@ -107,8 +107,10 @@ typedef struct { unsigned int chan_idx; /// id of the channel modeling algorithm int modelid; - /// identifies channel descriptor owner (the module which created this descriptor) + /// identifies channel descriptor owner (the module which created this descriptor channelmod_moduleid_t module_id; + /// name of this descriptor,used for model created from config file at init time + char *model_name; /// flags to properly trigger memory free unsigned int free_flags; } channel_desc_t; @@ -242,12 +244,37 @@ typedef enum { #define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n" #define CHANNELMOD_SECTION "channelmod" + +/* global channel modelization parameters */ +#define CHANNELMOD_MODELLIST_PARANAME "modellist" + +#define CHANNELMOD_HELP_MODELLIST " channel list name in config file describing the model type and its parameters\n" #define CHANNELMOD_PARAMS_DESC { \ - {"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\ - {"sinr_dB", NULL, 0 , dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\ - {"max_chan, CONFIG_HLP_MAX_CHAN", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\ + {"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\ + {"sinr_dB", NULL, 0, dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\ + {"max_chan", "Max number of runtime models", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\ + {CHANNELMOD_MODELLIST_PARANAME, CHANNELMOD_HELP_MODELLIST, 0, strptr:(char **)&modellist_name, defstrval:"DefaultChannelList", TYPE_STRING, 60 },\ } +/* parameters for one model */ +#define CHANNELMOD_MODEL_NAME_PNAME "model_name" +#define CHANNELMOD_MODEL_TYPE_PNAME "type" +#define CHANNELMOD_MODEL_PL_PNAME "ploss_dB" +#define CHANNELMOD_MODEL_NP_PNAME "noise_power_dB" +#define CHANNELMOD_MODEL_FF_PNAME "forgetfact" +#define CHANNELMOD_MODEL_CO_PNAME "offset" +#define CHANNELMOD_MODEL_DT_PNAME "ds_tdl" + +#define CHANNELMOD_MODEL_PARAMS_DESC { \ + {CHANNELMOD_MODEL_NAME_PNAME, "name of the model\n", 0, strptr:NULL , defstrval:"", TYPE_STRING, 0 },\ + {CHANNELMOD_MODEL_TYPE_PNAME, "name of the model type\n", 0, strptr:NULL , defstrval:"AWGN", TYPE_STRING, 0 },\ + {CHANNELMOD_MODEL_PL_PNAME, "channel path loss in dB\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\ + {CHANNELMOD_MODEL_NP_PNAME, "channel noise in dB\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\ + {CHANNELMOD_MODEL_FF_PNAME, "channel forget factor ((0 to 1)\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\ + {CHANNELMOD_MODEL_CO_PNAME, "channel offset in samps\n", 0, iptr:NULL, defintval:0, TYPE_INT, 0 },\ + {CHANNELMOD_MODEL_DT_PNAME, "delay spread for TDL models\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 }\ +} + #include "platform_constants.h" typedef struct { @@ -276,13 +303,17 @@ typedef struct { channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, uint8_t nb_rx, SCM_t channel_model, - double sampling_rate, + double sampling_rate, double channel_bandwidth, - double TDL_DS, + double TDL_DS, double forgetting_factor, int32_t channel_offset, double path_loss_dB, - float noise_power_dB); + float noise_power_dB); + +channel_desc_t *find_channel_desc_fromname( char *modelname ); + + /** \brief free memory allocated for a model descriptor \param ch points to the model, which cannot be used after calling this fuction @@ -295,6 +326,12 @@ void free_channel_desc_scm(channel_desc_t *ch); \param module_id identifies the channel model. should be define as a macro in simu.h */ void set_channeldesc_owner(channel_desc_t *cdesc, channelmod_moduleid_t module_id); +/** +\brief This function set a model name to a model descriptor, can be later used to identify a allocated channel model +\param cdesc points to the model descriptor +\param module_name is the C string to use as model name for the channel pointed by cdesc +*/ +void set_channeldesc_name(channel_desc_t *cdesc,char *modelname); /** \fn void random_channel(channel_desc_t *desc) \brief This routine generates a random channel response (time domain) according to a tapped delay line model. \param desc Pointer to the channel descriptor @@ -454,11 +491,11 @@ void multipath_tv_channel(channel_desc_t *desc, /**@} */ /**@} */ -int modelid_fromname(char *modelname); +int modelid_fromstrtype(char *modeltype); double channelmod_get_snr_dB(void); double channelmod_get_sinr_dB(void); void init_channelmod(void) ; - +int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) ; double N_RB2sampling_rate(uint16_t N_RB); double N_RB2channel_bandwidth(uint16_t N_RB); diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index 6a4db361df..26b81728cb 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -69,7 +69,9 @@ extern RAN_CONTEXT_t RC; #define RFSIMU_SECTION "rfsimulator" #define RFSIMU_OPTIONS_PARAMNAME "options" -# define RFSIM_CONFIG_HELP_OPTIONS " list of comma separated options to enable rf simulator functionalities. Available options: \n"\ + + +#define RFSIM_CONFIG_HELP_OPTIONS " list of comma separated options to enable rf simulator functionalities. Available options: \n"\ " chanmod: enable channel modelisation\n"\ " saviq: enable saving written iqs to a file\n" /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -78,21 +80,21 @@ extern RAN_CONTEXT_t RC; /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define simOpt PARAMFLAG_NOFREE|PARAMFLAG_CMDLINE_NOPREFIXENABLED #define RFSIMULATOR_PARAMS_DESC { \ - {"serveraddr", "\n", simOpt , strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\ - {"serverport", "\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\ - {RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\ - {"IQfile", "\n",simOpt, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\ - {"modelname", "\n", simOpt, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\ - {"ploss", "\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\ - {"forgetfact", "\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\ - {"offset", "\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\ + {"serveraddr", "\n", simOpt, strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\ + {"serverport", "\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\ + {RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\ + {"IQfile", "\n",simOpt, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\ + {"modelname", "\n", simOpt, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\ + {"ploss", "\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\ + {"forgetfact", "\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\ + {"offset", "\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\ }; static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg); static telnetshell_cmddef_t rfsimu_cmdarray[] = { - {"setmodel","",(cmdfunc_t)rfsimu_setchanmod_cmd,TELNETSRV_CMDFLAG_PUSHINTPOOLQ}, + {"setmodel"," ",(cmdfunc_t)rfsimu_setchanmod_cmd,TELNETSRV_CMDFLAG_PUSHINTPOOLQ}, {"","",NULL}, }; @@ -183,16 +185,9 @@ static void allocCirBuf(rfsimulator_state_t *bridge, int sock) { tableNor(rand); init_done=true; } - - ptr->channel_model=new_channel_desc_scm(bridge->tx_num_channels,bridge->rx_num_channels, - bridge->channelmod, - bridge->sample_rate, - bridge->tx_bw, - 30e-9, // TDL delay-spread parameter - bridge->chan_forgetfact, // forgetting_factor - bridge->chan_offset, // maybe used for TA - bridge->chan_pathloss, - bridge->noise_power_dB); // path_loss in dB + char *modelname = (bridge->typeStamp == ENB_MAGICDL) ? "rfsimu_channel_ue0":"rfsimu_channel_enB0"; + ptr->channel_model=find_channel_desc_fromname(modelname); // path_loss in dB + AssertFatal((ptr->channel_model!= NULL),"Channel model %s not found, check config file\n",modelname); set_channeldesc_owner(ptr->channel_model, RFSIMU_MODULEID); random_channel(ptr->channel_model,false); } @@ -301,7 +296,8 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) { break; } else if (strcmp(rfsimu_params[p].strlistptr[i],"chanmod") == 0) { init_channelmod(); - rfsimulator->channelmod=modelid_fromname(modelname); + load_channellist(rfsimulator->tx_num_channels, rfsimulator->rx_num_channels, rfsimulator->sample_rate, rfsimulator->tx_bw); + rfsimulator->channelmod=true; } else { fprintf(stderr,"Unknown rfsimulator option: %s\n",rfsimu_params[p].strlistptr[i]); exit(-1); @@ -322,20 +318,27 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) { static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg) { char *modelname=NULL; - int s = sscanf(buff,"%ms\n",&modelname); + char *modeltype=NULL; + if (debug) + prnt("rfsimu_setchanmod_cmd buffer \"%s\"\n",buff); + int s = sscanf(buff,"%m[^ ] %ms\n",&modelname, &modeltype); - if (s == 1) { - int channelmod=modelid_fromname(modelname); + if (s == 2) { + int channelmod=modelid_fromstrtype(modeltype); if (channelmod<0) - prnt("ERROR: model %s unknown\n",modelname); + prnt("ERROR: model type %s unknown\n",modeltype); else { rfsimulator_state_t *t = (rfsimulator_state_t *)arg; - + int found=0; for (int i=0; ibuf[i]; + if ( b->channel_model==NULL) + continue; + if (b->channel_model->model_name==NULL) + continue; + if (b->conn_sock >= 0 && (strcmp(b->channel_model->model_name,modelname)==0)) { - if (b->conn_sock >= 0 ) { channel_desc_t *newmodel=new_channel_desc_scm(t->tx_num_channels,t->rx_num_channels, channelmod, t->sample_rate, @@ -343,23 +346,29 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, 30e-9, // TDL delay-spread parameter t->chan_forgetfact, // forgetting_factor t->chan_offset, // maybe used for TA - t->chan_pathloss, - t->noise_power_dB - ); // path_loss in dB + t->chan_pathloss, + t->noise_power_dB + ); // path_loss in dB set_channeldesc_owner(newmodel, RFSIMU_MODULEID); + set_channeldesc_name(newmodel,modelname); random_channel(newmodel,false); channel_desc_t *oldmodel=b->channel_model; b->channel_model=newmodel; free_channel_desc_scm(oldmodel); - prnt("New model %s applied to channel connected to sock %d\n",modelname,i); + prnt("New model type %s applied to channel %s connected to sock %d\n",modeltype,modelname,i); + found=1; + break; } - } + } /* for */ + if (found==0) + prnt("Channel %s not found or not currently used\n",modelname); } } else { - prnt("ERROR: no model specified\n"); + prnt("ERROR: 2 parameters required: model name and model type (%i found)\n",s); } free(modelname); + free(modeltype); return CMDSTATUS_FOUND; } @@ -778,6 +787,11 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { // to change the log level, use this on command line // --log_config.hw_log_level debug rfsimulator_state_t *rfsimulator = (rfsimulator_state_t *)calloc(sizeof(rfsimulator_state_t),1); + // initialize channel simulation + rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels; + rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels; + rfsimulator->sample_rate=openair0_cfg->sample_rate; + rfsimulator->tx_bw=openair0_cfg->tx_bw; rfsimulator_readconfig(rfsimulator); pthread_mutex_init(&Sockmutex, NULL); LOG_I(HW,"rfsimulator: running as %s\n", rfsimulator-> typeStamp == ENB_MAGICDL ? "server waiting opposite rfsimulators to connect" : "client: will connect to a rfsimulator server side"); @@ -802,11 +816,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { rfsimulator->buf[i].conn_sock=-1; AssertFatal((rfsimulator->epollfd = epoll_create1(0)) != -1,""); - // initialize channel simulation - rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels; - rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels; - rfsimulator->sample_rate=openair0_cfg->sample_rate; - rfsimulator->tx_bw=openair0_cfg->tx_bw; + //randominit(0); set_taus_seed(0); /* look for telnet server, if it is loaded, add the channel modeling commands to it */ From de87c02ea9f1d7d6926fd0e26939a94a985f3665 Mon Sep 17 00:00:00 2001 From: frtabu Date: Wed, 10 Mar 2021 21:39:20 +0100 Subject: [PATCH 08/66] start doc --- ci-scripts/conf_files/channelmod_rfsimu.conf | 23 +++++-- openair1/SIMULATION/TOOLS/DOC/arch.md | 9 +++ .../TOOLS/DOC/channel_simulation.md | 13 ++++ openair1/SIMULATION/TOOLS/DOC/devusage.md | 7 ++ openair1/SIMULATION/TOOLS/DOC/rtusage.md | 69 +++++++++++++++++++ openair1/SIMULATION/TOOLS/random_channel.c | 47 ------------- 6 files changed, 114 insertions(+), 54 deletions(-) create mode 100644 openair1/SIMULATION/TOOLS/DOC/arch.md create mode 100644 openair1/SIMULATION/TOOLS/DOC/channel_simulation.md create mode 100644 openair1/SIMULATION/TOOLS/DOC/devusage.md create mode 100644 openair1/SIMULATION/TOOLS/DOC/rtusage.md diff --git a/ci-scripts/conf_files/channelmod_rfsimu.conf b/ci-scripts/conf_files/channelmod_rfsimu.conf index c7abffa878..ba115df04c 100644 --- a/ci-scripts/conf_files/channelmod_rfsimu.conf +++ b/ci-scripts/conf_files/channelmod_rfsimu.conf @@ -1,6 +1,6 @@ -/* configuration for channel modelisation */ -/* To be included in main config file when */ -/* channel modelisation is used (rfsimulator with chanmod options enabled) */ +#/* configuration for channel modelisation */ +#/* To be included in main config file when */ +#/* channel modelisation is used (rfsimulator with chanmod options enabled) */ channelmod = { max_chan=10; modellist="modellist_rfsimu_1"; @@ -15,14 +15,14 @@ channelmod = { ds_tdl = 0; }, { - model_name = "rfsimu_channel_ue0" + model_name = "rfsimu_channel_ue1" type = "AWGN"; ploss_dB = 0; noise_power_dB = 0; forgetfact = 0; offset = 0; ds_tdl = 0; - }, + } ); modellist_rfsimu_2 = ( { @@ -35,14 +35,23 @@ channelmod = { ds_tdl = 0; }, { - model_name = "rfsimu_channel_ue0" + model_name = "rfsimu_channel_ue1" type = "AWGN"; ploss_dB = 0; noise_power_dB = 0; forgetfact = 0; offset = 0; ds_tdl = 0; - }, + }, + { + model_name = "rfsimu_channel_ue2" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + } ); }; diff --git a/openair1/SIMULATION/TOOLS/DOC/arch.md b/openair1/SIMULATION/TOOLS/DOC/arch.md new file mode 100644 index 0000000000..30be337829 --- /dev/null +++ b/openair1/SIMULATION/TOOLS/DOC/arch.md @@ -0,0 +1,9 @@ +# Channel simulation source files + +1. [random_channel.c](../random_channel.c) +1. [sim.h](../sim.h) + + + +[channel simulation main page](channel_simulation.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md b/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md new file mode 100644 index 0000000000..be2b987b40 --- /dev/null +++ b/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md @@ -0,0 +1,13 @@ +# OAI channel simulation feature + +oai includes a channel simulation feature that any component can use to alter time domain samples of a RF channel by applying pre-defined models as defined, for example, in 3GPP TR 36.873 or TR 38.901 + +Definition, configuration and run-time modification of a channel model are implemented in common code included in UEs, gNb, eNB and used when running with the rfsimulator or the L1 simulator. Phy simulators are also using channel simulation but configuration is done via dedicated command line options. The rfsimulator is the only option to get access to all the configurations and run-time modifications features of oai channel simulation. + +## Documentation + +* [runtime usage](rtusage.md) +* [developer usage](devusage.md) +* [module architecture](arch.md) + +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/openair1/SIMULATION/TOOLS/DOC/devusage.md b/openair1/SIMULATION/TOOLS/DOC/devusage.md new file mode 100644 index 0000000000..8fa6b3fe7a --- /dev/null +++ b/openair1/SIMULATION/TOOLS/DOC/devusage.md @@ -0,0 +1,7 @@ +### channel simulation developer usage + + +[Configuring the channel simulation](rtusage.md) + +[channel simulation main page](channel_simulation.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/openair1/SIMULATION/TOOLS/DOC/rtusage.md b/openair1/SIMULATION/TOOLS/DOC/rtusage.md new file mode 100644 index 0000000000..37fc62b496 --- /dev/null +++ b/openair1/SIMULATION/TOOLS/DOC/rtusage.md @@ -0,0 +1,69 @@ +## configuring the channel simulation +Oai channel simulation is using the [config module](../../../config/config.md) to get its parameters at init time. The [telnet server](../../telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify some channel model parameters + +All channel simulation parameters are defined in the `channelmod` section. Most parameters are specific to a channel model and are only used by the rfsimulator. + +### global parameters + +| name | type | default | description | +|:---:|:---:|:---:|:----| +| `max_chan` | integer | `25` | Maximum number of channel model that can be defined in the system. Must be greater than the number of model definitions in the model list loaded at init time. | +| `modellist` | character string | `DefaultChannelList` | Name of the channel models list to load at init time. | + +### Model lists + +Several model lists can be defined in the oai configuration file. One, defined by the `modellist` parameter is loaded at init time. In the configuration file each model list item describes a channel model using a group of parameters: + +| parameter name | type | default | description | +|:---:|:---:|:---:|:----| +| `model name` | character string | mandatory |name of the model, as used in the code to retrieve a model definition| +| `type` | | `AWGN` | name of the channel modelization algorithm applied on rf signal. The list of available model types can be listed via the [telnet server](../../telnetsrv/DOC/telnetsrv.md) or by entering an invalid type name | +| `ploss_dB` | real (float) | | path loss of the channel, in dB | +| `noise_power_dB` | real (double) | | noise of the channel in dB | +| `forgetfact` | real (double) | | | +| `offset` | integer | | | +| `ds_tdl` | real double | | | + +Channel simulation parameters can also be specified on the command line: + +```bash +./lte-softmodem -O ../../../ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf --noS1 --rfsim --rfsimulator.options chanmod --rfsimulator.serveraddr enb --telnetsrv --channelmod.modellist modellist_rfsimu_2 --channelmod.modellist_rfsimu_2.[1].offset 120 +``` +### Using the telnet server to modify channel simulator parameters +The telnet server includes a `channelmod` command which can be used to dynamically modify some channel model parameters. This command is only available when channel simulation is enabled (via `rfsimulator.options chanmod` option when running the rfsimulator. `channelmod` command has its own help: + +``` +$ telnet 127.0.0.1 9090 +Trying 127.0.0.1... +Connected to 127.0.0.1. +Escape character is '^]'. + +softmodem_enb> help +..................................... + module 6 = channelmod: + channelmod help + channelmod show + channelmod modify + module 7 = rfsimu: + rfsimu setmodel +softmodem_enb> channelmod help +channelmod commands can be used to display or modify channel models parameters +channelmod show predef: display predefined model algorithms available in oai +channelmod show current: display the currently used models in the running executable +channelmod modify : set the specified parameters in a current model to the given value + specifies the model, the show current model command can be used to list the current models indexes + can be one of "riceanf", "aoa", "randaoa", "ploss", "noise_power_dB", "offset", "forgetf" +softmodem_enb> + +``` + + + + + + + +The [rfsimulator documentation](../../../../targets/ARCH/rfsimulator/README.md ) has also some specific information when using the channel simulation via this tool. + +[channel simulation main page](channel_simulation.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c index d45abeb711..dfe1d6a13d 100644 --- a/openair1/SIMULATION/TOOLS/random_channel.c +++ b/openair1/SIMULATION/TOOLS/random_channel.c @@ -2029,53 +2029,6 @@ void init_channelmod(void) { } } /* init_channelmod */ -void load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) { - - paramdef_t channelmod_params[] = CHANNELMOD_PARAMS_DESC; - - int numparams=sizeof(channelmod_params)/sizeof(paramdef_t); - int ret = config_get( channelmod_params,numparams,CHANNELMOD_SECTION); - AssertFatal(ret >= 0, "configuration couldn't be performed"); - defined_channels=calloc(max_chan,sizeof( channel_desc_t*)); - AssertFatal(defined_channels!=NULL, "couldn't allocate %u channel descriptors\n",max_chan); - - - paramdef_t achannel_params[] = CHANNELMOD_MODEL_PARAMS_DESC; - paramlist_def_t channel_list; - memset(&channel_list,0,sizeof(paramlist_def_t)); - strncpy(channel_list.listname,modellist_name,MAX_OPTNAME_SIZE-1); - - numparams = sizeof(achannel_params)/sizeof(paramdef_t); - config_getlist( &channel_list,achannel_params,numparams, CHANNELMOD_SECTION); - AssertFatal(channel_list.numelt>0, "List %s.%s not found in config filee\n",CHANNELMOD_SECTION,CHANNELMOD_MODELLIST_PARANAME); - int pindex_NAME = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_NAME_PNAME); - int pindex_DT = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_DT_PNAME ); - int pindex_FF = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_FF_PNAME ); - int pindex_CO = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_CO_PNAME ); - int pindex_PL = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_PL_PNAME ); - int pindex_NP = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_NP_PNAME ); - int pindex_TYPE = config_paramidx_fromname(channelmod_params,numparams, CHANNELMOD_MODEL_TYPE_PNAME); - - for (int i=0; imodel_name = strdup(*(channel_list.paramarray[i][pindex_NAME].strptr)); - LOG_I(OCM,"Model %s type %s allocated from config file, list %s\n",*(channel_list.paramarray[i][pindex_NAME].strptr), - *(channel_list.paramarray[i][pindex_TYPE].strptr), modellist_name); - } /* for loop on channel_list */ -} /* init_channelmod */ int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) { paramdef_t achannel_params[] = CHANNELMOD_MODEL_PARAMS_DESC; From a97bf1da6e732f763a9a3f3191311b9bca718d8c Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 15 Mar 2021 12:40:15 +0100 Subject: [PATCH 09/66] fix phy simulators, merge develop --- openair1/SIMULATION/LTE_PHY/dlsim.c | 4 ++-- openair1/SIMULATION/LTE_PHY/dlsim_tm4.c | 4 ++-- openair1/SIMULATION/LTE_PHY/dlsim_tm7.c | 4 ++-- openair1/SIMULATION/LTE_PHY/mbmssim.c | 4 ++-- openair1/SIMULATION/LTE_PHY/pbchsim.c | 6 +++--- openair1/SIMULATION/LTE_PHY/pdcchsim.c | 2 +- openair1/SIMULATION/LTE_PHY/prachsim.c | 2 +- openair1/SIMULATION/LTE_PHY/pucchsim.c | 2 +- openair1/SIMULATION/LTE_PHY/scansim.c | 2 +- openair1/SIMULATION/LTE_PHY/syncsim.c | 6 +++--- openair1/SIMULATION/LTE_PHY/ulsim.c | 2 +- openair1/SIMULATION/NR_PHY/dlschsim.c | 2 +- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- openair1/SIMULATION/NR_PHY/pbchsim.c | 2 +- openair1/SIMULATION/NR_PHY/prachsim.c | 2 +- openair1/SIMULATION/NR_PHY/pucchsim.c | 2 +- openair1/SIMULATION/NR_PHY/ulschsim.c | 2 +- openair1/SIMULATION/NR_PHY/ulsim.c | 2 +- 18 files changed, 26 insertions(+), 26 deletions(-) diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 667913d377..aa0fcbe3a3 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -1179,7 +1179,7 @@ int main(int argc, char **argv) { DS_TDL, forgetting_factor, rx_sample_offset, - 0); + 0, 0); reset_meas(&eNB2UE[0]->random_channel); reset_meas(&eNB2UE[0]->interp_time); @@ -1193,7 +1193,7 @@ int main(int argc, char **argv) { DS_TDL, forgetting_factor, rx_sample_offset, - 0); + 0, 0); reset_meas(&eNB2UE[n]->random_channel); reset_meas(&eNB2UE[n]->interp_time); } diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c index a585e8efc6..3b4e6782da 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c @@ -988,7 +988,7 @@ int main(int argc, char **argv) N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); if(num_rounds>1) { for(n=1; n<8; n++) @@ -999,7 +999,7 @@ int main(int argc, char **argv) N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); } if (eNB2UE[0]==NULL) { diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c index 5973f80b55..bd164150c5 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c @@ -834,7 +834,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); if(num_rounds>1) { for(n=1; n<4; n++) @@ -845,7 +845,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); } if (eNB2UE[0]==NULL) { diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c index b1f4d933b3..78fd1a293e 100644 --- a/openair1/SIMULATION/LTE_PHY/mbmssim.c +++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c @@ -1290,7 +1290,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); reset_meas(&eNB2UE[0]->random_channel); reset_meas(&eNB2UE[0]->interp_time); @@ -1303,7 +1303,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); reset_meas(&eNB2UE[n]->random_channel); reset_meas(&eNB2UE[n]->interp_time); } diff --git a/openair1/SIMULATION/LTE_PHY/pbchsim.c b/openair1/SIMULATION/LTE_PHY/pbchsim.c index 00ad03c52d..71286faafb 100644 --- a/openair1/SIMULATION/LTE_PHY/pbchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pbchsim.c @@ -386,7 +386,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), 0, 0, - 0); + 0, 0); if (interf1>-20) eNB2UE1 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx, @@ -396,7 +396,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), 0, 4, - 0); + 0, 0); if (interf2>-20) eNB2UE2 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx, @@ -406,7 +406,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), 0, 8, - 0); + 0, 0); if (eNB2UE==NULL) { msg("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c index 004eb24243..bd2c2d66b9 100644 --- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c @@ -708,7 +708,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), 0, 0, - 0); + 0, 0); L1_rxtx_proc_t *proc_rxtx = (subframe == 0)? &eNB->proc.L1_proc: &eNB->proc.L1_proc_tx; eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,N_RB_DL,0); UE->ulsch[0] = new_ue_ulsch(N_RB_DL,0); diff --git a/openair1/SIMULATION/LTE_PHY/prachsim.c b/openair1/SIMULATION/LTE_PHY/prachsim.c index c997aa7639..229764a893 100644 --- a/openair1/SIMULATION/LTE_PHY/prachsim.c +++ b/openair1/SIMULATION/LTE_PHY/prachsim.c @@ -343,7 +343,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL), 0.0, delay, - 0); + 0, 0); if (UE2eNB==NULL) { msg("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/pucchsim.c b/openair1/SIMULATION/LTE_PHY/pucchsim.c index 127bfcb533..083a756afb 100644 --- a/openair1/SIMULATION/LTE_PHY/pucchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pucchsim.c @@ -323,7 +323,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL), 0.0, 0, - 0); + 0, 0); if (UE2eNB==NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/scansim.c b/openair1/SIMULATION/LTE_PHY/scansim.c index 5ceeee7f2f..839d30a8de 100644 --- a/openair1/SIMULATION/LTE_PHY/scansim.c +++ b/openair1/SIMULATION/LTE_PHY/scansim.c @@ -335,7 +335,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL), 0, 0, - 0); + 0, 0); if (eNB2UE==NULL) { msg("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/syncsim.c b/openair1/SIMULATION/LTE_PHY/syncsim.c index 80598b37e4..e8ee7d3d5e 100644 --- a/openair1/SIMULATION/LTE_PHY/syncsim.c +++ b/openair1/SIMULATION/LTE_PHY/syncsim.c @@ -724,7 +724,7 @@ int main(int argc, char **argv) { BW, 0, 0, - 0); + 0, 0); if (interf1>-20) eNB2UE1 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx, @@ -733,7 +733,7 @@ int main(int argc, char **argv) { BW, 0, 0, - 0); + 0, 0); if (interf2>-20) eNB2UE2 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx, @@ -742,7 +742,7 @@ int main(int argc, char **argv) { BW, 0, 0, - 0); + 0, 0); if (eNB2UE==NULL) { msg("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 80beee4bed..fc5392b533 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -734,7 +734,7 @@ int main(int argc, char **argv) { 30e-9, forgetting_factor, delay, - 0); + 0, 0); // set Doppler UE2eNB->max_Doppler = maxDoppler; diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 00983553d8..12b0b1d1f0 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -339,7 +339,7 @@ int main(int argc, char **argv) 61.44e6, //N_RB2sampling_rate(N_RB_DL), 40e6, //N_RB2channel_bandwidth(N_RB_DL), DS_TDL, - 0, 0, 0); + 0, 0, 0, 0); if (gNB2UE == NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 3a989566d2..a1ace321e9 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -757,7 +757,7 @@ int main(int argc, char **argv) 30e-9, 0, 0, - 0); + 0, 0); if (gNB2UE==NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 7b845c5bd3..da0c273fec 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -479,7 +479,7 @@ int main(int argc, char **argv) 300e-9, 0, 0, - 0); + 0, 0); if (gNB2UE==NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 8bd54ec345..08d86f888f 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -655,7 +655,7 @@ int main(int argc, char **argv){ DS_TDL, 0.0, delay, - 0); + 0, 0); if (UE2gNB==NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 8d79633a6f..4cef1213c9 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -418,7 +418,7 @@ int main(int argc, char **argv) printf("FFO = %lf; IFO = %d\n",eps-IFO,IFO); } - UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, DS_TDL,0, 0, 0); + UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, DS_TDL,0, 0, 0, 0); if (UE2gNB==NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 6f2af73a1d..f84e553683 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -364,7 +364,7 @@ int main(int argc, char **argv) 61.44e6, //N_RB2sampling_rate(N_RB_DL), 40e6, //N_RB2channel_bandwidth(N_RB_DL), DS_TDL, - 0,0,0); + 0,0,0, 0); if (gNB2UE == NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 35d642e7b3..310316e0f6 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -592,7 +592,7 @@ int main(int argc, char **argv) sampling_frequency, bandwidth, DS_TDL, - 0, 0, 0); + 0, 0, 0, 0); if (UE2gNB == NULL) { printf("Problem generating channel model. Exiting.\n"); From 8ad4895f55176b7aa5cc67080f3ea72b657a8ede Mon Sep 17 00:00:00 2001 From: frtabu Date: Mon, 15 Mar 2021 12:51:49 +0100 Subject: [PATCH 10/66] Add common option telnetclt --- executables/softmodem-common.c | 10 +++++++--- executables/softmodem-common.h | 27 ++++++++++++++------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index 1077c0e1ac..11712d6157 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -86,7 +86,7 @@ char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr) { void get_common_options(uint32_t execmask) { uint32_t online_log_messages=0; uint32_t glog_level=0 ; - uint32_t start_telnetsrv = 0; + uint32_t start_telnetsrv = 0, start_telnetclt = 0; uint32_t noS1 = 0, nokrnmod = 0, nonbiot = 0; uint32_t rfsim = 0, basicsim = 0, do_forms = 0; char *logmem_filename = NULL; @@ -99,17 +99,21 @@ void get_common_options(uint32_t execmask) { sizeof(cmdline_logparams)/sizeof(paramdef_t)); config_get( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL); - if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) { + if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_FLOG_OPT))) { set_glog_onlinelog(online_log_messages); } - if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) { + if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_LOGL_OPT))) { set_glog(glog_level); } if (start_telnetsrv) { load_module_shlib("telnetsrv",NULL,0,NULL); } + + if (start_telnetclt) { + set_softmodem_optmask(SOFTMODEM_TELNETCLT_BIT); + } if (logmem_filename != NULL && strlen(logmem_filename) > 0) { log_mem_filename = &logmem_filename[0]; diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 60a761c732..ff052bf413 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -153,23 +153,22 @@ extern "C" #define CONFIG_HLP_LOGV "Set the global log verbosity \n" #define CONFIG_HLP_TELN "Start embedded telnet server \n" #define CONFIG_HLP_MSC "Enable the MSC tracing utility \n" -/*----------------------------------------------------------------------------------------------------------------------------*/ -/* command line parameters for LOG utility */ -/* optname helpstr paramflags XXXptr defXXXval type numelt */ -/*----------------------------------------------------------------------------------------------------------------------------*/ +#define CONFIG_FLOG_OPT "R" +#define CONFIG_LOGL_OPT "g" +/*-------------------------------------------------------------------------------------------------------------------------------------------------*/ +/* command line parameters for LOG utility */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*-------------------------------------------------------------------------------------------------------------------------------------------------*/ #define START_MSC softmodem_params.start_msc #define CMDLINE_LOGPARAMS_DESC { \ - {"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \ - {"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \ - {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \ - {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \ - {"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \ + {CONFIG_FLOG_OPT , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \ + {CONFIG_LOGL_OPT , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \ + {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \ + {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \ + {"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \ + {"telnetclt", NULL, 0, uptr:&start_telnetclt, defstrval:NULL, TYPE_UINT, 0}, \ } -#define CMDLINE_ONLINELOG_IDX 0 -#define CMDLINE_GLOGLEVEL_IDX 1 -#define CMDLINE_GLOGVERBO_IDX 2 -#define CMDLINE_STARTTELN_IDX 3 /* check function for global log level */ #define CMDLINE_LOGPARAMS_CHECK_DESC { \ @@ -190,6 +189,7 @@ extern "C" #define SOFTMODEM_SIML1_BIT (1<<12) #define SOFTMODEM_DOFORMS_BIT (1<<15) #define SOFTMODEM_RECPLAY_BIT (1<<16) +#define SOFTMODEM_TELNETCLT_BIT (1<<17) #define SOFTMODEM_ENB_BIT (1<<20) #define SOFTMODEM_GNB_BIT (1<<21) #define SOFTMODEM_4GUE_BIT (1<<22) @@ -206,6 +206,7 @@ extern "C" #define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT) #define IS_SOFTMODEM_DOFORMS ( get_softmodem_optmask() & SOFTMODEM_DOFORMS_BIT) #define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT) +#define IS_SOFTMODEM_TELNETCLT_BIT ( get_softmodem_optmask() & SOFTMODEM_TELNETCLT_BIT) #define IS_SOFTMODEM_ENB_BIT ( get_softmodem_optmask() & SOFTMODEM_ENB_BIT) #define IS_SOFTMODEM_GNB_BIT ( get_softmodem_optmask() & SOFTMODEM_GNB_BIT) #define IS_SOFTMODEM_4GUE_BIT ( get_softmodem_optmask() & SOFTMODEM_4GUE_BIT) From 98c354fedd7afce97967e6c552ce630566ccbfec Mon Sep 17 00:00:00 2001 From: frtabu Date: Mon, 15 Mar 2021 23:26:09 +0100 Subject: [PATCH 11/66] Set path for libconfig include directive, so that all config files could be located in the same directory. minor fixes in softmodem-common --- .../enb.band7.tm1.50PRB.usrpb210.conf | 2 +- common/config/config_load_configmodule.h | 8 ++++-- common/config/libconfig/config_libconfig.c | 28 +++++++++++++++---- executables/softmodem-common.c | 9 +++--- executables/softmodem-common.h | 1 + 5 files changed, 35 insertions(+), 13 deletions(-) diff --git a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf index 4d89ad96da..087ee37f01 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf @@ -260,7 +260,6 @@ NETWORK_CONTROLLER : FLEXRAN_CACHE = "/mnt/oai_agent_cache"; FLEXRAN_AWAIT_RECONF = "no"; }; - log_config : { global_log_level ="info"; @@ -279,3 +278,4 @@ NETWORK_CONTROLLER : rrc_log_verbosity ="medium"; }; +@include "channelmod_rfsimu.conf" diff --git a/common/config/config_load_configmodule.h b/common/config/config_load_configmodule.h index 8baaa99bb8..0688f6531f 100644 --- a/common/config/config_load_configmodule.h +++ b/common/config/config_load_configmodule.h @@ -82,10 +82,12 @@ typedef struct configmodule_interface { #ifdef CONFIG_LOADCONFIG_MAIN configmodule_interface_t *cfgptr=NULL; -static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]> \n \ - debugflags can also be defined in the config_libconfig section of the config file\n \ +static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]><:incp[path]>\n \ + debugflags can also be defined in the config section of the config file\n \ debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \ - 4->print command line processing debug messages\n "; + 4->print command line processing debug messages\n \ + incp parameter can be used to define the include path used for config files (@include directive)\n \ + defaults is set to the path of the main config file.\n"; #define CONFIG_SECTIONNAME "config" #define CONFIGPARAM_DEBUGFLAGS_IDX 0 diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index eb08a70183..abd7b7b504 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -33,8 +33,9 @@ #include #include +#include + #include -#include #include "config_libconfig.h" #include "config_libconfig_private.h" @@ -347,17 +348,34 @@ int config_libconfig_init(char *cfgP[], int numP) { config_get_if()->numptrs=0; memset(config_get_if()->ptrs,0,sizeof(void *) * CONFIG_MAX_ALLOCATEDPTRS); memset(config_get_if()->ptrsAllocated, 0, sizeof(config_get_if()->ptrsAllocated)); - + /* search for include path parameter and set config file include path accordingly */ + for (int i=0; i Date: Wed, 17 Mar 2021 19:34:27 +0100 Subject: [PATCH 12/66] noise power --- ci-scripts/conf_files/channelmod_rfsimu.conf | 4 ++-- openair1/SIMULATION/TOOLS/sim.h | 2 +- targets/ARCH/rfsimulator/apply_channelmod.c | 13 ++----------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/ci-scripts/conf_files/channelmod_rfsimu.conf b/ci-scripts/conf_files/channelmod_rfsimu.conf index ba115df04c..9a6ded24f1 100644 --- a/ci-scripts/conf_files/channelmod_rfsimu.conf +++ b/ci-scripts/conf_files/channelmod_rfsimu.conf @@ -6,10 +6,10 @@ channelmod = { modellist="modellist_rfsimu_1"; modellist_rfsimu_1 = ( { - model_name = "rfsimu_channel_ue0" + model_name = "rfsimu_channel_enB0" type = "AWGN"; ploss_dB = 0; - noise_power_dB = 0; + noise_power_dB = -10; forgetfact = 0; offset = 0; ds_tdl = 0; diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h index 0b154dbcc4..5825a9fcc0 100644 --- a/openair1/SIMULATION/TOOLS/sim.h +++ b/openair1/SIMULATION/TOOLS/sim.h @@ -269,7 +269,7 @@ typedef enum { {CHANNELMOD_MODEL_NAME_PNAME, "name of the model\n", 0, strptr:NULL , defstrval:"", TYPE_STRING, 0 },\ {CHANNELMOD_MODEL_TYPE_PNAME, "name of the model type\n", 0, strptr:NULL , defstrval:"AWGN", TYPE_STRING, 0 },\ {CHANNELMOD_MODEL_PL_PNAME, "channel path loss in dB\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\ - {CHANNELMOD_MODEL_NP_PNAME, "channel noise in dB\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\ + {CHANNELMOD_MODEL_NP_PNAME, "channel noise in dB\n", 0, dblptr:NULL, defdblval:-50, TYPE_DOUBLE, 0 },\ {CHANNELMOD_MODEL_FF_PNAME, "channel forget factor ((0 to 1)\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\ {CHANNELMOD_MODEL_CO_PNAME, "channel offset in samps\n", 0, iptr:NULL, defintval:0, TYPE_INT, 0 },\ {CHANNELMOD_MODEL_DT_PNAME, "delay spread for TDL models\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 }\ diff --git a/targets/ARCH/rfsimulator/apply_channelmod.c b/targets/ARCH/rfsimulator/apply_channelmod.c index 9ff9eda4d3..ab8ae77edd 100644 --- a/targets/ARCH/rfsimulator/apply_channelmod.c +++ b/targets/ARCH/rfsimulator/apply_channelmod.c @@ -65,17 +65,8 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si // Fixme: not sure when it is "volts" so dB is 20*log10(...) or "power", so dB is 10*log10(...) const double pathLossLinear = pow(10,channelDesc->path_loss_dB/20.0); // Energy in one sample to calibrate input noise - //Fixme: modified the N0W computation, not understand the origin value - const double KT=1.38e-23*290; //Boltzman*temperature - // sampling rate is linked to acquisition band (the input pass band filter) - const double noise_figure_watt = KT*channelDesc->sampling_rate; - // Fixme: how to convert a noise in Watt into a 12 bits value out of the RF ADC ? - // the parameter "-s" is declared as SNR, but the input power is not well defined - // −132.24 dBm is a LTE subcarrier noise, that was used in origin code (15KHz BW thermal noise) - const double rxGain= 132.24 - channelDesc->noise_power_dB; - // sqrt(4*noise_figure_watt) is the thermal noise factor (volts) - // fixme: the last constant is pure trial results to make decent noise - const double noise_per_sample = sqrt(4*noise_figure_watt) * pow(10,rxGain/20) *10; + // the normalized OAI value seems to be 256 as average amplitude (numerical amplification = 1) + const double noise_per_sample = pow(10,channelDesc->noise_power_dB/10.0) * 256; // Fixme: we don't fill the offset length samples at begining ? // anyway, in today code, channel_offset=0 const int dd = abs(channelDesc->channel_offset); From 5c025c321e9a563c16e4aec0f97900fbb41aeb63 Mon Sep 17 00:00:00 2001 From: frtabu Date: Thu, 18 Mar 2021 00:22:11 +0100 Subject: [PATCH 13/66] set libconfig AUTOCONVERT option to true --- common/config/libconfig/config_libconfig.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index abd7b7b504..17266246f0 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -364,7 +364,8 @@ int config_libconfig_init(char *cfgP[], int numP) { const char *incp = config_get_include_dir (&(libconfig_privdata.cfg)) ; printf("[LIBCONFIG] Path for include directive set to: %s\n", (incp!=NULL)?incp:"libconfig defaults"); - + /* set convertion option to allow integer to float conversion*/ + config_set_auto_convert (&(libconfig_privdata.cfg), CONFIG_TRUE); /* Read the file. If there is an error, report it and exit. */ if( config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile) == CONFIG_FALSE) { fprintf(stderr,"[LIBCONFIG] %s %d file %s - line %d: %s\n",__FILE__, __LINE__, From fcda7b97fe3d09eaa3332bb18cf40f323505eb17 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 19 Mar 2021 12:21:04 +0100 Subject: [PATCH 14/66] add sanitize option, merge develop --- cmake_targets/CMakeLists.txt | 55 ++++++++++--------- cmake_targets/build_oai | 4 ++ .../CODING/nrLDPC_decoder/nrLDPC_decoder.c | 2 +- openair1/PHY/TOOLS/nr_phy_scope.c | 2 +- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index c16170f932..dd3d84beb7 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -335,12 +335,17 @@ endif () add_definitions("-DASN_DISABLE_OER_SUPPORT") +if (build_sanitize) + set(linkasan -lasan) + set(gccasan --sanitize=address) +endif() + ######################### -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR} ${linkasan}") ######################### # set a flag for changes in the source code # these changes are related to hardcoded path to include .h files -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0 -DMALLOC_CHECK_=3") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} ${gccasan} -g3 -O0 -DMALLOC_CHECK_=3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3 -O2 -fno-delete-null-pointer-checks") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3") @@ -2905,7 +2910,7 @@ target_link_libraries (lte-softmodem RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} - -Wl,--end-group z dl) + -Wl,--end-group z dl ${linkasan}) target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) target_link_libraries (lte-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) @@ -2946,7 +2951,7 @@ target_link_libraries (ocp-enb RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB MISC_NFAPI_LTE_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} - -Wl,--end-group z dl) + -Wl,--end-group z dl ${linkasan}) target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${LIB_LMS_LIBRARIES} ${T_LIB}) add_executable(cu_test @@ -3016,7 +3021,7 @@ target_link_libraries (lte-uesoftmodem GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES} - -Wl,--end-group z dl) + -Wl,--end-group z dl ${linkasan}) target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES}) target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) @@ -3059,7 +3064,7 @@ target_link_libraries (nr-softmodem ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} - -Wl,--end-group z dl) + -Wl,--end-group z dl ${linkasan}) target_link_libraries (nr-softmodem ${LIBXML2_LIBRARIES}) target_link_libraries (nr-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) @@ -3099,7 +3104,7 @@ target_link_libraries (ocp-gnb ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON - -Wl,--end-group z dl) + -Wl,--end-group z dl ${linkasan}) target_link_libraries (ocp-gnb ${LIBXML2_LIBRARIES} ) target_link_libraries (ocp-gnb pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) @@ -3145,7 +3150,7 @@ target_link_libraries (nr-uesoftmodem ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} NFAPI_USER_LIB S1AP_LIB S1AP_ENB ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB - -Wl,--end-group z dl) + -Wl,--end-group z dl ${linkasan}) target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES}) target_link_libraries (nr-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) @@ -3171,7 +3176,7 @@ add_executable(dlsim_tm4 ) target_link_libraries (dlsim_tm4 -Wl,--start-group SIMU_COMMON SIMU UTIL SCHED_LIB SCHED_RU_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group - pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${T_LIB} + pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${T_LIB} ${linkasan} ) add_executable(polartest @@ -3184,7 +3189,7 @@ add_executable(polartest ) target_link_libraries(polartest -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR PHY_NR_COMMON PHY_NR_UE CONFIG_LIB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} dl + m pthread ${ATLAS_LIBRARIES} dl ${linkasan} ) add_executable(smallblocktest @@ -3199,7 +3204,7 @@ add_executable(smallblocktest target_link_libraries(smallblocktest -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_NR PHY_COMMON PHY_NR_COMMON CONFIG_LIB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} dl + m pthread ${ATLAS_LIBRARIES} dl ${linkasan} ) @@ -3228,7 +3233,7 @@ if (CUDA_FOUND) -Wl,--start-group LDPC_CU UTIL SIMU PHY_NR CONFIG_LIB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} dl + m pthread ${ATLAS_LIBRARIES} dl ${linkasan} ) else (CUDA_FOUND) @@ -3254,7 +3259,7 @@ add_dependencies( ldpctest ldpc_orig ldpc_optim ldpc_optim8seg ldpc ) target_link_libraries(ldpctest -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_NR PHY_COMMON PHY_NR_COMMON CONFIG_LIB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} dl + m pthread ${ATLAS_LIBRARIES} dl ${linkasan} ) add_executable(nr_dlschsim @@ -3269,7 +3274,7 @@ add_executable(nr_dlschsim ) target_link_libraries(nr_dlschsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan} ) add_executable(nr_pbchsim @@ -3284,7 +3289,7 @@ add_executable(nr_pbchsim ) target_link_libraries(nr_pbchsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan} ) #PUCCH ---> Prashanth @@ -3301,7 +3306,7 @@ add_executable(nr_pucchsim ) target_link_libraries(nr_pucchsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan} ) add_executable(nr_dlsim @@ -3320,7 +3325,7 @@ add_executable(nr_dlsim ) target_link_libraries(nr_dlsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan} ) target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR) @@ -3339,7 +3344,7 @@ add_executable(nr_prachsim ${SHLIB_LOADER_SOURCES}) target_link_libraries(nr_prachsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl) + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan}) add_executable(nr_ulschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c @@ -3353,7 +3358,7 @@ add_executable(nr_ulschsim ) target_link_libraries(nr_ulschsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan} ) add_executable(nr_ulsim @@ -3372,7 +3377,7 @@ add_executable(nr_ulsim ) target_link_libraries(nr_ulsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan} ) target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR) @@ -3392,7 +3397,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr ) target_link_libraries (${myExe} -Wl,--start-group SIMU_COMMON SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_NR_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group - pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl + pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl ${linkasan} ) endforeach(myExe) @@ -3406,7 +3411,7 @@ add_executable(test_epc_generate_scenario ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h ) target_link_libraries (test_epc_generate_scenario - -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} + -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ${linkasan} ) add_executable(test_epc_play_scenario @@ -3425,7 +3430,7 @@ add_executable(test_epc_play_scenario ) target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c) target_link_libraries (test_epc_play_scenario - -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} + -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ${linkasan} ) @@ -3445,7 +3450,7 @@ foreach(myExe s1ap ${OPENAIR3_DIR}/TEST/test_${myExe}.c ) target_link_libraries (test_${myExe} - -Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} + -Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ${linkasan} ) endforeach(myExe) @@ -3583,7 +3588,7 @@ target_link_libraries (nr-ittisim NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} PHY_NR_UE SCHED_NR_UE_LIB NR_L2_UE - -Wl,--end-group z dl) + -Wl,--end-group z dl ${linkasan}) target_link_libraries (nr-ittisim ${LIBXML2_LIBRARIES}) target_link_libraries (nr-ittisim pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 960b241047..c0317451c2 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -416,6 +416,10 @@ function main() { CMAKE_CMD="$CMAKE_CMD -GNinja" MAKE_CMD=ninja shift;; + --sanitize) + CMAKE_CMD="$CMAKE_CMD -Dbuild_sanitize=1" + MAKE_CMD=ninja + shift;; --ittiSIM) ittiSIM=1 ITTI_SIM="True" diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c index 785b588b9f..3226c97f87 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c @@ -39,7 +39,7 @@ #include "nrLDPC_bnProc.h" #define NR_LDPC_ENABLE_PARITY_CHECK -#define NR_LDPC_PROFILER_DETAIL +//#define NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_DEBUG_MODE #include "nrLDPC_tools/nrLDPC_debug.h" diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index b45c1abf0b..7c21ee7477 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -278,7 +278,7 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in graph->initDone=true; } - fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, sqrt(avg)); + fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, 0/*sqrt(avg)*/); graph->iteration++; } From 3bd3f452c2841414398008ef1d087657e2ea6b6d Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Sun, 21 Mar 2021 23:48:46 +0100 Subject: [PATCH 15/66] :( remove sanitize=address option, fix some cppchecks --- cmake_targets/CMakeLists.txt | 55 +++++++++---------- cmake_targets/build_oai | 4 -- common/utils/LOG/log.c | 2 +- common/utils/ocp_itti/intertask_interface.cpp | 4 +- openair1/PHY/TOOLS/nr_phy_scope.c | 2 +- openair1/SIMULATION/TOOLS/random_channel.c | 45 ++++++--------- 6 files changed, 47 insertions(+), 65 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index dd3d84beb7..c16170f932 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -335,17 +335,12 @@ endif () add_definitions("-DASN_DISABLE_OER_SUPPORT") -if (build_sanitize) - set(linkasan -lasan) - set(gccasan --sanitize=address) -endif() - ######################### -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR} ${linkasan}") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}") ######################### # set a flag for changes in the source code # these changes are related to hardcoded path to include .h files -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} ${gccasan} -g3 -O0 -DMALLOC_CHECK_=3") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0 -DMALLOC_CHECK_=3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3 -O2 -fno-delete-null-pointer-checks") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3") @@ -2910,7 +2905,7 @@ target_link_libraries (lte-softmodem RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} - -Wl,--end-group z dl ${linkasan}) + -Wl,--end-group z dl) target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) target_link_libraries (lte-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) @@ -2951,7 +2946,7 @@ target_link_libraries (ocp-enb RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB MISC_NFAPI_LTE_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} - -Wl,--end-group z dl ${linkasan}) + -Wl,--end-group z dl) target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${LIB_LMS_LIBRARIES} ${T_LIB}) add_executable(cu_test @@ -3021,7 +3016,7 @@ target_link_libraries (lte-uesoftmodem GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES} - -Wl,--end-group z dl ${linkasan}) + -Wl,--end-group z dl) target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES}) target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) @@ -3064,7 +3059,7 @@ target_link_libraries (nr-softmodem ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} - -Wl,--end-group z dl ${linkasan}) + -Wl,--end-group z dl) target_link_libraries (nr-softmodem ${LIBXML2_LIBRARIES}) target_link_libraries (nr-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) @@ -3104,7 +3099,7 @@ target_link_libraries (ocp-gnb ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON - -Wl,--end-group z dl ${linkasan}) + -Wl,--end-group z dl) target_link_libraries (ocp-gnb ${LIBXML2_LIBRARIES} ) target_link_libraries (ocp-gnb pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) @@ -3150,7 +3145,7 @@ target_link_libraries (nr-uesoftmodem ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} NFAPI_USER_LIB S1AP_LIB S1AP_ENB ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB - -Wl,--end-group z dl ${linkasan}) + -Wl,--end-group z dl) target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES}) target_link_libraries (nr-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) @@ -3176,7 +3171,7 @@ add_executable(dlsim_tm4 ) target_link_libraries (dlsim_tm4 -Wl,--start-group SIMU_COMMON SIMU UTIL SCHED_LIB SCHED_RU_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group - pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${T_LIB} ${linkasan} + pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${T_LIB} ) add_executable(polartest @@ -3189,7 +3184,7 @@ add_executable(polartest ) target_link_libraries(polartest -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR PHY_NR_COMMON PHY_NR_UE CONFIG_LIB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} dl ${linkasan} + m pthread ${ATLAS_LIBRARIES} dl ) add_executable(smallblocktest @@ -3204,7 +3199,7 @@ add_executable(smallblocktest target_link_libraries(smallblocktest -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_NR PHY_COMMON PHY_NR_COMMON CONFIG_LIB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} dl ${linkasan} + m pthread ${ATLAS_LIBRARIES} dl ) @@ -3233,7 +3228,7 @@ if (CUDA_FOUND) -Wl,--start-group LDPC_CU UTIL SIMU PHY_NR CONFIG_LIB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} dl ${linkasan} + m pthread ${ATLAS_LIBRARIES} dl ) else (CUDA_FOUND) @@ -3259,7 +3254,7 @@ add_dependencies( ldpctest ldpc_orig ldpc_optim ldpc_optim8seg ldpc ) target_link_libraries(ldpctest -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_NR PHY_COMMON PHY_NR_COMMON CONFIG_LIB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} dl ${linkasan} + m pthread ${ATLAS_LIBRARIES} dl ) add_executable(nr_dlschsim @@ -3274,7 +3269,7 @@ add_executable(nr_dlschsim ) target_link_libraries(nr_dlschsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan} + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ) add_executable(nr_pbchsim @@ -3289,7 +3284,7 @@ add_executable(nr_pbchsim ) target_link_libraries(nr_pbchsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan} + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ) #PUCCH ---> Prashanth @@ -3306,7 +3301,7 @@ add_executable(nr_pucchsim ) target_link_libraries(nr_pucchsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan} + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ) add_executable(nr_dlsim @@ -3325,7 +3320,7 @@ add_executable(nr_dlsim ) target_link_libraries(nr_dlsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan} + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ) target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR) @@ -3344,7 +3339,7 @@ add_executable(nr_prachsim ${SHLIB_LOADER_SOURCES}) target_link_libraries(nr_prachsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan}) + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl) add_executable(nr_ulschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c @@ -3358,7 +3353,7 @@ add_executable(nr_ulschsim ) target_link_libraries(nr_ulschsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan} + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ) add_executable(nr_ulsim @@ -3377,7 +3372,7 @@ add_executable(nr_ulsim ) target_link_libraries(nr_ulsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ${linkasan} + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl ) target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR) @@ -3397,7 +3392,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr ) target_link_libraries (${myExe} -Wl,--start-group SIMU_COMMON SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_NR_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group - pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl ${linkasan} + pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl ) endforeach(myExe) @@ -3411,7 +3406,7 @@ add_executable(test_epc_generate_scenario ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h ) target_link_libraries (test_epc_generate_scenario - -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ${linkasan} + -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ) add_executable(test_epc_play_scenario @@ -3430,7 +3425,7 @@ add_executable(test_epc_play_scenario ) target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c) target_link_libraries (test_epc_play_scenario - -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ${linkasan} + -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ) @@ -3450,7 +3445,7 @@ foreach(myExe s1ap ${OPENAIR3_DIR}/TEST/test_${myExe}.c ) target_link_libraries (test_${myExe} - -Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ${linkasan} + -Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ) endforeach(myExe) @@ -3588,7 +3583,7 @@ target_link_libraries (nr-ittisim NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} PHY_NR_UE SCHED_NR_UE_LIB NR_L2_UE - -Wl,--end-group z dl ${linkasan}) + -Wl,--end-group z dl) target_link_libraries (nr-ittisim ${LIBXML2_LIBRARIES}) target_link_libraries (nr-ittisim pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index e0075300eb..dbcadba103 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -421,10 +421,6 @@ function main() { CMAKE_CMD="$CMAKE_CMD -GNinja" MAKE_CMD=ninja shift;; - --sanitize) - CMAKE_CMD="$CMAKE_CMD -Dbuild_sanitize=1" - MAKE_CMD=ninja - shift;; --ittiSIM) ittiSIM=1 ITTI_SIM="True" diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index 4e6ec9d3db..8029ba826b 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -243,7 +243,7 @@ int write_file_matlab(const char *fname, fprintf(fp,"%d \n",((unsigned char *)&data)[0]); break; default: - AssertFatal(false, "unknown dump format: %d\n", format); + AssertFatal(false, "unknown dump format: %u\n", format); } if ((format != 10 && format !=11 && format !=12 && format != 13 && format != 15) || multiVec) { diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index 2189be9fe8..70cb53ccce 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -339,7 +339,9 @@ extern "C" { int itti_create_queue(const task_info_t *taskInfo) { pthread_mutex_lock (&lock_nb_queues); int newQueue=nb_queues++; - AssertFatal(tasks=(task_list_t **) realloc(tasks, nb_queues * sizeof(*tasks)),""); + task_list_t **tmp=(task_list_t **) realloc(tasks, nb_queues * sizeof(*tasks)); + AssertFatal(tmp!=NULL,""); + tasks=tmp; tasks[newQueue]= new task_list_t; pthread_mutex_unlock (&lock_nb_queues); LOG_I(TMR,"Starting itti queue: %s as task %d\n", taskInfo->name, newQueue); diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index 7c21ee7477..b3132101dc 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -242,7 +242,7 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in for (int pix=0; pixw; pix++) { scopeSample_t *end=values+(pix+1)*samplesPerPixel; end-=2; - AssertFatal(end <= values+datasize,"diff : %ld", end-values+datasize); + AssertFatal(end <= values+datasize,"diff : %lu", end-values+datasize); double val=0; for (scopeSample_t *s=values+(pix)*samplesPerPixel; diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c index dfe1d6a13d..9171b6c067 100644 --- a/openair1/SIMULATION/TOOLS/random_channel.c +++ b/openair1/SIMULATION/TOOLS/random_channel.c @@ -62,7 +62,7 @@ static double snr_dB=25; static double sinr_dB=0; static unsigned int max_chan; static channel_desc_t **defined_channels; -static char modellist_name[MAX_OPTNAME_SIZE]=""; +static char modellist_name[MAX_OPTNAME_SIZE]={0}; void fill_channel_desc(channel_desc_t *chan_desc, @@ -227,7 +227,6 @@ double tdl_a_amps_dB[] = {-13.4, -16.6, -19.9, -29.7}; -#define TDL_A_PATHS 23 double tdl_b_delays[] = {0.0000, 0.1072, @@ -276,7 +275,6 @@ double tdl_b_amps_dB[] = {0, -14.9, -9.2, -11.3}; -#define TDL_B_PATHS 23 double tdl_c_delays[] = {0, 0.2099, @@ -327,7 +325,6 @@ double tdl_c_amps_dB[] = {-4.4, -15.7, -21.6, -22.8}; -#define TDL_C_PATHS 24 double tdl_d_delays[] = {//0, 0, @@ -360,7 +357,6 @@ double tdl_d_amps_dB[] = {//-0.2, -30.0, -27.7}; -#define TDL_D_PATHS 13 #define TDL_D_RICEAN_FACTOR .046774 double tdl_e_delays[] = {0, @@ -395,7 +391,6 @@ double tdl_e_amps_dB[] = {//-0.03, -29.8, -29.2}; -#define TDL_E_PATHS 14 #define TDL_E_RICEAN_FACTOR 0.0063096 double epa_delays[] = { 0,.03,.07,.09,.11,.19,.41}; @@ -540,7 +535,6 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, LOG_I(OCM,"Channel Model (inside of new_channel_desc_scm)=%d\n\n", channel_model); int tdl_paths=0; - double tdl_ricean_factor = 1; double *tdl_amps_dB; double *tdl_delays; @@ -676,36 +670,32 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, break; /* tapped delay line (TDL) channel model from TR 38.901 Section 7.7.2 */ +#define tdl_m(MoDel)\ + DevAssert(sizeof(tdl_ ## MoDel ## _amps_dB) == sizeof(tdl_ ## MoDel ## _delays)); \ + tdl_paths=sizeof(tdl_ ## MoDel ## _amps_dB)/sizeof(*tdl_ ## MoDel ## _amps_dB);\ + tdl_delays=tdl_ ## MoDel ## _delays;\ + tdl_amps_dB=tdl_ ## MoDel ## _amps_dB + case TDL_A: case TDL_B: case TDL_C: case TDL_D: case TDL_E: + chan_desc->ricean_factor = 1; if (channel_model == TDL_A) { - tdl_paths=TDL_A_PATHS; - tdl_delays=tdl_a_delays; - tdl_amps_dB=tdl_a_amps_dB; + tdl_m(a); }else if (channel_model == TDL_B) { - tdl_paths=TDL_B_PATHS; - tdl_delays=tdl_b_delays; - tdl_amps_dB=tdl_b_amps_dB; + tdl_m(b); } else if (channel_model == TDL_C) { - tdl_paths=TDL_C_PATHS; - tdl_delays=tdl_c_delays; - tdl_amps_dB=tdl_c_amps_dB; - printf("Initializing TDL_C channel with %d paths\n",TDL_C_PATHS); + tdl_m(c); } else if (channel_model == TDL_D) { - tdl_paths=TDL_D_PATHS; - tdl_delays=tdl_d_delays; - tdl_amps_dB=tdl_d_amps_dB; - tdl_ricean_factor = TDL_D_RICEAN_FACTOR; + tdl_m(d); + chan_desc->ricean_factor = TDL_D_RICEAN_FACTOR; } else if (channel_model == TDL_E) { - tdl_paths=TDL_E_PATHS-1; - tdl_delays=tdl_e_delays+1; - tdl_amps_dB=tdl_e_amps_dB; - tdl_ricean_factor = TDL_E_RICEAN_FACTOR; - } + tdl_m(e); + chan_desc->ricean_factor = TDL_E_RICEAN_FACTOR; + } int tdl_pathsby3 = tdl_paths/3; if ((tdl_paths%3)>0) tdl_pathsby3++; @@ -728,7 +718,6 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, tdl_delays[i] *= DS_TDL; } chan_desc->delays = tdl_delays; - chan_desc->ricean_factor = tdl_ricean_factor; chan_desc->aoa = 0; chan_desc->random_aoa = 0; chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *)); @@ -2034,7 +2023,7 @@ int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double paramdef_t achannel_params[] = CHANNELMOD_MODEL_PARAMS_DESC; paramlist_def_t channel_list; memset(&channel_list,0,sizeof(paramlist_def_t)); - strncpy(channel_list.listname,modellist_name,MAX_OPTNAME_SIZE-1); + memcpy(channel_list.listname,modellist_name,sizeof(channel_list.listname)-1); int numparams = sizeof(achannel_params)/sizeof(paramdef_t); config_getlist( &channel_list,achannel_params,numparams, CHANNELMOD_SECTION); From 230af8db6ff8fac1d9a89224e743c08302f07a55 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 22 Mar 2021 07:59:24 +0100 Subject: [PATCH 16/66] fix a old issue about T_IDs.h that killed my CI run --- cmake_targets/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index c16170f932..8ac0dce1ef 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2805,6 +2805,7 @@ include_directories("${OPENAIR_DIR}/common/utils/T") if (${T_TRACER}) set(T_SOURCE + ${OPENAIR_DIR}/common/utils/T/T_IDs.h ${OPENAIR_DIR}/common/utils/T/T.c ${OPENAIR_DIR}/common/utils/T/local_tracer.c) set(T_LIB "rt") From 818c9b2c88f1b2d680b8bd298933ed2261d29d6b Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 25 Mar 2021 20:13:50 +0100 Subject: [PATCH 17/66] first pass --- cmake_targets/CMakeLists.txt | 9 +- executables/ocp-gnb.c | 2 +- .../CODING/3gpplte_turbo_decoder_sse_8bit.c | 35 +- openair1/PHY/LTE_ESTIMATION/lte_sync_time.c | 611 ++++++------------ openair1/PHY/LTE_REFSIG/primary_synch.h | 1 - openair1/PHY/TOOLS/lte_phy_scope.c | 9 +- openair1/PHY/TOOLS/tools_defs.h | 5 + openair1/PHY/phy_extern.h | 6 - openair1/PHY/phy_extern_nr_ue.h | 3 - openair1/PHY/phy_extern_ue.h | 6 - openair1/PHY/phy_vars.h | 3 - openair1/PHY/phy_vars_ue.h | 3 - openair2/GNB_APP/gnb_config.c | 8 +- openair2/LAYER2/MAC/config.c | 8 +- openair2/LAYER2/MAC/eNB_scheduler_mch.c | 2 +- openair2/LAYER2/MAC/mac_extern.h | 1 + openair2/LAYER2/MAC/ue_procedures.c | 2 +- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 23 +- openair2/RRC/LTE/plmn_data.h | 3 +- targets/RT/USER/lte-softmodem.c | 2 + targets/RT/USER/lte-ue.c | 3 +- 21 files changed, 242 insertions(+), 503 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 626d938625..83d2ba04e6 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -45,6 +45,8 @@ include_directories(${CONFIG_INCLUDE_DIRS}) pkg_search_module(CRYPTO libcrypto REQUIRED) include_directories(${CRYPTO_INCLUDE_DIRS}) +#uhd 4.0 and iris installs by default in /usr/local +include_directories("/usr/local/include/") #use native cmake method as this package is not in pkg-config if (${RF_BOARD} STREQUAL "OAI_USRP") find_package(Boost REQUIRED) @@ -52,7 +54,7 @@ if (${RF_BOARD} STREQUAL "OAI_USRP") elseif (${RF_BOARD} STREQUAL "OAI_IRIS") include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/") - include_directories("/usr/local/include/") + set(HW_SOURCE ${HW_SOURCE} ${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp) LINK_DIRECTORIES("/usr/local/lib") @@ -336,11 +338,11 @@ endif () add_definitions("-DASN_DISABLE_OER_SUPPORT") ######################### -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --sanitize=address -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}") ######################### # set a flag for changes in the source code # these changes are related to hardcoded path to include .h files -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0 -DMALLOC_CHECK_=3") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0 --sanitize=address -DMALLOC_CHECK_=3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3 -O2 -fno-delete-null-pointer-checks") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3") @@ -3088,6 +3090,7 @@ add_executable(ocp-gnb ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_gNB.c ${GTPU_need_ITTI} ${XFORMS_SOURCE_NR} ${T_SOURCE} diff --git a/executables/ocp-gnb.c b/executables/ocp-gnb.c index 4ddc7870d9..9a09a1247c 100644 --- a/executables/ocp-gnb.c +++ b/executables/ocp-gnb.c @@ -77,7 +77,6 @@ int config_sync_var=-1; pthread_mutex_t nfapi_sync_mutex; pthread_cond_t nfapi_sync_cond; int nfapi_sync_var=-1; -uint8_t nfapi_mode = NFAPI_MONOLITHIC; // Default to monolithic mode double cpuf; @@ -95,6 +94,7 @@ time_stats_t nfapi_meas; // total tx time time_stats_t softmodem_stats_rx_sf; // total rx time // not used but needed for link openair0_config_t openair0_cfg[MAX_CARDS]; +uint16_t slot_ahead=6; AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]; AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c index e1ca906b55..bc1c0dac56 100644 --- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c +++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c @@ -798,11 +798,11 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, n is the size in bits of the coded block, with the tail */ int n2; llr_t y8[3*(n+16)] __attribute__((aligned(16))); - llr_t systematic0[n+16] __attribute__ ((aligned(16))); - llr_t systematic1[n+16] __attribute__ ((aligned(16))); - llr_t systematic2[n+16] __attribute__ ((aligned(16))); - llr_t yparity1[n+16] __attribute__ ((aligned(16))); - llr_t yparity2[n+16] __attribute__ ((aligned(16))); + llr_t systematic0[n+32] __attribute__ ((aligned(16))); + llr_t systematic1[n+32] __attribute__ ((aligned(16))); + llr_t systematic2[n+32] __attribute__ ((aligned(16))); + llr_t yparity1[n+32] __attribute__ ((aligned(16))); + llr_t yparity2[n+32] __attribute__ ((aligned(16))); llr_t ext[n+128] __attribute__((aligned(16))); llr_t ext2[n+128] __attribute__((aligned(16))); llr_t alpha[(n+16)*8] __attribute__ ((aligned(16))); @@ -811,7 +811,7 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, llr_t m10[n+16] __attribute__ ((aligned(16))); // int *pi2_p,*pi4_p,*pi5_p,*pi6_p; int *pi4_p,*pi5_p,*pi6_p; - llr_t *s,*s1,*s2,*yp1,*yp2,*yp; + llr_t *s1,*s2,*yp1,*yp2,*yp; unsigned int i,j,iind;//,pi; unsigned char iteration_cnt=0; unsigned int crc,oldcrc,crc_len; @@ -927,7 +927,6 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, yp128 = (int8x16_t *)y8; #endif - s = systematic0; s1 = systematic1; s2 = systematic2; yp1 = yparity1; @@ -938,7 +937,7 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, for (i=0; i<16 ; i++ ) for (j=0; jn) { /* - s[n]=0;s[n+1]=0;s[n+2]=0;s[n+3]=0; - s[n+4]=0;s[n+5]=0;s[n+6]=0;s[n+7]=0; + systematic0[n]=0;systematic0[n+1]=0;systematic0[n+2]=0;systematic0[n+3]=0; + systematic0[n+4]=0;s[n+5]=0;s[n+6]=0;s[n+7]=0; s1[n]=0;s1[n+1]=0;s1[n+2]=0;s1[n+3]=0; s1[n+4]=0;s1[n+5]=0;s1[n+6]=0;s1[n+7]=0; s2[n]=0;s2[n+1]=0;s2[n+2]=0;s2[n+3]=0; @@ -961,26 +960,26 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, // Termination for (i=n2; isamples_per_tti); - sync_corr_ue1 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti); - sync_corr_ue2 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti); + case 50: + idft(IDFT_1024,in,out,1); + break; - if (sync_corr_ue0) { -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue0); -#endif - //common_vars->sync_corr = sync_corr; - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue0 not allocated\n"); - return(-1); + case 75: + idft(IDFT_1536,in,out,1); + break; + + case 100: + idft(IDFT_2048,in,out,1); + break; + + default: + LOG_E(PHY,"Unsupported N_RB_DL %d\n",size); + abort(); + break; } +} - if (sync_corr_ue1) { -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue1); -#endif - //common_vars->sync_corr = sync_corr; - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue1 not allocated\n"); - return(-1); +static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSize) { + int k=ofdmSize-36; + + for (int i=0; i<72; i++) { + out[k].r = in[i].r>>2; //we need to shift input to avoid overflow in fft + out[k].i = in[i].i>>2; + k++; + + if (k >= ofdmSize) { + k++; // skip DC carrier + k-=ofdmSize; + } } +} - if (sync_corr_ue2) { -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue2); -#endif - //common_vars->sync_corr = sync_corr; - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue2 not allocated\n"); - return(-1); - } - - // primary_synch0_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - primary_synch0_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); - - if (primary_synch0_time) { - // bzero(primary_synch0_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - bzero(primary_synch0_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch0_time allocated at %p\n", primary_synch0_time); -#endif - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch0_time not allocated\n"); - return(-1); - } - - // primary_synch1_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - primary_synch1_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); - - if (primary_synch1_time) { - // bzero(primary_synch1_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - bzero(primary_synch1_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch1_time allocated at %p\n", primary_synch1_time); -#endif - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch1_time not allocated\n"); - return(-1); - } - - // primary_synch2_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - primary_synch2_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); - - if (primary_synch2_time) { - // bzero(primary_synch2_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - bzero(primary_synch2_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch2_time allocated at %p\n", primary_synch2_time); -#endif - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch2_time not allocated\n"); - return(-1); - } - - +int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) { // LTE_UE_COMMON *common_vars + struct complex16 syncF_tmp[2048]__attribute__((aligned(32)))= {0}; + int sz=frame_parms->ofdm_symbol_size*sizeof(*primary_synch0_time); + AssertFatal( NULL != (primary_synch0_time = (struct complex16 *)malloc16(sz)),""); + bzero(primary_synch0_time,sz); + AssertFatal( NULL != (primary_synch1_time = (struct complex16 *)malloc16(sz)),""); + bzero(primary_synch1_time,sz); + AssertFatal( NULL != (primary_synch2_time = (struct complex16 *)malloc16(sz)),""); + bzero(primary_synch2_time,sz); // generate oversampled sync_time sequences - k=frame_parms->ofdm_symbol_size-36; + copyPrimary( syncF_tmp, (struct complex16 *) primary_synch0, frame_parms->ofdm_symbol_size); + doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch0_time); + copyPrimary( syncF_tmp, (struct complex16 *) primary_synch1, frame_parms->ofdm_symbol_size); + doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch1_time); + copyPrimary( syncF_tmp, (struct complex16 *) primary_synch2, frame_parms->ofdm_symbol_size); + doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch2_time); - for (i=0; i<72; i++) { - syncF_tmp[2*k] = primary_synch0[2*i]>>2; //we need to shift input to avoid overflow in fft - syncF_tmp[2*k+1] = primary_synch0[2*i+1]>>2; - k++; - - if (k >= frame_parms->ofdm_symbol_size) { - k++; // skip DC carrier - k-=frame_parms->ofdm_symbol_size; - } - } - - switch (frame_parms->N_RB_DL) { - case 6: - idft(IDFT_128,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 25: - idft(IDFT_512,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 50: - idft(IDFT_1024,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - - case 75: - idft(IDFT_1536,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, - 1); /// complex output - break; - case 100: - idft(IDFT_2048,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - default: - LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL); - break; - } - - for (i=0; iofdm_symbol_size; i++) - ((int32_t*)primary_synch0_time)[i] = sync_tmp[i]; - - k=frame_parms->ofdm_symbol_size-36; - - for (i=0; i<72; i++) { - syncF_tmp[2*k] = primary_synch1[2*i]>>2; //we need to shift input to avoid overflow in fft - syncF_tmp[2*k+1] = primary_synch1[2*i+1]>>2; - k++; - - if (k >= frame_parms->ofdm_symbol_size) { - k++; // skip DC carrier - k-=frame_parms->ofdm_symbol_size; - } - } - - switch (frame_parms->N_RB_DL) { - case 6: - idft(IDFT_128,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 25: - idft(IDFT_512,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 50: - idft(IDFT_1024,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - - case 75: - idft(IDFT_1536,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 100: - idft(IDFT_2048,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - default: - LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL); - break; - } - - for (i=0; iofdm_symbol_size; i++) - ((int32_t*)primary_synch1_time)[i] = sync_tmp[i]; - - k=frame_parms->ofdm_symbol_size-36; - - for (i=0; i<72; i++) { - syncF_tmp[2*k] = primary_synch2[2*i]>>2; //we need to shift input to avoid overflow in fft - syncF_tmp[2*k+1] = primary_synch2[2*i+1]>>2; - k++; - - if (k >= frame_parms->ofdm_symbol_size) { - k++; // skip DC carrier - k-=frame_parms->ofdm_symbol_size; - } - } - - switch (frame_parms->N_RB_DL) { - case 6: - idft(IDFT_128,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 25: - idft(IDFT_512,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 50: - idft(IDFT_1024,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - - case 75: - idft(IDFT_1536,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 100: - idft(IDFT_2048,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - default: - LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL); - break; - } - - for (i=0; iofdm_symbol_size; i++) - ((int32_t*)primary_synch2_time)[i] = sync_tmp[i]; - - - if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){ + if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)) { LOG_M("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1); LOG_M("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1); LOG_M("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1); } + return (1); } -void lte_sync_time_free(void) -{ - if (sync_corr_ue0) { - LOG_D(PHY,"Freeing sync_corr_ue (%p)...\n",sync_corr_ue0); - free(sync_corr_ue0); - } - - if (sync_corr_ue1) { - LOG_D(PHY,"Freeing sync_corr_ue (%p)...\n",sync_corr_ue1); - free(sync_corr_ue1); - } - - if (sync_corr_ue2) { - LOG_D(PHY,"Freeing sync_corr_ue (%p)...\n",sync_corr_ue2); - free(sync_corr_ue2); - } - +void lte_sync_time_free(void) { if (primary_synch0_time) { LOG_D(PHY,"Freeing primary_sync0_time ...\n"); free(primary_synch0_time); @@ -312,126 +128,81 @@ void lte_sync_time_free(void) free(primary_synch2_time); } - sync_corr_ue0 = NULL; - sync_corr_ue1 = NULL; - sync_corr_ue2 = NULL; primary_synch0_time = NULL; primary_synch1_time = NULL; primary_synch2_time = NULL; } -static inline int abs32(int x) -{ - return (((int)((short*)&x)[0])*((int)((short*)&x)[0]) + ((int)((short*)&x)[1])*((int)((short*)&x)[1])); +static inline int abs32(int x) { + return (((int)((short *)&x)[0])*((int)((short *)&x)[0]) + ((int)((short *)&x)[1])*((int)((short *)&x)[1])); } +static inline double absF(struct complexd x) { + return x.r*x.r+x.i*x.i; +} + +#define complexNull(c) bzero((void*) &(c), sizeof(c)) #define SHIFT 17 int lte_sync_time(int **rxdata, ///rx data in time domain LTE_DL_FRAME_PARMS *frame_parms, - int *eNB_id) -{ + int *eNB_id) { // perform a time domain correlation using the oversampled sync sequence - unsigned int n, ar, s, peak_pos, peak_val, sync_source; int result,result2; - int sync_out[3] = {0,0,0},sync_out2[3] = {0,0,0}; - int tmp[3] = {0,0,0}; + struct complexd sync_out[3]= {0}, sync_out2[3]= {0}; int length = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti>>1; - - //LOG_D(PHY,"[SYNC TIME] Calling sync_time.\n"); - AssertFatal(sync_corr_ue0 != NULL, - "sync_corr_ue0 not yet allocated! Exiting.\n"); - AssertFatal(sync_corr_ue1 != NULL, - "sync_corr_ue0 not yet allocated! Exiting.\n"); - AssertFatal(sync_corr_ue2 != NULL, - "sync_corr_ue0 not yet allocated! Exiting.\n"); - peak_val = 0; peak_pos = 0; sync_source = 0; - for (n=0; nofdm_symbol_size-frame_parms->nb_prefix_samples)) { if (n<(length-frame_parms->ofdm_symbol_size)) { - //calculate dot product of primary_synch0_time and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; for (ar=0; arnb_antennas_rx; ar++) { - - result = dot_product((short*)primary_synch0_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); - result2 = dot_product((short*)primary_synch0_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); - - ((short*)sync_corr_ue0)[2*n] += ((short*) &result)[0]; - ((short*)sync_corr_ue0)[2*n+1] += ((short*) &result)[1]; - ((short*)sync_corr_ue0)[2*(length+n)] += ((short*) &result2)[0]; - ((short*)sync_corr_ue0)[(2*(length+n))+1] += ((short*) &result2)[1]; - ((short*)sync_out)[0] += ((short*) &result)[0]; - ((short*)sync_out)[1] += ((short*) &result)[1]; - ((short*)sync_out2)[0] += ((short*) &result2)[0]; - ((short*)sync_out2)[1] += ((short*) &result2)[1]; + result = dot_product((short *)primary_synch0_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); + result2 = dot_product((short *)primary_synch0_time, (short *) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); + sync_out[0].r += ((short *) &result)[0]; + sync_out[0].i += ((short *) &result)[1]; + sync_out2[0].r += ((short *) &result2)[0]; + sync_out2[0].i += ((short *) &result2)[1]; } for (ar=0; arnb_antennas_rx; ar++) { - result = dot_product((short*)primary_synch1_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); - result2 = dot_product((short*)primary_synch1_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); - ((short*)sync_corr_ue1)[2*n] += ((short*) &result)[0]; - ((short*)sync_corr_ue1)[2*n+1] += ((short*) &result)[1]; - ((short*)sync_corr_ue1)[2*(length+n)] += ((short*) &result2)[0]; - ((short*)sync_corr_ue1)[(2*(length+n))+1] += ((short*) &result2)[1]; - - ((short*)sync_out)[2] += ((short*) &result)[0]; - ((short*)sync_out)[3] += ((short*) &result)[1]; - ((short*)sync_out2)[2] += ((short*) &result2)[0]; - ((short*)sync_out2)[3] += ((short*) &result2)[1]; + result = dot_product((short *)primary_synch1_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); + result2 = dot_product((short *)primary_synch1_time, (short *) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); + sync_out[1].r += ((short *) &result)[0]; + sync_out[1].i += ((short *) &result)[1]; + sync_out2[1].r += ((short *) &result2)[0]; + sync_out2[1].i += ((short *) &result2)[1]; } for (ar=0; arnb_antennas_rx; ar++) { - - result = dot_product((short*)primary_synch2_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); - result2 = dot_product((short*)primary_synch2_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); - ((short*)sync_corr_ue2)[2*n] += ((short*) &result)[0]; - ((short*)sync_corr_ue2)[2*n+1] += ((short*) &result)[1]; - ((short*)sync_corr_ue2)[2*(length+n)] += ((short*) &result2)[0]; - ((short*)sync_corr_ue2)[(2*(length+n))+1] += ((short*) &result2)[1]; - ((short*)sync_out)[4] += ((short*) &result)[0]; - ((short*)sync_out)[5] += ((short*) &result)[1]; - ((short*)sync_out2)[4] += ((short*) &result2)[0]; - ((short*)sync_out2)[5] += ((short*) &result2)[1]; + result = dot_product((short *)primary_synch2_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); + result2 = dot_product((short *)primary_synch2_time, (short *) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); + sync_out[2].r += ((short *) &result)[0]; + sync_out[2].i += ((short *) &result)[1]; + sync_out2[2].r += ((short *) &result2)[0]; + sync_out2[2].i += ((short *) &result2)[1]; } - } // calculate the absolute value of sync_corr[n] - sync_corr_ue0[n] = abs32(sync_corr_ue0[n]); - sync_corr_ue0[n+length] = abs32(sync_corr_ue0[n+length]); - sync_corr_ue1[n] = abs32(sync_corr_ue1[n]); - sync_corr_ue1[n+length] = abs32(sync_corr_ue1[n+length]); - sync_corr_ue2[n] = abs32(sync_corr_ue2[n]); - sync_corr_ue2[n+length] = abs32(sync_corr_ue2[n+length]); - for (s=0; s<3; s++) { - tmp[s] = (abs32(sync_out[s])>>1) + (abs32(sync_out2[s])>>1); + double tmp = absF(sync_out[s]) + absF(sync_out2[s]); - if (tmp[s]>peak_val) { - peak_val = tmp[s]; + if (tmp>peak_val) { + peak_val = tmp; peak_pos = n; sync_source = s; /* @@ -443,42 +214,22 @@ int lte_sync_time(int **rxdata, ///rx data in time domain } *eNB_id = sync_source; - - LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val,dB_fixed(peak_val)/2); - - - if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){ - static int debug_cnt; - if (debug_cnt == 0) { - LOG_M("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2); - LOG_M("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2); - LOG_M("sync_corr2_ue.m","synccorr2",sync_corr_ue2,2*length,1,2); - LOG_M("rxdata0.m","rxd0",rxdata[0],length<<1,1,1); - // exit(-1); - } else { - debug_cnt++; - } -} + LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val/2,dB_fixed(peak_val/2)/2); return(peak_pos); } -int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars -{ +int ru_sync_time_init(RU_t *ru) { // LTE_UE_COMMON *common_vars /* int16_t dmrs[2048]; int16_t *dmrsp[2] = {dmrs,NULL}; */ - int32_t dmrs[ru->frame_parms->ofdm_symbol_size*14] __attribute__((aligned(32))); //int32_t *dmrsp[2] = {&dmrs[(3-ru->frame_parms->Ncp)*ru->frame_parms->ofdm_symbol_size],NULL}; int32_t *dmrsp[2] = {&dmrs[0],NULL}; - generate_ul_ref_sigs(); - - ru->dmrssync = (int16_t*)malloc16_clear(ru->frame_parms->ofdm_symbol_size*2*sizeof(int16_t)); - ru->dmrs_corr = (uint64_t*)malloc16_clear(ru->frame_parms->samples_per_tti*10*sizeof(uint64_t)); - + ru->dmrssync = (int16_t *)malloc16_clear(ru->frame_parms->ofdm_symbol_size*2*sizeof(int16_t)); + ru->dmrs_corr = (uint64_t *)malloc16_clear(ru->frame_parms->samples_per_tti*10*sizeof(uint64_t)); generate_drs_pusch(NULL, NULL, ru->frame_parms, @@ -491,35 +242,39 @@ int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars 0); switch (ru->frame_parms->N_RB_DL) { - case 6: - idft(IDFT_128,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); - break; - case 25: - idft(IDFT_512,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); - break; - case 50: - idft(IDFT_1024,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); - break; - - case 75: - idft(IDFT_1536,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, - 1); /// complex output - break; - case 100: - idft(IDFT_2048,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); - break; - default: - AssertFatal(1==0,"Unsupported N_RB_DL %d\n",ru->frame_parms->N_RB_DL); - break; + case 6: + idft(IDFT_128,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, /// complex output + 1); + break; + + case 25: + idft(IDFT_512,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, /// complex output + 1); + break; + + case 50: + idft(IDFT_1024,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, /// complex output + 1); + break; + + case 75: + idft(IDFT_1536,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, + 1); /// complex output + break; + + case 100: + idft(IDFT_2048,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, /// complex output + 1); + break; + + default: + AssertFatal(1==0,"Unsupported N_RB_DL %d\n",ru->frame_parms->N_RB_DL); + break; } return(0); @@ -527,10 +282,11 @@ int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars void ru_sync_time_free(RU_t *ru) { - AssertFatal(ru->dmrssync!=NULL,"ru->dmrssync is NULL\n"); free(ru->dmrssync); - if (ru->dmrs_corr) free(ru->dmrs_corr); + + if (ru->dmrs_corr) + free(ru->dmrs_corr); } //#define DEBUG_PHY @@ -539,10 +295,8 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain LTE_DL_FRAME_PARMS *frame_parms, uint32_t length, uint32_t *peak_val_out, - uint32_t *sync_corr_eNB) -{ + uint32_t *sync_corr_eNB) { // perform a time domain correlation using the oversampled sync sequence - unsigned int n, ar, peak_val, peak_pos; uint64_t mean_val; int result; @@ -556,21 +310,21 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain } switch (eNB_id) { - case 0: - primary_synch_time = (short*)primary_synch0_time; - break; + case 0: + primary_synch_time = (short *)primary_synch0_time; + break; - case 1: - primary_synch_time = (short*)primary_synch1_time; - break; + case 1: + primary_synch_time = (short *)primary_synch1_time; + break; - case 2: - primary_synch_time = (short*)primary_synch2_time; - break; + case 2: + primary_synch_time = (short *)primary_synch2_time; + break; - default: - LOG_E(PHY,"[SYNC TIME] Illegal eNB_id!\n"); - return (-1); + default: + LOG_E(PHY,"[SYNC TIME] Illegal eNB_id!\n"); + return (-1); } peak_val = 0; @@ -578,21 +332,16 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain mean_val = 0; for (n=0; nofdm_symbol_size-frame_parms->nb_prefix_samples)) { - //calculate dot product of primary_synch0_time and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; for (ar=0; arnb_antennas_rx; ar++) { - - result = dot_product((short*)primary_synch_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); + result = dot_product((short *)primary_synch_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); //((short*)sync_corr)[2*n] += ((short*) &result)[0]; //((short*)sync_corr)[2*n+1] += ((short*) &result)[1]; sync_corr_eNB[n] += abs32(result); - } - } /* @@ -610,7 +359,6 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain } mean_val/=length; - *peak_val_out = peak_val; if (peak_val <= (40*(uint32_t)mean_val)) { @@ -620,88 +368,91 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain LOG_I(PHY,"[SYNC TIME] Peak found at pos %u, val = %u, mean_val = %"PRIu64"\n",peak_pos,peak_val,mean_val); return(peak_pos); } - } -static inline int64_t abs64(int64_t x) -{ - return (((int64_t)((int32_t*)&x)[0])*((int64_t)((int32_t*)&x)[0]) + ((int64_t) -((int32_t*)&x)[1])*((int64_t)((int32_t*)&x)[1])); +static inline int64_t abs64(int64_t x) { + return (((int64_t)((int32_t *)&x)[0])*((int64_t)((int32_t *)&x)[0]) + ((int64_t) + ((int32_t *)&x)[1])*((int64_t)((int32_t *)&x)[1])); } int ru_sync_time(RU_t *ru, int64_t *lev, - int64_t *avg) -{ + int64_t *avg) { LTE_DL_FRAME_PARMS *frame_parms = ru->frame_parms; RU_CALIBRATION *calibration = &ru->calibration; - // perform a time domain correlation using the oversampled sync sequence - int length = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti; - // circular copy of beginning to end of rxdata buffer. Note: buffer should be big enough upon calling this function - for (int ar=0;arnb_rx;ar++) memcpy((void*)&ru->common.rxdata[ar][2*length], - (void*)&ru->common.rxdata[ar][0], - frame_parms->ofdm_symbol_size); - + for (int ar=0; arnb_rx; ar++) + memcpy((void *)&ru->common.rxdata[ar][2*length], + (void *)&ru->common.rxdata[ar][0], + frame_parms->ofdm_symbol_size); + int32_t maxlev0=0; int maxpos0=0; int64_t avg0=0; int64_t result; int64_t dmrs_corr; - int maxval=0; - for (int i=0;i<2*(frame_parms->ofdm_symbol_size);i++) { + + for (int i=0; i<2*(frame_parms->ofdm_symbol_size); i++) { maxval = max(maxval,ru->dmrssync[i]); maxval = max(maxval,-ru->dmrssync[i]); } if (ru->state == RU_CHECK_SYNC) { - for (int i=0;i<2*(frame_parms->ofdm_symbol_size);i++) { - maxval = max(maxval,calibration->drs_ch_estimates_time[0][i]); - maxval = max(maxval,-calibration->drs_ch_estimates_time[0][i]); - } + for (int i=0; i<2*(frame_parms->ofdm_symbol_size); i++) { + maxval = max(maxval,calibration->drs_ch_estimates_time[0][i]); + maxval = max(maxval,-calibration->drs_ch_estimates_time[0][i]); + } } int shift = log2_approx(maxval); for (int n=0; nnb_rx; ar++) { - result = dot_product64(ru->dmrssync, - (int16_t*) &ru->common.rxdata[ar][n], - frame_parms->ofdm_symbol_size, - shift); - - if (ru->state == RU_CHECK_SYNC) { - result = dot_product64((int16_t*) &calibration->drs_ch_estimates_time[ar], - (int16_t*) &ru->common.rxdata[ar][n], + (int16_t *) &ru->common.rxdata[ar][n], frame_parms->ofdm_symbol_size, shift); + + if (ru->state == RU_CHECK_SYNC) { + result = dot_product64((int16_t *) &calibration->drs_ch_estimates_time[ar], + (int16_t *) &ru->common.rxdata[ar][n], + frame_parms->ofdm_symbol_size, + shift); } + dmrs_corr += abs64(result); } - if (ru->dmrs_corr != NULL) ru->dmrs_corr[n] = dmrs_corr; + + if (ru->dmrs_corr != NULL) + ru->dmrs_corr[n] = dmrs_corr; // tmpi holds ++...+ + if (dmrs_corr>maxlev0) { + maxlev0 = dmrs_corr; + maxpos0 = n; + } - if (dmrs_corr>maxlev0) { maxlev0 = dmrs_corr; maxpos0 = n; } avg0 += dmrs_corr; } - avg0/=(length/4); + avg0/=(length/4); int dmrsoffset = frame_parms->samples_per_tti + (3*frame_parms->ofdm_symbol_size)+(3*frame_parms->nb_prefix_samples) + frame_parms->nb_prefix_samples0; - - if ((int64_t)maxlev0 > (10*avg0)) {*lev = maxlev0; *avg=avg0; return((length+maxpos0-dmrsoffset)%length);} + + if ((int64_t)maxlev0 > (10*avg0)) { + *lev = maxlev0; + *avg=avg0; + return((length+maxpos0-dmrsoffset)%length); + } return(-1); } diff --git a/openair1/PHY/LTE_REFSIG/primary_synch.h b/openair1/PHY/LTE_REFSIG/primary_synch.h index 8152722df3..7a69222ddd 100644 --- a/openair1/PHY/LTE_REFSIG/primary_synch.h +++ b/openair1/PHY/LTE_REFSIG/primary_synch.h @@ -18,7 +18,6 @@ * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ - short primary_synch0[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-26120,-19785,11971,-30502,-24020,-22288,32117,6492,31311,9658,-16384,-28378,25100,-21063,-7292,-31946,20429,25618,14948,29158,11971,-30502,31311,9658,25100,-21063,-16384,28377,-24020,22287,32117,6492,-7292,31945,20429,25618,-26120,-19785,-16384,-28378,-16384,28377,-26120,-19785,-32402,4883,31311,-9659,32117,6492,-7292,-31946,32767,-1,25100,-21063,-24020,22287,-32402,4883,-32402,4883,-24020,22287,25100,-21063,32767,-1,-7292,-31946,32117,6492,31311,-9659,-32402,4883,-26120,-19785,-16384,28377,-16384,-28378,-26120,-19785,20429,25618,-7292,31945,32117,6492,-24020,22287,-16384,28377,25100,-21063,31311,9658,11971,-30502,14948,29158,20429,25618,-7292,-31946,25100,-21063,-16384,-28378,31311,9658,32117,6492,-24020,-22288,11971,-30502,-26120,-19785,32767,0,0,0,0,0,0,0,0,0,0,0}; short primary_synch1[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,-8086,-24020,-22288,2448,32675,-26120,19784,27073,18458,-16384,28377,25100,21062,-29523,14217,-7292,31945,-13477,-29868,-24020,-22288,27073,18458,25100,21062,-16384,-28378,2448,-32676,-26120,19784,-29523,-14218,-7292,31945,-31754,-8086,-16384,28377,-16384,-28378,-31754,-8086,31311,-9659,27073,-18459,-26120,19784,-29523,14217,32767,-1,25100,21062,2448,-32676,31311,-9659,31311,-9659,2448,-32676,25100,21062,32767,0,-29523,14217,-26120,19784,27073,-18459,31311,-9659,-31754,-8086,-16384,-28378,-16384,28377,-31754,-8086,-7292,31945,-29523,-14218,-26120,19784,2448,-32676,-16384,-28378,25100,21062,27073,18458,-24020,-22288,-13477,-29868,-7292,31945,-29523,14217,25100,21062,-16384,28377,27073,18458,-26120,19784,2448,32675,-24020,-22288,-31754,-8086,32767,0,0,0,0,0,0,0,0,0,0,0}; short primary_synch2[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,8085,-24020,22287,2448,-32676,-26120,-19785,27073,-18459,-16384,-28378,25100,-21063,-29523,-14218,-7292,-31946,-13477,29867,-24020,22287,27073,-18459,25100,-21063,-16384,28377,2448,32675,-26120,-19785,-29523,14217,-7292,-31946,-31754,8085,-16384,-28378,-16384,28377,-31754,8085,31311,9658,27073,18458,-26120,-19785,-29523,-14218,32767,0,25100,-21063,2448,32675,31311,9658,31311,9658,2448,32675,25100,-21063,32767,0,-29523,-14218,-26120,-19785,27073,18458,31311,9658,-31754,8085,-16384,28377,-16384,-28378,-31754,8085,-7292,-31946,-29523,14217,-26120,-19785,2448,32675,-16384,28377,25100,-21063,27073,-18459,-24020,22287,-13477,29867,-7292,-31946,-29523,-14218,25100,-21063,-16384,-28378,27073,-18459,-26120,-19785,2448,-32676,-24020,22287,-31754,8085,32767,-1,0,0,0,0,0,0,0,0,0,0}; diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c index acd22bc78d..4aa21b47e8 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.c +++ b/openair1/PHY/TOOLS/lte_phy_scope.c @@ -153,7 +153,6 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, int16_t **chest_t; int16_t **chest_f; int16_t *pusch_llr; - int32_t *pusch_comp; int32_t *pucch1_comp; int32_t *pucch1_thres; int32_t *pucch1ab_comp; @@ -189,7 +188,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, chest_t = (int16_t **) phy_vars_enb->srs_vars[UE_id].srs_ch_estimates; chest_f = (int16_t **) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates; pusch_llr = (int16_t *) phy_vars_enb->pusch_vars[UE_id]->llr; - pusch_comp = (int32_t *) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[0]; + int16_t *pusch_comp= (int16_t *) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[0]; pucch1_comp = (int32_t *) phy_vars_enb->pucch1_stats[UE_id]; pucch1_thres = (int32_t *) phy_vars_enb->pucch1_stats_thres[UE_id]; pucch1ab_comp = (int32_t *) phy_vars_enb->pucch1ab_stats[UE_id]; @@ -684,7 +683,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, if (frame_parms->N_RB_DL != 100) { fl_set_xyplot_data(form->pdcch_llr,bit_pdcch,llr_pdcch,12*frame_parms->N_RB_DL*2*num_pdcch_symbols,"","",""); } else { - LOG_D(PHY,"UE PDCCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n"); + LOG_D(HW,"UE PDCCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n"); } } @@ -698,7 +697,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, if (frame_parms->N_RB_DL != 100) { fl_set_xyplot_data(form->pdcch_comp,I,Q,12*frame_parms->N_RB_DL*num_pdcch_symbols,"","",""); } else { - LOG_D(PHY,"UE PDCCH COMP plot is bugged in 20 MHz BW, to be fixed !!!\n"); + LOG_D(HW,"UE PDCCH COMP plot is bugged in 20 MHz BW, to be fixed !!!\n"); } } @@ -714,7 +713,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, if (frame_parms->N_RB_DL != 100) { fl_set_xyplot_data(form->pdsch_llr,bit,llr,coded_bits_per_codeword,"","",""); } else { - LOG_D(PHY,"UE PDSCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n"); + LOG_D(HW,"UE PDSCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n"); } } diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index db7ac3d813..4c68c15cb6 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -44,6 +44,11 @@ struct complex { double y; }; +struct complexd { + double r; + double i; +}; + struct complexf { float r; float i; diff --git a/openair1/PHY/phy_extern.h b/openair1/PHY/phy_extern.h index 165ed961b3..4ba5e328e3 100644 --- a/openair1/PHY/phy_extern.h +++ b/openair1/PHY/phy_extern.h @@ -48,12 +48,6 @@ extern short primary_synch2[144]; extern unsigned char primary_synch0_tab[72]; extern unsigned char primary_synch1_tab[72]; extern unsigned char primary_synch2_tab[72]; -extern int16_t *primary_synch0_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[ -extern int *sync_corr_ue0; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue1; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue2; //!< index [0..10*samples_per_tti[ extern int flagMag; //extern short **txdataF_rep_tmp; diff --git a/openair1/PHY/phy_extern_nr_ue.h b/openair1/PHY/phy_extern_nr_ue.h index 700419c61c..f1704a7902 100644 --- a/openair1/PHY/phy_extern_nr_ue.h +++ b/openair1/PHY/phy_extern_nr_ue.h @@ -55,9 +55,6 @@ extern unsigned char primary_synch2_tab[72]; extern int16_t *primary_synch0_time; //!< index: [0..ofdm_symbol_size*2[ extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[ extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[ -extern int *sync_corr_ue0; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue1; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue2; //!< index [0..10*samples_per_tti[ extern int flagMag; //extern short **txdataF_rep_tmp; diff --git a/openair1/PHY/phy_extern_ue.h b/openair1/PHY/phy_extern_ue.h index 622551c2fe..fdaf6eaa89 100644 --- a/openair1/PHY/phy_extern_ue.h +++ b/openair1/PHY/phy_extern_ue.h @@ -47,12 +47,6 @@ extern short primary_synch2[144]; extern unsigned char primary_synch0_tab[72]; extern unsigned char primary_synch1_tab[72]; extern unsigned char primary_synch2_tab[72]; -extern int16_t *primary_synch0_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[ -extern int *sync_corr_ue0; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue1; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue2; //!< index [0..10*samples_per_tti[ extern int flagMag; //extern short **txdataF_rep_tmp; diff --git a/openair1/PHY/phy_vars.h b/openair1/PHY/phy_vars.h index 5e2be8bd8f..dadb1649ec 100644 --- a/openair1/PHY/phy_vars.h +++ b/openair1/PHY/phy_vars.h @@ -33,9 +33,6 @@ char* namepointer_log2; #include "PHY/LTE_REFSIG/primary_synch.h" -int16_t *primary_synch0_time; -int16_t *primary_synch1_time; -int16_t *primary_synch2_time; #include "PHY/LTE_TRANSPORT/transport_vars.h" diff --git a/openair1/PHY/phy_vars_ue.h b/openair1/PHY/phy_vars_ue.h index e90c2641aa..469a5c4754 100644 --- a/openair1/PHY/phy_vars_ue.h +++ b/openair1/PHY/phy_vars_ue.h @@ -33,9 +33,6 @@ char *namepointer_log2; #include "PHY/LTE_REFSIG/primary_synch.h" -int16_t *primary_synch0_time; -int16_t *primary_synch1_time; -int16_t *primary_synch2_time; PHY_VARS_UE ***PHY_vars_UE_g; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 608827cc7a..1f4f01b141 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -175,7 +175,7 @@ void prepare_scc(NR_ServingCellConfigCommon_t *scc) { scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble = CALLOC(1,sizeof(long)); scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->p0_NominalWithGrant = CALLOC(1,sizeof(long)); - scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon = CALLOC(1,sizeof(struct NR_SetupRelease_PUCCH_ConfigCommon)); + scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon = CALLOC(1,sizeof(*scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon)); scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->present= NR_SetupRelease_PUCCH_ConfigCommon_PR_setup; scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup = CALLOC(1,sizeof(struct NR_PUCCH_ConfigCommon)); scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->p0_nominal = CALLOC(1,sizeof(long)); @@ -297,7 +297,7 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) { void prepare_scd(NR_ServingCellConfig_t *scd) { // Allocate downlink structures - scd->downlinkBWP_ToAddModList = CALLOC(1, sizeof(scd->downlinkBWP_ToAddModList)); + scd->downlinkBWP_ToAddModList = CALLOC(1, sizeof(*scd->downlinkBWP_ToAddModList)); // Downlink bandwidth part NR_BWP_Downlink_t *bwp = calloc(1, sizeof(*bwp)); @@ -318,14 +318,14 @@ void prepare_scd(NR_ServingCellConfig_t *scd) { NR_DMRS_DownlinkCfg->phaseTrackingRS->present = NR_SetupRelease_PTRS_DownlinkConfig_PR_setup; NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup = CALLOC(1, sizeof(*NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup)); NR_PTRS_DownlinkConfig_t *NR_PTRS_DownlinkCfg = NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup; - NR_PTRS_DownlinkCfg->frequencyDensity = CALLOC(1, sizeof(NR_PTRS_DownlinkCfg->frequencyDensity)); + AssertFatal( NULL!= (NR_PTRS_DownlinkCfg->frequencyDensity = CALLOC(1, sizeof(*NR_PTRS_DownlinkCfg->frequencyDensity))), ""); int *dl_rbs[2]; for (int i=0;i<2;i++) { dl_rbs[i] = CALLOC(1, sizeof(*dl_rbs[i])); *dl_rbs[i] = 0; ASN_SEQUENCE_ADD(&NR_PTRS_DownlinkCfg->frequencyDensity->list, dl_rbs[i]); } - NR_PTRS_DownlinkCfg->timeDensity = CALLOC(1, sizeof(NR_PTRS_DownlinkCfg->timeDensity)); + NR_PTRS_DownlinkCfg->timeDensity = CALLOC(1, sizeof(*NR_PTRS_DownlinkCfg->timeDensity)); int *dl_mcs[3]; for (int i=0;i<3;i++) { dl_mcs[i] = CALLOC(1, sizeof(*dl_mcs[i])); diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 781347abaa..71f91a67ec 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -337,7 +337,8 @@ config_sib2(int Mod_idP, LTE_ARFCN_ValueEUTRA_t *ul_CArrierFreqP, long *ul_BandwidthP, LTE_AdditionalSpectrumEmission_t *additionalSpectrumEmissionP, - struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigListP) { + struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigListP, + int dl_Bandwidth) { nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP]; cfg->subframe_config.pb.value = radioResourceConfigCommonP->pdsch_ConfigCommon.p_b; cfg->subframe_config.pb.tl.tag = NFAPI_SUBFRAME_CONFIG_PB_TAG; @@ -345,7 +346,7 @@ config_sib2(int Mod_idP, cfg->rf_config.reference_signal_power.value = radioResourceConfigCommonP->pdsch_ConfigCommon.referenceSignalPower; cfg->rf_config.reference_signal_power.tl.tag = NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG; cfg->num_tlv++; - cfg->nfapi_config.max_transmit_power.value = cfg->rf_config.reference_signal_power.value + power_off_dB[cfg->rf_config.dl_channel_bandwidth.value]; + cfg->nfapi_config.max_transmit_power.value = cfg->rf_config.reference_signal_power.value + power_off_dB[dl_Bandwidth]; cfg->nfapi_config.max_transmit_power.tl.tag = NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG; cfg->num_tlv++; cfg->prach_config.configuration_index.value = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.prach_ConfigIndex; @@ -870,7 +871,8 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP, config_sib2(Mod_idP, CC_idP, radioResourceConfigCommon, radioResourceConfigCommon_BR, NULL, ul_Bandwidth, additionalSpectrumEmission, - mbsfn_SubframeConfigList); + mbsfn_SubframeConfigList, + mib->message.dl_Bandwidth); } // mib != NULL if (mobilityControlInfo !=NULL) { diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c index f3a77ed703..1272b16ec0 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c @@ -84,7 +84,7 @@ get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id, static uint32_t bytes_in_buffer=0; static uint32_t msi_pmch_stop=0; -uint16_t mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; +rb_id_t mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; static uint32_t msi_sfs=0; diff --git a/openair2/LAYER2/MAC/mac_extern.h b/openair2/LAYER2/MAC/mac_extern.h index cee6066a9e..2df2428c45 100644 --- a/openair2/LAYER2/MAC/mac_extern.h +++ b/openair2/LAYER2/MAC/mac_extern.h @@ -65,6 +65,7 @@ extern const int cqi_to_mcs[16]; extern uint32_t RRC_CONNECTION_FLAG; extern uint8_t rb_table[34]; +extern rb_id_t mbms_rab_id; #if defined(PRE_SCD_THREAD) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 0dedacb11f..9ae8f82a00 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -72,7 +72,7 @@ extern UL_IND_t *UL_INFO; extern int next_ra_frame; extern module_id_t next_Mod_id; -int mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; +rb_id_t mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; static int mbms_mch_i=0; //static int num_msi_per_CSA[28]; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 687d7b1bfe..59a10a86e2 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -78,7 +78,6 @@ extern int nas_sock_fd[MAX_MOBILES_PER_ENB]; extern int nas_sock_mbms_fd; -extern int mbms_rab_id; extern struct msghdr nas_msg_tx; @@ -113,8 +112,6 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { * PDCP packet to pick the right socket below */ int rb_id = pdcpHead->rb_id; - int sizeToWrite= sizeof (pdcp_data_ind_header_t) + - pdcpHead->data_size; void * pdcpData=(void*)(pdcpHead+1); if (rb_id == 10) { //hardcoded for PC5-Signaling if( LOG_DEBUGFLAG(DEBUG_PDCP) ) { @@ -128,24 +125,25 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { } else if (UE_NAS_USE_TUN) { //ret = write(nas_sock_fd[pdcpHead->inst], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite ); if(rb_id == mbms_rab_id){ - ret = write(nas_sock_mbms_fd, pdcpData,sizeToWrite ); + ret = write(nas_sock_mbms_fd, pdcpData, pdcpHead->data_size ); LOG_I(PDCP,"[PDCP_FIFOS] ret %d TRIED TO PUSH MBMS DATA TO rb_id %d handle %d sizeToWrite %d\n", - ret,rb_id,nas_sock_fd[pdcpHead->inst],sizeToWrite); + ret,rb_id,nas_sock_fd[pdcpHead->inst],pdcpHead->data_size); } else { if( LOG_DEBUGFLAG(DEBUG_PDCP) ) - log_dump(PDCP, pdcpData, sizeToWrite, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n"); - ret = write(nas_sock_fd[pdcpHead->inst], pdcpData,sizeToWrite ); + log_dump(PDCP, pdcpData, pdcpHead->data_size, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n"); + ret = write(nas_sock_fd[pdcpHead->inst], pdcpData,pdcpHead->data_size ); LOG_T(PDCP,"[UE PDCP_FIFOS] ret %d TRIED TO PUSH DATA TO rb_id %d handle %d sizeToWrite %d\n", - ret,rb_id,nas_sock_fd[pdcpHead->inst],sizeToWrite); + ret,rb_id,nas_sock_fd[pdcpHead->inst],pdcpHead->data_size); } } else if (ENB_NAS_USE_TUN) { if( LOG_DEBUGFLAG(DEBUG_PDCP) ) - log_dump(PDCP, pdcpData, sizeToWrite, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n"); - ret = write(nas_sock_fd[0], pdcpData, sizeToWrite); - LOG_T(PDCP,"[NB PDCP_FIFOS] ret %d TRIED TO PUSH DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[0],sizeToWrite); + log_dump(PDCP, pdcpData, pdcpHead->data_size, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n"); + ret = write(nas_sock_fd[0], pdcpData, pdcpHead->data_size); + LOG_T(PDCP,"[NB PDCP_FIFOS] ret %d TRIED TO PUSH DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[0],pdcpHead->data_size); } else if (PDCP_USE_NETLINK) { + int sizeToWrite= sizeof (pdcp_data_ind_header_t) + pdcpHead->data_size; memcpy(NLMSG_DATA(nas_nlh_tx), (uint8_t *) pdcpHead, sizeToWrite); nas_nlh_tx->nlmsg_len = sizeToWrite; ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0); @@ -154,7 +152,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s), nas_sock_fd[0]: %d\n", errno, strerror(errno), nas_sock_fd[0]); if( LOG_DEBUGFLAG(DEBUG_PDCP) ) - log_dump(PDCP, pdcpData, min(sizeToWrite,30) , LOG_DUMP_CHAR, + log_dump(PDCP, pdcpData, min(pdcpHead->data_size,30) , LOG_DUMP_CHAR, "Printing first bytes of PDCP SDU before removing it from the list: \n"); delNotifiedFIFO_elt (sdu_p); pdcp_nb_sdu_sent ++; @@ -384,6 +382,7 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 1 ); len = recvmsg(nas_sock_fd[0], &nas_msg_rx, 0); + printf("recev: %d\n", len); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 ); if (len > 0) { diff --git a/openair2/RRC/LTE/plmn_data.h b/openair2/RRC/LTE/plmn_data.h index 97dc94343b..1b80ee9d7b 100644 --- a/openair2/RRC/LTE/plmn_data.h +++ b/openair2/RRC/LTE/plmn_data.h @@ -2231,7 +2231,7 @@ static const plmn_data_t plmn_data[] = { /* 310 900 Mid-Rivers Communications Mid-Rivers Wireless Operational */ - {310, 910, "Verizon Wireless", "Verizon USA"} + {310, 910, "Verizon Wireless", "Verizon USA"}, /* 310 920 Get Mobile Inactive 310 930 Copper Valley Wireless Inactive @@ -2295,6 +2295,7 @@ static const plmn_data_t plmn_data[] = { 648 4 Econet Wireless Econet Operational */ + {0,0,"",""} }; diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 2e6f148e00..99f2695d92 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -56,6 +56,8 @@ //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all +#include + #include "PHY/phy_vars.h" #include "SCHED/sched_common_vars.h" #include "LAYER2/MAC/mac_vars.h" diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 407756e20f..f97aa596f7 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -181,8 +181,7 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t abstraction_flag) { - PHY_VARS_UE *ue = (PHY_VARS_UE *)malloc(sizeof(PHY_VARS_UE)); - memset(ue,0,sizeof(PHY_VARS_UE)); + PHY_VARS_UE *ue = (PHY_VARS_UE *)calloc(1,sizeof(PHY_VARS_UE)); if (frame_parms!=(LTE_DL_FRAME_PARMS *)NULL) { // if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS)); From 1a93c759c803e82cdc0608b675805dad02c5fe7f Mon Sep 17 00:00:00 2001 From: frtabu Date: Fri, 26 Mar 2021 12:14:32 +0100 Subject: [PATCH 18/66] fix cppcheck error --- common/utils/telnetsrv/telnetsrv.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c index 5a1fefbf3d..8ed8c791f4 100644 --- a/common/utils/telnetsrv/telnetsrv.c +++ b/common/utils/telnetsrv/telnetsrv.c @@ -461,12 +461,12 @@ int process_command(char *buf) { int i,j,k; char modulename[TELNET_CMD_MAXSIZE]; char cmd[TELNET_CMD_MAXSIZE]; - char cmdb[TELNET_MAX_MSGLENGTH]; + char *cmdb=NULL; char *bufbck; int rt; memset(modulename,0,sizeof(modulename)); memset(cmd,0,sizeof(cmd)); - memset(cmdb,0,sizeof(cmdb)); + if (strncasecmp(buf,"ex",2) == 0) return CMDSTATUS_EXIT; @@ -490,12 +490,10 @@ int process_command(char *buf) { return CMDSTATUS_FOUND; } - memset(modulename,0,sizeof(modulename)); - memset(cmd,0,sizeof(cmd)); - memset(cmdb,0,sizeof(cmdb)); + bufbck=strdup(buf); rt=CMDSTATUS_NOTFOUND; - j = sscanf(buf,"%19s %19s %[^\t\n]",modulename,cmd,cmdb); + j = sscanf(buf,"%19s %19s %m[^\t\n]",modulename,cmd,&cmdb); if (telnetparams.telnetdbg > 0) printf("process_command: %i words, module=%s cmd=%s, parameters= %s\n",j,modulename,cmd,cmdb); @@ -562,7 +560,7 @@ int process_command(char *buf) { rt= CMDSTATUS_FOUND; } /* loop */ } /* for i */ - + free(cmdb); free(bufbck); return rt; } From 364ea7685f251a82fc9100a45bf384f14a48aa59 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 26 Mar 2021 14:07:10 +0100 Subject: [PATCH 19/66] fix warings --- openair1/PHY/LTE_REFSIG/lte_gold.c | 6 +- openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c | 4 +- openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c | 2 +- openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c | 2 +- openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c | 2 +- openair1/PHY/NR_REFSIG/dmrs_nr.c | 2 +- openair1/SIMULATION/TOOLS/random_channel.c | 898 ++++++++++-------- 7 files changed, 489 insertions(+), 427 deletions(-) diff --git a/openair1/PHY/LTE_REFSIG/lte_gold.c b/openair1/PHY/LTE_REFSIG/lte_gold.c index c5e48d8364..596760541b 100644 --- a/openair1/PHY/LTE_REFSIG/lte_gold.c +++ b/openair1/PHY/LTE_REFSIG/lte_gold.c @@ -56,7 +56,7 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14] (((1+(Nid_cell<<1))*(1 + (((frame_parms->Ncp==0)?4:3)*l) + (7*(1+ns))))<<10); //cinit //x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit //n = 0 - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); // skip first 50 double words (1600 bits) @@ -103,7 +103,7 @@ void lte_gold_ue_spec(uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_ //x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit //n = 0 // printf("cinit (ns %d, l %d) => %d\n",ns,l,x2); - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); // skip first 50 double words (1600 bits) @@ -143,7 +143,7 @@ void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_ //x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit //n = 0 //printf("cinit (ns %d, l %d) => %d\n",ns,l,x2); - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); //skip first 50 double words (1600 bits) diff --git a/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c b/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c index b057f6a403..78f0fd93fe 100644 --- a/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c +++ b/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c @@ -59,7 +59,7 @@ void lte_gold_mbsfn(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_mbsfn_tabl //n = 0 // printf("cinit (sfn %d, l %d) => %d\n",sfn,l,x2); // Initializing the Sequence - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); // skip first 50 double words (1600 bits) // printf("n=0 : x1 %x, x2 %x\n",x1,x2); @@ -90,7 +90,7 @@ void lte_gold_mbsfn_khz_1dot25(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold for (sfn=0; sfn<10; sfn++) { x2 = (Nid_mbsfn) + (((1+(Nid_mbsfn<<1))*(1 + (7*(1+sfn))))<<9); //cinit - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); for (n=1; n<50; n++) { diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c index d48164e07d..b03f59fb78 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c @@ -121,7 +121,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, for (n=0; n<(1+(G>>5)); n++) { #ifdef DEBUG_SCRAMBLING - for (int k=0; k<32; k++) printf("scrambling %d : %d xor %d = %d\n",k+(n<<5),e[k],(s>>k)&1,e[k]^((s>>k)&1)); + for (int k=0; k<32; k++) printf("scrambling %d : %x xor %x = %d\n",k+(n<<5),e[k],(s>>k)&1,e[k]^((s>>k)&1)); #endif e[0] = (e[0]) ^ (s&1); diff --git a/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c b/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c index b249052cbf..a23f8db4f2 100644 --- a/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c +++ b/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c @@ -41,7 +41,7 @@ extern inline uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t res { // Init value for x1: x1(0) = 1, x1(n) = 0, n=1,2,...,30 // x1(31) = [x1(3) + x1(0)]mod2 = 1 - *x1 = 1 + (1<<31); + *x1 = 1 + (1U<<31); // Init value for x2: cinit = sum_{i=0}^30 x2*2^i // x2(31) = [x2(3) + x2(2) + x2(1) + x2(0)]mod2 // = (*x2>>3) ^ (*x2>>2) + (*x2>>1) + *x2 diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index 92fe777201..476d7028b1 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -374,7 +374,7 @@ static inline unsigned int lte_gold_unscram(unsigned int *x1, unsigned int *x2, int n; if (reset) { - *x1 = 1+ (1<<31); + *x1 = 1+ (1U<<31); *x2=*x2 ^ ((*x2 ^ (*x2>>1) ^ (*x2>>2) ^ (*x2>>3))<<31); // skip first 50 double words (1600 bits) diff --git a/openair1/PHY/NR_REFSIG/dmrs_nr.c b/openair1/PHY/NR_REFSIG/dmrs_nr.c index 03a37e2b27..2e270318f8 100644 --- a/openair1/PHY/NR_REFSIG/dmrs_nr.c +++ b/openair1/PHY/NR_REFSIG/dmrs_nr.c @@ -150,7 +150,7 @@ void pseudo_random_sequence_optimised(unsigned int size, uint32_t *c, uint32_t c unsigned int n,x1,x2; /* init of m-sequences */ - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2 = cinit; x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c index 9171b6c067..484119f409 100644 --- a/openair1/SIMULATION/TOOLS/random_channel.c +++ b/openair1/SIMULATION/TOOLS/random_channel.c @@ -50,7 +50,7 @@ static int channelmod_print_help(char *buff, int debug, telnet_printfunc_t prnt) static telnetshell_cmddef_t channelmod_cmdarray[] = { {"help","",channelmod_print_help}, {"show","",channelmod_show_cmd}, - {"modify"," ",channelmod_modify_cmd}, + {"modify"," ",channelmod_modify_cmd}, {"","",NULL}, }; @@ -62,7 +62,7 @@ static double snr_dB=25; static double sinr_dB=0; static unsigned int max_chan; static channel_desc_t **defined_channels; -static char modellist_name[MAX_OPTNAME_SIZE]={0}; +static char modellist_name[MAX_OPTNAME_SIZE]= {0}; void fill_channel_desc(channel_desc_t *chan_desc, @@ -71,7 +71,7 @@ void fill_channel_desc(channel_desc_t *chan_desc, uint8_t nb_taps, uint8_t channel_length, double *amps, - double *delays, + double *delays, struct complex **R_sqrt, double Td, double sampling_rate, @@ -139,8 +139,10 @@ void fill_channel_desc(channel_desc_t *chan_desc, if (R_sqrt == NULL) { chan_desc->R_sqrt = (struct complex **) calloc(nb_taps,sizeof(struct complex *)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_NTAPS ; + for (i = 0; iR_sqrt[i] = (struct complex *) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex)); + chan_desc->R_sqrt[i] = (struct complex *) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex)); + for (j = 0; jR_sqrt[i][j].x = 1.0; chan_desc->R_sqrt[i][j].y = 0.0; @@ -148,7 +150,7 @@ void fill_channel_desc(channel_desc_t *chan_desc, } } else { chan_desc->R_sqrt = (struct complex **) calloc(nb_taps,sizeof(struct complex *)); - + for (i = 0; iR_sqrt[i] = (struct complex*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex)); //chan_desc->R_sqrt = (struct complex*)&R_sqrt[i][0]; @@ -178,218 +180,228 @@ void fill_channel_desc(channel_desc_t *chan_desc, double mbsfn_delays[] = {0,.03,.15,.31,.37,1.09,12.490,12.52,12.64,12.80,12.86,13.58,27.49,27.52,27.64,27.80,27.86,28.58}; double mbsfn_amps_dB[] = {0,-1.5,-1.4,-3.6,-0.6,-7.0,-10,-11.5,-11.4,-13.6,-10.6,-17.0,-20,-21.5,-21.4,-23.6,-20.6,-27}; -double scm_c_delays[] = {0, 0.0125, 0.0250, 0.3625, 0.3750, 0.3875, 0.2500, 0.2625, 0.2750, 1.0375, 1.0500, 1.0625, 2.7250, 2.7375, 2.7500, 4.6000, 4.6125, 4.6250}; +double scm_c_delays[] = {0, 0.0125, 0.0250, 0.3625, 0.3750, 0.3875, 0.2500, 0.2625, 0.2750, 1.0375, 1.0500, 1.0625, 2.7250, 2.7375, 2.7500, 4.6000, 4.6125, 4.6250}; double scm_c_amps_dB[] = {0.00, -2.22, -3.98, -1.86, -4.08, -5.84, -1.08, -3.30, -5.06, -9.08, -11.30, -13.06, -15.14, -17.36, -19.12, -20.64, -22.85, -24.62}; double tdl_a_delays[] = {0.0000, - 0.3819, - 0.4025, - 0.5868, - 0.4610, - 0.5375, - 0.6708, - 0.5750, - 0.7618, - 1.5375, - 1.8978, - 2.2242, - 2.1718, - 2.4942, - 2.5119, - 3.0582, - 4.0810, - 4.4579, - 4.5695, - 4.7966, - 5.0066, - 5.3043, - 9.6586}; + 0.3819, + 0.4025, + 0.5868, + 0.4610, + 0.5375, + 0.6708, + 0.5750, + 0.7618, + 1.5375, + 1.8978, + 2.2242, + 2.1718, + 2.4942, + 2.5119, + 3.0582, + 4.0810, + 4.4579, + 4.5695, + 4.7966, + 5.0066, + 5.3043, + 9.6586 + }; double tdl_a_amps_dB[] = {-13.4, - 0, - -2.2, - -4, - -6, - -8.2, - -9.9, - -10.5, - -7.5, - -15.9, - -6.6, - -16.7, - -12.4, - -15.2, - -10.8, - -11.3, - -12.7, - -16.2, - -18.3, - -18.9, - -16.6, - -19.9, - -29.7}; + 0, + -2.2, + -4, + -6, + -8.2, + -9.9, + -10.5, + -7.5, + -15.9, + -6.6, + -16.7, + -12.4, + -15.2, + -10.8, + -11.3, + -12.7, + -16.2, + -18.3, + -18.9, + -16.6, + -19.9, + -29.7 + }; double tdl_b_delays[] = {0.0000, - 0.1072, - 0.2155, - 0.2095, - 0.2870, - 0.2986, - 0.3752, - 0.5055, - 0.3681, - 0.3697, - 0.5700, - 0.5283, - 1.1021, - 1.2756, - 1.5474, - 1.7842, - 2.0169, - 2.8294, - 3.0219, - 3.6187, - 4.1067, - 4.2790, - 4.7834}; + 0.1072, + 0.2155, + 0.2095, + 0.2870, + 0.2986, + 0.3752, + 0.5055, + 0.3681, + 0.3697, + 0.5700, + 0.5283, + 1.1021, + 1.2756, + 1.5474, + 1.7842, + 2.0169, + 2.8294, + 3.0219, + 3.6187, + 4.1067, + 4.2790, + 4.7834 + }; double tdl_b_amps_dB[] = {0, - -2.2, - -4, - -3.2, - -9.8, - -1.2, - -3.4, - -5.2, - -7.6, - -3, - -8.9, - -9, - -4.8, - -5.7, - -7.5, - -1.9, - -7.6, - -12.2, - -9.8, - -11.4, - -14.9, - -9.2, - -11.3}; + -2.2, + -4, + -3.2, + -9.8, + -1.2, + -3.4, + -5.2, + -7.6, + -3, + -8.9, + -9, + -4.8, + -5.7, + -7.5, + -1.9, + -7.6, + -12.2, + -9.8, + -11.4, + -14.9, + -9.2, + -11.3 + }; double tdl_c_delays[] = {0, - 0.2099, - 0.2219, - 0.2329, - 0.2176, - 0.6366, - 0.6448, - 0.6560, - 0.6584, - 0.7935, - 0.8213, - 0.9336, - 1.2285, - 1.3083, - 2.1704, - 2.7105, - 4.2589, - 4.6003, - 5.4902, - 5.6077, - 6.3065, - 6.6374, - 7.0427, - 8.6523}; + 0.2099, + 0.2219, + 0.2329, + 0.2176, + 0.6366, + 0.6448, + 0.6560, + 0.6584, + 0.7935, + 0.8213, + 0.9336, + 1.2285, + 1.3083, + 2.1704, + 2.7105, + 4.2589, + 4.6003, + 5.4902, + 5.6077, + 6.3065, + 6.6374, + 7.0427, + 8.6523 + }; double tdl_c_amps_dB[] = {-4.4, - -1.2, - -3.5, - -5.2, - -2.5, - 0, - -2.2, - -3.9, - -7.4, - -7.1, - -10.7, - -11.1, - -5.1, - -6.8, - -8.7, - -13.2, - -13.9, - -13.9, - -15.8, - -17.1, - -16, - -15.7, - -21.6, - -22.8}; + -1.2, + -3.5, + -5.2, + -2.5, + 0, + -2.2, + -3.9, + -7.4, + -7.1, + -10.7, + -11.1, + -5.1, + -6.8, + -8.7, + -13.2, + -13.9, + -13.9, + -15.8, + -17.1, + -16, + -15.7, + -21.6, + -22.8 + }; double tdl_d_delays[] = {//0, - 0, - 0.035, - 0.612, - 1.363, - 1.405, - 1.804, - 2.596, - 1.775, - 4.042, - 7.937, - 9.424, - 9.708, - 12.525}; + 0, + 0.035, + 0.612, + 1.363, + 1.405, + 1.804, + 2.596, + 1.775, + 4.042, + 7.937, + 9.424, + 9.708, + 12.525 +}; double tdl_d_amps_dB[] = {//-0.2, -//-13.5, - -.00147, - -18.8, - -21, - -22.8, - -17.9, - -20.1, - -21.9, - -22.9, - -27.8, - -23.6, - -24.8, - -30.0, - -27.7}; + //-13.5, + -.00147, + -18.8, + -21, + -22.8, + -17.9, + -20.1, + -21.9, + -22.9, + -27.8, + -23.6, + -24.8, + -30.0, + -27.7 + }; #define TDL_D_RICEAN_FACTOR .046774 double tdl_e_delays[] = {0, - 0.5133, - 0.5440, - 0.5630, - 0.5440, - 0.7112, - 1.9092, - 1.9293, - 1.9589, - 2.6426, - 3.7136, - 5.4524, - 12.0034, - 20.6519}; + 0.5133, + 0.5440, + 0.5630, + 0.5440, + 0.7112, + 1.9092, + 1.9293, + 1.9589, + 2.6426, + 3.7136, + 5.4524, + 12.0034, + 20.6519 + }; double tdl_e_amps_dB[] = {//-0.03, - //-22.03, - -.00433, - -15.8, - -18.1, - -19.8, - -22.9, - -22.4, - -18.6, - -20.8, - -22.6, - -22.3, - -25.6, - -20.2, - -29.8, - -29.2}; + //-22.03, + -.00433, + -15.8, + -18.1, + -19.8, + -22.9, + -22.4, + -18.6, + -20.8, + -22.6, + -22.3, + -25.6, + -20.2, + -29.8, + -29.2 + }; #define TDL_E_RICEAN_FACTOR 0.0063096 @@ -492,33 +504,101 @@ struct complex *R_sqrt_22_EPA_medium[1] = {R_sqrt_22_EPA_medium_tap}; //Rayleigh1_orth_eff_ch_TM4 +void tdlModel(int tdl_paths, double *tdl_delays, double *tdl_amps_dB, double DS_TDL, channel_desc_t *chan_desc ) { + int nb_rx=chan_desc-> nb_rx; + int nb_tx=chan_desc-> nb_tx; + int tdl_pathsby3 = tdl_paths/3; + + if ((tdl_paths%3)>0) + tdl_pathsby3++; + + chan_desc->nb_taps = tdl_paths; + chan_desc->Td = tdl_delays[tdl_paths-1]*DS_TDL; + printf("last path (%d) at %f * %e = %e\n",tdl_paths-1,tdl_delays[tdl_paths-1],DS_TDL,chan_desc->Td); + chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + + 1 + + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); + printf("TDL : %f Ms/s, nb_taps %d, Td %e, channel_length %d\n",chan_desc->sampling_rate,tdl_paths,chan_desc->Td,chan_desc->channel_length); + double sum_amps = 0; + chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); + + for (int i = 0; inb_taps; i++) { + chan_desc->amps[i] = pow(10,.1*tdl_amps_dB[i]); + sum_amps += chan_desc->amps[i]; + } + + for (int i = 0; inb_taps; i++) { + chan_desc->amps[i] /= sum_amps; + tdl_delays[i] *= DS_TDL; + } + + chan_desc->delays = tdl_delays; + chan_desc->aoa = 0; + chan_desc->random_aoa = 0; + chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *)); + chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *)); + chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *)); + + for (int i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex)); + + for (int i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex)); + + for (int i = 0; inb_taps; i++) + chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex)); + + chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); + + if (nb_tx==2 && nb_rx==2) { + for (int i = 0; i<(tdl_pathsby3); i++) + chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0]; + } else if (nb_tx==2 && nb_rx==1) { + for (int i = 0; i<(tdl_pathsby3); i++) + chan_desc->R_sqrt[i] = (struct complex *) &R21_sqrt[i][0]; + } else if (nb_tx==1 && nb_rx==2) { + for (int i = 0; i<(tdl_pathsby3); i++) + chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0]; + } else { + for (int i = 0; i<(tdl_pathsby3); i++) { + chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); + + for (int j = 0; jR_sqrt[i][j].x = 1.0; + chan_desc->R_sqrt[i][j].y = 0.0; + } + + LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx); + } + } +} channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, uint8_t nb_rx, SCM_t channel_model, double sampling_rate, double channel_bandwidth, - double DS_TDL, + double DS_TDL, double forgetting_factor, int32_t channel_offset, double path_loss_dB, - float noise_power_dB) { + float noise_power_dB) { channel_desc_t *chan_desc = (channel_desc_t *)calloc(1,sizeof(channel_desc_t)); - for(int i=0; ichan_idx=i; - break; - } - else { - AssertFatal(i<(max_chan-1), - "No more channel descriptors available, increase channelmod.max_chan parameter above %u\n",max_chan); - } + + for(int i=0; ichan_idx=i; + break; + } else { + AssertFatal(i<(max_chan-1), + "No more channel descriptors available, increase channelmod.max_chan parameter above %u\n",max_chan); + } } + uint16_t i,j; double sum_amps; double aoa,ricean_factor,Td,maxDoppler; - int channel_length,nb_taps; chan_desc->modelid = channel_model; chan_desc->nb_tx = nb_tx; @@ -531,9 +611,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->first_run = 1; chan_desc->ip = 0.0; chan_desc->noise_power_dB = noise_power_dB; - LOG_I(OCM,"Channel Model (inside of new_channel_desc_scm)=%d\n\n", channel_model); - int tdl_paths=0; double *tdl_amps_dB; double *tdl_delays; @@ -556,7 +634,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); - chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*scm_c_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -594,10 +673,11 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, for (i = 0; i<6; i++) chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0]; } else { - chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); - + for (j = 0; jR_sqrt[i][j].x = 1.0; chan_desc->R_sqrt[i][j].y = 0.0; @@ -617,6 +697,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*scm_c_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -654,7 +735,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, for (i = 0; i<6; i++) chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0]; } else { - chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); @@ -668,95 +750,41 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, } break; - -/* tapped delay line (TDL) channel model from TR 38.901 Section 7.7.2 */ + /* tapped delay line (TDL) channel model from TR 38.901 Section 7.7.2 */ #define tdl_m(MoDel)\ - DevAssert(sizeof(tdl_ ## MoDel ## _amps_dB) == sizeof(tdl_ ## MoDel ## _delays)); \ - tdl_paths=sizeof(tdl_ ## MoDel ## _amps_dB)/sizeof(*tdl_ ## MoDel ## _amps_dB);\ - tdl_delays=tdl_ ## MoDel ## _delays;\ - tdl_amps_dB=tdl_ ## MoDel ## _amps_dB + DevAssert(sizeof(tdl_ ## MoDel ## _amps_dB) == sizeof(tdl_ ## MoDel ## _delays)); \ + tdl_paths=sizeof(tdl_ ## MoDel ## _amps_dB)/sizeof(*tdl_ ## MoDel ## _amps_dB);\ + tdl_delays=tdl_ ## MoDel ## _delays;\ + tdl_amps_dB=tdl_ ## MoDel ## _amps_dB case TDL_A: - case TDL_B: - case TDL_C: - case TDL_D: - case TDL_E: chan_desc->ricean_factor = 1; - if (channel_model == TDL_A) { - tdl_m(a); - }else if (channel_model == TDL_B) { - tdl_m(b); - } - else if (channel_model == TDL_C) { - tdl_m(c); - } else if (channel_model == TDL_D) { - tdl_m(d); - chan_desc->ricean_factor = TDL_D_RICEAN_FACTOR; - } else if (channel_model == TDL_E) { - tdl_m(e); - chan_desc->ricean_factor = TDL_E_RICEAN_FACTOR; - } + tdl_m(a); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); + break; - int tdl_pathsby3 = tdl_paths/3; - if ((tdl_paths%3)>0) tdl_pathsby3++; + case TDL_B: + chan_desc->ricean_factor = 1; + tdl_m(b); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); + break; - chan_desc->nb_taps = tdl_paths; - chan_desc->Td = tdl_delays[tdl_paths-1]*DS_TDL; - printf("last path (%d) at %f * %e = %e\n",tdl_paths-1,tdl_delays[tdl_paths-1],DS_TDL,chan_desc->Td); - chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); - printf("TDL : %f Ms/s, nb_taps %d, Td %e, channel_length %d\n",chan_desc->sampling_rate,tdl_paths,chan_desc->Td,chan_desc->channel_length); - sum_amps = 0; - chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); + case TDL_C: + chan_desc->ricean_factor = 1; + tdl_m(c); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); + break; - for (i = 0; inb_taps; i++) { - chan_desc->amps[i] = pow(10,.1*tdl_amps_dB[i]); - sum_amps += chan_desc->amps[i]; - } - - for (i = 0; inb_taps; i++) { - chan_desc->amps[i] /= sum_amps; - tdl_delays[i] *= DS_TDL; - } - chan_desc->delays = tdl_delays; - chan_desc->aoa = 0; - chan_desc->random_aoa = 0; - chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *)); - chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *)); - chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *)); - - for (i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex)); - - for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex)); - - for (i = 0; inb_taps; i++) - chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex)); - - chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); - - if (nb_tx==2 && nb_rx==2) { - for (i = 0; i<(tdl_pathsby3); i++) - chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0]; - } else if (nb_tx==2 && nb_rx==1) { - for (i = 0; i<(tdl_pathsby3); i++) - chan_desc->R_sqrt[i] = (struct complex *) &R21_sqrt[i][0]; - } else if (nb_tx==1 && nb_rx==2) { - for (i = 0; i<(tdl_pathsby3); i++) - chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0]; - } else { - for (i = 0; i<(tdl_pathsby3); i++) { - chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); - - for (j = 0; jR_sqrt[i][j].x = 1.0; - chan_desc->R_sqrt[i][j].y = 0.0; - } - - LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx); - } - } + case TDL_D: + chan_desc->ricean_factor = TDL_D_RICEAN_FACTOR; + tdl_m(d); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); + break; + case TDL_E: + chan_desc->ricean_factor = TDL_E_RICEAN_FACTOR; + tdl_m(e); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); break; case EPA: @@ -766,6 +794,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -784,7 +813,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, for (i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex)); - + for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex)); @@ -799,6 +828,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, } else { chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); @@ -820,6 +850,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -865,7 +896,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n"); } }*/ - break; + break; case EPA_high: chan_desc->nb_taps = 7; @@ -874,6 +905,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -927,7 +959,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); - chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -982,6 +1015,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*eva_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -1015,7 +1049,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, } else { chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; - for (i = 0; i<6; i++) { + + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); for (j = 0; jamps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*etu_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -1069,6 +1105,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, } else { chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); @@ -1090,6 +1127,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*mbsfn_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -1117,6 +1155,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex *)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); @@ -1628,13 +1667,14 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, return(chan_desc); } /* channel_desc_t *new_channel_desc_scm */ -channel_desc_t * find_channel_desc_fromname( char *modelname ) { - for(int i=0; imodel_name,modelname) == 0) - return defined_channels[i]; - } - } +channel_desc_t *find_channel_desc_fromname( char *modelname ) { + for(int i=0; imodel_name,modelname) == 0) + return defined_channels[i]; + } + } + LOG_E(OCM,"Model %s not found \n", modelname); return NULL; } /* channel_desc_t * new_channel_desc_fromconfig */ @@ -1643,41 +1683,48 @@ channel_desc_t * find_channel_desc_fromname( char *modelname ) { void free_channel_desc_scm(channel_desc_t *ch) { // Must be made cleanly, a lot of leaks... - defined_channels[ch->chan_idx]=NULL; + defined_channels[ch->chan_idx]=NULL; + if(ch->free_flags&CHANMODEL_FREE_AMPS) free(ch->amps); - for (int i = 0; inb_tx*ch->nb_rx; i++) { + + for (int i = 0; inb_tx*ch->nb_rx; i++) { free(ch->ch[i]); free(ch->chF[i]); } - + for (int i = 0; inb_taps; i++) { - free(ch->a[i]); - } + free(ch->a[i]); + } + if(ch->free_flags&CHANMODEL_FREE_DELAY) - free(ch->delays); + free(ch->delays); + if(ch->free_flags&CHANMODEL_FREE_RSQRT_6) - for (int i = 0; i<6; i++) - free(ch->R_sqrt[i]); + for (int i = 0; i<6; i++) + free(ch->R_sqrt[i]); + if(ch->free_flags&CHANMODEL_FREE_RSQRT_NTAPS) - for (int i = 0; inb_taps;i++) - free(ch->R_sqrt[i]); - free(ch->R_sqrt); - free(ch->ch); + for (int i = 0; inb_taps; i++) + free(ch->R_sqrt[i]); + + free(ch->R_sqrt); + free(ch->ch); free(ch->chF); free(ch->a); free(ch->model_name); - free(ch); + free(ch); } void set_channeldesc_owner(channel_desc_t *cdesc, uint32_t module_id) { - cdesc->module_id=module_id; + cdesc->module_id=module_id; } void set_channeldesc_name(channel_desc_t *cdesc,char *modelname) { - if(cdesc->model_name != NULL) - free(cdesc->model_name); - cdesc->model_name=strdup(modelname); + if(cdesc->model_name != NULL) + free(cdesc->model_name); + + cdesc->model_name=strdup(modelname); } int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { @@ -1798,14 +1845,14 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { desc->ch[aarx+(aatx*desc->nb_rx)][k].x += s*desc->a[l][aarx+(aatx*desc->nb_rx)].x; desc->ch[aarx+(aatx*desc->nb_rx)][k].y += s*desc->a[l][aarx+(aatx*desc->nb_rx)].y; - // printf("l %d : desc->ch.x %f, s %e, delay %f\n",l,desc->a[l][aarx+(aatx*desc->nb_rx)].x,s,desc->delays[l]); + // printf("l %d : desc->ch.x %f, s %e, delay %f\n",l,desc->a[l][aarx+(aatx*desc->nb_rx)].x,s,desc->delays[l]); } //nb_taps #ifdef DEBUG_CH printf("(%d,%d,%d)->(%e,%e)\n",k,aarx,aatx,desc->ch[aarx+(aatx*desc->nb_rx)][k].x,desc->ch[aarx+(aatx*desc->nb_rx)][k].y); #endif } //channel_length - } + } } //aatx } //aarx @@ -1817,7 +1864,7 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { return (0); } - + double N_RB2sampling_rate(uint16_t N_RB) { double sampling_rate; @@ -1869,127 +1916,141 @@ double N_RB2channel_bandwidth(uint16_t N_RB) { LOG_E(OCM,"Unknown N_PRB\n"); return(-1); } - return(channel_bandwidth); -} - + return(channel_bandwidth); +} + + static int channelmod_print_help(char *buff, int debug, telnet_printfunc_t prnt ) { - prnt("channelmod commands can be used to display or modify channel models parameters\n"); - prnt("channelmod show predef: display predefined model algorithms available in oai\n"); - prnt("channelmod show current: display the currently used models in the running executable\n"); - prnt("channelmod modify : set the specified parameters in a current model to the given value\n"); - prnt(" specifies the model, the show current model command can be used to list the current models indexes\n"); - prnt(" can be one of \"riceanf\", \"aoa\", \"randaoa\", \"ploss\", \"noise_power_dB\", \"offset\", \"forgetf\"\n"); - return CMDSTATUS_FOUND; + prnt("channelmod commands can be used to display or modify channel models parameters\n"); + prnt("channelmod show predef: display predefined model algorithms available in oai\n"); + prnt("channelmod show current: display the currently used models in the running executable\n"); + prnt("channelmod modify : set the specified parameters in a current model to the given value\n"); + prnt(" specifies the model, the show current model command can be used to list the current models indexes\n"); + prnt(" can be one of \"riceanf\", \"aoa\", \"randaoa\", \"ploss\", \"noise_power_dB\", \"offset\", \"forgetf\"\n"); + return CMDSTATUS_FOUND; } static void display_channelmodel(channel_desc_t *cd,int debug, telnet_printfunc_t prnt) { - char *module_id_str[]=MODULEID_STR_INIT; - prnt("model owner: %s\n",(cd->module_id != 0)?module_id_str[cd->module_id]:"not set"); - prnt("nb_tx: %i nb_rx: %i taps: %i bandwidth: %lf sampling: %lf\n",cd->nb_tx, cd->nb_rx, cd->nb_taps, cd->channel_bandwidth, cd->sampling_rate); - prnt("channel length: %i Max path delay: %lf ricean fact.: %lf angle of arrival: %lf (randomized:%s)\n", - cd->channel_length, cd->Td, cd->ricean_factor, cd->aoa, (cd->random_aoa?"Yes":"No")); - prnt("max Doppler: %lf path loss: %lf noise: %lf rchannel offset: %i forget factor; %lf\n", - cd->max_Doppler, cd->path_loss_dB, cd->noise_power_dB, cd->channel_offset, cd->forgetting_factor); - prnt("Initial phase: %lf nb_path: %i \n", - cd->ip, cd->nb_paths); - for (int i=0; inb_taps ; i++) { - prnt("taps: %i lin. ampli. : %lf delay: %lf \n",i,cd->amps[i], cd->delays[i]); - } + char *module_id_str[]=MODULEID_STR_INIT; + prnt("model owner: %s\n",(cd->module_id != 0)?module_id_str[cd->module_id]:"not set"); + prnt("nb_tx: %i nb_rx: %i taps: %i bandwidth: %lf sampling: %lf\n",cd->nb_tx, cd->nb_rx, cd->nb_taps, cd->channel_bandwidth, cd->sampling_rate); + prnt("channel length: %i Max path delay: %lf ricean fact.: %lf angle of arrival: %lf (randomized:%s)\n", + cd->channel_length, cd->Td, cd->ricean_factor, cd->aoa, (cd->random_aoa?"Yes":"No")); + prnt("max Doppler: %lf path loss: %lf noise: %lf rchannel offset: %i forget factor; %lf\n", + cd->max_Doppler, cd->path_loss_dB, cd->noise_power_dB, cd->channel_offset, cd->forgetting_factor); + prnt("Initial phase: %lf nb_path: %i \n", + cd->ip, cd->nb_paths); + + for (int i=0; inb_taps ; i++) { + prnt("taps: %i lin. ampli. : %lf delay: %lf \n",i,cd->amps[i], cd->delays[i]); + } } - - + + static int channelmod_show_cmd(char *buff, int debug, telnet_printfunc_t prnt) { - char *subcmd=NULL; + char *subcmd=NULL; int s = sscanf(buff,"%ms\n",&subcmd); if (s>0) { if ( strcmp(subcmd,"predef") == 0) { for (int i=0; channelmod_names[i].name != NULL ; i++) { prnt(" %i %s\n", i, map_int_to_str(channelmod_names,i )); - } + } } else if ( strcmp(subcmd,"current") == 0) { for (int i=0; i < max_chan ; i++) { - if (defined_channels[i] != NULL) { - prnt("model %i %s type %s: \n----------------\n", i, (defined_channels[i]->model_name !=NULL)?defined_channels[i]->model_name:"(no name set)", - map_int_to_str(channelmod_names,defined_channels[i]->modelid)); - display_channelmodel(defined_channels[i],debug,prnt); + if (defined_channels[i] != NULL) { + prnt("model %i %s type %s: \n----------------\n", i, (defined_channels[i]->model_name !=NULL)?defined_channels[i]->model_name:"(no name set)", + map_int_to_str(channelmod_names,defined_channels[i]->modelid)); + display_channelmodel(defined_channels[i],debug,prnt); } } } else { - channelmod_print_help(buff, debug, prnt); + channelmod_print_help(buff, debug, prnt); } - free(subcmd); + + free(subcmd); } + return CMDSTATUS_FOUND; } - + static int channelmod_modify_cmd(char *buff, int debug, telnet_printfunc_t prnt) { - char *param=NULL, *value=NULL; + char *param=NULL, *value=NULL; int cd_id= -1; int s = sscanf(buff,"%i %ms %ms \n",&cd_id,¶m, &value); + if (cd_id<0 || cd_id >= max_chan) { - prnt("ERROR, %i: Channel model id outof range (0-%i)\n",cd_id,max_chan-1); - return CMDSTATUS_FOUND; + prnt("ERROR, %i: Channel model id outof range (0-%i)\n",cd_id,max_chan-1); + return CMDSTATUS_FOUND; } + if (defined_channels[cd_id]==NULL) { - prnt("ERROR, %i: Channel model has not been set\n",cd_id); - return CMDSTATUS_FOUND; - } - + prnt("ERROR, %i: Channel model has not been set\n",cd_id); + return CMDSTATUS_FOUND; + } + if (s==3) { if ( strcmp(param,"riceanf") == 0) { - double dbl = atof(value); - if (dbl <0 || dbl > 1) - prnt("ERROR: ricean factor range: 0 to 1, %lf is outof range\n",dbl); - else - defined_channels[cd_id]->ricean_factor=dbl; + double dbl = atof(value); + + if (dbl <0 || dbl > 1) + prnt("ERROR: ricean factor range: 0 to 1, %lf is outof range\n",dbl); + else + defined_channels[cd_id]->ricean_factor=dbl; } else if ( strcmp(param,"aoa") == 0) { - double dbl = atof(value); - if (dbl <0 || dbl >6.28) - prnt("ERROR: angle of arrival range: 0 to 2*Pi, %lf is outof range\n",dbl); - else - defined_channels[cd_id]->aoa=dbl; + double dbl = atof(value); + + if (dbl <0 || dbl >6.28) + prnt("ERROR: angle of arrival range: 0 to 2*Pi, %lf is outof range\n",dbl); + else + defined_channels[cd_id]->aoa=dbl; } else if ( strcmp(param,"randaoa") == 0) { - int i = atoi(value); - if (i!=0 && i!=1) - prnt("ERROR: randaoa is a boolean, must be 0 or 1\n"); - else - defined_channels[cd_id]->random_aoa=i; + int i = atoi(value); + + if (i!=0 && i!=1) + prnt("ERROR: randaoa is a boolean, must be 0 or 1\n"); + else + defined_channels[cd_id]->random_aoa=i; } else if ( strcmp(param,"ploss") == 0) { - double dbl = atof(value); - defined_channels[cd_id]->path_loss_dB=dbl; + double dbl = atof(value); + defined_channels[cd_id]->path_loss_dB=dbl; } else if ( strcmp(param,"noise_power_dB") == 0) { double dbl = atof(value); defined_channels[cd_id]->noise_power_dB=dbl; } else if ( strcmp(param,"offset") == 0) { - int i = atoi(value); - defined_channels[cd_id]->channel_offset=i; + int i = atoi(value); + defined_channels[cd_id]->channel_offset=i; } else if ( strcmp(param,"forgetf") == 0) { - double dbl = atof(value); - if (dbl <0 || dbl > 1) - prnt("ERROR: forgetting factor range: 0 to 1 (disable variation), %lf is outof range\n",dbl); - else - defined_channels[cd_id]->forgetting_factor=dbl; + double dbl = atof(value); + + if (dbl <0 || dbl > 1) + prnt("ERROR: forgetting factor range: 0 to 1 (disable variation), %lf is outof range\n",dbl); + else + defined_channels[cd_id]->forgetting_factor=dbl; } else { - prnt("ERROR: %s, unknown channel parameter\n",param); - return CMDSTATUS_FOUND; + prnt("ERROR: %s, unknown channel parameter\n",param); + return CMDSTATUS_FOUND; } - display_channelmodel(defined_channels[cd_id],debug,prnt); - free(param); - free(value); - random_channel(defined_channels[cd_id],false); + + display_channelmodel(defined_channels[cd_id],debug,prnt); + free(param); + free(value); + random_channel(defined_channels[cd_id],false); } - return CMDSTATUS_FOUND; + + return CMDSTATUS_FOUND; } - -int modelid_fromstrtype(char *modeltype) { - int modelid=map_str_to_int(channelmod_names,modeltype); - if (modelid < 0) + +int modelid_fromstrtype(char *modeltype) { + int modelid=map_str_to_int(channelmod_names,modeltype); + + if (modelid < 0) LOG_E(OCM,"random_channel.c: Error channel model %s unknown\n",modeltype); + return modelid; } @@ -2003,13 +2064,11 @@ double channelmod_get_sinr_dB(void) { void init_channelmod(void) { paramdef_t channelmod_params[] = CHANNELMOD_PARAMS_DESC; - int numparams=sizeof(channelmod_params)/sizeof(paramdef_t); int ret = config_get( channelmod_params,numparams,CHANNELMOD_SECTION); AssertFatal(ret >= 0, "configuration couldn't be performed"); - defined_channels=calloc(max_chan,sizeof( channel_desc_t*)); + defined_channels=calloc(max_chan,sizeof( channel_desc_t *)); AssertFatal(defined_channels!=NULL, "couldn't allocate %u channel descriptors\n",max_chan); - /* look for telnet server, if it is loaded, add the channel modeling commands to it */ add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME); @@ -2024,37 +2083,40 @@ int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double paramlist_def_t channel_list; memset(&channel_list,0,sizeof(paramlist_def_t)); memcpy(channel_list.listname,modellist_name,sizeof(channel_list.listname)-1); - int numparams = sizeof(achannel_params)/sizeof(paramdef_t); config_getlist( &channel_list,achannel_params,numparams, CHANNELMOD_SECTION); AssertFatal(channel_list.numelt>0, "List %s.%s not found in config file\n",CHANNELMOD_SECTION,channel_list.listname); - int pindex_NAME = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_NAME_PNAME); + int pindex_NAME = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_NAME_PNAME); int pindex_DT = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_DT_PNAME ); int pindex_FF = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_FF_PNAME ); int pindex_CO = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_CO_PNAME ); int pindex_PL = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_PL_PNAME ); int pindex_NP = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_NP_PNAME ); int pindex_TYPE = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_TYPE_PNAME); - - for (int i=0; imodel_name = strdup(*(channel_list.paramarray[i][pindex_NAME].strptr)); - LOG_I(OCM,"Model %s type %s allocated from config file, list %s\n",*(channel_list.paramarray[i][pindex_NAME].strptr), - *(channel_list.paramarray[i][pindex_TYPE].strptr), modellist_name); + *(channel_list.paramarray[i][pindex_DT].dblptr), *(channel_list.paramarray[i][pindex_FF].dblptr), + *(channel_list.paramarray[i][pindex_CO].iptr), *(channel_list.paramarray[i][pindex_PL].dblptr), + *(channel_list.paramarray[i][pindex_NP].dblptr) ); + AssertFatal( (channeldesc_p!= NULL), "Could not allocate channel %s type %s \n",*(channel_list.paramarray[i][pindex_NAME].strptr), *(channel_list.paramarray[i][pindex_TYPE].strptr)); + channeldesc_p->model_name = strdup(*(channel_list.paramarray[i][pindex_NAME].strptr)); + LOG_I(OCM,"Model %s type %s allocated from config file, list %s\n",*(channel_list.paramarray[i][pindex_NAME].strptr), + *(channel_list.paramarray[i][pindex_TYPE].strptr), modellist_name); } /* for loop on channel_list */ + return channel_list.numelt; } /* load_channelist */ From fbf39eecc17a621efa56232acc36b2fac956d211 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 26 Mar 2021 16:32:20 +0100 Subject: [PATCH 20/66] cppcheck fixes --- common/utils/backtrace.c | 2 +- nfapi/oai_integration/nfapi_pnf.c | 4 +- nfapi/open-nFAPI/common/src/debug.c | 152 +++++++++--------- nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp | 4 +- .../PHY/LTE_UE_TRANSPORT/srs_modulation.c | 1 + openair2/ENB_APP/flexran_agent_common.c | 12 -- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 1 - .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 2 +- targets/RT/USER/lte-ru.c | 1 - 10 files changed, 84 insertions(+), 97 deletions(-) diff --git a/common/utils/backtrace.c b/common/utils/backtrace.c index f6de74f156..f61cf0349a 100644 --- a/common/utils/backtrace.c +++ b/common/utils/backtrace.c @@ -38,7 +38,7 @@ void display_backtrace(void) { size_t i; char *test=getenv("NO_BACKTRACE"); - if (test!=0) *((int *)0)=0; + if (test!=0) abort(); size = backtrace(array, 10); strings = backtrace_symbols(array, size); diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index 4ca02ed929..9b550cf7d8 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -2199,7 +2199,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add pnf.phys[0].udp.tx_port = vnf_p7_port; strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr); strcpy(pnf.phys[0].local_addr, pnf_ip_addr); - printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n", + printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%u rx:%u]\n", __FUNCTION__,config->vnf_ip_addr, config->vnf_p5_port, pnf.phys[0].local_addr, pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port, @@ -2250,7 +2250,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, pnf.phys[0].udp.tx_port = vnf_p7_port; strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr); strcpy(pnf.phys[0].local_addr, pnf_ip_addr); - printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n", + printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%u rx:%u]\n", __FUNCTION__, config->vnf_ip_addr, config->vnf_p5_port, pnf.phys[0].local_addr, diff --git a/nfapi/open-nFAPI/common/src/debug.c b/nfapi/open-nFAPI/common/src/debug.c index a45d41d7d7..f53be43223 100644 --- a/nfapi/open-nFAPI/common/src/debug.c +++ b/nfapi/open-nFAPI/common/src/debug.c @@ -1,76 +1,76 @@ -/* - * Copyright 2017 Cisco Systems, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define MAX_MSG_LENGTH 2096 -#define TRACE_HEADER_LENGTH 44 - -void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...); - -// initialize the trace function to 0 -void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg; - -nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO; -//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN; - -void nfapi_set_trace_level(nfapi_trace_level_t new_level) -{ - nfapi_trace_level_g = new_level; -} - -void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...) -{ - char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH]; - uint32_t num_chars; - va_list p_args; - struct timeval tv; - pthread_t tid = pthread_self(); - - (void)gettimeofday(&tv, NULL); - - num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid); - - if (num_chars > TRACE_HEADER_LENGTH) - { - printf("trace_dbg: Error, num_chars is too large: %d", num_chars); - return; - } - - va_start(p_args, format); - if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args))) - { - if (level <= NFAPI_TRACE_WARN) - { - printf("%s", trace_buff); - } - printf("%s", trace_buff); - } - va_end(p_args); -} +/* + * Copyright 2017 Cisco Systems, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define MAX_MSG_LENGTH 2096 +#define TRACE_HEADER_LENGTH 44 + +void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...); + +// initialize the trace function to 0 +void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg; + +nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO; +//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN; + +void nfapi_set_trace_level(nfapi_trace_level_t new_level) +{ + nfapi_trace_level_g = new_level; +} + +void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...) +{ + char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH]; + uint32_t num_chars; + va_list p_args; + struct timeval tv; + pthread_t tid = pthread_self(); + + (void)gettimeofday(&tv, NULL); + + num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid); + + if (num_chars > TRACE_HEADER_LENGTH) + { + printf("trace_dbg: Error, num_chars is too large: %u", num_chars); + return; + } + + va_start(p_args, format); + if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args))) + { + if (level <= NFAPI_TRACE_WARN) + { + printf("%s", trace_buff); + } + printf("%s", trace_buff); + } + va_end(p_args); +} diff --git a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp index 1c2f0bef80..4fe5065cea 100644 --- a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp +++ b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp @@ -278,7 +278,7 @@ void *fapi_thread_start(void *ptr) { if(instance->tick == 1000) { if(instance->tx_byte_count > 0) { - printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count); + printf("[FAPI] Tx rate %u bytes/sec\n", instance->tx_byte_count); instance->tx_byte_count = 0; } @@ -319,7 +319,7 @@ void *fapi_thread_start(void *ptr) { millisec = now_ts.tv_nsec / 1e6; if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec) { - printf("*** missing millisec %d %d\n", last_millisec, millisec); + printf("*** missing millisec %u %u\n", last_millisec, millisec); catchup = millisec - last_millisec - 1; } diff --git a/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c index e6960273c7..9c0edb467c 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c @@ -170,6 +170,7 @@ int32_t generate_srs(LTE_DL_FRAME_PARMS *frame_parms, Msc_RS = msrsb * 6; k0 = ( ( (int16_t)(frame_parms->N_RB_UL>>1) - (int16_t)(msrs0>>1) ) * 12 ) + kTC; + AssertFatal(msrsb,"divide by 0"); nb = (4*n_RRC/msrsb)%Nb; for (b=0; b<=Bsrs; b++) { diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index abb5b57e0c..1af59eab87 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -648,18 +648,6 @@ error: * ************************************ */ -int sort_ue_config(const void *a, const void *b) { - const Protocol__FlexUeConfig *fa = a; - const Protocol__FlexUeConfig *fb = b; - - if (fa->rnti < fb->rnti) - return -1; - else if (fa->rnti < fb->rnti) - return 1; - - return 0; -} - int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; Protocol__FlexHeader *header = NULL; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index cdeb23c099..ca74eab0c5 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -1010,7 +1010,7 @@ int get_format0(uint8_t index, uint8_t unpaired, frequency_range_t frequency_range){ - uint16_t format; + uint16_t format=0; if (unpaired) { if (frequency_range==FR1) format = table_6_3_3_2_3_prachConfig_Index[index][0]; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 3f69cfbe74..c948b01726 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -247,7 +247,6 @@ void schedule_control_sib1(module_id_t module_id, gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space)); gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset)); - gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); fill_default_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space); fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset,servingcellconfigcommon); fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 247a7e2c45..90fe651ac1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -654,7 +654,7 @@ int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, int Mod_idP, int UE_i //returns the measured RSRP value (upper limit) int get_measured_rsrp(uint8_t index) { //if index is invalid returning minimum rsrp -140 - if((index >= 0 && index <= 15) || index >= 114) + if(index <= 15 || index >= 114) return MIN_RSRP_VALUE; return L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[index]; diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 368fd78f9e..4682c5989e 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -869,7 +869,6 @@ static void *ru_thread_asynch_rxtx( void *param ) { LOG_I(PHY, "devices ok (ru_thread_asynch_rxtx)\n"); while (!oai_exit) { - if (oai_exit) break; if (ru->state != RU_RUN) { subframe=0; From f5022585d99b5dd7d12a7cabd4f5607554eddb88 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 29 Mar 2021 21:50:06 +0200 Subject: [PATCH 21/66] format astyle only --- openair1/PHY/TOOLS/lte_phy_scope.c | 3 +- openair1/PHY/TOOLS/lte_phy_scope_tm4.c | 1002 +++++++++++++----------- openair1/PHY/TOOLS/nr_phy_scope.c | 3 +- 3 files changed, 542 insertions(+), 466 deletions(-) diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c index acd22bc78d..c18fbe4a3a 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.c +++ b/openair1/PHY/TOOLS/lte_phy_scope.c @@ -184,8 +184,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, chest_f_abs = (float *) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); llr = (float *) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero bit = malloc(coded_bits_per_codeword*sizeof(float)); - - rxsig_t = (int16_t**) phy_vars_enb->RU_list[0]->common.rxdata; + rxsig_t = (int16_t **) phy_vars_enb->RU_list[0]->common.rxdata; chest_t = (int16_t **) phy_vars_enb->srs_vars[UE_id].srs_ch_estimates; chest_f = (int16_t **) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates; pusch_llr = (int16_t *) phy_vars_enb->pusch_vars[UE_id]->llr; diff --git a/openair1/PHY/TOOLS/lte_phy_scope_tm4.c b/openair1/PHY/TOOLS/lte_phy_scope_tm4.c index d44f8e325b..a9caf8713b 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope_tm4.c +++ b/openair1/PHY/TOOLS/lte_phy_scope_tm4.c @@ -32,8 +32,7 @@ float tput_time_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; float tput_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; float tput_ue_max[NUMBER_OF_UE_MAX] = {0}; -static void ia_receiver_on_off( FL_OBJECT *button, long arg) -{ +static void ia_receiver_on_off( FL_OBJECT *button, long arg) { if (fl_get_button(button)) { fl_set_object_label(button, "IA Receiver ON"); // PHY_vars_UE_g[0][0]->use_ia_receiver = 1; @@ -45,8 +44,7 @@ static void ia_receiver_on_off( FL_OBJECT *button, long arg) } } -static void dl_traffic_on_off( FL_OBJECT *button, long arg) -{ +static void dl_traffic_on_off( FL_OBJECT *button, long arg) { if (fl_get_button(button)) { fl_set_object_label(button, "DL Traffic ON"); otg_enabled = 1; @@ -58,9 +56,7 @@ static void dl_traffic_on_off( FL_OBJECT *button, long arg) } } -static void sic_receiver_on_off( FL_OBJECT *button, long arg) -{ - +static void sic_receiver_on_off( FL_OBJECT *button, long arg) { if (fl_get_button(button)) { fl_set_object_label(button, "SIC Receiver ON"); use_sic_receiver = 1; @@ -72,8 +68,7 @@ static void sic_receiver_on_off( FL_OBJECT *button, long arg) } } -FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) -{ +FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) { FL_OBJECT *obj; FD_lte_phy_scope_enb *fdui = fl_malloc( sizeof *fdui ); // Define form @@ -145,8 +140,7 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) void phy_scope_eNB(FD_lte_phy_scope_enb *form, PHY_VARS_eNB *phy_vars_enb, - int UE_id) -{ + int UE_id) { int eNB_id = 0; int i,i2,arx,atx,ind,k; LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_enb->frame_parms; @@ -176,24 +170,27 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, int coded_bits_per_codeword = 0; uint8_t harq_pid; // in TDD config 3 it is sf-2, i.e., can be 0,1,2 int mcs = 0; + // choose max MCS to compute coded_bits_per_codeword if (phy_vars_enb->ulsch[UE_id]!=NULL) { for (harq_pid=0; harq_pid<3; harq_pid++) { mcs = cmax(phy_vars_enb->ulsch[UE_id]->harq_processes[harq_pid]->mcs,mcs); } } + coded_bits_per_codeword = frame_parms->N_RB_UL*12*get_Qm(mcs)*frame_parms->symbols_per_tti; - chest_f_abs = (float*) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); - llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero + chest_f_abs = (float *) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); + llr = (float *) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero bit = malloc(coded_bits_per_codeword*sizeof(float)); - rxsig_t = (int16_t**) phy_vars_enb->common_vars.rxdata[eNB_id]; - chest_t = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id]; - chest_f = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates[eNB_id]; - pusch_llr = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->llr; - pusch_comp = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[eNB_id][0]; - pucch1_comp = (int32_t*) phy_vars_enb->pucch1_stats[UE_id]; - pucch1_thres = (int32_t*) phy_vars_enb->pucch1_stats_thres[UE_id]; - pucch1ab_comp = (int32_t*) phy_vars_enb->pucch1ab_stats[UE_id]; + rxsig_t = (int16_t **) phy_vars_enb->common_vars.rxdata[eNB_id]; + chest_t = (int16_t **) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id]; + chest_f = (int16_t **) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates[eNB_id]; + pusch_llr = (int16_t *) phy_vars_enb->pusch_vars[UE_id]->llr; + pusch_comp = (int16_t *) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[eNB_id][0]; + pucch1_comp = (int32_t *) phy_vars_enb->pucch1_stats[UE_id]; + pucch1_thres = (int32_t *) phy_vars_enb->pucch1_stats_thres[UE_id]; + pucch1ab_comp = (int32_t *) phy_vars_enb->pucch1ab_stats[UE_id]; + // Received signal in time domain of receive antenna 0 if (rxsig_t != NULL) { if (rxsig_t[0] != NULL) { @@ -201,48 +198,61 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, rxsig_t_dB[0][i] = 10*log10(1.0+(float) ((rxsig_t[0][2*i])*(rxsig_t[0][2*i])+(rxsig_t[0][2*i+1])*(rxsig_t[0][2*i+1]))); time[i] = (float) i; } + fl_set_xyplot_data(form->rxsig_t,time,rxsig_t_dB[0],FRAME_LENGTH_COMPLEX_SAMPLES,"","",""); } + for (arx=1; arxrxsig_t,arx,time,rxsig_t_dB[arx],FRAME_LENGTH_COMPLEX_SAMPLES,rx_antenna_colors[arx]); } } } + // Channel Impulse Response if (chest_t != NULL) { ymax = 0; + if (chest_t[0] !=NULL) { for (i=0; i<(frame_parms->ofdm_symbol_size); i++) { - i2 = (i+(frame_parms->ofdm_symbol_size>>1))%frame_parms->ofdm_symbol_size; - time2[i] = (float)(i-(frame_parms->ofdm_symbol_size>>1)); + i2 = (i+(frame_parms->ofdm_symbol_size>>1))%frame_parms->ofdm_symbol_size; + time2[i] = (float)(i-(frame_parms->ofdm_symbol_size>>1)); chest_t_abs[0][i] = 10*log10((float) (1+chest_t[0][2*i2]*chest_t[0][2*i2]+chest_t[0][2*i2+1]*chest_t[0][2*i2+1])); + if (chest_t_abs[0][i] > ymax) ymax = chest_t_abs[0][i]; } + fl_set_xyplot_data(form->chest_t,time2,chest_t_abs[0],(frame_parms->ofdm_symbol_size),"","",""); } + for (arx=1; arxofdm_symbol_size>>3); i++) { chest_t_abs[arx][i] = 10*log10((float) (1+chest_t[arx][2*i]*chest_t[arx][2*i]+chest_t[arx][2*i+1]*chest_t[arx][2*i+1])); + if (chest_t_abs[arx][i] > ymax) ymax = chest_t_abs[arx][i]; } + fl_add_xyplot_overlay(form->chest_t,arx,time,chest_t_abs[arx],(frame_parms->ofdm_symbol_size>>3),rx_antenna_colors[arx]); fl_set_xyplot_overlay_type(form->chest_t,arx,FL_DASHED_XYPLOT); } } + // Avoid flickering effect // fl_get_xyplot_ybounds(form->chest_t,&ymin,&ymax); fl_set_xyplot_ybounds(form->chest_t,0,ymax); } + // Channel Frequency Response if (chest_f != NULL) { ind = 0; + for (atx=0; atxchest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce); fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,3); fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,nsymb_ce,"","",""); + for (arx=1; arxchest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); } + // other tx antennas if (nb_antennas_tx > 1) { if (nb_antennas_rx > 1) { @@ -279,17 +292,21 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, } } } + // PUSCH LLRs if (pusch_llr != NULL) { for (i=0; ipusch_llr,bit,llr,coded_bits_per_codeword,"","",""); } + // PUSCH I/Q of MF Output if (pusch_comp!=NULL) { ind=0; + for (k=0; ksymbols_per_tti; k++) { for (i=0; i<12*frame_parms->N_RB_UL; i++) { I[ind] = pusch_comp[(2*frame_parms->N_RB_UL*12*k)+2*i]; @@ -297,8 +314,10 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, ind++; } } + fl_set_xyplot_data(form->pusch_comp,I,Q,ind,"","",""); } + // PUSCH I/Q of MF Output if (pucch1ab_comp!=NULL) { for (ind=0; ind<10240; ind++) { @@ -308,6 +327,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, B_pucch[ind] = ind; C_pucch[ind] = (float)pucch1_thres[ind]; } + fl_set_xyplot_data(form->pucch_comp,I_pucch,Q_pucch,10240,"","",""); fl_set_xyplot_data(form->pucch_comp1,B_pucch,A_pucch,1024,"","",""); fl_add_xyplot_overlay(form->pucch_comp1,1,B_pucch,C_pucch,1024,FL_RED); @@ -315,6 +335,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, fl_set_xyplot_xbounds(form->pucch_comp,-5000,5000); fl_set_xyplot_ybounds(form->pucch_comp1,0,80); } + // PUSCH Throughput memmove( tput_time_enb[UE_id], &tput_time_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) ); memmove( tput_enb[UE_id], &tput_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) ); @@ -329,509 +350,564 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, free(chest_f_abs); } -FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void ) -{ - FL_OBJECT *obj; - FD_lte_phy_scope_ue *fdui = fl_malloc( sizeof *fdui ); - // Define form - fdui->lte_phy_scope_ue = fl_bgn_form( FL_NO_BOX, 800, 1000 ); - // This the whole UI box - obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 1000, "" ); - fl_set_object_color( obj, FL_BLACK, FL_BLACK ); - // Received signal - fdui->rxsig_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 20, 370, 100, "Received Signal (Time-Domain, dB)" ); - fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED ); - fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color - fl_set_xyplot_ybounds(fdui->rxsig_t,30,70); - // Time-domain channel response - fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" ); - fl_set_object_boxtype( fdui->chest_t, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->chest_t, FL_BLACK, FL_RED ); - fl_set_object_lcolor( fdui->chest_t, FL_WHITE ); // Label color - // Frequency-domain channel response - fdui->chest_f = fl_add_xyplot( FL_IMPULSE_XYPLOT, 20, 140, 760, 100, "Channel Frequency Response (RE, dB)" ); - fl_set_object_boxtype( fdui->chest_f, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->chest_f, FL_BLACK, FL_RED ); - fl_set_object_lcolor( fdui->chest_f, FL_WHITE ); // Label color - fl_set_xyplot_ybounds( fdui->chest_f,30,70); - /* - // LLR of PBCH - fdui->pbch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 260, 500, 100, "PBCH Log-Likelihood Ratios (LLR, mag)" ); - fl_set_object_boxtype( fdui->pbch_llr, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pbch_llr, FL_BLACK, FL_GREEN ); - fl_set_object_lcolor( fdui->pbch_llr, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pbch_llr,2); - fl_set_xyplot_xgrid( fdui->pbch_llr,FL_GRID_MAJOR); - fl_set_xyplot_xbounds( fdui->pbch_llr,0,1920); - // I/Q PBCH comp - fdui->pbch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 260, 240, 100, "PBCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pbch_comp, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pbch_comp, FL_BLACK, FL_GREEN ); - fl_set_object_lcolor( fdui->pbch_comp, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pbch_comp,2); - fl_set_xyplot_xbounds( fdui->pbch_comp,-100,100); - fl_set_xyplot_ybounds( fdui->pbch_comp,-100,100); - // LLR of PDCCH - fdui->pdcch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 380, 500, 100, "PDCCH Log-Likelihood Ratios (LLR, mag)" ); - fl_set_object_boxtype( fdui->pdcch_llr, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdcch_llr, FL_BLACK, FL_CYAN ); - fl_set_object_lcolor( fdui->pdcch_llr, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdcch_llr,2); - // I/Q PDCCH comp - fdui->pdcch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 380, 240, 100, "PDCCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pdcch_comp, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdcch_comp, FL_BLACK, FL_CYAN ); - fl_set_object_lcolor( fdui->pdcch_comp, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdcch_comp,2); - fl_set_xyplot_xgrid( fdui->pdcch_llr,FL_GRID_MAJOR); - */ - int offset=240; - // LLR of PDSCH - fdui->pdsch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 500-offset, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)" ); - fl_set_object_boxtype( fdui->pdsch_llr, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_llr, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pdsch_llr, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdsch_llr,2); - fl_set_xyplot_xgrid( fdui->pdsch_llr,FL_GRID_MAJOR); - // I/Q PDSCH comp - fdui->pdsch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 500-offset, 240, 200, "PDSCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pdsch_comp, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_comp, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pdsch_comp, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdsch_comp,2); - // LLR of PDSCH - fdui->pdsch_llr1 = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 720-offset, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)" ); - fl_set_object_boxtype( fdui->pdsch_llr1, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_llr1, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pdsch_llr1, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdsch_llr1,2); - fl_set_xyplot_xgrid( fdui->pdsch_llr1,FL_GRID_MAJOR); - // I/Q PDSCH comp - fdui->pdsch_comp1 = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 720-offset, 240, 200, "PDSCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pdsch_comp1, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_comp1, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pdsch_comp1, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdsch_comp1,2); - /* - // Throughput on PDSCH - fdui->pdsch_tput = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 720, 500, 100, "PDSCH Throughput [frame]/[kbit/s]" ); - fl_set_object_boxtype( fdui->pdsch_tput, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_tput, FL_BLACK, FL_WHITE ); - fl_set_object_lcolor( fdui->pdsch_tput, FL_WHITE ); // Label color - */ - // Generic UE Button - fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 540, 720, 240, 40, "" ); - fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER ); - //use_sic_receiver = 0; - fl_set_button(fdui->button_0,0); - fl_set_object_label(fdui->button_0, "SIC Receiver OFF"); - fl_set_object_color(fdui->button_0, FL_RED, FL_RED); - fl_set_object_callback(fdui->button_0, sic_receiver_on_off, 0 ); - fl_hide_object(fdui->button_0); - - fl_end_form( ); - fdui->lte_phy_scope_ue->fdui = fdui; - return fdui; +FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void ) { + FL_OBJECT *obj; + FD_lte_phy_scope_ue *fdui = fl_malloc( sizeof *fdui ); + // Define form + fdui->lte_phy_scope_ue = fl_bgn_form( FL_NO_BOX, 800, 1000 ); + // This the whole UI box + obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 1000, "" ); + fl_set_object_color( obj, FL_BLACK, FL_BLACK ); + // Received signal + fdui->rxsig_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 20, 370, 100, "Received Signal (Time-Domain, dB)" ); + fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED ); + fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color + fl_set_xyplot_ybounds(fdui->rxsig_t,30,70); + // Time-domain channel response + fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" ); + fl_set_object_boxtype( fdui->chest_t, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->chest_t, FL_BLACK, FL_RED ); + fl_set_object_lcolor( fdui->chest_t, FL_WHITE ); // Label color + // Frequency-domain channel response + fdui->chest_f = fl_add_xyplot( FL_IMPULSE_XYPLOT, 20, 140, 760, 100, "Channel Frequency Response (RE, dB)" ); + fl_set_object_boxtype( fdui->chest_f, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->chest_f, FL_BLACK, FL_RED ); + fl_set_object_lcolor( fdui->chest_f, FL_WHITE ); // Label color + fl_set_xyplot_ybounds( fdui->chest_f,30,70); + /* + // LLR of PBCH + fdui->pbch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 260, 500, 100, "PBCH Log-Likelihood Ratios (LLR, mag)" ); + fl_set_object_boxtype( fdui->pbch_llr, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pbch_llr, FL_BLACK, FL_GREEN ); + fl_set_object_lcolor( fdui->pbch_llr, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pbch_llr,2); + fl_set_xyplot_xgrid( fdui->pbch_llr,FL_GRID_MAJOR); + fl_set_xyplot_xbounds( fdui->pbch_llr,0,1920); + // I/Q PBCH comp + fdui->pbch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 260, 240, 100, "PBCH I/Q of MF Output" ); + fl_set_object_boxtype( fdui->pbch_comp, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pbch_comp, FL_BLACK, FL_GREEN ); + fl_set_object_lcolor( fdui->pbch_comp, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pbch_comp,2); + fl_set_xyplot_xbounds( fdui->pbch_comp,-100,100); + fl_set_xyplot_ybounds( fdui->pbch_comp,-100,100); + // LLR of PDCCH + fdui->pdcch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 380, 500, 100, "PDCCH Log-Likelihood Ratios (LLR, mag)" ); + fl_set_object_boxtype( fdui->pdcch_llr, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdcch_llr, FL_BLACK, FL_CYAN ); + fl_set_object_lcolor( fdui->pdcch_llr, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdcch_llr,2); + // I/Q PDCCH comp + fdui->pdcch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 380, 240, 100, "PDCCH I/Q of MF Output" ); + fl_set_object_boxtype( fdui->pdcch_comp, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdcch_comp, FL_BLACK, FL_CYAN ); + fl_set_object_lcolor( fdui->pdcch_comp, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdcch_comp,2); + fl_set_xyplot_xgrid( fdui->pdcch_llr,FL_GRID_MAJOR); + */ + int offset=240; + // LLR of PDSCH + fdui->pdsch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 500-offset, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)" ); + fl_set_object_boxtype( fdui->pdsch_llr, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdsch_llr, FL_BLACK, FL_YELLOW ); + fl_set_object_lcolor( fdui->pdsch_llr, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdsch_llr,2); + fl_set_xyplot_xgrid( fdui->pdsch_llr,FL_GRID_MAJOR); + // I/Q PDSCH comp + fdui->pdsch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 500-offset, 240, 200, "PDSCH I/Q of MF Output" ); + fl_set_object_boxtype( fdui->pdsch_comp, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdsch_comp, FL_BLACK, FL_YELLOW ); + fl_set_object_lcolor( fdui->pdsch_comp, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdsch_comp,2); + // LLR of PDSCH + fdui->pdsch_llr1 = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 720-offset, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)" ); + fl_set_object_boxtype( fdui->pdsch_llr1, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdsch_llr1, FL_BLACK, FL_YELLOW ); + fl_set_object_lcolor( fdui->pdsch_llr1, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdsch_llr1,2); + fl_set_xyplot_xgrid( fdui->pdsch_llr1,FL_GRID_MAJOR); + // I/Q PDSCH comp + fdui->pdsch_comp1 = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 720-offset, 240, 200, "PDSCH I/Q of MF Output" ); + fl_set_object_boxtype( fdui->pdsch_comp1, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdsch_comp1, FL_BLACK, FL_YELLOW ); + fl_set_object_lcolor( fdui->pdsch_comp1, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdsch_comp1,2); + /* + // Throughput on PDSCH + fdui->pdsch_tput = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 720, 500, 100, "PDSCH Throughput [frame]/[kbit/s]" ); + fl_set_object_boxtype( fdui->pdsch_tput, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdsch_tput, FL_BLACK, FL_WHITE ); + fl_set_object_lcolor( fdui->pdsch_tput, FL_WHITE ); // Label color + */ + // Generic UE Button + fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 540, 720, 240, 40, "" ); + fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER ); + //use_sic_receiver = 0; + fl_set_button(fdui->button_0,0); + fl_set_object_label(fdui->button_0, "SIC Receiver OFF"); + fl_set_object_color(fdui->button_0, FL_RED, FL_RED); + fl_set_object_callback(fdui->button_0, sic_receiver_on_off, 0 ); + fl_hide_object(fdui->button_0); + fl_end_form( ); + fdui->lte_phy_scope_ue->fdui = fdui; + return fdui; } void phy_scope_UE(FD_lte_phy_scope_ue *form, PHY_VARS_UE *phy_vars_ue, int eNB_id, int UE_id, - uint8_t subframe) -{ - int i,arx,atx,ind,k; - LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; - int nsymb_ce = frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti; - uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; - uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_eNB; - int16_t **rxsig_t; - int16_t **chest_t; - int16_t **chest_f; - int16_t *pdsch_llr,*pdsch_llr1; - int16_t *pdsch_comp,*pdsch_comp1; - int16_t *pdsch_mag0,*pdsch_mag1,*pdsch_magb0,*pdsch_magb1; - int8_t *pdcch_llr; - int16_t *pdcch_comp; - int8_t *pbch_llr; - int16_t *pbch_comp; - float Re,Im,ymax=1; - int num_pdcch_symbols=3; - float *llr0, *bit0, *llr1, *bit1, *chest_f_abs, llr_pbch[1920], bit_pbch[1920], *llr_pdcch, *bit_pdcch; - float *I, *Q; - float rxsig_t_dB[nb_antennas_rx][FRAME_LENGTH_COMPLEX_SAMPLES]; - float **chest_t_abs; - float time[FRAME_LENGTH_COMPLEX_SAMPLES]; - float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx]; - int frame = phy_vars_ue->proc.proc_rxtx[0].frame_rx; - uint32_t total_dlsch_bitrate = phy_vars_ue->bitrate[eNB_id]; - int coded_bits_per_codeword0=0,coded_bits_per_codeword1=1; - int mod0,mod1; - int mcs0 = 0; - int mcs1=0; - unsigned char harq_pid = 0; - int beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]>6 ? phy_vars_ue->transmission_mode[eNB_id] : 0; - if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) { - harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->current_harq_pid; - if (harq_pid>=8) - return; - mcs0 = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->mcs; - // Button 0 - /* - if(!phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->dl_power_off) { - // we are in TM5 - fl_show_object(form->button_0); - } - */ - } - fl_show_object(form->button_0); - if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]!=NULL) { - harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->current_harq_pid; - if (harq_pid>=8) - return; - mcs1 = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->mcs; - } - if (phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]!=NULL) { - num_pdcch_symbols = phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->num_pdcch_symbols; - } - // coded_bits_per_codeword = frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); - if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) { - mod0 = get_Qm(mcs0); - coded_bits_per_codeword0 = get_G(frame_parms, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->nb_rb, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->rb_alloc_even, - get_Qm(mcs0), - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Nl, - num_pdcch_symbols, - frame, - subframe, - beamforming_mode); - } else { - coded_bits_per_codeword0 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); - mod0=0; - } - if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]!=NULL) { - mod1 = get_Qm(mcs1); - coded_bits_per_codeword1 = get_G(frame_parms, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->nb_rb, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->rb_alloc_even, - get_Qm(mcs1), - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->Nl, - num_pdcch_symbols, - frame, - subframe, - beamforming_mode); - } else { - coded_bits_per_codeword1 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); - mod1=0; - } - I = (float*) calloc(nsymb_ce*2,sizeof(float)); - Q = (float*) calloc(nsymb_ce*2,sizeof(float)); - chest_t_abs = (float**) malloc(nb_antennas_rx*sizeof(float*)); - for (arx=0;arxofdm_symbol_size,sizeof(float)); - } - chest_f_abs = (float*) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); - //llr0 = (float*) calloc(coded_bits_per_codeword0,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error. - llr0 = (float*) malloc(coded_bits_per_codeword0*sizeof(float)); - memset((void *)llr0, 0,coded_bits_per_codeword0*sizeof(float)); // init to zero - bit0 = malloc(coded_bits_per_codeword0*sizeof(float)); + uint8_t subframe) { + int i,arx,atx,ind,k; + LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; + int nsymb_ce = frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti; + uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; + uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_eNB; + int16_t **rxsig_t; + int16_t **chest_t; + int16_t **chest_f; + int16_t *pdsch_llr,*pdsch_llr1; + int16_t *pdsch_comp,*pdsch_comp1; + int16_t *pdsch_mag0,*pdsch_mag1,*pdsch_magb0,*pdsch_magb1; + int8_t *pdcch_llr; + int16_t *pdcch_comp; + int8_t *pbch_llr; + int16_t *pbch_comp; + float Re,Im,ymax=1; + int num_pdcch_symbols=3; + float *llr0, *bit0, *llr1, *bit1, *chest_f_abs, llr_pbch[1920], bit_pbch[1920], *llr_pdcch, *bit_pdcch; + float *I, *Q; + float rxsig_t_dB[nb_antennas_rx][FRAME_LENGTH_COMPLEX_SAMPLES]; + float **chest_t_abs; + float time[FRAME_LENGTH_COMPLEX_SAMPLES]; + float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx]; + int frame = phy_vars_ue->proc.proc_rxtx[0].frame_rx; + uint32_t total_dlsch_bitrate = phy_vars_ue->bitrate[eNB_id]; + int coded_bits_per_codeword0=0,coded_bits_per_codeword1=1; + int mod0,mod1; + int mcs0 = 0; + int mcs1=0; + unsigned char harq_pid = 0; + int beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]>6 ? phy_vars_ue->transmission_mode[eNB_id] : 0; - //llr1 = (float*) calloc(coded_bits_per_codeword1,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error. - llr1 = (float*) malloc(coded_bits_per_codeword1*sizeof(float)); - memset((void *)llr1, 0,coded_bits_per_codeword1*sizeof(float)); // init to zero - bit1 = malloc(coded_bits_per_codeword1*sizeof(float)); - llr_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); // init to zero - bit_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); - rxsig_t = (int16_t**) phy_vars_ue->common_vars.rxdata; - chest_t = (int16_t**) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id]; - chest_f = (int16_t**) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id]; - pbch_llr = (int8_t*) phy_vars_ue->pbch_vars[eNB_id]->llr; - pbch_comp = (int16_t*) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0]; - pdcch_llr = (int8_t*) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr; - pdcch_comp = (int16_t*) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp[0]; - pdsch_llr = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[0]; // stream 0 - pdsch_llr1 = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[1]; // stream 1 - pdsch_comp = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0]; - //pdsch_comp = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[0]; - //pdsch_comp1 = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[1]; - pdsch_comp1 = (int16_t*) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp1[0][0])[0]; - //pdsch_comp1 = (int16_t*) (phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[0][0])[0]; - pdsch_mag0 = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0]; - pdsch_mag1 = (int16_t*) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag1[0][0])[0]; - pdsch_magb0 = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb0[0]; - pdsch_magb1 = (int16_t*) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb1[0][0])[0]; - fl_freeze_form(form->lte_phy_scope_ue); - // Received signal in time domain of receive antenna 0 - if (rxsig_t != NULL) { - if (rxsig_t[0] != NULL) { - for (i=0; irxsig_t,time,rxsig_t_dB[0],FRAME_LENGTH_COMPLEX_SAMPLES,"","",""); - } - for (arx=1;arxrxsig_t,arx,time,rxsig_t_dB[arx],FRAME_LENGTH_COMPLEX_SAMPLES,rx_antenna_colors[arx]); - } - } + if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) { + harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->current_harq_pid; + + if (harq_pid>=8) + return; + + mcs0 = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->mcs; + // Button 0 + /* + if(!phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->dl_power_off) { + // we are in TM5 + fl_show_object(form->button_0); + } + */ + } + + fl_show_object(form->button_0); + + if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]!=NULL) { + harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->current_harq_pid; + + if (harq_pid>=8) + return; + + mcs1 = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->mcs; + } + + if (phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]!=NULL) { + num_pdcch_symbols = phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->num_pdcch_symbols; + } + + // coded_bits_per_codeword = frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); + if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) { + mod0 = get_Qm(mcs0); + coded_bits_per_codeword0 = get_G(frame_parms, + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->nb_rb, + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->rb_alloc_even, + get_Qm(mcs0), + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Nl, + num_pdcch_symbols, + frame, + subframe, + beamforming_mode); + } else { + coded_bits_per_codeword0 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); + mod0=0; + } + + if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]!=NULL) { + mod1 = get_Qm(mcs1); + coded_bits_per_codeword1 = get_G(frame_parms, + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->nb_rb, + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->rb_alloc_even, + get_Qm(mcs1), + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->Nl, + num_pdcch_symbols, + frame, + subframe, + beamforming_mode); + } else { + coded_bits_per_codeword1 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); + mod1=0; + } + + I = (float *) calloc(nsymb_ce*2,sizeof(float)); + Q = (float *) calloc(nsymb_ce*2,sizeof(float)); + chest_t_abs = (float **) malloc(nb_antennas_rx*sizeof(float *)); + + for (arx=0; arxofdm_symbol_size,sizeof(float)); + } + + chest_f_abs = (float *) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); + //llr0 = (float*) calloc(coded_bits_per_codeword0,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error. + llr0 = (float *) malloc(coded_bits_per_codeword0*sizeof(float)); + memset((void *)llr0, 0,coded_bits_per_codeword0*sizeof(float)); // init to zero + bit0 = malloc(coded_bits_per_codeword0*sizeof(float)); + //llr1 = (float*) calloc(coded_bits_per_codeword1,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error. + llr1 = (float *) malloc(coded_bits_per_codeword1*sizeof(float)); + memset((void *)llr1, 0,coded_bits_per_codeword1*sizeof(float)); // init to zero + bit1 = malloc(coded_bits_per_codeword1*sizeof(float)); + llr_pdcch = (float *) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); // init to zero + bit_pdcch = (float *) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); + rxsig_t = (int16_t **) phy_vars_ue->common_vars.rxdata; + chest_t = (int16_t **) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id]; + chest_f = (int16_t **) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id]; + pbch_llr = (int8_t *) phy_vars_ue->pbch_vars[eNB_id]->llr; + pbch_comp = (int16_t *) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0]; + pdcch_llr = (int8_t *) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr; + pdcch_comp = (int16_t *) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp[0]; + pdsch_llr = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[0]; // stream 0 + pdsch_llr1 = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[1]; // stream 1 + pdsch_comp = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0]; + //pdsch_comp = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[0]; + //pdsch_comp1 = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[1]; + pdsch_comp1 = (int16_t *) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp1[0][0])[0]; + //pdsch_comp1 = (int16_t*) (phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[0][0])[0]; + pdsch_mag0 = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0]; + pdsch_mag1 = (int16_t *) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag1[0][0])[0]; + pdsch_magb0 = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb0[0]; + pdsch_magb1 = (int16_t *) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb1[0][0])[0]; + fl_freeze_form(form->lte_phy_scope_ue); + + // Received signal in time domain of receive antenna 0 + if (rxsig_t != NULL) { + if (rxsig_t[0] != NULL) { + for (i=0; irxsig_t,time,rxsig_t_dB[0],FRAME_LENGTH_COMPLEX_SAMPLES,"","",""); } + + for (arx=1; arxrxsig_t,arx,time,rxsig_t_dB[arx],FRAME_LENGTH_COMPLEX_SAMPLES,rx_antenna_colors[arx]); + } + } + } + // Channel Impulse Response (still repeated format) if (chest_t != NULL) { ymax = 0; + if (chest_t[0] !=NULL) { for (i=0; i<(frame_parms->ofdm_symbol_size>>3); i++) { chest_t_abs[0][i] = (float) (chest_t[0][4*i]*chest_t[0][4*i]+chest_t[0][4*i+1]*chest_t[0][4*i+1]); + if (chest_t_abs[0][i] > ymax) ymax = chest_t_abs[0][i]; } + fl_set_xyplot_data(form->chest_t,time,chest_t_abs[0],(frame_parms->ofdm_symbol_size>>3),"","",""); } + for (arx=1; arxofdm_symbol_size>>3); i++) { chest_t_abs[arx][i] = (float) (chest_t[arx][4*i]*chest_t[arx][4*i]+chest_t[arx][4*i+1]*chest_t[arx][4*i+1]); + if (chest_t_abs[arx][i] > ymax) ymax = chest_t_abs[arx][i]; } + fl_add_xyplot_overlay(form->chest_t,arx,time,chest_t_abs[arx],(frame_parms->ofdm_symbol_size>>3),rx_antenna_colors[arx]); fl_set_xyplot_overlay_type(form->chest_t,arx,FL_DASHED_XYPLOT); } } - // Avoid flickering effect - // fl_get_xyplot_ybounds(form->chest_t,&ymin,&ymax); - fl_set_xyplot_ybounds(form->chest_t,0,ymax); + + // Avoid flickering effect + // fl_get_xyplot_ybounds(form->chest_t,&ymin,&ymax); + fl_set_xyplot_ybounds(form->chest_t,0,ymax); + } + + // Channel Frequency Response (includes 5 complex sample for filter) + if (chest_f != NULL) { + ind = 0; + + for (atx=0; atxchest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce); - //fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,2); - // fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*2,2); - fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); - fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,nsymb_ce,"","",""); - for (arx=1;arxchest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - // other tx antennas - if (nb_antennas_tx > 1) { - if (nb_antennas_rx > 1) { - for (atx=1;atxchest_f,(atx<<1)+arx,&freq[((atx<<1)+arx)*nsymb_ce],&chest_f_abs[((atx<<1)+arx)*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - } - } else { // 1 rx antenna - atx=1; arx=0; - fl_add_xyplot_overlay(form->chest_f,atx,&freq[atx*nsymb_ce],&chest_f_abs[atx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - } + + // tx antenna 0 + fl_set_xyplot_xbounds(form->chest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce); + //fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,2); + // fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*2,2); + fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); + fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,nsymb_ce,"","",""); + + for (arx=1; arxchest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); } - /* - // PBCH LLRs - if (pbch_llr != NULL) { - for (i=0; i<1920;i++) { - llr_pbch[i] = (float) pbch_llr[i]; - bit_pbch[i] = (float) i; + + // other tx antennas + if (nb_antennas_tx > 1) { + if (nb_antennas_rx > 1) { + for (atx=1; atxchest_f,(atx<<1)+arx,&freq[((atx<<1)+arx)*nsymb_ce],&chest_f_abs[((atx<<1)+arx)*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); + } } - fl_set_xyplot_data(form->pbch_llr,bit_pbch,llr_pbch,1920,"","",""); + } else { // 1 rx antenna + atx=1; + arx=0; + fl_add_xyplot_overlay(form->chest_f,atx,&freq[atx*nsymb_ce],&chest_f_abs[atx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); + } } - // PBCH I/Q of MF Output - if (pbch_comp!=NULL) { - for (i=0; i<72*2; i++) { - I[i] = pbch_comp[2*i]; - Q[i] = pbch_comp[2*i+1]; - } - fl_set_xyplot_data(form->pbch_comp,I,Q,72*2,"","",""); - } - // PDCCH LLRs - if (pdcch_llr != NULL) { - for (i=0; i<12*frame_parms->N_RB_DL*2*num_pdcch_symbols;i++) { - llr_pdcch[i] = (float) pdcch_llr[i]; - bit_pdcch[i] = (float) i; - } - fl_set_xyplot_xbounds(form->pdcch_llr,0,12*frame_parms->N_RB_DL*2*3); - fl_set_xyplot_data(form->pdcch_llr,bit_pdcch,llr_pdcch,12*frame_parms->N_RB_DL*2*num_pdcch_symbols,"","",""); - } - // PDCCH I/Q of MF Output - if (pdcch_comp!=NULL) { - for (i=0; i<12*frame_parms->N_RB_DL*num_pdcch_symbols; i++) { - I[i] = pdcch_comp[2*i]; - Q[i] = pdcch_comp[2*i+1]; - } - fl_set_xyplot_data(form->pdcch_comp,I,Q,12*frame_parms->N_RB_DL*num_pdcch_symbols,"","",""); - } - */ - // PDSCH LLRs CW0 - if (pdsch_llr != NULL) { - for (i=0; ipdsch_llr,0,coded_bits_per_codeword0); - fl_set_xyplot_data(form->pdsch_llr,bit0,llr0,coded_bits_per_codeword0,"","",""); + } + + /* + // PBCH LLRs + if (pbch_llr != NULL) { + for (i=0; i<1920;i++) { + llr_pbch[i] = (float) pbch_llr[i]; + bit_pbch[i] = (float) i; + } + fl_set_xyplot_data(form->pbch_llr,bit_pbch,llr_pbch,1920,"","",""); + } + // PBCH I/Q of MF Output + if (pbch_comp!=NULL) { + for (i=0; i<72*2; i++) { + I[i] = pbch_comp[2*i]; + Q[i] = pbch_comp[2*i+1]; + } + fl_set_xyplot_data(form->pbch_comp,I,Q,72*2,"","",""); + } + // PDCCH LLRs + if (pdcch_llr != NULL) { + for (i=0; i<12*frame_parms->N_RB_DL*2*num_pdcch_symbols;i++) { + llr_pdcch[i] = (float) pdcch_llr[i]; + bit_pdcch[i] = (float) i; + } + fl_set_xyplot_xbounds(form->pdcch_llr,0,12*frame_parms->N_RB_DL*2*3); + fl_set_xyplot_data(form->pdcch_llr,bit_pdcch,llr_pdcch,12*frame_parms->N_RB_DL*2*num_pdcch_symbols,"","",""); + } + // PDCCH I/Q of MF Output + if (pdcch_comp!=NULL) { + for (i=0; i<12*frame_parms->N_RB_DL*num_pdcch_symbols; i++) { + I[i] = pdcch_comp[2*i]; + Q[i] = pdcch_comp[2*i+1]; + } + fl_set_xyplot_data(form->pdcch_comp,I,Q,12*frame_parms->N_RB_DL*num_pdcch_symbols,"","",""); + } + */ + // PDSCH LLRs CW0 + if (pdsch_llr != NULL) { + for (i=0; ipdsch_llr,0,coded_bits_per_codeword0); + fl_set_xyplot_data(form->pdsch_llr,bit0,llr0,coded_bits_per_codeword0,"","",""); + } + // PDSCH I/Q of MF Output - if (pdsch_comp!=NULL) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { - I[ind] = pdsch_comp[(2*frame_parms->N_RB_DL*12*k)+4*i]; - Q[ind] = pdsch_comp[(2*frame_parms->N_RB_DL*12*k)+4*i+1]; - ind++; - } - } - fl_set_xyplot_data(form->pdsch_comp,I,Q,ind,"","",""); + if (pdsch_comp!=NULL) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + I[ind] = pdsch_comp[(2*frame_parms->N_RB_DL*12*k)+4*i]; + Q[ind] = pdsch_comp[(2*frame_parms->N_RB_DL*12*k)+4*i+1]; + ind++; + } } - if (pdsch_mag0 != NULL) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_set_xyplot_data(form->pdsch_comp,I,Q,ind,"","",""); + } + + if (pdsch_mag0 != NULL) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i]*cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i+1]*sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp,1,I,Q,ind,FL_GREEN); + } } - if (pdsch_magb0 != NULL) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_add_xyplot_overlay(form->pdsch_comp,1,I,Q,ind,FL_GREEN); + } + + if (pdsch_magb0 != NULL) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i]*cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i+1]*sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp,2,I,Q,ind,FL_RED); + } } - if ((pdsch_mag0 != NULL) && (pdsch_magb0 != NULL)) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_add_xyplot_overlay(form->pdsch_comp,2,I,Q,ind,FL_RED); + } + + if ((pdsch_mag0 != NULL) && (pdsch_magb0 != NULL)) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = - (pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i]+ - pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i])* - cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); + (pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i]+ + pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i])* + cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = - (pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i+1]+ - pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i+1])* - sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); + (pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i+1]+ + pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i+1])* + sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp,3,I,Q,ind,FL_BLUE); + } } - // PDSCH LLRs CW1 - if (pdsch_llr1 != NULL) { - for (i=0; ipdsch_llr1,0,coded_bits_per_codeword1); - fl_set_xyplot_data(form->pdsch_llr1,bit1,llr1,coded_bits_per_codeword1,"","",""); + + fl_add_xyplot_overlay(form->pdsch_comp,3,I,Q,ind,FL_BLUE); + } + + // PDSCH LLRs CW1 + if (pdsch_llr1 != NULL) { + for (i=0; isymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { - I[ind] = pdsch_comp1[(2*frame_parms->N_RB_DL*12*k)+4*i]; - Q[ind] = pdsch_comp1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]; - ind++; - } - } - fl_set_xyplot_data(form->pdsch_comp1,I,Q,ind,"","",""); + + fl_set_xyplot_xbounds(form->pdsch_llr1,0,coded_bits_per_codeword1); + fl_set_xyplot_data(form->pdsch_llr1,bit1,llr1,coded_bits_per_codeword1,"","",""); + } + + // PDSCH I/Q of MF Output + if (pdsch_comp1!=NULL) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + I[ind] = pdsch_comp1[(2*frame_parms->N_RB_DL*12*k)+4*i]; + Q[ind] = pdsch_comp1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]; + ind++; + } } - if (pdsch_mag1 != NULL) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_set_xyplot_data(form->pdsch_comp1,I,Q,ind,"","",""); + } + + if (pdsch_mag1 != NULL) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i]*cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]*sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp1,1,I,Q,ind,FL_GREEN); + } } - if (pdsch_magb1 != NULL) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_add_xyplot_overlay(form->pdsch_comp1,1,I,Q,ind,FL_GREEN); + } + + if (pdsch_magb1 != NULL) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i]*cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]*sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp1,2,I,Q,ind,FL_RED); + } } - if ((pdsch_mag1 != NULL) && (pdsch_magb1 != NULL)) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_add_xyplot_overlay(form->pdsch_comp1,2,I,Q,ind,FL_RED); + } + + if ((pdsch_mag1 != NULL) && (pdsch_magb1 != NULL)) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = - (pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i]+ - pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i])* - cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); + (pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i]+ + pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i])* + cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = - (pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]+ - pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i+1])* - sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); + (pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]+ + pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i+1])* + sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp1,3,I,Q,ind,FL_BLUE); + } } - /* - // PDSCH Throughput - memcpy((void*)tput_time_ue[UE_id],(void*)&tput_time_ue[UE_id][1],(TPUT_WINDOW_LENGTH-1)*sizeof(float)); - memcpy((void*)tput_ue[UE_id],(void*)&tput_ue[UE_id][1],(TPUT_WINDOW_LENGTH-1)*sizeof(float)); - tput_time_ue[UE_id][TPUT_WINDOW_LENGTH-1] = (float) frame; - tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0; - if (tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] > tput_ue_max[UE_id]) { - tput_ue_max[UE_id] = tput_ue[UE_id][TPUT_WINDOW_LENGTH-1]; - } - fl_set_xyplot_data(form->pdsch_tput,tput_time_ue[UE_id],tput_ue[UE_id],TPUT_WINDOW_LENGTH,"","",""); - fl_set_xyplot_ybounds(form->pdsch_tput,0,tput_ue_max[UE_id]); - */ - fl_unfreeze_form(form->lte_phy_scope_ue); - fl_check_forms(); - free(I); - free(Q); - free(chest_f_abs); - free(llr0); - free(bit0); - free(llr1); - free(bit1); - free(bit_pdcch); - free(llr_pdcch); - //This is done to avoid plotting old data when TB0 is disabled, and TB1 is mapped onto CW0 - /*if (phy_vars_ue->transmission_mode[eNB_id]==3 && phy_vars_ue->transmission_mode[eNB_id]==4){ - for (int i = 0; i<8; ++i) - for (int j = 0; j < 7*2*frame_parms->N_RB_DL*12+4; ++j ) - phy_vars_ue->pdsch_vars[subframe&0x1][eNB_id]->rxdataF_comp1[0][0][i][j]=0; + fl_add_xyplot_overlay(form->pdsch_comp1,3,I,Q,ind,FL_BLUE); + } - for (int m=0; mpdsch_vars[subframe&0x1][eNB_id]->llr[0][m]=0; - }*/ + /* + // PDSCH Throughput + memcpy((void*)tput_time_ue[UE_id],(void*)&tput_time_ue[UE_id][1],(TPUT_WINDOW_LENGTH-1)*sizeof(float)); + memcpy((void*)tput_ue[UE_id],(void*)&tput_ue[UE_id][1],(TPUT_WINDOW_LENGTH-1)*sizeof(float)); + tput_time_ue[UE_id][TPUT_WINDOW_LENGTH-1] = (float) frame; + tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0; + if (tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] > tput_ue_max[UE_id]) { + tput_ue_max[UE_id] = tput_ue[UE_id][TPUT_WINDOW_LENGTH-1]; + } + fl_set_xyplot_data(form->pdsch_tput,tput_time_ue[UE_id],tput_ue[UE_id],TPUT_WINDOW_LENGTH,"","",""); + fl_set_xyplot_ybounds(form->pdsch_tput,0,tput_ue_max[UE_id]); + */ + fl_unfreeze_form(form->lte_phy_scope_ue); + fl_check_forms(); + free(I); + free(Q); + free(chest_f_abs); + free(llr0); + free(bit0); + free(llr1); + free(bit1); + free(bit_pdcch); + free(llr_pdcch); + //This is done to avoid plotting old data when TB0 is disabled, and TB1 is mapped onto CW0 + /*if (phy_vars_ue->transmission_mode[eNB_id]==3 && phy_vars_ue->transmission_mode[eNB_id]==4){ + for (int i = 0; i<8; ++i) + for (int j = 0; j < 7*2*frame_parms->N_RB_DL*12+4; ++j ) + phy_vars_ue->pdsch_vars[subframe&0x1][eNB_id]->rxdataF_comp1[0][0][i][j]=0; + + for (int m=0; mpdsch_vars[subframe&0x1][eNB_id]->llr[0][m]=0; + }*/ } diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index b3132101dc..176404f26c 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -226,7 +226,8 @@ static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int laye static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize, const int divisions, const char *label) { if ( values == NULL ) - return; + return; + fl_winset(FL_ObjWin(graph->graph)); const int samplesPerPixel=datasize/graph->w; int displayPart=graph->waterFallh-ScaleZone; From 58d372d3a2773b3cdd7d75462fab90a291f93ecb Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 31 Mar 2021 10:01:11 +0200 Subject: [PATCH 22/66] one cppcheck, merge develop --- openair1/PHY/TOOLS/nr_phy_scope.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index 176404f26c..1d6a279c91 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -243,7 +243,7 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in for (int pix=0; pixw; pix++) { scopeSample_t *end=values+(pix+1)*samplesPerPixel; end-=2; - AssertFatal(end <= values+datasize,"diff : %lu", end-values+datasize); + AssertFatal(end <= values+datasize,"diff : %u", end-values+datasize); double val=0; for (scopeSample_t *s=values+(pix)*samplesPerPixel; From 55315b8fae1b786888764e93ac54c2e225e26eb3 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 1 Apr 2021 21:43:47 +0200 Subject: [PATCH 23/66] revert removal of a dirty workaround --- openair1/SIMULATION/TOOLS/random_channel.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c index 9e4170fc7c..4e26d9a954 100644 --- a/openair1/SIMULATION/TOOLS/random_channel.c +++ b/openair1/SIMULATION/TOOLS/random_channel.c @@ -1683,8 +1683,7 @@ channel_desc_t *find_channel_desc_fromname( char *modelname ) { void free_channel_desc_scm(channel_desc_t *ch) { // Must be made cleanly, a lot of leaks... - defined_channels[ch->chan_idx]=NULL; - + if (max_chan != 0) defined_channels[ch->chan_idx]=NULL; if(ch->free_flags&CHANMODEL_FREE_AMPS) free(ch->amps); From 0317d6725bc3fac2a299f9df65162cc67e53fb60 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 2 Apr 2021 10:12:13 +0200 Subject: [PATCH 24/66] sanitize, calibration tool kickoff --- cmake_targets/CMakeLists.txt | 12 + cmake_targets/tools/run_enb_s1_usrp | 13 - common/utils/system.c | 26 +- common/utils/system.h | 8 +- executables/nr-softmodem.c | 1 - executables/nr-softmodem.h | 4 - executables/ocp-gnb.c | 3 - openair1/PHY/TOOLS/calibration_scope.c | 387 +++++++++++++++++++++++++ openair1/PHY/TOOLS/calibration_scope.h | 5 + openair1/PHY/TOOLS/calibration_test.c | 329 +++++++++++++++++++++ openair2/GNB_APP/gnb_paramdef.h | 10 +- openair2/SIMULATION/NR_RRC/itti_sim.c | 3 - openair2/UTIL/OCG/OCG.h | 1 - targets/ARCH/COMMON/common_lib.h | 1 + 14 files changed, 762 insertions(+), 41 deletions(-) create mode 100644 openair1/PHY/TOOLS/calibration_scope.c create mode 100644 openair1/PHY/TOOLS/calibration_scope.h create mode 100644 openair1/PHY/TOOLS/calibration_test.c diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 7643fedb9d..477dfb7976 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2797,6 +2797,7 @@ add_library(rfsimulator MODULE ${OPENAIR_TARGETS}/ARCH/rfsimulator/simulator.c ${OPENAIR_TARGETS}/ARCH/rfsimulator/apply_channelmod.c ${OPENAIR_TARGETS}/ARCH/rfsimulator/new_channel_sim.c + ${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c ) target_link_libraries(rfsimulator SIMU_COMMON ${ATLAS_LIBRARIES}) @@ -3181,6 +3182,17 @@ target_link_libraries (dlsim_tm4 pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${T_LIB} ) +add_executable(rftest + ${OPENAIR_DIR}/openair1/PHY/TOOLS/calibration_test.c + ${OPENAIR_DIR}/openair1/PHY/TOOLS/calibration_scope.c + ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c + ${OPENAIR_DIR}/executables/softmodem-common.c + ${CONFIG_SOURCES} + ${SHLIB_LOADER_SOURCES} +) +target_link_libraries(rftest minimal_lib PHY_NR_COMMON pthread dl m forms ${T_LIB} ) + add_executable(polartest ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/polartest.c ${OPENAIR_DIR}/common/utils/backtrace.c diff --git a/cmake_targets/tools/run_enb_s1_usrp b/cmake_targets/tools/run_enb_s1_usrp index e119126683..1a4c6b10b8 100755 --- a/cmake_targets/tools/run_enb_s1_usrp +++ b/cmake_targets/tools/run_enb_s1_usrp @@ -101,7 +101,6 @@ function main() local -i run_gdb=0 local -i show_stdout=0 local exe_arguments="" - local itti_dump_file="" until [ -z "$1" ] do @@ -154,18 +153,6 @@ function main() exe_arguments="$exe_arguments --rf-config-file=$rf_config_file" fi ;; - -K | --itti-dump-file) - itti_dump_file=$2 - # can omit file name if last arg on the line - if [ "x$itti_dump_file" = "x" ]; then - itti_dump_file="/tmp/enb_s1_usrp_itti.log" - shift 1; - else - shift 2; - fi - echo "setting ITTI dump file to: $itti_dump_file" - exe_arguments="$exe_arguments -K $itti_dump_file" - ;; -m | --mscgen) g_msc_dir=$2 # can omit file name if last arg on the line diff --git a/common/utils/system.c b/common/utils/system.c index 1bd5c7d39b..239ea525c7 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -199,15 +199,26 @@ void start_background_system(void) { void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority){ pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - pthread_attr_setschedpolicy(&attr, SCHED_FIFO); + int ret; + AssertFatal(0==(ret=pthread_attr_init(&attr)),"ret: %d, errno: %d\n",ret, errno); + AssertFatal(0==(ret=pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)),"ret: %d, errno: %d\n",ret, errno); + AssertFatal(0==(ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED)),"ret: %d, errno: %d\n",ret, errno); + AssertFatal(0==(ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI)),"ret: %d, errno: %d\n",ret, errno); + if(prioritysched_get_priority_max(SCHED_FIFO)) { + LOG_E(TMR,"Prio not possible: %d, min is %d, max: %d, forced in the range\n", + priority, + sched_get_priority_min(SCHED_OAI), + sched_get_priority_max(SCHED_OAI)); + if(prioritysched_get_priority_max(SCHED_OAI)) + priority=sched_get_priority_max(SCHED_OAI); + } + AssertFatal(priority<=sched_get_priority_max(SCHED_OAI),""); struct sched_param sparam={0}; sparam.sched_priority = priority; - pthread_attr_setschedparam(&attr, &sparam); - - pthread_create(t, &attr, func, param); + AssertFatal(0==(ret=pthread_attr_setschedparam(&attr, &sparam)),"ret: %d, errno: %d\n",ret, errno); + AssertFatal(0==(ret=pthread_create(t, &attr, func, param)),"ret: %d, errno: %d\n",ret, errno); pthread_setname_np(*t, name); if (affinity != -1 ) { @@ -216,7 +227,6 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, CPU_SET(affinity, &cpuset); AssertFatal( pthread_setaffinity_np(*t, sizeof(cpu_set_t), &cpuset) == 0, "Error setting processor affinity"); } - pthread_attr_destroy(&attr); } diff --git a/common/utils/system.h b/common/utils/system.h index 760b7840a5..46316f6db6 100644 --- a/common/utils/system.h +++ b/common/utils/system.h @@ -46,9 +46,11 @@ void set_latency_target(void); void configure_linux(void); void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority); -#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_FIFO) -#define OAI_PRIORITY_RT sched_get_priority_min(SCHED_FIFO+10) -#define OAI_PRIORITY_RT_MAX sched_get_priority_min(SCHED_FIFO+20) + +#define SCHED_OAI SCHED_RR +#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_OAI) +#define OAI_PRIORITY_RT sched_get_priority_min(SCHED_OAI)+1 +#define OAI_PRIORITY_RT_MAX sched_get_priority_min(SCHED_OAI)+2 void thread_top_init(char *thread_name, int affinity, diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 63c06563d2..692e4d530f 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -114,7 +114,6 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; //Temp fix for inexistent NR upper layer unsigned char NB_gNB_INST = 1; -static char *itti_dump_file = NULL; int UE_scan = 1; int UE_scan_carrier = 0; diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h index d6cfe6b906..18a6fe42d0 100644 --- a/executables/nr-softmodem.h +++ b/executables/nr-softmodem.h @@ -18,13 +18,9 @@ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define CMDLINE_PARAMS_DESC_GNB { \ - {"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \ {"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \ {"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \ {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \ - {"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \ - {"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \ - {"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \ {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \ {"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \ } diff --git a/executables/ocp-gnb.c b/executables/ocp-gnb.c index 9a09a1247c..1f85132186 100644 --- a/executables/ocp-gnb.c +++ b/executables/ocp-gnb.c @@ -61,8 +61,6 @@ uint32_t do_forms=0; unsigned int mmapped_dma=0; int8_t threequarter_fs=0; -uint32_t target_dl_mcs = 28; //maximum allowed mcs -uint32_t target_ul_mcs = 20; int chain_offset=0; uint16_t sl_ahead=6; uint16_t sf_ahead=6; @@ -122,7 +120,6 @@ int restart_L1L2(module_id_t gnb_id) { } static int wait_for_sync = 0; -static char *itti_dump_file = NULL; static double snr_dB=20; static int DEFBANDS[] = {7}; static int DEFENBS[] = {0}; diff --git a/openair1/PHY/TOOLS/calibration_scope.c b/openair1/PHY/TOOLS/calibration_scope.c new file mode 100644 index 0000000000..da1acb5175 --- /dev/null +++ b/openair1/PHY/TOOLS/calibration_scope.c @@ -0,0 +1,387 @@ +#include +#include +#include "executables/softmodem-common.h" +#include "executables/nr-softmodem-common.h" +#include +#include + +#define TPUT_WINDOW_LENGTH 100 +#define ScaleZone 4 + +const FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW}; +const FL_COLOR water_colors[4] = {FL_BLUE,FL_GREEN,FL_YELLOW,FL_RED}; + +typedef struct { + int16_t r; + int16_t i; +} scopeSample_t; +#define SquaredNorm(VaR) ((VaR).r*(VaR).r+(VaR).i*(VaR).i) +typedef struct { + void ** samplesRx; + openair0_device *rfdevice; +} calibData_t; + +typedef struct OAIgraph { + FL_OBJECT *graph; + FL_OBJECT *text; + float maxX; + float maxY; + float minX; + float minY; + int x; + int y; + int w; + int h; + int waterFallh; + double *waterFallAvg; + boolean_t initDone; + int iteration; + void (*funct) (struct OAIgraph *graph, calibData_t *); +} OAIgraph_t; + + +/* Forms and Objects */ +typedef struct { + calibData_t * context; + FL_FORM *phy_scope; + OAIgraph_t graph[20]; + FL_OBJECT *button_0; +} OAI_phy_scope_t; + +typedef struct { + FL_FORM *stats_form; + void *vdata; + char *cdata; + long ldata; + FL_OBJECT *stats_text; + FL_OBJECT *stats_button; +} FD_stats_form; + +static void drawsymbol(FL_OBJECT *obj, int id, + FL_POINT *p, int n, int w, int h) { + fl_points( p, n, FL_YELLOW); +} + +#define WATERFALL 10000 + +static void commonGraph(OAIgraph_t *graph, int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { + if (type==WATERFALL) { + graph->waterFallh=h-15; + graph->waterFallAvg=malloc(sizeof(*graph->waterFallAvg) * graph->waterFallh); + + for (int i=0; i< graph->waterFallh; i++) + graph->waterFallAvg[i]=0; + + graph->graph=fl_add_canvas(FL_NORMAL_CANVAS, x, y, w, graph->waterFallh, label); + graph->text=fl_add_text(FL_NORMAL_TEXT, x, y+graph->waterFallh, w, 15, label); + fl_set_object_lcolor(graph->text,FL_WHITE); + fl_set_object_color(graph->text, FL_BLACK, FL_BLACK); + fl_set_object_lalign(graph->text, FL_ALIGN_CENTER ); + } else { + graph->graph=fl_add_xyplot(type, x, y, w, h, label); + fl_set_object_lcolor(graph->graph, FL_WHITE ); // Label color + fl_set_object_color(graph->graph, FL_BLACK, pointColor); + + for (int i=0; i< FL_MAX_XYPLOTOVERLAY; i++) + fl_set_xyplot_symbol(graph->graph, i, drawsymbol); + } + + graph->x=x; + graph->y=y; + graph->w=w; + graph->h=h; + graph->maxX=0; + graph->maxY=0; + graph->minX=0; + graph->minY=0; + graph->initDone=false; + graph->iteration=0; +} + +static OAIgraph_t calibrationCommonGraph( void (*funct) (OAIgraph_t *graph, calibData_t *context), + int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { + OAIgraph_t graph; + commonGraph(&graph, type, x, y, w, h, label, pointColor); + graph.funct=funct; + return graph; +} + + +static void setRange(OAIgraph_t *graph, float minX, float maxX, float minY, float maxY) { + if ( maxX > graph->maxX || minX < graph->minX || + abs(maxX-graph->maxX)>abs(graph->maxX)/2 || + abs(maxX-graph->maxX)>abs(graph->maxX)/2 ) { + graph->maxX/=2; + graph->minX/=2; + graph->maxX=max(graph->maxX,maxX); + graph->minX=min(graph->minX,minX); + fl_set_xyplot_xbounds(graph->graph, graph->minX*1.2, graph->maxX*1.2); + } + + if ( maxY > graph->maxY || minY < graph->minY || + abs(maxY-graph->maxY)>abs(graph->maxY)/2 || + abs(maxY-graph->maxY)>abs(graph->maxY)/2 ) { + graph->maxY/=2; + graph->minY/=2; + graph->maxY=max(graph->maxY,maxY); + graph->minY=min(graph->minY,minY); + fl_set_xyplot_ybounds(graph->graph, graph->minY*1.2, graph->maxY*1.2); + } +} + +static void oai_xygraph_getbuff(OAIgraph_t *graph, float **x, float **y, int len, int layer) { + float *old_x; + float *old_y; + int old_len=-1; + + if (graph->iteration >1) + fl_get_xyplot_data_pointer(graph->graph, layer, &old_x, &old_y, &old_len); + + if (old_len != len) { + LOG_W(HW,"allocating graph of %d scope\n", len); + float values[len]; + float time[len]; + + // make time in case we will use it + for (int i=0; igraph,time,values,len,"","",""); + else + fl_add_xyplot_overlay(graph->graph,layer,time,values,len,rx_antenna_colors[layer]); + + fl_get_xyplot_data_pointer(graph->graph, layer, &old_x, &old_y, &old_len); + AssertFatal(old_len==len,""); + } + + *x=old_x; + *y=old_y; +} + +static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int layer, boolean_t NoAutoScale) { + fl_redraw_object(graph->graph); + + if ( NoAutoScale && graph->iteration%NoAutoScale == 0) { + float maxX=0, maxY=0, minX=0, minY=0; + + for (int k=0; kiteration++; +} + +static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize, const int divisions, const char *label) { + if ( values == NULL ) + return; + fl_winset(FL_ObjWin(graph->graph)); + const int samplesPerPixel=datasize/graph->w; + int displayPart=graph->waterFallh-ScaleZone; + int row=graph->iteration%displayPart; + double avg=0; + + for (int i=0; i < displayPart; i++) + avg+=graph->waterFallAvg[i]; + + avg/=displayPart; + graph->waterFallAvg[row]=0; + + for (int pix=0; pixw; pix++) { + scopeSample_t *end=values+(pix+1)*samplesPerPixel; + end-=2; + AssertFatal(end <= values+datasize,"diff : %ld", end-values+datasize); + double val=0; + + for (scopeSample_t *s=values+(pix)*samplesPerPixel; + s waterFallAvg[row]+=val/graph->w; + int col=0; + + if (val > avg*2 ) + col=1; + + if (val > avg*10 ) + col=2; + + if (val > avg*100 ) + col=3; + + fl_point(pix, graph->iteration%displayPart, water_colors[col]); + } + + if (graph->initDone==false) { + for ( int i=0; i < graph->waterFallh; i++ ) + for ( int j = 0 ; j < graph->w ; j++ ) + fl_point(j, i, FL_BLACK); + + for ( int i=1; iwaterFallh; j++) + fl_point(i*(graph->w/divisions),j, FL_WHITE); + + graph->initDone=true; + } + + fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, sqrt(avg)); + graph->iteration++; +} + +static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) { + float *values, *time; + oai_xygraph_getbuff(graph, &time, &values, len, 0); + + for (int ant=0; antsamplesRx[0], + 0, 0, + "X axis:one frame in time"); +} +static void gNBfreqWaterFall (OAIgraph_t *graph, calibData_t *context) { + //use 1st antenna + genericWaterFall(graph, (scopeSample_t *)context->samplesRx[0], + 0, 0, + "X axis:one frame in time"); +} +static void timeResponse (OAIgraph_t *graph, calibData_t *context) { + #if 0 + const int len=2*phy_vars_gnb->frame_parms.ofdm_symbol_size; + float *values, *time; + oai_xygraph_getbuff(graph, &time, &values, len, 0); + const int ant=0; // display antenna 0 for each UE + + for (int ue=0; uepusch_vars[ue]->ul_ch_estimates_time[ant]; + + if (data != NULL) { + for (int i=0; iframe_parms; + int sz=frame_parms->N_RB_UL*12*frame_parms->symbols_per_slot; + + for (int ue=0; uepusch_vars[ue]->rxdataF_comp[0]; + float *I, *Q; + oai_xygraph_getbuff(graph, &I, &Q, sz, ue); + + if (pusch_comp) { + for (int k=0; kcontext=context; + // Define form + fdui->phy_scope = fl_bgn_form( FL_NO_BOX, 800, 800 ); + // This the whole UI box + obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 800, "" ); + fl_set_object_color( obj, FL_BLACK, FL_WHITE ); + int curY=0,x,y,w,h; + // Received signal + fdui->graph[0] = calibrationCommonGraph( gNBWaterFall, WATERFALL, 0, curY, 400, 100, + "Received Signal (Time-Domain, one frame)", FL_RED ); + + // Time-domain channel response + //fdui->graph[1] = calibrationCommonGraph( timeResponse, FL_NORMAL_XYPLOT, 410, curY, 400, 100, "SRS Frequency Response (samples, abs)", FL_RED ); + fl_get_object_bbox(fdui->graph[0].graph,&x, &y,&w, &h); + curY+=h; + // Frequency-domain channel response + fdui->graph[1] = calibrationCommonGraph( gNBfreqWaterFall, WATERFALL, 0, curY, 800, 100, + "Channel Frequency domain (RE, one frame)", FL_RED ); + fl_get_object_bbox(fdui->graph[1].graph,&x, &y,&w, &h); + curY+=h+20; + // LLR of PUSCH + //fdui->graph[3] = calibrationCommonGraph( puschLLR, FL_POINTS_XYPLOT, 0, curY, 500, 200, "PUSCH Log-Likelihood Ratios (LLR, mag)", FL_YELLOW ); + // I/Q PUSCH comp + fdui->graph[2] = calibrationCommonGraph( puschIQ, FL_POINTS_XYPLOT, 500, curY, 300, 200, + "PUSCH I/Q of MF Output", FL_YELLOW ); + fl_get_object_bbox(fdui->graph[2].graph,&x, &y,&w, &h); + curY+=h; + //fl_get_object_bbox(fdui->graph[6].graph,&x, &y,&w, &h); + curY+=h; + fdui->graph[3].graph=NULL; + fl_end_form( ); + fdui->phy_scope->fdui = fdui; + fl_show_form (fdui->phy_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, "LTE UL SCOPE gNB"); + return fdui; +} + +void calibrationScope(OAI_phy_scope_t *form) { + int i=0; + + while (form->graph[i].graph) { + form->graph[i].funct(form->graph+i, form->context); + i++; + } + + //fl_check_forms(); +} + +static void *scopeThread(void *arg) { + calibData_t * context = (calibData_t *)arg; + size_t stksize=0; + pthread_attr_t atr; + pthread_attr_init(&atr); + pthread_attr_getstacksize(&atr, &stksize); + pthread_attr_setstacksize(&atr,32*1024*1024 ); + sleep(3); // no clean interthread barriers + int fl_argc=1; + char *name="Calibration-scope"; + fl_initialize (&fl_argc, &name, NULL, 0, 0); + OAI_phy_scope_t *form = createScopeCalibration(context); + + while (!oai_exit) { + calibrationScope(form); + usleep(99*1000); + } + + return NULL; +} + +void CalibrationInitScope(void ** samplesRx,openair0_device *rfdevice) { + pthread_t forms_thread; + calibData_t * tmp=(calibData_t *) malloc(sizeof(*tmp)); + tmp->samplesRx=samplesRx; + tmp->rfdevice=rfdevice; + threadCreate(&forms_thread, scopeThread, (void*) tmp, "scope", -1, OAI_PRIORITY_RT_LOW); +} diff --git a/openair1/PHY/TOOLS/calibration_scope.h b/openair1/PHY/TOOLS/calibration_scope.h new file mode 100644 index 0000000000..052a1a6b6e --- /dev/null +++ b/openair1/PHY/TOOLS/calibration_scope.h @@ -0,0 +1,5 @@ +#ifndef CALIB_SCOPE_H +#define CALIB_SCOPE_H + +void CalibrationInitScope(void ** samplesRx,openair0_device *rfdevice); +#endif diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c new file mode 100644 index 0000000000..376315734a --- /dev/null +++ b/openair1/PHY/TOOLS/calibration_test.c @@ -0,0 +1,329 @@ +#include +#include +#include +#include +#include + + +volatile int oai_exit=false; +unsigned int mmapped_dma=0; +int single_thread_flag; +uint32_t timing_advance; +int8_t threequarter_fs; +int usrp_tx_thread; +uint64_t downlink_frequency[MAX_NUM_CCs][4]; +int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; +int opp_enabled; +static double snr_dB=20; +#include + +int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state) {return 0;} +void nfapi_setmode(nfapi_mode_t nfapi_mode) {} +void set_taus_seed(unsigned int seed_init){}; + +int main(int argc, char **argv) { + ///static configuration for NR at the moment + if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == NULL) { + exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); + } + set_softmodem_sighandler(); + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + logInit(); + paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC_GNB ; + + CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); + get_common_options(SOFTMODEM_GNB_BIT ); + config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); + CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); + configure_linux(); + + + int N_RB=50; + int subCarrierFreq=30e3; + int sampling_rate=30.72e6; + int DFT=2048; + int TxAdvanceInDFTSize=12; + int antennas=1; + uint64_t freq=3619.200e6; + int rxGain=90; + int txGain=90; + int filterBand=40e6; + char * usrp_addrs="type=b200"; + + openair0_config_t openair0_cfg= { + //! Module ID for this configuration + .Mod_id=0, + //! device log level + .log_level=0, + //! duplexing mode + .duplex_mode=0, + //! number of downlink resource blocks + .num_rb_dl=N_RB, + //! number of samples per frame + .samples_per_frame=0, + //! the sample rate for both transmit and receive. + .sample_rate=sampling_rate, + //device is doing mmapped DMA transfers + .mmapped_dma=0, + //! offset in samples between TX and RX paths + .tx_sample_advance=0, + //! samples per packet on the fronthaul interface + .samples_per_packet=1024, + //! number of RX channels (=RX antennas) + .rx_num_channels=antennas, + //! number of TX channels (=TX antennas) + .tx_num_channels=antennas, + //! \brief Center frequency in Hz for RX. + //! index: [0..rx_num_channels[ + .rx_freq={freq,freq,freq,freq}, + //! \brief Center frequency in Hz for TX. + //! index: [0..rx_num_channels[ !!! see lte-ue.c:427 FIXME iterates over rx_num_channels + .tx_freq={freq,freq,freq,freq}, + //! \brief memory + //! \brief Pointer to Calibration table for RX gains + .rx_gain_calib_table=NULL, + //! mode for rxgain (ExpressMIMO2) + .rxg_mode={0}, + //! \brief Gain for RX in dB. + //! index: [0..rx_num_channels] + .rx_gain={rxGain,rxGain,rxGain,rxGain}, + //! \brief Gain offset (for calibration) in dB + //! index: [0..rx_num_channels] + .rx_gain_offset={0}, + //! gain for TX in dB + .tx_gain={txGain,txGain,txGain,txGain}, + //! RX bandwidth in Hz + .rx_bw=filterBand, + //! TX bandwidth in Hz + .tx_bw=filterBand, + //! clock source + .clock_source=external,//internal gpsdo external + //! timing_source + .time_source=internal, //internal gpsdo external + //! Manual SDR IP address + //#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) + .sdr_addrs=usrp_addrs, + //! Auto calibration flag + .autocal={0}, + //! rf devices work with x bits iqs when oai have its own iq format + //! the two following parameters are used to convert iqs + .iq_txshift=0, + .iq_rxrescale=0, + //! Configuration file for LMS7002M + .configFilename="", + //! remote IP/MAC addr for Ethernet interface + .remote_addr="", + //! remote port number for Ethernet interface + .remote_port=0, + //! local IP/MAC addr for Ethernet interface (eNB/BBU, UE) + .my_addr=0, + //! local port number for Ethernet interface (eNB/BBU, UE) + .my_port=0, + //! record player configuration, definition in record_player.h + .recplay_mode=0, + .recplay_conf=NULL, + //! number of samples per tti + .samples_per_tti=0, + //! check for threequarter sampling rate + .threequarter_fs=0, + }; + //----------------------- + openair0_device rfdevice= { + /*!tx write thread*/ + //.write_thread={0}, + /*!brief Module ID of this device */ + .Mod_id=0, + /*!brief Component Carrier ID of this device */ + .CC_id=0, + /*!brief Type of this device */ + .type=NONE_DEV, + /*!brief Transport protocol type that the device supports (in case I/Q samples need to be transported) */ + .transp_type=NONE_TP, + /*!brief Type of the device's host (RAU/RRU) */ + .host_type=MIN_HOST_TYPE, + /* !brief RF frontend parameters set by application */ + .openair0_cfg=NULL, //set by device_init + /* !brief ETH params set by application */ + .eth_params=NULL, + //! record player data, definition in record_player.h + .recplay_state=NULL, + /* !brief Indicates if device already initialized */ + .is_init=0, + /*!brief Can be used by driver to hold internal structure*/ + .priv=NULL, + /* Functions API, which are called by the application*/ + /*! \brief Called to start the transceiver. Return 0 if OK, < 0 if error + @param device pointer to the device structure specific to the RF hardware target + */ + .trx_start_func=NULL, + + /*! \brief Called to configure the device + @param device pointer to the device structure specific to the RF hardware target + */ + .trx_config_func=NULL, + + /*! \brief Called to send a request message between RAU-RRU on control port + @param device pointer to the device structure specific to the RF hardware target + @param msg pointer to the message structure passed between RAU-RRU + @param msg_len length of the message + */ + .trx_ctlsend_func=NULL, + + /*! \brief Called to receive a reply message between RAU-RRU on control port + @param device pointer to the device structure specific to the RF hardware target + @param msg pointer to the message structure passed between RAU-RRU + @param msg_len length of the message + */ + .trx_ctlrecv_func=NULL, + + /*! \brief Called to send samples to the RF target + @param device pointer to the device structure specific to the RF hardware target + @param timestamp The timestamp at whicch the first sample MUST be sent + @param buff Buffer which holds the samples (2 dimensional) + @param nsamps number of samples to be sent + @param number of antennas + @param flags flags must be set to TRUE if timestamp parameter needs to be applied + */ + .trx_write_func=NULL, + + /*! \brief Called to send samples to the RF target + @param device pointer to the device structure specific to the RF hardware target + @param timestamp The timestamp at whicch the first sample MUST be sent + @param buff Buffer which holds the samples (1 dimensional) + @param nsamps number of samples to be sent + @param antenna_id index of the antenna if the device has multiple anteannas + @param flags flags must be set to TRUE if timestamp parameter needs to be applied + */ + .trx_write_func2=NULL, + + /*! \brief Receive samples from hardware. + * Read \ref nsamps samples from each channel to buffers. buff[0] is the array for + * the first channel. *ptimestamp is the time at which the first sample + * was received. + * \param device the hardware to use + * \param[out] ptimestamp the time at which the first sample was received. + * \param[out] buff An array of pointers to buffers for received samples. The buffers must be large enough to hold the number of samples \ref nsamps. + * \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte. + * \param num_antennas number of antennas from which to receive samples + * \returns the number of sample read + */ + + .trx_read_func=NULL, + + /*! \brief Receive samples from hardware, this version provides a single antenna at a time and returns. + * Read \ref nsamps samples from each channel to buffers. buff[0] is the array for + * the first channel. *ptimestamp is the time at which the first sample + * was received. + * \param device the hardware to use + * \param[out] ptimestamp the time at which the first sample was received. + * \param[out] buff A pointers to a buffer for received samples. The buffer must be large enough to hold the number of samples \ref nsamps. + * \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte. + * \param antenna_id Index of antenna from which samples were received + * \returns the number of sample read + */ + .trx_read_func2=NULL, + + /*! \brief print the device statistics + * \param device the hardware to use + * \returns 0 on success + */ + /*! \brief print the device statistics + * \param device the hardware to use + * \returns 0 on success + */ + .trx_get_stats_func=NULL, + + /*! \brief Reset device statistics + * \param device the hardware to use + * \returns 0 in success + */ + .trx_reset_stats_func=NULL, + + /*! \brief Terminate operation of the transceiver -- free all associated resources + * \param device the hardware to use + */ + .trx_end_func=NULL, + + /*! \brief Stop operation of the transceiver + */ + .trx_stop_func=NULL, + + /* Functions API related to UE*/ + + /*! \brief Set RX feaquencies + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \param exmimo_dump_config dump EXMIMO configuration + * \returns 0 in success + */ + .trx_set_freq_func=NULL, + + /*! \brief Set gains + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \returns 0 in success + */ + .trx_set_gains_func=NULL, + + /*! \brief RRU Configuration callback + * \param idx RU index + * \param arg pointer to capabilities or configuration + */ + .configure_rru=NULL, + /*! \brief Pointer to generic RRU private information + */ + .thirdparty_priv=NULL, + .thirdparty_init=NULL, + /*! \brief Callback for Third-party RRU Cleanup routine + \param device the hardware configuration to use + */ + .thirdparty_cleanup=NULL, + + /*! \brief Callback for Third-party start streaming routine + \param device the hardware configuration to use + */ + .thirdparty_startstreaming=NULL, + + /*! \brief RRU Configuration callback + * \param idx RU index + * \param arg pointer to capabilities or configuration + */ + .trx_write_init=NULL, + /* \brief Get internal parameter + * \param id parameter to get + * \return a pointer to the parameter + */ + .get_internal_parameter=NULL, + }; + + openair0_device_load(&rfdevice,&openair0_cfg); + + void ** samplesRx = (void **)malloc16(antennas* sizeof(struct complex16 *) ); + void ** samplesTx = (void **)malloc16(antennas* sizeof(struct complex16 *) ); + + for (int i=0; i +#include #include #include #include "record_player.h" From c0ef3e6f88b354409ae1330051348edac1d4e505 Mon Sep 17 00:00:00 2001 From: Laurent OpenCells Date: Sat, 3 Apr 2021 23:37:58 +0200 Subject: [PATCH 25/66] fix gcc reported issues --- cmake_targets/CMakeLists.txt | 1 + .../install_external_packages.ubuntu20 | 9 +- common/utils/msc/msc.c | 1 + common/utils/msc/msc.h | 2 +- executables/main-ocp.c | 3 + executables/nr-softmodem.c | 3 +- executables/nr-uesoftmodem.c | 2 + executables/ocp-gnb.c | 3 +- executables/thread-common.h | 2 +- nfapi/oai_integration/nfapi_pnf.c | 1 - nfapi/oai_integration/nfapi_pnf.h | 1 + openair1/PHY/CODING/3gpplte_sse.c | 2 - openair1/PHY/CODING/TESTBENCH/ldpctest.c | 26 ++- openair1/PHY/CODING/TESTBENCH/polartest.c | 9 +- .../PHY/CODING/TESTBENCH/smallblocktest.c | 5 +- openair1/PHY/NR_REFSIG/nr_gen_mod_table.c | 12 ++ openair1/PHY/NR_REFSIG/nr_mod_table.h | 12 +- openair1/PHY/NR_REFSIG/pss_nr.h | 3 +- openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c | 36 ++++ openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h | 62 ++---- openair1/PHY/TOOLS/lte_enb_scope.c | 3 +- openair1/PHY/TOOLS/lte_phy_scope.c | 4 - openair1/PHY/TOOLS/time_meas.c | 19 +- openair1/PHY/TOOLS/time_meas.h | 1 - openair1/PHY/impl_defs_nr.h | 10 +- openair1/SCHED/phy_procedures_lte_eNb.c | 2 +- openair1/SCHED_NR_UE/pucch_uci_ue_nr.c | 187 ++++++++++++++++ openair1/SCHED_NR_UE/pucch_uci_ue_nr.h | 202 ------------------ openair1/SIMULATION/LTE_PHY/common_sim.h | 8 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 5 +- openair1/SIMULATION/LTE_PHY/ulsim.c | 5 +- openair1/SIMULATION/NR_PHY/dlsim.c | 6 +- openair1/SIMULATION/NR_PHY/prachsim.c | 1 + openair1/SIMULATION/NR_PHY/ulsim.c | 5 +- openair1/SIMULATION/TOOLS/phase_noise.c | 1 + openair1/SIMULATION/TOOLS/sim.h | 1 - .../MAC/flexran_agent_mac_internal.h | 2 - .../RRC/flexran_agent_rrc_defs.h | 2 - openair2/ENB_APP/flexran_agent_common.h | 1 - openair2/ENB_APP/flexran_agent_net_comm.c | 2 +- .../ENB_APP/flexran_agent_ran_api_to_fix.c | 33 +++ openair2/LAYER2/MAC/config_ue.c | 4 - openair2/LAYER2/MAC/defs_NB_IoT.h | 3 - openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 48 +++++ openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 88 ++++---- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 6 +- .../LAYER2/PROTO_AGENT/proto_agent_common.h | 1 - .../LAYER2/PROTO_AGENT/proto_agent_net_comm.c | 2 +- openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c | 2 + openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h | 2 - openair2/LAYER2/RLC/rlc.c | 19 ++ openair2/LAYER2/RLC/rlc.h | 14 +- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 1 - openair2/LAYER2/rlc_v2/rlc_oai_api.c | 1 - openair2/NETWORK_DRIVER/UE_IP/netlink.c | 1 + openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 26 +-- openair2/PHY_INTERFACE/IF_Module.c | 4 +- openair2/PHY_INTERFACE/phy_stub_UE.c | 1 + openair2/PHY_INTERFACE/phy_stub_UE.h | 3 +- openair2/RRC/LTE/rrc_UE.c | 4 +- openair2/RRC/NR_UE/rrc_UE.c | 1 + openair2/RRC/NR_UE/rrc_vars.h | 2 +- openair3/GTPV1-U/gtpv1u_eNB.c | 1 + openair3/NAS/UE/nas_ue_task.c | 1 + .../ETHERNET/USERSPACE/LIB/ethernet_lib.c | 1 - targets/RT/USER/lte-softmodem.c | 3 + targets/RT/USER/lte-ue.c | 1 + targets/RT/USER/lte-uesoftmodem.c | 1 + targets/RT/USER/rt_wrapper.c | 1 + 69 files changed, 512 insertions(+), 425 deletions(-) create mode 100644 openair2/ENB_APP/flexran_agent_ran_api_to_fix.c diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 477dfb7976..8d8adb6eb0 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -3058,6 +3058,7 @@ add_executable(nr-softmodem ${T_SOURCE} ${CONFIG_SOURCES} ${SHLIB_LOADER_SOURCES} + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api_to_fix.c ) target_link_libraries (nr-softmodem diff --git a/cmake_targets/install_external_packages.ubuntu20 b/cmake_targets/install_external_packages.ubuntu20 index 9ef79be9c2..4f0fbf5946 100755 --- a/cmake_targets/install_external_packages.ubuntu20 +++ b/cmake_targets/install_external_packages.ubuntu20 @@ -83,6 +83,8 @@ get_distribution_release() { check_supported_distribution() { case $(get_distribution_release) in "ubuntu20.04") return 0 ;; + "ubuntu20.10") return 0 ;; + "ubuntu21.04") return 0 ;; esac return 1 } @@ -329,6 +331,7 @@ check_install_ubuntu_packages() { $SUDO apt install -y software-properties-common case "$(get_distribution_release)" in "ubuntu20.04") + "ubuntu21.04") specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" @@ -345,7 +348,6 @@ check_install_ubuntu_packages() { openvpn \ pkg-config \ python3-dev \ - python-pexpect \ sshfs \ swig \ tshark \ @@ -358,7 +360,6 @@ check_install_ubuntu_packages() { iperf3 \ android-tools-adb \ wvdial \ - python-numpy \ sshpass \ nscd \ bc \ @@ -379,7 +380,6 @@ check_install_ubuntu_packages() { git \ graphviz \ gtkwave \ - guile-2.0-dev \ iperf \ iptables \ libxtables-dev \ @@ -419,7 +419,8 @@ check_install_ubuntu_packages() { libxpm-dev \ libboost-all-dev \ nettle-dev \ - nettle-bin + nettle-bin \ + libreadline-dev fi $SUDO update-alternatives --set "$LAPACK_LIBNAME" "$LAPACK_TARGET" diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c index 7cc5f79f90..84b723b022 100644 --- a/common/utils/msc/msc.c +++ b/common/utils/msc/msc.c @@ -52,6 +52,7 @@ FILE *g_msc_fd; char g_msc_proto2str[MAX_MSC_PROTOS][MSC_MAX_PROTO_NAME_LENGTH]; +msc_interface_t msc_interface; typedef unsigned long msc_message_number_t; typedef struct msc_queue_item_s { diff --git a/common/utils/msc/msc.h b/common/utils/msc/msc.h index aab872cfe1..adb0d9e657 100644 --- a/common/utils/msc/msc.h +++ b/common/utils/msc/msc.h @@ -117,7 +117,7 @@ void msc_log_message( #define MESSAGE_CHART_GENERATOR msc_interface.msc_loaded -msc_interface_t msc_interface; +extern msc_interface_t msc_interface; #define MSC_INIT(arg1,arg2) if(msc_interface.msc_loaded) msc_interface.msc_init(arg1,arg2) #define MSC_START_USE if(msc_interface.msc_loaded) msc_interface.msc_start_use #define MSC_END if(msc_interface.msc_loaded) msc_interface.msc_end diff --git a/executables/main-ocp.c b/executables/main-ocp.c index ae1db7195b..93a24f9ddf 100644 --- a/executables/main-ocp.c +++ b/executables/main-ocp.c @@ -73,6 +73,9 @@ int sync_var=-1; //!< protected by mutex \ref sync_mutex. int config_sync_var=-1; volatile int oai_exit = 0; double cpuf; +msc_interface_t msc_interface; +THREAD_STRUCT thread_struct; + uint16_t sf_ahead=4; //uint16_t slot_ahead=6; int otg_enabled; diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 692e4d530f..fc5c284ef2 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -92,11 +92,12 @@ pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex extern uint8_t nfapi_mode; // Default to monolithic mode - +THREAD_STRUCT thread_struct; pthread_cond_t sync_cond; pthread_mutex_t sync_mutex; int sync_var=-1; //!< protected by mutex \ref sync_mutex. int config_sync_var=-1; +msc_interface_t msc_interface; volatile int start_gNB = 0; volatile int oai_exit = 0; diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 2854457eee..c5364e38af 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -88,6 +88,8 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "executables/thread-common.h" extern const char *duplex_mode[]; +msc_interface_t msc_interface; +THREAD_STRUCT thread_struct; // Thread variables pthread_cond_t nfapi_sync_cond; diff --git a/executables/ocp-gnb.c b/executables/ocp-gnb.c index 1f85132186..a12cef9052 100644 --- a/executables/ocp-gnb.c +++ b/executables/ocp-gnb.c @@ -77,6 +77,7 @@ pthread_cond_t nfapi_sync_cond; int nfapi_sync_var=-1; double cpuf; +THREAD_STRUCT thread_struct; pthread_cond_t sync_cond; pthread_mutex_t sync_mutex; @@ -93,7 +94,7 @@ time_stats_t softmodem_stats_rx_sf; // total rx time // not used but needed for link openair0_config_t openair0_cfg[MAX_CARDS]; uint16_t slot_ahead=6; - +msc_interface_t msc_interface; AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]; AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; int flexran_agent_start(mid_t mod_id) { diff --git a/executables/thread-common.h b/executables/thread-common.h index 6f3af3cfc0..0aaeb3c30e 100644 --- a/executables/thread-common.h +++ b/executables/thread-common.h @@ -3,7 +3,7 @@ #include "PHY/defs_common.h" -THREAD_STRUCT thread_struct; +extern THREAD_STRUCT thread_struct; static inline void set_parallel_conf(char *parallel_conf) { mapping config[]= { diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index 4ca02ed929..0329b13dac 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -73,7 +73,6 @@ extern pthread_mutex_t nfapi_sync_mutex; extern int nfapi_sync_var; extern int sync_var; -char uecap_xer_in; extern void init_eNB_afterRU(void); extern void init_UE_stub(int nb_inst,int,int); diff --git a/nfapi/oai_integration/nfapi_pnf.h b/nfapi/oai_integration/nfapi_pnf.h index b3ab7cbdbc..61d4847eba 100644 --- a/nfapi/oai_integration/nfapi_pnf.h +++ b/nfapi/oai_integration/nfapi_pnf.h @@ -21,6 +21,7 @@ #if !defined(NFAPI_PNF_H__) #define NFAPI_PNF_H__ +extern nfapi_ue_release_request_body_t release_rntis; int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind); void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port); void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port); diff --git a/openair1/PHY/CODING/3gpplte_sse.c b/openair1/PHY/CODING/3gpplte_sse.c index 2a7b789650..fffd04ea3c 100644 --- a/openair1/PHY/CODING/3gpplte_sse.c +++ b/openair1/PHY/CODING/3gpplte_sse.c @@ -44,8 +44,6 @@ //#define DEBUG_TURBO_ENCODER 1 //#define CALLGRIND 1 -unsigned short threegpplte_interleaver_output; -unsigned long long threegpplte_interleaver_tmp; #if defined(__x86_64__) || defined(__i386__) struct treillis { diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c index e16c909835..f6769251cd 100644 --- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c +++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c @@ -116,7 +116,6 @@ int test_ldpc(short No_iteration, double sigma; sigma = 1.0/sqrt(2*SNR); opp_enabled=1; - cpu_freq_GHz = get_cpu_freq_GHz(); //short test_input[block_length]; unsigned char *test_input[MAX_NUM_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};; //short *c; //padded codeword @@ -614,7 +613,6 @@ int main(int argc, char *argv[]) exit(1); break; } - cpu_freq_GHz = get_cpu_freq_GHz(); //printf("the decoder supports BG2, Kb=10, Z=128 & 256\n"); //printf(" range of blocklength: 1201 -> 1280, 2401 -> 2560\n"); printf("block length %d: \n", block_length); @@ -704,25 +702,25 @@ int main(int argc, char *argv[]) printf("SNR %f, Std iterations: %f\n",SNR, dec_iter->n_iter_std); printf("SNR %f, Max iterations: %d\n",SNR, dec_iter->n_iter_max); printf("\n"); - printf("Encoding time mean: %15.3f us\n",(double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz); - printf("Encoding time std: %15.3f us\n",sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz,2))); - printf("Encoding time max: %15.3f us\n",(double)time_optim->max/1000.0/cpu_freq_GHz); + printf("Encoding time mean: %15.3f us\n",(double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz()); + printf("Encoding time std: %15.3f us\n",sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),2))); + printf("Encoding time max: %15.3f us\n",(double)time_optim->max/1000.0/get_cpu_freq_GHz()); printf("\n"); - printf("Decoding time mean: %15.3f us\n",(double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz); - printf("Decoding time std: %15.3f us\n",sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz,2))); - printf("Decoding time max: %15.3f us\n",(double)time_decoder->max/1000.0/cpu_freq_GHz); + printf("Decoding time mean: %15.3f us\n",(double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz()); + printf("Decoding time std: %15.3f us\n",sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),2))); + printf("Decoding time max: %15.3f us\n",(double)time_decoder->max/1000.0/get_cpu_freq_GHz()); fprintf(fd,"%f %f %f %f %f %f %f %f %f %f %f %f %d \n", SNR, (double)decoded_errors[i]/(double)n_trials , (double)errors_bit/(double)n_trials/(double)block_length/(double)n_segments , errors_bit_uncoded/(double)n_trials/(double)n_segments , - (double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz, - sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz,2)), - (double)time_optim->max/1000.0/cpu_freq_GHz, - (double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz, - sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz,2)), - (double)time_decoder->max/1000.0/cpu_freq_GHz, + (double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(), + sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),2)), + (double)time_optim->max/1000.0/get_cpu_freq_GHz(), + (double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(), + sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),2)), + (double)time_decoder->max/1000.0/get_cpu_freq_GHz(), dec_iter->n_iter_mean, dec_iter->n_iter_std, dec_iter->n_iter_max diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index d9adf3e24f..e43ba507ab 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -113,7 +113,6 @@ int main(int argc, char *argv[]) //Initiate timing. (Results depend on CPU Frequency. Therefore, might change due to performance variances during simulation.) time_stats_t timeEncoder,timeDecoder; opp_enabled=1; - cpu_freq_GHz = get_cpu_freq_GHz(); reset_meas(&timeEncoder); reset_meas(&timeDecoder); randominit(0); @@ -324,9 +323,9 @@ if (logFlag){ #endif //Iteration times are in microseconds. - timeEncoderCumulative+=(timeEncoder.diff/(cpu_freq_GHz*1000.0)); - timeDecoderCumulative+=(timeDecoder.diff/(cpu_freq_GHz*1000.0)); - if (logFlag) fprintf(logFile,",%f,%d,%u,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(cpu_freq_GHz*1000.0)), (timeDecoder.diff/(cpu_freq_GHz*1000.0))); + timeEncoderCumulative+=(timeEncoder.diff/(get_cpu_freq_GHz()*1000.0)); + timeDecoderCumulative+=(timeDecoder.diff/(get_cpu_freq_GHz()*1000.0)); + if (logFlag) fprintf(logFile,",%f,%d,%u,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(get_cpu_freq_GHz()*1000.0)), (timeDecoder.diff/(get_cpu_freq_GHz()*1000.0))); if (nBitError<0) { blockErrorCumulative++; @@ -348,7 +347,7 @@ if (logFlag){ printf("[ListSize=%d] SNR=%+8.3f, BLER=%9.6f, BER=%12.9f, t_Encoder=%9.3fus, t_Decoder=%9.3fus\n", decoderListSize, SNR, ((double)blockErrorCumulative/iterations), ((double)bitErrorCumulative / (iterations*testLength)), - (double)timeEncoder.diff/timeEncoder.trials/(cpu_freq_GHz*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(cpu_freq_GHz*1000.0)); + (double)timeEncoder.diff/timeEncoder.trials/(get_cpu_freq_GHz()*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(get_cpu_freq_GHz()*1000.0)); //(timeEncoderCumulative/iterations),timeDecoderCumulative/iterations); if (blockErrorCumulative==0 && bitErrorCumulative==0) break; diff --git a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c index 02d5dc64e0..f750d24977 100644 --- a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c +++ b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c @@ -13,7 +13,6 @@ int main(int argc, char *argv[]) { time_stats_t timeEncoder,timeDecoder; opp_enabled=1; - cpu_freq_GHz = get_cpu_freq_GHz(); reset_meas(&timeEncoder); reset_meas(&timeDecoder); randominit(0); @@ -141,8 +140,8 @@ int main(int argc, char *argv[]) SNR, ((double)bitErrorCumulative / (iterations*messageLength)), ((double)blockErrorCumulative/iterations), - ((double)timeEncoder.diff/timeEncoder.trials)/(cpu_freq_GHz), - ((double)timeDecoder.diff/timeDecoder.trials)/(cpu_freq_GHz*1000.0)); + ((double)timeEncoder.diff/timeEncoder.trials)/(get_cpu_freq_GHz()), + ((double)timeDecoder.diff/timeDecoder.trials)/(get_cpu_freq_GHz()*1000.0)); blockErrorCumulative=0; bitErrorCumulative=0; diff --git a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c index b0f9e6d03c..9ed2bd949f 100644 --- a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c +++ b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c @@ -21,6 +21,18 @@ #include "nr_refsig.h" #include "nr_mod_table.h" +short nr_qpsk_mod_table[8]; + +int32_t nr_16qam_mod_table[16]; +#if defined(__SSE2__) +__m128i nr_qpsk_byte_mod_table[2048]; +#endif + +int64_t nr_16qam_byte_mod_table[1024]; + +int64_t nr_64qam_mod_table[4096]; + +int32_t nr_256qam_mod_table[512]; void nr_generate_modulation_table() { float sqrt2 = 0.70711; diff --git a/openair1/PHY/NR_REFSIG/nr_mod_table.h b/openair1/PHY/NR_REFSIG/nr_mod_table.h index aa8b99f584..2c6964fe96 100644 --- a/openair1/PHY/NR_REFSIG/nr_mod_table.h +++ b/openair1/PHY/NR_REFSIG/nr_mod_table.h @@ -29,16 +29,16 @@ #define NR_MOD_TABLE_QAM64_OFFSET 23 #define NR_MOD_TABLE_QAM256_OFFSET 87 -short nr_qpsk_mod_table[8]; +extern short nr_qpsk_mod_table[8]; -int32_t nr_16qam_mod_table[16]; +extern int32_t nr_16qam_mod_table[16]; #if defined(__SSE2__) -__m128i nr_qpsk_byte_mod_table[2048]; +extern __m128i nr_qpsk_byte_mod_table[2048]; #endif -int64_t nr_16qam_byte_mod_table[1024]; +extern int64_t nr_16qam_byte_mod_table[1024]; -int64_t nr_64qam_mod_table[4096]; +extern int64_t nr_64qam_mod_table[4096]; -int32_t nr_256qam_mod_table[512]; +extern int32_t nr_256qam_mod_table[512]; #endif diff --git a/openair1/PHY/NR_REFSIG/pss_nr.h b/openair1/PHY/NR_REFSIG/pss_nr.h index 19b9736bcb..b32d48a2e9 100644 --- a/openair1/PHY/NR_REFSIG/pss_nr.h +++ b/openair1/PHY/NR_REFSIG/pss_nr.h @@ -120,8 +120,7 @@ EXTERN int64_t *pss_corr_ue[NUMBER_PSS_SEQUENCE] ; /* profiling structure */ -EXTERN double cpuf; -time_stats_t generic_time[TIME_LAST]; +EXTERN time_stats_t generic_time[TIME_LAST]; #ifndef DEFINE_HEADER_ONLY diff --git a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c index 4a419ae926..dfd759f376 100644 --- a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c +++ b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c @@ -54,6 +54,42 @@ * *********************************************************************/ +/* Table 5.2.2.2-2: Definition of phi ( n ) for M ZC = 12 */ +const char phi_M_ZC_12[12*U_GROUP_NUMBER] += { +/* 0 1 2 3 4 5 6 7 8 9 10 11 */ +/* 0 */ 1, -1, 3, 1, 1, -1, -1, -1, 1, 3, -3, 1, +/* 1 */ -1, -1, -1, -1, 1, -3, -1, 3, 3, -1, -3, 1, +/* 2 */ -3, 1, -3, -3, -3, 3, -3, -1, 1, 1, 1, -3, +/* 3 */ -3, 3, 1, 3, -3, 1, 1, 1, 1, 3, -3, 3, +/* 4 */ -3, 1, 3, -1, -1, -3, -3, -1, -1, 3, 1, -3, +/* 5 */ -1, 1, 1, -1, 1, 3, 3, -1, -1, -3, 1, -3, +/* 6 */ -3, -3, -1, 3, 3, 3, -3, 3, -3, 1, -1, -3, +/* 7 */ -3, 3, -3, 3, 3, -3, -1, -1, 3, 3, 1, -3, +/* 8 */ -3, -1, -3, -1, -1, -3, 3, 3, -1, -1, 1, -3, +/* 9 */ -3, 3, 3, 3, -1, -3, -3, -1, -3, 1, 3, -3, +/* 10 */ 1, 3, -3, 1, 3, 3, 3, 1, -1, 1, -1, 3, +/* 11 */ -1, -3, 3, -1, -3, -3, -3, -1, 1, -1, 1, -3, +/* 12 */ 3, 1, 3, 1, 3, -3, -1, 1, 3, 1, -1, -3, +/* 13 */ -3, -3, 3, 3, 3, -3, -1, 1, -3, 3, 1, -3, +/* 14 */ -3, -1, 1, -3, 1, 3, 3, 3, -1, -3, 3, 3, +/* 15 */ -3, -3, 3, 1, -3, -3, -3, -1, 3, -1, 1, 3, +/* 16 */ -1, 1, 3, -3, 1, -1, 1, -1, -1, -3, 1, -1, +/* 17 */ -3, -1, -1, 1, 3, 1, 1, -1, 1, -1, -3, 1, +/* 18 */ -3, -1, 3, -3, -3, -1, -3, 1, -1, -3, 3, 3, +/* 19 */ -3, -3, 3, -3, -1, 3, 3, 3, -1, -3, 1, -3, +/* 20 */ -3, 1, -1, -1, 3, 3, -3, -1, -1, -3, -1, -3, +/* 21 */ -3, 1, 3, 3, -1, -1, -3, 3, 3, -3, 3, -3, +/* 22 */ -3, -1, -1, -3, -3, -1, -3, 3, 1, 3, -1, -3, +/* 23 */ -3, -1, 3, 1, -3, -1, -3, 3, 1, 3, 3, 1, +/* 24 */ -3, 3, 3, 1, -3, 3, -1, 1, 3, -3, 3, -3, +/* 25 */ 3, -1, -3, 3, -3, -1, 3, 3, 3, -3, -1, -3, +/* 26 */ 1, -1, 3, -1, -1, -1, -3, -1, 1, 1, 1, -3, +/* 27 */ -3, 3, 1, -3, 1, 3, -1, -1, 1, 3, 3, 3, +/* 28 */ -3, 3, -3, 3, -3, -3, 3, -1, -1, 1, 3, -3, +/* 29 */ -3, 3, 1, -1, 3, 3, -3, 1, -1, 1, -1, 1, +} +; int16_t *base_sequence_less_than_36(unsigned int M_ZC, unsigned int u, unsigned int scaling) diff --git a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h index 44d30da8f3..0e17e2b3f3 100644 --- a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h +++ b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h @@ -58,7 +58,7 @@ #define INDEX_SB_LESS_32 (4) /* index of dftsizes array for which subcarrier number is less than 36 */ -const uint16_t ul_allocated_re[SRS_SB_CONF] /* number of uplink allocated resource elements */ +EXTERN const uint16_t ul_allocated_re[SRS_SB_CONF] /* number of uplink allocated resource elements */ /* this table is derivated from TS 38.211 Table 6.4.1.4.3-1: SRS bandwidth configuration which gives m_SRS_b then all possible values of sequence length is */ /* M_sc_b_SRS = m_SRS_b * N_SC_RB/K_TC with K_TC = 2 or K_TC = 4 as specified in TS 38.211 6.4.1.4.3 */ #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H @@ -82,7 +82,7 @@ m_SRS_b 224 116, 240 256 264 272 144 152 160 168 176 184 ; /* table of largest prime number lower than uplink allocated resource elements "ul_allocated_re" */ -const uint16_t ref_ul_primes[SRS_SB_CONF] +EXTERN const uint16_t ref_ul_primes[SRS_SB_CONF] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 6, 12, 18, 24, 30, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 168, 180, 192, 204, 216, 228, 240, */ @@ -101,10 +101,10 @@ const uint16_t ref_ul_primes[SRS_SB_CONF] ; /* Low-PAPR base sequence; see TS 38.211 clause 5.2.2 */ -int16_t *rv_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][SRS_SB_CONF]; +EXTERN int16_t *rv_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][SRS_SB_CONF]; /* 38.211 table Table 5.2.2.2-1: Definition of phi(n) for M_ZC = 6 */ -const char phi_M_ZC_6[6*U_GROUP_NUMBER] +EXTERN const char phi_M_ZC_6[6*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 */ @@ -141,47 +141,9 @@ const char phi_M_ZC_6[6*U_GROUP_NUMBER] } #endif ; -/* Table 5.2.2.2-2: Definition of phi ( n ) for M ZC = 12 */ -const char phi_M_ZC_12[12*U_GROUP_NUMBER] -#ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H -= { -/* 0 1 2 3 4 5 6 7 8 9 10 11 */ -/* 0 */ 1, -1, 3, 1, 1, -1, -1, -1, 1, 3, -3, 1, -/* 1 */ -1, -1, -1, -1, 1, -3, -1, 3, 3, -1, -3, 1, -/* 2 */ -3, 1, -3, -3, -3, 3, -3, -1, 1, 1, 1, -3, -/* 3 */ -3, 3, 1, 3, -3, 1, 1, 1, 1, 3, -3, 3, -/* 4 */ -3, 1, 3, -1, -1, -3, -3, -1, -1, 3, 1, -3, -/* 5 */ -1, 1, 1, -1, 1, 3, 3, -1, -1, -3, 1, -3, -/* 6 */ -3, -3, -1, 3, 3, 3, -3, 3, -3, 1, -1, -3, -/* 7 */ -3, 3, -3, 3, 3, -3, -1, -1, 3, 3, 1, -3, -/* 8 */ -3, -1, -3, -1, -1, -3, 3, 3, -1, -1, 1, -3, -/* 9 */ -3, 3, 3, 3, -1, -3, -3, -1, -3, 1, 3, -3, -/* 10 */ 1, 3, -3, 1, 3, 3, 3, 1, -1, 1, -1, 3, -/* 11 */ -1, -3, 3, -1, -3, -3, -3, -1, 1, -1, 1, -3, -/* 12 */ 3, 1, 3, 1, 3, -3, -1, 1, 3, 1, -1, -3, -/* 13 */ -3, -3, 3, 3, 3, -3, -1, 1, -3, 3, 1, -3, -/* 14 */ -3, -1, 1, -3, 1, 3, 3, 3, -1, -3, 3, 3, -/* 15 */ -3, -3, 3, 1, -3, -3, -3, -1, 3, -1, 1, 3, -/* 16 */ -1, 1, 3, -3, 1, -1, 1, -1, -1, -3, 1, -1, -/* 17 */ -3, -1, -1, 1, 3, 1, 1, -1, 1, -1, -3, 1, -/* 18 */ -3, -1, 3, -3, -3, -1, -3, 1, -1, -3, 3, 3, -/* 19 */ -3, -3, 3, -3, -1, 3, 3, 3, -1, -3, 1, -3, -/* 20 */ -3, 1, -1, -1, 3, 3, -3, -1, -1, -3, -1, -3, -/* 21 */ -3, 1, 3, 3, -1, -1, -3, 3, 3, -3, 3, -3, -/* 22 */ -3, -1, -1, -3, -3, -1, -3, 3, 1, 3, -1, -3, -/* 23 */ -3, -1, 3, 1, -3, -1, -3, 3, 1, 3, 3, 1, -/* 24 */ -3, 3, 3, 1, -3, 3, -1, 1, 3, -3, 3, -3, -/* 25 */ 3, -1, -3, 3, -3, -1, 3, 3, 3, -3, -1, -3, -/* 26 */ 1, -1, 3, -1, -1, -1, -3, -1, 1, 1, 1, -3, -/* 27 */ -3, 3, 1, -3, 1, 3, -1, -1, 1, 3, 3, 3, -/* 28 */ -3, 3, -3, 3, -3, -3, 3, -1, -1, 1, 3, -3, -/* 29 */ -3, 3, 1, -1, 3, 3, -3, 1, -1, 1, -1, 1, -} -#endif -; /* Table 5.2.2.2-3: Definition of phi (n ) for M_ZC = 18 */ -const char phi_M_ZC_18[18*U_GROUP_NUMBER] +EXTERN const char phi_M_ZC_18[18*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 */ @@ -220,7 +182,7 @@ const char phi_M_ZC_18[18*U_GROUP_NUMBER] ; /* Table 5.2.2.2-4: Definition of phi (n ) for M_ZC = 24 */ -const char phi_M_ZC_24[24*U_GROUP_NUMBER] +EXTERN const char phi_M_ZC_24[24*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 */ @@ -260,10 +222,10 @@ const char phi_M_ZC_24[24*U_GROUP_NUMBER] /************** FUNCTION ******************************************/ -int16_t *base_sequence_36_or_larger(unsigned int M_ZC, unsigned int u, unsigned int v, unsigned int scaling, unsigned int if_dmrs_seq); +EXTERN int16_t *base_sequence_36_or_larger(unsigned int M_ZC, unsigned int u, unsigned int v, unsigned int scaling, unsigned int if_dmrs_seq); -int16_t *base_sequence_less_than_36(unsigned int M_ZC, unsigned int u, unsigned int scaling); +EXTERN int16_t *base_sequence_less_than_36(unsigned int M_ZC, unsigned int u, unsigned int scaling); /*! \brief This function generate the sounding reference symbol (SRS) for the uplink. @param tables of srs @@ -278,7 +240,7 @@ void free_ul_reference_signal_sequences(void); #define MAX_INDEX_DMRS_UL_ALLOCATED_REs 53 -const uint16_t dmrs_ul_allocated_res[MAX_INDEX_DMRS_UL_ALLOCATED_REs] +EXTERN const uint16_t dmrs_ul_allocated_res[MAX_INDEX_DMRS_UL_ALLOCATED_REs] /* Number of possible DMRS REs based on PRBs allocated for PUSCH. Array has values until 273 RBs (100Mhz BW) Number of PUSCH RBs allocated should be able to be expressed as 2topowerofn*3topowerofn*5tothepowerofn According to 3GPP spec 38.211 section 6.3.1.4 @@ -307,7 +269,7 @@ const uint16_t dmrs_ul_allocated_res[MAX_INDEX_DMRS_UL_ALLOCATED_REs] /* Table of largest prime number N_ZC < possible DMRS REs M_ZC, this array has values until 100Mhz According to 3GPP spec 38.211 section 5.2.2.1 Table used in calculating DMRS low papr type1 sequence for transform precoding */ -const uint16_t dmrs_ref_ul_primes[MAX_INDEX_DMRS_UL_ALLOCATED_REs] +EXTERN const uint16_t dmrs_ref_ul_primes[MAX_INDEX_DMRS_UL_ALLOCATED_REs] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /*DMRS REs 6, 12, 18, 24, 30, 36, 48, 54, 60, 72, 90, 96, */ @@ -331,8 +293,8 @@ const uint16_t dmrs_ref_ul_primes[MAX_INDEX_DMRS_UL_ALLOCATED_REs] ; /// PUSCH DMRS for transform precoding -int16_t *gNB_dmrs_lowpaprtype1_sequence[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; -int16_t *dmrs_lowpaprtype1_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; +EXTERN int16_t *gNB_dmrs_lowpaprtype1_sequence[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; +EXTERN int16_t *dmrs_lowpaprtype1_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; int16_t get_index_for_dmrs_lowpapr_seq(int16_t num_dmrs_res); void generate_lowpapr_typ1_refsig_sequences(unsigned int scaling); void free_gnb_lowpapr_sequences(void); diff --git a/openair1/PHY/TOOLS/lte_enb_scope.c b/openair1/PHY/TOOLS/lte_enb_scope.c index 19e135ae56..220df5b54a 100644 --- a/openair1/PHY/TOOLS/lte_enb_scope.c +++ b/openair1/PHY/TOOLS/lte_enb_scope.c @@ -44,7 +44,6 @@ FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; char title[255]; unsigned char scope_enb_num_ue = 2; static pthread_t forms_thread; //xforms -int otg_enabled=0; void reset_stats(FL_OBJECT *button, long arg) { int i,j,k; @@ -131,7 +130,7 @@ int enbscope_autoinit(void) { sprintf (title, "LTE UL SCOPE eNB for CC_id %d, UE %d",CC_id,UE_id); fl_show_form (form_enb[CC_id][UE_id]->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); - if (otg_enabled) { + if (0) { fl_set_button(form_enb[CC_id][UE_id]->button_0,1); fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic ON"); } else { diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c index 4aa21b47e8..6852000ca9 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.c +++ b/openair1/PHY/TOOLS/lte_phy_scope.c @@ -27,7 +27,6 @@ #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" #define TPUT_WINDOW_LENGTH 100 -int otg_enabled; FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW}; @@ -57,11 +56,9 @@ static void ia_receiver_on_off( FL_OBJECT *button, long arg) { static void dl_traffic_on_off( FL_OBJECT *button, long arg) { if (fl_get_button(button)) { fl_set_object_label(button, "DL Traffic ON"); - otg_enabled = 1; fl_set_object_color(button, FL_GREEN, FL_GREEN); } else { fl_set_object_label(button, "DL Traffic OFF"); - otg_enabled = 0; fl_set_object_color(button, FL_RED, FL_RED); } } @@ -131,7 +128,6 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) { fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 20, 600, 240, 40, "" ); fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER ); fl_set_button(fdui->button_0,0); - otg_enabled = 0; fl_set_object_label(fdui->button_0, "DL Traffic OFF"); fl_set_object_color(fdui->button_0, FL_RED, FL_RED); fl_set_object_callback(fdui->button_0, dl_traffic_on_off, 0 ); diff --git a/openair1/PHY/TOOLS/time_meas.c b/openair1/PHY/TOOLS/time_meas.c index cfa3b93007..396674333a 100644 --- a/openair1/PHY/TOOLS/time_meas.c +++ b/openair1/PHY/TOOLS/time_meas.c @@ -27,16 +27,19 @@ // global var for openair performance profiler int opp_enabled = 0; +double cpu_freq_GHz __attribute__ ((aligned(32)))=0.0; double get_cpu_freq_GHz(void) { - time_stats_t ts = {0}; - reset_meas(&ts); - ts.trials++; - ts.in = rdtsc_oai(); - sleep(1); - ts.diff = (rdtsc_oai()-ts.in); - cpu_freq_GHz = (double)ts.diff/1000000000; - printf("CPU Freq is %f \n", cpu_freq_GHz); + if (cpu_freq_GHz <1 ) { + time_stats_t ts = {0}; + reset_meas(&ts); + ts.trials++; + ts.in = rdtsc_oai(); + sleep(1); + ts.diff = (rdtsc_oai()-ts.in); + cpu_freq_GHz = (double)ts.diff/1000000000; + printf("CPU Freq is %f \n", cpu_freq_GHz); + } return cpu_freq_GHz; } diff --git a/openair1/PHY/TOOLS/time_meas.h b/openair1/PHY/TOOLS/time_meas.h index 2deab40f27..fc929bcd1c 100644 --- a/openair1/PHY/TOOLS/time_meas.h +++ b/openair1/PHY/TOOLS/time_meas.h @@ -33,7 +33,6 @@ #include // global var to enable openair performance profiler extern int opp_enabled; -double cpu_freq_GHz __attribute__ ((aligned(32)));; #if defined(__x86_64__) || defined(__i386__) typedef struct { diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/impl_defs_nr.h index ceb75c2554..fad578c8b0 100644 --- a/openair1/PHY/impl_defs_nr.h +++ b/openair1/PHY/impl_defs_nr.h @@ -214,10 +214,8 @@ typedef enum { #define NB_SRS_PERIOD (17) -const uint16_t srs_period[NB_SRS_PERIOD] -#ifdef INIT_VARIABLES_PHY_IMPLEMENTATION_DEFS_NR_H +static const uint16_t srs_period[NB_SRS_PERIOD] = { 1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 160, 320, 640, 1280, 2560} -#endif ; /// SRS_Resource of SRS_Config information element from 38.331 RRC specifications @@ -796,7 +794,6 @@ typedef struct { uint8_t initial_CS_indexes[MAX_NB_CYCLIC_SHIFT]; } initial_pucch_resource_t; -const initial_pucch_resource_t initial_pucch_resource[NB_INITIAL_PUCCH_RESOURCE]; /* TS 36.213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */ /* structure with all possible fields for pucch format from 0 to 4 */ typedef struct { @@ -1051,11 +1048,6 @@ typedef struct { #define NB_SR_PERIOD (15) -const uint16_t scheduling_request_periodicity[NB_SR_PERIOD] -#ifdef INIT_VARIABLES_PHY_IMPLEMENTATION_DEFS_NR_H -= { 0, 0, 1, 2, 4, 5, 8, 10, 16, 20, 40, 80, 160, 320, 640 } -#endif -; typedef enum { sr_sym2 = 0, diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 38307a7b9e..e1af4e31ac 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -51,7 +51,7 @@ #define MBMS_NFAPI_SCHEDULER -nfapi_ue_release_request_body_t release_rntis; +extern nfapi_ue_release_request_body_t release_rntis; int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t UE_id,uint8_t harq_pid, uint8_t bw_factor) { uint32_t Nre,sumKr,MPR_x100,Kr,r; diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c index edb070f873..560c7b9383 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c @@ -40,6 +40,7 @@ #include #include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" #include "openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h" +#include #ifndef NO_RAT_NR @@ -54,10 +55,172 @@ #endif +/* TS 36.213 Table 9.2.3-3: Mapping of values for one HARQ-ACK bit to sequences */ +static const int sequence_cyclic_shift_1_harq_ack_bit[2] +/* HARQ-ACK Value 0 1 */ +/* Sequence cyclic shift */ = { 0, 6 } +; + +/* TS 36.213 Table 9.2.5-2: Mapping of values for two HARQ-ACK bits and positive SR to sequences */ +static const int sequence_cyclic_shift_2_harq_ack_bits_positive_sr[4] +/* HARQ-ACK Value (0,0) (0,1) (1,0) (1,1) */ +/* Sequence cyclic shift */ = { 1, 4, 10, 7 } +; + uint8_t nr_is_cqi_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id); uint8_t nr_is_ri_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id); +static const uint16_t scheduling_request_periodicity[NB_SR_PERIOD] += { 0, 0, 1, 2, 4, 5, 8, 10, 16, 20, 40, 80, 160, 320, 640 } +; + +/* TS 38.213 9.2.5.2 UE procedure for multiplexing HARQ-ACK/SR and CSI in a PUCCH */ +/* this is a counter of number of pucch format 4 per subframe */ +static int nb_pucch_format_4_in_subframes[LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] = { 0 } ; + +/* TS 36.213 Table 9.2.5.2-1: Code rate corresponding to higher layer parameter PUCCH-F2-maximum-coderate, */ +/* or PUCCH-F3-maximum-coderate, or PUCCH-F4-maximum-coderate */ +/* add one additional element set to 0 for parsing the array until this end */ +/* stored values are code rates * 100 */ +//static const int code_rate_r_time_100[8] = { (0.08 * 100), (0.15 * 100), (0.25*100), (0.35*100), (0.45*100), (0.60*100), (0.80*100), 0 } ; + +/* TS 38.213 Table 9.2.3-4: Mapping of values for two HARQ-ACK bits to sequences */ +static const int sequence_cyclic_shift_2_harq_ack_bits[4] +/* HARQ-ACK Value (0,0) (0,1) (1,0) (1,1) */ +/* Sequence cyclic shift */ = { 0, 3, 9, 6 } +; + +/* TS 38.211 Table 6.4.1.3.3.2-1: DM-RS positions for PUCCH format 3 and 4 */ +static const int nb_symbols_excluding_dmrs[NB_SYMBOL_MINUS_FOUR][2][2] += { +/* No additional DMRS Additional DMRS */ +/* PUCCH length No hopping hopping No hopping hopping */ +/* index 0 1 0 1 */ +/* 4 */ {{ 3 , 2 } , { 3 , 2 }}, +/* 5 */ {{ 3 , 3 } , { 3 , 3 }}, +/* 6 */ {{ 4 , 4 } , { 4 , 4 }}, +/* 7 */ {{ 5 , 5 } , { 5 , 5 }}, +/* 8 */ {{ 6 , 6 } , { 6 , 6 }}, +/* 9 */ {{ 7 , 7 } , { 7 , 7 }}, +/* 10 */ {{ 8 , 8 } , { 6 , 6 }}, +/* 11 */ {{ 9 , 9 } , { 7 , 7 }}, +/* 12 */ {{ 10 , 10 } , { 8 , 8 }}, +/* 13 */ {{ 11 , 11 } , { 9 , 9 }}, +/* 14 */ {{ 12 , 12 } , { 10 , 10 }}, +} +; + + +/* TS 36.213 Table 9.2.5-1: Mapping of values for one HARQ-ACK bit and positive SR to sequences */ +static const int sequence_cyclic_shift_1_harq_ack_bit_positive_sr[2] +/* HARQ-ACK Value 0 1 */ +/* Sequence cyclic shift */ = { 3, 9 } +; + +static float RSRP_meas_mapping_nr[98] += { + -140, + -139, + -138, + -137, + -136, + -135, + -134, + -133, + -132, + -131, + -130, + -129, + -128, + -127, + -126, + -125, + -124, + -123, + -122, + -121, + -120, + -119, + -118, + -117, + -116, + -115, + -114, + -113, + -112, + -111, + -110, + -109, + -108, + -107, + -106, + -105, + -104, + -103, + -102, + -101, + -100, + -99, + -98, + -97, + -96, + -95, + -94, + -93, + -92, + -91, + -90, + -89, + -88, + -87, + -86, + -85, + -84, + -83, + -82, + -81, + -80, + -79, + -78, + -77, + -76, + -75, + -74, + -73, + -72, + -71, + -70, + -69, + -68, + -67, + -66, + -65, + -64, + -63, + -62, + -61, + -60, + -59, + -58, + -57, + -56, + -55, + -54, + -53, + -52, + -51, + -50, + -49, + -48, + -47, + -46, + -45, + -44, + -43 + } + ; + long binary_search_float_nr( float elements[], @@ -202,6 +365,30 @@ void nr_generate_pucch3_4(int32_t **txdataF, * *********************************************************************/ +/* TS 36.213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */ +const initial_pucch_resource_t initial_pucch_resource[NB_INITIAL_PUCCH_RESOURCE] += +{ +/* format first symbol Number of symbols PRB offset nb index for set of initial CS */ +/* 0 */ { pucch_format0_nr, 12, 2, 0, 2, { 0, 3, 0, 0 } }, +/* 1 */ { pucch_format0_nr, 12, 2, 0, 3, { 0, 4, 8, 0 } }, +/* 2 */ { pucch_format0_nr, 12, 2, 3, 3, { 0, 4, 8, 0 } }, +/* 3 */ { pucch_format1_nr, 10, 4, 0, 2, { 0, 6, 0, 0 } }, +/* 4 */ { pucch_format1_nr, 10, 4, 0, 4, { 0, 3, 6, 9 } }, +/* 5 */ { pucch_format1_nr, 10, 4, 2, 4, { 0, 3, 6, 9 } }, +/* 6 */ { pucch_format1_nr, 10, 4, 4, 4, { 0, 3, 6, 9 } }, +/* 7 */ { pucch_format1_nr, 4, 10, 0, 2, { 0, 6, 0, 0 } }, +/* 8 */ { pucch_format1_nr, 4, 10, 0, 4, { 0, 3, 6, 9 } }, +/* 9 */ { pucch_format1_nr, 4, 10, 2, 4, { 0, 3, 6, 9 } }, +/* 10 */ { pucch_format1_nr, 4, 10, 4, 4, { 0, 3, 6, 9 } }, +/* 11 */ { pucch_format1_nr, 0, 14, 0, 2, { 0, 6, 0, 0 } }, +/* 12 */ { pucch_format1_nr, 0, 14, 0, 4, { 0, 3, 6, 9 } }, +/* 13 */ { pucch_format1_nr, 0, 14, 2, 4, { 0, 3, 6, 9 } }, +/* 14 */ { pucch_format1_nr, 0, 14, 4, 4, { 0, 3, 6, 9 } }, +/* 15 */ { pucch_format1_nr, 0, 14, 0, 4, { 0, 3, 6, 9 } }, +} +; + bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t *proc, bool reset_harq) { uint8_t sr_payload = 0; diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h index 9b53331f50..97d8d73282 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h @@ -60,214 +60,12 @@ /************** VARIABLES *****************************************/ -float RSRP_meas_mapping_nr[98] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= { - -140, - -139, - -138, - -137, - -136, - -135, - -134, - -133, - -132, - -131, - -130, - -129, - -128, - -127, - -126, - -125, - -124, - -123, - -122, - -121, - -120, - -119, - -118, - -117, - -116, - -115, - -114, - -113, - -112, - -111, - -110, - -109, - -108, - -107, - -106, - -105, - -104, - -103, - -102, - -101, - -100, - -99, - -98, - -97, - -96, - -95, - -94, - -93, - -92, - -91, - -90, - -89, - -88, - -87, - -86, - -85, - -84, - -83, - -82, - -81, - -80, - -79, - -78, - -77, - -76, - -75, - -74, - -73, - -72, - -71, - -70, - -69, - -68, - -67, - -66, - -65, - -64, - -63, - -62, - -61, - -60, - -59, - -58, - -57, - -56, - -55, - -54, - -53, - -52, - -51, - -50, - -49, - -48, - -47, - -46, - -45, - -44, - -43 - } - #endif - ; - -/* TS 36.213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */ -const initial_pucch_resource_t initial_pucch_resource[NB_INITIAL_PUCCH_RESOURCE] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= -{ -/* format first symbol Number of symbols PRB offset nb index for set of initial CS */ -/* 0 */ { pucch_format0_nr, 12, 2, 0, 2, { 0, 3, 0, 0 } }, -/* 1 */ { pucch_format0_nr, 12, 2, 0, 3, { 0, 4, 8, 0 } }, -/* 2 */ { pucch_format0_nr, 12, 2, 3, 3, { 0, 4, 8, 0 } }, -/* 3 */ { pucch_format1_nr, 10, 4, 0, 2, { 0, 6, 0, 0 } }, -/* 4 */ { pucch_format1_nr, 10, 4, 0, 4, { 0, 3, 6, 9 } }, -/* 5 */ { pucch_format1_nr, 10, 4, 2, 4, { 0, 3, 6, 9 } }, -/* 6 */ { pucch_format1_nr, 10, 4, 4, 4, { 0, 3, 6, 9 } }, -/* 7 */ { pucch_format1_nr, 4, 10, 0, 2, { 0, 6, 0, 0 } }, -/* 8 */ { pucch_format1_nr, 4, 10, 0, 4, { 0, 3, 6, 9 } }, -/* 9 */ { pucch_format1_nr, 4, 10, 2, 4, { 0, 3, 6, 9 } }, -/* 10 */ { pucch_format1_nr, 4, 10, 4, 4, { 0, 3, 6, 9 } }, -/* 11 */ { pucch_format1_nr, 0, 14, 0, 2, { 0, 6, 0, 0 } }, -/* 12 */ { pucch_format1_nr, 0, 14, 0, 4, { 0, 3, 6, 9 } }, -/* 13 */ { pucch_format1_nr, 0, 14, 2, 4, { 0, 3, 6, 9 } }, -/* 14 */ { pucch_format1_nr, 0, 14, 4, 4, { 0, 3, 6, 9 } }, -/* 15 */ { pucch_format1_nr, 0, 14, 0, 4, { 0, 3, 6, 9 } }, -} -#endif -; - -/* TS 36.213 Table 9.2.3-3: Mapping of values for one HARQ-ACK bit to sequences */ -const int sequence_cyclic_shift_1_harq_ack_bit[2] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -/* HARQ-ACK Value 0 1 */ -/* Sequence cyclic shift */ = { 0, 6 } -#endif -; - -/* TS 38.213 Table 9.2.3-4: Mapping of values for two HARQ-ACK bits to sequences */ -const int sequence_cyclic_shift_2_harq_ack_bits[4] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -/* HARQ-ACK Value (0,0) (0,1) (1,0) (1,1) */ -/* Sequence cyclic shift */ = { 0, 3, 9, 6 } -#endif -; - -/* TS 36.213 Table 9.2.5-1: Mapping of values for one HARQ-ACK bit and positive SR to sequences */ -const int sequence_cyclic_shift_1_harq_ack_bit_positive_sr[2] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -/* HARQ-ACK Value 0 1 */ -/* Sequence cyclic shift */ = { 3, 9 } -#endif -; - -/* TS 36.213 Table 9.2.5-2: Mapping of values for two HARQ-ACK bits and positive SR to sequences */ -const int sequence_cyclic_shift_2_harq_ack_bits_positive_sr[4] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -/* HARQ-ACK Value (0,0) (0,1) (1,0) (1,1) */ -/* Sequence cyclic shift */ = { 1, 4, 10, 7 } -#endif -; - -/* TS 36.213 Table 9.2.5.2-1: Code rate corresponding to higher layer parameter PUCCH-F2-maximum-coderate, */ -/* or PUCCH-F3-maximum-coderate, or PUCCH-F4-maximum-coderate */ -/* add one additional element set to 0 for parsing the array until this end */ -/* stored values are code rates * 100 */ -const int code_rate_r_time_100[8] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= { (0.08 * 100), (0.15 * 100), (0.25*100), (0.35*100), (0.45*100), (0.60*100), (0.80*100), 0 } -#endif -; - #define NB_SYMBOL_MINUS_FOUR (11) #define I_PUCCH_NO_ADDITIONAL_DMRS (0) #define I_PUCCH_ADDITIONAL_DMRS (1) #define I_PUCCH_NO_HOPPING (0) #define I_PUCCH_HOPING (1) -/* TS 38.211 Table 6.4.1.3.3.2-1: DM-RS positions for PUCCH format 3 and 4 */ -const int nb_symbols_excluding_dmrs[NB_SYMBOL_MINUS_FOUR][2][2] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= { -/* No additional DMRS Additional DMRS */ -/* PUCCH length No hopping hopping No hopping hopping */ -/* index 0 1 0 1 */ -/* 4 */ {{ 3 , 2 } , { 3 , 2 }}, -/* 5 */ {{ 3 , 3 } , { 3 , 3 }}, -/* 6 */ {{ 4 , 4 } , { 4 , 4 }}, -/* 7 */ {{ 5 , 5 } , { 5 , 5 }}, -/* 8 */ {{ 6 , 6 } , { 6 , 6 }}, -/* 9 */ {{ 7 , 7 } , { 7 , 7 }}, -/* 10 */ {{ 8 , 8 } , { 6 , 6 }}, -/* 11 */ {{ 9 , 9 } , { 7 , 7 }}, -/* 12 */ {{ 10 , 10 } , { 8 , 8 }}, -/* 13 */ {{ 11 , 11 } , { 9 , 9 }}, -/* 14 */ {{ 12 , 12 } , { 10 , 10 }}, -} -#endif -; - -/* TS 38.213 9.2.5.2 UE procedure for multiplexing HARQ-ACK/SR and CSI in a PUCCH */ -/* this is a counter of number of pucch format 4 per subframe */ -int nb_pucch_format_4_in_subframes[LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= { 0 } -#endif -; /*************** FUNCTIONS ****************************************/ diff --git a/openair1/SIMULATION/LTE_PHY/common_sim.h b/openair1/SIMULATION/LTE_PHY/common_sim.h index 796a576aed..5e0be3de89 100644 --- a/openair1/SIMULATION/LTE_PHY/common_sim.h +++ b/openair1/SIMULATION/LTE_PHY/common_sim.h @@ -46,13 +46,13 @@ void sumUpStatsSlot(time_stats_t *res, time_stats_t src[RX_NB_TH][2], int lastAc } double squareRoot(time_stats_t *ptr) { - double timeBase=1/(1000*cpu_freq_GHz); + double timeBase=1/(1000*get_cpu_freq_GHz()); return sqrt((double)ptr->diff_square*pow(timeBase,2)/ptr->trials - pow((double)ptr->diff/ptr->trials*timeBase,2)); } void printDistribution(time_stats_t *ptr, varArray_t *sortedList, char *txt) { - double timeBase=1/(1000*cpu_freq_GHz); + double timeBase=1/(1000*get_cpu_freq_GHz()); printf("%-43s %6.2f us (%d trials)\n", txt, (double)ptr->diff/ptr->trials*timeBase, @@ -69,7 +69,7 @@ void printStatIndent(time_stats_t *ptr, char *txt) { } void printStatIndent2(time_stats_t *ptr, char *txt) { - double timeBase=1/(1000*cpu_freq_GHz); + double timeBase=1/(1000*get_cpu_freq_GHz()); printf(" |__ %-34s %6.2f us (%3d trials)\n", txt, ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0, @@ -77,7 +77,7 @@ void printStatIndent2(time_stats_t *ptr, char *txt) { } void printStatIndent3(time_stats_t *ptr, char *txt) { - double timeBase=1/(1000*cpu_freq_GHz); + double timeBase=1/(1000*get_cpu_freq_GHz()); printf(" |__ %-30s %6.2f us (%3d trials)\n", txt, ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0, diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 667913d377..23a23c26be 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -65,11 +65,14 @@ void feptx_ofdm(RU_t *ru, int frame, int subframe); void feptx_prec(RU_t *ru, int frame, int subframe); double cpuf; -#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) +#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) //#define MCS_COUNT 23//added for PHY abstraction #include int otg_enabled=0; +THREAD_STRUCT thread_struct; +nfapi_ue_release_request_body_t release_rntis; + /*the following parameters are used to control the processing times calculations*/ double t_tx_max = -1000000000; /*!< \brief initial max process time for tx */ double t_rx_max = -1000000000; /*!< \brief initial max process time for rx */ diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 80beee4bed..53a23d7575 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -57,7 +57,7 @@ #include "executables/split_headers.h" double cpuf; -#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) +#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) //#define MCS_COUNT 23//added for PHY abstraction #include channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX]; @@ -70,6 +70,9 @@ node_desc_t *ue_data[NUMBER_OF_UE_MAX]; extern uint16_t beta_ack[16],beta_ri[16],beta_cqi[16]; //extern char* namepointer_chMag ; int xforms=0; +THREAD_STRUCT thread_struct; +nfapi_ue_release_request_body_t release_rntis; + FD_lte_phy_scope_enb *form_enb; char title[255]; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 0a7ae96e09..da4db6a131 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -63,7 +63,7 @@ //#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" #include "PHY/NR_REFSIG/ptrs_nr.h" #include "NR_RRCReconfiguration.h" -#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) +#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) #include "SIMULATION/LTE_PHY/common_sim.h" #include @@ -83,6 +83,10 @@ uint16_t sf_ahead=4 ; uint16_t sl_ahead=0; //uint8_t nfapi_mode = 0; uint64_t downlink_frequency[MAX_NUM_CCs][4]; +THREAD_STRUCT thread_struct; +nfapi_ue_release_request_body_t release_rntis; +msc_interface_t msc_interface; + // dummy functions int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); } diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index efbc40cd55..a6e07b67df 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -65,6 +65,7 @@ extern uint16_t prach_root_sequence_map0_3[838]; openair0_config_t openair0_cfg[MAX_CARDS]; //uint8_t nfapi_mode=0; uint16_t sl_ahead = 0; +msc_interface_t msc_interface; //void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index fce690ebd2..bc0cec3fbc 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -57,7 +57,7 @@ #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "common/utils/threadPool/thread-pool.h" #include "PHY/NR_REFSIG/ptrs_nr.h" -#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) +#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) #include "SIMULATION/LTE_PHY/common_sim.h" #include @@ -81,6 +81,9 @@ uint16_t sl_ahead=0; double cpuf; //uint8_t nfapi_mode = 0; uint64_t downlink_frequency[MAX_NUM_CCs][4]; +THREAD_STRUCT thread_struct; +nfapi_ue_release_request_body_t release_rntis; +msc_interface_t msc_interface; extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration diff --git a/openair1/SIMULATION/TOOLS/phase_noise.c b/openair1/SIMULATION/TOOLS/phase_noise.c index 5958a0ccdd..1dfd43d8cb 100644 --- a/openair1/SIMULATION/TOOLS/phase_noise.c +++ b/openair1/SIMULATION/TOOLS/phase_noise.c @@ -26,6 +26,7 @@ #include "sim.h" +uint16_t LUTSin[ResolSinCos+1]; /* linear phase noise model */ void phase_noise(double ts, int16_t * InRe, int16_t * InIm) { diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h index 55a78e9778..8776530dde 100644 --- a/openair1/SIMULATION/TOOLS/sim.h +++ b/openair1/SIMULATION/TOOLS/sim.h @@ -468,7 +468,6 @@ double N_RB2channel_bandwidth(uint16_t N_RB); */ //look-up table for the sine (cosine) function #define ResolSinCos 100 -uint16_t LUTSin[ResolSinCos+1]; void InitSinLUT( void ); void phase_noise(double ts, int16_t * InRe, int16_t * InIm); diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h index 9db5d61a11..d6dd6e3b6f 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h @@ -51,8 +51,6 @@ typedef struct { pthread_mutex_t *mutex; } mac_stats_updates_context_t; -/*Array holding the last stats reports for each eNB. Used for continuous reporting*/ -mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB]; /*Functions to initialize and destroy the struct required for the *continuous stats update report*/ diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h index 5f6432732f..a9236af80b 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h @@ -49,8 +49,6 @@ typedef struct /*To Be Extended*/ }rrc_meas_stats; -/* RRC CMI statistics */ -rrc_meas_stats * meas_stats; /* FLEXRAN AGENT-RRC Interface */ diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h index ae690c7124..18d32421dd 100644 --- a/openair2/ENB_APP/flexran_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -70,7 +70,6 @@ typedef struct { pthread_mutex_t *mutex; } stats_updates_context_t; -stats_updates_context_t stats_context[NUM_MAX_ENB]; /********************************** * FlexRAN protocol messages helper diff --git a/openair2/ENB_APP/flexran_agent_net_comm.c b/openair2/ENB_APP/flexran_agent_net_comm.c index 0d1c52096d..568a0e32cc 100644 --- a/openair2/ENB_APP/flexran_agent_net_comm.c +++ b/openair2/ENB_APP/flexran_agent_net_comm.c @@ -30,7 +30,7 @@ #include "common/utils/LOG/log.h" flexran_agent_channel_t *agent_channel[NUM_MAX_ENB][FLEXRAN_AGENT_MAX]; -flexran_agent_channel_instance_t channel_instance; +static flexran_agent_channel_instance_t channel_instance; int flexran_agent_channel_id = 0; int flexran_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority) { diff --git a/openair2/ENB_APP/flexran_agent_ran_api_to_fix.c b/openair2/ENB_APP/flexran_agent_ran_api_to_fix.c new file mode 100644 index 0000000000..a5eb850712 --- /dev/null +++ b/openair2/ENB_APP/flexran_agent_ran_api_to_fix.c @@ -0,0 +1,33 @@ +#include +#include +#include +pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; +uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; + +uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; + diff --git a/openair2/LAYER2/MAC/config_ue.c b/openair2/LAYER2/MAC/config_ue.c index 1c5e706218..79202d87e3 100644 --- a/openair2/LAYER2/MAC/config_ue.c +++ b/openair2/LAYER2/MAC/config_ue.c @@ -85,10 +85,6 @@ void ue_mac_reset(module_id_t module_idP, uint8_t eNB_index) { ue_init_mac(module_idP); //This will hopefully do the rest of the MAC reset procedure } -int32_t **rxdata; -int32_t **txdata; - - int rrc_mac_config_req_ue(module_id_t Mod_idP, int CC_idP, diff --git a/openair2/LAYER2/MAC/defs_NB_IoT.h b/openair2/LAYER2/MAC/defs_NB_IoT.h index 517f01d1b9..78524e104d 100644 --- a/openair2/LAYER2/MAC/defs_NB_IoT.h +++ b/openair2/LAYER2/MAC/defs_NB_IoT.h @@ -537,9 +537,6 @@ typedef struct { // global variables -nprach_parameters_NB_IoT_t nprach_list[3]; -//DLSF Table -DLSF_INFO_t DLSF_information; #endif /*__LAYER2_MAC_DEFS_NB_IoT_H__ */ diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index ee2711c6ef..39c9acb3d3 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -83,9 +83,57 @@ hash_table_t *pdcp_coll_p = NULL; static int mbms_socket = -1; #endif +uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +int pdcp_pc5_sockfd; +struct sockaddr_in prose_ctrl_addr; +struct sockaddr_in prose_pdcp_addr; +struct sockaddr_in pdcp_sin; /* pdcp module parameters and related functions*/ static pdcp_params_t pdcp_params= {0,NULL}; +rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB]; +rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB]; // for noS1 mode +unsigned int pdcp_eNB_UE_instance_to_rnti_index; + +signed int pdcp_2_nas_irq; +pdcp_stats_t UE_pdcp_stats[MAX_MOBILES_PER_ENB]; +pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX]; + +static pdcp_mbms_t pdcp_mbms_array_ue[MAX_MOBILES_PER_ENB][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +static pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +static sdu_size_t pdcp_input_sdu_remaining_size_to_read; +static sdu_size_t pdcp_output_header_bytes_to_write; +static sdu_size_t pdcp_output_sdu_bytes_to_write; +notifiedFIFO_t pdcp_sdu_list; + +pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; + uint64_t get_pdcp_optmask(void) { return pdcp_params.optmask; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index c8ab4499ee..46ffea1ac9 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -91,34 +91,34 @@ extern int pdcp_instance_cnt; int init_pdcp_thread(void); void cleanup_pdcp_thread(void); -uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; -uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +extern uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; -uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +extern uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; void pdcp_update_perioidical_stats(const protocol_ctxt_t *const ctxt_pP); @@ -138,7 +138,7 @@ typedef struct pdcp_enb_s { } pdcp_enb_t; -pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; +extern pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; typedef struct pdcp_stats_s { time_stats_t pdcp_run; @@ -455,10 +455,10 @@ struct pdcp_netlink_element_s { //TTN for D2D (PC5S) #define PDCP_SOCKET_PORT_NO 9999 //temporary value #define PC5_SIGNALLING_PAYLOAD_SIZE 100 //should be updated with a correct value -int pdcp_pc5_sockfd; -struct sockaddr_in prose_ctrl_addr; -struct sockaddr_in prose_pdcp_addr; -struct sockaddr_in pdcp_sin; +extern int pdcp_pc5_sockfd; +extern struct sockaddr_in prose_ctrl_addr; +extern struct sockaddr_in prose_pdcp_addr; +extern struct sockaddr_in pdcp_sin; void pdcp_pc5_socket_init(void); typedef struct { @@ -500,28 +500,18 @@ typedef struct { #define REORDERING_WINDOW_SN_7BIT 64 #define REORDERING_WINDOW_SN_12BIT 2048 -signed int pdcp_2_nas_irq; -pdcp_stats_t UE_pdcp_stats[MAX_MOBILES_PER_ENB]; -pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX]; +extern signed int pdcp_2_nas_irq; +extern pdcp_stats_t UE_pdcp_stats[MAX_MOBILES_PER_ENB]; +extern pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX]; // for UE code conly -rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB]; -rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB]; // for noS1 mode -unsigned int pdcp_eNB_UE_instance_to_rnti_index; +extern rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB]; +extern rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB]; // for noS1 mode +extern unsigned int pdcp_eNB_UE_instance_to_rnti_index; -pdcp_mbms_t pdcp_mbms_array_ue[MAX_MOBILES_PER_ENB][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -sdu_size_t pdcp_output_sdu_bytes_to_write; -sdu_size_t pdcp_output_header_bytes_to_write; -notifiedFIFO_t pdcp_sdu_list; -int pdcp_sent_a_sdu; -pdcp_data_req_header_t pdcp_input_header; -unsigned char pdcp_input_sdu_buffer[MAX_IP_PACKET_SIZE]; -sdu_size_t pdcp_input_index_header; -sdu_size_t pdcp_input_sdu_size_read; -sdu_size_t pdcp_input_sdu_remaining_size_to_read; +extern notifiedFIFO_t pdcp_sdu_list; #define PDCP_COLL_KEY_VALUE(mODULE_iD, rNTI, iS_eNB, rB_iD, iS_sRB) \ ((hash_key_t)mODULE_iD | \ diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index bf6579955b..cb5f1af28d 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -319,13 +319,15 @@ error: } int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { +/* code useless in this status: return 0 anyways rlc_op_status_t result = 0; - //printf("PROTO_AGENT: handling the data_req_ack message\n"); + printf("PROTO_AGENT: handling the data_req_ack message\n"); Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack; result = data_ack->result; - //printf("PROTO_AGENT: ACK RESULT IS %u\n", result); + printf("PROTO_AGENT: ACK RESULT IS %u\n", result); ack_result = result; +*/ return 0; } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h index c805b81543..8f553e05e1 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h @@ -62,7 +62,6 @@ typedef int (*proto_agent_message_destruction_callback)( ); -uint32_t ack_result; /********************************** * progRAN protocol messages helper diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c index 9a63427ed5..925c11c8f8 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c @@ -30,7 +30,7 @@ #include "common/utils/LOG/log.h" proto_agent_channel_t *proto_channel[NUMBER_OF_eNB_MAX][ENB_AGENT_MAX]; -proto_agent_channel_instance_t channel_instance; +static proto_agent_channel_instance_t channel_instance; int proto_agent_channel_id = 0; int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id) { diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c index fda84879be..cf77f9ec37 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c @@ -80,6 +80,8 @@ static int g_send_id_read_index[2]; static struct mac_data_ind g_tx_delayed_indications[MAX_TIME_DELAYED_PDU_DUE_TO_HARQ]; static struct mac_data_ind g_rx_delayed_indications[MAX_TIME_DELAYED_PDU_DUE_TO_HARQ]; +static rlc_um_entity_t um_tx; +static rlc_um_entity_t um_rx; static int8_t *g_sdus[] = {"En dépit de son volontarisme affiché, le premier ministre est de plus en plus décrié pour son incompétence. La tension politique et dans l'opinion publique est encore montée d'un cran au Japon, sur fond d'inquiétantes nouvelles, avec du plutonium détecté dans le sol autour de la centrale de Fukushima. Le premier ministre Naoto Kan a solennellement déclaré que son gouvernement était «en état d'alerte maximum». Tout en reconnaissant que la situation restait «imprévisible». Ce volontarisme affiché par le premier ministre - que Nicolas Sarkozy rencontrera demain lors d'une visite au Japon - ne l'a pas empêché d'être la cible de violentes critiques de la part de parlementaires sur sa gestion de la crise. Attaqué sur le manque de transparence, il a assuré qu'il rendait publiques toutes les informations en sa possession. Un député de l'opposition, Yosuke Isozaki, a aussi reproché à Naoto Kan de ne pas avoir ordonné l'évacuation des populations dans la zone comprise entre 20 et 30 km autour de la centrale. «Peut-il y avoir quelque chose de plus irresponsable que cela ?», a-t-il lancé. Pour l'heure, la zone d'évacuation est limitée à un rayon de 20 km, seul le confinement étant recommandé pour les 10 km suivants. Sur ce sujet, les autorités japonaises ont été fragilisées mardi par les déclarations de Greenpeace, affirmant que ses experts avaient détecté une radioactivité dangereuse à 40 km de la centrale. L'organisation écologiste a appelé à une extension de la zone d'évacuation, exhortant Tokyo à «cesser de privilégier la politique aux dépens de la science». L'Agence japonaise de sûreté nucléaire a balayé ces critiques.", diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h index 6da464aa28..bfde1b31f3 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h @@ -21,8 +21,6 @@ # ifndef __RLC_UM_TEST_H__ # define __RLC_UM_TEST_H__ -rlc_um_entity_t um_tx; -rlc_um_entity_t um_rx; void rlc_um_v9_3_0_test_windows_5(void); void rlc_um_v9_3_0_test_windows_10(void); diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 98c8c3e252..81e8a80748 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -36,6 +36,7 @@ #include "common/utils/LOG/vcd_signal_dumper.h" #include "targets/COMMON/openairinterface5g_limits.h" #include "assertions.h" +#include #include "common/ran_context.h" extern RAN_CONTEXT_t RC; @@ -51,6 +52,24 @@ extern boolean_t pdcp_data_ind( #define DEBUG_RLC_PDCP_INTERFACE 1 //#define TRACE_RLC_PAYLOAD 1 #define DEBUG_RLC_DATA_REQ 1 +void (*rlc_rrc_data_conf)( + const protocol_ctxt_t *const ctxtP, + const rb_id_t rb_idP, + const mui_t muiP, + const rlc_tx_status_t statusP) __attribute__ ((aligned(32))); + +void (*rlc_rrc_data_ind)( + const protocol_ctxt_t *const ctxtP, + const rb_id_t rb_idP, + const sdu_size_t sdu_sizeP, + const uint8_t *const sduP) __attribute__ ((aligned(32))); + +logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +hash_table_t *rlc_coll_p __attribute__ ((aligned(32))); + //----------------------------------------------------------------------------- void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, const signed long sizeP) diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index 7e4920a579..ef5f824ba0 100644 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -133,13 +133,13 @@ typedef struct { #define RLC_MAX_MBMS_LC (LTE_maxSessionPerPMCH * LTE_maxServiceCount) #define RLC_MAX_LC ((max_val_LTE_DRB_Identity+1)* MAX_MOBILES_PER_ENB) -void (*rlc_rrc_data_ind)( +extern void (*rlc_rrc_data_ind)( const protocol_ctxt_t *const ctxtP, const rb_id_t rb_idP, const sdu_size_t sdu_sizeP, const uint8_t *const sduP) __attribute__ ((aligned(32))); -void (*rlc_rrc_data_conf)( +extern void (*rlc_rrc_data_conf)( const protocol_ctxt_t *const ctxtP, const rb_id_t rb_idP, const mui_t muiP, @@ -184,8 +184,8 @@ typedef struct rlc_mbms_id_s { //rlc_mbms_t rlc_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h //rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +extern rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +extern rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h #define rlc_mbms_enb_get_lcid_by_rb_id(Enb_mOD,rB_iD) rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD] ; @@ -201,8 +201,8 @@ rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_ rlc_mbms_rbid2lcid_ue[uE_mOD][rB_iD] = lOG_cH_iD; \ } while (0); -logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ -logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +extern logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +extern logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ #define RLC_COLL_KEY_VALUE(eNB_iD, rNTI, iS_eNB, rB_iD, iS_sRB) \ @@ -250,7 +250,7 @@ logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; (((hash_key_t)(sESSION_ID)) << 37) | \ (((hash_key_t)(0x0000000000000001)) << 63)) -hash_table_t *rlc_coll_p __attribute__ ((aligned(32))); +extern hash_table_t *rlc_coll_p __attribute__ ((aligned(32))); /*! \fn tbs_size_t mac_rlc_serialize_tb (char* bufferP, list_t transport_blocksP) * \brief Serialize a list of transport blocks coming from RLC in order to be processed by MAC. diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 2eb2bae968..88333272cb 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -320,7 +320,6 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind( return ret; } -int oai_emulation; rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index 919d577a18..18285f6563 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -265,7 +265,6 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind( return ret; } -int oai_emulation; rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, diff --git a/openair2/NETWORK_DRIVER/UE_IP/netlink.c b/openair2/NETWORK_DRIVER/UE_IP/netlink.c index 658ae19aba..79fc37ae39 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/netlink.c +++ b/openair2/NETWORK_DRIVER/UE_IP/netlink.c @@ -39,6 +39,7 @@ #include "local.h" #include "proto_extern.h" +MODULE_LICENSE("GPL"); #define OAI_IP_DRIVER_NETLINK_ID 31 #define NL_DEST_PID 1 diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 5b5f3e6b3c..34c7f8ece1 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -41,8 +41,8 @@ #define MAX_IF_MODULES 100 //#define UL_HARQ_PRINT -NR_IF_Module_t *if_inst[MAX_IF_MODULES]; -NR_Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; +static NR_IF_Module_t *nr_if_inst[MAX_IF_MODULES]; +static NR_Sched_Rsp_t NR_Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind); extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind); extern int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *cqi_ind); @@ -178,8 +178,8 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { #endif module_id_t module_id = UL_info->module_id; int CC_id = UL_info->CC_id; - NR_Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id]; - NR_IF_Module_t *ifi = if_inst[module_id]; + NR_Sched_Rsp_t *sched_info = &NR_Sched_INFO[module_id][CC_id]; + NR_IF_Module_t *ifi = nr_if_inst[module_id]; gNB_MAC_INST *mac = RC.nrmac[module_id]; LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rach_pdus:%d rx_ind:%d crcs:%d]\n", UL_info->frame,UL_info->slot, @@ -253,17 +253,17 @@ NR_IF_Module_t *NR_IF_Module_init(int Mod_id) { AssertFatal(Mod_id %d\n",Mod_id,MAX_IF_MODULES); LOG_I(PHY,"Installing callbacks for IF_Module - UL_indication\n"); - if (if_inst[Mod_id]==NULL) { - if_inst[Mod_id] = (NR_IF_Module_t*)malloc(sizeof(NR_IF_Module_t)); - memset((void*)if_inst[Mod_id],0,sizeof(NR_IF_Module_t)); + if (nr_if_inst[Mod_id]==NULL) { + nr_if_inst[Mod_id] = (NR_IF_Module_t*)malloc(sizeof(NR_IF_Module_t)); + memset((void*)nr_if_inst[Mod_id],0,sizeof(NR_IF_Module_t)); - LOG_I(MAC,"Allocating shared L1/L2 interface structure for instance %d @ %p\n",Mod_id,if_inst[Mod_id]); + LOG_I(MAC,"Allocating shared L1/L2 interface structure for instance %d @ %p\n",Mod_id,nr_if_inst[Mod_id]); - if_inst[Mod_id]->CC_mask=0; - if_inst[Mod_id]->NR_UL_indication = NR_UL_indication; - AssertFatal(pthread_mutex_init(&if_inst[Mod_id]->if_mutex,NULL)==0, - "allocation of if_inst[%d]->if_mutex fails\n",Mod_id); + nr_if_inst[Mod_id]->CC_mask=0; + nr_if_inst[Mod_id]->NR_UL_indication = NR_UL_indication; + AssertFatal(pthread_mutex_init(&nr_if_inst[Mod_id]->if_mutex,NULL)==0, + "allocation of nr_if_inst[%d]->if_mutex fails\n",Mod_id); } - return if_inst[Mod_id]; + return nr_if_inst[Mod_id]; } diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c index d98c603d78..38a742bf74 100644 --- a/openair2/PHY_INTERFACE/IF_Module.c +++ b/openair2/PHY_INTERFACE/IF_Module.c @@ -7,8 +7,8 @@ #include "nfapi/oai_integration/vendor_ext.h" #define MAX_IF_MODULES 100 -IF_Module_t *if_inst[MAX_IF_MODULES]; -Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; +static IF_Module_t *if_inst[MAX_IF_MODULES]; +static Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind); extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind); diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 21740016b1..c212075934 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -54,6 +54,7 @@ extern nfapi_tx_request_pdu_t* tx_request_pdu[1023][10][10]; extern uint16_t 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); void Msg3_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h index 547fc2dfc4..26d4aed835 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.h +++ b/openair2/PHY_INTERFACE/phy_stub_UE.h @@ -27,12 +27,11 @@ extern nfapi_dl_config_request_t* dl_config_req; extern nfapi_ul_config_request_t* ul_config_req; extern nfapi_hi_dci0_request_t* hi_dci0_req; -int tx_req_num_elems; +extern int tx_req_num_elems; //below 2 difinitions move to lte-ue.c to add initialization when difinition. //int next_ra_frame; //module_id_t next_Mod_id; -eth_params_t stub_eth_params; diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index c57cec6ba5..e3d28d8a0f 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -330,7 +330,7 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) { preconfigpool->data_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = 0; // 40 ms SL Period preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.present = LTE_SubframeBitmapSL_r12_PR_bs40_r12; - preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = CALLOC(1,5); + preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = CALLOC(5,1); preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = 5; preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = 0; // last 36 subframes for PSCCH @@ -338,7 +338,7 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) { preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[1] = 0xFF; preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[2] = 0xFF; preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[3] = 0xFF; - preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[5] = 0xFF; + preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[4] = 0xFF; preconfigpool->dataHoppingConfig_r12.hoppingParameter_r12 = 0; preconfigpool->dataHoppingConfig_r12.numSubbands_r12 = LTE_SL_HoppingConfigComm_r12__numSubbands_r12_ns1; preconfigpool->dataHoppingConfig_r12.rb_Offset_r12 = 0; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index f373d74230..7e1c68ae4e 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -72,6 +72,7 @@ #include "nr_nas_msg_sim.h" #endif +NR_UE_RRC_INST_t *NR_UE_rrc_inst; /* NAS Attach request with IMSI */ static const char nr_nas_attach_req_imsi[] = { 0x07, 0x41, diff --git a/openair2/RRC/NR_UE/rrc_vars.h b/openair2/RRC/NR_UE/rrc_vars.h index 5c74e5b5a8..30c74debdd 100644 --- a/openair2/RRC/NR_UE/rrc_vars.h +++ b/openair2/RRC/NR_UE/rrc_vars.h @@ -36,6 +36,6 @@ #include "rrc_defs.h" -NR_UE_RRC_INST_t *NR_UE_rrc_inst; +extern NR_UE_RRC_INST_t *NR_UE_rrc_inst; #endif diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c index 847002ab44..5fb3288dc1 100644 --- a/openair3/GTPV1-U/gtpv1u_eNB.c +++ b/openair3/GTPV1-U/gtpv1u_eNB.c @@ -51,6 +51,7 @@ #include "gtpv1u_eNB_defs.h" #include "gtpv1u_eNB_task.h" #include "rrc_eNB_GTPV1U.h" +#include #undef GTP_DUMP_SOCKET diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c index 178f21a44a..be887623bb 100644 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -33,6 +33,7 @@ # include "memory.h" #include "nas_user.h" +#include // FIXME make command line option for NAS_UE_AUTOSTART # define NAS_UE_AUTOSTART 1 diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c index dce410de47..f35a18eb0e 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c @@ -42,7 +42,6 @@ #include #include #include -#include #include "common_lib.h" #include "ethernet_lib.h" diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 99f2695d92..2db8ce5e7f 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -35,6 +35,7 @@ #include #include "rt_wrapper.h" +#include #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all @@ -102,6 +103,8 @@ pthread_cond_t nfapi_sync_cond; pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex +msc_interface_t msc_interface; + uint16_t sf_ahead=4; diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index f97aa596f7..0ea2368b25 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -95,6 +95,7 @@ extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP); +int tx_req_num_elems; extern uint16_t sf_ahead; //extern int tx_req_UE_MAC1(); diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 9bf179efb9..9b0c8c3c91 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -86,6 +86,7 @@ #include "lte-softmodem.h" +msc_interface_t msc_interface; /* temporary compilation wokaround (UE/eNB split */ uint16_t sf_ahead; diff --git a/targets/RT/USER/rt_wrapper.c b/targets/RT/USER/rt_wrapper.c index 5bdbbb36e3..b051868825 100644 --- a/targets/RT/USER/rt_wrapper.c +++ b/targets/RT/USER/rt_wrapper.c @@ -44,6 +44,7 @@ #include #include "rt_wrapper.h" #include +#include #include "openair1/PHY/defs_common.h" From 4511e70face325dc7d43b6d389ad96f3641776c0 Mon Sep 17 00:00:00 2001 From: Laurent OpenCells Date: Mon, 5 Apr 2021 12:56:52 +0200 Subject: [PATCH 26/66] fix from ci results --- cmake_targets/CMakeLists.txt | 4 +- common/utils/system.h | 4 +- common/utils/telnetsrv/telnetsrv.c | 2 +- openair1/PHY/LTE_REFSIG/primary_synch.h | 1 + openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c | 36 ------------------ openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h | 38 +++++++++++++++++++ openair1/SCHED/phy_procedures_lte_eNb.c | 2 +- openair1/SIMULATION/TOOLS/phase_noise.c | 2 +- openair2/GNB_APP/gnb_config.c | 2 +- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 26 +------------ openair2/PHY_INTERFACE/phy_stub_UE.h | 2 +- openair2/RRC/LTE/plmn_data.h | 3 +- openair2/RRC/LTE/rrc_eNB.c | 5 +-- openair2/UTIL/OCG/OCG.h | 6 --- targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 6 +-- .../gnb.sa.band78.fr1.106PRB.usrpb210.conf | 2 +- 16 files changed, 57 insertions(+), 84 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 8d8adb6eb0..3124d496d4 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -338,11 +338,11 @@ endif () add_definitions("-DASN_DISABLE_OER_SUPPORT") ######################### -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --sanitize=address -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}") ######################### # set a flag for changes in the source code # these changes are related to hardcoded path to include .h files -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0 --sanitize=address -DMALLOC_CHECK_=3") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0 -DMALLOC_CHECK_=3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3 -O2 -fno-delete-null-pointer-checks") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3") diff --git a/common/utils/system.h b/common/utils/system.h index 46316f6db6..b576495a46 100644 --- a/common/utils/system.h +++ b/common/utils/system.h @@ -49,8 +49,8 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, #define SCHED_OAI SCHED_RR #define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_OAI) -#define OAI_PRIORITY_RT sched_get_priority_min(SCHED_OAI)+1 -#define OAI_PRIORITY_RT_MAX sched_get_priority_min(SCHED_OAI)+2 +#define OAI_PRIORITY_RT ((sched_get_priority_min(SCHED_OAI)+sched_get_priority_min(SCHED_OAI))/2) +#define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_OAI)-2 void thread_top_init(char *thread_name, int affinity, diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c index 03f7af99bc..287b63c188 100644 --- a/common/utils/telnetsrv/telnetsrv.c +++ b/common/utils/telnetsrv/telnetsrv.c @@ -702,7 +702,7 @@ void poll_telnetcmdq(void *qid, void *arg) { */ void exec_moduleinit(char *modname) { void (*fptr)(void); - char initfunc[TELNET_CMD_MAXSIZE+9]; + char initfunc[TELNET_CMD_MAXSIZE+10]; if (strlen(modname) > TELNET_CMD_MAXSIZE) { fprintf(stderr,"[TELNETSRV] module %s not loaded, name exceeds the %i size limit\n", diff --git a/openair1/PHY/LTE_REFSIG/primary_synch.h b/openair1/PHY/LTE_REFSIG/primary_synch.h index 7a69222ddd..8152722df3 100644 --- a/openair1/PHY/LTE_REFSIG/primary_synch.h +++ b/openair1/PHY/LTE_REFSIG/primary_synch.h @@ -18,6 +18,7 @@ * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ + short primary_synch0[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-26120,-19785,11971,-30502,-24020,-22288,32117,6492,31311,9658,-16384,-28378,25100,-21063,-7292,-31946,20429,25618,14948,29158,11971,-30502,31311,9658,25100,-21063,-16384,28377,-24020,22287,32117,6492,-7292,31945,20429,25618,-26120,-19785,-16384,-28378,-16384,28377,-26120,-19785,-32402,4883,31311,-9659,32117,6492,-7292,-31946,32767,-1,25100,-21063,-24020,22287,-32402,4883,-32402,4883,-24020,22287,25100,-21063,32767,-1,-7292,-31946,32117,6492,31311,-9659,-32402,4883,-26120,-19785,-16384,28377,-16384,-28378,-26120,-19785,20429,25618,-7292,31945,32117,6492,-24020,22287,-16384,28377,25100,-21063,31311,9658,11971,-30502,14948,29158,20429,25618,-7292,-31946,25100,-21063,-16384,-28378,31311,9658,32117,6492,-24020,-22288,11971,-30502,-26120,-19785,32767,0,0,0,0,0,0,0,0,0,0,0}; short primary_synch1[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,-8086,-24020,-22288,2448,32675,-26120,19784,27073,18458,-16384,28377,25100,21062,-29523,14217,-7292,31945,-13477,-29868,-24020,-22288,27073,18458,25100,21062,-16384,-28378,2448,-32676,-26120,19784,-29523,-14218,-7292,31945,-31754,-8086,-16384,28377,-16384,-28378,-31754,-8086,31311,-9659,27073,-18459,-26120,19784,-29523,14217,32767,-1,25100,21062,2448,-32676,31311,-9659,31311,-9659,2448,-32676,25100,21062,32767,0,-29523,14217,-26120,19784,27073,-18459,31311,-9659,-31754,-8086,-16384,-28378,-16384,28377,-31754,-8086,-7292,31945,-29523,-14218,-26120,19784,2448,-32676,-16384,-28378,25100,21062,27073,18458,-24020,-22288,-13477,-29868,-7292,31945,-29523,14217,25100,21062,-16384,28377,27073,18458,-26120,19784,2448,32675,-24020,-22288,-31754,-8086,32767,0,0,0,0,0,0,0,0,0,0,0}; short primary_synch2[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,8085,-24020,22287,2448,-32676,-26120,-19785,27073,-18459,-16384,-28378,25100,-21063,-29523,-14218,-7292,-31946,-13477,29867,-24020,22287,27073,-18459,25100,-21063,-16384,28377,2448,32675,-26120,-19785,-29523,14217,-7292,-31946,-31754,8085,-16384,-28378,-16384,28377,-31754,8085,31311,9658,27073,18458,-26120,-19785,-29523,-14218,32767,0,25100,-21063,2448,32675,31311,9658,31311,9658,2448,32675,25100,-21063,32767,0,-29523,-14218,-26120,-19785,27073,18458,31311,9658,-31754,8085,-16384,28377,-16384,-28378,-31754,8085,-7292,-31946,-29523,14217,-26120,-19785,2448,32675,-16384,28377,25100,-21063,27073,-18459,-24020,22287,-13477,29867,-7292,-31946,-29523,-14218,25100,-21063,-16384,-28378,27073,-18459,-26120,-19785,2448,-32676,-24020,22287,-31754,8085,32767,-1,0,0,0,0,0,0,0,0,0,0}; diff --git a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c index dfd759f376..4a419ae926 100644 --- a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c +++ b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c @@ -54,42 +54,6 @@ * *********************************************************************/ -/* Table 5.2.2.2-2: Definition of phi ( n ) for M ZC = 12 */ -const char phi_M_ZC_12[12*U_GROUP_NUMBER] -= { -/* 0 1 2 3 4 5 6 7 8 9 10 11 */ -/* 0 */ 1, -1, 3, 1, 1, -1, -1, -1, 1, 3, -3, 1, -/* 1 */ -1, -1, -1, -1, 1, -3, -1, 3, 3, -1, -3, 1, -/* 2 */ -3, 1, -3, -3, -3, 3, -3, -1, 1, 1, 1, -3, -/* 3 */ -3, 3, 1, 3, -3, 1, 1, 1, 1, 3, -3, 3, -/* 4 */ -3, 1, 3, -1, -1, -3, -3, -1, -1, 3, 1, -3, -/* 5 */ -1, 1, 1, -1, 1, 3, 3, -1, -1, -3, 1, -3, -/* 6 */ -3, -3, -1, 3, 3, 3, -3, 3, -3, 1, -1, -3, -/* 7 */ -3, 3, -3, 3, 3, -3, -1, -1, 3, 3, 1, -3, -/* 8 */ -3, -1, -3, -1, -1, -3, 3, 3, -1, -1, 1, -3, -/* 9 */ -3, 3, 3, 3, -1, -3, -3, -1, -3, 1, 3, -3, -/* 10 */ 1, 3, -3, 1, 3, 3, 3, 1, -1, 1, -1, 3, -/* 11 */ -1, -3, 3, -1, -3, -3, -3, -1, 1, -1, 1, -3, -/* 12 */ 3, 1, 3, 1, 3, -3, -1, 1, 3, 1, -1, -3, -/* 13 */ -3, -3, 3, 3, 3, -3, -1, 1, -3, 3, 1, -3, -/* 14 */ -3, -1, 1, -3, 1, 3, 3, 3, -1, -3, 3, 3, -/* 15 */ -3, -3, 3, 1, -3, -3, -3, -1, 3, -1, 1, 3, -/* 16 */ -1, 1, 3, -3, 1, -1, 1, -1, -1, -3, 1, -1, -/* 17 */ -3, -1, -1, 1, 3, 1, 1, -1, 1, -1, -3, 1, -/* 18 */ -3, -1, 3, -3, -3, -1, -3, 1, -1, -3, 3, 3, -/* 19 */ -3, -3, 3, -3, -1, 3, 3, 3, -1, -3, 1, -3, -/* 20 */ -3, 1, -1, -1, 3, 3, -3, -1, -1, -3, -1, -3, -/* 21 */ -3, 1, 3, 3, -1, -1, -3, 3, 3, -3, 3, -3, -/* 22 */ -3, -1, -1, -3, -3, -1, -3, 3, 1, 3, -1, -3, -/* 23 */ -3, -1, 3, 1, -3, -1, -3, 3, 1, 3, 3, 1, -/* 24 */ -3, 3, 3, 1, -3, 3, -1, 1, 3, -3, 3, -3, -/* 25 */ 3, -1, -3, 3, -3, -1, 3, 3, 3, -3, -1, -3, -/* 26 */ 1, -1, 3, -1, -1, -1, -3, -1, 1, 1, 1, -3, -/* 27 */ -3, 3, 1, -3, 1, 3, -1, -1, 1, 3, 3, 3, -/* 28 */ -3, 3, -3, 3, -3, -3, 3, -1, -1, 1, 3, -3, -/* 29 */ -3, 3, 1, -1, 3, 3, -3, 1, -1, 1, -1, 1, -} -; int16_t *base_sequence_less_than_36(unsigned int M_ZC, unsigned int u, unsigned int scaling) diff --git a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h index 0e17e2b3f3..43ec0c03dc 100644 --- a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h +++ b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h @@ -141,6 +141,44 @@ EXTERN const char phi_M_ZC_6[6*U_GROUP_NUMBER] } #endif ; +/* Table 5.2.2.2-2: Definition of phi ( n ) for M ZC = 12 */ +EXTERN const char phi_M_ZC_12[12*U_GROUP_NUMBER] +#ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H += { +/* 0 1 2 3 4 5 6 7 8 9 10 11 */ +/* 0 */ 1, -1, 3, 1, 1, -1, -1, -1, 1, 3, -3, 1, +/* 1 */ -1, -1, -1, -1, 1, -3, -1, 3, 3, -1, -3, 1, +/* 2 */ -3, 1, -3, -3, -3, 3, -3, -1, 1, 1, 1, -3, +/* 3 */ -3, 3, 1, 3, -3, 1, 1, 1, 1, 3, -3, 3, +/* 4 */ -3, 1, 3, -1, -1, -3, -3, -1, -1, 3, 1, -3, +/* 5 */ -1, 1, 1, -1, 1, 3, 3, -1, -1, -3, 1, -3, +/* 6 */ -3, -3, -1, 3, 3, 3, -3, 3, -3, 1, -1, -3, +/* 7 */ -3, 3, -3, 3, 3, -3, -1, -1, 3, 3, 1, -3, +/* 8 */ -3, -1, -3, -1, -1, -3, 3, 3, -1, -1, 1, -3, +/* 9 */ -3, 3, 3, 3, -1, -3, -3, -1, -3, 1, 3, -3, +/* 10 */ 1, 3, -3, 1, 3, 3, 3, 1, -1, 1, -1, 3, +/* 11 */ -1, -3, 3, -1, -3, -3, -3, -1, 1, -1, 1, -3, +/* 12 */ 3, 1, 3, 1, 3, -3, -1, 1, 3, 1, -1, -3, +/* 13 */ -3, -3, 3, 3, 3, -3, -1, 1, -3, 3, 1, -3, +/* 14 */ -3, -1, 1, -3, 1, 3, 3, 3, -1, -3, 3, 3, +/* 15 */ -3, -3, 3, 1, -3, -3, -3, -1, 3, -1, 1, 3, +/* 16 */ -1, 1, 3, -3, 1, -1, 1, -1, -1, -3, 1, -1, +/* 17 */ -3, -1, -1, 1, 3, 1, 1, -1, 1, -1, -3, 1, +/* 18 */ -3, -1, 3, -3, -3, -1, -3, 1, -1, -3, 3, 3, +/* 19 */ -3, -3, 3, -3, -1, 3, 3, 3, -1, -3, 1, -3, +/* 20 */ -3, 1, -1, -1, 3, 3, -3, -1, -1, -3, -1, -3, +/* 21 */ -3, 1, 3, 3, -1, -1, -3, 3, 3, -3, 3, -3, +/* 22 */ -3, -1, -1, -3, -3, -1, -3, 3, 1, 3, -1, -3, +/* 23 */ -3, -1, 3, 1, -3, -1, -3, 3, 1, 3, 3, 1, +/* 24 */ -3, 3, 3, 1, -3, 3, -1, 1, 3, -3, 3, -3, +/* 25 */ 3, -1, -3, 3, -3, -1, 3, 3, 3, -3, -1, -3, +/* 26 */ 1, -1, 3, -1, -1, -1, -3, -1, 1, 1, 1, -3, +/* 27 */ -3, 3, 1, -3, 1, 3, -1, -1, 1, 3, 3, 3, +/* 28 */ -3, 3, -3, 3, -3, -3, 3, -1, -1, 1, 3, -3, +/* 29 */ -3, 3, 1, -1, 3, 3, -3, 1, -1, 1, -1, 1, +} +#endif +; /* Table 5.2.2.2-3: Definition of phi (n ) for M_ZC = 18 */ EXTERN const char phi_M_ZC_18[18*U_GROUP_NUMBER] diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index e1af4e31ac..d894061acd 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -40,6 +40,7 @@ #include "common/utils/LOG/log.h" #include #include "common/utils/LOG/vcd_signal_dumper.h" +#include #include "assertions.h" #include "msc.h" @@ -51,7 +52,6 @@ #define MBMS_NFAPI_SCHEDULER -extern nfapi_ue_release_request_body_t release_rntis; int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t UE_id,uint8_t harq_pid, uint8_t bw_factor) { uint32_t Nre,sumKr,MPR_x100,Kr,r; diff --git a/openair1/SIMULATION/TOOLS/phase_noise.c b/openair1/SIMULATION/TOOLS/phase_noise.c index 1dfd43d8cb..6cc24f23db 100644 --- a/openair1/SIMULATION/TOOLS/phase_noise.c +++ b/openair1/SIMULATION/TOOLS/phase_noise.c @@ -26,7 +26,7 @@ #include "sim.h" -uint16_t LUTSin[ResolSinCos+1]; +static uint16_t LUTSin[ResolSinCos+1]; /* linear phase noise model */ void phase_noise(double ts, int16_t * InRe, int16_t * InIm) { diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index dd90426896..b40ff5d9e2 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -175,7 +175,7 @@ void prepare_scc(NR_ServingCellConfigCommon_t *scc) { scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble = CALLOC(1,sizeof(long)); scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->p0_NominalWithGrant = CALLOC(1,sizeof(long)); - scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon = CALLOC(1,sizeof(*scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon)); + scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon = CALLOC(1,sizeof(struct NR_SetupRelease_PUCCH_ConfigCommon)); scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->present= NR_SetupRelease_PUCCH_ConfigCommon_PR_setup; scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup = CALLOC(1,sizeof(struct NR_PUCCH_ConfigCommon)); scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->p0_nominal = CALLOC(1,sizeof(long)); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index df3b5824c1..637c28fbf8 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -375,7 +375,6 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx protocol_ctxt_t ctxt; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; - module_id_t ue_id = 0; pdcp_t *pdcp_p = NULL; static unsigned char pdcp_read_state_g =0; rb_id_t rab_id = 0; @@ -469,30 +468,7 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx } else { // rb_id =0, thus interpreated as broadcast and transported as multiple unicast // is a broadcast packet, we have to send this packet on all default RABS of all connected UEs //#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES - for (ue_id = 0; ue_id < NB_UE_INST; ue_id++) { - if (oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt_cpy.module_id][ue_id] != NOT_A_RNTI) { - ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt_cpy.module_id][ue_id]; - LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n", - ctxt.frame, - pdcp_read_header_g.inst, - pdcp_read_header_g.rb_id, - pdcp_read_header_g.data_size, - ctxt.module_id, - ctxt.rnti, - DEFAULT_RAB_ID); - pdcp_data_req ( - &ctxt, - SRB_FLAG_NO, - DEFAULT_RAB_ID, - RLC_MUI_UNDEFINED, - RLC_SDU_CONFIRM_NO, - pdcp_read_header_g.data_size, - (unsigned char *)NLMSG_DATA(nas_nlh_rx), - PDCP_TRANSMISSION_MODE_DATA - ,NULL, NULL - ); - } - } + // never finished code, dropped } } else { // ctxt.enb_flag => UE if (NFAPI_MODE == NFAPI_UE_STUB_PNF) { diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h index 26d4aed835..a542c7bbab 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.h +++ b/openair2/PHY_INTERFACE/phy_stub_UE.h @@ -18,6 +18,7 @@ //#include "openair1/PHY/LTE_TRANSPORT/defs.h" //below 2 difinitions move to phy_stub_UE.c to add initialization when difinition. +extern int tx_req_num_elems; extern UL_IND_t *UL_INFO; extern nfapi_tx_request_pdu_t* tx_request_pdu_list; // New @@ -27,7 +28,6 @@ extern nfapi_dl_config_request_t* dl_config_req; extern nfapi_ul_config_request_t* ul_config_req; extern nfapi_hi_dci0_request_t* hi_dci0_req; -extern int tx_req_num_elems; //below 2 difinitions move to lte-ue.c to add initialization when difinition. //int next_ra_frame; diff --git a/openair2/RRC/LTE/plmn_data.h b/openair2/RRC/LTE/plmn_data.h index 1b80ee9d7b..15dbd4aa23 100644 --- a/openair2/RRC/LTE/plmn_data.h +++ b/openair2/RRC/LTE/plmn_data.h @@ -2232,6 +2232,7 @@ static const plmn_data_t plmn_data[] = { 310 900 Mid-Rivers Communications Mid-Rivers Wireless Operational */ {310, 910, "Verizon Wireless", "Verizon USA"}, + {0,0,"",""} /* 310 920 Get Mobile Inactive 310 930 Copper Valley Wireless Inactive @@ -2295,7 +2296,7 @@ static const plmn_data_t plmn_data[] = { 648 4 Econet Wireless Econet Operational */ - {0,0,"",""} + }; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 526ce129b1..b30422ce2f 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -6557,10 +6557,9 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( (int)DRB_configList->list.array[i]->drb_Identity, (int)*DRB_configList->list.array[i]->logicalChannelIdentity); /* For pre-ci tests */ - LOG_I(RRC, "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete from UE %u, reconfiguring DRB %d/LCID %d\n", + LOG_I(RRC, "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete, reconfiguring DRB %d/LCID %d\n", ctxt_pP->module_id, ctxt_pP->frame, - oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid], (int)DRB_configList->list.array[i]->drb_Identity, (int)*DRB_configList->list.array[i]->logicalChannelIdentity); @@ -6585,7 +6584,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( "[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n", ctxt_pP->module_id, ctxt_pP->module_id, (long int)((ue_context_pP->local_uid * LTE_maxDRB) + DRB_configList->list.array[i]->drb_Identity)); - ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid]; + ue_module_id = 0; // Was oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid]; rb_conf_ipv4(0, //add ue_module_id, //cx ctxt_pP->module_id, //inst diff --git a/openair2/UTIL/OCG/OCG.h b/openair2/UTIL/OCG/OCG.h index 73f2f26d08..58cc7184e7 100644 --- a/openair2/UTIL/OCG/OCG.h +++ b/openair2/UTIL/OCG/OCG.h @@ -716,12 +716,6 @@ typedef struct { */ unsigned char slot_isr; int slot_sfd; - rnti_t eNB_ue_module_id_to_rnti[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];/*!< \brief used by eNB, this array can be filled: - by local virtualization: set directly by UE, or by remote UEs: TODO add signalisation on ethernet emulation link from UE to eNB*/ - - module_id_t eNB_ue_local_uid_to_ue_module_id[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];/*!< \brief used by eNB, this array can be filled: - by local virtualization: set directly by UE, or by remote UEs: TODO add signalisation on ethernet emulation link from UE to eNB*/ - } Info; /* @}*/ diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index 61a742af65..853cb41620 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -153,7 +153,7 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) { } static int sync_to_gps(openair0_device *device) { - uhd::set_thread_priority_safe(); + //uhd::set_thread_priority_safe(); //std::string args; //Set up program options //po::options_description desc("Allowed options"); @@ -589,7 +589,7 @@ void *trx_usrp_write_thread(void * arg){ int trx_usrp_write_init(openair0_device *device){ - uhd::set_thread_priority_safe(1.0); + //uhd::set_thread_priority_safe(1.0); openair0_thread_t *write_thread = &device->write_thread; printf("initializing tx write thread\n"); @@ -940,7 +940,7 @@ extern "C" { // hotfix! to be checked later - uhd::set_thread_priority_safe(1.0); + //uhd::set_thread_priority_safe(1.0); // Initialize USRP device int vers=0,subvers=0,subsubvers=0; int bw_gain_adjust=0; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 1b329c54da..96df4a971f 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -269,7 +269,7 @@ RUs = ( eNB_instances = [0]; #beamforming 1x4 matrix: bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; - clock_src = "external"; + clock_src = "internal"; } ); From 873e42612ad0dff8ca6f7f76a6e92041734e6674 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Tue, 6 Apr 2021 21:32:19 +0200 Subject: [PATCH 27/66] merge develop, documentation fix --- common/utils/threadPool/thread-pool.md | 6 +++--- executables/nr-ru.c | 2 +- .../CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf | 9 --------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/common/utils/threadPool/thread-pool.md b/common/utils/threadPool/thread-pool.md index a087b989fa..80f3b99446 100644 --- a/common/utils/threadPool/thread-pool.md +++ b/common/utils/threadPool/thread-pool.md @@ -210,8 +210,8 @@ time the worker finished the job time the client reads the result if you set the environement variable: -thread-pool-measurements to a valid file name +threadPoolMeasurements to a valid file name These measurements will be wrote to this Linux pipe. -A tool to read the linux fifo and display it in ascii is provided: -see the local directory Makefile for this tool and to compile the thread pool unitary tests. +A tool to read the linux fifo and display it in ascii is provided; compute the binay: +in cmake building directory: make/ninja measurement_display \ No newline at end of file diff --git a/executables/nr-ru.c b/executables/nr-ru.c index b059c6f4e8..6aa21613da 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1390,7 +1390,7 @@ void *ru_thread( void *param ) { syncMsg->frame_tx = proc->frame_tx; syncMsg->slot_tx = proc->tti_tx; syncMsg->timestamp_tx = proc->timestamp_tx; - res->key = proc->tti_rx; + res->key = 3000+proc->tti_rx; pushTpool(gNB->threadPool, res); } diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 96df4a971f..535db82dfc 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -282,15 +282,6 @@ THREAD_STRUCT = ( } ); -rfsimulator : -{ - serveraddr = "server"; - serverport = "4043"; - options = (); #("saviq"); or/and "chanmod" - modelname = "AWGN"; - IQfile = "/tmp/rfsimulator.iqs"; -}; - log_config : { global_log_level ="info"; From 04f2ec2352a4f66f34940b9b1f077a24326d27cd Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Tue, 6 Apr 2021 21:33:13 +0200 Subject: [PATCH 28/66] merge develop, documentation fix --- executables/nr-gnb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index a92f433560..379bbfeb5c 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -126,7 +126,7 @@ void tx_func(void *param) { syncMsg->slot_tx = slot_tx; syncMsg->timestamp_tx = info->timestamp_tx; syncMsg->ru = gNB->RU_list[0]; - res->key = slot_tx; + res->key = 1000+slot_tx; pushTpool(gNB->threadPool, res); } @@ -275,7 +275,7 @@ void rx_func(void *param) { syncMsg->frame_tx = frame_tx; syncMsg->slot_tx = slot_tx; syncMsg->timestamp_tx = info->timestamp_tx; - res->key = slot_tx; + res->key = 2000+slot_tx; pushTpool(gNB->threadPool, res); } From f21ac1a84ca7bfa0c19e46b50b02b5078c18c427 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 9 Apr 2021 10:15:53 +0200 Subject: [PATCH 29/66] [CI] increase time out for waits Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-gitlab | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index 2f06216101..f88ec62858 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -231,7 +231,7 @@ pipeline { stage ("Build basic simulator") { steps { gitlabCommitStatus(name: "Build basic-sim") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -240,7 +240,7 @@ pipeline { stage ("Build 5G gNB-USRP") { steps { gitlabCommitStatus(name: "Build gNB-USRP") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -249,7 +249,7 @@ pipeline { stage ("Build 5G NR-UE-USRP") { steps { gitlabCommitStatus(name: "Build nr-UE-USRP") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant nr-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -258,7 +258,7 @@ pipeline { stage ("Build physical simulators") { steps { gitlabCommitStatus(name: "Build phy-sim") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -267,7 +267,7 @@ pipeline { stage ("Build eNB-ethernet") { steps { gitlabCommitStatus(name: "Build eNB-ethernet") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -278,7 +278,7 @@ pipeline { // This is typically the last one to finish. lock (vmResource) { gitlabCommitStatus(name: "Build UE-ethernet") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } From 657b525efc0ca13cde204b464633af4d8c254de3 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Fri, 9 Apr 2021 14:31:02 +0200 Subject: [PATCH 30/66] merge develop --- executables/nr-uesoftmodem.c | 1 - 1 file changed, 1 deletion(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 20e1e296e1..4fa014972a 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -146,7 +146,6 @@ int card_offset = 0; uint64_t num_missed_slots = 0; // counter for the number of missed slots int transmission_mode = 1; int numerology = 0; -int usrp_tx_thread = 0; int oaisim_flag = 0; int emulate_rf = 0; From ceb96a36e7d45621ca63e592dadcfb51dde4cc2a Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Sun, 11 Apr 2021 20:07:26 +0200 Subject: [PATCH 31/66] astyle --- targets/ARCH/rfsimulator/stored_node.c | 1 - 1 file changed, 1 deletion(-) diff --git a/targets/ARCH/rfsimulator/stored_node.c b/targets/ARCH/rfsimulator/stored_node.c index dcea69b9dd..0dd051dbf6 100644 --- a/targets/ARCH/rfsimulator/stored_node.c +++ b/targets/ARCH/rfsimulator/stored_node.c @@ -201,7 +201,6 @@ int main(int argc, char *argv[]) { void *buff=malloc(bufSize); uint64_t timestamp=0; const int blockSize=1920; - // If fileSize is not multiple of blockSize*4 then discard remaining samples fileSize = (fileSize/(blockSize<<2))*(blockSize<<2); From a8ca37a782857909640944678acd92c681b44c67 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 12 Apr 2021 13:48:47 +0100 Subject: [PATCH 32/66] Add support for InitialBWP in nr_configure_pdcch --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 4 ++-- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 7d73899f37..9efc03101d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -883,7 +883,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra } NR_BWP_Downlink_t *bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1]; - NR_ControlResourceSet_t *coreset = get_coreset(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1], ss, 0); + NR_ControlResourceSet_t *coreset = get_coreset(bwp, ss, 0); long BWPStart = 0; if (get_softmodem_params()->sa) { @@ -1134,7 +1134,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra } NR_BWP_Downlink_t *bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1]; - NR_ControlResourceSet_t *coreset = get_coreset(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1], ss, 0); + NR_ControlResourceSet_t *coreset = get_coreset(bwp, ss, 0); int UE_id = find_nr_UE_id(module_idP, ra->rnti); NR_UE_info_t *UE_info = &nr_mac->UE_info; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 265c58c2e4..4f55d78604 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -563,6 +563,8 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, NR_ServingCellConfigCommon_t *scc, NR_BWP_Downlink_t *bwp) { + int sps = 0; + if (bwp) { // This is not the InitialBWP pdcch_pdu->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); @@ -571,8 +573,18 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, // first symbol //AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored"); - int sps = bwp->bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; + sps = bwp->bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; + } + else { // this is for InitialBWP + pdcch_pdu->BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + pdcch_pdu->SubcarrierSpacing = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing; + pdcch_pdu->CyclicPrefix = (scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix==NULL) ? 0 : *scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix; + // first symbol + //AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored"); + sps = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12; + } AssertFatal(ss->monitoringSymbolsWithinSlot!=NULL,"ss->monitoringSymbolsWithinSlot is null\n"); AssertFatal(ss->monitoringSymbolsWithinSlot->buf!=NULL,"ss->monitoringSymbolsWithinSlot->buf is null\n"); @@ -617,10 +629,6 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, //precoderGranularity pdcch_pdu->precoderGranularity = coreset->precoderGranularity; - } - else { // this is for InitialBWP - AssertFatal(1==0,"Fill in InitialBWP PDCCH configuration\n"); - } } From e8f8297892ea878d1ca37dd35d400125db2469fc Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 12 Apr 2021 19:20:23 +0100 Subject: [PATCH 33/66] Fix search space and coreset for Msg2 and Msg4 at gNB --- openair2/GNB_APP/gnb_config.c | 32 ++++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 125 +++++++++--------- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- openair2/RRC/NR/rrc_gNB_reconfig.c | 16 +-- 4 files changed, 94 insertions(+), 81 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index b40ff5d9e2..a440c99537 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -123,7 +123,37 @@ void prepare_scc(NR_ServingCellConfigCommon_t *scc) { scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon)); scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero = CALLOC(1,sizeof(long)); scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero = CALLOC(1,sizeof(long)); - // scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet = CALLOC(1,sizeof(struct NR_ControlResourceSet)); + + NR_ControlResourceSet_t *coreset0 = CALLOC(1,sizeof(struct NR_ControlResourceSet)); + coreset0->controlResourceSetId = 0; + // frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B, + if(coreset0->frequencyDomainResources.buf == NULL) coreset0->frequencyDomainResources.buf = calloc(1,6); + coreset0->frequencyDomainResources.buf[0] = 0xff; + coreset0->frequencyDomainResources.buf[1] = 0; + coreset0->frequencyDomainResources.buf[2] = 0; + coreset0->frequencyDomainResources.buf[3] = 0; + coreset0->frequencyDomainResources.buf[4] = 0; + coreset0->frequencyDomainResources.buf[5] = 0; + coreset0->frequencyDomainResources.size = 6; + coreset0->frequencyDomainResources.bits_unused = 3; + coreset0->duration = 1; + coreset0->cce_REG_MappingType.present=NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved; + coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset0->cce_REG_MappingType.choice.interleaved)); + coreset0->cce_REG_MappingType.choice.interleaved->reg_BundleSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6; + coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; + coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = scc->physCellId; + coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; + if(coreset0->tci_StatesPDCCH_ToAddList == NULL) coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*coreset0->tci_StatesPDCCH_ToAddList)); + NR_TCI_StateId_t *tci[8]; + for (int i=0;i<8;i++) { + tci[i]=calloc(1,sizeof(*tci[i])); + *tci[i] = i; + ASN_SEQUENCE_ADD(&coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]); + } + coreset0->tci_StatesPDCCH_ToReleaseList = NULL; + coreset0->tci_PresentInDCI = NULL; + coreset0->pdcch_DMRS_ScramblingID = NULL; + scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet = coreset0; // scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList)); // scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = CALLOC(1,sizeof(NR_SearchSpaceId_t)); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 9efc03101d..e051bb5f9d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -528,10 +528,11 @@ void nr_initiate_ra_proc(module_id_t module_idP, else ra_rnti = 1 + symbol + (slotP * 14) + (freq_index * 14 * 80) + (ul_carrier_id * 14 * 80 * 8); - // This should be handled differently when we use the initialBWP for RA ra->bwp_id = 1; - NR_BWP_Downlink_t *bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ->list.array[ra->bwp_id - 1]; + NR_BWP_Downlink_t *bwp = NULL; // For SA we use InitialBWP + if(get_softmodem_params()->sa != 1) { + bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]; + } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 1); @@ -562,13 +563,21 @@ void nr_initiate_ra_proc(module_id_t module_idP, ra->timing_offset = timing_offset; ra->preamble_slot = slotP; - struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; + NR_SearchSpaceId_t ra_SearchSpace = 0; + struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = NULL; + if(bwp) { + commonSearchSpaceList = bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; + ra_SearchSpace = *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace; + } else { + commonSearchSpaceList = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; + ra_SearchSpace = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace; + } AssertFatal(commonSearchSpaceList->list.count > 0, "common SearchSpace list has 0 elements\n"); + // Common searchspace list for (int i = 0; i < commonSearchSpaceList->list.count; i++) { ss = commonSearchSpaceList->list.array[i]; - if (ss->searchSpaceId == *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace) + if (ss->searchSpaceId == ra_SearchSpace) ra->ra_ss = ss; } @@ -866,30 +875,27 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra int rbSize = 8; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + NR_SearchSpace_t *ss = ra->ra_ss; + long BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - NR_SearchSpace_t *ss = NULL; - if(ra->ra_ss) { - ss = ra->ra_ss; - } else { - if (nr_mac->sched_ctrlCommon == NULL){ - nr_mac->sched_ctrlCommon = calloc(1,sizeof(*nr_mac->sched_ctrlCommon)); - } - if(nr_mac->sched_ctrlCommon->search_space == NULL) { - nr_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*nr_mac->sched_ctrlCommon->search_space)); - fill_default_searchSpaceZero(nr_mac->sched_ctrlCommon->search_space); - } - ss = nr_mac->sched_ctrlCommon->search_space; + NR_BWP_Downlink_t *bwp = NULL; // For SA we use InitialBWP + if(get_softmodem_params()->sa != 1) { + bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]; } - NR_BWP_Downlink_t *bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1]; - NR_ControlResourceSet_t *coreset = get_coreset(bwp, ss, 0); + NR_ControlResourceSet_t *coreset = NULL; + if(bwp) { + coreset = get_coreset(bwp, ss, 0); + } else { + coreset = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet; + } long BWPStart = 0; - if (get_softmodem_params()->sa) { - BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - } else { // NSA mode is not using the Initial BWP + if (get_softmodem_params()->sa != 1) { BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } else { + BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); } uint16_t *vrb_map = cc[CC_id].vrb_map; @@ -923,7 +929,9 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra // Calculate number of symbols int startSymbolIndex, nrOfSymbols; - const int startSymbolAndLength = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength; + const int startSymbolAndLength = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated-> + downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup-> + pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n"); @@ -934,9 +942,8 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra // look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially // important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them - const int bwpid = bwp->bwp_Id; const int coresetid = coreset->controlResourceSetId; - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid]; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid]; if (!pdcch_pdu_rel15) { nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset(dl_tti_pdcch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t)); @@ -945,14 +952,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dl_req->nPDUs += 1; pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, bwp); - nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15; - } - - // TODO: This assignment should be done in function nr_configure_pdcch() - if(get_softmodem_params()->sa) { - pdcch_pdu_rel15->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG_CSET_0; - pdcch_pdu_rel15->BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pdcch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid] = pdcch_pdu_rel15; } nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; @@ -976,7 +976,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra const int pduindex = nr_mac->pdu_index[CC_id]++; uint8_t mcsTableIdx = 0; - if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL) + if (bwp==NULL || bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL) mcsTableIdx = 0; else{ if (*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == 0) @@ -994,7 +994,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra pdsch_pdu_rel15->pduIndex = pduindex; pdsch_pdu_rel15->BWPSize = BWPSize; pdsch_pdu_rel15->BWPStart = BWPStart; - pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; + pdsch_pdu_rel15->SubcarrierSpacing = bwp!=NULL ? bwp->bwp_Common->genericParameters.subcarrierSpacing : scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing; pdsch_pdu_rel15->CyclicPrefix = 0; pdsch_pdu_rel15->NrOfCodewords = 1; pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcsIndex,mcsTableIdx); @@ -1006,7 +1006,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra pdsch_pdu_rel15->nrOfLayers = 1; pdsch_pdu_rel15->transmissionScheme = 0; pdsch_pdu_rel15->refPoint = 0; - pdsch_pdu_rel15->dmrsConfigType = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + pdsch_pdu_rel15->dmrsConfigType = bwp!=NULL ? (bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0; pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; pdsch_pdu_rel15->SCID = 0; pdsch_pdu_rel15->numDmrsCdmGrpsNoData = numDmrsCdmGrpsNoData; @@ -1074,7 +1074,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra NR_DL_DCI_FORMAT_1_0, NR_RNTI_RA, pdsch_pdu_rel15->BWPSize, - bwp->bwp_Id); + ra->bwp_id); // DL TX request nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs]; @@ -1119,28 +1119,25 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra uint8_t time_domain_assignment = 0; uint8_t mcsIndex = 0; - NR_SearchSpace_t *ss = NULL; - if(ra->ra_ss) { - ss = ra->ra_ss; - } else { - if (nr_mac->sched_ctrlCommon == NULL){ - nr_mac->sched_ctrlCommon = calloc(1,sizeof(*nr_mac->sched_ctrlCommon)); - } - if(nr_mac->sched_ctrlCommon->search_space == NULL) { - nr_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*nr_mac->sched_ctrlCommon->search_space)); - fill_default_searchSpaceZero(nr_mac->sched_ctrlCommon->search_space); - } - ss = nr_mac->sched_ctrlCommon->search_space; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + NR_SearchSpace_t *ss = ra->ra_ss; + + NR_BWP_Downlink_t *bwp = NULL; // For SA we use InitialBWP + if(get_softmodem_params()->sa != 1) { + bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]; } - NR_BWP_Downlink_t *bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1]; - NR_ControlResourceSet_t *coreset = get_coreset(bwp, ss, 0); + NR_ControlResourceSet_t *coreset = NULL; + if(bwp) { + coreset = get_coreset(bwp, ss, 0); + } else { + coreset = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet; + } int UE_id = find_nr_UE_id(module_idP, ra->rnti); NR_UE_info_t *UE_info = &nr_mac->UE_info; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; long BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); long BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); @@ -1180,7 +1177,9 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra // Calculate number of symbols int startSymbolIndex, nrOfSymbols; - const int startSymbolAndLength = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength; + const int startSymbolAndLength = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated-> + downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup-> + pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n"); @@ -1191,7 +1190,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra uint16_t N_DMRS_SLOT = get_num_dmrs(dlDmrsSymbPos); - long dmrsConfigType = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + long dmrsConfigType = bwp!=NULL ? (bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0; uint8_t N_PRB_DMRS = 0; AssertFatal(nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData == 1 || nr_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData == 2, @@ -1206,7 +1205,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra } uint8_t mcsTableIdx = 0; - if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL) + if (bwp==NULL || bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL) mcsTableIdx = 0; else{ if (*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == 0) @@ -1257,9 +1256,8 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra // look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially // important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them - const int bwpid = bwp->bwp_Id; const int coresetid = coreset->controlResourceSetId; - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid]; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid]; if (!pdcch_pdu_rel15) { nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset(dl_tti_pdcch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t)); @@ -1268,14 +1266,9 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dl_req->nPDUs += 1; pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, bwp); - nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15; + nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid] = pdcch_pdu_rel15; } - // TODO: This assignment should be done in function nr_configure_pdcch() - pdcch_pdu_rel15->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG_CSET_0; - pdcch_pdu_rel15->BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pdcch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset((void *)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; @@ -1300,7 +1293,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra pdsch_pdu_rel15->pduIndex = pduindex; pdsch_pdu_rel15->BWPSize = BWPSize; pdsch_pdu_rel15->BWPStart = BWPStart; - pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; + pdsch_pdu_rel15->SubcarrierSpacing = bwp!=NULL ? bwp->bwp_Common->genericParameters.subcarrierSpacing : scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing; pdsch_pdu_rel15->CyclicPrefix = 0; pdsch_pdu_rel15->NrOfCodewords = 1; pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcsIndex,mcsTableIdx); @@ -1390,7 +1383,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra NR_DL_DCI_FORMAT_1_0, NR_RNTI_TC, pdsch_pdu_rel15->BWPSize, - bwp->bwp_Id); + ra->bwp_id); // Add padding header and zero rest out if there is space left if (mac_pdu_length < harq->tb_size) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 4f55d78604..d4cf603c4f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -178,7 +178,7 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, int coreset_id = coreset->controlResourceSetId; int *cce_list; - if(bwp->bwp_Id == 0) { + if( bwp==NULL || bwp->bwp_Id == 0 ) { cce_list = nr_mac->cce_list[1][0]; } else { cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id]; diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 19e8d77e05..455acb770c 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -483,7 +483,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco coreset->frequencyDomainResources.buf[0] = 0xf0; else coreset->frequencyDomainResources.buf[0] = 0xff; - if (curr_bwp < 96 || get_softmodem_params()->sa==1) + if (curr_bwp < 96) coreset->frequencyDomainResources.buf[1] = 0; else coreset->frequencyDomainResources.buf[1] = 0xff; @@ -494,17 +494,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco coreset->frequencyDomainResources.size = 6; coreset->frequencyDomainResources.bits_unused = 3; coreset->duration=1; - - if(get_softmodem_params()->sa) { - coreset->cce_REG_MappingType.present=NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved; - coreset->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset->cce_REG_MappingType.choice.interleaved)); - coreset->cce_REG_MappingType.choice.interleaved->reg_BundleSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6; - coreset->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; - coreset->cce_REG_MappingType.choice.interleaved->shiftIndex = servingcellconfigcommon->physCellId; - } else { - coreset->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; - } - + coreset->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; coreset->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; coreset->tci_StatesPDCCH_ToAddList=calloc(1,sizeof(*coreset->tci_StatesPDCCH_ToAddList)); @@ -552,7 +542,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss); - + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1)); *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=0; From dbb0bca5804f6675eaa96c6413f59e7db61d1669 Mon Sep 17 00:00:00 2001 From: hardy Date: Fri, 9 Apr 2021 16:17:19 +0200 Subject: [PATCH 34/66] new ci files to build gir MR dashboard --- ci-scripts/Jenkinsfile-git-dashboard | 45 +++++++++++++++++++++ ci-scripts/data_extraction_from_gitlab.py | 49 +++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 ci-scripts/Jenkinsfile-git-dashboard create mode 100644 ci-scripts/data_extraction_from_gitlab.py diff --git a/ci-scripts/Jenkinsfile-git-dashboard b/ci-scripts/Jenkinsfile-git-dashboard new file mode 100644 index 0000000000..12533646c0 --- /dev/null +++ b/ci-scripts/Jenkinsfile-git-dashboard @@ -0,0 +1,45 @@ +#!/bin/groovy +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +// Template Jenkins Declarative Pipeline script to run Test w/ RF HW + +// Location of the python executor node shall be in the same subnet as the others servers +def pythonExecutor = params.pythonExecutor + + +pipeline { + agent { + label pythonExecutor + } + stages { + stage ("Fetch Data") { + steps { + script { + //retrieve MR data from gitlab + sh returnStdout: true, script: 'python3 ci-scripts/data_extraction_from_gitlab.py' + } + } + } + } +} + + diff --git a/ci-scripts/data_extraction_from_gitlab.py b/ci-scripts/data_extraction_from_gitlab.py new file mode 100644 index 0000000000..8ed1cca79c --- /dev/null +++ b/ci-scripts/data_extraction_from_gitlab.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Wed Mar 31 21:57:37 2021 + +@author: hardy +""" + +import subprocess +import shlex +import json +import datetime + + +cmd="""curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100" """ +process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE) +output = process.stdout.readline() +tmp=output.decode("utf-8") + + +d = json.loads(tmp) +f = open("/tmp/gitlab_dashboard.txt", "w") +f.write("MR;Created_at;Author;Title;CAN START;IN PROGRESS;COMPLETED;OK MERGE;Merge conflicts\n") +for x in range(len(d)): + date_time_str = d[x]['created_at'] + date_time_obj = datetime.datetime.strptime(date_time_str, '%Y-%m-%dT%H:%M:%S.%fZ') + + milestone1=milestone2=milestone3=milestone4="" + if d[x]['milestone']=="REVIEW_CAN_START": + milestone1="X" + elif d[x]['milestone']=="REVIEW_IN_PROGRESS": + milestone2="X" + elif d[x]['milestone']=="REVIEW_COMPLETED_AND_APPROVED": + milestone3="X" + elif d[x]['milestone']=="OK_TO_BE_MERGED": + milestone4="X" + else: + pass + + + if d[x]['has_conflicts']==True: + conflicts = "YES" + else: + conflicts = "" + + f.write(str(d[x]['iid'])+';'+ str(date_time_obj.date())+';'+ str(d[x]['author']['name'])+';'+str(d[x]['title'])+";" \ + + milestone1 +";"+ milestone2 +";"+ milestone3 +";"+ milestone4 + ";" + conflicts +"\n") +f.close() + From 357866b3e620b47bad723cb88d015289e1c467c5 Mon Sep 17 00:00:00 2001 From: hardy Date: Tue, 13 Apr 2021 15:42:22 +0200 Subject: [PATCH 35/66] adding phy test to 5G NR testsuite --- ci-scripts/xml_files/gnb_phytest_usrp_run.xml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 ci-scripts/xml_files/gnb_phytest_usrp_run.xml diff --git a/ci-scripts/xml_files/gnb_phytest_usrp_run.xml b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml new file mode 100644 index 0000000000..00610d430e --- /dev/null +++ b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml @@ -0,0 +1,53 @@ + + + gNB-PHY-Test + Run-gNB-PHY-Test + tasks + 2 + +090101 000001 090109 + + + + + Initialize_eNB + Initialize gNB USRP + -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test -q -U 787200 -T 106 -t 28 -D 130175 -m 28 -M 106 + NR + + + + IdleSleep + Sleep + 180 + + + + + Terminate_eNB + Terminate gNB + NR + + + From 3c59974b23a2b5c6ae12946e81ae0d2451cd5898 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 13 Apr 2021 15:26:44 +0100 Subject: [PATCH 36/66] Fix phy-test DL traffic --- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index bc15353e9a..97708be352 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -943,7 +943,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in tx_req.tx_request_body[0].pdu_index = j; tx_req.tx_request_body[0].pdu = ulsch_input_buffer; - if (ra->ra_state != RA_SUCCEEDED && !ra->cfra){ + if (ra->ra_state == WAIT_RAR && !ra->cfra){ LOG_I(NR_MAC,"[RAPROC] RA-Msg3 transmitted\n"); nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->gNB_index); } From 86f1c69f2683f7f005ab4a8b8dfd6292fdfaf9ad Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 13 Apr 2021 22:28:02 +0200 Subject: [PATCH 37/66] Fix code review remarks, merge develop, revert some merge errors --- ci-scripts/Jenkinsfile-GitLab-Container | 36 ++++- ci-scripts/Jenkinsfile-gitlab | 47 ++---- ci-scripts/args_parse.py | 11 +- ci-scripts/buildOnVM.sh | 2 +- ci-scripts/cls_containerize.py | 9 +- ci-scripts/createVM.sh | 2 +- ci-scripts/html.py | 85 +++++++++++ ci-scripts/main.py | 6 +- ci-scripts/reportBuildLocally.sh | 3 + ci-scripts/waitBuildOnVM.sh | 7 +- ci-scripts/xml_class_list.yml | 1 + common/utils/assertions.h | 2 +- common/utils/system.c | 18 ++- common/utils/system.h | 2 +- common/utils/threadPool/thread-pool.h | 21 ++- common/utils/threadPool/thread-pool.md | 2 +- executables/main-ocp.c | 4 +- executables/nr-gnb.c | 4 +- executables/nr-ru.c | 7 +- executables/nr-softmodem.c | 2 +- executables/nr-ue.c | 8 + executables/nr-uesoftmodem.c | 2 +- executables/ocp-gnb.c | 2 +- executables/softmodem-common.c | 2 +- executables/softmodem-common.h | 4 +- openair1/PHY/LTE_ESTIMATION/lte_sync_time.c | 36 ++--- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 2 +- openair1/PHY/TOOLS/calibration_test.c | 1 + openair1/PHY/TOOLS/lte_phy_scope.c | 6 +- openair1/PHY/TOOLS/nr_phy_scope.c | 140 +++++++++--------- openair1/PHY/TOOLS/nr_phy_scope.h | 8 +- openair1/PHY/TOOLS/phy_scope_interface.h | 19 +++ openair1/PHY/TOOLS/time_meas.c | 16 +- openair1/PHY/defs_gNB.h | 2 +- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 2 +- openair1/SCHED_NR_UE/pucch_uci_ue_nr.c | 2 +- openair2/GNB_APP/L1_nr_paramdef.h | 2 +- openair2/GNB_APP/gnb_config.c | 6 +- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 1 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 6 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 6 +- openair2/NETWORK_DRIVER/UE_IP/netlink.c | 2 +- openair2/PHY_INTERFACE/phy_stub_UE.h | 10 +- openair2/RRC/LTE/plmn_data.h | 1 - .../gnb.sa.band78.fr1.106PRB.usrpb210.conf | 9 ++ targets/RT/USER/lte-softmodem.c | 4 +- targets/RT/USER/lte-ue.c | 2 +- targets/RT/USER/lte-uesoftmodem.c | 4 +- 49 files changed, 359 insertions(+), 219 deletions(-) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index fbf9ba8f4b..dd9dba2e66 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -27,6 +27,9 @@ def nodeExecutor = params.nodeExecutor def doMandatoryTests = false def doFullTestsuite = false +// +def gitCommitAuthorEmailAddr + pipeline { agent { label nodeExecutor @@ -152,21 +155,40 @@ pipeline { } } } + stage ("CppCheck Analysis") { + steps { + script { + triggerSlaveJob ('RAN-cppcheck', 'CppCheck Analysis') + } + } + post { + always { + script { + finalizeSlaveJob('RAN-cppcheck') + } + } + failure { + script { + currentBuild.result = 'FAILURE' + } + } + } + } } } } post { always { script { + def eSubject = JOB_NAME + ' - Build # ' + BUILD_ID + ' - ' + currentBuild.result + '!' + def eBody = "Hi,\n\n" + eBody += "Here are attached HTML report files for " + JOB_NAME + " - Build # " + BUILD_ID + " - " + currentBuild.result + "!\n\n" + eBody += "Regards,\n" + eBody += "OAI CI Team" emailext attachmentsPattern: '*results*.html', - body: '''Hi, - -Here are attached HTML report files for $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS! - -Regards, -OAI CI Team''', + body: eBody, replyTo: 'no-reply@openairinterface.org', - subject: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!', + subject: eSubject, to: gitCommitAuthorEmailAddr if (fileExists('.git/CI_COMMIT_MSG')) { diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index de49275b7e..bb78a21ca0 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -224,33 +224,14 @@ pipeline { } } } - } + } - stage ("Start VM -- cppcheck") { - steps { - lock (vmResource) { - timeout (time: 7, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" - } - } - } - } - stage ("Variant Builds") { parallel { - stage ("Analysis with cppcheck") { - steps { - gitlabCommitStatus(name: "Analysis with cppcheck") { - timeout (time: 30, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}" - } - } - } - } stage ("Build basic simulator") { steps { gitlabCommitStatus(name: "Build basic-sim") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -259,7 +240,7 @@ pipeline { stage ("Build 5G gNB-USRP") { steps { gitlabCommitStatus(name: "Build gNB-USRP") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -268,7 +249,7 @@ pipeline { stage ("Build 5G NR-UE-USRP") { steps { gitlabCommitStatus(name: "Build nr-UE-USRP") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant nr-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -277,7 +258,7 @@ pipeline { stage ("Build physical simulators") { steps { gitlabCommitStatus(name: "Build phy-sim") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -286,7 +267,7 @@ pipeline { stage ("Build eNB-ethernet") { steps { gitlabCommitStatus(name: "Build eNB-ethernet") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -297,7 +278,7 @@ pipeline { // This is typically the last one to finish. lock (vmResource) { gitlabCommitStatus(name: "Build UE-ethernet") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -315,9 +296,9 @@ pipeline { script { dir ('archives') { if (fileExists('red_hat')) { - sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth gnb_usrp nr_ue_usrp red_hat" + sh "zip -r -qq vm_build_logs.zip basic_sim phy_sim enb_eth ue_eth gnb_usrp nr_ue_usrp red_hat" } else { - sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth gnb_usrp nr_ue_usrp" + sh "zip -r -qq vm_build_logs.zip basic_sim phy_sim enb_eth ue_eth gnb_usrp nr_ue_usrp" } } if(fileExists('archives/vm_build_logs.zip')) { @@ -325,16 +306,6 @@ pipeline { } if ("MERGE".equals(env.gitlabActionType)) { sh "./ci-scripts/oai-ci-vm-tool report-build --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}" - // If the merge request has introduced more CPPCHECK errors or warnings, notifications in GitLab - if (fileExists('oai_cppcheck_added_errors.txt')) { - def ret=readFile('./oai_cppcheck_added_errors.txt').trim(); - if ("0".equals(ret)) { - echo "No added cppcheck warnings/errors in this merge request" - } else { - def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Some modified files in Merge Request MAY have INTRODUCED up to " + ret + " CPPCHECK errors/warnings" - addGitLabMRComment comment: message - } - } // If the merge request has introduced compilation warnings, notifications in GitLab sh "./ci-scripts/checkAddedWarnings.sh --src-branch ${env.gitlabSourceBranch} --target-branch ${env.gitlabTargetBranch}" def res=readFile('./oai_warning_files.txt').trim(); diff --git a/ci-scripts/args_parse.py b/ci-scripts/args_parse.py index 248e873cdd..288e0b4885 100644 --- a/ci-scripts/args_parse.py +++ b/ci-scripts/args_parse.py @@ -41,7 +41,7 @@ import constants as CONST #----------------------------------------------------------- -def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): +def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA): py_param_file_present = False @@ -80,6 +80,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): HTML.ranRepository=matchReg.group(1) ldpc.ranRepository=matchReg.group(1) CONTAINERS.ranRepository=matchReg.group(1) + SCA.ranRepository=matchReg.group(1) elif re.match('^\-\-eNB_AllowMerge=(.+)$|^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE) @@ -92,6 +93,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): RAN.ranAllowMerge=True HTML.ranAllowMerge=True CONTAINERS.ranAllowMerge=True + SCA.ranAllowMerge=True elif re.match('^\-\-eNBBranch=(.+)$|^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE) @@ -102,6 +104,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): HTML.ranBranch=matchReg.group(1) ldpc.ranBranch=matchReg.group(1) CONTAINERS.ranBranch=matchReg.group(1) + SCA.ranBranch=matchReg.group(1) elif re.match('^\-\-eNBCommitID=(.*)$|^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE) @@ -112,6 +115,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): HTML.ranCommitID=matchReg.group(1) ldpc.ranCommitID=matchReg.group(1) CONTAINERS.ranCommitID=matchReg.group(1) + SCA.ranCommitID=matchReg.group(1) elif re.match('^\-\-eNBTargetBranch=(.*)$|^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE) @@ -122,12 +126,14 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): HTML.ranTargetBranch=matchReg.group(1) ldpc.ranTargetBranch=matchReg.group(1) CONTAINERS.ranTargetBranch=matchReg.group(1) + SCA.ranTargetBranch=matchReg.group(1) elif re.match('^\-\-eNBIPAddress=(.+)$|^\-\-eNB[1-2]IPAddress=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE) RAN.eNBIPAddress=matchReg.group(1) ldpc.eNBIpAddr=matchReg.group(1) CONTAINERS.eNBIPAddress=matchReg.group(1) + SCA.eNBIPAddress=matchReg.group(1) elif re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1IPAddress=matchReg.group(1) @@ -142,6 +148,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): RAN.eNBUserName=matchReg.group(1) ldpc.eNBUserName=matchReg.group(1) CONTAINERS.eNBUserName=matchReg.group(1) + SCA.eNBUserName=matchReg.group(1) elif re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1UserName=matchReg.group(1) @@ -156,6 +163,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): RAN.eNBPassword=matchReg.group(1) ldpc.eNBPassWord=matchReg.group(1) CONTAINERS.eNBPassword=matchReg.group(1) + SCA.eNBPassword=matchReg.group(1) elif re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1Password=matchReg.group(1) @@ -170,6 +178,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): RAN.eNBSourceCodePath=matchReg.group(1) ldpc.eNBSourceCodePath=matchReg.group(1) CONTAINERS.eNBSourceCodePath=matchReg.group(1) + SCA.eNBSourceCodePath=matchReg.group(1) elif re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1SourceCodePath=matchReg.group(1) diff --git a/ci-scripts/buildOnVM.sh b/ci-scripts/buildOnVM.sh index 2b1a5e0c71..31e9653769 100755 --- a/ci-scripts/buildOnVM.sh +++ b/ci-scripts/buildOnVM.sh @@ -62,7 +62,7 @@ function build_on_vm { echo "ARCHIVES_LOC = $ARCHIVES_LOC" echo "BUILD_OPTIONS = $BUILD_OPTIONS" - if [[ "$VM_NAME" == *"-enb-usrp"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] then echo "This VM type is no longer supported in the pipeline framework" return diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 0debe42468..e5011dcd46 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -83,6 +83,7 @@ class Containerize(): self.flexranCtrlDeployed = False self.flexranCtrlIpAddress = '' self.cli = '' + self.cliBuildOptions = '' self.dockerfileprefix = '' self.host = '' self.allImagesSize = {} @@ -124,9 +125,11 @@ class Containerize(): if self.host == 'Ubuntu': self.cli = 'docker' self.dockerfileprefix = '.ubuntu18' + self.cliBuildOptions = '--no-cache' elif self.host == 'Red Hat': self.cli = 'sudo podman' self.dockerfileprefix = '.rhel8.2' + self.cliBuildOptions = '--no-cache --disable-compression' imageNames = [] result = re.search('eNB', self.imageKind) @@ -144,6 +147,8 @@ class Containerize(): imageNames.append(('oai-gnb', 'gNB')) imageNames.append(('oai-lte-ue', 'lteUE')) imageNames.append(('oai-nr-ue', 'nrUE')) + if self.host == 'Red Hat': + imageNames.append(('oai-physim', 'phySim')) if len(imageNames) == 0: imageNames.append(('oai-enb', 'eNB')) @@ -201,7 +206,7 @@ class Containerize(): # Build the shared image only on Push Events (not on Merge Requests) if (not self.ranAllowMerge): - mySSH.command(self.cli + ' build --target ' + sharedimage + ' --tag ' + sharedimage + ':' + sharedTag + ' --file docker/Dockerfile.ran' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 1600) + mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + sharedimage + ' --tag ' + sharedimage + ':' + sharedTag + ' --file docker/Dockerfile.ran' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 1600) # First verify if the shared image was properly created. status = True mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + sharedimage + ':' + sharedTag, '\$', 5) @@ -249,7 +254,7 @@ class Containerize(): # the archived Dockerfiles have "ran-build:latest" as base image # we need to update them with proper tag mySSH.command('sed -i -e "s#' + sharedimage + ':latest#' + sharedimage + ':' + sharedTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) - mySSH.command(self.cli + ' build --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) + mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) # split the log mySSH.command('mkdir -p cmake_targets/log/' + image, '\$', 5) mySSH.command('python3 ci-scripts/docker_log_split.py --logfilename=cmake_targets/log/' + image + '.log', '\$', 5) diff --git a/ci-scripts/createVM.sh b/ci-scripts/createVM.sh index b67668f0bc..ab859c10d7 100755 --- a/ci-scripts/createVM.sh +++ b/ci-scripts/createVM.sh @@ -87,7 +87,7 @@ function create_vm { echo "VM_CPU = $VM_CPU" echo "VM_DISK = $VM_DISK GBytes" - if [[ "$VM_NAME" == *"-enb-usrp"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] then echo "This VM type is no longer supported in the pipeline framework" return diff --git a/ci-scripts/html.py b/ci-scripts/html.py index b3ee00e7dc..a0ac638573 100644 --- a/ci-scripts/html.py +++ b/ci-scripts/html.py @@ -479,3 +479,88 @@ class HTMLManagement(): self.htmlFile.write(' \n') self.htmlFile.close() + def CreateHtmlTestRowCppCheckResults(self, CCR): + if (self.htmlFooterCreated or (not self.htmlHeaderCreated)): + return + self.htmlFile = open('test_results.html', 'a') + vId = 0 + for version in CCR.versions: + self.htmlFile.write(' \n') + self.htmlFile.write(' Results for cppcheck v ' + version + ' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' NB ERRORS\n') + if CCR.nbErrors[vId] == 0: + myColor = 'lightgreen' + elif CCR.nbErrors[vId] < 20: + myColor = 'orange' + else: + myColor = 'lightcoral' + self.htmlFile.write(' ' + str(CCR.nbErrors[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' NB WARNINGS\n') + if CCR.nbWarnings[vId] == 0: + myColor = 'lightgreen' + elif CCR.nbWarnings[vId] < 20: + myColor = 'orange' + else: + myColor = 'lightcoral' + self.htmlFile.write(' ' + str(CCR.nbWarnings[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' ----------------- \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Memory leak\n') + self.htmlFile.write(' ' + str(CCR.nbMemLeaks[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Possible null pointer deference\n') + self.htmlFile.write(' ' + str(CCR.nbNullPtrs[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Uninitialized variable\n') + self.htmlFile.write(' ' + str(CCR.nbUninitVars[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Undefined behaviour shifting\n') + self.htmlFile.write(' ' + str(CCR.nbTooManyBitsShift[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Signed integer overflow\n') + self.htmlFile.write(' ' + str(CCR.nbIntegerOverflow[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Printf formatting issues\n') + self.htmlFile.write(' ' + str(CCR.nbInvalidPrintf[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Modulo result is predetermined\n') + self.htmlFile.write(' ' + str(CCR.nbModuloAlways[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Opposite Condition -> dead code\n') + self.htmlFile.write(' ' + str(CCR.nbOppoInnerCondition[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Wrong Scanf Nb Args\n') + self.htmlFile.write(' ' + str(CCR.nbWrongScanfArg[vId]) + '\n') + self.htmlFile.write(' \n') + vId += 1 + + self.htmlFile.close() diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 3094197c54..d23e9de2cb 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -42,6 +42,7 @@ import cls_oaicitest #main class for OAI CI test framework import cls_physim #class PhySim for physical simulators build and test import cls_cots_ue #class CotsUe for Airplane mode control import cls_containerize #class Containerize for all container-based operations on RAN/UE objects +import cls_static_code_analysis #class for static code analysis import sshconnection @@ -378,6 +379,7 @@ EPC = epc.EPCManagement() RAN = ran.RANManagement() HTML = html.HTMLManagement() CONTAINERS = cls_containerize.Containerize() +SCA = cls_static_code_analysis.StaticCodeAnalysis() ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build @@ -388,7 +390,7 @@ ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU b #----------------------------------------------------------- import args_parse -py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP) +py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA) @@ -741,6 +743,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re CONTAINERS.DeployObject(HTML, EPC) elif action == 'Undeploy_Object': CONTAINERS.UndeployObject(HTML, RAN) + elif action == 'Cppcheck_Analysis': + SCA.CppCheckAnalysis(HTML) else: sys.exit('Invalid class (action) from xml') if not RAN.prematureExit: diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh index 19a486303f..489074e5e8 100755 --- a/ci-scripts/reportBuildLocally.sh +++ b/ci-scripts/reportBuildLocally.sh @@ -568,6 +568,8 @@ function report_build { echo "

Ubuntu 16.04 LTS -- Summary

" >> ./build_results.html + if [ -f ./archives/cppcheck/cppcheck.xml ] + then sca_summary_table_header ./archives/cppcheck/cppcheck.xml "OAI Static Code Analysis with CPPCHECK" sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized variable" uninitvar sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized struct member" uninitStructMember @@ -579,6 +581,7 @@ function report_build { sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Buffer is accessed out of bounds" bufferAccessOutOfBounds sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Expression depends on order of evaluation of side effects" unknownEvaluationOrder sca_summary_table_footer ./archives/cppcheck/cppcheck.xml + fi # summary_table_header "OAI Build: 4G LTE eNB -- USRP option" ./archives/enb_usrp # summary_table_row "LTE SoftModem - Release 15" ./archives/enb_usrp/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./enb_usrp_row1.html diff --git a/ci-scripts/waitBuildOnVM.sh b/ci-scripts/waitBuildOnVM.sh index ff2129a187..f7e300edf4 100755 --- a/ci-scripts/waitBuildOnVM.sh +++ b/ci-scripts/waitBuildOnVM.sh @@ -47,7 +47,7 @@ function wait_on_vm_build { echo "ARCHIVES_LOC = $ARCHIVES_LOC" echo "BUILD_OPTIONS = $BUILD_OPTIONS" - if [[ "$VM_NAME" == *"-enb-usrp"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] then echo "This VM type is no longer supported in the pipeline framework" return @@ -73,6 +73,9 @@ function wait_on_vm_build { echo "############################################################" echo "Waiting build process to end on VM ($VM_NAME)" echo "############################################################" + # Since the last VM was cppcheck and is removed + # we are going too fast in wait and the build_oai is not yet started + sleep 120 if [[ "$VM_NAME" == *"-cppcheck"* ]] then @@ -90,7 +93,7 @@ function wait_on_vm_build { } function check_on_vm_build { - if [[ "$VM_NAME" == *"-enb-usrp"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] then echo "This VM type is no longer supported in the pipeline framework" return diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index 0e00a2e7d4..de16116124 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -37,3 +37,4 @@ - Build_Image - Deploy_Object - Undeploy_Object + - Cppcheck_Analysis diff --git a/common/utils/assertions.h b/common/utils/assertions.h index 48d8df401c..06d43bdbfa 100644 --- a/common/utils/assertions.h +++ b/common/utils/assertions.h @@ -39,7 +39,7 @@ void output_log_mem(void); display_backtrace(); \ fflush(stdout); \ fflush(stderr); \ - exit(EXIT_FAILURE); \ + abort(); #define _Assert_(cOND, aCTION, fORMAT, aRGS...) \ do { \ diff --git a/common/utils/system.c b/common/utils/system.c index 239ea525c7..4c6c1a4dc0 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -200,10 +200,14 @@ void start_background_system(void) { void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority){ pthread_attr_t attr; int ret; - AssertFatal(0==(ret=pthread_attr_init(&attr)),"ret: %d, errno: %d\n",ret, errno); - AssertFatal(0==(ret=pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)),"ret: %d, errno: %d\n",ret, errno); - AssertFatal(0==(ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED)),"ret: %d, errno: %d\n",ret, errno); - AssertFatal(0==(ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI)),"ret: %d, errno: %d\n",ret, errno); + ret=pthread_attr_init(&attr); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + ret=pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); if(prioritysched_get_priority_max(SCHED_FIFO)) { LOG_E(TMR,"Prio not possible: %d, min is %d, max: %d, forced in the range\n", priority, @@ -217,8 +221,10 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, AssertFatal(priority<=sched_get_priority_max(SCHED_OAI),""); struct sched_param sparam={0}; sparam.sched_priority = priority; - AssertFatal(0==(ret=pthread_attr_setschedparam(&attr, &sparam)),"ret: %d, errno: %d\n",ret, errno); - AssertFatal(0==(ret=pthread_create(t, &attr, func, param)),"ret: %d, errno: %d\n",ret, errno); + ret=pthread_attr_setschedparam(&attr, &sparam); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + ret=pthread_create(t, &attr, func, param); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); pthread_setname_np(*t, name); if (affinity != -1 ) { diff --git a/common/utils/system.h b/common/utils/system.h index b576495a46..fbfd338a1a 100644 --- a/common/utils/system.h +++ b/common/utils/system.h @@ -49,7 +49,7 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, #define SCHED_OAI SCHED_RR #define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_OAI) -#define OAI_PRIORITY_RT ((sched_get_priority_min(SCHED_OAI)+sched_get_priority_min(SCHED_OAI))/2) +#define OAI_PRIORITY_RT ((sched_get_priority_min(SCHED_OAI)+sched_get_priority_max(SCHED_OAI))/2) #define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_OAI)-2 void thread_top_init(char *thread_name, diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h index 5db1a5e34e..c438989747 100644 --- a/common/utils/threadPool/thread-pool.h +++ b/common/utils/threadPool/thread-pool.h @@ -37,14 +37,21 @@ #else #define THREADINIT PTHREAD_MUTEX_INITIALIZER #endif -#define mutexinit(mutex) AssertFatal(pthread_mutex_init(&mutex,NULL)==0,""); -#define condinit(signal) AssertFatal(pthread_cond_init(&signal,NULL)==0,""); -#define mutexlock(mutex) AssertFatal(pthread_mutex_lock(&mutex)==0,""); +#define mutexinit(mutex) {int ret=pthread_mutex_init(&mutex,NULL); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define condinit(signal) {int ret=pthread_cond_init(&signal,NULL); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define mutexlock(mutex) {int ret=pthread_mutex_lock(&mutex); \ + AssertFatal(ret==0,"ret=%d\n",ret);} #define mutextrylock(mutex) pthread_mutex_trylock(&mutex) -#define mutexunlock(mutex) AssertFatal(pthread_mutex_unlock(&mutex)==0,""); -#define condwait(condition, mutex) AssertFatal(pthread_cond_wait(&condition, &mutex)==0,""); -#define condbroadcast(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,""); -#define condsignal(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,""); +#define mutexunlock(mutex) {int ret=pthread_mutex_unlock(&mutex); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define condwait(condition, mutex) {int ret=pthread_cond_wait(&condition, &mutex); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define condbroadcast(signal) {int ret=pthread_cond_broadcast(&signal); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define condsignal(signal) {int ret=pthread_cond_broadcast(&signal); \ + AssertFatal(ret==0,"ret=%d\n",ret);} #define tpool_nbthreads(tpool) (tpool.nbThreads) typedef struct notifiedFIFO_elt_s { struct notifiedFIFO_elt_s *next; diff --git a/common/utils/threadPool/thread-pool.md b/common/utils/threadPool/thread-pool.md index 80f3b99446..f2422d9822 100644 --- a/common/utils/threadPool/thread-pool.md +++ b/common/utils/threadPool/thread-pool.md @@ -214,4 +214,4 @@ threadPoolMeasurements to a valid file name These measurements will be wrote to this Linux pipe. A tool to read the linux fifo and display it in ascii is provided; compute the binay: -in cmake building directory: make/ninja measurement_display \ No newline at end of file +in cmake building directory: make/ninja measurement_display diff --git a/executables/main-ocp.c b/executables/main-ocp.c index 93a24f9ddf..2851bbe41c 100644 --- a/executables/main-ocp.c +++ b/executables/main-ocp.c @@ -1321,7 +1321,7 @@ int main ( int argc, char **argv ) { // end of CI modifications //getchar(); - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) load_softscope("enb", NULL); itti_wait_tasks_end(); @@ -1330,7 +1330,7 @@ int main ( int argc, char **argv ) { // stop threads if (RC.nb_inst == 0 || !NODE_IS_CU(node_type)) { - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) end_forms(); LOG_I(ENB_APP,"stopping MODEM threads\n"); diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 379bbfeb5c..a92f433560 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -126,7 +126,7 @@ void tx_func(void *param) { syncMsg->slot_tx = slot_tx; syncMsg->timestamp_tx = info->timestamp_tx; syncMsg->ru = gNB->RU_list[0]; - res->key = 1000+slot_tx; + res->key = slot_tx; pushTpool(gNB->threadPool, res); } @@ -275,7 +275,7 @@ void rx_func(void *param) { syncMsg->frame_tx = frame_tx; syncMsg->slot_tx = slot_tx; syncMsg->timestamp_tx = info->timestamp_tx; - res->key = 2000+slot_tx; + res->key = slot_tx; pushTpool(gNB->threadPool, res); } diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 6aa21613da..74e1333636 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -89,7 +89,7 @@ static int DEFBFW[] = {0x00007fff}; #include "s1ap_eNB.h" #include "SIMULATION/ETH_TRANSPORT/proto.h" - +#include #include "T.h" @@ -1344,7 +1344,8 @@ void *ru_thread( void *param ) { for (aa=0;aanb_rx;aa++) memcpy((void*)RC.gNB[0]->common_vars.rxdataF[aa], (void*)ru->common.rxdataF[aa], fp->symbols_per_slot*fp->ofdm_symbol_size*sizeof(int32_t)); - + if (IS_SOFTMODEM_DOSCOPE && RC.gNB[0]->scopeData) + ((scopeData_t*)RC.gNB[0]->scopeData)->slotFunc(ru->common.rxdataF[0],proc->tti_rx, RC.gNB[0]->scopeData); // Do PRACH RU processing int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST); @@ -1390,7 +1391,7 @@ void *ru_thread( void *param ) { syncMsg->frame_tx = proc->frame_tx; syncMsg->slot_tx = proc->tti_tx; syncMsg->timestamp_tx = proc->timestamp_tx; - res->key = 3000+proc->tti_rx; + res->key = proc->tti_rx; pushTpool(gNB->threadPool, res); } diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index fc5c284ef2..ad67457bd8 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -809,7 +809,7 @@ if(!IS_SOFTMODEM_NOS1) printf("RC.nb_RU:%d\n", RC.nb_RU); // once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration) printf("ALL RUs ready - init gNBs\n"); - if(IS_SOFTMODEM_DOFORMS) { + if(IS_SOFTMODEM_DOSCOPE) { sleep(1); scopeParms_t p; p.argc=&argc; diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 47ddd7896e..2adf373196 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -332,6 +332,14 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { protocol_ctxt_t ctxt; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0); pdcp_run(&ctxt); + + /* send tick to RLC and PDCP every ms */ + if (proc->nr_slot_rx % UE->frame_parms.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 / UE->frame_parms.slots_per_subframe); + nr_pdcp_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe); + } } } diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index c5364e38af..64cf0759e1 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -472,7 +472,7 @@ int main( int argc, char **argv ) { configure_linux(); mlockall(MCL_CURRENT | MCL_FUTURE); - if(IS_SOFTMODEM_DOFORMS) { + if(IS_SOFTMODEM_DOSCOPE) { load_softscope("nr",PHY_vars_UE_g[0][0]); } diff --git a/executables/ocp-gnb.c b/executables/ocp-gnb.c index a12cef9052..34cd2ce269 100644 --- a/executables/ocp-gnb.c +++ b/executables/ocp-gnb.c @@ -994,7 +994,7 @@ int main( int argc, char **argv ) { (void *)NULL, "time_meas", -1, OAI_PRIORITY_RT_LOW); } - if(IS_SOFTMODEM_DOFORMS) { + if(IS_SOFTMODEM_DOSCOPE) { scopeParms_t tmp= {&argc, argv, &ru, RC.gNB[0]}; load_softscope("nr",&tmp); } diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index 1077c0e1ac..72cf2e32c5 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -140,7 +140,7 @@ void get_common_options(uint32_t execmask) { } if (do_forms) { - set_softmodem_optmask(SOFTMODEM_DOFORMS_BIT); + set_softmodem_optmask(SOFTMODEM_DOSCOPE_BIT); } if(parallel_config != NULL) set_parallel_conf(parallel_config); diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 7a7be1de96..27479033b0 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -188,7 +188,7 @@ extern "C" #define SOFTMODEM_RFSIM_BIT (1<<10) #define SOFTMODEM_BASICSIM_BIT (1<<11) #define SOFTMODEM_SIML1_BIT (1<<12) -#define SOFTMODEM_DOFORMS_BIT (1<<15) +#define SOFTMODEM_DOSCOPE_BIT (1<<15) #define SOFTMODEM_RECPLAY_BIT (1<<16) #define SOFTMODEM_ENB_BIT (1<<20) #define SOFTMODEM_GNB_BIT (1<<21) @@ -204,7 +204,7 @@ extern "C" #define IS_SOFTMODEM_RFSIM ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT) #define IS_SOFTMODEM_BASICSIM ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT) #define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT) -#define IS_SOFTMODEM_DOFORMS ( get_softmodem_optmask() & SOFTMODEM_DOFORMS_BIT) +#define IS_SOFTMODEM_DOSCOPE ( get_softmodem_optmask() & SOFTMODEM_DOSCOPE_BIT) #define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT) #define IS_SOFTMODEM_ENB_BIT ( get_softmodem_optmask() & SOFTMODEM_ENB_BIT) #define IS_SOFTMODEM_GNB_BIT ( get_softmodem_optmask() & SOFTMODEM_GNB_BIT) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c index b9da34a301..655878cfaa 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c @@ -43,36 +43,36 @@ static struct complex16 *primary_synch2_time __attribute__((aligned(32))); static void doIdft(int size, short *in, short *out) { switch (size) { - case 6: + case 6: idft(IDFT_128,in,out,1); - break; + break; - case 25: + case 25: idft(IDFT_512,in,out,1); - break; + break; - case 50: + case 50: idft(IDFT_1024,in,out,1); - break; - - case 75: + break; + + case 75: idft(IDFT_1536,in,out,1); - break; + break; - case 100: + case 100: idft(IDFT_2048,in,out,1); - break; + break; - default: + default: LOG_E(PHY,"Unsupported N_RB_DL %d\n",size); abort(); - break; + break; + } } -} static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSize) { int k=ofdmSize-36; - + for (int i=0; i<72; i++) { out[k].r = in[i].r>>1; //we need to shift input to avoid overflow in fft out[k].i = in[i].i>>1; @@ -83,7 +83,7 @@ static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSi k-=ofdmSize; } } -} + } int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) { // LTE_UE_COMMON *common_vars struct complex16 syncF_tmp[2048]__attribute__((aligned(32)))= {0}; @@ -102,7 +102,7 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) { // LTE_UE_COMMON *com copyPrimary( syncF_tmp, (struct complex16 *) primary_synch2, frame_parms->ofdm_symbol_size); doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch2_time); - if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)) { + if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){ LOG_M("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1); LOG_M("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1); LOG_M("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1); @@ -135,7 +135,7 @@ void lte_sync_time_free(void) { static inline int abs32(int x) { - return (((int)((short *)&x)[0])*((int)((short *)&x)[0]) + ((int)((short *)&x)[1])*((int)((short *)&x)[1])); + return (((int)((short*)&x)[0])*((int)((short*)&x)[0]) + ((int)((short*)&x)[1])*((int)((short*)&x)[1])); } static inline double absF(struct complexd x) { diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 35c4a6e8cb..35baef1792 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -52,7 +52,7 @@ * set as command line argument, see lte-softmodem.c * default value: 0 */ -int16_t nr_dlsch_demod_shift = 0; +int32_t nr_dlsch_demod_shift = 0; //int16_t interf_unaw_shift = 13; //#define DEBUG_HARQ diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c index 376315734a..982ca9d254 100644 --- a/openair1/PHY/TOOLS/calibration_test.c +++ b/openair1/PHY/TOOLS/calibration_test.c @@ -15,6 +15,7 @@ uint64_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int opp_enabled; static double snr_dB=20; +THREAD_STRUCT thread_struct; #include int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state) {return 0;} diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c index 6852000ca9..f8321d7265 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.c +++ b/openair1/PHY/TOOLS/lte_phy_scope.c @@ -679,7 +679,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, if (frame_parms->N_RB_DL != 100) { fl_set_xyplot_data(form->pdcch_llr,bit_pdcch,llr_pdcch,12*frame_parms->N_RB_DL*2*num_pdcch_symbols,"","",""); } else { - LOG_D(HW,"UE PDCCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n"); + LOG_D(PHY,"UE PDCCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n"); } } @@ -693,7 +693,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, if (frame_parms->N_RB_DL != 100) { fl_set_xyplot_data(form->pdcch_comp,I,Q,12*frame_parms->N_RB_DL*num_pdcch_symbols,"","",""); } else { - LOG_D(HW,"UE PDCCH COMP plot is bugged in 20 MHz BW, to be fixed !!!\n"); + LOG_D(PHY,"UE PDCCH COMP plot is bugged in 20 MHz BW, to be fixed !!!\n"); } } @@ -709,7 +709,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, if (frame_parms->N_RB_DL != 100) { fl_set_xyplot_data(form->pdsch_llr,bit,llr,coded_bits_per_codeword,"","",""); } else { - LOG_D(HW,"UE PDSCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n"); + LOG_D(PHY,"UE PDSCH LLR plot is bugged in 20 MHz BW, to be fixed !!!\n"); } } diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index b45c1abf0b..7d239340e4 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -38,10 +38,7 @@ int otg_enabled; const FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW}; const FL_COLOR water_colors[4] = {FL_BLUE,FL_GREEN,FL_YELLOW,FL_RED}; -typedef struct { - int16_t r; - int16_t i; -} scopeSample_t; +typedef struct complex16 scopeSample_t; #define SquaredNorm(VaR) ((VaR).r*(VaR).r+(VaR).i*(VaR).i) typedef struct OAIgraph { @@ -59,7 +56,7 @@ typedef struct OAIgraph { double *waterFallAvg; boolean_t initDone; int iteration; - void (*gNBfunct) (struct OAIgraph *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id); + void (*gNBfunct) (struct OAIgraph *graph, scopeData_t *p, int UE_id); void (*nrUEfunct)(struct OAIgraph *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id); } OAIgraph_t; @@ -135,7 +132,7 @@ static void commonGraph(OAIgraph_t *graph, int type, FL_Coord x, FL_Coord y, FL_ graph->iteration=0; } -static OAIgraph_t gNBcommonGraph( void (*funct) (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id), +static OAIgraph_t gNBcommonGraph( void (*funct) (OAIgraph_t *graph, scopeData_t *p, int UE_id), int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { OAIgraph_t graph; commonGraph(&graph, type, x, y, w, h, label, pointColor); @@ -226,7 +223,8 @@ static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int laye static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize, const int divisions, const char *label) { if ( values == NULL ) - return; + return; + fl_winset(FL_ObjWin(graph->graph)); const int samplesPerPixel=datasize/graph->w; int displayPart=graph->waterFallh-ScaleZone; @@ -297,10 +295,10 @@ static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const sc } } -static void gNBWaterFall (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { - NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; +static void gNBWaterFall (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { + NR_DL_FRAME_PARMS *frame_parms=&p->gNB->frame_parms; //use 1st antenna - genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdata[0], + genericWaterFall(graph, (scopeSample_t *)p->ru->common.rxdata[0], frame_parms->samples_per_frame, frame_parms->slots_per_frame, "X axis:one frame in time"); } @@ -318,31 +316,35 @@ static void timeSignal (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy } */ -static void timeResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { - const int len=2*phy_vars_gnb->frame_parms.ofdm_symbol_size; +static void timeResponse (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { + const int len=2*p->gNB->frame_parms.ofdm_symbol_size; float *values, *time; oai_xygraph_getbuff(graph, &time, &values, len, 0); const int ant=0; // display antenna 0 for each UE for (int ue=0; uepusch_vars[ue]->ul_ch_estimates_time[ant]; + if ( p->gNB->pusch_vars && p->gNB->pusch_vars[ue] && + p->gNB->pusch_vars[ue]->ul_ch_estimates_time && + p->gNB->pusch_vars[ue]->ul_ch_estimates_time[ant] ) { + scopeSample_t *data= (scopeSample_t *)p->gNB->pusch_vars[ue]->ul_ch_estimates_time[ant]; - if (data != NULL) { - for (int i=0; iframe_parms; +static void gNBfreqWaterFall (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { + NR_DL_FRAME_PARMS *frame_parms=&p->gNB->frame_parms; //use 1st antenna - genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdataF[0], frame_parms->samples_per_frame_wCP, + genericWaterFall(graph, (scopeSample_t *)p->rxdataF, frame_parms->samples_per_frame_wCP, frame_parms->slots_per_frame, - "X axis: Frequency domain, one frame"); + "X axis: Frequency domain, one subframe"); } /* @@ -354,16 +356,18 @@ static void frequencyResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU } */ -static void puschLLR (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { +static void puschLLR (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { //int Qm = 2; int coded_bits_per_codeword =3*8*6144+12; // (8*((3*8*6144)+12)); // frame_parms->N_RB_UL*12*Qm*frame_parms->symbols_per_tti; for (int ue=0; uepusch_vars[ue]->llr; - float *llr, *bit; - oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword, ue); + if ( p->gNB->pusch_vars && + p->gNB->pusch_vars[ue] && + p->gNB->pusch_vars[ue]->llr ) { + int16_t *pusch_llr = (int16_t *)p->gNB->pusch_vars[ue]->llr; + float *llr, *bit; + oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword, ue); - if (pusch_llr) { for (int i=0; iframe_parms; +static void puschIQ (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { + NR_DL_FRAME_PARMS *frame_parms=&p->gNB->frame_parms; int sz=frame_parms->N_RB_UL*12*frame_parms->symbols_per_slot; for (int ue=0; uepusch_vars[ue]->rxdataF_comp[0]; - float *I, *Q; - oai_xygraph_getbuff(graph, &I, &Q, sz, ue); + if ( p->gNB->pusch_vars && + p->gNB->pusch_vars[ue] && + p->gNB->pusch_vars[ue]->rxdataF_comp && + p->gNB->pusch_vars[ue]->rxdataF_comp[0] ) { + scopeSample_t *pusch_comp = (scopeSample_t *) p->gNB->pusch_vars[ue]->rxdataF_comp[0]; + float *I, *Q; + oai_xygraph_getbuff(graph, &I, &Q, sz, ue); - if (pusch_comp) { for (int k=0; kpucch1ab_stats[UE_id]; @@ -418,11 +425,9 @@ static void pucchEnergy (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *ph } */ } - -static void pucchIQ (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { +static void pucchIQ (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { } - -static void puschThroughtput (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { +static void puschThroughtput (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { // PUSCH Throughput /* float tput_time_enb[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; @@ -437,7 +442,6 @@ static void puschThroughtput (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_ // fl_set_xyplot_ybounds(form->pusch_tput,0,ymax); */ } - static OAI_phy_scope_t *create_phy_scope_gnb(void) { FL_OBJECT *obj; OAI_phy_scope_t *fdui = calloc(( sizeof *fdui ),1); @@ -486,11 +490,9 @@ static OAI_phy_scope_t *create_phy_scope_gnb(void) { fl_show_form (fdui->phy_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, "LTE UL SCOPE gNB"); return fdui; } - static const int scope_enb_num_ue = 1; void phy_scope_gNB(OAI_phy_scope_t *form, - PHY_VARS_gNB *phy_vars_gnb, - RU_t *phy_vars_ru, + scopeData_t *p, int UE_id) { static OAI_phy_scope_t *rememberForm=NULL; @@ -505,15 +507,14 @@ void phy_scope_gNB(OAI_phy_scope_t *form, int i=0; while (form->graph[i].graph) { - form->graph[i].gNBfunct(form->graph+i, phy_vars_gnb, phy_vars_ru, UE_id); + form->graph[i].gNBfunct(form->graph+i, p, UE_id); i++; } //fl_check_forms(); } - static void *scope_thread_gNB(void *arg) { - scopeParms_t *p=(scopeParms_t *) arg; + scopeData_t *p=(scopeData_t *) arg; //# ifdef ENABLE_XFORMS_WRITE_STATS // FILE *gNB_stats = fopen("gNB_stats.txt", "w"); //#endif @@ -530,20 +531,32 @@ static void *scope_thread_gNB(void *arg) { OAI_phy_scope_t *form_gnb = create_phy_scope_gnb(); while (!oai_exit) { - phy_scope_gNB(form_gnb, p->gNB, p->ru, nb_ue); + phy_scope_gNB(form_gnb, p, nb_ue); usleep(99*1000); } return NULL; } - +static void copyRxdataF(int32_t *data, int slot, void *scopeData) { + scopeData_t *scope=(scopeData_t *)scopeData; + memcpy(scope->rxdataF + slot*scope->gNB->frame_parms.samples_per_slot_wCP, + data, + scope->gNB->frame_parms.samples_per_slot_wCP); +} void gNBinitScope(scopeParms_t *p) { - static scopeParms_t parms; - memcpy(&parms,p,sizeof(parms)); + p->gNB->scopeData=malloc(sizeof(scopeData_t)); + AssertFatal(p->gNB->scopeData,""); + scopeData_t *scope=(scopeData_t *) p->gNB->scopeData; + scope->argc=p->argc; + scope->argv=p->argv; + scope->ru=p->ru; + scope->gNB=p->gNB; + scope->slotFunc=copyRxdataF; + scope->rxdataF=(int32_t *) calloc(p->gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t),1); + AssertFatal(scope->rxdataF,""); pthread_t forms_thread; - threadCreate(&forms_thread, scope_thread_gNB, &parms, "scope", -1, OAI_PRIORITY_RT_LOW); + threadCreate(&forms_thread, scope_thread_gNB, p->gNB->scopeData, "scope", -1, OAI_PRIORITY_RT_LOW); } - static void ueWaterFall (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // Received signal in time domain of receive antenna 0 genericWaterFall(graph, @@ -552,7 +565,6 @@ static void ueWaterFall (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eN phy_vars_ue->frame_parms.slots_per_frame, "X axis: one frame time"); } - /* replaced by waterfall static void ueTimeResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // Received signal in time domain of receive antenna 0 @@ -561,14 +573,12 @@ static void ueTimeResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int phy_vars_ue->frame_parms.samples_per_frame); } */ - static void ueChannelResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // Channel Impulse Response genericPowerPerAntena(graph, phy_vars_ue->frame_parms.nb_antennas_rx, (const scopeSample_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates_time, phy_vars_ue->frame_parms.ofdm_symbol_size>>3); } - static void ueFreqWaterFall (OAIgraph_t *graph,PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id ) { NR_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->frame_parms; //use 1st antenna @@ -578,7 +588,6 @@ static void ueFreqWaterFall (OAIgraph_t *graph,PHY_VARS_NR_UE *phy_vars_ue, int phy_vars_ue->frame_parms.slots_per_frame, "X axis: one frame frequency" ); } - /* static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // Channel Frequency Response (includes 5 complex sample for filter) @@ -614,7 +623,6 @@ static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue oai_xygraph(graph,freq,chest_f_abs,frame_parms->ofdm_symbol_size,0,10); } */ - static void uePbchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PBCH LLRs if ( !phy_vars_ue->pbch_vars[eNB_id]->llr) @@ -630,7 +638,6 @@ static void uePbchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ oai_xygraph(graph,bit_pbch,llr_pbch,864,0,10); } - static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PBCH I/Q of MF Output if (!phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0]) @@ -665,15 +672,14 @@ static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i AssertFatal(base <= 180*3,""); oai_xygraph(graph,I,Q,base,0, 10); } - static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PDCCH LLRs if (!phy_vars_ue->pdcch_vars[0][eNB_id]->llr) return; - int num_re = 4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols - int Qm = 2; - int coded_bits_per_codeword = num_re*Qm; + //int num_re = 4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols + //int Qm = 2; + int coded_bits_per_codeword = 2*4*100*12; //num_re*Qm; float *llr, *bit; oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword*RX_NB_TH_MAX, 0); int base=0; @@ -691,7 +697,6 @@ static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ AssertFatal(base <= coded_bits_per_codeword*RX_NB_TH_MAX, ""); oai_xygraph(graph,bit,llr,base,0,10); } - static void uePcchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PDCCH I/Q of MF Output if (!phy_vars_ue->pdcch_vars[0][eNB_id]->rxdataF_comp[0]) @@ -716,7 +721,6 @@ static void uePcchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i AssertFatal(base <= nb*RX_NB_TH_MAX, ""); oai_xygraph(graph,I,Q,base,0,10); } - static void uePdschLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PDSCH LLRs if (!phy_vars_ue->pdsch_vars[0][eNB_id]->llr[0]) @@ -744,7 +748,6 @@ static void uePdschLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB //fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword); oai_xygraph(graph,bit,llr,base,0,10); } - static void uePdschIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PDSCH I/Q of MF Output if (!phy_vars_ue->pdsch_vars[0][eNB_id]->rxdataF_comp0[0]) @@ -772,7 +775,6 @@ static void uePdschIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ AssertFatal(base <= sz*RX_NB_TH_MAX, ""); oai_xygraph(graph,I,Q,sz*RX_NB_TH_MAX,0,10); } - static void uePdschThroughput (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { /* float tput_time_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; @@ -796,7 +798,6 @@ static void uePdschThroughput (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, fl_set_xyplot_ybounds(form->pdsch_tput,0,tput_ue_max[UE_id]); */ } - static OAI_phy_scope_t *create_phy_scope_nrue( int ID ) { FL_OBJECT *obj; OAI_phy_scope_t *fdui = calloc(( sizeof *fdui ),1); @@ -866,7 +867,6 @@ static OAI_phy_scope_t *create_phy_scope_nrue( int ID ) { fl_show_form (fdui->phy_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, buf); return fdui; } - void phy_scope_nrUE(OAI_phy_scope_t *form, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, @@ -890,8 +890,6 @@ void phy_scope_nrUE(OAI_phy_scope_t *form, //fl_check_forms(); } - - static void *nrUEscopeThread(void *arg) { PHY_VARS_NR_UE *ue=(PHY_VARS_NR_UE *)arg; size_t stksize; @@ -915,13 +913,10 @@ static void *nrUEscopeThread(void *arg) { pthread_exit((void *)arg); } - void nrUEinitScope(PHY_VARS_NR_UE *ue) { pthread_t forms_thread; threadCreate(&forms_thread, nrUEscopeThread, ue, "scope", -1, OAI_PRIORITY_RT_LOW); } - - void nrscope_autoinit(void *dataptr) { AssertFatal( (IS_SOFTMODEM_GNB_BIT||IS_SOFTMODEM_5GUE_BIT),"Scope cannot find NRUE or GNB context"); @@ -956,7 +951,6 @@ static void reset_stats_gNB(FL_OBJECT *button, } } } - static FD_stats_form *create_form_stats_form(int ID) { FL_OBJECT *obj; FD_stats_form *fdui = calloc(( sizeof *fdui ),1); diff --git a/openair1/PHY/TOOLS/nr_phy_scope.h b/openair1/PHY/TOOLS/nr_phy_scope.h index 84b9e66908..e34ddf2c20 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.h +++ b/openair1/PHY/TOOLS/nr_phy_scope.h @@ -33,13 +33,7 @@ //#include "PHY/impl_defs_top.h" #include "PHY/defs_nr_UE.h" -typedef struct { - int *argc; - char **argv; - RU_t *ru; - PHY_VARS_gNB *gNB; -} scopeParms_t; - +#include extern RAN_CONTEXT_t RC; #endif diff --git a/openair1/PHY/TOOLS/phy_scope_interface.h b/openair1/PHY/TOOLS/phy_scope_interface.h index adf04d5ea4..8b747d575d 100644 --- a/openair1/PHY/TOOLS/phy_scope_interface.h +++ b/openair1/PHY/TOOLS/phy_scope_interface.h @@ -29,7 +29,26 @@ * \note * \warning */ +#ifndef __PHY_SCOPE_INTERFACE_H__ +#define __PHY_SCOPE_INTERFACE_H__ +#include +typedef struct { + int *argc; + char **argv; + RU_t *ru; + PHY_VARS_gNB *gNB; +} scopeParms_t; +typedef struct scopeData_s { + int *argc; + char **argv; + RU_t *ru; + PHY_VARS_gNB *gNB; + int32_t * rxdataF; + void (*slotFunc)(int32_t* data, int slot, void * scopeData); +} scopeData_t; + int load_softscope(char *exectype, void *initarg); int end_forms(void) ; +#endif diff --git a/openair1/PHY/TOOLS/time_meas.c b/openair1/PHY/TOOLS/time_meas.c index 396674333a..891238c347 100644 --- a/openair1/PHY/TOOLS/time_meas.c +++ b/openair1/PHY/TOOLS/time_meas.c @@ -31,14 +31,14 @@ double cpu_freq_GHz __attribute__ ((aligned(32)))=0.0; double get_cpu_freq_GHz(void) { if (cpu_freq_GHz <1 ) { - time_stats_t ts = {0}; - reset_meas(&ts); - ts.trials++; - ts.in = rdtsc_oai(); - sleep(1); - ts.diff = (rdtsc_oai()-ts.in); - cpu_freq_GHz = (double)ts.diff/1000000000; - printf("CPU Freq is %f \n", cpu_freq_GHz); + time_stats_t ts = {0}; + reset_meas(&ts); + ts.trials++; + ts.in = rdtsc_oai(); + sleep(1); + ts.diff = (rdtsc_oai()-ts.in); + cpu_freq_GHz = (double)ts.diff/1000000000; + printf("CPU Freq is %f \n", cpu_freq_GHz); } return cpu_freq_GHz; } diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 2f6c4324b0..b7152632a1 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -846,7 +846,7 @@ typedef struct PHY_VARS_gNB_s { tpool_t *threadPool; int nbDecode; uint8_t pusch_proc_threads; - + void * scopeData; } PHY_VARS_gNB; typedef struct LDPCDecode_s { diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index df66217e49..638a89b2d3 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1134,7 +1134,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, LOG_D(PHY, "harq_pid: %d, TBS expected dlsch1: %d \n", harq_pid, dlsch1->harq_processes[harq_pid]->TBS); } - LOG_D(PHY," ------ end ldpc decoder for AbsSubframe %d.%d ------ \n", frame_rx, nr_slot_rx); + LOG_D(PHY," ------ end ldpc decoder for AbsSubframe %d.%d ------ decoded in %d \n", frame_rx, nr_slot_rx, ret); LOG_D(PHY, "harq_pid: %d, TBS expected dlsch0: %d \n",harq_pid, dlsch0->harq_processes[harq_pid]->TBS); if(retmax_ldpc_iterations+1){ diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c index 560c7b9383..0455c481d5 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c @@ -975,7 +975,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t LOG_E(PHY,"PUCCH Downlink DAI has an invalid value : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); } else if (harq_status->send_harq_status == 0) { - LOG_D(PHY,"PUCCH Downlink ack can not be transmitted : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); + LOG_E(PHY,"PUCCH Downlink ack can not be transmitted : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); } else { diff --git a/openair2/GNB_APP/L1_nr_paramdef.h b/openair2/GNB_APP/L1_nr_paramdef.h index 67be560778..88f2cb1615 100644 --- a/openair2/GNB_APP/L1_nr_paramdef.h +++ b/openair2/GNB_APP/L1_nr_paramdef.h @@ -62,7 +62,7 @@ {CONFIG_STRING_L1_REMOTE_N_PORTC, NULL, 0, uptr:NULL, defintval:50030, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_LOCAL_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_REMOTE_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \ -{CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0} \ +{CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:3, TYPE_UINT, 0} \ } #define L1_CC_IDX 0 #define L1_TRANSPORT_N_PREFERENCE_IDX 1 diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index b40ff5d9e2..9aa2f0fc67 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1014,14 +1014,16 @@ int RCconfig_nr_gtpu(void ) { MessageDef *message; if (gnb_mode == 1) { // NSA - AssertFatal((message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_ENB_S1_REQ))!=NULL,""); + message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_ENB_S1_REQ); + AssertFatal(message!=NULL,""); // IPV4_STR_ADDR_TO_INT_NWBO ( address, RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); // LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up); IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up); GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = gnb_port_for_S1U; } else {// TODO SA - AssertFatal((message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_GNB_NG_REQ))!=NULL,""); + message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_GNB_NG_REQ); + AssertFatal(message!=NULL,""); IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_GNB_NG_REQ(message).gnb_ip_address_for_NGu_up, "BAD IP ADDRESS FORMAT FOR gNB NG_U !\n" ); LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_GNB_NG_REQ(message).gnb_ip_address_for_NGu_up); GTPV1U_GNB_NG_REQ(message).gnb_port_for_NGu_up = gnb_port_for_NGU; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 844ee95d32..eea30abde3 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -981,7 +981,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, struct NR_PUSCH_TimeDomainResourceAllocationList *pusch_TimeDomainAllocationList = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; // k2 as per 3GPP TS 38.214 version 15.9.0 Release 15 ch 6.1.2.1.1 // PUSCH time domain resource allocation is higher layer configured from uschTimeDomainAllocationList in either pusch-ConfigCommon - uint8_t k2; + int k2; if (is_Msg3) { k2 = *pusch_TimeDomainAllocationList->list.array[tda_id]->k2; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 30a89cce77..8f54c3a498 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -806,6 +806,7 @@ void nr_schedule_ue_spec(module_id_t module_id, pdsch_pdu->qamModOrder[0] = Qm; pdsch_pdu->mcsIndex[0] = sched_ctrl->mcs; pdsch_pdu->mcsTable[0] = sched_ctrl->mcsTableIdx; + AssertFatal(harq->round<4,"%d",harq->round); pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq->round]; pdsch_pdu->TBSize[0] = TBS; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 247a7e2c45..3e53f07084 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -569,7 +569,9 @@ static void handle_dl_harq(module_id_t mod_id, add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].available_dl_harq, harq_pid); harq->round = 0; harq->ndi ^= 1; - } else if (harq->round == MAX_HARQ_ROUNDS) { + } else { + harq->round++; + if (harq->round == MAX_HARQ_ROUNDS) { add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].available_dl_harq, harq_pid); harq->round = 0; harq->ndi ^= 1; @@ -578,7 +580,7 @@ static void handle_dl_harq(module_id_t mod_id, LOG_D(MAC, "retransmission error for UE %d (total %d)\n", UE_id, stats->dlsch_errors); } else { add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].retrans_dl_harq, harq_pid); - harq->round++; + } } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 9784b6b79e..aff809fc55 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -346,7 +346,9 @@ void handle_nr_ul_harq(module_id_t mod_id, harq_pid, crc_pdu->rnti); add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid); - } else if (harq->round == MAX_HARQ_ROUNDS) { + } else { + harq->round++; + if (harq->round == MAX_HARQ_ROUNDS) { harq->ndi ^= 1; harq->round = 0; LOG_D(MAC, @@ -356,12 +358,12 @@ void handle_nr_ul_harq(module_id_t mod_id, UE_info->mac_stats[UE_id].ulsch_errors++; add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid); } else { - harq->round++; LOG_D(MAC, "Ulharq id %d crc failed for RNTI %04x\n", harq_pid, crc_pdu->rnti); add_tail_nr_list(&sched_ctrl->retrans_ul_harq, harq_pid); + } } } diff --git a/openair2/NETWORK_DRIVER/UE_IP/netlink.c b/openair2/NETWORK_DRIVER/UE_IP/netlink.c index 79fc37ae39..b3829c51d1 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/netlink.c +++ b/openair2/NETWORK_DRIVER/UE_IP/netlink.c @@ -39,7 +39,7 @@ #include "local.h" #include "proto_extern.h" -MODULE_LICENSE("GPL"); +MODULE_LICENSE("OAI"); #define OAI_IP_DRIVER_NETLINK_ID 31 #define NL_DEST_PID 1 diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h index a542c7bbab..bdf8872371 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.h +++ b/openair2/PHY_INTERFACE/phy_stub_UE.h @@ -18,7 +18,6 @@ //#include "openair1/PHY/LTE_TRANSPORT/defs.h" //below 2 difinitions move to phy_stub_UE.c to add initialization when difinition. -extern int tx_req_num_elems; extern UL_IND_t *UL_INFO; extern nfapi_tx_request_pdu_t* tx_request_pdu_list; // New @@ -27,14 +26,7 @@ extern nfapi_tx_request_pdu_t* tx_request_pdu_list; extern nfapi_dl_config_request_t* dl_config_req; extern nfapi_ul_config_request_t* ul_config_req; extern nfapi_hi_dci0_request_t* hi_dci0_req; - - -//below 2 difinitions move to lte-ue.c to add initialization when difinition. -//int next_ra_frame; -//module_id_t next_Mod_id; - - - +extern int tx_req_num_elems; // This function should return all the sched_response config messages which concern a specific UE. Inside this // function we should somehow make the translation of config message's rnti to Mod_ID. diff --git a/openair2/RRC/LTE/plmn_data.h b/openair2/RRC/LTE/plmn_data.h index 15dbd4aa23..701bcaf764 100644 --- a/openair2/RRC/LTE/plmn_data.h +++ b/openair2/RRC/LTE/plmn_data.h @@ -2296,7 +2296,6 @@ static const plmn_data_t plmn_data[] = { 648 4 Econet Wireless Econet Operational */ - }; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 535db82dfc..96df4a971f 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -282,6 +282,15 @@ THREAD_STRUCT = ( } ); +rfsimulator : +{ + serveraddr = "server"; + serverport = "4043"; + options = (); #("saviq"); or/and "chanmod" + modelname = "AWGN"; + IQfile = "/tmp/rfsimulator.iqs"; +}; + log_config : { global_log_level ="info"; diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 2db8ce5e7f..bdca959281 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -732,7 +732,7 @@ int main ( int argc, char **argv ) fflush(stderr); // end of CI modifications //getchar(); - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) load_softscope("enb",NULL); itti_wait_tasks_end(); oai_exit=1; @@ -740,7 +740,7 @@ int main ( int argc, char **argv ) // stop threads if (RC.nb_inst == 0 || !NODE_IS_CU(node_type)) { - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) end_forms(); LOG_I(ENB_APP,"stopping MODEM threads\n"); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 0ea2368b25..82140ea5aa 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -183,7 +183,7 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, { PHY_VARS_UE *ue = (PHY_VARS_UE *)calloc(1,sizeof(PHY_VARS_UE)); - + AssertFatal(ue,""); if (frame_parms!=(LTE_DL_FRAME_PARMS *)NULL) { // if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS)); } diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 9b0c8c3c91..6830fdacd3 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -759,7 +759,7 @@ int main( int argc, char **argv ) { PHY_vars_UE_g[0][0]->no_timing_correction = 1; } - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) load_softscope("ue",NULL); config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS); @@ -784,7 +784,7 @@ int main( int argc, char **argv ) { printf("oai_exit=%d\n",oai_exit); // stop threads - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) end_forms(); printf("stopping MODEM threads\n"); From a8a34df01f5bc7248576e9b192c0045b651087c1 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 14 Apr 2021 00:28:41 +0100 Subject: [PATCH 38/66] Fix compilation warning in oai_usrpdevif --- targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index 8025337ecb..8a2800611d 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -1337,18 +1337,18 @@ extern "C" { if(is_equal(s->sample_rate, (double)7.68e6)) s->tx_forward_nsamps = 50; - recplay_state_t *recPlay=device->recplay_state; + recplay_state_t *recPlay=device->recplay_state; - if (recPlay != NULL) { // record mode - recPlay->maxSizeBytes=openair0_cfg[0].recplay_conf->u_sf_max * + if (recPlay != NULL) { // record mode + recPlay->maxSizeBytes=openair0_cfg[0].recplay_conf->u_sf_max * (sizeof(iqrec_t)+BELL_LABS_IQ_BYTES_PER_SF); - recPlay->ms_sample = (iqrec_t *) malloc(recPlay->maxSizeBytes); - recPlay->currentPtr= (uint8_t *)recPlay->ms_sample; + recPlay->ms_sample = (iqrec_t *) malloc(recPlay->maxSizeBytes); + recPlay->currentPtr= (uint8_t *)recPlay->ms_sample; - if (recPlay->ms_sample == NULL) { - std::cerr<< "Memory allocation failed for subframe record or replay mode." << std::endl; - exit(-1); - } + if (recPlay->ms_sample == NULL) { + std::cerr<< "Memory allocation failed for subframe record or replay mode." << std::endl; + exit(-1); + } } return 0; } From 3fee93c79a5608e2f632566c9928a469ce47c7fb Mon Sep 17 00:00:00 2001 From: hardy Date: Mon, 12 Apr 2021 22:55:28 +0200 Subject: [PATCH 39/66] from poc to python class --- ci-scripts/Jenkinsfile-git-dashboard | 6 +- ci-scripts/data_extraction_from_gitlab.py | 49 ----- ci-scripts/ran_dashboard.py | 237 ++++++++++++++++++++++ 3 files changed, 240 insertions(+), 52 deletions(-) delete mode 100644 ci-scripts/data_extraction_from_gitlab.py create mode 100644 ci-scripts/ran_dashboard.py diff --git a/ci-scripts/Jenkinsfile-git-dashboard b/ci-scripts/Jenkinsfile-git-dashboard index 12533646c0..6ebd46bc76 100644 --- a/ci-scripts/Jenkinsfile-git-dashboard +++ b/ci-scripts/Jenkinsfile-git-dashboard @@ -31,11 +31,11 @@ pipeline { label pythonExecutor } stages { - stage ("Fetch Data") { + stage ("gDashboard") { steps { script { - //retrieve MR data from gitlab - sh returnStdout: true, script: 'python3 ci-scripts/data_extraction_from_gitlab.py' + //retrieve MR data from gitlab and export to gSheet + sh returnStdout: true, script: 'python3 ci-scripts/ran_dashboard.py' } } } diff --git a/ci-scripts/data_extraction_from_gitlab.py b/ci-scripts/data_extraction_from_gitlab.py deleted file mode 100644 index 8ed1cca79c..0000000000 --- a/ci-scripts/data_extraction_from_gitlab.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Wed Mar 31 21:57:37 2021 - -@author: hardy -""" - -import subprocess -import shlex -import json -import datetime - - -cmd="""curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100" """ -process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE) -output = process.stdout.readline() -tmp=output.decode("utf-8") - - -d = json.loads(tmp) -f = open("/tmp/gitlab_dashboard.txt", "w") -f.write("MR;Created_at;Author;Title;CAN START;IN PROGRESS;COMPLETED;OK MERGE;Merge conflicts\n") -for x in range(len(d)): - date_time_str = d[x]['created_at'] - date_time_obj = datetime.datetime.strptime(date_time_str, '%Y-%m-%dT%H:%M:%S.%fZ') - - milestone1=milestone2=milestone3=milestone4="" - if d[x]['milestone']=="REVIEW_CAN_START": - milestone1="X" - elif d[x]['milestone']=="REVIEW_IN_PROGRESS": - milestone2="X" - elif d[x]['milestone']=="REVIEW_COMPLETED_AND_APPROVED": - milestone3="X" - elif d[x]['milestone']=="OK_TO_BE_MERGED": - milestone4="X" - else: - pass - - - if d[x]['has_conflicts']==True: - conflicts = "YES" - else: - conflicts = "" - - f.write(str(d[x]['iid'])+';'+ str(date_time_obj.date())+';'+ str(d[x]['author']['name'])+';'+str(d[x]['title'])+";" \ - + milestone1 +";"+ milestone2 +";"+ milestone3 +";"+ milestone4 + ";" + conflicts +"\n") -f.close() - diff --git a/ci-scripts/ran_dashboard.py b/ci-scripts/ran_dashboard.py new file mode 100644 index 0000000000..78d86f5cf3 --- /dev/null +++ b/ci-scripts/ran_dashboard.py @@ -0,0 +1,237 @@ +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- +# Merge Requests Dashboard for RAN on googleSheet +# +# Required Python Version +# Python 3.x +# +#--------------------------------------------------------------------- + +#----------------------------------------------------------- +# Import +#----------------------------------------------------------- + +#import google spreadsheet API +import gspread +from oauth2client.service_account import ServiceAccountCredentials + + +import subprocess +import shlex #lexical analysis +import json #json structures +import datetime #now() and date formating +from datetime import datetime + +#----------------------------------------------------------- +# Class Declaration +#----------------------------------------------------------- + +class gDashboard: + def __init__(self, creds_file, spreadsheet, worksheet): #"creds.json", 'OAI RAN Dashboard', 'MR Status' + self.scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"] + self.creds = ServiceAccountCredentials.from_json_keyfile_name(creds_file, self.scope) + self.client = gspread.authorize(self.creds) + #spreadsheet + self.ss = self.client.open(spreadsheet) + #worksheet + self.sheet = self.ss.worksheet(worksheet) + self.ss.del_worksheet(self.sheet) #start by deleting the old sheet + self.sheet = self.ss.add_worksheet(title=worksheet, rows="100", cols="20") #create a new one + + self.d = {} #data dictionary + + + def fetchData(self,cmd): + #cmd="""curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100" """ + process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE) + output = process.stdout.readline() + tmp=output.decode("utf-8") + self.d = json.loads(tmp) + + + def gBuild(self): + + #line 1 : get update date + now = datetime.now() + # dd/mm/YY H:M:S + dt_string = "Update : " + now.strftime("%d/%m/%Y %H:%M") + row =[dt_string] + self.sheet.insert_row(row, index=1, value_input_option='RAW') + + #line 2 is empty + #line 3 is column names + i=3 + row =["MR","Created_at","Author","Title","Assignee", "Reviewer", "CAN START","IN PROGRESS","COMPLETED","OK MERGE","Merge conflicts"] + self.sheet.insert_row(row, index=i, value_input_option='RAW') + + #line 4 onward, build data lines + for x in range(len(self.d)): + i=i+1 + + + date_time_str = self.d[x]['created_at'] + date_time_obj = datetime.strptime(date_time_str, '%Y-%m-%dT%H:%M:%S.%fZ') + + milestone1=milestone2=milestone3=milestone4="" + if self.d[x]['milestone']['title']=="REVIEW_CAN_START": + milestone1="X" + elif self.d[x]['milestone']['title']=="REVIEW_IN_PROGRESS": + milestone2="X" + elif self.d[x]['milestone']['title']=="REVIEW_COMPLETED_AND_APPROVED": + milestone3="X" + elif self.d[x]['milestone']['title']=="OK_TO_BE_MERGED": + milestone4="X" + else: + pass + + #check if empty or not + if self.d[x]['assignee']!=None: + assignee = str(self.d[x]['assignee']['name']) + else: + assignee = "" + + #check if empty or not + if len(self.d[x]['reviewers'])!=0: + reviewer = str(self.d[x]['reviewers'][0]['name']) + else: + reviewer = "" + + if self.d[x]['has_conflicts']==True: + conflicts = "YES" + else: + conflicts = "" + + #build final row + row =[str(self.d[x]['iid']), str(date_time_obj.date()),str(self.d[x]['author']['name']),str(self.d[x]['title']),\ + assignee, reviewer,\ + milestone1,milestone2,milestone3,milestone4,conflicts] + + #write it to worksheet + self.sheet.insert_row(row, index=i, value_input_option='RAW') + + + def gFormat(self,sourceSheetName,destinationSheetName): # "Formating" , "MR Status" + + #copy formating template + sourceSheetId = self.ss.worksheet(sourceSheetName)._properties['sheetId'] + destinationSheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] + body = { + "requests": [ + { + "copyPaste": { + "source": { + "sheetId": sourceSheetId, + "startRowIndex": 0, + "endRowIndex": 40, + "startColumnIndex": 0, + "endColumnIndex": 20 + }, + "destination": { + "sheetId": destinationSheetId, + "startRowIndex": 0, + "endRowIndex": 40, + "startColumnIndex": 0, + "endColumnIndex": 20 + }, + "pasteType": "PASTE_FORMAT" + } + } + ] + } + self.ss.batch_update(body) + + #resize columns fit to data, except col 0 + sheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] + body = { + "requests": [ + { + 'autoResizeDimensions': { + 'dimensions': { + 'sheetId': sheetId, + 'dimension': 'COLUMNS', + 'startIndex': 1, + 'endIndex': 20 + } + } + } + ] + } + self.ss.batch_update(body) + + + #resize col 0 + sheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] + body = { + "requests": [ + { + "updateDimensionProperties": { + "range": { + "sheetId": sheetId, + "dimension": "COLUMNS", + "startIndex": 0, + "endIndex": 1 + }, + "properties": { + "pixelSize": 100 + }, + "fields": "pixelSize" + } + } + ] + } + self.ss.batch_update(body) + + + #resize milestones to be cleaner + sheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] + body = { + "requests": [ + { + "updateDimensionProperties": { + "range": { + "sheetId": sheetId, + "dimension": "COLUMNS", + "startIndex": 6, + "endIndex": 10 + }, + "properties": { + "pixelSize": 135 + }, + "fields": "pixelSize" + } + } + ] + } + self.ss.batch_update(body) + + +def main(): + my_gDashboard=gDashboard("/home/oaicicd/remi/creds.json", 'OAI RAN Dashboard', 'MR Status') + cmd="""curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100" """ + my_gDashboard.fetchData(cmd) + my_gDashboard.gBuild() + my_gDashboard.gFormat("Formating" , "MR Status") + + +if __name__ == "__main__": + # execute only if run as a script + main() From 5a4d29e86455b91c73dc3449e83f4b1dc124b8de Mon Sep 17 00:00:00 2001 From: hardy Date: Wed, 14 Apr 2021 12:48:30 +0200 Subject: [PATCH 40/66] adding check if milestone is empty --- ci-scripts/ran_dashboard.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ci-scripts/ran_dashboard.py b/ci-scripts/ran_dashboard.py index 78d86f5cf3..24e125c278 100644 --- a/ci-scripts/ran_dashboard.py +++ b/ci-scripts/ran_dashboard.py @@ -92,14 +92,17 @@ class gDashboard: date_time_obj = datetime.strptime(date_time_str, '%Y-%m-%dT%H:%M:%S.%fZ') milestone1=milestone2=milestone3=milestone4="" - if self.d[x]['milestone']['title']=="REVIEW_CAN_START": - milestone1="X" - elif self.d[x]['milestone']['title']=="REVIEW_IN_PROGRESS": - milestone2="X" - elif self.d[x]['milestone']['title']=="REVIEW_COMPLETED_AND_APPROVED": - milestone3="X" - elif self.d[x]['milestone']['title']=="OK_TO_BE_MERGED": - milestone4="X" + if self.d[x]['milestone']!=None: + if self.d[x]['milestone']['title']=="REVIEW_CAN_START": + milestone1="X" + elif self.d[x]['milestone']['title']=="REVIEW_IN_PROGRESS": + milestone2="X" + elif self.d[x]['milestone']['title']=="REVIEW_COMPLETED_AND_APPROVED": + milestone3="X" + elif self.d[x]['milestone']['title']=="OK_TO_BE_MERGED": + milestone4="X" + else: + pass else: pass From d3719fece9f0ff9d89d6a05160a523608209a284 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 15 Apr 2021 16:09:13 +0100 Subject: [PATCH 41/66] Fix SA SIB1 segmentation fault --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 79bfbec1fc..3483182088 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -324,6 +324,7 @@ void schedule_control_sib1(module_id_t module_id, gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon)); gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space)); gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset)); + gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); fill_default_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space); fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset,servingcellconfigcommon); fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon); From e9df88885e349c5398fd95f2770c5e00b0e2f385 Mon Sep 17 00:00:00 2001 From: hardy Date: Thu, 15 Apr 2021 23:36:23 +0200 Subject: [PATCH 42/66] adding real time stats from log to HTML --- ci-scripts/ran.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 783adb98e6..4b955d1e03 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -694,6 +694,8 @@ class RANManagement(): NSA_RAPROC_PUSCH_check = 0 #dlsch and ulsch statistics (dictionary) dlsch_ulsch_stats = {} + #real time statistics (dictionary) + real_time_stats ={} #count "L1 thread not ready" msg L1_thread_not_ready_cnt = 0 #count "problem receiving samples" msg @@ -863,6 +865,17 @@ class RANManagement(): if result is not None: #remove 1- all useless char before relevant info (ulsch or dlsch) 2- trailing char dlsch_ulsch_stats[k]=re.sub(r'^.*\]\s+', r'' , line.rstrip()) + #real time statistics + #same method as above + keys = {'feprx','feptx_prec','feptx_ofdm','feptx_total','L1 Tx processing','DLSCH encoding','L1 Rx processing','PUSCH inner-receiver','PUSCH decoding'} + for k in keys: + result = re.search(k, line) + if result is not None: + #remove 1- all useless char before relevant info 2- trailing char + tmp=re.match(rf'^.*?(\b{k}\b.*)',line.rstrip()) #from python 3.6 we can use literal string interpolation for the variable k, using rf' in the regex + real_time_stats[k]=tmp.group(1) + + #count "L1 thread not ready" msg result = re.search('\[PHY\]\s+L1_thread isn\'t ready', str(line)) if result is not None: @@ -920,6 +933,14 @@ class RANManagement(): logging.debug(dlsch_ulsch_stats[key]) htmleNBFailureMsg += statMsg + #real time statistics statistics + if len(real_time_stats)!=0: #check if dictionary is not empty + statMsg='' + for key in real_time_stats: #for each dictionary key + statMsg += real_time_stats[key] + '\n' + logging.debug(real_time_stats[key]) + htmleNBFailureMsg += statMsg + if uciStatMsgCount > 0: statMsg = nodeB_prefix + 'NB showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') From b7ad0ec21d2c705c5e232748efc958568940eea9 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Tue, 12 Jan 2021 16:01:55 +0100 Subject: [PATCH 43/66] Add cmd line options for DL&UL phytest scheduling Add parameters: MCS, Bandwidth (in PRBs), slot scheduling bitmap Conflicts: executables/nr-softmodem.h openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c --- executables/nr-softmodem-common.h | 8 ++- executables/nr-softmodem.c | 2 - executables/nr-softmodem.h | 12 +++++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 1 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 52 +++++++++++-------- 5 files changed, 48 insertions(+), 27 deletions(-) diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h index 500819e684..3abdc061c6 100644 --- a/executables/nr-softmodem-common.h +++ b/executables/nr-softmodem-common.h @@ -68,11 +68,15 @@ #define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n" #define CONFIG_HLP_EXMCAL "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n" #define CONFIG_HLP_ITTIL "Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n" -#define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n" +#define CONFIG_HLP_DLMCS_PHYTEST "Set the downlink MCS for PHYTEST mode\n" #define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n" #define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n" #define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n" -#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n" +#define CONFIG_HLP_ULMCS_PHYTEST "Set the uplink MCS for PHYTEST mode\n" +#define CONFIG_HLP_DLBW_PHYTEST "Set the downlink banwdwidth (in PRBs) for PHYTEST mode\n" +#define CONFIG_HLP_ULBW_PHYTEST "Set the uplink banwdwidth (in PRBs) for PHYTEST mode\n" +#define CONFIG_HLP_DLBM_PHYTEST "Bitmap for DLSCH slots (slot 0 starts at LSB)\n" +#define CONFIG_HLP_ULBM_PHYTEST "Bitmap for ULSCH slots (slot 0 starts at LSB)\n" #define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n" #define CONFIG_HLP_UE "Set the lte softmodem as a UE\n" #define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n" diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index fd86565df5..8ac3a63efe 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -161,8 +161,6 @@ int otg_enabled; //static NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; //static nfapi_nr_config_request_t *config[MAX_NUM_CCs]; -uint32_t target_dl_mcs = 28; //maximum allowed mcs -uint32_t target_ul_mcs = 20; uint32_t timing_advance = 0; uint64_t num_missed_slots=0; // counter for the number of missed slots diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h index 18a6fe42d0..928558013c 100644 --- a/executables/nr-softmodem.h +++ b/executables/nr-softmodem.h @@ -21,12 +21,24 @@ {"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \ {"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \ {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \ + {"m" , CONFIG_HLP_DLMCS_PHYTEST,0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \ + {"t" , CONFIG_HLP_ULMCS_PHYTEST,0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \ + {"M" , CONFIG_HLP_DLBW_PHYTEST,0, uptr:&target_dl_bw, defintval:0, TYPE_UINT, 0}, \ + {"T" , CONFIG_HLP_ULBW_PHYTEST,0, uptr:&target_ul_bw, defintval:0, TYPE_UINT, 0}, \ + {"D" , CONFIG_HLP_DLBM_PHYTEST,0, u64ptr:&dlsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \ + {"U" , CONFIG_HLP_ULBM_PHYTEST,0, u64ptr:&ulsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \ {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \ {"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \ } #include "threads_t.h" extern threads_t threads; +extern uint32_t target_dl_mcs; +extern uint32_t target_ul_mcs; +extern uint32_t target_dl_bw; +extern uint32_t target_ul_bw; +extern uint64_t dlsch_slot_bitmap; +extern uint64_t ulsch_slot_bitmap; // In nr-gnb.c extern void init_gNB(int single_thread_flag,int wait_for_sync); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 584648c67f..f18908ff32 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -53,6 +53,7 @@ #include "executables/softmodem-common.h" #include "nfapi/oai_integration/vendor_ext.h" +#include "executables/nr-softmodem.h" uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index bf8269132a..212922d5bb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -255,12 +255,17 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, } } +extern int getNrOfSymbols(NR_BWP_Downlink_t *bwp, int tda); +extern uint8_t getN_PRB_DMRS(NR_BWP_Downlink_t *bwp, int numDmrsCdmGrpsNoData); +uint32_t target_dl_mcs = 9; +uint32_t target_dl_bw = 50; +uint64_t dlsch_slot_bitmap = (1<<1); /* schedules whole bandwidth for first user, all the time */ void nr_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_t slot) { - if (slot != 1) + if (!is_xlsch_in_slot(dlsch_slot_bitmap, slot)) return; NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; const int UE_id = 0; @@ -273,24 +278,25 @@ void nr_preprocessor_phytest(module_id_t module_id, /* find largest unallocated chunk */ const int bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); int rbStart = 0; - int tStart = 0; int rbSize = 0; uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; - /* find largest unallocated RB region */ - do { + /* loop ensures that we allocate exactly target_dl_bw, or return */ + while (true) { /* advance to first free RB */ - while (tStart < bwpSize && vrb_map[tStart]) - tStart++; - /* find maximum rbSize at current rbStart */ - int tSize = 1; - while (tStart + tSize < bwpSize && !vrb_map[tStart + tSize]) - tSize++; - if (tSize > rbSize) { - rbStart = tStart; - rbSize = tSize; - } - tStart += tSize; - } while (tStart < bwpSize); + while (rbStart < bwpSize && vrb_map[rbStart]) + rbStart++; + rbSize = 1; + /* iterate until we are at target_dl_bw or no available RBs */ + while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && rbSize < target_dl_bw) + rbSize++; + /* found target_dl_bw? */ + if (rbSize == target_dl_bw) + break; + /* at end and below target_dl_bw? */ + if (rbStart + rbSize >= bwpSize) + return; + rbStart += rbSize; + } sched_ctrl->num_total_bytes = 0; const int lcid = DL_SCH_LCID_DTCH; @@ -363,7 +369,7 @@ void nr_preprocessor_phytest(module_id_t module_id, else sched_ctrl->mcsTableIdx = 2; } - sched_ctrl->mcs = 9; + sched_ctrl->mcs = target_dl_mcs; sched_ctrl->numDmrsCdmGrpsNoData = 1; /* get the PID of a HARQ process awaiting retransmission, or -1 otherwise */ sched_ctrl->dl_harq_pid = sched_ctrl->retrans_dl_harq.head; @@ -373,6 +379,9 @@ void nr_preprocessor_phytest(module_id_t module_id, vrb_map[rb + sched_ctrl->rbStart] = 1; } +uint32_t target_ul_mcs = 9; +uint32_t target_ul_bw = 50; +uint64_t ulsch_slot_bitmap = (1<<8); bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_t slot, @@ -409,14 +418,11 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, /* check if slot is UL, and that slot is 8 (assuming K2=6 because of UE * limitations). Note that if K2 or the TDD configuration is changed, below * conditions might exclude each other and never be true */ - if (!(is_xlsch_in_slot(ulsch_in_slot_bitmap, sched_slot) && sched_slot == 8)) + if (!is_xlsch_in_slot(ulsch_slot_bitmap, sched_slot)) return false; - const int bw = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); uint16_t rbStart = 0; - uint16_t rbSize = 50; /* due to OAI UE limitations */ - if (rbSize>bw) - rbSize = bw; + uint16_t rbSize = target_ul_bw; uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; @@ -477,7 +483,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, num_dmrs_cdm_grps_no_data, ps); - const int mcs = 9; + const int mcs = target_ul_mcs; NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; sched_pusch->mcs = mcs; sched_pusch->rbStart = rbStart; From 21948e89c0dddd762f246803615467b75e642583 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Tue, 12 Jan 2021 16:04:04 +0100 Subject: [PATCH 44/66] Always do PUSCH decoding in phy_test mode --- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- openair1/SIMULATION/NR_PHY/pbchsim.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index d44c8641a6..285c189a0b 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -644,7 +644,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) start_meas(&gNB->rx_pusch_stats); for(uint8_t symbol = symbol_start; symbol < symbol_end; symbol++) { no_sig = nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, symbol, harq_pid); - if (no_sig) { + if (no_sig && (get_softmodem_params()->phy_test == 0)) { LOG_I(PHY, "PUSCH not detected in symbol %d\n",symbol); nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1); return; diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index c75a590603..c24a841c4b 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -66,6 +66,7 @@ uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3}; uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3}; uint64_t get_softmodem_optmask(void) {return 0;} +softmodem_params_t *get_softmodem_params(void) {return 0;} void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} From 052739f01d35d4985fdb24a0706f5dc541f1ae02 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 16 Mar 2021 07:37:42 +0100 Subject: [PATCH 45/66] Update phytest cmdline parameter description after review --- executables/nr-softmodem-common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h index 3abdc061c6..813ffcf8fa 100644 --- a/executables/nr-softmodem-common.h +++ b/executables/nr-softmodem-common.h @@ -73,8 +73,8 @@ #define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n" #define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n" #define CONFIG_HLP_ULMCS_PHYTEST "Set the uplink MCS for PHYTEST mode\n" -#define CONFIG_HLP_DLBW_PHYTEST "Set the downlink banwdwidth (in PRBs) for PHYTEST mode\n" -#define CONFIG_HLP_ULBW_PHYTEST "Set the uplink banwdwidth (in PRBs) for PHYTEST mode\n" +#define CONFIG_HLP_DLBW_PHYTEST "Set the number of PRBs used for DLSCH in PHYTEST mode\n" +#define CONFIG_HLP_ULBW_PHYTEST "Set the number of PRBs used for ULSCH in PHYTEST mode\n" #define CONFIG_HLP_DLBM_PHYTEST "Bitmap for DLSCH slots (slot 0 starts at LSB)\n" #define CONFIG_HLP_ULBM_PHYTEST "Bitmap for ULSCH slots (slot 0 starts at LSB)\n" #define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n" From b548f9a3d246dc3f316e89447e9b7c466d91976e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 14 Apr 2021 12:14:56 +0200 Subject: [PATCH 46/66] Correctly check for used symbols in UL phytest scheduler --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 212922d5bb..d14109d7bc 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -426,8 +426,12 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; + const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; + int startSymbolIndex, nrOfSymbols; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + const uint16_t symb = ((1 << nrOfSymbols) - 1) << startSymbolIndex; for (int i = rbStart; i < rbStart + rbSize; ++i) { - if (vrb_map_UL[i]) { + if ((vrb_map_UL[i] & symb) != 0) { LOG_E(MAC, "%s(): %4d.%2d RB %d is already reserved, cannot schedule UE\n", __func__, From 992e8323e19e51ce2c5948e88740597f505c72fc Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Fri, 16 Apr 2021 17:05:26 +0200 Subject: [PATCH 47/66] Reducing the size of bf structs quickfix for realtime problem caused by memset --- nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h index 444140509c..bcb0a94ca8 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h @@ -691,7 +691,7 @@ typedef struct typedef struct { uint16_t pm_idx;//Index to precoding matrix (PM) pre-stored at cell configuration. Note: If precoding is not used this parameter should be set to 0. Value: 0->65535. - nfapi_nr_dig_bf_interface_t dig_bf_interface_list[255];//max dig_bf_interfaces + nfapi_nr_dig_bf_interface_t dig_bf_interface_list[1];//max dig_bf_interfaces }nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t; @@ -702,7 +702,7 @@ typedef struct uint16_t prg_size;//Size in RBs of a precoding resource block group (PRG) – to which same precoding and digital beamforming gets applied. Value: 1->275 //watchout: dig_bf_interfaces here, in table 3-53 it's dig_bf_interface uint8_t dig_bf_interfaces;//Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255 - nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t prgs_list[275];//max prg_size + nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t prgs_list[1];//max prg_size }nfapi_nr_tx_precoding_and_beamforming_t; From dc65173b69355801a7a542237d01145ecb01a891 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Thu, 1 Apr 2021 12:12:25 +0200 Subject: [PATCH 48/66] Fixed RX proc perf stat --- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 5 +++++ openair1/SIMULATION/NR_PHY/ulsim.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 285c189a0b..17aa2ec7d0 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -194,6 +194,8 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0); } + if (do_meas==1) stop_meas(&gNB->phy_proc_tx); + if ((frame&127) == 0) dump_pdsch_stats(gNB); //apply the OFDM symbol rotation here @@ -539,6 +541,8 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) int power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][offset],12*18); LOG_D(PHY,"frame %d, slot %d: UL signal energy %d\n",frame_rx,slot_rx,power_rxF); + start_meas(&gNB->phy_proc_rx); + for (int i=0;ipucch[i]; if (pucch) { @@ -662,6 +666,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) } } } + stop_meas(&gNB->phy_proc_rx); // figure out a better way to choose slot_rx, 19 is ok for a particular TDD configuration with 30kHz SCS if ((frame_rx&127) == 0 && slot_rx==19) { dump_pusch_stats(gNB); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 21351caac1..920994810d 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -1170,7 +1170,6 @@ int main(int argc, char **argv) gNB->UL_INFO.rx_ind.number_of_pdus = 0; gNB->UL_INFO.crc_ind.number_crcs = 0; - start_meas(&gNB->phy_proc_rx); phy_procedures_gNB_common_RX(gNB, frame, slot); phy_procedures_gNB_uespec_RX(gNB, frame, slot); @@ -1202,7 +1201,6 @@ int main(int argc, char **argv) LOG_M("rxsigF0_llr.m","rxsF0_llr", &gNB->pusch_vars[0]->llr[0],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,1,0); } - start_meas(&gNB->phy_proc_rx); //////////////////////////////////////////////////////////// if (gNB->ulsch[0][0]->last_iteration_cnt >= From 8656b1221050a7cdc8fc9fabdd50d92ddffa8dbb Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Fri, 2 Apr 2021 16:36:45 +0200 Subject: [PATCH 49/66] Added L1 stats to softmodem --- executables/nr-gnb.c | 14 +++++++++----- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index a92f433560..e980818002 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -323,18 +323,22 @@ static void *process_stats_thread(void *param) { PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param; + reset_meas(&gNB->phy_proc_tx); reset_meas(&gNB->dlsch_encoding_stats); - reset_meas(&gNB->dlsch_scrambling_stats); - reset_meas(&gNB->dlsch_modulation_stats); + reset_meas(&gNB->phy_proc_rx); + reset_meas(&gNB->rx_pusch_stats); + reset_meas(&gNB->ulsch_decoding_stats); wait_sync("process_stats_thread"); while(!oai_exit) { sleep(1); - print_meas(&gNB->dlsch_encoding_stats, "pdsch_encoding", NULL, NULL); - print_meas(&gNB->dlsch_scrambling_stats, "pdsch_scrambling", NULL, NULL); - print_meas(&gNB->dlsch_modulation_stats, "pdsch_modulation", NULL, NULL); + print_meas(&gNB->phy_proc_tx, "L1 Tx processing", NULL, NULL); + print_meas(&gNB->dlsch_encoding_stats, "DLSCH encoding", NULL, NULL); + print_meas(&gNB->phy_proc_rx, "L1 Rx processing", NULL, NULL); + print_meas(&gNB->rx_pusch_stats, "PUSCH inner-receiver", NULL, NULL); + print_meas(&gNB->ulsch_decoding_stats, "PUSCH decoding", NULL, NULL); } return(NULL); } diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 9eff4255f3..aa83b3e32c 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -995,7 +995,7 @@ int main(int argc, char **argv) if (run_initial_sync) nr_common_signal_procedures(gNB,frame,slot,gNB->ssb[0].ssb_pdu); else - phy_procedures_gNB_TX(gNB,frame,slot,0); + phy_procedures_gNB_TX(gNB,frame,slot,1); int txdataF_offset = (slot%2) * frame_parms->samples_per_slot_wCP; From 8185060b09ac0e1f7052937517b02f8636c2f316 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Tue, 6 Apr 2021 12:07:50 +0200 Subject: [PATCH 50/66] printing max --- openair1/PHY/TOOLS/time_meas.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/TOOLS/time_meas.c b/openair1/PHY/TOOLS/time_meas.c index ef1444572d..ee06917c0f 100644 --- a/openair1/PHY/TOOLS/time_meas.c +++ b/openair1/PHY/TOOLS/time_meas.c @@ -103,10 +103,11 @@ void print_meas(time_stats_t *ts, if (ts->trials>0) { //printf("%20s: total: %10.3f ms, average: %10.3f us (%10d trials)\n", name, ts->diff/cpu_freq_GHz/1000000.0, ts->diff/ts->trials/cpu_freq_GHz/1000.0, ts->trials); if ((total_exec_time == NULL) || (sf_exec_time== NULL)) { - fprintf(stderr, "%25s: %15.3f us; %15d;\n", + fprintf(stderr, "%25s: %15.3f us; %15d; %15.3f us;\n", name, (ts->diff/ts->trials/cpu_freq_GHz/1000.0), - ts->trials); + ts->trials, + ts->max); } else { fprintf(stderr, "%25s: %15.3f ms (%5.2f%%); %15.3f us (%5.2f%%); %15d;\n", name, From b56bfa7dbe6eacfcc5eff67d30381bdfa3f8fe6e Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Tue, 6 Apr 2021 12:16:58 +0200 Subject: [PATCH 51/66] fixed max print --- openair1/PHY/TOOLS/time_meas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/TOOLS/time_meas.c b/openair1/PHY/TOOLS/time_meas.c index ee06917c0f..001770c876 100644 --- a/openair1/PHY/TOOLS/time_meas.c +++ b/openair1/PHY/TOOLS/time_meas.c @@ -107,7 +107,7 @@ void print_meas(time_stats_t *ts, name, (ts->diff/ts->trials/cpu_freq_GHz/1000.0), ts->trials, - ts->max); + ts->max/cpu_freq_GHz/1000.0); } else { fprintf(stderr, "%25s: %15.3f ms (%5.2f%%); %15.3f us (%5.2f%%); %15d;\n", name, From bf8b6219955fc64079615754f2d78aef36041534 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Fri, 16 Apr 2021 17:36:48 +0200 Subject: [PATCH 52/66] Adding timing stats for ul indication and scheduler --- executables/nr-gnb.c | 4 ++++ openair1/PHY/defs_gNB.h | 1 + openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 1 + 3 files changed, 6 insertions(+) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index e980818002..f38fcd22a9 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -230,6 +230,7 @@ void rx_func(void *param) { // Call the scheduler + start_meas(&gNB->ul_indication_stats); pthread_mutex_lock(&gNB->UL_INFO_mutex); gNB->UL_INFO.frame = frame_rx; gNB->UL_INFO.slot = slot_rx; @@ -237,6 +238,7 @@ void rx_func(void *param) { gNB->UL_INFO.CC_id = gNB->CC_id; gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); pthread_mutex_unlock(&gNB->UL_INFO_mutex); + stop_meas(&gNB->ul_indication_stats); // RX processing int tx_slot_type = nr_slot_select(cfg,frame_tx,slot_tx); @@ -326,6 +328,7 @@ static void *process_stats_thread(void *param) { reset_meas(&gNB->phy_proc_tx); reset_meas(&gNB->dlsch_encoding_stats); reset_meas(&gNB->phy_proc_rx); + reset_meas(&gNB->ul_indication_stats); reset_meas(&gNB->rx_pusch_stats); reset_meas(&gNB->ulsch_decoding_stats); @@ -337,6 +340,7 @@ static void *process_stats_thread(void *param) { print_meas(&gNB->phy_proc_tx, "L1 Tx processing", NULL, NULL); print_meas(&gNB->dlsch_encoding_stats, "DLSCH encoding", NULL, NULL); print_meas(&gNB->phy_proc_rx, "L1 Rx processing", NULL, NULL); + print_meas(&gNB->ul_indication_stats, "UL Indication", NULL, NULL); print_meas(&gNB->rx_pusch_stats, "PUSCH inner-receiver", NULL, NULL); print_meas(&gNB->ulsch_decoding_stats, "PUSCH decoding", NULL, NULL); } diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index a165aa1984..edb19f7501 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -824,6 +824,7 @@ typedef struct PHY_VARS_gNB_s { time_stats_t dlsch_segmentation_stats; time_stats_t rx_pusch_stats; + time_stats_t ul_indication_stats; time_stats_t ulsch_decoding_stats; time_stats_t ulsch_rate_unmatching_stats; time_stats_t ulsch_ldpc_decoding_stats; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index f18908ff32..35fbafb2ba 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -92,6 +92,7 @@ void dump_mac_stats(gNB_MAC_INST *gNB) LOG_I(MAC, "UE %d: LCID %d: %d bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]); } } + print_meas(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL); } void clear_nr_nfapi_information(gNB_MAC_INST * gNB, From cf87873f218e7dc0320297ba3d7c0e9992617402 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Fri, 16 Apr 2021 17:48:47 +0200 Subject: [PATCH 53/66] Calling ul indication after L1 RX --- executables/nr-gnb.c | 24 +++++++++---------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index f38fcd22a9..4047ff1386 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -228,18 +228,6 @@ void rx_func(void *param) { rnti_to_remove_count = 0; if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); - // Call the scheduler - - start_meas(&gNB->ul_indication_stats); - pthread_mutex_lock(&gNB->UL_INFO_mutex); - gNB->UL_INFO.frame = frame_rx; - gNB->UL_INFO.slot = slot_rx; - gNB->UL_INFO.module_id = gNB->Mod_id; - gNB->UL_INFO.CC_id = gNB->CC_id; - gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); - pthread_mutex_unlock(&gNB->UL_INFO_mutex); - stop_meas(&gNB->ul_indication_stats); - // RX processing int tx_slot_type = nr_slot_select(cfg,frame_tx,slot_tx); int rx_slot_type = nr_slot_select(cfg,frame_rx,slot_rx); @@ -266,6 +254,18 @@ void rx_func(void *param) { stop_meas( &softmodem_stats_rxtx_sf ); LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, frame_rx, slot_rx, frame_tx, slot_tx); + // Call the scheduler + + start_meas(&gNB->ul_indication_stats); + pthread_mutex_lock(&gNB->UL_INFO_mutex); + gNB->UL_INFO.frame = frame_rx; + gNB->UL_INFO.slot = slot_rx; + gNB->UL_INFO.module_id = gNB->Mod_id; + gNB->UL_INFO.CC_id = gNB->CC_id; + gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); + pthread_mutex_unlock(&gNB->UL_INFO_mutex); + stop_meas(&gNB->ul_indication_stats); + notifiedFIFO_elt_t *res; if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 4413864553..5c4b123655 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -978,7 +978,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { const uint8_t harq_value = uci_01->harq->harq_list[harq_bit].harq_value; const uint8_t harq_confidence = uci_01->harq->harq_confidence_level; - const int feedback_slot = (slot - 1 + num_slots) % num_slots; + const int feedback_slot = (slot + num_slots) % num_slots; /* In case of realtime problems: we can only identify a HARQ process by * timing. If the HARQ process's feedback_slot is not the one we * expected, we assume that processing has been aborted and we need to @@ -1030,7 +1030,7 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, // iterate over received harq bits for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { const int acknack = ((uci_234->harq.harq_payload[harq_bit >> 3]) >> harq_bit) & 0x01; - const int feedback_slot = (slot - 1 + num_slots) % num_slots; + const int feedback_slot = (slot + num_slots) % num_slots; /* In case of realtime problems: we can only identify a HARQ process by * timing. If the HARQ process's feedback_slot is not the one we * expected, we assume that processing has been aborted and we need to From 3e411abb7cb3c7c7d1d561bebdc6d9020fd7efcf Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Fri, 16 Apr 2021 18:37:57 +0200 Subject: [PATCH 54/66] Fixed compiler warning --- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index aa83b3e32c..d53041aa74 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -277,7 +277,7 @@ int main(int argc, char **argv) //float psnr; float eff_tp_check = 0.7; uint8_t snrRun; - uint32_t TBS; + uint32_t TBS = 0; int **txdata; double **s_re,**s_im,**r_re,**r_im; //double iqim = 0.0; From 6f7a3fdcd28a34fe6aea1489d83cdb8fb0378376 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Fri, 16 Apr 2021 18:54:35 +0200 Subject: [PATCH 55/66] Laurent's change: bugfix in usrp lib --- targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index bed7faf161..42ef899072 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -597,7 +597,8 @@ int trx_usrp_write_init(openair0_device *device){ write_thread->end = 0; write_thread->count_write = 0; printf("end of tx write thread\n"); - + pthread_mutex_init(&write_thread->mutex_write, NULL); + pthread_cond_init(&write_thread->cond_write, NULL); pthread_create(&write_thread->pthread_write,NULL,trx_usrp_write_thread,(void *)device); return(0); From 2995662fd79ac1351325d71df67c271a6d756630 Mon Sep 17 00:00:00 2001 From: hardy Date: Fri, 16 Apr 2021 21:58:38 +0200 Subject: [PATCH 56/66] fixed incorrect indentation + removed L1 ready msg (no longer used) --- ci-scripts/ran.py | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 4b955d1e03..7914f7b975 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -695,9 +695,7 @@ class RANManagement(): #dlsch and ulsch statistics (dictionary) dlsch_ulsch_stats = {} #real time statistics (dictionary) - real_time_stats ={} - #count "L1 thread not ready" msg - L1_thread_not_ready_cnt = 0 + real_time_stats = {} #count "problem receiving samples" msg pb_receiving_samples_cnt = 0 @@ -868,18 +866,12 @@ class RANManagement(): #real time statistics #same method as above keys = {'feprx','feptx_prec','feptx_ofdm','feptx_total','L1 Tx processing','DLSCH encoding','L1 Rx processing','PUSCH inner-receiver','PUSCH decoding'} - for k in keys: - result = re.search(k, line) - if result is not None: - #remove 1- all useless char before relevant info 2- trailing char - tmp=re.match(rf'^.*?(\b{k}\b.*)',line.rstrip()) #from python 3.6 we can use literal string interpolation for the variable k, using rf' in the regex - real_time_stats[k]=tmp.group(1) - - - #count "L1 thread not ready" msg - result = re.search('\[PHY\]\s+L1_thread isn\'t ready', str(line)) - if result is not None: - L1_thread_not_ready_cnt += 1 + for k in keys: + result = re.search(k, line) + if result is not None: + #remove 1- all useless char before relevant info 2- trailing char + tmp=re.match(rf'^.*?(\b{k}\b.*)',line.rstrip()) #from python 3.6 we can use literal string interpolation for the variable k, using rf' in the regex + real_time_stats[k]=tmp.group(1) #count "problem receiving samples" msg result = re.search('\[PHY\]\s+problem receiving samples', str(line)) if result is not None: @@ -910,15 +902,10 @@ class RANManagement(): statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : PASS ' htmlMsg = statMsg+'\n' else: - statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : FAIL ' + statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : FAIL or not relevant' htmlMsg = statMsg+'\n' logging.debug(statMsg) htmleNBFailureMsg += htmlMsg - #L1 thread not ready log - statMsg = '[PHY] L1 thread is not ready msg count = '+str(L1_thread_not_ready_cnt) - htmlMsg = statMsg+'\n' - logging.debug(statMsg) - htmleNBFailureMsg += htmlMsg #problem receiving samples log statMsg = '[PHY] problem receiving samples msg count = '+str(pb_receiving_samples_cnt) htmlMsg = statMsg+'\n' From ad135dd1e2b59cf5763fa59f65e8922bf4eb623d Mon Sep 17 00:00:00 2001 From: hardy Date: Mon, 19 Apr 2021 10:05:13 +0200 Subject: [PATCH 57/66] adding the case where no rt stat found in log --- ci-scripts/ran.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 7914f7b975..c0ddc70e80 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -927,6 +927,10 @@ class RANManagement(): statMsg += real_time_stats[key] + '\n' logging.debug(real_time_stats[key]) htmleNBFailureMsg += statMsg + else: + statMsg = 'No real time stats found in the log file\n' + logging.debug('No real time stats found in the log file') + htmleNBFailureMsg += statMsg if uciStatMsgCount > 0: statMsg = nodeB_prefix + 'NB showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)' From e2ef05e5f5323adb78228d22c37291abb0b55408 Mon Sep 17 00:00:00 2001 From: hardy Date: Tue, 20 Apr 2021 11:09:11 +0200 Subject: [PATCH 58/66] added 2 detections in the ul dl harq stats for HTML --- ci-scripts/ran.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 783adb98e6..a0ef1993c9 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -857,7 +857,7 @@ class RANManagement(): #keys below are the markers we are loooking for, loop over this keys list #everytime these markers are found in the log file, the previous ones are overwritten in the dict #eventually we record and print only the last occurence - keys = {'dlsch_rounds','dlsch_total_bytes','ulsch_rounds','ulsch_total_bytes_scheduled'} + keys = {'UE ID','dlsch_rounds','dlsch_total_bytes','ulsch_rounds','ulsch_total_bytes_scheduled', 'scheduling timing stats'} for k in keys: result = re.search(k, line) if result is not None: From 2784cd484e1c93f1fff458249a32b86eb99d1560 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 21 Apr 2021 10:37:55 +0200 Subject: [PATCH 59/66] revert default values for 5GS --- openair2/GNB_APP/gnb_paramdef.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 0bf7cb3892..8b326d58c9 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -324,12 +324,12 @@ typedef enum { /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*--------------------------------------------------------------------------------------------------------------------------------------------------*/ #define GNBNETPARAMS_DESC { \ -{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_GNB_PORT_FOR_NGU, NULL, 0, uptr:NULL, defintval:2152L, TYPE_UINT, 0}, \ -{GNB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_X2C, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_X2C, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_ENB_PORT_FOR_X2C, NULL, 0, uptr:NULL, defintval:0L, TYPE_UINT, 0} \ } From b8480de3c5eddcb7fb8e426ca5a80b7d19927a20 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 21 Apr 2021 12:15:17 +0200 Subject: [PATCH 60/66] try fix T_IDs.h --- cmake_targets/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 16e922e7c1..d54237e6c1 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2837,6 +2837,12 @@ add_custom_command ( ${OPENAIR_DIR}/common/utils/LOG/vcd_signal_dumper.h ) +execute_process ( + COMMAND make clean + COMMAND make -j2 + COMMAND make check_vcd + WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T +) #This rule is specifically needed to generate T files #before anything else in a project that uses the T. #See below, there are some 'add_dependencies' showing that. From d0e091294e0ff2acfed2add1039f47f51b3f620c Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 21 Apr 2021 12:44:40 +0200 Subject: [PATCH 61/66] more on T_IDs.h --- cmake_targets/CMakeLists.txt | 2 -- common/utils/T/Makefile | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index d54237e6c1..766444d307 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2838,8 +2838,6 @@ add_custom_command ( ) execute_process ( - COMMAND make clean - COMMAND make -j2 COMMAND make check_vcd WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T ) diff --git a/common/utils/T/Makefile b/common/utils/T/Makefile index 0588c88a45..f53a642b0b 100644 --- a/common/utils/T/Makefile +++ b/common/utils/T/Makefile @@ -18,7 +18,7 @@ T_messages.txt.h: T_messages.txt T_IDs.h: $(GENIDS) T_messages.txt ./$(GENIDS) T_messages.txt T_IDs.h -check_vcd: +check_vcd: T_IDs.h gcc -Wall -I. -I.. -I../itti -I../../../openair2/COMMON -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread ./_check_vcd || (rm -f ./_check_vcd ./T_IDs.h ./T_messages.txt.h && false) rm -f ./_check_vcd From 2a1025165c958e8e06039ecfd5493b183b343927 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 21 Apr 2021 14:49:44 +0200 Subject: [PATCH 62/66] fix, third trial T_IDs.h --- cmake_targets/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 766444d307..8bf57f460e 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2828,8 +2828,6 @@ endif (${T_TRACER}) #This rule and the following deal with it. add_custom_command ( OUTPUT ${OPENAIR_DIR}/common/utils/T/T_IDs.h - COMMAND make clean - COMMAND make -j2 COMMAND make check_vcd WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T DEPENDS ${OPENAIR_DIR}/common/utils/T/T_messages.txt From df56f5d34588dbb0248342dfbb059928c4fc3e12 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 21 Apr 2021 15:28:48 +0200 Subject: [PATCH 63/66] fix4 T_IDs.h --- common/utils/T/Makefile | 2 +- openair1/PHY/LTE_ESTIMATION/lte_sync_time.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/utils/T/Makefile b/common/utils/T/Makefile index f53a642b0b..d76ab93cb8 100644 --- a/common/utils/T/Makefile +++ b/common/utils/T/Makefile @@ -18,7 +18,7 @@ T_messages.txt.h: T_messages.txt T_IDs.h: $(GENIDS) T_messages.txt ./$(GENIDS) T_messages.txt T_IDs.h -check_vcd: T_IDs.h +check_vcd: T_IDs.h T_messages.txt.h gcc -Wall -I. -I.. -I../itti -I../../../openair2/COMMON -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread ./_check_vcd || (rm -f ./_check_vcd ./T_IDs.h ./T_messages.txt.h && false) rm -f ./_check_vcd diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c index 655878cfaa..57b4c28661 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c @@ -86,7 +86,7 @@ static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSi } int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) { // LTE_UE_COMMON *common_vars - struct complex16 syncF_tmp[2048]__attribute__((aligned(32)))= {0}; + struct complex16 syncF_tmp[2048]__attribute__((aligned(32)))= {{0}}; int sz=frame_parms->ofdm_symbol_size*sizeof(*primary_synch0_time); AssertFatal( NULL != (primary_synch0_time = (struct complex16 *)malloc16(sz)),""); bzero(primary_synch0_time,sz); @@ -153,7 +153,7 @@ int lte_sync_time(int **rxdata, ///rx data in time domain // perform a time domain correlation using the oversampled sync sequence unsigned int n, ar, s, peak_pos, peak_val, sync_source; int result,result2; - struct complexd sync_out[3]= {0}, sync_out2[3]= {0}; + struct complexd sync_out[3]= {{0}}, sync_out2[3]= {{0}}; int length = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti>>1; peak_val = 0; peak_pos = 0; From e3692f09052cfa28b5beff9559e07f83bac5e10e Mon Sep 17 00:00:00 2001 From: hardy Date: Wed, 21 Apr 2021 22:09:20 +0200 Subject: [PATCH 64/66] [CI] add hyperlinks to git MR + reduce API calls (quotas) --- ci-scripts/ran_dashboard.py | 109 ++++++++++++++++++++++++------------ 1 file changed, 72 insertions(+), 37 deletions(-) diff --git a/ci-scripts/ran_dashboard.py b/ci-scripts/ran_dashboard.py index 24e125c278..601cda1722 100644 --- a/ci-scripts/ran_dashboard.py +++ b/ci-scripts/ran_dashboard.py @@ -68,26 +68,23 @@ class gDashboard: self.d = json.loads(tmp) - def gBuild(self): + def gBuild(self, destinationSheetName): - #line 1 : get update date + #line 1 : update date/time, format dd/mm/YY H:M:S now = datetime.now() - # dd/mm/YY H:M:S dt_string = "Update : " + now.strftime("%d/%m/%Y %H:%M") row =[dt_string] self.sheet.insert_row(row, index=1, value_input_option='RAW') - #line 2 is empty - #line 3 is column names + #line 2 empty + #line 3 is for the column names i=3 row =["MR","Created_at","Author","Title","Assignee", "Reviewer", "CAN START","IN PROGRESS","COMPLETED","OK MERGE","Merge conflicts"] self.sheet.insert_row(row, index=i, value_input_option='RAW') - #line 4 onward, build data lines + #line 4 onward, MR data lines for x in range(len(self.d)): - i=i+1 - - + i=i+1 date_time_str = self.d[x]['created_at'] date_time_obj = datetime.strptime(date_time_str, '%Y-%m-%dT%H:%M:%S.%fZ') @@ -123,22 +120,65 @@ class gDashboard: else: conflicts = "" - #build final row - row =[str(self.d[x]['iid']), str(date_time_obj.date()),str(self.d[x]['author']['name']),str(self.d[x]['title']),\ + #build final row to be inserted, the first column is left empty for now, will be filled afterward with hyperlinks to gitlab MR + row =["", str(date_time_obj.date()),str(self.d[x]['author']['name']),str(self.d[x]['title']),\ assignee, reviewer,\ milestone1,milestone2,milestone3,milestone4,conflicts] - #write it to worksheet + #insert the row to worksheet self.sheet.insert_row(row, index=i, value_input_option='RAW') + + + #add MR hyperlinks in a list of requests to be sent as one update batch; this to save API calls (quotas) + i=3 + requests=[] + for x in range(len(self.d)): + rowIndex=i + colIndex=0 + hyperlink= '\"'+"https://gitlab.eurecom.fr/oai/openairinterface5g/-/merge_requests/"+ str(self.d[x]['iid']) +'\"' + text= '\"'+str(self.d[x]['iid'])+'"' + requests.append(self.addHyperlink(hyperlink, text, destinationSheetName, rowIndex, colIndex)) + i=i+1 + body = {"requests": requests} + self.ss.batch_update(body) + + + def addHyperlink(self, hyperlink, text, destinationSheetName, rowIndex, colIndex): + sheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] + request =\ + { + "updateCells": { + "rows": [ + { + "values": [ + { + "userEnteredValue": { + "formulaValue":"=HYPERLINK({},{})".format(hyperlink, text) + } + } + ] + } + ], + "fields": "userEnteredValue", + "start": { + "sheetId": sheetId, + "rowIndex": rowIndex, + "columnIndex": colIndex + } + } + } + return request + + def gFormat(self,sourceSheetName,destinationSheetName): # "Formating" , "MR Status" - + #the requests are appended in a list of requests to be sent as one update batch; this to save API calls (quotas) #copy formating template sourceSheetId = self.ss.worksheet(sourceSheetName)._properties['sheetId'] destinationSheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] - body = { - "requests": [ + requests=[] + requests.append( { "copyPaste": { "source": { @@ -146,45 +186,40 @@ class gDashboard: "startRowIndex": 0, "endRowIndex": 40, "startColumnIndex": 0, - "endColumnIndex": 20 + "endColumnIndex": 12 }, "destination": { "sheetId": destinationSheetId, "startRowIndex": 0, "endRowIndex": 40, "startColumnIndex": 0, - "endColumnIndex": 20 + "endColumnIndex": 12 }, "pasteType": "PASTE_FORMAT" } } - ] - } - self.ss.batch_update(body) + ) + #resize columns fit to data, except col 0 sheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] - body = { - "requests": [ + requests.append( { 'autoResizeDimensions': { 'dimensions': { 'sheetId': sheetId, 'dimension': 'COLUMNS', 'startIndex': 1, - 'endIndex': 20 + 'endIndex': 12 } } - } - ] - } - self.ss.batch_update(body) + } + ) #resize col 0 sheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] - body = { - "requests": [ + requests.append( { "updateDimensionProperties": { "range": { @@ -199,15 +234,12 @@ class gDashboard: "fields": "pixelSize" } } - ] - } - self.ss.batch_update(body) + ) #resize milestones to be cleaner sheetId = self.ss.worksheet(destinationSheetName)._properties['sheetId'] - body = { - "requests": [ + requests.append( { "updateDimensionProperties": { "range": { @@ -222,17 +254,20 @@ class gDashboard: "fields": "pixelSize" } } - ] - } + ) + + body = {"requests": requests} self.ss.batch_update(body) + def main(): my_gDashboard=gDashboard("/home/oaicicd/remi/creds.json", 'OAI RAN Dashboard', 'MR Status') cmd="""curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100" """ my_gDashboard.fetchData(cmd) - my_gDashboard.gBuild() + my_gDashboard.gBuild("MR Status") my_gDashboard.gFormat("Formating" , "MR Status") + if __name__ == "__main__": From 80a9aaf5ddc3cf56f33956fcebb2d5e62610ed88 Mon Sep 17 00:00:00 2001 From: hardy Date: Thu, 22 Apr 2021 21:56:37 +0200 Subject: [PATCH 65/66] adding new conf file to use n310 on mozart --- .../gnb.band78.tm1.fr1.106PRB.usrpn310.conf | 305 ++++++++++++++++++ 1 file changed, 305 insertions(+) create mode 100644 ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf new file mode 100644 index 0000000000..d007ceb9be --- /dev/null +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf @@ -0,0 +1,305 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 31; //0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641272; //641032; #641968; 641968=start of ssb at 3600MHz + 82 RBs 641032=center of SSB at center of cell + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=84,L=13 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6368; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) + initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6368; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -100; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 5; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; //15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, + +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 2; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 2; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; #0x80; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; //8; //7; + nrofDownlinkSymbols = 6; //0; //6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; //0; //4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.18.99"; + ipv6 = "192:168:30::17"; + port = 36412 ; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "yes"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "192.168.18.199"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.198"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.198"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.198"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 6; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; #114 + eNB_instances = [0]; + sdr_addrs = "addr=192.168.80.50" + clock_src = "internal" + + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + //parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + +uicc: { +opc = "testopc"; +}; From 0c3280b554fedb80b6eaacc7d46ade1ec31e61e4 Mon Sep 17 00:00:00 2001 From: Remi Hardy Date: Fri, 23 Apr 2021 10:41:15 +0200 Subject: [PATCH 66/66] fix nsa n310 conf file for CI --- .../conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf index d007ceb9be..809203f672 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf @@ -204,7 +204,7 @@ gNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.18.99"; + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; port = 36412 ; active = "yes"; @@ -219,7 +219,7 @@ gNBs = t_dc_prep = 1000; /* unit: millisecond */ t_dc_overall = 2000; /* unit: millisecond */ target_enb_x2_ip_address = ( - { ipv4 = "192.168.18.199"; + { ipv4 = "CI_FR1_CTL_ENB_IP_ADDR"; ipv6 = "192:168:30::17"; preference = "ipv4"; } @@ -229,11 +229,11 @@ gNBs = { GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.198"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "CI_GNB_IP_ADDR"; GNB_INTERFACE_NAME_FOR_S1U = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.198"; + GNB_IPV4_ADDRESS_FOR_S1U = "CI_GNB_IP_ADDR"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 - GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.198"; + GNB_IPV4_ADDRESS_FOR_X2C = "CI_GNB_IP_ADDR"; GNB_PORT_FOR_X2C = 36422; # Spec 36422 }; }