diff --git a/README.md b/README.md index 4f38f77e4e9d37d8fdc54ff6b867bc84db818d72..2077b3d20b29fc56931768962f576a8cc6a563fc 100644 --- a/README.md +++ b/README.md @@ -21,28 +21,14 @@ # OpenAirInterface License # -### Included Fixes: ### -- Ease of use of gprof and address sanitizer for debugging purposes -- Updated json files to allow for GDB, real-time debugging capabilities -- Updated logging features to minimally log only key connection milestones. This imroves scalability of multiple UEs. -- Updated logging to include time stamp for timing analysis -- Updated memory allocation procedures to correct size requirements -- Added debugging features to handle signal terminations -- nfapi.c pullarray8 fix invalid pointer math -- Overlapping destination and source memory in memcpy, so updated to memmove to check for this bug -- Advanced error checking mechanisms in critical pack and unpack functions -- Created option for CPU assignment to UE to improve scalability -- Added EPC integration to allow multiple individual UE entities to each have their USIM information parced by the executables -- Updated random value seeds to minimize probability of error in generation of random values -- Enables capability round robin scheduler if desired -- Enables capability real time scheduler if desired -- Added new standalone functions to the UE phy-layer (phy_stub_ue.c) to incorporate individual UE entities -- Updated sending and packing functions in UE (lte_ue.c) to incorporate new standalone changes -- Incorporated semaphores to control timing of incoming downlink packets -- Implemented new queuing system to handle message exchange from UE to eNB and vice versa -- Updated global value in nFAPI for size of subframe -- Updated global value to increase scalability in system + * [OAI License Model](http://www.openairinterface.org/?page_id=101) + * [OAI License v1.1 on our website](http://www.openairinterface.org/?page_id=698) +It is distributed under **OAI Public License V1.1**. + +The license information is distributed under [LICENSE](LICENSE) file in the same directory. + +Please see [NOTICE](NOTICE.md) file for third party software that is included in the sources. # Where to Start # diff --git a/ci-scripts/conf_files/gNB_SA_CU.conf b/ci-scripts/conf_files/gNB_SA_CU.conf index 1e84e479bcd7de445a1c53fc8c265d73c459b895..39c9a43ad44a86f92f9c78f8edc5d45b6fbed730 100644 --- a/ci-scripts/conf_files/gNB_SA_CU.conf +++ b/ci-scripts/conf_files/gNB_SA_CU.conf @@ -84,17 +84,8 @@ gNBs = # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPcontrolResourceSetZero = 11; initialDLBWPsearchSpaceZero = 0; - #pdsch-ConfigCommon - #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; #for DL slot - initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB - initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - - initialDLBWPk0_1 = 0; #for mixed slot - initialDLBWPmappingType_1 = 0; - initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 #uplinkConfigCommon #frequencyInfoUL @@ -149,19 +140,6 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, - # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; # used for UL slot - initialULBWPmappingType_0 = 1 - initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - - initialULBWPk2_1 = 6; # used for mixed slot - initialULBWPmappingType_1 = 1; - initialULBWPstartSymbolAndLength_1 = 52; # this is SS=10 L=4 - - initialULBWPk2_2 = 7; # used for Msg.3 during RA - initialULBWPmappingType_2 = 1; - initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 - msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index 95fa75bc1de8d0f2dbc789cf74554cb1a6af35e6..c30805a2d9b6021db0df7b3c38186a0fd70b0e3d 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -76,17 +76,8 @@ gNBs = # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPcontrolResourceSetZero = 11; initialDLBWPsearchSpaceZero = 0; - #pdsch-ConfigCommon - #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; #for DL slot - initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB - initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - - initialDLBWPk0_1 = 0; #for mixed slot - initialDLBWPmappingType_1 = 0; - initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 #uplinkConfigCommon #frequencyInfoUL @@ -141,19 +132,6 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, - # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; # used for UL slot - initialULBWPmappingType_0 = 1 - initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - - initialULBWPk2_1 = 6; # used for mixed slot - initialULBWPmappingType_1 = 1; - initialULBWPstartSymbolAndLength_1 = 52; # this is SS=10 L=4 - - initialULBWPk2_2 = 7; # used for Msg.3 during RA - initialULBWPmappingType_2 = 1; - initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 - msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; diff --git a/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf b/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf index 082cc826f3a95b37a85ef29cce062637be80bedd..8b14b7455681031550803aaeb63ed19c81f52ada 100644 --- a/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf +++ b/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf @@ -258,7 +258,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf b/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf index 6af8a23407c83d0d194c37458d4de27ce536a642..02035ea827c2965a4c96314b28f7316ddf31e494 100644 --- a/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf +++ b/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf @@ -254,7 +254,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf index e798e40d64f767e4be2b82f94c2c9d20fea3c20e..84b66060d978b97862af6291e6cf1bef10065399 100644 --- a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf @@ -232,7 +232,7 @@ RUs = ( bf_weights = [0x00007fff, 0x00007fff]; #clock_src = "external"; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf index b92c7df92d45255145931ca421e01d681c561817..9f5c2875b39c80e73c59efdbb22815ca3e64d524 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf @@ -261,7 +261,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf index 6c778a7c3156dd260b28238388bcc389db2bb14a..594bd5e4c82dc0a1db81e39e61cc9ad392060e66 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -265,7 +265,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf index 5c826ca862e9a5ec01352c7b952329dbfda239c0..2361437f7c7c1b4004850bd1e0252d5f8dea823d 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf @@ -260,7 +260,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sf_extension = 0 - sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + sdr_addrs = "mgmt_addr=192.168.18.252,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" } ); diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index ffc2e26dc5840e9e9dff7e0c82841f8705c08976..7975d4bc77c2a05579a18f6006aa32f85d195227 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -997,8 +997,6 @@ include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC") include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP") include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/S1AP") include_directories("${OPENAIR2_DIR}/UTIL/OSA") -include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc") -include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") include_directories("${OPENAIR2_DIR}/UTIL/MEM") include_directories("${OPENAIR2_DIR}/UTIL/LISTS") include_directories("${OPENAIR2_DIR}/UTIL/FIFO") @@ -1013,8 +1011,29 @@ include_directories("${OPENAIR2_DIR}/UTIL/OMV") include_directories("${OPENAIR2_DIR}/RRC/LTE/MESSAGES") include_directories("${OPENAIR_DIR}") -# Utilities Library +# flexran ################ +# Make lfds as a own source code (even if it is a outside library) +# only user: Flexran, please don't use lfds in any other component +################################################################### + +set(lfds7 ${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/src/) +file(GLOB lfds7_queue ${lfds7}/lfds700_queue/*.c) +file(GLOB lfds7_ring ${lfds7}/lfds700_ringbuffer/*.c) +file(GLOB lfds7_qbss ${lfds7}/lfds700_queue_bounded_singleconsumer_singleproducer/*.c) +file(GLOB lfds7_stack ${lfds7}/lfds700_stack/*.c) +file(GLOB lfds7_freelist ${lfds7}/lfds700_freelist/*.c) +file(GLOB lfds7_btree ${lfds7}/lfds700_btree_addonly_unbalanced/*.c) +file(GLOB lfds7_hash ${lfds7}/lfds700_hash_addonly/*.c) +file(GLOB lfds7_ordered_list ${lfds7}/lfds700_list_addonly_ordered_singlylinked/*.c) +file(GLOB lfds7_unordered_list ${lfds7}/lfds700_list_addonly_singlylinked_unordered/*.c) +file(GLOB lfds7_misc ${lfds7}/lfds700_misc/*.c) + +add_library(LFDS7 + ${lfds7_queue} ${lfds7_ring} ${lfds7_qbss} ${lfds7_stack} ${lfds7_freelist} ${lfds7_btree} ${lfds7_hash} ${lfds7_ordered_list} ${lfds7_unordered_list} ${lfds7_misc} +) + +target_include_directories(LFDS7 PRIVATE "${lfds7}") # set the version of protobuf messages, V3 not supported yet add_list1_option(FLPT_VERSION V2 "FLPT MSG protobuf grammar version" V2 V3) @@ -1062,6 +1081,9 @@ add_library(FLPT_MSG ${FLPT_OAI_generated} ${FLPT_source} ) +target_link_libraries(FLPT_MSG LFDS7) +add_dependencies(FLPT_MSG LFDS7) + set(FLPT_MSG_LIB FLPT_MSG) #message("prpt c dir is : ${FLPT_C_DIR}") include_directories (${FLPT_C_DIR}) @@ -1073,6 +1095,7 @@ add_library(ASYNC_IF ${OPENAIR2_DIR}/UTIL/ASYNC_IF/ringbuffer_queue.c ) set(ASYNC_IF_LIB ASYNC_IF) +target_include_directories(ASYNC_IF PRIVATE "${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) add_library(FLEXRAN_AGENT @@ -1095,7 +1118,9 @@ add_library(FLEXRAN_AGENT ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_slice_verification.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_app.c ) -add_dependencies(FLEXRAN_AGENT rrc_flag) +add_dependencies(FLEXRAN_AGENT rrc_flag ASYNC_IF) +target_link_libraries(FLEXRAN_AGENT ASYNC_IF LFDS7) +target_include_directories(FLEXRAN_AGENT PRIVATE "${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT) add_library(flapp_sample SHARED ${OPENAIR2_DIR}/ENB_APP/flexran_apps/sample.c @@ -1159,6 +1184,10 @@ set(PROTOBUF_LIB "protobuf-c") #set(PROTOBUF_LIB "protobuf") #for Cpp +########### +# Utilities +############### + add_library(HASHTABLE ${OPENAIR_DIR}/common/utils/hashtable/hashtable.c ${OPENAIR_DIR}/common/utils/hashtable/obj_hashtable.c @@ -1781,7 +1810,6 @@ set(L2_SRC ${PDCP_DIR}/pdcp_primitives.c ${PDCP_DIR}/pdcp_util.c ${PDCP_DIR}/pdcp_security.c - ${PDCP_DIR}/pdcp_netlink.c ${OPENAIR2_DIR}/LAYER2/openair2_proc.c # ${RRC_DIR}/rrc_UE.c ${RRC_DIR}/rrc_eNB.c @@ -1836,7 +1864,6 @@ set(L2_SRC_UE ${PDCP_DIR}/pdcp_primitives.c ${PDCP_DIR}/pdcp_util.c ${PDCP_DIR}/pdcp_security.c - ${PDCP_DIR}/pdcp_netlink.c ${RRC_DIR}/rrc_UE.c ${RRC_DIR}/rrc_common.c ${RRC_DIR}/L2_interface_common.c @@ -2377,43 +2404,6 @@ add_library(LIB_5GNAS_GNB ) target_link_libraries(LIB_5GNAS_GNB SECU_CN ${CRYPTO_LIBRARIES}) -# Make lfds as a own source code (even if it is a outside library) -# For better intergration with compilation flags & structure of cmake -################################################################### -set(lfds ${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/src/) -file(GLOB lfds_queue ${lfds}/lfds611_queue/*.c) -file(GLOB lfds_ring ${lfds}/lfds611_ringbuffer/*.c) -file(GLOB lfds_slist ${lfds}/lfds611_slist/*.c) -file(GLOB lfds_stack ${lfds}/lfds611_stack/*.c) -file(GLOB lfds_freelist ${lfds}/lfds611_freelist/*.c) - -include_directories(${lfds}) -add_library(LFDS - ${lfds_queue} ${lfds_ring} ${lfds_slist} ${lfds_stack} ${lfds_freelist} - ${lfds}/lfds611_liblfds/lfds611_liblfds_abstraction_test_helpers.c - ${lfds}/lfds611_liblfds/lfds611_liblfds_aligned_free.c - ${lfds}/lfds611_liblfds/lfds611_liblfds_aligned_malloc.c - ${lfds}/lfds611_abstraction/lfds611_abstraction_free.c - ${lfds}/lfds611_abstraction/lfds611_abstraction_malloc.c -) - -set(lfds7 ${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/src/) -file(GLOB lfds7_queue ${lfds7}/lfds700_queue/*.c) -file(GLOB lfds7_ring ${lfds7}/lfds700_ringbuffer/*.c) -file(GLOB lfds7_qbss ${lfds7}/lfds700_queue_bounded_singleconsumer_singleproducer/*.c) -file(GLOB lfds7_stack ${lfds7}/lfds700_stack/*.c) -file(GLOB lfds7_freelist ${lfds7}/lfds700_freelist/*.c) -file(GLOB lfds7_btree ${lfds7}/lfds700_btree_addonly_unbalanced/*.c) -file(GLOB lfds7_hash ${lfds7}/lfds700_hash_addonly/*.c) -file(GLOB lfds7_ordered_list ${lfds7}/lfds700_list_addonly_ordered_singlylinked/*.c) -file(GLOB lfds7_unordered_list ${lfds7}/lfds700_list_addonly_singlylinked_unordered/*.c) -file(GLOB lfds7_misc ${lfds7}/lfds700_misc/*.c) - -include_directories(${lfds7}) -add_library(LFDS7 - ${lfds7_queue} ${lfds7_ring} ${lfds7_qbss} ${lfds7_stack} ${lfds7_freelist} ${lfds7_btree} ${lfds7_hash} ${lfds7_ordered_list} ${lfds7_unordered_list} ${lfds7_misc} -) - add_library(SIMU_COMMON ${OPENAIR1_DIR}/SIMULATION/TOOLS/random_channel.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/rangen_double.c @@ -2603,8 +2593,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 M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U F1AP_LIB F1AP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP 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 - ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} + PHY_COMMON PHY PHY_RU L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB + ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} -Wl,--end-group z dl) target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) @@ -2643,8 +2633,8 @@ 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 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 - ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} + PHY_COMMON PHY PHY_RU L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB MISC_NFAPI_LTE_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB SIMU_COMMON + ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} -Wl,--end-group z dl) target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${LIB_LMS_LIBRARIES} ${T_LIB}) @@ -2701,8 +2691,8 @@ 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 SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP 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 - ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES} + PHY_UE PHY_RU L2_UE L2_LTE SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB + ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ATLAS_LIBRARIES} -Wl,--end-group z dl) target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES}) @@ -2740,8 +2730,8 @@ add_executable(nr-softmodem target_link_libraries (nr-softmodem -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT 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 ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB + UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU GTPV1U SECU_CN SECU_OSA + ITTI ${FLPT_MSG_LIB} ${FLEXRAN_AGENT_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 ${FSPT_MSG_LIB} -Wl,--end-group z dl) @@ -2780,11 +2770,11 @@ add_executable(nr-uesoftmodem target_link_libraries (nr-uesoftmodem -Wl,--start-group RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB - PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB + PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_NR_LIB S1AP_LIB S1AP_ENB - ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} + ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ATLAS_LIBRARIES} NFAPI_USER_LIB S1AP_LIB S1AP_ENB - ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB} + ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ATLAS_LIBRARIES} LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB} -Wl,--end-group z dl) target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES}) @@ -2812,7 +2802,7 @@ add_executable(dlsim_tm4 ${T_SOURCE} ) target_link_libraries (dlsim_tm4 - -Wl,--start-group SIMU_COMMON SIMU UTIL SCHED_LIB SCHED_RU_LIB PHY LFDS ITTI -Wl,--end-group + -Wl,--start-group SIMU_COMMON SIMU UTIL SCHED_LIB SCHED_RU_LIB PHY ITTI -Wl,--end-group pthread m rt CONFIG_LIB ${ATLAS_LIBRARIES} ${T_LIB} ) @@ -2976,7 +2966,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr ${NFAPI_USER_DIR}/nfapi.c ) 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 LFDS7 -Wl,--end-group + -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 ITTI -Wl,--end-group pthread m rt CONFIG_LIB ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl ) @@ -2998,7 +2988,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 -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} CONFIG_LIB ) endforeach(myExe) @@ -3019,12 +3009,12 @@ if (${T_TRACER}) ITTI RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP params_libconfig oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_iqplayer oai_eth_transpro oai_mobipass tcp_bridge tcp_bridge_oai - coding FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE UTIL OMG_SUMO + coding FLPT_MSG FLEXRAN_AGENT HASHTABLE UTIL OMG_SUMO SECU_OSA SECU_CN SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB default_sched remote_sched RAL 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 SCTP_CLIENT MME_APP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB + CN_UTILS GTPV1U SCTP_CLIENT MME_APP LIB_NAS_UE NB_IoT SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB ldpc_orig ldpc_optim ldpc_optim8seg ldpc dfts) if (TARGET ${i}) add_dependencies(${i} generate_T) @@ -3128,8 +3118,8 @@ add_executable(nr-ittisim target_link_libraries (nr-ittisim -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT 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 ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${RAL_LIB} ${NAS_SIM_LIB} RRC_LIB NR_RRC_LIB + UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU GTPV1U SECU_CN SECU_OSA + ITTI ${FLPT_MSG_LIB} ${FLEXRAN_AGENT_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 ${FSPT_MSG_LIB} PHY_NR_UE SCHED_NR_UE_LIB NR_L2_UE diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index acbbcfd1a98602cb4c0a4b7c3d76ebd93e65eef6..e8023d2d52043774600d9b973a57fb460dc93e41 100755 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1093,10 +1093,10 @@ (Test8: 217 PRB 100 PDSCH-PRBs 110 PDSCH-Offset), (Test9: 106 PRBs 50 PDSCH-PRBs MCS Index 27), (Test10: 106 PRBs 50 PDSCH-PRBs MCS Index 16), - (Test11: 106 MCS-TABLE 256 QAM MCS Index 26), - (Test12: HARQ test 25% TP (4 rounds), - (Test13: HARQ test 33% TP (3 rounds), - (Test14: HARQ test 50% TP (2 rounds), + (Test11: 106 MCS-TABLE 256 QAM MCS Index 27), + (Test12: HARQ test 25% TP 4 rounds), + (Test13: HARQ test 33% TP 3 rounds), + (Test14: HARQ test 50% TP 2 rounds), (Test15: 3 PTRS, 8 Interpolated Symbols), (Test16: 6 PTRS, 5 Interpolated Symbols), (Test17: 11 PTRS, 0 Interpolated Symbols), diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index 1f19d5587818f50da9333a74eb8ff2d8986ac13d..1fbf42f62d43c02952ffcc487acc00636fc8f735 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -346,7 +346,7 @@ typedef struct { @param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit) @param multiVec create new file or append to existing (useful for writing multiple vectors to same file. Just call the function multiple times with same file name and with this parameter set to 1) */ -#define MATLAB_RAW (1<<31) +#define MATLAB_RAW (1U<<31) #define MATLAB_SHORT 0 #define MATLAB_CSHORT 1 #define MATLAB_INT 2 diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index febfe7db7d77bacc0c7382c32706a86f351a004b..49743b3bdc8f82f1795d721fae4d35fc2c1e077a 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -521,7 +521,6 @@ int get_subband_size(int NPRB,int size) { } - // from start symbol index and nb or symbols to symbol occupation bitmap in a slot uint16_t SL_to_bitmap(int startSymbolIndex, int nrOfSymbols) { return ((1<<nrOfSymbols)-1)<<startSymbolIndex; @@ -543,5 +542,4 @@ void SLIV2SL(int SLIV,int *S,int *L) { *L=15-SLIVdiv14; *S=13-SLIVmod14; } - } diff --git a/doc/L2NFAPI.md b/doc/L2NFAPI.md index 137e4847e4bddbde1eace9ec9806793ad4bab8e8..5b8c0f546cf1c1e323e0004d7e85029d355fc1ba 100644 --- a/doc/L2NFAPI.md +++ b/doc/L2NFAPI.md @@ -18,6 +18,10 @@ The UE executable is able to "simulate" multiple UEs in order to stimulate the s **This simulator is available starting the `v1.0.0` release on the `master` branch.** +**2022/03/08: CAUTION, THIS TUTORIAL IS NO LONGER VALID on the `develop` branch after the `2022.w01` tag.** + +**2022/03/08: CAUTION, THE LAST VALID TAG on `develop` branch is `2021.w51_c`.** + Currently the Continuous Integration process is validating this simulator the following way: * the LTE modem executable is run on one host (in our CI deployment it is a **Xenial Virtual Machine**) @@ -31,6 +35,17 @@ Normally it should be fine to run both executables on the same host using the `l 1. [With S1 -- eNB and UE on 2 hosts](L2NFAPI_S1.md) 2. [No S1 -- eNB and UE on 2 hosts](L2NFAPI_NOS1.md) + +**2022/03/08: Starting the `2022.w01` tag on the `develop` branch, the L2 nFAPI simulation is using a proxy.** + +A tutorial is available on the [EpiSci GitHub Repository](https://github.com/EpiSci/oai-lte-5g-multi-ue-proxy#readme). + +This proxy allows to perform L2 nFAPI simulator for: + +* LTE +* 5G-NSA +* 5G-SA + ---- [oai wiki home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/doc/L2NFAPI_NOS1.md b/doc/L2NFAPI_NOS1.md index bb4c32ec084bf2258657bfa0bb96d01253825807..4f56be34166b8b5f8fdb7a3e702e126378097dd3 100644 --- a/doc/L2NFAPI_NOS1.md +++ b/doc/L2NFAPI_NOS1.md @@ -12,6 +12,10 @@ </tr> </table> +**2022/03/08: CAUTION, THIS TUTORIAL IS NO LONGER VALID on the `develop` branch after the `2022.w01` tag.** + +**2022/03/08: CAUTION, THE LAST VALID TAG on `develop` branch is `2021.w51_c`.** + ## Table of Contents ## 1. [Environment](#1-environment) diff --git a/doc/L2NFAPI_S1.md b/doc/L2NFAPI_S1.md index 9fd6d518180d705d1d5a16a3d4361b3cd7b06684..824e9e469ab7dcd5d0542a52268c74622176f63a 100644 --- a/doc/L2NFAPI_S1.md +++ b/doc/L2NFAPI_S1.md @@ -12,6 +12,10 @@ </tr> </table> +**2022/03/08: CAUTION, THIS TUTORIAL IS NO LONGER VALID on the `develop` branch after the `2022.w01` tag.** + +**2022/03/08: CAUTION, THE LAST VALID TAG on `develop` branch is `2021.w51_c`.** + ## Table of Contents ## 1. [Environment](#1-environment) diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index 449859b04225039b846ca02acc8199a01fc67f28..7ee3ae9d7e6d01bf42fdb0c961754f06fbad2f02 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -33,7 +33,7 @@ It is planned to enhance this simulator with the following functionalities: This simulator connects a eNodeB and UEs through a nfapi interface, short-cutting the L1 layer. The objective of this simulator is to allow multi UEs simulation, with a large number of UEs (ideally up to 255 ) .Here to ease the platform setup, UEs are simulated via a single `lte-uesoftmodem` instance. Today the CI tests just with one UE and architecture has to be reviewed to allow a number of UE above about 16. This work is on-going. -As for the rf simulator, no specific hardware is required. The [L2 nfapi simlator page](L2NFAPI.md) contains the detailed documentation. +As for the rf simulator, no specific hardware is required. The [L2 nfapi simulator page](L2NFAPI.md) contains the detailed documentation. # L1 Simulator diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index fa0c3a1f63a15e40fe9b3c0db9fec46fc7faba24..4793ef4e95fc7a0e78d280ee0c07bb93ac95f71f 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -177,15 +177,14 @@ void rx_func(void *param) { void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); int j; for (j = 0; j < NUMBER_OF_NR_ULSCH_MAX; j++) - if (gNB->ulsch[j][0]->rnti == rnti_to_remove[i]) { - gNB->ulsch[j][0]->rnti = 0; - gNB->ulsch[j][0]->harq_mask = 0; - //clean_gNB_ulsch(gNB->ulsch[j][0]); + if (gNB->ulsch[j]->rnti == rnti_to_remove[i]) { + gNB->ulsch[j]->rnti = 0; + gNB->ulsch[j]->harq_mask = 0; int h; for (h = 0; h < NR_MAX_ULSCH_HARQ_PROCESSES; h++) { - gNB->ulsch[j][0]->harq_processes[h]->status = SCH_IDLE; - gNB->ulsch[j][0]->harq_processes[h]->round = 0; - gNB->ulsch[j][0]->harq_processes[h]->handled = 0; + gNB->ulsch[j]->harq_processes[h]->status = SCH_IDLE; + gNB->ulsch[j]->harq_processes[h]->round = 0; + gNB->ulsch[j]->harq_processes[h]->handled = 0; } up_removed++; } @@ -210,7 +209,6 @@ void rx_func(void *param) { if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); // 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); if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) { // UE-specific RX processing for subframe n @@ -244,7 +242,8 @@ void rx_func(void *param) { gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); pthread_mutex_unlock(&gNB->UL_INFO_mutex); stop_meas(&gNB->ul_indication_stats); - + + int tx_slot_type = nr_slot_select(cfg,frame_rx,slot_tx); if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) { notifiedFIFO_elt_t *res; processingData_L1tx_t *syncMsg; @@ -256,8 +255,17 @@ void rx_func(void *param) { syncMsg->timestamp_tx = info->timestamp_tx; res->key = slot_tx; pushTpool(gNB->threadPool, res); + } else if (get_softmodem_params()->continuous_tx) { + notifiedFIFO_elt_t *res = pullTpool(gNB->L1_tx_free, gNB->threadPool); + processingData_L1tx_t *syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res); + syncMsg->gNB = gNB; + syncMsg->timestamp_tx = info->timestamp_tx; + syncMsg->frame = frame_tx; + syncMsg->slot = slot_tx; + res->key = slot_tx; + pushNotifiedFIFO(gNB->L1_tx_out, res); } - + #if 0 LOG_D(PHY, "rxtx:%lld nfapi:%lld phy:%lld tx:%lld rx:%lld prach:%lld ofdm:%lld ", softmodem_stats_rxtx_sf.diff_now, nfapi_meas.diff_now, @@ -395,7 +403,11 @@ void *tx_reorder_thread(void* param) { syncMsgRU.slot_tx = syncMsgL1->slot; syncMsgRU.timestamp_tx = syncMsgL1->timestamp_tx; syncMsgRU.ru = gNB->RU_list[0]; - next_tx_slot = get_next_downlink_slot(gNB, &gNB->gNB_config, syncMsgRU.frame_tx, syncMsgRU.slot_tx); + if (get_softmodem_params()->continuous_tx) { + int slots_per_frame = gNB->frame_parms.slots_per_frame; + next_tx_slot = (syncMsgRU.slot_tx + 1) % slots_per_frame; + } else + next_tx_slot = get_next_downlink_slot(gNB, &gNB->gNB_config, syncMsgRU.frame_tx, syncMsgRU.slot_tx); pushNotifiedFIFO(gNB->L1_tx_free, resL1); if (resL1==resL1Reserve) resL1Reserve=NULL; diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 14cd9149bd3f2583663b0a3f265933dd2f3a35f0..b51b11520a957e6be4ac5f417216bcdf552bcd27 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -703,53 +703,60 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { nfapi_nr_config_request_scf_t *cfg = &ru->config; void *txp[ru->nb_tx]; unsigned int txs; - int i,txsymb=fp->symbols_per_slot; + int i; T(T_ENB_PHY_OUTPUT_SIGNAL, T_INT(0), T_INT(0), T_INT(frame), T_INT(slot), T_INT(0), T_BUFFER(&ru->common.txdata[0][fp->get_samples_slot_timestamp(slot,fp,0)], fp->samples_per_subframe * 4)); - int slot_type = nr_slot_select(cfg,frame,slot%fp->slots_per_frame); - int prevslot_type = nr_slot_select(cfg,frame,(slot+(fp->slots_per_frame-1))%fp->slots_per_frame); - int nextslot_type = nr_slot_select(cfg,frame,(slot+1)%fp->slots_per_frame); int sf_extension = 0; int siglen=fp->get_samples_per_slot(slot,fp); - int flags=1; + int flags = 0; - //nr_subframe_t SF_type = nr_slot_select(cfg,slot%fp->slots_per_frame); - if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT || IS_SOFTMODEM_RFSIM) { - if (cfg->cell_config.frame_duplex_type.value == TDD) { - if(slot_type == NR_MIXED_SLOT) { - txsymb = 0; + if (cfg->cell_config.frame_duplex_type.value == TDD && !get_softmodem_params()->continuous_tx) { + int slot_type = nr_slot_select(cfg,frame,slot%fp->slots_per_frame); + if(slot_type == NR_MIXED_SLOT) { + int txsymb = 0; - for(int symbol_count = 0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) { - if (cfg->tdd_table.max_tdd_periodicity_list[slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value == 0) - txsymb++; - } + for(int symbol_count = 0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) { + if (cfg->tdd_table.max_tdd_periodicity_list[slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value == 0) + txsymb++; + } - AssertFatal(txsymb>0,"illegal txsymb %d\n",txsymb); + AssertFatal(txsymb>0,"illegal txsymb %d\n",txsymb); - if (fp->slots_per_subframe == 1) { - if (txsymb <= 7) - siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); - else - siglen = 2 * (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (txsymb - 2) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); - } else { - if (slot%(fp->slots_per_subframe/2)) - siglen = txsymb * (fp->ofdm_symbol_size + fp->nb_prefix_samples); - else - siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); - } - - //+ ru->end_of_burst_delay; - flags = 3; // end of burst + if (fp->slots_per_subframe == 1) { + if (txsymb <= 7) + siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); + else + siglen = 2 * (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (txsymb - 2) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); + } else { + if(slot%(fp->slots_per_subframe/2)) + siglen = txsymb * (fp->ofdm_symbol_size + fp->nb_prefix_samples); + else + siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples); } - if (slot_type == NR_DOWNLINK_SLOT && prevslot_type == NR_UPLINK_SLOT) { + //+ ru->end_of_burst_delay; + flags = 3; // end of burst + } else if (slot_type == NR_DOWNLINK_SLOT) { + int prevslot_type = nr_slot_select(cfg,frame,(slot+(fp->slots_per_frame-1))%fp->slots_per_frame); + int nextslot_type = nr_slot_select(cfg,frame,(slot+1)%fp->slots_per_frame); + if (prevslot_type == NR_UPLINK_SLOT) { flags = 2; // start of burst sf_extension = ru->sf_extension; - } - if (slot_type == NR_DOWNLINK_SLOT && nextslot_type == NR_UPLINK_SLOT) + } else if (nextslot_type == NR_UPLINK_SLOT) { flags = 3; // end of burst + } else { + flags = 1; // middle of burst + } } + } else { // FDD + if (proc->first_tx == 1) { + flags = 2; // start of burst + } else { + flags = 1; // middle of burst + } + } + if (flags) { if (fp->freq_range==nr_FR2) { // the beam index is written in bits 8-10 of the flags // bit 11 enables the gpio programming diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 543be7a8b5eac91821cba05b9b30b9f150573b4c..3cc71b8b3a0f3ef9d577176e64ab1f404557fe3c 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -18,7 +18,8 @@ * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ -#define _GNU_SOURCE + +#define _GNU_SOURCE #include <pthread.h> #include <openair1/PHY/impl_defs_top.h> #include "executables/nr-uesoftmodem.h" @@ -1125,9 +1126,8 @@ void *UE_thread(void *arg) { } int flags = 0; - int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH; - if (openair0_cfg[0].duplex_mode == duplex_mode_TDD) { + if (openair0_cfg[0].duplex_mode == duplex_mode_TDD && !get_softmodem_params()->continuous_tx) { uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots; int nrofUplinkSlots, nrofUplinkSymbols; @@ -1139,8 +1139,9 @@ void *UE_thread(void *arg) { nrofUplinkSlots = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; nrofUplinkSymbols = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols; } - uint8_t num_UL_slots = nrofUplinkSlots + (nrofUplinkSymbols != 0); + int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH; + uint8_t num_UL_slots = nrofUplinkSlots + (nrofUplinkSymbols != 0); uint8_t first_tx_slot = tdd_period - num_UL_slots; if (slot_tx_usrp % tdd_period == first_tx_slot) diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 1f73720e703a7017f886278b0c3c7c09d06e327d..8d6735b1994bece407133eb757131fea5fb6c24d 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -99,6 +99,7 @@ extern "C" #define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n" #define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR\n" #define CONFIG_L1_EMULATOR "Run in L1 emulated mode (disable PHY layer)\n" +#define CONFIG_HLP_CONTINUOUS_TX "perform continuous transmission, even in TDD mode (to work around USRP issues)\n" /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ /* command line parameters common to eNodeB and UE */ @@ -126,6 +127,7 @@ extern "C" #define NODE_NUMBER softmodem_params.node_number #define NON_STOP softmodem_params.non_stop #define EMULATE_L1 softmodem_params.emulate_l1 +#define CONTINUOUS_TX softmodem_params.continuous_tx #define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat"; @@ -163,7 +165,8 @@ extern int usrp_tx_thread; {"do-prb-interpolation", CONFIG_HLP_PRBINTER, PARAMFLAG_BOOL, iptr:&PRB_INTERPOLATION, defintval:0, TYPE_INT, 0}, \ {"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \ {"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \ - {"emulate-l1", CONFIG_L1_EMULATOR, PARAMFLAG_BOOL, iptr:&EMULATE_L1, defintval:0, TYPE_INT, 0} \ + {"emulate-l1", CONFIG_L1_EMULATOR, PARAMFLAG_BOOL, iptr:&EMULATE_L1, defintval:0, TYPE_INT, 0}, \ + {"continuous-tx", CONFIG_HLP_CONTINUOUS_TX,PARAMFLAG_BOOL, iptr:&CONTINUOUS_TX, defintval:0, TYPE_INT, 0}, \ } #define CONFIG_HLP_NSA "Enable NSA mode \n" @@ -254,6 +257,7 @@ typedef struct { uint16_t node_number; int non_stop; int emulate_l1; + int continuous_tx; } softmodem_params_t; extern uint64_t get_softmodem_optmask(void); diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c index 58d649d0119b35edcd1781042acd9b52dc0cc354..41b2d4fe84c2b3a3b330edc6a262986d501a38a5 100644 --- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c +++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c @@ -117,7 +117,7 @@ int test_ldpc(short No_iteration, sigma = 1.0/sqrt(2*SNR); opp_enabled=1; //short test_input[block_length]; - unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};; + unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};; //short *c; //padded codeword unsigned char estimated_output[MAX_NUM_DLSCH_SEGMENTS][block_length]; memset(estimated_output, 0, sizeof(estimated_output)); diff --git a/openair1/PHY/CODING/crc_byte.c b/openair1/PHY/CODING/crc_byte.c index 7e37abcf8152c4b388dd206edd0d3aee6523beff..9ad18cc1a6336c5a542182813ea7f7b66a1c523e 100644 --- a/openair1/PHY/CODING/crc_byte.c +++ b/openair1/PHY/CODING/crc_byte.c @@ -72,10 +72,10 @@ unsigned int crcbit (unsigned char * inputptr, unsigned int i, crc = 0, c; while (octetlen-- > 0) { - c = (*inputptr++) << 24; + c = ((unsigned int)(*inputptr++)) << 24; for (i = 8; i != 0; i--) { - if ((1 << 31) & (c ^ crc)) + if ((1U << 31) & (c ^ crc)) crc = (crc << 1) ^ poly; else crc <<= 1; diff --git a/openair1/PHY/CODING/nrLDPC_defs.h b/openair1/PHY/CODING/nrLDPC_defs.h index 0d7ff9ef9f834e9c8c5231f65e24f9e96da408a9..a6fb44cb0dd40bfd1b0995043ec6893e91317dff 100644 --- a/openair1/PHY/CODING/nrLDPC_defs.h +++ b/openair1/PHY/CODING/nrLDPC_defs.h @@ -57,7 +57,7 @@ typedef struct { /// Number of "Filler" bits uint32_t F; /// LDPC-code outputs - uint8_t *d[MAX_NUM_NR_DLSCH_SEGMENTS]; + uint8_t *d[MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS]; } encoder_implemparams_t; #define INIT0_LDPCIMPLEMPARAMS {0,0,0,NULL,NULL,NULL,NULL} typedef void(*nrLDPC_initcallfunc_t)(t_nrLDPC_dec_params *p_decParams, int8_t *p_llr, int8_t *p_out); diff --git a/openair1/PHY/CODING/nr_segmentation.c b/openair1/PHY/CODING/nr_segmentation.c index 0eede23766956fd83a6789f55c842fc4d58ebfe3..281e61cda523fc3c9621f81c4d2f1ab183f0c5a5 100644 --- a/openair1/PHY/CODING/nr_segmentation.c +++ b/openair1/PHY/CODING/nr_segmentation.c @@ -63,11 +63,6 @@ int32_t nr_segmentation(unsigned char *input_buffer, #endif } - if ((*C)>MAX_NUM_NR_DLSCH_SEGMENTS) { - LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime); - return(-1); - } - // Find K+ Kprime = Bprime/(*C); diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index afb5614cbd8bbb05507f9793636179c08b059aab..59b3c85504742c7e9c29237edd19c8655b3a3c7f 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -117,12 +117,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, gNB->bad_pucch = 0; + // ceil(((NB_RB<<1)*3)/32) // 3 RE *2(QPSK) + int pdcch_dmrs_init_length = (((fp->N_RB_DL<<1)*3)>>5)+1; + for (int slot=0; slot<fp->slots_per_frame; slot++) { pdcch_dmrs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *)); AssertFatal(pdcch_dmrs[slot]!=NULL, "NR init: pdcch_dmrs for slot %d - malloc failed\n", slot); for (int symb=0; symb<fp->symbols_per_slot; symb++) { - pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(pdcch_dmrs_init_length*sizeof(uint32_t)); LOG_D(PHY,"pdcch_dmrs[%d][%d] %p\n",slot,symb,pdcch_dmrs[slot][symb]); AssertFatal(pdcch_dmrs[slot][symb]!=NULL, "NR init: pdcch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); } @@ -136,16 +139,19 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, gNB->nr_gold_pdsch_dmrs = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***)); uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs; + // ceil(((NB_RB*6(k)*2(QPSK)/32) // 3 RE *2(QPSK) + int pdsch_dmrs_init_length = ((fp->N_RB_DL*12)>>5)+1; for (int slot=0; slot<fp->slots_per_frame; slot++) { pdsch_dmrs[slot] = (uint32_t ***)malloc16(fp->symbols_per_slot*sizeof(uint32_t **)); AssertFatal(pdsch_dmrs[slot]!=NULL, "NR init: pdsch_dmrs for slot %d - malloc failed\n", slot); + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; for (int symb=0; symb<fp->symbols_per_slot; symb++) { - pdsch_dmrs[slot][symb] = (uint32_t **)malloc16(NR_MAX_NB_CODEWORDS*sizeof(uint32_t *)); + pdsch_dmrs[slot][symb] = (uint32_t **)malloc16(nb_codewords*sizeof(uint32_t *)); AssertFatal(pdsch_dmrs[slot][symb]!=NULL, "NR init: pdsch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); - for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) { - pdsch_dmrs[slot][symb][q] = (uint32_t *)malloc16(NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + for (int q=0; q<nb_codewords; q++) { + pdsch_dmrs[slot][symb][q] = (uint32_t *)malloc16(pdsch_dmrs_init_length*sizeof(uint32_t)); AssertFatal(pdsch_dmrs[slot][symb][q]!=NULL, "NR init: pdsch_dmrs for slot %d symbol %d codeword %d - malloc failed\n", slot, symb, q); } } @@ -158,6 +164,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, uint32_t ****pusch_dmrs = gNB->nr_gold_pusch_dmrs; + // ceil(((NB_RB*6(k)*2(QPSK)/32) // 3 RE *2(QPSK) + int pusch_dmrs_init_length = ((fp->N_RB_UL*12)>>5)+1; for(int nscid=0; nscid<2; nscid++) { pusch_dmrs[nscid] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **)); AssertFatal(pusch_dmrs[nscid]!=NULL, "NR init: pusch_dmrs for nscid %d - malloc failed\n", nscid); @@ -167,7 +175,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, AssertFatal(pusch_dmrs[nscid][slot]!=NULL, "NR init: pusch_dmrs for slot %d - malloc failed\n", slot); for (int symb=0; symb<fp->symbols_per_slot; symb++) { - pusch_dmrs[nscid][slot][symb] = (uint32_t *)malloc16(NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + pusch_dmrs[nscid][slot][symb] = (uint32_t *)malloc16(pusch_dmrs_init_length*sizeof(uint32_t)); AssertFatal(pusch_dmrs[nscid][slot][symb]!=NULL, "NR init: pusch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); } } @@ -182,12 +190,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, uint32_t ***csi_rs = gNB->nr_gold_csi_rs; AssertFatal(csi_rs!=NULL, "NR init: csi reference signal malloc failed\n"); + // ceil((NB_RB*8(max allocation per RB)*2(QPSK))/32) + int csi_dmrs_init_length = ((fp->N_RB_DL<<4)>>5)+1; + for (int slot=0; slot<fp->slots_per_frame; slot++) { csi_rs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *)); AssertFatal(csi_rs[slot]!=NULL, "NR init: csi reference signal for slot %d - malloc failed\n", slot); for (int symb=0; symb<fp->symbols_per_slot; symb++) { - csi_rs[slot][symb] = (uint32_t *)malloc16(NR_MAX_CSI_RS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + csi_rs[slot][symb] = (uint32_t *)malloc16(csi_dmrs_init_length*sizeof(uint32_t)); AssertFatal(csi_rs[slot][symb]!=NULL, "NR init: csi reference signal for slot %d symbol %d - malloc failed\n", slot, symb); } } @@ -196,6 +207,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, for (int id=0; id<NUMBER_OF_NR_SRS_MAX; id++) { gNB->nr_srs_info[id] = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t)); + gNB->nr_srs_info[id]->sc_list = (uint16_t *) malloc16_clear(6*fp->N_RB_UL*sizeof(uint16_t)); gNB->nr_srs_info[id]->srs_generated_signal = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t)); gNB->nr_srs_info[id]->noise_power = (uint32_t*)malloc16_clear(sizeof(uint32_t)); gNB->nr_srs_info[id]->srs_received_signal = (int32_t **)malloc16(Prx*sizeof(int32_t*)); @@ -315,9 +327,10 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) free_and_zero(pdcch_dmrs); uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs; + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; for (int slot = 0; slot < fp->slots_per_frame; slot++) { for (int symb = 0; symb < fp->symbols_per_slot; symb++) { - for (int q = 0; q < NR_MAX_NB_CODEWORDS; q++) + for (int q = 0; q < nb_codewords; q++) free_and_zero(pdsch_dmrs[slot][symb][q]); free_and_zero(pdsch_dmrs[slot][symb]); } @@ -352,6 +365,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time[i]); free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time_shifted[i]); } + free_and_zero(gNB->nr_srs_info[id]->sc_list); free_and_zero(gNB->nr_srs_info[id]->srs_generated_signal); free_and_zero(gNB->nr_srs_info[id]->noise_power); free_and_zero(gNB->nr_srs_info[id]->srs_received_signal); @@ -559,9 +573,10 @@ void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) { uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value; msg->num_pdsch_slot = 0; + int num_cw = NR_MAX_NB_LAYERS > 4? 2:1; for (int i=0; i<gNB->number_of_nr_dlsch_max; i++) { LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,gNB->number_of_nr_dlsch_max); - for (int j=0; j<2; j++) { + for (int j=0; j<num_cw; j++) { msg->dlsch[i][j] = new_gNB_dlsch(fp,1,16,NSOFT,0,grid_size); AssertFatal(msg->dlsch[i][j]!=NULL,"Can't initialize dlsch %d \n", i); } @@ -573,9 +588,10 @@ void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) const NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; const nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; const uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value; + int num_cw = NR_MAX_NB_LAYERS > 4? 2:1; for (int i=0; i<gNB->number_of_nr_dlsch_max; i++) - for (int j=0; j<2; j++) - free_gNB_dlsch(&msg->dlsch[i][j], grid_size); + for (int j=0; j<num_cw; j++) + free_gNB_dlsch(&msg->dlsch[i][j], grid_size, fp); } void init_nr_transport(PHY_VARS_gNB *gNB) { @@ -600,22 +616,16 @@ void init_nr_transport(PHY_VARS_gNB *gNB) { LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,gNB->number_of_nr_ulsch_max); - for (int j=0; j<2; j++) { - // ULSCH for data - gNB->ulsch[i][j] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL); - - if (!gNB->ulsch[i][j]) { - LOG_E(PHY,"Can't get gNB ulsch structures\n"); - exit(-1); - } + gNB->ulsch[i] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL); + if (!gNB->ulsch[i]) { + LOG_E(PHY,"Can't get gNB ulsch structures\n"); + exit(-1); } - } gNB->rx_total_gain_dB=130; - //fp->pucch_config_common.deltaPUCCH_Shift = 1; } @@ -630,6 +640,5 @@ void reset_nr_transport(PHY_VARS_gNB *gNB) free_gNB_srs(gNB->srs[i]); for (int i=0; i<gNB->number_of_nr_ulsch_max; i++) - for (int j=0; j<2; j++) - free_gNB_ulsch(&gNB->ulsch[i][j], fp->N_RB_UL); + free_gNB_ulsch(&gNB->ulsch[i], fp->N_RB_UL); } diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 5c6780c67d2c513f2588129e8184256ef0e54c14..b19a149567fe81ae4d2b482cbf124f09a27a1be6 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -57,6 +57,7 @@ extern uint16_t beta_cqi[16]; */ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch, const NR_DL_FRAME_PARMS *const fp) { + AssertFatal( pdsch, "pdsch==0" ); pdsch->pmi_ext = (uint8_t *)malloc16_clear( fp->N_RB_DL ); pdsch->llr[0] = (int16_t *)malloc16_clear( (8*(3*8*6144))*sizeof(int16_t) ); @@ -150,21 +151,6 @@ void phy_term_nr_ue__PDSCH(NR_UE_PDSCH* pdsch, const NR_DL_FRAME_PARMS *const fp free_and_zero(pdsch->ptrs_re_per_slot); } -void phy_init_nr_ue_PUSCH(NR_UE_PUSCH *const pusch, - const NR_DL_FRAME_PARMS *const fp) { - AssertFatal( pusch, "pusch==0" ); - - for (int i=0; i<NR_MAX_NB_LAYERS; i++) { - pusch->txdataF_layers[i] = (int32_t *)malloc16_clear(NR_MAX_PUSCH_ENCODED_LENGTH*sizeof(int32_t)); - } -} - -void phy_term_nr_ue_PUSCH(NR_UE_PUSCH *pusch) -{ - for (int i = 0; i < NR_MAX_NB_LAYERS; i++) - free_and_zero(pusch->txdataF_layers[i]); -} - int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) { // create shortcuts @@ -172,13 +158,15 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) NR_UE_COMMON *const common_vars = &ue->common_vars; NR_UE_PBCH **const pbch_vars = ue->pbch_vars; NR_UE_PRACH **const prach_vars = ue->prach_vars; + int i,j,k,l,slot,symb; + NR_UE_SRS **const srs_vars = ue->srs_vars; - int i,j,k,l,slot,symb,q; int gNB_id; int th_id; - uint32_t ****pusch_dmrs; + LOG_I(PHY, "Initializing UE vars for gNB TXant %u, UE RXant %u\n", fp->nb_antennas_tx, fp->nb_antennas_rx); + phy_init_nr_top(ue); // many memory allocation sizes are hard coded AssertFatal( fp->nb_antennas_rx <= 4, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" ); @@ -206,15 +194,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) // init NR modulation lookup tables nr_generate_modulation_table(); - /////////////////////////PUSCH init///////////////////////// - /////////// - for (th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { - for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) { - ue->pusch_vars[th_id][gNB_id] = (NR_UE_PUSCH *)malloc16(sizeof(NR_UE_PUSCH)); - phy_init_nr_ue_PUSCH( ue->pusch_vars[th_id][gNB_id], fp ); - } - } - /////////////////////////PUCCH init///////////////////////// /////////// for (th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { @@ -230,21 +209,21 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) /////////////////////////PUSCH DMRS init///////////////////////// /////////// - ue->nr_gold_pusch_dmrs = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***)); - pusch_dmrs = ue->nr_gold_pusch_dmrs; + + // ceil(((NB_RB*6(k)*2(QPSK)/32) // 3 RE *2(QPSK) + int pusch_dmrs_init_length = ((fp->N_RB_UL*12)>>5)+1; + + ue->nr_gold_pusch_dmrs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **)); + uint32_t ***pusch_dmrs = ue->nr_gold_pusch_dmrs; for (slot=0; slot<fp->slots_per_frame; slot++) { - pusch_dmrs[slot] = (uint32_t ***)malloc16(fp->symbols_per_slot*sizeof(uint32_t **)); + pusch_dmrs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *)); AssertFatal(pusch_dmrs[slot]!=NULL, "init_nr_ue_signal: pusch_dmrs for slot %d - malloc failed\n", slot); for (symb=0; symb<fp->symbols_per_slot; symb++) { - pusch_dmrs[slot][symb] = (uint32_t **)malloc16(NR_MAX_NB_CODEWORDS*sizeof(uint32_t *)); + pusch_dmrs[slot][symb] = (uint32_t *)malloc16(pusch_dmrs_init_length*sizeof(uint32_t)); AssertFatal(pusch_dmrs[slot][symb]!=NULL, "init_nr_ue_signal: pusch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); - for (q=0; q<NR_MAX_NB_CODEWORDS; q++) { - pusch_dmrs[slot][symb][q] = (uint32_t *)malloc16(NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t)); - AssertFatal(pusch_dmrs[slot][symb][q]!=NULL, "init_nr_ue_signal: pusch_dmrs for slot %d symbol %d codeword %d - malloc failed\n", slot, symb, q); - } } } @@ -293,6 +272,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) } } + // ceil(((NB_RB<<1)*3)/32) // 3 RE *2(QPSK) + int pdcch_dmrs_init_length = (((fp->N_RB_DL<<1)*3)>>5)+1; //PDCCH DMRS init (gNB offset = 0) ue->nr_gold_pdcch[0] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **)); uint32_t ***pdcch_dmrs = ue->nr_gold_pdcch[0]; @@ -303,11 +284,14 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) AssertFatal(pdcch_dmrs[slot]!=NULL, "NR init: pdcch_dmrs for slot %d - malloc failed\n", slot); for (int symb=0; symb<fp->symbols_per_slot; symb++) { - pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(pdcch_dmrs_init_length*sizeof(uint32_t)); AssertFatal(pdcch_dmrs[slot][symb]!=NULL, "NR init: pdcch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); } } + // ceil(((NB_RB*6(k)*2(QPSK)/32) // 3 RE *2(QPSK) + int pdsch_dmrs_init_length = ((fp->N_RB_DL*12)>>5)+1; + //PDSCH DMRS init (eNB offset = 0) ue->nr_gold_pdsch[0] = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***)); uint32_t ****pdsch_dmrs = ue->nr_gold_pdsch[0]; @@ -316,12 +300,13 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) pdsch_dmrs[slot] = (uint32_t ***)malloc16(fp->symbols_per_slot*sizeof(uint32_t **)); AssertFatal(pdsch_dmrs[slot]!=NULL, "NR init: pdsch_dmrs for slot %d - malloc failed\n", slot); + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; for (int symb=0; symb<fp->symbols_per_slot; symb++) { - pdsch_dmrs[slot][symb] = (uint32_t **)malloc16(NR_MAX_NB_CODEWORDS*sizeof(uint32_t *)); + pdsch_dmrs[slot][symb] = (uint32_t **)malloc16(nb_codewords*sizeof(uint32_t *)); AssertFatal(pdsch_dmrs[slot][symb]!=NULL, "NR init: pdsch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); - for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) { - pdsch_dmrs[slot][symb][q] = (uint32_t *)malloc16(NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + for (int q=0; q<nb_codewords; q++) { + pdsch_dmrs[slot][symb][q] = (uint32_t *)malloc16(pdsch_dmrs_init_length*sizeof(uint32_t)); AssertFatal(pdsch_dmrs[slot][symb][q]!=NULL, "NR init: pdsch_dmrs for slot %d symbol %d codeword %d - malloc failed\n", slot, symb, q); } } @@ -343,6 +328,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) srs_vars[gNB_id]->active = false; ue->nr_srs_info = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t)); + ue->nr_srs_info->sc_list = (uint16_t *) malloc16_clear(6*fp->N_RB_UL*sizeof(uint16_t)); ue->nr_srs_info->srs_generated_signal = (int32_t *) malloc16_clear( (2*(fp->samples_per_frame)+2048)*sizeof(int32_t) ); ue->nr_srs_info->noise_power = (uint32_t*)malloc16_clear(sizeof(uint32_t)); ue->nr_srs_info->srs_received_signal = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); @@ -441,29 +427,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) } } - // PBCH - pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); - pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); - pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); - pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); - pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); - pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); // + // RACH prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) ); prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) ); - for (i=0; i<fp->nb_antennas_rx; i++) { - pbch_vars[gNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 ); - - for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) { - int idx = (j*fp->nb_antennas_rx)+i; - pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 ); - pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) ); - pbch_vars[gNB_id]->dl_ch_estimates_time[idx]= (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) ); - pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 ); - } - } - - pbch_vars[gNB_id]->decoded_output = (uint8_t *)malloc16_clear(64); } // initialization for the last instance of pdsch_vars (used for MU-MIMO) @@ -498,16 +465,12 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { for (int gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) { - phy_term_nr_ue_PUSCH(ue->pusch_vars[th_id][gNB_id]); - free_and_zero(ue->pusch_vars[th_id][gNB_id]); free_and_zero(ue->pucch_vars[th_id][gNB_id]); } } for (int slot = 0; slot < fp->slots_per_frame; slot++) { for (int symb = 0; symb < fp->symbols_per_slot; symb++) { - for (int q = 0; q < NR_MAX_NB_CODEWORDS; q++) - free_and_zero(ue->nr_gold_pusch_dmrs[slot][symb][q]); free_and_zero(ue->nr_gold_pusch_dmrs[slot][symb]); } free_and_zero(ue->nr_gold_pusch_dmrs[slot]); @@ -541,9 +504,10 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) } free_and_zero(ue->nr_gold_pdcch[0]); + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; for (int slot=0; slot<fp->slots_per_frame; slot++) { for (int symb=0; symb<fp->symbols_per_slot; symb++) { - for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) + for (int q=0; q<nb_codewords; q++) free_and_zero(ue->nr_gold_pdsch[0][slot][symb][q]); free_and_zero(ue->nr_gold_pdsch[0][slot][symb]); } @@ -625,6 +589,7 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) free_and_zero(ue->nr_srs_info->srs_estimated_channel_time[i]); free_and_zero(ue->nr_srs_info->srs_estimated_channel_time_shifted[i]); } + free_and_zero(ue->nr_srs_info->sc_list); free_and_zero(ue->nr_srs_info->srs_generated_signal); free_and_zero(ue->nr_srs_info->noise_power); free_and_zero(ue->nr_srs_info->srs_received_signal); @@ -636,25 +601,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) free_and_zero(ue->srs_vars[gNB_id]); - for (int i = 0; i < fp->nb_antennas_rx; i++) { - free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_ext[i]); - - for (int j = 0; j < 4; j++) { - int idx = (j*fp->nb_antennas_rx)+i; - free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_comp[idx]); - free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates[idx]); - free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_time[idx]); - free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_ext[idx]); - } - } - - free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_ext); - free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_comp); - free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates); - free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_ext); - free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_time); - free_and_zero(ue->pbch_vars[gNB_id]->llr); - free_and_zero(ue->pbch_vars[gNB_id]->decoded_output); free_and_zero(ue->pbch_vars[gNB_id]); free_and_zero(ue->prach_vars[gNB_id]->prachF); @@ -679,7 +625,8 @@ void term_nr_ue_transport(PHY_VARS_NR_UE *ue) for (int j = 0; j < 2; j++) { for (int k = 0; k < RX_NB_TH_MAX; k++) { free_nr_ue_dlsch(&ue->dlsch[k][i][j], N_RB_DL); - free_nr_ue_ulsch(&ue->ulsch[k][i][j], N_RB_DL); + if (j==0) + free_nr_ue_ulsch(&ue->ulsch[k][i], N_RB_DL); } } @@ -690,15 +637,19 @@ void term_nr_ue_transport(PHY_VARS_NR_UE *ue) free_nr_ue_dlsch(&ue->dlsch_MCH[0], N_RB_DL); } -void init_nr_ue_transport(PHY_VARS_NR_UE *ue) -{ +void init_nr_ue_transport(PHY_VARS_NR_UE *ue) { + + int num_codeword = NR_MAX_NB_LAYERS > 4? 2:1; + for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) { - for (int j=0; j<2; j++) { + for (int j=0; j<num_codeword; j++) { for (int k=0; k<RX_NB_TH_MAX; k++) { AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL))!=NULL,"Can't get ue dlsch structures\n"); LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[k][i][j]); - AssertFatal((ue->ulsch[k][i][j] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES))!=NULL,"Can't get ue ulsch structures\n"); - LOG_D(PHY,"ulsch[%d][%d][%d] => %p\n",k,i,j,ue->ulsch[k][i][j]); + if (j==0) { + AssertFatal((ue->ulsch[k][i] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES))!=NULL,"Can't get ue ulsch structures\n"); + LOG_D(PHY,"ulsch[%d][%d] => %p\n",k,i,ue->ulsch[k][i]); + } } } diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index 35bc28d9c111f67aada20fa34a9984b65b04d2af..757a8d965f982119751d6fcd61ce337944dd6cfa 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -253,7 +253,6 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp); - if (Ncp == NFAPI_CP_EXTENDED) AssertFatal(mu == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, mu); diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index fd3c1d394d34430ac5e30516cd8a036eb2c3cb43..a1ebc85d6fe5e9f470d8067eb9984b17b3a74d8f 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -320,98 +320,16 @@ void nr_layer_mapping(int16_t **mod_symbs, } } -void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, +void nr_ue_layer_mapping(int16_t *mod_symbs, uint8_t n_layers, uint16_t n_symbs, - int16_t **tx_layers) -{ - int16_t *mod_symbs; - - switch (n_layers) { - - case 1: - mod_symbs = (int16_t *)ulsch_ue[0]->d_mod; - for (int i=0; i<n_symbs; i++) { - tx_layers[0][i<<1] = (mod_symbs[i<<1]*AMP)>>15; - tx_layers[0][(i<<1)+1] = (mod_symbs[(i<<1)+1]*AMP)>>15; - } - break; - - case 2: - case 3: - case 4: - mod_symbs = (int16_t *)ulsch_ue[0]->d_mod; - - for (int i=0; i<n_symbs/n_layers; i++) { - for (int l=0; l<n_layers; l++) { - tx_layers[l][i<<1] = (mod_symbs[(n_layers*i+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[((n_layers*i+l)<<1)+1]*AMP)>>15; - } - } - break; - - case 5: - mod_symbs = (int16_t *)ulsch_ue[0]->d_mod; - - for (int i=0; i<n_symbs>>1; i++) - for (int l=0; l<2; l++) { - tx_layers[l][i<<1] = (mod_symbs[((i<<1)+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<1)+l)<<1)+1]*AMP)>>15; - } - - mod_symbs = (int16_t *)ulsch_ue[1]->d_mod; - - for (int i=0; i<n_symbs/3; i++) - for (int l=2; l<5; l++) { - tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15; - } - break; - - case 6: - for (int q=0; q<2; q++) { - mod_symbs = (int16_t *)ulsch_ue[q]->d_mod; + int16_t **tx_layers) { - for (int i=0; i<n_symbs/3; i++) - for (int l=0; l<3; l++) { - tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15; - } - } - break; - - case 7: - mod_symbs = (int16_t *)ulsch_ue[1]->d_mod; - - for (int i=0; i<n_symbs/3; i++) - for (int l=0; l<3; l++) { - tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15; - } - - mod_symbs = (int16_t *)ulsch_ue[0]->d_mod; - - for (int i=0; i<n_symbs/4; i++) - for (int l=3; l<7; l++) { - tx_layers[l][i<<1] = (mod_symbs[((i<<2)+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<2)+l)<<1)+1]*AMP)>>15; - } - break; - - case 8: - for (int q=0; q<2; q++) { - mod_symbs = (int16_t *)ulsch_ue[q]->d_mod; - - for (int i=0; i<n_symbs>>2; i++) - for (int l=0; l<3; l++) { - tx_layers[l][i<<1] = (mod_symbs[((i<<2)+l)<<1]*AMP)>>15; - tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<2)+l)<<1)+1]*AMP)>>15; - } - } - break; - - default: - AssertFatal(0, "Invalid number of layers %d\n", n_layers); + for (int i=0; i<n_symbs/n_layers; i++) { + for (int l=0; l<n_layers; l++) { + tx_layers[l][i<<1] = (mod_symbs[(n_layers*i+l)<<1]*AMP)>>15; + tx_layers[l][(i<<1)+1] = (mod_symbs[((n_layers*i+l)<<1)+1]*AMP)>>15; + } } } diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index 75541a13615ce851db32f45e127c7285e5db971b..db15e3d9efc5fac5b145e82d5bca19e6735a61a1 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -66,7 +66,7 @@ void nr_layer_mapping(int16_t **mod_symbs, @param[out] tx_layers, modulated symbols for each layer */ -void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, +void nr_ue_layer_mapping(int16_t *mod_symbs, uint8_t n_layers, uint16_t n_symbs, int16_t **tx_layers); diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c index cfb5a2e56ebb799de3d119e54a12714cb51b18bb..f4761489f578f7828c89ea0405b9eb78cfd680a8 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c +++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c @@ -184,7 +184,7 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq PHY_MEASUREMENTS_gNB *meas = &gNB->measurements; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; int ch_offset = fp->ofdm_symbol_size * symbol; - int N_RB_UL = gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu.rb_size; + int N_RB_UL = gNB->ulsch[ulsch_id]->harq_processes[harq_pid]->ulsch_pdu.rb_size; rx_power_tot[ulsch_id] = 0; diff --git a/openair1/PHY/NR_REFSIG/nr_gold.c b/openair1/PHY/NR_REFSIG/nr_gold.c index 7930839832a123d983c8cbfa429a97554844eeb6..b593dcbb477506d7a547e51eb4c65747e676fa2e 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold.c +++ b/openair1/PHY/NR_REFSIG/nr_gold.c @@ -60,6 +60,7 @@ void nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid) uint8_t reset; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs; + int pdcch_dmrs_init_length = (((fp->N_RB_DL<<1)*3)>>5)+1; for (uint8_t slot=0; slot<fp->slots_per_frame; slot++) { for (uint8_t symb=0; symb<fp->symbols_per_slot; symb++) { @@ -67,7 +68,7 @@ void nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid) reset = 1; x2 = ((1<<17) * (fp->symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid<<1)); LOG_D(PHY,"PDCCH DMRS slot %d, symb %d, Nid %d, x2 %x\n",slot,symb,Nid,x2); - for (uint32_t n=0; n<NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD; n++) { + for (uint32_t n=0; n<pdcch_dmrs_init_length; n++) { pdcch_dmrs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } @@ -81,11 +82,12 @@ void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid) { uint32_t x1, x2; - uint8_t reset, q; + uint8_t reset; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs; - - uint16_t N_n_scid[NR_MAX_NB_CODEWORDS]={Nid, Nid}; // Not correct, appropriate scrambling IDs have to be updated to support DCI 1_1 + int pdsch_dmrs_init_length = ((fp->N_RB_DL*12)>>5)+1; + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; + uint16_t N_n_scid[2]={Nid, Nid}; uint8_t n_scid=0; // again works only for 1_0 for (uint8_t slot=0; slot<fp->slots_per_frame; slot++) { @@ -93,13 +95,13 @@ void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid) reset = 1; x2 = ((1<<17) * (fp->symbols_per_slot*slot+symb+1) * ((N_n_scid[n_scid]<<1)+1) +((N_n_scid[n_scid]<<1)+n_scid)); LOG_D(PHY,"PDSCH DMRS slot %d, symb %d x2 %x, N_n_scid %d,n_scid %d\n",slot,symb,x2,N_n_scid[n_scid],n_scid); - for (uint32_t n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) { + for (uint32_t n=0; n<pdsch_dmrs_init_length; n++) { pdsch_dmrs[slot][symb][0][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } - for (q = 1; q < NR_MAX_NB_CODEWORDS; q++) - memcpy(pdsch_dmrs[slot][symb][q],pdsch_dmrs[slot][symb][0],sizeof(uint32_t)*NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD); + if(nb_codewords>1) + memcpy(pdsch_dmrs[slot][symb][1],pdsch_dmrs[slot][symb][0],sizeof(uint32_t)*pdsch_dmrs_init_length); } } } @@ -113,6 +115,7 @@ void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid) { unsigned int nid; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; unsigned short l; + int pusch_dmrs_init_length = ((fp->N_RB_UL*12)>>5)+1; for (nscid=0; nscid<2; nscid++) { nid = Nid[nscid]; @@ -122,7 +125,7 @@ void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid) { x2 = ((1<<17) * (fp->symbols_per_slot*ns+l+1) * ((nid<<1)+1) +((nid<<1)+nscid)); LOG_D(PHY,"DMRS slot %d, symb %d x2 %x\n",ns,l,x2); - for (n=0; n<NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD; n++) { + for (n=0; n<pusch_dmrs_init_length; n++) { gNB->nr_gold_pusch_dmrs[nscid][ns][l][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } @@ -138,6 +141,7 @@ void nr_init_csi_rs(PHY_VARS_gNB* gNB, uint32_t Nid) uint32_t ***csi_rs = gNB->nr_gold_csi_rs; uint32_t x1, x2; uint8_t reset; + int csi_dmrs_init_length = ((fp->N_RB_DL<<4)>>5)+1; for (uint8_t slot=0; slot<fp->slots_per_frame; slot++) { for (uint8_t symb=0; symb<fp->symbols_per_slot; symb++) { @@ -145,7 +149,7 @@ void nr_init_csi_rs(PHY_VARS_gNB* gNB, uint32_t Nid) reset = 1; x2 = ((1<<10) * (fp->symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid)); - for (uint32_t n=0; n<NR_MAX_CSI_RS_INIT_LENGTH_DWORD; n++) { + for (uint32_t n=0; n<csi_dmrs_init_length; n++) { csi_rs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } diff --git a/openair1/PHY/NR_REFSIG/nr_gold_ue.c b/openair1/PHY/NR_REFSIG/nr_gold_ue.c index 623b86edfbb5dde7a5d7c1b392da6f971e47d4be..932cdba538a2d8c34f7d1a42ce64aaa5a94ecffe 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold_ue.c +++ b/openair1/PHY/NR_REFSIG/nr_gold_ue.c @@ -57,6 +57,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, unsigned char ns,l; unsigned int n,x1,x2,x2tmp0; uint8_t reset; + int pdcch_dmrs_init_length = (((ue->frame_parms.N_RB_DL<<1)*3)>>5)+1; for (ns=0; ns<ue->frame_parms.slots_per_frame; ns++) { @@ -64,9 +65,9 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, reset = 1; x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; - x2 = (x2tmp0+(nid<<1))%(1<<31); //cinit + x2 = (x2tmp0+(nid<<1))%(1U<<31); //cinit - for (n=0; n<NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD; n++) { + for (n=0; n<pdcch_dmrs_init_length; n++) { ue->nr_gold_pdcch[0][ns][l][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } @@ -77,28 +78,28 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, void nr_gold_pdsch(PHY_VARS_NR_UE* ue, unsigned short *n_idDMRS) { - unsigned char l; - unsigned int n,x1,x2,x2tmp0,ns; - int nscid; + + unsigned int x1,x2,x2tmp0; unsigned int nid; uint8_t reset; - + int pdsch_dmrs_init_length = ((ue->frame_parms.N_RB_DL*12)>>5)+1; + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; /// to be updated from higher layer //unsigned short lbar = 0; - for (nscid=0; nscid<2; nscid++) { - for (ns=0; ns<ue->frame_parms.slots_per_frame; ns++) { + for (int nscid=0; nscid<nb_codewords; nscid++) { + for (int ns=0; ns<ue->frame_parms.slots_per_frame; ns++) { nid = n_idDMRS[nscid]; - for (l=0; l<ue->frame_parms.symbols_per_slot; l++) { + for (int l=0; l<ue->frame_parms.symbols_per_slot; l++) { reset = 1; x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; - x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit + x2 = (x2tmp0+(nid<<1)+nscid)%(1U<<31); //cinit LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid); - for (n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) { + for (int n=0; n<pdsch_dmrs_init_length; n++) { ue->nr_gold_pdsch[0][ns][l][nscid][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } @@ -112,9 +113,10 @@ void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue, uint8_t n_scid) { uint32_t x1, x2, n; - uint8_t reset, slot, symb, q; + uint8_t reset, slot, symb; NR_DL_FRAME_PARMS *fp = &ue->frame_parms; - uint32_t ****pusch_dmrs = ue->nr_gold_pusch_dmrs; + uint32_t ***pusch_dmrs = ue->nr_gold_pusch_dmrs; + int pusch_dmrs_init_length = ((fp->N_RB_UL*12)>>5)+1; for (slot=0; slot<fp->slots_per_frame; slot++) { @@ -123,13 +125,10 @@ void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue, reset = 1; x2 = ((1<<17) * (fp->symbols_per_slot*slot+symb+1) * ((N_n_scid[n_scid]<<1)+1) +((N_n_scid[n_scid]<<1)+n_scid)); - for (n=0; n<NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD; n++) { - pusch_dmrs[slot][symb][0][n] = lte_gold_generic(&x1, &x2, reset); + for (n=0; n<pusch_dmrs_init_length; n++) { + pusch_dmrs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } - - for (q = 1; q < NR_MAX_NB_CODEWORDS; q++) - memcpy(pusch_dmrs[slot][symb][q],pusch_dmrs[slot][symb][0],sizeof(uint32_t)*NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD); } } } diff --git a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c index 4f5baacc34e0fc1c8af47aeff418882a5132ea96..b530dcf4823b012e82927da75b81ffff633a599b 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c +++ b/openair1/PHY/NR_TRANSPORT/nr_csi_rs.c @@ -37,7 +37,9 @@ void nr_generate_csi_rs(PHY_VARS_gNB *gNB, int32_t **txdataF = gNB->common_vars.txdataF; int txdataF_offset = slot*frame_parms.samples_per_slot_wCP; uint32_t **gold_csi_rs = gNB->nr_gold_csi_rs[slot]; - int16_t mod_csi[frame_parms.symbols_per_slot][NR_MAX_CSI_RS_LENGTH>>1] __attribute__((aligned(16)));; + //*8(max allocation per RB)*2(QPSK)) + int csi_rs_length = frame_parms.N_RB_DL<<4; + int16_t mod_csi[frame_parms.symbols_per_slot][csi_rs_length>>1] __attribute__((aligned(16)));; uint16_t b = csi_params.freq_domain; uint16_t n, csi_bw, csi_start, p, k, l, mprime, na, kpn, csi_length; uint8_t size, ports, kprime, lprime, i, gs; @@ -59,7 +61,7 @@ void nr_generate_csi_rs(PHY_VARS_gNB *gNB, for (uint8_t symb=0; symb<frame_parms.symbols_per_slot; symb++) { reset = 1; x2 = ((1<<10) * (frame_parms.symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid)); - for (uint32_t n=0; n<NR_MAX_CSI_RS_INIT_LENGTH_DWORD; n++) { + for (uint32_t n=0; n<(csi_rs_length>>5)+1; n++) { gold_csi_rs[symb][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index c5ff2c9f2d9cf128271ee0adad66f6a3e4a9ebe0..e0c445d3852eb2cb709e0f83b9d8a2d3c25bf6d9 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -79,10 +79,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15; - uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5]; int16_t **mod_symbs = (int16_t**)dlsch->mod_symbs; int16_t **tx_layers = (int16_t**)dlsch->txdataF; - int16_t **txdataF_precoding = (int16_t**)dlsch->txdataF_precoding; int8_t Wf[2], Wt[2], l0, l_prime, l_overline, delta; uint8_t dmrs_Type = rel15->dmrsConfigType; int nb_re_dmrs; @@ -100,6 +98,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, uint16_t nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs*dmrs_len-xOverhead)*rel15->rbSize*rel15->nrOfLayers; uint8_t Qm = rel15->qamModOrder[0]; uint32_t encoded_length = nb_re*Qm; + uint32_t scrambled_output[rel15->NrOfCodewords][(encoded_length>>5)+1]; int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16))); /* PTRS */ @@ -121,8 +120,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, /// CRC, coding, interleaving and rate matching AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n"); - unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS] __attribute__((aligned(32))); - bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS); + unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers] __attribute__((aligned(32))); + bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * Qm * rel15->nrOfLayers); start_meas(dlsch_encoding_stats); if (nr_dlsch_encoding(gNB, @@ -147,20 +146,18 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, } printf("\n"); #endif - - - + /// scrambling start_meas(dlsch_scrambling_stats); - for (int q=0; q<rel15->NrOfCodewords; q++) - memset((void*)scrambled_output[q], 0, (encoded_length>>5)*sizeof(uint32_t)); - for (int q=0; q<rel15->NrOfCodewords; q++) + for (int q=0; q<rel15->NrOfCodewords; q++) { + memset((void*)scrambled_output[q], 0, ((encoded_length>>5)+1)*sizeof(uint32_t)); nr_pdsch_codeword_scrambling(output, encoded_length, q, rel15->dataScramblingId, rel15->rnti, scrambled_output[q]); + } stop_meas(dlsch_scrambling_stats); #ifdef DEBUG_DLSCH @@ -219,6 +216,9 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, start_sc -= frame_parms->ofdm_symbol_size; int txdataF_offset = slot*frame_parms->samples_per_slot_wCP; + int16_t **txdataF_precoding = (int16_t **)malloc16(rel15->nrOfLayers*sizeof(int16_t *)); + for (int layer = 0; layer<rel15->nrOfLayers; layer++) + txdataF_precoding[layer] = (int16_t *)malloc16(2*14*frame_parms->ofdm_symbol_size*sizeof(int16_t)); #ifdef DEBUG_DLSCH_MAPPING printf("PDSCH resource mapping started (start SC %d\tstart symbol %d\tN_PRB %d\tnb_re %d,nb_layers %d)\n", @@ -295,7 +295,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ptrs_symbol = is_ptrs_symbol(l,dlPtrsSymPos); if(ptrs_symbol) { /* PTRS QPSK Modulation for each OFDM symbol in a slot */ - printf("Doing ptrs modulation for symbol %d, n_ptrs %d\n",l,n_ptrs); + LOG_D(PHY,"Doing ptrs modulation for symbol %d, n_ptrs %d\n",l,n_ptrs); nr_modulation(pdsch_dmrs[l][0], (n_ptrs<<1), DMRS_MOD_ORDER, mod_ptrs); } } @@ -555,6 +555,9 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, else { LOG_D(PHY,"beam index for PDSCH allocation already taken\n"); } + for (int layer = 0; layer<rel15->nrOfLayers; layer++) + free16(txdataF_precoding[layer],2*14*frame_parms->ofdm_symbol_size); + free16(txdataF_precoding,rel15->nrOfLayers); }// dlsch loop } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h index 77db12672f33952564a0c791fdb09d4a40221b40..28676b49f26ae9f51bbf2e720c6c9f39e56825f5 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h @@ -68,7 +68,6 @@ void nr_fill_dlsch(processingData_L1tx_t *msgTx, void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot); -void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB); void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index cdf0e6c1527b0afbc354a37c261a84e9ac4fc2e4..229f59032e0aaebb90ad5d8aec7a711310f36a45 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -50,10 +50,14 @@ //#define DEBUG_DLSCH_FREE 1 -void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) { - int r; +void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, + uint16_t N_RB, + const NR_DL_FRAME_PARMS* frame_parms) { + NR_gNB_DLSCH_t *dlsch = *dlschptr; - uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated + + int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS; + uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers; if (N_RB != 273) { a_segments = a_segments*N_RB; @@ -65,26 +69,30 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) { free16(harq->b, a_segments * 1056); harq->b = NULL; } - for (r = 0; r < a_segments; r++) { + for (int r = 0; r < a_segments; r++) { free(harq->c[r]); harq->c[r] = NULL; } + free(harq->c); free(harq->pdu); for (int aa = 0; aa < 64; aa++) free(dlsch->calib_dl_ch_estimates[aa]); free(dlsch->calib_dl_ch_estimates); - for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; + for (int q=0; q<nb_codewords; q++) free(dlsch->mod_symbs[q]); + free(dlsch->mod_symbs); - for (int layer = 0; layer < NR_MAX_NB_LAYERS; layer++) { - free(dlsch->txdataF_precoding[layer]); + for (int layer = 0; layer < max_layers; layer++) { free(dlsch->txdataF[layer]); for (int aa = 0; aa < 64; aa++) free(dlsch->ue_spec_bf_weights[layer][aa]); free(dlsch->ue_spec_bf_weights[layer]); } + free(dlsch->txdataF); + free(dlsch->ue_spec_bf_weights); free(dlsch); *dlschptr = NULL; @@ -96,9 +104,9 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint32_t Nsoft, uint8_t abstraction_flag, uint16_t N_RB) { - unsigned char i,r,aa,layer; - int re; - uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated + + int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS; + uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated if (N_RB != 273) { a_segments = a_segments*N_RB; @@ -114,31 +122,36 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, dlsch->Mlimit = 4; dlsch->Nsoft = Nsoft; - for (layer=0; layer<NR_MAX_NB_LAYERS; layer++) { + int txdataf_size = frame_parms->N_RB_DL*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8; // max pdsch encoded length for each layer + + dlsch->txdataF = (int32_t **)malloc16(max_layers*sizeof(int32_t *)); + + dlsch->ue_spec_bf_weights = (int32_t ***)malloc16(max_layers*sizeof(int32_t **)); + for (int layer=0; layer<max_layers; layer++) { dlsch->ue_spec_bf_weights[layer] = (int32_t **)malloc16(64*sizeof(int32_t *)); - for (aa=0; aa<64; aa++) { + for (int aa=0; aa<64; aa++) { dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); - for (re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) { + for (int re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) { dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff; } } - - dlsch->txdataF[layer] = (int32_t *)malloc16((NR_MAX_PDSCH_ENCODED_LENGTH/NR_MAX_NB_LAYERS)*sizeof(int32_t)); // NR_MAX_NB_LAYERS is already included in NR_MAX_PDSCH_ENCODED_LENGTH - dlsch->txdataF_precoding[layer] = (int32_t *)malloc16(2*14*frame_parms->ofdm_symbol_size*sizeof(int32_t)); + dlsch->txdataF[layer] = (int32_t *)malloc16((txdataf_size)*sizeof(int32_t)); } - for (int q=0; q<NR_MAX_NB_CODEWORDS; q++) - dlsch->mod_symbs[q] = (int32_t *)malloc16(NR_MAX_PDSCH_ENCODED_LENGTH*sizeof(int32_t)); + int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; + dlsch->mod_symbs = (int32_t **)malloc16(nb_codewords*sizeof(int32_t *)); + for (int q=0; q<nb_codewords; q++) + dlsch->mod_symbs[q] = (int32_t *)malloc16(txdataf_size*max_layers*sizeof(int32_t)); dlsch->calib_dl_ch_estimates = (int32_t **)malloc16(64*sizeof(int32_t *)); - for (aa=0; aa<64; aa++) { + for (int aa=0; aa<64; aa++) { dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); } - for (i=0; i<20; i++) { + for (int i=0; i<20; i++) { dlsch->harq_ids[0][i] = 0; dlsch->harq_ids[1][i] = 0; } @@ -153,7 +166,8 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, nr_emulate_dlsch_payload(harq->pdu, (dlsch_bytes) >> 3); bzero(harq->b, dlsch_bytes); - for (r = 0; r < a_segments; r++) { + harq->c = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *)); + for (int r = 0; r < a_segments; r++) { // account for filler in first segment and CRCs for multiple segment case // [hna] 8448 is the maximum CB size in NR // 68*348 = 68*(maximum size of Zc) @@ -316,6 +330,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, stats->current_Qm = rel15->qamModOrder[0]; } + int max_bytes = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*rel15->nrOfLayers*1056; if (A > 3824) { // Add 24-bit crc (polynomial A) to payload crc = crc24a(a,A)>>8; @@ -326,11 +341,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, //printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]); harq->B = A+24; // harq->b = a; - AssertFatal((A / 8) + 4 <= MAX_NR_DLSCH_PAYLOAD_BYTES, + AssertFatal((A / 8) + 4 <= max_bytes, "A %d is too big (A/8+4 = %d > %d)\n", A, (A / 8) + 4, - MAX_NR_DLSCH_PAYLOAD_BYTES); + max_bytes); memcpy(harq->b, a, (A / 8) + 4); // why is this +4 if the CRC is only 3 bytes? } else { // Add 16-bit crc (polynomial A) to payload @@ -341,11 +356,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, //printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]); harq->B = A+16; // harq->b = a; - AssertFatal((A / 8) + 3 <= MAX_NR_DLSCH_PAYLOAD_BYTES, + AssertFatal((A / 8) + 3 <= max_bytes, "A %d is too big (A/8+3 = %d > %d)\n", A, (A / 8) + 3, - MAX_NR_DLSCH_PAYLOAD_BYTES); + max_bytes); memcpy(harq->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc } @@ -363,6 +378,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, impp.Kb = nr_segmentation(harq->b, harq->c, harq->B, &impp.n_segments, &impp.K, impp.Zc, &impp.F, impp.BG); stop_meas(dlsch_segmentation_stats); + if (impp.n_segments>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*rel15->nrOfLayers) { + LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",impp.n_segments,harq->B); + return(-1); + } + for (int r=0; r<impp.n_segments; r++) { //d_tmp[r] = &harq->d[r][0]; //channel_input[r] = &harq->d[r][0]; diff --git a/openair1/PHY/NR_TRANSPORT/nr_scrambling.c b/openair1/PHY/NR_TRANSPORT/nr_scrambling.c index b68ad2d89f9b86259bc613ba9fb315af140424f8..4bbecfd994d4ffd0dd180a5634d87f15084fd460 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_scrambling.c +++ b/openair1/PHY/NR_TRANSPORT/nr_scrambling.c @@ -40,7 +40,7 @@ void nr_codeword_scrambling(uint8_t *in, __m256i c = ((__m256i*)in)[i]; uint32_t in32 = _mm256_movemask_epi8(_mm256_slli_epi16(c,7)); out[i]=(in32^s); - //printf("in[%d] %x => %x\n",i,in32,out[i]); + LOG_D(PHY,"in[%d] %x => %x\n",i,in32,out[i]); s=lte_gold_generic(&x1, &x2, 0); } #elif defined(__SSE4__) diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h index b62698c74844193d549ca0c69569b3b3fd69f98e..f9478b7633282abe3f14926387be019b4d586f08 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h @@ -106,7 +106,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint8_t abstraction_flag, uint16_t N_RB); -void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB); +void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB, const NR_DL_FRAME_PARMS* frame_parms); /** \brief This function is the top-level entry point to PUSCH demodulation, after frequency-domain transformation and channel estimation. It performs - RB extraction (signal and channel estimates) @@ -146,7 +146,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, void nr_ulsch_scale_channel(int32_t **ul_ch_estimates_ext, NR_DL_FRAME_PARMS *frame_parms, - NR_gNB_ULSCH_t **ulsch_gNB, + NR_gNB_ULSCH_t *ulsch_gNB, uint8_t symbol, uint8_t start_symbol, uint16_t nb_rb, diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c index 1cb503489bbdcf28d10c1c07e34662e9f3537930..3e3137739e2d620339619ab17414cf2a17b05a35 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c @@ -42,15 +42,14 @@ int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) { AssertFatal(gNB!=NULL,"gNB is null\n"); for (i=0; i<gNB->number_of_nr_ulsch_max; i++) { AssertFatal(gNB->ulsch[i]!=NULL,"gNB->ulsch[%d] is null\n",i); - AssertFatal(gNB->ulsch[i][0]!=NULL,"gNB->ulsch[%d][0] is null\n",i); - LOG_D(PHY,"searching for rnti %x : ulsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,gNB->ulsch[i][0]->harq_mask,gNB->ulsch[i][0]->rnti,first_free_index); - if ((gNB->ulsch[i][0]->harq_mask >0) && - (gNB->ulsch[i][0]->rnti==rnti)) return i; - else if ((gNB->ulsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; + LOG_D(PHY,"searching for rnti %x : ulsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,gNB->ulsch[i]->harq_mask,gNB->ulsch[i]->rnti,first_free_index); + if ((gNB->ulsch[i]->harq_mask >0) && + (gNB->ulsch[i]->rnti==rnti)) return i; + else if ((gNB->ulsch[i]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; } if (type == SEARCH_EXIST) return -1; if (first_free_index != -1) - gNB->ulsch[first_free_index][0]->rnti = 0; + gNB->ulsch[first_free_index]->rnti = 0; return first_free_index; } @@ -64,7 +63,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, AssertFatal( (ulsch_id>=0) && (ulsch_id<gNB->number_of_nr_ulsch_max), "illegal or no ulsch_id found!!! rnti %04x ulsch_id %d\n",ulsch_pdu->rnti,ulsch_id); - NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ulsch_id][0]; + NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ulsch_id]; int harq_pid = ulsch_pdu->pusch_data.harq_process_id; ulsch->rnti = ulsch_pdu->rnti; //ulsch->rnti_type; diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index e9ed278bb1ec0aacfc9a0968d681ccb51c901111..49c1b898cc7372c8a7eb94a0b4dfac9b7b616966 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -175,7 +175,7 @@ void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch) //t_nrLDPC_procBuf* p_nrLDPC_procBuf[MAX_NUM_NR_ULSCH_SEGMENTS]; ulsch->harq_processes[i]->Z=0; /// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1) - //int16_t e[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448]; + //int16_t e[MAX_NUM_NR_ULSCH_SEGMENTS][3*8448]; ulsch->harq_processes[i]->E=0; @@ -406,7 +406,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, #endif - NR_gNB_ULSCH_t *ulsch = phy_vars_gNB->ulsch[ULSCH_id][0]; + NR_gNB_ULSCH_t *ulsch = phy_vars_gNB->ulsch[ULSCH_id]; NR_gNB_PUSCH *pusch = phy_vars_gNB->pusch_vars[ULSCH_id]; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid]; @@ -532,6 +532,12 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, &harq_process->F, p_decParams->BG); + if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*n_layers) { + LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B); + return(-1); + } + + #ifdef DEBUG_ULSCH_DECODING printf("ulsch decoding nr segmentation Z %d\n", harq_process->Z); if (!frame%100) diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index e53b930bbbee80085daeed5aef35c77e0fde9ac1..355830c07829b8f0b49f853d51c0b04ee71ddcf9 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -403,7 +403,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, NR_DL_FRAME_PARMS *frame_parms, - NR_gNB_ULSCH_t **ulsch_gNB, + NR_gNB_ULSCH_t *ulsch_gNB, uint8_t symbol, uint8_t is_dmrs_symbol, unsigned short nb_rb, @@ -418,7 +418,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, // Determine scaling amplitude based the symbol - ch_amp = 1024*8; //((pilots) ? (ulsch_gNB[0]->sqrt_rho_b) : (ulsch_gNB[0]->sqrt_rho_a)); + ch_amp = 1024*8; //((pilots) ? (ulsch_gNB->sqrt_rho_b) : (ulsch_gNB->sqrt_rho_a)); LOG_D(PHY,"Scaling PUSCH Chest in OFDM symbol %d by %d, pilots %d nb_rb %d NCP %d symbol %d\n", symbol, ch_amp, is_dmrs_symbol, nb_rb, frame_parms->Ncp, symbol); // printf("Scaling PUSCH Chest in OFDM symbol %d by %d\n",symbol_mod,ch_amp); @@ -1177,7 +1177,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, int avgs = 0; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; - nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu; + nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id]->harq_processes[harq_pid]->ulsch_pdu; int avg[frame_parms->nb_antennas_rx*rel15_ul->nrOfLayers]; gNB->pusch_vars[ulsch_id]->dmrs_symbol = INVALID_VALUE; diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index b85dbd1454f7b29a494e63af23199eda1fca279a..50c3b62f5023931ad28924a9f96d96bfcf9c80e7 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -457,7 +457,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_list[1].harq_value = !(index&0x01); uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01); - LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d (0 pass, 1 fail) and %d with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", + LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d and %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n", frame,slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,gNB->ulsch_stats[0].sync_pos); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c index 15f3abad795b143de81a9a01888e2e3d6a2a0ee7..f4f183793f97675d6ec2727403fef56b3489a551 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c @@ -36,6 +36,7 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, PHY_VARS_NR_UE *ue, module_id_t gNB_id, + const int estimateSz, struct complex16 dl_ch_estimates_time[][estimateSz], uint8_t frame, uint8_t subframe, unsigned char clear, @@ -60,8 +61,8 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, int j = (i < 0) ? (i + frame_parms->ofdm_symbol_size) : i; for (int aa = 0; aa < frame_parms->nb_antennas_rx; aa++) { - int Re = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[(j<<1)]; - int Im = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[1+(j<<1)]; + int Re = dl_ch_estimates_time[aa][j].r; + int Im = dl_ch_estimates_time[aa][j].i; temp += (Re*Re/2) + (Im*Im/2); } diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 8bc877239ca8a190e55e0a019d133b95abae1813..4c3b9138b259da6bbbc7534e93e978e5d172d864 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -29,6 +29,7 @@ #include "PHY/NR_REFSIG/ptrs_nr.h" #include "PHY/NR_TRANSPORT/nr_sch_dmrs.h" #include "filt16a_32.h" +#include <openair1/PHY/TOOLS/phy_scope_interface.h> //#define DEBUG_PDSCH //#define DEBUG_PDCCH @@ -44,7 +45,6 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, NR_UE_SSB *current_ssb) { int pilot[200] __attribute__((aligned(16))); - unsigned char aarx; unsigned short k; unsigned int pilot_cnt; int16_t ch[2],*pil,*rxF; @@ -78,7 +78,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, // generate pilot nr_pbch_dmrs_rx(dmrss,ue->nr_gold_pbch[n_hf][ssb_index], &pilot[0]); - for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { + for (int aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { int re_offset = ssb_offset; pil = (int16_t *)&pilot[0]; @@ -198,6 +198,9 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, + int estimateSz, + struct complex16 dl_ch_estimates [][estimateSz], + struct complex16 dl_ch_estimates_time [][estimateSz], UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, unsigned char Ns, @@ -207,16 +210,14 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, uint8_t n_hf) { int pilot[200] __attribute__((aligned(16))); - unsigned char aarx,p; unsigned short k; unsigned int pilot_cnt; - int16_t ch[2],*pil,*rxF,*dl_ch,*fl,*fm,*fr; + int16_t *pil,*rxF,*dl_ch,*fl,*fm,*fr; int ch_offset,symbol_offset; //int slot_pbch; uint8_t nushift; - int **dl_ch_estimates =ue->pbch_vars[gNB_id]->dl_ch_estimates; - int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; + int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; nushift = ue->frame_parms.Nid_cell%4; ue->frame_parms.nushift = nushift; @@ -270,17 +271,57 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, break; } + idft_size_idx_t idftsizeidx; + + switch (ue->frame_parms.ofdm_symbol_size) { + case 128: + idftsizeidx = IDFT_128; + break; + + case 256: + idftsizeidx = IDFT_256; + break; + + case 512: + idftsizeidx = IDFT_512; + break; + + case 1024: + idftsizeidx = IDFT_1024; + break; + + case 1536: + idftsizeidx = IDFT_1536; + break; + + case 2048: + idftsizeidx = IDFT_2048; + break; + + case 3072: + idftsizeidx = IDFT_3072; + break; + + case 4096: + idftsizeidx = IDFT_4096; + break; + + default: + printf("unsupported ofdm symbol size \n"); + assert(0); + } + // generate pilot nr_pbch_dmrs_rx(dmrss,ue->nr_gold_pbch[n_hf][ssb_index], &pilot[0]); - for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { + for (int aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { int re_offset = ssb_offset; pil = (int16_t *)&pilot[0]; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)]; dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset]; - memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size)); + memset(dl_ch,0,sizeof(*dl_ch)*(ue->frame_parms.ofdm_symbol_size)); #ifdef DEBUG_CH printf("pbch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL); @@ -290,6 +331,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, #endif // Treat first 2 pilots specially (left edge) + int16_t ch[2]; ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); @@ -403,62 +445,18 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, } - idft_size_idx_t idftsizeidx; - - switch (ue->frame_parms.ofdm_symbol_size) { - case 128: - idftsizeidx = IDFT_128; - break; - - case 256: - idftsizeidx = IDFT_256; - break; - - case 512: - idftsizeidx = IDFT_512; - break; - - case 1024: - idftsizeidx = IDFT_1024; - break; - - case 1536: - idftsizeidx = IDFT_1536; - break; - - case 2048: - idftsizeidx = IDFT_2048; - break; - - case 3072: - idftsizeidx = IDFT_3072; - break; - - case 4096: - idftsizeidx = IDFT_4096; - break; - - default: - printf("unsupported ofdm symbol size \n"); - assert(0); - } - if( dmrss == 2) // update time statistics for last PBCH symbol { // do ifft of channel estimate - for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) - for (p=0; p<ue->frame_parms.nb_antenna_ports_gNB; p++) { - if (ue->pbch_vars[gNB_id]->dl_ch_estimates[(p*ue->frame_parms.nb_antennas_rx)+aarx]) - { - LOG_D(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d ch_offset %d\n", Ns, proc->thread_id, symbol, ch_offset); - idft(idftsizeidx, - (int16_t*) &ue->pbch_vars[gNB_id]->dl_ch_estimates[(p*ue->frame_parms.nb_antennas_rx)+aarx][ch_offset], - (int16_t*) ue->pbch_vars[gNB_id]->dl_ch_estimates_time[(p*ue->frame_parms.nb_antennas_rx)+aarx],1); - } - } - } - - } + LOG_D(PHY,"Channel Impulse Computation Slot %d Symbol %d ch_offset %d\n", Ns, symbol, ch_offset); + idft(idftsizeidx, + (int16_t*) &dl_ch_estimates[aarx][ch_offset], + (int16_t*) dl_ch_estimates_time[aarx], + 1); +} +} + if (dmrss == 2) + UEscopeCopy(ue, pbchDlChEstimateTime, (void*)dl_ch_estimates_time, sizeof(struct complex16), ue->frame_parms.nb_antennas_rx, idftsizeidx); return(0); } diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h index 4dec92143a10799ac41aa946c3a199dd6fe2b947..aa4b78e1453cef70f784e4f3e7cedd325a076a3a 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h @@ -56,7 +56,10 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, NR_UE_SSB *current_ssb); int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, - UE_nr_rxtx_proc_t *proc, + int estimateSz, + struct complex16 dl_ch_estimates [][estimateSz], + struct complex16 dl_ch_estimates_time [][estimateSz], + UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, unsigned char Ns, unsigned char symbol, @@ -79,6 +82,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, PHY_VARS_NR_UE *ue, module_id_t gNB_id, + int estimateSz, + struct complex16 dl_ch_estimates_time [][estimateSz], uint8_t frame, uint8_t subframe, unsigned char clear, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index a9b8ce2e557c158b0fdc6ec6e44d068a1211201e..54b7c34608511829402c6fab9abbde35ff06add2 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -79,9 +79,11 @@ void init_dlsch_tpool(uint8_t num_dlsch_threads) { free(params); } + void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr, uint16_t N_RB_DL) { - int i,r; - uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated + + uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; + NR_UE_DLSCH_t *dlsch=*dlschptr; if (dlsch) { @@ -90,36 +92,23 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr, uint16_t N_RB_DL) { a_segments = a_segments/273 +1; } - for (i=0; i<dlsch->Mdlharq; i++) { + for (int i=0; i<dlsch->Mdlharq; i++) { if (dlsch->harq_processes[i]) { if (dlsch->harq_processes[i]->b) { free16(dlsch->harq_processes[i]->b,a_segments*1056); dlsch->harq_processes[i]->b = NULL; } - for (r=0; r<a_segments; r++) { + for (int r=0; r<a_segments; r++) { free16(dlsch->harq_processes[i]->c[r],1056); dlsch->harq_processes[i]->c[r] = NULL; + free16(dlsch->harq_processes[i]->d[r],5*8448); + dlsch->harq_processes[i]->d[r] = NULL; + nrLDPC_free_mem(dlsch->harq_processes[i]->p_nrLDPC_procBuf[r]); } - - for (r=0; r<a_segments; r++) - if (dlsch->harq_processes[i]->d[r]) { - free16(dlsch->harq_processes[i]->d[r],(5*8448)*sizeof(short)); - dlsch->harq_processes[i]->d[r] = NULL; - } - - for (r=0; r<a_segments; r++) - if (dlsch->harq_processes[i]->w[r]) { - free16(dlsch->harq_processes[i]->w[r],(5*8448)*sizeof(short)); - dlsch->harq_processes[i]->w[r] = NULL; - } - - for (r=0; r<a_segments; r++) { - if (dlsch->harq_processes[i]->p_nrLDPC_procBuf[r]) { - nrLDPC_free_mem(dlsch->harq_processes[i]->p_nrLDPC_procBuf[r]); - dlsch->harq_processes[i]->p_nrLDPC_procBuf[r] = NULL; - } - } + free16(dlsch->harq_processes[i]->c,a_segments); + free16(dlsch->harq_processes[i]->d,a_segments); + free16(dlsch->harq_processes[i]->p_nrLDPC_procBuf,a_segments); free16(dlsch->harq_processes[i],sizeof(NR_DL_UE_HARQ_t)); dlsch->harq_processes[i] = NULL; @@ -131,10 +120,13 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr, uint16_t N_RB_DL) { } } + NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_ldpc_iterations,uint16_t N_RB_DL) { + NR_UE_DLSCH_t *dlsch; - uint8_t exit_flag = 0,i,r; - uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated + uint8_t exit_flag = 0; + + uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated if (N_RB_DL != 273) { a_segments = a_segments*N_RB_DL; @@ -153,7 +145,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint dlsch->Mlimit = 4; dlsch->max_ldpc_iterations = max_ldpc_iterations; - for (i=0; i<Mdlharq; i++) { + for (int i=0; i<Mdlharq; i++) { dlsch->harq_processes[i] = (NR_DL_UE_HARQ_t *)malloc16(sizeof(NR_DL_UE_HARQ_t)); if (dlsch->harq_processes[i]) { @@ -167,26 +159,17 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint else exit_flag=3; - for (r=0; r<a_segments; r++) { + dlsch->harq_processes[i]->c = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *)); + dlsch->harq_processes[i]->d = (int16_t **)malloc16(a_segments*sizeof(int16_t *)); + dlsch->harq_processes[i]->p_nrLDPC_procBuf = (t_nrLDPC_procBuf **)malloc16(a_segments*sizeof(t_nrLDPC_procBuf *)); + for (int r=0; r<a_segments; r++) { dlsch->harq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem(); dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(1056); - + dlsch->harq_processes[i]->d[r] = (int16_t *)malloc16(5*8448*sizeof(int16_t)); if (dlsch->harq_processes[i]->c[r]) memset(dlsch->harq_processes[i]->c[r],0,1056); - else - exit_flag=2; - - dlsch->harq_processes[i]->d[r] = (short *)malloc16((5*8448)*sizeof(short)); - if (dlsch->harq_processes[i]->d[r]) - memset(dlsch->harq_processes[i]->d[r],0,(5*8448)*sizeof(short)); - else - exit_flag=2; - - dlsch->harq_processes[i]->w[r] = (short *)malloc16((5*8448)*sizeof(short)); - - if (dlsch->harq_processes[i]->w[r]) - memset(dlsch->harq_processes[i]->w[r],0,(5*8448)*sizeof(short)); + memset(dlsch->harq_processes[i]->d[r],0,5*8448); else exit_flag=2; } @@ -320,11 +303,16 @@ void nr_processDLSegment(void* arg) { t_nrLDPC_procBuf **p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf; + + int16_t w[5*8448]; + memset(w,0,(5*8448)*sizeof(short)); + start_meas(&rdata->ts_deinterleave); + //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN); nr_deinterleaving_ldpc(E, Qm, - harq_process->w[r], // [hna] w is e + w, // [hna] w is e dlsch_llr+r_offset); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_OUT); stop_meas(&rdata->ts_deinterleave); @@ -346,7 +334,7 @@ void nr_processDLSegment(void* arg) { p_decoderParms->BG, p_decoderParms->Z, harq_process->d[r], - harq_process->w[r], + w, harq_process->C, harq_process->rvidx, (harq_process->first_rx==1)?1:0, @@ -578,6 +566,11 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, &harq_process->F, p_decParams->BG); + if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*harq_process->Nl) { + LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B); + return(-1); + } + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD) && (!frame%100)) LOG_I(PHY,"K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, p_decParams->Z, harq_process->Nl); } @@ -593,7 +586,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, p_decParams->numMaxIter = dlsch->max_ldpc_iterations; p_decParams->outMode= 0; r_offset = 0; - uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated + uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*harq_process->Nl; //number of segments to be allocated if (nb_rb != 273) { a_segments = a_segments*nb_rb; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index c8d851ca77650698549b089b0fb1427e00dce43d..bbb4a1e03a52196ff1fc98551f1c79a4dfa6c96a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -202,7 +202,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pdsch_vars = ue->pdsch_vars[proc->thread_id]; dlsch = ue->dlsch[proc->thread_id][gNB_id]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; - dlsch1_harq = dlsch[1]->harq_processes[harq_pid]; + if (NR_MAX_NB_LAYERS>4) + dlsch1_harq = dlsch[1]->harq_processes[harq_pid]; beamforming_mode = ue->transmission_mode[gNB_id] < 7 ? 0 :ue->transmission_mode[gNB_id]; break; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index d7b1a030c9966b9c60ce86b07a180c45a29d0637..ac918b4f3e85e0451f235ac29e729917faebd892 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -146,17 +146,23 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini start_meas(&ue->dlsch_channel_estimation_stats); // computing channel estimation for selected best ssb + const int estimateSz=7*2*frame_parms->ofdm_symbol_size; + __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[frame_parms->nb_antennas_rx][estimateSz]; + __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[frame_parms->nb_antennas_rx][estimateSz]; for(int i=pbch_initial_symbol; i<pbch_initial_symbol+3;i++) - nr_pbch_channel_estimation(ue,proc,0,0,i,i-pbch_initial_symbol,temp_ptr->i_ssb,temp_ptr->n_hf); + nr_pbch_channel_estimation(ue,estimateSz, dl_ch_estimates, dl_ch_estimates_time, + proc,0,0,i,i-pbch_initial_symbol,temp_ptr->i_ssb,temp_ptr->n_hf); stop_meas(&ue->dlsch_channel_estimation_stats); - + fapiPbch_t result; ret = nr_rx_pbch(ue, proc, - ue->pbch_vars[0], + estimateSz, dl_ch_estimates, + ue->pbch_vars[0], frame_parms, 0, temp_ptr->i_ssb, - SISO); + SISO, + &result); temp_ptr=temp_ptr->next_ssb; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index 6b5185dc2ce1af902ca5b2e372d9c16caa0301c3..2705132bc6adccc1aa917766c1ef5c9232d429e0 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -36,28 +36,30 @@ #include "PHY/LTE_REFSIG/lte_refsig.h" #include "PHY/INIT/phy_init.h" #include "openair1/SCHED_NR_UE/defs.h" +#include <openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h> +#include <openair1/PHY/TOOLS/phy_scope_interface.h> -//#define DEBUG_PBCH +//#define DEBUG_PBCH //#define DEBUG_PBCH_ENCODING - //#include "PHY_INTERFACE/defs.h" +//#include "PHY_INTERFACE/defs.h" #define PBCH_A 24 - +#define PBCH_MAX_RE_PER_SYMBOL (20*12) +#define PBCH_MAX_RE (PBCH_MAX_RE_PER_SYMBOL*4) #define print_shorts(s,x) printf("%s : %d,%d,%d,%d,%d,%d,%d,%d\n",s,((int16_t*)x)[0],((int16_t*)x)[1],((int16_t*)x)[2],((int16_t*)x)[3],((int16_t*)x)[4],((int16_t*)x)[5],((int16_t*)x)[6],((int16_t*)x)[7]) -uint16_t nr_pbch_extract(int **rxdataF, - int **dl_ch_estimates, - int **rxdataF_ext, - int **dl_ch_estimates_ext, - uint32_t symbol, - uint32_t s_offset, - NR_DL_FRAME_PARMS *frame_parms) { +static uint16_t nr_pbch_extract(int **rxdataF, + const int estimateSz, + struct complex16 dl_ch_estimates[][estimateSz], + struct complex16 rxdataF_ext[][PBCH_MAX_RE_PER_SYMBOL], + struct complex16 dl_ch_estimates_ext[][PBCH_MAX_RE_PER_SYMBOL], + uint32_t symbol, + uint32_t s_offset, + NR_DL_FRAME_PARMS *frame_parms) { uint16_t rb; uint8_t i,j,aarx; - int32_t *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; int nushiftmod4 = frame_parms->nushift; - AssertFatal(symbol>=1 && symbol<5, "symbol %d illegal for PBCH extraction\n", symbol); @@ -65,9 +67,8 @@ uint16_t nr_pbch_extract(int **rxdataF, for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { unsigned int rx_offset = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier; rx_offset = (rx_offset)%(frame_parms->ofdm_symbol_size); - - rxF = &rxdataF[aarx][(symbol+s_offset)*frame_parms->ofdm_symbol_size]; - rxF_ext = &rxdataF_ext[aarx][symbol*20*12]; + struct complex16 *rxF = (struct complex16 *)&rxdataF[aarx][(symbol+s_offset)*frame_parms->ofdm_symbol_size]; + struct complex16 *rxF_ext = rxdataF_ext[aarx]; #ifdef DEBUG_PBCH printf("extract_rbs (nushift %d): rx_offset=%d, symbol %u\n",frame_parms->nushift, (rx_offset + ((symbol+s_offset)*(frame_parms->ofdm_symbol_size))),symbol); @@ -76,7 +77,6 @@ uint16_t nr_pbch_extract(int **rxdataF, for (int i =0; i<8; i++) { printf("rxF [%d]= %d\n",i,rxF[i]); printf("pbch extract rxF %d %d addr %p\n", p[2*i], p[2*i+1], &p[2*i]); - printf("rxF ext addr %p\n", &rxF_ext[i]); } #endif @@ -91,19 +91,18 @@ uint16_t nr_pbch_extract(int **rxdataF, (i!=(nushiftmod4+8))) { rxF_ext[j]=rxF[rx_offset]; #ifdef DEBUG_PBCH - printf("rxF ext[%d] = (%d,%d) rxF [%u]= (%d,%d)\n",(9*rb) + j, - ((int16_t *)&rxF_ext[j])[0], - ((int16_t *)&rxF_ext[j])[1], + printf("rxF ext[%d] = (%d,%d) rxF [%u]= (%d,%d)\n", + (9*rb) + j, + rxF_ext[j].r, rxF_ext[j].i, rx_offset, - ((int16_t *)&rxF[rx_offset])[0], - ((int16_t *)&rxF[rx_offset])[1]); + rxF[rx_offset].r,rxF[rx_offset].j; #endif j++; } rx_offset=(rx_offset+1)%(frame_parms->ofdm_symbol_size); //rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 1) : (rx_offset+1); - } + } rxF_ext+=9; } else { //symbol 2 @@ -115,11 +114,9 @@ uint16_t nr_pbch_extract(int **rxdataF, rxF_ext[j]=rxF[rx_offset]; #ifdef DEBUG_PBCH printf("rxF ext[%d] = (%d,%d) rxF [%u]= (%d,%d)\n",(rb<4) ? (9*rb) + j : (9*(rb-12))+j, - ((int16_t *)&rxF_ext[j])[0], - ((int16_t *)&rxF_ext[j])[1], + rxF_ext[j].r, rxF_ext[j].i, rx_offset, - ((int16_t *)&rxF[rx_offset])[0], - ((int16_t *)&rxF[rx_offset])[1]); + rxF[rx_offset].r,rxF[rx_offset].j; #endif j++; } @@ -129,16 +126,16 @@ uint16_t nr_pbch_extract(int **rxdataF, } rxF_ext+=9; - } else{ //rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 12) : (rx_offset+12); - rx_offset = (rx_offset+12)%(frame_parms->ofdm_symbol_size); - } + } else { //rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 12) : (rx_offset+12); + rx_offset = (rx_offset+12)%(frame_parms->ofdm_symbol_size); + } } } - dl_ch0 = &dl_ch_estimates[aarx][((symbol+s_offset)*(frame_parms->ofdm_symbol_size))]; + struct complex16 *dl_ch0 = &dl_ch_estimates[aarx][((symbol+s_offset)*(frame_parms->ofdm_symbol_size))]; //printf("dl_ch0 addr %p\n",dl_ch0); - dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*20*12]; + struct complex16 *dl_ch0_ext = dl_ch_estimates_ext[aarx]; for (rb=0; rb<20; rb++) { j=0; @@ -150,15 +147,11 @@ uint16_t nr_pbch_extract(int **rxdataF, (i!=(nushiftmod4+8))) { dl_ch0_ext[j]=dl_ch0[i]; #ifdef DEBUG_PBCH - if ((rb==0) && (i<2)) printf("dl ch0 ext[%d] = (%d,%d) dl_ch0 [%d]= (%d,%d)\n",j, - ((int16_t *)&dl_ch0_ext[j])[0], - ((int16_t *)&dl_ch0_ext[j])[1], + dl_ch0_ext[j].r, dl_ch0_ext[j].i, i, - ((int16_t *)&dl_ch0[i])[0], - ((int16_t *)&dl_ch0[i])[1]); - + dl_ch0[j].r, dl_ch0[j].i, #endif j++; } @@ -175,11 +168,9 @@ uint16_t nr_pbch_extract(int **rxdataF, dl_ch0_ext[j]=dl_ch0[i]; #ifdef DEBUG_PBCH printf("dl ch0 ext[%d] = (%d,%d) dl_ch0 [%d]= (%d,%d)\n",j, - ((int16_t *)&dl_ch0_ext[j])[0], - ((int16_t *)&dl_ch0_ext[j])[1], + dl_ch0_ext[j].r, dl_ch0_ext[j].i, i, - ((int16_t *)&dl_ch0[i])[0], - ((int16_t *)&dl_ch0[i])[1]); + dl_ch0[j].r, dl_ch0[j].i, #endif j++; } @@ -199,11 +190,10 @@ uint16_t nr_pbch_extract(int **rxdataF, //__m128i avg128; //compute average channel_level on each (TX,RX) antenna pair -int nr_pbch_channel_level(int **dl_ch_estimates_ext, +int nr_pbch_channel_level(struct complex16 dl_ch_estimates_ext[][PBCH_MAX_RE_PER_SYMBOL], NR_DL_FRAME_PARMS *frame_parms, - uint32_t symbol) { - int16_t rb, nb_rb=20; - uint8_t aarx; + int nb_re) { + int16_t nb_rb=nb_re/12; #if defined(__x86_64__) || defined(__i386__) __m128i avg128; __m128i *dl_ch128; @@ -213,22 +203,23 @@ int nr_pbch_channel_level(int **dl_ch_estimates_ext, #endif int avg1=0,avg2=0; - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { + for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { //clear average level #if defined(__x86_64__) || defined(__i386__) avg128 = _mm_setzero_si128(); - dl_ch128=(__m128i *)&dl_ch_estimates_ext[aarx][symbol*20*12]; + dl_ch128=(__m128i *)dl_ch_estimates_ext[aarx]; #elif defined(__arm__) avg128 = vdupq_n_s32(0); - dl_ch128=(int16x8_t *)&dl_ch_estimates_ext[aarx][symbol*20*12]; + dl_ch128=(int16x8_t *)dl_ch_estimates_ext[aarx]; #endif - for (rb=0; rb<nb_rb; rb++) { + for (int rb=0; rb<nb_rb; rb++) { #if defined(__x86_64__) || defined(__i386__) avg128 = _mm_add_epi32(avg128,_mm_madd_epi16(dl_ch128[0],dl_ch128[0])); avg128 = _mm_add_epi32(avg128,_mm_madd_epi16(dl_ch128[1],dl_ch128[1])); avg128 = _mm_add_epi32(avg128,_mm_madd_epi16(dl_ch128[2],dl_ch128[2])); #elif defined(__arm__) + abort(); // to be filled in #endif dl_ch128+=3; @@ -251,35 +242,19 @@ int nr_pbch_channel_level(int **dl_ch_estimates_ext, //LOG_I(PHY,"Channel level : %d, %d\n",avg1, avg2); } -#if defined(__x86_64__) || defined(__i386__) - _mm_empty(); - _m_empty(); -#endif return(avg2); } -void nr_pbch_channel_compensation(int **rxdataF_ext, - int **dl_ch_estimates_ext, - int **rxdataF_comp, - NR_DL_FRAME_PARMS *frame_parms, - uint32_t symbol, - uint8_t output_shift) { - const uint16_t nb_re=symbol == 2 ? 72 : 180; - AssertFatal((symbol > 0 && symbol < 4), - "symbol %d is illegal for PBCH DM-RS\n", - symbol); - - // printf("comp: symbol %d : nb_re %d\n",symbol,nb_re); - +static void nr_pbch_channel_compensation(struct complex16 rxdataF_ext[][PBCH_MAX_RE_PER_SYMBOL], + struct complex16 dl_ch_estimates_ext[][PBCH_MAX_RE_PER_SYMBOL], + int nb_re, + struct complex16 rxdataF_comp[][PBCH_MAX_RE_PER_SYMBOL], + NR_DL_FRAME_PARMS *frame_parms, + uint8_t output_shift) { for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - vect128 *dl_ch128 = (vect128 *)&dl_ch_estimates_ext[aarx][symbol*20*12]; - vect128 *rxdataF128 = (vect128 *)&rxdataF_ext[aarx][symbol*20*12]; - vect128 *rxdataF_comp128 = (vect128 *)&rxdataF_comp[aarx][symbol*20*12]; - /* - printf("ch compensation dl_ch ext addr %p \n", &dl_ch_estimates_ext[aarx][symbol*20*12]); - printf("rxdataf ext addr %p symbol %d\n", &rxdataF_ext[aarx][symbol*20*12], symbol); - printf("rxdataf_comp addr %p\n",&rxdataF_comp[aarx][symbol*20*12]); - */ + vect128 *dl_ch128 = (vect128 *)dl_ch_estimates_ext[aarx]; + vect128 *rxdataF128 = (vect128 *)rxdataF_ext[aarx]; + vect128 *rxdataF_comp128 = (vect128 *)rxdataF_comp[aarx]; for (int re=0; re<nb_re; re+=12) { *rxdataF_comp128++ = mulByConjugate128(rxdataF128++, dl_ch128++, output_shift); @@ -327,16 +302,18 @@ void nr_pbch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms, } static void nr_pbch_unscrambling(NR_UE_PBCH *pbch, - uint16_t Nid, - uint8_t nushift, - uint16_t M, - uint16_t length, - uint8_t bitwise, - uint32_t unscrambling_mask) { + int16_t *demod_pbch_e, + uint16_t Nid, + uint8_t nushift, + uint16_t M, + uint16_t length, + uint8_t bitwise, + uint32_t unscrambling_mask, + uint32_t pbch_a_prime, + uint32_t *pbch_a_interleaved) { uint8_t reset, offset; uint32_t x1, x2, s=0; uint8_t k=0; - int16_t *demod_pbch_e = pbch->llr; reset = 1; // x1 is set in first call to lte_gold_generic x2 = Nid; //this is c_init @@ -361,10 +338,10 @@ static void nr_pbch_unscrambling(NR_UE_PBCH *pbch, reset = 0; } - (pbch->pbch_a_interleaved) ^= ((unscrambling_mask>>i)&1)? ((pbch->pbch_a_prime>>i)&1)<<i : (((pbch->pbch_a_prime>>i)&1) ^ ((s>>((k+offset)&0x1f))&1))<<i; + *pbch_a_interleaved ^= ((unscrambling_mask>>i)&1)? ((pbch_a_prime>>i)&1)<<i : (((pbch_a_prime>>i)&1) ^ ((s>>((k+offset)&0x1f))&1))<<i; k += (!((unscrambling_mask>>i)&1)); #ifdef DEBUG_PBCH_ENCODING - printf("i %d k %d offset %d (unscrambling_mask>>i)&1) %d s: %08x\t pbch_a_interleaved 0x%08x (!((unscrambling_mask>>i)&1)) %d\n", i, k, offset, (unscrambling_mask>>i)&1, s, pbch->pbch_a_interleaved, + printf("i %d k %d offset %d (unscrambling_mask>>i)&1) %d s: %08x\t pbch_a_interleaved 0x%08x (!((unscrambling_mask>>i)&1)) %d\n", i, k, offset, (unscrambling_mask>>i)&1, s, *pbch_a_interleaved, (!((unscrambling_mask>>i)&1))); #endif } else { @@ -386,18 +363,16 @@ static void nr_pbch_unscrambling(NR_UE_PBCH *pbch, } } -void nr_pbch_quantize(int16_t *pbch_llr8, - int16_t *pbch_llr, - uint16_t len) { - uint16_t i; - - for (i=0; i<len; i++) { +static void nr_pbch_quantize(int16_t *pbch_llr8, + int16_t *pbch_llr, + uint16_t len) { + for (int i=0; i<len; i++) { if (pbch_llr[i]>31) pbch_llr8[i]=32; else if (pbch_llr[i]<-31) pbch_llr8[i]=-32; else - pbch_llr8[i] = (char)(pbch_llr[i]); + pbch_llr8[i]=pbch_llr[i]; } } /* @@ -410,36 +385,33 @@ uint8_t pbch_deinterleaving_pattern[32] = {28,0,31,30,7,29,25,27,5,8,24,9,10,11, int nr_rx_pbch( PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, + int estimateSz, struct complex16 dl_ch_estimates [][estimateSz], NR_UE_PBCH *nr_ue_pbch_vars, NR_DL_FRAME_PARMS *frame_parms, uint8_t gNB_id, uint8_t i_ssb, - MIMO_mode_t mimo_mode) { - + MIMO_mode_t mimo_mode, + fapiPbch_t *result) { NR_UE_COMMON *nr_ue_common_vars = &ue->common_vars; int max_h=0; int symbol; //uint8_t pbch_a[64]; -//FT ?? cppcheck doesn't like pbch_a allocation because of line 525..and i don't get what this variable is for.. -//uint8_t *pbch_a = malloc(sizeof(uint8_t) * NR_POLAR_PBCH_PAYLOAD_BITS); - //uint32_t pbch_a_prime; - int16_t *pbch_e_rx; - uint8_t *decoded_output = nr_ue_pbch_vars->decoded_output; + //FT ?? cppcheck doesn't like pbch_a allocation because of line 525..and i don't get what this variable is for.. + //uint8_t *pbch_a = malloc(sizeof(uint8_t) * NR_POLAR_PBCH_PAYLOAD_BITS); uint8_t nushift; uint16_t M; - uint8_t Lmax=frame_parms->Lmax; + uint8_t Lmax=frame_parms->Lmax; //uint16_t crc; //unsigned short idx_demod =0; uint32_t decoderState=0; //uint8_t decoderListSize = 8, pathMetricAppr = 0; //time_stats_t polar_decoder_init,polar_rate_matching,decoding,bit_extraction,deinterleaving; //time_stats_t path_metric,sorting,update_LLR; -// FT ?? cppcheck fix memset(&pbch_a[0], 0, sizeof(uint8_t) * NR_POLAR_PBCH_PAYLOAD_BITS); + // FT ?? cppcheck fix memset(&pbch_a[0], 0, sizeof(uint8_t) * NR_POLAR_PBCH_PAYLOAD_BITS); //printf("nr_pbch_ue nid_cell %d\n",frame_parms->Nid_cell); - - pbch_e_rx = &nr_ue_pbch_vars->llr[0]; - // clear LLR buffer - memset(nr_ue_pbch_vars->llr,0,NR_POLAR_PBCH_E); + int16_t pbch_e_rx[960]= {0}; //Fixme: previous version erase only NR_POLAR_PBCH_E bytes + int16_t pbch_unClipped[960]= {0}; + int pbch_e_rx_idx=0; int symbol_offset=1; if (ue->is_synchronized > 0) @@ -447,20 +419,24 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, else symbol_offset=0; - #ifdef DEBUG_PBCH //printf("address dataf %p",nr_ue_common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF); write_output("rxdataF0_pbch.m","rxF0pbch", &nr_ue_common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[0][(symbol_offset+1)*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size*3,1,1); #endif - // symbol refers to symbol within SSB. symbol_offset is the offset of the SSB wrt start of slot - for (symbol=1; symbol<4; symbol++) { + double log2_maxh; + for (symbol=1; symbol<4; symbol++) { + const uint16_t nb_re=symbol == 2 ? 72 : 180; + struct complex16 rxdataF_ext[frame_parms->nb_antennas_rx][PBCH_MAX_RE_PER_SYMBOL]; + struct complex16 dl_ch_estimates_ext[frame_parms->nb_antennas_rx][PBCH_MAX_RE_PER_SYMBOL]; + memset(dl_ch_estimates_ext,0, sizeof dl_ch_estimates_ext); nr_pbch_extract(nr_ue_common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, - nr_ue_pbch_vars->dl_ch_estimates, - nr_ue_pbch_vars->rxdataF_ext, - nr_ue_pbch_vars->dl_ch_estimates_ext, + estimateSz, + dl_ch_estimates, + rxdataF_ext, + dl_ch_estimates_ext, symbol, symbol_offset, frame_parms); @@ -470,142 +446,139 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, #endif if (symbol == 1) { - max_h = nr_pbch_channel_level(nr_ue_pbch_vars->dl_ch_estimates_ext, + max_h = nr_pbch_channel_level(dl_ch_estimates_ext, frame_parms, - symbol); - nr_ue_pbch_vars->log2_maxh = 3+(log2_approx(max_h)/2); + nb_re); + log2_maxh = 3+(log2_approx(max_h)/2); } #ifdef DEBUG_PBCH LOG_I(PHY,"[PHY] PBCH log2_maxh = %d (%d)\n",nr_ue_pbch_vars->log2_maxh,max_h); #endif - nr_pbch_channel_compensation(nr_ue_pbch_vars->rxdataF_ext, - nr_ue_pbch_vars->dl_ch_estimates_ext, - nr_ue_pbch_vars->rxdataF_comp, + struct complex16 rxdataF_comp[frame_parms->nb_antennas_rx][PBCH_MAX_RE_PER_SYMBOL]; + nr_pbch_channel_compensation(rxdataF_ext, + dl_ch_estimates_ext, + nb_re, + rxdataF_comp, frame_parms, - symbol, - nr_ue_pbch_vars->log2_maxh); // log2_maxh+I0_shift + log2_maxh); // log2_maxh+I0_shift /*if (frame_parms->nb_antennas_rx > 1) pbch_detection_mrc(frame_parms, - nr_ue_pbch_vars->rxdataF_comp, + rxdataF_comp, symbol);*/ /* if (mimo_mode == ALAMOUTI) { - nr_pbch_alamouti(frame_parms,nr_ue_pbch_vars->rxdataF_comp,symbol); + nr_pbch_alamouti(frame_parms,rxdataF_comp,symbol); } else if (mimo_mode != SISO) { LOG_I(PHY,"[PBCH][RX] Unsupported MIMO mode\n"); return(-1); } */ - if (symbol==2) { - nr_pbch_quantize(pbch_e_rx, - (short *)&(nr_ue_pbch_vars->rxdataF_comp[0][symbol*240]), - 144); - pbch_e_rx+=144; - } else { - nr_pbch_quantize(pbch_e_rx, - (short *)&(nr_ue_pbch_vars->rxdataF_comp[0][symbol*240]), - 360); - pbch_e_rx+=360; - } + int nb=symbol==2 ? 144 : 360; + nr_pbch_quantize(pbch_e_rx+pbch_e_rx_idx, + (short *)rxdataF_comp[0], + nb); + memcpy(pbch_unClipped+pbch_e_rx_idx, rxdataF_comp[0], nb*sizeof(int16_t)); + pbch_e_rx_idx+=nb; } + // legacy code use int16, but it is complex16 + UEscopeCopy(ue, pbchRxdataF_comp, pbch_unClipped, sizeof(struct complex16), frame_parms->nb_antennas_rx, pbch_e_rx_idx/2); + UEscopeCopy(ue, pbchLlr, pbch_e_rx, sizeof(int16_t), frame_parms->nb_antennas_rx, pbch_e_rx_idx); #ifdef DEBUG_PBCH - write_output("rxdataF_comp.m","rxFcomp",&nr_ue_pbch_vars->rxdataF_comp[0][240],240*3,1,1); -#endif - pbch_e_rx = nr_ue_pbch_vars->llr; - //demod_pbch_e = nr_ue_pbch_vars->demod_pbch_e; -// FT?? cppcheck fix - pbch_a = nr_ue_pbch_vars->pbch_a; -#ifdef DEBUG_PBCH - //pbch_e_rx = &nr_ue_pbch_vars->llr[0]; - short *p = (short *)&(nr_ue_pbch_vars->rxdataF_comp[0][20*12]); - + write_output("rxdataF_comp.m","rxFcomp",rxdataF_comp[0],240*3,1,1); + short *p = (short *)rxdataF_comp[0]); + for (int cnt = 0; cnt < 864 ; cnt++) printf("pbch rx llr %d\n",*(pbch_e_rx+cnt)); - + #endif //un-scrambling M = NR_POLAR_PBCH_E; nushift = (Lmax==4)? i_ssb&3 : i_ssb&7; uint32_t unscrambling_mask = (Lmax==64)?0x100006D:0x1000041; - - nr_pbch_unscrambling(nr_ue_pbch_vars,frame_parms->Nid_cell,nushift,M,NR_POLAR_PBCH_E,0,0); + uint32_t pbch_a_interleaved=0; + uint32_t pbch_a_prime=0; + nr_pbch_unscrambling(nr_ue_pbch_vars, pbch_e_rx, frame_parms->Nid_cell, nushift, M, NR_POLAR_PBCH_E, + 0, 0, pbch_a_prime, &pbch_a_interleaved); //polar decoding de-rate matching - decoderState = polar_decoder_int16(pbch_e_rx,(uint64_t *)&nr_ue_pbch_vars->pbch_a_prime,0, + uint64_t tmp=0; + decoderState = polar_decoder_int16(pbch_e_rx,(uint64_t *)&tmp,0, NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL); + pbch_a_prime=tmp; + if(decoderState) + return(decoderState); - if(decoderState) return(decoderState); - - // printf("polar decoder output 0x%08x\n",nr_ue_pbch_vars->pbch_a_prime); + // printf("polar decoder output 0x%08x\n",pbch_a_prime); // Decoder reversal uint32_t a_reversed=0; for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++) - a_reversed |= (((uint64_t)nr_ue_pbch_vars->pbch_a_prime>>i)&1)<<(31-i); + a_reversed |= (((uint64_t)pbch_a_prime>>i)&1)<<(31-i); - nr_ue_pbch_vars->pbch_a_prime = a_reversed; + pbch_a_prime = a_reversed; //payload un-scrambling - nr_ue_pbch_vars->pbch_a_interleaved=0; M = (Lmax == 64)? (NR_POLAR_PBCH_PAYLOAD_BITS - 6) : (NR_POLAR_PBCH_PAYLOAD_BITS - 3); - nushift = ((nr_ue_pbch_vars->pbch_a_prime>>24)&1) ^ (((nr_ue_pbch_vars->pbch_a_prime>>6)&1)<<1); - nr_pbch_unscrambling(nr_ue_pbch_vars,frame_parms->Nid_cell,nushift,M,NR_POLAR_PBCH_PAYLOAD_BITS,1,unscrambling_mask); - //printf("nushift %d sfn 3rd %d 2nd %d", nushift,((nr_ue_pbch_vars->pbch_a_prime>>6)&1), ((nr_ue_pbch_vars->pbch_a_prime>>24)&1) ); + nushift = ((pbch_a_prime>>24)&1) ^ (((pbch_a_prime>>6)&1)<<1); + pbch_a_interleaved=0; + nr_pbch_unscrambling(nr_ue_pbch_vars, pbch_e_rx, frame_parms->Nid_cell, nushift, M, NR_POLAR_PBCH_PAYLOAD_BITS, + 1, unscrambling_mask, pbch_a_prime, &pbch_a_interleaved); + //printf("nushift %d sfn 3rd %d 2nd %d", nushift,((pbch_a_prime>>6)&1), ((pbch_a_prime>>24)&1) ); //payload deinterleaving //uint32_t in=0; uint32_t out=0; for (int i=0; i<32; i++) { - out |= ((nr_ue_pbch_vars->pbch_a_interleaved>>i)&1)<<(pbch_deinterleaving_pattern[i]); + out |= ((pbch_a_interleaved>>i)&1)<<(pbch_deinterleaving_pattern[i]); #ifdef DEBUG_PBCH - printf("i %d in 0x%08x out 0x%08x ilv %d (in>>i)&1) 0x%08x\n", i, nr_ue_pbch_vars->pbch_a_interleaved, out, pbch_deinterleaving_pattern[i], (nr_ue_pbch_vars->pbch_a_interleaved>>i)&1); + printf("i %d in 0x%08x out 0x%08x ilv %d (in>>i)&1) 0x%08x\n", i, pbch_a_interleaved, out, pbch_deinterleaving_pattern[i], (pbch_a_interleaved>>i)&1); #endif } uint32_t payload = 0; - //uint8_t xtra_byte = 0; - nr_ue_pbch_vars->xtra_byte = (out>>24)&0xff; + result->xtra_byte = (out>>24)&0xff; for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++) payload |= ((out>>i)&1)<<(NR_POLAR_PBCH_PAYLOAD_BITS-i-1); - + for (int i=0; i<3; i++) - decoded_output[i] = (uint8_t)((payload>>((3-i)<<3))&0xff); - - frame_parms->half_frame_bit = ((nr_ue_pbch_vars->xtra_byte>>4)&0x01); // computing the half frame index from the extra byte - + result->decoded_output[i] = (uint8_t)((payload>>((3-i)<<3))&0xff); + + frame_parms->half_frame_bit = (result->xtra_byte>>4)&0x01; // computing the half frame index from the extra byte frame_parms->ssb_index = i_ssb; // ssb index corresponds to i_ssb for Lmax = 4,8 + if (Lmax == 64) { // for Lmax = 64 ssb index 4th,5th and 6th bits are in extra byte for (int i=0; i<3; i++) - frame_parms->ssb_index += (((nr_ue_pbch_vars->xtra_byte>>(7-i))&0x01)<<(3+i)); + frame_parms->ssb_index += (((result->xtra_byte>>(7-i))&0x01)<<(3+i)); } ue->symbol_offset = nr_get_ssb_start_symbol(frame_parms,frame_parms->ssb_index); + if (frame_parms->half_frame_bit) - ue->symbol_offset += (frame_parms->slots_per_frame>>1)*frame_parms->symbols_per_slot; + ue->symbol_offset += (frame_parms->slots_per_frame>>1)*frame_parms->symbols_per_slot; uint8_t frame_number_4lsb = 0; - for (int i=0; i<4; i++) - frame_number_4lsb |= ((nr_ue_pbch_vars->xtra_byte>>i)&1)<<(3-i); + for (int i=0; i<4; i++) + frame_number_4lsb |= ((result->xtra_byte>>i)&1)<<(3-i); + proc->decoded_frame_rx = frame_number_4lsb; - #ifdef DEBUG_PBCH - printf("xtra_byte %x payload %x\n", nr_ue_pbch_vars->xtra_byte, payload); + printf("xtra_byte %x payload %x\n", xtra_byte, payload); for (int i=0; i<(NR_POLAR_PBCH_PAYLOAD_BITS>>3); i++) { // printf("unscrambling pbch_a[%d] = %x \n", i,pbch_a[i]); - printf("[PBCH] decoder payload[%d] = %x\n",i,decoded_output[i]); + printf("[PBCH] decoder payload[%d] = %x\n",i,result->decoded_output[i]); } -#endif +#endif nr_downlink_indication_t dl_indication; fapi_nr_rx_indication_t *rx_ind=calloc(sizeof(*rx_ind),1); uint16_t number_pdus = 1; - nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id); - nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, gNB_id, ue, NULL, NULL, number_pdus, proc); + nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, gNB_id, ue, NULL, NULL, number_pdus, proc,(void *)result); if (ue->if_inst && ue->if_inst->dl_indication) ue->if_inst->dl_indication(&dl_indication, NULL); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index 9bc3643557e6155546e2d9aeeddd5dc1d5415d8a..aac59a7da15350a442658bc6f2b6b906724e2fff 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -1152,11 +1152,14 @@ int rx_sss(PHY_VARS_NR_UE *phy_vars_ue,int32_t *tot_metric,uint8_t *flip_max,uin */ int nr_rx_pbch( PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, + const int estimateSz, + struct complex16 dl_ch_estimates[][estimateSz], NR_UE_PBCH *nr_ue_pbch_vars, NR_DL_FRAME_PARMS *frame_parms, uint8_t eNB_id, uint8_t i_ssb, - MIMO_mode_t mimo_mode); + MIMO_mode_t mimo_mode, + fapiPbch_t* result); int nr_pbch_detection(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index caf3a19d855c04a474689198d941283a6f71d8c6..f76119250f5164a8c2859ce0a7bc926fe9fc283a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -88,9 +88,9 @@ typedef struct { /// LDPC-code outputs uint8_t *d[MAX_NUM_NR_ULSCH_SEGMENTS]; /// LDPC-code outputs (TS 36.212 V15.4.0, Sec 5.3.2 p. 17) - uint8_t *e; + uint8_t *e; /// Rate matching (Interleaving) outputs (TS 36.212 V15.4.0, Sec 5.4.2.2 p. 30) - uint8_t *f; + uint8_t *f; /// Number of code segments uint32_t C; /// Number of bits in code segments @@ -122,55 +122,15 @@ typedef struct { typedef struct { /// SRS active flag uint8_t srs_active; -//#if defined(UPGRADE_RAT_NR) -#if 1 // Pointers to HARQ processes for the ULSCH NR_UL_UE_HARQ_t *harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES]; int harq_process_id[NR_MAX_SLOTS_PER_FRAME]; // UL number of harq processes uint8_t number_harq_processes_for_pusch; -#endif - /* - /// Pointer to CQI data (+1 for 8 bits crc) - uint8_t o[1+MAX_CQI_BYTES]; - /// Length of CQI data (bits) - uint8_t O; - /// Format of CQI data - UCI_format_t uci_format; - /// Rank information - uint8_t o_RI[2]; - /// Length of rank information (bits) - uint8_t O_RI; - /// Pointer to ACK - uint8_t o_ACK[4]; - */ /// Minimum number of CQI bits for PUSCH (36-212 r8.6, Sec 5.2.4.1 p. 37) uint8_t O_CQI_MIN; /// ACK/NAK Bundling flag uint8_t bundling; - /// Concatenated "g"-sequences (for definition see 36-212 V15.4.0 2018-12, p.31) - uint8_t g[MAX_NUM_NR_CHANNEL_BITS] __attribute__ ((aligned(32))); - /// Interleaved "h"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18) - uint8_t h[MAX_NUM_NR_CHANNEL_BITS]; - /// Scrambled "b"-sequences (for definition see 36-211 V8.6 2009-03, p.14) - uint8_t b_tilde[MAX_NUM_NR_CHANNEL_BITS]; - /// Modulated "d"-sequences (for definition see 36-211 V8.6 2009-03, p.14) - int32_t d_mod[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); - /// Transform-coded "y"-sequences (for definition see 38-211 V15.3.0 2018-09, subsection 6.3.1.4) - int32_t y[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); - /* - /// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27) - uint8_t q[MAX_CQI_PAYLOAD]; - - /// coded and interleaved CQI bits - uint8_t o_w[(MAX_CQI_BITS+8)*3]; - /// coded CQI bits - uint8_t o_d[96+((MAX_CQI_BITS+8)*3)]; - /// coded ACK bits - uint8_t q_ACK[MAX_ACK_PAYLOAD]; - /// coded RI bits - uint8_t q_RI[MAX_RI_PAYLOAD]; - */ /// beta_offset_cqi times 8 uint16_t beta_offset_cqi_times8; /// beta_offset_ri times 8 @@ -219,7 +179,9 @@ typedef struct { /// Pointer to the payload uint8_t *b; /// Pointers to transport block segments - uint8_t *c[MAX_NUM_NR_DLSCH_SEGMENTS]; + uint8_t **c; + /// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) + int16_t **d; /// Index of current HARQ round for this DLSCH uint8_t round; /// MCS table for this DLSCH @@ -234,14 +196,8 @@ typedef struct { uint8_t rvidx; /// MIMO mode for this DLSCH MIMO_nrmode_t mimo_mode; - /// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) - int16_t *w[MAX_NUM_NR_DLSCH_SEGMENTS]; - /// for abstraction soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) - //double w_abs[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448]; - /// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) - int16_t *d[MAX_NUM_NR_DLSCH_SEGMENTS]; /// LDPC processing buffers - t_nrLDPC_procBuf* p_nrLDPC_procBuf[MAX_NUM_NR_DLSCH_SEGMENTS]; + t_nrLDPC_procBuf **p_nrLDPC_procBuf; /// Number of code segments uint32_t C; /// Number of bits in code segments diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index 0ab4c94b963d604549c89dfcf2dfe35aa0c71fb1..87ba2090e7c1997209b2008939595a615ef1b158 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -174,43 +174,23 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, unsigned int G) { start_meas(&ue->ulsch_encoding_stats); -/////////////////////////parameters and variables declaration///////////////////////// -/////////// - - unsigned int crc; - NR_UL_UE_HARQ_t *harq_process; - uint16_t nb_rb ; - uint32_t A, F; - uint32_t *pz; - uint8_t mod_order; - uint16_t Kr,r; - uint32_t r_offset; - uint32_t E,Kb; - uint8_t Ilbrm; - uint32_t Tbslbrm; - uint16_t R; - float Coderate; - -/////////// -/////////////////////////////////////////////////////////////////////////////////////// - /////////////////////////parameters and variables initialization///////////////////////// /////////// - crc = 1; - harq_process = ulsch->harq_processes[harq_pid]; - nb_rb = harq_process->pusch_pdu.rb_size; - A = harq_process->pusch_pdu.pusch_data.tb_size*8; - pz = &harq_process->Z; - mod_order = nr_get_Qm_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table); - R = nr_get_code_rate_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table); - Kr=0; - r_offset=0; - F=0; - Ilbrm = 0; - Tbslbrm = 950984; //max tbs - Coderate = 0.0; + unsigned int crc = 1; + NR_UL_UE_HARQ_t *harq_process = ulsch->harq_processes[harq_pid]; + uint16_t nb_rb = harq_process->pusch_pdu.rb_size; + uint32_t A = harq_process->pusch_pdu.pusch_data.tb_size*8; + uint32_t *pz = &harq_process->Z; + uint8_t mod_order = nr_get_Qm_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table); + uint16_t R = nr_get_code_rate_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table); + uint16_t Kr=0; + uint32_t r_offset=0; + uint32_t F=0; + uint8_t Ilbrm = 0; + uint32_t Tbslbrm = 950984; //max tbs + float Coderate = 0.0; /////////// ///////////////////////////////////////////////////////////////////////////////////////// @@ -286,14 +266,19 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_IN); start_meas(&ue->ulsch_segmentation_stats); - Kb=nr_segmentation(harq_process->b, - harq_process->c, - harq_process->B, - &harq_process->C, - &harq_process->K, - pz, - &harq_process->F, - harq_process->BG); + uint32_t Kb=nr_segmentation(harq_process->b, + harq_process->c, + harq_process->B, + &harq_process->C, + &harq_process->K, + pz, + &harq_process->F, + harq_process->BG); + + if (harq_process->C>MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*harq_process->pusch_pdu.nrOfLayers) { + LOG_E(PHY,"nr_segmentation.c: too many segments %d, B %d\n",harq_process->C,harq_process->B); + return(-1); + } stop_meas(&ue->ulsch_segmentation_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_OUT); @@ -310,7 +295,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, //printf("segment Z %d k %d Kr %d BG %d\n", *pz,harq_process->K,Kr,BG); //start_meas(te_stats); - for (r=0; r<harq_process->C; r++) { + for (int r=0; r<harq_process->C; r++) { //channel_input[r] = &harq_process->d[r][0]; #ifdef DEBUG_ULSCH_CODING printf("Encoder: B %d F %d \n",harq_process->B, harq_process->F); @@ -345,8 +330,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LDPC_ENCODER_OPTIM, VCD_FUNCTION_IN); start_meas(&ue->ulsch_ldpc_encoding_stats); - for(int j = 0; j < (harq_process->C/8 + 1); j++) - { + for(int j = 0; j < (harq_process->C/8 + 1); j++) { impp.macro_num = j; nrLDPC_encoder(harq_process->c,harq_process->d,*pz,Kb,Kr,harq_process->BG,&impp); } @@ -369,14 +353,13 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, F = harq_process->F; Kr = harq_process->K; - for (r=0; r<harq_process->C; r++) { // looping over C segments - + for (int r=0; r<harq_process->C; r++) { // looping over C segments if (harq_process->F>0) { - for (int k=(Kr-F-2*(*pz)); k<Kr-2*(*pz); k++) { - harq_process->d[r][k] = NR_NULL; - //if (k<(Kr-F+8)) - //printf("r %d filler bits [%d] = %d \n", r,k, harq_process->d[r][k]); - } + for (int k=(Kr-F-2*(*pz)); k<Kr-2*(*pz); k++) { + harq_process->d[r][k] = NR_NULL; + //if (k<(Kr-F+8)) + //printf("r %d filler bits [%d] = %d \n", r,k, harq_process->d[r][k]); + } } @@ -391,7 +374,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, ///////////////////////// d---->| Rate matching bit selection |---->e ///////////////////////// /////////// - E = nr_get_E(G, harq_process->C, mod_order, harq_process->pusch_pdu.nrOfLayers, r); + uint32_t E = nr_get_E(G, harq_process->C, mod_order, harq_process->pusch_pdu.nrOfLayers, r); Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->pusch_pdu.nrOfLayers); @@ -434,9 +417,9 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, start_meas(&ue->ulsch_interleaving_stats); nr_interleaving_ldpc(E, - mod_order, - harq_process->e+r_offset, - harq_process->f+r_offset); + mod_order, + harq_process->e+r_offset, + harq_process->f+r_offset); stop_meas(&ue->ulsch_interleaving_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INTERLEAVING_LDPC, VCD_FUNCTION_OUT); @@ -458,8 +441,6 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, } - memcpy(ulsch->g,harq_process->f,G); // g is the concatenated code block - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT); stop_meas(&ue->ulsch_encoding_stats); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 41cf9c2ffaa248f9fe0b4bbe8ab1455e841fef68..802cb55e03445dcd26ce7c17f3272022efb85c3f 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -105,18 +105,15 @@ void nr_pusch_codeword_scrambling(uint8_t *in, } void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, - unsigned char harq_pid, - uint32_t frame, - uint8_t slot, - uint8_t thread_id, - int gNB_id) { + unsigned char harq_pid, + uint32_t frame, + uint8_t slot, + uint8_t thread_id, + int gNB_id) { LOG_D(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot); uint32_t available_bits; - uint8_t cwd_index, l; - uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5]; - int16_t **tx_layers; int32_t **txdataF; int8_t Wf[2], Wt[2]; int l_prime[2], delta; @@ -125,102 +122,100 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, int sample_offsetF, N_RE_prime; NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms; - NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id]; - uint8_t num_of_codewords = 1; // tmp assumption int N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig uint16_t number_dmrs_symbols = 0; - for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++) { - - NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[thread_id][gNB_id][cwd_index]; - NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid]; - nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &harq_process_ul_ue->pusch_pdu; - - int start_symbol = pusch_pdu->start_symbol_index; - uint16_t ul_dmrs_symb_pos = pusch_pdu->ul_dmrs_symb_pos; - uint8_t number_of_symbols = pusch_pdu->nr_of_symbols; - uint8_t dmrs_type = pusch_pdu->dmrs_config_type; - uint16_t start_rb = pusch_pdu->rb_start; - uint16_t nb_rb = pusch_pdu->rb_size; - uint8_t Nl = pusch_pdu->nrOfLayers; - uint8_t mod_order = pusch_pdu->qam_mod_order; - uint16_t rnti = pusch_pdu->rnti; - uint8_t cdm_grps_no_data = pusch_pdu->num_dmrs_cdm_grps_no_data; - uint16_t start_sc = frame_parms->first_carrier_offset + (start_rb+pusch_pdu->bwp_start)*NR_NB_SC_PER_RB; - - if (start_sc >= frame_parms->ofdm_symbol_size) - start_sc -= frame_parms->ofdm_symbol_size; - - ulsch_ue->Nid_cell = frame_parms->Nid_cell; - - for (int i = start_symbol; i < start_symbol + number_of_symbols; i++) { - if((ul_dmrs_symb_pos >> i) & 0x01) - number_dmrs_symbols += 1; - } + NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[thread_id][gNB_id]; + NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid]; + nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &harq_process_ul_ue->pusch_pdu; + + int start_symbol = pusch_pdu->start_symbol_index; + uint16_t ul_dmrs_symb_pos = pusch_pdu->ul_dmrs_symb_pos; + uint8_t number_of_symbols = pusch_pdu->nr_of_symbols; + uint8_t dmrs_type = pusch_pdu->dmrs_config_type; + uint16_t start_rb = pusch_pdu->rb_start; + uint16_t nb_rb = pusch_pdu->rb_size; + uint8_t Nl = pusch_pdu->nrOfLayers; + uint8_t mod_order = pusch_pdu->qam_mod_order; + uint16_t rnti = pusch_pdu->rnti; + uint8_t cdm_grps_no_data = pusch_pdu->num_dmrs_cdm_grps_no_data; + uint16_t start_sc = frame_parms->first_carrier_offset + (start_rb+pusch_pdu->bwp_start)*NR_NB_SC_PER_RB; + + if (start_sc >= frame_parms->ofdm_symbol_size) + start_sc -= frame_parms->ofdm_symbol_size; + + ulsch_ue->Nid_cell = frame_parms->Nid_cell; + + for (int i = start_symbol; i < start_symbol + number_of_symbols; i++) { + if((ul_dmrs_symb_pos >> i) & 0x01) + number_dmrs_symbols += 1; + } - nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*cdm_grps_no_data; + nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*cdm_grps_no_data; - LOG_D(PHY,"ulsch %x : start_rb %d bwp_start %d start_sc %d start_symbol %d num_symbols %d cdmgrpsnodata %d num_dmrs %d dmrs_re_per_rb %d\n", - rnti,start_rb,pusch_pdu->bwp_start,start_sc,start_symbol,number_of_symbols,cdm_grps_no_data,number_dmrs_symbols,nb_dmrs_re_per_rb); + LOG_D(PHY,"ulsch %x : start_rb %d bwp_start %d start_sc %d start_symbol %d num_symbols %d cdmgrpsnodata %d num_dmrs %d dmrs_re_per_rb %d\n", + rnti,start_rb,pusch_pdu->bwp_start,start_sc,start_symbol,number_of_symbols,cdm_grps_no_data,number_dmrs_symbols,nb_dmrs_re_per_rb); - // TbD num_of_mod_symbols is set but never used - N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh; - harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*num_of_codewords; + // TbD num_of_mod_symbols is set but never used + N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh; + harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb; - /////////////////////////ULSCH coding///////////////////////// - /////////// + /////////////////////////ULSCH coding///////////////////////// + /////////// - unsigned int G = nr_get_G(nb_rb, number_of_symbols, - nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl); + unsigned int G = nr_get_G(nb_rb, number_of_symbols, + nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl); - trace_NRpdu(DIRECTION_UPLINK, - ulsch_ue->harq_processes[harq_pid]->a, - ulsch_ue->harq_processes[harq_pid]->pusch_pdu.pusch_data.tb_size, - 0, WS_C_RNTI, rnti, frame, slot, 0, 0); - - if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G) == -1) - return; + trace_NRpdu(DIRECTION_UPLINK, + harq_process_ul_ue->a, + harq_process_ul_ue->pusch_pdu.pusch_data.tb_size, + 0, WS_C_RNTI, rnti, frame, slot, 0, 0); + if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G) == -1) + return; - /////////// - //////////////////////////////////////////////////////////////////// - /////////////////////////ULSCH scrambling///////////////////////// - /////////// + /////////// + //////////////////////////////////////////////////////////////////// - available_bits = G; + /////////////////////////ULSCH scrambling///////////////////////// + /////////// - memset(scrambled_output[cwd_index], 0, ((available_bits>>5)+1)*sizeof(uint32_t)); + available_bits = G; + uint32_t scrambled_output[(available_bits>>5)+1]; + memset(scrambled_output, 0, ((available_bits>>5)+1)*sizeof(uint32_t)); - nr_pusch_codeword_scrambling(ulsch_ue->g, - available_bits, - ulsch_ue->Nid_cell, - rnti, - false, - scrambled_output[cwd_index]); // assume one codeword for the moment + nr_pusch_codeword_scrambling(harq_process_ul_ue->f, + available_bits, + ulsch_ue->Nid_cell, + rnti, + false, + scrambled_output); + ///////////// + ////////////////////////////////////////////////////////////////////////// - ///////////// - ////////////////////////////////////////////////////////////////////////// + /////////////////////////ULSCH modulation///////////////////////// + /////////// - /////////////////////////ULSCH modulation///////////////////////// - /////////// + int max_num_re = number_of_symbols*nb_rb*NR_NB_SC_PER_RB; + int32_t d_mod[max_num_re] __attribute__ ((aligned(16))); - nr_modulation(scrambled_output[cwd_index], // assume one codeword for the moment - available_bits, - mod_order, - (int16_t *)ulsch_ue->d_mod); + nr_modulation(scrambled_output, // assume one codeword for the moment + available_bits, + mod_order, + (int16_t *)d_mod); - /////////// - //////////////////////////////////////////////////////////////////////// + /////////// + //////////////////////////////////////////////////////////////////////// /////////////////////////DMRS Modulation///////////////////////// /////////// - uint32_t ***pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; + uint32_t **pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; uint16_t n_dmrs = (pusch_pdu->bwp_start + start_rb + nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4); int16_t mod_dmrs[n_dmrs<<1] __attribute((aligned(16))); /////////// @@ -256,9 +251,11 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////ULSCH layer mapping///////////////////////// /////////// - tx_layers = (int16_t **)pusch_ue->txdataF_layers; + int16_t **tx_layers = (int16_t **)malloc16_clear(Nl*sizeof(int16_t *)); + for (int nl=0; nl<Nl; nl++) + tx_layers[nl] = (int16_t *)malloc16_clear((available_bits<<1)/mod_order*sizeof(int16_t)); - nr_ue_layer_mapping(UE->ulsch[thread_id][gNB_id], + nr_ue_layer_mapping((int16_t *)d_mod, Nl, available_bits/mod_order, tx_layers); @@ -276,13 +273,16 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint8_t u = 0, v = 0; int16_t *dmrs_seq = NULL; + /// Transform-coded "y"-sequences (for definition see 38-211 V15.3.0 2018-09, subsection 6.3.1.4) + int32_t y[max_num_re] __attribute__ ((aligned(16))); + // if transform precoding is enbaled (value 0) if (pusch_pdu->transform_precoding == 0) { uint32_t nb_re_pusch=nb_rb * NR_NB_SC_PER_RB; uint32_t y_offset = 0; uint16_t num_dmrs_res_per_symbol = nb_rb*(NR_NB_SC_PER_RB/2); - + // Calculate index to dmrs seq array based on number of DMRS Subcarriers on this symbol index = get_index_for_dmrs_lowpapr_seq(num_dmrs_res_per_symbol); u = pusch_pdu->dfts_ofdm.low_papr_group_number; @@ -291,59 +291,54 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, AssertFatal(index >= 0, "Num RBs not configured according to 3GPP 38.211 section 6.3.1.4. For PUSCH with transform precoding, num RBs cannot be multiple of any other primenumber other than 2,3,5\n"); AssertFatal(dmrs_seq != NULL, "DMRS low PAPR seq not found, check if DMRS sequences are generated"); - + LOG_D(PHY,"Transform Precoding params. u: %d, v: %d, index for dmrsseq: %d\n", u, v, index); - for (l = start_symbol; l < start_symbol + number_of_symbols; l++) { + for (int l = start_symbol; l < start_symbol + number_of_symbols; l++) { if((ul_dmrs_symb_pos >> l) & 0x01) /* In the symbol with DMRS no data would be transmitted CDM groups is 2*/ continue; - nr_dft(&ulsch_ue->y[y_offset], &((int32_t*)tx_layers[0])[y_offset], nb_re_pusch); + nr_dft(&y[y_offset], &((int32_t*)tx_layers[0])[y_offset], nb_re_pusch); y_offset = y_offset + nb_re_pusch; LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d, y_offset: %d\n", l, nb_re_pusch, y_offset); - #ifdef DEBUG_PUSCH_MAPPING - printf("NR_ULSCH_UE: y_offset %d\t nb_re_pusch %d \t Symbol %d \t nb_rb %d \n", - y_offset, nb_re_pusch, l, nb_rb); - #endif +#ifdef DEBUG_PUSCH_MAPPING + printf("NR_ULSCH_UE: y_offset %d\t nb_re_pusch %d \t Symbol %d \t nb_rb %d \n", + y_offset, nb_re_pusch, l, nb_rb); +#endif } - #ifdef DEBUG_DFT_IDFT - int32_t debug_symbols[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); - int offset = 0; - printf("NR_ULSCH_UE: available_bits: %d, mod_order: %d", available_bits,mod_order); - - for (int ll = 0; ll < (available_bits/mod_order); ll++) { - debug_symbols[ll] = ulsch_ue->y[ll]; - } - - printf("NR_ULSCH_UE: numSym: %d, num_dmrs_sym: %d", number_of_symbols,number_dmrs_symbols); - for (int ll = 0; ll < (number_of_symbols-number_dmrs_symbols); ll++) { +#ifdef DEBUG_DFT_IDFT + int32_t debug_symbols[max_num_re] __attribute__ ((aligned(16))); + int offset = 0; + printf("NR_ULSCH_UE: available_bits: %d, mod_order: %d", available_bits,mod_order); - nr_idft(&debug_symbols[offset], nb_re_pusch); - - offset = offset + nb_re_pusch; + for (int ll = 0; ll < (available_bits/mod_order); ll++) { + debug_symbols[ll] = y[ll]; + } - } - LOG_M("preDFT_all_symbols.m","UE_preDFT", tx_layers[0],number_of_symbols*nb_re_pusch,1,1); - LOG_M("postDFT_all_symbols.m","UE_postDFT", ulsch_ue->y,number_of_symbols*nb_re_pusch,1,1); - LOG_M("DEBUG_IDFT_SYMBOLS.m","UE_Debug_IDFT", debug_symbols,number_of_symbols*nb_re_pusch,1,1); - LOG_M("UE_DMRS_SEQ.m","UE_DMRS_SEQ", dmrs_seq,nb_re_pusch,1,1); - #endif + printf("NR_ULSCH_UE: numSym: %d, num_dmrs_sym: %d", number_of_symbols,number_dmrs_symbols); + for (int ll = 0; ll < (number_of_symbols-number_dmrs_symbols); ll++) { + nr_idft(&debug_symbols[offset], nb_re_pusch); + offset = offset + nb_re_pusch; + } + LOG_M("preDFT_all_symbols.m","UE_preDFT", tx_layers[0],number_of_symbols*nb_re_pusch,1,1); + LOG_M("postDFT_all_symbols.m","UE_postDFT", y,number_of_symbols*nb_re_pusch,1,1); + LOG_M("DEBUG_IDFT_SYMBOLS.m","UE_Debug_IDFT", debug_symbols,number_of_symbols*nb_re_pusch,1,1); + LOG_M("UE_DMRS_SEQ.m","UE_DMRS_SEQ", dmrs_seq,nb_re_pusch,1,1); +#endif } else - memcpy(ulsch_ue->y, tx_layers[0], (available_bits/mod_order)*sizeof(int32_t)); + memcpy(y, tx_layers[0], (available_bits/mod_order)*sizeof(int32_t)); - - /////////// - //////////////////////////////////////////////////////////////////////// - - + for (int nl = 0; nl < Nl; nl++) + free_and_zero(tx_layers[nl]); + free_and_zero(tx_layers); /////////////////////////ULSCH RE mapping///////////////////////// /////////// @@ -356,18 +351,16 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint16_t m = 0; - #ifdef DEBUG_PUSCH_MAPPING - printf("NR_ULSCH_UE: Value of CELL ID %d /t, u %d \n", frame_parms->Nid_cell, u); - #endif - - +#ifdef DEBUG_PUSCH_MAPPING + printf("NR_ULSCH_UE: Value of CELL ID %d /t, u %d \n", frame_parms->Nid_cell, u); +#endif // DMRS params for this ap get_Wt(Wt, ap, dmrs_type); get_Wf(Wf, ap, dmrs_type); delta = get_delta(ap, dmrs_type); - for (l=start_symbol; l<start_symbol+number_of_symbols; l++) { + for (int l=start_symbol; l<start_symbol+number_of_symbols; l++) { uint16_t k = start_sc; uint16_t n = 0; @@ -388,21 +381,18 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, // TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part // Perform this on gold sequence, not required when SC FDMA operation is done, - LOG_D(PHY,"DMRS in symbol %d\n",l); - nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated - + LOG_D(PHY,"DMRS in symbol %d\n",l); + nr_modulation(pusch_dmrs[l], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // Qm = 2 as DMRS is QPSK modulated } else { dmrs_idx = 0; } - - } else if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { AssertFatal(pusch_pdu->transform_precoding == 1, "PTRS NOT SUPPORTED IF TRANSFORM PRECODING IS ENABLED\n"); if(is_ptrs_symbol(l, ulsch_ue->ptrs_symbols)) { is_ptrs_sym = 1; - nr_modulation(pusch_dmrs[l][0], nb_rb, DMRS_MOD_ORDER, mod_ptrs); + nr_modulation(pusch_dmrs[l], nb_rb, DMRS_MOD_ORDER, mod_ptrs); } } @@ -417,15 +407,15 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%frame_parms->ofdm_symbol_size)) is_dmrs = 1; } else if (is_ptrs_sym) { - is_ptrs = is_ptrs_subcarrier(k, - rnti, - ap, - dmrs_type, - K_ptrs, - nb_rb, - pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, - start_sc, - frame_parms->ofdm_symbol_size); + is_ptrs = is_ptrs_subcarrier(k, + rnti, + ap, + dmrs_type, + K_ptrs, + nb_rb, + pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, + start_sc, + frame_parms->ofdm_symbol_size); } if (is_dmrs == 1) { @@ -434,19 +424,19 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*dmrs_seq[2*dmrs_idx]) >> 15; ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*dmrs_seq[(2*dmrs_idx) + 1]) >> 15; - + } else { - ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15; - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; + ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15; + ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; - } + } - #ifdef DEBUG_PUSCH_MAPPING - printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t dmrs: %d %d\n", - dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1], - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]); - #endif +#ifdef DEBUG_PUSCH_MAPPING + printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t dmrs: %d %d\n", + dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1], + ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]); +#endif dmrs_idx++; @@ -463,14 +453,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, } else if (!is_dmrs_sym || allowed_xlsch_re_in_dmrs_symbol(k, start_sc, frame_parms->ofdm_symbol_size, cdm_grps_no_data, dmrs_type)) { - ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1]; - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1]; + ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) y)[m<<1]; + ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) y)[(m<<1) + 1]; - #ifdef DEBUG_PUSCH_MAPPING +#ifdef DEBUG_PUSCH_MAPPING printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, k, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1], - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]); - #endif + m, l, k, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1], + ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]); +#endif m++; @@ -486,10 +476,9 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, } } } - } NR_UL_UE_HARQ_t *harq_process_ulsch=NULL; - harq_process_ulsch = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid]; + harq_process_ulsch = UE->ulsch[thread_id][gNB_id]->harq_processes[harq_pid]; harq_process_ulsch->status = SCH_IDLE; /////////// diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c index 158c82e585c0172fb2fa18883cb2010f7f40d050..77e06c08fd823ac2349ab93e002134df94dc0405 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c @@ -743,7 +743,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain /* perform correlation of rx data and pss sequence ie it is a dot product */ result = dot_product64((short*)primary_synchro_time_nr[pss_index], - (short*) &(rxdata[ar][n+is*frame_parms->samples_per_frame]), + (short*)&(rxdata[ar][n+is*frame_parms->samples_per_frame]), frame_parms->ofdm_symbol_size, shift); pss_corr_ue[pss_index][n] += abs64(result); diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index 5594d566934d659c322ce19382d67c90b5c8e57d..fe0f785ef4ce44a07ef85f7472329fb2e995f6f0 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -40,6 +40,13 @@ const FL_COLOR water_colors[4] = {FL_BLUE,FL_GREEN,FL_YELLOW,FL_RED}; typedef struct complex16 scopeSample_t; #define SquaredNorm(VaR) ((VaR).r*(VaR).r+(VaR).i*(VaR).i) +typedef struct { + int dataSize; + int elementSz; + int colSz; + int lineSz; +} scopeGraphData_t; + typedef struct OAIgraph { FL_OBJECT *graph; FL_OBJECT *text; @@ -56,7 +63,7 @@ typedef struct OAIgraph { boolean_t initDone; int iteration; 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); + void (*nrUEfunct)(scopeGraphData_t **data, struct OAIgraph *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id); } OAIgraph_t; /* Forms and Objects */ @@ -140,7 +147,7 @@ static OAIgraph_t gNBcommonGraph( void (*funct) (OAIgraph_t *graph, scopeData_t return graph; } -static OAIgraph_t nrUEcommonGraph( void (*funct) (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id), +static OAIgraph_t nrUEcommonGraph( void (*funct) (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, 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); @@ -341,7 +348,7 @@ static void timeResponse (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { 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 *)p->rxdataF, frame_parms->samples_per_frame_wCP, + genericWaterFall(graph, (scopeSample_t *)p->liveData, frame_parms->samples_per_frame_wCP, frame_parms->slots_per_frame, "X axis: Frequency domain, one subframe"); } @@ -515,6 +522,7 @@ void phy_scope_gNB(OAI_phy_scope_t *form, //fl_check_forms(); } + static void *scope_thread_gNB(void *arg) { scopeData_t *p=(scopeData_t *) arg; size_t stksize=0; @@ -539,11 +547,12 @@ static void *scope_thread_gNB(void *arg) { 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, + memcpy(((int32_t *)scope->liveData) + slot*scope->gNB->frame_parms.samples_per_slot_wCP, data, - scope->gNB->frame_parms.samples_per_slot_wCP); + scope->gNB->frame_parms.samples_per_slot_wCP*sizeof(int32_t)); } void gNBinitScope(scopeParms_t *p) { @@ -554,11 +563,11 @@ void gNBinitScope(scopeParms_t *p) { scope->ru=p->ru; scope->gNB=p->gNB; scope->slotFunc=copyRxdataF; - AssertFatal(scope->rxdataF=(int32_t *) calloc(p->gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t),1),""); + AssertFatal(scope->liveData= calloc(p->gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t),1),""); pthread_t forms_thread; 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) { +static void ueWaterFall (scopeGraphData_t **data, 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, (scopeSample_t *) phy_vars_ue->common_vars.rxdata[0], @@ -574,13 +583,19 @@ 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) { + +static void ueChannelResponse (scopeGraphData_t **data, 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); + if (!data[pbchDlChEstimateTime]) + return; + + const scopeSample_t *tmp=(scopeSample_t *)(data[pbchDlChEstimateTime]+1); + genericPowerPerAntena(graph, data[pbchDlChEstimateTime]->colSz, + &tmp, + data[pbchDlChEstimateTime]->lineSz); } -static void ueFreqWaterFall (OAIgraph_t *graph,PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id ) { + +static void ueFreqWaterFall (scopeGraphData_t **data, 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 genericWaterFall(graph, @@ -624,56 +639,44 @@ 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) { +static void uePbchLLR (scopeGraphData_t **data, 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) + if ( !data[pbchLlr]) return; - int16_t *pbch_llr = (int16_t *) phy_vars_ue->pbch_vars[eNB_id]->llr; + const int sz=data[pbchLlr]->lineSz; + //const int antennas=data[pbchLlr]->colSz; + // We take the first antenna only for now + int16_t *llrs = (int16_t *) (data[pbchLlr]+1); float *llr_pbch, *bit_pbch; - oai_xygraph_getbuff(graph, &bit_pbch, &llr_pbch, 864, 0); + oai_xygraph_getbuff(graph, &bit_pbch, &llr_pbch, sz, 0); - for (int i=0; i<864; i++) { - llr_pbch[i] = (float) pbch_llr[i]; + for (int i=0; i<sz; i++) { + llr_pbch[i] = llrs[i]; } - oai_xygraph(graph,bit_pbch,llr_pbch,864,0,10); + oai_xygraph(graph,bit_pbch,llr_pbch,sz,0,10); } -static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { + +static void uePbchIQ (scopeGraphData_t **data, 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]) + if (!data[pbchRxdataF_comp]) return; - scopeSample_t *pbch_comp = (scopeSample_t *) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0]; + scopeSample_t *pbch_comp = (scopeSample_t *) (data[pbchRxdataF_comp]+1); + const int sz=data[pbchRxdataF_comp]->lineSz; float *I, *Q; - oai_xygraph_getbuff(graph, &I, &Q, 180*3, 0); - memset(I,0,180*3*sizeof(*I)); - memset(Q,0,180*3*sizeof(*Q)); - int first_symbol=1; - int base=0; - - for (int symbol=first_symbol; symbol<(first_symbol+3); symbol++) { - int nb_re; - - if (symbol == 2 || symbol == 6) - nb_re = 72; - else - nb_re = 180; - - AssertFatal(base+nb_re<180*3,""); - - for (int i=0; i<nb_re; i++) { - I[base+i] = pbch_comp[symbol*20*12+i].r; - Q[base+i] = pbch_comp[symbol*20*12+i].i; - } + oai_xygraph_getbuff(graph, &I, &Q, sz, 0); - base+=nb_re; + for (int i=0; i<sz; i++) { + I[i]=pbch_comp[i].r; + Q[i]=pbch_comp[i].i; } - AssertFatal(base <= 180*3,""); - oai_xygraph(graph,I,Q,base,0, 10); + oai_xygraph(graph, I, Q, sz, 0, true); } -static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { + +static void uePcchLLR (scopeGraphData_t **data, 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; @@ -698,7 +701,7 @@ 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) { +static void uePcchIQ (scopeGraphData_t **data, 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]) return; @@ -722,7 +725,7 @@ 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) { +static void uePdschLLR (scopeGraphData_t **data, 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]) return; @@ -749,7 +752,7 @@ 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) { +static void uePdschIQ (scopeGraphData_t **data, 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]) return; @@ -776,7 +779,7 @@ 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) { +static void uePdschThroughput (scopeGraphData_t **data, 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}}; float tput_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; @@ -869,7 +872,9 @@ 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, + +void phy_scope_nrUE(scopeGraphData_t **UEliveData, + OAI_phy_scope_t *form, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { @@ -886,26 +891,29 @@ void phy_scope_nrUE(OAI_phy_scope_t *form, int i=0; while (form->graph[i].graph) { - form->graph[i].nrUEfunct(form->graph+i, phy_vars_ue, eNB_id, UE_id); + form->graph[i].nrUEfunct(UEliveData, form->graph+i, phy_vars_ue, eNB_id, UE_id); i++; } //fl_check_forms(); } + static void *nrUEscopeThread(void *arg) { PHY_VARS_NR_UE *ue=(PHY_VARS_NR_UE *)arg; size_t stksize; - pthread_attr_t atr={0}; + pthread_attr_t atr= {0}; pthread_attr_getstacksize(&atr, &stksize); pthread_attr_setstacksize(&atr,32*1024*1024 ); int fl_argc=1; char *name="5G-UE-scope"; fl_initialize (&fl_argc, &name, NULL, 0, 0); OAI_phy_scope_t *form_nrue=create_phy_scope_nrue(0); + (( scopeData_t *)ue->scopeData)->liveData=calloc(sizeof(scopeGraphData_t *), UEdataTypeNumberOfItems); while (!oai_exit) { fl_freeze_form(form_nrue->phy_scope); - phy_scope_nrUE(form_nrue, + phy_scope_nrUE((( scopeData_t *)ue->scopeData)->liveData, + form_nrue, ue, 0,0); fl_unfreeze_form(form_nrue->phy_scope); @@ -915,10 +923,41 @@ static void *nrUEscopeThread(void *arg) { pthread_exit((void *)arg); } + +void UEcopyData(PHY_VARS_NR_UE *ue, enum UEdataType type, void *dataIn, int elementSz, int colSz, int lineSz) { + scopeData_t *tmp=(scopeData_t *)ue->scopeData; + + if (tmp) { + scopeGraphData_t *live= ((scopeGraphData_t **)tmp->liveData)[type]; + + if (live == NULL || live->dataSize < elementSz*colSz*lineSz) { + scopeGraphData_t *ptr=realloc(live, sizeof(scopeGraphData_t) + elementSz*colSz*lineSz); + + if (!ptr) { + LOG_E(PHY,"can't realloc\n"); + return; + } else { + live=ptr; + } + } + + live->dataSize=elementSz*colSz*lineSz; + live->elementSz=elementSz; + live->colSz=colSz; + live->lineSz=lineSz; + memcpy(live+1, dataIn, elementSz*colSz*lineSz); + ((scopeGraphData_t **)tmp->liveData)[type]=live; + } +} + void nrUEinitScope(PHY_VARS_NR_UE *ue) { + AssertFatal(ue->scopeData=malloc(sizeof(scopeData_t)),""); + scopeData_t *scope=(scopeData_t *) ue->scopeData; + scope->copyData=UEcopyData; 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"); diff --git a/openair1/PHY/TOOLS/phy_scope_interface.h b/openair1/PHY/TOOLS/phy_scope_interface.h index 8b747d575d1720f95ae192013a31dfe914ed7ad8..9cd8e1dc40c0924d3b01f1ef7561bd46b46f1561 100644 --- a/openair1/PHY/TOOLS/phy_scope_interface.h +++ b/openair1/PHY/TOOLS/phy_scope_interface.h @@ -32,6 +32,8 @@ #ifndef __PHY_SCOPE_INTERFACE_H__ #define __PHY_SCOPE_INTERFACE_H__ #include <openair1/PHY/defs_gNB.h> +#include <openair1/PHY/defs_nr_UE.h> + typedef struct { int *argc; char **argv; @@ -39,16 +41,25 @@ typedef struct { PHY_VARS_gNB *gNB; } scopeParms_t; +enum UEdataType { + pbchDlChEstimateTime, + pbchLlr, + pbchRxdataF_comp, + UEdataTypeNumberOfItems +}; 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); + void *liveData; + void (*slotFunc)(int32_t *data, int slot, void *scopeData); + void (*copyData)(PHY_VARS_NR_UE *,enum UEdataType, void *data, int elementSz, int colSz, int lineSz); } scopeData_t; int load_softscope(char *exectype, void *initarg); int end_forms(void) ; + +#define UEscopeCopy(ue, type, ...) if(ue->scopeData) ((scopeData_t*)ue->scopeData)->copyData(ue, type, ##__VA_ARGS__); #endif diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h index fa5538409381377fe2fd2685bd556dbd5e0d594c..7f4d07ddae8c5b58251ca3a50ae0ae4ba913105d 100644 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -837,6 +837,7 @@ typedef struct { /// RF and Interface devices per CC openair0_device rfdevice; + void *scopeData; } PHY_VARS_UE; /* this structure is used to pass both UE phy vars and diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 50b79289ed5db83bdda5e57b65c62db13076d8e7..6f1781074f6476ff2ba36ae362495385024e3acd 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -89,7 +89,7 @@ typedef struct { /// Pointer to the payload uint8_t *b; /// Pointers to transport block segments - uint8_t *c[MAX_NUM_NR_DLSCH_SEGMENTS]; + uint8_t **c; /// Frame where current HARQ round was sent uint32_t frame; /// Subframe where current HARQ round was sent @@ -157,13 +157,11 @@ typedef struct { /// Pointers to variables related to DLSCH harq process NR_DL_gNB_HARQ_t harq_process; /// TX buffers for UE-spec transmission (antenna layers 1,...,4 after to precoding) - int32_t *txdataF[NR_MAX_NB_LAYERS]; - /// TX buffers for UE-spec transmission (antenna ports 1000 or 1001,...,1007, before precoding) - int32_t *txdataF_precoding[NR_MAX_NB_LAYERS]; + int32_t **txdataF; /// Modulated symbols buffer - int32_t *mod_symbs[NR_MAX_NB_CODEWORDS]; + int32_t **mod_symbs; /// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers? - int32_t **ue_spec_bf_weights[NR_MAX_NB_LAYERS]; + int32_t ***ue_spec_bf_weights; /// dl channel estimates (estimated from ul channel estimates) int32_t **calib_dl_ch_estimates; /// Allocated RNTI (0 means DLSCH_t is not currently used) @@ -287,7 +285,7 @@ typedef struct { /// LDPC lifting size (38.212 V15.4.0 table 5.3.2-1) uint32_t Z; /// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1) - int16_t e[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448]; + int16_t e[MAX_NUM_NR_ULSCH_SEGMENTS][3*8448]; /// Number of bits in each code block after rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1) uint32_t E; /// Number of segments processed so far @@ -759,7 +757,7 @@ typedef struct PHY_VARS_gNB_s { NR_gNB_PDCCH_t pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; NR_gNB_UL_PDCCH_t ul_pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX]; NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; // Nusers times two spatial streams - NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX][2]; // [Nusers times][2 codewords] + NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX]; // [Nusers times] NR_gNB_DLSCH_t *dlsch_SI,*dlsch_ra,*dlsch_p; NR_gNB_DLSCH_t *dlsch_PCH; /// statistics for DLSCH measurement collection diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 1cbe724f330a86cb3f77204c22c6a05b8518eae2..315134ed37decc2f93cb96f792491bbd06df6c6a 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -225,11 +225,6 @@ typedef struct { } NR_UE_COMMON_PER_THREAD; -typedef struct { - /// TX buffers for multiple layers - int32_t *txdataF_layers[NR_MAX_NB_LAYERS]; - } NR_UE_PUSCH; - typedef struct { bool active[2]; fapi_nr_ul_config_pucch_pdu pucch_pdu[2]; @@ -650,40 +645,6 @@ typedef struct { #define PBCH_A 24 typedef struct { - /// \brief Pointers to extracted PBCH symbols in frequency-domain. - /// - first index: rx antenna [0..nb_antennas_rx[ - /// - second index: ? [0..287] (hard coded) - int32_t **rxdataF_ext; - /// \brief Pointers to extracted and compensated PBCH symbols in frequency-domain. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..287] (hard coded) - int32_t **rxdataF_comp; - /// \brief Hold the channel estimates in frequency domain. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[ - int32_t **dl_ch_estimates; - /// \brief Pointers to downlink channel estimates in frequency-domain extracted in PRBS. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..287] (hard coded) - int32_t **dl_ch_estimates_ext; - /// \brief Hold the channel estimates in time domain (used for tracking). - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: samples? [0..2*ofdm_symbol_size[ - int32_t **dl_ch_estimates_time; - int log2_maxh; - uint8_t pbch_a[NR_POLAR_PBCH_PAYLOAD_BITS>>3]; - uint32_t pbch_a_interleaved; - uint32_t pbch_a_prime; - uint8_t pbch_e[NR_POLAR_PBCH_E]; - int16_t demod_pbch_e[NR_POLAR_PBCH_E]; - /// \brief Pointer to PBCH llrs. - /// - first index: ? [0..1919] (hard coded) - int16_t *llr; - /// \brief Pointer to PBCH decoded output. - /// - first index: ? [0..63] (hard coded) - uint8_t *decoded_output; - /// \brief PBCH additional bits - uint8_t xtra_byte; /// \brief Total number of PDU errors. uint32_t pdu_errors; /// \brief Total number of PDU errors 128 frames ago. @@ -691,7 +652,7 @@ typedef struct { /// \brief Total number of consecutive PDU errors. uint32_t pdu_errors_conseq; /// \brief FER (in percent) . - uint32_t pdu_fer; + //uint32_t pdu_fer; } NR_UE_PBCH; typedef struct { @@ -815,10 +776,9 @@ typedef struct { NR_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_SRS *srs_vars[NUMBER_OF_CONNECTED_gNB_MAX]; - NR_UE_PUSCH *pusch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_PUCCH *pucch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX]; - NR_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_CODEWORDS]; // two RxTx Threads - NR_UE_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_CODEWORDS]; // two code words + NR_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_LAYERS>4 ? 2:1]; // two RxTx Threads + NR_UE_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_ra[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX]; @@ -862,7 +822,7 @@ typedef struct { uint16_t scramblingID_pdcch; /// PUSCH DMRS sequence - uint32_t ****nr_gold_pusch_dmrs; + uint32_t ***nr_gold_pusch_dmrs; uint32_t X_u[64][839]; @@ -1069,7 +1029,7 @@ typedef struct { #endif int dl_stats[5]; - + void* scopeData; } PHY_VARS_NR_UE; /* this structure is used to pass both UE phy vars and diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index d3352fb520dc05fbcbd5fb4d7335ec3e609f561c..0a58ff3dc18311ea05047866f5f29f5a3078d54c 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -44,8 +44,6 @@ #define MAX_NUM_SUBCARRIER_SPACING 5 -#define NR_MAX_NB_RB 275 - #define NR_NB_SC_PER_RB 12 #define NR_NB_REG_PER_CCE 6 @@ -67,22 +65,9 @@ #define NR_PBCH_DMRS_LENGTH 144 // in mod symbols #define NR_PBCH_DMRS_LENGTH_DWORD 10 // ceil(2(QPSK)*NR_PBCH_DMRS_LENGTH/32) -/*These max values are for the gold sequences which are generated at init for the - * full carrier bandwidth*/ -#define NR_MAX_PDCCH_DMRS_INIT_LENGTH ((NR_MAX_NB_RB<<1)*3) // 3 symbols *2(QPSK) -#define NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD 52 // ceil(NR_MAX_PDCCH_DMRS_LENGTH/32) /*used for the resource mapping*/ #define NR_MAX_PDCCH_DMRS_LENGTH 576 // 16(L)*2(QPSK)*3(3 DMRS symbs per REG)*6(REG per CCE) -#define NR_MAX_PDSCH_DMRS_LENGTH 3300 //275*6(k)*2(QPSK real+imag) -#define NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD 104 // ceil(NR_MAX_PDSCH_DMRS_LENGTH/32) - -#define NR_MAX_CSI_RS_LENGTH 4400 //275*8(max allocation per RB)*2(QPSK) -#define NR_MAX_CSI_RS_INIT_LENGTH_DWORD 138 // ceil(NR_MAX_CSI_RS_LENGTH/32) - -#define NR_MAX_PUSCH_DMRS_LENGTH NR_MAX_PDSCH_DMRS_LENGTH -#define NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD - #define NR_MAX_DCI_PAYLOAD_SIZE 64 #define NR_MAX_DCI_SIZE 1728 //16(L)*2(QPSK)*9(12 RE per REG - 3(DMRS))*6(REG per CCE) #define NR_MAX_DCI_SIZE_DWORD 54 // ceil(NR_MAX_DCI_SIZE/32) @@ -93,24 +78,19 @@ #define NR_MAX_CSET_DURATION 3 #define NR_MAX_NB_RBG 18 -#define NR_MAX_NB_LAYERS 2 // 8 // SU-MIMO (3GPP TS 38.211 V15.4.0 section 7.3.1.3) -#define NR_MAX_NB_CODEWORDS 2 +#define NR_MAX_NB_LAYERS 4 // 8 #define NR_MAX_NB_HARQ_PROCESSES 16 -#define NR_MAX_PDSCH_ENCODED_LENGTH (NR_MAX_NB_RB*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8*NR_MAX_NB_LAYERS) // 8 is the maximum modulation order (it was 950984 before !!) -#define NR_MAX_PUSCH_ENCODED_LENGTH NR_MAX_PDSCH_ENCODED_LENGTH + #define NR_MAX_PDSCH_TBS 3824 #define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 - The physical layer imposes a limit to the maximum size a SIB can take. The maximum SIB1 or SI message size is 2976 bits. -#define MAX_NUM_NR_DLSCH_SEGMENTS (NR_MAX_NB_LAYERS*34) -#define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056) +#define MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER 34 #define MAX_NUM_NR_ULSCH_SEGMENTS 34 #define MAX_NR_ULSCH_PAYLOAD_BYTES (MAX_NUM_NR_ULSCH_SEGMENTS*1056) #define MAX_NUM_NR_SRS_SYMBOLS 4 -#define MAX_NUM_NR_CHANNEL_BITS (14*273*12*8) // 14 symbols, 273 RB -#define MAX_NUM_NR_RE (14*273*12) #define NR_RX_NB_TH 1 #define NR_NB_TH_SLOT 2 @@ -253,7 +233,7 @@ typedef struct { typedef struct { uint16_t sc_list_length; - uint16_t sc_list[6 * NR_MAX_NB_RB]; + uint16_t *sc_list; uint8_t srs_generated_signal_bits; int32_t *srs_generated_signal; int32_t **srs_received_signal; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index ee1e0be49af41369d6a57fa79a29b14e99c63ca5..1a35f6ee683753181b82db2c3ce4951eafb1b194 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1938,6 +1938,8 @@ void fill_ulsch_harq_indication (PHY_VARS_eNB *eNB, LTE_UL_eNB_HARQ_t *ulsch_har pthread_mutex_unlock(&eNB->UL_INFO_mutex); } +#define packetError(ConD, fmt, args...) if (!(ConD)) { LOG_E(PHY, fmt, args); goodPacket=false; } + void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, int frame, int subframe, uint8_t *harq_ack, uint8_t tdd_mapping_mode, uint16_t tdd_multiplexing_mask) { if ( split73 == SPLIT73_DU ) { sendFs6Ulharq(fs6ULindicationHarq, UEid, eNB, uci, frame, subframe, harq_ack, tdd_mapping_mode, tdd_multiplexing_mask, 0, 0); @@ -1953,6 +1955,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in } pthread_mutex_lock(&eNB->UL_INFO_mutex); + bool goodPacket=true; nfapi_harq_indication_t *ind = &eNB->UL_INFO.harq_ind; nfapi_harq_indication_body_t *body = &ind->harq_indication_body; assert(eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU); @@ -1985,73 +1988,87 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG; pdu->harq_indication_fdd_rel13.mode = 0; pdu->harq_indication_fdd_rel13.number_of_ack_nack = 1; - AssertFatal (harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n", harq_ack[0]); - pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0]; - // release DLSCH if needed - release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + packetError (harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n", harq_ack[0]); + if (goodPacket) { + pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0]; + // release DLSCH if needed + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + } } else if (uci->pucch_fmt == pucch_format1b) { pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG; pdu->harq_indication_fdd_rel13.mode = 0; pdu->harq_indication_fdd_rel13.number_of_ack_nack = 2; - AssertFatal (harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n", harq_ack[0]); - AssertFatal (harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n", harq_ack[1]); - pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0]; - pdu->harq_indication_fdd_rel13.harq_tb_n[1] = harq_ack[1]; - // release DLSCH if needed - release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); - release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); - } else AssertFatal(1==0,"only format 1a/b for now, received %d\n",uci->pucch_fmt); + packetError (harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n", harq_ack[0]); + packetError (harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n", harq_ack[1]); + if (goodPacket) { + pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0]; + pdu->harq_indication_fdd_rel13.harq_tb_n[1] = harq_ack[1]; + // release DLSCH if needed + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); + } + } else + packetError(1==0,"only format 1a/b for now, received %d\n",uci->pucch_fmt); } else { // TDD - AssertFatal (tdd_mapping_mode == 0 || tdd_mapping_mode == 1 || tdd_mapping_mode == 2, "Illegal tdd_mapping_mode %d\n", tdd_mapping_mode); - pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; - pdu->harq_indication_tdd_rel13.mode = tdd_mapping_mode; - LOG_D(PHY,"%s(eNB, uci_harq format %d, rnti:%04x, frame:%d, subframe:%d, tdd_mapping_mode:%d) harq_ack[0]:%d harq_ack[1]:%d\n", __FUNCTION__, uci->pucch_fmt,uci->rnti, frame, subframe, - tdd_mapping_mode,harq_ack[0],harq_ack[1]); - - switch (tdd_mapping_mode) { + packetError (tdd_mapping_mode == 0 || tdd_mapping_mode == 1 || tdd_mapping_mode == 2, "Illegal tdd_mapping_mode %d\n", tdd_mapping_mode); + if (goodPacket) { + pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; + pdu->harq_indication_tdd_rel13.mode = tdd_mapping_mode; + LOG_D(PHY,"%s(eNB, uci_harq format %d, rnti:%04x, frame:%d, subframe:%d, tdd_mapping_mode:%d) harq_ack[0]:%d harq_ack[1]:%d\n", __FUNCTION__, uci->pucch_fmt,uci->rnti, frame, subframe, + tdd_mapping_mode,harq_ack[0],harq_ack[1]); + + switch (tdd_mapping_mode) { case 0: // bundling if (uci->pucch_fmt == pucch_format1a) { pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1; LOG_D(PHY,"bundling, pucch1a, number of ack nack %d\n",pdu->harq_indication_tdd_rel13.number_of_ack_nack); - AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); - pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0]; - // release all bundled DLSCH if needed - release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + packetError(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); + if (goodPacket) { + pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0]; + // release all bundled DLSCH if needed + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + } } else if (uci->pucch_fmt == pucch_format1b) { pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2; - AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n",harq_ack[0]); - AssertFatal(harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n",harq_ack[1]); - pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; - pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0]; - pdu->harq_indication_tdd_rel13.harq_data[1].bundling.value_0 = harq_ack[1]; - // release all DLSCH if needed - release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); - release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); + packetError(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n",harq_ack[0]); + packetError(harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n",harq_ack[1]); + if (goodPacket) { + pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; + pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0]; + pdu->harq_indication_tdd_rel13.harq_data[1].bundling.value_0 = harq_ack[1]; + // release all DLSCH if needed + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); + } } break; case 1: // multiplexing - AssertFatal (uci->pucch_fmt == pucch_format1b, "uci->pucch_format %d is not format1b\n", uci->pucch_fmt); - - if (uci->num_pucch_resources == 1 && uci->pucch_fmt == pucch_format1a) { - pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; - pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1; - AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); - pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0]; - // release all DLSCH if needed - release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + packetError (uci->pucch_fmt == pucch_format1b, "uci->pucch_format %d is not format1b\n", uci->pucch_fmt); + if (goodPacket) { + if (uci->num_pucch_resources == 1 && uci->pucch_fmt == pucch_format1a) { + pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; + pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1; + packetError(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); + if (goodPacket) { + pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0]; + // release all DLSCH if needed + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + } } else if (uci->num_pucch_resources == 1 && uci->pucch_fmt == pucch_format1b) { - pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; - pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2; - AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n",harq_ack[0]); - AssertFatal(harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n",harq_ack[1]); - pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0]; - pdu->harq_indication_tdd_rel13.harq_data[1].multiplex.value_0 = harq_ack[1]; - // release all DLSCH if needed - release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); - release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); + pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; + pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2; + packetError(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n",harq_ack[0]); + packetError(harq_ack[1] == 1 || harq_ack[1] == 2 || harq_ack[1] == 4, "harq_ack[1] is %d, should be 0,1 or 4\n",harq_ack[1]); + if (goodPacket) { + pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0]; + pdu->harq_indication_tdd_rel13.harq_data[1].multiplex.value_0 = harq_ack[1]; + // release all DLSCH if needed + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); + } } else { // num_pucch_resources (M) > 1 pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; pdu->harq_indication_tdd_rel13.number_of_ack_nack = uci->num_pucch_resources; @@ -2067,7 +2084,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in release_harq(eNB,DLSCH_id,1,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */); } - break; + break; case 2: // special bundling (SR collision) pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; @@ -2117,16 +2134,23 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in } else { pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 0; } - + break; } break; + } + } } } //TDD - - eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs++; - LOG_D(PHY,"Incremented eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs:%d\n", eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs); + + if (goodPacket) { + eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs++; + LOG_D(PHY,"Incremented eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs:%d\n", eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs); + } else { + LOG_W(PHY,"discarded a PUCCH because the decoded values are impossible\n"); + } + pthread_mutex_unlock(&eNB->UL_INFO_mutex); } diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 1ddf4b0d07794164cbe5b839e27845a3bf1b84ec..ee7f734ae2c8d35664fae8442cf36fd7e678ac07 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -198,7 +198,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq; NR_gNB_ULSCH_t *ulsch = rdata->ulsch; int r = rdata->segment_r; - nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[rdata->ulsch_id][0]->harq_processes[rdata->harq_pid]->ulsch_pdu; + nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[rdata->ulsch_id]->harq_processes[rdata->harq_pid]->ulsch_pdu; bool decodeSuccess = (rdata->decodeIterations <= rdata->decoderParms.numMaxIter); ulsch_harq->processedSegments++; @@ -303,7 +303,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH_id, uint8_t harq_pid) { NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; - nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[ULSCH_id][0]->harq_processes[harq_pid]->ulsch_pdu; + nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->ulsch_pdu; uint8_t l, number_dmrs_symbols = 0; uint32_t G; @@ -379,13 +379,13 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, pthread_mutex_lock(&gNB->UL_INFO_mutex); - NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0]; + NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id]; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid]; NR_gNB_SCH_STATS_t *stats=get_ulsch_stats(gNB,ulsch); nfapi_nr_pusch_pdu_t *pusch_pdu = &harq_process->ulsch_pdu; - // pdu->data = gNB->ulsch[ULSCH_id+1][0]->harq_processes[harq_pid]->b; + // pdu->data = gNB->ulsch[ULSCH_id+1]->harq_processes[harq_pid]->b; int sync_pos = nr_est_timing_advance_pusch(gNB, ULSCH_id); // estimate timing advance for MAC // scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size @@ -548,7 +548,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { } for (int ULSCH_id=0;ULSCH_id<gNB->number_of_nr_ulsch_max;ULSCH_id++) { - NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0]; + NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id]; int harq_pid; NR_UL_gNB_HARQ_t *ulsch_harq; if ((ulsch) && @@ -708,7 +708,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { } for (int ULSCH_id=0;ULSCH_id<gNB->number_of_nr_ulsch_max;ULSCH_id++) { - NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0]; + NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id]; int harq_pid; int no_sig; NR_UL_gNB_HARQ_t *ulsch_harq; diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h index c362bb470f4297456d5fbaa302aceedf8be825a6..eeea57ffc6125ddfd9af36ba9cb83a770f041d31 100644 --- a/openair1/SCHED_NR_UE/defs.h +++ b/openair1/SCHED_NR_UE/defs.h @@ -82,6 +82,11 @@ #define DAQ_AGC_OFF 0 +typedef struct { + uint8_t decoded_output[64]; + uint8_t xtra_byte; +} fapiPbch_t; + /** @addtogroup _PHY_PROCEDURES_ * @{ */ @@ -395,7 +400,8 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1, uint16_t n_pdus, - UE_nr_rxtx_proc_t *proc); + UE_nr_rxtx_proc_t *proc, + void * typeSpecific); bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 161b7d9918d0be7a9a07cd5028e1f41dcd3b764d..a206d1c6143229ffcd47c5d7d8dac1cf922cea8d 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -280,7 +280,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ thread_id = scheduled_response->thread_id; NR_UE_DLSCH_t *dlsch0 = NULL; NR_UE_PDCCH *pdcch_vars = PHY_vars_UE_g[module_id][cc_id]->pdcch_vars[thread_id][0]; - NR_UE_ULSCH_t *ulsch0 = PHY_vars_UE_g[module_id][cc_id]->ulsch[thread_id][0][0]; + NR_UE_ULSCH_t *ulsch = PHY_vars_UE_g[module_id][cc_id]->ulsch[thread_id][0]; NR_UE_PUCCH *pucch_vars = PHY_vars_UE_g[module_id][cc_id]->pucch_vars[thread_id][0]; if(scheduled_response->dl_config != NULL){ @@ -367,7 +367,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ // pusch config pdu pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu; current_harq_pid = pusch_config_pdu->pusch_data.harq_process_id; - NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch0->harq_processes[current_harq_pid]; + NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch->harq_processes[current_harq_pid]; if (harq_process_ul_ue){ @@ -375,7 +375,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ memcpy(pusch_pdu, pusch_config_pdu, sizeof(nfapi_nr_ue_pusch_pdu_t)); - ulsch0->f_pusch = pusch_config_pdu->absolute_delta_PUSCH; + ulsch->f_pusch = pusch_config_pdu->absolute_delta_PUSCH; if (scheduled_response->tx_request) { for (int j=0; j<scheduled_response->tx_request->number_of_pdus; j++) { diff --git a/openair1/SCHED_NR_UE/harq_nr.c b/openair1/SCHED_NR_UE/harq_nr.c index 4d92509d48e4985d31793b1eaf392c4a056d5742..4afe5f41d3b50a9611c2ffb9246ba59a39377038 100644 --- a/openair1/SCHED_NR_UE/harq_nr.c +++ b/openair1/SCHED_NR_UE/harq_nr.c @@ -123,7 +123,7 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, i memset(ulsch,0,sizeof(NR_UE_ULSCH_t)); - ue->ulsch[thread_id][gNB_id][code_word_idx] = ulsch; + ue->ulsch[thread_id][gNB_id] = ulsch; } else { LOG_E(PHY, "Fatal memory allocation problem at line %d in function %s of file %s \n", __LINE__ , __func__, __FILE__); @@ -148,7 +148,7 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, i } for (int slot_tx = 0; slot_tx < NR_MAX_SLOTS_PER_FRAME; slot_tx++) { - ue->ulsch[thread_id][gNB_id][code_word_idx]->harq_process_id[slot_tx] = NR_MAX_HARQ_PROCESSES; + ue->ulsch[thread_id][gNB_id]->harq_process_id[slot_tx] = NR_MAX_HARQ_PROCESSES; } } @@ -167,7 +167,7 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, i void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, int code_word_idx) { - NR_UE_ULSCH_t *ulsch = ue->ulsch[thread_id][gNB_id][code_word_idx]; + NR_UE_ULSCH_t *ulsch = ue->ulsch[thread_id][gNB_id]; for (int process_id = 0; process_id < ulsch->number_harq_processes_for_pusch; process_id++) { @@ -178,7 +178,7 @@ void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, free16(ulsch, sizeof(NR_UE_ULSCH_t)); - ue->ulsch[thread_id][gNB_id][code_word_idx] = NULL; + ue->ulsch[thread_id][gNB_id] = NULL; } /******************************************************************* diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 0d284de71c4541df679fa05b376e207cd1616138..ddddcd09e26c529149ecd4b71bbdfed21ad24af1 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -118,7 +118,8 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1, uint16_t n_pdus, - UE_nr_rxtx_proc_t *proc ){ + UE_nr_rxtx_proc_t *proc, + void * typeSpecific){ NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; @@ -162,8 +163,11 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.pdu_length = dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS / 8; break; case FAPI_NR_RX_PDU_TYPE_SSB: - rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.pdu = ue->pbch_vars[gNB_id]->decoded_output; - rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.additional_bits = ue->pbch_vars[gNB_id]->xtra_byte; + rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.pdu=malloc(sizeof(((fapiPbch_t*)typeSpecific)->decoded_output)); + memcpy(rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.pdu, + ((fapiPbch_t*)typeSpecific)->decoded_output, + sizeof(((fapiPbch_t*)typeSpecific)->decoded_output)); + rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.additional_bits = ((fapiPbch_t*)typeSpecific)->xtra_byte; rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_index = (frame_parms->ssb_index)&0x7; rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_length = frame_parms->Lmax; rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.cell_id = frame_parms->Nid_cell; @@ -285,8 +289,9 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, start_meas(&ue->phy_proc_tx); if (ue->UE_mode[gNB_id] <= PUSCH){ - for (uint8_t harq_pid = 0; harq_pid < ue->ulsch[proc->thread_id][gNB_id][0]->number_harq_processes_for_pusch; harq_pid++) { - if (ue->ulsch[proc->thread_id][gNB_id][0]->harq_processes[harq_pid]->status == ACTIVE) + + for (uint8_t harq_pid = 0; harq_pid < ue->ulsch[proc->thread_id][gNB_id]->number_harq_processes_for_pusch; harq_pid++) { + if (ue->ulsch[proc->thread_id][gNB_id]->harq_processes[harq_pid]->status == ACTIVE) nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, proc->thread_id, gNB_id); } } @@ -353,10 +358,9 @@ void nr_ue_measurement_procedures(uint16_t l, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_OUT); } -void nr_ue_pbch_procedures(uint8_t gNB_id, +static void nr_ue_pbch_procedures(uint8_t gNB_id, PHY_VARS_NR_UE *ue, - UE_nr_rxtx_proc_t *proc, - uint8_t abstraction_flag) + UE_nr_rxtx_proc_t *proc,int estimateSz, struct complex16 dl_ch_estimates[][estimateSz]) { int ret = 0; @@ -368,13 +372,15 @@ void nr_ue_pbch_procedures(uint8_t gNB_id, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_IN); LOG_D(PHY,"[UE %d] Frame %d Slot %d, Trying PBCH (NidCell %d, gNB_id %d)\n",ue->Mod_id,frame_rx,nr_slot_rx,ue->frame_parms.Nid_cell,gNB_id); - + fapiPbch_t result; ret = nr_rx_pbch(ue, proc, + estimateSz, dl_ch_estimates, ue->pbch_vars[gNB_id], &ue->frame_parms, gNB_id, (ue->frame_parms.ssb_index)&7, - SISO); + SISO, + &result); if (ret==0) { @@ -444,7 +450,6 @@ void nr_ue_pbch_procedures(uint8_t gNB_id, } if (frame_rx % 100 == 0) { - ue->pbch_vars[gNB_id]->pdu_fer = ue->pbch_vars[gNB_id]->pdu_errors - ue->pbch_vars[gNB_id]->pdu_errors_last; ue->pbch_vars[gNB_id]->pdu_errors_last = ue->pbch_vars[gNB_id]->pdu_errors; } @@ -795,16 +800,16 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, switch (pdsch) { case RA_PDSCH: nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id); - nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_RAR, gNB_id, ue, dlsch0, NULL, number_pdus, proc); + nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_RAR, gNB_id, ue, dlsch0, NULL, number_pdus, proc, NULL); ue->UE_mode[gNB_id] = RA_RESPONSE; break; case PDSCH: nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id); - nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_DLSCH, gNB_id, ue, dlsch0, NULL, number_pdus, proc); + nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_DLSCH, gNB_id, ue, dlsch0, NULL, number_pdus, proc, NULL); break; case SI_PDSCH: nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id); - nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_SIB, gNB_id, ue, dlsch0, NULL, number_pdus, proc); + nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_SIB, gNB_id, ue, dlsch0, NULL, number_pdus, proc, NULL); break; default: break; @@ -1400,6 +1405,9 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, if (slot_ssb) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_IN); LOG_D(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); + const int estimateSz=7*2*sizeof(int)*fp->ofdm_symbol_size; + __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[fp->nb_antennas_rx][estimateSz]; + __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[fp->nb_antennas_rx][estimateSz]; for (int i=1; i<4; i++) { nr_slot_fep(ue, @@ -1409,7 +1417,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, start_meas(&ue->dlsch_channel_estimation_stats); - nr_pbch_channel_estimation(ue,proc,gNB_id,nr_slot_rx,(ue->symbol_offset+i)%(fp->symbols_per_slot),i-1,(fp->ssb_index)&7,fp->half_frame_bit); + nr_pbch_channel_estimation(ue, estimateSz, dl_ch_estimates, dl_ch_estimates_time,proc,gNB_id,nr_slot_rx,(ue->symbol_offset+i)%(fp->symbols_per_slot),i-1,(fp->ssb_index)&7,fp->half_frame_bit); stop_meas(&ue->dlsch_channel_estimation_stats); } @@ -1418,13 +1426,14 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, if ((ue->decode_MIB == 1) && slot_pbch) { LOG_D(PHY," ------ Decode MIB: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); - nr_ue_pbch_procedures(gNB_id, ue, proc, 0); + nr_ue_pbch_procedures(gNB_id, ue, proc, estimateSz, dl_ch_estimates); if (ue->no_timing_correction==0) { LOG_D(PHY,"start adjust sync slot = %d no timing %d\n", nr_slot_rx, ue->no_timing_correction); nr_adjust_synch_ue(fp, ue, gNB_id, + estimateSz, dl_ch_estimates_time, frame_rx, nr_slot_rx, 0, @@ -1619,13 +1628,17 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, start_meas(&ue->dlsch_procedures_stat[proc->thread_id]); + NR_UE_DLSCH_t *dlsch1 = NULL; + if (NR_MAX_NB_LAYERS>4) + dlsch1 = ue->dlsch[proc->thread_id][gNB_id][1]; + if (ret_pdsch >= 0) nr_ue_dlsch_procedures(ue, proc, gNB_id, PDSCH, ue->dlsch[proc->thread_id][gNB_id][0], - ue->dlsch[proc->thread_id][gNB_id][1], + dlsch1, &ue->dlsch_errors[gNB_id]); stop_meas(&ue->dlsch_procedures_stat[proc->thread_id]); diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index f3aae9a3f7b452cbbd034e1d649e6680a875ce8e..d6812dd541164c3fd056b75bb28561ffba9488d4 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -395,19 +395,6 @@ int main(int argc, char **argv) load_pbch_desc(pbch_file_fd); } - /* for (int k=0; k<2; k++) { - // Create transport channel structures for 2 transport blocks (MIMO) - for (i=0; i<2; i++) { - gNB->dlsch[k][i] = new_gNB_dlsch(Kmimo,8,Nsoft,0,frame_parms,gNB_config); - - if (!gNB->dlsch[k][i]) { - printf("Can't get eNB dlsch structures\n"); - exit(-1); - } - gNB->dlsch[k][i]->Nsoft = 10; - gNB->dlsch[k][i]->rnti = n_rnti+k; - } - }*/ //configure UE UE = malloc(sizeof(PHY_VARS_NR_UE)); memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS)); @@ -420,10 +407,10 @@ int main(int argc, char **argv) //nr_init_frame_parms_ue(&UE->frame_parms); //init_nr_ue_transport(UE, 0); + int num_codeword = NR_MAX_NB_LAYERS > 4? 2:1; for (int sf = 0; sf < 2; sf++) { - for (i = 0; i < 2; i++) { + for (i = 0; i < num_codeword; i++) { UE->dlsch[sf][0][i] = new_nr_ue_dlsch(Kmimo, 8, Nsoft, 5, N_RB_DL); - if (!UE->dlsch[sf][0][i]) { printf("Can't get ue dlsch structures\n"); exit(-1); @@ -434,8 +421,8 @@ int main(int argc, char **argv) } unsigned char harq_pid = 0; //dlsch->harq_ids[subframe]; - processingData_L1tx_t msgDataTx; - init_DLSCH_struct(gNB, &msgDataTx); + processingData_L1tx_t msgDataTx; + init_DLSCH_struct(gNB, &msgDataTx); NR_gNB_DLSCH_t *dlsch = msgDataTx.dlsch[0][0]; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15; //time_stats_t *rm_stats, *te_stats, *i_stats; @@ -642,8 +629,9 @@ int main(int argc, char **argv) free(RC.gNB[0]); free(RC.gNB); + int num_cw = NR_MAX_NB_LAYERS > 4? 2:1; for (int sf = 0; sf < 2; sf++) - for (int i = 0; i < 2; i++) + for (int i = 0; i < num_cw; i++) free_nr_ue_dlsch(&UE->dlsch[sf][0][i], N_RB_DL); term_nr_ue_signal(UE, 1); free(UE); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 0c27ca5974f0472cd8c90a2c2f7c0458def0cf3c..62d63a536a47cf0ad31d2ab27896e30f636c2909 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -655,7 +655,7 @@ int main(int argc, char **argv) printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", argv[0]); printf("-h This message\n"); - printf("-L <log level, 0(errors), 1(warning), 2(info) 3(debug) 4 (trace)>\n"); + printf("-L <log level, 0(errors), 1(warning), 2(analysis), 3(info), 4(debug), 5(trace)>\n"); //printf("-p Use extended prefix mode\n"); //printf("-d Use TDD\n"); printf("-n Number of frames to simulate\n"); @@ -1117,7 +1117,7 @@ int main(int argc, char **argv) pdsch_pdu_rel15->dlDmrsSymbPos); ptrsSymbPerSlot = get_ptrs_symbols_in_slot(dlPtrsSymPos, pdsch_pdu_rel15->StartSymbolIndex, pdsch_pdu_rel15->NrOfSymbols); ptrsRePerSymb = ((rel15->rbSize + rel15->PTRSFreqDensity - 1)/rel15->PTRSFreqDensity); - printf("[DLSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot,ptrsRePerSymb, ptrsSymbPerSlot*ptrsRePerSymb ); + LOG_D(PHY,"[DLSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot,ptrsRePerSymb, ptrsSymbPerSlot*ptrsRePerSymb ); } msgDataTx->ssb[0].ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234; @@ -1274,7 +1274,7 @@ int main(int argc, char **argv) available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, rel15->nrOfLayers); if(pdu_bit_map & 0x1) { available_bits-= (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2); - printf("[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2) ); + LOG_D(PHY,"[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2) ); } /* @@ -1331,7 +1331,8 @@ int main(int argc, char **argv) printf("*****************************************\n"); printf("\n"); dump_pdsch_stats(stdout,gNB); - printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, BLER %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],berStats[snrRun],blerStats[snrRun],effRate,effRate/TBS*100,TBS); + printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, BLER %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", + SNR, n_errors, n_trials,roundStats[snrRun],berStats[snrRun],blerStats[snrRun],effRate,effRate/TBS*100,TBS); printf("\n"); if (print_perf==1) { diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c index 7a47410129f2f78f43df8f9b597675a7c6217e78..351c2f33c47a74a94e8276201289767a47b67973 100644 --- a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c +++ b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c @@ -1,5 +1,6 @@ #include "nfapi/oai_integration/vendor_ext.h" + int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0); } int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); } int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); } @@ -35,4 +36,5 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1, uint16_t n_pdus, - UE_nr_rxtx_proc_t *proc) {} + UE_nr_rxtx_proc_t *proc, + void * typeSpecific ) {} diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index f3a8d21fdde53172148dd76f40b2d0926b43b3e9..8fc6410538a25f57c55fc6b70cb60dc1c065fd13 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -438,6 +438,7 @@ int main(int argc, char **argv) printf("Initializing gNodeB for mu %d, N_RB_DL %d\n",mu,N_RB_DL); + RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *)); RC.gNB[0] = malloc16_clear(sizeof(*(RC.gNB[0]))); gNB = RC.gNB[0]; @@ -531,13 +532,13 @@ int main(int argc, char **argv) s_im = malloc(2*sizeof(double*)); r_re = malloc(2*sizeof(double*)); r_im = malloc(2*sizeof(double*)); - txdata = malloc(2*sizeof(int*)); + txdata = calloc(2,sizeof(int*)); for (i=0; i<2; i++) { + s_re[i] = malloc16_clear(frame_length_complex_samples*sizeof(double)); s_im[i] = malloc16_clear(frame_length_complex_samples*sizeof(double)); - r_re[i] = malloc16_clear(frame_length_complex_samples*sizeof(double)); r_im[i] = malloc16_clear(frame_length_complex_samples*sizeof(double)); printf("Allocating %d samples for txdata\n",frame_length_complex_samples); @@ -550,6 +551,7 @@ int main(int argc, char **argv) //configure UE + UE = malloc16_clear(sizeof(*UE)); memcpy(&UE->frame_parms,frame_parms,sizeof(UE->frame_parms)); //phy_init_nr_top(UE); //called from init_nr_ue_signal @@ -722,6 +724,9 @@ int main(int argc, char **argv) UE_nr_rxtx_proc_t proc={0}; UE->rx_offset=0; uint8_t ssb_index = 0; + const int estimateSz=7*2*sizeof(int)*frame_parms->ofdm_symbol_size; + __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[frame_parms->nb_antennas_rx][estimateSz]; + __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[frame_parms->nb_antennas_rx][estimateSz]; while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms,ssb_index); @@ -732,17 +737,20 @@ int main(int argc, char **argv) i%frame_parms->symbols_per_slot, ssb_slot); - nr_pbch_channel_estimation(UE,&proc,0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf); + nr_pbch_channel_estimation(UE,estimateSz, dl_ch_estimates, dl_ch_estimates_time, &proc, + 0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf); } - + fapiPbch_t result; ret = nr_rx_pbch(UE, &proc, - UE->pbch_vars[0], + estimateSz, dl_ch_estimates, + UE->pbch_vars[0], frame_parms, 0, ssb_index%8, - SISO); + SISO, + &result); if (ret==0) { //UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically @@ -751,9 +759,9 @@ int main(int argc, char **argv) for (int i=0; i<8; i++) gNB_xtra_byte |= ((gNB->pbch.pbch_a>>(31-i))&1)<<(7-i); - payload_ret = (UE->pbch_vars[0]->xtra_byte == gNB_xtra_byte); + payload_ret = (result.xtra_byte == gNB_xtra_byte); for (i=0;i<3;i++){ - payload_ret += (UE->pbch_vars[0]->decoded_output[i] == ((msgDataTx.ssb[ssb_index].ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff)); + payload_ret += (result.decoded_output[i] == ((msgDataTx.ssb[ssb_index].ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff)); } //printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->pbch_vars[0]->xtra_byte); //printf("ret %d\n", payload_ret); diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 6cdf0b90cd65b030b4519c75386669464495922c..f6227e17697d15e5ec761294b82039caf2bd0a93 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -407,15 +407,10 @@ int main(int argc, char **argv) } for (sf = 0; sf < 2; sf++) { - for (i = 0; i < 2; i++) { - - UE->ulsch[sf][0][i] = new_nr_ue_ulsch(N_RB_UL, 8); - - if (!UE->ulsch[sf][0][i]) { - printf("Can't get ue ulsch structures.\n"); - exit(-1); - } - + UE->ulsch[sf][0] = new_nr_ue_ulsch(N_RB_UL, 8); + if (!UE->ulsch[sf][0]) { + printf("Can't get ue ulsch structures.\n"); + exit(-1); } } @@ -431,11 +426,11 @@ int main(int argc, char **argv) uint8_t rvidx = 0; uint8_t UE_id = 0; - NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0]; + NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id]; NR_UL_gNB_HARQ_t *harq_process_gNB = ulsch_gNB->harq_processes[harq_pid]; nfapi_nr_pusch_pdu_t *rel15_ul = &harq_process_gNB->ulsch_pdu; - NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0][0][0]; + NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0][0]; mod_order = nr_get_Qm_ul(Imcs, 0); code_rate = nr_get_code_rate_ul(Imcs, 0); @@ -525,7 +520,7 @@ int main(int argc, char **argv) } */ - if (ulsch_ue->g[i] == 0) + if (ulsch_ue->harq_processes[harq_pid]->f[i] == 0) modulated_input[i] = 1.0; ///sqrt(2); //QPSK else modulated_input[i] = -1.0; ///sqrt(2); @@ -615,8 +610,7 @@ int main(int argc, char **argv) } for (sf = 0; sf < 2; sf++) - for (i = 0; i < 2; i++) - free_nr_ue_ulsch(&UE->ulsch[sf][0][i], N_RB_UL); + free_nr_ue_ulsch(&UE->ulsch[sf][0], N_RB_UL); term_nr_ue_signal(UE, 1); free(UE); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 16e406794a02bd0349878a7fddda7825d9636278..1791d5e9b18df2497306e4f15044c7a86916e1ed 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -822,7 +822,7 @@ int main(int argc, char **argv) unsigned char harq_pid = 0; - NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0]; + NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id]; //nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_processes[harq_pid]->ulsch_pdu; nfapi_nr_ul_tti_request_t *UL_tti_req = malloc(sizeof(*UL_tti_req)); NR_Sched_Rsp_t *Sched_INFO = malloc(sizeof(*Sched_INFO)); @@ -831,7 +831,7 @@ int main(int argc, char **argv) nfapi_nr_pusch_pdu_t *pusch_pdu = &UL_tti_req->pdus_list[0].pusch_pdu; - NR_UE_ULSCH_t **ulsch_ue = UE->ulsch[0][0]; + NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0][0]; unsigned char *estimated_output_bit; unsigned char *test_input_bit; @@ -1070,8 +1070,8 @@ int main(int argc, char **argv) memset((void*)roundStats,0,50*sizeof(roundStats[0])); while (round<max_rounds && crc_status) { round_trials[round][snrRun]++; - ulsch_ue[0]->harq_processes[harq_pid]->round = round; - gNB->ulsch[0][0]->harq_processes[harq_pid]->round = round; + ulsch_ue->harq_processes[harq_pid]->round = round; + gNB->ulsch[0]->harq_processes[harq_pid]->round = round; rv_index = nr_rv_round_map[round]; UE_proc.thread_id = 0; @@ -1212,7 +1212,7 @@ int main(int argc, char **argv) //nr_fill_ulsch(gNB,frame,slot,pusch_pdu); // Not needed as its its already filled as apart of "nr_schedule_response(Sched_INFO);" - for (int i=0;i<(TBS/8);i++) ulsch_ue[0]->harq_processes[harq_pid]->a[i]=i&0xff; + for (int i=0;i<(TBS/8);i++) ulsch_ue->harq_processes[harq_pid]->a[i]=i&0xff; if (input_fd == NULL) { // set FAPI parameters for UE, put them in the scheduled response and call @@ -1387,8 +1387,8 @@ int main(int argc, char **argv) } //////////////////////////////////////////////////////////// - if ((gNB->ulsch[0][0]->last_iteration_cnt >= - gNB->ulsch[0][0]->max_ldpc_iterations+1) || ul_proc_error == 1) { + if ((gNB->ulsch[0]->last_iteration_cnt >= + gNB->ulsch[0]->max_ldpc_iterations+1) || ul_proc_error == 1) { error_flag = 1; n_errors[round][snrRun]++; crc_status = 1; @@ -1413,8 +1413,8 @@ int main(int argc, char **argv) for (i = 0; i < available_bits; i++) { - if(((ulsch_ue[0]->g[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0)) || - ((ulsch_ue[0]->g[i] == 1) && (gNB->pusch_vars[UE_id]->llr[i] >= 0))) + if(((ulsch_ue->harq_processes[harq_pid]->f[i] == 0) && (gNB->pusch_vars[UE_id]->llr[i] <= 0)) || + ((ulsch_ue->harq_processes[harq_pid]->f[i] == 1) && (gNB->pusch_vars[UE_id]->llr[i] >= 0))) { /*if(errors_scrambling == 0) printf("\x1B[34m" "[frame %d][trial %d]\t1st bit in error in unscrambling = %d\n" "\x1B[0m", frame, trial, i);*/ @@ -1432,7 +1432,7 @@ int main(int argc, char **argv) for (i = 0; i < TBS; i++) { estimated_output_bit[i] = (ulsch_gNB->harq_processes[harq_pid]->b[i/8] & (1 << (i & 7))) >> (i & 7); - test_input_bit[i] = (ulsch_ue[0]->harq_processes[harq_pid]->b[i/8] & (1 << (i & 7))) >> (i & 7); + test_input_bit[i] = (ulsch_ue->harq_processes[harq_pid]->b[i/8] & (1 << (i & 7))) >> (i & 7); if (estimated_output_bit[i] != test_input_bit[i]) { /*if(errors_decoding == 0) @@ -1441,13 +1441,13 @@ int main(int argc, char **argv) } } if (n_trials == 1) { - for (int r=0;r<ulsch_ue[0]->harq_processes[harq_pid]->C;r++) - for (int i=0;i<ulsch_ue[0]->harq_processes[harq_pid]->K>>3;i++) { - if ((ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************"); + for (int r=0;r<ulsch_ue->harq_processes[harq_pid]->C;r++) + for (int i=0;i<ulsch_ue->harq_processes[harq_pid]->K>>3;i++) { + if ((ulsch_ue->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************"); /*printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r, - i,ulsch_ue[0]->harq_processes[harq_pid]->c[r][i], + i,ulsch_ue->harq_processes[harq_pid]->c[r][i], i,ulsch_gNB->harq_processes[harq_pid]->c[r][i], - ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);*/ + ulsch_ue->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);*/ } } if (errors_decoding > 0 && error_flag == 0) { diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index f532f9e74a5287efcaa840ed520ec7e3fc6c3d2f..e20d93b74c611236420b9df653bcf1a9c2e2f401 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -632,15 +632,18 @@ void RCconfig_NR_L1(void) { config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr; if (ulprbbl) LOG_I(NR_PHY,"PRB blacklist %s\n",ulprbbl); - char *pt = strtok(ulprbbl,","); + char *save = NULL; + char *pt = strtok_r(ulprbbl, ",", &save); int prbbl[275]; int num_prbbl=0; memset(prbbl,0,275*sizeof(int)); while (pt) { - prbbl[atoi(pt)] = 1; + const int rb = atoi(pt); + AssertFatal(rb < 275, "RB %d out of bounds (max 275)\n", rb); + prbbl[rb] = 0x3FFF; // all symbols taken LOG_I(NR_PHY,"Blacklisting prb %d\n",atoi(pt)); - pt = strtok(NULL,","); + pt = strtok_r(NULL, ",", &save); num_prbbl++; } @@ -744,15 +747,16 @@ void RCconfig_nr_macrlc() { config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr; - char *pt = strtok(ulprbbl,","); - int prbbl[275]; + char *save = NULL; + char *pt = strtok_r(ulprbbl, ",", &save); + uint16_t prbbl[275]; int num_prbbl=0; - int prb; - memset(prbbl,0,275*sizeof(int)); + memset(prbbl,0,sizeof(prbbl)); while (pt) { - prb=atoi(pt); - prbbl[prb] = 1; - pt = strtok(NULL,","); + const int prb = atoi(pt); + AssertFatal(prb < 275, "RB %d out of bounds (max 275)\n", prb); + prbbl[prb] = 0x3FFF; // all symbols taken + pt = strtok_r(NULL, ",", &save); num_prbbl++; } @@ -1466,7 +1470,8 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) { // NGAP_REGISTER_GNB_REQ (msg_p).enb_interface_name_for_NGU = strdup(enb_interface_name_for_NGU); cidr = *(NETParams[GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX].strptr); - address = strtok(cidr, "/"); + char *save = NULL; + address = strtok_r(cidr, "/", &save); NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv6 = 0; NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv4 = 1; @@ -1738,7 +1743,8 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { } cidr = *(NETParams[ENB_IPV4_ADDR_FOR_X2C_IDX].strptr); - address = strtok(cidr, "/"); + char *save = NULL; + address = strtok_r(cidr, "/", &save); X2AP_REGISTER_ENB_REQ (msg_p).enb_x2_ip_address.ipv6 = 0; X2AP_REGISTER_ENB_REQ (msg_p).enb_x2_ip_address.ipv4 = 1; strcpy(X2AP_REGISTER_ENB_REQ (msg_p).enb_x2_ip_address.ipv4_address, address); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 51541353f41377faeb9fa135428ce32f67443dca..540198a22a228f84e118dd8a1ac6391df7e10574 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -318,7 +318,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; const int last_slot = (slot + num_slots - 1) % num_slots; uint16_t *vrb_map_UL = cc[CC_id].vrb_map_UL; - memset(&vrb_map_UL[last_slot * MAX_BWP_SIZE], 0, sizeof(uint16_t) * MAX_BWP_SIZE); + memcpy(&vrb_map_UL[last_slot * MAX_BWP_SIZE], &RC.nrmac[module_idP]->ulprbbl, sizeof(uint16_t) * MAX_BWP_SIZE); clear_nr_nfapi_information(RC.nrmac[module_idP], CC_id, frame, slot); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index a10845a6abe52ccc57ffe25703b3920dba770258..f36dbc4a1622f4a041bb39c4e8e3a12546231db4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -389,7 +389,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP const int16_t N_RA_RB = get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing.value, mu_pusch); uint16_t *vrb_map_UL = &cc->vrb_map_UL[slotP * MAX_BWP_SIZE]; for (int i = 0; i < N_RA_RB * fdm; ++i) - vrb_map_UL[bwp_start + rach_ConfigGeneric->msg1_FrequencyStart + i] = 0xff; // all symbols + vrb_map_UL[bwp_start + rach_ConfigGeneric->msg1_FrequencyStart + i] = SL_to_bitmap(start_symbol, N_t_slot*N_dur); } } } @@ -772,6 +772,8 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t int scs = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; int fh = 0; int startSymbolAndLength = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->startSymbolAndLength; + int StartSymbolIndex, NrOfSymbols; + SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols); int mappingtype = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->mappingType; uint16_t *vrb_map_UL = &RC.nrmac[module_idP]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; @@ -780,7 +782,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t int BWPSize = nr_mac->type0_PDCCH_CSS_config[ra->beam_id].num_rbs; int rbStart = 0; for (int i = 0; (i < ra->msg3_nb_rb) && (rbStart <= (BWPSize - ra->msg3_nb_rb)); i++) { - if (vrb_map_UL[rbStart + BWPStart + i]) { + if (vrb_map_UL[rbStart + BWPStart + i]&SL_to_bitmap(StartSymbolIndex, NrOfSymbols)) { rbStart += i; i = 0; } @@ -898,7 +900,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t aggregation_level); for (int rb = 0; rb < ra->msg3_nb_rb; rb++) { - vrb_map_UL[rbStart + BWPStart + rb] = 1; + vrb_map_UL[rbStart + BWPStart + rb] |= SL_to_bitmap(StartSymbolIndex, NrOfSymbols); } // reset state to wait msg3 @@ -928,6 +930,9 @@ void nr_get_Msg3alloc(module_id_t module_id, int mu = ubwp ? ubwp->bwp_Common->genericParameters.subcarrierSpacing : scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; + int StartSymbolIndex = 0; + int NrOfSymbols = 0; + int startSymbolAndLength = 0; int temp_slot = 0; ra->Msg3_tda_id = 16; // initialization to a value above limit @@ -942,6 +947,8 @@ void nr_get_Msg3alloc(module_id_t module_id, int nb_periods_per_frame = get_nb_periods_per_frame(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity); int nb_slots_per_period = ((1<<mu)*10)/nb_periods_per_frame; for (int i=0; i<pusch_TimeDomainAllocationList->list.count; i++) { + startSymbolAndLength = pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols); k2 = *pusch_TimeDomainAllocationList->list.array[i]->k2; // we want to transmit in the uplink symbols of mixed slot if ((k2 + DELTA[mu])%nb_slots_per_period == 0) { @@ -949,6 +956,8 @@ void nr_get_Msg3alloc(module_id_t module_id, ra->Msg3_slot = temp_slot%nr_slots_per_frame[mu]; if (is_xlsch_in_slot(RC.nrmac[module_id]->ulsch_slot_bitmap[ra->Msg3_slot / 64], ra->Msg3_slot)) { ra->Msg3_tda_id = i; + ra->msg3_startsymb = StartSymbolIndex; + ra->msg3_nrsymb = NrOfSymbols; break; } } @@ -1002,11 +1011,12 @@ void nr_get_Msg3alloc(module_id_t module_id, while (rbSize < msg3_nb_rb) { rbStart += rbSize; /* last iteration rbSize was not enough, skip it */ rbSize = 0; - while (rbStart < bwpSize && vrb_map_UL[rbStart + bwpStart]) + while (rbStart < bwpSize && + (vrb_map_UL[rbStart + bwpStart]&SL_to_bitmap(StartSymbolIndex, NrOfSymbols))) rbStart++; AssertFatal(rbStart < bwpSize - msg3_nb_rb, "no space to allocate Msg 3 for RA!\n"); while (rbStart + rbSize < bwpSize - && !vrb_map_UL[rbStart + bwpStart + rbSize] + && !(vrb_map_UL[rbStart + bwpStart + rbSize]&SL_to_bitmap(StartSymbolIndex, NrOfSymbols)) && rbSize < msg3_nb_rb) rbSize++; } @@ -1113,7 +1123,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t i + ra->msg3_first_rb, ra->Msg3_frame, ra->Msg3_slot); - vrb_map_UL[i + ra->msg3_first_rb + ra->msg3_bwp_start] = 1; + vrb_map_UL[i + ra->msg3_first_rb + ra->msg3_bwp_start] |= SL_to_bitmap(ra->msg3_startsymb, ra->msg3_nrsymb); } LOG_D(NR_MAC, "[gNB %d][RAPROC] Frame %d, Slot %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 7d16a4ee01d295ff28a34adae41210b001c02456..cddeb364d519e666cd9e9bbd3c72de38d224e2ef 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -640,7 +640,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; // Data to be transmitted - bzero(tx_req->TLVs[0].value.direct,MAX_NR_DLSCH_PAYLOAD_BYTES); + bzero(tx_req->TLVs[0].value.direct,MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*1056); memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length); tx_req->PDU_length = TBS; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index f366b2c4f9ea8f4b60dc03476dbb1b8b82348dc8..5032ee601f0a82e9722268f462243c9398a22ca0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -691,7 +691,7 @@ bool allocate_dl_retransmission(module_id_t module_id, /* retransmissions: directly allocate */ *n_rb_sched -= sched_ctrl->sched_pdsch.rbSize; for (int rb = 0; rb < sched_ctrl->sched_pdsch.rbSize; rb++) - rballoc_mask[rb + sched_ctrl->sched_pdsch.rbStart] -= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); + rballoc_mask[rb + sched_ctrl->sched_pdsch.rbStart] ^= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); return true; } @@ -910,7 +910,7 @@ void pf_dl(module_id_t module_id, /* transmissions: directly allocate */ n_rb_sched -= sched_pdsch->rbSize; for (int rb = 0; rb < sched_pdsch->rbSize; rb++) - rballoc_mask[rb + sched_pdsch->rbStart] -= slbitmap; + rballoc_mask[rb + sched_pdsch->rbStart] ^= slbitmap; } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index fddf084a388ef4fc7245dc82ef410044eb3ac117..7866cc49156bea72c93c869a4d6b6f491793f37c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -55,8 +55,6 @@ extern RAN_CONTEXT_t RC; //#define ENABLE_MAC_PAYLOAD_DEBUG 1 -//uint8_t mac_pdu[MAX_NR_DLSCH_PAYLOAD_BYTES]; - /*Scheduling of DLSCH with associated DCI in common search space * current version has only a DCI for type 1 PDCCH for C_RNTI*/ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, @@ -481,9 +479,8 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; - const uint16_t symb = ((1 << ps->nrOfSymbols) - 1) << ps->startSymbolIndex; for (int i = rbStart; i < rbStart + rbSize; ++i) { - if ((vrb_map_UL[i+BWPStart] & symb) != 0) { + if ((vrb_map_UL[i+BWPStart] & SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols)) != 0) { LOG_E(MAC, "%s(): %4d.%2d RB %d is already reserved, cannot schedule UE\n", __func__, @@ -561,6 +558,6 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ sched_ctrl->aggregation_level); for (int rb = rbStart; rb < rbStart + rbSize; rb++) - vrb_map_UL[rb+BWPStart] = 1; + vrb_map_UL[rb+BWPStart] |= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); return true; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 4d05320e64f319855d2f7be4cbe2e1a4ddb84487..ac0b186218baa360fdf03e7dfed14161fcfd926b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1235,23 +1235,26 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, else { // this is the default PUCCH configuration, PUCCH format 0 or 1 LOG_D(NR_MAC,"pucch_acknak: Filling default PUCCH configuration from Tables (r_pucch %d, bwp %p)\n",r_pucch,bwp); int rsetindex = *scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon; - int prboffset = r_pucch/default_pucch_csset[rsetindex]; - int prboffsetm8 = (r_pucch-8)/default_pucch_csset[rsetindex]; - pucch_pdu->prb_start = (r_pucch>>3)==0 ? - default_pucch_prboffset[rsetindex] + prboffset: - pucch_pdu->bwp_size-1-default_pucch_prboffset[rsetindex]-prboffsetm8; + int prb_start, second_hop_prb, nr_of_symb, start_symb; + set_r_pucch_parms(rsetindex, + r_pucch, + pucch_pdu->bwp_size, + &prb_start, + &second_hop_prb, + &nr_of_symb, + &start_symb); + + pucch_pdu->prb_start = prb_start; pucch_pdu->rnti = rnti; pucch_pdu->freq_hop_flag = 1; - pucch_pdu->second_hop_prb = (r_pucch>>3)==0? - pucch_pdu->bwp_size-1-default_pucch_prboffset[rsetindex]-prboffset: - default_pucch_prboffset[rsetindex] + prboffsetm8; + pucch_pdu->second_hop_prb = second_hop_prb; pucch_pdu->format_type = default_pucch_fmt[rsetindex]; pucch_pdu->initial_cyclic_shift = r_pucch%default_pucch_csset[rsetindex]; if (rsetindex==3||rsetindex==7||rsetindex==11) pucch_pdu->initial_cyclic_shift*=6; else if (rsetindex==1||rsetindex==2) pucch_pdu->initial_cyclic_shift*=3; else pucch_pdu->initial_cyclic_shift*=4; - pucch_pdu->nr_of_symbols = default_pucch_numbsymb[rsetindex]; - pucch_pdu->start_symbol_index = default_pucch_firstsymb[rsetindex]; + pucch_pdu->nr_of_symbols = nr_of_symb; + pucch_pdu->start_symbol_index = start_symb; if (pucch_pdu->format_type == 1) pucch_pdu->time_domain_occ_idx = 0; // check this!! pucch_pdu->sr_flag = O_sr; pucch_pdu->prb_size=1; @@ -1259,6 +1262,32 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, } +void set_r_pucch_parms(int rsetindex, + int r_pucch, + int bwp_size, + int *prb_start, + int *second_hop_prb, + int *nr_of_symbols, + int *start_symbol_index) { + + // procedure described in 38.213 section 9.2.1 + + int prboffset = r_pucch/default_pucch_csset[rsetindex]; + int prboffsetm8 = (r_pucch-8)/default_pucch_csset[rsetindex]; + + *prb_start = (r_pucch>>3)==0 ? + default_pucch_prboffset[rsetindex] + prboffset: + bwp_size-1-default_pucch_prboffset[rsetindex]-prboffsetm8; + + *second_hop_prb = (r_pucch>>3)==0? + bwp_size-1-default_pucch_prboffset[rsetindex]-prboffset: + default_pucch_prboffset[rsetindex] + prboffsetm8; + + *nr_of_symbols = default_pucch_numbsymb[rsetindex]; + *start_symbol_index = default_pucch_firstsymb[rsetindex]; +} + + void prepare_dci(const NR_CellGroupConfig_t *CellGroup, dci_pdu_rel15_t *dci_pdu_rel15, nr_dci_format_t format, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index cfff41a6adf7fd758868fc2d12b6550a459794d8..cedc78097e0622a560931af53bd10e6c4d4a4389 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -79,7 +79,9 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, NR_BWP_UplinkDedicated_t *ubwpd; ubwpd = cg ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP:NULL; - LOG_D(NR_MAC,"pucch_acknak: %d.%d Calling nr_configure_pucch (ubwpd %p,r_pucch %d) pucch in %d.%d\n",frame,slot,ubwpd,pucch->r_pucch,pucch->frame,pucch->ul_slot); + LOG_D(NR_MAC,"%d.%d Calling nr_configure_pucch (ubwpd %p,r_pucch %d) pucch to be scheduled in %d.%d\n", + frame,slot,ubwpd,pucch->r_pucch,pucch->frame,pucch->ul_slot); + nr_configure_pucch(pucch_pdu, scc, UE_info->CellGroup[UE_id], @@ -758,16 +760,16 @@ void nr_csi_meas_reporting(int Mod_idP, switch(pucchres->format.present){ case NR_PUCCH_Resource__format_PR_format2: len = pucchres->format.choice.format2->nrofPRBs; - mask = ((1 << pucchres->format.choice.format2->nrofSymbols) - 1) << pucchres->format.choice.format2->startingSymbolIndex; + mask = SL_to_bitmap(pucchres->format.choice.format2->startingSymbolIndex, pucchres->format.choice.format2->nrofSymbols); curr_pucch->simultaneous_harqcsi = pucch_Config->format2->choice.setup->simultaneousHARQ_ACK_CSI; break; case NR_PUCCH_Resource__format_PR_format3: len = pucchres->format.choice.format3->nrofPRBs; - mask = ((1 << pucchres->format.choice.format3->nrofSymbols) - 1) << pucchres->format.choice.format3->startingSymbolIndex; + mask = SL_to_bitmap(pucchres->format.choice.format3->startingSymbolIndex, pucchres->format.choice.format3->nrofSymbols); curr_pucch->simultaneous_harqcsi = pucch_Config->format3->choice.setup->simultaneousHARQ_ACK_CSI; break; case NR_PUCCH_Resource__format_PR_format4: - mask = ((1 << pucchres->format.choice.format4->nrofSymbols) - 1) << pucchres->format.choice.format4->startingSymbolIndex; + mask = SL_to_bitmap(pucchres->format.choice.format4->startingSymbolIndex, pucchres->format.choice.format4->nrofSymbols); curr_pucch->simultaneous_harqcsi = pucch_Config->format4->choice.setup->simultaneousHARQ_ACK_CSI; break; default: @@ -775,7 +777,12 @@ void nr_csi_meas_reporting(int Mod_idP, } // verify resources are free for (int i = start; i < start + len; ++i) { - vrb_map_UL[i+bwp_start] |= mask; + if((vrb_map_UL[i+bwp_start] & mask) != 0) { + LOG_E(NR_MAC, "%4d.%2d VRB MAP in %4d.%2d not free. Can't schedule CSI reporting on PUCCH.\n", frame, slot, frame, sched_slot); + memset(curr_pucch, 0, sizeof(*curr_pucch)); + } + else + vrb_map_UL[i+bwp_start] |= mask; } } } @@ -1506,6 +1513,61 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, } } +bool test_acknack_vrb_occupation(NR_UE_sched_ctrl_t *sched_ctrl, + NR_sched_pucch_t *pucch, + uint16_t *vrb_map_UL, + const NR_ServingCellConfigCommon_t *scc, + NR_PUCCH_Config_t *pucch_Config, + int r_pucch, + int bwp_start, + int bwp_size) { + + // We assume initial cyclic shift is always 0 so different pucch resources can't overlap + + NR_sched_pucch_t *csi_pucch = &sched_ctrl->sched_pucch[1]; + if (csi_pucch && + csi_pucch->csi_bits > 0 && + csi_pucch->frame == pucch->frame && + csi_pucch->ul_slot == pucch->ul_slot && + csi_pucch->simultaneous_harqcsi && + (csi_pucch->csi_bits + csi_pucch->dai_c) < 11) + return true; // available resources for csi_pucch already verified + + if(r_pucch<0){ + const NR_PUCCH_Resource_t *resource = pucch_Config->resourceToAddModList->list.array[0]; + DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0); + pucch->second_hop_prb = resource->secondHopPRB!= NULL ? *resource->secondHopPRB : 0; + pucch->nr_of_symb = resource->format.choice.format0->nrofSymbols; + pucch->start_symb = resource->format.choice.format0->startingSymbolIndex; + pucch->prb_start = resource->startingPRB; + } + else{ + int rsetindex = *scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon; + set_r_pucch_parms(rsetindex, + r_pucch, + bwp_size, + &pucch->prb_start, + &pucch->second_hop_prb, + &pucch->nr_of_symb, + &pucch->start_symb); + } + + // verifying occupation of PRBs for ACK/NACK on dedicated pucch + for (int l=0; l<pucch->nr_of_symb; l++) { + uint16_t symb = SL_to_bitmap(pucch->start_symb+l, 1); + int prb; + if (l==1 && pucch->second_hop_prb != 0) + prb = pucch->second_hop_prb; + else + prb = pucch->prb_start; + if ((vrb_map_UL[bwp_start+prb] & symb) != 0) { + return false; + break; + } + } + return true; +} + // this function returns an index to NR_sched_pucch structure // currently this structure contains PUCCH0 at index 0 and PUCCH2 at index 1 @@ -1545,6 +1607,24 @@ int nr_acknack_scheduling(int mod_id, * later) * * each UE has dedicated PUCCH Format 0 resources, and we use index 0! */ NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[mod_id]->UE_info.UE_sched_ctrl[UE_id]; + NR_CellGroupConfig_t *cg = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]; + + NR_PUCCH_Config_t *pucch_Config = NULL; + if (sched_ctrl->active_ubwp) { + pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup; + } else if (cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) { + pucch_Config = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; + } + NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? + &sched_ctrl->active_ubwp->bwp_Common->genericParameters: + &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + int bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); + int bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); + NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[0]; LOG_D(NR_MAC, "In %s: %d.%d Trying to allocate pucch, current DAI %d\n", __FUNCTION__, frame, slot, pucch->dai_c); @@ -1590,7 +1670,6 @@ int nr_acknack_scheduling(int mod_id, LOG_D(NR_MAC, "In %s: pucch_acknak 1. DL %d.%d, UL_ACK %d.%d, DAI_C %d\n", __FUNCTION__, frame, slot, pucch->frame, pucch->ul_slot, pucch->dai_c); // this is hardcoded for now as ue specific only if we are not on the initialBWP (to be fixed to allow ue_Specific also on initialBWP - NR_CellGroupConfig_t *cg = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]; NR_BWP_UplinkDedicated_t *ubwpd=NULL; if (cg && @@ -1664,23 +1743,36 @@ int nr_acknack_scheduling(int mod_id, // Find the right timing_indicator value. int ind_found = -1; // while we are within the feedback limits + uint16_t *vrb_map_UL; while ((n_slots_frame + pucch->ul_slot - slot) % n_slots_frame <= max_fb_time) { - int i = 0; - while (i < 8) { - LOG_D(NR_MAC, "In %s: pdsch_to_harq_feedback[%d] = %d (pucch->ul_slot %d - slot %d)\n", __FUNCTION__, - i,pdsch_to_harq_feedback[i],pucch->ul_slot,slot); - int diff = pucch->ul_slot - slot; - if (diff<0) - diff += n_slots_frame; - if (pdsch_to_harq_feedback[i] == diff && - pdsch_to_harq_feedback[i] >= minfbtime) { - ind_found = i; - break; + // checking if in ul_slot the resources potentially to be assigned to this PUCCH are available + vrb_map_UL = &RC.nrmac[mod_id]->common_channels[CC_id].vrb_map_UL[pucch->ul_slot * MAX_BWP_SIZE]; + bool ret = test_acknack_vrb_occupation(sched_ctrl, + pucch, + vrb_map_UL, + scc, + pucch_Config, + r_pucch, + bwp_start, + bwp_size); + if (ret) { + int i = 0; + while (i < 8) { + LOG_D(NR_MAC,"pdsch_to_harq_feedback[%d] = %d (pucch->ul_slot %d - slot %d)\n", + i,pdsch_to_harq_feedback[i],pucch->ul_slot,slot); + int diff = pucch->ul_slot - slot; + if (diff<0) + diff += n_slots_frame; + if (pdsch_to_harq_feedback[i] == diff && + pdsch_to_harq_feedback[i] >= minfbtime) { + ind_found = i; + break; + } + ++i; } - ++i; + if (ind_found!=-1) + break; } - if (ind_found!=-1) - break; // advance to the next ul slot const int f = pucch->frame; const int s = pucch->ul_slot; @@ -1741,46 +1833,16 @@ int nr_acknack_scheduling(int mod_id, pucch->dai_c++; pucch->resource_indicator = 0; // each UE has dedicated PUCCH resources pucch->r_pucch=r_pucch; - NR_PUCCH_Config_t *pucch_Config = NULL; - if (sched_ctrl->active_ubwp) { - pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup; - } else if (RC.nrmac[mod_id]->UE_info.CellGroup[UE_id] && - RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig && - RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated && - RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig && - RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP && - RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup) { - pucch_Config = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; - } - - NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? - &sched_ctrl->active_ubwp->bwp_Common->genericParameters: - &scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; - int bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); - - /* verify that at that slot and symbol, resources are free. We only do this - * for initialCyclicShift 0 (we assume it always has that one), so other - * initialCyclicShifts can overlap with ICS 0!*/ - if (pucch_Config) { - const NR_PUCCH_Resource_t *resource = pucch_Config->resourceToAddModList->list.array[pucch->resource_indicator]; - DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0); - int second_hop_prb = resource->secondHopPRB!= NULL ? *resource->secondHopPRB : 0; - int nr_of_symbols = resource->format.choice.format0->nrofSymbols; - if (resource->format.choice.format0->initialCyclicShift == 0) { - uint16_t *vrb_map_UL = &RC.nrmac[mod_id]->common_channels[CC_id].vrb_map_UL[pucch->ul_slot * MAX_BWP_SIZE]; - for (int l=0; l<nr_of_symbols; l++) { - uint16_t symb = 1 << (resource->format.choice.format0->startingSymbolIndex + l); - int prb; - if (l==1 && second_hop_prb != 0) - prb = second_hop_prb; - else - prb = resource->startingPRB; - if ((vrb_map_UL[bwp_start+prb] & symb) != 0) - LOG_W(MAC, "symbol 0x%x is not free for PUCCH alloc in vrb_map_UL at RB %ld and slot %d.%d\n", symb, resource->startingPRB, pucch->frame, pucch->ul_slot); - vrb_map_UL[bwp_start+prb] |= symb; - } - } + vrb_map_UL = &RC.nrmac[mod_id]->common_channels[CC_id].vrb_map_UL[pucch->ul_slot * MAX_BWP_SIZE]; + for (int l=0; l<pucch->nr_of_symb; l++) { + uint16_t symb = SL_to_bitmap(pucch->start_symb+l, 1); + int prb; + if (l==1 && pucch->second_hop_prb != 0) + prb = pucch->second_hop_prb; + else + prb = pucch->prb_start; + vrb_map_UL[bwp_start+prb] |= symb; } return 0; } @@ -1880,12 +1942,13 @@ void nr_sr_reporting(int Mod_idP, frame_t SFN, sub_frame_t slot) } curr_pucch->sr_flag = true; } else { - NR_sched_pucch_t sched_sr; - memset(&sched_sr, 0, sizeof(sched_sr)); - sched_sr.frame = SFN; - sched_sr.ul_slot = slot; - sched_sr.resource_indicator = found; - sched_sr.sr_flag = true; + NR_sched_pucch_t sched_sr = { + .frame = SFN, + .ul_slot = slot, + .sr_flag = true, + .resource_indicator = found, + .r_pucch = -1 + }; nr_fill_nfapi_pucch(Mod_idP, SFN, slot, &sched_sr, UE_id); } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index bd2836c3e7f70c7f403d42864dca2dd5fc2485c5..aa49b14fe538a8be28ed18e77b28586582fdaabd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -977,13 +977,6 @@ bool allocate_ul_retransmission(module_id_t module_id, LOG_D(NR_MAC,"retInfo->time_domain_allocation = %d, tda = %d\n", retInfo->time_domain_allocation, tda); LOG_D(NR_MAC,"num_dmrs_cdm_grps_no_data %d, tbs %d\n",num_dmrs_cdm_grps_no_data, retInfo->tb_size); if (tda == retInfo->time_domain_allocation) { - /* Check the resource is enough for retransmission */ - while (rbStart < bwpSize && !rballoc_mask[rbStart]) - rbStart++; - if (rbStart + retInfo->rbSize > bwpSize) { - LOG_W(NR_MAC, "cannot allocate retransmission of UE %d/RNTI %04x: no resources (rbStart %d, retInfo->rbSize %d, bwpSize %d\n", UE_id, UE_info->rnti[UE_id], rbStart, retInfo->rbSize, bwpSize); - return false; - } /* check whether we need to switch the TDA allocation since tha last * (re-)transmission */ NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static; @@ -997,18 +990,29 @@ bool allocate_ul_retransmission(module_id_t module_id, nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); sched_ctrl->update_pusch_ps = false; } + + /* Check the resource is enough for retransmission */ + while (rbStart < bwpSize && + !(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) + rbStart++; + if (rbStart + retInfo->rbSize > bwpSize) { + LOG_W(NR_MAC, "cannot allocate retransmission of UE %d/RNTI %04x: no resources (rbStart %d, retInfo->rbSize %d, bwpSize %d\n", UE_id, UE_info->rnti[UE_id], rbStart, retInfo->rbSize, bwpSize); + return false; + } LOG_D(NR_MAC, "%s(): retransmission keeping TDA %d and TBS %d\n", __func__, tda, retInfo->tb_size); } else { + NR_pusch_semi_static_t temp_ps; + int dci_format = get_dci_format(sched_ctrl); + nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp,ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, &temp_ps); /* the retransmission will use a different time domain allocation, check * that we have enough resources */ - while (rbStart < bwpSize && !rballoc_mask[rbStart]) + while (rbStart < bwpSize && + !(rballoc_mask[rbStart]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) rbStart++; int rbSize = 0; - while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize]) + while (rbStart + rbSize < bwpSize && + (rballoc_mask[rbStart + rbSize]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) rbSize++; - NR_pusch_semi_static_t temp_ps; - int dci_format = get_dci_format(sched_ctrl); - nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp,ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, &temp_ps); uint32_t new_tbs; uint16_t new_rbSize; bool success = nr_find_nb_rb(retInfo->Qm, @@ -1091,7 +1095,7 @@ bool allocate_ul_retransmission(module_id_t module_id, /* Mark the corresponding RBs as used */ n_rb_sched -= sched_pusch->rbSize; for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) - rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] = 0; + rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= SL_to_bitmap(sched_ctrl->pusch_semi_static.startSymbolIndex, sched_ctrl->pusch_semi_static.nrOfSymbols); return true; } @@ -1209,21 +1213,6 @@ void pf_ul(module_id_t module_id, if (max_num_ue < 0) return; - LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb, rbStart); - while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; - if (rbStart + min_rb >= bwpSize) { - LOG_W(NR_MAC, "cannot allocate continuous UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", - UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); - return; - } - - sched_ctrl->cce_index = CCEIndex; - fill_pdcch_vrb_map(RC.nrmac[module_id], - CC_id, - &sched_ctrl->sched_pdcch, - CCEIndex, - sched_ctrl->aggregation_level); - /* Save PUSCH field */ /* we want to avoid a lengthy deduction of DMRS and other parameters in * every TTI if we can save it, so check whether dci_format, TDA, or @@ -1238,6 +1227,24 @@ void pf_ul(module_id_t module_id, nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); sched_ctrl->update_pusch_ps = false; } + + LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb, rbStart); + while (rbStart < bwpSize && + !(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) + rbStart++; + if (rbStart + min_rb >= bwpSize) { + LOG_W(NR_MAC, "cannot allocate continuous UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", + UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); + return; + } + + sched_ctrl->cce_index = CCEIndex; + fill_pdcch_vrb_map(RC.nrmac[module_id], + CC_id, + &sched_ctrl->sched_pdcch, + CCEIndex, + sched_ctrl->aggregation_level); + NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; sched_pusch->mcs = 9; update_ul_ue_R_Qm(sched_pusch, ps); @@ -1256,7 +1263,7 @@ void pf_ul(module_id_t module_id, /* Mark the corresponding RBs as used */ n_rb_sched -= sched_pusch->rbSize; for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) - rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] = 0; + rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); continue; } @@ -1331,19 +1338,6 @@ void pf_ul(module_id_t module_id, NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static; - while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; - sched_pusch->rbStart = rbStart; - uint16_t max_rbSize = 1; - while (rbStart + max_rbSize < bwpSize && rballoc_mask[rbStart + max_rbSize]) - max_rbSize++; - - if (rbStart + min_rb >= bwpSize) { - LOG_W(NR_MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", - UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); - return; - } - else LOG_D(NR_MAC,"allocating UL data for UE %d/RNTI %04x (rbStsart %d, min_rb %d, bwpSize %d\n",UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); - /* Save PUSCH field */ /* we want to avoid a lengthy deduction of DMRS and other parameters in * every TTI if we can save it, so check whether dci_format, TDA, or @@ -1360,6 +1354,23 @@ void pf_ul(module_id_t module_id, } update_ul_ue_R_Qm(sched_pusch, ps); + while (rbStart < bwpSize && + !(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) + rbStart++; + sched_pusch->rbStart = rbStart; + uint16_t max_rbSize = 1; + while (rbStart + max_rbSize < bwpSize && + (rballoc_mask[rbStart + max_rbSize]&&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) + max_rbSize++; + + if (rbStart + min_rb >= bwpSize) { + LOG_W(NR_MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", + UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); + return; + } + else LOG_D(NR_MAC,"allocating UL data for UE %d/RNTI %04x (rbStsart %d, min_rb %d, bwpSize %d\n",UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize); + + /* Calculate the current scheduling bytes and the necessary RBs */ const int B = cmax(sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, 0); uint16_t rbSize = 0; @@ -1390,7 +1401,7 @@ void pf_ul(module_id_t module_id, n_rb_sched -= sched_pusch->rbSize; for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) - rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] = 0; + rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); } } @@ -1473,11 +1484,9 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; int startSymbolIndex, nrOfSymbols; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - const uint16_t symb = ((1 << nrOfSymbols) - 1) << startSymbolIndex; + const uint16_t symb = SL_to_bitmap(startSymbolIndex, nrOfSymbols); int st = 0, e = 0, len = 0; - for (int i = 0; i < bwpSize; i++) - if (RC.nrmac[module_id]->ulprbbl[i] == 1) vrb_map_UL[i]=symb; for (int i = 0; i < bwpSize; i++) { while ((vrb_map_UL[bwpStart + i] & symb) != 0 && i < bwpSize) @@ -1498,7 +1507,7 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t /* Calculate mask: if any RB in vrb_map_UL is blocked (1), the current RB will be 0 */ for (int i = 0; i < bwpSize; i++) - rballoc_mask[i] = i >= st && i <= e; + rballoc_mask[i] = (i >= st && i <= e)*SL_to_bitmap(startSymbolIndex, nrOfSymbols); /* proportional fair scheduling algorithm */ pf_ul(module_id, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 28e9d689fa6f40ecd7a9cb622e2b4e87e1b1a84a..8b734e3b950b7f50212c7c514a3a5cabf7a60ea8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -291,6 +291,14 @@ void prepare_dci(const NR_CellGroupConfig_t *CellGroup, nr_dci_format_t format, int bwp_id); +void set_r_pucch_parms(int rsetindex, + int r_pucch, + int bwp_size, + int *prb_start, + int *second_hop_prb, + int *nr_of_symbols, + int *start_symbol_index); + /* find coreset within the search space */ NR_ControlResourceSet_t *get_coreset(module_id_t module_idP, NR_ServingCellConfigCommon_t *scc, diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index b1e12414871fc8bf8864dd448c3f555354ac8d05..eccffca031aaafc04ef1f12c8086f27a3223bde0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -171,6 +171,8 @@ typedef struct { uint8_t msg3_round; /// Flag to indicate if Msg3 carries a DCCH or DTCH message bool msg3_dcch_dtch; + int msg3_startsymb; + int msg3_nrsymb; /// TBS used for Msg4 int msg4_TBsize; /// MCS used for Msg4 @@ -327,6 +329,10 @@ typedef struct NR_sched_pucch { uint8_t timing_indicator; uint8_t resource_indicator; int r_pucch; + int prb_start; + int second_hop_prb; + int nr_of_symb; + int start_symb; } NR_sched_pucch_t; /* PUSCH semi-static configuration: as long as the TDA and DCI format remain @@ -724,7 +730,7 @@ typedef struct gNB_MAC_INST_s { /// current PDU index (BCH,DLSCH) uint16_t pdu_index[NFAPI_CC_MAX]; int num_ulprbbl; - int ulprbbl[275]; + uint16_t ulprbbl[275]; /// NFAPI Config Request Structure nfapi_nr_config_request_scf_t config[NFAPI_CC_MAX]; /// NFAPI DL Config Request Structure diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 9bce0e884399e947fbc81083a4e5b1de328b87dd..f7323010cb05fcdbe3c9cdbac2ee97ba03aa2333 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1175,7 +1175,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_length, (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_start_subcarrier, (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.cell_id)) << FAPI_NR_RX_PDU_TYPE_SSB; - + free((dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.pdu); break; case FAPI_NR_RX_PDU_TYPE_SIB: ret_mask |= (handle_bcch_dlsch(dl_info->module_id, diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c index c3e41978e59a3f59b7a6f472d5d9d1f23d2d17aa..bd09540627aba805ec9a02378ece258cbefc442d 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c @@ -4297,6 +4297,7 @@ ssize_t do_nrMeasurementReport(uint8_t *buffer, If we delete this asn1cCalloc statement, eNB will crash in NSA mode. Please don't delete the following line unless the bug has been found. */ asn1cCalloc(measresulteutra_list->cgi_Info, measresult_cgi2); + (void) measresult_cgi2; struct LTE_MeasResultEUTRA__measResult* measResult= &measresulteutra_list->measResult; asn1cCallocOne(measResult->rsrpResult, rsrp_tar); asn1cCallocOne(measResult->rsrqResult, rsrq_tar); diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 4286ea0d62d1fc67c6c26717a79af498f5bb2b01..4492380d7f86460d3b7827670b646fdb1e3b70cf 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -905,30 +905,27 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP( for (pdusession = 0; pdusession < ue_context_pP->ue_context.setup_pdu_sessions; pdusession++) { // if (xid == ue_context_pP->ue_context.pdusession[pdusession].xid) { if (ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_DONE) { - NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].pdusession_id = ue_context_pP->ue_context.pduSession[pdusession].param.pdusession_id; - // NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].pdusession_id = 1; - NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].nb_of_qos_flow = ue_context_pP->ue_context.pduSession[pdusession].param.nb_qos; - NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].gtp_teid = ue_context_pP->ue_context.gnb_gtp_teid[pdusession]; - NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].gNB_addr.pdu_session_type = PDUSessionType_ipv4; - NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].gNB_addr.length = ue_context_pP->ue_context.gnb_gtp_addrs[pdusession].length; - memcpy(NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].gNB_addr.buffer, - ue_context_pP->ue_context.gnb_gtp_addrs[pdusession].buffer, sizeof(uint8_t)*20); - for (qos_flow_index = 0; qos_flow_index < NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].nb_of_qos_flow; qos_flow_index++) { - NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].associated_qos_flows[qos_flow_index].qfi = + pdusession_setup_t * tmp=&NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession]; + tmp->pdusession_id = ue_context_pP->ue_context.pduSession[pdusession].param.pdusession_id; + // tmp->pdusession_id = 1; + tmp->nb_of_qos_flow = ue_context_pP->ue_context.pduSession[pdusession].param.nb_qos; + tmp->gtp_teid = ue_context_pP->ue_context.gnb_gtp_teid[pdusession]; + tmp->gNB_addr.pdu_session_type = PDUSessionType_ipv4; + tmp->gNB_addr.length = ue_context_pP->ue_context.gnb_gtp_addrs[pdusession].length; + memcpy(tmp->gNB_addr.buffer, + ue_context_pP->ue_context.gnb_gtp_addrs[pdusession].buffer, tmp->gNB_addr.length); + for (qos_flow_index = 0; qos_flow_index < tmp->nb_of_qos_flow; qos_flow_index++) { + tmp->associated_qos_flows[qos_flow_index].qfi = ue_context_pP->ue_context.pduSession[pdusession].param.qos[qos_flow_index].qfi; - NGAP_PDUSESSION_SETUP_RESP(msg_p).pdusessions[pdusession].associated_qos_flows[qos_flow_index].qos_flow_mapping_ind = QOSFLOW_MAPPING_INDICATION_DL; + tmp->associated_qos_flows[qos_flow_index].qos_flow_mapping_ind = QOSFLOW_MAPPING_INDICATION_DL; } ue_context_pP->ue_context.pduSession[pdusession].status = PDU_SESSION_STATUS_ESTABLISHED; - LOG_I (NR_RRC,"gnb_gtp_addr (msg index %d, pdu_sessions index %d, status %d, xid %d): nb_of_pdusessions %d, pdusession_id %d, teid: %u, addr: %d.%d.%d.%d \n ", + LOG_I (NR_RRC,"gnb_gtp_addr (msg index %d, pdu_sessions index %d, status %d, xid %d): nb_of_pdusessions %d, pdusession_id %d, teid: %u \n ", pdu_sessions_done, pdusession, ue_context_pP->ue_context.pduSession[pdusession].status, xid, ue_context_pP->ue_context.nb_of_pdusessions, NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].pdusession_id, - NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gtp_teid, - NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gNB_addr.buffer[0], - NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gNB_addr.buffer[1], - NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gNB_addr.buffer[2], - NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gNB_addr.buffer[3]); + NGAP_PDUSESSION_SETUP_RESP (msg_p).pdusessions[pdu_sessions_done].gtp_teid); pdu_sessions_done++; } else if ((ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_NEW) || (ue_context_pP->ue_context.pduSession[pdusession].status == PDU_SESSION_STATUS_ESTABLISHED)) { diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/building.txt b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/building.txt deleted file mode 100644 index 56b4be609f3edb99e53b5ee05d71ea2bd40c8966..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/building.txt +++ /dev/null @@ -1,40 +0,0 @@ -building liblfds -================ - -Windows (user-mode) -=================== -1. Use Microsoft Visual Studio 2008 or Visual C++ 2008 Express Edition (or - later versions) to load "liblfds.sln". The "Win32" platform is x86, - the "x64" platform is x64. - -2. Use Microsoft Windows SDK and GNUmake to run makefile.windows (obviously - you'll need to have run setenv.bat or the appropriate vcvars*.bat first; - you can build for x64/64-bit and x86/32-bit - just run the correct batch - file). - - Targets are "librel", "libdbg", "dllrel", "dlldbg" and "clean". You need - to clean between switching targets. - -Windows (kernel) -================ -Use the Windows Driver Kit "build" command. Prior to running "build", -if you wish to build a static library, run the batch file -"runme_before_win_kernel_static_lib_build.bat"; if you wish to -build a dynamic library, instead run "runme_before_win_kernel_dynamic_lib_build.bat". - -The Windows kernel build system is rather limited and rather than -really rather messing up the directory/file structure just for the -Windows kernel platform, I've instead arranged it that these batch -files do the necessary work so that "build" will work. - -The batch files are idempotent; you can run them as often as you -like, in any order, at any time (before or after builds), and they'll -do the right thing. You need to clean between switching targets. - -Linux -===== -Use GNUmake to run "makefile.linux". Targets are "arrel", "ardbg", -"sorel", "sodbg" and "clean". You need to clean between switching -targets. - - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/dirs b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/dirs deleted file mode 100644 index 0be5295378cbf84032bc092001922d2fcf48d5e1..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/dirs +++ /dev/null @@ -1,2 +0,0 @@ -DIRS = src - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/inc/liblfds611.h b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/inc/liblfds611.h deleted file mode 100644 index f2c05ee5e3cb419e06301b401e9afc12ae61f650..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/inc/liblfds611.h +++ /dev/null @@ -1,334 +0,0 @@ -#ifndef __LIBLFDS611_H - -/***** library header *****/ -#define LFDS611_RELEASE_NUMBER_STRING "6.1.1" - - - - -/***** lfds611_abstraction *****/ - -/***** defines *****/ -#if (defined _WIN64 && defined _MSC_VER && !defined WIN_KERNEL_BUILD) -// TRD : 64-bit Windows user-mode with the Microsoft C compiler, any CPU -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <windows.h> -#include <intrin.h> -typedef unsigned __int64 lfds611_atom_t; -#define LFDS611_INLINE __forceinline -#define LFDS611_ALIGN(alignment) __declspec( align(alignment) ) -#define LFDS611_ALIGN_SINGLE_POINTER 8 -#define LFDS611_ALIGN_DOUBLE_POINTER 16 -#define LFDS611_BARRIER_COMPILER_LOAD _ReadBarrier() -#define LFDS611_BARRIER_COMPILER_STORE _WriteBarrier() -#define LFDS611_BARRIER_COMPILER_FULL _ReadWriteBarrier() -#define LFDS611_BARRIER_PROCESSOR_LOAD _mm_lfence() -#define LFDS611_BARRIER_PROCESSOR_STORE _mm_sfence() -#define LFDS611_BARRIER_PROCESSOR_FULL _mm_mfence() -#endif - -#if (!defined _WIN64 && defined _WIN32 && defined _MSC_VER && !defined WIN_KERNEL_BUILD) -// TRD : 32-bit Windows user-mode with the Microsoft C compiler, any CPU -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <windows.h> -#include <intrin.h> -typedef unsigned long int lfds611_atom_t; -#define LFDS611_INLINE __forceinline -#define LFDS611_ALIGN(alignment) __declspec( align(alignment) ) -#define LFDS611_ALIGN_SINGLE_POINTER 4 -#define LFDS611_ALIGN_DOUBLE_POINTER 8 -#define LFDS611_BARRIER_COMPILER_LOAD _ReadBarrier() -#define LFDS611_BARRIER_COMPILER_STORE _WriteBarrier() -#define LFDS611_BARRIER_COMPILER_FULL _ReadWriteBarrier() -#define LFDS611_BARRIER_PROCESSOR_LOAD _mm_lfence() -#define LFDS611_BARRIER_PROCESSOR_STORE _mm_sfence() -#define LFDS611_BARRIER_PROCESSOR_FULL _mm_mfence() - -// TRD : this define is documented but missing in Microsoft Platform SDK v7.0 -#define _InterlockedCompareExchangePointer(destination, exchange, compare) _InterlockedCompareExchange((volatile long *) destination, (long) exchange, (long) compare) -#endif - -#if (defined _WIN64 && defined _MSC_VER && defined WIN_KERNEL_BUILD) -// TRD : 64-bit Windows kernel with the Microsoft C compiler, any CPU -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <wdm.h> -typedef unsigned __int64 lfds611_atom_t; -#define LFDS611_INLINE __forceinline -#define LFDS611_ALIGN(alignment) __declspec( align(alignment) ) -#define LFDS611_ALIGN_SINGLE_POINTER 8 -#define LFDS611_ALIGN_DOUBLE_POINTER 16 -#define LFDS611_BARRIER_COMPILER_LOAD _ReadBarrier() -#define LFDS611_BARRIER_COMPILER_STORE _WriteBarrier() -#define LFDS611_BARRIER_COMPILER_FULL _ReadWriteBarrier() -#define LFDS611_BARRIER_PROCESSOR_LOAD _mm_lfence() -#define LFDS611_BARRIER_PROCESSOR_STORE _mm_sfence() -#define LFDS611_BARRIER_PROCESSOR_FULL _mm_mfence() -#endif - -#if (!defined _WIN64 && defined _WIN32 && defined _MSC_VER && defined WIN_KERNEL_BUILD) -// TRD : 32-bit Windows kernel with the Microsoft C compiler, any CPU -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <wdm.h> -typedef unsigned long int lfds611_atom_t; -#define LFDS611_INLINE __forceinline -#define LFDS611_ALIGN(alignment) __declspec( align(alignment) ) -#define LFDS611_ALIGN_SINGLE_POINTER 4 -#define LFDS611_ALIGN_DOUBLE_POINTER 8 -#define LFDS611_BARRIER_COMPILER_LOAD _ReadBarrier() -#define LFDS611_BARRIER_COMPILER_STORE _WriteBarrier() -#define LFDS611_BARRIER_COMPILER_FULL _ReadWriteBarrier() -#define LFDS611_BARRIER_PROCESSOR_LOAD _mm_lfence() -#define LFDS611_BARRIER_PROCESSOR_STORE _mm_sfence() -#define LFDS611_BARRIER_PROCESSOR_FULL _mm_mfence() - -// TRD : this define is documented but missing in Microsoft Platform SDK v7.0 -#define _InterlockedCompareExchangePointer(destination, exchange, compare) _InterlockedCompareExchange((volatile long *) destination, (long) exchange, (long) compare) -#endif - -#if (defined __unix__ && defined __x86_64__ && __GNUC__) -// TRD : any UNIX with GCC on x64 -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -typedef unsigned long long int lfds611_atom_t; -#define LFDS611_INLINE inline -#define LFDS611_ALIGN(alignment) __attribute__( (aligned(alignment)) ) -#define LFDS611_ALIGN_SINGLE_POINTER 8 -#define LFDS611_ALIGN_DOUBLE_POINTER 16 -#define LFDS611_BARRIER_COMPILER_LOAD __asm__ __volatile__ ( "" : : : "memory" ) -#define LFDS611_BARRIER_COMPILER_STORE __asm__ __volatile__ ( "" : : : "memory" ) -#define LFDS611_BARRIER_COMPILER_FULL __asm__ __volatile__ ( "" : : : "memory" ) -#define LFDS611_BARRIER_PROCESSOR_LOAD __sync_synchronize() -#define LFDS611_BARRIER_PROCESSOR_STORE __sync_synchronize() -#define LFDS611_BARRIER_PROCESSOR_FULL __sync_synchronize() -#endif - -#if (defined __unix__ && defined __i386__ && __GNUC__) -// TRD : any UNIX with GCC on x86 -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -typedef unsigned long int lfds611_atom_t; -#define LFDS611_INLINE inline -#define LFDS611_ALIGN(alignment) __attribute__( (aligned(alignment)) ) -#define LFDS611_ALIGN_SINGLE_POINTER 4 -#define LFDS611_ALIGN_DOUBLE_POINTER 8 -#define LFDS611_BARRIER_COMPILER_LOAD __asm__ __volatile__ ( "" : : : "memory" ) -#define LFDS611_BARRIER_COMPILER_STORE __asm__ __volatile__ ( "" : : : "memory" ) -#define LFDS611_BARRIER_COMPILER_FULL __asm__ __volatile__ ( "" : : : "memory" ) -#define LFDS611_BARRIER_PROCESSOR_LOAD __sync_synchronize() -#define LFDS611_BARRIER_PROCESSOR_STORE __sync_synchronize() -#define LFDS611_BARRIER_PROCESSOR_FULL __sync_synchronize() -#endif - -#if (defined __unix__ && defined __arm__ && __GNUC__) -// TRD : any UNIX with GCC on ARM -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -typedef unsigned long int lfds611_atom_t; -#define LFDS611_INLINE inline -#define LFDS611_ALIGN(alignment) __attribute__( (aligned(alignment)) ) -#define LFDS611_ALIGN_SINGLE_POINTER 4 -#define LFDS611_ALIGN_DOUBLE_POINTER 8 -#define LFDS611_BARRIER_COMPILER_LOAD __asm__ __volatile__ ( "" : : : "memory" ) -#define LFDS611_BARRIER_COMPILER_STORE __asm__ __volatile__ ( "" : : : "memory" ) -#define LFDS611_BARRIER_COMPILER_FULL __asm__ __volatile__ ( "" : : : "memory" ) -#define LFDS611_BARRIER_PROCESSOR_LOAD __sync_synchronize() -#define LFDS611_BARRIER_PROCESSOR_STORE __sync_synchronize() -#define LFDS611_BARRIER_PROCESSOR_FULL __sync_synchronize() -#endif - -#define LFDS611_BARRIER_LOAD LFDS611_BARRIER_COMPILER_LOAD; LFDS611_BARRIER_PROCESSOR_LOAD; LFDS611_BARRIER_COMPILER_LOAD -#define LFDS611_BARRIER_STORE LFDS611_BARRIER_COMPILER_STORE; LFDS611_BARRIER_PROCESSOR_STORE; LFDS611_BARRIER_COMPILER_STORE -#define LFDS611_BARRIER_FULL LFDS611_BARRIER_COMPILER_FULL; LFDS611_BARRIER_PROCESSOR_FULL; LFDS611_BARRIER_COMPILER_FULL - -/***** enums *****/ -enum lfds611_data_structure_validity { - LFDS611_VALIDITY_VALID, - LFDS611_VALIDITY_INVALID_LOOP, - LFDS611_VALIDITY_INVALID_MISSING_ELEMENTS, - LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS, - LFDS611_VALIDITY_INVALID_TEST_DATA -}; - -/***** structs *****/ -struct lfds611_validation_info { - lfds611_atom_t - min_elements, - max_elements; -}; - -/***** public prototypes *****/ -void *lfds611_abstraction_malloc( size_t size ); -void lfds611_abstraction_free( void *memory ); - - - - - -/***** lfds611_freelist *****/ - -/***** enums *****/ -enum lfds611_freelist_query_type { - LFDS611_FREELIST_QUERY_ELEMENT_COUNT, - LFDS611_FREELIST_QUERY_VALIDATE -}; - -/***** incomplete types *****/ -struct lfds611_freelist_state; -struct lfds611_freelist_element; - -/***** public prototypes *****/ -int lfds611_freelist_new( struct lfds611_freelist_state **fs, lfds611_atom_t number_elements, int (*user_data_init_function)(void **user_data, void *user_state), void *user_state ); -void lfds611_freelist_use( struct lfds611_freelist_state *fs ); -void lfds611_freelist_delete( struct lfds611_freelist_state *fs, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state ); - -lfds611_atom_t lfds611_freelist_new_elements( struct lfds611_freelist_state *fs, lfds611_atom_t number_elements ); - -struct lfds611_freelist_element *lfds611_freelist_pop( struct lfds611_freelist_state *fs, struct lfds611_freelist_element **fe ); -struct lfds611_freelist_element *lfds611_freelist_guaranteed_pop( struct lfds611_freelist_state *fs, struct lfds611_freelist_element **fe ); -void lfds611_freelist_push( struct lfds611_freelist_state *fs, struct lfds611_freelist_element *fe ); - -void *lfds611_freelist_get_user_data_from_element( struct lfds611_freelist_element *fe, void **user_data ); -void lfds611_freelist_set_user_data_in_element( struct lfds611_freelist_element *fe, void *user_data ); - -void lfds611_freelist_query( struct lfds611_freelist_state *fs, enum lfds611_freelist_query_type query_type, void *query_input, void *query_output ); - - - - - -/***** lfds611_liblfds *****/ - -/***** public prototypes *****/ -void lfds611_liblfds_abstraction_test_helper_increment_non_atomic( lfds611_atom_t *shared_counter ); -void lfds611_liblfds_abstraction_test_helper_increment_atomic( volatile lfds611_atom_t *shared_counter ); -void lfds611_liblfds_abstraction_test_helper_cas( volatile lfds611_atom_t *shared_counter, lfds611_atom_t *local_counter ); -void lfds611_liblfds_abstraction_test_helper_dcas( volatile lfds611_atom_t *shared_counter, lfds611_atom_t *local_counter ); - - - - - -/***** lfds611_queue *****/ - -/***** enums *****/ -enum lfds611_queue_query_type { - LFDS611_QUEUE_QUERY_ELEMENT_COUNT, - LFDS611_QUEUE_QUERY_VALIDATE -}; - -/***** incomplete types *****/ -struct lfds611_queue_state; - -/***** public prototypes *****/ -int lfds611_queue_new( struct lfds611_queue_state **sq, lfds611_atom_t number_elements ); -void lfds611_queue_use( struct lfds611_queue_state *qs ); -void lfds611_queue_delete( struct lfds611_queue_state *qs, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state ); - -int lfds611_queue_enqueue( struct lfds611_queue_state *qs, void *user_data ); -int lfds611_queue_guaranteed_enqueue( struct lfds611_queue_state *qs, void *user_data ); -int lfds611_queue_dequeue( struct lfds611_queue_state *qs, void **user_data ); - -void lfds611_queue_query( struct lfds611_queue_state *qs, enum lfds611_queue_query_type query_type, void *query_input, void *query_output ); - - - - - -/***** lfds611_ringbuffer *****/ - -/***** enums *****/ -enum lfds611_ringbuffer_query_type { - LFDS611_RINGBUFFER_QUERY_VALIDATE -}; - -/***** incomplete types *****/ -struct lfds611_ringbuffer_state; - -/***** public prototypes *****/ -int lfds611_ringbuffer_new( struct lfds611_ringbuffer_state **rs, lfds611_atom_t number_elements, int (*user_data_init_function)(void **user_data, void *user_state), void *user_state ); -void lfds611_ringbuffer_use( struct lfds611_ringbuffer_state *rs ); -void lfds611_ringbuffer_delete( struct lfds611_ringbuffer_state *rs, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state ); - -struct lfds611_freelist_element *lfds611_ringbuffer_get_read_element( struct lfds611_ringbuffer_state *rs, struct lfds611_freelist_element **fe ); -struct lfds611_freelist_element *lfds611_ringbuffer_get_write_element( struct lfds611_ringbuffer_state *rs, struct lfds611_freelist_element **fe, int *overwrite_flag ); - -void lfds611_ringbuffer_put_read_element( struct lfds611_ringbuffer_state *rs, struct lfds611_freelist_element *fe ); -void lfds611_ringbuffer_put_write_element( struct lfds611_ringbuffer_state *rs, struct lfds611_freelist_element *fe ); - -void lfds611_ringbuffer_query( struct lfds611_ringbuffer_state *rs, enum lfds611_ringbuffer_query_type query_type, void *query_input, void *query_output ); - - - - - -/***** lfds611_slist *****/ - -/***** incomplete types *****/ -struct lfds611_slist_state; -struct lfds611_slist_element; - -/***** public prototypes *****/ -int lfds611_slist_new( struct lfds611_slist_state **ss, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state ); -void lfds611_slist_use( struct lfds611_slist_state *ss ); -void lfds611_slist_delete( struct lfds611_slist_state *ss ); - -struct lfds611_slist_element *lfds611_slist_new_head( struct lfds611_slist_state *ss, void *user_data ); -struct lfds611_slist_element *lfds611_slist_new_next( struct lfds611_slist_element *se, void *user_data ); - -int lfds611_slist_logically_delete_element( struct lfds611_slist_state *ss, struct lfds611_slist_element *se ); -void lfds611_slist_single_threaded_physically_delete_all_elements( struct lfds611_slist_state *ss ); - -int lfds611_slist_get_user_data_from_element( struct lfds611_slist_element *se, void **user_data ); -int lfds611_slist_set_user_data_in_element( struct lfds611_slist_element *se, void *user_data ); - -struct lfds611_slist_element *lfds611_slist_get_head( struct lfds611_slist_state *ss, struct lfds611_slist_element **se ); -struct lfds611_slist_element *lfds611_slist_get_next( struct lfds611_slist_element *se, struct lfds611_slist_element **next_se ); -struct lfds611_slist_element *lfds611_slist_get_head_and_then_next( struct lfds611_slist_state *ss, struct lfds611_slist_element **se ); - - - - - -/***** lfds611_stack *****/ - -/***** enums *****/ -enum lfds611_stack_query_type { - LFDS611_STACK_QUERY_ELEMENT_COUNT, - LFDS611_STACK_QUERY_VALIDATE -}; - -/***** incomplete types *****/ -struct lfds611_stack_state; - -/***** public prototypes *****/ -int lfds611_stack_new( struct lfds611_stack_state **ss, lfds611_atom_t number_elements ); -void lfds611_stack_use( struct lfds611_stack_state *ss ); -void lfds611_stack_delete( struct lfds611_stack_state *ss, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state ); - -void lfds611_stack_clear( struct lfds611_stack_state *ss, void (*user_data_clear_function)(void *user_data, void *user_state), void *user_state ); - -int lfds611_stack_push( struct lfds611_stack_state *ss, void *user_data ); -int lfds611_stack_guaranteed_push( struct lfds611_stack_state *ss, void *user_data ); -int lfds611_stack_pop( struct lfds611_stack_state *ss, void **user_data ); - -void lfds611_stack_query( struct lfds611_stack_state *ss, enum lfds611_stack_query_type query_type, void *query_input, void *query_output ); - - - - - -#define __LIBLFDS611_H - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/liblfds611.def b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/liblfds611.def deleted file mode 100644 index b9c92b0cf9f2bcd241f36f9a0beec6b4b9174d30..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/liblfds611.def +++ /dev/null @@ -1,57 +0,0 @@ -EXPORTS - -lfds611_liblfds_abstraction_test_helper_increment_non_atomic = lfds611_liblfds_abstraction_test_helper_increment_non_atomic @1 -lfds611_liblfds_abstraction_test_helper_increment_atomic = lfds611_liblfds_abstraction_test_helper_increment_atomic @2 -lfds611_liblfds_abstraction_test_helper_cas = lfds611_liblfds_abstraction_test_helper_cas @3 -lfds611_liblfds_abstraction_test_helper_dcas = lfds611_liblfds_abstraction_test_helper_dcas @4 - -lfds611_freelist_delete = lfds611_freelist_delete @5 -lfds611_freelist_get_user_data_from_element = lfds611_freelist_get_user_data_from_element @6 -lfds611_freelist_guaranteed_pop = lfds611_freelist_guaranteed_pop @7 -lfds611_freelist_new = lfds611_freelist_new @8 -lfds611_freelist_new_elements = lfds611_freelist_new_elements @9 -lfds611_freelist_pop = lfds611_freelist_pop @10 -lfds611_freelist_push = lfds611_freelist_push @11 -lfds611_freelist_query = lfds611_freelist_query @12 -lfds611_freelist_set_user_data_in_element = lfds611_freelist_set_user_data_in_element @13 -lfds611_freelist_use = lfds611_freelist_use @14 - -lfds611_queue_delete = lfds611_queue_delete @15 -lfds611_queue_dequeue = lfds611_queue_dequeue @16 -lfds611_queue_enqueue = lfds611_queue_enqueue @17 -lfds611_queue_guaranteed_enqueue = lfds611_queue_guaranteed_enqueue @18 -lfds611_queue_new = lfds611_queue_new @19 -lfds611_queue_query = lfds611_queue_query @20 -lfds611_queue_use = lfds611_queue_use @21 - -lfds611_ringbuffer_delete = lfds611_ringbuffer_delete @22 -lfds611_ringbuffer_get_read_element = lfds611_ringbuffer_get_read_element @23 -lfds611_ringbuffer_get_write_element = lfds611_ringbuffer_get_write_element @24 -lfds611_ringbuffer_new = lfds611_ringbuffer_new @25 -lfds611_ringbuffer_put_read_element = lfds611_ringbuffer_put_read_element @26 -lfds611_ringbuffer_put_write_element = lfds611_ringbuffer_put_write_element @27 -lfds611_ringbuffer_query = lfds611_ringbuffer_query @28 -lfds611_ringbuffer_use = lfds611_ringbuffer_use @29 - -lfds611_slist_delete = lfds611_slist_delete @30 -lfds611_slist_get_head = lfds611_slist_get_head @31 -lfds611_slist_get_head_and_then_next = lfds611_slist_get_head_and_then_next @32 -lfds611_slist_get_next = lfds611_slist_get_next @33 -lfds611_slist_get_user_data_from_element = lfds611_slist_get_user_data_from_element @34 -lfds611_slist_logically_delete_element = lfds611_slist_logically_delete_element @35 -lfds611_slist_new = lfds611_slist_new @36 -lfds611_slist_new_head = lfds611_slist_new_head @37 -lfds611_slist_new_next = lfds611_slist_new_next @38 -lfds611_slist_set_user_data_in_element = lfds611_slist_set_user_data_in_element @39 -lfds611_slist_single_threaded_physically_delete_all_elements = lfds611_slist_single_threaded_physically_delete_all_elements @40 -lfds611_slist_use = lfds611_slist_use @41 - -lfds611_stack_clear = lfds611_stack_clear @42 -lfds611_stack_delete = lfds611_stack_delete @43 -lfds611_stack_guaranteed_push = lfds611_stack_guaranteed_push @44 -lfds611_stack_new = lfds611_stack_new @45 -lfds611_stack_pop = lfds611_stack_pop @46 -lfds611_stack_push = lfds611_stack_push @47 -lfds611_stack_query = lfds611_stack_query @48 -lfds611_stack_use = lfds611_stack_use @49 - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/liblfds611.sln b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/liblfds611.sln deleted file mode 100644 index de51b657c4d58584358dc5b165b90ef96f9559f9..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/liblfds611.sln +++ /dev/null @@ -1,38 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds611", "liblfds611.vcproj", "{F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug DLL|Win32 = Debug DLL|Win32 - Debug DLL|x64 = Debug DLL|x64 - Debug Lib|Win32 = Debug Lib|Win32 - Debug Lib|x64 = Debug Lib|x64 - Release DLL|Win32 = Release DLL|Win32 - Release DLL|x64 = Release DLL|x64 - Release Lib|Win32 = Release Lib|Win32 - Release Lib|x64 = Release Lib|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug DLL|x64.Build.0 = Debug DLL|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug Lib|Win32.ActiveCfg = Debug Lib|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug Lib|Win32.Build.0 = Debug Lib|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug Lib|x64.ActiveCfg = Debug Lib|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug Lib|x64.Build.0 = Debug Lib|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release DLL|Win32.Build.0 = Release DLL|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release DLL|x64.ActiveCfg = Release DLL|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release DLL|x64.Build.0 = Release DLL|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release Lib|Win32.ActiveCfg = Release Lib|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release Lib|Win32.Build.0 = Release Lib|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release Lib|x64.ActiveCfg = Release Lib|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release Lib|x64.Build.0 = Release Lib|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/liblfds611.vcproj b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/liblfds611.vcproj deleted file mode 100644 index 96d5028eb80366c1f2bdb5987ca4a4fbb87ffe5c..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/liblfds611.vcproj +++ /dev/null @@ -1,800 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9.00" - Name="liblfds611" - ProjectGUID="{F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}" - RootNamespace="liblfds" - TargetFrameworkVersion="196613" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug Lib|Win32" - OutputDirectory="$(ProjectDir)\bin\$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(ProjectDir)\obj\$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - WholeProgramOptimization="0" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/DWIN32_LEAN_AND_MEAN /D_DEBUG" - Optimization="0" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(ProjectDir)\src";"$(ProjectDir)\inc"" - MinimalRebuild="true" - ExceptionHandling="0" - BasicRuntimeChecks="3" - EnableFunctionLevelLinking="true" - BrowseInformation="1" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="3" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - AdditionalOptions="/wx" - AdditionalLibraryDirectories="" - IgnoreAllDefaultLibraries="true" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug Lib|x64" - OutputDirectory="$(ProjectDir)\bin\$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(ProjectDir)\obj\$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - WholeProgramOptimization="0" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/DWIN32_LEAN_AND_MEAN /D_DEBUG" - Optimization="0" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(ProjectDir)\src";"$(ProjectDir)\inc"" - ExceptionHandling="0" - BasicRuntimeChecks="3" - SmallerTypeCheck="true" - EnableFunctionLevelLinking="true" - BrowseInformation="1" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="3" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - AdditionalOptions="/wx" - AdditionalLibraryDirectories="" - IgnoreAllDefaultLibraries="true" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release Lib|Win32" - OutputDirectory="$(ProjectDir)\bin\$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(ProjectDir)\obj\$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - WholeProgramOptimization="0" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/DWIN32_LEAN_AND_MEAN /DNDEBUG" - Optimization="3" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - AdditionalIncludeDirectories=""$(ProjectDir)\src";"$(ProjectDir)\inc"" - StringPooling="true" - ExceptionHandling="0" - BufferSecurityCheck="false" - EnableFunctionLevelLinking="true" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="0" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - AdditionalOptions="/wx" - AdditionalLibraryDirectories="" - IgnoreAllDefaultLibraries="true" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release Lib|x64" - OutputDirectory="$(ProjectDir)\bin\$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(ProjectDir)\obj\$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - CharacterSet="1" - WholeProgramOptimization="0" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/DWIN32_LEAN_AND_MEAN /DNDEBUG" - Optimization="3" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - AdditionalIncludeDirectories=""$(ProjectDir)\src";"$(ProjectDir)\inc"" - StringPooling="true" - ExceptionHandling="0" - BufferSecurityCheck="false" - EnableFunctionLevelLinking="true" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="0" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - AdditionalOptions="/wx" - AdditionalLibraryDirectories="" - IgnoreAllDefaultLibraries="true" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug DLL|Win32" - OutputDirectory="$(ProjectDir)\bin\$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(ProjectDir)\obj\$(PlatformName)\$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="0" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/DWIN32_LEAN_AND_MEAN /D_DEBUG" - Optimization="0" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(ProjectDir)\src";"$(ProjectDir)\inc"" - MinimalRebuild="true" - ExceptionHandling="0" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - EnableFunctionLevelLinking="true" - BrowseInformation="1" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="3" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="msvcrtd.lib" - IgnoreAllDefaultLibraries="true" - ModuleDefinitionFile="$(ProjectDir)\liblfds611.def" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug DLL|x64" - OutputDirectory="$(ProjectDir)\bin\$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(ProjectDir)\obj\$(PlatformName)\$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="0" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/DWIN32_LEAN_AND_MEAN /D_DEBUG" - Optimization="0" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(ProjectDir)\src";"$(ProjectDir)\inc"" - ExceptionHandling="0" - BasicRuntimeChecks="3" - SmallerTypeCheck="true" - RuntimeLibrary="3" - EnableFunctionLevelLinking="true" - BrowseInformation="1" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="3" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="msvcrtd.lib" - IgnoreAllDefaultLibraries="true" - ModuleDefinitionFile="$(ProjectDir)\liblfds611.def" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release DLL|Win32" - OutputDirectory="$(ProjectDir)\bin\$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(ProjectDir)\obj\$(PlatformName)\$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="0" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/DWIN32_LEAN_AND_MEAN /DNDEBUG" - Optimization="3" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - AdditionalIncludeDirectories=""$(ProjectDir)\src";"$(ProjectDir)\inc"" - StringPooling="true" - ExceptionHandling="0" - RuntimeLibrary="2" - BufferSecurityCheck="false" - EnableFunctionLevelLinking="true" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="0" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="msvcrt.lib" - IgnoreAllDefaultLibraries="true" - ModuleDefinitionFile="$(ProjectDir)\liblfds611.def" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release DLL|x64" - OutputDirectory="$(ProjectDir)\bin\$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(ProjectDir)\obj\$(PlatformName)\$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="0" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/DWIN32_LEAN_AND_MEAN /DNDEBUG" - Optimization="3" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - AdditionalIncludeDirectories=""$(ProjectDir)\src";"$(ProjectDir)\inc"" - StringPooling="true" - ExceptionHandling="0" - RuntimeLibrary="2" - BufferSecurityCheck="false" - EnableFunctionLevelLinking="true" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="0" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="msvcrt.lib" - IgnoreAllDefaultLibraries="true" - ModuleDefinitionFile="$(ProjectDir)\liblfds611.def" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="inc" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\inc\liblfds611.h" - > - </File> - </Filter> - <Filter - Name="src" - > - <File - RelativePath=".\src\liblfds611_internal.h" - > - </File> - <Filter - Name="lfds611_abstraction" - > - <File - RelativePath=".\src\lfds611_abstraction\lfds611_abstraction_free.c" - > - </File> - <File - RelativePath=".\src\lfds611_abstraction\lfds611_abstraction_internal_body.h" - > - </File> - <File - RelativePath=".\src\lfds611_abstraction\lfds611_abstraction_internal_wrapper.h" - > - </File> - <File - RelativePath=".\src\lfds611_abstraction\lfds611_abstraction_malloc.c" - > - </File> - </Filter> - <Filter - Name="lfds611_freelist" - > - <File - RelativePath=".\src\lfds611_freelist\lfds611_freelist_delete.c" - > - </File> - <File - RelativePath=".\src\lfds611_freelist\lfds611_freelist_get_and_set.c" - > - </File> - <File - RelativePath=".\src\lfds611_freelist\lfds611_freelist_internal.h" - > - </File> - <File - RelativePath=".\src\lfds611_freelist\lfds611_freelist_new.c" - > - </File> - <File - RelativePath=".\src\lfds611_freelist\lfds611_freelist_pop_push.c" - > - </File> - <File - RelativePath=".\src\lfds611_freelist\lfds611_freelist_query.c" - > - </File> - </Filter> - <Filter - Name="lfds611_queue" - > - <File - RelativePath=".\src\lfds611_queue\lfds611_queue_delete.c" - > - </File> - <File - RelativePath=".\src\lfds611_queue\lfds611_queue_internal.h" - > - </File> - <File - RelativePath=".\src\lfds611_queue\lfds611_queue_new.c" - > - </File> - <File - RelativePath=".\src\lfds611_queue\lfds611_queue_query.c" - > - </File> - <File - RelativePath=".\src\lfds611_queue\lfds611_queue_queue.c" - > - </File> - </Filter> - <Filter - Name="lfds611_ringbuffer" - > - <File - RelativePath=".\src\lfds611_ringbuffer\lfds611_ringbuffer_delete.c" - > - </File> - <File - RelativePath=".\src\lfds611_ringbuffer\lfds611_ringbuffer_get_and_put.c" - > - </File> - <File - RelativePath=".\src\lfds611_ringbuffer\lfds611_ringbuffer_internal.h" - > - </File> - <File - RelativePath=".\src\lfds611_ringbuffer\lfds611_ringbuffer_new.c" - > - </File> - <File - RelativePath=".\src\lfds611_ringbuffer\lfds611_ringbuffer_query.c" - > - </File> - </Filter> - <Filter - Name="lfds611_slist" - > - <File - RelativePath=".\src\lfds611_slist\lfds611_slist_delete.c" - > - </File> - <File - RelativePath=".\src\lfds611_slist\lfds611_slist_get_and_set.c" - > - </File> - <File - RelativePath=".\src\lfds611_slist\lfds611_slist_internal.h" - > - </File> - <File - RelativePath=".\src\lfds611_slist\lfds611_slist_link.c" - > - </File> - <File - RelativePath=".\src\lfds611_slist\lfds611_slist_new.c" - > - </File> - </Filter> - <Filter - Name="lfds611_stack" - > - <File - RelativePath=".\src\lfds611_stack\lfds611_stack_delete.c" - > - </File> - <File - RelativePath=".\src\lfds611_stack\lfds611_stack_internal.h" - > - </File> - <File - RelativePath=".\src\lfds611_stack\lfds611_stack_new.c" - > - </File> - <File - RelativePath=".\src\lfds611_stack\lfds611_stack_push_pop.c" - > - </File> - <File - RelativePath=".\src\lfds611_stack\lfds611_stack_query.c" - > - </File> - </Filter> - <Filter - Name="lfds611_liblfds" - > - <File - RelativePath=".\src\lfds611_liblfds\lfds611_liblfds_abstraction_test_helpers.c" - > - </File> - <File - RelativePath=".\src\lfds611_liblfds\lfds611_liblfds_aligned_free.c" - > - </File> - <File - RelativePath=".\src\lfds611_liblfds\lfds611_liblfds_aligned_malloc.c" - > - </File> - <File - RelativePath=".\src\lfds611_liblfds\lfds611_liblfds_internal.h" - > - </File> - </Filter> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/makefile.linux b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/makefile.linux deleted file mode 100644 index 2655d8ec5e9630ec78c10a3702a4285f51e89cad..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/makefile.linux +++ /dev/null @@ -1,111 +0,0 @@ -##### paths ##### -OUTDIR := . -BINDIR = $(OUTDIR)/bin -OBJDIR = $(OUTDIR)/obj -INCDIR = inc -SRCDIR = src - -##### misc ##### -QUIETLY = 1>/dev/null 2>/dev/null - -##### sources, objects and libraries ##### -BINNAME = liblfds611 -AR_BINARY = $(BINDIR)/$(BINNAME).a -$(info $(AR_BINARY)) -SO_BINARY = $(BINDIR)/$(BINNAME).so -SRCDIRS = lfds611_abstraction lfds611_freelist lfds611_liblfds lfds611_queue lfds611_ringbuffer lfds611_slist lfds611_stack -# TRD : be aware - in the linux makefile, with the one-pass linking behaviour of the GNU linker, the order -# of source files matters! this is because it leads to the ordering of objects in the library and -# that in turn, since the data structures all use the freelist API and the abstraction API, has to be -# correct -# TRD : lfds611_abstraction_cas.c lfds611_abstraction_dcas.c lfds611_abstraction_increment.c are inlined and are compiled by every C file -SOURCES = lfds611_queue_delete.c lfds611_queue_new.c lfds611_queue_query.c lfds611_queue_queue.c \ - lfds611_ringbuffer_delete.c lfds611_ringbuffer_get_and_put.c lfds611_ringbuffer_new.c lfds611_ringbuffer_query.c \ - lfds611_slist_delete.c lfds611_slist_get_and_set.c lfds611_slist_link.c lfds611_slist_new.c \ - lfds611_stack_delete.c lfds611_stack_new.c lfds611_stack_push_pop.c lfds611_stack_query.c \ - lfds611_freelist_delete.c lfds611_freelist_get_and_set.c lfds611_freelist_new.c lfds611_freelist_query.c lfds611_freelist_pop_push.c \ - lfds611_liblfds_abstraction_test_helpers.c lfds611_liblfds_aligned_free.c lfds611_liblfds_aligned_malloc.c \ - lfds611_abstraction_free.c lfds611_abstraction_malloc.c -OBJECTS = $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(SOURCES))) - -##### CPU variants ##### -UNAME = $(shell uname -m) -GCCARCH = -march=$(UNAME) - -ifeq ($(UNAME),x86_64) - GCCARCH = -march=core2 -endif - -ifeq ($(findstring arm,$(UNAME)),arm) - GCCARCH = -march=armv6k -marm -endif - -##### tools ##### -MAKE = make -MFLAGS = - -DG = gcc -DGFLAGS = -MM -std=c99 -I"$(SRCDIR)" -I"$(INCDIR)" - -CC = gcc -CBASE = -Wall -Wno-unknown-pragmas -std=c99 $(GCCARCH) -pthread -c -I"$(SRCDIR)" -I"$(INCDIR)" -CFREL = -O2 -finline-functions -Wno-strict-aliasing -CFDBG = -O0 -g - -AR = ar -AFLAGS = -rcs - -LD = gcc -LFBASE = -Wall -std=c99 -shared -LFREL = -O2 -s -LFDBG = -O0 -g - -##### rel/dbg .a/.so variants ##### -ifeq ($(findstring so,$(MAKECMDGOALS)),so) - CBASE := $(CBASE) -fpic -endif - -CFLAGS = $(CBASE) $(CFDBG) -LFLAGS = $(LFBASE) $(LFDBG) - -ifeq ($(findstring rel,$(MAKECMDGOALS)),rel) - CFLAGS = $(CBASE) $(CFREL) - LFLAGS = $(LFBASE) $(LFREL) -endif - -##### search paths ##### -vpath %.c $(patsubst %,$(SRCDIR)/%:,$(SRCDIRS)) - -##### implicit rules ##### -$(OBJDIR)/%.o : %.c - @echo "Compiling $<" - @$(DG) $(DGFLAGS) $< >$(OBJDIR)/$*.d - @$(CC) $(CFLAGS) -o $@ $< - -##### explicit rules ##### -$(AR_BINARY) : $(OBJECTS) - @echo "Creating $(AR_BINARY)" - @$(AR) $(AFLAGS) $(AR_BINARY) $(OBJECTS) - -$(SO_BINARY) : $(OBJECTS) - @echo "Creating $(SO_BINARY)" - $(LD) $(LFLAGS) $(SYSLIBS) $(OBJECTS) -o $(SO_BINARY) - -##### phony ##### -.PHONY : clean arrel ardbg sorel sodbg - -clean : - @rm -f $(BINDIR)/$(BINNAME).* $(OBJDIR)/*.o $(OBJDIR)/*.d - -arrel : $(AR_BINARY) -ardbg : $(AR_BINARY) - -sorel : $(SO_BINARY) -sodbg : $(SO_BINARY) - -##### dependencies ##### --include $(DEPENDS) - -##### notes ##### -# TRD : we use -std=c99 purely to permit C++ style comments - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/makefile.windows b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/makefile.windows deleted file mode 100644 index 9948e7cea74c0bee00d25e024910c049b85d67f8..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/makefile.windows +++ /dev/null @@ -1,97 +0,0 @@ -##### paths ##### -BINDIR = bin -INCDIR = inc -OBJDIR = obj -SRCDIR = src - -##### misc ##### -QUIETLY = 1>nul 2>nul - -##### sources, objects and libraries ##### -BINNAME = liblfds611 -LIB_BINARY = $(BINDIR)\$(BINNAME).lib -DLL_BINARY = $(BINDIR)\$(BINNAME).dll -SRCDIRS = lfds611_abstraction lfds611_freelist lfds611_liblfds lfds611_queue lfds611_ringbuffer lfds611_slist lfds611_stack -# TRD : lfds611_abstraction_cas.c lfds611_abstraction_dcas.c lfds611_abstraction_increment.c are inlined and are compiled by every C file -SOURCES = lfds611_abstraction_free.c lfds611_abstraction_malloc.c \ - lfds611_freelist_delete.c lfds611_freelist_get_and_set.c lfds611_freelist_new.c lfds611_freelist_query.c lfds611_freelist_pop_push.c \ - lfds611_liblfds_abstraction_test_helpers.c lfds611_liblfds_aligned_free.c lfds611_liblfds_aligned_malloc.c \ - lfds611_queue_delete.c lfds611_queue_new.c lfds611_queue_query.c lfds611_queue_queue.c \ - lfds611_ringbuffer_delete.c lfds611_ringbuffer_get_and_put.c lfds611_ringbuffer_new.c lfds611_ringbuffer_query.c \ - lfds611_slist_delete.c lfds611_slist_get_and_set.c lfds611_slist_link.c lfds611_slist_new.c \ - lfds611_stack_delete.c lfds611_stack_new.c lfds611_stack_push_pop.c lfds611_stack_query.c -OBJECTS = $(patsubst %.c,$(OBJDIR)/%.obj,$(notdir $(SOURCES))) -SYSLIBS = kernel32.lib - -##### tools ##### -MAKE = make -MFLAGS = - -CC = cl -CBASE = /nologo /W4 /WX /c "-I$(SRCDIR)" "-I$(INCDIR)" "/Fd$(BINDIR)\$(BINNAME).pdb" /DUNICODE /D_UNICODE /DWIN32_LEAN_AND_MEAN -CFREL = /Ox /DNDEBUG -CFDBG = /Od /Gm /Zi /D_DEBUG - -AR = lib -AFLAGS = /nologo /subsystem:console /wx /verbose - -LD = link -LFBASE = /dll /def:$(BINNAME).def /nologo /subsystem:console /wx /nodefaultlib /nxcompat -LFREL = /incremental:no -LFDBG = /debug "/pdb:$(BINDIR)\$(BINNAME).pdb" - -##### variants ##### -CFLAGS = $(CBASE) $(CFDBG) /MTd -LFLAGS = $(LFBASE) $(LFDBG) -CLIB = libcmtd.lib - -ifeq ($(MAKECMDGOALS),librel) - CFLAGS = $(CBASE) $(CFREL) /MT - LFLAGS = $(LFBASE) $(LFREL) - CLIB = libcmt.lib -endif - -ifeq ($(MAKECMDGOALS),libdbg) - CFLAGS = $(CBASE) $(CFDBG) /MTd - LFLAGS = $(LFBASE) $(LFDBG) - CLIB = libcmtd.lib -endif - -ifeq ($(MAKECMDGOALS),dllrel) - CFLAGS = $(CBASE) $(CFREL) /MD - LFLAGS = $(LFBASE) $(LFREL) - CLIB = msvcrt.lib -endif - -ifeq ($(MAKECMDGOALS),dlldbg) - CFLAGS = $(CBASE) $(CFDBG) /MDd - LFLAGS = $(LFBASE) $(LFDBG) - CLIB = msvcrtd.lib -endif - -##### search paths ##### -vpath %.c $(patsubst %,$(SRCDIR)/%;,$(SRCDIRS)) - -##### implicit rules ##### -$(OBJDIR)/%.obj : %.c - $(CC) $(CFLAGS) "/Fo$@" $< - -##### explicit rules ##### -$(LIB_BINARY) : $(OBJECTS) - $(AR) $(AFLAGS) $(OBJECTS) /out:$(LIB_BINARY) - -$(DLL_BINARY) : $(OBJECTS) - $(LD) $(LFLAGS) $(CLIB) $(SYSLIBS) $(OBJECTS) /out:$(DLL_BINARY) - -##### phony ##### -.PHONY : clean librel libdbg dllrel dlldbg - -clean : - @erase /Q $(BINDIR)\$(BINNAME).* $(OBJDIR)\*.obj $(QUIETLY) - -librel : $(LIB_BINARY) -libdbg : $(LIB_BINARY) - -dllrel : $(DLL_BINARY) -dlldbg : $(DLL_BINARY) - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/readme.txt b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/readme.txt deleted file mode 100644 index cbe196238c7213d4ab3876f3fd6448339a6ba78a..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/readme.txt +++ /dev/null @@ -1,147 +0,0 @@ -introduction -============ -Welcome to liblfds, a portable, license-free, lock-free data structure library -written in C. - -supported platforms -=================== -Out-of-the-box ports are provided for; - -Operating System CPU Toolchain Choices -================ ============= ================= -Windows 64-bit x64 1. Microsoft Visual Studio - 2. Microsoft Windows SDK and GNUmake - -Windows 32-bit x64, x86 1. Microsoft Visual Studio - 2. Visual C++ Express Edition - 3. Microsoft Windows SDK and GNUmake - -Windows Kernel x64, x86 1. Windows Driver Kit - -Linux 64-bit x64 1. GCC and GNUmake - -Linux 32-bit ARM, x64, x86 1. GCC and GNUmake - -For more information including version requirements, see the building guide (lfds). - -data structures -=============== -This release of liblfds provides the following; - - * Freelist - * Queue - * Ringbuffer (each element read by a single reader) - * Singly-linked list (logical delete only) - * Stack - -These are all many-readers, many-writers. - -liblfds on-line -=============== -On the liblfds home page, you will find the blog, a bugzilla, a forum, a -mediawiki and the current and all historical releases. - -The mediawiki contains comprehensive documentation for development, building, -testing and porting. - -http://www.liblfds.org - -license -======= -There is no license. You are free to use this code in any way. - -using -===== -Once built, there is a single header file, /inc/liblfds.h, which you must include -in your source code, and a single library file /bin/liblfds.*, where the suffix -depends on your platform and your build choice (static or dynamic), to which, -if statically built, you must link directly or, if dynamically built, you must -arrange your system such that the library can be found by the loader at run-time. - -testing -======= -The library comes with a command line test and benchmark program. This program -requires threads. As such, it is only suitable for platforms which can execute -a command line binary and provide thread support. Currently this means the test -and benchmark program works for all platforms except the Windows Kernel. - -For documentation, see the testing and benchmarking guide in the mediawiki. - -porting -======= -Both the test program and liblfds provide an abstraction layer which acts to -mask platform differences. Porting is the act of implementing on your platform -the functions which make up the abstraction layers. You do not need to port -the test program to port liblfds, but obviously it is recommended, so you can -test your port. - -To support liblfds, your platform MUST support; - - * atomic single-word* increment - * atomic single-word compare-and-swap - * atomic contiguous double-word compare-and-swap* - * malloc and free - * compiler directive for alignment of variables declared on the stack - * compiler directives for compiler barriers and processor barriers - -* A ''word'' here means a type equal in length to the platform pointer size. -* This requirement excludes the Alpha, IA64, MIPS, PowerPC and SPARC platforms. - -Also, your platform MAY support; - - * compiler keyword for function inlining - -To support the test programme, your platform MUST support; - - * determining the number of logical cores - * threads (starting and waiting on for completion) - -For documentation, see the porting guide (lfds) in the mediawiki. - -release history -=============== -release 1, 25th September 2009, svn revision 1574. - - initial release - -release 2, 5th October 2009, svn revision 1599. - - added abstraction layer for Windows kernel - - minor code tidyups/fixes - -release 3, 25th October 2009, svn revision 1652. - - added singly linked list (logical delete only) - - minor code tidyups/fixes - -release 4, 7th December 2009, svn revision 1716. - - added ARM support - - added benchmarking functionality to the test program - - fixed a profound and pervasive pointer - declaration bug; earlier releases of liblfds - *should not be used* - -release 5, 19th December 2009, svn revision 1738. - - fixed subtle queue bug, which also affected ringbuffer - and caused data re-ordering under high load - - added benchmarks for freelist, ringbuffer and stack - -release 6, 29th December 2009, svn revision 1746. - - fixed two implementation errors, which reduced performance, - spotted by Codeplug from "http://cboard.cprogramming.com". - -release 6.0.0, 18th December 2012, svn revision 2537 - - introduction of namespaces, e.g. the "lfds600_" prefix - code otherwise COMPLETELY AND WHOLLY UNCHANGED - this release is a stepping-stone to 6.1.0 - -release 6.0.1, 2nd January 2013, svn revision 3296 - - bug fix where an enum wasn't moved into the new namespacing policy - -release 6.1.0, 31th December 2012, svn revision 2600 - - fixed all existing non-enhancement bugs - - discovered some new bugs and fixed them too - - a very few minor changes/enhancements - -release 6.1.1, 2nd January 2013, svn revision 3297 - - crucial bug fix where compiler barriers for atomic operations - were not brought over from 7.0.0 during backporting - - minor fix for abstraction tests, two missing store barriers - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/runme_before_win_kernel_build_readme.txt b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/runme_before_win_kernel_build_readme.txt deleted file mode 100644 index d7087ecd4893bc9b2846f9c2a6bc94b4daf9a0e9..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/runme_before_win_kernel_build_readme.txt +++ /dev/null @@ -1,32 +0,0 @@ -The Windows kernel build environment is primitive and has a number -of severe limitations; in particular, all source files must be in -one directory and it is not possible to choose the output binary type -(static or dynamic library) from the build command line; rather, -a string has to be modified in a text file used by the build (!) - -To deal with these limitations, it is necessary for a Windows kernel -build to run a batch file prior to building. - -There are two batch files, one for static library builds and the other -for dynamic library builds. - -They are both idempotent; you can run them as often as you like and -switch between them as often as you want. It's all fine; whenever -you run one of them, it will take you from whatever state you were -previously in, into the state you want to be in. - -Both batch files copy all the sources file into a single directory, -"/src/single_dir_for_windows_kernel/". - -The static library batch file will then copy "/sources.static" into -"/src/single_dir_for_windows_kernel/", which will cause a static -library to be built. - -The dynamic library batch file will then copy "/sources.dynamic" into -"/src/single_dir_for_windows_kernel/", which will cause a dynamic -library to be built. It will also copy "src/driver_entry.c" into -"/src/single_dir_for_windows_kernel/", since the linker requires -the DriverEntry function to exist for dynamic libraries, even -though it's not used. - - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/runme_before_win_kernel_dynamic_lib_build.bat b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/runme_before_win_kernel_dynamic_lib_build.bat deleted file mode 100644 index 6a9f68b428045e601571efe3222e074137826673..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/runme_before_win_kernel_dynamic_lib_build.bat +++ /dev/null @@ -1,15 +0,0 @@ -@echo off -rmdir /q /s src\single_dir_for_windows_kernel 1>nul 2>nul -mkdir src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_abstraction\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_freelist\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_liblfds\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_queue\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_ringbuffer\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_slist\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_stack\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y sources.dynamic src\single_dir_for_windows_kernel\sources 1>nul 2>nul -copy /y src\driver_entry.c src\single_dir_for_windows_kernel 1>nul 2>nul -echo Windows kernel dynamic library build directory structure created. -echo (Note the effects of this batch file are idempotent). - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/runme_before_win_kernel_static_lib_build.bat b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/runme_before_win_kernel_static_lib_build.bat deleted file mode 100644 index a3b9362b0ee5c5e8408dbf2ad10caaf16253a5ae..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/runme_before_win_kernel_static_lib_build.bat +++ /dev/null @@ -1,15 +0,0 @@ -@echo off -rmdir /q /s src\single_dir_for_windows_kernel 1>nul 2>nul -mkdir src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_abstraction\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_freelist\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_liblfds\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_queue\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_ringbuffer\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_slist\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y src\lfds611_stack\* src\single_dir_for_windows_kernel 1>nul 2>nul -copy /y sources.static src\single_dir_for_windows_kernel\sources 1>nul 2>nul -erase /f src\single_dir_for_windows_kernel\driver_entry.c 1>nul 2>nul -echo Windows kernel static library build directory structure created. -echo (Note the effects of this batch file are idempotent). - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/sources.dynamic b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/sources.dynamic deleted file mode 100644 index 0ed73dc06e257cd9e0c4b53ed623a9572cdef6e8..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/sources.dynamic +++ /dev/null @@ -1,37 +0,0 @@ -MSC_WARNING_LEVEL = /WX /W4 -DLLDEF = ../../liblfds611.def -TARGETNAME = liblfds611 -TARGETPATH = ../../bin/ -TARGETTYPE = EXPORT_DRIVER -UMTYPE = nt -USER_C_FLAGS = /DWIN_KERNEL_BUILD - -INCLUDES = ..;../../inc/ -SOURCES = lfds611_abstraction_free.c \ - lfds611_abstraction_malloc.c \ - lfds611_freelist_delete.c \ - lfds611_freelist_get_and_set.c \ - lfds611_freelist_new.c \ - lfds611_freelist_pop_push.c \ - lfds611_freelist_query.c \ - lfds611_liblfds_abstraction_test_helpers.c \ - lfds611_liblfds_aligned_free.c \ - lfds611_liblfds_aligned_malloc.c \ - lfds611_queue_delete.c \ - lfds611_queue_new.c \ - lfds611_queue_query.c \ - lfds611_queue_queue.c \ - lfds611_ringbuffer_delete.c \ - lfds611_ringbuffer_get_and_put.c \ - lfds611_ringbuffer_new.c \ - lfds611_ringbuffer_query.c \ - lfds611_slist_delete.c \ - lfds611_slist_get_and_set.c \ - lfds611_slist_link.c \ - lfds611_slist_new.c \ - lfds611_stack_delete.c \ - lfds611_stack_new.c \ - lfds611_stack_push_pop.c \ - lfds611_stack_query.c \ - driver_entry.c - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/sources.static b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/sources.static deleted file mode 100644 index 64965033edb7511c9ec731124ea877e8a3ee8702..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/sources.static +++ /dev/null @@ -1,35 +0,0 @@ -MSC_WARNING_LEVEL = /WX /W4 -TARGETNAME = liblfds611 -TARGETPATH = ../../bin/ -TARGETTYPE = DRIVER_LIBRARY -UMTYPE = nt -USER_C_FLAGS = /DWIN_KERNEL_BUILD - -INCLUDES = ..;../../inc/ -SOURCES = lfds611_abstraction_free.c \ - lfds611_abstraction_malloc.c \ - lfds611_freelist_delete.c \ - lfds611_freelist_get_and_set.c \ - lfds611_freelist_new.c \ - lfds611_freelist_pop_push.c \ - lfds611_freelist_query.c \ - lfds611_liblfds_abstraction_test_helpers.c \ - lfds611_liblfds_aligned_free.c \ - lfds611_liblfds_aligned_malloc.c \ - lfds611_queue_delete.c \ - lfds611_queue_new.c \ - lfds611_queue_query.c \ - lfds611_queue_queue.c \ - lfds611_ringbuffer_delete.c \ - lfds611_ringbuffer_get_and_put.c \ - lfds611_ringbuffer_new.c \ - lfds611_ringbuffer_query.c \ - lfds611_slist_delete.c \ - lfds611_slist_get_and_set.c \ - lfds611_slist_link.c \ - lfds611_slist_new.c \ - lfds611_stack_delete.c \ - lfds611_stack_new.c \ - lfds611_stack_push_pop.c \ - lfds611_stack_query.c - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/dirs b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/dirs deleted file mode 100644 index 64e002cc57abf19f52e3d3c5dbc24a8629e36d1f..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/dirs +++ /dev/null @@ -1,3 +0,0 @@ -DIRS = single_dir_for_windows_kernel - - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/driver_entry.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/driver_entry.c deleted file mode 100644 index a2dac56f2da9b0a29f14f692f25c5896addacfa1..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/driver_entry.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "liblfds611_internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -NTSTATUS DriverEntry( struct _DRIVER_OBJECT *DriverObject, PUNICODE_STRING RegistryPath ) -{ - return( STATUS_SUCCESS ); -} - -#pragma warning( default : 4100 ) - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/driver_entry_readme.txt b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/driver_entry_readme.txt deleted file mode 100644 index a3979772f2804560e847ff5b44c6dad9971532db..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/driver_entry_readme.txt +++ /dev/null @@ -1,4 +0,0 @@ -This C file (driver_entry.c) is used when building a dynamic library for -the Windows kernel. It exists to work around one of the limitations of -that build environment. It is not used by any other build; just ignore it. - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_cas.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_cas.c deleted file mode 100644 index ed3d7d7d26da886ba4543321256970d561b19a49..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_cas.c +++ /dev/null @@ -1,71 +0,0 @@ -#include "lfds611_abstraction_internal_body.h" - - - - - -/****************************************************************************/ -#if (defined _WIN32 && defined _MSC_VER) - -/* TRD : 64 bit and 32 bit Windows (user-mode or kernel) on any CPU with the Microsoft C compiler - - _WIN32 indicates 64-bit or 32-bit Windows - _MSC_VER indicates Microsoft C compiler -*/ - -static LFDS611_INLINE lfds611_atom_t lfds611_abstraction_cas( volatile lfds611_atom_t *destination, lfds611_atom_t exchange, lfds611_atom_t compare ) -{ - lfds611_atom_t - rv; - - assert( destination != NULL ); - // TRD : exchange can be any value in its range - // TRD : compare can be any value in its range - - LFDS611_BARRIER_COMPILER_FULL; - - rv = (lfds611_atom_t) _InterlockedCompareExchangePointer( (void * volatile *) destination, (void *) exchange, (void *) compare ); - - LFDS611_BARRIER_COMPILER_FULL; - - return( rv ); -} - -#endif - - - - - -/****************************************************************************/ -#if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 1 && __GNUC_PATCHLEVEL__ >= 0) - -/* TRD : any OS on any CPU with GCC 4.1.0 or better - - GCC 4.1.0 introduced the __sync_*() atomic intrinsics - - __GNUC__ / __GNUC_MINOR__ / __GNUC_PATCHLEVEL__ indicates GCC and which version -*/ - -static LFDS611_INLINE lfds611_atom_t lfds611_abstraction_cas( volatile lfds611_atom_t *destination, lfds611_atom_t exchange, lfds611_atom_t compare ) -{ - lfds611_atom_t - rv; - - assert( destination != NULL ); - // TRD : exchange can be any value in its range - // TRD : compare can be any value in its range - - // TRD : note the different argument order for the GCC instrinsic to the MSVC instrinsic - - LFDS611_BARRIER_COMPILER_FULL; - - rv = (lfds611_atom_t) __sync_val_compare_and_swap( destination, compare, exchange ); - - LFDS611_BARRIER_COMPILER_FULL; - - return( rv ); -} - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_dcas.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_dcas.c deleted file mode 100644 index 61f243735bc3b83bbef7ca14c903163c956a9b9d..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_dcas.c +++ /dev/null @@ -1,157 +0,0 @@ -#include "lfds611_abstraction_internal_body.h" - - - - - -/****************************************************************************/ -#if (defined _WIN64 && defined _MSC_VER) - -/* TRD : 64 bit Windows (user-mode or kernel) on any CPU with the Microsoft C compiler - - _WIN64 indicates 64 bit Windows - _MSC_VER indicates Microsoft C compiler -*/ - -static LFDS611_INLINE unsigned char lfds611_abstraction_dcas( volatile lfds611_atom_t *destination, lfds611_atom_t *exchange, lfds611_atom_t *compare ) -{ - unsigned char - cas_result; - - assert( destination != NULL ); - assert( exchange != NULL ); - assert( compare != NULL ); - - LFDS611_BARRIER_COMPILER_FULL; - - cas_result = _InterlockedCompareExchange128( (volatile __int64 *) destination, (__int64) *(exchange+1), (__int64) *exchange, (__int64 *) compare ); - - LFDS611_BARRIER_COMPILER_FULL; - - return( cas_result ) ; -} - -#endif - - - - - -/****************************************************************************/ -#if (!defined _WIN64 && defined _WIN32 && defined _MSC_VER) - -/* TRD : 32 bit Windows (user-mode or kernel) on any CPU with the Microsoft C compiler - - (!defined _WIN64 && defined _WIN32) indicates 32 bit Windows - _MSC_VER indicates Microsoft C compiler -*/ - -static LFDS611_INLINE unsigned char lfds611_abstraction_dcas( volatile lfds611_atom_t *destination, lfds611_atom_t *exchange, lfds611_atom_t *compare ) -{ - __int64 - original_compare; - - assert( destination != NULL ); - assert( exchange != NULL ); - assert( compare != NULL ); - - *(__int64 *) &original_compare = *(__int64 *) compare; - - LFDS611_BARRIER_COMPILER_FULL; - - *(__int64 *) compare = _InterlockedCompareExchange64( (volatile __int64 *) destination, *(__int64 *) exchange, *(__int64 *) compare ); - - LFDS611_BARRIER_COMPILER_FULL; - - return( (unsigned char) (*(__int64 *) compare == *(__int64 *) &original_compare) ); -} - -#endif - - - - - -/****************************************************************************/ -#if (defined __x86_64__ && defined __GNUC__) - -/* TRD : any OS on x64 with GCC - - __x86_64__ indicates x64 - __GNUC__ indicates GCC -*/ - -static LFDS611_INLINE unsigned char lfds611_abstraction_dcas( volatile lfds611_atom_t *destination, lfds611_atom_t *exchange, lfds611_atom_t *compare ) -{ - unsigned char - cas_result; - - assert( destination != NULL ); - assert( exchange != NULL ); - assert( compare != NULL ); - - // TRD : __asm__ with "memory" in the clobber list is for GCC a full compiler barrier - __asm__ __volatile__ - ( - "lock;" // make cmpxchg16b atomic - "cmpxchg16b %0;" // cmpxchg16b sets ZF on success - "setz %3;" // if ZF set, set cas_result to 1 - - // output - : "+m" (*(volatile lfds611_atom_t (*)[2]) destination), "+a" (*compare), "+d" (*(compare+1)), "=q" (cas_result) - - // input - : "b" (*exchange), "c" (*(exchange+1)) - - // clobbered - : "cc", "memory" - ); - - return( cas_result ); -} - -#endif - - - - - -/****************************************************************************/ -#if ((defined __i686__ || defined __arm__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 1 && __GNUC_PATCHLEVEL__ >= 0) - -/* TRD : any OS on x86 or ARM with GCC 4.1.0 or better - - GCC 4.1.0 introduced the __sync_*() atomic intrinsics - - __GNUC__ / __GNUC_MINOR__ / __GNUC_PATCHLEVEL__ indicates GCC and which version -*/ - -static LFDS611_INLINE unsigned char lfds611_abstraction_dcas( volatile lfds611_atom_t *destination, lfds611_atom_t *exchange, lfds611_atom_t *compare ) -{ - unsigned char - cas_result = 0; - - unsigned long long int - original_destination; - - assert( destination != NULL ); - assert( exchange != NULL ); - assert( compare != NULL ); - - LFDS611_BARRIER_COMPILER_FULL; - - original_destination = __sync_val_compare_and_swap( (volatile unsigned long long int *) destination, *(unsigned long long int *) compare, *(unsigned long long int *) exchange ); - - LFDS611_BARRIER_COMPILER_FULL; - - if( original_destination == *(unsigned long long int *) compare ) - cas_result = 1; - - *(unsigned long long int *) compare = original_destination; - - return( cas_result ); -} - -#endif - - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_free.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_free.c deleted file mode 100644 index e582374c986e4ea97a3f72dd0929d77fe887ae38..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_free.c +++ /dev/null @@ -1,44 +0,0 @@ -#include "lfds611_abstraction_internal_wrapper.h" - - - - - -/****************************************************************************/ -#if (!defined WIN_KERNEL_BUILD) - -/* TRD : any OS except Windows kernel on any CPU with any compiler - - !WIN_KERNEL_BUILD indicates not Windows kernel -*/ - -void lfds611_abstraction_free( void *memory ) -{ - free( memory ); - - return; -} - -#endif - - - - - -/****************************************************************************/ -#if (defined WIN_KERNEL_BUILD) - -/* TRD : any Windows (kernel) on any CPU with the Microsoft C compiler - - WIN_KERNEL_BUILD indicates Windows kernel -*/ - -void lfds611_abstraction_free( void *memory ) -{ - ExFreePoolWithTag( memory, 'sdfl' ); - - return; -} - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_increment.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_increment.c deleted file mode 100644 index 4cdd068d0227c574d473c5740da3b0c67eb15c54..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_increment.c +++ /dev/null @@ -1,98 +0,0 @@ -#include "lfds611_abstraction_internal_body.h" - - - - - -/****************************************************************************/ -#if (defined _WIN64 && defined _MSC_VER) - -/* TRD : 64 bit Windows (user-mode or kernel) on any CPU with the Microsoft C compiler - - _WIN64 indicates 64 bit Windows - _MSC_VER indicates Microsoft C compiler -*/ - -static LFDS611_INLINE lfds611_atom_t lfds611_abstraction_increment( volatile lfds611_atom_t *value ) -{ - lfds611_atom_t - rv; - - assert( value != NULL ); - - LFDS611_BARRIER_COMPILER_FULL; - - rv = (lfds611_atom_t) _InterlockedIncrement64( (__int64 *) value ); - - LFDS611_BARRIER_COMPILER_FULL; - - return( rv ); -} - -#endif - - - - - -/****************************************************************************/ -#if (!defined _WIN64 && defined _WIN32 && defined _MSC_VER) - -/* TRD : 32 bit Windows (user-mode or kernel) on any CPU with the Microsoft C compiler - - (!defined _WIN64 && defined _WIN32) indicates 32 bit Windows - _MSC_VER indicates Microsoft C compiler -*/ - -static LFDS611_INLINE lfds611_atom_t lfds611_abstraction_increment( volatile lfds611_atom_t *value ) -{ - lfds611_atom_t - rv; - - assert( value != NULL ); - - LFDS611_BARRIER_COMPILER_FULL; - - rv = (lfds611_atom_t) _InterlockedIncrement( (long int *) value ); - - LFDS611_BARRIER_COMPILER_FULL; - - return( rv ); -} - -#endif - - - - - -/****************************************************************************/ -#if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 1 && __GNUC_PATCHLEVEL__ >= 0) - -/* TRD : any OS on any CPU with GCC 4.1.0 or better - - GCC 4.1.0 introduced the __sync_*() atomic intrinsics - - __GNUC__ / __GNUC_MINOR__ / __GNUC_PATCHLEVEL__ indicates GCC and which version -*/ - -static LFDS611_INLINE lfds611_atom_t lfds611_abstraction_increment( volatile lfds611_atom_t *value ) -{ - lfds611_atom_t - rv; - - assert( value != NULL ); - - // TRD : no need for casting here, GCC has a __sync_add_and_fetch() for all native types - - LFDS611_BARRIER_COMPILER_FULL; - - rv = (lfds611_atom_t) __sync_add_and_fetch( value, 1 ); - - LFDS611_BARRIER_COMPILER_FULL; - - return( rv ); -} - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_internal_body.h b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_internal_body.h deleted file mode 100644 index ac10143514dadc64e207e7bb4702d1777419932c..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_internal_body.h +++ /dev/null @@ -1,2 +0,0 @@ -/***** private prototypes *****/ - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_internal_wrapper.h b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_internal_wrapper.h deleted file mode 100644 index c9129c2748bec83e38ad3388cee19de3d72fc063..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_internal_wrapper.h +++ /dev/null @@ -1,6 +0,0 @@ -/***** the library wide include file *****/ -#include "liblfds611_internal.h" - -/***** the internal header body *****/ -#include "lfds611_abstraction_internal_body.h" - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_malloc.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_malloc.c deleted file mode 100644 index d97b820872fec2efcf2749d9b38946f51b7f32a2..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_abstraction/lfds611_abstraction_malloc.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "lfds611_abstraction_internal_wrapper.h" - - - - - -/****************************************************************************/ -#if (!defined WIN_KERNEL_BUILD) - -/* TRD : any OS except Windows kernel on any CPU with any compiler - - !WIN_KERNEL_BUILD indicates not Windows kernel -*/ - -void *lfds611_abstraction_malloc( size_t size ) -{ - return( malloc(size) ); -} - -#endif - - - - - -/****************************************************************************/ -#if (defined WIN_KERNEL_BUILD) - -/* TRD : any Windows (kernel) on any CPU with the Microsoft C compiler - - WIN_KERNEL_BUILD indicates Windows kernel -*/ - -void *lfds611_abstraction_malloc( size_t size ) -{ - return( ExAllocatePoolWithTag(NonPagedPool, size, 'sdfl') ); -} - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_delete.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_delete.c deleted file mode 100644 index b5de6f6ac2378192bc4a6fe20b6d359142905066..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_delete.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "lfds611_freelist_internal.h" - - - - - -/****************************************************************************/ -void lfds611_freelist_delete( struct lfds611_freelist_state *fs, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state ) -{ - struct lfds611_freelist_element - *fe; - - void - *user_data; - - assert( fs != NULL ); - // TRD : user_data_delete_function can be NULL - // TRD : user_state can be NULL - - // TRD : leading load barrier not required as it will be performed by the pop - - while( lfds611_freelist_pop(fs, &fe) ) { - if( user_data_delete_function != NULL ) { - lfds611_freelist_get_user_data_from_element( fe, &user_data ); - user_data_delete_function( user_data, user_state ); - } - - lfds611_liblfds_aligned_free( fe ); - } - - lfds611_liblfds_aligned_free( fs ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_get_and_set.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_get_and_set.c deleted file mode 100644 index 9e5108c5b5fb18bbfaef839519550f71ac5e3cd2..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_get_and_set.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "lfds611_freelist_internal.h" - - - - - -/****************************************************************************/ -void *lfds611_freelist_get_user_data_from_element( struct lfds611_freelist_element *fe, void **user_data ) -{ - assert( fe != NULL ); - // TRD : user_data can be NULL - - LFDS611_BARRIER_LOAD; - - if( user_data != NULL ) - *user_data = fe->user_data; - - return( fe->user_data ); -} - - - - - -/****************************************************************************/ -void lfds611_freelist_set_user_data_in_element( struct lfds611_freelist_element *fe, void *user_data ) -{ - assert( fe != NULL ); - // TRD : user_data can be NULL - - fe->user_data = user_data; - - LFDS611_BARRIER_STORE; - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_internal.h b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_internal.h deleted file mode 100644 index a593a4d9590ec1c40e39567f0813ad94383b818b..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_internal.h +++ /dev/null @@ -1,40 +0,0 @@ -/***** the library wide include file *****/ -#include "liblfds611_internal.h" - -/***** defines *****/ -#define LFDS611_FREELIST_POINTER 0 -#define LFDS611_FREELIST_COUNTER 1 -#define LFDS611_FREELIST_PAC_SIZE 2 - -/***** structures *****/ -#pragma pack( push, LFDS611_ALIGN_DOUBLE_POINTER ) - -struct lfds611_freelist_state { - struct lfds611_freelist_element - *volatile top[LFDS611_FREELIST_PAC_SIZE]; - - int - (*user_data_init_function)( void **user_data, void *user_state ); - - void - *user_state; - - lfds611_atom_t - aba_counter, - element_count; -}; - -struct lfds611_freelist_element { - struct lfds611_freelist_element - *next[LFDS611_FREELIST_PAC_SIZE]; - - void - *user_data; -}; - -#pragma pack( pop ) - -/***** private prototypes *****/ -lfds611_atom_t lfds611_freelist_internal_new_element( struct lfds611_freelist_state *fs, struct lfds611_freelist_element **fe ); -void lfds611_freelist_internal_validate( struct lfds611_freelist_state *fs, struct lfds611_validation_info *vi, enum lfds611_data_structure_validity *lfds611_freelist_validity ); - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_new.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_new.c deleted file mode 100644 index 2eeae80097f2e85ca6bb40e95d0a5a346c48b6b8..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_new.c +++ /dev/null @@ -1,136 +0,0 @@ -#include "lfds611_freelist_internal.h" - - - - - -/****************************************************************************/ -int lfds611_freelist_new( struct lfds611_freelist_state **fs, lfds611_atom_t number_elements, int (*user_data_init_function)(void **user_data, void *user_state), void *user_state ) -{ - int - rv = 0; - - lfds611_atom_t - element_count; - - assert( fs != NULL ); - // TRD : number_elements can be any value in its range - // TRD : user_data_init_function can be NULL - - *fs = (struct lfds611_freelist_state *) lfds611_liblfds_aligned_malloc( sizeof(struct lfds611_freelist_state), LFDS611_ALIGN_DOUBLE_POINTER ); - - if( (*fs) != NULL ) { - (*fs)->top[LFDS611_FREELIST_POINTER] = NULL; - (*fs)->top[LFDS611_FREELIST_COUNTER] = 0; - (*fs)->user_data_init_function = user_data_init_function; - (*fs)->user_state = user_state; - (*fs)->aba_counter = 0; - (*fs)->element_count = 0; - - element_count = lfds611_freelist_new_elements( *fs, number_elements ); - - if( element_count == number_elements ) - rv = 1; - - if( element_count != number_elements ) { - lfds611_liblfds_aligned_free( (*fs) ); - *fs = NULL; - } - } - - LFDS611_BARRIER_STORE; - - return( rv ); -} - - - - - -/****************************************************************************/ -//#pragma warning( disable : 4100 ) - -void lfds611_freelist_use( struct lfds611_freelist_state *fs ) -{ - assert( fs != NULL ); - - LFDS611_BARRIER_LOAD; - - return; -} - -//#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -lfds611_atom_t lfds611_freelist_new_elements( struct lfds611_freelist_state *fs, lfds611_atom_t number_elements ) -{ - struct lfds611_freelist_element - *fe; - - lfds611_atom_t - loop, - count = 0; - - assert( fs != NULL ); - // TRD : number_elements can be any value in its range - // TRD : user_data_init_function can be NULL - - for( loop = 0 ; loop < number_elements ; loop++ ) - if( lfds611_freelist_internal_new_element(fs, &fe) ) { - lfds611_freelist_push( fs, fe ); - count++; - } - - return( count ); -} - - - - - -/****************************************************************************/ -lfds611_atom_t lfds611_freelist_internal_new_element( struct lfds611_freelist_state *fs, struct lfds611_freelist_element **fe ) -{ - lfds611_atom_t - rv = 0; - - assert( fs != NULL ); - assert( fe != NULL ); - - /* TRD : basically, does what you'd expect; - - allocates an element - calls the user init function - if anything fails, cleans up, - sets *fe to NULL - and returns 0 - */ - - *fe = (struct lfds611_freelist_element *) lfds611_liblfds_aligned_malloc( sizeof(struct lfds611_freelist_element), LFDS611_ALIGN_DOUBLE_POINTER ); - - if( *fe != NULL ) { - if( fs->user_data_init_function == NULL ) { - (*fe)->user_data = NULL; - rv = 1; - } - - if( fs->user_data_init_function != NULL ) { - rv = fs->user_data_init_function( &(*fe)->user_data, fs->user_state ); - - if( rv == 0 ) { - lfds611_liblfds_aligned_free( *fe ); - *fe = NULL; - } - } - } - - if( rv == 1 ) - lfds611_abstraction_increment( (lfds611_atom_t *) &fs->element_count ); - - return( rv ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_pop_push.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_pop_push.c deleted file mode 100644 index c0e22824141d173fad7d2b9168b076b1dd5e77f0..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_pop_push.c +++ /dev/null @@ -1,87 +0,0 @@ -#include "lfds611_freelist_internal.h" - - - - - -/****************************************************************************/ -struct lfds611_freelist_element *lfds611_freelist_pop( struct lfds611_freelist_state *fs, struct lfds611_freelist_element **fe ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) struct lfds611_freelist_element - *fe_local[LFDS611_FREELIST_PAC_SIZE]; - - assert( fs != NULL ); - assert( fe != NULL ); - - LFDS611_BARRIER_LOAD; - - fe_local[LFDS611_FREELIST_COUNTER] = fs->top[LFDS611_FREELIST_COUNTER]; - fe_local[LFDS611_FREELIST_POINTER] = fs->top[LFDS611_FREELIST_POINTER]; - - /* TRD : note that lfds611_abstraction_dcas loads the original value of the destination (fs->top) into the compare (fe_local) - (this happens of course after the CAS itself has occurred inside lfds611_abstraction_dcas) - */ - - do { - if( fe_local[LFDS611_FREELIST_POINTER] == NULL ) { - *fe = NULL; - return( *fe ); - } - } while( 0 == lfds611_abstraction_dcas((volatile lfds611_atom_t *) fs->top, (lfds611_atom_t *) fe_local[LFDS611_FREELIST_POINTER]->next, (lfds611_atom_t *) fe_local) ); - - *fe = (struct lfds611_freelist_element *) fe_local[LFDS611_FREELIST_POINTER]; - - return( *fe ); -} - - - - - -/****************************************************************************/ -struct lfds611_freelist_element *lfds611_freelist_guaranteed_pop( struct lfds611_freelist_state *fs, struct lfds611_freelist_element **fe ) -{ - assert( fs != NULL ); - assert( fe != NULL ); - - lfds611_freelist_internal_new_element( fs, fe ); - - return( *fe ); -} - - - - - -/****************************************************************************/ -void lfds611_freelist_push( struct lfds611_freelist_state *fs, struct lfds611_freelist_element *fe ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) struct lfds611_freelist_element - *fe_local[LFDS611_FREELIST_PAC_SIZE], - *original_fe_next[LFDS611_FREELIST_PAC_SIZE]; - - assert( fs != NULL ); - assert( fe != NULL ); - - LFDS611_BARRIER_LOAD; - - fe_local[LFDS611_FREELIST_POINTER] = fe; - fe_local[LFDS611_FREELIST_COUNTER] = (struct lfds611_freelist_element *) lfds611_abstraction_increment( (lfds611_atom_t *) &fs->aba_counter ); - - original_fe_next[LFDS611_FREELIST_POINTER] = fs->top[LFDS611_FREELIST_POINTER]; - original_fe_next[LFDS611_FREELIST_COUNTER] = fs->top[LFDS611_FREELIST_COUNTER]; - - /* TRD : note that lfds611_abstraction_dcas loads the original value of the destination (fs->top) into the compare (original_fe_next) - (this happens of course after the CAS itself has occurred inside lfds611_abstraction_dcas) - this then causes us in our loop, should we repeat it, to update fe_local->next to a more - up-to-date version of the head of the lfds611_freelist - */ - - do { - fe_local[LFDS611_FREELIST_POINTER]->next[LFDS611_FREELIST_POINTER] = original_fe_next[LFDS611_FREELIST_POINTER]; - fe_local[LFDS611_FREELIST_POINTER]->next[LFDS611_FREELIST_COUNTER] = original_fe_next[LFDS611_FREELIST_COUNTER]; - } while( 0 == lfds611_abstraction_dcas((volatile lfds611_atom_t *) fs->top, (lfds611_atom_t *) fe_local, (lfds611_atom_t *) original_fe_next) ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_query.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_query.c deleted file mode 100644 index 9e42ee0361e517b97b39ceefc9a350ece2b62bf2..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_freelist/lfds611_freelist_query.c +++ /dev/null @@ -1,110 +0,0 @@ -#include "lfds611_freelist_internal.h" - - - - - -/****************************************************************************/ -void lfds611_freelist_query( struct lfds611_freelist_state *fs, enum lfds611_freelist_query_type query_type, void *query_input, void *query_output ) -{ - assert( fs != NULL ); - // TRD : query type can be any value in its range - // TRD : query_input can be NULL in some cases - assert( query_output != NULL ); - - LFDS611_BARRIER_LOAD; - - switch( query_type ) { - case LFDS611_FREELIST_QUERY_ELEMENT_COUNT: - assert( query_input == NULL ); - - *(lfds611_atom_t *) query_output = fs->element_count; - break; - - case LFDS611_FREELIST_QUERY_VALIDATE: - // TRD : query_input can be NULL - - lfds611_freelist_internal_validate( fs, (struct lfds611_validation_info *) query_input, (enum lfds611_data_structure_validity *) query_output ); - break; - } - - return; -} - - - - - -/****************************************************************************/ -void lfds611_freelist_internal_validate( struct lfds611_freelist_state *fs, struct lfds611_validation_info *vi, enum lfds611_data_structure_validity *lfds611_freelist_validity ) -{ - struct lfds611_freelist_element - *fe, - *fe_slow, - *fe_fast; - - lfds611_atom_t - element_count = 0; - - assert( fs != NULL ); - // TRD : vi can be NULL - assert( lfds611_freelist_validity != NULL ); - - *lfds611_freelist_validity = LFDS611_VALIDITY_VALID; - - fe_slow = fe_fast = (struct lfds611_freelist_element *) fs->top[LFDS611_FREELIST_POINTER]; - - /* TRD : first, check for a loop - we have two pointers - both of which start at the top of the lfds611_freelist - we enter a loop - and on each iteration - we advance one pointer by one element - and the other by two - - we exit the loop when both pointers are NULL - (have reached the end of the lfds611_freelist) - - or - - if we fast pointer 'sees' the slow pointer - which means we have a loop - */ - - if( fe_slow != NULL ) - do { - fe_slow = fe_slow->next[LFDS611_FREELIST_POINTER]; - - if( fe_fast != NULL ) - fe_fast = fe_fast->next[LFDS611_FREELIST_POINTER]; - - if( fe_fast != NULL ) - fe_fast = fe_fast->next[LFDS611_FREELIST_POINTER]; - } while( fe_slow != NULL and fe_fast != fe_slow ); - - if( fe_fast != NULL and fe_slow != NULL and fe_fast == fe_slow ) - *lfds611_freelist_validity = LFDS611_VALIDITY_INVALID_LOOP; - - /* TRD : now check for expected number of elements - vi can be NULL, in which case we do not check - we know we don't have a loop from our earlier check - */ - - if( *lfds611_freelist_validity == LFDS611_VALIDITY_VALID and vi != NULL ) { - fe = (struct lfds611_freelist_element *) fs->top[LFDS611_FREELIST_POINTER]; - - while( fe != NULL ) { - element_count++; - fe = (struct lfds611_freelist_element *) fe->next[LFDS611_FREELIST_POINTER]; - } - - if( element_count < vi->min_elements ) - *lfds611_freelist_validity = LFDS611_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( element_count > vi->max_elements ) - *lfds611_freelist_validity = LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_abstraction_test_helpers.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_abstraction_test_helpers.c deleted file mode 100644 index a015159b7f4b8c9afcdef5bdc622dec637225e11..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_abstraction_test_helpers.c +++ /dev/null @@ -1,106 +0,0 @@ -#include "lfds611_liblfds_internal.h" - - - - - -/****************************************************************************/ -void lfds611_liblfds_abstraction_test_helper_increment_non_atomic( lfds611_atom_t *shared_counter ) -{ - /* TRD : lfds611_atom_t must be volatile or the compiler - optimizes it away into a single store - */ - - volatile lfds611_atom_t - count = 0; - - assert( shared_counter != NULL ); - - while( count++ < 10000000 ) - (*(lfds611_atom_t *) shared_counter)++; - - return; -} - - - - - -/****************************************************************************/ -void lfds611_liblfds_abstraction_test_helper_increment_atomic( volatile lfds611_atom_t *shared_counter ) -{ - lfds611_atom_t - count = 0; - - assert( shared_counter != NULL ); - - while( count++ < 10000000 ) - lfds611_abstraction_increment( shared_counter ); - - return; -} - - - - - -/****************************************************************************/ -void lfds611_liblfds_abstraction_test_helper_cas( volatile lfds611_atom_t *shared_counter, lfds611_atom_t *local_counter ) -{ - lfds611_atom_t - loop = 0, - original_destination; - - LFDS611_ALIGN(LFDS611_ALIGN_SINGLE_POINTER) lfds611_atom_t - exchange, - compare; - - assert( shared_counter != NULL ); - assert( local_counter != NULL ); - - while( loop++ < 1000000 ) { - do { - compare = *shared_counter; - exchange = compare + 1; - - original_destination = lfds611_abstraction_cas( shared_counter, exchange, compare ); - } while( original_destination != compare ); - - (*local_counter)++; - } - - return; -} - - - - - -/****************************************************************************/ -void lfds611_liblfds_abstraction_test_helper_dcas( volatile lfds611_atom_t *shared_counter, lfds611_atom_t *local_counter ) -{ - lfds611_atom_t - loop = 0; - - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) lfds611_atom_t - exchange[2], - compare[2]; - - assert( shared_counter != NULL ); - assert( local_counter != NULL ); - - while( loop++ < 1000000 ) { - compare[0] = *shared_counter; - compare[1] = *(shared_counter+1); - - do { - exchange[0] = compare[0] + 1; - exchange[1] = compare[1]; - } while( 0 == lfds611_abstraction_dcas(shared_counter, exchange, compare) ); - - (*local_counter)++; - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_aligned_free.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_aligned_free.c deleted file mode 100644 index 0449f8b24445a2d1921616f7e03d3999f7152700..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_aligned_free.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "lfds611_liblfds_internal.h" - - - - - -/****************************************************************************/ -void lfds611_liblfds_aligned_free( void *memory ) -{ - assert( memory != NULL ); - - // TRD : the "void *" stored above memory points to the root of the allocation - lfds611_abstraction_free( *( (void **) memory - 1 ) ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_aligned_malloc.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_aligned_malloc.c deleted file mode 100644 index ef6ee5742660cde40c65fd3c5da7b15055212f68..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_aligned_malloc.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "lfds611_liblfds_internal.h" - - - - - -/****************************************************************************/ -void *lfds611_liblfds_aligned_malloc( size_t size, size_t align_in_bytes ) -{ - void - *original_memory, - *memory; - - size_t - offset; - - // TRD : size can be any value in its range - // TRD : align_in_bytes can be any value in its range - - original_memory = memory = lfds611_abstraction_malloc( size + sizeof(void *) + align_in_bytes ); - - if( memory != NULL ) { - memory = (void **) memory + 1; - offset = align_in_bytes - (size_t) memory % align_in_bytes; - memory = (unsigned char *) memory + offset; - *( (void **) memory - 1 ) = original_memory; - } - - return( memory ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_internal.h b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_internal.h deleted file mode 100644 index d6fa1227594d94bd4c32747557b888e17c4a8490..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_internal.h +++ /dev/null @@ -1,4 +0,0 @@ -/***** the library wide include file *****/ -#include "liblfds611_internal.h" - - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_readme.txt b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_readme.txt deleted file mode 100644 index aa3327028ccf792e233afd6a0c9db829c1c2e871..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_liblfds/lfds611_liblfds_readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -This is not a data structure but rather functions internal to the library. - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_delete.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_delete.c deleted file mode 100644 index a11b501e56f4ff1dde5157e36807e90d190198b6..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_delete.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "lfds611_queue_internal.h" - - - - - -/****************************************************************************/ -void lfds611_queue_delete( struct lfds611_queue_state *qs, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state ) -{ - void - *user_data; - - assert( qs != NULL ); - // TRD : user_data_delete_function can be NULL - // TRD : user_state can be NULL - - // TRD : leading load barrier not required as it will be performed by the dequeue - - while( lfds611_queue_dequeue(qs, &user_data) ) - if( user_data_delete_function != NULL ) - user_data_delete_function( user_data, user_state ); - - /* TRD : fully dequeuing will leave us - with a single dummy element - which both qs->enqueue and qs->dequeue point at - we push this back onto the lfds611_freelist - before we delete the lfds611_freelist - */ - - lfds611_freelist_push( qs->fs, qs->enqueue[LFDS611_QUEUE_POINTER]->fe ); - - lfds611_freelist_delete( qs->fs, lfds611_queue_internal_freelist_delete_function, NULL ); - - lfds611_liblfds_aligned_free( qs ); - - return; -} - - - - - -/****************************************************************************/ -//#pragma warning( disable : 4100 ) - -void lfds611_queue_internal_freelist_delete_function( void *user_data, void *user_state ) -{ - assert( user_data != NULL ); - assert( user_state == NULL ); - - lfds611_liblfds_aligned_free( user_data ); - - return; -} - -//#pragma warning( default : 4100 ) - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_internal.h b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_internal.h deleted file mode 100644 index e84e35035a7509cc8c21031bc775d9efa0ac9d7c..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_internal.h +++ /dev/null @@ -1,59 +0,0 @@ -/***** the library wide include file *****/ -#include "liblfds611_internal.h" - -/***** pragmas *****/ - -/***** defines *****/ -#define LFDS611_QUEUE_STATE_UNKNOWN -1 -#define LFDS611_QUEUE_STATE_EMPTY 0 -#define LFDS611_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE 1 -#define LFDS611_QUEUE_STATE_ATTEMPT_DELFDS611_QUEUE 2 - -#define LFDS611_QUEUE_POINTER 0 -#define LFDS611_QUEUE_COUNTER 1 -#define LFDS611_QUEUE_PAC_SIZE 2 - -/***** structures *****/ -#pragma pack( push, LFDS611_ALIGN_DOUBLE_POINTER ) - -struct lfds611_queue_state { - struct lfds611_queue_element - *volatile enqueue[LFDS611_QUEUE_PAC_SIZE], - *volatile dequeue[LFDS611_QUEUE_PAC_SIZE]; - - lfds611_atom_t - aba_counter; - - struct lfds611_freelist_state - *fs; -}; - -struct lfds611_queue_element { - // TRD : next in a lfds611_queue requires volatile as it is target of CAS - struct lfds611_queue_element - *volatile next[LFDS611_QUEUE_PAC_SIZE]; - - struct lfds611_freelist_element - *fe; - - void - *user_data; -}; - -#pragma pack( pop ) - -/***** externs *****/ - -/***** private prototypes *****/ -int lfds611_queue_internal_freelist_init_function( void **user_data, void *user_state ); -void lfds611_queue_internal_freelist_delete_function( void *user_data, void *user_state ); - -void lfds611_queue_internal_new_element_from_freelist( struct lfds611_queue_state *qs, struct lfds611_queue_element *qe[LFDS611_QUEUE_PAC_SIZE], void *user_data ); -void lfds611_queue_internal_guaranteed_new_element_from_freelist( struct lfds611_queue_state *qs, struct lfds611_queue_element * qe[LFDS611_QUEUE_PAC_SIZE], void *user_data ); -void lfds611_queue_internal_init_element( struct lfds611_queue_state *qs, struct lfds611_queue_element *qe[LFDS611_QUEUE_PAC_SIZE], struct lfds611_freelist_element *fe, void *user_data ); - -void lfds611_queue_internal_queue( struct lfds611_queue_state *qs, struct lfds611_queue_element *qe[LFDS611_QUEUE_PAC_SIZE] ); - -void lfds611_queue_internal_validate( struct lfds611_queue_state *qs, struct lfds611_validation_info *vi, enum lfds611_data_structure_validity *lfds611_queue_validity, - enum lfds611_data_structure_validity *lfds611_freelist_validity ); - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_new.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_new.c deleted file mode 100644 index 7fec0a2e9024940431b27a02294953408764bd10..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_new.c +++ /dev/null @@ -1,158 +0,0 @@ -#include "lfds611_queue_internal.h" - - - - - -/****************************************************************************/ -int lfds611_queue_new( struct lfds611_queue_state **qs, lfds611_atom_t number_elements ) -{ - int - rv = 0; - - struct lfds611_queue_element - *qe[LFDS611_QUEUE_PAC_SIZE]; - - assert( qs != NULL ); - // TRD : number_elements can be any value in its range - - *qs = (struct lfds611_queue_state *) lfds611_liblfds_aligned_malloc( sizeof(struct lfds611_queue_state), LFDS611_ALIGN_DOUBLE_POINTER ); - - if( *qs != NULL ) { - // TRD : the size of the lfds611_freelist is the size of the lfds611_queue (+1 for the leading dummy element, which is hidden from the caller) - lfds611_freelist_new( &(*qs)->fs, number_elements+1, lfds611_queue_internal_freelist_init_function, NULL ); - - if( (*qs)->fs != NULL ) { - lfds611_queue_internal_new_element_from_freelist( *qs, qe, NULL ); - (*qs)->enqueue[LFDS611_QUEUE_POINTER] = (*qs)->dequeue[LFDS611_QUEUE_POINTER] = qe[LFDS611_QUEUE_POINTER]; - (*qs)->enqueue[LFDS611_QUEUE_COUNTER] = (*qs)->dequeue[LFDS611_QUEUE_COUNTER] = 0; - (*qs)->aba_counter = 0; - rv = 1; - } - - if( (*qs)->fs == NULL ) { - lfds611_liblfds_aligned_free( *qs ); - *qs = NULL; - } - } - - LFDS611_BARRIER_STORE; - - return( rv ); -} - - - - - -/****************************************************************************/ -//#pragma warning( disable : 4100 ) - -void lfds611_queue_use( struct lfds611_queue_state *qs ) -{ - assert( qs != NULL ); - - LFDS611_BARRIER_LOAD; - - return; -} - -//#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -//#pragma warning( disable : 4100 ) - -int lfds611_queue_internal_freelist_init_function( void **user_data, void *user_state ) -{ - int - rv = 0; - - assert( user_data != NULL ); - assert( user_state == NULL ); - - *user_data = lfds611_liblfds_aligned_malloc( sizeof(struct lfds611_queue_element), LFDS611_ALIGN_DOUBLE_POINTER ); - - if( *user_data != NULL ) - rv = 1; - - return( rv ); -} - -//#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -void lfds611_queue_internal_new_element_from_freelist( struct lfds611_queue_state *qs, struct lfds611_queue_element *qe[LFDS611_QUEUE_PAC_SIZE], void *user_data ) -{ - struct lfds611_freelist_element - *fe; - - assert( qs != NULL ); - assert( qe != NULL ); - // TRD : user_data can be any value in its range - - qe[LFDS611_QUEUE_POINTER] = NULL; - - lfds611_freelist_pop( qs->fs, &fe ); - - if( fe != NULL ) - lfds611_queue_internal_init_element( qs, qe, fe, user_data ); - - return; -} - - - - - -/****************************************************************************/ -void lfds611_queue_internal_guaranteed_new_element_from_freelist( struct lfds611_queue_state *qs, struct lfds611_queue_element *qe[LFDS611_QUEUE_PAC_SIZE], void *user_data ) -{ - struct lfds611_freelist_element - *fe; - - assert( qs != NULL ); - assert( qe != NULL ); - // TRD : user_data can be any value in its range - - qe[LFDS611_QUEUE_POINTER] = NULL; - - lfds611_freelist_guaranteed_pop( qs->fs, &fe ); - - if( fe != NULL ) - lfds611_queue_internal_init_element( qs, qe, fe, user_data ); - - return; -} - - - - - -/****************************************************************************/ -void lfds611_queue_internal_init_element( struct lfds611_queue_state *qs, struct lfds611_queue_element *qe[LFDS611_QUEUE_PAC_SIZE], struct lfds611_freelist_element *fe, void *user_data ) -{ - assert( qs != NULL ); - assert( qe != NULL ); - assert( fe != NULL ); - // TRD : user_data can be any value in its range - - lfds611_freelist_get_user_data_from_element( fe, (void **) &qe[LFDS611_QUEUE_POINTER] ); - qe[LFDS611_QUEUE_COUNTER] = (struct lfds611_queue_element *) lfds611_abstraction_increment( (lfds611_atom_t *) &qs->aba_counter ); - - qe[LFDS611_QUEUE_POINTER]->next[LFDS611_QUEUE_POINTER] = NULL; - qe[LFDS611_QUEUE_POINTER]->next[LFDS611_QUEUE_COUNTER] = (struct lfds611_queue_element *) lfds611_abstraction_increment( (lfds611_atom_t *) &qs->aba_counter ); - - qe[LFDS611_QUEUE_POINTER]->fe = fe; - qe[LFDS611_QUEUE_POINTER]->user_data = user_data; - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_query.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_query.c deleted file mode 100644 index 504485d7b5b278f7232ad093bbc4691926adbf31..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_query.c +++ /dev/null @@ -1,150 +0,0 @@ -#include "lfds611_queue_internal.h" - - - - - -/****************************************************************************/ -//#pragma warning( disable : 4100 ) - -void lfds611_queue_query( struct lfds611_queue_state *qs, enum lfds611_queue_query_type query_type, void *query_input, void *query_output ) -{ - assert( qs != NULL ); - // TRD : query_type can be any value in its range - // TRD : query_input can be NULL - assert( query_output != NULL ); - - switch( query_type ) { - case LFDS611_QUEUE_QUERY_ELEMENT_COUNT: - assert( query_input == NULL ); - - lfds611_freelist_query( qs->fs, LFDS611_FREELIST_QUERY_ELEMENT_COUNT, NULL, query_output ); - break; - - case LFDS611_QUEUE_QUERY_VALIDATE: - // TRD : query_input can be NULL - - lfds611_queue_internal_validate( qs, (struct lfds611_validation_info *) query_input, (enum lfds611_data_structure_validity *) query_output, ((enum lfds611_data_structure_validity *) query_output)+1 ); - break; - } - - return; -} - -//#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -void lfds611_queue_internal_validate( struct lfds611_queue_state *qs, struct lfds611_validation_info *vi, enum lfds611_data_structure_validity *lfds611_queue_validity, - enum lfds611_data_structure_validity *lfds611_freelist_validity ) -{ - struct lfds611_queue_element - *qe, - *qe_slow, - *qe_fast; - - lfds611_atom_t - element_count = 0, - total_elements; - - struct lfds611_validation_info - lfds611_freelist_vi; - - assert( qs != NULL ); - // TRD : vi can be NULL - assert( lfds611_queue_validity != NULL ); - assert( lfds611_freelist_validity != NULL ); - - *lfds611_queue_validity = LFDS611_VALIDITY_VALID; - - LFDS611_BARRIER_LOAD; - - qe_slow = qe_fast = (struct lfds611_queue_element *) qs->dequeue[LFDS611_QUEUE_POINTER]; - - /* TRD : first, check for a loop - we have two pointers - both of which start at the dequeue end of the lfds611_queue - we enter a loop - and on each iteration - we advance one pointer by one element - and the other by two - - we exit the loop when both pointers are NULL - (have reached the end of the lfds611_queue) - - or - - if we fast pointer 'sees' the slow pointer - which means we have a loop - */ - - if( qe_slow != NULL ) - do { - qe_slow = qe_slow->next[LFDS611_QUEUE_POINTER]; - - if( qe_fast != NULL ) - qe_fast = qe_fast->next[LFDS611_QUEUE_POINTER]; - - if( qe_fast != NULL ) - qe_fast = qe_fast->next[LFDS611_QUEUE_POINTER]; - } while( qe_slow != NULL and qe_fast != qe_slow ); - - if( qe_fast != NULL and qe_slow != NULL and qe_fast == qe_slow ) - *lfds611_queue_validity = LFDS611_VALIDITY_INVALID_LOOP; - - /* TRD : now check for expected number of elements - vi can be NULL, in which case we do not check - we know we don't have a loop from our earlier check - */ - - if( *lfds611_queue_validity == LFDS611_VALIDITY_VALID and vi != NULL ) { - qe = (struct lfds611_queue_element *) qs->dequeue[LFDS611_QUEUE_POINTER]; - - while( qe != NULL ) { - element_count++; - qe = (struct lfds611_queue_element *) qe->next[LFDS611_QUEUE_POINTER]; - } - - /* TRD : remember there is a dummy element in the lfds611_queue */ - element_count--; - - if( element_count < vi->min_elements ) - *lfds611_queue_validity = LFDS611_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( element_count > vi->max_elements ) - *lfds611_queue_validity = LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - } - - /* TRD : now we validate the lfds611_freelist - - we may be able to check for the expected number of - elements in the lfds611_freelist - - if the caller has given us an expected min and max - number of elements in the lfds611_queue, then the total number - of elements in the lfds611_freelist, minus that min and max, - gives us the expected number of elements in the - lfds611_freelist - */ - - if( vi != NULL ) { - lfds611_freelist_query( qs->fs, LFDS611_FREELIST_QUERY_ELEMENT_COUNT, NULL, (void *) &total_elements ); - - /* TRD : remember there is a dummy element in the lfds611_queue */ - total_elements--; - - lfds611_freelist_vi.min_elements = total_elements - vi->max_elements; - lfds611_freelist_vi.max_elements = total_elements - vi->min_elements; - - lfds611_freelist_query( qs->fs, LFDS611_FREELIST_QUERY_VALIDATE, (void *) &lfds611_freelist_vi, (void *) lfds611_freelist_validity ); - } - - if( vi == NULL ) - lfds611_freelist_query( qs->fs, LFDS611_FREELIST_QUERY_VALIDATE, NULL, (void *) lfds611_freelist_validity ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_queue.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_queue.c deleted file mode 100644 index c3abe45043191071c750240e9d466ee070c2d83c..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_queue/lfds611_queue_queue.c +++ /dev/null @@ -1,184 +0,0 @@ -#include "lfds611_queue_internal.h" - - - - - -/****************************************************************************/ -int lfds611_queue_enqueue( struct lfds611_queue_state *qs, void *user_data ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) struct lfds611_queue_element - *qe[LFDS611_QUEUE_PAC_SIZE]; - - assert( qs != NULL ); - // TRD : user_data can be NULL - - lfds611_queue_internal_new_element_from_freelist( qs, qe, user_data ); - - if( qe[LFDS611_QUEUE_POINTER] == NULL ) - return( 0 ); - - lfds611_queue_internal_queue( qs, qe ); - - return( 1 ); -} - - - - - -/****************************************************************************/ -int lfds611_queue_guaranteed_enqueue( struct lfds611_queue_state *qs, void *user_data ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) struct lfds611_queue_element - *qe[LFDS611_QUEUE_PAC_SIZE]; - - assert( qs != NULL ); - // TRD : user_data can be NULL - - lfds611_queue_internal_guaranteed_new_element_from_freelist( qs, qe, user_data ); - - if( qe[LFDS611_QUEUE_POINTER] == NULL ) - return( 0 ); - - lfds611_queue_internal_queue( qs, qe ); - - return( 1 ); -} - - - - - -/****************************************************************************/ -void lfds611_queue_internal_queue( struct lfds611_queue_state *qs, struct lfds611_queue_element *qe[LFDS611_QUEUE_PAC_SIZE] ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) struct lfds611_queue_element - *enqueue[LFDS611_QUEUE_PAC_SIZE], - *next[LFDS611_QUEUE_PAC_SIZE]; - - unsigned char - cas_result = 0; - - assert( qs != NULL ); - assert( qe != NULL ); - - // TRD : the DCAS operation issues a read and write barrier, so we don't need a read barrier in the do() loop - - LFDS611_BARRIER_LOAD; - - do { - enqueue[LFDS611_QUEUE_POINTER] = qs->enqueue[LFDS611_QUEUE_POINTER]; - enqueue[LFDS611_QUEUE_COUNTER] = qs->enqueue[LFDS611_QUEUE_COUNTER]; - - next[LFDS611_QUEUE_POINTER] = enqueue[LFDS611_QUEUE_POINTER]->next[LFDS611_QUEUE_POINTER]; - next[LFDS611_QUEUE_COUNTER] = enqueue[LFDS611_QUEUE_POINTER]->next[LFDS611_QUEUE_COUNTER]; - - /* TRD : this if() ensures that the next we read, just above, - really is from qs->enqueue (which we copied into enqueue) - */ - - LFDS611_BARRIER_LOAD; - - if( qs->enqueue[LFDS611_QUEUE_POINTER] == enqueue[LFDS611_QUEUE_POINTER] and qs->enqueue[LFDS611_QUEUE_COUNTER] == enqueue[LFDS611_QUEUE_COUNTER] ) { - if( next[LFDS611_QUEUE_POINTER] == NULL ) { - qe[LFDS611_QUEUE_COUNTER] = next[LFDS611_QUEUE_COUNTER] + 1; - cas_result = lfds611_abstraction_dcas( (volatile lfds611_atom_t *) enqueue[LFDS611_QUEUE_POINTER]->next, (lfds611_atom_t *) qe, (lfds611_atom_t *) next ); - } else { - next[LFDS611_QUEUE_COUNTER] = enqueue[LFDS611_QUEUE_COUNTER] + 1; - lfds611_abstraction_dcas( (volatile lfds611_atom_t *) qs->enqueue, (lfds611_atom_t *) next, (lfds611_atom_t *) enqueue ); - } - } - } while( cas_result == 0 ); - - qe[LFDS611_QUEUE_COUNTER] = enqueue[LFDS611_QUEUE_COUNTER] + 1; - lfds611_abstraction_dcas( (volatile lfds611_atom_t *) qs->enqueue, (lfds611_atom_t *) qe, (lfds611_atom_t *) enqueue ); - - return; -} - - - - - -/****************************************************************************/ -int lfds611_queue_dequeue( struct lfds611_queue_state *qs, void **user_data ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) struct lfds611_queue_element - *enqueue[LFDS611_QUEUE_PAC_SIZE], - *dequeue[LFDS611_QUEUE_PAC_SIZE], - *next[LFDS611_QUEUE_PAC_SIZE]; - - unsigned char - cas_result = 0; - - int - rv = 1, - state = LFDS611_QUEUE_STATE_UNKNOWN, - finished_flag = LOWERED; - - assert( qs != NULL ); - assert( user_data != NULL ); - - // TRD : the DCAS operation issues a read and write barrier, so we don't need a read barrier in the do() loop - - LFDS611_BARRIER_LOAD; - - do { - dequeue[LFDS611_QUEUE_POINTER] = qs->dequeue[LFDS611_QUEUE_POINTER]; - dequeue[LFDS611_QUEUE_COUNTER] = qs->dequeue[LFDS611_QUEUE_COUNTER]; - - enqueue[LFDS611_QUEUE_POINTER] = qs->enqueue[LFDS611_QUEUE_POINTER]; - enqueue[LFDS611_QUEUE_COUNTER] = qs->enqueue[LFDS611_QUEUE_COUNTER]; - - next[LFDS611_QUEUE_POINTER] = dequeue[LFDS611_QUEUE_POINTER]->next[LFDS611_QUEUE_POINTER]; - next[LFDS611_QUEUE_COUNTER] = dequeue[LFDS611_QUEUE_POINTER]->next[LFDS611_QUEUE_COUNTER]; - - /* TRD : confirm that dequeue didn't move between reading it - and reading its next pointer - */ - - LFDS611_BARRIER_LOAD; - - if( dequeue[LFDS611_QUEUE_POINTER] == qs->dequeue[LFDS611_QUEUE_POINTER] and dequeue[LFDS611_QUEUE_COUNTER] == qs->dequeue[LFDS611_QUEUE_COUNTER] ) { - if( enqueue[LFDS611_QUEUE_POINTER] == dequeue[LFDS611_QUEUE_POINTER] and next[LFDS611_QUEUE_POINTER] == NULL ) - state = LFDS611_QUEUE_STATE_EMPTY; - - if( enqueue[LFDS611_QUEUE_POINTER] == dequeue[LFDS611_QUEUE_POINTER] and next[LFDS611_QUEUE_POINTER] != NULL ) - state = LFDS611_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE; - - if( enqueue[LFDS611_QUEUE_POINTER] != dequeue[LFDS611_QUEUE_POINTER] ) - state = LFDS611_QUEUE_STATE_ATTEMPT_DELFDS611_QUEUE; - - switch( state ) { - case LFDS611_QUEUE_STATE_EMPTY: - *user_data = NULL; - rv = 0; - finished_flag = RAISED; - break; - - case LFDS611_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE: - next[LFDS611_QUEUE_COUNTER] = enqueue[LFDS611_QUEUE_COUNTER] + 1; - lfds611_abstraction_dcas( (volatile lfds611_atom_t *) qs->enqueue, (lfds611_atom_t *) next, (lfds611_atom_t *) enqueue ); - break; - - case LFDS611_QUEUE_STATE_ATTEMPT_DELFDS611_QUEUE: - *user_data = next[LFDS611_QUEUE_POINTER]->user_data; - - next[LFDS611_QUEUE_COUNTER] = dequeue[LFDS611_QUEUE_COUNTER] + 1; - cas_result = lfds611_abstraction_dcas( (volatile lfds611_atom_t *) qs->dequeue, (lfds611_atom_t *) next, (lfds611_atom_t *) dequeue ); - - if( cas_result == 1 ) - finished_flag = RAISED; - - break; - } - } - } while( finished_flag == LOWERED ); - - if( cas_result == 1 ) - lfds611_freelist_push( qs->fs, dequeue[LFDS611_QUEUE_POINTER]->fe ); - - return( rv ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_delete.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_delete.c deleted file mode 100644 index 847d442d2855b7321d75f0a8104e917c120d1f8c..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_delete.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "lfds611_ringbuffer_internal.h" - - - - - -/****************************************************************************/ -void lfds611_ringbuffer_delete( struct lfds611_ringbuffer_state *rs, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state ) -{ - assert( rs != NULL ); - // TRD : user_data_delete_function can be NULL - // TRD : user_state can be NULL - - lfds611_queue_delete( rs->qs, NULL, NULL ); - - lfds611_freelist_delete( rs->fs, user_data_delete_function, user_state ); - - lfds611_liblfds_aligned_free( rs ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_get_and_put.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_get_and_put.c deleted file mode 100644 index 9b0ea2a667fe91f55c80aa48df099f22f6299268..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_get_and_put.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "lfds611_ringbuffer_internal.h" - - - - - -/****************************************************************************/ -struct lfds611_freelist_element *lfds611_ringbuffer_get_read_element( struct lfds611_ringbuffer_state *rs, struct lfds611_freelist_element **fe ) -{ - assert( rs != NULL ); - assert( fe != NULL ); - - lfds611_queue_dequeue( rs->qs, (void **) fe ); - - return( *fe ); -} - - - - - -/****************************************************************************/ -struct lfds611_freelist_element *lfds611_ringbuffer_get_write_element( struct lfds611_ringbuffer_state *rs, struct lfds611_freelist_element **fe, int *overwrite_flag ) -{ - assert( rs != NULL ); - assert( fe != NULL ); - // TRD : overwrite_flag can be NULL - - /* TRD : we try to obtain an element from the lfds611_freelist - if we can, we populate it and add it to the lfds611_queue - - if we cannot, then the lfds611_ringbuffer is full - so instead we grab the current read element and - use that instead - - dequeue may fail since the lfds611_queue may be emptied - during our dequeue attempt - - so what we actually do here is a loop, attempting - the lfds611_freelist and if it fails then a dequeue, until - we obtain an element - - once we have an element, we lfds611_queue it - - you may be wondering why this operation is in a loop - remember - these operations are lock-free; anything - can happen in between - - so for example the pop could fail because the lfds611_freelist - is empty; but by the time we go to get an element from - the lfds611_queue, the whole lfds611_queue has been emptied back into - the lfds611_freelist! - - if overwrite_flag is provided, we set it to 0 if we - obtained a new element from the lfds611_freelist, 1 if we - stole an element from the lfds611_queue - */ - - do { - if( overwrite_flag != NULL ) - *overwrite_flag = 0; - - lfds611_freelist_pop( rs->fs, fe ); - - if( *fe == NULL ) { - lfds611_ringbuffer_get_read_element( rs, fe ); - - if( overwrite_flag != NULL and *fe != NULL ) - *overwrite_flag = 1; - } - } while( *fe == NULL ); - - return( *fe ); -} - - - - - -/****************************************************************************/ -void lfds611_ringbuffer_put_read_element( struct lfds611_ringbuffer_state *rs, struct lfds611_freelist_element *fe ) -{ - assert( rs != NULL ); - assert( fe != NULL ); - - lfds611_freelist_push( rs->fs, fe ); - - return; -} - - - - - -/****************************************************************************/ -void lfds611_ringbuffer_put_write_element( struct lfds611_ringbuffer_state *rs, struct lfds611_freelist_element *fe ) -{ - assert( rs != NULL ); - assert( fe != NULL ); - - lfds611_queue_enqueue( rs->qs, fe ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_internal.h b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_internal.h deleted file mode 100644 index e32a5f2d13a9570bea114d7ccea166b822426382..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_internal.h +++ /dev/null @@ -1,24 +0,0 @@ -/***** the library wide include file *****/ -#include "liblfds611_internal.h" - -/***** defines *****/ - -/***** structures *****/ -#pragma pack( push, LFDS611_ALIGN_DOUBLE_POINTER ) - -struct lfds611_ringbuffer_state { - struct lfds611_queue_state - *qs; - - struct lfds611_freelist_state - *fs; -}; - -#pragma pack( pop ) - -/***** externs *****/ - -/***** private prototypes *****/ -void lfds611_ringbuffer_internal_validate( struct lfds611_ringbuffer_state *rs, struct lfds611_validation_info *vi, enum lfds611_data_structure_validity *lfds611_queue_validity, - enum lfds611_data_structure_validity *lfds611_freelist_validity ); - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_new.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_new.c deleted file mode 100644 index 6d8dde2a54adf42fa45277a6af58e7050989078b..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_new.c +++ /dev/null @@ -1,63 +0,0 @@ -#include "lfds611_ringbuffer_internal.h" - - - - - -/****************************************************************************/ -int lfds611_ringbuffer_new( struct lfds611_ringbuffer_state **rs, lfds611_atom_t number_elements, int (*user_data_init_function)(void **user_data, void *user_state), void *user_state ) -{ - int - rv = 0; - - assert( rs != NULL ); - // TRD : number_elements can be any value in its range - // TRD : user_data_init_function can be NULL - // TRD : user_state can be NULL - - *rs = (struct lfds611_ringbuffer_state *) lfds611_liblfds_aligned_malloc( sizeof(struct lfds611_ringbuffer_state), LFDS611_ALIGN_DOUBLE_POINTER ); - - if( *rs != NULL ) { - lfds611_freelist_new( &(*rs)->fs, number_elements, user_data_init_function, user_state ); - - if( (*rs)->fs != NULL ) { - lfds611_queue_new( &(*rs)->qs, number_elements ); - - if( (*rs)->qs != NULL ) - rv = 1; - - if( (*rs)->qs == NULL ) { - lfds611_liblfds_aligned_free( *rs ); - *rs = NULL; - } - } - - if( (*rs)->fs == NULL ) { - lfds611_liblfds_aligned_free( *rs ); - *rs = NULL; - } - } - - LFDS611_BARRIER_STORE; - - return( rv ); -} - - - - - -/****************************************************************************/ -//#pragma warning( disable : 4100 ) - -void lfds611_ringbuffer_use( struct lfds611_ringbuffer_state *rs ) -{ - assert( rs != NULL ); - - LFDS611_BARRIER_LOAD; - - return; -} - -//#pragma warning( default : 4100 ) - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_query.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_query.c deleted file mode 100644 index 11bf8b0b6e0deb1b96d1bc9cc9e62386bfa32b12..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_ringbuffer/lfds611_ringbuffer_query.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "lfds611_ringbuffer_internal.h" - - - - - -/****************************************************************************/ -//#pragma warning( disable : 4100 ) - -void lfds611_ringbuffer_query( struct lfds611_ringbuffer_state *rs, enum lfds611_ringbuffer_query_type query_type, void *query_input, void *query_output ) -{ - assert( rs != NULL ); - // TRD : query_type can be any value in its range - // TRD : query_input can be NULL - assert( query_output != NULL ); - - switch( query_type ) { - case LFDS611_RINGBUFFER_QUERY_VALIDATE: - // TRD : query_input can be NULL - - lfds611_ringbuffer_internal_validate( rs, (struct lfds611_validation_info *) query_input, (enum lfds611_data_structure_validity *) query_output, - ((enum lfds611_data_structure_validity *) query_output)+2 ); - break; - } - - return; -} - -//#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -void lfds611_ringbuffer_internal_validate( struct lfds611_ringbuffer_state *rs, struct lfds611_validation_info *vi, enum lfds611_data_structure_validity *lfds611_queue_validity, - enum lfds611_data_structure_validity *lfds611_freelist_validity ) -{ - assert( rs != NULL ); - // TRD : vi can be NULL - assert( lfds611_queue_validity != NULL ); - assert( lfds611_freelist_validity != NULL ); - - lfds611_queue_query( rs->qs, LFDS611_QUEUE_QUERY_VALIDATE, vi, lfds611_queue_validity ); - - if( vi != NULL ) { - struct lfds611_validation_info - lfds611_freelist_vi; - - lfds611_atom_t - total_elements; - - lfds611_freelist_query( rs->fs, LFDS611_FREELIST_QUERY_ELEMENT_COUNT, NULL, (void *) &total_elements ); - lfds611_freelist_vi.min_elements = total_elements - vi->max_elements; - lfds611_freelist_vi.max_elements = total_elements - vi->min_elements; - lfds611_freelist_query( rs->fs, LFDS611_FREELIST_QUERY_VALIDATE, (void *) &lfds611_freelist_vi, (void *) lfds611_freelist_validity ); - } - - if( vi == NULL ) - lfds611_freelist_query( rs->fs, LFDS611_FREELIST_QUERY_VALIDATE, NULL, (void *) lfds611_freelist_validity ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_delete.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_delete.c deleted file mode 100644 index 18a897b5936cffef74e4d271f5fba1617a3aabdf..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_delete.c +++ /dev/null @@ -1,83 +0,0 @@ -#include "lfds611_slist_internal.h" - - - - - -/****************************************************************************/ -void lfds611_slist_delete( struct lfds611_slist_state *ss ) -{ - lfds611_slist_single_threaded_physically_delete_all_elements( ss ); - - lfds611_liblfds_aligned_free( ss ); - - return; -} - - - - - -/****************************************************************************/ -int lfds611_slist_logically_delete_element( struct lfds611_slist_state *ss, struct lfds611_slist_element *se ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) void - *volatile user_data_and_flags[2], - *volatile new_user_data_and_flags[2]; - - unsigned char - cas_rv = 0; - - assert( ss != NULL ); - assert( se != NULL ); - - LFDS611_BARRIER_LOAD; - - user_data_and_flags[LFDS611_SLIST_USER_DATA] = se->user_data_and_flags[LFDS611_SLIST_USER_DATA]; - user_data_and_flags[LFDS611_SLIST_FLAGS] = se->user_data_and_flags[LFDS611_SLIST_FLAGS]; - - do { - new_user_data_and_flags[LFDS611_SLIST_USER_DATA] = user_data_and_flags[LFDS611_SLIST_USER_DATA]; - new_user_data_and_flags[LFDS611_SLIST_FLAGS] = (void *) ((lfds611_atom_t) user_data_and_flags[LFDS611_SLIST_FLAGS] | LFDS611_SLIST_FLAG_DELETED); - } while( !((lfds611_atom_t) user_data_and_flags[LFDS611_SLIST_FLAGS] & LFDS611_SLIST_FLAG_DELETED) - and 0 == (cas_rv = lfds611_abstraction_dcas((volatile lfds611_atom_t *) se->user_data_and_flags, (lfds611_atom_t *) new_user_data_and_flags, (lfds611_atom_t *) user_data_and_flags)) ); - - if( cas_rv == 1 ) - if( ss->user_data_delete_function != NULL ) - ss->user_data_delete_function( (void *) user_data_and_flags[LFDS611_SLIST_USER_DATA], ss->user_state ); - - return( cas_rv ); -} - - - - - -/****************************************************************************/ -void lfds611_slist_single_threaded_physically_delete_all_elements( struct lfds611_slist_state *ss ) -{ - struct lfds611_slist_element - *volatile se, - *volatile se_temp; - - LFDS611_BARRIER_LOAD; - - se = ss->head; - - while( se != NULL ) { - // TRD : if a non-deleted element and there is a delete function, call the delete function - if( ss->user_data_delete_function != NULL ) - ss->user_data_delete_function( (void *) se->user_data_and_flags[LFDS611_SLIST_USER_DATA], ss->user_state ); - - se_temp = se; - se = se->next; - lfds611_liblfds_aligned_free( (void *) se_temp ); - } - - lfds611_slist_internal_init_slist( ss, ss->user_data_delete_function, ss->user_state ); - - LFDS611_BARRIER_STORE; - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_get_and_set.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_get_and_set.c deleted file mode 100644 index 5d5112b3b3399c35e998113aa26ccc2b90cc1ae2..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_get_and_set.c +++ /dev/null @@ -1,133 +0,0 @@ -#include "lfds611_slist_internal.h" - - - - - -/****************************************************************************/ -int lfds611_slist_get_user_data_from_element( struct lfds611_slist_element *se, void **user_data ) -{ - int - rv = 1; - - assert( se != NULL ); - assert( user_data != NULL ); - - LFDS611_BARRIER_LOAD; - - *user_data = (void *) se->user_data_and_flags[LFDS611_SLIST_USER_DATA]; - - if( (lfds611_atom_t) se->user_data_and_flags[LFDS611_SLIST_FLAGS] & LFDS611_SLIST_FLAG_DELETED ) - rv = 0; - - return( rv ); -} - - - - - -/****************************************************************************/ -int lfds611_slist_set_user_data_in_element( struct lfds611_slist_element *se, void *user_data ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) void - *user_data_and_flags[2], - *new_user_data_and_flags[2]; - - int - rv = 1; - - assert( se != NULL ); - // TRD : user_data can be NULL - - LFDS611_BARRIER_LOAD; - - user_data_and_flags[LFDS611_SLIST_USER_DATA] = se->user_data_and_flags[LFDS611_SLIST_USER_DATA]; - user_data_and_flags[LFDS611_SLIST_FLAGS] = se->user_data_and_flags[LFDS611_SLIST_FLAGS]; - - new_user_data_and_flags[LFDS611_SLIST_USER_DATA] = user_data; - - do { - new_user_data_and_flags[LFDS611_SLIST_FLAGS] = user_data_and_flags[LFDS611_SLIST_FLAGS]; - } while( !((lfds611_atom_t) user_data_and_flags[LFDS611_SLIST_FLAGS] & LFDS611_SLIST_FLAG_DELETED) and - 0 == lfds611_abstraction_dcas((volatile lfds611_atom_t *) se->user_data_and_flags, (lfds611_atom_t *) new_user_data_and_flags, (lfds611_atom_t *) user_data_and_flags) ); - - if( (lfds611_atom_t) user_data_and_flags[LFDS611_SLIST_FLAGS] & LFDS611_SLIST_FLAG_DELETED ) - rv = 0; - - LFDS611_BARRIER_STORE; - - return( rv ); -} - - - - - -/****************************************************************************/ -struct lfds611_slist_element *lfds611_slist_get_head( struct lfds611_slist_state *ss, struct lfds611_slist_element **se ) -{ - assert( ss != NULL ); - assert( se != NULL ); - - LFDS611_BARRIER_LOAD; - - *se = (struct lfds611_slist_element *) ss->head; - - lfds611_slist_internal_move_to_first_undeleted_element( se ); - - return( *se ); -} - - - - - -/****************************************************************************/ -struct lfds611_slist_element *lfds611_slist_get_next( struct lfds611_slist_element *se, struct lfds611_slist_element **next_se ) -{ - assert( se != NULL ); - assert( next_se != NULL ); - - LFDS611_BARRIER_LOAD; - - *next_se = (struct lfds611_slist_element *) se->next; - - lfds611_slist_internal_move_to_first_undeleted_element( next_se ); - - return( *next_se ); -} - - - - - -/****************************************************************************/ -struct lfds611_slist_element *lfds611_slist_get_head_and_then_next( struct lfds611_slist_state *ss, struct lfds611_slist_element **se ) -{ - assert( ss != NULL ); - assert( se != NULL ); - - if( *se == NULL ) - lfds611_slist_get_head( ss, se ); - else - lfds611_slist_get_next( *se, se ); - - return( *se ); -} - - - - - -/****************************************************************************/ -void lfds611_slist_internal_move_to_first_undeleted_element( struct lfds611_slist_element **se ) -{ - assert( se != NULL ); - - while( *se != NULL and (lfds611_atom_t) (*se)->user_data_and_flags[LFDS611_SLIST_FLAGS] & LFDS611_SLIST_FLAG_DELETED ) - (*se) = (struct lfds611_slist_element *) (*se)->next; - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_internal.h b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_internal.h deleted file mode 100644 index fe7e767515e7edf49ba8e99a251cdc716416a87f..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_internal.h +++ /dev/null @@ -1,53 +0,0 @@ -/***** the library wide include file *****/ -#include "liblfds611_internal.h" - -/***** defines *****/ -#define LFDS611_SLIST_USER_DATA 0 -#define LFDS611_SLIST_FLAGS 1 - -#define LFDS611_SLIST_NO_FLAGS 0x0 -#define LFDS611_SLIST_FLAG_DELETED 0x1 - -/***** structures *****/ -#pragma pack( push, LFDS611_ALIGN_SINGLE_POINTER ) - -struct lfds611_slist_state { - struct lfds611_slist_element - *volatile head; - - void - (*user_data_delete_function)( void *user_data, void *user_state ), - *user_state; -}; - -#pragma pack( pop ) - -#pragma pack( push, LFDS611_ALIGN_DOUBLE_POINTER ) - -/* TRD : this pragma pack doesn't seem to work under Windows - if the structure members are the correct way round - (next first), then user_data_and_flags ends up on - a single pointer boundary and DCAS crashes - - accordingly, I've moved user_data_and_flags first -*/ - -struct lfds611_slist_element { - void - *volatile user_data_and_flags[2]; - - // TRD : requires volatile as is target of CAS - struct lfds611_slist_element - *volatile next; -}; - -#pragma pack( pop ) - -/***** private prototypes *****/ -void lfds611_slist_internal_init_slist( struct lfds611_slist_state *ss, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state ); - -void lfds611_slist_internal_link_element_to_head( struct lfds611_slist_state *lfds611_slist_state, struct lfds611_slist_element *volatile se ); -void lfds611_slist_internal_link_element_after_element( struct lfds611_slist_element *volatile lfds611_slist_in_list_element, struct lfds611_slist_element *volatile se ); - -void lfds611_slist_internal_move_to_first_undeleted_element( struct lfds611_slist_element **se ); - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_link.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_link.c deleted file mode 100644 index 3df2775c4f9614c3d696fad2c45f6b03026c7d50..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_link.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "lfds611_slist_internal.h" - - - - - -/****************************************************************************/ -void lfds611_slist_internal_link_element_to_head( struct lfds611_slist_state *ss, struct lfds611_slist_element *volatile se ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_SINGLE_POINTER) struct lfds611_slist_element - *se_next; - - assert( ss != NULL ); - assert( se != NULL ); - - LFDS611_BARRIER_LOAD; - - se_next = ss->head; - - do { - se->next = se_next; - } while( se->next != (se_next = (struct lfds611_slist_element *) lfds611_abstraction_cas((volatile lfds611_atom_t *) &ss->head, (lfds611_atom_t) se, (lfds611_atom_t) se->next)) ); - - return; -} - - - - - -/****************************************************************************/ -void lfds611_slist_internal_link_element_after_element( struct lfds611_slist_element *volatile lfds611_slist_in_list_element, struct lfds611_slist_element *volatile se ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_SINGLE_POINTER) struct lfds611_slist_element - *se_prev, - *se_next; - - assert( lfds611_slist_in_list_element != NULL ); - assert( se != NULL ); - - LFDS611_BARRIER_LOAD; - - se_prev = (struct lfds611_slist_element *) lfds611_slist_in_list_element; - - se_next = se_prev->next; - - do { - se->next = se_next; - } while( se->next != (se_next = (struct lfds611_slist_element *) lfds611_abstraction_cas((volatile lfds611_atom_t *) &se_prev->next, (lfds611_atom_t) se, (lfds611_atom_t) se->next)) ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_new.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_new.c deleted file mode 100644 index b48e349ab0b2203a369bee7f8a667c970277f2c8..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_slist/lfds611_slist_new.c +++ /dev/null @@ -1,114 +0,0 @@ -#include "lfds611_slist_internal.h" - - - - - -/****************************************************************************/ -int lfds611_slist_new( struct lfds611_slist_state **ss, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state ) -{ - int - rv = 0; - - assert( ss != NULL ); - // TRD : user_data_delete_function can be NULL - // TRD : user_state can be NULL - - *ss = (struct lfds611_slist_state *) lfds611_liblfds_aligned_malloc( sizeof(struct lfds611_slist_state), LFDS611_ALIGN_SINGLE_POINTER ); - - if( *ss != NULL ) { - lfds611_slist_internal_init_slist( *ss, user_data_delete_function, user_state ); - rv = 1; - } - - LFDS611_BARRIER_STORE; - - return( rv ); -} - - - - - -/****************************************************************************/ -//#pragma warning( disable : 4100 ) - -void lfds611_slist_use( struct lfds611_slist_state *ss ) -{ - assert( ss != NULL ); - - LFDS611_BARRIER_LOAD; - - return; -} - -//#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -void lfds611_slist_internal_init_slist( struct lfds611_slist_state *ss, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state ) -{ - assert( ss != NULL ); - // TRD : user_data_delete_function can be NULL - // TRD : user_state can be NULL - - ss->head = NULL; - ss->user_data_delete_function = user_data_delete_function; - ss->user_state = user_state; - - return; -} - - - - - -/****************************************************************************/ -struct lfds611_slist_element *lfds611_slist_new_head( struct lfds611_slist_state *ss, void *user_data ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_SINGLE_POINTER) struct lfds611_slist_element - *volatile se; - - assert( ss != NULL ); - // TRD : user_data can be NULL - - se = (struct lfds611_slist_element *) lfds611_liblfds_aligned_malloc( sizeof(struct lfds611_slist_element), LFDS611_ALIGN_DOUBLE_POINTER ); - - if( se != NULL ) { - se->user_data_and_flags[LFDS611_SLIST_USER_DATA] = user_data; - se->user_data_and_flags[LFDS611_SLIST_FLAGS] = LFDS611_SLIST_NO_FLAGS; - - lfds611_slist_internal_link_element_to_head( ss, se ); - } - - return( (struct lfds611_slist_element *) se ); -} - - - - - -/****************************************************************************/ -struct lfds611_slist_element *lfds611_slist_new_next( struct lfds611_slist_element *se, void *user_data ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_SINGLE_POINTER) struct lfds611_slist_element - *volatile se_next; - - assert( se != NULL ); - // TRD : user_data can be NULL - - se_next = (struct lfds611_slist_element *) lfds611_liblfds_aligned_malloc( sizeof(struct lfds611_slist_element), LFDS611_ALIGN_DOUBLE_POINTER ); - - if( se_next != NULL ) { - se_next->user_data_and_flags[LFDS611_SLIST_USER_DATA] = user_data; - se_next->user_data_and_flags[LFDS611_SLIST_FLAGS] = LFDS611_SLIST_NO_FLAGS; - - lfds611_slist_internal_link_element_after_element( se, se_next ); - } - - return( (struct lfds611_slist_element *) se_next ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_delete.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_delete.c deleted file mode 100644 index 75700e6b3959c3447d846970b3f09c705dc08bec..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_delete.c +++ /dev/null @@ -1,67 +0,0 @@ -#include "lfds611_stack_internal.h" - - - - - -/****************************************************************************/ -void lfds611_stack_delete( struct lfds611_stack_state *ss, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state ) -{ - void - *user_data; - - assert( ss != NULL ); - // TRD : user_data_delete_function can be NULL - // TRD : user_state can be NULL - - while( lfds611_stack_pop(ss, &user_data) ) - if( user_data_delete_function != NULL ) - user_data_delete_function( user_data, user_state ); - - lfds611_freelist_delete( ss->fs, lfds611_stack_internal_freelist_delete_function, NULL ); - - lfds611_liblfds_aligned_free( ss ); - - return; -} - - - - - -/****************************************************************************/ -void lfds611_stack_clear( struct lfds611_stack_state *ss, void (*user_data_clear_function)(void *user_data, void *user_state), void *user_state ) -{ - void - *user_data; - - assert( ss != NULL ); - // TRD : user_data_clear_function can be NULL - // TRD : user_state can be NULL - - while( lfds611_stack_pop(ss, &user_data) ) - if( user_data_clear_function != NULL ) - user_data_clear_function( user_data, user_state ); - - return; -} - - - - - -/****************************************************************************/ -//#pragma warning( disable : 4100 ) - -void lfds611_stack_internal_freelist_delete_function( void *user_data, void *user_state ) -{ - assert( user_data != NULL ); - assert( user_state == NULL ); - - lfds611_liblfds_aligned_free( user_data ); - - return; -} - -//#pragma warning( default : 4100 ) - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_internal.h b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_internal.h deleted file mode 100644 index 32f4f3fa402715c3ec0bfee44effc8587e7b38a2..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_internal.h +++ /dev/null @@ -1,51 +0,0 @@ -/***** the library wide include file *****/ -#include "liblfds611_internal.h" - -/***** pragmas *****/ - -/***** defines *****/ -#define LFDS611_STACK_POINTER 0 -#define LFDS611_STACK_COUNTER 1 -#define LFDS611_STACK_PAC_SIZE 2 - -/***** structures *****/ -#pragma pack( push, LFDS611_ALIGN_DOUBLE_POINTER ) - -struct lfds611_stack_state { - // TRD : must come first for alignment - struct lfds611_stack_element - *volatile top[LFDS611_STACK_PAC_SIZE]; - - lfds611_atom_t - aba_counter; - - struct lfds611_freelist_state - *fs; -}; - -struct lfds611_stack_element { - struct lfds611_stack_element - *next[LFDS611_STACK_PAC_SIZE]; - - struct lfds611_freelist_element - *fe; - - void - *user_data; -}; - -#pragma pack( pop ) - -/***** private prototypes *****/ -int lfds611_stack_internal_freelist_init_function( void **user_data, void *user_state ); -void lfds611_stack_internal_freelist_delete_function( void *user_data, void *user_state ); - -void lfds611_stack_internal_new_element_from_freelist( struct lfds611_stack_state *ss, struct lfds611_stack_element *se[LFDS611_STACK_PAC_SIZE], void *user_data ); -void lfds611_stack_internal_new_element( struct lfds611_stack_state *ss, struct lfds611_stack_element *se[LFDS611_STACK_PAC_SIZE], void *user_data ); -void lfds611_stack_internal_init_element( struct lfds611_stack_state *ss, struct lfds611_stack_element *se[LFDS611_STACK_PAC_SIZE], struct lfds611_freelist_element *fe, void *user_data ); - -void lfds611_stack_internal_push( struct lfds611_stack_state *ss, struct lfds611_stack_element *se[LFDS611_STACK_PAC_SIZE] ); - -void lfds611_stack_internal_validate( struct lfds611_stack_state *ss, struct lfds611_validation_info *vi, enum lfds611_data_structure_validity *stack_validity, - enum lfds611_data_structure_validity *freelist_validity ); - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_new.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_new.c deleted file mode 100644 index 927f28c88c8e71f7ba7f78652e4dd8593946dec6..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_new.c +++ /dev/null @@ -1,156 +0,0 @@ -#include "lfds611_stack_internal.h" - - - - - -/****************************************************************************/ -int lfds611_stack_new( struct lfds611_stack_state **ss, lfds611_atom_t number_elements ) -{ - int - rv = 0; - - assert( ss != NULL ); - // TRD : number_elements can be any value in its range - - *ss = (struct lfds611_stack_state *) lfds611_liblfds_aligned_malloc( sizeof(struct lfds611_stack_state), LFDS611_ALIGN_DOUBLE_POINTER ); - - if( *ss != NULL ) { - // TRD : the size of the lfds611_freelist is the size of the lfds611_stack - lfds611_freelist_new( &(*ss)->fs, number_elements, lfds611_stack_internal_freelist_init_function, NULL ); - - if( (*ss)->fs == NULL ) { - lfds611_liblfds_aligned_free( *ss ); - *ss = NULL; - } - - if( (*ss)->fs != NULL ) { - (*ss)->top[LFDS611_STACK_POINTER] = NULL; - (*ss)->top[LFDS611_STACK_COUNTER] = 0; - (*ss)->aba_counter = 0; - rv = 1; - } - } - - LFDS611_BARRIER_STORE; - - return( rv ); -} - - - - - -/****************************************************************************/ -//#pragma warning( disable : 4100 ) - -void lfds611_stack_use( struct lfds611_stack_state *ss ) -{ - assert( ss != NULL ); - - LFDS611_BARRIER_LOAD; - - return; -} - -//#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -//#pragma warning( disable : 4100 ) - -int lfds611_stack_internal_freelist_init_function( void **user_data, void *user_state ) -{ - int - rv = 0; - - assert( user_data != NULL ); - assert( user_state == NULL ); - - *user_data = lfds611_liblfds_aligned_malloc( sizeof(struct lfds611_stack_element), LFDS611_ALIGN_DOUBLE_POINTER ); - - if( *user_data != NULL ) - rv = 1; - - return( rv ); -} - -//#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -void lfds611_stack_internal_new_element_from_freelist( struct lfds611_stack_state *ss, struct lfds611_stack_element *se[LFDS611_STACK_PAC_SIZE], void *user_data ) -{ - struct lfds611_freelist_element - *fe; - - assert( ss != NULL ); - assert( se != NULL ); - // TRD : user_data can be any value in its range - - lfds611_freelist_pop( ss->fs, &fe ); - - if( fe == NULL ) - se[LFDS611_STACK_POINTER] = NULL; - - if( fe != NULL ) - lfds611_stack_internal_init_element( ss, se, fe, user_data ); - - return; -} - - - - - -/****************************************************************************/ -void lfds611_stack_internal_new_element( struct lfds611_stack_state *ss, struct lfds611_stack_element *se[LFDS611_STACK_PAC_SIZE], void *user_data ) -{ - struct lfds611_freelist_element - *fe; - - assert( ss != NULL ); - assert( se != NULL ); - // TRD : user_data can be any value in its range - - lfds611_freelist_guaranteed_pop( ss->fs, &fe ); - - if( fe == NULL ) - se[LFDS611_STACK_POINTER] = NULL; - - if( fe != NULL ) - lfds611_stack_internal_init_element( ss, se, fe, user_data ); - - return; -} - - - - - -/****************************************************************************/ -void lfds611_stack_internal_init_element( struct lfds611_stack_state *ss, struct lfds611_stack_element *se[LFDS611_STACK_PAC_SIZE], struct lfds611_freelist_element *fe, void *user_data ) -{ - assert( ss != NULL ); - assert( se != NULL ); - assert( fe != NULL ); - // TRD : user_data can be any value in its range - - lfds611_freelist_get_user_data_from_element( fe, (void **) &se[LFDS611_STACK_POINTER] ); - - se[LFDS611_STACK_COUNTER] = (struct lfds611_stack_element *) lfds611_abstraction_increment( (lfds611_atom_t *) &ss->aba_counter ); - - se[LFDS611_STACK_POINTER]->next[LFDS611_STACK_POINTER] = NULL; - se[LFDS611_STACK_POINTER]->next[LFDS611_STACK_COUNTER] = 0; - se[LFDS611_STACK_POINTER]->fe = fe; - se[LFDS611_STACK_POINTER]->user_data = user_data; - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_push_pop.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_push_pop.c deleted file mode 100644 index 402051114b7cbb52e22d598718671e1428fa841f..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_push_pop.c +++ /dev/null @@ -1,110 +0,0 @@ -#include "lfds611_stack_internal.h" - - - - - -/****************************************************************************/ -int lfds611_stack_push( struct lfds611_stack_state *ss, void *user_data ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) struct lfds611_stack_element - *se[LFDS611_STACK_PAC_SIZE]; - - assert( ss != NULL ); - // TRD : user_data can be NULL - - lfds611_stack_internal_new_element_from_freelist( ss, se, user_data ); - - if( se[LFDS611_STACK_POINTER] == NULL ) - return( 0 ); - - lfds611_stack_internal_push( ss, se ); - - return( 1 ); -} - - - - - -/****************************************************************************/ -int lfds611_stack_guaranteed_push( struct lfds611_stack_state *ss, void *user_data ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) struct lfds611_stack_element - *se[LFDS611_STACK_PAC_SIZE]; - - assert( ss != NULL ); - // TRD : user_data can be NULL - - /* TRD : this function allocated a new lfds611_freelist element and uses that - to push onto the lfds611_stack, guaranteeing success (unless malloc() - fails of course) - */ - - lfds611_stack_internal_new_element( ss, se, user_data ); - - // TRD : malloc failed - if( se[LFDS611_STACK_POINTER] == NULL ) - return( 0 ); - - lfds611_stack_internal_push( ss, se ); - - return( 1 ); -} - - - - - -/****************************************************************************/ -void lfds611_stack_internal_push( struct lfds611_stack_state *ss, struct lfds611_stack_element *se[LFDS611_STACK_PAC_SIZE] ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) struct lfds611_stack_element - *original_se_next[LFDS611_STACK_PAC_SIZE]; - - assert( ss != NULL ); - assert( se != NULL ); - - LFDS611_BARRIER_LOAD; - - original_se_next[LFDS611_STACK_POINTER] = ss->top[LFDS611_STACK_POINTER]; - original_se_next[LFDS611_STACK_COUNTER] = ss->top[LFDS611_STACK_COUNTER]; - - do { - se[LFDS611_STACK_POINTER]->next[LFDS611_STACK_POINTER] = original_se_next[LFDS611_STACK_POINTER]; - se[LFDS611_STACK_POINTER]->next[LFDS611_STACK_COUNTER] = original_se_next[LFDS611_STACK_COUNTER]; - } while( 0 == lfds611_abstraction_dcas((volatile lfds611_atom_t *) ss->top, (lfds611_atom_t *) se, (lfds611_atom_t *) original_se_next) ); - - return; -} - - - - - -/****************************************************************************/ -int lfds611_stack_pop( struct lfds611_stack_state *ss, void **user_data ) -{ - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) struct lfds611_stack_element - *se[LFDS611_STACK_PAC_SIZE]; - - assert( ss != NULL ); - assert( user_data != NULL ); - - LFDS611_BARRIER_LOAD; - - se[LFDS611_STACK_COUNTER] = ss->top[LFDS611_STACK_COUNTER]; - se[LFDS611_STACK_POINTER] = ss->top[LFDS611_STACK_POINTER]; - - do { - if( se[LFDS611_STACK_POINTER] == NULL ) - return( 0 ); - } while( 0 == lfds611_abstraction_dcas((volatile lfds611_atom_t *) ss->top, (lfds611_atom_t *) se[LFDS611_STACK_POINTER]->next, (lfds611_atom_t *) se) ); - - *user_data = se[LFDS611_STACK_POINTER]->user_data; - - lfds611_freelist_push( ss->fs, se[LFDS611_STACK_POINTER]->fe ); - - return( 1 ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_query.c b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_query.c deleted file mode 100644 index 51ef2d12831993f31128f371441a9759f6697532..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/lfds611_stack/lfds611_stack_query.c +++ /dev/null @@ -1,154 +0,0 @@ -#include "lfds611_stack_internal.h" - - - - - -/****************************************************************************/ -void lfds611_stack_query( struct lfds611_stack_state *ss, enum lfds611_stack_query_type query_type, void *query_input, void *query_output ) -{ - assert( ss != NULL ); - // TRD : query_type can be any value in its range - // TRD : query_iput can be NULL - assert( query_output != NULL ); - - LFDS611_BARRIER_LOAD; - - switch( query_type ) { - case LFDS611_STACK_QUERY_ELEMENT_COUNT: - assert( query_input == NULL ); - - lfds611_freelist_query( ss->fs, LFDS611_FREELIST_QUERY_ELEMENT_COUNT, NULL, query_output ); - break; - - case LFDS611_STACK_QUERY_VALIDATE: - // TRD : query_input can be NULL - - /* TRD : the validation info passed in is for the stack - it indicates the minimum and maximum number of elements - which should be present - - we need to validate the freelist - and validate the stack - - we cannot know the min/max for the freelist, given only - the min/max for the stack - */ - - lfds611_freelist_query( ss->fs, LFDS611_FREELIST_QUERY_VALIDATE, NULL, (enum lfds611_data_structure_validity *) query_output ); - - if( *(enum lfds611_data_structure_validity *) query_output == LFDS611_VALIDITY_VALID ) - lfds611_stack_internal_validate( ss, (struct lfds611_validation_info *) query_input, (enum lfds611_data_structure_validity *) query_output, ((enum lfds611_data_structure_validity *) query_output)+1 ); - - break; - } - - return; -} - - - - - -/****************************************************************************/ -void lfds611_stack_internal_validate( struct lfds611_stack_state *ss, struct lfds611_validation_info *vi, enum lfds611_data_structure_validity *stack_validity, - enum lfds611_data_structure_validity *freelist_validity ) -{ - struct lfds611_stack_element - *se, - *se_slow, - *se_fast; - - lfds611_atom_t - element_count = 0, - total_elements; - - struct lfds611_validation_info - freelist_vi; - - assert( ss != NULL ); - // TRD : vi can be NULL - assert( stack_validity != NULL ); - - *stack_validity = LFDS611_VALIDITY_VALID; - - se_slow = se_fast = (struct lfds611_stack_element *) ss->top[LFDS611_STACK_POINTER]; - - /* TRD : first, check for a loop - we have two pointers - both of which start at the top of the stack - we enter a loop - and on each iteration - we advance one pointer by one element - and the other by two - - we exit the loop when both pointers are NULL - (have reached the end of the stack) - - or - - if we fast pointer 'sees' the slow pointer - which means we have a loop - */ - - if( se_slow != NULL ) - do { - se_slow = se_slow->next[LFDS611_STACK_POINTER]; - - if( se_fast != NULL ) - se_fast = se_fast->next[LFDS611_STACK_POINTER]; - - if( se_fast != NULL ) - se_fast = se_fast->next[LFDS611_STACK_POINTER]; - } while( se_slow != NULL and se_fast != se_slow ); - - if( se_fast != NULL and se_slow != NULL and se_fast == se_slow ) - *stack_validity = LFDS611_VALIDITY_INVALID_LOOP; - - /* TRD : now check for expected number of elements - vi can be NULL, in which case we do not check - we know we don't have a loop from our earlier check - */ - - if( *stack_validity == LFDS611_VALIDITY_VALID and vi != NULL ) { - se = (struct lfds611_stack_element *) ss->top[LFDS611_STACK_POINTER]; - - while( se != NULL ) { - element_count++; - se = (struct lfds611_stack_element *) se->next[LFDS611_STACK_POINTER]; - } - - if( element_count < vi->min_elements ) - *stack_validity = LFDS611_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( element_count > vi->max_elements ) - *stack_validity = LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - } - - /* TRD : now we validate the freelist - - we may be able to check for the expected number of - elements in the freelist - - if the caller has given us an expected min and max - number of elements in the stack, then the total number - of elements in the freelist, minus that min and max, - gives us the expected number of elements in the - freelist - */ - - if( vi != NULL ) { - lfds611_freelist_query( ss->fs, LFDS611_FREELIST_QUERY_ELEMENT_COUNT, NULL, (void *) &total_elements ); - - freelist_vi.min_elements = total_elements - vi->max_elements; - freelist_vi.max_elements = total_elements - vi->min_elements; - - lfds611_freelist_query( ss->fs, LFDS611_FREELIST_QUERY_VALIDATE, (void *) &freelist_vi, (void *) freelist_validity ); - } - - if( vi == NULL ) - lfds611_freelist_query( ss->fs, LFDS611_FREELIST_QUERY_VALIDATE, NULL, (void *) freelist_validity ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/liblfds611_internal.h b/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/liblfds611_internal.h deleted file mode 100644 index 9bcf726504b1842f61b74a7cfad23b3591bbe1b0..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/liblfds611/src/liblfds611_internal.h +++ /dev/null @@ -1,25 +0,0 @@ -/***** public prototypes *****/ -#include "liblfds611.h" - -/***** defines *****/ -#define and && -#define or || - -#define RAISED 1 -#define LOWERED 0 - -#define NO_FLAGS 0x0 - -/***** private prototypes *****/ -void *lfds611_liblfds_aligned_malloc( size_t size, size_t align_in_bytes ); -void lfds611_liblfds_aligned_free( void *memory ); - -static LFDS611_INLINE lfds611_atom_t lfds611_abstraction_cas( volatile lfds611_atom_t *destination, lfds611_atom_t exchange, lfds611_atom_t compare ); -static LFDS611_INLINE unsigned char lfds611_abstraction_dcas( volatile lfds611_atom_t *destination, lfds611_atom_t *exchange, lfds611_atom_t *compare ); -static LFDS611_INLINE lfds611_atom_t lfds611_abstraction_increment( volatile lfds611_atom_t *value ); - -/***** inlined code *****/ -#include "lfds611_abstraction/lfds611_abstraction_cas.c" -#include "lfds611_abstraction/lfds611_abstraction_dcas.c" -#include "lfds611_abstraction/lfds611_abstraction_increment.c" - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/building.txt b/openair2/UTIL/LFDS/liblfds6.1.1/test/building.txt deleted file mode 100644 index 685cda0cf1aa7bf81b672e8e01ce567bbdbb8393..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/building.txt +++ /dev/null @@ -1,51 +0,0 @@ -building test -============= - -Windows (user-mode) -=================== -1. Use Microsoft Visual Studio 2008 or Visual C++ 2008 Express Edition (or - later versions) to load "liblfds.sln". The "Win32" platform is x86, - the "x64" platform is x64. The test programme provides the "Release" - and "Debug" targets. The other targets ("Release DLL", "Release Lib", - "Debug DLL" and "Debug Lib") are carried over will-nilly from the liblds - library. - - All builds will work, but DLL builds will require the DLL from liblfds - to be placed into a location where the test executable can find it (e.g. - the same directory). - -2. Use Microsoft Windows SDK and GNUmake to run makefile.windows (obviously - you'll need to have run setenv.bat or the appropriate vcvars*.bat first; - you can build for x64/64-bit and x86/32-bit - just run the correct batch - file). - - If liblfds has been built as a DLL, the DLL from liblfds needs to be - placed into a location where the test executable can find it (e.g. the - same directory). - - Targets are "rel", "dbg" and "clean". You need to clean between switching - targets. - -Windows (kernel) -================ -No build supported, since this is a command line utility. - -Linux -===== -Use GNUmake to run "makefile.linux". Targets are "rel", "dbg" and -"clean". You need to clean between switching targets. - -If liblfds has been built as a shared object, the shared object file from -liblfds will need to be placed somewhere the text executable can find it. - -A convenient solution is to place the shared object file in the same -directory as the text executable and set the environment variable -"LD_LIBRARY_PATH" to ".", e.g. in bash; - -export LD_LIBRARY_PATH=. - -Remember to unset after finishing testing, or your system will continue -to scan the current directory for shared object files. - -unset LD_LIBRARY_PATH - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/makefile.linux b/openair2/UTIL/LFDS/liblfds6.1.1/test/makefile.linux deleted file mode 100644 index 8bc0c1c86016a8df9360557acccd3ff8674df40c..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/makefile.linux +++ /dev/null @@ -1,82 +0,0 @@ -##### paths ##### -BINDIR = bin -INCDIR = ../liblfds611/inc -LIBDIR = ../liblfds611/bin -OBJDIR = obj -SRCDIR = src - -##### misc ##### -QUIETLY = 1>nul 2>nul - -##### sources, objects and libraries ##### -BINNAME = test -BINARY = $(BINDIR)/$(BINNAME) -SRCDIRS = . -SOURCES = abstraction_cpu_count.c test_abstraction.c abstraction_thread_start.c abstraction_thread_wait.c benchmark_freelist.c benchmark_queue.c benchmark_ringbuffer.c benchmark_stack.c test_freelist.c main.c misc.c test_queue.c test_ringbuffer.c test_slist.c test_stack.c -OBJECTS = $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(SOURCES))) -SYSLIBS = -lpthread -lc -lm -USRLIBS = -llfds611 - -##### CPU variants ##### -UNAME = $(shell uname -m) -GCCARCH = -march=$(UNAME) - -ifeq ($(UNAME),x86_64) - GCCARCH = -march=core2 -endif - -ifeq ($(findstring arm,$(UNAME)),arm) - GCCARCH = -march=armv6k -marm -endif - -##### tools ##### -MAKE = make -MFLAGS = - -DG = gcc -DGFLAGS = -MM -std=c99 -I"$(SRCDIR)" -I"$(INCDIR)" - -CC = gcc -CFBASE = -Wall -Wno-unknown-pragmas -std=c99 $(GCCARCH) -pthread -c -I"$(SRCDIR)" -I"$(INCDIR)" -CFREL = -O2 -Wno-strict-aliasing -CFDBG = -O0 -g - -LD = gcc -LFBASE = -L"$(LIBDIR)" -LFREL = -O2 -s -LFDBG = -O0 -g - -##### variants ##### -CFLAGS = $(CFBASE) $(CFDBG) -LFLAGS = $(LFBASE) $(LFDBG) - -ifeq ($(MAKECMDGOALS),rel) - CFLAGS = $(CFBASE) $(CFREL) - LFLAGS = $(LFBASE) $(LFREL) -endif - -##### search paths ##### -vpath %.c $(patsubst %,$(SRCDIR)/%:,$(SRCDIRS)) - -##### implicit rules ##### -$(OBJDIR)/%.o : %.c - $(DG) $(DGFLAGS) $< >$(OBJDIR)/$*.d - $(CC) $(CFLAGS) -o $@ $< - -##### explicit rules ##### -$(BINARY) : $(OBJECTS) - $(LD) -o $(BINARY) $(LFLAGS) $(OBJECTS) $(USRLIBS) $(SYSLIBS) - chmod +x $(BINARY) - -##### phony ##### -.PHONY : clean rel dbg - -clean : - @rm -f $(BINDIR)/$(BINNAME) $(OBJDIR)/*.o $(OBJDIR)/*.d - -rel : $(BINARY) -dbg : $(BINARY) - -##### dependencies ##### --include $(DEPENDS) - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/makefile.windows b/openair2/UTIL/LFDS/liblfds6.1.1/test/makefile.windows deleted file mode 100644 index d899414b07571018ddd5c39aebf39908fb22cfe3..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/makefile.windows +++ /dev/null @@ -1,64 +0,0 @@ -##### paths ##### -BINDIR = bin -INCDIR = ../liblfds611/inc -LIBDIR = ../liblfds611/bin -OBJDIR = obj -SRCDIR = src - -##### misc ##### -QUIETLY = 1>nul 2>nul - -##### sources, objects and libraries ##### -BINNAME = test -BINARY = $(BINDIR)\$(BINNAME).exe -SRCDIRS = . -SOURCES = abstraction_cpu_count.c test_abstraction.c abstraction_thread_start.c abstraction_thread_wait.c benchmark_freelist.c benchmark_queue.c benchmark_ringbuffer.c benchmark_stack.c test_freelist.c main.c misc.c test_queue.c test_ringbuffer.c test_slist.c test_stack.c -OBJECTS = $(patsubst %.c,$(OBJDIR)/%.obj,$(notdir $(SOURCES))) -SYSLIBS = kernel32.lib -USRLIBS = liblfds611.lib - -##### tools ##### -MAKE = make -MFLAGS = - -CC = cl -CFBASE = /nologo /W4 /WX /c "-I$(SRCDIR)" "-I$(INCLUDE)" "-I$(INCDIR)" "/Fd$(BINDIR)\$(BINNAME).pdb" /D UNICODE /D _UNICODE /DWIN32_LEAN_AND_MEAN /D_CRT_SECURE_NO_WARNINGS -CFREL = /Ox /DNDEBUG /MT -CFDBG = /Od /Gm /Zi /D_DEBUG /MTd - -LD = link -LFBASE = "/libpath:$(LIB)" "/libpath:$(LIBDIR)" /nologo /subsystem:console /nodefaultlib /nxcompat /wx -LFREL = /incremental:no -LFDBG = /debug "/pdb:$(BINDIR)\$(BINNAME).pdb" - -##### variants ##### -CFLAGS = $(CFBASE) $(CFDBG) -LFLAGS = $(LFBASE) $(LFDBG) -CLIB = libcmtd.lib - -ifeq ($(MAKECMDGOALS),rel) - CFLAGS = $(CFBASE) $(CFREL) - LFLAGS = $(LFBASE) $(LFREL) - CLIB = libcmt.lib -endif - -##### search paths ##### -vpath %.c $(patsubst %,$(SRCDIR)/%;,$(SRCDIRS)) - -##### implicit rules ##### -$(OBJDIR)/%.obj : %.c - $(CC) $(CFLAGS) "/Fo$@" $< - -##### explicit rules ##### -$(BINARY) : $(OBJECTS) - $(LD) $(LFLAGS) $(CLIB) $(SYSLIBS) $(USRLIBS) $(OBJECTS) /out:$(BINARY) - -##### phony ##### -.PHONY : clean rel dbg - -clean : - @erase /Q $(OBJDIR)\*.obj $(BINDIR)\$(BINNAME).* $(QUIETLY) - -rel : $(BINARY) -dbg : $(BINARY) - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/abstraction.h b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/abstraction.h deleted file mode 100644 index 7a7e82f9bb4231adf6de0e83cff967320d2e63e6..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/abstraction.h +++ /dev/null @@ -1,50 +0,0 @@ -/***** defines *****/ -#if (defined _WIN32 && defined _MSC_VER && !defined WIN_KERNEL_BUILD) -/* TRD : any Windows (user-mode) on any CPU with the Microsoft C compiler - - _WIN32 indicates 64-bit or 32-bit Windows - _MSC_VER indicates Microsoft C compiler - !WIN_KERNEL_BUILD indicates Windows user-mode -*/ - -#include <windows.h> -typedef HANDLE thread_state_t; -typedef DWORD thread_return_t; -#define CALLING_CONVENTION WINAPI -#endif - -#if (defined _WIN32 && defined _MSC_VER && defined WIN_KERNEL_BUILD) -/* TRD : any Windows (kernel-mode) on any CPU with the Microsoft C compiler - - _WIN32 indicates 64-bit or 32-bit Windows - _MSC_VER indicates Microsoft C compiler - WIN_KERNEL_BUILD indicates Windows kernel -*/ - -#include <wdm.h> -typedef HANDLE thread_state_t; -typedef VOID thread_return_t; -#define CALLING_CONVENTION -#endif - -#if (defined __unix__ && defined __GNUC__) -/* TRD : any UNIX on any CPU with GCC - - __unix__ indicates Solaris, Linux, HPUX, etc - __GNUC__ indicates GCC -*/ -#include <unistd.h> -#include <pthread.h> -#include <sched.h> -typedef pthread_t thread_state_t; -typedef void * thread_return_t; -#define CALLING_CONVENTION -#endif - -typedef thread_return_t (CALLING_CONVENTION *thread_function_t)( void *thread_user_state ); - -/***** public prototypes *****/ -unsigned int abstraction_cpu_count( void ); -int abstraction_thread_start( thread_state_t *thread_state, unsigned int cpu, thread_function_t thread_function, void *thread_user_state ); -void abstraction_thread_wait( thread_state_t thread_state ); - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/abstraction_cpu_count.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/abstraction_cpu_count.c deleted file mode 100644 index fb6ff5e79c676af4a09487335be235a3517b717f..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/abstraction_cpu_count.c +++ /dev/null @@ -1,81 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -#if (defined _WIN32 && defined _MSC_VER && !defined WIN_KERNEL_BUILD) - -/* TRD : any Windows (user-mode) on any CPU with the Microsoft C compiler - - _WIN32 indicates 64-bit or 32-bit Windows - _MSC_VER indicates Microsoft C compiler - !WIN_KERNEL_BUILD indicates Windows user-mode -*/ - -unsigned int abstraction_cpu_count() -{ - SYSTEM_INFO - si; - - GetNativeSystemInfo( &si ); - - return( (unsigned int) si.dwNumberOfProcessors ); -} - -#endif - - - - - -/****************************************************************************/ -#if (defined _WIN32 && defined _MSC_VER && defined WIN_KERNEL_BUILD) - -/* TRD : any Windows on any CPU with the Microsoft C compiler - - _WIN32 indicates 64-bit or 32-bit Windows - _MSC_VER indicates Microsoft C compiler - WIN_KERNEL_BUILD indicates Windows kernel -*/ - -unsigned int abstraction_cpu_count() -{ - unsigned int - active_processor_count; - - active_processor_count = KeQueryActiveProcessorCount( NULL ); - - return( active_processor_count ); -} - -#endif - - - - - -/****************************************************************************/ -#if (defined __linux__ && defined __GNUC__) - -/* TRD : Linux on any CPU with GCC - - this function I believe is Linux specific and varies by UNIX flavour - - __linux__ indicates Linux - __GNUC__ indicates GCC -*/ - -unsigned int abstraction_cpu_count() -{ - long int - cpu_count; - - cpu_count = sysconf( _SC_NPROCESSORS_ONLN ); - - return( (unsigned int) cpu_count ); -} - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/abstraction_thread_start.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/abstraction_thread_start.c deleted file mode 100644 index 5075c5f8ded8b8e50d7848b6db34c7a58bceae75..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/abstraction_thread_start.c +++ /dev/null @@ -1,141 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -#if (defined _WIN32 && defined _MSC_VER && !defined WIN_KERNEL_BUILD) - -/* TRD : any Windows (user-mode) on any CPU with the Microsoft C compiler - - _WIN32 indicates 64-bit or 32-bit Windows - _MSC_VER indicates Microsoft C compiler - !WIN_KERNEL_BUILD indicates Windows user-mode -*/ - -int abstraction_thread_start( thread_state_t *thread_state, unsigned int cpu, thread_function_t thread_function, void *thread_user_state ) -{ - int - rv = 0; - - DWORD - thread_id; - - DWORD_PTR - affinity_mask, - result; - - assert( thread_state != NULL ); - // TRD : cpu can be any value in its range - assert( thread_function != NULL ); - // TRD : thread_user_state can be NULL - - affinity_mask = (DWORD_PTR) (1 << cpu); - - *thread_state = CreateThread( NULL, 0, thread_function, thread_user_state, NO_FLAGS, &thread_id ); - - result = SetThreadAffinityMask( *thread_state, affinity_mask ); - - if( *thread_state != NULL and result != 0 ) - rv = 1; - - return( rv ); -} - -#endif - - - - - -/****************************************************************************/ -#if (defined _WIN32 && defined _MSC_VER && defined WIN_KERNEL_BUILD) - -/* TRD : any Windows on any CPU with the Microsoft C compiler - - _WIN32 indicates 64-bit or 32-bit Windows - _MSC_VER indicates Microsoft C compiler - WIN_KERNEL_BUILD indicates Windows kernel -*/ - -int abstraction_thread_start( thread_state_t *thread_state, unsigned int cpu, thread_function_t thread_function, void *thread_user_state ) -{ - int - rv = 0; - - KAFFINITY - affinity_mask - - NTSTATUS - nts_create, - nts_affinity; - - assert( thread_state != NULL ); - // TRD : cpu can be any value in its range - assert( thread_function != NULL ); - // TRD : thread_user_state can be NULL - - affinity_mask = 1 << cpu; - - nts_create = PsCreateSystemThread( thread_state, THREAD_ALL_ACCESS, NULL, NULL, NULL, thread_function, thread_user_state ); - - nts_affinity = ZwSetInformationThread( thread_state, ThreadAffinityMask, &affinity_mask, sizeof(KAFFINITY) ); - - if( nts_create == STATUS_SUCCESS and nts_affinity == STATUS_SUCCESS ) - rv = 1; - - return( rv ); -} - -#endif - - - - - -/****************************************************************************/ -#if (defined __unix__) - -/* TRD : any UNIX on any CPU with any compiler - - I assumed pthreads is available on any UNIX. - - __unix__ indicates Solaris, Linux, HPUX, etc -*/ - -int abstraction_thread_start( thread_state_t *thread_state, unsigned int cpu, thread_function_t thread_function, void *thread_user_state ) -{ - int - rv = 0, - rv_create; - - pthread_attr_t - attr; - - cpu_set_t - cpuset; - - assert( thread_state != NULL ); - // TRD : cpu can be any value in its range - assert( thread_function != NULL ); - // TRD : thread_user_state can be NULL - - pthread_attr_init( &attr ); - - CPU_ZERO( &cpuset ); - CPU_SET( cpu, &cpuset ); - pthread_attr_setaffinity_np( &attr, sizeof(cpuset), &cpuset ); - - rv_create = pthread_create( thread_state, &attr, thread_function, thread_user_state ); - - if( rv_create == 0 ) - rv = 1; - - pthread_attr_destroy( &attr ); - - return( rv ); -} - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/abstraction_thread_wait.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/abstraction_thread_wait.c deleted file mode 100644 index a5835c9051333538dee9728d11f9095b9d2605fe..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/abstraction_thread_wait.c +++ /dev/null @@ -1,71 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -#if (defined _WIN32 && defined _MSC_VER && !defined WIN_KERNEL_BUILD) - -/* TRD : any Windows (user-mode) on any CPU with the Microsoft C compiler - - _WIN32 indicates 64-bit or 32-bit Windows - _MSC_VER indicates Microsoft C compiler - !WIN_KERNEL_BUILD indicates Windows user-mode -*/ - -void abstraction_thread_wait( thread_state_t thread_state ) -{ - WaitForSingleObject( thread_state, INFINITE ); - - return; -} - -#endif - - - - - -/****************************************************************************/ -#if (defined _WIN32 && defined _MSC_VER && defined WIN_KERNEL_BUILD) - -/* TRD : any Windows on any CPU with the Microsoft C compiler - - _WIN32 indicates 64-bit or 32-bit Windows - _MSC_VER indicates Microsoft C compiler - WIN_KERNEL_BUILD indicates Windows kernel -*/ - -void abstraction_thread_wait( thread_state_t thread_state ) -{ - KeWaitForSingleObject( thread_state, Executive, KernelMode, FALSE, NULL ); - - return; -} - -#endif - - - - - -/****************************************************************************/ -#if (defined __unix__) - -/* TRD : any UNIX on any CPU with any compiler - - I assumed pthreads is available on any UNIX. - - __unix__ indicates Solaris, Linux, HPUX, etc -*/ - -void abstraction_thread_wait( thread_state_t thread_state ) -{ - pthread_join( thread_state, NULL ); - - return; -} - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/benchmark_freelist.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/benchmark_freelist.c deleted file mode 100644 index 689de3eaa7ed930bd5e04cf6cc6565d723dda749..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/benchmark_freelist.c +++ /dev/null @@ -1,134 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -void benchmark_lfds611_freelist( void ) -{ - unsigned int - loop, - thread_count, - cpu_count; - - struct lfds611_freelist_state - *fs; - - struct lfds611_freelist_benchmark - *fb; - - thread_state_t - *thread_handles; - - lfds611_atom_t - total_operations_for_full_test_for_all_cpus, - total_operations_for_full_test_for_all_cpus_for_one_cpu = 0; - - double - mean_operations_per_second_per_cpu, - difference_per_second_per_cpu, - total_difference_per_second_per_cpu, - std_dev_per_second_per_cpu, - scalability; - - /* TRD : here we benchmark the freelist - - the benchmark is to have a single freelist - where a worker thread busy-works popping and then pushing - */ - - cpu_count = abstraction_cpu_count(); - - thread_handles = (thread_state_t *) malloc( sizeof(thread_state_t) * cpu_count ); - - fb = (struct lfds611_freelist_benchmark *) malloc( sizeof(struct lfds611_freelist_benchmark) * cpu_count ); - - // TRD : print the benchmark ID and CSV header - printf( "\n" - "Release %s Freelist Benchmark #1\n" - "CPUs,total ops,mean ops/sec per CPU,standard deviation,scalability\n", LFDS611_RELEASE_NUMBER_STRING ); - - // TRD : we run CPU count times for scalability - for( thread_count = 1 ; thread_count <= cpu_count ; thread_count++ ) { - // TRD : initialisation - lfds611_freelist_new( &fs, 1000, NULL, NULL ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (fb+loop)->fs = fs; - (fb+loop)->operation_count = 0; - } - - // TRD : main test - for( loop = 0 ; loop < thread_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, benchmark_lfds611_freelist_thread_pop_and_push, fb+loop ); - - for( loop = 0 ; loop < thread_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - // TRD : post test math - total_operations_for_full_test_for_all_cpus = 0; - total_difference_per_second_per_cpu = 0; - - for( loop = 0 ; loop < thread_count ; loop++ ) - total_operations_for_full_test_for_all_cpus += (fb+loop)->operation_count; - - mean_operations_per_second_per_cpu = ((double) total_operations_for_full_test_for_all_cpus / (double) thread_count) / (double) 10; - - if( thread_count == 1 ) - total_operations_for_full_test_for_all_cpus_for_one_cpu = total_operations_for_full_test_for_all_cpus; - - for( loop = 0 ; loop < thread_count ; loop++ ) { - difference_per_second_per_cpu = ((double) (fb+loop)->operation_count / (double) 10) - mean_operations_per_second_per_cpu; - total_difference_per_second_per_cpu += difference_per_second_per_cpu * difference_per_second_per_cpu; - } - - std_dev_per_second_per_cpu = sqrt( (double) total_difference_per_second_per_cpu ); - - scalability = (double) total_operations_for_full_test_for_all_cpus / (double) (total_operations_for_full_test_for_all_cpus_for_one_cpu * thread_count); - - printf( "%u,%u,%.0f,%.0f,%0.2f\n", thread_count, (unsigned int) total_operations_for_full_test_for_all_cpus, mean_operations_per_second_per_cpu, std_dev_per_second_per_cpu, scalability ); - - // TRD : cleanup - lfds611_freelist_delete( fs, NULL, NULL ); - } - - free( fb ); - - free( thread_handles ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION benchmark_lfds611_freelist_thread_pop_and_push( void *freelist_benchmark ) -{ - struct lfds611_freelist_benchmark - *fb; - - struct lfds611_freelist_element - *fe; - - time_t - start_time; - - assert( freelist_benchmark != NULL ); - - fb = (struct lfds611_freelist_benchmark *) freelist_benchmark; - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - lfds611_freelist_pop( fb->fs, &fe ); - lfds611_freelist_push( fb->fs, fe ); - - fb->operation_count += 2; - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/benchmark_queue.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/benchmark_queue.c deleted file mode 100644 index 70ab8e06e552725e5ea82701dd28af7364ad731a..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/benchmark_queue.c +++ /dev/null @@ -1,138 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -void benchmark_lfds611_queue( void ) -{ - unsigned int - loop, - thread_count, - cpu_count; - - struct lfds611_queue_state - *qs; - - struct lfds611_queue_benchmark - *qb; - - thread_state_t - *thread_handles; - - lfds611_atom_t - total_operations_for_full_test_for_all_cpus, - total_operations_for_full_test_for_all_cpus_for_one_cpu = 0; - - double - mean_operations_per_second_per_cpu, - difference_per_second_per_cpu, - total_difference_per_second_per_cpu, - std_dev_per_second_per_cpu, - scalability; - - /* TRD : here we benchmark the queue - - the benchmark is to have a single queue - where a worker thread busy-works dequeuing and then queuing - */ - - cpu_count = abstraction_cpu_count(); - - thread_handles = (thread_state_t *) malloc( sizeof(thread_state_t) * cpu_count ); - - qb = (struct lfds611_queue_benchmark *) malloc( sizeof(struct lfds611_queue_benchmark) * cpu_count ); - - // TRD : print the benchmark ID and CSV header - printf( "\n" - "Release %s Queue Benchmark #1\n" - "CPUs,total ops,mean ops/sec per CPU,standard deviation,scalability\n", LFDS611_RELEASE_NUMBER_STRING ); - - // TRD : we run CPU count times for scalability - for( thread_count = 1 ; thread_count <= cpu_count ; thread_count++ ) { - // TRD : initialisation - lfds611_queue_new( &qs, 1000 ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (qb+loop)->qs = qs; - (qb+loop)->operation_count = 0; - } - - // TRD : populate the queue (we don't actually use the user data) - for( loop = 0 ; loop < 500 ; loop++ ) - lfds611_queue_enqueue( qs, (void *) (lfds611_atom_t) loop ); - - // TRD : main test - for( loop = 0 ; loop < thread_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, benchmark_lfds611_queue_thread_delfds611_queue_and_enqueue, qb+loop ); - - for( loop = 0 ; loop < thread_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - // TRD : post test math - total_operations_for_full_test_for_all_cpus = 0; - total_difference_per_second_per_cpu = 0; - - for( loop = 0 ; loop < thread_count ; loop++ ) - total_operations_for_full_test_for_all_cpus += (qb+loop)->operation_count; - - mean_operations_per_second_per_cpu = ((double) total_operations_for_full_test_for_all_cpus / (double) thread_count) / (double) 10; - - if( thread_count == 1 ) - total_operations_for_full_test_for_all_cpus_for_one_cpu = total_operations_for_full_test_for_all_cpus; - - for( loop = 0 ; loop < thread_count ; loop++ ) { - difference_per_second_per_cpu = ((double) (qb+loop)->operation_count / (double) 10) - mean_operations_per_second_per_cpu; - total_difference_per_second_per_cpu += difference_per_second_per_cpu * difference_per_second_per_cpu; - } - - std_dev_per_second_per_cpu = sqrt( (double) total_difference_per_second_per_cpu ); - - scalability = (double) total_operations_for_full_test_for_all_cpus / (double) (total_operations_for_full_test_for_all_cpus_for_one_cpu * thread_count); - - printf( "%u,%u,%.0f,%.0f,%0.2f\n", thread_count, (unsigned int) total_operations_for_full_test_for_all_cpus, mean_operations_per_second_per_cpu, std_dev_per_second_per_cpu, scalability ); - - // TRD : cleanup - lfds611_queue_delete( qs, NULL, NULL ); - } - - free( qb ); - - free( thread_handles ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION benchmark_lfds611_queue_thread_delfds611_queue_and_enqueue( void *queue_benchmark ) -{ - struct lfds611_queue_benchmark - *qb; - - void - *user_data; - - time_t - start_time; - - assert( queue_benchmark != NULL ); - - qb = (struct lfds611_queue_benchmark *) queue_benchmark; - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - lfds611_queue_dequeue( qb->qs, &user_data ); - lfds611_queue_enqueue( qb->qs, user_data ); - - qb->operation_count += 2; - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/benchmark_ringbuffer.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/benchmark_ringbuffer.c deleted file mode 100644 index 1322b4e0ce043866ee7131f1583ee336d2322a47..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/benchmark_ringbuffer.c +++ /dev/null @@ -1,137 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -void benchmark_lfds611_ringbuffer( void ) -{ - unsigned int - loop, - thread_count, - cpu_count; - - struct lfds611_ringbuffer_state - *rs; - - struct lfds611_ringbuffer_benchmark - *rb; - - thread_state_t - *thread_handles; - - lfds611_atom_t - total_operations_for_full_test_for_all_cpus, - total_operations_for_full_test_for_all_cpus_for_one_cpu = 0; - - double - mean_operations_per_second_per_cpu, - difference_per_second_per_cpu, - total_difference_per_second_per_cpu, - std_dev_per_second_per_cpu, - scalability; - - /* TRD : here we benchmark the ringbuffer - - the benchmark is to have a single ringbuffer - where a worker thread busy-works writing and then reading - */ - - cpu_count = abstraction_cpu_count(); - - thread_handles = (thread_state_t *) malloc( sizeof(thread_state_t) * cpu_count ); - - rb = (struct lfds611_ringbuffer_benchmark *) malloc( sizeof(struct lfds611_ringbuffer_benchmark) * cpu_count ); - - // TRD : print the benchmark ID and CSV header - printf( "\n" - "Release %s Ringbuffer Benchmark #1\n" - "CPUs,total ops,mean ops/sec per CPU,standard deviation,scalability\n", LFDS611_RELEASE_NUMBER_STRING ); - - // TRD : we run CPU count times for scalability - for( thread_count = 1 ; thread_count <= cpu_count ; thread_count++ ) { - // TRD : initialisation - lfds611_ringbuffer_new( &rs, 1000, NULL, NULL ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (rb+loop)->rs = rs; - (rb+loop)->operation_count = 0; - } - - // TRD : main test - for( loop = 0 ; loop < thread_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, benchmark_lfds611_ringbuffer_thread_write_and_read, rb+loop ); - - for( loop = 0 ; loop < thread_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - // TRD : post test math - total_operations_for_full_test_for_all_cpus = 0; - total_difference_per_second_per_cpu = 0; - - for( loop = 0 ; loop < thread_count ; loop++ ) - total_operations_for_full_test_for_all_cpus += (rb+loop)->operation_count; - - mean_operations_per_second_per_cpu = ((double) total_operations_for_full_test_for_all_cpus / (double) thread_count) / (double) 10; - - if( thread_count == 1 ) - total_operations_for_full_test_for_all_cpus_for_one_cpu = total_operations_for_full_test_for_all_cpus; - - for( loop = 0 ; loop < thread_count ; loop++ ) { - difference_per_second_per_cpu = ((double) (rb+loop)->operation_count / (double) 10) - mean_operations_per_second_per_cpu; - total_difference_per_second_per_cpu += difference_per_second_per_cpu * difference_per_second_per_cpu; - } - - std_dev_per_second_per_cpu = sqrt( (double) total_difference_per_second_per_cpu ); - - scalability = (double) total_operations_for_full_test_for_all_cpus / (double) (total_operations_for_full_test_for_all_cpus_for_one_cpu * thread_count); - - printf( "%u,%u,%.0f,%.0f,%0.2f\n", thread_count, (unsigned int) total_operations_for_full_test_for_all_cpus, mean_operations_per_second_per_cpu, std_dev_per_second_per_cpu, scalability ); - - // TRD : cleanup - lfds611_ringbuffer_delete( rs, NULL, NULL ); - } - - free( rb ); - - free( thread_handles ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION benchmark_lfds611_ringbuffer_thread_write_and_read( void *ringbuffer_benchmark ) -{ - struct lfds611_ringbuffer_benchmark - *rb; - - struct lfds611_freelist_element - *fe; - - time_t - start_time; - - assert( ringbuffer_benchmark != NULL ); - - rb = (struct lfds611_ringbuffer_benchmark *) ringbuffer_benchmark; - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - lfds611_ringbuffer_get_write_element( rb->rs, &fe, NULL ); - lfds611_ringbuffer_put_write_element( rb->rs, fe ); - - lfds611_ringbuffer_get_read_element( rb->rs, &fe ); - lfds611_ringbuffer_put_read_element( rb->rs, fe ); - - rb->operation_count += 2; - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/benchmark_stack.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/benchmark_stack.c deleted file mode 100644 index 0a9f6c86989e14e386fc340d3ff8f54877991395..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/benchmark_stack.c +++ /dev/null @@ -1,134 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -void benchmark_lfds611_stack( void ) -{ - unsigned int - loop, - thread_count, - cpu_count; - - struct lfds611_stack_state - *ss; - - struct lfds611_stack_benchmark - *sb; - - thread_state_t - *thread_handles; - - lfds611_atom_t - total_operations_for_full_test_for_all_cpus, - total_operations_for_full_test_for_all_cpus_for_one_cpu = 0; - - double - mean_operations_per_second_per_cpu, - difference_per_second_per_cpu, - total_difference_per_second_per_cpu, - std_dev_per_second_per_cpu, - scalability; - - /* TRD : here we benchmark the stack - - the benchmark is to have a single stack - where a worker thread busy-works pushing then popping - */ - - cpu_count = abstraction_cpu_count(); - - thread_handles = (thread_state_t *) malloc( sizeof(thread_state_t) * cpu_count ); - - sb = (struct lfds611_stack_benchmark *) malloc( sizeof(struct lfds611_stack_benchmark) * cpu_count ); - - // TRD : print the benchmark ID and CSV header - printf( "\n" - "Release %s Stack Benchmark #1\n" - "CPUs,total ops,mean ops/sec per CPU,standard deviation,scalability\n", LFDS611_RELEASE_NUMBER_STRING ); - - // TRD : we run CPU count times for scalability - for( thread_count = 1 ; thread_count <= cpu_count ; thread_count++ ) { - // TRD : initialisation - lfds611_stack_new( &ss, 1000 ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (sb+loop)->ss = ss; - (sb+loop)->operation_count = 0; - } - - // TRD : main test - for( loop = 0 ; loop < thread_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, benchmark_lfds611_stack_thread_push_and_pop, sb+loop ); - - for( loop = 0 ; loop < thread_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - // TRD : post test math - total_operations_for_full_test_for_all_cpus = 0; - total_difference_per_second_per_cpu = 0; - - for( loop = 0 ; loop < thread_count ; loop++ ) - total_operations_for_full_test_for_all_cpus += (sb+loop)->operation_count; - - mean_operations_per_second_per_cpu = ((double) total_operations_for_full_test_for_all_cpus / (double) thread_count) / (double) 10; - - if( thread_count == 1 ) - total_operations_for_full_test_for_all_cpus_for_one_cpu = total_operations_for_full_test_for_all_cpus; - - for( loop = 0 ; loop < thread_count ; loop++ ) { - difference_per_second_per_cpu = ((double) (sb+loop)->operation_count / (double) 10) - mean_operations_per_second_per_cpu; - total_difference_per_second_per_cpu += difference_per_second_per_cpu * difference_per_second_per_cpu; - } - - std_dev_per_second_per_cpu = sqrt( (double) total_difference_per_second_per_cpu ); - - scalability = (double) total_operations_for_full_test_for_all_cpus / (double) (total_operations_for_full_test_for_all_cpus_for_one_cpu * thread_count); - - printf( "%u,%u,%.0f,%.0f,%0.2f\n", thread_count, (unsigned int) total_operations_for_full_test_for_all_cpus, mean_operations_per_second_per_cpu, std_dev_per_second_per_cpu, scalability ); - - // TRD : cleanup - lfds611_stack_delete( ss, NULL, NULL ); - } - - free( sb ); - - free( thread_handles ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION benchmark_lfds611_stack_thread_push_and_pop( void *stack_benchmark ) -{ - struct lfds611_stack_benchmark - *sb; - - void - *user_data = NULL; - - time_t - start_time; - - assert( stack_benchmark != NULL ); - - sb = (struct lfds611_stack_benchmark *) stack_benchmark; - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - lfds611_stack_push( sb->ss, user_data ); - lfds611_stack_pop( sb->ss, &user_data ); - - sb->operation_count += 2; - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/internal.h b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/internal.h deleted file mode 100644 index ae30bf142c17118d1f12d004001d6d9ad82c3ff8..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/internal.h +++ /dev/null @@ -1,123 +0,0 @@ -/***** ANSI includes *****/ -/* TRD : _GNU_SOURCE is required by sched.h for pthread_attr_setaffinity_np, CPU_ZERO and CPU_SET - however it has to be defined very early as even the ANSI headers pull in stuff - which uses _GNU_SOURCE and which I think must be protected against multiple inclusion, - which basically means if you set it too late, it's not seen, because the headers - have already been parsed with _GNU_SOURCE unset -*/ - -#define _GNU_SOURCE - -#include <assert.h> -#include <math.h> -#include <stdio.h> -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> - -/***** internal includes *****/ -#include "abstraction.h" - -/***** external includes *****/ -#include "liblfds611.h" - -/***** defines *****/ -#define and && -#define or || - -#define RAISED 1 -#define LOWERED 0 - -#define NO_FLAGS 0x0 - -/***** enums *****/ -enum lfds611_test_operation { - UNKNOWN, - HELP, - TEST, - BENCHMARK -}; - -/***** structs *****/ -#include "structures.h" - -/***** prototypes *****/ -int main( int argc, char **argv ); - -void internal_display_test_name( char *test_name ); -void internal_display_test_result( unsigned int number_name_dvs_pairs, ... ); -void internal_display_lfds611_data_structure_validity( enum lfds611_data_structure_validity dvs ); - -void benchmark_lfds611_freelist( void ); -thread_return_t CALLING_CONVENTION benchmark_lfds611_freelist_thread_pop_and_push( void *freelist_benchmark ); - -void benchmark_lfds611_queue( void ); -thread_return_t CALLING_CONVENTION benchmark_lfds611_queue_thread_delfds611_queue_and_enqueue( void *queue_benchmark ); - -void benchmark_lfds611_ringbuffer( void ); -thread_return_t CALLING_CONVENTION benchmark_lfds611_ringbuffer_thread_write_and_read( void *ringbuffer_benchmark ); - -void benchmark_lfds611_stack( void ); -thread_return_t CALLING_CONVENTION benchmark_lfds611_stack_thread_push_and_pop( void *stack_benchmark ); - -void test_lfds611_abstraction( void ); -void abstraction_test_increment( void ); -thread_return_t CALLING_CONVENTION abstraction_test_internal_thread_increment( void *shared_counter ); -thread_return_t CALLING_CONVENTION abstraction_test_internal_thread_atomic_increment( void *shared_counter ); -void abstraction_test_cas( void ); -thread_return_t CALLING_CONVENTION abstraction_test_internal_thread_cas( void *abstraction_test_cas_state ); -void abstraction_test_dcas( void ); -thread_return_t CALLING_CONVENTION abstraction_test_internal_thread_dcas( void *abstraction_test_dcas_state ); - -void test_lfds611_freelist( void ); -void freelist_test_internal_popping( void ); -int freelist_test_internal_popping_init( void **user_data, void *user_state ); -thread_return_t CALLING_CONVENTION freelist_test_internal_thread_popping( void *freelist_test_popping_state ); -void freelist_test_internal_pushing( void ); -int freelist_test_internal_pushing_init( void **user_data, void *user_state ); -void freelist_test_internal_pushing_delete( void *user_data, void *user_state ); -thread_return_t CALLING_CONVENTION freelist_test_internal_thread_pushing( void *freelist_test_pushing_state ); -void freelist_test_internal_popping_and_pushing( void ); -thread_return_t CALLING_CONVENTION freelist_test_internal_thread_popping_and_pushing_start_popping( void *freelist_test_popping_and_pushing_state ); -thread_return_t CALLING_CONVENTION freelist_test_internal_thread_popping_and_pushing_start_pushing( void *freelist_test_popping_and_pushing_state ); -void freelist_test_internal_rapid_popping_and_pushing( void ); -thread_return_t CALLING_CONVENTION freelist_test_internal_thread_rapid_popping_and_pushing( void *lfds611_freelist_state ); - -void test_lfds611_queue( void ); -void queue_test_enqueuing( void ); -thread_return_t CALLING_CONVENTION queue_test_internal_thread_simple_enqueuer( void *queue_test_enqueuing_state ); -void queue_test_dequeuing( void ); -thread_return_t CALLING_CONVENTION queue_test_internal_thread_simple_dequeuer( void *queue_test_dequeuing_state ); -void queue_test_enqueuing_and_dequeuing( void ); -thread_return_t CALLING_CONVENTION queue_test_internal_thread_enqueuer_and_dequeuer( void *queue_test_rapid_enqueuing_and_dequeuing_state ); -void queue_test_rapid_enqueuing_and_dequeuing( void ); -thread_return_t CALLING_CONVENTION queue_test_internal_thread_rapid_enqueuer_and_dequeuer( void *queue_test_rapid_enqueuing_and_dequeuing_state ); - -void test_lfds611_ringbuffer( void ); -void ringbuffer_test_reading( void ); -thread_return_t CALLING_CONVENTION ringbuffer_test_thread_simple_reader( void *ringbuffer_test_reading_state ); -void ringbuffer_test_writing( void ); -thread_return_t CALLING_CONVENTION ringbuffer_test_thread_simple_writer( void *ringbuffer_test_writing_state ); -void ringbuffer_test_reading_and_writing( void ); -thread_return_t CALLING_CONVENTION ringbuffer_test_thread_reader_writer( void *ringbuffer_test_reading_and_writing_state ); - -void test_lfds611_slist( void ); -void test_slist_new_delete_get( void ); -thread_return_t CALLING_CONVENTION slist_test_internal_thread_new_delete_get_new_head_and_next( void *slist_test_state ); -thread_return_t CALLING_CONVENTION slist_test_internal_thread_new_delete_get_delete_and_get( void *slist_test_state ); -void test_slist_get_set_user_data( void ); -thread_return_t CALLING_CONVENTION slist_test_internal_thread_get_set_user_data( void *slist_test_state ); -void test_slist_delete_all_elements( void ); - -void test_lfds611_stack( void ); -void stack_test_internal_popping( void ); -thread_return_t CALLING_CONVENTION stack_test_internal_thread_popping( void *stack_test_popping_state ); -void stack_test_internal_pushing( void ); -thread_return_t CALLING_CONVENTION stack_test_internal_thread_pushing( void *stack_test_pushing_state ); -void stack_test_internal_popping_and_pushing( void ); -thread_return_t CALLING_CONVENTION stack_test_internal_thread_popping_and_pushing_start_popping( void *stack_test_popping_and_pushing_state ); -thread_return_t CALLING_CONVENTION stack_test_internal_thread_popping_and_pushing_start_pushing( void *stack_test_popping_and_pushing_state ); -void stack_test_internal_rapid_popping_and_pushing( void ); -thread_return_t CALLING_CONVENTION stack_test_internal_thread_rapid_popping_and_pushing( void *stack_state ); - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/main.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/main.c deleted file mode 100644 index 66836ba441e26b333432d6feb4147c87b9f65b7b..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/main.c +++ /dev/null @@ -1,83 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -int main( int argc, char **argv ) -{ - enum lfds611_test_operation - operation = UNKNOWN; - - unsigned int - loop, - iterations = 1; - - assert( argc >= 1 ); - assert( argv != NULL ); - - if( argc == 1 or argc >= 4 ) - operation = HELP; - - if( operation == UNKNOWN ) { - if( 0 == strcmp(*(argv+1), "test") ) { - operation = TEST; - - // TRD : sscanf() may fail, but iterations is initialised to 1, so it's okay - if( argc == 3 ) - sscanf( *(argv+2), "%u", &iterations ); - } - - if( 0 == strcmp(*(argv+1), "benchmark") ) { - operation = BENCHMARK; - - // TRD : sscanf() may fail, but iterations is initialised to 1, so it's okay - if( argc == 3 ) - sscanf( *(argv+2), "%u", &iterations ); - } - } - - switch( operation ) { - case UNKNOWN: - case HELP: - printf( "test [test|benchmark] [iterations]\n" - " test : run the test suite\n" - " benchmark : run the benchmark suite\n" - " iterations : optional, default is 1\n" ); - break; - - case TEST: - for( loop = 1 ; loop < iterations+1 ; loop++ ) { - printf( "\n" - "Test Iteration %02u\n" - "=================\n", loop ); - - test_lfds611_abstraction(); - test_lfds611_freelist(); - test_lfds611_queue(); - test_lfds611_ringbuffer(); - test_lfds611_slist(); - test_lfds611_stack(); - } - - break; - - case BENCHMARK: - for( loop = 1 ; loop < iterations+1 ; loop++ ) { - printf( "\n" - "Benchmark Iteration %02u\n" - "========================\n", loop ); - - benchmark_lfds611_freelist(); - benchmark_lfds611_queue(); - benchmark_lfds611_ringbuffer(); - benchmark_lfds611_stack(); - } - - break; - } - - return( EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/misc.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/misc.c deleted file mode 100644 index 9b5891832f7d04892f6be1619cbdc966bd687172..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/misc.c +++ /dev/null @@ -1,119 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -void internal_display_test_name( char *test_name ) -{ - assert( test_name != NULL ); - - printf( "%s...", test_name ); - fflush( stdout ); - - return; -} - - - - - -/****************************************************************************/ -void internal_display_test_result( unsigned int number_name_dvs_pairs, ... ) -{ - va_list - va; - - int - passed_flag = RAISED; - - unsigned int - loop; - - char - *name; - - enum lfds611_data_structure_validity - dvs; - - // TRD : number_name_dvs_pairs can be any value in its range - - va_start( va, number_name_dvs_pairs ); - - for( loop = 0 ; loop < number_name_dvs_pairs ; loop++ ) { - name = va_arg( va, char * ); - dvs = va_arg( va, enum lfds611_data_structure_validity ); - - if( dvs != LFDS611_VALIDITY_VALID ) { - passed_flag = LOWERED; - break; - } - } - - va_end( va ); - - if( passed_flag == RAISED ) - puts( "passed" ); - - if( passed_flag == LOWERED ) { - printf( "failed (" ); - - va_start( va, number_name_dvs_pairs ); - - for( loop = 0 ; loop < number_name_dvs_pairs ; loop++ ) { - name = va_arg( va, char * ); - dvs = va_arg( va, enum lfds611_data_structure_validity ); - - printf( "%s ", name ); - internal_display_lfds611_data_structure_validity( dvs ); - - if( loop+1 < number_name_dvs_pairs ) - printf( ", " ); - } - - va_end( va ); - - printf( ")\n" ); - } - - return; -} - - - - - -/****************************************************************************/ -void internal_display_lfds611_data_structure_validity( enum lfds611_data_structure_validity dvs ) -{ - char - *string = NULL; - - switch( dvs ) { - case LFDS611_VALIDITY_VALID: - string = "valid"; - break; - - case LFDS611_VALIDITY_INVALID_LOOP: - string = "invalid - loop detected"; - break; - - case LFDS611_VALIDITY_INVALID_MISSING_ELEMENTS: - string = "invalid - missing elements"; - break; - - case LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS: - string = "invalid - additional elements"; - break; - - case LFDS611_VALIDITY_INVALID_TEST_DATA: - string = "invalid - invalid test data"; - break; - } - - printf( "%s", string ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/structures.h b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/structures.h deleted file mode 100644 index 36d01536b539a1c3271e46f87bc1778db42b9f9c..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/structures.h +++ /dev/null @@ -1,205 +0,0 @@ -/***** structs *****/ -#pragma pack( push, LFDS611_ALIGN_DOUBLE_POINTER ) - -/***** abstraction tests *****/ -struct abstraction_test_cas_state { - volatile lfds611_atom_t - *shared_counter; - - lfds611_atom_t - local_counter; -}; - -struct abstraction_test_dcas_state { - volatile lfds611_atom_t - *shared_counter; - - lfds611_atom_t - local_counter; -}; - -/***** freelist tests *****/ -struct freelist_test_popping_state { - struct lfds611_freelist_state - *fs, - *fs_thread_local; -}; - -struct freelist_test_pushing_state { - lfds611_atom_t - *count, - thread_number; - - struct lfds611_freelist_state - *source_fs, - *fs; -}; - -struct freelist_test_popping_and_pushing_state { - struct lfds611_freelist_state - *local_fs, - *fs; -}; - -struct freelist_test_counter_and_thread_number { - lfds611_atom_t - thread_number; - - unsigned long long int - counter; -}; - -/***** queue tests *****/ -struct queue_test_enqueuing_state { - struct lfds611_queue_state - *qs; - - lfds611_atom_t - counter; -}; - -struct queue_test_dequeuing_state { - struct lfds611_queue_state - *qs; - - int - error_flag; -}; - -struct queue_test_enqueuing_and_dequeuing_state { - struct lfds611_queue_state - *qs; - - lfds611_atom_t - counter, - thread_number, - *per_thread_counters; - - unsigned int - cpu_count; - - int - error_flag; -}; - -struct queue_test_rapid_enqueuing_and_dequeuing_state { - struct lfds611_queue_state - *qs; - - lfds611_atom_t - counter; -}; - -/***** ringbuffer tests *****/ -struct ringbuffer_test_reading_state { - struct lfds611_ringbuffer_state - *rs; - - int - error_flag; - - lfds611_atom_t - read_count; -}; - -struct ringbuffer_test_writing_state { - struct lfds611_ringbuffer_state - *rs; - - lfds611_atom_t - write_count; -}; - -struct ringbuffer_test_reading_and_writing_state { - struct lfds611_ringbuffer_state - *rs; - - lfds611_atom_t - counter, - *per_thread_counters; - - unsigned int - cpu_count; - - int - error_flag; -}; - -/***** slist tests *****/ -struct slist_test_state { - struct lfds611_slist_state - *ss; - - size_t - create_count, - delete_count; - - lfds611_atom_t - thread_and_count; -}; - -/***** stack tests *****/ -struct stack_test_popping_state { - struct lfds611_stack_state - *ss, - *ss_thread_local; -}; - -struct stack_test_pushing_state { - lfds611_atom_t - thread_number; - - struct lfds611_stack_state - *ss; -}; - -struct stack_test_popping_and_pushing_state { - struct lfds611_stack_state - *local_ss, - *ss; -}; - -struct stack_test_counter_and_thread_number { - lfds611_atom_t - thread_number, - counter; -}; - -/***** freelist benchmarks *****/ -struct lfds611_freelist_benchmark { - struct lfds611_freelist_state - *fs; - - lfds611_atom_t - operation_count; -}; - -/***** queue benchmarks *****/ -struct lfds611_queue_benchmark { - struct lfds611_queue_state - *qs; - - lfds611_atom_t - operation_count; -}; - -/***** ringbuffer benchmarks *****/ -struct lfds611_ringbuffer_benchmark { - struct lfds611_ringbuffer_state - *rs; - - lfds611_atom_t - operation_count; -}; - -/***** stack benchmarks *****/ -struct lfds611_stack_benchmark { - struct lfds611_stack_state - *ss; - - lfds611_atom_t - operation_count; -}; - -#pragma pack( pop ) - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_abstraction.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_abstraction.c deleted file mode 100644 index 772fbf5ca38640c8a26178bd11fcec135f160760..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_abstraction.c +++ /dev/null @@ -1,323 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -void test_lfds611_abstraction( void ) -{ - printf( "\n" - "Abstraction Tests\n" - "=================\n" ); - - abstraction_test_increment(); - abstraction_test_cas(); - abstraction_test_dcas(); - - return; -} - - - - - -/****************************************************************************/ -void abstraction_test_increment( void ) -{ - unsigned int - loop, - cpu_count; - - thread_state_t - *thread_handles; - - LFDS611_ALIGN(LFDS611_ALIGN_SINGLE_POINTER) volatile lfds611_atom_t - shared_counter, - atomic_shared_counter; - - /* TRD : here we test lfds611_abstraction_increment - - first, we run one thread per CPU where each thread increments - a shared counter 10,000,000 times - however, this first test - does NOT use atomic increment; it uses "++" - - second, we repeat the exercise, but this time using - lfds611_abstraction_increment() - - if the final value in the first test is less than (10,000,000*cpu_count) - then the system is sensitive to non-atomic increments; this means if - our atomic version of the test passes, we can have some degree of confidence - that it works - - if the final value in the first test is in fact correct, then we can't know - that our atomic version has changed anything - - and of course if the final value in the atomic test is wrong, we know things - are broken - */ - - internal_display_test_name( "Atomic increment" ); - - cpu_count = abstraction_cpu_count(); - - shared_counter = 0; - atomic_shared_counter = 0; - - LFDS611_BARRIER_STORE; - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - // TRD : non-atomic - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, abstraction_test_internal_thread_increment, (void *) &shared_counter ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - // TRD : atomic - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, abstraction_test_internal_thread_atomic_increment, (void *) &atomic_shared_counter ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - // TRD : results - if( shared_counter < (10000000 * cpu_count) and atomic_shared_counter == (10000000 * cpu_count) ) - puts( "passed" ); - - if( shared_counter == (10000000 * cpu_count) and atomic_shared_counter == (10000000 * cpu_count) ) - puts( "indeterminate" ); - - if( atomic_shared_counter < (10000000 * cpu_count) ) - puts( "failed" ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION abstraction_test_internal_thread_increment( void *shared_counter ) -{ - assert( shared_counter != NULL ); - - LFDS611_BARRIER_LOAD; - - lfds611_liblfds_abstraction_test_helper_increment_non_atomic( shared_counter ); - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION abstraction_test_internal_thread_atomic_increment( void *shared_counter ) -{ - assert( shared_counter != NULL ); - - LFDS611_BARRIER_LOAD; - - lfds611_liblfds_abstraction_test_helper_increment_atomic( shared_counter ); - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void abstraction_test_cas( void ) -{ - unsigned int - loop, - cpu_count; - - thread_state_t - *thread_handles; - - struct abstraction_test_cas_state - *atcs; - - LFDS611_ALIGN(LFDS611_ALIGN_SINGLE_POINTER) volatile lfds611_atom_t - shared_counter; - - lfds611_atom_t - local_total = 0; - - // TRD : number_logical_processors can be any value in its range - - /* TRD : here we test lfds611_abstraction_cas - - we run one thread per CPU - we use lfds611_abstraction_cas() to increment a shared counter - every time a thread successfully increments the counter, - it increments a thread local counter - the threads run for ten seconds - after the threads finish, we total the local counters - they should equal the shared counter - */ - - internal_display_test_name( "Atomic CAS" ); - - cpu_count = abstraction_cpu_count(); - - shared_counter = 0; - - LFDS611_BARRIER_STORE; - - atcs = malloc( sizeof(struct abstraction_test_cas_state) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (atcs+loop)->shared_counter = &shared_counter; - (atcs+loop)->local_counter = 0; - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, abstraction_test_internal_thread_cas, atcs+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - // TRD : results - for( loop = 0 ; loop < cpu_count ; loop++ ) - local_total += (atcs+loop)->local_counter; - - if( local_total == shared_counter ) - puts( "passed" ); - - if( local_total != shared_counter ) - puts( "failed" ); - - // TRD : cleanup - free( atcs ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION abstraction_test_internal_thread_cas( void *abstraction_test_cas_state ) -{ - struct abstraction_test_cas_state - *atcs; - - assert( abstraction_test_cas_state != NULL ); - - atcs = (struct abstraction_test_cas_state *) abstraction_test_cas_state; - - LFDS611_BARRIER_LOAD; - - lfds611_liblfds_abstraction_test_helper_cas( atcs->shared_counter, &atcs->local_counter ); - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void abstraction_test_dcas( void ) -{ - unsigned int - loop, - cpu_count; - - thread_state_t - *thread_handles; - - struct abstraction_test_dcas_state - *atds; - - LFDS611_ALIGN(LFDS611_ALIGN_DOUBLE_POINTER) volatile lfds611_atom_t - shared_counter[2] = { 0, 0 }; - - lfds611_atom_t - local_total = 0; - - /* TRD : here we test lfds611_abstraction_dcas - - we run one thread per CPU - we use lfds611_abstraction_dcas() to increment a shared counter - every time a thread successfully increments the counter, - it increments a thread local counter - the threads run for ten seconds - after the threads finish, we total the local counters - they should equal the shared counter - */ - - internal_display_test_name( "Atomic DCAS" ); - - cpu_count = abstraction_cpu_count(); - - atds = malloc( sizeof(struct abstraction_test_dcas_state) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (atds+loop)->shared_counter = shared_counter; - (atds+loop)->local_counter = 0; - } - - LFDS611_BARRIER_STORE; - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, abstraction_test_internal_thread_dcas, atds+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - // TRD : results - for( loop = 0 ; loop < cpu_count ; loop++ ) - local_total += (atds+loop)->local_counter; - - if( local_total == shared_counter[0] ) - puts( "passed" ); - - if( local_total != shared_counter[0] ) - puts( "failed" ); - - // TRD : cleanup - free( atds ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION abstraction_test_internal_thread_dcas( void *abstraction_test_dcas_state ) -{ - struct abstraction_test_dcas_state - *atds; - - assert( abstraction_test_dcas_state != NULL ); - - atds = (struct abstraction_test_dcas_state *) abstraction_test_dcas_state; - - LFDS611_BARRIER_LOAD; - - lfds611_liblfds_abstraction_test_helper_dcas( atds->shared_counter, &atds->local_counter ); - - return( (thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_freelist.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_freelist.c deleted file mode 100644 index d915b815b04a02a78d8624fa61a57a721e70521a..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_freelist.c +++ /dev/null @@ -1,673 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -void test_lfds611_freelist( void ) -{ - printf( "\n" - "Freelist Tests\n" - "==============\n" ); - - freelist_test_internal_popping(); - freelist_test_internal_pushing(); - freelist_test_internal_popping_and_pushing(); - freelist_test_internal_rapid_popping_and_pushing(); - - return; -} - - - - - -/****************************************************************************/ -void freelist_test_internal_popping( void ) -{ - unsigned int - loop, - cpu_count; - - lfds611_atom_t - count = 0; - - thread_state_t - *thread_handles; - - enum lfds611_data_structure_validity - dvs = LFDS611_VALIDITY_VALID; - - struct lfds611_freelist_state - *fs; - - struct lfds611_freelist_element - *fe; - - struct freelist_test_popping_state - *ftps; - - unsigned int - *found_count; - - /* TRD : we create a freelist with 1,000,000 elements - - the creation function runs in a single thread and creates - and pushes those elements onto the freelist - - each element contains a void pointer which is its element number - - we then run one thread per CPU - where each thread loops, popping as quickly as possible - each popped element is pushed onto a thread-local freelist - - the threads run till the source freelist is empty - - we then check the thread-local freelists - we should find we have every element - - then tidy up - */ - - internal_display_test_name( "Popping" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_freelist_new( &fs, 1000000, freelist_test_internal_popping_init, &count ); - ftps = malloc( sizeof(struct freelist_test_popping_state) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (ftps+loop)->fs = fs; - lfds611_freelist_new( &(ftps+loop)->fs_thread_local, 0, NULL, NULL ); - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, freelist_test_internal_thread_popping, ftps+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - // TRD : now we check the thread-local freelists - found_count = malloc( sizeof(unsigned int) * 1000000 ); - - for( loop = 0 ; loop < 1000000 ; loop++ ) - *(found_count+loop) = 0; - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - while( lfds611_freelist_pop((ftps+loop)->fs_thread_local, &fe) ) { - lfds611_freelist_get_user_data_from_element( fe, (void **) &count ); - (*(found_count+count))++; - lfds611_freelist_push( fs, fe ); - } - } - - for( loop = 0 ; loop < 1000000 and dvs == LFDS611_VALIDITY_VALID ; loop++ ) { - if( *(found_count+loop) == 0 ) - dvs = LFDS611_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( *(found_count+loop) > 1 ) - dvs = LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - } - - // TRD : cleanup - free( found_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - lfds611_freelist_delete( (ftps+loop)->fs_thread_local, NULL, NULL ); - - free( ftps ); - lfds611_freelist_delete( fs, NULL, NULL ); - - // TRD : print the test result - internal_display_test_result( 1, "freelist", dvs ); - - return; -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -int freelist_test_internal_popping_init( void **user_data, void *user_state ) -{ - lfds611_atom_t - *count; - - assert( user_data != NULL ); - assert( user_state != NULL ); - - count = (lfds611_atom_t *) user_state; - - *(lfds611_atom_t *) user_data = (*count)++; - - return( 1 ); -} - -#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION freelist_test_internal_thread_popping( void *freelist_test_popping_state ) -{ - struct freelist_test_popping_state - *ftps; - - struct lfds611_freelist_element - *fe; - - assert( freelist_test_popping_state != NULL ); - - ftps = (struct freelist_test_popping_state *) freelist_test_popping_state; - - lfds611_freelist_use( ftps->fs ); - lfds611_freelist_use( ftps->fs_thread_local ); - - while( lfds611_freelist_pop(ftps->fs, &fe) ) - lfds611_freelist_push( ftps->fs_thread_local, fe ); - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void freelist_test_internal_pushing( void ) -{ - unsigned int - loop, - cpu_count; - - lfds611_atom_t - count = 0; - - thread_state_t - *thread_handles; - - enum lfds611_data_structure_validity - dvs; - - struct freelist_test_pushing_state - *ftps; - - struct lfds611_freelist_element - *fe; - - struct lfds611_freelist_state - *fs, - *cleanup_fs; - - struct freelist_test_counter_and_thread_number - *cnt, - *counter_and_number_trackers; - - struct lfds611_validation_info - vi; - - /* TRD : we create an empty freelist, which we will push to - - we then create one freelist per CPU, where this freelist - contains 100,000 elements per thread and - each element is an incrementing counter and unique ID - (from 0 to number of CPUs) - - we then start one thread per CPU, where each thread is - given one of the populated freelists and pops from that - to push to the empty freelist - - the reason for this is to achieve memory pre-allocation - which allows the pushing threads to run at maximum speed - - the threads end when their freelists are empty - - we then fully pop the now populated main freelist (onto - a second freelist, so we can cleanly free all memory), - checking that the counts increment on a per unique ID basis - and that the number of elements we pop equals 1,000,000 per thread - (since each element has an incrementing counter which is - unique on a per unique ID basis, we can know we didn't lose - any elements) - */ - - internal_display_test_name( "Pushing" ); - - cpu_count = abstraction_cpu_count(); - - ftps = malloc( sizeof(struct freelist_test_pushing_state) * cpu_count ); - - lfds611_freelist_new( &fs, 0, NULL, NULL ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (ftps+loop)->thread_number = (lfds611_atom_t) loop; - // TRD : note count is shared across threads, so thread 0 is 0-100000, thread 1 is 100000-200000, etc - (ftps+loop)->count = &count; - lfds611_freelist_new( &(ftps+loop)->source_fs, 100000, freelist_test_internal_pushing_init, (void *) (ftps+loop) ); - (ftps+loop)->fs = fs; - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, freelist_test_internal_thread_pushing, ftps+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - // TRD : now fully pop and verify the main freelist - lfds611_freelist_new( &cleanup_fs, 0, NULL, NULL ); - - counter_and_number_trackers = malloc( sizeof(struct freelist_test_counter_and_thread_number) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (counter_and_number_trackers+loop)->counter = 100000 * loop; - (counter_and_number_trackers+loop)->thread_number = (lfds611_atom_t) loop; - } - - vi.min_elements = vi.max_elements = 100000 * cpu_count; - - lfds611_freelist_query( fs, LFDS611_FREELIST_QUERY_VALIDATE, &vi, (void *) &dvs ); - - while( dvs == LFDS611_VALIDITY_VALID and lfds611_freelist_pop(fs, &fe) ) { - lfds611_freelist_get_user_data_from_element( fe, (void **) &cnt ); - - if( cnt->counter != (counter_and_number_trackers+cnt->thread_number)->counter++ ) - dvs = LFDS611_VALIDITY_INVALID_MISSING_ELEMENTS; - - lfds611_freelist_push( cleanup_fs, fe ); - } - - // TRD : clean up - free( counter_and_number_trackers ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - lfds611_freelist_delete( (ftps+loop)->source_fs, NULL, NULL ); - - free( ftps ); - - lfds611_freelist_delete( cleanup_fs, freelist_test_internal_pushing_delete, NULL ); - lfds611_freelist_delete( fs, NULL, NULL ); - - // TRD : print the test result - internal_display_test_result( 1, "freelist", dvs ); - - return; -} - - - - - -/****************************************************************************/ -int freelist_test_internal_pushing_init( void **user_data, void *user_state ) -{ - struct freelist_test_counter_and_thread_number - *ftcatn; - - struct freelist_test_pushing_state - *ftps; - - assert( user_data != NULL ); - // TRD : user_state is being used as an integer type - - *user_data = malloc( sizeof(struct freelist_test_counter_and_thread_number) ); - ftps = (struct freelist_test_pushing_state *) user_state; - - ftcatn = (struct freelist_test_counter_and_thread_number *) *user_data; - - ftcatn->counter = (*ftps->count)++; - ftcatn->thread_number = ftps->thread_number; - - return( 1 ); -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -void freelist_test_internal_pushing_delete( void *user_data, void *user_state ) -{ - assert( user_data != NULL ); - assert( user_state == NULL ); - - free( user_data ); - - return; -} - -#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION freelist_test_internal_thread_pushing( void *freelist_test_pushing_state ) -{ - struct freelist_test_pushing_state - *ftps; - - struct lfds611_freelist_element - *fe; - - assert( freelist_test_pushing_state != NULL ); - - ftps = (struct freelist_test_pushing_state *) freelist_test_pushing_state; - - lfds611_freelist_use( ftps->source_fs ); - lfds611_freelist_use( ftps->fs ); - - while( lfds611_freelist_pop(ftps->source_fs, &fe) ) - lfds611_freelist_push( ftps->fs, fe ); - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void freelist_test_internal_popping_and_pushing( void ) -{ - unsigned int - loop, - cpu_count; - - thread_state_t - *thread_handles; - - enum lfds611_data_structure_validity - dvs; - - struct lfds611_freelist_state - *fs; - - struct freelist_test_popping_and_pushing_state - *pps; - - struct lfds611_validation_info - vi; - - /* TRD : we have two threads per CPU - the threads loop for ten seconds - the first thread pushes 100000 elements then pops 100000 elements - the second thread pops 100000 elements then pushes 100000 elements - all pushes and pops go onto the single main freelist - - after time is up, all threads push what they have remaining onto - the main freelist - - we then validate the main freelist - */ - - internal_display_test_name( "Popping and pushing (10 seconds)" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_freelist_new( &fs, 100000 * cpu_count, NULL, NULL ); - - pps = malloc( sizeof(struct freelist_test_popping_and_pushing_state) * cpu_count * 2 ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (pps+loop)->fs = fs; - lfds611_freelist_new( &(pps+loop)->local_fs, 0, NULL, NULL ); - - (pps+loop+cpu_count)->fs = fs; - lfds611_freelist_new( &(pps+loop+cpu_count)->local_fs, 100000, NULL, NULL ); - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count * 2 ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - abstraction_thread_start( &thread_handles[loop], loop, freelist_test_internal_thread_popping_and_pushing_start_popping, pps+loop ); - abstraction_thread_start( &thread_handles[loop+cpu_count], loop, freelist_test_internal_thread_popping_and_pushing_start_pushing, pps+loop+cpu_count ); - } - - for( loop = 0 ; loop < cpu_count * 2 ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - for( loop = 0 ; loop < cpu_count * 2 ; loop++ ) - lfds611_freelist_delete( (pps+loop)->local_fs, NULL, NULL ); - - free( pps ); - - vi.min_elements = vi.max_elements = 100000 * cpu_count * 2; - - lfds611_freelist_query( fs, LFDS611_FREELIST_QUERY_VALIDATE, (void *) &vi, (void *) &dvs ); - - lfds611_freelist_delete( fs, NULL, NULL ); - - // TRD : print the test result - internal_display_test_result( 1, "freelist", dvs ); - - return; -} - - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION freelist_test_internal_thread_popping_and_pushing_start_popping( void *freelist_test_popping_and_pushing_state ) -{ - struct freelist_test_popping_and_pushing_state - *pps; - - struct lfds611_freelist_element - *fe; - - time_t - start_time; - - unsigned int - count; - - assert( freelist_test_popping_and_pushing_state != NULL ); - - pps = (struct freelist_test_popping_and_pushing_state *) freelist_test_popping_and_pushing_state; - - lfds611_freelist_use( pps->fs ); - lfds611_freelist_use( pps->local_fs ); - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - count = 0; - - while( count < 100000 ) { - lfds611_freelist_pop( pps->fs, &fe ); - - if( fe != NULL ) { - lfds611_freelist_push( pps->local_fs, fe ); - count++; - } - } - - while( lfds611_freelist_pop(pps->local_fs, &fe) ) - lfds611_freelist_push( pps->fs, fe ); - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION freelist_test_internal_thread_popping_and_pushing_start_pushing( void *freelist_test_popping_and_pushing_state ) -{ - struct freelist_test_popping_and_pushing_state - *pps; - - struct lfds611_freelist_element - *fe; - - time_t - start_time; - - unsigned int - count; - - assert( freelist_test_popping_and_pushing_state != NULL ); - - pps = (struct freelist_test_popping_and_pushing_state *) freelist_test_popping_and_pushing_state; - - lfds611_freelist_use( pps->fs ); - lfds611_freelist_use( pps->local_fs ); - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - while( lfds611_freelist_pop(pps->local_fs, &fe) ) - lfds611_freelist_push( pps->fs, fe ); - - count = 0; - - while( count < 1000 ) { - lfds611_freelist_pop( pps->fs, &fe ); - - if( fe != NULL ) { - lfds611_freelist_push( pps->local_fs, fe ); - count++; - } - } - } - - // TRD : now push whatever we have in our local freelist - while( lfds611_freelist_pop(pps->local_fs, &fe) ) - lfds611_freelist_push( pps->fs, fe ); - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void freelist_test_internal_rapid_popping_and_pushing( void ) -{ - unsigned int - loop, - cpu_count; - - thread_state_t - *thread_handles; - - struct lfds611_freelist_state - *fs; - - struct lfds611_validation_info - vi; - - enum lfds611_data_structure_validity - dvs; - - /* TRD : in these tests there is a fundamental antagonism between - how much checking/memory clean up that we do and the - likelyhood of collisions between threads in their lock-free - operations - - the lock-free operations are very quick; if we do anything - much at all between operations, we greatly reduce the chance - of threads colliding - - so we have some tests which do enough checking/clean up that - they can tell the freelist is valid and don't leak memory - and here, this test now is one of those which does minimal - checking - in fact, the nature of the test is that you can't - do any real checking - but goes very quickly - - what we do is create a small freelist and then run one thread - per CPU, where each thread simply pops and then immediately - pushes - - the test runs for ten seconds - - after the test is done, the only check we do is to traverse - the freelist, checking for loops and ensuring the number of - elements is correct - */ - - internal_display_test_name( "Rapid popping and pushing (10 seconds)" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_freelist_new( &fs, cpu_count, NULL, NULL ); - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, freelist_test_internal_thread_rapid_popping_and_pushing, fs ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - vi.min_elements = cpu_count; - vi.max_elements = cpu_count; - - lfds611_freelist_query( fs, LFDS611_FREELIST_QUERY_VALIDATE, (void *) &vi, (void *) &dvs ); - - lfds611_freelist_delete( fs, NULL, NULL ); - - // TRD : print the test result - internal_display_test_result( 1, "freelist", dvs ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION freelist_test_internal_thread_rapid_popping_and_pushing( void *lfds611_freelist_state ) -{ - struct lfds611_freelist_state - *fs; - - struct lfds611_freelist_element - *fe; - - time_t - start_time; - - assert( lfds611_freelist_state != NULL ); - - fs = (struct lfds611_freelist_state *) lfds611_freelist_state; - - lfds611_freelist_use( fs ); - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - lfds611_freelist_pop( fs, &fe ); - lfds611_freelist_push( fs, fe ); - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_queue.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_queue.c deleted file mode 100644 index 9acb516ff75902c9486b56c207b847b4c4a451e6..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_queue.c +++ /dev/null @@ -1,515 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -void test_lfds611_queue( void ) -{ - printf( "\n" - "Queue Tests\n" - "===========\n" ); - - queue_test_enqueuing(); - queue_test_dequeuing(); - queue_test_enqueuing_and_dequeuing(); - queue_test_rapid_enqueuing_and_dequeuing(); - - return; -} - - - - - -/****************************************************************************/ -void queue_test_enqueuing( void ) -{ - unsigned int - loop, - cpu_count; - - thread_state_t - *thread_handles; - - struct lfds611_queue_state - *qs; - - struct queue_test_enqueuing_state - *qtes; - - lfds611_atom_t - user_data, - thread, - count, - *per_thread_counters; - - struct lfds611_validation_info - vi = { 1000000, 1000000 }; - - enum lfds611_data_structure_validity - dvs[2]; - - /* TRD : create an empty queue with 1,000,000 elements in its freelist - then run one thread per CPU - where each thread busy-works, enqueuing elements (until there are no more elements) - each element's void pointer of user data is (thread number | element number) - where element_number is a thread-local counter starting at 0 - where the thread_number occupies the top byte - - when we're done, we check that all the elements are present - and increment on a per-thread basis - */ - - internal_display_test_name( "Enqueuing" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_queue_new( &qs, 1000000 ); - - qtes = malloc( sizeof(struct queue_test_enqueuing_state) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (qtes+loop)->qs = qs; - (qtes+loop)->counter = (lfds611_atom_t) loop << (sizeof(lfds611_atom_t)*8-8); - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, queue_test_internal_thread_simple_enqueuer, qtes+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - free( qtes ); - - /* TRD : first, validate the queue - - then dequeue - we expect to find element numbers increment on a per thread basis - */ - - lfds611_queue_query( qs, LFDS611_QUEUE_QUERY_VALIDATE, &vi, dvs ); - - per_thread_counters = malloc( sizeof(lfds611_atom_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - *(per_thread_counters+loop) = 0; - - while( dvs[0] == LFDS611_VALIDITY_VALID and dvs[1] == LFDS611_VALIDITY_VALID and lfds611_queue_dequeue(qs, (void *) &user_data) ) { - thread = user_data >> (sizeof(lfds611_atom_t)*8-8); - count = (user_data << 8) >> 8; - - if( thread >= cpu_count ) { - dvs[0] = LFDS611_VALIDITY_INVALID_TEST_DATA; - break; - } - - if( count < per_thread_counters[thread] ) - dvs[0] = LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( count > per_thread_counters[thread] ) - dvs[0] = LFDS611_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( count == per_thread_counters[thread] ) - per_thread_counters[thread]++; - } - - free( per_thread_counters ); - - lfds611_queue_delete( qs, NULL, NULL ); - - internal_display_test_result( 2, "queue", dvs[0], "queue freelist", dvs[1] ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION queue_test_internal_thread_simple_enqueuer( void *queue_test_enqueuing_state ) -{ - struct queue_test_enqueuing_state - *qtes; - - assert( queue_test_enqueuing_state != NULL ); - - qtes = (struct queue_test_enqueuing_state *) queue_test_enqueuing_state; - - lfds611_queue_use( qtes->qs ); - - // TRD : top byte of counter is already our thread number - while( lfds611_queue_enqueue(qtes->qs, (void *) qtes->counter++) ); - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void queue_test_dequeuing( void ) -{ - unsigned int - loop, - cpu_count; - - thread_state_t - *thread_handles; - - struct lfds611_queue_state - *qs; - - struct queue_test_dequeuing_state - *qtds; - - struct lfds611_validation_info - vi = { 0, 0 }; - - enum lfds611_data_structure_validity - dvs[2]; - - /* TRD : create a queue with 1,000,000 elements - - use a single thread to enqueue every element - each elements user data is an incrementing counter - - then run one thread per CPU - where each busy-works dequeuing - - when an element is dequeued, we check (on a per-thread basis) the - value deqeued is greater than the element previously dequeued - */ - - internal_display_test_name( "Dequeuing" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_queue_new( &qs, 1000000 ); - - for( loop = 0 ; loop < 1000000 ; loop++ ) - lfds611_queue_enqueue( qs, (void *) (lfds611_atom_t) loop ); - - qtds = malloc( sizeof(struct queue_test_dequeuing_state) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (qtds+loop)->qs = qs; - (qtds+loop)->error_flag = LOWERED; - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, queue_test_internal_thread_simple_dequeuer, qtds+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - // TRD : check queue is empty - lfds611_queue_query( qs, LFDS611_QUEUE_QUERY_VALIDATE, (void *) &vi, (void *) dvs ); - - // TRD : check for raised error flags - for( loop = 0 ; loop < cpu_count ; loop++ ) - if( (qtds+loop)->error_flag == RAISED ) - dvs[0] = LFDS611_VALIDITY_INVALID_TEST_DATA; - - free( qtds ); - - lfds611_queue_delete( qs, NULL, NULL ); - - internal_display_test_result( 2, "queue", dvs[0], "queue freelist", dvs[1] ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION queue_test_internal_thread_simple_dequeuer( void *queue_test_dequeuing_state ) -{ - struct queue_test_dequeuing_state - *qtds; - - lfds611_atom_t - *prev_user_data, - *user_data; - - assert( queue_test_dequeuing_state != NULL ); - - qtds = (struct queue_test_dequeuing_state *) queue_test_dequeuing_state; - - lfds611_queue_use( qtds->qs ); - - lfds611_queue_dequeue( qtds->qs, (void *) &prev_user_data ); - - while( lfds611_queue_dequeue(qtds->qs, (void *) &user_data) ) { - if( user_data <= prev_user_data ) - qtds->error_flag = RAISED; - - prev_user_data = user_data; - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void queue_test_enqueuing_and_dequeuing( void ) -{ - unsigned int - loop, - subloop, - cpu_count; - - thread_state_t - *thread_handles; - - struct lfds611_queue_state - *qs; - - struct queue_test_enqueuing_and_dequeuing_state - *qteds; - - struct lfds611_validation_info - vi = { 0, 0 }; - - enum lfds611_data_structure_validity - dvs[2]; - - internal_display_test_name( "Enqueuing and dequeuing (10 seconds)" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_queue_new( &qs, cpu_count ); - - qteds = malloc( sizeof(struct queue_test_enqueuing_and_dequeuing_state) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (qteds+loop)->qs = qs; - (qteds+loop)->thread_number = loop; - (qteds+loop)->counter = (lfds611_atom_t) loop << (sizeof(lfds611_atom_t)*8-8); - (qteds+loop)->cpu_count = cpu_count; - (qteds+loop)->error_flag = LOWERED; - (qteds+loop)->per_thread_counters = malloc( sizeof(lfds611_atom_t) * cpu_count ); - - for( subloop = 0 ; subloop < cpu_count ; subloop++ ) - *((qteds+loop)->per_thread_counters+subloop) = 0; - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, queue_test_internal_thread_enqueuer_and_dequeuer, qteds+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - lfds611_queue_query( qs, LFDS611_QUEUE_QUERY_VALIDATE, (void *) &vi, (void *) dvs ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - if( (qteds+loop)->error_flag == RAISED ) - dvs[0] = LFDS611_VALIDITY_INVALID_TEST_DATA; - - for( loop = 0 ; loop < cpu_count ; loop++ ) - free( (qteds+loop)->per_thread_counters ); - - free( qteds ); - - lfds611_queue_delete( qs, NULL, NULL ); - - internal_display_test_result( 2, "queue", dvs[0], "queue freelist", dvs[1] ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION queue_test_internal_thread_enqueuer_and_dequeuer( void *queue_test_enqueuing_and_dequeuing_state ) -{ - struct queue_test_enqueuing_and_dequeuing_state - *qteds; - - time_t - start_time; - - lfds611_atom_t - thread, - count, - user_data; - - assert( queue_test_enqueuing_and_dequeuing_state != NULL ); - - qteds = (struct queue_test_enqueuing_and_dequeuing_state *) queue_test_enqueuing_and_dequeuing_state; - - lfds611_queue_use( qteds->qs ); - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - lfds611_queue_enqueue( qteds->qs, (void *) (qteds->counter++) ); - lfds611_queue_dequeue( qteds->qs, (void *) &user_data ); - - thread = user_data >> (sizeof(lfds611_atom_t)*8-8); - count = (user_data << 8) >> 8; - - if( thread >= qteds->cpu_count ) - qteds->error_flag = RAISED; - else { - if( count < qteds->per_thread_counters[thread] ) - qteds->error_flag = RAISED; - - if( count >= qteds->per_thread_counters[thread] ) - qteds->per_thread_counters[thread] = count+1; - } - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void queue_test_rapid_enqueuing_and_dequeuing( void ) -{ - unsigned int - loop, - cpu_count; - - thread_state_t - *thread_handles; - - struct lfds611_queue_state - *qs; - - struct queue_test_rapid_enqueuing_and_dequeuing_state - *qtreds; - - struct lfds611_validation_info - vi = { 50000, 50000 }; - - lfds611_atom_t - user_data, - thread, - count, - *per_thread_counters; - - enum lfds611_data_structure_validity - dvs[2]; - - internal_display_test_name( "Rapid enqueuing and dequeuing (10 seconds)" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_queue_new( &qs, 100000 ); - - for( loop = 0 ; loop < 50000 ; loop++ ) - lfds611_queue_enqueue( qs, NULL ); - - qtreds = malloc( sizeof(struct queue_test_rapid_enqueuing_and_dequeuing_state) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (qtreds+loop)->qs = qs; - (qtreds+loop)->counter = (lfds611_atom_t) loop << (sizeof(lfds611_atom_t)*8-8); - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, queue_test_internal_thread_rapid_enqueuer_and_dequeuer, qtreds+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - lfds611_queue_query( qs, LFDS611_QUEUE_QUERY_VALIDATE, (void *) &vi, (void *) dvs ); - - // TRD : now check results - per_thread_counters = malloc( sizeof(lfds611_atom_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - *(per_thread_counters+loop) = 0; - - while( dvs[0] == LFDS611_VALIDITY_VALID and dvs[1] == LFDS611_VALIDITY_VALID and lfds611_queue_dequeue(qs, (void *) &user_data) ) { - thread = user_data >> (sizeof(lfds611_atom_t)*8-8); - count = (user_data << 8) >> 8; - - if( thread >= cpu_count ) { - dvs[0] = LFDS611_VALIDITY_INVALID_TEST_DATA; - break; - } - - if( per_thread_counters[thread] == 0 ) - per_thread_counters[thread] = count; - - if( count < per_thread_counters[thread] ) - dvs[0] = LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( count >= per_thread_counters[thread] ) - per_thread_counters[thread] = count+1; - } - - free( per_thread_counters ); - - free( qtreds ); - - lfds611_queue_delete( qs, NULL, NULL ); - - internal_display_test_result( 2, "queue", dvs[0], "queue freelist", dvs[1] ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION queue_test_internal_thread_rapid_enqueuer_and_dequeuer( void *queue_test_rapid_enqueuing_and_dequeuing_state ) -{ - struct queue_test_rapid_enqueuing_and_dequeuing_state - *qtreds; - - time_t - start_time; - - lfds611_atom_t - user_data; - - assert( queue_test_rapid_enqueuing_and_dequeuing_state != NULL ); - - qtreds = (struct queue_test_rapid_enqueuing_and_dequeuing_state *) queue_test_rapid_enqueuing_and_dequeuing_state; - - lfds611_queue_use( qtreds->qs ); - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - lfds611_queue_enqueue( qtreds->qs, (void *) (qtreds->counter++) ); - lfds611_queue_dequeue( qtreds->qs, (void *) &user_data ); - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_ringbuffer.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_ringbuffer.c deleted file mode 100644 index c9c0fd1721d4c636f4f6c954eac5ba1fc753bf76..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_ringbuffer.c +++ /dev/null @@ -1,472 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -void test_lfds611_ringbuffer( void ) -{ - printf( "\n" - "Ringbuffer Tests\n" - "================\n" ); - - ringbuffer_test_reading(); - ringbuffer_test_writing(); - ringbuffer_test_reading_and_writing(); - - return; -} - - - - - -/****************************************************************************/ -void ringbuffer_test_reading( void ) -{ - unsigned int - loop, - cpu_count; - - thread_state_t - *thread_handles; - - struct lfds611_ringbuffer_state - *rs; - - struct lfds611_freelist_element - *fe; - - struct ringbuffer_test_reading_state - *rtrs; - - struct lfds611_validation_info - vi = { 0, 0 }; - - enum lfds611_data_structure_validity - dvs[3]; - - lfds611_atom_t - total_read = 0; - - /* TRD : we create a single ringbuffer - with 1,000,000 elements - we populate the ringbuffer, where the - user data is an incrementing counter - - we create one thread per CPU - where each thread busy-works, - reading until the ringbuffer is empty - - each thread keeps track of the number of reads it manages - and that each user data it reads is greater than the - previous user data that was read - */ - - internal_display_test_name( "Reading" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_ringbuffer_new( &rs, 1000000, NULL, NULL ); - - for( loop = 0 ; loop < 1000000 ; loop++ ) { - lfds611_ringbuffer_get_write_element( rs, &fe, NULL ); - lfds611_freelist_set_user_data_in_element( fe, (void *) (lfds611_atom_t) loop ); - lfds611_ringbuffer_put_write_element( rs, fe ); - } - - rtrs = malloc( sizeof(struct ringbuffer_test_reading_state) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (rtrs+loop)->rs = rs; - (rtrs+loop)->read_count = 0; - (rtrs+loop)->error_flag = LOWERED; - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, ringbuffer_test_thread_simple_reader, rtrs+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - lfds611_ringbuffer_query( rs, LFDS611_RINGBUFFER_QUERY_VALIDATE, (void *) &vi, (void *) dvs ); - - // TRD : check for raised error flags - for( loop = 0 ; loop < cpu_count ; loop++ ) - if( (rtrs+loop)->error_flag == RAISED ) - dvs[0] = LFDS611_VALIDITY_INVALID_TEST_DATA; - - // TRD : check thread reads total to 1,000,000 - for( loop = 0 ; loop < cpu_count ; loop++ ) - total_read += (rtrs+loop)->read_count; - - if( total_read < 1000000 ) - dvs[0] = LFDS611_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( total_read > 1000000 ) - dvs[0] = LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - free( rtrs ); - - lfds611_ringbuffer_delete( rs, NULL, NULL ); - - internal_display_test_result( 3, "queue", dvs[0], "queue freelist", dvs[1], "freelist", dvs[2] ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION ringbuffer_test_thread_simple_reader( void *ringbuffer_test_reading_state ) -{ - struct ringbuffer_test_reading_state - *rtrs; - - struct lfds611_freelist_element - *fe; - - lfds611_atom_t - *prev_user_data, - *user_data; - - assert( ringbuffer_test_reading_state != NULL ); - - rtrs = (struct ringbuffer_test_reading_state *) ringbuffer_test_reading_state; - - lfds611_ringbuffer_use( rtrs->rs ); - - /* TRD : read an initial element to load a value into prev_user_data - it may be (under valgrind for example) that by the time we start - there are no elements remaining to read - */ - - lfds611_ringbuffer_get_read_element( rtrs->rs, &fe ); - - if( fe == NULL ) - return( (thread_return_t) EXIT_SUCCESS ); - - lfds611_freelist_get_user_data_from_element( fe, (void **) &prev_user_data ); - lfds611_ringbuffer_put_read_element( rtrs->rs, fe ); - - rtrs->read_count++; - - while( lfds611_ringbuffer_get_read_element(rtrs->rs, &fe) ) { - lfds611_freelist_get_user_data_from_element( fe, (void **) &user_data ); - lfds611_ringbuffer_put_read_element( rtrs->rs, fe ); - - if( user_data <= prev_user_data ) - rtrs->error_flag = RAISED; - - prev_user_data = user_data; - - rtrs->read_count++; - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void ringbuffer_test_writing( void ) -{ - unsigned int - loop, - cpu_count; - - thread_state_t - *thread_handles; - - struct lfds611_ringbuffer_state - *rs; - - struct lfds611_freelist_element - *fe; - - struct ringbuffer_test_writing_state - *rtws; - - struct lfds611_validation_info - vi = { 100000, 100000 }; - - enum lfds611_data_structure_validity - dvs[3]; - - lfds611_atom_t - thread, - count, - user_data, - *per_thread_counters; - - /* TRD : we create a single ringbuffer - with 100000 elements - the ringbuffers starts empty - - we create one thread per CPU - where each thread busy-works writing - for ten seconds - - the user data in each written element is a combination - of the thread number and the counter - - after the threads are complete, we validate by - checking the user data counters increment on a per thread - basis - */ - - internal_display_test_name( "Writing (10 seconds)" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_ringbuffer_new( &rs, 100000, NULL, NULL ); - - rtws = malloc( sizeof(struct ringbuffer_test_writing_state) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (rtws+loop)->rs = rs; - (rtws+loop)->write_count = (lfds611_atom_t) loop << (sizeof(lfds611_atom_t)*8-8); - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, ringbuffer_test_thread_simple_writer, rtws+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - // TRD : now check results - per_thread_counters = malloc( sizeof(lfds611_atom_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - *(per_thread_counters+loop) = 0; - - lfds611_ringbuffer_query( rs, LFDS611_RINGBUFFER_QUERY_VALIDATE, (void *) &vi, (void *) dvs ); - - while( dvs[0] == LFDS611_VALIDITY_VALID and dvs[1] == LFDS611_VALIDITY_VALID and dvs[2] == LFDS611_VALIDITY_VALID and lfds611_ringbuffer_get_read_element(rs, &fe) ) { - lfds611_freelist_get_user_data_from_element( fe, (void *) &user_data ); - - thread = user_data >> (sizeof(lfds611_atom_t)*8-8); - count = (user_data << 8) >> 8; - - if( thread >= cpu_count ) { - dvs[0] = LFDS611_VALIDITY_INVALID_TEST_DATA; - lfds611_ringbuffer_put_read_element( rs, fe ); - break; - } - - if( per_thread_counters[thread] == 0 ) - per_thread_counters[thread] = count; - - if( count < per_thread_counters[thread] ) - dvs[0] = LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( count >= per_thread_counters[thread] ) - per_thread_counters[thread] = count+1; - - lfds611_ringbuffer_put_read_element( rs, fe ); - } - - free( per_thread_counters ); - - free( rtws ); - - lfds611_ringbuffer_delete( rs, NULL, NULL ); - - internal_display_test_result( 3, "queue", dvs[0], "queue freelist", dvs[1], "freelist", dvs[2] ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION ringbuffer_test_thread_simple_writer( void *ringbuffer_test_writing_state ) -{ - struct ringbuffer_test_writing_state - *rtws; - - struct lfds611_freelist_element - *fe; - - time_t - start_time; - - assert( ringbuffer_test_writing_state != NULL ); - - rtws = (struct ringbuffer_test_writing_state *) ringbuffer_test_writing_state; - - lfds611_ringbuffer_use( rtws->rs ); - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - lfds611_ringbuffer_get_write_element( rtws->rs, &fe, NULL ); - lfds611_freelist_set_user_data_in_element( fe, (void *) (lfds611_atom_t) (rtws->write_count++) ); - lfds611_ringbuffer_put_write_element( rtws->rs, fe ); - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void ringbuffer_test_reading_and_writing( void ) -{ - unsigned int - loop, - subloop, - cpu_count; - - thread_state_t - *thread_handles; - - struct lfds611_ringbuffer_state - *rs; - - struct ringbuffer_test_reading_and_writing_state - *rtrws; - - struct lfds611_validation_info - vi = { 0, 0 }; - - enum lfds611_data_structure_validity - dvs[3]; - - /* TRD : we create a single ringbuffer - with 100000 elements - the ringbuffers starts empty - - we create one thread per CPU - where each thread busy-works writing - and then immediately reading - for ten seconds - - the user data in each written element is a combination - of the thread number and the counter - - while a thread runs, it keeps track of the - counters for the other threads and throws an error - if it sees the number stay the same or decrease - */ - - internal_display_test_name( "Reading and writing (10 seconds)" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_ringbuffer_new( &rs, 100000, NULL, NULL ); - - rtrws = malloc( sizeof(struct ringbuffer_test_reading_and_writing_state) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (rtrws+loop)->rs = rs; - (rtrws+loop)->counter = (lfds611_atom_t) loop << (sizeof(lfds611_atom_t)*8-8); - (rtrws+loop)->cpu_count = cpu_count; - (rtrws+loop)->error_flag = LOWERED; - (rtrws+loop)->per_thread_counters = malloc( sizeof(lfds611_atom_t) * cpu_count ); - - for( subloop = 0 ; subloop < cpu_count ; subloop++ ) - *((rtrws+loop)->per_thread_counters+subloop) = 0; - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, ringbuffer_test_thread_reader_writer, rtrws+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - lfds611_ringbuffer_query( rs, LFDS611_RINGBUFFER_QUERY_VALIDATE, (void *) &vi, (void *) dvs ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - if( (rtrws+loop)->error_flag == RAISED ) - dvs[0] = LFDS611_VALIDITY_INVALID_TEST_DATA; - - for( loop = 0 ; loop < cpu_count ; loop++ ) - free( (rtrws+loop)->per_thread_counters ); - - free( rtrws ); - - lfds611_ringbuffer_delete( rs, NULL, NULL ); - - internal_display_test_result( 3, "queue", dvs[0], "queue freelist", dvs[1], "freelist", dvs[2] ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION ringbuffer_test_thread_reader_writer( void *ringbuffer_test_reading_and_writing_state ) -{ - struct ringbuffer_test_reading_and_writing_state - *rtrws; - - struct lfds611_freelist_element - *fe; - - lfds611_atom_t - user_data, - thread, - count; - - time_t - start_time; - - assert( ringbuffer_test_reading_and_writing_state != NULL ); - - rtrws = (struct ringbuffer_test_reading_and_writing_state *) ringbuffer_test_reading_and_writing_state; - - lfds611_ringbuffer_use( rtrws->rs ); - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - lfds611_ringbuffer_get_write_element( rtrws->rs, &fe, NULL ); - lfds611_freelist_set_user_data_in_element( fe, (void *) (lfds611_atom_t) (rtrws->counter++) ); - lfds611_ringbuffer_put_write_element( rtrws->rs, fe ); - - lfds611_ringbuffer_get_read_element( rtrws->rs, &fe ); - lfds611_freelist_get_user_data_from_element( fe, (void *) &user_data ); - - thread = user_data >> (sizeof(lfds611_atom_t)*8-8); - count = (user_data << 8) >> 8; - - if( thread >= rtrws->cpu_count ) - rtrws->error_flag = RAISED; - else { - if( count < rtrws->per_thread_counters[thread] ) - rtrws->error_flag = RAISED; - - if( count >= rtrws->per_thread_counters[thread] ) - rtrws->per_thread_counters[thread] = count+1; - } - - lfds611_ringbuffer_put_read_element( rtrws->rs, fe ); - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_slist.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_slist.c deleted file mode 100644 index 0388ad8c7db4e403ce3613b9ef5335754a64b6da..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_slist.c +++ /dev/null @@ -1,388 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -void test_lfds611_slist( void ) -{ - printf( "\n" - "SList Tests\n" - "===========\n" ); - - test_slist_new_delete_get(); - test_slist_get_set_user_data(); - test_slist_delete_all_elements(); - - return; -} - - - - - -/****************************************************************************/ -void test_slist_new_delete_get( void ) -{ - unsigned int - loop, - cpu_count; - - struct lfds611_slist_state - *ss; - - struct lfds611_slist_element - *se = NULL; - - struct slist_test_state - *sts; - - thread_state_t - *thread_handles; - - size_t - total_create_count = 0, - total_delete_count = 0, - element_count = 0; - - enum lfds611_data_structure_validity - dvs = LFDS611_VALIDITY_VALID; - - /* TRD : two threads per CPU - first simply alternates between new_head() and new_next() (next on element created by head) - second calls get_next, if NULL, then calls get_head, and deletes the element - both threads keep count of created and deleted - validate is to reconcile created, deleted and remaining in list - */ - - internal_display_test_name( "New head/next, delete and get next" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_slist_new( &ss, NULL, NULL ); - - sts = malloc( sizeof(struct slist_test_state) * cpu_count * 2 ); - - for( loop = 0 ; loop < cpu_count * 2 ; loop++ ) { - (sts+loop)->ss = ss; - (sts+loop)->create_count = 0; - (sts+loop)->delete_count = 0; - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count * 2 ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - abstraction_thread_start( &thread_handles[loop], loop, slist_test_internal_thread_new_delete_get_new_head_and_next, sts+loop ); - abstraction_thread_start( &thread_handles[loop+cpu_count], loop, slist_test_internal_thread_new_delete_get_delete_and_get, sts+loop+cpu_count ); - } - - for( loop = 0 ; loop < cpu_count * 2 ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - // TRD : now validate - for( loop = 0 ; loop < cpu_count * 2 ; loop++ ) { - total_create_count += (sts+loop)->create_count; - total_delete_count += (sts+loop)->delete_count; - } - - while( NULL != lfds611_slist_get_head_and_then_next(ss, &se) ) - element_count++; - - if( total_create_count - total_delete_count - element_count != 0 ) - dvs = LFDS611_VALIDITY_INVALID_TEST_DATA; - - free( sts ); - - lfds611_slist_delete( ss ); - - internal_display_test_result( 1, "slist", dvs ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION slist_test_internal_thread_new_delete_get_new_head_and_next( void *slist_test_state ) -{ - struct slist_test_state - *sts; - - time_t - start_time; - - struct lfds611_slist_element - *se = NULL; - - assert( slist_test_state != NULL ); - - sts = (struct slist_test_state *) slist_test_state; - - lfds611_slist_use( sts->ss ); - - time( &start_time ); - - while( time(NULL) < start_time + 1 ) { - if( sts->create_count % 2 == 0 ) - se = lfds611_slist_new_head( sts->ss, NULL ); - else - lfds611_slist_new_next( se, NULL ); - - sts->create_count++; - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION slist_test_internal_thread_new_delete_get_delete_and_get( void *slist_test_state ) -{ - struct slist_test_state - *sts; - - time_t - start_time; - - struct lfds611_slist_element - *se = NULL; - - assert( slist_test_state != NULL ); - - sts = (struct slist_test_state *) slist_test_state; - - lfds611_slist_use( sts->ss ); - - time( &start_time ); - - while( time(NULL) < start_time + 1 ) { - if( se == NULL ) - lfds611_slist_get_head( sts->ss, &se ); - else - lfds611_slist_get_next( se, &se ); - - if( se != NULL ) { - if( 1 == lfds611_slist_logically_delete_element(sts->ss, se) ) - sts->delete_count++; - } - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void test_slist_get_set_user_data( void ) -{ - unsigned int - loop, - cpu_count; - - struct lfds611_slist_state - *ss; - - struct lfds611_slist_element - *se = NULL; - - struct slist_test_state - *sts; - - thread_state_t - *thread_handles; - - lfds611_atom_t - thread_and_count, - thread, - count, - *per_thread_counters, - *per_thread_drop_flags; - - enum lfds611_data_structure_validity - dvs = LFDS611_VALIDITY_VALID; - - /* TRD : create a list of (cpu_count*10) elements, user data 0 - one thread per CPU - each thread loops, setting user_data to ((thread_number << (sizeof(lfds611_atom_t)*8-8)) | count) - validation is to scan list, count on a per thread basis should go down only once - */ - - internal_display_test_name( "Get and set user data" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_slist_new( &ss, NULL, NULL ); - - for( loop = 0 ; loop < cpu_count * 10 ; loop++ ) - lfds611_slist_new_head( ss, NULL ); - - sts = malloc( sizeof(struct slist_test_state) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (sts+loop)->ss = ss; - (sts+loop)->thread_and_count = (lfds611_atom_t) loop << (sizeof(lfds611_atom_t)*8-8); - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, slist_test_internal_thread_get_set_user_data, sts+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - // now validate - per_thread_counters = malloc( sizeof(lfds611_atom_t) * cpu_count ); - per_thread_drop_flags = malloc( sizeof(lfds611_atom_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - *(per_thread_counters+loop) = 0; - *(per_thread_drop_flags+loop) = 0; - } - - while( dvs == LFDS611_VALIDITY_VALID and NULL != lfds611_slist_get_head_and_then_next(ss, &se) ) { - lfds611_slist_get_user_data_from_element( se, (void **) &thread_and_count ); - - thread = thread_and_count >> (sizeof(lfds611_atom_t)*8-8); - count = (thread_and_count << 8) >> 8; - - if( thread >= cpu_count ) { - dvs = LFDS611_VALIDITY_INVALID_TEST_DATA; - break; - } - - if( per_thread_counters[thread] == 0 ) { - per_thread_counters[thread] = count; - continue; - } - - per_thread_counters[thread]++; - - if( count < per_thread_counters[thread] and per_thread_drop_flags[thread] == 1 ) { - dvs = LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - break; - } - - if( count < per_thread_counters[thread] and per_thread_drop_flags[thread] == 0 ) { - per_thread_drop_flags[thread] = 1; - per_thread_counters[thread] = count; - continue; - } - - if( count < per_thread_counters[thread] ) - dvs = LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( count >= per_thread_counters[thread] ) - per_thread_counters[thread] = count; - } - - free( per_thread_drop_flags ); - free( per_thread_counters ); - - free( sts ); - - lfds611_slist_delete( ss ); - - internal_display_test_result( 1, "slist", dvs ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION slist_test_internal_thread_get_set_user_data( void *slist_test_state ) -{ - struct slist_test_state - *sts; - - time_t - start_time; - - struct lfds611_slist_element - *se = NULL; - - assert( slist_test_state != NULL ); - - sts = (struct slist_test_state *) slist_test_state; - - lfds611_slist_use( sts->ss ); - - time( &start_time ); - - while( time(NULL) < start_time + 1 ) { - if( se == NULL ) - lfds611_slist_get_head( sts->ss, &se ); - - lfds611_slist_set_user_data_in_element( se, (void *) sts->thread_and_count++ ); - - lfds611_slist_get_next( se, &se ); - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void test_slist_delete_all_elements( void ) -{ - struct lfds611_slist_state - *ss; - - struct lfds611_slist_element - *se = NULL; - - size_t - element_count = 0; - - unsigned int - loop; - - enum lfds611_data_structure_validity - dvs = LFDS611_VALIDITY_VALID; - - /* TRD : this test creates a list of 100,000 elements - then simply calls delete_all_elements() - we then count the number of elements remaining - should be zero :-) - */ - - internal_display_test_name( "Delete all elements" ); - - lfds611_slist_new( &ss, NULL, NULL ); - - for( loop = 0 ; loop < 1000000 ; loop++ ) - lfds611_slist_new_head( ss, NULL ); - - lfds611_slist_single_threaded_physically_delete_all_elements( ss ); - - while( NULL != lfds611_slist_get_head_and_then_next(ss, &se) ) - element_count++; - - if( element_count != 0 ) - dvs = LFDS611_VALIDITY_INVALID_TEST_DATA; - - lfds611_slist_delete( ss ); - - internal_display_test_result( 1, "slist", dvs ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_stack.c b/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_stack.c deleted file mode 100644 index cb5916620b23f1273cd8031beb13df80b84b8b0f..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/src/test_stack.c +++ /dev/null @@ -1,582 +0,0 @@ -#include "internal.h" - - - - - -/****************************************************************************/ -void test_lfds611_stack( void ) -{ - printf( "\n" - "Stack Tests\n" - "===========\n" ); - - stack_test_internal_popping(); - stack_test_internal_pushing(); - stack_test_internal_popping_and_pushing(); - stack_test_internal_rapid_popping_and_pushing(); - - return; -} - - - - - -/****************************************************************************/ -void stack_test_internal_popping( void ) -{ - unsigned int - loop, - *found_count, - cpu_count; - - lfds611_atom_t - count; - - thread_state_t - *thread_handles; - - enum lfds611_data_structure_validity - dvs = LFDS611_VALIDITY_VALID; - - struct lfds611_stack_state - *ss; - - struct stack_test_popping_state - *stps; - - /* TRD : we create a stack with 1,000,000 elements - - we then populate the stack, where each element is - set to contain a void pointer which is its element number - - we then run one thread per CPU - where each thread loops, popping as quickly as possible - each popped element is pushed onto a thread-local stack - - the threads run till the source stack is empty - - we then check the thread-local stacks - we should find we have every element - - then tidy up - */ - - internal_display_test_name( "Popping" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_stack_new( &ss, 1000000 ); - - for( loop = 0 ; loop < 1000000 ; loop++ ) - lfds611_stack_push( ss, (void *) (lfds611_atom_t) loop ); - - stps = malloc( sizeof(struct stack_test_popping_state) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (stps+loop)->ss = ss; - lfds611_stack_new( &(stps+loop)->ss_thread_local, 1000000 ); - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, stack_test_internal_thread_popping, stps+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - // TRD : now we check the thread-local stacks - found_count = malloc( sizeof(unsigned int) * 1000000 ); - - for( loop = 0 ; loop < 1000000 ; loop++ ) - *(found_count+loop) = 0; - - for( loop = 0 ; loop < cpu_count ; loop++ ) - while( lfds611_stack_pop((stps+loop)->ss_thread_local, (void **) &count) ) - (*(found_count+count))++; - - for( loop = 0 ; loop < 1000000 and dvs == LFDS611_VALIDITY_VALID ; loop++ ) { - if( *(found_count+loop) == 0 ) - dvs = LFDS611_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( *(found_count+loop) > 1 ) - dvs = LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - } - - // TRD : cleanup - free( found_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - lfds611_stack_delete( (stps+loop)->ss_thread_local, NULL, NULL ); - - free( stps ); - lfds611_stack_delete( ss, NULL, NULL ); - - // TRD : print the test result - internal_display_test_result( 1, "stack", dvs ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION stack_test_internal_thread_popping( void *stack_test_popping_state ) -{ - struct stack_test_popping_state - *stps; - - lfds611_atom_t - count; - - assert( stack_test_popping_state != NULL ); - - stps = (struct stack_test_popping_state *) stack_test_popping_state; - - lfds611_stack_use( stps->ss ); - - while( lfds611_stack_pop(stps->ss, (void **) &count) ) - lfds611_stack_push( stps->ss_thread_local, (void *) count ); - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void stack_test_internal_pushing( void ) -{ - unsigned int - loop, - cpu_count; - - thread_state_t - *thread_handles; - - enum lfds611_data_structure_validity - dvs[2]; - - struct stack_test_pushing_state - *stps; - - struct lfds611_stack_state - *ss; - - lfds611_atom_t - user_data, - thread, - count, - *per_thread_counters; - - struct lfds611_validation_info - vi = { 1000000, 1000000 }; - - /* TRD : we create a stack with 1,000,000 elements - - we then create one thread per CPU, where each thread - pushes as quickly as possible to the stack - - the data pushed is a counter and a thread ID - - the threads exit when the stack is full - - we then validate the stack; - - checking that the counts increment on a per unique ID basis - and that the number of elements we pop equals 1,000,000 - (since each element has an incrementing counter which is - unique on a per unique ID basis, we can know we didn't lose - any elements) - */ - - internal_display_test_name( "Pushing" ); - - cpu_count = abstraction_cpu_count(); - - stps = malloc( sizeof(struct stack_test_pushing_state) * cpu_count ); - - // TRD : the main stack - lfds611_stack_new( &ss, 1000000 ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (stps+loop)->thread_number = (lfds611_atom_t) loop; - (stps+loop)->ss = ss; - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, stack_test_internal_thread_pushing, stps+loop ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - // TRD : the stack is now fully pushed; time to verify - per_thread_counters = malloc( sizeof(lfds611_atom_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - *(per_thread_counters+loop) = 1000000; - - lfds611_stack_query( ss, LFDS611_STACK_QUERY_VALIDATE, &vi, (void *) dvs ); - - while( dvs[0] == LFDS611_VALIDITY_VALID and lfds611_stack_pop(ss, (void **) &user_data) ) { - thread = user_data >> (sizeof(lfds611_atom_t)*8-8); - count = (user_data << 8) >> 8; - - if( thread >= cpu_count ) { - dvs[0] = LFDS611_VALIDITY_INVALID_TEST_DATA; - break; - } - - if( count > per_thread_counters[thread] ) - dvs[0] = LFDS611_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( count < per_thread_counters[thread] ) - per_thread_counters[thread] = count-1; - } - - // TRD : clean up - free( per_thread_counters ); - - free( stps ); - - lfds611_stack_delete( ss, NULL, NULL ); - - // TRD : print the test result - internal_display_test_result( 2, "stack", dvs[0], "stack freelist", dvs[1] ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION stack_test_internal_thread_pushing( void *stack_test_pushing_state ) -{ - struct stack_test_pushing_state - *stps; - - lfds611_atom_t - counter = 0; - - assert( stack_test_pushing_state != NULL ); - - stps = (struct stack_test_pushing_state *) stack_test_pushing_state; - - lfds611_stack_use( stps->ss ); - - // TRD : we write (thread_number | counter), where thread_number is the top 8 bits of the lfds611_atom_t - while( lfds611_stack_push(stps->ss, (void **) ((stps->thread_number << (sizeof(lfds611_atom_t)*8-8)) | counter++)) ); - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void stack_test_internal_popping_and_pushing( void ) -{ - unsigned int - loop, - subloop, - cpu_count; - - thread_state_t - *thread_handles; - - enum lfds611_data_structure_validity - dvs[2]; - - struct lfds611_stack_state - *ss; - - struct stack_test_popping_and_pushing_state - *stpps; - - struct lfds611_validation_info - vi; - - /* TRD : we have two threads per CPU - the threads loop for ten seconds - the first thread pushes 100000 elements then pops 100000 elements - the second thread pops 100000 elements then pushes 100000 elements - all pushes and pops go onto the single main stack - - after time is up, all threads push what they have remaining onto - the main stack - - we then validate the main stack - */ - - internal_display_test_name( "Popping and pushing (10 seconds)" ); - - cpu_count = abstraction_cpu_count(); - - // TRD : just some initial elements so the pushing threads can start immediately - lfds611_stack_new( &ss, 100000 * cpu_count * 2 ); - - for( loop = 0 ; loop < 100000 * cpu_count ; loop++ ) - lfds611_stack_push( ss, (void *) (lfds611_atom_t) loop ); - - stpps = malloc( sizeof(struct stack_test_popping_and_pushing_state) * cpu_count * 2 ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - (stpps+loop)->ss = ss; - lfds611_stack_new( &(stpps+loop)->local_ss, 100000 ); - - (stpps+loop+cpu_count)->ss = ss; - lfds611_stack_new( &(stpps+loop+cpu_count)->local_ss, 100000 ); - - // TRD : fill the pushing thread stacks - for( subloop = 0 ; subloop < 100000 ; subloop++ ) - lfds611_stack_push( (stpps+loop+cpu_count)->local_ss, (void *) (lfds611_atom_t) subloop ); - } - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count * 2 ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) { - abstraction_thread_start( &thread_handles[loop], loop, stack_test_internal_thread_popping_and_pushing_start_popping, stpps+loop ); - abstraction_thread_start( &thread_handles[loop+cpu_count], loop, stack_test_internal_thread_popping_and_pushing_start_pushing, stpps+loop+cpu_count ); - } - - for( loop = 0 ; loop < cpu_count * 2 ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - for( loop = 0 ; loop < cpu_count * 2 ; loop++ ) - lfds611_stack_delete( (stpps+loop)->local_ss, NULL, NULL ); - - free( stpps ); - - vi.min_elements = vi.max_elements = 100000 * cpu_count * 2; - - lfds611_stack_query( ss, LFDS611_STACK_QUERY_VALIDATE, (void *) &vi, (void *) dvs ); - - lfds611_stack_delete( ss, NULL, NULL ); - - // TRD : print the test result - internal_display_test_result( 2, "stack", dvs[0], "stack freelist", dvs[1] ); - - return; -} - - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION stack_test_internal_thread_popping_and_pushing_start_popping( void *stack_test_popping_and_pushing_state ) -{ - struct stack_test_popping_and_pushing_state - *stpps; - - void - *user_data; - - time_t - start_time; - - unsigned int - count; - - assert( stack_test_popping_and_pushing_state != NULL ); - - stpps = (struct stack_test_popping_and_pushing_state *) stack_test_popping_and_pushing_state; - - lfds611_stack_use( stpps->ss ); - lfds611_stack_use( stpps->local_ss ); - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - count = 0; - - while( count < 100000 ) - if( lfds611_stack_pop(stpps->ss, &user_data) ) { - lfds611_stack_push( stpps->local_ss, user_data ); - count++; - } - - // TRD : return our local stack to the main stack - while( lfds611_stack_pop(stpps->local_ss, &user_data) ) - lfds611_stack_push( stpps->ss, user_data ); - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION stack_test_internal_thread_popping_and_pushing_start_pushing( void *stack_test_popping_and_pushing_state ) -{ - struct stack_test_popping_and_pushing_state - *stpps; - - void - *user_data; - - time_t - start_time; - - unsigned int - count; - - assert( stack_test_popping_and_pushing_state != NULL ); - - stpps = (struct stack_test_popping_and_pushing_state *) stack_test_popping_and_pushing_state; - - lfds611_stack_use( stpps->ss ); - lfds611_stack_use( stpps->local_ss ); - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - // TRD : return our local stack to the main stack - while( lfds611_stack_pop(stpps->local_ss, &user_data) ) - lfds611_stack_push( stpps->ss, user_data ); - - count = 0; - - while( count < 100000 ) - if( lfds611_stack_pop(stpps->ss, &user_data) ) { - lfds611_stack_push( stpps->local_ss, user_data ); - count++; - } - } - - // TRD : now push whatever we have in our local stack - while( lfds611_stack_pop(stpps->local_ss, &user_data) ) - lfds611_stack_push( stpps->ss, user_data ); - - return( (thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -void stack_test_internal_rapid_popping_and_pushing( void ) -{ - unsigned int - loop, - cpu_count; - - thread_state_t - *thread_handles; - - struct lfds611_stack_state - *ss; - - struct lfds611_validation_info - vi; - - enum lfds611_data_structure_validity - dvs[2]; - - /* TRD : in these tests there is a fundamental antagonism between - how much checking/memory clean up that we do and the - likelyhood of collisions between threads in their lock-free - operations - - the lock-free operations are very quick; if we do anything - much at all between operations, we greatly reduce the chance - of threads colliding - - so we have some tests which do enough checking/clean up that - they can tell the stack is valid and don't leak memory - and here, this test now is one of those which does minimal - checking - in fact, the nature of the test is that you can't - do any real checking - but goes very quickly - - what we do is create a small stack and then run one thread - per CPU, where each thread simply pushes and then immediately - pops - - the test runs for ten seconds - - after the test is done, the only check we do is to traverse - the stack, checking for loops and ensuring the number of - elements is correct - */ - - internal_display_test_name( "Rapid popping and pushing (10 seconds)" ); - - cpu_count = abstraction_cpu_count(); - - lfds611_stack_new( &ss, cpu_count ); - - thread_handles = malloc( sizeof(thread_state_t) * cpu_count ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_start( &thread_handles[loop], loop, stack_test_internal_thread_rapid_popping_and_pushing, ss ); - - for( loop = 0 ; loop < cpu_count ; loop++ ) - abstraction_thread_wait( thread_handles[loop] ); - - free( thread_handles ); - - vi.min_elements = 0; - vi.max_elements = 0; - - lfds611_stack_query( ss, LFDS611_STACK_QUERY_VALIDATE, (void *) &vi, (void *) dvs ); - - lfds611_stack_delete( ss, NULL, NULL ); - - // TRD : print the test result - internal_display_test_result( 2, "stack", dvs[0], "stack freelist", dvs[1] ); - - return; -} - - - - - -/****************************************************************************/ -thread_return_t CALLING_CONVENTION stack_test_internal_thread_rapid_popping_and_pushing( void *stack_state ) -{ - struct lfds611_stack_state - *ss; - - void - *user_data = NULL; - - time_t - start_time; - - assert( stack_state != NULL ); - - ss = (struct lfds611_stack_state *) stack_state; - - lfds611_stack_use( ss ); - - time( &start_time ); - - while( time(NULL) < start_time + 10 ) { - lfds611_stack_push( ss, user_data ); - lfds611_stack_pop( ss, &user_data ); - } - - return( (thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/test.sln b/openair2/UTIL/LFDS/liblfds6.1.1/test/test.sln deleted file mode 100644 index 3cfb5b203155789b0105227b94f031fa56c0fe0a..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/test.sln +++ /dev/null @@ -1,79 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcproj", "{6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}" - ProjectSection(ProjectDependencies) = postProject - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05} = {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds611", "..\liblfds611\liblfds611.vcproj", "{F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug DLL|Win32 = Debug DLL|Win32 - Debug DLL|x64 = Debug DLL|x64 - Debug Lib|Win32 = Debug Lib|Win32 - Debug Lib|x64 = Debug Lib|x64 - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release DLL|Win32 = Release DLL|Win32 - Release DLL|x64 = Release DLL|x64 - Release Lib|Win32 = Release Lib|Win32 - Release Lib|x64 = Release Lib|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Debug DLL|Win32.ActiveCfg = Debug|Win32 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Debug DLL|Win32.Build.0 = Debug|Win32 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Debug DLL|x64.ActiveCfg = Debug|x64 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Debug DLL|x64.Build.0 = Debug|x64 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Debug Lib|Win32.ActiveCfg = Debug|Win32 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Debug Lib|Win32.Build.0 = Debug|Win32 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Debug Lib|x64.ActiveCfg = Debug|x64 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Debug Lib|x64.Build.0 = Debug|x64 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Debug|Win32.ActiveCfg = Debug|Win32 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Debug|Win32.Build.0 = Debug|Win32 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Debug|x64.ActiveCfg = Debug|x64 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Debug|x64.Build.0 = Debug|x64 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Release DLL|Win32.ActiveCfg = Release|Win32 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Release DLL|Win32.Build.0 = Release|Win32 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Release DLL|x64.ActiveCfg = Release|x64 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Release DLL|x64.Build.0 = Release|x64 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Release Lib|Win32.ActiveCfg = Release|Win32 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Release Lib|Win32.Build.0 = Release|Win32 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Release Lib|x64.ActiveCfg = Release|x64 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Release Lib|x64.Build.0 = Release|x64 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Release|Win32.ActiveCfg = Release|Win32 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Release|Win32.Build.0 = Release|Win32 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Release|x64.ActiveCfg = Release|x64 - {6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}.Release|x64.Build.0 = Release|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug DLL|x64.Build.0 = Debug DLL|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug Lib|Win32.ActiveCfg = Debug Lib|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug Lib|Win32.Build.0 = Debug Lib|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug Lib|x64.ActiveCfg = Debug Lib|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug Lib|x64.Build.0 = Debug Lib|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug|Win32.ActiveCfg = Debug Lib|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug|Win32.Build.0 = Debug Lib|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug|x64.ActiveCfg = Debug Lib|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Debug|x64.Build.0 = Debug Lib|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release DLL|Win32.Build.0 = Release DLL|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release DLL|x64.ActiveCfg = Release DLL|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release DLL|x64.Build.0 = Release DLL|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release Lib|Win32.ActiveCfg = Release Lib|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release Lib|Win32.Build.0 = Release Lib|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release Lib|x64.ActiveCfg = Release Lib|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release Lib|x64.Build.0 = Release Lib|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release|Win32.ActiveCfg = Release Lib|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release|Win32.Build.0 = Release Lib|Win32 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release|x64.ActiveCfg = Release Lib|x64 - {F73AE755-F6D8-4C3A-977D-FBB40DC0ED05}.Release|x64.Build.0 = Release Lib|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds6.1.1/test/test.vcproj b/openair2/UTIL/LFDS/liblfds6.1.1/test/test.vcproj deleted file mode 100644 index 97159c86b46c37fd86b9c2c995776e86b2fe97d0..0000000000000000000000000000000000000000 --- a/openair2/UTIL/LFDS/liblfds6.1.1/test/test.vcproj +++ /dev/null @@ -1,415 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9.00" - Name="test" - ProjectGUID="{6E4CBF20-DF1A-4FA0-8A90-58E2A3A5CF09}" - RootNamespace="test" - TargetFrameworkVersion="196613" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(ProjectDir)\bin\$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(ProjectDir)\obj\$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/DWIN32_LEAN_AND_MEAN /D_DEBUG /D_CRT_SECURE_NO_WARNINGS" - Optimization="0" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(ProjectDir)\src";"$(ProjectDir)\..\liblfds611\inc"" - MinimalRebuild="true" - ExceptionHandling="0" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - EnableFunctionLevelLinking="true" - BrowseInformation="1" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="4" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libcmtd.lib" - IgnoreAllDefaultLibraries="true" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - OutputDirectory="$(ProjectDir)\bin\$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(ProjectDir)\obj\$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/DWIN32_LEAN_AND_MEAN /D_DEBUG /D_CRT_SECURE_NO_WARNINGS" - Optimization="0" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(ProjectDir)\src";"$(ProjectDir)\..\liblfds611\inc"" - ExceptionHandling="0" - RuntimeLibrary="1" - EnableFunctionLevelLinking="true" - BrowseInformation="1" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="3" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libcmtd.lib" - IgnoreAllDefaultLibraries="true" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(ProjectDir)\bin\$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(ProjectDir)\obj\$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/DWIN32_LEAN_AND_MEAN /DNDEBUG /D_CRT_SECURE_NO_WARNINGS" - Optimization="3" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - AdditionalIncludeDirectories=""$(ProjectDir)\src";"$(ProjectDir)\..\liblfds611\inc"" - ExceptionHandling="0" - RuntimeLibrary="0" - EnableFunctionLevelLinking="true" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="0" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libcmt.lib" - IgnoreAllDefaultLibraries="true" - GenerateDebugInformation="false" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - OutputDirectory="$(ProjectDir)\bin\$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(ProjectDir)\obj\$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalOptions="/DWIN32_LEAN_AND_MEAN /DNDEBUG /D_CRT_SECURE_NO_WARNINGS" - Optimization="3" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - AdditionalIncludeDirectories=""$(ProjectDir)\src";"$(ProjectDir)\..\liblfds611\inc"" - ExceptionHandling="0" - EnableFunctionLevelLinking="true" - WarningLevel="4" - WarnAsError="true" - CompileAs="1" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libcmt.lib" - IgnoreAllDefaultLibraries="true" - GenerateDebugInformation="false" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="src" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\src\abstraction.h" - > - </File> - <File - RelativePath=".\src\abstraction_cpu_count.c" - > - </File> - <File - RelativePath=".\src\abstraction_thread_start.c" - > - </File> - <File - RelativePath=".\src\abstraction_thread_wait.c" - > - </File> - <File - RelativePath=".\src\benchmark_freelist.c" - > - </File> - <File - RelativePath=".\src\benchmark_queue.c" - > - </File> - <File - RelativePath=".\src\benchmark_ringbuffer.c" - > - </File> - <File - RelativePath=".\src\benchmark_stack.c" - > - </File> - <File - RelativePath=".\src\internal.h" - > - </File> - <File - RelativePath=".\src\main.c" - > - </File> - <File - RelativePath=".\src\misc.c" - > - </File> - <File - RelativePath=".\src\structures.h" - > - </File> - <File - RelativePath=".\src\test_abstraction.c" - > - </File> - <File - RelativePath=".\src\test_freelist.c" - > - </File> - <File - RelativePath=".\src\test_queue.c" - > - </File> - <File - RelativePath=".\src\test_ringbuffer.c" - > - </File> - <File - RelativePath=".\src\test_slist.c" - > - </File> - <File - RelativePath=".\src\test_stack.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/openair2/UTIL/LISTS/list.c b/openair2/UTIL/LISTS/list.c index 65f70c0786a97d96395d79c705871ba0f0c3ccd4..578833edba59b6b65df567846128f9637e7ba621 100644 --- a/openair2/UTIL/LISTS/list.c +++ b/openair2/UTIL/LISTS/list.c @@ -43,7 +43,7 @@ list_init (list_t * listP, char *nameP) { //----------------------------------------------------------------------------- if (nameP) { - strncpy( listP->name, nameP, LIST_NAME_MAX_CHAR ); + strncpy( listP->name, nameP, LIST_NAME_MAX_CHAR-1 ); listP->name[LIST_NAME_MAX_CHAR-1] = 0; // terminate string } diff --git a/openair2/UTIL/LISTS/list2.c b/openair2/UTIL/LISTS/list2.c index 3f0a59df53be4ca3548207f22a2c015bb772f4bb..d9aa1b6a90128e42adfb193cada81efe152f289f 100644 --- a/openair2/UTIL/LISTS/list2.c +++ b/openair2/UTIL/LISTS/list2.c @@ -53,7 +53,7 @@ list2_init (list2_t * listP, char *nameP) { //----------------------------------------------------------------------------- if (nameP) { - strncpy( listP->name, nameP, LIST_NAME_MAX_CHAR ); + strncpy( listP->name, nameP, LIST_NAME_MAX_CHAR-1 ); listP->name[LIST_NAME_MAX_CHAR-1] = 0; // terminate string } diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index 3f4b7d1aa1c4265c30ebd784c56ca02856087f2f..d7db2f70b435bbd7692c9be28942eba6d6254c8a 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -680,24 +680,20 @@ int ngap_gNB_initial_ctxt_resp( pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.present = NGAP_UPTransportLayerInformation_PR_gTPTunnel; - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel = (NGAP_GTPTunnel_t *)calloc(1, sizeof(NGAP_GTPTunnel_t)); - GTP_TEID_TO_ASN1(initial_ctxt_resp_p->pdusessions[i].gtp_teid, &pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->gTP_TEID); + pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel = (NGAP_GTPTunnel_t *)calloc(1, sizeof(NGAP_GTPTunnel_t)); + struct NGAP_GTPTunnel *tmp=pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel; + GTP_TEID_TO_ASN1(initial_ctxt_resp_p->pdusessions[i].gtp_teid, &tmp->gTP_TEID); - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf = malloc(initial_ctxt_resp_p->pdusessions[i].gNB_addr.length); + tmp->transportLayerAddress.buf = malloc(initial_ctxt_resp_p->pdusessions[i].gNB_addr.length); - memcpy(pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf, + memcpy(tmp->transportLayerAddress.buf, initial_ctxt_resp_p->pdusessions[i].gNB_addr.buffer, initial_ctxt_resp_p->pdusessions[i].gNB_addr.length); - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.size = initial_ctxt_resp_p->pdusessions[i].gNB_addr.length; - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.bits_unused = 0; + tmp->transportLayerAddress.size = initial_ctxt_resp_p->pdusessions[i].gNB_addr.length; + tmp->transportLayerAddress.bits_unused = 0; - NGAP_DEBUG("initial_ctxt_resp_p: pdusession ID %ld, gnb_addr %d.%d.%d.%d, SIZE %ld \n", - item->pDUSessionID, - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[0], - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[1], - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[2], - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[3], - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.size); + NGAP_DEBUG("initial_ctxt_resp_p: pdusession ID %ld\n", + item->pDUSessionID); /* associatedQosFlowList. number of 1? */ for(int j=0; j < initial_ctxt_resp_p->pdusessions[i].nb_of_qos_flow; j++) { @@ -987,24 +983,25 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance, pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.present = NGAP_UPTransportLayerInformation_PR_gTPTunnel; pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel = calloc(1, sizeof(struct NGAP_GTPTunnel)); - - GTP_TEID_TO_ASN1(pdusession_setup_resp_p->pdusessions[i].gtp_teid, &pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->gTP_TEID); - - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf = malloc(pdusession_setup_resp_p->pdusessions[i].gNB_addr.length); - - memcpy(pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf, - pdusession_setup_resp_p->pdusessions[i].gNB_addr.buffer, - pdusession_setup_resp_p->pdusessions[i].gNB_addr.length); - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.size = pdusession_setup_resp_p->pdusessions[i].gNB_addr.length; - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.bits_unused = 0; - - NGAP_DEBUG("pdusession_setup_resp_p: pdusession ID %ld, gnb_addr %d.%d.%d.%d, SIZE %ld \n", - item->pDUSessionID, - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[0], - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[1], - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[2], - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.buf[3], - pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel->transportLayerAddress.size); + struct NGAP_GTPTunnel *tmp=pdusessionTransfer_p->dLQosFlowPerTNLInformation.uPTransportLayerInformation.choice.gTPTunnel; + GTP_TEID_TO_ASN1(pdusession_setup_resp_p->pdusessions[i].gtp_teid, &tmp->gTP_TEID); + if (pdusession_setup_resp_p->pdusessions[i].gNB_addr.length) { + tmp->transportLayerAddress.buf = malloc(pdusession_setup_resp_p->pdusessions[i].gNB_addr.length); + + memcpy(tmp->transportLayerAddress.buf, + pdusession_setup_resp_p->pdusessions[i].gNB_addr.buffer, + pdusession_setup_resp_p->pdusessions[i].gNB_addr.length); + tmp->transportLayerAddress.size = pdusession_setup_resp_p->pdusessions[i].gNB_addr.length; + tmp->transportLayerAddress.bits_unused = 0; + + NGAP_DEBUG("pdusession_setup_resp_p: pdusession ID %ld, gnb_addr %d.%d.%d.%d, SIZE %ld \n", + item->pDUSessionID, + tmp->transportLayerAddress.buf[0], + tmp->transportLayerAddress.buf[1], + tmp->transportLayerAddress.buf[2], + tmp->transportLayerAddress.buf[3], + tmp->transportLayerAddress.size); + } /* associatedQosFlowList. number of 1? */ for(int j=0; j < pdusession_setup_resp_p->pdusessions[i].nb_of_qos_flow; j++) { diff --git a/targets/ARCH/COMMON/common_lib.c b/targets/ARCH/COMMON/common_lib.c index c4f4e3ead5905648eccfeba6ebf7fb14702285e5..08daf58cf7d149dadf0d84bc68bf35243f4d50b0 100644 --- a/targets/ARCH/COMMON/common_lib.c +++ b/targets/ARCH/COMMON/common_lib.c @@ -43,16 +43,31 @@ //#include "targets/RT/USER/lte-softmodem.h" #include "executables/softmodem-common.h" -char *get_devname(int devtype) { -char *devnames[MAX_RF_DEV_TYPE]=DEVTYPE_NAMES; +const char* devtype_names[MAX_RF_DEV_TYPE] = { + "", + "EXMIMO", + "USRP B200", + "USRP X300", + "USRP N300", + "USRP X400", + "BLADERF", + "LMSSDR", + "IRIS", + "No HW", + "ADRV9371_ZC706", + "UEDv2", + "RFSIMULATOR" +}; + +const char *get_devname(int devtype) { if (devtype < MAX_RF_DEV_TYPE && devtype !=MIN_RF_DEV_TYPE ) - return devnames[devtype]; + return devtype_names[devtype]; return "none"; } int set_device(openair0_device *device) { - char *devname = get_devname(device->type); + const char *devname = get_devname(device->type); if (strcmp(devname,"none") != 0) { LOG_I(HW,"[%s] has loaded %s device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"),devname); } else { diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 0c71a9999a4c780132ab05ec4d4918cd429c841c..38a7b0fa67aac05b71d4f1a8635f0ba4e2895ed2 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -92,6 +92,8 @@ typedef enum { USRP_X300_DEV, /*!\brief device is USRP N300/N310*/ USRP_N300_DEV, + /*!\brief device is USRP X400/X410*/ + USRP_X400_DEV, /*!\brief device is BLADE RF*/ BLADERF_DEV, /*!\brief device is LMSSDR (SoDeRa)*/ @@ -107,7 +109,9 @@ typedef enum { RFSIMULATOR, MAX_RF_DEV_TYPE } dev_type_t; -#define DEVTYPE_NAMES {"","EXMIMO","USRP B200","USRP X300","USRP N300","BLADERF","LMSSDR","IRIS","No HW","ADRV9371_ZC706","UEDv2", "RFSIMULATOR"} +/* list of names of devices, needs to match dev_type_t */ +extern const char* devtype_names[MAX_RF_DEV_TYPE]; + /*!\brief transport protocol types */ typedef enum { @@ -535,7 +539,7 @@ extern "C" /*! \brief get device name from device type */ -char *get_devname(int devtype); +const char *get_devname(int devtype); /*! \brief Initialize openair RF target. It returns 0 if OK */ int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cfg); /*! \brief Initialize transport protocol . It returns 0 if OK */ diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index e3b06a6438fad53764ca1d519264413d740b6cd6..4259304643be88a0374a7ac7ec80f3fd2c350d4e 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -273,18 +273,20 @@ static int sync_to_gps(openair0_device *device) { static int trx_usrp_start(openair0_device *device) { usrp_state_t *s = (usrp_state_t *)device->priv; - // setup GPIO for TDD, GPIO(4) = ATR_RX - //set data direction register (DDR) to output - s->usrp->set_gpio_attr("FP0", "DDR", 0xfff, 0xfff); - //set lower 7 bits to be controlled automatically by ATR (the rest 5 bits are controlled manually) - s->usrp->set_gpio_attr("FP0", "CTRL", 0x7f,0xfff); - //set pins 4 (RX_TX_Switch) and 6 (Shutdown PA) to 1 when the radio is only receiving (ATR_RX) - s->usrp->set_gpio_attr("FP0", "ATR_RX", (1<<4)|(1<<6), 0x7f); - // set pin 5 (Shutdown LNA) to 1 when the radio is transmitting and receiveing (ATR_XX) - // (we use full duplex here, because our RX is on all the time - this might need to change later) - s->usrp->set_gpio_attr("FP0", "ATR_XX", (1<<5), 0x7f); - // set the output pins to 1 - s->usrp->set_gpio_attr("FP0", "OUT", 7<<7, 0xf80); + if (device->type != USRP_X400_DEV) { + // setup GPIO for TDD, GPIO(4) = ATR_RX + //set data direction register (DDR) to output + s->usrp->set_gpio_attr("FP0", "DDR", 0xfff, 0xfff); + //set lower 7 bits to be controlled automatically by ATR (the rest 5 bits are controlled manually) + s->usrp->set_gpio_attr("FP0", "CTRL", 0x7f,0xfff); + //set pins 4 (RX_TX_Switch) and 6 (Shutdown PA) to 1 when the radio is only receiving (ATR_RX) + s->usrp->set_gpio_attr("FP0", "ATR_RX", (1<<4)|(1<<6), 0x7f); + // set pin 5 (Shutdown LNA) to 1 when the radio is transmitting and receiveing (ATR_XX) + // (we use full duplex here, because our RX is on all the time - this might need to change later) + s->usrp->set_gpio_attr("FP0", "ATR_XX", (1<<5), 0x7f); + // set the output pins to 1 + s->usrp->set_gpio_attr("FP0", "OUT", 7<<7, 0xf80); + } s->wait_for_first_pps = 1; s->rx_count = 0; @@ -847,7 +849,7 @@ rx_gain_calib_table_t calib_table_x310[] = { {-1,0} }; -/*! \brief USRPB210 RX calibration table */ +/*! \brief USRPn3xf RX calibration table */ rx_gain_calib_table_t calib_table_n310[] = { {3500000000.0,0.0}, {2660000000.0,0.0}, @@ -857,6 +859,16 @@ rx_gain_calib_table_t calib_table_n310[] = { {-1,0} }; +/*! \brief Empty RX calibration table */ +rx_gain_calib_table_t calib_table_none[] = { + {3500000000.0,0.0}, + {2660000000.0,0.0}, + {2300000000.0,0.0}, + {1880000000.0,0.0}, + {816000000.0, 0.0}, + {-1,0} +}; + /*! \brief Set RX gain offset * \param openair0_cfg RF frontend parameters set by application @@ -1011,7 +1023,9 @@ extern "C" { device->type=USRP_N300_DEV; usrp_master_clock = 122.88e6; args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock); - //args += ", send_buff_size=33554432"; + + if ( 0 != system("sysctl -w net.core.rmem_max=62500000 net.core.wmem_max=62500000") ) + LOG_W(HW,"Can't set kernel parameters for N3x0\n"); } if (device_adds[0].get("type") == "x300") { @@ -1025,6 +1039,13 @@ extern "C" { LOG_W(HW,"Can't set kernel parameters for X3xx\n"); } + if (device_adds[0].get("type") == "x4xx") { + printf("Found USRP x400\n"); + device->type = USRP_X400_DEV; + usrp_master_clock = 245.76e6; + args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock); + } + s->usrp = uhd::usrp::multi_usrp::make(args); if (args.find("clock_source")==std::string::npos) { @@ -1103,8 +1124,13 @@ extern "C" { std::cerr << "-- Using calibration table: calib_table_n310" << std::endl; } + if (device->type == USRP_X400_DEV) { + openair0_cfg[0].rx_gain_calib_table = calib_table_none; + std::cerr << "-- Using calibration table: calib_table_none" << std::endl; + } + - if (device->type==USRP_N300_DEV || device->type==USRP_X300_DEV) { + if (device->type==USRP_N300_DEV || device->type==USRP_X300_DEV || device->type==USRP_X400_DEV) { LOG_I(HW,"%s() sample_rate:%u\n", __FUNCTION__, (int)openair0_cfg[0].sample_rate); switch ((int)openair0_cfg[0].sample_rate) { diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf index 43c2ab20ad6be972e36f7c906e46ee58f96fd6be..c07a0db649240390a4e547baeeadce703d029846 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf @@ -13,7 +13,6 @@ gNBs = gNB_name = "gNB-Eurecom-CU"; - // Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; plmn_list = ({ @@ -27,14 +26,14 @@ gNBs = }, { sst = 1; - sd = 0x1; #112233; // 0 false, else true + sd = 0x112233; // 0 false, else true } ); }); - nr_cellid = 12345678L + nr_cellid = 12345678L; tr_s_preference = "f1"; @@ -43,9 +42,148 @@ gNBs = remote_s_address = "127.0.0.3"; local_s_portc = 501; local_s_portd = 2152; - remote_s_portc = 501; + remote_s_portc = 500; remote_s_portd = 2152; + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + min_rxtxtime = 6; + sib1_tda = 0; + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 12; + searchSpaceZero = 0; + } + ); + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641280; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640008; + #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=27,L=48 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952 +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 11; + initialDLBWPsearchSpaceZero = 0; + + #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 = 28875; +# 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 = -96; +#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 = 4; +#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; +#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, + + 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; + +# 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; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + ); # ------- SCTP definitions SCTP : { @@ -56,7 +194,7 @@ gNBs = ////////// AMF parameters: - amf_ip_address = ( { ipv4 = "192.168.69.131"; + amf_ip_address = ( { ipv4 = "192.168.69.131"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -66,15 +204,31 @@ gNBs = NETWORK_INTERFACES : { - GNB_INTERFACE_NAME_FOR_NG_AMF = "bond0"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.18.207/24"; - GNB_INTERFACE_NAME_FOR_NGU = "bond0"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.18.207/24"; + GNB_INTERFACE_NAME_FOR_NG_AMF = "eth0"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.18.207"; + GNB_INTERFACE_NAME_FOR_NGU = "eth0"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.18.207"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; } ); +security = { + # preferred ciphering algorithms + # the first one of the list that an UE supports in chosen + # valid values: nea0, nea1, nea2, nea3 + ciphering_algorithms = ( "nea0" ); + + # preferred integrity algorithms + # the first one of the list that an UE supports in chosen + # valid values: nia0, nia1, nia2, nia3 + integrity_algorithms = ( "nia2", "nia0" ); + + # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter + # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' + drb_ciphering = "yes"; + drb_integrity = "no"; +}; log_config : { global_log_level ="info"; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf index 0b6d7cd7c85bdab7411cb5c6ee93b64e4322ceab..c30805a2d9b6021db0df7b3c38186a0fd70b0e3d 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf @@ -12,7 +12,6 @@ gNBs = gNB_name = "gNB-Eurecom-DU"; - // Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; plmn_list = ({ @@ -26,25 +25,23 @@ gNBs = }, { sst = 1; - sd = 0x1; #112233; // 0 false, else true + sd = 0x112233; // 0 false, else true } ); }); - nr_cellid = 12345678L - -# tr_s_preference = "local_mac" + nr_cellid = 12345678L; ////////// Physical parameters: ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; + min_rxtxtime = 6; sib1_tda = 0; - pdcch_ConfigSIB1 = ( { controlResourceSetZero = 12; @@ -74,15 +71,14 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=27,L=48 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 12952; + initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952 # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 11; + initialDLBWPcontrolResourceSetZero = 11; initialDLBWPsearchSpaceZero = 0; - #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -95,7 +91,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 12952; + initialULBWPlocationAndBandwidth = 28875; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -107,7 +103,7 @@ gNBs = prach_msg1_FDM = 0; prach_msg1_FrequencyStart = 0; zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -118; + preambleReceivedTargetPower = -96; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) preambleTransMax = 6; #powerRampingStep @@ -118,9 +114,9 @@ gNBs = ra_ResponseWindow = 4; #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 = 3; + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; #oneHalf (0..15) 4,8,12,16,...60,64 - ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; #ra_ContentionResolutionTimer #(0..7) 8,16,24,32,40,48,56,64 ra_ContentionResolutionTimer = 7; @@ -136,7 +132,6 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, - msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -177,7 +172,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -201,9 +196,9 @@ MACRLCs = ( local_n_if_name = "lo"; local_n_address = "127.0.0.3"; remote_n_address = "127.0.0.4"; - local_n_portc = 601; + local_n_portc = 500; local_n_portd = 2152; - remote_n_portc = 600; + remote_n_portc = 501; remote_n_portd = 2152; } @@ -214,6 +209,9 @@ L1s = ( num_cc = 1; tr_n_preference = "local_mac"; thread_pool_size = 8; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 150; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 } ); @@ -224,21 +222,13 @@ RUs = ( nb_rx = 1 att_tx = 0 att_rx = 0; - bands = [7]; + bands = [78]; max_pdschReferenceSignalPower = -27; - max_rxgain = 75; + max_rxgain = 114; eNB_instances = [0]; - ##beamforming 1x2 matrix: 1 layer x 2 antennas - bf_weights = [0x00007fff, 0x0000]; - ##beamforming 1x4 matrix: 1 layer x 4 antennas - #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; - ## beamforming 2x2 matrix: - # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; - ## beamforming 4x4 matrix: - #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - - sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; - clock_src = "external"; + #beamforming 1x4 matrix: + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + clock_src = "internal"; } ); @@ -250,6 +240,13 @@ THREAD_STRUCT = ( worker_config = "WORKER_ENABLE"; } ); +rfsimulator: { +serveraddr = "server"; + serverport = "4043"; + options = (); #("saviq"); or/and "chanmod" + modelname = "AWGN"; + IQfile = "/tmp/rfsimulator.iqs" +} log_config : { @@ -257,7 +254,7 @@ THREAD_STRUCT = ( hw_log_level ="info"; phy_log_level ="info"; mac_log_level ="info"; - rlc_log_level ="debug"; + rlc_log_level ="info"; pdcp_log_level ="info"; rrc_log_level ="info"; f1ap_log_level ="debug"; diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 2e95e56d852db2a57036cde266cf29809b38e020..25da395b9010570f816bdf1626377a6cd272f55e 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -2011,8 +2011,18 @@ void *UE_thread(void *arg) if (is_synchronized == 0) { if (instance_cnt_synch < 0) { // we can invoke the synch - // grab 10 ms of signal and wakeup synch thread + // we shift in time flow because the UE doesn't detect sync when frame alignment is not easy + for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) + rxp[i] = (void *)&dummy_rx[i][0]; + UE->rfdevice.trx_read_func(&UE->rfdevice, + ×tamp, + rxp, + UE->frame_parms.samples_per_tti/2, + UE->frame_parms.nb_antennas_rx); + + // grab 10 ms of signal and wakeup synch thread + if (UE->mode != loop_through_memory) { if (IS_SOFTMODEM_RFSIM ) { for(int sf=0; sf<10; sf++) {