diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ae49fdecb..4b2a3b41d9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -508,9 +508,6 @@ include_directories ("${OPENAIR_DIR}/radio/COMMON")
# ???!!! TO BE DOCUMENTED OPTIONS !!!???
##############################################################
-add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????" ON)
-add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????" ON)
-
add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION with max 256 UE" ON)
add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION with max 256 UE" ON)
add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE" ON)
@@ -1483,10 +1480,6 @@ add_library(L2_UE_LTE_NR
)
target_link_libraries(L2_UE_LTE_NR PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
-if (NOT ${NOS1})
-target_compile_definitions(L2_UE PUBLIC -DPDCP_USE_NETLINK)
-endif()
-
target_link_libraries(L2_UE PRIVATE asn1_lte_rrc_hdrs)
add_library( NR_L2_UE ${NR_L2_SRC_UE} ${MAC_NR_SRC_UE} )
@@ -1885,13 +1878,6 @@ set (SIMUSRC
add_library(SIMU STATIC ${SIMUSRC} )
target_include_directories(SIMU PUBLIC ${OPENAIR1_DIR}/SIMULATION/TOOLS ${OPENAIR1_DIR}/SIMULATION/RF)
-add_library(SIMU_ETH STATIC
- ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
- ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
- ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
-)
-target_link_libraries(SIMU_ETH PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
-
include_directories("${NFAPI_DIR}/nfapi/public_inc")
include_directories("${NFAPI_DIR}/common/public_inc")
include_directories("${NFAPI_DIR}/pnf/public_inc")
@@ -1940,8 +1926,6 @@ add_executable(lte-softmodem
${OPENAIR_DIR}/executables/create_tasks_mbms.c
${OPENAIR_DIR}/radio/COMMON/common_lib.c
${OPENAIR_DIR}/radio/COMMON/record_player.c
- ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
- ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${PHY_INTERFACE_DIR}/queue_t.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
@@ -1954,7 +1938,7 @@ target_link_libraries(lte-softmodem PRIVATE
-Wl,--start-group
lte_rrc nr_rrc s1ap m2ap x2ap m3ap GTPV1U SECURITY UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB SCHED_RU_LIB
PHY_COMMON PHY PHY_RU L2 L2_LTE NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB
- ${NAS_UE_LIB} ITTI SIMU SIMU_ETH shlib_loader
+ ${NAS_UE_LIB} ITTI SIMU shlib_loader
-Wl,--end-group z dl)
target_link_libraries(lte-softmodem PRIVATE pthread m CONFIG_LIB rt sctp)
@@ -1998,22 +1982,17 @@ add_executable(lte-uesoftmodem
${OPENAIR_DIR}/executables/create_tasks_ue.c
${OPENAIR_DIR}/radio/COMMON/common_lib.c
${OPENAIR_DIR}/radio/COMMON/record_player.c
- ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
- ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${OPENAIR1_DIR}/PHY/TOOLS/phy_scope_interface.c
)
-if (NOT ${NOS1})
- target_compile_definitions(lte-uesoftmodem PRIVATE -DPDCP_USE_NETLINK)
-endif()
target_link_libraries(lte-uesoftmodem PRIVATE
-Wl,--start-group
lte_rrc nr_rrc s1ap x2ap m2ap m3ap
SECURITY UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON
- PHY_UE PHY_RU L2_UE L2_LTE SIMU SIMU_ETH NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB
+ PHY_UE PHY_RU L2_UE L2_LTE SIMU NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB
${NAS_UE_LIB} ITTI shlib_loader
-Wl,--end-group z dl)
@@ -2038,8 +2017,6 @@ add_executable(nr-softmodem
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR_DIR}/radio/COMMON/common_lib.c
${OPENAIR_DIR}/radio/COMMON/record_player.c
- ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
- ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${PHY_INTERFACE_DIR}/queue_t.c
@@ -2050,7 +2027,7 @@ target_link_libraries(nr-softmodem PRIVATE
-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 GTPV1U SECURITY
ITTI ${NAS_UE_LIB} lte_rrc nr_rrc
- ngap s1ap L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB SIMU SIMU_ETH
+ ngap s1ap L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB SIMU
x2ap f1ap m2ap m3ap e1ap shlib_loader
-Wl,--end-group z dl)
@@ -2081,7 +2058,6 @@ target_link_libraries(nr-softmodem PRIVATE
add_executable(nr-cuup
executables/nr-cuup.c
executables/softmodem-common.c
- ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${NR_RRC_DIR}/rrc_gNB_UE_context.c
${OPENAIR2_DIR}/E1AP/e1ap_setup.c
${NR_PDCP_SRC}
@@ -2090,7 +2066,7 @@ add_executable(nr-cuup
target_link_libraries(nr-cuup PRIVATE
CONFIG_LIB ITTI SCTP_CLIENT
- GTPV1U e1ap f1ap SIMU_ETH
+ GTPV1U e1ap f1ap
z sctp dl pthread shlib_loader ${T_LIB})
target_link_libraries(nr-cuup PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
if(E2_AGENT)
@@ -2109,9 +2085,7 @@ add_executable(nr-uesoftmodem
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR_DIR}/radio/COMMON/common_lib.c
${OPENAIR_DIR}/radio/COMMON/record_player.c
- ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/LAYER2/NR_MAC_COMMON/nr_mac_common.c
- ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR1_DIR}/PHY/TOOLS/phy_scope_interface.c
)
@@ -2121,10 +2095,10 @@ target_link_libraries(nr-uesoftmodem PRIVATE
nr_rrc SECURITY UTIL HASHTABLE SCHED_RU_LIB SCHED_NR_UE_LIB
PHY_COMMON PHY_NR_COMMON PHY_NR_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB MISC_NFAPI_NR_LIB
- ITTI LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB} SIMU SIMU_ETH shlib_loader
+ ITTI LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB} SIMU shlib_loader
-Wl,--end-group z dl)
-target_link_libraries(nr-uesoftmodem PRIVATE pthread m CONFIG_LIB rt)
+target_link_libraries(nr-uesoftmodem PRIVATE pthread m CONFIG_LIB rt nr_ue_phy_meas)
target_link_libraries(nr-uesoftmodem PRIVATE ${T_LIB})
target_link_libraries(nr-uesoftmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
@@ -2221,14 +2195,13 @@ add_executable(nr_psbchsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/psbchsim.c
${OPENAIR1_DIR}/SIMULATION/NR_PHY/nr_dummy_functions.c
${OPENAIR_DIR}/executables/softmodem-common.c
- ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${NR_UE_RRC_DIR}/rrc_nsa.c
${NFAPI_USER_DIR}/nfapi.c
${NFAPI_USER_DIR}/gnb_ind_vars.c
${PHY_INTERFACE_DIR}/queue_t.c
)
target_link_libraries(nr_psbchsim PRIVATE
- -Wl,--start-group UTIL SIMU SIMU_ETH PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON CONFIG_LIB L2_NR -lz -Wl,--end-group
+ -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON CONFIG_LIB L2_NR -lz -Wl,--end-group
m pthread ${T_LIB} ITTI dl shlib_loader
)
target_link_libraries(nr_psbchsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
@@ -2248,15 +2221,14 @@ add_executable(nr_dlsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlsim.c
${OPENAIR1_DIR}/SIMULATION/NR_PHY/nr_dummy_functions.c
${OPENAIR_DIR}/executables/softmodem-common.c
- ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${NR_UE_RRC_DIR}/rrc_nsa.c
${NFAPI_USER_DIR}/nfapi.c
${NFAPI_USER_DIR}/gnb_ind_vars.c
${PHY_INTERFACE_DIR}/queue_t.c
)
target_link_libraries(nr_dlsim PRIVATE
- -Wl,--start-group UTIL SIMU SIMU_ETH PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON nr_rrc CONFIG_LIB L2_NR HASHTABLE x2ap SECURITY ngap -lz -Wl,--end-group
- m pthread ${T_LIB} ITTI dl shlib_loader
+ -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON nr_rrc CONFIG_LIB L2_NR HASHTABLE x2ap SECURITY ngap -lz -Wl,--end-group
+ m pthread ${T_LIB} ITTI dl shlib_loader nr_ue_phy_meas
)
target_link_libraries(nr_dlsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
@@ -2284,7 +2256,6 @@ add_executable(nr_ulsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulsim.c
${OPENAIR1_DIR}/SIMULATION/NR_PHY/nr_dummy_functions.c
${OPENAIR_DIR}/executables/softmodem-common.c
- ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${NR_UE_RRC_DIR}/rrc_nsa.c
${NFAPI_USER_DIR}/nfapi.c
${NFAPI_USER_DIR}/gnb_ind_vars.c
@@ -2296,8 +2267,8 @@ if (ENABLE_LDPC_T2)
endif()
target_link_libraries(nr_ulsim PRIVATE
- -Wl,--start-group UTIL SIMU SIMU_ETH PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON nr_rrc CONFIG_LIB L2_NR HASHTABLE x2ap SECURITY ngap -lz -Wl,--end-group
- m pthread ${T_LIB} ITTI dl shlib_loader
+ -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON nr_rrc CONFIG_LIB L2_NR HASHTABLE x2ap SECURITY ngap -lz -Wl,--end-group
+ m pthread ${T_LIB} ITTI dl shlib_loader nr_ue_phy_meas
)
target_link_libraries(nr_ulsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
@@ -2344,7 +2315,7 @@ endforeach(myExe)
#ensure that the T header files are generated before targets depending on them
if (${T_TRACER})
foreach(i
- #all "add_executable" definitions (except tests, rb_tool, updatefw)
+ #all "add_executable" definitions (except tests, updatefw)
lte-softmodem lte-uesoftmodem nr-softmodem
nr-uesoftmodem dlsim dlsim_tm4 dlsim_tm7
ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim
@@ -2359,7 +2330,7 @@ if (${T_TRACER})
MISC_NFAPI_LTE_LIB MISC_NFAPI_NR_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_UE_NR ngap
- CN_UTILS GTPV1U SCTP_CLIENT MME_APP LIB_NAS_UE NB_IoT SIMU SIMU_ETH OPENAIR0_LIB
+ CN_UTILS GTPV1U SCTP_CLIENT MME_APP LIB_NAS_UE NB_IoT SIMU OPENAIR0_LIB
ldpc_orig ldpc_optim ldpc_optim8seg ldpc_t2 ldpc_cl ldpc_cuda ldpc dfts config_internals nr_common)
if (TARGET ${i})
add_dependencies(${i} generate_T)
@@ -2367,86 +2338,6 @@ if (${T_TRACER})
endforeach(i)
endif (${T_TRACER})
-##################################################
-# Generated specific cases is not regular code
-###############################################
-
-################
-# Kernel modules
-###############
-# Set compiler options for kernel modules
-# we need to get out cmake to use the regular Linux Kernel process
-# this is documented as https://www.kernel.org/doc/Documentation/kbuild/modules.txt
-######################################
-
-# retrieve the compiler options to send it to gccxml
-get_directory_property(DirDefs COMPILE_DEFINITIONS )
-foreach( d ${DirDefs} )
- set(module_cc_opt "${module_cc_opt} -D${d}")
-endforeach()
-get_directory_property( DirDefs INCLUDE_DIRECTORIES )
-foreach( d ${DirDefs} )
- set(module_cc_opt "${module_cc_opt} -I${d}")
-endforeach()
-
-EXECUTE_PROCESS(COMMAND uname -r
- OUTPUT_VARIABLE os_release
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-SET(module_build_path /lib/modules/${os_release}/build)
-
-function(make_driver name dir)
- file(MAKE_DIRECTORY ${OPENAIR_BIN_DIR}/${name})
- foreach(f IN ITEMS ${ARGN})
- list(APPEND src_path_list ${dir}/${f})
- string(REGEX REPLACE "c *$" "o" obj ${f})
- set(objs "${objs} ${obj}")
- endforeach()
- CONFIGURE_FILE(${OPENAIR_CMAKE}/tools/Kbuild.cmake ${OPENAIR_BIN_DIR}/${name}/Kbuild)
- add_custom_command(OUTPUT ${name}.ko
- COMMAND make -C ${module_build_path} M=${OPENAIR_BIN_DIR}/${name}
- WORKING_DIRECTORY ${OPENAIR_BIN_DIR}/${name}
- COMMENT "building ${module}.ko"
- VERBATIM
- SOURCES ${src_path_list}
- )
- add_custom_target(${name} DEPENDS ${name}.ko)
-endfunction(make_driver name dir src)
-
-# nashmesh module
-################
-list(APPEND nasmesh_src device.c common.c ioctl.c classifier.c tool.c mesh.c)
-set(module_cc_opt "${module_cc_opt} -DNAS_NETLINK -DPDCP_USE_NETLINK")
-# legacy Makefile was using NAS_NETLINK flag, but other drivers the hereafter flag
-# so, this cmake use OAI_NW_DRIVER_USE_NETLINK everywhere
-if (OAI_NW_DRIVER_USE_NETLINK)
- list(APPEND nasmesh_src netlink.c)
-endif()
-make_driver(nasmesh ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH ${nasmesh_src})
-
-# user space tool for configuring MESH IP driver
-################
-add_executable(rb_tool
- ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/RB_TOOL/rb_tool.c
-)
-target_include_directories(rb_tool PRIVATE ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/)
-
-# ???
-####################
-list(APPEND oai_nw_drv_src device.c common.c ioctl.c classifier.c tool.c)
-if(OAI_NW_DRIVER_USE_NETLINK)
- list(APPEND oai_nw_drv_src netlink.c)
-endif()
-make_driver(oai_nw_drv ${OPENAIR2_DIR}/NETWORK_DRIVER/LTE ${oai_nw_drv_src})
-
-
-# ue_ip: purpose ???
-###############
-list(APPEND ue_ip_src device.c common.c)
-if(OAI_NW_DRIVER_USE_NETLINK)
- list(APPEND ue_ip_src netlink.c)
-endif()
-make_driver(ue_ip ${OPENAIR2_DIR}/NETWORK_DRIVER/UE_IP ${ue_ip_src})
-
include(${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/CMakeLists.txt)
set(ENABLE_TESTS OFF CACHE STRING "Activate build of tests")
diff --git a/NOTICE.md b/NOTICE.md
index b92941540d..10f3bd295b 100644
--- a/NOTICE.md
+++ b/NOTICE.md
@@ -4,15 +4,6 @@ For more details of the license, refer to [LICENSE](LICENSE) file in the same di
However, the source code also contains third party software that is acknowledged here for reference.
-## Credits for LFDS user space source code located in folder openair2/UTILS/LFDS/ ##
-
-See on [liblfds website](https://liblfds.org/) the license section.
-
-
-"There is no license. You are free to use this software in any way, for any purpose. Go forth and create wealth!
-If however for legal reasons a licence is required, the license of your choice will be granted."
-
-
## Credits for source code common/utils/collection/queue.h: ##
The Regents of the University of California: BSD 3-Clause Licence.
diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container
index b1bf895111..f5b83ec071 100644
--- a/ci-scripts/Jenkinsfile-GitLab-Container
+++ b/ci-scripts/Jenkinsfile-GitLab-Container
@@ -585,6 +585,29 @@ pipeline {
}
}
}
+ stage ("SA-FHI72-CN5G") {
+ when { expression {do5Gtest} }
+ steps {
+ script {
+ triggerSlaveJob ('RAN-SA-FHI72-CN5G', 'SA-FHI72-CN5G')
+ }
+ }
+ post {
+ always {
+ script {
+ // Using a unique variable name for each test stage to avoid overwriting on a global variable
+ // due to parallel-time concurrency
+ saFHI72Status = finalizeSlaveJob('RAN-SA-FHI72-CN5G')
+ }
+ }
+ failure {
+ script {
+ currentBuild.result = 'FAILURE'
+ failingStages += saFHI72Status
+ }
+ }
+ }
+ }
stage ("SA-OAIUE-CN5G") {
when { expression {do5Gtest} }
steps {
diff --git a/ci-scripts/ci_infra.yaml b/ci-scripts/ci_infra.yaml
index 8cbb5936e2..8ffb1c2083 100644
--- a/ci-scripts/ci_infra.yaml
+++ b/ci-scripts/ci_infra.yaml
@@ -18,6 +18,14 @@ up2:
IF: wwan0
MTU: 1500
+up2-fhi72:
+ Host: up2
+ AttachScript: sudo /opt/mbim-fhi72/start_quectel_mbim.sh
+ DetachScript: sudo /opt/mbim-fhi72/stop_quectel_mbim.sh
+ NetworkScript: ip a show dev wwan0
+ IF: wwan0
+ MTU: 1500
+
sphex_quectel:
Host: sphex
InitScript: sudo stdbuf -oL /home/oaicicd/quectel-CM/quectel-CM -4 -s oai.ipv4 &> /tmp/quecel-cm.log &
@@ -58,9 +66,18 @@ adb_ue_2:
oc-cn5g:
Host: avra
+ Namespace: "oaicicd-core-for-ci-ran"
+ CNPath: "/opt/oai-cn5g-fed-develop-2024-april-00102"
NetworkScript: echo "inet 172.21.6.102"
RunIperf3Server: False
+oc-cn5g-20897:
+ Host: cacofonix
+ Namespace: "oaicicd-core-for-fhi72"
+ CNPath: "/opt/oai-cn5g-fed-develop-2024-april-20897"
+ NetworkScript: echo "inet 172.21.6.105"
+ RunIperf3Server: False
+
matix-cn5g:
Host: matix
NetworkScript: docker exec prod-trf-gen ip a show dev eth0
@@ -99,6 +116,10 @@ amarisoft_ue:
Host: amariue
InitScript: /root/lteue-linux-2023-10-27/ue/lteue /root/oaicicd/ran_sa_aw2s_asue_2x2/aw2s-multi-00102-2x2.cfg &
TermScript: /root/2023-10-27/libs/ws.js -t 10 127.0.0.1:9002 '{"message":"quit"}' || killall -KILL lteue-avx2
+amarisoft_ue_fhi72:
+ Host: amariue
+ InitScript: /root/lteue-linux-2023-10-27/ue/lteue /root/oaicicd/ran_sa_fhi72_asue_2x2_benetel550/fhi72-multi-20897-2x2.cfg &
+ TermScript: /root/2023-10-27/libs/ws.js -t 10 127.0.0.1:9002 '{"message":"quit"}' || killall -KILL lteue-avx2
amarisoft_ue_1:
Host: amariue
AttachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":1}'
diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py
index 80d6d95daa..3f11fad7fb 100644
--- a/ci-scripts/cls_cluster.py
+++ b/ci-scripts/cls_cluster.py
@@ -43,7 +43,6 @@ NAMESPACE = "oaicicd-ran"
OCUrl = "https://api.oai.cs.eurecom.fr:6443"
OCRegistry = "default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/"
CI_OC_RAN_NAMESPACE = "oaicicd-ran"
-CI_OC_CORE_NAMESPACE = "oaicicd-core-for-ci-ran"
CN_IMAGES = ["mysql", "oai-nrf", "oai-amf", "oai-smf", "oai-upf", "oai-ausf", "oai-udm", "oai-udr", "oai-traffic-server"]
CN_CONTAINERS = ["", "-c nrf", "-c amf", "-c smf", "-c upf", "-c ausf", "-c udm", "-c udr", ""]
@@ -68,10 +67,9 @@ def OC_login(cmd, ocUserName, ocPassword, ocProjectName):
def OC_logout(cmd):
cmd.run(f'oc logout')
-def OC_deploy_CN(cmd, ocUserName, ocPassword):
- logging.debug('OC OAI CN5G: Deploying OAI CN5G on Openshift Cluster')
- path = "/opt/oai-cn5g-fed-develop-2024-april-00102"
- succeeded = OC_login(cmd, ocUserName, ocPassword, CI_OC_CORE_NAMESPACE)
+def OC_deploy_CN(cmd, ocUserName, ocPassword, ocNamespace, path):
+ logging.debug(f'OC OAI CN5G: Deploying OAI CN5G on Openshift Cluster: {ocNamespace}')
+ succeeded = OC_login(cmd, ocUserName, ocPassword, ocNamespace)
if not succeeded:
return False, CONST.OC_LOGIN_FAIL
cmd.run('helm uninstall oai5gcn --wait --timeout 60s')
@@ -84,10 +82,9 @@ def OC_deploy_CN(cmd, ocUserName, ocPassword):
OC_logout(cmd)
return True, report
-def OC_undeploy_CN(cmd, ocUserName, ocPassword):
- logging.debug('OC OAI CN5G: Terminating CN on Openshift Cluster')
- path = "/opt/oai-cn5g-fed-develop-2024-april-00102"
- succeeded = OC_login(cmd, ocUserName, ocPassword, CI_OC_CORE_NAMESPACE)
+def OC_undeploy_CN(cmd, ocUserName, ocPassword, ocNamespace, path):
+ logging.debug(f'OC OAI CN5G: Terminating CN on Openshift Cluster: {ocNamespace}')
+ succeeded = OC_login(cmd, ocUserName, ocPassword, ocNamespace)
if not succeeded:
return False, CONST.OC_LOGIN_FAIL
cmd.run(f'rm -Rf {path}/logs')
diff --git a/ci-scripts/cls_module.py b/ci-scripts/cls_module.py
index d0cfba0299..ef758a2933 100644
--- a/ci-scripts/cls_module.py
+++ b/ci-scripts/cls_module.py
@@ -65,6 +65,8 @@ class Module_UE:
self.logStore = m.get('LogStore')
self.cmd_prefix = m.get('CmdPrefix')
self.runIperf3Server = m.get('RunIperf3Server', True)
+ self.namespace = m.get('Namespace')
+ self.cnPath = m.get('CNPath')
logging.info(f'initialized {self.module_name}@{self.host} from {filename}')
def __str__(self):
@@ -190,6 +192,12 @@ class Module_UE:
def getHost(self):
return self.host
+ def getNamespace(self):
+ return self.namespace
+
+ def getCNPath(self):
+ return self.cnPath
+
def getRunIperf3Server(self):
return self.runIperf3Server
diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py
index b7e61c06cd..037f0fdf19 100644
--- a/ci-scripts/cls_oaicitest.py
+++ b/ci-scripts/cls_oaicitest.py
@@ -96,45 +96,44 @@ def Iperf_ComputeTime(args):
return int(result.group('iperf_time'))
def Iperf_analyzeV3TCPJson(filename, iperf_tcp_rate_target):
- if (not os.path.isfile(filename)):
- return (False, 'Iperf3 TCP: Log file not present')
- if (os.path.getsize(filename)==0):
- return (False, 'Iperf3 TCP: Log file is empty')
-
- with open(filename) as file:
- filename = json.load(file)
- try:
- sender_bitrate = round(filename['end']['streams'][0]['sender']['bits_per_second']/1000000,2)
- receiver_bitrate = round(filename['end']['streams'][0]['receiver']['bits_per_second']/1000000,2)
- except Exception as e:
- return (False, 'Could not compute Iperf3 bitrate!')
-
+ try:
+ with open(filename) as f:
+ results = json.load(f)
+ sender_bitrate = round(results['end']['streams'][0]['sender']['bits_per_second'] / 1000000, 2)
+ receiver_bitrate = round(results['end']['streams'][0]['receiver']['bits_per_second'] / 1000000, 2)
+ except json.JSONDecodeError as e:
+ return (False, f'Could not decode JSON log file {filename}: {e}')
+ except KeyError as e:
+ e_msg = results.get('error', f'error report not found in {filename}')
+ return (False, f'While parsing Iperf3 results: missing key {e}, {e_msg}')
+ except Exception as e:
+ return (False, f'While parsing Iperf3 results: exception: {e}')
snd_msg = f'Sender Bitrate : {sender_bitrate} Mbps'
rcv_msg = f'Receiver Bitrate : {receiver_bitrate} Mbps'
success = True
- if (iperf_tcp_rate_target is not None):
- if (int(receiver_bitrate) < int(iperf_tcp_rate_target)):
- rcv_msg += f" (too low! < {iperf_tcp_rate_target} Mbps)"
- success = False
+ if iperf_tcp_rate_target is not None:
+ success = float(receiver_bitrate) >= float(iperf_tcp_rate_target)
+ if success:
+ rcv_msg += f" (target: {iperf_tcp_rate_target})"
else:
- rcv_msg += f" (target : {iperf_tcp_rate_target} Mbps)"
+ rcv_msg += f" (too low! < {iperf_tcp_rate_target})"
return(success, f'{snd_msg}\n{rcv_msg}')
def Iperf_analyzeV3BIDIRJson(filename):
- if (not os.path.isfile(filename)):
- return (False, 'Iperf3 Bidir TCP: Log file not present')
- if (os.path.getsize(filename)==0):
- return (False, 'Iperf3 Bidir TCP: Log file is empty')
-
- with open(filename) as file:
- filename = json.load(file)
- try:
- sender_bitrate_ul = round(filename['end']['streams'][0]['sender']['bits_per_second']/1000000,2)
- receiver_bitrate_ul = round(filename['end']['streams'][0]['receiver']['bits_per_second']/1000000,2)
- sender_bitrate_dl = round(filename['end']['streams'][1]['sender']['bits_per_second']/1000000,2)
- receiver_bitrate_dl = round(filename['end']['streams'][1]['receiver']['bits_per_second']/1000000,2)
- except Exception as e:
- return (False, 'Could not compute BIDIR bitrate!')
+ try:
+ with open(filename) as f:
+ results = json.load(f)
+ sender_bitrate_ul = round(results['end']['streams'][0]['sender']['bits_per_second'] / 1000000, 2)
+ receiver_bitrate_ul = round(results['end']['streams'][0]['receiver']['bits_per_second'] / 1000000, 2)
+ sender_bitrate_dl = round(results['end']['streams'][1]['sender']['bits_per_second'] / 1000000, 2)
+ receiver_bitrate_dl = round(results['end']['streams'][1]['receiver']['bits_per_second'] / 1000000, 2)
+ except json.JSONDecodeError as e:
+ return (False, f'Could not decode JSON log file: {e}')
+ except KeyError as e:
+ e_msg = results.get('error', f'error report not found in {filename}')
+ return (False, f'While parsing Iperf3 results: missing key {e}, {e_msg}')
+ except Exception as e:
+ return (False, f'While parsing Iperf3 results: exception: {e}')
msg = f'Sender Bitrate DL : {sender_bitrate_dl} Mbps\n'
msg += f'Receiver Bitrate DL : {receiver_bitrate_dl} Mbps\n'
diff --git a/ci-scripts/conf_files/gnb.band78.106prb.rfsim.phytest-dora.conf b/ci-scripts/conf_files/gnb.band78.106prb.rfsim.phytest-dora.conf
index 551d860d33..f68c2e6ff0 100644
--- a/ci-scripts/conf_files/gnb.band78.106prb.rfsim.phytest-dora.conf
+++ b/ci-scripts/conf_files/gnb.band78.106prb.rfsim.phytest-dora.conf
@@ -85,7 +85,7 @@ gNBs =
powerRampingStep = 1;
#ra_ReponseWindow
#1,2,4,8,10,20,40,80
- ra_ResponseWindow = 4;
+ ra_ResponseWindow = 5;
#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4;
diff --git a/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf b/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf
new file mode 100644
index 0000000000..b98ed5d31c
--- /dev/null
+++ b/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf
@@ -0,0 +1,297 @@
+Active_gNBs = ( "gNB-OAI");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+gNBs =
+(
+ {
+ ////////// Identification parameters:
+ gNB_ID = 0xe00;
+ gNB_name = "gNB-OAI";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+ plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ( { sst = 1; }); });
+
+ //nr_cellid = 12345678L;
+ nr_cellid = 1;
+
+ ////////// Physical parameters:
+
+ pdsch_AntennaPorts_XP = 2;
+ pdsch_AntennaPorts_N1 = 1;
+ maxMIMO_layers = 2;
+ pusch_AntennaPorts = 4;
+ do_CSIRS = 1;
+ do_SRS = 0 ;
+
+ pdcch_ConfigSIB1 = (
+ {
+ controlResourceSetZero = 11;
+ searchSpaceZero = 0;
+ }
+ );
+
+ servingCellConfigCommon = (
+ {
+ #spCellConfigCommon
+ physCellId = 0;
+# downlinkConfigCommon
+ #frequencyInfoDL
+ # this is 3450.72 MHz (center frequency)
+ absoluteFrequencySSB = 666624;
+ dl_frequencyBand = 77;
+ # this is 3401.58 MHz
+ dl_absoluteFrequencyPointA = 663348;
+ #scs-SpecificCarrierList
+ dl_offstToCarrier = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ dl_subcarrierSpacing = 1;
+ dl_carrierBandwidth = 273;
+ #initialDownlinkBWP
+ #genericParameters
+ initialDLBWPlocationAndBandwidth = 1099; #38.101-1 Table 5.3.2-1
+ #
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ initialDLBWPsubcarrierSpacing = 1;
+ #pdcch-ConfigCommon
+ initialDLBWPcontrolResourceSetZero = 11;
+ initialDLBWPsearchSpaceZero = 0;
+
+ #uplinkConfigCommon
+ #frequencyInfoUL
+ ul_frequencyBand = 77;
+ #scs-SpecificCarrierList
+ ul_offstToCarrier = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ ul_subcarrierSpacing = 1;
+ ul_carrierBandwidth = 273;
+ pMax = 23;
+ #initialUplinkBWP
+ #genericParameters
+ initialULBWPlocationAndBandwidth = 1099;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ initialULBWPsubcarrierSpacing = 1;
+ #rach-ConfigCommon
+ #rach-ConfigGeneric
+ prach_ConfigurationIndex = 159;
+#prach_msg1_FDM
+#0 = one, 1=two, 2=four, 3=eight
+ prach_msg1_FDM = 0;
+ prach_msg1_FrequencyStart = 0;
+ zeroCorrelationZoneConfig = 0;
+ preambleReceivedTargetPower = -100;
+#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
+ preambleTransMax = 7;
+#powerRampingStep
+# 0=dB0,1=dB2,2=dB4,3=dB6
+ powerRampingStep = 2;
+#ra_ReponseWindow
+#1,2,4,8,10,20,40,80
+ ra_ResponseWindow = 5;
+#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
+#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
+ ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3;
+#oneHalf (0..15) 4,8,12,16,...60,64
+ ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15;
+#ra_ContentionResolutionTimer
+#(0..7) 8,16,24,32,40,48,56,64
+ ra_ContentionResolutionTimer = 7;
+ rsrp_ThresholdSSB = 19;
+#prach-RootSequenceIndex_PR
+#1 = 839, 2 = 139
+ prach_RootSequenceIndex_PR = 2;
+ prach_RootSequenceIndex = 1;
+ # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
+ #
+ msg1_SubcarrierSpacing = 1,
+# restrictedSetConfig
+# 0=unrestricted, 1=restricted type A, 2=restricted type B
+ restrictedSetConfig = 0,
+
+# this is the offset between the last PRACH preamble power and the Msg3 PUSCH, 2 times the field value in dB
+ msg3_DeltaPreamble = 2;
+ p0_NominalWithGrant = -100;
+
+# pucch-ConfigCommon setup :
+# pucchGroupHopping
+# 0 = neither, 1= group hopping, 2=sequence hopping
+ pucchGroupHopping = 0;
+ hoppingId = 0;
+ p0_nominal = -96;
+# ssb_PositionsInBurs_BitmapPR
+# 1=short, 2=medium, 3=long
+ ssb_PositionsInBurst_PR = 2;
+ ssb_PositionsInBurst_Bitmap = 0x1;
+
+# 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 = 5;
+ nrofDownlinkSlots = 3;
+ nrofDownlinkSymbols = 6;
+ nrofUplinkSlots = 1;
+ nrofUplinkSymbols = 4;
+
+ ssPBCH_BlockPower = 0;
+ }
+
+ );
+
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+
+
+ ////////// AMF parameters:
+ amf_ip_address = ({ ipv4 = "172.21.6.103"; });
+
+ NETWORK_INTERFACES :
+ {
+ GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.18.20";
+ GNB_IPV4_ADDRESS_FOR_NGU = "172.21.18.20";
+ GNB_PORT_FOR_S1U = 2152; # Spec 2152
+ };
+ }
+);
+
+MACRLCs = (
+{
+ num_cc = 1;
+ tr_s_preference = "local_L1";
+ tr_n_preference = "local_RRC";
+ pusch_TargetSNRx10 = 180;
+ pucch_TargetSNRx10 = 230;
+ ul_bler_target_upper=.35;
+ ul_bler_target_lower=.15;
+ pusch_FailureThres = 100;
+}
+);
+
+L1s = (
+{
+ num_cc = 1;
+ tr_n_preference = "local_mac";
+ prach_dtx_threshold = 130
+ pucch0_dtx_threshold = 80;
+ pusch_dtx_threshold = -100;
+ tx_amp_backoff_dB = 3;
+ L1_rx_thread_core = 3;
+ L1_tx_thread_core = 4;
+ phase_compensation = 0; # needs to match O-RU configuration
+}
+);
+
+RUs = (
+{
+ local_rf = "no";
+ nb_tx = 4;
+ nb_rx = 4;
+ att_tx = 0
+ att_rx = 0;
+ bands = [77];
+ max_pdschReferenceSignalPower = -27;
+ max_rxgain = 75;
+ sf_extension = 0;
+ eNB_instances = [0];
+ ru_thread_core = 5;
+ sl_ahead = 5;
+ ##beamforming 1x2 matrix: 1 layer x 2 antennas
+ bf_weights = [0x00007fff, 0x0000,0x00007fff, 0x0000];
+ clock_src = "internal";
+ tr_preference = "raw_if4p5"; # important: activate FHI7.2
+ do_precoding = 0; # needs to match O-RU configuration
+}
+);
+
+rfsimulator :
+{
+ serveraddr = "server";
+ serverport = "4043";
+ options = (); #("saviq"); or/and "chanmod"
+ modelname = "AWGN";
+ IQfile = "/tmp/rfsimulator.iqs";
+};
+
+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";
+ hw_log_level = "info";
+ phy_log_level = "info";
+ mac_log_level = "info";
+ rlc_log_level = "info";
+ pdcp_log_level = "info";
+ rrc_log_level = "info";
+ ngap_log_level = "info";
+ f1ap_log_level = "info";
+};
+
+fhi_72 = {
+ dpdk_devices = ("0000:c3:11.0", "0000:c3:11.1");
+ system_core = 0;
+ io_core = 1;
+ worker_cores = (2);
+ du_addr = ("76:76:64:6e:00:01", "76:76:64:6e:00:01");
+ ru_addr = ("98:ae:71:01:c5:eb", "98:ae:71:01:c5:eb");
+ mtu = 9216; # check if xran uses this properly
+ fh_config = ({
+ Tadv_cp_dl = 125;
+ T2a_cp_dl = (285, 429); # (min, max)
+ T2a_cp_ul = (285, 429); # (min, max)
+ T2a_up = (125, 428); # (min, max)
+ Ta3 = (130, 170); # (min, max)
+ T1a_cp_dl = (285, 470); # (min, max)
+ T1a_cp_ul = (285, 429); # (min, max)
+ T1a_up = (125, 350); # (min, max)
+ Ta4 = (110, 180); # (min, max)
+ ru_config = {
+ iq_width = 9;
+ iq_width_prach = 9;
+ };
+ prach_config = {
+ eAxC_offset = 4;
+ };
+ });
+};
diff --git a/ci-scripts/conf_files/gnb.sa.band78.273prb.fhi72.4x4-benetel550.conf b/ci-scripts/conf_files/gnb.sa.band78.273prb.fhi72.4x4-benetel550.conf
new file mode 100644
index 0000000000..f8586437fa
--- /dev/null
+++ b/ci-scripts/conf_files/gnb.sa.band78.273prb.fhi72.4x4-benetel550.conf
@@ -0,0 +1,296 @@
+Active_gNBs = ( "gNB-OAI");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+gNBs =
+(
+ {
+ ////////// Identification parameters:
+ gNB_ID = 0xe00;
+ gNB_name = "gNB-OAI";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+ plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ( { sst = 1; }); });
+
+ nr_cellid = 1;
+
+ ////////// Physical parameters:
+
+ pdsch_AntennaPorts_XP = 2;
+ pdsch_AntennaPorts_N1 = 1;
+ maxMIMO_layers = 2;
+ pusch_AntennaPorts = 4;
+ do_CSIRS = 1;
+ do_SRS = 0 ;
+ sib1_tda = 15;
+# force_UL256qam_off = 1;
+
+ pdcch_ConfigSIB1 = (
+ {
+ controlResourceSetZero = 11;
+ searchSpaceZero = 0;
+ }
+ );
+
+ servingCellConfigCommon = (
+ {
+ #spCellConfigCommon
+
+ physCellId = 0;
+ # n_TimingAdvanceOffset = 0;
+# downlinkConfigCommon
+ #frequencyInfoDL
+ # this is 3450.72 MHz (center frequency)
+ absoluteFrequencySSB = 623328;
+ dl_frequencyBand = 78;
+ # this is 3401.58 MHz
+ dl_absoluteFrequencyPointA = 620052;
+ #scs-SpecificCarrierList
+ dl_offstToCarrier = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ dl_subcarrierSpacing = 1;
+ dl_carrierBandwidth = 273;
+ #initialDownlinkBWP
+ #genericParameters
+ initialDLBWPlocationAndBandwidth = 1099; #38.101-1 Table 5.3.2-1
+ #
+# 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 = 273;
+ pMax = 23;
+ #initialUplinkBWP
+ #genericParameters
+ initialULBWPlocationAndBandwidth = 1099;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ initialULBWPsubcarrierSpacing = 1;
+ #rach-ConfigCommon
+ #rach-ConfigGeneric
+ prach_ConfigurationIndex = 151;
+#prach_msg1_FDM
+#0 = one, 1=two, 2=four, 3=eight
+ prach_msg1_FDM = 0;
+ prach_msg1_FrequencyStart = 0;
+ zeroCorrelationZoneConfig = 0;
+ preambleReceivedTargetPower = -100;
+#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
+ preambleTransMax = 8;
+#powerRampingStep
+# 0=dB0,1=dB2,2=dB4,3=dB6
+ powerRampingStep = 1;
+#ra_ReponseWindow
+#1,2,4,8,10,20,40,80
+ ra_ResponseWindow = 5;
+#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
+#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
+ ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3;
+#oneHalf (0..15) 4,8,12,16,...60,64
+ ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15;
+#ra_ContentionResolutionTimer
+#(0..7) 8,16,24,32,40,48,56,64
+ ra_ContentionResolutionTimer = 7;
+ rsrp_ThresholdSSB = 19;
+#prach-RootSequenceIndex_PR
+#1 = 839, 2 = 139
+ prach_RootSequenceIndex_PR = 2;
+ prach_RootSequenceIndex = 1;
+ # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
+ #
+ msg1_SubcarrierSpacing = 1,
+# restrictedSetConfig
+# 0=unrestricted, 1=restricted type A, 2=restricted type B
+ restrictedSetConfig = 0,
+
+# this is the offset between the last PRACH preamble power and the Msg3 PUSCH, 2 times the field value in dB
+ msg3_DeltaPreamble = 2;
+ p0_NominalWithGrant = -96;
+
+# pucch-ConfigCommon setup :
+# pucchGroupHopping
+# 0 = neither, 1= group hopping, 2=sequence hopping
+ pucchGroupHopping = 0;
+ hoppingId = 0;
+ p0_nominal = -96;
+# ssb_PositionsInBurs_BitmapPR
+# 1=short, 2=medium, 3=long
+ ssb_PositionsInBurst_PR = 2;
+ ssb_PositionsInBurst_Bitmap = 0x1;
+
+# 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 = -15;
+ }
+
+ );
+
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+
+
+ ////////// AMF parameters:
+ amf_ip_address = ({ ipv4 = "172.21.6.103"; });
+
+ NETWORK_INTERFACES :
+ {
+ GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.18.20";
+ GNB_IPV4_ADDRESS_FOR_NGU = "172.21.18.20";
+ GNB_PORT_FOR_S1U = 2152; # Spec 2152
+ };
+ }
+);
+
+MACRLCs = (
+{
+ num_cc = 1;
+ tr_s_preference = "local_L1";
+ tr_n_preference = "local_RRC";
+ pusch_TargetSNRx10 = 100;
+ pucch_TargetSNRx10 = 200;
+ dl_bler_target_upper=.35;
+ dl_bler_target_lower=.15;
+ ul_bler_target_upper=.35;
+ ul_bler_target_lower=.15;
+ pusch_FailureThres = 1000;
+ ul_max_mcs = 28;
+}
+);
+
+L1s = (
+{
+ num_cc = 1;
+ tr_n_preference = "local_mac";
+ prach_dtx_threshold = 90;
+ pucch0_dtx_threshold = 80;
+ pusch_dtx_threshold = 10;
+ max_ldpc_iterations = 15;
+ tx_amp_backoff_dB = 12; # needs to match O-RU configuration
+ L1_rx_thread_core = 3;
+ L1_tx_thread_core = 4;
+ phase_compensation = 0; # needs to match O-RU configuration
+}
+);
+
+RUs = (
+{
+ local_rf = "no";
+ nb_tx = 4;
+ nb_rx = 4;
+ att_tx = 0
+ att_rx = 0;
+ bands = [78];
+ max_pdschReferenceSignalPower = -27;
+ max_rxgain = 75;
+ sf_extension = 0;
+ eNB_instances = [0];
+ ru_thread_core = 5;
+ sl_ahead = 10;
+ ##beamforming 1x2 matrix: 1 layer x 2 antennas
+ bf_weights = [0x00007fff, 0x0000,0x00007fff, 0x0000];
+ tr_preference = "raw_if4p5"; # important: activate FHI7.2
+ do_precoding = 0; # needs to match O-RU configuration
+}
+);
+
+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";
+ hw_log_level ="info";
+ phy_log_level ="info";
+ mac_log_level ="info";
+ rlc_log_level ="info";
+ pdcp_log_level ="info";
+ rrc_log_level ="info";
+ ngap_log_level ="info";
+ f1ap_log_level ="info";
+};
+
+fhi_72 = {
+ dpdk_devices = ("0000:c3:11.0", "0000:c3:11.1");
+ system_core = 0;
+ io_core = 1;
+ worker_cores = (2);
+ du_addr = ("00:11:22:33:44:66", "00:11:22:33:44:67");
+ ru_addr = ("70:b3:d5:e1:5b:81", "70:b3:d5:e1:5b:81");
+ mtu = 9216;
+ file_prefix = "fhi_72";
+ fh_config = ({
+ Tadv_cp_dl = 125;
+ T2a_cp_dl = (259, 500);
+ T2a_cp_ul = (25, 500);
+ T2a_up = (134, 375);
+ Ta3 = (152, 160);
+ T1a_cp_dl = (419, 470);
+ T1a_cp_ul = (285, 336);
+ T1a_up = (294, 345);
+ Ta4 = (0, 200);
+ ru_config = {
+ iq_width = 9;
+ iq_width_prach = 9;
+ };
+ prach_config = {
+ eAxC_offset = 4;
+ };
+ });
+};
diff --git a/ci-scripts/docker/Dockerfile.cppcheck.xenial b/ci-scripts/docker/Dockerfile.cppcheck.xenial
index f69d4a8402..0d6aa029ff 100644
--- a/ci-scripts/docker/Dockerfile.cppcheck.xenial
+++ b/ci-scripts/docker/Dockerfile.cppcheck.xenial
@@ -1,5 +1,32 @@
+#/*
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements. See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# * http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# * contact@openairinterface.org
+# */
+#---------------------------------------------------------------------
+#
+# Dockerfile for the Open-Air-Interface BUILD service
+# Valid for Ubuntu 22.04
+#
+#---------------------------------------------------------------------
FROM ubuntu:xenial AS oai-cppcheck
+
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
diff --git a/ci-scripts/docker/Dockerfile.formatting.bionic b/ci-scripts/docker/Dockerfile.formatting.bionic
index 47fd2a08d0..a8d58f511c 100644
--- a/ci-scripts/docker/Dockerfile.formatting.bionic
+++ b/ci-scripts/docker/Dockerfile.formatting.bionic
@@ -1,3 +1,30 @@
+#/*
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements. See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# * http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# * contact@openairinterface.org
+# */
+#---------------------------------------------------------------------
+#
+# Dockerfile for the Open-Air-Interface BUILD service
+# Valid for Ubuntu 22.04
+#
+#---------------------------------------------------------------------
+
FROM ubuntu:bionic AS oai-formatting-check
ARG MERGE_REQUEST
diff --git a/ci-scripts/docker/Dockerfile.unittest.ubuntu22 b/ci-scripts/docker/Dockerfile.unittest.ubuntu22
index 21805560d4..4401761c02 100644
--- a/ci-scripts/docker/Dockerfile.unittest.ubuntu22
+++ b/ci-scripts/docker/Dockerfile.unittest.ubuntu22
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
-FROM ran-base:develop as ran-tests
+FROM ran-base:develop AS ran-tests
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
diff --git a/ci-scripts/epc.py b/ci-scripts/epc.py
index fb5aa8cde6..7c0eb51853 100644
--- a/ci-scripts/epc.py
+++ b/ci-scripts/epc.py
@@ -48,6 +48,7 @@ import helpreadme as HELP
import constants as CONST
import cls_cluster as OC
import cls_cmd
+import cls_module
#-----------------------------------------------------------
# Class Declaration
#-----------------------------------------------------------
@@ -75,6 +76,7 @@ class EPCManagement():
self.OCRegistry = "default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/"
self.OCUserName = ''
self.OCPassword = ''
+ self.cnID = ''
self.imageToPull = ''
self.eNBSourceCodePath = ''
@@ -298,7 +300,8 @@ class EPCManagement():
html_cell += '(' + res4.group('date') + ')'
html_cell += '\n'
elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE):
- succeeded, report = OC.OC_deploy_CN(mySSH, self.OCUserName, self.OCPassword)
+ cn = cls_module.Module_UE(self.cnID)
+ succeeded, report = OC.OC_deploy_CN(mySSH, self.OCUserName, self.OCPassword, cn.getNamespace(), cn.getCNPath())
if not succeeded:
HTML.CreateHtmlTestRow('N/A', 'KO', report)
HTML.CreateHtmlTabFooter(False)
@@ -575,7 +578,8 @@ class EPCManagement():
mySSH.copyin(f'{self.SourceCodePath}/logs/test_logs_CN.zip','test_logs_CN.zip')
logging.debug(message)
elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE):
- succeeded, report = OC.OC_undeploy_CN(mySSH, self.OCUserName, self.OCPassword)
+ cn = cls_module.Module_UE(self.cnID)
+ succeeded, report = OC.OC_undeploy_CN(mySSH, self.OCUserName, self.OCPassword, cn.getNamespace(), cn.getCNPath())
if not succeeded:
HTML.CreateHtmlTestRow('N/A', 'KO', report)
HTML.CreateHtmlTabFooter(False)
diff --git a/ci-scripts/main.py b/ci-scripts/main.py
index 8f1235d8b4..ed002c1fa2 100644
--- a/ci-scripts/main.py
+++ b/ci-scripts/main.py
@@ -337,11 +337,13 @@ def GetParametersFromXML(action):
string_field = test.findtext('args')
if (string_field is not None):
EPC.cfgDeploy = string_field
+ EPC.cnID = test.findtext('cn_id')
elif action == 'Terminate_5GCN':
string_field = test.findtext('args')
if (string_field is not None):
EPC.cfgUnDeploy = string_field
+ EPC.cnID = test.findtext('cn_id')
elif action == 'Deploy_Object' or action == 'Undeploy_Object':
eNB_instance=test.findtext('eNB_instance')
diff --git a/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2.xml b/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2.xml
new file mode 100644
index 0000000000..bac2ec38a0
--- /dev/null
+++ b/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2.xml
@@ -0,0 +1,143 @@
+
+
+ test-5g-fhi72-vvdn
+ 100 MHz TDD SA VVDN
+ tasks
+ 1
+
+ 200000
+ 110000
+ 120000
+ 102000
+ 102001
+ 100100
+ 100010
+ 100020
+ 100030
+ 100040
+ 103000
+ 100002
+ 130000
+
+
+
+
+ Custom_Command
+ Setup sriov and network interfaces VVDN
+ cacofonix
+ /opt/FHI7.2/setup_sriov_vvdn.sh
+ yes
+
+
+
+ Pull_Cluster_Image
+ Pull Images from Cluster
+ oaicicd-ran
+ oai-gnb-fhi72
+
+
+
+ Deploy_Object
+ Deploy gNB (TDD/Band78/100MHz/VVDN) in a container
+ ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb
+ 0
+ 0
+
+
+
+ Attach_UE
+ Attach UE
+ up2-fhi72
+
+
+
+ Ping
+ Ping: 100 pings in 10 sec
+ up2-fhi72
+ -c 100 -i 0.1 172.21.6.104
+ 1
+ 15
+
+
+
+ Iperf
+ iperf (DL/300Mbps/UDP)(30 sec)(multi-ue profile)
+ -u -b 300M -t 30 -R
+ up2-fhi72
+ 20
+ 80
+ balanced
+ oc-cn5g-20897
+
+
+
+ Iperf
+ iperf (DL/TCP)(30 sec)(multi-ue profile)
+ -t 30 -R
+ up2-fhi72
+ 40
+ oc-cn5g-20897
+
+
+
+ Iperf
+ iperf (UL/70Mbps/UDP)(30 sec)(multi-ue profile)
+ -u -b 70M -t 30
+ up2-fhi72
+ 20
+ 80
+ balanced
+ oc-cn5g-20897
+
+
+
+ Iperf
+ iperf (UL/TCP)(30 sec)(multi-ue profile)
+ -t 30
+ up2-fhi72
+ 40
+ oc-cn5g-20897
+
+
+
+ Detach_UE
+ Detach UE
+ up2-fhi72
+
+
+
+ IdleSleep
+ Sleep
+ 5
+
+
+
+ Undeploy_Object
+ Undeploy gNB
+ ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb
+ 0
+ 0
+
+
+
diff --git a/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2_cleanup.xml b/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2_cleanup.xml
new file mode 100644
index 0000000000..1a9aecfc8a
--- /dev/null
+++ b/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2_cleanup.xml
@@ -0,0 +1,63 @@
+
+
+ cleanup-fhi72-vvdn
+ Cleanup VVDN
+ trash
+
+ 555555
+ 666666
+ 777777
+ 888888
+
+
+
+
+ Detach_UE
+ Detach UE
+ up2-fhi72
+
+
+
+ Undeploy_Object
+ Undeploy gNB
+ ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb
+ 0
+ 0
+
+
+
+ Clean_Test_Server_Images
+ Clean Test Images on Test Server
+ 0
+
+
+
+ Custom_Command
+ Set CPU to idle state, set kernel parameters to default values
+ cacofonix
+ /opt/FHI7.2/setup_cleanup.sh
+ yes
+
+
+
diff --git a/ci-scripts/xml_files/sa_cn5g_20897_closure.xml b/ci-scripts/xml_files/sa_cn5g_20897_closure.xml
new file mode 100644
index 0000000000..685775c1a4
--- /dev/null
+++ b/ci-scripts/xml_files/sa_cn5g_20897_closure.xml
@@ -0,0 +1,38 @@
+
+
+ cn5g-closure
+ CN5G-Closure
+ log-out
+
+ 060000
+
+
+
+
+ Terminate_5GCN
+ Terminate 5G Core
+ oc-cn5g-20897
+
+
+
diff --git a/ci-scripts/xml_files/sa_cn5g_20897_start.xml b/ci-scripts/xml_files/sa_cn5g_20897_start.xml
new file mode 100644
index 0000000000..2d60baedc1
--- /dev/null
+++ b/ci-scripts/xml_files/sa_cn5g_20897_start.xml
@@ -0,0 +1,38 @@
+
+
+ cn5g-start-tab
+ CN5G-Start
+ log-in
+
+ 000100
+
+
+
+
+
+ Initialize_5GCN
+ Initialize 5G Core
+ oc-cn5g-20897
+
+
diff --git a/ci-scripts/xml_files/sa_cn5g_closure.xml b/ci-scripts/xml_files/sa_cn5g_closure.xml
index 7174da3b7b..727e208d4c 100644
--- a/ci-scripts/xml_files/sa_cn5g_closure.xml
+++ b/ci-scripts/xml_files/sa_cn5g_closure.xml
@@ -32,6 +32,7 @@
Terminate_5GCN
Terminate 5G Core
+ oc-cn5g
diff --git a/ci-scripts/xml_files/sa_cn5g_start.xml b/ci-scripts/xml_files/sa_cn5g_start.xml
index 6499d60700..3de615330a 100644
--- a/ci-scripts/xml_files/sa_cn5g_start.xml
+++ b/ci-scripts/xml_files/sa_cn5g_start.xml
@@ -33,5 +33,6 @@
Initialize_5GCN
Initialize 5G Core
+ oc-cn5g
diff --git a/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/README.md b/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/README.md
new file mode 100644
index 0000000000..c9cf235bb2
--- /dev/null
+++ b/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/README.md
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+ |
+
+ OAI O-RAN 7.2 Front-haul Docker Compose
+ |
+
+
+
+For instructions on OAI gNB Docker deployment with FH 7.2 RU, please refer to the [README](../sa_fhi_7.2_vvdn_gnb/README.md).
diff --git a/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/docker-compose.yml
new file mode 100644
index 0000000000..5783964bbe
--- /dev/null
+++ b/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/docker-compose.yml
@@ -0,0 +1,40 @@
+services:
+ oai-gnb:
+ image: oai-gnb-fhi72:latest
+ cap_add:
+ - SYS_ADMIN
+ - IPC_LOCK
+ - SYS_NICE
+ cap_drop:
+ - ALL
+ container_name: oai-gnb
+ environment:
+ TZ: Europe/Paris
+ USE_ADDITIONAL_OPTIONS: --sa --thread-pool 6,7,8,9
+ devices:
+ - /dev/vfio:/dev/vfio/
+ volumes:
+ - ../../conf_files/gnb.sa.band78.273prb.fhi72.4x4-benetel550.conf:/opt/oai-gnb/etc/gnb.conf
+ - /dev/hugepages:/dev/hugepages
+ # Please change these values based on your system
+ cpuset: "0,1,2,3,4,5,6,7,8,9"
+ networks:
+ oai-net:
+ ipv4_address: 172.21.18.20
+ healthcheck:
+ test: /bin/bash -c "pgrep nr-softmodem"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+networks:
+ oai-net:
+ driver: macvlan
+ name: oai-net
+ ipam:
+ config:
+ - subnet: "172.21.16.0/22"
+ ip_range: "172.21.18.20/32"
+ gateway: "172.21.19.254"
+ driver_opts:
+ com.docker.network.bridge.name: "oai-net"
+ parent: ens7f0
diff --git a/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/setup_cleanup.sh b/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/setup_cleanup.sh
new file mode 100644
index 0000000000..9a06336acc
--- /dev/null
+++ b/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/setup_cleanup.sh
@@ -0,0 +1,5 @@
+set -e
+sudo cpupower idle-set -E > /dev/null
+sudo sysctl kernel.sched_rt_runtime_us=950000
+sudo sysctl kernel.timer_migration=1
+exit 0
diff --git a/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/setup_sriov_benetel.sh b/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/setup_sriov_benetel.sh
new file mode 100644
index 0000000000..1bcf941ae0
--- /dev/null
+++ b/ci-scripts/yaml_files/sa_fhi_7.2_benetel550_gnb/setup_sriov_benetel.sh
@@ -0,0 +1,22 @@
+set -e
+sudo cpupower idle-set -D 0 > /dev/null
+sudo sysctl kernel.sched_rt_runtime_us=-1
+sudo sysctl kernel.timer_migration=0
+sudo ethtool -G ens7f1 rx 8160
+sudo ethtool -G ens7f1 tx 8160
+sudo ifconfig ens7f1 mtu 9216
+sudo sh -c 'echo 0 > /sys/class/net/ens7f1/device/sriov_numvfs'
+sudo sh -c 'echo 2 > /sys/class/net/ens7f1/device/sriov_numvfs'
+sudo modprobe -r iavf
+sudo modprobe iavf
+# this next 2 lines is for C/U planes
+sudo ip link set ens7f1 vf 0 mac 00:11:22:33:44:66 vlan 3 qos 0 spoofchk off mtu 9216
+sudo ip link set ens7f1 vf 1 mac 00:11:22:33:44:67 vlan 3 qos 0 spoofchk off mtu 9216
+sleep 1
+# These are the DPDK bindings for C/U-planes on vlan 3
+sudo /usr/local/bin/dpdk-devbind.py --unbind c3:11.0
+sudo /usr/local/bin/dpdk-devbind.py --unbind c3:11.1
+sudo modprobe vfio-pci
+sudo /usr/local/bin/dpdk-devbind.py --bind vfio-pci c3:11.0
+sudo /usr/local/bin/dpdk-devbind.py --bind vfio-pci c3:11.1
+exit 0
diff --git a/ci-scripts/yaml_files/sa_fhi_7.2_gnb/README.md b/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/README.md
similarity index 74%
rename from ci-scripts/yaml_files/sa_fhi_7.2_gnb/README.md
rename to ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/README.md
index 1acbe7fb86..2fcf39ad2c 100644
--- a/ci-scripts/yaml_files/sa_fhi_7.2_gnb/README.md
+++ b/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/README.md
@@ -14,35 +14,35 @@

-This docker-compose is designed to use `OAI-gNB` with a 7.2 compatible Radio Unit. Before using this docker compose you have to configure
-the host machine as per the [ORAN_FHI7.2_Tutorial](../../../doc/ORAN_FHI7.2_Tutorial.md). The container image used by the docker compose file is tested only on `Ubuntu 22.04` docker host.
+This docker-compose is designed to use `OAI-gNB` with a 7.2 compatible Radio Unit. Before using this docker compose you have to configure
+the host machine as per the [ORAN_FHI7.2_Tutorial](../../../doc/ORAN_FHI7.2_Tutorial.md). The container image used by the docker compose file is tested only on `Ubuntu 22.04` and `RHEL 9.4` docker host.
## Build Image (Optional)
Refer to [OAI Docker/Podman Build and Usage Procedures](../../../docker/README.md)
-## Configure Networking
+## Configure Networking
### SR-IOV Virtual Functions (VFs)
-In docker-compose environment there is no automated method
-to configure the VFs on the fly. The user will have to manually configure
-C/U plane VFs before starting the container `OAI-gNB`.
+In docker-compose environment there is no automated method
+to configure the VFs on the fly. The user will have to manually configure
+C/U plane VFs before starting the container `OAI-gNB`.
-You can follow the step
+You can follow the step
[configure-network-interfaces-and-dpdk-vfs](../../../doc/ORAN_FHI7.2_Tutorial.md#configure-network-interfaces-and-dpdk-vfs).
### Interface towards AMF (N2)
-For `N2` interface we are using `macvlan` driver of docker.
+For `N2` interface we are using `macvlan` driver of docker.
-You can use the `bridge` driver, in situation
+You can use the `bridge` driver, in situation
-- When the core network is running on the same machine
-- or different machine but you have configured
-needed `ip route` and forwarding to access the core network from RAN host.
+- When the core network is running on the same machine
+- or different machine but you have configured
+needed `ip route` and forwarding to access the core network from RAN host.
-To configure docker `macvlan` network
+To configure docker `macvlan` network
you need to choose `ipam.config` and `driver_opts.parent` are per your environment
```
@@ -59,7 +59,7 @@ you need to choose `ipam.config` and `driver_opts.parent` are per your environme
parent: enp193s0f0
```
-To configure `bridge` network you need to choose `ipam.config.subnet` as per your environment.
+To configure `bridge` network you need to choose `ipam.config.subnet` as per your environment.
```
oai-net:
@@ -74,7 +74,7 @@ To configure `bridge` network you need to choose `ipam.config.subnet` as per you
## Deploy OAI-gNB Container
-The [configuration file](../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.273prb.fhi72.4x4-benetel650.conf) used by docker compose is configured for Benetel 650 RU (RAN650-1v1.0.4-dda1bf5).
+The [configuration file](../../conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf) used by docker compose is configured for VVDN RU.
```bash
docker-compose up -d
diff --git a/ci-scripts/yaml_files/sa_fhi_7.2_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/docker-compose.yml
similarity index 65%
rename from ci-scripts/yaml_files/sa_fhi_7.2_gnb/docker-compose.yml
rename to ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/docker-compose.yml
index e3e93b3b74..2798a8e8fc 100644
--- a/ci-scripts/yaml_files/sa_fhi_7.2_gnb/docker-compose.yml
+++ b/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/docker-compose.yml
@@ -1,17 +1,23 @@
services:
oai-gnb:
image: oai-gnb-fhi72:latest
- privileged: true
+ cap_add:
+ - SYS_ADMIN
+ - IPC_LOCK
+ - SYS_NICE
+ cap_drop:
+ - ALL
container_name: oai-gnb
environment:
TZ: Europe/Paris
- USE_ADDITIONAL_OPTIONS: --sa --thread-pool 13,14,15,16,17,18
+ USE_ADDITIONAL_OPTIONS: --sa --thread-pool 6,7,8,9
devices:
- /dev/vfio:/dev/vfio/
volumes:
- - ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.273prb.fhi72.4x4-benetel650.conf:/opt/oai-gnb/etc/gnb.conf
+ - ../../conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf:/opt/oai-gnb/etc/gnb.conf
- /dev/hugepages:/dev/hugepages
- cpuset: "0,1,2,8,9,10,13,14,15,16,17,18"
+ # Please change these values based on your system
+ cpuset: "0,1,2,3,4,5,6,7,8,9"
networks:
oai-net:
ipv4_address: 172.21.18.20
@@ -31,4 +37,4 @@ networks:
gateway: "172.21.19.254"
driver_opts:
com.docker.network.bridge.name: "oai-net"
- parent: enp193s0f0
+ parent: ens7f0
diff --git a/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/setup_cleanup.sh b/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/setup_cleanup.sh
new file mode 100644
index 0000000000..9a06336acc
--- /dev/null
+++ b/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/setup_cleanup.sh
@@ -0,0 +1,5 @@
+set -e
+sudo cpupower idle-set -E > /dev/null
+sudo sysctl kernel.sched_rt_runtime_us=950000
+sudo sysctl kernel.timer_migration=1
+exit 0
diff --git a/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/setup_sriov_vvdn.sh b/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/setup_sriov_vvdn.sh
new file mode 100644
index 0000000000..2b7a512f83
--- /dev/null
+++ b/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/setup_sriov_vvdn.sh
@@ -0,0 +1,21 @@
+set -e
+sudo cpupower idle-set -D 0 > /dev/null
+sudo sysctl kernel.sched_rt_runtime_us=-1
+sudo sysctl kernel.timer_migration=0
+sudo ethtool -G ens7f1 rx 8160
+sudo ethtool -G ens7f1 tx 8160
+sudo sh -c 'echo 0 > /sys/class/net/ens7f1/device/sriov_numvfs'
+sudo sh -c 'echo 2 > /sys/class/net/ens7f1/device/sriov_numvfs'
+sudo modprobe -r iavf
+sudo modprobe iavf
+# this next 2 lines is for C/U planes
+sudo ip link set ens7f1 vf 0 mac 76:76:64:6e:00:01 vlan 4 spoofchk off mtu 9216
+sudo ip link set ens7f1 vf 1 mac 76:76:64:6e:00:00 vlan 4 spoofchk off mtu 9216
+sleep 1
+# These are the DPDK bindings for C/U-planes on vlan 4
+sudo /usr/local/bin/dpdk-devbind.py --unbind c3:11.0
+sudo /usr/local/bin/dpdk-devbind.py --unbind c3:11.1
+sudo modprobe vfio-pci
+sudo /usr/local/bin/dpdk-devbind.py --bind vfio-pci c3:11.0
+sudo /usr/local/bin/dpdk-devbind.py --bind vfio-pci c3:11.1
+exit 0
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 3e688923fb..cd7e326be8 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -85,7 +85,7 @@ Options:
--RU
Makes the OAI RRU
--UE
- Makes the UE specific parts (ue_ip, usim, nvram) from the given configuration file
+ Makes the UE specific parts (usim, nvram) from the given configuration file
--nrUE
Makes the NR UE softmodem
--UE-conf-nvram [configuration file]
@@ -271,9 +271,6 @@ function main() {
--UE-gen-nvram)
gen_nvram_path=$(readlink -f "$2")
shift 2;;
- --UE-ip)
- TARGET_LIST="$TARGET_LIST ue_ip"
- shift;;
-w | --hardware)
case "$2" in
"USRP" | "BLADERF" | "LMSSDR" | "IRIS")
diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index 356229762f..ac336478df 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -171,10 +171,6 @@ clean_kernel() {
$SUDO iptables -t filter -F
$SUDO iptables -t raw -F
echo_info "Flushed iptables"
- $SUDO rmmod nasmesh > /dev/null 2>&1
- $SUDO rmmod oai_nw_drv > /dev/null 2>&1
- $SUDO rmmod ue_ip > /dev/null 2>&1
- echo_info "removed drivers from kernel"
}
clean_all_files() {
diff --git a/cmake_targets/tools/init_nas_nos1 b/cmake_targets/tools/init_nas_nos1
deleted file mode 100755
index a94639026a..0000000000
--- a/cmake_targets/tools/init_nas_nos1
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-
-#/*
-# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
-# * contributor license agreements. See the NOTICE file distributed with
-# * this work for additional information regarding copyright ownership.
-# * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
-# * except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.openairinterface.org/?page_id=698
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-# *-------------------------------------------------------------------------------
-# * For more information about the OpenAirInterface (OAI) Software Alliance:
-# * contact@openairinterface.org
-# */
-
-# file init_nas_nos1
-# brief loads the nasmesh module and sets up the radio bearers (used to provide ip interface without S1 interface)
-# author Florian Kaltenberger
-#
-#######################################
-
-load_module() {
- mod_name=${1##*/}
- mod_name=${mod_name%.*}
- if awk "/$mod_name/ {found=1 ;exit} END {if (found!=1) exit 1}" /proc/modules
- then
- echo "module $mod_name already loaded: I remove it first"
- sudo rmmod $mod_name
- fi
- echo loading $mod_name
- sudo insmod $1
-}
-
-load_module $OPENAIR_DIR/cmake_targets/ran_build/build/nasmesh.ko
-
-if [ "$1" = "eNB" ]; then
- echo "bring up oai0 interface for enb"
- sudo ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
- $OPENAIR_DIR/cmake_targets/ran_build/build/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.2 -r 1
-else
- if [ "$1" = "UE" ]; then
- echo "bring up oai0 interface for UE"
- sudo ifconfig oai0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255
- $OPENAIR_DIR/cmake_targets/ran_build/build/rb_tool -a -c0 -i0 -z0 -s 10.0.1.2 -t 10.0.1.1 -r 1
- fi
-fi
diff --git a/cmake_targets/tools/init_nas_s1 b/cmake_targets/tools/init_nas_s1
deleted file mode 100755
index deee97634c..0000000000
--- a/cmake_targets/tools/init_nas_s1
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/bash
-
-#WARNING: this file may not work properly, be sure to know what you
-#do when using it
-
-#/*
-# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
-# * contributor license agreements. See the NOTICE file distributed with
-# * this work for additional information regarding copyright ownership.
-# * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
-# * except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# * http://www.openairinterface.org/?page_id=698
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-# *-------------------------------------------------------------------------------
-# * For more information about the OpenAirInterface (OAI) Software Alliance:
-# * contact@openairinterface.org
-# */
-
-################################################################################
-# file init_nas_s1
-# brief loads the ue_ip module and sets up IP for the UE
-# you may want to edit it to fit your settings (replace oip0 by oipX for
-# instance)
-# author Florian Kaltenberger
-#
-#######################################
-
-LTEIF=oip1
-#OPENAIR_DIR=/home/oai/svn-oai/openair4G
-
-load_module() {
- mod_name=${1##*/}
- mod_name=${mod_name%.*}
- if awk "/$mod_name/ {found=1 ;exit} END {if (found!=1) exit 1}" /proc/modules
- then
- echo "module $mod_name already loaded: I remove it first"
- sudo rmmod $mod_name
- fi
- echo loading $mod_name
- sudo insmod $1
-}
-
-load_module ../ran_build/build/ue_ip.ko
-
-if [ "$1" = "UE" ]; then
- echo "bring up $LTEIF interface for UE"
- sudo ifconfig $LTEIF up
-fi
-
-sudo ip route flush cache
-sleep 1
-sudo sysctl -w net.ipv4.conf.all.log_martians=1
-echo "Disabling reverse path filtering"
-sudo sysctl -w net.ipv4.conf.all.rp_filter=0
-sudo ip route flush cache
-
-# Check table 200 lte in /etc/iproute2/rt_tables
-fgrep lte /etc/iproute2/rt_tables > /dev/null
-if [ $? -ne 0 ]; then
- echo "200 lte " >> /etc/iproute2/rt_tables
-fi
-sudo ip rule add fwmark 1 table lte
-sudo ip route add default dev $LTEIF table lte
diff --git a/common/config/DOC/config/rtusage.md b/common/config/DOC/config/rtusage.md
index 42ef93bffc..3b51e1afd2 100644
--- a/common/config/DOC/config/rtusage.md
+++ b/common/config/DOC/config/rtusage.md
@@ -68,7 +68,6 @@ To get help on supported parameters you can use specific options:
--worker-config: two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'
--nbiot-disable: disable nb-iot, even if defined in config
--noS1: Disable s1 interface
- --nokrnmod: (noS1 only): Use tun instead of namesh module
--------------------------------------------------------------------
[LIBCONFIG] (root): 4/4 parameters successfully set, (4 to default value)
diff --git a/common/utils/CMakeLists.txt b/common/utils/CMakeLists.txt
index 932f458a77..025091249b 100644
--- a/common/utils/CMakeLists.txt
+++ b/common/utils/CMakeLists.txt
@@ -13,6 +13,6 @@ add_subdirectory(T)
add_subdirectory(nr)
add_subdirectory(LOG)
add_subdirectory(threadPool)
-add_library(utils utils.c system.c time_meas.c time_stat.c)
+add_library(utils utils.c system.c time_meas.c time_stat.c tun_if.c)
target_include_directories(utils PUBLIC .)
target_link_libraries(utils PRIVATE ${T_LIB})
diff --git a/common/utils/telnetsrv/telnetsrv_5Gue_measurements.c b/common/utils/telnetsrv/telnetsrv_5Gue_measurements.c
index bdf508e6ef..82f791cd2a 100644
--- a/common/utils/telnetsrv/telnetsrv_5Gue_measurements.c
+++ b/common/utils/telnetsrv/telnetsrv_5Gue_measurements.c
@@ -86,7 +86,15 @@ int get_measurgroups(telnet_measurgroupdef_t **measurgroups) {
void measurcmd_display_phycpu(telnet_printfunc_t prnt) {
PHY_VARS_NR_UE *UE = PHY_vars_UE_g[0][0];
- telnet_cpumeasurdef_t cpumeasur[]=CPU_PHYNRUE_MEASURE;
+ telnet_cpumeasurdef_t cpumeasur[MAX_CPU_STAT_TYPE];
+ for (int i = 0; i < MAX_CPU_STAT_TYPE; i++) {
+ sprintf(cpumeasur[i].statname, "%s", UE->phy_cpu_stats.cpu_time_stats[i].meas_name);
+ cpumeasur[i].astatptr = &UE->phy_cpu_stats.cpu_time_stats[i];
+ cpumeasur[i].statemask = 0;
+ cpumeasur[i].num_occur1 = 1;
+ cpumeasur[i].num_occur2 = 0;
+ cpumeasur[i].num_occur3 = 0;
+ }
prnt("%s cpu (%1.1g GHz) measurements: PHY (cpustats %s) %s\n",HDR,cpufreq,
PRINT_CPUMEAS_STATE,HDR);
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
diff --git a/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h b/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h
index bbc9cb664d..896c42d08a 100644
--- a/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h
+++ b/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h
@@ -95,51 +95,4 @@
{"ip_pdcp", &(pdcpvars->ip_pdcp),0,1},\
}
-/* from openair1/PHY/defs_nr_UE.h */
-#define CPU_PHYNRUE_MEASURE \
-{ \
- {"phy_proc", &(UE->phy_proc),0,1},\
- {"phy_proc_rx", &(UE-> phy_proc_rx),0,1},\
- {"phy_proc_tx", &(UE->phy_proc_tx),0,1},\
- {"ue_ul_indication_stats", &(UE->ue_ul_indication_stats),0,1},\
- {"ofdm_mod_stats", &(UE->ofdm_mod_stats),0,1},\
- {"ulsch_encoding_stats", &(UE->ulsch_encoding_stats),0,1},\
- {"ulsch_modulation_stats", &(UE->ulsch_modulation_stats),0,1},\
- {"ulsch_segmentation_stats", &(UE->ulsch_segmentation_stats),0,1},\
- {"ulsch_rate_matching_stats", &(UE->ulsch_rate_matching_stats),0,1},\
- {"ulsch_ldpc_encoding_stats", &(UE->ulsch_ldpc_encoding_stats),0,1},\
- {"ulsch_interleaving_stats", &(UE->ulsch_interleaving_stats),0,1},\
- {"ulsch_multiplexing_stats", &(UE->ulsch_multiplexing_stats),0,1},\
- {"ofdm_demod_stats", &(UE->ofdm_demod_stats),0,1},\
- {"dlsch_rx_pdcch_stats", &(UE->dlsch_rx_pdcch_stats),0,1},\
- {"rx_dft_stats", &(UE->rx_dft_stats),0,1},\
- {"dlsch_c...timation_stats", &(UE->dlsch_channel_estimation_stats),0,1},\
- {"dlsch_f...timation_stats", &(UE->dlsch_freq_offset_estimation_stats),0,1},\
- {"dlsch_demodulation_stats", &(UE->dlsch_demodulation_stats),0,1},\
- {"dlsch_rate_unmatching_stats", &(UE->dlsch_rate_unmatching_stats),0,1},\
- {"dlsch_ldpc_decoding_stats", &(UE->dlsch_ldpc_decoding_stats),0,1},\
- {"dlsch_deinterleaving_stats", &(UE->dlsch_deinterleaving_stats),0,1},\
- {"dlsch_llr_stats", &(UE->dlsch_llr_stats),0,1},\
- {"dlsch_unscrambling_stats", &(UE->dlsch_unscrambling_stats),0,1},\
- {"dlsch_rate_matching_stats", &(UE->dlsch_rate_matching_stats),0,1},\
- {"dlsch_ldpc_encoding_stats", &(UE->dlsch_ldpc_encoding_stats),0,1},\
- {"dlsch_interleaving_stats", &(UE->dlsch_interleaving_stats),0,1},\
- {"dlsch_tc_init_stats", &(UE->dlsch_tc_init_stats),0,1},\
- {"dlsch_tc_alpha_stats", &(UE->dlsch_tc_alpha_stats),0,1},\
- {"dlsch_tc_beta_stats", &(UE->dlsch_tc_beta_stats),0,1},\
- {"dlsch_tc_gamma_stats", &(UE->dlsch_tc_gamma_stats),0,1},\
- {"dlsch_tc_ext_stats", &(UE->dlsch_tc_ext_stats),0,1},\
- {"dlsch_tc_intl1_stats", &(UE->dlsch_tc_intl1_stats),0,1},\
- {"dlsch_tc_intl2_stats", &(UE->dlsch_tc_intl2_stats),0,1},\
- {"tx_prach", &(UE->tx_prach),0,1},\
- {"ue_front_end_stat", &(UE->ue_front_end_stat),0,1},\
- {"ue_front_end_per_slot_stat", &(UE->ue_front_end_per_slot_stat[0]),0,LTE_SLOTS_PER_SUBFRAME},\
- {"pdcch_procedures_stat", &(UE->pdcch_procedures_stat),0,1},\
- {"rx_pdsch_stats", &(UE->rx_pdsch_stats), 0, 1}, \
- {"pdsch_procedures_stat", &(UE->pdsch_procedures_stat),0,1},\
- {"pdsch_procedures_per_slot_stat", &(UE->pdsch_procedures_per_slot_stat[0]),0,LTE_SLOTS_PER_SUBFRAME},\
- {"dlsch_procedures_stat", &(UE->dlsch_procedures_stat),0,1},\
- {"dlsch_decoding_stats", &(UE->dlsch_decoding_stats),0,1},\
- {"dlsch_llr_stats_para", &(UE->dlsch_llr_stats_parallelization[0]),0,LTE_SLOTS_PER_SUBFRAME},\
-}
#endif
diff --git a/common/utils/tun_if.c b/common/utils/tun_if.c
new file mode 100644
index 0000000000..4d04325998
--- /dev/null
+++ b/common/utils/tun_if.c
@@ -0,0 +1,283 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ * contact@openairinterface.org
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "tun_if.h"
+#include "common/platform_constants.h"
+#include "common/utils/LOG/log.h"
+#include "common/utils/system.h"
+
+int nas_sock_fd[MAX_MOBILES_PER_ENB * 2]; // Allocated for both LTE UE and NR UE.
+int nas_sock_mbms_fd;
+
+static int tun_alloc(char *dev)
+{
+ struct ifreq ifr;
+ int fd, err;
+
+ if ((fd = open("/dev/net/tun", O_RDWR)) < 0) {
+ LOG_E(UTIL, "failed to open /dev/net/tun\n");
+ return -1;
+ }
+
+ memset(&ifr, 0, sizeof(ifr));
+ /* Flags: IFF_TUN - TUN device (no Ethernet headers)
+ * IFF_TAP - TAP device
+ *
+ * IFF_NO_PI - Do not provide packet information
+ */
+ ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
+
+ if (*dev)
+ strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name) - 1);
+
+ if ((err = ioctl(fd, TUNSETIFF, (void *)&ifr)) < 0) {
+ close(fd);
+ return err;
+ }
+
+ strcpy(dev, ifr.ifr_name);
+ return fd;
+}
+
+int tun_init_mbms(char *ifprefix, int id)
+{
+ int ret;
+ char ifname[64];
+
+ sprintf(ifname, "%s%d", ifprefix, id);
+ nas_sock_mbms_fd = tun_alloc(ifname);
+
+ if (nas_sock_mbms_fd == -1) {
+ LOG_E(UTIL, "Error opening mbms socket %s (%d:%s)\n", ifname, errno, strerror(errno));
+ exit(1);
+ }
+
+ LOG_D(UTIL, "Opened socket %s with fd %d\n", ifname, nas_sock_mbms_fd);
+ ret = fcntl(nas_sock_mbms_fd, F_SETFL, O_NONBLOCK);
+
+ if (ret == -1) {
+ LOG_E(UTIL, "Error fcntl (%d:%s)\n", errno, strerror(errno));
+ return 0;
+ }
+
+ struct sockaddr_nl nas_src_addr = {0};
+ nas_src_addr.nl_family = AF_NETLINK;
+ nas_src_addr.nl_pid = 1;
+ nas_src_addr.nl_groups = 0; /* not in mcast groups */
+ ret = bind(nas_sock_mbms_fd, (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr));
+
+ return 1;
+}
+
+int tun_init(const char *ifprefix, int num_if, int id)
+{
+ int ret;
+ char ifname[64];
+
+ int begx = (id == 0) ? 0 : id - 1;
+ int endx = (id == 0) ? num_if : id;
+ for (int i = begx; i < endx; i++) {
+ sprintf(ifname, "%s%d", ifprefix, i + 1);
+ nas_sock_fd[i] = tun_alloc(ifname);
+
+ if (nas_sock_fd[i] == -1) {
+ LOG_E(UTIL, "Error opening socket %s (%d:%s)\n", ifname, errno, strerror(errno));
+ return 0;
+ }
+
+ LOG_I(UTIL, "Opened socket %s with fd nas_sock_fd[%d]=%d\n", ifname, i, nas_sock_fd[i]);
+ ret = fcntl(nas_sock_fd[i], F_SETFL, O_NONBLOCK);
+
+ if (ret == -1) {
+ LOG_E(UTIL, "Error fcntl (%d:%s)\n", errno, strerror(errno));
+
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+/*
+ * \brief set a genneric interface parameter
+ * \param ifn the name of the interface to modify
+ * \param if_addr the address that needs to be modified
+ * \param operation one of SIOCSIFADDR (set interface address), SIOCSIFNETMASK
+ * (set network mask), SIOCSIFBRDADDR (set broadcast address), SIOCSIFFLAGS
+ * (set flags)
+ * \return true on success, false otherwise
+ */
+static bool setInterfaceParameter(int sock_fd, const char *ifn, int af, const char *if_addr, int operation)
+{
+ DevAssert(af == AF_INET || af == AF_INET6);
+ struct ifreq ifr = {0};
+ strncpy(ifr.ifr_name, ifn, sizeof(ifr.ifr_name));
+ struct in6_ifreq ifr6 = {0};
+
+ void *ioctl_opt = NULL;
+ if (af == AF_INET) {
+ struct sockaddr_in addr = {.sin_family = AF_INET};
+ int ret = inet_pton(af, if_addr, &addr.sin_addr);
+ if (ret != 1) {
+ LOG_E(OIP, "inet_pton(): cannot convert %s to IPv4 network address\n", if_addr);
+ return false;
+ }
+ memcpy(&ifr.ifr_ifru.ifru_addr,&addr,sizeof(struct sockaddr_in));
+ ioctl_opt = 𝔦
+ } else {
+ struct sockaddr_in6 addr6 = {.sin6_family = AF_INET6};
+ int ret = inet_pton(af, if_addr, &addr6.sin6_addr);
+ if (ret != 1) {
+ LOG_E(OIP, "inet_pton(): cannot convert %s to IPv6 network address\n", if_addr);
+ return false;
+ }
+ memcpy(&ifr6.ifr6_addr, &addr6.sin6_addr, sizeof(struct in6_addr));
+ // we need to get the if index to put it into ifr6
+ if (ioctl(sock_fd, SIOGIFINDEX, &ifr) < 0) {
+ LOG_E(OIP, "ioctl() failed: errno %d, %s\n", errno, strerror(errno));
+ return false;
+ }
+ ifr6.ifr6_ifindex = ifr.ifr_ifindex;
+ ifr6.ifr6_prefixlen = 64;
+ ioctl_opt = &ifr6;
+ }
+
+ bool success = ioctl(sock_fd, operation, ioctl_opt) == 0;
+ if (!success)
+ LOG_E(OIP, "Setting operation %d for %s: ioctl call failed: %d, %s\n", operation, ifn, errno, strerror(errno));
+ return success;
+}
+
+/*
+ * \brief bring interface up (up != 0) or down (up == 0)
+ */
+typedef enum { INTERFACE_DOWN, INTERFACE_UP } if_action_t;
+static bool change_interface_state(int sock_fd, const char *ifn, if_action_t if_action)
+{
+ const char* action = if_action == INTERFACE_DOWN ? "DOWN" : "UP";
+
+ struct ifreq ifr = {0};
+ strncpy(ifr.ifr_name, ifn, sizeof(ifr.ifr_name));
+ /* get flags of this interface: see netdevice(7) */
+ bool success = ioctl(sock_fd, SIOCGIFFLAGS, (caddr_t)&ifr) == 0;
+ if (!success)
+ goto fail_interface_state;
+
+ if (if_action == INTERFACE_UP) {
+ ifr.ifr_flags |= IFF_UP | IFF_NOARP | IFF_POINTOPOINT;
+ ifr.ifr_flags &= ~IFF_MULTICAST;
+ } else {
+ ifr.ifr_flags &= ~IFF_UP;
+ }
+
+ success = ioctl(sock_fd, SIOCSIFFLAGS, (caddr_t)&ifr) == 0;
+ if (!success)
+ goto fail_interface_state;
+ return true;
+
+fail_interface_state:
+ LOG_E(OIP, "Bringing interface %s for %s: ioctl call failed: %d, %s\n", action, ifn, errno, strerror(errno));
+ return false;
+}
+
+// non blocking full configuration of the interface (address, and the two lest octets of the address)
+bool tun_config(int interface_id, const char *ipv4, const char *ipv6, const char *ifpref)
+{
+ char interfaceName[IFNAMSIZ];
+ snprintf(interfaceName, sizeof(interfaceName), "%s%d", ifpref, interface_id);
+
+ AssertFatal(ipv4 != NULL || ipv6 != NULL, "need to have IP address, but none given\n");
+
+ int sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (sock_fd < 0) {
+ LOG_E(UTIL, "Failed creating socket for interface management: %d, %s\n", errno, strerror(errno));
+ return false;
+ }
+
+ change_interface_state(sock_fd, interfaceName, INTERFACE_DOWN);
+ bool success = true;
+ if (ipv4 != NULL)
+ success = setInterfaceParameter(sock_fd, interfaceName, AF_INET, ipv4, SIOCSIFADDR);
+ // set the machine network mask for IPv4
+ if (success && ipv4 != NULL)
+ success = setInterfaceParameter(sock_fd, interfaceName, AF_INET, "255.255.255.0", SIOCSIFNETMASK);
+
+ if (ipv6 != NULL) {
+ // for setting the IPv6 address, we need an IPv6 socket. For setting IPv4,
+ // we need an IPv4 socket. So do all operations using IPv4 socket, except
+ // for setting the IPv6
+ int sock_fd = socket(AF_INET6, SOCK_DGRAM, 0);
+ if (sock_fd < 0) {
+ LOG_E(UTIL, "Failed creating socket for interface management: %d, %s\n", errno, strerror(errno));
+ success = false;
+ }
+ success = success && setInterfaceParameter(sock_fd, interfaceName, AF_INET6, ipv6, SIOCSIFADDR);
+ close(sock_fd);
+ }
+
+ if (success)
+ success = change_interface_state(sock_fd, interfaceName, INTERFACE_UP);
+
+ if (success)
+ LOG_I(OIP, "Interface %s successfully configured, IPv4 %s, IPv6 %s\n", interfaceName, ipv4, ipv6);
+ else
+ LOG_E(OIP, "Interface %s couldn't be configured (IPv4 %s, IPv6 %s)\n", interfaceName, ipv4, ipv6);
+
+ close(sock_fd);
+ return success;
+}
+
+void setup_ue_ipv4_route(int interface_id, const char *ipv4, const char *ifpref)
+{
+ int table_id = interface_id - 1 + 10000;
+ char interfaceName[IFNAMSIZ];
+ snprintf(interfaceName, sizeof(interfaceName), "%s%d", ifpref, interface_id);
+
+ char command_line[500];
+ int res = sprintf(command_line,
+ "ip rule add from %s/32 table %d && "
+ "ip rule add to %s/32 table %d && "
+ "ip route add default dev %s table %d",
+ ipv4,
+ table_id,
+ ipv4,
+ table_id,
+ interfaceName,
+ table_id);
+
+ if (res < 0) {
+ LOG_E(UTIL, "Could not create ip rule/route commands string\n");
+ return;
+ }
+ background_system(command_line);
+}
+
diff --git a/common/utils/tun_if.h b/common/utils/tun_if.h
new file mode 100644
index 0000000000..45ae34983f
--- /dev/null
+++ b/common/utils/tun_if.h
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ * contact@openairinterface.org
+ */
+
+#ifndef TUN_IF_H_
+#define TUN_IF_H_
+
+#include
+
+/* TODO: doc */
+int tun_init(const char *ifprefix, int num_if, int id);
+
+/* TODO: doc */
+int tun_init_mbms(char *ifsuffix, int id);
+
+/*! \fn int tun_config(char*, int, int)
+ * \brief This function initializes the nasmesh interface using the basic values,
+ * basic address, network mask and broadcast address, as the default configured
+ * ones
+ * \param[in] interface_id number of this interface, prepended after interface
+ * name
+ * \param[in] ipv4 IPv4 address of this interface as a string
+ * \param[in] ipv6 IPv6 address of this interface as a string
+ * \param[in] ifprefix interface name prefix to which an interface number will
+ * be appended
+ * \return true on success, otherwise false
+ * \note
+ * @ingroup _nas
+ */
+bool tun_config(int interface_id, const char *ipv4, const char *ipv6, const char *ifprefix);
+
+/*!
+ * \brief Setup a IPv4 rule in table (interface_id - 1 + 10000) and route to
+ * force packets coming into interface back through it, and workaround
+ * net.ipv4.conf.all.rp_filter=2 (strict source filtering would filter out
+ * responses of packets going out through interface to another IP address not
+ * in same subnet).
+ * \param[in] interface_id number of this interface, prepended after interface
+ * name
+ * \param[in] ipv4 IPv4 address of the UE
+ * \param[in] ifprefix interface name prefix to which an interface number will
+ * be appended
+ */
+void setup_ue_ipv4_route(int interface_id, const char *ipv4, const char *ifpref);
+
+#endif /*TUN_IF_H_*/
diff --git a/doc/BUILD.md b/doc/BUILD.md
index e99f88fca4..3e06e79d01 100644
--- a/doc/BUILD.md
+++ b/doc/BUILD.md
@@ -38,7 +38,6 @@ Running the [build_oai](../cmake_targets/build_oai) script also generates some
- `conf2uedata`: a binary used to build the (4G) UE data from a configuration file. The created file emulates the sim card of a 3GPP compliant phone.
- `nvram`: a binary used to build (4G) UE (IMEI...) and EMM (IMSI, registered PLMN) non volatile data.
-- `rb_tool`: radio bearer utility for (4G) UE
- `genids` T Tracer utility, used at build time to generate `T_IDs.h` include file. This binary is located in the [T Tracer source file directory](../common/utils/T) .
The build system for OAI uses [cmake](https://cmake.org/) which is a tool to generate makefiles. The `build_oai` script is a wrapper using `cmake` and `make`/`ninja` to ease the oai build and use. It logs the `cmake` and `ninja`/`make` commands it executes. The file describing how to build the executables from source files is the [CMakeLists.txt](../CMakeLists.txt), it is used as input by cmake to generate the makefiles.
diff --git a/doc/Doxyfile b/doc/Doxyfile
index 72c03efe96..5ae52a3c3a 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -866,6 +866,8 @@ INPUT = \
@CMAKE_CURRENT_SOURCE_DIR@/../common/config/config_cmdline.c \
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/time_meas.c \
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/time_meas.h \
+@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/tun_if.h \
+@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/tun_if.c \
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/utils.c \
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/oai_asn1.h \
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/system.h \
@@ -1874,10 +1876,6 @@ INPUT = \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/RRC/NR_UE/rrc_defs.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/RRC/NR_UE/L2_interface_ue.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair2/RRC/NAS/rb_config.h \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair2/RRC/NAS/rb_config.c \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair2/RRC/NAS/nas_config.h \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair2/RRC/NAS/nas_config.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/RRC/NR/rrc_gNB_internode.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/RRC/NR/nr_rrc_defs.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair2/RRC/NR/cucp_cuup_if.h \
@@ -2308,13 +2306,6 @@ INPUT = \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_ESTIMATION/nr_freq_equalization.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/proto.h \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/multicast_link.h \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/socket.h \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/socket.c \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/ETH_TRANSPORT/defs.h \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/RF/adc.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/RF/dac.c \
@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/RF/rf.h \
diff --git a/doc/L1SIM.md b/doc/L1SIM.md
index 56be7f93b6..a78d3c328a 100644
--- a/doc/L1SIM.md
+++ b/doc/L1SIM.md
@@ -45,7 +45,7 @@ $ source oaienv
$ cd cmake_targets/tools
$ sudo -E ./init_nas_nos1 eNB
$ cd ../ran_build/build
-$ sudo -E ./lte-softmodem -O YYY.conf --noS1 --nokrnmod 0
+$ sudo -E ./lte-softmodem -O YYY.conf --noS1
```
# How to run a UE with the noS1 option
@@ -59,7 +59,7 @@ $ source oaienv
$ cd cmake_targets/tools
$ sudo -E ./init_nas_nos1 UE
$ cd ../ran_build/build
-$ sudo ./lte-uesoftmodem -O XXX.conf -r 25 --siml1 --noS1 --nokrnmod 0
+$ sudo ./lte-uesoftmodem -O XXX.conf -r 25 --siml1 --noS1
```
That should give you equivalent functionality to what you had with oaisim including noise and RF channel emulation (path loss / fading, etc.). You should also be able to run multiple UEs.
diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md
index b1b5090ae7..4d181158a9 100644
--- a/doc/RUNMODEM.md
+++ b/doc/RUNMODEM.md
@@ -103,12 +103,15 @@ Command line parameters for UE in `--sa` mode:
- `--ssb` : SSB start subcarrier (default value 516)
**Optional parameters**:
+- `-E`: use three-quarter sampling for split 8 sample rate. Required for
+ certain radios (e.g., 40MHz with B210). If used on the gNB, it is a good idea
+ to use for the UE as well (and vice versa).
- `--ue-scan-carrier` : scan for cells in current bandwidth. This option can be used if the SSB position of the gNB is unknown. If multiple cells are detected, the UE will try to connect to the first cell. By default, this option is disabled and the UE attempts to only decode SSB given by `--ssb`.
To simplify the configuration for the user testing OAI UE with OAI gNB, the latter prints the following LOG that guides the user to correctly set some of the UE command line parameters.
```
-[PHY] Command line parameters for the UE: -C 3319680000 -r 106 --numerology 1 --ssb 516
+[PHY] Command line parameters for OAI UE: -C 3319680000 -r 106 --numerology 1 --ssb 516
```
You can run this, using USRPs, on two separate machines:
diff --git a/doc/TESTBenches.md b/doc/TESTBenches.md
index 53e0ed3054..ec918a6e33 100644
--- a/doc/TESTBenches.md
+++ b/doc/TESTBenches.md
@@ -199,6 +199,12 @@ information on how the images are built.
~5G-NR
- matix + N310 (gNB), up2 + COTS UE (Quectel RM520N), OAI 5GC deployed in docker on matix
- NR performance tests: 2x2 configuration, 60 MHz and 100 MHz bandwidth
+- [RAN-SA-FHI72-CN5G](https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-SA-FHI72-CN5G/)
+ ~5G-NR
+ - cacofonix + FHI72 + Benetel550 (gNB), AmariUE, OAI CN5G
+ - cacofonix + FHI72 + VVDN (gNB), up2 (Quectel RM520N UE), OAI CN5G
+ - OpenShift cluster for CN deployment
+ - FHI 7.2 testing with 100 MHz bandwidth, 2 layers in DL
### RAN-CI-NSA-Trigger
diff --git a/doc/iqrecordplayer_usage.md b/doc/iqrecordplayer_usage.md
index 603a74f4b5..69c675c996 100644
--- a/doc/iqrecordplayer_usage.md
+++ b/doc/iqrecordplayer_usage.md
@@ -33,7 +33,7 @@ than the value of `--subframes-max` parameter.
>Recording session example:
```bash
-./nr-uesoftmodem -O /home/oaitests/mediatek_sim.conf --sa --nokrnmod 1 --numerology 1 -r 106 -C 3649440000 --band 78 -E --ue-fo-compensation --device.recplay.subframes-record 1 --device.recplay.subframes-file /home/iqs/oai-nrUE-17042023.dat --device.recplay.use-mmap 1 --device.recplay.subframes-max 30000
+./nr-uesoftmodem -O /home/oaitests/mediatek_sim.conf --sa --numerology 1 -r 106 -C 3649440000 --band 78 -E --ue-fo-compensation --device.recplay.subframes-record 1 --device.recplay.subframes-file /home/iqs/oai-nrUE-17042023.dat --device.recplay.use-mmap 1 --device.recplay.subframes-max 30000
............................................
............................................
............................................
@@ -54,7 +54,7 @@ options for replay mode are:
>Replay mode session example:
```bash
-./nr-uesoftmodem -O /home/oaitests/mediatek_sim.conf --sa --nokrnmod 1 --numerology 1 -r 106 -C 3649440000 --band 78 -E --ue-fo-compensation --device.recplay.subframes-replay 1 --device.recplay.subframes-file /home/iqs/oai-nrUE-17042023.dat --device.recplay.use-mmap 1 --device.recplay.subframes-loops 1
+./nr-uesoftmodem -O /home/oaitests/mediatek_sim.conf --sa --numerology 1 -r 106 -C 3649440000 --band 78 -E --ue-fo-compensation --device.recplay.subframes-replay 1 --device.recplay.subframes-file /home/iqs/oai-nrUE-17042023.dat --device.recplay.use-mmap 1 --device.recplay.subframes-loops 1
..................................
..................................
[HW] Replay iqs from USRP B200 device, bandwidth 4.000000e+07
diff --git a/docker/Dockerfile.base.rhel9 b/docker/Dockerfile.base.rhel9
index 03b4ccac91..dee50127ac 100644
--- a/docker/Dockerfile.base.rhel9
+++ b/docker/Dockerfile.base.rhel9
@@ -67,7 +67,7 @@ RUN rm -f /etc/rhsm-host && \
# Add "Tini - A tiny but valid init for containers", https://github.com/krallin/tini
# it will be copied into target containers, to print exit numbers and handle signals properly
-ENV TINI_VERSION v0.19.0
+ENV TINI_VERSION=v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
diff --git a/docker/Dockerfile.base.rocky b/docker/Dockerfile.base.rocky
index 5b5debd862..0e9d630bac 100644
--- a/docker/Dockerfile.base.rocky
+++ b/docker/Dockerfile.base.rocky
@@ -48,7 +48,7 @@ RUN dnf install 'dnf-command(config-manager)' -y && \
# Add "Tini - A tiny but valid init for containers", https://github.com/krallin/tini
# it will be copied into target containers, to print exit numbers and handle signals properly
-ENV TINI_VERSION v0.19.0
+ENV TINI_VERSION=v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
diff --git a/docker/Dockerfile.base.ubuntu22 b/docker/Dockerfile.base.ubuntu22
index d1b90e2dcf..f23cf01ac0 100644
--- a/docker/Dockerfile.base.ubuntu22
+++ b/docker/Dockerfile.base.ubuntu22
@@ -57,7 +57,7 @@ RUN apt-get update && \
# Add "Tini - A tiny but valid init for containers", https://github.com/krallin/tini
# it will be copied into target containers, to print exit numbers and handle signals properly
-ENV TINI_VERSION v0.19.0
+ENV TINI_VERSION=v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
diff --git a/docker/Dockerfile.base.ubuntu22.cross-arm64 b/docker/Dockerfile.base.ubuntu22.cross-arm64
index 2be24289f5..74af391660 100644
--- a/docker/Dockerfile.base.ubuntu22.cross-arm64
+++ b/docker/Dockerfile.base.ubuntu22.cross-arm64
@@ -74,7 +74,7 @@ RUN apt-get update && \
# Add "Tini - A tiny but valid init for containers", https://github.com/krallin/tini
# it will be copied into target containers, to print exit numbers and handle signals properly
-ENV TINI_VERSION v0.19.0
+ENV TINI_VERSION=v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
diff --git a/docker/Dockerfile.build.fhi72.rhel9 b/docker/Dockerfile.build.fhi72.rhel9
index fc5570a85c..6a70b89a51 100644
--- a/docker/Dockerfile.build.fhi72.rhel9
+++ b/docker/Dockerfile.build.fhi72.rhel9
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as ran-base
+FROM ran-base:latest AS ran-base
ENV TZ=Europe
RUN rm -Rf /oai-ran
@@ -48,7 +48,7 @@ RUN git clone https://gerrit.o-ran-sc.org/r/o-du/phy.git /opt/phy && \
cd /opt/phy/fhi_lib/lib && \
RTE_SDK=/oai-ran/dpdk-stable-20.11.9/ XRAN_DIR=/opt/phy/fhi_lib make XRAN_LIB_SO=1
-FROM ran-base as ran-build-fhi72
+FROM ran-base AS ran-build-fhi72
ARG E2AP_VERSION=E2AP_V3
ARG KPM_VERSION=KPM_V3_00
diff --git a/docker/Dockerfile.build.fhi72.ubuntu22 b/docker/Dockerfile.build.fhi72.ubuntu22
index 774f488ed7..16ce820832 100644
--- a/docker/Dockerfile.build.fhi72.ubuntu22
+++ b/docker/Dockerfile.build.fhi72.ubuntu22
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as ran-base
+FROM ran-base:latest AS ran-base
ARG E2AP_VERSION=E2AP_V3
ARG KPM_VERSION=KPM_V3_00
@@ -61,7 +61,7 @@ RUN git clone https://gerrit.o-ran-sc.org/r/o-du/phy.git /opt/phy && \
cd /opt/phy/fhi_lib/lib && \
RTE_SDK=/oai-ran/dpdk-stable-20.11.9/ XRAN_DIR=/opt/phy/fhi_lib make XRAN_LIB_SO=1
-FROM ran-base as ran-build-fhi72
+FROM ran-base AS ran-build-fhi72
## Build and install OAI
#run build_oai to build the target image
RUN /bin/sh oaienv && \
diff --git a/docker/Dockerfile.build.rhel9 b/docker/Dockerfile.build.rhel9
index 6adeb62b31..464c6caf5a 100644
--- a/docker/Dockerfile.build.rhel9
+++ b/docker/Dockerfile.build.rhel9
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as ran-build
+FROM ran-base:latest AS ran-build
RUN rm -Rf /oai-ran
WORKDIR /oai-ran
diff --git a/docker/Dockerfile.build.rocky b/docker/Dockerfile.build.rocky
index aef75c7d2b..3fe164b10d 100644
--- a/docker/Dockerfile.build.rocky
+++ b/docker/Dockerfile.build.rocky
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as ran-build
+FROM ran-base:latest AS ran-build
RUN rm -Rf /oai-ran
WORKDIR /oai-ran
diff --git a/docker/Dockerfile.build.ubuntu22 b/docker/Dockerfile.build.ubuntu22
index 6a4b44c794..e4cc71fdcf 100644
--- a/docker/Dockerfile.build.ubuntu22
+++ b/docker/Dockerfile.build.ubuntu22
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as ran-build
+FROM ran-base:latest AS ran-build
ARG BUILD_OPTION
RUN rm -Rf /oai-ran
diff --git a/docker/Dockerfile.build.ubuntu22.cross-arm64 b/docker/Dockerfile.build.ubuntu22.cross-arm64
index 371651e5ec..349a4f791c 100644
--- a/docker/Dockerfile.build.ubuntu22.cross-arm64
+++ b/docker/Dockerfile.build.ubuntu22.cross-arm64
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as ran-build
+FROM ran-base:latest AS ran-build
RUN rm -Rf /oai-ran
WORKDIR /oai-ran
diff --git a/docker/Dockerfile.eNB.rhel9 b/docker/Dockerfile.eNB.rhel9
index c523ac0b1f..391f2a6594 100644
--- a/docker/Dockerfile.eNB.rhel9
+++ b/docker/Dockerfile.eNB.rhel9
@@ -31,7 +31,7 @@ FROM ran-build:latest AS enb-build
#start from scratch for target executable
-FROM registry.access.redhat.com/ubi9/ubi:latest as oai-enb
+FROM registry.access.redhat.com/ubi9/ubi:latest AS oai-enb
ENV TZ=Europe/Paris
RUN dnf update -y && \
diff --git a/docker/Dockerfile.eNB.rocky b/docker/Dockerfile.eNB.rocky
index 04243dfda2..eee61a7dda 100644
--- a/docker/Dockerfile.eNB.rocky
+++ b/docker/Dockerfile.eNB.rocky
@@ -32,7 +32,7 @@ FROM ran-build:latest AS enb-build
#start from scratch for target executable
-FROM $BASE_IMAGE as oai-enb
+FROM $BASE_IMAGE AS oai-enb
ENV TZ=Europe/Paris
RUN dnf update -y && \
diff --git a/docker/Dockerfile.eNB.ubuntu22 b/docker/Dockerfile.eNB.ubuntu22
index af580f6258..44797cd7f5 100644
--- a/docker/Dockerfile.eNB.ubuntu22
+++ b/docker/Dockerfile.eNB.ubuntu22
@@ -25,13 +25,13 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as enb-base
+FROM ran-base:latest AS enb-base
FROM ran-build:latest AS enb-build
#start from scratch for target executable
-FROM ubuntu:jammy as oai-enb
+FROM ubuntu:jammy AS oai-enb
ARG BUILD_OPTION
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
diff --git a/docker/Dockerfile.gNB.aerial.ubuntu22 b/docker/Dockerfile.gNB.aerial.ubuntu22
index 3259e27baa..dcfe005caa 100644
--- a/docker/Dockerfile.gNB.aerial.ubuntu22
+++ b/docker/Dockerfile.gNB.aerial.ubuntu22
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as ran-build
+FROM ran-base:latest AS ran-build
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
@@ -58,7 +58,7 @@ RUN /bin/sh oaienv && \
#start from scratch for target executable
-FROM ubuntu:jammy as oai-gnb-aerial
+FROM ubuntu:jammy AS oai-gnb-aerial
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
diff --git a/docker/Dockerfile.gNB.aerial.ubuntu22.sanitize-address b/docker/Dockerfile.gNB.aerial.ubuntu22.sanitize-address
index 919d7b788d..62c7de33d6 100644
--- a/docker/Dockerfile.gNB.aerial.ubuntu22.sanitize-address
+++ b/docker/Dockerfile.gNB.aerial.ubuntu22.sanitize-address
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as ran-build
+FROM ran-base:latest AS ran-build
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
@@ -58,7 +58,7 @@ RUN /bin/sh oaienv && \
#start from scratch for target executable
-FROM ubuntu:jammy as oai-gnb-aerial
+FROM ubuntu:jammy AS oai-gnb-aerial
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
diff --git a/docker/Dockerfile.gNB.aw2s.rhel9 b/docker/Dockerfile.gNB.aw2s.rhel9
index 926e2a2e75..db4b0f60c6 100644
--- a/docker/Dockerfile.gNB.aw2s.rhel9
+++ b/docker/Dockerfile.gNB.aw2s.rhel9
@@ -38,7 +38,7 @@ RUN /bin/sh oaienv && \
./build_oai -w AW2SORI -t Ethernet
#start from scratch for target executable
-FROM registry.access.redhat.com/ubi9/ubi:latest as oai-gnb-aw2s
+FROM registry.access.redhat.com/ubi9/ubi:latest AS oai-gnb-aw2s
ENV TZ=Europe/Paris
RUN dnf update -y && \
diff --git a/docker/Dockerfile.gNB.aw2s.rocky b/docker/Dockerfile.gNB.aw2s.rocky
index 269eb4be3f..bdd1eb4e38 100644
--- a/docker/Dockerfile.gNB.aw2s.rocky
+++ b/docker/Dockerfile.gNB.aw2s.rocky
@@ -39,7 +39,7 @@ RUN /bin/sh oaienv && \
./build_oai -w AW2SORI -t Ethernet
#start from scratch for target executable
-FROM $BASE_IMAGE as oai-gnb-aw2s
+FROM $BASE_IMAGE AS oai-gnb-aw2s
ENV TZ=Europe/Paris
RUN dnf update -y && \
diff --git a/docker/Dockerfile.gNB.fhi72.rhel9 b/docker/Dockerfile.gNB.fhi72.rhel9
index 6bac3c71d9..0d629ac8a1 100644
--- a/docker/Dockerfile.gNB.fhi72.rhel9
+++ b/docker/Dockerfile.gNB.fhi72.rhel9
@@ -25,12 +25,12 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as gnb-base
+FROM ran-base:latest AS gnb-base
-FROM ran-build-fhi72:latest as gnb-build
+FROM ran-build-fhi72:latest AS gnb-build
#start from scratch for target executable
-FROM registry.access.redhat.com/ubi9/ubi:latest as oai-gnb-fhi72
+FROM registry.access.redhat.com/ubi9/ubi:latest AS oai-gnb-fhi72
ENV TZ=Europe/Paris
# Copy the entitlements
diff --git a/docker/Dockerfile.gNB.fhi72.ubuntu22 b/docker/Dockerfile.gNB.fhi72.ubuntu22
index 5bb0ad5234..31f2392af7 100644
--- a/docker/Dockerfile.gNB.fhi72.ubuntu22
+++ b/docker/Dockerfile.gNB.fhi72.ubuntu22
@@ -25,13 +25,13 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as gnb-base
+FROM ran-base:latest AS gnb-base
-FROM ran-build-fhi72:latest as gnb-build
+FROM ran-build-fhi72:latest AS gnb-build
#start from scratch for target executable
-FROM ubuntu:jammy as oai-gnb
+FROM ubuntu:jammy AS oai-gnb
ARG BUILD_OPTION
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
diff --git a/docker/Dockerfile.gNB.rhel9 b/docker/Dockerfile.gNB.rhel9
index d4f20b1cd0..e8fd8a9433 100644
--- a/docker/Dockerfile.gNB.rhel9
+++ b/docker/Dockerfile.gNB.rhel9
@@ -31,7 +31,7 @@ FROM ran-build:latest AS gnb-build
#start from scratch for target executable
-FROM registry.access.redhat.com/ubi9/ubi:latest as oai-gnb
+FROM registry.access.redhat.com/ubi9/ubi:latest AS oai-gnb
ENV TZ=Europe/Paris
RUN dnf update -y && \
diff --git a/docker/Dockerfile.gNB.rocky b/docker/Dockerfile.gNB.rocky
index 2e59a0d230..c1665e5a86 100644
--- a/docker/Dockerfile.gNB.rocky
+++ b/docker/Dockerfile.gNB.rocky
@@ -32,7 +32,7 @@ FROM ran-build:latest AS gnb-build
#start from scratch for target executable
-FROM $BASE_IMAGE as oai-gnb
+FROM $BASE_IMAGE AS oai-gnb
ENV TZ=Europe/Paris
RUN dnf update -y && \
diff --git a/docker/Dockerfile.gNB.ubuntu22 b/docker/Dockerfile.gNB.ubuntu22
index 6ac01d7139..77a7ac0207 100644
--- a/docker/Dockerfile.gNB.ubuntu22
+++ b/docker/Dockerfile.gNB.ubuntu22
@@ -25,13 +25,13 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as gnb-base
+FROM ran-base:latest AS gnb-base
FROM ran-build:latest AS gnb-build
#start from scratch for target executable
-FROM ubuntu:jammy as oai-gnb
+FROM ubuntu:jammy AS oai-gnb
ARG BUILD_OPTION
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
diff --git a/docker/Dockerfile.lteRU.rhel9 b/docker/Dockerfile.lteRU.rhel9
index d57c88bbf4..18ef1e8cfd 100644
--- a/docker/Dockerfile.lteRU.rhel9
+++ b/docker/Dockerfile.lteRU.rhel9
@@ -31,7 +31,7 @@ FROM ran-build:latest AS ru-build
#start from scratch for target executable
-FROM registry.access.redhat.com/ubi9/ubi:latest as oai-lte-ru
+FROM registry.access.redhat.com/ubi9/ubi:latest AS oai-lte-ru
ENV TZ=Europe/Paris
RUN dnf update -y && \
diff --git a/docker/Dockerfile.lteRU.ubuntu22 b/docker/Dockerfile.lteRU.ubuntu22
index 83a3e950ab..0f5f68932a 100644
--- a/docker/Dockerfile.lteRU.ubuntu22
+++ b/docker/Dockerfile.lteRU.ubuntu22
@@ -25,13 +25,13 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as ru-base
+FROM ran-base:latest AS ru-base
FROM ran-build:latest AS ru-build
#start from scratch for target executable
-FROM ubuntu:jammy as oai-lte-ru
+FROM ubuntu:jammy AS oai-lte-ru
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
diff --git a/docker/Dockerfile.lteUE.rhel9 b/docker/Dockerfile.lteUE.rhel9
index 84854c2104..9ddf9e1f32 100644
--- a/docker/Dockerfile.lteUE.rhel9
+++ b/docker/Dockerfile.lteUE.rhel9
@@ -31,7 +31,7 @@ FROM ran-build:latest AS lte-ue-build
#start from scratch for target executable
-FROM registry.access.redhat.com/ubi9/ubi:latest as oai-lte-ue
+FROM registry.access.redhat.com/ubi9/ubi:latest AS oai-lte-ue
ENV TZ=Europe/Paris
RUN dnf update -y && \
diff --git a/docker/Dockerfile.lteUE.rocky b/docker/Dockerfile.lteUE.rocky
index 54b5dfa52a..4d98776c1d 100644
--- a/docker/Dockerfile.lteUE.rocky
+++ b/docker/Dockerfile.lteUE.rocky
@@ -32,7 +32,7 @@ FROM ran-build:latest AS lte-ue-build
#start from scratch for target executable
-FROM $BASE_IMAGE as oai-lte-ue
+FROM $BASE_IMAGE AS oai-lte-ue
ENV TZ=Europe/Paris
RUN dnf update -y && \
diff --git a/docker/Dockerfile.lteUE.ubuntu22 b/docker/Dockerfile.lteUE.ubuntu22
index 057b6d17dc..5174dab36a 100644
--- a/docker/Dockerfile.lteUE.ubuntu22
+++ b/docker/Dockerfile.lteUE.ubuntu22
@@ -31,7 +31,7 @@ FROM ran-build:latest AS lte-ue-build
#start from scratch for target executable
-FROM ubuntu:jammy as oai-lte-ue
+FROM ubuntu:jammy AS oai-lte-ue
ARG BUILD_OPTION
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
diff --git a/docker/Dockerfile.nr-cuup.rhel9 b/docker/Dockerfile.nr-cuup.rhel9
index c10560e13f..08ee72fa30 100644
--- a/docker/Dockerfile.nr-cuup.rhel9
+++ b/docker/Dockerfile.nr-cuup.rhel9
@@ -32,7 +32,7 @@ FROM ran-build:latest AS gnb-build
RUN cp /oai-ran/docker/scripts/gnb_entrypoint.sh /oai-ran/docker/scripts/entrypoint.sh
#start from scratch for target executable
-FROM registry.access.redhat.com/ubi9/ubi:latest as oai-nr-cuup
+FROM registry.access.redhat.com/ubi9/ubi:latest AS oai-nr-cuup
ENV TZ=Europe/Paris
RUN yum repolist --disablerepo=* && \
diff --git a/docker/Dockerfile.nr-cuup.rocky b/docker/Dockerfile.nr-cuup.rocky
index e6803bce1a..7f0e8fc2f1 100644
--- a/docker/Dockerfile.nr-cuup.rocky
+++ b/docker/Dockerfile.nr-cuup.rocky
@@ -33,7 +33,7 @@ FROM ran-build:latest AS gnb-build
RUN cp /oai-ran/docker/scripts/gnb_entrypoint.sh /oai-ran/docker/scripts/entrypoint.sh
#start from scratch for target executable
-FROM $BASE_IMAGE as oai-nr-cuup
+FROM $BASE_IMAGE AS oai-nr-cuup
ENV TZ=Europe/Paris
RUN yum repolist --disablerepo=* && \
diff --git a/docker/Dockerfile.nr-cuup.ubuntu22 b/docker/Dockerfile.nr-cuup.ubuntu22
index b618a578be..af95cb5a9c 100644
--- a/docker/Dockerfile.nr-cuup.ubuntu22
+++ b/docker/Dockerfile.nr-cuup.ubuntu22
@@ -25,12 +25,12 @@
#
#---------------------------------------------------------------------
-FROM ran-base:latest as gnb-base
+FROM ran-base:latest AS gnb-base
FROM ran-build:latest AS gnb-build
-FROM ubuntu:jammy as oai-nr-cuup
+FROM ubuntu:jammy AS oai-nr-cuup
ARG BUILD_OPTION
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
diff --git a/docker/Dockerfile.nrUE.rhel9 b/docker/Dockerfile.nrUE.rhel9
index 7d5894c618..7279809fdb 100644
--- a/docker/Dockerfile.nrUE.rhel9
+++ b/docker/Dockerfile.nrUE.rhel9
@@ -31,7 +31,7 @@ FROM ran-build:latest AS nr-ue-build
#start from scratch for target executable
-FROM registry.access.redhat.com/ubi9/ubi:latest as oai-nr-ue
+FROM registry.access.redhat.com/ubi9/ubi:latest AS oai-nr-ue
ENV TZ=Europe/Paris
RUN dnf update -y && \
diff --git a/docker/Dockerfile.nrUE.rocky b/docker/Dockerfile.nrUE.rocky
index 88d6bd73ff..ec5ecf6a99 100644
--- a/docker/Dockerfile.nrUE.rocky
+++ b/docker/Dockerfile.nrUE.rocky
@@ -32,7 +32,7 @@ FROM ran-build:latest AS nr-ue-build
#start from scratch for target executable
-FROM $BASE_IMAGE as oai-nr-ue
+FROM $BASE_IMAGE AS oai-nr-ue
ENV TZ=Europe/Paris
RUN dnf update -y && \
diff --git a/docker/Dockerfile.nrUE.ubuntu22 b/docker/Dockerfile.nrUE.ubuntu22
index 83aa918045..74ae9620b0 100644
--- a/docker/Dockerfile.nrUE.ubuntu22
+++ b/docker/Dockerfile.nrUE.ubuntu22
@@ -31,7 +31,7 @@ FROM ran-build:latest AS nr-ue-build
#start from scratch for target executable
-FROM ubuntu:jammy as oai-nr-ue
+FROM ubuntu:jammy AS oai-nr-ue
ARG BUILD_OPTION
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
diff --git a/docker/Dockerfile.phySim.rhel9 b/docker/Dockerfile.phySim.rhel9
index ccfe8505a8..e568c6bc00 100644
--- a/docker/Dockerfile.phySim.rhel9
+++ b/docker/Dockerfile.phySim.rhel9
@@ -41,7 +41,7 @@ RUN /bin/sh oaienv && \
./build_oai --phy_simulators --ninja --sanitize --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
#start from scratch for target executable
-FROM registry.access.redhat.com/ubi9/ubi:latest as oai-physim
+FROM registry.access.redhat.com/ubi9/ubi:latest AS oai-physim
RUN dnf update -y && \
dnf install -y \
diff --git a/executables/lte-enb.c b/executables/lte-enb.c
index 8f50dfc63d..1a26644a43 100644
--- a/executables/lte-enb.c
+++ b/executables/lte-enb.c
@@ -85,7 +85,6 @@
#include "executables/lte-softmodem.h"
#include "s1ap_eNB.h"
-#include "SIMULATION/ETH_TRANSPORT/proto.h"
#include "T.h"
diff --git a/executables/lte-ru.c b/executables/lte-ru.c
index 54747a9578..0ae8b86216 100644
--- a/executables/lte-ru.c
+++ b/executables/lte-ru.c
@@ -72,8 +72,6 @@ static int DEFRUTPCORES[] = {2,4,6,8};
#include "ENB_APP/enb_paramdef.h"
#include "common/config/config_userapi.h"
-#include "SIMULATION/ETH_TRANSPORT/proto.h"
-
#include "T.h"
#include "executables/softmodem-common.h"
diff --git a/executables/lte-softmodem.c b/executables/lte-softmodem.c
index a895b7b614..99f98d4f83 100644
--- a/executables/lte-softmodem.c
+++ b/executables/lte-softmodem.c
@@ -407,18 +407,14 @@ extern void phy_free_RU(RU_t *);
static void init_pdcp(void)
{
pdcp_layer_init();
- uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
- (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
+ uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ? 0 : LINK_ENB_PDCP_TO_GTPV1U_BIT;
if (IS_SOFTMODEM_NOS1)
- pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ;
+ pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT;
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_W_MBMS_BIT;
pdcp_module_init(pdcp_initmask, 0);
-
- pdcp_set_rlc_data_req_func(rlc_data_req);
- pdcp_set_pdcp_data_ind_func(pdcp_data_ind);
}
static void wait_nfapi_init(char *thread_name) {
diff --git a/executables/lte-softmodem.h b/executables/lte-softmodem.h
index 6bc6d27f21..0f5559c7d3 100644
--- a/executables/lte-softmodem.h
+++ b/executables/lte-softmodem.h
@@ -26,7 +26,6 @@
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "s1ap_eNB.h"
-#include "SIMULATION/ETH_TRANSPORT/proto.h"
#include "executables/softmodem-common.h"
diff --git a/executables/lte-ue.c b/executables/lte-ue.c
index 6c5cfd3f32..ee51346f46 100644
--- a/executables/lte-ue.c
+++ b/executables/lte-ue.c
@@ -80,11 +80,6 @@ void init_UE_threads_stub(int);
void init_UE_single_thread_stub(int);
void *UE_thread(void *arg);
int init_timer_thread(void);
-extern void multicast_link_start(void (*rx_handlerP) (unsigned int, char *),
- unsigned char _multicast_group,
- char *multicast_ifname);
-extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP);
-
int tx_req_num_elems;
extern uint16_t sf_ahead;
@@ -364,10 +359,9 @@ void init_UE_stub_single_thread(int nb_inst,
init_UE_single_thread_stub(nb_inst);
printf("UE threads created \n");
- if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
- LOG_I(PHY,"Starting multicast link on %s\n",emul_iface);
- multicast_link_start(ue_stub_rx_handler,0,emul_iface);
- }
+ AssertFatal(NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF,
+ "unsupported NFAPI mode %d\n",
+ NFAPI_MODE);
}
void init_UE_standalone_thread(int ue_idx) {
@@ -408,8 +402,9 @@ void init_UE_stub(int nb_inst,
printf("UE threads created \n");
LOG_I(PHY,"Starting multicast link on %s\n",emul_iface);
- if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF)
- multicast_link_start(ue_stub_rx_handler,0,emul_iface);
+ AssertFatal(NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF,
+ "unsupported NFAPI mode %d\n",
+ NFAPI_MODE);
}
@@ -2356,15 +2351,7 @@ static void *timer_thread( void *param ) {
}
nanosleep(&t_sleep, (struct timespec *)NULL);
- UE_tport_t pdu;
- pdu.header.packet_type = TTI_SYNC;
- pdu.header.absSF = (timer_frame*10)+timer_subframe;
-
- if (NFAPI_MODE != NFAPI_UE_STUB_PNF && NFAPI_MODE != NFAPI_MODE_STANDALONE_PNF) {
- multicast_link_write_sock(0,
- (char *)&pdu,
- sizeof(UE_tport_header_t));
- }
+ AssertFatal(NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF, "unsupported NFAPI mode %d\n", NFAPI_MODE);
} else {
wait_on_condition(&UE->timer_mutex,&UE->timer_cond,&UE->instance_cnt_timer,"timer_thread");
release_thread(&UE->timer_mutex,&UE->instance_cnt_timer,"timer_thread");
diff --git a/executables/lte-uesoftmodem.c b/executables/lte-uesoftmodem.c
index fa32d877f6..a75a22fba4 100644
--- a/executables/lte-uesoftmodem.c
+++ b/executables/lte-uesoftmodem.c
@@ -488,18 +488,21 @@ static inline void wait_nfapi_init(char *thread_name) {
}
static void init_pdcp(int ue_id) {
- uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT);
+ uint32_t pdcp_initmask = !IS_SOFTMODEM_NOS1 ? LINK_ENB_PDCP_TO_GTPV1U_BIT : LINK_ENB_PDCP_TO_GTPV1U_BIT;
if (IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) {
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
}
- if (IS_SOFTMODEM_NOKRNMOD)
- pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
+ // previous code was:
+ // if (IS_SOFTMODEM_NOKRNMOD)
+ // pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
+ // The kernel module (KRNMOD) has been removed from the project, so the 'if'
+ // was removed but the flag 'pdcp_initmask' was kept, as "no kernel module"
+ // was always set. further refactoring could take it out
+ pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
pdcp_module_init(pdcp_initmask, ue_id);
- pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
- pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
}
// Stupid function addition because UE itti messages queues definition is common with eNB
diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c
index 1f5fca077c..6efd26dfd7 100644
--- a/executables/nr-gnb.c
+++ b/executables/nr-gnb.c
@@ -75,7 +75,6 @@
#include "UTIL/OPT/opt.h"
#include "gnb_paramdef.h"
-#include "SIMULATION/ETH_TRANSPORT/proto.h"
#include
#include "T.h"
diff --git a/executables/nr-ru.c b/executables/nr-ru.c
index 24a1ecd719..aff3b5b8c2 100644
--- a/executables/nr-ru.c
+++ b/executables/nr-ru.c
@@ -65,7 +65,6 @@ static int DEFRUTPCORES[] = {-1,-1,-1,-1};
#include "GNB_APP/gnb_paramdef.h"
#include "common/config/config_userapi.h"
-#include "SIMULATION/ETH_TRANSPORT/proto.h"
#include
diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h
index 589bc537f5..b50389e7d0 100644
--- a/executables/nr-softmodem-common.h
+++ b/executables/nr-softmodem-common.h
@@ -30,8 +30,6 @@
#include "PHY/types.h"
#include
-#include "SIMULATION/ETH_TRANSPORT/proto.h"
-
/* help strings definition for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
#define CONFIG_HLP_RFCFGF "Configuration file for front-end (e.g. LMS7002M)\n"
#define CONFIG_HLP_ULMAXE "set the eNodeB max ULSCH erros\n"
@@ -103,8 +101,8 @@
#define CONFIG_HLP_TELN "Start embedded telnet server \n"
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
#define CONFIG_HLP_NOS1 "Disable s1 interface\n"
-#define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n"
#define CONFIG_HLP_AGC "Rx Gain control used for UE"
+
/*--------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for LOG utility */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c
index b188ead832..ac8a6c13ef 100644
--- a/executables/nr-softmodem.c
+++ b/executables/nr-softmodem.c
@@ -140,8 +140,6 @@ uint8_t nb_antenna_rx = 1;
int otg_enabled;
-#include
-
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
@@ -542,10 +540,8 @@ static void wait_nfapi_init(char *thread_name) {
}
void init_pdcp(void) {
- uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
- PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT:
- LINK_ENB_PDCP_TO_GTPV1U_BIT;
-
+ uint32_t pdcp_initmask = IS_SOFTMODEM_NOS1 ? ENB_NAS_USE_TUN_BIT : LINK_ENB_PDCP_TO_GTPV1U_BIT;
+
if (!NODE_IS_DU(get_node_type())) {
nr_pdcp_layer_init(get_node_type() == ngran_gNB_CUCP);
nr_pdcp_module_init(pdcp_initmask, 0);
@@ -654,12 +650,7 @@ int main( int argc, char **argv ) {
itti_init(TASK_MAX, tasks_info);
// initialize mscgen log after ITTI
init_opt();
- if(PDCP_USE_NETLINK && !IS_SOFTMODEM_NOS1) {
- netlink_init();
- if (get_softmodem_params()->nsa) {
- init_pdcp();
- }
- }
+
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
#endif
diff --git a/executables/nr-ue.c b/executables/nr-ue.c
index 266778ebca..dca05ea36a 100644
--- a/executables/nr-ue.c
+++ b/executables/nr-ue.c
@@ -27,6 +27,7 @@
#include "PHY/INIT/nr_phy_init.h"
#include "NR_MAC_UE/mac_proto.h"
#include "RRC/NR_UE/rrc_proto.h"
+#include "RRC/NR_UE/L2_interface_ue.h"
#include "SCHED_NR_UE/phy_frame_config_nr.h"
#include "SCHED_NR_UE/defs.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
@@ -100,17 +101,14 @@ static size_t dump_L1_UE_meas_stats(PHY_VARS_NR_UE *ue, char *output, size_t max
{
const char *begin = output;
const char *end = output + max_len;
- output += print_meas_log(&ue->phy_proc_tx, "L1 TX processing", NULL, NULL, output, end - output);
- output += print_meas_log(&ue->ulsch_encoding_stats, "ULSCH encoding", NULL, NULL, output, end - output);
- output += print_meas_log(&ue->phy_proc_rx, "L1 RX processing", NULL, NULL, output, end - output);
- output += print_meas_log(&ue->ue_ul_indication_stats, "UL Indication", NULL, NULL, output, end - output);
- output += print_meas_log(&ue->rx_pdsch_stats, "PDSCH receiver", NULL, NULL, output, end - output);
- output += print_meas_log(&ue->dlsch_decoding_stats, "PDSCH decoding", NULL, NULL, output, end - output);
- output += print_meas_log(&ue->dlsch_deinterleaving_stats, " -> Deinterleive", NULL, NULL, output, end - output);
- output += print_meas_log(&ue->dlsch_rate_unmatching_stats, " -> Rate Unmatch", NULL, NULL, output, end - output);
- output += print_meas_log(&ue->dlsch_ldpc_decoding_stats, " -> LDPC Decode", NULL, NULL, output, end - output);
- output += print_meas_log(&ue->dlsch_unscrambling_stats, "PDSCH unscrambling", NULL, NULL, output, end - output);
- output += print_meas_log(&ue->dlsch_rx_pdcch_stats, "PDCCH handling", NULL, NULL, output, end - output);
+ for (int i = 0; i < MAX_CPU_STAT_TYPE; i++) {
+ output += print_meas_log(&ue->phy_cpu_stats.cpu_time_stats[i],
+ ue->phy_cpu_stats.cpu_time_stats[i].meas_name,
+ NULL,
+ NULL,
+ output,
+ end - output);
+ }
return output - begin;
}
diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c
index 105ffdbbaa..aa25518712 100644
--- a/executables/nr-uesoftmodem.c
+++ b/executables/nr-uesoftmodem.c
@@ -326,22 +326,25 @@ void init_openair0()
static void init_pdcp(int ue_id)
{
- uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT);
+ uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : LINK_ENB_PDCP_TO_GTPV1U_BIT;
/*if (IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) {
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
}*/
- if (IS_SOFTMODEM_NOKRNMOD) {
- pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
- }
+ // previous code was:
+ // if (IS_SOFTMODEM_NOKRNMOD)
+ // pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
+ // The kernel module (KRNMOD) has been removed from the project, so the 'if'
+ // was removed but the flag 'pdcp_initmask' was kept, as "no kernel module"
+ // was always set. further refactoring could take it out
+ pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
+
if (get_softmodem_params()->nsa && rlc_module_init(0) != 0) {
LOG_I(RLC, "Problem at RLC initiation \n");
}
nr_pdcp_layer_init(false);
nr_pdcp_module_init(pdcp_initmask, ue_id);
- pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
- pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
}
// Stupid function addition because UE itti messages queues definition is common with eNB
@@ -503,6 +506,7 @@ int main(int argc, char **argv)
set_options(CC_id, UE[CC_id]);
NR_UE_MAC_INST_t *mac = get_mac_inst(inst);
+ init_nr_ue_phy_cpu_stats(&UE[CC_id]->phy_cpu_stats);
if (get_softmodem_params()->sa || get_softmodem_params()->sl_mode) { // set frame config to initial values from command line
// and assume that the SSB is centered on the grid
diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h
index 779f0049d8..204b16b109 100644
--- a/executables/nr-uesoftmodem.h
+++ b/executables/nr-uesoftmodem.h
@@ -3,9 +3,6 @@
#include
#include
#include "PHY/defs_nr_UE.h"
-#include "SIMULATION/ETH_TRANSPORT/proto.h"
-
-
#define CONFIG_HLP_IF_FREQ "IF frequency for RF, if needed\n"
#define CONFIG_HLP_IF_FREQ_OFF "UL IF frequency offset for RF, if needed\n"
diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c
index 6f5cabdede..be2a79eb64 100644
--- a/executables/softmodem-common.c
+++ b/executables/softmodem-common.c
@@ -97,7 +97,7 @@ void get_common_options(configmodule_interface_t *cfg, uint32_t execmask)
uint32_t glog_level=0 ;
uint32_t start_telnetsrv = 0, start_telnetclt = 0;
uint32_t start_websrv = 0;
- uint32_t noS1 = 0, nokrnmod = 1, nonbiot = 0;
+ uint32_t noS1 = 0, nonbiot = 0;
uint32_t rfsim = 0, do_forms = 0;
int nfapi_index = 0;
char *logmem_filename = NULL;
@@ -146,10 +146,6 @@ void get_common_options(configmodule_interface_t *cfg, uint32_t execmask)
set_softmodem_optmask(SOFTMODEM_NOS1_BIT);
}
- if (nokrnmod) {
- set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT);
- }
-
if (nonbiot) {
set_softmodem_optmask(SOFTMODEM_NONBIOT_BIT);
}
diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h
index a696c064a4..110a5c60a7 100644
--- a/executables/softmodem-common.h
+++ b/executables/softmodem-common.h
@@ -99,7 +99,6 @@ extern "C"
#define CONFIG_HLP_NOS1 "Disable s1 interface\n"
#define CONFIG_HLP_RFSIM "Run in rf simulator mode\n"
-#define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n"
#define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n"
#define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n"
#define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR 'MONOLITHIC', 'PNF', 'VNF', 'AERIAL','UE_STUB_PNF','UE_STUB_OFFNET','STANDALONE_PNF'\n"
@@ -173,7 +172,6 @@ extern int usrp_tx_thread;
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, .strptr=&worker_config, .defstrval=NULL, TYPE_STRING, 0}, \
{"noS1", CONFIG_HLP_NOS1, PARAMFLAG_BOOL, .uptr=&noS1, .defintval=0, TYPE_UINT, 0}, \
{"rfsim", CONFIG_HLP_RFSIM, PARAMFLAG_BOOL, .uptr=&rfsim, .defintval=0, TYPE_UINT, 0}, \
- {"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, .uptr=&nokrnmod, .defintval=1, TYPE_UINT, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, .uptr=&nonbiot, .defuintval=0, TYPE_UINT, 0}, \
{"chest-freq", CONFIG_HLP_CHESTFREQ, 0, .iptr=&CHEST_FREQ, .defintval=0, TYPE_INT, 0}, \
{"chest-time", CONFIG_HLP_CHESTTIME, 0, .iptr=&CHEST_TIME, .defintval=0, TYPE_INT, 0}, \
@@ -224,7 +222,6 @@ extern int usrp_tx_thread;
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
- { .s5 = { NULL } }, \
{ .s3a = { config_checkstr_assign_integer, \
{"MONOLITHIC", "PNF", "VNF", "AERIAL","UE_STUB_PNF","UE_STUB_OFFNET","STANDALONE_PNF"}, \
{NFAPI_MONOLITHIC, NFAPI_MODE_PNF, NFAPI_MODE_VNF, NFAPI_MODE_AERIAL,NFAPI_UE_STUB_PNF,NFAPI_UE_STUB_OFFNET,NFAPI_MODE_STANDALONE_PNF}, \
@@ -278,7 +275,6 @@ extern int usrp_tx_thread;
/***************************************************************************************************************************************/
#define SOFTMODEM_NOS1_BIT (1<<0)
-#define SOFTMODEM_NOKRNMOD_BIT (1<<1)
#define SOFTMODEM_NONBIOT_BIT (1<<2)
#define SOFTMODEM_RFSIM_BIT (1<<10)
#define SOFTMODEM_SIML1_BIT (1<<12)
@@ -298,7 +294,6 @@ extern int usrp_tx_thread;
#define IS_SOFTMODEM_NOS1 ( get_softmodem_optmask() & SOFTMODEM_NOS1_BIT)
-#define IS_SOFTMODEM_NOKRNMOD ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT)
#define IS_SOFTMODEM_NONBIOT ( get_softmodem_optmask() & SOFTMODEM_NONBIOT_BIT)
#define IS_SOFTMODEM_RFSIM ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT)
#define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT)
diff --git a/openair1/PHY/CMakeLists.txt b/openair1/PHY/CMakeLists.txt
index 6f364e4daf..b841d00601 100644
--- a/openair1/PHY/CMakeLists.txt
+++ b/openair1/PHY/CMakeLists.txt
@@ -1,7 +1,2 @@
-add_boolean_option(ENABLE_UESCOPE OFF "Whether to build the lte uescope" OFF)
-add_boolean_option(ENABLE_ENBSCOPE OFF "Whether to build the lte enbcope" OFF)
-add_boolean_option(ENABLE_NRSCOPE OFF "Whether to build the 5G scope" OFF)
-if(ENABLE_UESCOPE OR ENABLE_ENBSCOPE OR ENABLE_NRSCOPE)
- add_subdirectory(TOOLS)
-endif()
add_subdirectory(nr_phy_common)
+add_subdirectory(TOOLS)
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
index 9393bfc048..db6bdff2cd 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
@@ -69,7 +69,7 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
uint32_t aarx /* ,rx_power_correction */;
uint32_t rb;
- int32_t *ul_ch;
+ c16_t *ul_ch;
int32_t n0_power_tot;
int64_t n0_power_tot2;
int len;
@@ -112,9 +112,9 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
for (aarx=0; aarxnb_antennas_rx; aarx++) {
measurements->n0_subband_power[aarx][rb] = 0;
for (int s=0;s<(14-(frame_parms->Ncp<<1));s++) {
- offset = offset0 + (s*frame_parms->ofdm_symbol_size);
- ul_ch = &common_vars->rxdataF[aarx][offset];
- len = 12;
+ offset = offset0 + (s*frame_parms->ofdm_symbol_size);
+ ul_ch = (c16_t *)&common_vars->rxdataF[aarx][offset];
+ len = 12;
// just do first half of middle PRB for odd number of PRBs
if (((frame_parms->N_RB_UL&1) == 1) &&
(rb==(frame_parms->N_RB_UL>>1))) {
@@ -154,7 +154,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
int32_t aarx,rx_power_correction;
int32_t rx_power;
uint32_t rb;
- int32_t *ul_ch;
+ c16_t *ul_ch;
//printf("Running eNB_srs_measurements for eNB_id %d\n",eNB_id);
@@ -176,9 +176,9 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
measurements->rx_spatial_power[srs_id][0][aarx] =
- ((signal_energy_nodc(&srs_vars->srs_ch_estimates[aarx][frame_parms->first_carrier_offset],
+ ((signal_energy_nodc((c16_t*)&srs_vars->srs_ch_estimates[aarx][frame_parms->first_carrier_offset],
(frame_parms->N_RB_DL*6)) +
- signal_energy_nodc(&srs_vars->srs_ch_estimates[aarx][1],
+ signal_energy_nodc((c16_t*)&srs_vars->srs_ch_estimates[aarx][1],
(frame_parms->N_RB_DL*6)))*rx_power_correction) -
measurements->n0_power[aarx];
@@ -219,9 +219,9 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
// printf("common_vars->srs_ch_estimates[0] => %x\n",common_vars->srs_ch_estimates[0]);
if (rb < 12)
- ul_ch = &srs_vars->srs_ch_estimates[aarx][frame_parms->first_carrier_offset + (rb*12)];
+ ul_ch = (c16_t *)&srs_vars->srs_ch_estimates[aarx][frame_parms->first_carrier_offset + (rb * 12)];
else if (rb>12)
- ul_ch = &srs_vars->srs_ch_estimates[aarx][6 + (rb-13)*12];
+ ul_ch = (c16_t *)&srs_vars->srs_ch_estimates[aarx][6 + (rb - 13) * 12];
else {
measurements->subband_cqi_dB[srs_id][aarx][rb] = 0;
continue;
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
index 453b8a3e79..c9ec2449e1 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
@@ -1062,7 +1062,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
for (aarx=0; aarxnb_antennas_rx; aarx++) {
for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) {
ue->measurements.rx_spatial_power[eNB_id][aatx][aarx] =
- (signal_energy_nodc(&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][(aatx<<1) + aarx][0],
+ (signal_energy_nodc((c16_t*)&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][(aatx<<1) + aarx][0],
(N_RB_DL*12)));
//- ue->measurements.n0_power[aarx];
@@ -1169,7 +1169,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
msg("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]);
*/
ue->measurements.subband_cqi[eNB_id][aarx][subband] =
- (signal_energy_nodc(dl_ch0,subband_size) + signal_energy_nodc(dl_ch1,subband_size));
+ (signal_energy_nodc((c16_t*)dl_ch0,subband_size) + signal_energy_nodc((c16_t*)dl_ch1,subband_size));
if ( ue->measurements.subband_cqi[eNB_id][aarx][subband] < 0)
ue->measurements.subband_cqi[eNB_id][aarx][subband]=0;
@@ -1185,8 +1185,8 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
} else { // this is for the last subband which is smaller in size
// for (i=0;i<12;i++)
// printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]);
- ue->measurements.subband_cqi[eNB_id][aarx][subband] = (signal_energy_nodc(dl_ch0,last_subband_size) +
- signal_energy_nodc(dl_ch1,last_subband_size)); // - ue->measurements.n0_power[aarx];
+ ue->measurements.subband_cqi[eNB_id][aarx][subband] = (signal_energy_nodc((c16_t*)dl_ch0,last_subband_size) +
+ signal_energy_nodc((c16_t*)dl_ch1,last_subband_size)); // - ue->measurements.n0_power[aarx];
ue->measurements.subband_cqi_tot[eNB_id][subband] += ue->measurements.subband_cqi[eNB_id][aarx][subband];
ue->measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(ue->measurements.subband_cqi[eNB_id][aarx][subband],
ue->measurements.n0_power[aarx]);
@@ -1297,7 +1297,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
// for (i=0;i<48;i++)
// printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]);
ue->measurements.subband_cqi[eNB_id][aarx][subband] =
- (signal_energy_nodc(dl_ch0,48) ) - ue->measurements.n0_power[aarx];
+ (signal_energy_nodc((c16_t*)dl_ch0,48) ) - ue->measurements.n0_power[aarx];
ue->measurements.subband_cqi_tot[eNB_id][subband] += ue->measurements.subband_cqi[eNB_id][aarx][subband];
ue->measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(ue->measurements.subband_cqi[eNB_id][aarx][subband],
@@ -1305,7 +1305,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
} else {
// for (i=0;i<12;i++)
// printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]);
- ue->measurements.subband_cqi[eNB_id][aarx][subband] = (signal_energy_nodc(dl_ch0,12) ) - ue->measurements.n0_power[aarx];
+ ue->measurements.subband_cqi[eNB_id][aarx][subband] = (signal_energy_nodc((c16_t*)dl_ch0,12) ) - ue->measurements.n0_power[aarx];
ue->measurements.subband_cqi_tot[eNB_id][subband] += ue->measurements.subband_cqi[eNB_id][aarx][subband];
ue->measurements.subband_cqi_dB[eNB_id][aarx][subband] = dB_fixed2(ue->measurements.subband_cqi[eNB_id][aarx][subband],
ue->measurements.n0_power[aarx]);
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
index 33425766ab..897f4b1371 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
@@ -843,7 +843,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
}
for (i=0; inb_antennas_rx; i++) {
- pusch_vars->ulsch_power[i] = signal_energy_nodc(pusch_vars->drs_ch_estimates[i],
+ pusch_vars->ulsch_power[i] = signal_energy_nodc((c16_t*)pusch_vars->drs_ch_estimates[i],
ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)/correction_factor;
LOG_D(PHY,"%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d) power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid,
ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_100Ks,correction_factor,dB_fixed_x10(pusch_vars->ulsch_power[i]));
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
index 2e29fd41d1..b9ba9347cf 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
@@ -1955,7 +1955,7 @@ void dlsch_channel_compensation_TM56(int **rxdataF_ext,
}
Nre = (pilots==0) ? 12 : 8;
- precoded_signal_strength += ((signal_energy_nodc(&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*Nre],
+ precoded_signal_strength += ((signal_energy_nodc((c16_t*)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*Nre],
(nb_rb*Nre))) - (measurements->n0_power[aarx]));
} // rx_antennas
@@ -2349,9 +2349,9 @@ void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms,
} // rb loop
Nre = (pilots==0) ? 12 : 8;
- precoded_signal_strength0 += ((signal_energy_nodc(&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*Nre],
+ precoded_signal_strength0 += ((signal_energy_nodc((c16_t*)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*Nre],
(nb_rb*Nre))*rx_power_correction) - (measurements->n0_power[aarx]));
- precoded_signal_strength1 += ((signal_energy_nodc(&dl_ch_estimates_ext[aarx+2][symbol*frame_parms->N_RB_DL*Nre],
+ precoded_signal_strength1 += ((signal_energy_nodc((c16_t*)&dl_ch_estimates_ext[aarx+2][symbol*frame_parms->N_RB_DL*Nre],
(nb_rb*Nre))*rx_power_correction) - (measurements->n0_power[aarx]));
} // rx_antennas
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/sldch.c b/openair1/PHY/LTE_UE_TRANSPORT/sldch.c
index 8769d5f81b..2f7f652b5d 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/sldch.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/sldch.c
@@ -31,8 +31,6 @@
*/
#include "PHY/defs_UE.h"
-extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP);
-
void generate_sldch(PHY_VARS_UE *ue,SLDCH_t *sldch,int frame_tx,int subframe_tx) {
UE_tport_t pdu;
@@ -54,10 +52,5 @@ void generate_sldch(PHY_VARS_UE *ue,SLDCH_t *sldch,int frame_tx,int subframe_tx)
sldch->payload_length,
sldch_header_len+sizeof(SLDCH_t)-sizeof(uint8_t*)+sldch->payload_length);
- multicast_link_write_sock(0,
- (char *)&pdu,
- sldch_header_len+sizeof(SLDCH_t));
-
+ AssertFatal(false, "multicast_link_write_sock() not implemented\n");
}
-
-
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/slsch.c b/openair1/PHY/LTE_UE_TRANSPORT/slsch.c
index e4e94a232d..8dda31fbe4 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/slsch.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/slsch.c
@@ -31,10 +31,6 @@
*/
#include "PHY/defs_UE.h"
-extern int
-multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP);
-
-
void generate_slsch(PHY_VARS_UE *ue,SLSCH_t *slsch,int frame_tx,int subframe_tx) {
UE_tport_t pdu;
@@ -58,9 +54,6 @@ void generate_slsch(PHY_VARS_UE *ue,SLSCH_t *slsch,int frame_tx,int subframe_tx)
slsch->payload_length,
slsch_header_len+sizeof(SLSCH_t)-sizeof(uint8_t*)+slsch->payload_length);
- multicast_link_write_sock(0,
- (char *)&pdu,
- slsch_header_len+sizeof(SLSCH_t)-sizeof(uint8_t*)+slsch->payload_length);
-
+ AssertFatal(false, "multicast_link_write_sock() not implemented\n");
}
}
diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c
index ffcd0b13ad..faee44cc9e 100644
--- a/openair1/PHY/MODULATION/slot_fep_nr.c
+++ b/openair1/PHY/MODULATION/slot_fep_nr.c
@@ -184,14 +184,12 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
rxdata_ptr = (int16_t *)tmp_dft_in;
}
- start_meas(&ue->rx_dft_stats);
-
+ start_meas_nr_ue_phy(ue, RX_DFT_STATS);
dft(dftsize,
rxdata_ptr,
(int16_t *)&rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
1);
-
- stop_meas(&ue->rx_dft_stats);
+ stop_meas_nr_ue_phy(ue, RX_DFT_STATS);
apply_nr_rotation_RX(frame_parms, rxdataF[aa], frame_parms->symbol_rotation[linktype], Ns, frame_parms->N_RB_DL, 0, symbol, 1);
}
diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
index a45734e791..e36471c25d 100644
--- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
+++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
@@ -143,12 +143,12 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB, int slot, int first_symb, int num_sy
int offset = offset0 + (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size;
nb_symb[rb]++;
for (int aarx=0; aarxnb_antennas_rx; aarx++) {
- int32_t *ul_ch = (int32_t *)&common_vars->rxdataF[aarx][offset];
+ c16_t *ul_ch = &common_vars->rxdataF[aarx][offset];
int32_t signal_energy;
if (((frame_parms->N_RB_UL&1) == 1) &&
(rb==(frame_parms->N_RB_UL>>1))) {
signal_energy = signal_energy_nodc(ul_ch, 6);
- ul_ch = (int32_t *)&common_vars->rxdataF[aarx][offset0];
+ ul_ch = &common_vars->rxdataF[aarx][offset0];
signal_energy += signal_energy_nodc(ul_ch, 6);
} else {
signal_energy = signal_energy_nodc(ul_ch, 12);
@@ -229,7 +229,7 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB,
for (int aatx = 0; aatx < nrOfLayers; aatx++){
rx_spatial_power[aatx][aarx] =
- (signal_energy_nodc(&pusch_vars->ul_ch_estimates[aatx * fp->nb_antennas_rx + aarx][ch_offset],
+ (signal_energy_nodc((c16_t*)&pusch_vars->ul_ch_estimates[aatx * fp->nb_antennas_rx + aarx][ch_offset],
N_RB_UL * NR_NB_SC_PER_RB));
if (rx_spatial_power[aatx][aarx] < 0) {
diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
index 96266e279a..2d33e0f55b 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
@@ -1522,7 +1522,7 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB,
}
for (int aatx = 0; aatx < rel15_ul->nrOfLayers; aatx++) {
pusch_vars->ulsch_power[aarx] += signal_energy_nodc(
- &pusch_vars->ul_ch_estimates[aatx * gNB->frame_parms.nb_antennas_rx + aarx][symbol * frame_parms->ofdm_symbol_size],
+ (c16_t*)&pusch_vars->ul_ch_estimates[aatx * gNB->frame_parms.nb_antennas_rx + aarx][symbol * frame_parms->ofdm_symbol_size],
rel15_ul->rb_size * 12);
}
for (int rb = 0; rb < rel15_ul->rb_size; rb++)
diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c
index b7534322cb..d4cf436c76 100644
--- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c
+++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c
@@ -266,7 +266,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
printf("x (%d,%d), xr (%ld,%ld)\n", x_re[l][n], x_im[l][n], xr[aa][l][n].r, xr[aa][l][n].i);
#endif
}
- int energ = signal_energy_nodc((int32_t *)rp, nb_re_pucch);
+ int energ = signal_energy_nodc(rp, nb_re_pucch);
signal_energy += energ;
if (aa == 0)
signal_energy_ant0 += energ;
@@ -1059,6 +1059,8 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
c16_t rp[Prx2][2][nb_re_pucch];
memset(rp, 0, sizeof(rp));
+ int64_t pucch2_lev = 0;
+
for (int aa=0;aanr_of_symbols;symb++) {
c16_t *tmp_rp = ((c16_t *)&rxdataF[aa][soffset + (l2 + symb) * frame_parms->ofdm_symbol_size]);
@@ -1072,10 +1074,23 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
memcpy(rp[aa][symb], &tmp_rp[re_offset[symb]], neg_length * sizeof(c16_t));
memcpy(&rp[aa][symb][neg_length], tmp_rp, pos_length * sizeof(c16_t));
}
+ pucch2_lev += signal_energy_nodc(rp[aa][symb], nb_re_pucch);
}
}
+ pucch2_lev /= Prx * Prx * pucch_pdu->nr_of_symbols;
+ int pucch2_levdB = dB_fixed(pucch2_lev);
+ int scaling = 0;
+ if (pucch2_levdB > 72)
+ scaling = 4;
+ else if (pucch2_levdB > 66)
+ scaling = 3;
+ else if (pucch2_levdB > 60)
+ scaling = 2;
+ else if (pucch2_levdB > 54)
+ scaling = 1;
+
LOG_D(PHY,
- "%d.%d Decoding pucch2 for %d symbols, %d PRB, nb_harq %d, nb_sr %d, nb_csi %d/%d\n",
+ "%d.%d Decoding pucch2 for %d symbols, %d PRB, nb_harq %d, nb_sr %d, nb_csi %d/%d, pucch2_lev %d dB (scaling %d)\n",
frame,
slot,
pucch_pdu->nr_of_symbols,
@@ -1083,7 +1098,9 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
pucch_pdu->bit_len_harq,
pucch_pdu->sr_flag,
pucch_pdu->bit_len_csi_part1,
- pucch_pdu->bit_len_csi_part2);
+ pucch_pdu->bit_len_csi_part2,
+ pucch2_levdB,
+ scaling);
int nc_group_size=1; // 2 PRB
int ngroup = prb_size_ext/nc_group_size/2;
@@ -1124,14 +1141,14 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
for (int idx = 0; idx < 4; idx++) {
c16_t *rp_base = rp[aa][symb] + prb * 12 + 3 * idx;
AssertFatal(prb * 12 + 3 * idx + 2 < nb_re_pucch, "");
- r_re_ext_p[idx << 1] = rp_base->r;
- r_im_ext_p[idx << 1] = rp_base->i;
+ r_re_ext_p[idx << 1] = rp_base->r >> scaling;
+ r_im_ext_p[idx << 1] = rp_base->i >> scaling;
rp_base++;
- rd_re_ext_p[idx] = rp_base->r;
- rd_im_ext_p[idx] = rp_base->i;
+ rd_re_ext_p[idx] = rp_base->r >> scaling;
+ rd_im_ext_p[idx] = rp_base->i >> scaling;
rp_base++;
- r_re_ext_p[1 + (idx << 1)] = rp_base->r;
- r_im_ext_p[1 + (idx << 1)] = rp_base->i;
+ r_re_ext_p[1 + (idx << 1)] = rp_base->r >> scaling;
+ r_im_ext_p[1 + (idx << 1)] = rp_base->i >> scaling;
}
#ifdef DEBUG_NR_PUCCH_RX
@@ -1519,24 +1536,38 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
corr_re = ( corr32_re[symb][half_prb>>2][aa]/(2*nc_group_size*4/2)+((int16_t*)(&prod_re[aa]))[0]);
corr_im = ( corr32_im[symb][half_prb>>2][aa]/(2*nc_group_size*4/2)+((int16_t*)(&prod_im[aa]))[0]);
corr_tmp += (corr_re*corr_re + corr_im*corr_im)>>(Prx/2);
- /*
- LOG_D(PHY,"pucch2 half_prb %d cw %d (%d,%d) aa %d: (%d,%d,%d,%d,%d,%d,%d,%d)x(%d,%d,%d,%d,%d,%d,%d,%d) (%d,%d)+(%d,%d)
- = (%d,%d) => %d\n", half_prb,cw,cw&15,cw>>4,aa,
- ((int16_t*)&pucch2_polar_4bit[cw&15])[0],((int16_t*)&pucch2_polar_4bit[cw>>4])[0],
- ((int16_t*)&pucch2_polar_4bit[cw&15])[1],((int16_t*)&pucch2_polar_4bit[cw>>4])[1],
- ((int16_t*)&pucch2_polar_4bit[cw&15])[2],((int16_t*)&pucch2_polar_4bit[cw>>4])[2],
- ((int16_t*)&pucch2_polar_4bit[cw&15])[3],((int16_t*)&pucch2_polar_4bit[cw>>4])[3],
- ((int16_t*)&rp_re[aa][half_prb])[0],((int16_t*)&rp_im[aa][half_prb])[0],
- ((int16_t*)&rp_re[aa][half_prb])[1],((int16_t*)&rp_im[aa][half_prb])[1],
- ((int16_t*)&rp_re[aa][half_prb])[2],((int16_t*)&rp_im[aa][half_prb])[2],
- ((int16_t*)&rp_re[aa][half_prb])[3],((int16_t*)&rp_im[aa][half_prb])[3],
- corr32_re[half_prb>>2][aa]/(2*nc_group_size*4/2),corr32_im[half_prb>>2][aa]/(2*nc_group_size*4/2),
- ((int16_t*)(&prod_re[aa]))[0],
- ((int16_t*)(&prod_im[aa]))[0],
- corr_re,
- corr_im,
- corr_tmp);
- */
+
+ LOG_D(PHY,
+ "pucch2 half_prb %d cw %d (%d,%d) aa %d: (%d,%d,%d,%d,%d,%d,%d,%d)x(%d,%d,%d,%d,%d,%d,%d,%d) (%d,%d)+(%d,%d) = "
+ "(%d,%d) => %d\n",
+ half_prb,
+ cw,
+ cw & 15,
+ cw >> 4,
+ aa,
+ ((int16_t *)&pucch2_polar_4bit[cw & 15])[0],
+ ((int16_t *)&pucch2_polar_4bit[cw >> 4])[0],
+ ((int16_t *)&pucch2_polar_4bit[cw & 15])[1],
+ ((int16_t *)&pucch2_polar_4bit[cw >> 4])[1],
+ ((int16_t *)&pucch2_polar_4bit[cw & 15])[2],
+ ((int16_t *)&pucch2_polar_4bit[cw >> 4])[2],
+ ((int16_t *)&pucch2_polar_4bit[cw & 15])[3],
+ ((int16_t *)&pucch2_polar_4bit[cw >> 4])[3],
+ ((int16_t *)&rp_re[aa][half_prb])[0],
+ ((int16_t *)&rp_im[aa][half_prb])[0],
+ ((int16_t *)&rp_re[aa][half_prb])[1],
+ ((int16_t *)&rp_im[aa][half_prb])[1],
+ ((int16_t *)&rp_re[aa][half_prb])[2],
+ ((int16_t *)&rp_im[aa][half_prb])[2],
+ ((int16_t *)&rp_re[aa][half_prb])[3],
+ ((int16_t *)&rp_im[aa][half_prb])[3],
+ corr32_re[symb][half_prb >> 2][aa] / (2 * nc_group_size * 4 / 2),
+ corr32_im[symb][half_prb >> 2][aa] / (2 * nc_group_size * 4 / 2),
+ ((int16_t *)(&prod_re[aa]))[0],
+ ((int16_t *)(&prod_im[aa]))[0],
+ corr_re,
+ corr_im,
+ corr_tmp);
}
corr16 = simde_mm_set1_epi16((int16_t)(corr_tmp >> 8));
@@ -1624,7 +1655,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
uci_pdu->pucch_format=0;
uci_pdu->ul_cqi=cqi;
uci_pdu->timing_advance=0xffff; // currently not valid
- uci_pdu->rssi=1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy_nodc((int32_t *)&rxdataF[0][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[0]],12*pucch_pdu->prb_size)));
+ uci_pdu->rssi=1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy_nodc(&rxdataF[0][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[0]],12*pucch_pdu->prb_size)));
if (pucch_pdu->bit_len_harq>0) {
int harq_bytes=pucch_pdu->bit_len_harq>>3;
if ((pucch_pdu->bit_len_harq&7) > 0) harq_bytes++;
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
index 3e42680dc8..0fb94f93f3 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
@@ -113,7 +113,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
ue->measurements.rx_power[gNB_id][aarx] = 0;
for (aatx = 0; aatx < frame_parms->nb_antenna_ports_gNB; aatx++){
- const int z=signal_energy_nodc(&dl_ch_estimates[gNB_id][ch_offset], N_RB_DL * NR_NB_SC_PER_RB);
+ const int z=signal_energy_nodc((c16_t*)&dl_ch_estimates[gNB_id][ch_offset], N_RB_DL * NR_NB_SC_PER_RB);
rx_spatial_power[gNB_id][aatx][aarx] = z;
if (rx_spatial_power[gNB_id][aatx][aarx] < 0)
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
index 6c57130b3d..e295681ae0 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
@@ -83,9 +83,9 @@ static bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue,
NR_UE_DLSCH_t *dlsch = (NR_UE_DLSCH_t *) rdata->dlsch;
int r = rdata->segment_r;
- merge_meas(&phy_vars_ue->dlsch_deinterleaving_stats, &rdata->ts_deinterleave);
- merge_meas(&phy_vars_ue->dlsch_rate_unmatching_stats, &rdata->ts_rate_unmatch);
- merge_meas(&phy_vars_ue->dlsch_ldpc_decoding_stats, &rdata->ts_ldpc_decode);
+ merge_meas(&phy_vars_ue->phy_cpu_stats.cpu_time_stats[DLSCH_DEINTERLEAVING_STATS], &rdata->ts_deinterleave);
+ merge_meas(&phy_vars_ue->phy_cpu_stats.cpu_time_stats[DLSCH_RATE_UNMATCHING_STATS], &rdata->ts_rate_unmatch);
+ merge_meas(&phy_vars_ue->phy_cpu_stats.cpu_time_stats[DLSCH_LDPC_DECODING_STATS], &rdata->ts_ldpc_decode);
bool decodeSuccess = (rdata->decodeIterations < (1+dlsch->max_ldpc_iterations));
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
index 7476309ad8..6537e4b840 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
@@ -438,12 +438,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
//--------------------- RBs extraction ---------------------
//----------------------------------------------------------
const int n_rx = frame_parms->nb_antennas_rx;
- time_stats_t meas = {0};
const bool meas_enabled = cpumeas(CPUMEAS_GETSTATE);
- if (meas_enabled)
- start_meas(&meas);
{
+ start_meas_nr_ue_phy(ue, DLSCH_EXTRACT_RBS_STATS);
__attribute__((aligned(32))) c16_t rxdataF_ext[nbRx][rx_size_symbol];
memset(rxdataF_ext, 0, sizeof(rxdataF_ext));
@@ -469,15 +467,15 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
dlsch_config->dlDmrsSymbPos,
csi_res_bitmap,
ue->chest_time);
+ stop_meas_nr_ue_phy(ue, DLSCH_EXTRACT_RBS_STATS);
if (meas_enabled) {
- stop_meas(&meas);
LOG_D(PHY,
"[AbsSFN %u.%d] Slot%d Symbol %d: Pilot/Data extraction %5.2f \n",
frame,
nr_slot_rx,
slot,
symbol,
- meas.p_time / (cpuf * 1000.0));
+ ue->phy_cpu_stats.cpu_time_stats[DLSCH_EXTRACT_RBS_STATS].p_time / (cpuf * 1000.0));
}
if (ue->phy_sim_pdsch_rxdataF_ext)
for (unsigned char aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
@@ -491,25 +489,23 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
//----------------------------------------------------------
//--------------------- Channel Scaling --------------------
//----------------------------------------------------------
- if (meas_enabled)
- start_meas(&meas);
+ start_meas_nr_ue_phy(ue, DLSCH_CHANNEL_SCALE_STATS);
nr_dlsch_scale_channel(rx_size_symbol, dl_ch_estimates_ext, frame_parms, nl, n_rx, symbol, pilots, nb_re_pdsch, nb_rb_pdsch);
+ stop_meas_nr_ue_phy(ue, DLSCH_CHANNEL_SCALE_STATS);
if (meas_enabled) {
- stop_meas(&meas);
LOG_D(PHY,
"[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",
frame,
nr_slot_rx,
slot,
symbol,
- meas.p_time / (cpuf * 1000.0));
+ ue->phy_cpu_stats.cpu_time_stats[DLSCH_CHANNEL_SCALE_STATS].p_time / (cpuf * 1000.0));
}
//----------------------------------------------------------
//--------------------- Channel Level Calc. ----------------
//----------------------------------------------------------
- if (meas_enabled)
- start_meas(&meas);
+ start_meas_nr_ue_phy(ue, DLSCH_CHANNEL_LEVEL_STATS);
if (first_symbol_flag) {
int32_t avg[MAX_ANT][MAX_ANT] = {};
if (nb_re_pdsch)
@@ -537,8 +533,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
// LOG_I(PHY, "avgs Power per SC is %d lg2_maxh %d\n", avgs, log2_maxh);
LOG_D(PHY, "[DLSCH] AbsSubframe %d.%d log2_maxh = %d (%d)\n", frame % 1024, nr_slot_rx, *log2_maxh, avgs);
}
+ stop_meas_nr_ue_phy(ue, DLSCH_CHANNEL_LEVEL_STATS);
if (meas_enabled) {
- stop_meas(&meas);
LOG_D(PHY,
"[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",
frame,
@@ -546,7 +542,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
slot,
symbol,
first_symbol_flag,
- meas.p_time / (cpuf * 1000.0));
+ ue->phy_cpu_stats.cpu_time_stats[DLSCH_CHANNEL_LEVEL_STATS].p_time / (cpuf * 1000.0));
}
#if T_TRACER
T(T_UE_PHY_PDSCH_ENERGY, T_INT(gNB_id), T_INT(0), T_INT(frame % 1024), T_INT(nr_slot_rx));
@@ -556,8 +552,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
//--------------------- channel compensation ---------------
//----------------------------------------------------------
// Disable correlation measurement for optimizing UE
- if (meas_enabled)
- start_meas(&meas);
+ start_meas_nr_ue_phy(ue, DLSCH_CHANNEL_COMPENSATION_STATS);
nr_dlsch_channel_compensation(rx_size_symbol,
nbRx,
rxdataF_ext,
@@ -576,8 +571,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
nb_rb_pdsch,
*log2_maxh,
measurements); // log2_maxh+I0_shift
+ stop_meas_nr_ue_phy(ue, DLSCH_CHANNEL_COMPENSATION_STATS);
if (meas_enabled) {
- stop_meas(&meas);
LOG_D(PHY,
"[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d Channel Comp %5.2f \n",
frame,
@@ -585,13 +580,11 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
slot,
symbol,
*log2_maxh,
- meas.p_time / (cpuf * 1000.0));
+ ue->phy_cpu_stats.cpu_time_stats[DLSCH_CHANNEL_COMPENSATION_STATS].p_time / (cpuf * 1000.0));
}
}
- if (meas_enabled)
- start_meas(&meas);
-
+ start_meas_nr_ue_phy(ue, DLSCH_MRC_MMSE_STATS);
if (n_rx > 1) {
nr_dlsch_detection_mrc(rx_size_symbol,
nl,
@@ -620,20 +613,20 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
nb_re_pdsch,
nvar);
}
+ stop_meas_nr_ue_phy(ue, DLSCH_MRC_MMSE_STATS);
if (meas_enabled) {
- stop_meas(&meas);
LOG_D(PHY,
"[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine and MMSE %5.2f \n",
frame,
nr_slot_rx,
slot,
symbol,
- meas.p_time / (cpuf * 1000.0));
+ ue->phy_cpu_stats.cpu_time_stats[DLSCH_MRC_MMSE_STATS].p_time / (cpuf * 1000.0));
}
- if (meas_enabled)
- start_meas(&meas);
+
+
/* Store the valid DL RE's */
dl_valid_re[symbol-1] = nb_re_pdsch;
int startSymbIdx = 0;
@@ -682,6 +675,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
else
first_symbol_flag = 0;
/* Calculate LLR's for each symbol */
+ start_meas_nr_ue_phy(ue, DLSCH_LLR_STATS);
nr_dlsch_llr(rx_size_symbol,
nbRx,
rx_llr_layer_size,
@@ -703,8 +697,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
nr_slot_rx,
dlsch,
llr_offset);
+ stop_meas_nr_ue_phy(ue, DLSCH_LLR_STATS);
}
+ start_meas_nr_ue_phy(ue, DLSCH_LAYER_DEMAPPING);
nr_dlsch_layer_demapping(llr,
dlsch[0].Nl,
dlsch[0].dlsch_config.qamModOrder,
@@ -713,6 +709,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
codeword_TB1,
rx_llr_layer_size,
layer_llr);
+ stop_meas_nr_ue_phy(ue, DLSCH_LAYER_DEMAPPING);
// Please keep it: useful for debugging
#ifdef DEBUG_PDSCH_RX
char filename[50];
@@ -742,14 +739,13 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
}
if (meas_enabled) {
- stop_meas(&meas);
LOG_D(PHY,
"[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",
frame,
nr_slot_rx,
slot,
symbol,
- meas.p_time / (cpuf * 1000.0));
+ ue->phy_cpu_stats.cpu_time_stats[DLSCH_LLR_STATS].p_time / (cpuf * 1000.0));
}
#if T_TRACER
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
index 1d7a8fd6d8..98c6dc3dfb 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
@@ -48,7 +48,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
uint32_t tb_size,
unsigned int G)
{
- start_meas(&ue->ulsch_encoding_stats);
+ start_meas_nr_ue_phy(ue, ULSCH_ENCODING_STATS);
/////////////////////////parameters and variables initialization/////////////////////////
@@ -107,7 +107,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
harq_process->BG = ulsch->pusch_pdu.ldpcBaseGraph;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_IN);
- start_meas(&ue->ulsch_segmentation_stats);
+ start_meas_nr_ue_phy(ue, ULSCH_SEGMENTATION_STATS);
impp.Kb = nr_segmentation(harq_process->payload_AB,
harq_process->c,
B,
@@ -126,7 +126,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
LOG_E(PHY, "nr_segmentation.c: too many segments %d, B %d\n", impp.n_segments, B);
return(-1);
}
- stop_meas(&ue->ulsch_segmentation_stats);
+ stop_meas_nr_ue_phy(ue, ULSCH_SEGMENTATION_STATS);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_OUT);
#ifdef DEBUG_ULSCH_CODING
@@ -148,7 +148,8 @@ 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);
+
+ start_meas_nr_ue_phy(ue, ULSCH_LDPC_ENCODING_STATS);
if (ldpc_interface_offload.LDPCencoder) {
for (int j = 0; j < impp.n_segments; j++) {
impp.perCB[j].E_cb = nr_get_E(G, impp.n_segments, impp.Qm, ulsch->pusch_pdu.nrOfLayers, j);
@@ -168,6 +169,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
write_output("ulsch_enc_output0.m", "enc0", &harq_process->d[0][0], (3 * 8 * Kr_bytes) + 12, 1, 4);
#endif
}
+ stop_meas_nr_ue_phy(ue, ULSCH_LDPC_ENCODING_STATS);
///////////////////////////////////////////////////////////////////////////////
for (int r = 0; r < impp.n_segments; r++) { // looping over C segments
if (impp.F > 0) {
@@ -191,7 +193,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
impp.perCB[r].E_cb = nr_get_E(G, impp.n_segments, impp.Qm, ulsch->pusch_pdu.nrOfLayers, r);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_IN);
- start_meas(&ue->ulsch_rate_matching_stats);
+ start_meas(&ue->phy_cpu_stats.cpu_time_stats[ULSCH_RATE_MATCHING_STATS]);
if (nr_rate_matching_ldpc(ulsch->pusch_pdu.tbslbrm,
impp.BG,
impp.Zc,
@@ -205,7 +207,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
== -1)
return -1;
- stop_meas(&ue->ulsch_rate_matching_stats);
+ stop_meas(&ue->phy_cpu_stats.cpu_time_stats[ULSCH_RATE_MATCHING_STATS]);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_OUT);
#ifdef DEBUG_ULSCH_CODING
@@ -215,9 +217,9 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
///////////////////////// e---->| Rate matching bit interleaving |---->f /////////////////////////
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INTERLEAVING_LDPC, VCD_FUNCTION_IN);
- start_meas(&ue->ulsch_interleaving_stats);
+ start_meas_nr_ue_phy(ue, ULSCH_INTERLEAVING_STATS);
nr_interleaving_ldpc(impp.perCB[r].E_cb, impp.Qm, harq_process->e + r_offset, harq_process->f + r_offset);
- stop_meas(&ue->ulsch_interleaving_stats);
+ stop_meas_nr_ue_phy(ue, ULSCH_INTERLEAVING_STATS);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INTERLEAVING_LDPC, VCD_FUNCTION_OUT);
#ifdef DEBUG_ULSCH_CODING
@@ -231,6 +233,6 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
}
///////////////////////////////////////////////////////////////////////////////////////////////
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
- stop_meas(&ue->ulsch_encoding_stats);
+ stop_meas_nr_ue_phy(ue, ULSCH_ENCODING_STATS);
return(0);
}
diff --git a/openair1/PHY/TOOLS/CMakeLists.txt b/openair1/PHY/TOOLS/CMakeLists.txt
index 8acd528617..93ef4f5cc7 100644
--- a/openair1/PHY/TOOLS/CMakeLists.txt
+++ b/openair1/PHY/TOOLS/CMakeLists.txt
@@ -29,29 +29,37 @@
#* \warning
#*/
-find_library(forms NAMES forms)
-if(NOT forms)
- message(FATAL_ERROR "required library forms not found for building scopes")
-else()
- message(STATUS "libforms library, required for scopes, found at ${forms}")
+add_boolean_option(ENABLE_UESCOPE OFF "Whether to build the lte uescope" OFF)
+add_boolean_option(ENABLE_ENBSCOPE OFF "Whether to build the lte enbcope" OFF)
+add_boolean_option(ENABLE_NRSCOPE OFF "Whether to build the 5G scope" OFF)
+if(ENABLE_UESCOPE OR ENABLE_ENBSCOPE OR ENABLE_NRSCOPE)
+ find_library(forms NAMES forms)
+ if(NOT forms)
+ message(FATAL_ERROR "required library forms not found for building scopes")
+ else()
+ message(STATUS "libforms library, required for scopes, found at ${forms}")
+ endif()
+
+ include_directories ("/usr/include/X11")
+ add_library(xforms_common OBJECT
+ lte_phy_scope.c
+ ../../../executables/stats.c)
+ target_link_libraries(xforms_common PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
+
+ add_library(enbscope MODULE lte_enb_scope.c $)
+ target_link_libraries(enbscope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
+
+ add_library(uescope MODULE lte_ue_scope.c $)
+ target_link_libraries(uescope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
+
+ add_library(nrscope MODULE nr_phy_scope.c)
+ target_link_libraries(nrscope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
+
+ # all libraries should be written to root build dir (default creates the same hierarchie under build as existing for sources)
+ set_target_properties(enbscope uescope nrscope
+ PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../../..
+ )
+endif()
+if (ENABLE_TESTS)
+ add_subdirectory(tests)
endif()
-
-include_directories ("/usr/include/X11")
-add_library(xforms_common OBJECT
- lte_phy_scope.c
- ../../../executables/stats.c)
-target_link_libraries(xforms_common PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
-
-add_library(enbscope MODULE lte_enb_scope.c $)
-target_link_libraries(enbscope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
-
-add_library(uescope MODULE lte_ue_scope.c $)
-target_link_libraries(uescope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
-
-add_library(nrscope MODULE nr_phy_scope.c)
-target_link_libraries(nrscope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
-
-# all libraries should be written to root build dir (default creates the same hierarchie under build as existing for sources)
-set_target_properties(enbscope uescope nrscope
- PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../../..
-)
diff --git a/openair1/PHY/TOOLS/signal_energy.c b/openair1/PHY/TOOLS/signal_energy.c
index 3f2b9a456d..affee5dac4 100644
--- a/openair1/PHY/TOOLS/signal_energy.c
+++ b/openair1/PHY/TOOLS/signal_energy.c
@@ -112,30 +112,32 @@ int32_t signal_energy_amp_shift(int32_t *input,uint32_t length)
return((temp>0)?temp:1);
}
-int32_t signal_energy_nodc(int32_t *input,uint32_t length)
+int32_t signal_energy_nodc(const c16_t *input, uint32_t length)
{
- int32_t i;
- int32_t temp;
+ // init
+ simde__m128 mm0 = simde_mm_setzero_ps();
- simde__m128i in;
- simde__m128 mm0;
-
-//init
- mm0 = simde_mm_setzero_ps();
-//Acc
- for (i=0; i<(length>>2); i++) {
- in = simde_mm_loadu_si128((simde__m128i *)input);
- mm0 = simde_mm_add_ps(mm0,simde_mm_cvtepi32_ps(simde_mm_madd_epi16(in,in)));
+ // Acc
+ for (int32_t i = 0; i < (length >> 2); i++) {
+ simde__m128i in = simde_mm_loadu_si128((simde__m128i *)input);
+ mm0 = simde_mm_add_ps(mm0, simde_mm_cvtepi32_ps(simde_mm_madd_epi16(in, in)));
input += 4;
}
- //Ave
- temp = (int)((((float*)&mm0)[0] +
- ((float*)&mm0)[1] +
- ((float*)&mm0)[2] +
- ((float*)&mm0)[3])/(float)length);
- return temp;
+ // leftover
+ float leftover_sum = 0;
+ c16_t *leftover_input = (c16_t *)input;
+ uint16_t lefover_count = length - ((length >> 2) << 2);
+ for (int32_t i = 0; i < lefover_count; i++) {
+ leftover_sum += leftover_input[i].r * leftover_input[i].r + leftover_input[i].i * leftover_input[i].i;
+ }
+
+ // Ave
+ float sums[4];
+ simde_mm_store_ps(sums, mm0);
+ return (int)((sums[0] + sums[1] + sums[2] + sums[3] + leftover_sum) / (float)length);
}
+
double signal_energy_fp(double *s_re[2],double *s_im[2],uint32_t nb_antennas,uint32_t length,uint32_t offset)
{
@@ -164,45 +166,6 @@ double signal_energy_fp2(struct complexd *s,uint32_t length)
}
return(V/length);
}
- //
-#ifdef MAIN
-#define LENGTH 256
-#include
-#include
-#include
-#include
-main(int argc,char **argv)
-{
-
- int input[LENGTH];
- int energy=0,dc_r=0,dc_i=0;
- int16_t s=1,i;
- int amp;
-
- amp = atoi(argv[1]);// arguments to integer
-
- if (argc>1)
- printf("Amp = %d\n",amp);
-
- for (i=0; i
+extern "C" {
+#include "openair1/PHY/TOOLS/tools_defs.h"
+extern int32_t signal_energy_nodc(const c16_t *input, uint32_t length);
+}
+#include
+#include
+
+int32_t signal_energy_nodc_ref(const c16_t *input, uint32_t length)
+{
+ float sum = 0;
+ for (auto i = 0U; i < length; i++) {
+ sum += input[i].r * input[i].r + input[i].i * input[i].i;
+ }
+ return sum / length;
+}
+
+TEST(signal_energy_nodc, size_6)
+{
+ std::vector input;
+ input.resize(6);
+ std::fill(input.begin(), input.end(), (c16_t){42, 42});
+ EXPECT_EQ(signal_energy_nodc(input.data(), input.size()),
+ signal_energy_nodc_ref(input.data(), input.size()));
+}
+
+int main(int argc, char **argv)
+{
+ testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h
index 771f488b54..c6926ff752 100644
--- a/openair1/PHY/TOOLS/tools_defs.h
+++ b/openair1/PHY/TOOLS/tools_defs.h
@@ -761,7 +761,7 @@ int32_t subcarrier_energy(int32_t *,uint32_t, int32_t *subcarrier_energy, uint16
/*!\fn int32_t signal_energy_nodc(int32_t *,uint32_t);
\brief Computes the signal energy per subcarrier, without DC removal
*/
-int32_t signal_energy_nodc(int32_t *,uint32_t);
+int32_t signal_energy_nodc(const c16_t *input, uint32_t length);
int32_t signal_power(int32_t *,uint32_t);
int32_t interference_power(int32_t *,uint32_t);
diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h
index 93a4ee8b94..2ab028b6a9 100644
--- a/openair1/PHY/defs_nr_UE.h
+++ b/openair1/PHY/defs_nr_UE.h
@@ -40,6 +40,7 @@
#include "defs_nr_common.h"
#include "CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#include "PHY/defs_nr_sl_UE.h"
+#include "openair1/PHY/nr_phy_common/inc/nr_ue_phy_meas.h"
#include
#include
@@ -502,56 +503,10 @@ typedef struct PHY_VARS_NR_UE_s {
scheduling_request_config_t scheduling_request_config_nr[NUMBER_OF_CONNECTED_gNB_MAX];
#endif
-
- time_stats_t phy_proc;
- time_stats_t phy_proc_tx;
- time_stats_t phy_proc_rx;
-
- time_stats_t ue_ul_indication_stats;
-
uint32_t use_ia_receiver;
-
- time_stats_t ofdm_mod_stats;
- time_stats_t ulsch_encoding_stats;
- time_stats_t ulsch_ldpc_encoding_stats;
- time_stats_t ulsch_modulation_stats;
- time_stats_t ulsch_segmentation_stats;
- time_stats_t ulsch_rate_matching_stats;
- time_stats_t ulsch_interleaving_stats;
- time_stats_t ulsch_multiplexing_stats;
-
- time_stats_t ue_front_end_stat;
- time_stats_t ue_front_end_per_slot_stat[LTE_SLOTS_PER_SUBFRAME];
- time_stats_t pdcch_procedures_stat;
- time_stats_t pdsch_procedures_stat;
- time_stats_t pdsch_procedures_per_slot_stat[LTE_SLOTS_PER_SUBFRAME];
- time_stats_t dlsch_procedures_stat;
-
- time_stats_t rx_pdsch_stats;
- time_stats_t ofdm_demod_stats;
- time_stats_t dlsch_rx_pdcch_stats;
- time_stats_t rx_dft_stats;
- time_stats_t dlsch_channel_estimation_stats;
- time_stats_t dlsch_freq_offset_estimation_stats;
- time_stats_t dlsch_decoding_stats;
- time_stats_t dlsch_demodulation_stats;
- time_stats_t dlsch_rate_unmatching_stats;
- time_stats_t dlsch_ldpc_decoding_stats;
- time_stats_t dlsch_deinterleaving_stats;
- time_stats_t dlsch_llr_stats;
- time_stats_t dlsch_llr_stats_parallelization[LTE_SLOTS_PER_SUBFRAME];
- time_stats_t dlsch_unscrambling_stats;
- time_stats_t dlsch_rate_matching_stats;
- time_stats_t dlsch_ldpc_encoding_stats;
- time_stats_t dlsch_interleaving_stats;
- time_stats_t dlsch_tc_init_stats;
- time_stats_t dlsch_tc_alpha_stats;
- time_stats_t dlsch_tc_beta_stats;
- time_stats_t dlsch_tc_gamma_stats;
- time_stats_t dlsch_tc_ext_stats;
- time_stats_t dlsch_tc_intl1_stats;
- time_stats_t dlsch_tc_intl2_stats;
- time_stats_t tx_prach;
+ // TODO: move this out of phy
+ time_stats_t ue_ul_indication_stats;
+ nr_ue_phy_cpu_stat_t phy_cpu_stats;
/// RF and Interface devices per CC
openair0_device rfdevice;
@@ -685,5 +640,12 @@ typedef struct LDPCDecode_ue_s {
UE_nr_rxtx_proc_t proc;
} ldpcDecode_ue_t;
-#include "SIMULATION/ETH_TRANSPORT/defs.h"
+static inline void start_meas_nr_ue_phy(PHY_VARS_NR_UE *ue, int meas_index) {
+ start_meas(&ue->phy_cpu_stats.cpu_time_stats[meas_index]);
+}
+
+static inline void stop_meas_nr_ue_phy(PHY_VARS_NR_UE *ue, int meas_index) {
+ stop_meas(&ue->phy_cpu_stats.cpu_time_stats[meas_index]);
+}
+
#endif
diff --git a/openair1/PHY/nr_phy_common/CMakeLists.txt b/openair1/PHY/nr_phy_common/CMakeLists.txt
index 3ba2666b08..ebbc3fcbc7 100644
--- a/openair1/PHY/nr_phy_common/CMakeLists.txt
+++ b/openair1/PHY/nr_phy_common/CMakeLists.txt
@@ -1,3 +1,7 @@
add_library(nr_phy_common src/nr_phy_common.c)
target_link_libraries(nr_phy_common PRIVATE UTIL)
target_include_directories(nr_phy_common PUBLIC inc/)
+
+add_library(nr_ue_phy_meas src/nr_ue_phy_meas.c)
+target_include_directories(nr_ue_phy_meas PUBLIC inc/)
+target_link_libraries(nr_ue_phy_meas PUBLIC utils)
diff --git a/openair1/PHY/nr_phy_common/inc/nr_ue_phy_meas.h b/openair1/PHY/nr_phy_common/inc/nr_ue_phy_meas.h
new file mode 100644
index 0000000000..6c667e3c1d
--- /dev/null
+++ b/openair1/PHY/nr_phy_common/inc/nr_ue_phy_meas.h
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ * contact@openairinterface.org
+ */
+
+#ifndef __NR_UE_PHY_MEAS__H__
+#define __NR_UE_PHY_MEAS__H__
+#include "time_meas.h"
+#include "utils.h"
+
+#define NOOP(a) a
+#define FOREACH_NR_PHY_CPU_MEAS(FN) \
+ FN(RX_PDSCH_STATS),\
+ FN(DLSCH_RX_PDCCH_STATS),\
+ FN(RX_DFT_STATS),\
+ FN(DLSCH_CHANNEL_ESTIMATION_STATS),\
+ FN(DLSCH_DECODING_STATS),\
+ FN(DLSCH_RATE_UNMATCHING_STATS),\
+ FN(DLSCH_LDPC_DECODING_STATS),\
+ FN(DLSCH_DEINTERLEAVING_STATS),\
+ FN(DLSCH_EXTRACT_RBS_STATS),\
+ FN(DLSCH_CHANNEL_SCALE_STATS),\
+ FN(DLSCH_CHANNEL_LEVEL_STATS),\
+ FN(DLSCH_MRC_MMSE_STATS),\
+ FN(DLSCH_UNSCRAMBLING_STATS),\
+ FN(DLSCH_CHANNEL_COMPENSATION_STATS),\
+ FN(DLSCH_LLR_STATS),\
+ FN(DLSCH_LAYER_DEMAPPING),\
+ FN(PHY_RX_PDCCH_STATS),\
+ FN(DLSCH_PROCEDURES_STATS),\
+ FN(PHY_PROC_TX),\
+ FN(ULSCH_SEGMENTATION_STATS),\
+ FN(ULSCH_LDPC_ENCODING_STATS),\
+ FN(ULSCH_RATE_MATCHING_STATS),\
+ FN(ULSCH_INTERLEAVING_STATS),\
+ FN(ULSCH_ENCODING_STATS)
+
+typedef enum {
+ FOREACH_NR_PHY_CPU_MEAS(NOOP),
+ MAX_CPU_STAT_TYPE
+} nr_ue_phy_cpu_stat_type_t;
+
+typedef struct nr_ue_phy_cpu_stat_t {
+ time_stats_t cpu_time_stats[MAX_CPU_STAT_TYPE];
+} nr_ue_phy_cpu_stat_t;
+
+void init_nr_ue_phy_cpu_stats(nr_ue_phy_cpu_stat_t *ue_phy_cpu_stats);
+void reset_nr_ue_phy_cpu_stats(nr_ue_phy_cpu_stat_t *ue_phy_cpu_stats);
+
+#endif
diff --git a/openair2/NETWORK_DRIVER/UE_IP/sap.h b/openair1/PHY/nr_phy_common/src/nr_ue_phy_meas.c
similarity index 63%
rename from openair2/NETWORK_DRIVER/UE_IP/sap.h
rename to openair1/PHY/nr_phy_common/src/nr_ue_phy_meas.c
index ad70386ed7..75ad7a5b72 100644
--- a/openair2/NETWORK_DRIVER/UE_IP/sap.h
+++ b/openair1/PHY/nr_phy_common/src/nr_ue_phy_meas.c
@@ -19,10 +19,22 @@
* contact@openairinterface.org
*/
-#ifndef UE_IP_SAP_H
-#define UE_IP_SAP_H
-typedef unsigned short OaiNwDrvRadioBearerId_t;
+#include
+#include "nr_ue_phy_meas.h"
+#include
-#define UE_IP_PRIMITIVE_MAX_LENGTH 180 // maximum length of a NAS primitive
+void init_nr_ue_phy_cpu_stats(nr_ue_phy_cpu_stat_t *ue_phy_cpu_stats) {
+ reset_nr_ue_phy_cpu_stats(ue_phy_cpu_stats);
+ const char* cpu_stats_enum_to_string_table[] = {
+ FOREACH_NR_PHY_CPU_MEAS(TO_STRING)
+ };
+ for (int i = 0; i < MAX_CPU_STAT_TYPE; i++) {
+ ue_phy_cpu_stats->cpu_time_stats[i].meas_name = strdup(cpu_stats_enum_to_string_table[i]);
+ }
+}
-#endif
+void reset_nr_ue_phy_cpu_stats(nr_ue_phy_cpu_stat_t *ue_phy_cpu_stats) {
+ for (int i = 0; i < MAX_CPU_STAT_TYPE; i++) {
+ reset_meas(&ue_phy_cpu_stats->cpu_time_stats[i]);
+ }
+}
diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c
index fdeb58ead1..96e32c6444 100644
--- a/openair1/SCHED/ru_procedures.c
+++ b/openair1/SCHED/ru_procedures.c
@@ -444,7 +444,7 @@ void feptx_ofdm(RU_t *ru,
stop_meas(&ru->ofdm_mod_stats);
LOG_D(PHY,"feptx_ofdm (TXPATH): frame %d, subframe %d: txp (time %p) %d dB, txp (freq) %d dB\n",
frame,subframe,txdata,dB_fixed(signal_energy((int32_t*)txdata,fp->samples_per_tti)),
- dB_fixed(signal_energy_nodc(ru->common.txdataF_BF[aa],2*slot_sizeF)));
+ dB_fixed(signal_energy_nodc((c16_t*)ru->common.txdataF_BF[aa],2*slot_sizeF)));
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+ru->idx , 0 );
diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c
index 93619732ae..16a06c6e97 100644
--- a/openair1/SCHED_NR/nr_ru_procedures.c
+++ b/openair1/SCHED_NR/nr_ru_procedures.c
@@ -166,7 +166,7 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) {
LOG_D(PHY,"feptx_ofdm (TXPATH): frame %d, slot %d: txp (time %p) %d dB, txp (freq) %d dB\n",
frame_tx,slot,txdata,dB_fixed(signal_energy((int32_t*)txdata,fp->get_samples_per_slot(
- slot,fp))),dB_fixed(signal_energy_nodc(ru->common.txdataF_BF[aa],2*slot_sizeF)));
+ slot,fp))),dB_fixed(signal_energy_nodc((c16_t*)ru->common.txdataF_BF[aa],2*slot_sizeF)));
}
diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
index 97205f28c7..b5423bab23 100644
--- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c
+++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
@@ -81,19 +81,21 @@ void nr_common_signal_procedures(PHY_VARS_gNB *gNB,int frame,int slot, nfapi_nr_
fp->print_ue_help_cmdline_log = false;
if (fp->dl_CarrierFreq != fp->ul_CarrierFreq)
LOG_A(PHY,
- "Command line parameters for the UE: -C %lu --CO %ld -r %d --numerology %d --ssb %d\n",
+ "Command line parameters for OAI UE: -C %lu --CO %ld -r %d --numerology %d --ssb %d %s\n",
fp->dl_CarrierFreq,
fp->ul_CarrierFreq - fp->dl_CarrierFreq,
fp->N_RB_DL,
scs,
- fp->ssb_start_subcarrier);
+ fp->ssb_start_subcarrier,
+ fp->threequarter_fs ? "-E" : "");
else
LOG_A(PHY,
- "Command line parameters for the UE: -C %lu -r %d --numerology %d --ssb %d\n",
+ "Command line parameters for OAI UE: -C %lu -r %d --numerology %d --ssb %d %s\n",
fp->dl_CarrierFreq,
fp->N_RB_DL,
scs,
- fp->ssb_start_subcarrier);
+ fp->ssb_start_subcarrier,
+ fp->threequarter_fs ? "-E" : "");
}
LOG_D(PHY,
"ssbOffsetPointA %d SSB SsbSubcarrierOffset %d prb_offset %d sc_offset %d scs %d ssb_start_subcarrier %d\n",
@@ -739,7 +741,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
"frame %d, slot %d: UL signal energy %d\n",
frame_rx,
slot_rx,
- signal_energy_nodc((int32_t *)&gNB->common_vars.rxdataF[0][soffset + offset + (47 * 12)], 12 * 18));
+ signal_energy_nodc(&gNB->common_vars.rxdataF[0][soffset + offset + (47 * 12)], 12 * 18));
start_meas(&gNB->phy_proc_rx);
@@ -771,7 +773,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
"frame %d, slot %d: PUCCH signal energy %d\n",
frame_rx,
slot_rx,
- signal_energy_nodc((int32_t *)&gNB->common_vars.rxdataF[0][soffset + offset], 12));
+ signal_energy_nodc(&gNB->common_vars.rxdataF[0][soffset + offset], 12));
nr_decode_pucch0(gNB,
frame_rx,
diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
index 725dc1fe45..0653947bec 100644
--- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
@@ -275,8 +275,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, n
LOG_D(PHY,"****** start TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx);
- start_meas(&ue->phy_proc_tx);
-
+ start_meas_nr_ue_phy(ue, PHY_PROC_TX);
for (uint8_t harq_pid = 0; harq_pid < NR_MAX_ULSCH_HARQ_PROCESSES; harq_pid++) {
if (ue->ul_harq_processes[harq_pid].ULstatus == ACTIVE) {
nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, gNB_id, phy_data, (c16_t **)&txdataF);
@@ -300,7 +299,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, n
LOG_D(PHY, "****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT);
- stop_meas(&ue->phy_proc_tx);
+ stop_meas_nr_ue_phy(ue, PHY_PROC_TX);
}
void nr_ue_measurement_procedures(uint16_t l,
@@ -426,7 +425,7 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue,
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &phy_pdcch_config->pdcch_config[n_ss];
- start_meas(&ue->dlsch_rx_pdcch_stats);
+ start_meas_nr_ue_phy(ue, DLSCH_RX_PDCCH_STATS);
/// PDCCH/DCI e-sequence (input to rate matching).
int32_t pdcch_e_rx_size = NR_MAX_PDCCH_SIZE;
@@ -454,9 +453,7 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue,
nr_fill_dl_indication(&dl_indication, &dci_ind, NULL, proc, ue, phy_data);
// send to mac
ue->if_inst->dl_indication(&dl_indication);
-
- stop_meas(&ue->dlsch_rx_pdcch_stats);
-
+ stop_meas_nr_ue_phy(ue, DLSCH_RX_PDCCH_STATS);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_OUT);
return (dci_ind.number_of_dcis);
}
@@ -468,7 +465,6 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP],
int G)
{
- int frame_rx = proc->frame_rx;
int nr_slot_rx = proc->nr_slot_rx;
// We handle only one CW now
@@ -510,6 +506,7 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
uint32_t nvar = 0;
+ start_meas_nr_ue_phy(ue, DLSCH_CHANNEL_ESTIMATION_STATS);
for (int m = dlschCfg->start_symbol; m < (dlschCfg->start_symbol + dlschCfg->number_symbols); m++) {
if (dlschCfg->dlDmrsSymbPos & (1 << m)) {
for (int nl = 0; nl < dlsch0->Nl; nl++) { //for MIMO Config: it shall loop over no_layers
@@ -546,6 +543,7 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
}
}
}
+ stop_meas_nr_ue_phy(ue, DLSCH_CHANNEL_ESTIMATION_STATS);
nvar /= (dlschCfg->number_symbols * dlsch0->Nl * ue->frame_parms.nb_antennas_rx);
@@ -576,16 +574,12 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
uint32_t llr_offset[NR_SYMBOLS_PER_SLOT] = {0};
int32_t log2_maxh = 0;
- start_meas(&ue->rx_pdsch_stats);
+ start_meas_nr_ue_phy(ue, RX_PDSCH_STATS);
for (int m = dlschCfg->start_symbol; m < (dlschCfg->number_symbols + dlschCfg->start_symbol); m++) {
bool first_symbol_flag = false;
if (m == first_symbol_with_data)
first_symbol_flag = true;
- uint8_t slot = 0;
- if(m >= ue->frame_parms.symbols_per_slot>>1)
- slot = 1;
- start_meas(&ue->dlsch_llr_stats_parallelization[slot]);
// process DLSCH received symbols in the slot
// symbol by symbol processing (if data/DMRS are multiplexed is checked inside the function)
if (nr_rx_pdsch(ue,
@@ -610,17 +604,8 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
nvar)
< 0)
return -1;
-
- stop_meas(&ue->dlsch_llr_stats_parallelization[slot]);
- if (cpumeas(CPUMEAS_GETSTATE))
- LOG_D(PHY,
- "[AbsSFN %d.%d] LLR Computation Symbol %d %5.2f \n",
- frame_rx,
- nr_slot_rx,
- m,
- ue->dlsch_llr_stats_parallelization[slot].p_time / (cpuf * 1000.0));
} // CRNTI active
- stop_meas(&ue->rx_pdsch_stats);
+ stop_meas_nr_ue_phy(ue, RX_PDSCH_STATS);
}
return 0;
}
@@ -734,13 +719,11 @@ static bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
return false;
}
- start_meas(&ue->dlsch_unscrambling_stats);
+ start_meas_nr_ue_phy(ue, DLSCH_UNSCRAMBLING_STATS);
nr_dlsch_unscrambling(llr[0], G, 0, dlsch[0].dlsch_config.dlDataScramblingId, dlsch[0].rnti);
+ stop_meas_nr_ue_phy(ue, DLSCH_UNSCRAMBLING_STATS);
- stop_meas(&ue->dlsch_unscrambling_stats);
-
- start_meas(&ue->dlsch_decoding_stats);
-
+ start_meas_nr_ue_phy(ue, DLSCH_DECODING_STATS);
// create memory to store decoder output
int a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated
int num_rb = dlsch[0].dlsch_config.number_rbs;
@@ -796,12 +779,16 @@ static bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
LOG_D(PHY, "DL PDU length in bits: %d, in bytes: %d \n", dlsch[0].dlsch_config.TBS, dlsch[0].dlsch_config.TBS / 8);
- stop_meas(&ue->dlsch_decoding_stats);
- if (cpumeas(CPUMEAS_GETSTATE)) {
- LOG_D(PHY, " --> Unscrambling for CW0 %5.3f\n",
- (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0));
- LOG_D(PHY, "AbsSubframe %d.%d --> LDPC Decoding for CW0 %5.3f\n",
- frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats.p_time)/(cpuf*1000.0));
+ stop_meas_nr_ue_phy(ue, DLSCH_DECODING_STATS);
+ if (cpumeas(CPUMEAS_GETSTATE)) {
+ LOG_D(PHY,
+ " --> Unscrambling for CW0 %5.3f\n",
+ ue->phy_cpu_stats.cpu_time_stats[DLSCH_UNSCRAMBLING_STATS].p_time / (cpuf * 1000.0));
+ LOG_D(PHY,
+ "AbsSubframe %d.%d --> LDPC Decoding for CW0 %5.3f\n",
+ frame_rx % 1024,
+ nr_slot_rx,
+ ue->phy_cpu_stats.cpu_time_stats[DLSCH_DECODING_STATS].p_time / (cpuf * 1000.0));
}
if(is_cw1_active) {
@@ -819,14 +806,13 @@ static bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
int ptrsSymbPerSlot = get_ptrs_symbols_in_slot(ptrsSymbPos, dlsch_config->start_symbol, dlsch_config->number_symbols);
unav_res = n_ptrs * ptrsSymbPerSlot;
}
+ start_meas_nr_ue_phy(ue, DLSCH_UNSCRAMBLING_STATS);
unav_res += compute_csi_rm_unav_res(dlsch_config);
G = nr_get_G(dlsch_config->number_rbs, nb_symb_sch, nb_re_dmrs, dmrs_len, unav_res, dlsch_config->qamModOrder, dlsch[1].Nl);
- start_meas(&ue->dlsch_unscrambling_stats);
nr_dlsch_unscrambling(llr[1], G, 0, dlsch[1].dlsch_config.dlDataScramblingId, dlsch[1].rnti);
- stop_meas(&ue->dlsch_unscrambling_stats);
-
- start_meas(&ue->dlsch_decoding_stats);
+ stop_meas_nr_ue_phy(ue, DLSCH_UNSCRAMBLING_STATS);
+ start_meas_nr_ue_phy(ue, DLSCH_DECODING_STATS);
ret1 = nr_dlsch_decoding(ue,
proc,
gNB_id,
@@ -843,14 +829,16 @@ static bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
G);
LOG_T(PHY,"CW dlsch decoding, ret1 = %d\n", ret1);
- stop_meas(&ue->dlsch_decoding_stats);
+ stop_meas_nr_ue_phy(ue, DLSCH_DECODING_STATS);
if (cpumeas(CPUMEAS_GETSTATE)) {
- LOG_D(PHY, " --> Unscrambling for CW1 %5.3f\n", (ue->dlsch_unscrambling_stats.p_time) / (cpuf * 1000.0));
+ LOG_D(PHY,
+ " --> Unscrambling for CW1 %5.3f\n",
+ ue->phy_cpu_stats.cpu_time_stats[DLSCH_UNSCRAMBLING_STATS].p_time / (cpuf * 1000.0));
LOG_D(PHY,
"AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n",
frame_rx % 1024,
nr_slot_rx,
- (ue->dlsch_decoding_stats.p_time) / (cpuf * 1000.0));
+ ue->phy_cpu_stats.cpu_time_stats[DLSCH_DECODING_STATS].p_time / (cpuf * 1000.0));
}
LOG_D(PHY, "harq_pid: %d, TBS expected dlsch1: %d \n", harq_pid, dlsch[1].dlsch_config.TBS);
}
@@ -884,7 +872,6 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_
nr_ue_dlsch_init(phy_data->dlsch, NR_MAX_NB_LAYERS>4 ? 2:1, ue->max_ldpc_iterations);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN);
- start_meas(&ue->phy_proc_rx);
LOG_D(PHY," ****** start RX-Chain for Frame.Slot %d.%d ****** \n",
frame_rx%1024, nr_slot_rx);
@@ -913,7 +900,6 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_
for (int i=1; i<4; i++) {
nr_slot_fep(ue, fp, proc, (ssb_start_symbol + i) % (fp->symbols_per_slot), rxdataF, link_type_dl);
- start_meas(&ue->dlsch_channel_estimation_stats);
nr_pbch_channel_estimation(&ue->frame_parms,
NULL,
estimateSz,
@@ -928,7 +914,6 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_
rxdataF,
false,
fp->Nid_cell);
- stop_meas(&ue->dlsch_channel_estimation_stats);
if (i - 1 == 2)
UEscopeCopy(ue,
@@ -1006,8 +991,6 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_
uint8_t nb_symb_pdcch = phy_pdcch_config->nb_search_space > 0 ? phy_pdcch_config->pdcch_config[0].coreset.duration : 0;
for (uint16_t l=0; lofdm_demod_stats);
nr_slot_fep(ue, fp, proc, l, rxdataF, link_type_dl);
}
@@ -1031,8 +1014,6 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_
pdcch_dl_ch_estimates,
rxdataF);
- stop_meas(&ue->ofdm_demod_stats);
-
}
dci_cnt = dci_cnt + nr_ue_pdcch_procedures(ue, proc, pdcch_est_size, pdcch_dl_ch_estimates, phy_data, n_ss, rxdataF);
}
@@ -1049,8 +1030,6 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
int gNB_id = proc->gNB_id;
NR_UE_DLSCH_t *dlsch = &phy_data->dlsch[0];
- time_stats_t meas = {0};
- start_meas(&meas);
// do procedures for C-RNTI
bool slot_fep_map[14] = {0};
@@ -1145,7 +1124,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
LOG_D(PHY, "DLSCH data reception at nr_slot_rx: %d\n", nr_slot_rx);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN);
- start_meas(&ue->dlsch_procedures_stat);
+ start_meas_nr_ue_phy(ue, DLSCH_PROCEDURES_STATS);
if (ret_pdsch >= 0)
nr_ue_dlsch_procedures(ue, proc, dlsch, llr, G);
@@ -1157,10 +1136,9 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
LOG_W(NR_PHY, "nr_ue_pdsch_procedures failed in slot %d\n", proc->nr_slot_rx);
}
- stop_meas(&ue->dlsch_procedures_stat);
+ stop_meas_nr_ue_phy(ue, DLSCH_PROCEDURES_STATS);
if (cpumeas(CPUMEAS_GETSTATE)) {
- LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_slot_rx,ue->pdsch_procedures_stat.p_time/(cpuf*1000.0));
- LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_slot_rx,ue->dlsch_procedures_stat.p_time/(cpuf*1000.0));
+ LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_slot_rx,ue->phy_cpu_stats.cpu_time_stats[DLSCH_PROCEDURES_STATS].p_time/(cpuf*1000.0));
}
if (ue->phy_sim_rxdataF)
@@ -1173,8 +1151,6 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
free(llr[i]);
}
- start_meas(&meas);
-
if (nr_slot_rx==9) {
if (frame_rx % 10 == 0) {
if ((ue->dlsch_received[gNB_id] - ue->dlsch_received_last[gNB_id]) != 0)
@@ -1199,10 +1175,6 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
}
- stop_meas(&meas);
- if (cpumeas(CPUMEAS_GETSTATE))
- LOG_D(PHY, "after ldpc decode until end of Rx %5.2f \n", meas.p_time / (cpuf * 1000.0));
-
#ifdef EMOS
phy_procedures_emos_UE_RX(ue,slot,gNB_id);
#endif
@@ -1210,10 +1182,6 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT);
- stop_meas(&ue->phy_proc_rx);
- if (cpumeas(CPUMEAS_GETSTATE))
- LOG_D(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_slot_rx,ue->phy_proc_rx.p_time/(cpuf*1000.0));
-
LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, nr_slot_rx);
UEscopeCopy(ue, commonRxdataF, rxdataF, sizeof(int32_t), ue->frame_parms.nb_antennas_rx, rxdataF_sz, 0);
}
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/Makefile.inc b/openair1/SIMULATION/ETH_TRANSPORT/Makefile.inc
deleted file mode 100644
index b865ef7612..0000000000
--- a/openair1/SIMULATION/ETH_TRANSPORT/Makefile.inc
+++ /dev/null
@@ -1,6 +0,0 @@
-ETHERNET_TRANSPORT_OBJS = $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/netlink_init.o
-ETHERNET_TRANSPORT_OBJS += $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/multicast_link.o
-ETHERNET_TRANSPORT_OBJS += $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/socket.o
-ETHERNET_TRANSPORT_OBJS += $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/bypass_session_layer.o
-ETHERNET_TRANSPORT_OBJS += $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/emu_transport.o
-ETHERNET_TRANSPORT_OBJS += $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/pgm_link.o
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/README.txt b/openair1/SIMULATION/ETH_TRANSPORT/README.txt
deleted file mode 100644
index a1c1ed9562..0000000000
--- a/openair1/SIMULATION/ETH_TRANSPORT/README.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-For reliable UDP multicast, the libpgm-dev should be installed on the machines,
-otherwise the old multicast method using simply UDP will be used, resulting in
-packet loss and unexpected behaviour of oaisim.
-
-To compile OAI with PGM:
-
-For Ubuntu 12.04 and earliers:
- sudo apt-get install libpgm-dev
- is sufficient
-
-For Ubuntu older than 12.04:
-
-wget http://openpgm.googlecode.com/files/libpgm-5.1.118.tar.gz
-tar xvf libpgm-5.1.118.tar.gz
-cd libpgm-5.1.118/openpgm/pgm
-./configure --prefix=/usr
-make
-sudo make install
-
-We have to clean oaisim compilation and re-compile
-
-
-When running OAI, the -D should be used to provide the NIC to bind.
-Parameter can be either an interface name or an ip address (refer to this link
-for more informations: http://code.google.com/p/openpgm/wiki/OpenPgmConceptsTransport)
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/defs.h b/openair1/SIMULATION/ETH_TRANSPORT/defs.h
deleted file mode 100644
index 384f25e950..0000000000
--- a/openair1/SIMULATION/ETH_TRANSPORT/defs.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file defs.h
- * \brief specifies the data structure and variable for phy emulation
- * \author Navid Nikaein, Raymomd Knopp and Hicham Anouar
- * \date 2011
- * \version 1.1
- * \company Eurecom
- * \email: navid.nikaein@eurecom.fr
- */
-
-#ifndef __BYPASS_SESSION_LAYER_DEFS_H__
-# define __BYPASS_SESSION_LAYER_DEFS_H__
-//-----------------------------------------------------------------------------
-//#include "openair_defs.h"
-#include "common/openairinterface5g_limits.h"
-#include "PHY/defs_common.h"
-#include "PHY/LTE_TRANSPORT/uci_common.h"
-
-typedef enum emu_transport_info_e {
- EMU_TRANSPORT_INFO_ERROR = 0x0,
- EMU_TRANSPORT_INFO_WAIT_PM,
- EMU_TRANSPORT_INFO_WAIT_SM,
- EMU_TRANSPORT_INFO_SYNC,
- EMU_TRANSPORT_INFO_ENB,
- EMU_TRANSPORT_INFO_UE,
- EMU_TRANSPORT_INFO_RELEASE
-} emu_transport_info_t;
-
-#define WAIT_PM_TRANSPORT 1
-#define WAIT_SM_TRANSPORT 2
-#define SYNC_TRANSPORT 3
-#define ENB_TRANSPORT 4
-#define UE_TRANSPORT 5
-#define RELEASE_TRANSPORT 6
-
-#define WAIT_SYNC_TRANSPORT 1
-#define SYNCED_TRANSPORT 2
-//#define WAIT_ENB_TRANSPORT 2
-//#define WAIT_UE_TRANSPORT 3
-
-
-#define BYPASS_RX_BUFFER_SIZE 64000
-#define BYPASS_TX_BUFFER_SIZE 64000
-
-typedef unsigned int (*tx_handler_t) (unsigned char, char*, unsigned int*, unsigned int*);
-typedef unsigned int (*rx_handler_t) (unsigned char, char*, unsigned int);
-
-/*************************************************************/
-
-typedef struct eNB_cntl_s {
- uint32_t pbch_flag:1;
- uint32_t pmch_flag:1;
- uint32_t pss:2;
- uint32_t sss:8;
- uint32_t cfi:2;
- uint32_t phich:19; // max 200 bit
- // uint32_t pbch_payload:24;
- uint32_t pbch_payload;
-} eNB_cntl;
-
-typedef struct UE_cntl_s {
- uint8_t pucch_flag:3; // 0,7 = none, 1 = type 1, 2=type 1a, 3=type 1b, 4=type 2, 5=type 2a, 6=type 2b
- uint8_t pucch_Ncs1:3; // physical configuration of pucch, for abstraction purposes
- uint32_t pucch_payload:21; // ack/nak/cqi information
- uint8_t sr:1;
- uint8_t pusch_flag:1; // 0=none,1=active
- uint8_t pucch_sel:1;
- //uint32_t pusch_uci; // uci information on pusch
- uint8_t pusch_uci[MAX_CQI_BYTES];
- uint8_t uci_format;
- uint8_t length_uci;
- uint8_t pusch_ri:2; // ri information on pusch
- uint8_t pusch_ack:2; // ack/nak on pusch
- uint8_t prach_flag:1; // 0=none,1=active
- uint8_t prach_id:6; // this is the PHY preamble index for the prach
-} UE_cntl;
-
-#define MAX_TRANSPORT_BLOCKS_BUFFER_SIZE 16384
-//#define MAX_PMCH_TRANSPORT_BLOCKS_BUFFER_SIZE 8192 // 16384
-#define MAX_NUM_DCI 5+1 // +1: for PMCH/MCH
-
-typedef struct eNB_transport_info_s {
- eNB_cntl cntl;
- uint8_t num_pmch;
- uint8_t num_common_dci;
- uint8_t num_ue_spec_dci;
- DCI_ALLOC_t dci_alloc[MAX_NUM_DCI];
- uint8_t dlsch_type[MAX_NUM_DCI];
- uint8_t harq_pid[MAX_NUM_DCI];
- uint8_t ue_id[MAX_NUM_DCI];
- uint16_t tbs[MAX_NUM_DCI*2]; // times 2 for dual-stream MIMO formats
- uint8_t transport_blocks[MAX_TRANSPORT_BLOCKS_BUFFER_SIZE];
- //uint8_t pmch_transport_blocks[MAX_PMCH_TRANSPORT_BLOCKS_BUFFER_SIZE];
-} __attribute__((__packed__)) eNB_transport_info_t ;
-
-typedef struct UE_transport_info_s {
- UE_cntl cntl;
- uint8_t num_eNB;
- uint16_t rnti[NUMBER_OF_CONNECTED_eNB_MAX];
- uint8_t eNB_id[NUMBER_OF_CONNECTED_eNB_MAX];
- uint8_t harq_pid[NUMBER_OF_CONNECTED_eNB_MAX];
- uint16_t tbs[NUMBER_OF_CONNECTED_eNB_MAX];
- uint8_t transport_blocks[MAX_TRANSPORT_BLOCKS_BUFFER_SIZE];//*NUMBER_OF_CONNECTED_eNB_MAX];
-} __attribute__((__packed__)) UE_transport_info_t ;
-
-/*! \brief */
-typedef struct bypass_msg_header_s {
- unsigned char Message_type; /*! \brief control or data*/
- //unsigned char nb_master; /*! \brief */
- unsigned char master_id; /*! \brief */
- unsigned int nb_enb; /*! \brief */
- unsigned int nb_ue; /*! \brief */
- unsigned int nb_flow; /*! \brief */
- unsigned int frame;
- unsigned int subframe;
- uint64_t seq_num;
- unsigned int failing_master_id;
-} __attribute__((__packed__)) bypass_msg_header_t;
-
-typedef struct bypass_proto2multicast_header_s {
- unsigned int size;
-} bypass_proto2multicast_header_t;
-
-#endif /* __BYPASS_SESSION_LAYER_DEFS_H__ */
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c b/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c
deleted file mode 100644
index d0f0eab4a6..0000000000
--- a/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file phy_emulation.c
- * \brief implements the underlying protocol for emulated data exchange over Ethernet using IP multicast
- * \author Navid Nikaein
- * \date 2011 - 2014
- * \version 1.1
- * \company Eurecom
- * \email: navid.nikaein@eurecom.fr
- */
-
-
-#include "PHY/defs.h"
-#include "PHY/extern.h"
-#include "common/ran_context.h"
-#include "defs.h"
-#include "extern.h"
-#include "proto.h"
-#include "UTIL/LOG/log.h"
-#include "UTIL/LOG/vcd_signal_dumper.h"
-#include "openair1/SIMULATION/ETH_TRANSPORT/extern.h"
-unsigned char Emulation_status;
-unsigned char emu_tx_status;
-unsigned char emu_rx_status;
-
-#if !defined(ENABLE_NEW_MULTICAST)
-pthread_mutex_t Tx_mutex;
-pthread_cond_t Tx_cond;
-char Tx_mutex_var;
-#endif
-
-/* Handlers for RX and TX */
-rx_handler_t rx_handler;
-tx_handler_t tx_handler;
-
-eNB_transport_info_t eNB_transport_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
-uint16_t eNB_transport_info_TB_index[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
-
-UE_transport_info_t UE_transport_info[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
-
-UE_cntl ue_cntl_delay[NUMBER_OF_UE_MAX][MAX_NUM_CCs][2];
-
-extern unsigned int Master_list_rx;
-
-extern unsigned char NB_INST;
-//#define DEBUG_CONTROL 1
-//#define DEBUG_EMU 1
-
-void emu_transport_sync(void)
-{
- LOG_D(EMU, "Entering EMU transport SYNC is primary master %d\n",
- oai_emulation.info.is_primary_master);
-
- if (oai_emulation.info.is_primary_master == 0) {
-retry:
- bypass_tx_data(WAIT_SM_TRANSPORT,0,0);
- // just wait to recieve the master 0 msg
- Master_list_rx = oai_emulation.info.master_list - 1;
-
- if (bypass_rx_data(0,0,0,1) == -1) {
- /* In case the master is not ready at time we send the first message */
- sleep(1);
- goto retry;
- }
- } else {
- bypass_rx_data(0,0,0,0);
- bypass_tx_data(WAIT_PM_TRANSPORT,0,0);
- }
-
- if (oai_emulation.info.master_list!=0) {
-retry2:
- bypass_tx_data(SYNC_TRANSPORT,0,0);
-
- if (bypass_rx_data(0,0,0,0) == -1) {
- goto retry2;
- }
-
- // i received the sync from all secondary masters
- if (emu_rx_status == SYNCED_TRANSPORT) {
- emu_tx_status = SYNCED_TRANSPORT;
- }
-
- LOG_D(EMU,"TX secondary master SYNC_TRANSPORT state \n");
- }
-
- LOG_D(EMU, "Leaving EMU transport SYNC is primary master %d\n",
- oai_emulation.info.is_primary_master);
-}
-
-void emu_transport(unsigned int frame, unsigned int last_slot,
- unsigned int next_slot,lte_subframe_t direction,
- unsigned char frame_type,
- int ethernet_flag )
-{
- if (ethernet_flag == 0) {
- return;
- }
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(
- VCD_SIGNAL_DUMPER_FUNCTIONS_EMU_TRANSPORT, VCD_FUNCTION_IN);
-
- if ((frame_type == 1) && (direction == SF_S)) {
- if ((next_slot % 2) == 0) {
- emu_transport_DL(frame, last_slot, next_slot);
- } else {
- emu_transport_UL(frame, last_slot , next_slot);
- }
-
- //DL
- } else {
- if ((next_slot % 2) == 0) {
- if (((frame_type == 1) && (direction == SF_DL )) || (frame_type == 0) ) {
- emu_transport_DL(frame, last_slot, next_slot);
- }
- }
-
- // UL
- if (((frame_type == 1) && (direction == SF_UL)) || (frame_type == 0) ) {
- emu_transport_UL(frame, last_slot, next_slot);
- }
- }
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(
- VCD_SIGNAL_DUMPER_FUNCTIONS_EMU_TRANSPORT, VCD_FUNCTION_OUT);
-}
-
-
-void emu_transport_DL(unsigned int frame, unsigned int last_slot,
- unsigned int next_slot)
-{
- LOG_D(EMU, "Entering EMU transport DL, is primary master %d\n",
- oai_emulation.info.is_primary_master);
-
- if (oai_emulation.info.is_primary_master == 0) {
- if (oai_emulation.info.nb_enb_local > 0) { // send in DL if
- bypass_tx_data(ENB_TRANSPORT, frame, next_slot);
- bypass_rx_data(frame, last_slot, next_slot, 1);
- } else {
- bypass_tx_data(WAIT_SM_TRANSPORT,frame,next_slot);
- bypass_rx_data(frame, last_slot, next_slot, 0);
- }
- } else { // PM
- if (oai_emulation.info.nb_enb_local>0) { // send in DL if
- bypass_rx_data(frame, last_slot, next_slot, 1);
- bypass_tx_data(ENB_TRANSPORT, frame, next_slot);
- } else {
- bypass_rx_data(frame, last_slot, next_slot, 0);
- bypass_tx_data(WAIT_SM_TRANSPORT,frame,next_slot);
- }
- }
-
- LOG_D(EMU, "Leaving EMU transport DL, is primary master %d\n",
- oai_emulation.info.is_primary_master);
-}
-
-void emu_transport_UL(unsigned int frame, unsigned int last_slot,
- unsigned int next_slot)
-{
- LOG_D(EMU, "Entering EMU transport UL, is primary master %d\n",
- oai_emulation.info.is_primary_master);
-
- if (oai_emulation.info.is_primary_master == 0) {
- if (oai_emulation.info.nb_ue_local > 0) {
- bypass_tx_data(UE_TRANSPORT, frame, next_slot);
- bypass_rx_data(frame, last_slot, next_slot, 1);
- } else {
- bypass_tx_data(WAIT_SM_TRANSPORT, frame, next_slot);
- bypass_rx_data(frame,last_slot, next_slot, 0);
- }
- } else {
- if (oai_emulation.info.nb_ue_local > 0) {
- bypass_rx_data(frame, last_slot, next_slot, 1);
- bypass_tx_data(UE_TRANSPORT, frame, next_slot);
- } else {
- bypass_rx_data(frame,last_slot, next_slot, 0);
- bypass_tx_data(WAIT_SM_TRANSPORT, frame, next_slot);
- }
- }
-
- LOG_D(EMU, "Leaving EMU transport UL, is primary master %d\n",
- oai_emulation.info.is_primary_master);
-}
-
-void emu_transport_release(void)
-{
- bypass_tx_data(RELEASE_TRANSPORT,0,0);
- LOG_E(EMU," tx RELEASE_TRANSPORT \n");
-}
-
-unsigned int emul_tx_handler(unsigned char Mode,char *Tx_buffer,
- unsigned int *Nbytes,unsigned int *Nb_flows)
-{
-
- return *Nbytes;
-}
-
-unsigned int emul_rx_data(void)
-{
- return(0);
-}
-
-unsigned int emul_rx_handler(unsigned char Mode,char *rx_buffer,
- unsigned int Nbytes)
-{
- unsigned short Rx_size=0;
- return (Rx_size+2);
-}
-
-void clear_eNB_transport_info(uint8_t nb_eNB)
-{
- uint8_t eNB_id;
- uint8_t CC_id;
-
- for (eNB_id=0; eNB_idpbch_pdu =
- eNB_transport_info[enb_id][CC_id].cntl.pbch_payload;
- /* LOG_I(EMU," RX slot %d ENB TRANSPORT pbch payload %d pdu[0] %d pdu[0] %d \n",
- next_slot ,
- eNB_transport_info[enb_id][CC_id].cntl.pbch_payload,
- ((uint8_t*)RC.eNB[enb_id]->pbch_pdu)[0],
- ((uint8_t*)RC.eNB[enb_id]->pbch_pdu)[1]);
- */
- // }
- //CFI
- // not needed yet
-
- //PHICH
- // to be added later
-
- //DCI
- nb_total_dci= eNB_transport_info[enb_id][CC_id].num_pmch +
- eNB_transport_info[enb_id][CC_id].num_ue_spec_dci +
- eNB_transport_info[enb_id][CC_id].num_common_dci;
-
- RC.eNB[enb_id][CC_id]->num_ue_spec_dci[(next_slot>>1)&1] =
- eNB_transport_info[enb_id][CC_id].num_ue_spec_dci;
- RC.eNB[enb_id][CC_id]->num_common_dci[(next_slot>>1)&1] =
- eNB_transport_info[enb_id][CC_id].num_common_dci;
-#ifdef DEBUG_EMU
- LOG_D(EMU, "Fill phy vars eNB %d for slot %d, DCI found %d \n",
- enb_id, next_slot, nb_total_dci);
-#endif
-
- if (nb_total_dci >0) {
-
- memcpy(RC.eNB[enb_id][CC_id]->dci_alloc[(next_slot>>1)&1],
- eNB_transport_info[enb_id][CC_id].dci_alloc,
- (nb_total_dci) * sizeof(DCI_ALLOC_t));
-
- n_dci_dl=0;
-
- // fill dlsch_eNB structure from DCI
- for (n_dci = 0; n_dci < nb_total_dci; n_dci++) {
-
- //exclude ul dci
- if ((eNB_transport_info[enb_id][CC_id].dci_alloc[n_dci_dl].format > 0) || (eNB_transport_info[enb_id][CC_id].num_pmch > 0 )) {
-#ifdef DEBUG_EMU
- LOG_D(EMU, "dci spec %d common %d pmch %d tbs is %d payload offset %d\n",
- eNB_transport_info[enb_id][CC_id].num_ue_spec_dci,
- eNB_transport_info[enb_id][CC_id].num_common_dci,
- eNB_transport_info[enb_id][CC_id].num_pmch,
- eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl],
- payload_offset);
-#endif
-
- switch (eNB_transport_info[enb_id][CC_id].dlsch_type[n_dci_dl]) {
- case 0: //SI:
- memcpy(RC.eNB[enb_id][CC_id]->dlsch_SI->harq_processes[0]->b,
- &eNB_transport_info[enb_id][CC_id].transport_blocks[payload_offset],
- eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
-#ifdef DEBUG_EMU
- LOG_D(EMU, "SI eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]%d \n",
- eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
-#endif
- break;
-
- case 1: //RA:
- memcpy(RC.eNB[enb_id][CC_id]->dlsch_ra->harq_processes[0]->b,
- &eNB_transport_info[enb_id][CC_id].transport_blocks[payload_offset],
- eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
-#ifdef DEBUG_EMU
- LOG_D(EMU, "RA eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]%d \n",
- eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
-#endif
- break;
-
- case 2://TB0:
- harq_pid = eNB_transport_info[enb_id][CC_id].harq_pid[n_dci_dl];
- ue_id = eNB_transport_info[enb_id][CC_id].ue_id[n_dci_dl];
- RC.eNB[enb_id][CC_id]->dlsch[ue_id][0]->rnti=
- eNB_transport_info[enb_id][CC_id].dci_alloc[n_dci_dl].rnti;
- dlsch_eNB = RC.eNB[enb_id][CC_id]->dlsch[ue_id][0];
-#ifdef DEBUG_EMU
- LOG_D(EMU,
- " enb_id %d ue id is %d rnti is %x dci index %d, harq_pid %d tbs %d \n",
- enb_id, ue_id, eNB_transport_info[enb_id][CC_id].dci_alloc[n_dci_dl].rnti,
- n_dci_dl, harq_pid, eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
-
- for (i=0; iharq_processes[harq_pid]->b,
- &eNB_transport_info[enb_id][CC_id].transport_blocks[payload_offset],
- eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
- break;
-
- case 3://TB1:
- harq_pid = eNB_transport_info[enb_id][CC_id].harq_pid[n_dci_dl];
- ue_id = eNB_transport_info[enb_id][CC_id].ue_id[n_dci_dl];
- RC.eNB[enb_id][CC_id]->dlsch[ue_id][1]->rnti=
- eNB_transport_info[enb_id][CC_id].dci_alloc[n_dci_dl].rnti;
- dlsch_eNB = RC.eNB[enb_id][CC_id]->dlsch[ue_id][1];
-
- memcpy(dlsch_eNB->harq_processes[harq_pid]->b,
- &eNB_transport_info[enb_id][CC_id].transport_blocks[payload_offset],
- eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
- break;
-
- case 5:
- memcpy(RC.eNB[enb_id][CC_id]->dlsch_MCH->harq_processes[0]->b,
- &eNB_transport_info[enb_id][CC_id].transport_blocks[payload_offset],
- eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
-#ifdef DEBUG_EMU
- LOG_D(EMU, "PMCH eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl] %d \n",
- eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
-#endif
- break;
-
- default:
- LOG_W(EMU,"not supported dlsch type %d \n", eNB_transport_info[enb_id][CC_id].dlsch_type[n_dci_dl]);
- break;
- }
-
- payload_offset += eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl];
- }
-
- n_dci_dl++;
- }
-
-#ifdef DEBUG_EMU
- LOG_D(EMU, "Fill phy eNB vars done next slot %d !\n", next_slot);
-#endif
- }
-}
-
-void fill_phy_ue_vars(unsigned int ue_id, uint8_t CC_id,unsigned int last_slot)
-{
- int n_enb;//index
- int enb_id;
- // int harq_id;
- // int payload_offset = 0;
- unsigned short rnti;
- unsigned int harq_pid;
- LTE_UE_ULSCH_t *ulsch;
- PUCCH_FMT_t pucch_format;
- // uint8_t ue_transport_info_index[NUMBER_OF_eNB_MAX];
- uint8_t subframe = (last_slot+1)>>1;
-
- memcpy(&ue_cntl_delay[ue_id][CC_id][(last_slot+1)%2], &UE_transport_info[ue_id][CC_id].cntl,
- sizeof(UE_cntl));
-
-#ifdef DEBUG_EMU
- LOG_D(EMU,
- "Last slot %d subframe %d CC_id %d: Fill phy vars UE %d : PRACH is (%d,%d) preamble (%d,%d) SR (%d,%d), pucch_sel (%d, %d)\n",
-
- last_slot,subframe,CC_id, ue_id,
- UE_transport_info[ue_id][CC_id].cntl.prach_flag,
- ue_cntl_delay[ue_id][CC_id][last_slot%2].prach_flag,
- UE_transport_info[ue_id][CC_id].cntl.prach_id,
- ue_cntl_delay[ue_id][CC_id][last_slot%2].prach_id,
- UE_transport_info[ue_id][CC_id].cntl.sr,
- ue_cntl_delay[ue_id][CC_id][last_slot%2].sr,
- UE_transport_info[ue_id][CC_id].cntl.pucch_sel,
- ue_cntl_delay[ue_id][CC_id][last_slot%2].pucch_sel);
-#endif
- //ue_cntl_delay[subframe%2].prach_flag ;
- PHY_vars_UE_g[ue_id][CC_id]->generate_prach = ue_cntl_delay[ue_id][CC_id][last_slot%2].prach_flag;//UE_transport_info[ue_id][CC_id].cntl.prach_flag;
-
- if (PHY_vars_UE_g[ue_id][CC_id]->generate_prach == 1) {
- // if (PHY_vars_UE_g[ue_id][CC_id]->prach_resources[enb_id] == NULL)
- // PHY_vars_UE_g[ue_id][CC_id]->prach_resources[enb_id] = malloc(sizeof(PRACH_RESOURCES_t));
- //ue_cntl_delay[subframe%2].prach_id;
- PHY_vars_UE_g[ue_id][CC_id]->prach_PreambleIndex =
- ue_cntl_delay[ue_id][CC_id][last_slot%2].prach_id;
- }
-
- pucch_format= ue_cntl_delay[ue_id][CC_id][last_slot%2].pucch_flag;// UE_transport_info[ue_id][CC_id].cntl.pucch_flag;
-
- if ((last_slot + 1) % 2 == 0) {
- if (pucch_format == pucch_format1) { // UE_transport_info[ue_id][CC_id].cntl.sr;
- PHY_vars_UE_g[ue_id][CC_id]->sr[subframe] = ue_cntl_delay[ue_id][CC_id][last_slot%2].sr;
- } else if ((pucch_format == pucch_format1a) ||
- (pucch_format == pucch_format1b)) {
- PHY_vars_UE_g[ue_id][CC_id]->pucch_payload[0] = ue_cntl_delay[ue_id][CC_id][last_slot%2].pucch_payload;
- //UE_transport_info[ue_id][CC_id].cntl.pucch_payload;
- }
-
- PHY_vars_UE_g[ue_id][CC_id]->pucch_sel[subframe] =
- ue_cntl_delay[ue_id][CC_id][last_slot%2].pucch_sel;
- }
-
-#ifdef DEBUG_EMU
- LOG_D(EMU,"subframe %d trying to copy the payload from num eNB %d to UE %d \n",
- subframe, UE_transport_info[ue_id][CC_id].num_eNB, ue_id);
-#endif
-
- for (n_enb = 0; n_enb < UE_transport_info[ue_id][CC_id].num_eNB; n_enb++) {
-
- rnti = UE_transport_info[ue_id][CC_id].rnti[n_enb];
- enb_id = UE_transport_info[ue_id][CC_id].eNB_id[n_enb];
-
- PHY_vars_UE_g[ue_id][CC_id]->pdcch_vars[0][enb_id]->crnti=rnti;
- PHY_vars_UE_g[ue_id][CC_id]->pdcch_vars[1][enb_id]->crnti=rnti;
-
- harq_pid = UE_transport_info[ue_id][CC_id].harq_pid[n_enb];
-
- PHY_vars_UE_g[ue_id][CC_id]->ulsch[enb_id]->o_RI[0] =
- ue_cntl_delay[ue_id][CC_id][last_slot%2].pusch_ri & 0x1;
- PHY_vars_UE_g[ue_id][CC_id]->ulsch[enb_id]->o_RI[1] =
- (ue_cntl_delay[ue_id][CC_id][last_slot%2].pusch_ri>>1) & 0x1;
-
- PHY_vars_UE_g[ue_id][CC_id]->ulsch[enb_id]->o_ACK[0]=
- ue_cntl_delay[ue_id][CC_id][last_slot%2].pusch_ack & 0x1;
- PHY_vars_UE_g[ue_id][CC_id]->ulsch[enb_id]->o_ACK[1]=
- (ue_cntl_delay[ue_id][CC_id][last_slot%2].pusch_ack>>1) & 0x1;
- //*(uint32_t *)ulsch->o = ue_cntl_delay[ue_id][CC_id][last_slot%2].pusch_uci;
-
- if ((last_slot % 2) == 1) {
- PHY_vars_UE_g[ue_id][CC_id]->ulsch[enb_id]->O =
- ue_cntl_delay[ue_id][CC_id][last_slot%2].length_uci;
- PHY_vars_UE_g[ue_id][CC_id]->ulsch[enb_id]->uci_format =
- ue_cntl_delay[ue_id][CC_id][last_slot%2].uci_format;
-
- memcpy(PHY_vars_UE_g[ue_id][CC_id]->ulsch[enb_id]->o,
- ue_cntl_delay[ue_id][CC_id][last_slot%2].pusch_uci,
- MAX_CQI_BYTES);
-
- ulsch = PHY_vars_UE_g[ue_id][CC_id]->ulsch[enb_id];
- // if (((HLC_subband_cqi_rank1_2A_5MHz *)ulsch->o)->cqi1)
- LOG_D(EMU,
- "[UE %d] subframe %d last slot %d copy the payload from eNB %d to UE %d with harq id %d cqi (val %d, length %d) \n",
- ue_id, subframe, last_slot, enb_id, ue_id, harq_pid,
- ((HLC_subband_cqi_rank1_2A_5MHz *)ulsch->o)->cqi1,
- PHY_vars_UE_g[ue_id][CC_id]->ulsch[enb_id]->O);
- }
-
- memcpy(PHY_vars_UE_g[ue_id][CC_id]->ulsch[enb_id]->harq_processes[harq_pid]->b,
- UE_transport_info[ue_id][CC_id].transport_blocks,
- UE_transport_info[ue_id][CC_id].tbs[enb_id]);
-
- //ue_transport_info_index[enb_id]+=UE_transport_info[ue_id][CC_id].tbs[enb_id];
-
- //UE_transport_info[ue_id][CC_id].transport_blocks+=ue_transport_info_index[enb_id];
- //LOG_T(EMU,"ulsch tbs is %d\n", UE_transport_info[ue_id][CC_id].tbs[enb_id]);
- }
-}
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/extern.h b/openair1/SIMULATION/ETH_TRANSPORT/extern.h
deleted file mode 100644
index ecd0d301d6..0000000000
--- a/openair1/SIMULATION/ETH_TRANSPORT/extern.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file extern.h
- * \brief specifies the extern variables for phy emulation
- * \author Navid Nikaein and Raymomd Knopp and Hicham Anouar
- * \date 2011
- * \version 1.1
- * \company Eurecom
- * \email: navid.nikaein@eurecom.fr
- */
-
-#ifndef __BYPASS_SESSION_LAYER_EXTERN_H__
-# define __BYPASS_SESSION_LAYER_EXTERN_H__
-
-#include
-
-
-extern unsigned char Emulation_status;
-extern unsigned char emu_tx_status;
-extern unsigned char emu_rx_status;
-//extern unsigned int Master_list;
-//extern unsigned short Master_id;
-//extern unsigned int Is_primary_master;
-
-#if !defined(ENABLE_NEW_MULTICAST)
-extern pthread_mutex_t Tx_mutex;
-extern pthread_cond_t Tx_cond;
-extern char Tx_mutex_var;
-#endif
-
-extern rx_handler_t rx_handler;
-extern tx_handler_t tx_handler;
-
-extern eNB_transport_info_t eNB_transport_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
-extern uint16_t eNB_transport_info_TB_index[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
-
-extern UE_transport_info_t UE_transport_info[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
-
-extern UE_cntl ue_cntl_delay[NUMBER_OF_UE_MAX][MAX_NUM_CCs][2];
-
-#endif
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c b/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c
deleted file mode 100644
index 281d42a7a6..0000000000
--- a/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file multicast_link.c
- * \brief
- * \author Lionel Gauthier and Navid Nikaein
- * \date 2011
- * \version 1.1
- * \company Eurecom
- * \email: navid.nikaein@eurecom.fr
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#define MULTICAST_LINK_C
-
-#include "socket.h"
-#include "multicast_link.h"
-
-#include "common/utils/LOG/log.h"
-
-extern unsigned short Master_id;
-
-const char *multicast_group_list[MULTICAST_LINK_NUM_GROUPS] = {
- "239.0.0.161",
- "239.0.0.162",
- "239.0.0.163",
- "239.0.0.164"
-};
-
-static multicast_group_t group_list[MULTICAST_LINK_NUM_GROUPS];
-
-/* Socket file descriptors we want to wake up for, using select() */
-static fd_set socks;
-/* Highest #'d file descriptor, needed for select() */
-static int highsock;
-#if ! defined(ENABLE_NEW_MULTICAST)
-static pthread_t main_loop_thread;
-#endif
-static void (*rx_handler) (unsigned int, char *);
-static unsigned char multicast_group;
-static char *multicast_if;
-
-//------------------------------------------------------------------------------
-void
-multicast_link_init(void)
-{
- //------------------------------------------------------------------------------
- int group;
- int multicast_loop;
- int reuse_addr = 1;
- static struct ip_mreq command;
- struct sockaddr_in sin;
- // struct ifreq ifr;
-
- for (group = 0; group < MULTICAST_LINK_NUM_GROUPS; group++) {
- //strcpy (group_list[group].host_addr, multicast_group_list[group]);
- strncpy (group_list[group].host_addr, multicast_group_list[group], sizeof(group_list[group].host_addr));
- group_list[group].host_addr[sizeof(group_list[group].host_addr) - 1] = 0; // terminate string
- group_list[group].port = 46014 + group;
- group_list[group].socket = make_socket_inet(
- SOCK_DGRAM,
- &group_list[group].port, &sin);
-
- LOG_D(PHY, "multicast_link_init(): Created socket %d for group %d, port %d\n",
- group_list[group].socket,group,group_list[group].port);
-
- /* Used so we can re-bind to our port while a previous connection is still
- * in TIME_WAIT state.
- */
- if (setsockopt(group_list[group].socket, SOL_SOCKET, SO_REUSEADDR,
- &reuse_addr, sizeof (reuse_addr)) < 0) {
- LOG_E(PHY, "[MULTICAST] ERROR : setsockopt:SO_REUSEADDR, exiting ...");
- exit (EXIT_FAILURE);
- }
-
- if (multicast_if != NULL) {
- if (setsockopt(group_list[group].socket, SOL_SOCKET,SO_BINDTODEVICE,
- multicast_if, strlen(multicast_if)) < 0) {
- LOG_E(PHY,
- "[MULTICAST] ERROR : setsockopt:SO_BINDTODEVICE on interface %s, exiting ...\n",
- multicast_if);
- LOG_E(PHY,
- "[MULTICAST] make sure that you have a root privilage or run with sudo -E \n");
- exit (EXIT_FAILURE);
- }
- }
-
-#if !defined(ENABLE_NEW_MULTICAST)
- /* Make the socket blocking */
- socket_setnonblocking(group_list[group].socket);
-#endif
-
- multicast_loop = 0;
-
- if (setsockopt (group_list[group].socket, IPPROTO_IP, IP_MULTICAST_LOOP,
- &multicast_loop, sizeof (multicast_loop)) < 0) {
- LOG_E(PHY,
- "[MULTICAST] ERROR: %s line %d multicast_link_main_loop() IP_MULTICAST_LOOP %m",
- __FILE__, __LINE__);
- exit (EXIT_FAILURE);
- }
-
- // Join the broadcast group:
- command.imr_multiaddr.s_addr = inet_addr (group_list[group].host_addr);
- command.imr_interface.s_addr = htonl (INADDR_ANY);
-
- if (command.imr_multiaddr.s_addr == -1) {
- LOG_E(PHY, "[MULTICAST] ERROR: %s line %d NO MULTICAST", __FILE__, __LINE__);
- exit (EXIT_FAILURE);
- }
-
- if (setsockopt (group_list[group].socket, IPPROTO_IP, IP_ADD_MEMBERSHIP,
- &command, sizeof (command)) < 0) {
- LOG_E(PHY, "[MULTICAST] ERROR: %s line %d IP_ADD_MEMBERSHIP %m", __FILE__,
- __LINE__);
- exit (EXIT_FAILURE);
- }
-
- memset (&group_list[group].sock_remote_addr, 0, sizeof (struct sockaddr_in));
- group_list[group].sock_remote_addr.sin_family = AF_INET;
- group_list[group].sock_remote_addr.sin_addr.s_addr = inet_addr (multicast_group_list[group]);
- group_list[group].sock_remote_addr.sin_port = htons (group_list[group].port);
- }
-}
-
-//------------------------------------------------------------------------------
-void
-multicast_link_build_select_list (void)
-{
- //------------------------------------------------------------------------------
- int group;
-
- /* First put together fd_set for select(), which will
- consist of the sock veriable in case a new connection
- is coming in, plus all the sockets we have already
- accepted. */
-
-
- /* FD_ZERO() clears out the fd_set called socks, so that
- it doesn't contain any file descriptors. */
-
- FD_ZERO (&socks);
-
-
- /* Loops through all the possible connections and adds
- those sockets to the fd_set */
-
- for (group = 0; group < MULTICAST_LINK_NUM_GROUPS; group++) {
- if (group_list[group].socket != 0) {
- FD_SET (group_list[group].socket, &socks);
-
- if (group_list[group].socket > highsock) {
- highsock = group_list[group].socket;
- }
- }
- }
-}
-
-void
-multicast_link_read_data (int groupP)
-{
- int num_bytes;
-
- if ((groupP < MULTICAST_LINK_NUM_GROUPS) && (groupP >= 0)) {
- if ((num_bytes = recvfrom (group_list[groupP].socket,
- group_list[groupP].rx_buffer, 40000, 0, 0, 0)) < 0) {
- LOG_E(PHY, "[MULTICAST] recvfrom has failed (%d:%s)\n (%s:%d)\n",
- errno, strerror(errno), __FILE__, __LINE__);
- } else {
- rx_handler(num_bytes,group_list[groupP].rx_buffer);
- }
- } else {
- LOG_E(PHY, "[MULTICAST] ERROR: groupP out of bounds %d\n", groupP);
- }
-}
-
-//------------------------------------------------------------------------------
-void
-multicast_link_read (void)
-{
- //------------------------------------------------------------------------------
- int group; /* Current item in connectlist for for loops */
-
- /* Now check connectlist for available data */
-
- /* Run through our sockets and check to see if anything
- happened with them, if so 'service' them. */
-
- for (group = multicast_group; group < MULTICAST_LINK_NUM_GROUPS ; group++) {
- if (FD_ISSET (group_list[group].socket, &socks)) {
- multicast_link_read_data (group);
- break;
- }
- } /* for (all entries in queue) */
-}
-
-//------------------------------------------------------------------------------
-int
-multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP)
-{
- //------------------------------------------------------------------------------
- int num;
-
- if ((num = sendto (group_list[groupP].socket, dataP, sizeP, 0,
- (struct sockaddr *) &group_list[groupP].sock_remote_addr,
- sizeof (group_list[groupP].sock_remote_addr))) < 0) {
- LOG_E(PHY, "[MULTICAST] sendto has failed (%d:%s)\n (%s:%d)\n",
- errno, strerror(errno),
- __FILE__, __LINE__);
- }
-
- return num;
-}
-
-int multicast_link_read_data_from_sock(uint8_t is_master)
-{
- struct timeval timeout, *timeout_p;
- int readsocks; /* Number of sockets ready for reading */
-
- timeout.tv_sec = 0;
- timeout.tv_usec = 15000;
-
- if (is_master == 0) {
- /* UE will block indefinetely if no data is sent from eNB
- * NOTE: a NULL timeout for select will block indefinetely
- */
- timeout_p = NULL;
- } else {
- /* In case of eNB set the timeout to 500 usecs after which we consider
- * the packets as dropped.
- */
- timeout_p = &timeout;
- }
-
- highsock = -1;
-
- multicast_link_build_select_list ();
-
- LOG_D(PHY, "Stuck on select with timeout %s\n",
- timeout_p == NULL ? "infinite" : "15000 usecs");
-
- readsocks = select(highsock + 1, &socks, (fd_set *) 0, (fd_set *) 0, timeout_p);
-
- if (readsocks < 0) {
- LOG_E(PHY, "Multicast select failed (%d:%s)\n", errno, strerror(errno));
- exit(EXIT_FAILURE);
- } else if (readsocks > 0) {
- multicast_link_read();
- } else {
- /* Timeout */
- LOG_I(PHY, "Multicast select time-out\n");
- return 1;
- }
-
- return 0;
-}
-
-void* multicast_link_main_loop (void *param)
-{
- while (1) {
- multicast_link_read_data_from_sock(0);
- }
-
- return NULL;
-}
-
-void multicast_link_start(void (*rx_handlerP) (unsigned int, char *),
- unsigned char _multicast_group, char *multicast_ifname)
-{
- rx_handler = rx_handlerP;
- multicast_group = _multicast_group;
- multicast_if = multicast_ifname;
- LOG_I(PHY, "[MULTICAST] LINK START on interface=%s for group=%d: handler=%p\n",
- (multicast_if == NULL) ? "not specified" : multicast_if, multicast_group,
- rx_handler);
- multicast_link_init ();
-#if ! defined(ENABLE_NEW_MULTICAST)
- LOG_D(PHY, "[MULTICAST] multicast link start thread\n");
-
- if (pthread_create (&main_loop_thread, NULL, multicast_link_main_loop,
- NULL) != 0) {
- LOG_E(PHY, "[MULTICAST LINK] Error in pthread_create (%d:%s)\n",
- errno, strerror(errno));
- exit(EXIT_FAILURE);
- } else {
- pthread_detach(main_loop_thread); // disassociate from parent
- LOG_I(PHY, "[MULTICAST LINK] Thread detached\n");
- }
-
-#endif
-}
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.h b/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.h
deleted file mode 100644
index fdea20455b..0000000000
--- a/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file multicast_link.h
- * \brief
- * \author Lionel Gauthier and Navid Nikaein
- * \date 2011
- * \version 1.1
- * \company Eurecom
- * \email: navid.nikaein@eurecom.fr
- */
-
-#ifndef __MULTICAST_LINK_H__
-# define __MULTICAST_LINK_H__
-# ifdef MULTICAST_LINK_C
-# define private_multicast_link(x) x
-# define public_multicast_link(x) x
-# else
-# define private_multicast_link(x)
-# define public_multicast_link(x) extern x
-# endif
-# include "stdint.h"
-
-private_multicast_link (typedef struct multicast_group_t {
- int socket;
- struct sockaddr_in sock_remote_addr;
- char host_addr[16];
- uint16_t port;
- char rx_buffer[40000];
-} multicast_group_t;)
-
-#define MULTICAST_LINK_NUM_GROUPS 4
-
-extern const char *multicast_group_list[MULTICAST_LINK_NUM_GROUPS];
-
-private_multicast_link(void multicast_link_init (void));
-private_multicast_link(void multicast_link_read_data (int groupP));
-private_multicast_link(void multicast_link_read (void));
-private_multicast_link(void *multicast_link_main_loop (void *param));
-
-public_multicast_link(int multicast_link_write_sock (int groupP, char *dataP, uint32_t sizeP));
-public_multicast_link(void multicast_link_start ( void (*rx_handlerP) (unsigned int, char*), unsigned char multicast_group, char * multicast_ifname));
-# ifdef BYPASS_PHY
-public_multicast_link(pthread_mutex_t Bypass_phy_wr_mutex);
-public_multicast_link(pthread_cond_t Bypass_phy_wr_cond);
-public_multicast_link(char Bypass_phy_wr);
-# endif //BYPASS_PHY
-#endif
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
deleted file mode 100644
index 75f5e83632..0000000000
--- a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file netlink_init.c
-* \brief initiate the netlink socket for communication with nas dirver
-* \author Navid Nikaein and Raymomd Knopp
-* \date 2011
-* \version 1.0
-* \company Eurecom
-* \email: navid.nikaein@eurecom.fr
-*/
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "common/platform_constants.h"
-
-#include
-#include
-#include
-#include
-#include "common/openairinterface5g_limits.h"
-
-#include "pdcp.h"
-
-char nl_rx_buf[NL_MAX_PAYLOAD];
-
-struct sockaddr_nl nas_src_addr, nas_dest_addr;
-struct nlmsghdr *nas_nlh_tx = NULL;
-struct nlmsghdr *nas_nlh_rx = NULL;
-struct iovec nas_iov_tx;
-struct iovec nas_iov_rx = {nl_rx_buf, sizeof(nl_rx_buf)};
-
-int nas_sock_fd[MAX_MOBILES_PER_ENB*2]; //Allocated for both LTE UE and NR UE.
-
-int nas_sock_mbms_fd;
-
-struct msghdr nas_msg_tx;
-struct msghdr nas_msg_rx;
-
-#define GRAAL_NETLINK_ID 31
-
-static int tun_alloc(char *dev) {
- struct ifreq ifr;
- int fd, err;
-
- if( (fd = open("/dev/net/tun", O_RDWR)) < 0 ) {
- LOG_E(PDCP, "[TUN] failed to open /dev/net/tun\n");
- return -1;
- }
-
- memset(&ifr, 0, sizeof(ifr));
- /* Flags: IFF_TUN - TUN device (no Ethernet headers)
- * IFF_TAP - TAP device
- *
- * IFF_NO_PI - Do not provide packet information
- */
- ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
-
- if( *dev )
- strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)-1);
-
- if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ) {
- close(fd);
- return err;
- }
-
- strcpy(dev, ifr.ifr_name);
- return fd;
-}
-
-
-int netlink_init_mbms_tun(char *ifprefix, int id) {//for UE, id = 1, 2, ...,
- int ret;
- char ifname[64];
-
- if (id > 0) {
- sprintf(ifname, "oaitun_%.3s%d", ifprefix, id-1);
- }
- else {
- sprintf(ifname, "oaitun_%.3s1", ifprefix); // added "1": for historical reasons
- }
- nas_sock_mbms_fd = tun_alloc(ifname);
-
- if (nas_sock_mbms_fd == -1) {
- printf("[NETLINK] Error opening mbms socket %s (%d:%s)\n",ifname,errno, strerror(errno));
- exit(1);
- }
-
- printf("[NETLINK]Opened socket %s with fd %d\n",ifname,nas_sock_mbms_fd);
- ret = fcntl(nas_sock_mbms_fd,F_SETFL,O_NONBLOCK);
-
- if (ret == -1) {
- printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
-
- if (LINK_ENB_PDCP_TO_IP_DRIVER) {
- exit(1);
- }
- }
-
- memset(&nas_src_addr, 0, sizeof(nas_src_addr));
- nas_src_addr.nl_family = AF_NETLINK;
- nas_src_addr.nl_pid = 1;//getpid(); /* self pid */
- nas_src_addr.nl_groups = 0; /* not in mcast groups */
- ret = bind(nas_sock_mbms_fd, (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr));
-
- return 1;
-}
-
-int netlink_init_tun(char *ifprefix, int num_if, int id) {//for UE, id = 1, 2, ...,
- int ret;
- char ifname[64];
-
- int begx = (id == 0) ? 0 : id - 1;
- int endx = (id == 0) ? num_if : id;
- for (int i = begx; i < endx; i++) {
- sprintf(ifname, "oaitun_%.3s%d",ifprefix,i+1);
- nas_sock_fd[i] = tun_alloc(ifname);
-
- if (nas_sock_fd[i] == -1) {
- LOG_E(PDCP, "TUN: Error opening socket %s (%d:%s)\n",ifname,errno, strerror(errno));
- return 0;
- }
-
- LOG_I(PDCP, "TUN: Opened socket %s with fd nas_sock_fd[%d]=%d\n",
- ifname, i, nas_sock_fd[i]);
- ret = fcntl(nas_sock_fd[i],F_SETFL,O_NONBLOCK);
-
- if (ret == -1) {
- LOG_E(PDCP, "TUN: Error fcntl (%d:%s)\n",errno, strerror(errno));
-
- if (LINK_ENB_PDCP_TO_IP_DRIVER) {
- exit(1);
- }
- }
- } /* for */
-
- return 1;
-}
-
-
-int netlink_init(void) {
- int ret;
- nas_sock_fd[0] = socket(PF_NETLINK, SOCK_RAW,GRAAL_NETLINK_ID);
-
- if (nas_sock_fd[0] == -1) {
- printf("[NETLINK] Error opening GRAAL_NETLINK_ID socket %d (%d:%s)\n",nas_sock_fd[0],errno, strerror(errno));
-
- if (LINK_ENB_PDCP_TO_IP_DRIVER) {
- exit(1);
- }
- }
-
- printf("[NETLINK] Opened socket with fd %d\n",nas_sock_fd[0]);
- ret = fcntl(nas_sock_fd[0],F_SETFL,O_NONBLOCK);
-
- if (ret == -1) {
- printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
-
- if (LINK_ENB_PDCP_TO_IP_DRIVER) {
- exit(1);
- }
- }
-
- memset(&nas_src_addr, 0, sizeof(nas_src_addr));
- nas_src_addr.nl_family = AF_NETLINK;
- nas_src_addr.nl_pid = 1;//getpid(); /* self pid */
- nas_src_addr.nl_groups = 0; /* not in mcast groups */
- ret = bind(nas_sock_fd[0], (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr));
- memset(&nas_dest_addr, 0, sizeof(nas_dest_addr));
- nas_dest_addr.nl_family = AF_NETLINK;
- nas_dest_addr.nl_pid = 0; /* For Linux Kernel */
- nas_dest_addr.nl_groups = 0; /* unicast */
- // TX PART
- free(nas_nlh_tx);
- nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD));
- memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD));
- /* Fill the netlink message header */
- nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD);
- nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */
- nas_nlh_tx->nlmsg_flags = 0;
- nas_iov_tx.iov_base = (void *)nas_nlh_tx;
- nas_iov_tx.iov_len = nas_nlh_tx->nlmsg_len;
- memset(&nas_msg_tx,0,sizeof(nas_msg_tx));
- nas_msg_tx.msg_name = (void *)&nas_dest_addr;
- nas_msg_tx.msg_namelen = sizeof(nas_dest_addr);
- nas_msg_tx.msg_iov = &nas_iov_tx;
- nas_msg_tx.msg_iovlen = 1;
- // RX PART
- memset(&nas_msg_rx,0,sizeof(nas_msg_rx));
- nas_msg_rx.msg_name = (void *)&nas_src_addr;
- nas_msg_rx.msg_namelen = sizeof(nas_src_addr);
- nas_msg_rx.msg_iov = &nas_iov_rx;
- nas_msg_rx.msg_iovlen = 1;
- return(nas_sock_fd[0]);
-}
-
-void netlink_cleanup(void)
-{
- free(nas_nlh_tx);
- nas_nlh_tx = NULL;
-}
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/proto.h b/openair1/SIMULATION/ETH_TRANSPORT/proto.h
deleted file mode 100644
index bc6990ac3e..0000000000
--- a/openair1/SIMULATION/ETH_TRANSPORT/proto.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file proto.h
-* \brief
-* \author Navid Nikaein
-* \date 2011
-* \version 1.0
-* \company Eurecom
-* \email: navid.nikaein@eurecom.fr
-*/
-
-#include "SIMULATION/ETH_TRANSPORT/defs.h"
-
-#ifndef EMU_PROTO_H_
-#define EMU_PROTO_H_
-
-void init_bypass (void);
-void bypass_init ( unsigned int (*tx_handlerP) (unsigned char,char *, unsigned int *, unsigned int *),unsigned int (*rx_handlerP) (unsigned char,char *,unsigned int));
-int bypass_rx_data(unsigned int frame, unsigned int last_slot,
- unsigned int next_slot, uint8_t is_master);
-void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot,
- unsigned int next_slot, uint8_t is_master);
-void bypass_tx_data (emu_transport_info_t Type, unsigned int frame, unsigned int next_slot);
-
-void emulation_tx_rx(void);
-
-unsigned int emul_tx_handler(unsigned char Mode,char *Tx_buffer,unsigned int *Nbytes,unsigned int *Nb_flows);
-unsigned int emul_rx_handler(unsigned char Mode,char *rx_buffer, unsigned int Nbytes);
-
-unsigned int emul_rx_data(void);
-
-void emu_transport_info(unsigned int last_slot, unsigned int next_slot);
-void fill_phy_enb_vars(unsigned int enb_id, uint8_t CC_id,unsigned int next_slot);
-void fill_phy_ue_vars(unsigned int ue_id, uint8_t CC_id,unsigned int last_slot);
-void emu_transport_sync(void);
-void emu_transport(unsigned int frame, unsigned int last_slot,unsigned int next_slot, lte_subframe_t direction, unsigned char frame_type, int ethernet_flag );
-void emu_transport_DL(unsigned int frame, unsigned int last_slot,unsigned int next_slot);
-void emu_transport_UL(unsigned int frame, unsigned int last_slot,unsigned int next_slot);
-void emu_transport_release(void);
-
-int multicast_link_read_data_from_sock(uint8_t eNB_flag);
-
-void clear_eNB_transport_info(uint8_t);
-void clear_UE_transport_info(uint8_t);
-int netlink_init(void);
-int netlink_init_tun(char *ifsuffix, int num_if, int id);
-int netlink_init_mbms_tun(char *ifsuffix, int id);
-void netlink_cleanup(void);
-
-#endif /* EMU_PROTO_H_ */
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/socket.c b/openair1/SIMULATION/ETH_TRANSPORT/socket.c
deleted file mode 100644
index 2b28a66170..0000000000
--- a/openair1/SIMULATION/ETH_TRANSPORT/socket.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file socket.c
-* \brief
-* \author Lionel Gauthier
-* \date 2011
-* \version 1.0
-* \company Eurecom
-* \email: lionel.gauthier@eurecom.fr
-*/
-
-#include
-#include
-#include
-#include
-//#include
-#include
-#include
-#include
-
-#define SOCKET_C
-//#include "openair_defs.h"
-#include "socket.h"
-
-#define msg printf
-//------------------------------------------------------------------------------
-void
-socket_setnonblocking (int sockP)
-{
- //------------------------------------------------------------------------------
-
- int opts;
-
- opts = fcntl (sockP, F_GETFL);
-
- if (opts < 0) {
- perror ("fcntl(F_GETFL)");
- exit (EXIT_FAILURE);
- }
-
- opts = (opts | O_NONBLOCK);
-
- if (fcntl (sockP, F_SETFL, opts) < 0) {
- perror ("fcntl(F_SETFL)");
- exit (EXIT_FAILURE);
- }
-
- return;
-}
-
-//------------------------------------------------------------------------------
-int
-make_socket_inet (int typeP, uint16_t * portP, struct sockaddr_in *ptr_addressP)
-{
- //------------------------------------------------------------------------------
-
- int sock;
- unsigned int length = sizeof (struct sockaddr_in);
- struct sockaddr_in name;
-
-
- assert ((typeP == SOCK_STREAM) || (typeP == SOCK_DGRAM));
-
- /* Create the socket. */
- sock = socket (PF_INET, typeP, 0);
-
- if (sock < 0) {
- fprintf (stderr, "ERROR: %s line %d socket %m", __FILE__, __LINE__);
- exit (EXIT_FAILURE);
- }
-
- /* Give the socket a name. */
- name.sin_family = AF_INET;
- name.sin_port = htons (*portP);
- name.sin_addr.s_addr = htonl (INADDR_ANY);
-
- if (bind (sock, (struct sockaddr *) &name, sizeof (name)) < 0) {
- close (sock);
- fprintf (stderr, "ERROR: %s line %d bind port %d %m", __FILE__, __LINE__, *portP);
- exit (EXIT_FAILURE);
- }
-
- if (ptr_addressP != NULL) {
- getsockname (sock, (struct sockaddr *) ptr_addressP, &length);
- }
-
- msg("[SOCKET] bound socket port %d\n", *portP);
- return sock;
-}
-
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/socket.h b/openair1/SIMULATION/ETH_TRANSPORT/socket.h
deleted file mode 100644
index e9ca36bee2..0000000000
--- a/openair1/SIMULATION/ETH_TRANSPORT/socket.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file socket.h
-* \brief
-* \author Lionel Gauthier
-* \date 2011
-* \version 1.0
-* \company Eurecom
-* \email: lionel.gauthier@eurecom.fr
-*/
-
-#ifndef __SIMULATION_ETH_TRANSPORT_SOCKET__H__
-#define __SIMULATION_ETH_TRANSPORT_SOCKET__H__
-
-# ifdef SOCKET_C
-# define private_socket(x) x
-# define public_socket(x) x
-# else
-# define private_socket(x)
-# define public_socket(x) extern x
-# endif
-# include "stdint.h"
-public_socket (void socket_setnonblocking (int sockP);
- )
-public_socket (int make_socket_inet (int typeP, uint16_t * portP, struct sockaddr_in *ptr_addressP);
- )
-#endif
diff --git a/openair1/SIMULATION/LTE_PHY/common_sim.h b/openair1/SIMULATION/LTE_PHY/common_sim.h
index 5625cf8e2f..aaea26c5bb 100644
--- a/openair1/SIMULATION/LTE_PHY/common_sim.h
+++ b/openair1/SIMULATION/LTE_PHY/common_sim.h
@@ -62,18 +62,20 @@ void printDistribution(time_stats_t *ptr, varArray_t *sortedList, char *txt) {
}
void printStatIndent(time_stats_t *ptr, char *txt) {
- printf("|__ %-38s %6.2f us (%3d trials)\n",
+ printf("|__ %-38s %6.2f us (%3d trials)\t\t(%6.2f total [ms])\n",
txt,
ptr->trials?inMicroS(ptr->diff/ptr->trials):0,
- ptr->trials);
+ ptr->trials,
+ ptr->trials?inMicroS(ptr->diff)/1000:0);
}
void printStatIndent2(time_stats_t *ptr, char *txt) {
double timeBase=1/(1000*get_cpu_freq_GHz());
- printf(" |__ %-34s %6.2f us (%3d trials)\n",
+ printf(" |__ %-34s %6.2f us (%3d trials)\t\t(%6.2f total [ms])\n",
txt,
ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0,
- ptr->trials);
+ ptr->trials,
+ ptr->trials?inMicroS(ptr->diff)/1000:0);
}
void printStatIndent3(time_stats_t *ptr, char *txt) {
diff --git a/openair1/SIMULATION/LTE_PHY/dummy_functions.c b/openair1/SIMULATION/LTE_PHY/dummy_functions.c
index fcbab51f4b..fd682d2f78 100644
--- a/openair1/SIMULATION/LTE_PHY/dummy_functions.c
+++ b/openair1/SIMULATION/LTE_PHY/dummy_functions.c
@@ -47,8 +47,6 @@ SLDCH_t *ue_get_sldch(module_id_t module_idP, int CC_id,frame_t frameP, sub_fram
SLSCH_t *ue_get_slsch(module_id_t module_idP, int CC_id,frame_t frameP, sub_frame_t subframe) {return(NULL);}
-void multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP) {}
-
uint16_t
ue_process_rar(const module_id_t module_idP,
const int CC_id,
diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index d7f390f315..80e4643e14 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -826,6 +826,7 @@ int main(int argc, char **argv)
UE->frame_parms.nb_antennas_rx = n_rx;
UE->frame_parms.nb_antenna_ports_gNB = n_tx;
UE->max_ldpc_iterations = max_ldpc_iterations;
+ init_nr_ue_phy_cpu_stats(&UE->phy_cpu_stats);
if (run_initial_sync==1)
UE->is_synchronized = 0;
@@ -1232,36 +1233,10 @@ int main(int argc, char **argv)
printStatIndent2(&gNB->dlsch_resource_mapping_stats, "DLSCH Resource Mapping time");
printStatIndent2(&gNB->dlsch_precoding_stats,"DLSCH Layer Precoding time");
- printf("\nUE RX function statistics (per %d us slot)\n",1000>>*scc->ssbSubcarrierSpacing);
- /*
- printDistribution(&phy_proc_rx_tot, table_rx,"Total PHY proc rx");
- printStatIndent(&ue_front_end_tot,"Front end processing");
- printStatIndent(&dlsch_llr_tot,"rx_pdsch processing");
- printStatIndent2(&pdsch_procedures_tot,"pdsch processing");
- printStatIndent2(&dlsch_procedures_tot,"dlsch processing");
- printStatIndent2(&UE->crnti_procedures_stats,"C-RNTI processing");
- printStatIndent(&UE->ofdm_demod_stats,"ofdm demodulation");
- printStatIndent(&UE->dlsch_channel_estimation_stats,"DLSCH channel estimation time");
- printStatIndent(&UE->dlsch_freq_offset_estimation_stats,"DLSCH frequency offset estimation time");
- printStatIndent(&dlsch_decoding_tot, "DLSCH Decoding time ");
- printStatIndent(&UE->dlsch_unscrambling_stats,"DLSCH unscrambling time");
- printStatIndent(&UE->dlsch_rate_unmatching_stats,"DLSCH Rate Unmatching");
- printf("|__ DLSCH Turbo Decoding(%d bits), avg iterations: %.1f %.2f us (%d cycles, %d trials)\n",
- UE->dlsch[0][0]->harq_processes[0]->Cminus ?
- UE->dlsch[0][0]->harq_processes[0]->Kminus :
- UE->dlsch[0][0]->harq_processes[0]->Kplus,
- UE->dlsch_tc_intl1_stats.trials/(double)UE->dlsch_tc_init_stats.trials,
- (double)UE->dlsch_turbo_decoding_stats.diff/UE->dlsch_turbo_decoding_stats.trials*timeBase,
- (int)((double)UE->dlsch_turbo_decoding_stats.diff/UE->dlsch_turbo_decoding_stats.trials),
- UE->dlsch_turbo_decoding_stats.trials);
- printStatIndent2(&UE->dlsch_tc_init_stats,"init");
- printStatIndent2(&UE->dlsch_tc_alpha_stats,"alpha");
- printStatIndent2(&UE->dlsch_tc_beta_stats,"beta");
- printStatIndent2(&UE->dlsch_tc_gamma_stats,"gamma");
- printStatIndent2(&UE->dlsch_tc_ext_stats,"ext");
- printStatIndent2(&UE->dlsch_tc_intl1_stats,"turbo internal interleaver");
- printStatIndent2(&UE->dlsch_tc_intl2_stats,"intl2+HardDecode+CRC");
- */
+ printf("\nUE function statistics (per %d us slot)\n", 1000 >> *scc->ssbSubcarrierSpacing);
+ for (int i = RX_PDSCH_STATS; i <= DLSCH_PROCEDURES_STATS; i++) {
+ printStatIndent(&UE->phy_cpu_stats.cpu_time_stats[i], UE->phy_cpu_stats.cpu_time_stats[i].meas_name);
+ }
}
if (n_trials == 1) {
diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c
index 8d02ee9927..2d64de91e0 100644
--- a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c
+++ b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c
@@ -36,6 +36,8 @@ void nr_mac_rrc_msg3_ind(const module_id_t mod_id, int rnti, int gnb_id) {}
void nr_mac_rrc_ra_ind(const module_id_t mod_id, int frame, bool success) {}
+void nr_mac_rrc_inactivity_timer_ind(const module_id_t mod_id) {}
+
void rrc_data_ind(const protocol_ctxt_t *const ctxt_pP,
const rb_id_t Srb_id,
const sdu_size_t sdu_sizeP,
diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c
index 5291930c12..9dd9ef61a9 100644
--- a/openair1/SIMULATION/NR_PHY/pucchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pucchsim.c
@@ -539,7 +539,7 @@ int main(int argc, char **argv)
}
pucch_GroupHopping_t PUCCH_GroupHopping = pucch_tx_pdu.group_hop_flag + (pucch_tx_pdu.sequence_hop_flag<<1);
-
+ double tx_level_fp = 100.0;
for(SNR=snr0;SNR<=snr1;SNR+=1){
ack_nack_errors=0;
sr_errors=0;
@@ -578,8 +578,8 @@ int main(int argc, char **argv)
for (int aarx=0;aarx 0) printf("symb %d, re %d , aarx %d : txr %f, txi %f, chr %f, chi %f, nr %f, ni %f, rxr %f, rxi %f => %d,%d\n",
symb, re, aarx, txr,txi,
diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c
index 925202f4e6..bbcc5f0759 100644
--- a/openair1/SIMULATION/NR_PHY/ulsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulsim.c
@@ -950,10 +950,6 @@ int main(int argc, char *argv[])
reset_meas(&gNB->rx_pusch_symbol_processing_stats);
reset_meas(&gNB->ulsch_decoding_stats);
reset_meas(&gNB->ulsch_channel_estimation_stats);
- reset_meas(&UE->ulsch_ldpc_encoding_stats);
- reset_meas(&UE->ulsch_rate_matching_stats);
- reset_meas(&UE->ulsch_interleaving_stats);
- reset_meas(&UE->ulsch_encoding_stats);
reset_meas(&gNB->rx_srs_stats);
reset_meas(&gNB->generate_srs_stats);
reset_meas(&gNB->get_srs_signal_stats);
@@ -962,6 +958,7 @@ int main(int argc, char *argv[])
reset_meas(&gNB->srs_report_tlv_stats);
reset_meas(&gNB->srs_beam_report_stats);
reset_meas(&gNB->srs_iq_matrix_stats);
+ init_nr_ue_phy_cpu_stats(&UE->phy_cpu_stats);
uint32_t errors_scrambling[16] = {0};
int n_errors[16] = {0};
@@ -1575,11 +1572,9 @@ int main(int argc, char *argv[])
printStatIndent(&gNB->ulsch_decoding_stats,"ULSCH total decoding time");
printf("\nUE TX\n");
- printStatIndent(&UE->ulsch_encoding_stats,"ULSCH total encoding time");
- printStatIndent2(&UE->ulsch_segmentation_stats,"ULSCH segmentation time");
- printStatIndent2(&UE->ulsch_ldpc_encoding_stats,"ULSCH LDPC encoder time");
- printStatIndent2(&UE->ulsch_rate_matching_stats,"ULSCH rate-matching time");
- printStatIndent2(&UE->ulsch_interleaving_stats,"ULSCH interleaving time");
+ for (int i = PHY_PROC_TX; i <= ULSCH_ENCODING_STATS; i++) {
+ printStatIndent(&UE->phy_cpu_stats.cpu_time_stats[i], UE->phy_cpu_stats.cpu_time_stats[i].meas_name);
+ }
printStatIndent(&gNB->rx_srs_stats,"RX SRS time");
printStatIndent2(&gNB->generate_srs_stats,"Generate SRS sequence time");
printStatIndent2(&gNB->get_srs_signal_stats,"Get SRS signal time");
diff --git a/openair2/COMMON/mac_messages_def.h b/openair2/COMMON/mac_messages_def.h
index 661f219240..e3ef328017 100644
--- a/openair2/COMMON/mac_messages_def.h
+++ b/openair2/COMMON/mac_messages_def.h
@@ -50,6 +50,7 @@ MESSAGE_DEF(RRC_MAC_PCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacPcchDat
MESSAGE_DEF(NR_RRC_MAC_RA_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcMacRaInd, nr_rrc_mac_ra_ind)
MESSAGE_DEF(NR_RRC_MAC_MSG3_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcMacMsg3Ind, nr_rrc_mac_msg3_ind)
+MESSAGE_DEF(NR_RRC_MAC_INAC_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcMacInacInd, nr_rrc_mac_inac_ind)
/* RRC configures DRX context (MAC timers) of a UE */
MESSAGE_DEF(RRC_MAC_DRX_CONFIG_REQ, MESSAGE_PRIORITY_MED, rrc_mac_drx_config_req_t, rrc_mac_drx_config_req)
diff --git a/openair2/COMMON/mac_messages_types.h b/openair2/COMMON/mac_messages_types.h
index effdaacff3..bc9e8f6c8a 100644
--- a/openair2/COMMON/mac_messages_types.h
+++ b/openair2/COMMON/mac_messages_types.h
@@ -57,6 +57,7 @@
#define NR_RRC_MAC_RA_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_mac_ra_ind
#define NR_RRC_MAC_MSG3_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_mac_msg3_ind
+#define NR_RRC_MAC_INAC_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_mac_inac_ind
#define RRC_MAC_DRX_CONFIG_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_drx_config_req
@@ -80,6 +81,10 @@ typedef struct NRRrcMacMsg3Ind_s {
int gnb_id;
} NRRrcMacMsg3Ind;
+typedef struct NRRrcMacInacInd_s {
+ bool inactivity_timer_expired; // not to leave the struct empty
+} NRRrcMacInacInd;
+
typedef struct RrcMacInSyncInd_s {
uint32_t frame;
uint8_t sub_frame;
diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c
index 224a98ebde..8ccca9f478 100644
--- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c
+++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c
@@ -279,14 +279,13 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id
uint8_t *mb = malloc16(ie->value.choice.RRCContainer.size);
memcpy(mb, ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size);
LOG_D(F1AP, "Calling pdcp_data_ind for UE RNTI %lx srb_id %lu with size %ld (DCCH) \n", ctxt.rntiMaybeUEid, srb_id, ie->value.choice.RRCContainer.size);
- //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++)
- // printf("%02x ", mb->data[i]);
- //printf("\n");
- pdcp_data_ind (&ctxt,
- 1, // srb_flag
- 0, // embms_flag
- srb_id,
- ie->value.choice.RRCContainer.size,
- mb, NULL, NULL);
+ nr_pdcp_data_ind(&ctxt,
+ 1, // srb_flag
+ 0, // embms_flag
+ srb_id,
+ ie->value.choice.RRCContainer.size,
+ mb,
+ NULL,
+ NULL);
return 0;
}
diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c
index e28f7dce93..1baaba8221 100644
--- a/openair2/LAYER2/NR_MAC_UE/config_ue.c
+++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c
@@ -1814,6 +1814,64 @@ static uint32_t nr_get_sf_periodicBSRTimer(long periodicBSR)
return timer;
}
+static uint32_t get_data_inactivity_timer(long setup)
+{
+ uint32_t timer_s = 0;
+ switch (setup) {
+ case NR_DataInactivityTimer_s1 :
+ timer_s = 1;
+ break;
+ case NR_DataInactivityTimer_s2 :
+ timer_s = 2;
+ break;
+ case NR_DataInactivityTimer_s3 :
+ timer_s = 3;
+ break;
+ case NR_DataInactivityTimer_s5 :
+ timer_s = 5;
+ break;
+ case NR_DataInactivityTimer_s7 :
+ timer_s = 7;
+ break;
+ case NR_DataInactivityTimer_s10 :
+ timer_s = 10;
+ break;
+ case NR_DataInactivityTimer_s15 :
+ timer_s = 15;
+ break;
+ case NR_DataInactivityTimer_s20 :
+ timer_s = 20;
+ break;
+ case NR_DataInactivityTimer_s40 :
+ timer_s = 40;
+ break;
+ case NR_DataInactivityTimer_s50 :
+ timer_s = 50;
+ break;
+ case NR_DataInactivityTimer_s60 :
+ timer_s = 60;
+ break;
+ case NR_DataInactivityTimer_s80 :
+ timer_s = 80;
+ break;
+ case NR_DataInactivityTimer_s100 :
+ timer_s = 100;
+ break;
+ case NR_DataInactivityTimer_s120 :
+ timer_s = 120;
+ break;
+ case NR_DataInactivityTimer_s150 :
+ timer_s = 150;
+ break;
+ case NR_DataInactivityTimer_s180 :
+ timer_s = 180;
+ break;
+ default :
+ AssertFatal(false, "Invalid data inactivity timer\n");
+ }
+ return timer_s;
+}
+
static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroupConfig_t *mcg)
{
NR_UE_SCHEDULING_INFO *si = &mac->scheduling_info;
@@ -1879,7 +1937,34 @@ static void configure_maccellgroup(NR_UE_MAC_INST_t *mac, const NR_MAC_CellGroup
}
}
if (mcg->phr_Config) {
- // TODO configuration when PHR is implemented
+ nr_phr_info_t *phr_info = &si->phr_info;
+ phr_info->is_configured = mcg->phr_Config->choice.setup != NULL;
+ if (phr_info->is_configured) {
+ int slots_per_subframe = nr_slots_per_frame[scs] / 10;
+ struct NR_PHR_Config *config = mcg->phr_Config->choice.setup;
+ AssertFatal(config->multiplePHR == 0, "mulitplePHR not supported");
+ phr_info->PathlossChange_db = config->phr_Tx_PowerFactorChange;
+ const int periodic_timer_sf_enum_to_sf[] = {10, 20, 50, 100, 200, 500, 1000, UINT_MAX};
+ int periodic_timer_sf = periodic_timer_sf_enum_to_sf[config->phr_PeriodicTimer];
+ nr_timer_setup(&phr_info->periodicPHR_Timer, periodic_timer_sf * slots_per_subframe, 1);
+ const int prohibit_timer_sf_enum_to_sf[] = {0, 10, 20, 50, 100, 200, 500, 1000};
+ int prohibit_timer_sf = prohibit_timer_sf_enum_to_sf[config->phr_ProhibitTimer];
+ nr_timer_setup(&phr_info->prohibitPHR_Timer, prohibit_timer_sf * slots_per_subframe, 1);
+ phr_info->phr_reporting = (1 << phr_cause_phr_config);
+ }
+ }
+
+ if (mcg->ext1 && mcg->ext1->dataInactivityTimer) {
+ struct NR_SetupRelease_DataInactivityTimer *setup_release = mcg->ext1->dataInactivityTimer;
+ if (setup_release->present == NR_SetupRelease_DataInactivityTimer_PR_release)
+ free(mac->data_inactivity_timer);
+ if (setup_release->present == NR_SetupRelease_DataInactivityTimer_PR_setup) {
+ if (!mac->data_inactivity_timer)
+ mac->data_inactivity_timer = calloc(1, sizeof(*mac->data_inactivity_timer));
+ uint32_t timer_s = get_data_inactivity_timer(setup_release->choice.setup); // timer in seconds
+ int scs = mac->current_DL_BWP->scs;
+ nr_timer_setup(mac->data_inactivity_timer, (timer_s * 1000) << scs, 1); // 1 slot update rate
+ }
}
}
diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h
index 781192fbc2..c4aec8aa20 100644
--- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h
+++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h
@@ -172,6 +172,12 @@
UE_STATE(UE_CONNECTED) \
UE_STATE(UE_DETACHING)
+typedef enum {
+ phr_cause_prohibit_timer = 0,
+ phr_cause_periodic_timer,
+ phr_cause_phr_config,
+} NR_UE_PHR_Reporting_cause_t;
+
/*!\brief UE layer 2 status */
typedef enum {
#define UE_STATE(state) state,
@@ -222,6 +228,24 @@ typedef struct {
uint32_t maxTransmissions;
} nr_sr_info_t;
+typedef struct {
+ bool is_configured;
+ ///timer before triggering a periodic PHR
+ NR_timer_t periodicPHR_Timer;
+ ///timer before triggering a prohibit PHR
+ NR_timer_t prohibitPHR_Timer;
+ ///DL Pathloss change value
+ uint16_t PathlossLastValue;
+ ///number of subframe before triggering a periodic PHR
+ int16_t periodicPHR_SF;
+ ///number of subframe before triggering a prohibit PHR
+ int16_t prohibitPHR_SF;
+ ///DL Pathloss Change in db
+ uint16_t PathlossChange_db;
+ int phr_reporting;
+ bool was_mac_reset;
+} nr_phr_info_t;
+
// LTE structure, might need to be adapted for NR
typedef struct {
// lcs scheduling info
@@ -240,18 +264,8 @@ typedef struct {
NR_timer_t retxBSR_Timer;
/// periodicBSR-Timer
NR_timer_t periodicBSR_Timer;
- ///timer before triggering a periodic PHR
- uint16_t periodicPHR_Timer;
- ///timer before triggering a prohibit PHR
- uint16_t prohibitPHR_Timer;
- ///DL Pathloss change value
- uint16_t PathlossChange;
- ///number of subframe before triggering a periodic PHR
- int16_t periodicPHR_SF;
- ///number of subframe before triggering a prohibit PHR
- int16_t prohibitPHR_SF;
- ///DL Pathloss Change in db
- uint16_t PathlossChange_db;
+
+ nr_phr_info_t phr_info;
} NR_UE_SCHEDULING_INFO;
typedef enum {
@@ -557,11 +571,8 @@ typedef struct NR_UE_MAC_INST_s {
// order lc info
A_SEQUENCE_OF(nr_lcordered_info_t) lc_ordered_list;
-
NR_UE_SCHEDULING_INFO scheduling_info;
-
- /// PHR
- uint8_t PHR_reporting_active;
+ NR_timer_t *data_inactivity_timer;
int dmrs_TypeA_Position;
int p_Max;
diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h
index 396294fc97..9a0bc8e911 100644
--- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h
+++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h
@@ -173,7 +173,7 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac,nr_downlink_indication_t *dl_in
int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
NR_UE_MAC_INST_t *mac,
- uint8_t power_headroom, // todo: NR_POWER_HEADROOM_CMD *power_headroom,
+ NR_SINGLE_ENTRY_PHR_MAC_CE *power_headroom,
uint16_t *crnti,
NR_BSR_SHORT *truncated_bsr,
NR_BSR_SHORT *short_bsr,
@@ -193,7 +193,9 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
sub_frame_t subframe,
uint8_t gNB_index,
uint8_t *ulsch_buffer,
- uint32_t buflen);
+ uint32_t buflen,
+ int16_t tx_power,
+ int16_t P_CMAX);
void set_harq_status(NR_UE_MAC_INST_t *mac,
uint8_t pucch_id,
diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c
index b6a289cc45..d2034893bc 100644
--- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c
+++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c
@@ -118,8 +118,10 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac)
nr_timer_setup(&mac->scheduling_info.retxBSR_Timer, 80 * subframes_per_slot, 1); // 1 slot update rate
nr_timer_setup(&mac->scheduling_info.periodicBSR_Timer, 10 * subframes_per_slot, 1); // 1 slot update rate
- mac->scheduling_info.periodicPHR_Timer = NR_PHR_Config__phr_PeriodicTimer_sf10;
- mac->scheduling_info.prohibitPHR_Timer = NR_PHR_Config__phr_ProhibitTimer_sf10;
+ mac->scheduling_info.phr_info.is_configured = true;
+ mac->scheduling_info.phr_info.PathlossChange_db = 1;
+ nr_timer_setup(&mac->scheduling_info.phr_info.periodicPHR_Timer, 10 * subframes_per_slot, 1);
+ nr_timer_setup(&mac->scheduling_info.phr_info.prohibitPHR_Timer, 10 * subframes_per_slot, 1);
}
void nr_ue_send_synch_request(NR_UE_MAC_INST_t *mac, module_id_t module_id, int cc_id, const fapi_nr_synch_request_t *sync_req)
@@ -196,6 +198,8 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
nr_mac->scheduling_info.lc_sched_info[i].Bj = 0;
nr_timer_stop(&nr_mac->scheduling_info.lc_sched_info[i].Bj_timer);
}
+ if (nr_mac->data_inactivity_timer)
+ nr_timer_stop(nr_mac->data_inactivity_timer);
nr_timer_stop(&nr_mac->ra.contention_resolution_timer);
nr_timer_stop(&nr_mac->scheduling_info.sr_DelayTimer);
nr_timer_stop(&nr_mac->scheduling_info.retxBSR_Timer);
@@ -229,7 +233,8 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
nr_mac->scheduling_info.BSR_reporting_active = NR_BSR_TRIGGER_NONE;
// cancel any triggered Power Headroom Reporting procedure
- // TODO PHR not implemented yet
+ nr_mac->scheduling_info.phr_info.phr_reporting = 0;
+ nr_mac->scheduling_info.phr_info.was_mac_reset = true;
// flush the soft buffers for all DL HARQ processes
for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++)
@@ -246,8 +251,7 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
// TODO beam failure procedure not implemented
}
-void release_mac_configuration(NR_UE_MAC_INST_t *mac,
- NR_UE_MAC_reset_cause_t cause)
+void release_mac_configuration(NR_UE_MAC_INST_t *mac, NR_UE_MAC_reset_cause_t cause)
{
NR_UE_ServingCell_Info_t *sc = &mac->sc_info;
// if cause is Re-establishment, release spCellConfig only
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
index 9264e4ad16..c26e8a5629 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
@@ -31,7 +31,7 @@
*/
/* RRC */
-#include "RRC/NR_UE/rrc_proto.h"
+#include "RRC/NR_UE/L2_interface_ue.h"
/* MAC */
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
index c7903a9666..36c04447f1 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
@@ -38,7 +38,7 @@
#include "executables/nr-softmodem.h"
/* RRC*/
-#include "RRC/NR_UE/rrc_proto.h"
+#include "RRC/NR_UE/L2_interface_ue.h"
/* MAC */
#include "NR_MAC_COMMON/nr_mac.h"
@@ -2957,19 +2957,22 @@ void nr_ue_send_sdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info, in
// Processing MAC PDU
// it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs
- switch (dl_info->rx_ind->rx_indication_body[pdu_id].pdu_type){
- case FAPI_NR_RX_PDU_TYPE_DLSCH:
- nr_ue_process_mac_pdu(mac, dl_info, pdu_id);
- break;
- case FAPI_NR_RX_PDU_TYPE_RAR:
+ switch (dl_info->rx_ind->rx_indication_body[pdu_id].pdu_type) {
+ case FAPI_NR_RX_PDU_TYPE_DLSCH :
+ // start or restart dataInactivityTimer if any MAC entity receives a MAC SDU for DTCH logical channel,
+ // DCCH logical channel, or CCCH logical channel
+ if (mac->data_inactivity_timer)
+ nr_timer_start(mac->data_inactivity_timer);
+ nr_ue_process_mac_pdu(mac, dl_info, pdu_id);
+ break;
+ case FAPI_NR_RX_PDU_TYPE_RAR :
nr_ue_process_rar(mac, dl_info, pdu_id);
- break;
+ break;
default:
- break;
+ AssertFatal(false, "Invalid PDU type\n");
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_OUT);
-
}
// #define EXTRACT_DCI_ITEM(val,size) val= readBits(dci_pdu, &pos, size);
@@ -3668,30 +3671,28 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i
*/
int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
NR_UE_MAC_INST_t *mac,
- uint8_t power_headroom, // todo: NR_POWER_HEADROOM_CMD *power_headroom,
+ NR_SINGLE_ENTRY_PHR_MAC_CE *power_headroom,
uint16_t *crnti,
NR_BSR_SHORT *truncated_bsr,
NR_BSR_SHORT *short_bsr,
NR_BSR_LONG *long_bsr)
{
int mac_ce_len = 0;
- uint8_t mac_ce_size = 0;
uint8_t *pdu = mac_ce;
if (power_headroom) {
-
// MAC CE fixed subheader
((NR_MAC_SUBHEADER_FIXED *) mac_ce)->R = 0;
((NR_MAC_SUBHEADER_FIXED *) mac_ce)->LCID = UL_SCH_LCID_SINGLE_ENTRY_PHR;
mac_ce++;
// PHR MAC CE (1 octet)
- ((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_ce)->PH = power_headroom;
+ ((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_ce)->PH = power_headroom->PH;
((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_ce)->R1 = 0;
- ((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_ce)->PCMAX = 0; // todo
+ ((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_ce)->PCMAX = power_headroom->PCMAX;
((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_ce)->R2 = 0;
// update pointer and length
- mac_ce_size = sizeof(NR_SINGLE_ENTRY_PHR_MAC_CE);
+ int mac_ce_size = sizeof(NR_SINGLE_ENTRY_PHR_MAC_CE);
mac_ce += mac_ce_size;
mac_ce_len += mac_ce_size + sizeof(NR_MAC_SUBHEADER_FIXED);
LOG_D(NR_MAC, "[UE] Generating ULSCH PDU : power_headroom pdu %p mac_ce %p b\n",
@@ -3710,7 +3711,7 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
memcpy(mac_ce, crnti, sizeof(*crnti));
// update pointer and length
- mac_ce_size = sizeof(uint16_t);
+ int mac_ce_size = sizeof(uint16_t);
mac_ce += mac_ce_size;
mac_ce_len += mac_ce_size + sizeof(NR_MAC_SUBHEADER_FIXED);
}
@@ -3727,7 +3728,7 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
((NR_BSR_SHORT_TRUNCATED *) mac_ce)-> LcgID = truncated_bsr->LcgID;;
// update pointer and length
- mac_ce_size = sizeof(NR_BSR_SHORT_TRUNCATED);
+ int mac_ce_size = sizeof(NR_BSR_SHORT_TRUNCATED);
mac_ce += mac_ce_size;
mac_ce_len += mac_ce_size + sizeof(NR_MAC_SUBHEADER_FIXED);
LOG_D(NR_MAC, "[UE] Generating ULSCH PDU : truncated_bsr Buffer_size %d LcgID %d pdu %p mac_ce %p\n",
@@ -3745,7 +3746,7 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
((NR_BSR_SHORT *) mac_ce)->LcgID = short_bsr->LcgID;
// update pointer and length
- mac_ce_size = sizeof(NR_BSR_SHORT);
+ int mac_ce_size = sizeof(NR_BSR_SHORT);
mac_ce += mac_ce_size;
mac_ce_len += mac_ce_size + sizeof(NR_MAC_SUBHEADER_FIXED);
LOG_D(NR_MAC, "[UE] Generating ULSCH PDU : short_bsr Buffer_size %d LcgID %d pdu %p mac_ce %p\n",
@@ -3812,7 +3813,7 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
((NR_BSR_LONG *) mac_ce)->LcgID7 = 1;
*Buffer_size_ptr++ = long_bsr->Buffer_size7;
}
- ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_subheader_ptr)->L = mac_ce_size = (uint8_t*) Buffer_size_ptr - (uint8_t*) mac_ce;
+ int mac_ce_size = ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_subheader_ptr)->L = (uint8_t*) Buffer_size_ptr - (uint8_t*) mac_ce;
LOG_D(NR_MAC, "[UE] Generating ULSCH PDU : long_bsr size %d Lcgbit 0x%02x Buffer_size %d %d %d %d %d %d %d %d\n", mac_ce_size, *((uint8_t*) mac_ce),
((NR_BSR_LONG *) mac_ce)->Buffer_size0, ((NR_BSR_LONG *) mac_ce)->Buffer_size1, ((NR_BSR_LONG *) mac_ce)->Buffer_size2, ((NR_BSR_LONG *) mac_ce)->Buffer_size3,
((NR_BSR_LONG *) mac_ce)->Buffer_size4, ((NR_BSR_LONG *) mac_ce)->Buffer_size5, ((NR_BSR_LONG *) mac_ce)->Buffer_size6, ((NR_BSR_LONG *) mac_ce)->Buffer_size7);
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
index 315f1ef522..c1d7238d41 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
@@ -54,6 +54,7 @@
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/RLC/rlc.h"
+#include "RRC/NR_UE/L2_interface_ue.h"
//#define SRS_DEBUG
#define verifyMutex(a) \
@@ -64,6 +65,12 @@
static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, sub_frame_t slotP);
static void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment);
+static void nr_ue_fill_phr(NR_UE_MAC_INST_t *mac,
+ NR_SINGLE_ENTRY_PHR_MAC_CE *phr,
+ float P_CMAX,
+ float tx_power,
+ frame_t frameP,
+ sub_frame_t subframe);
void clear_ul_config_request(NR_UE_MAC_INST_t *mac, int scs)
{
@@ -81,7 +88,10 @@ fapi_nr_ul_config_request_pdu_t *lockGet_ul_config(NR_UE_MAC_INST_t *mac, frame_
NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->tdd_UL_DL_ConfigurationCommon;
// Check if requested on the right slot
- AssertFatal(is_nr_UL_slot(tdd_config, slot_tx, mac->frame_type) != 0, "UL config_request called at wrong slot %d\n", slot_tx);
+ if (!is_nr_UL_slot(tdd_config, slot_tx, mac->frame_type)) {
+ LOG_E(NR_MAC, "Lock of UL config for PDU type %d called for slot %d which is not UL\n", pdu_type, slot_tx);
+ return NULL;
+ }
AssertFatal(mac->ul_config_request != NULL, "mac->ul_config_request not initialized, logic bug\n");
fapi_nr_ul_config_request_t *ul_config = mac->ul_config_request + slot_tx;
@@ -147,6 +157,11 @@ static void trigger_regular_bsr(NR_UE_MAC_INST_t *mac, NR_LogicalChannelIdentity
void update_mac_timers(NR_UE_MAC_INST_t *mac)
{
+ if (mac->data_inactivity_timer) {
+ bool inactivity_timer_expired = nr_timer_tick(mac->data_inactivity_timer);
+ if (inactivity_timer_expired)
+ nr_mac_rrc_inactivity_timer_ind(mac->ue_id);
+ }
nr_timer_tick(&mac->ra.contention_resolution_timer);
for (int j = 0; j < NR_MAX_SR_ID; j++)
nr_timer_tick(&mac->scheduling_info.sr_info[j].prohibitTimer);
@@ -176,6 +191,21 @@ void update_mac_timers(NR_UE_MAC_INST_t *mac)
AssertFatal(!nr_timer_tick(&mac->scheduling_info.lc_sched_info[i].Bj_timer),
"Bj timer for LCID %d expired! That should never happen\n",
i);
+
+ nr_phr_info_t *phr_info = &mac->scheduling_info.phr_info;
+ if (phr_info->is_configured) {
+ bool prohibit_expired = nr_timer_tick(&phr_info->prohibitPHR_Timer);
+ if (prohibit_expired) {
+ int16_t pathloss = compute_nr_SSB_PL(mac, mac->ssb_measurements.ssb_rsrp_dBm);
+ if (abs(pathloss - phr_info->PathlossLastValue) > phr_info->PathlossChange_db) {
+ phr_info->phr_reporting |= (1 << phr_cause_prohibit_timer);
+ }
+ }
+ bool periodic_expired = nr_timer_tick(&phr_info->periodicPHR_Timer);
+ if (periodic_expired) {
+ phr_info->phr_reporting |= (1 << phr_cause_periodic_timer);
+ }
+ }
}
void remove_ul_config_last_item(fapi_nr_ul_config_request_pdu_t *pdu)
@@ -220,7 +250,10 @@ fapi_nr_ul_config_request_pdu_t *lockGet_ul_iterator(NR_UE_MAC_INST_t *mac, fram
{
NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->tdd_UL_DL_ConfigurationCommon;
//Check if requested on the right slot
- AssertFatal(is_nr_UL_slot(tdd_config, slot_tx, mac->frame_type) != 0, "UL config_request called at wrong slot %d\n", slot_tx);
+ if (!is_nr_UL_slot(tdd_config, slot_tx, mac->frame_type)) {
+ LOG_E(NR_MAC, "UL lock iterator called for slot %d which is not UL\n", slot_tx);
+ return NULL;
+ }
AssertFatal(mac->ul_config_request != NULL, "mac->ul_config_request not initialized, logic bug\n");
return fapiLockIterator(mac->ul_config_request + slot_tx, frame_tx, slot_tx);
}
@@ -942,6 +975,16 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
return -1;
}
+ // 38.321 5.4.6
+ // if it is the first UL resource allocated for a new transmission since the last MAC reset:
+ // 2> start phr-PeriodicTimer;
+ if (mac->scheduling_info.phr_info.is_configured) {
+ if (mac->scheduling_info.phr_info.was_mac_reset && pusch_config_pdu->pusch_data.new_data_indicator) {
+ mac->scheduling_info.phr_info.was_mac_reset = false;
+ nr_timer_start(&mac->scheduling_info.phr_info.periodicPHR_Timer);
+ }
+ }
+
return 0;
}
@@ -1185,7 +1228,6 @@ static bool nr_ue_periodic_srs_scheduling(NR_UE_MAC_INST_t *mac, frame_t frame,
// Performs :
// 1. TODO: Call RRC for link status return to PHY
// 2. TODO: Perform SR/BSR procedures for scheduling feedback
-// 3. TODO: Perform PHR procedures
void nr_ue_dl_scheduler(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info)
{
frame_t rx_frame = dl_info->frame;
@@ -1422,10 +1464,28 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
if (ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator
&& (mac->state == UE_CONNECTED || (ra->ra_state == nrRA_WAIT_RAR && ra->cfra))) {
// Getting IP traffic to be transmitted
- nr_ue_get_sdu(mac, cc_id, frame_tx, slot_tx, gNB_index, ulsch_input_buffer, TBS_bytes);
- ulcfg_pdu->pusch_config_pdu.tx_request_body.fapiTxPdu = ulsch_input_buffer;
- ulcfg_pdu->pusch_config_pdu.tx_request_body.pdu_length = TBS_bytes;
- number_of_pdus++;
+ int tx_power = ulcfg_pdu->pusch_config_pdu.tx_power;
+ int P_CMAX = nr_get_Pcmax(mac->p_Max,
+ mac->nr_band,
+ mac->frame_type,
+ mac->frequency_range,
+ mac->current_UL_BWP->channel_bandwidth,
+ ulcfg_pdu->pusch_config_pdu.qam_mod_order,
+ false,
+ mac->current_UL_BWP->scs,
+ mac->current_UL_BWP->BWPSize,
+ ulcfg_pdu->pusch_config_pdu.transform_precoding,
+ ulcfg_pdu->pusch_config_pdu.rb_size,
+ ulcfg_pdu->pusch_config_pdu.rb_start);
+
+ nr_ue_get_sdu(mac, cc_id, frame_tx, slot_tx, gNB_index, ulsch_input_buffer, TBS_bytes, tx_power, P_CMAX);
+ ulcfg_pdu->pusch_config_pdu.tx_request_body.fapiTxPdu = ulsch_input_buffer;
+ ulcfg_pdu->pusch_config_pdu.tx_request_body.pdu_length = TBS_bytes;
+ number_of_pdus++;
+ // start or restart dataInactivityTimer if any MAC entity transmits a MAC SDU for DTCH logical channel,
+ // or DCCH logical channel
+ if (mac->data_inactivity_timer)
+ nr_timer_start(mac->data_inactivity_timer);
}
}
@@ -1612,7 +1672,6 @@ static void build_ro_list(NR_UE_MAC_INST_t *mac)
uint8_t prach_conf_start_symbol; // Starting symbol of the PRACH occasions in the PRACH slot
uint8_t N_t_slot; // Number of PRACH occasions in a 14-symbols PRACH slot
uint8_t N_dur; // Duration of a PRACH occasion (nb of symbols)
- uint8_t frame; // Maximum is NB_FRAMES_IN_MAX_ASSOCIATION_PATTERN_PERIOD
uint16_t format = 0xffff;
uint8_t format2 = 0xff;
int nb_fdm;
@@ -1723,11 +1782,11 @@ static void build_ro_list(NR_UE_MAC_INST_t *mac)
// For every frames in a PRACH configuration period
// ------------------------------------------------
for (int frame_idx = 0; frame_idx < nb_of_frames_per_prach_conf_period; frame_idx++) {
- frame = (period_idx * nb_of_frames_per_prach_conf_period) + frame_idx;
+ int frame_rach = (period_idx * nb_of_frames_per_prach_conf_period) + frame_idx;
- LOG_D(NR_MAC,"PRACH Conf Period Frame Idx %d - Frame %d\n", frame_idx, frame);
+ LOG_D(NR_MAC,"PRACH Conf Period Frame Idx %d - Frame %d\n", frame_idx, frame_rach);
// Is it a valid frame for this PRACH configuration index? (n_sfn mod x = y)
- if ((frame%x)==y || (frame%x)==y2) {
+ if ((frame_rach % x) == y || (frame_rach % x) == y2) {
// For every slot in a frame
// -------------------------
@@ -1757,13 +1816,19 @@ static void build_ro_list(NR_UE_MAC_INST_t *mac)
slot_map->prach_occasion[n_prach_occ_in_time * nb_fdm + n_prach_occ_in_freq] =
(prach_occasion_info_t){.start_symbol = start_symbol,
.fdm = n_prach_occ_in_freq,
- .frame = frame,
+ .frame = frame_idx,
.slot = slot,
.format = format};
prach_assoc_pattern->prach_conf_period_list[period_idx].nb_of_prach_occasion++;
- LOG_D(NR_MAC,"Adding a PRACH occasion: frame %u, slot-symbol %d-%d, occ_in_time-occ_in-freq %d-%d, nb ROs in conf period %d, for this slot: RO# in time %d, RO# in freq %d\n",
- frame, slot, start_symbol, n_prach_occ_in_time, n_prach_occ_in_freq, prach_conf_period_list->nb_of_prach_occasion,
+ LOG_D(NR_MAC,
+ "Adding a PRACH occasion: frame %u, slot-symbol %d-%d, occ_in_time-occ_in-freq %d-%d, nb ROs in conf period %d, for this slot: RO# in time %d, RO# in freq %d\n",
+ frame_rach,
+ slot,
+ start_symbol,
+ n_prach_occ_in_time,
+ n_prach_occ_in_freq,
+ prach_conf_period_list->nb_of_prach_occasion,
slot_map->nb_of_prach_occasion_in_time,
slot_map->nb_of_prach_occasion_in_freq);
} // For every freq in the slot
@@ -1886,6 +1951,7 @@ static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac)
// Map all the association periods within the association pattern period
LOG_D(NR_MAC,"Proceed to the SSB to RO mapping\n");
// Check if we need to map multiple SSBs per RO or multiple ROs per SSB
+
if (multiple_ssb_per_ro) {
const prach_association_period_t *end =
prach_assoc_pattern->prach_association_period_list + prach_assoc_pattern->nb_of_assoc_period;
@@ -1948,13 +2014,17 @@ static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac)
}
}
} else {
+ int frame = 0;
+ int slot = 0;
+ int ro_in_time = 0;
+ int ro_in_freq = 0;
prach_association_period_t *end = prach_assoc_pattern->prach_association_period_list + prach_assoc_pattern->nb_of_assoc_period;
for (prach_association_period_t *prach_period = prach_assoc_pattern->prach_association_period_list; prach_period < end;
prach_period++) {
// Go through the list of transmitted SSBs
for (int idx = 0; idx < ssb_list->nb_tx_ssb; idx++) {
ssb_info_t *tx_ssb = ssb_list->tx_ssb + idx;
- uint8_t nb_mapped_ro_in_association_period=0; // Reset the nb of mapped ROs for the new SSB index
+ uint8_t nb_mapped_ro_in_association_period = 0; // Reset the nb of mapped ROs for the new SSB index
bool done = false;
// Map all the required ROs to this SSB
// Go through the list of PRACH config periods within this association period
@@ -1962,11 +2032,11 @@ static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac)
// Build the association period with its association PRACH Configuration indexes
prach_period->prach_conf_period_list[i] = &prach_assoc_pattern->prach_conf_period_list[prach_configuration_period_idx];
prach_conf_period_t *prach_conf = prach_period->prach_conf_period_list[i];
- for (int frame = 0; frame < prach_conf->nb_of_frame && !done; frame++) {
- for (int slot = 0; slot < prach_conf->nb_of_slot && !done; slot++) {
+ for (; frame < prach_conf->nb_of_frame; frame++) {
+ for (; slot < prach_conf->nb_of_slot; slot++) {
prach_occasion_slot_t *slot_map = &prach_conf->prach_occasion_slot_map[frame][slot];
- for (int ro_in_time = 0; ro_in_time < slot_map->nb_of_prach_occasion_in_time && !done; ro_in_time++) {
- for (int ro_in_freq = 0; ro_in_freq < slot_map->nb_of_prach_occasion_in_freq && !done; ro_in_freq++) {
+ for (; ro_in_time < slot_map->nb_of_prach_occasion_in_time; ro_in_time++) {
+ for (; ro_in_freq < slot_map->nb_of_prach_occasion_in_freq; ro_in_freq++) {
prach_occasion_info_t *ro_p =
slot_map->prach_occasion + ro_in_time * slot_map->nb_of_prach_occasion_in_freq + ro_in_freq;
int ssb_idx = get_ssb_idx_from_list(ssb_list, idx);
@@ -1978,14 +2048,15 @@ static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac)
tx_ssb->mapped_ro[tx_ssb->nb_mapped_ro] = ro_p;
tx_ssb->nb_mapped_ro++;
nb_mapped_ro_in_association_period++;
- done = nb_mapped_ro_in_association_period == ssb_rach_ratio;
LOG_D(NR_MAC,
- "Mapped ssb_idx %u to RO slot-symbol %u-%u, %u-%u-%u/%u\n"
+ "Mapped ssb_idx %u to RO slot-symbol %u-%u-%u, %u-%u-%u-%u/%u\n"
"Nb mapped ROs for this ssb idx: in the association period only %u / total %u\n",
ssb_idx,
+ ro_p->frame,
ro_p->slot,
ro_p->start_symbol,
+ frame,
slot,
ro_in_time,
ro_in_freq,
@@ -1997,10 +2068,30 @@ static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac)
// WIP: Assuming that ssb_rach_ratio equals the maximum nb of times a given ssb_idx is mapped within an
// association period:
// this is true if no PRACH occasions are conflicting with SSBs nor TDD_UL_DL_ConfigurationCommon schedule
+ if (nb_mapped_ro_in_association_period == ssb_rach_ratio) {
+ ro_in_freq++;
+ break;
+ }
}
+ if (nb_mapped_ro_in_association_period == ssb_rach_ratio)
+ break;
+ else
+ ro_in_freq = 0;
}
+ if (nb_mapped_ro_in_association_period == ssb_rach_ratio)
+ break;
+ else
+ ro_in_time = 0;
}
+ if (nb_mapped_ro_in_association_period == ssb_rach_ratio)
+ break;
+ else
+ slot = 0;
}
+ if (nb_mapped_ro_in_association_period == ssb_rach_ratio)
+ break;
+ else
+ frame = 0;
}
}
}
@@ -2051,8 +2142,8 @@ static int get_nr_prach_info_from_ssb_index(prach_association_pattern_t *prach_a
// First count the number of times the SSB index is found in that RO
uint8_t nb_mapped_ssb = 0;
- for (int ro_in_time=0; ro_in_time < prach_occasion_slot_p->nb_of_prach_occasion_in_time; ro_in_time++) {
- for (int ro_in_freq=0; ro_in_freq < prach_occasion_slot_p->nb_of_prach_occasion_in_freq; ro_in_freq++) {
+ for (int ro_in_time = 0; ro_in_time < prach_occasion_slot_p->nb_of_prach_occasion_in_time; ro_in_time++) {
+ for (int ro_in_freq = 0; ro_in_freq < prach_occasion_slot_p->nb_of_prach_occasion_in_freq; ro_in_freq++) {
prach_occasion_info_t *ro_p =
prach_occasion_slot_p->prach_occasion + ro_in_time * prach_occasion_slot_p->nb_of_prach_occasion_in_freq + ro_in_freq;
for (uint8_t ssb_nb = 0; ssb_nb < ro_p->nb_mapped_ssb; ssb_nb++) {
@@ -2735,6 +2826,7 @@ typedef struct {
NR_BSR_SHORT *bsr_s;
NR_BSR_LONG *bsr_l;
NR_BSR_SHORT *bsr_t;
+ NR_SINGLE_ENTRY_PHR_MAC_CE* phr;
//NR_POWER_HEADROOM_CMD *phr_pr;
int tot_mac_ce_len;
uint8_t total_mac_pdu_header_len;
@@ -2758,12 +2850,13 @@ static int nr_ue_get_sdu_mac_ce_pre(NR_UE_MAC_INST_t *mac,
uint8_t gNB_index,
uint8_t *ulsch_buffer,
uint32_t buflen,
+ int16_t tx_power,
+ int16_t P_CMAX,
NR_UE_MAC_CE_INFO *mac_ce_p)
{
int num_lcg_id_with_data = 0;
// Preparing the MAC CEs sub-PDUs and get the total size
mac_ce_p->bsr_header_len = 0;
- mac_ce_p->phr_header_len = 0; //sizeof(SCH_SUBHEADER_FIXED);
int lcg_id = 0;
while (lcg_id != NR_INVALID_LCGID) {
if (mac->scheduling_info.lcg_sched_info[lcg_id].BSR_bytes) {
@@ -2794,8 +2887,23 @@ static int nr_ue_get_sdu_mac_ce_pre(NR_UE_MAC_INST_t *mac,
}
}
}
-
mac_ce_p->bsr_len = mac_ce_p->bsr_ce_len + mac_ce_p->bsr_header_len;
+
+
+ nr_phr_info_t *phr_info = &mac->scheduling_info.phr_info;
+ mac_ce_p->phr_header_len = 0;
+ mac_ce_p->phr_ce_len = 0;
+ if (phr_info->is_configured && phr_info->phr_reporting > 0) {
+ if (buflen >= (mac_ce_p->bsr_len + sizeof(NR_MAC_SUBHEADER_FIXED) + sizeof(NR_SINGLE_ENTRY_PHR_MAC_CE))) {
+ if (mac->scheduling_info.phr_info.phr_reporting) {
+ mac_ce_p->phr_header_len = sizeof(NR_MAC_SUBHEADER_FIXED);
+ mac_ce_p->phr_ce_len = sizeof(NR_SINGLE_ENTRY_PHR_MAC_CE);
+ nr_ue_fill_phr(mac, mac_ce_p->phr, P_CMAX, tx_power, frameP, subframe);
+ }
+ }
+ }
+ mac_ce_p->phr_len = mac_ce_p->phr_header_len + mac_ce_p->phr_ce_len;
+
return (mac_ce_p->bsr_len + mac_ce_p->phr_len);
}
@@ -3234,7 +3342,9 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
slot_t slot,
uint8_t gNB_index,
uint8_t *ulsch_buffer,
- uint32_t buflen)
+ uint32_t buflen,
+ int16_t tx_power,
+ int16_t P_CMAX)
{
NR_UE_MAC_CE_INFO mac_ce_info;
NR_UE_MAC_CE_INFO *mac_ce_p=&mac_ce_info;
@@ -3253,8 +3363,9 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
mac_ce_p->bsr_s = &bsr_short;
mac_ce_p->bsr_l = &bsr_long;
mac_ce_p->bsr_t = &bsr_truncated;
- //NR_POWER_HEADROOM_CMD phr;
- //mac_ce_p->phr_p = &phr;
+
+ NR_SINGLE_ENTRY_PHR_MAC_CE phr;
+ mac_ce_p->phr = &phr;
//int highest_priority = 16;
const uint8_t sh_size = sizeof(NR_MAC_SUBHEADER_LONG);
@@ -3273,7 +3384,7 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
// because as per standard(TS38.321), all equal priority channels should be served equally
// nr_ue_get_sdu_mac_ce_pre updates all mac_ce related header field related to length
- mac_ce_p->tot_mac_ce_len = nr_ue_get_sdu_mac_ce_pre(mac, CC_id, frame, slot, gNB_index, ulsch_buffer, buflen, mac_ce_p);
+ mac_ce_p->tot_mac_ce_len = nr_ue_get_sdu_mac_ce_pre(mac, CC_id, frame, slot, gNB_index, ulsch_buffer, buflen, tx_power, P_CMAX, mac_ce_p);
mac_ce_p->total_mac_pdu_header_len = mac_ce_p->tot_mac_ce_len;
LOG_D(NR_MAC, "[UE %d] [%d.%d] process UL transport block at with size TBS = %d bytes \n", mac->ue_id, frame, slot, buflen);
@@ -3373,9 +3484,8 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
nr_ue_get_sdu_mac_ce_post(mac, frame, slot, ulsch_buffer, buflen, mac_ce_p);
if (mac_ce_p->tot_mac_ce_len > 0) {
-
LOG_D(NR_MAC, "In %s copying %d bytes of MAC CEs to the UL PDU \n", __FUNCTION__, mac_ce_p->tot_mac_ce_len);
- int size = nr_write_ce_ulsch_pdu(pdu, mac, 0, NULL, mac_ce_p->bsr_t, mac_ce_p->bsr_s, mac_ce_p->bsr_l);
+ int size = nr_write_ce_ulsch_pdu(pdu, mac, mac_ce_p->phr_ce_len ? mac_ce_p->phr : NULL, 0, mac_ce_p->bsr_t, mac_ce_p->bsr_s, mac_ce_p->bsr_l);
if (size != mac_ce_p->tot_mac_ce_len)
LOG_E(NR_MAC, "MAC CE size computed by nr_write_ce_ulsch_pdu is %d while the one assumed before is %d\n", size, mac_ce_p->tot_mac_ce_len);
pdu += (unsigned char) mac_ce_p->tot_mac_ce_len;
@@ -3436,3 +3546,42 @@ static void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TI
dl_config->number_pdus += 1;
ul_time_alignment->ta_apply = no_ta;
}
+
+static void nr_ue_fill_phr(NR_UE_MAC_INST_t *mac,
+ NR_SINGLE_ENTRY_PHR_MAC_CE *phr,
+ float P_CMAX,
+ float tx_power,
+ frame_t frameP,
+ sub_frame_t subframe)
+{
+ nr_phr_info_t *phr_info = &mac->scheduling_info.phr_info;
+ // Value mapping according to 38.133 10.1.18.1
+ const int PC_MAX_00 = -29;
+ phr->PCMAX = max(0, (int)P_CMAX - PC_MAX_00) & 0x3f;
+ // Value mapping according to 38.133 10.1.17.1.1
+ const int POWER_HEADROOM_55 = 22;
+ int headroom = P_CMAX - tx_power;
+ if (headroom < POWER_HEADROOM_55) {
+ const int POWER_HEADROOM_0 = -32;
+ phr->PH = max(0, headroom - POWER_HEADROOM_0);
+ } else {
+ phr->PH = min(0x3f, 55 + (headroom - POWER_HEADROOM_55) / 2);
+ }
+
+ LOG_D(NR_MAC,
+ "PHR Reporting sfn.subframe %d.%d reason = %d, P_CMAX = %d (%5.2f dBm), headrom = %d (%d dB) tx_power = %5.2f dBm\n",
+ frameP,
+ subframe,
+ phr_info->phr_reporting,
+ phr->PCMAX,
+ P_CMAX,
+ phr->PH,
+ headroom,
+ tx_power);
+
+ phr_info->PathlossLastValue = compute_nr_SSB_PL(mac, mac->ssb_measurements.ssb_rsrp_dBm);
+ // Restart both timers according to 38.321
+ nr_timer_start(&phr_info->periodicPHR_Timer);
+ nr_timer_start(&phr_info->prohibitPHR_Timer);
+ phr_info->phr_reporting = 0;
+}
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
index 772b9bf582..b8f370be16 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
@@ -313,10 +313,13 @@ static int nr_process_mac_pdu(instance_t module_idP,
int PH;
const int PCMAX = phr->PCMAX;
/* 38.133 Table10.1.17.1-1 */
- if (phr->PH < 55)
+ if (phr->PH < 55) {
PH = phr->PH - 32;
- else
- PH = phr->PH - 32 + (phr->PH - 54);
+ } else if (phr->PH < 63) {
+ PH = 28 + (phr->PH - 55) * 2;
+ } else {
+ PH = 42;
+ }
// in sched_ctrl we set normalized PH wrt MCS and PRBs
long *deltaMCS = ul_bwp->pusch_Config ? ul_bwp->pusch_Config->pusch_PowerControl->deltaMCS : NULL;
sched_ctrl->ph = PH
@@ -331,8 +334,16 @@ static int nr_process_mac_pdu(instance_t module_idP,
sched_ctrl->ph0 = PH;
/* 38.133 Table10.1.18.1-1 */
sched_ctrl->pcmax = PCMAX - 29;
- LOG_D(NR_MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n",
- phr->R1, PH, sched_ctrl->ph, phr->R2, PCMAX, sched_ctrl->pcmax);
+ LOG_D(NR_MAC,
+ "SINGLE ENTRY PHR %d.%d R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n",
+ frameP,
+ slot,
+ phr->R1,
+ PH,
+ sched_ctrl->ph,
+ phr->R2,
+ PCMAX,
+ sched_ctrl->pcmax);
break;
case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT:
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
index 28cd37f3af..c63487e1ce 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
@@ -49,8 +49,7 @@
#include "common/ngran_types.h"
#include "common/openairinterface5g_limits.h"
#include "executables/lte-softmodem.h"
-#include "SIMULATION/ETH_TRANSPORT/proto.h"
-#include "openair2/RRC/NAS/nas_config.h"
+#include "common/utils/tun_if.h"
#include "intertask_interface.h"
#include "openair3/S1AP/s1ap_eNB.h"
#include
@@ -113,7 +112,7 @@ struct sockaddr_in prose_ctrl_addr;
struct sockaddr_in prose_pdcp_addr;
struct sockaddr_in pdcp_sin;
/* pdcp module parameters and related functions*/
-static pdcp_params_t pdcp_params= {0,NULL};
+static pdcp_params_t pdcp_params = {0};
rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB];
rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB]; // for noS1 mode
unsigned int pdcp_eNB_UE_instance_to_rnti_index;
@@ -298,8 +297,8 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP,
LOG_UI(PDCP, "Before rlc_data_req 1, srb_flagP: %d, rb_idP: %ld \n", srb_flagP, rb_idP);
}
- rlc_status = pdcp_params.send_rlc_data_req_func(ctxt_pP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP,
- confirmP, sdu_buffer_sizeP, pdcp_pdu_p,NULL,NULL);
+ rlc_status =
+ rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p, NULL, NULL);
} else {
rlc_status = RLC_OP_STATUS_OUT_OF_RESSOURCES;
LOG_E(PDCP,PROTOCOL_CTXT_FMT" PDCP_DATA_REQ SDU DROPPED, OUT OF MEMORY \n",
@@ -467,9 +466,16 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP,
if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1)) {
LOG_D(PDCP, "pdcp data req on drb %ld, size %d, rnti %lx\n", rb_idP, pdcp_pdu_size, ctxt_pP->rntiMaybeUEid);
- rlc_status = pdcp_params.send_rlc_data_req_func(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP,
- confirmP, pdcp_pdu_size, pdcp_pdu_p,sourceL2Id,
- destinationL2Id);
+ rlc_status = rlc_data_req(ctxt_pP,
+ srb_flagP,
+ MBMS_FLAG_NO,
+ rb_idP,
+ muiP,
+ confirmP,
+ pdcp_pdu_size,
+ pdcp_pdu_p,
+ sourceL2Id,
+ destinationL2Id);
ret = false;
switch (rlc_status) {
case RLC_OP_STATUS_OK:
@@ -2279,63 +2285,38 @@ void rrc_pdcp_config_req (
}
}
-pdcp_data_ind_func_t get_pdcp_data_ind_func() {
- return pdcp_params.pdcp_data_ind_func;
-}
-
-void pdcp_set_rlc_data_req_func(send_rlc_data_req_func_t send_rlc_data_req) {
- pdcp_params.send_rlc_data_req_func = send_rlc_data_req;
-}
-
-void pdcp_set_pdcp_data_ind_func(pdcp_data_ind_func_t pdcp_data_ind) {
- pdcp_params.pdcp_data_ind_func = pdcp_data_ind;
-}
-
uint64_t pdcp_module_init( uint64_t pdcp_optmask, int id) {
/* temporary enforce netlink when UE_NAS_USE_TUN is set,
this is while switching from noS1 as build option
to noS1 as config option */
if ( pdcp_optmask & UE_NAS_USE_TUN_BIT) {
- pdcp_params.optmask = pdcp_params.optmask | PDCP_USE_NETLINK_BIT ;
+ pdcp_params.optmask = pdcp_params.optmask;
}
pdcp_params.optmask = pdcp_params.optmask | pdcp_optmask ;
- LOG_I(PDCP, "pdcp init,%s %s\n",
- ((LINK_ENB_PDCP_TO_GTPV1U)?"usegtp":""),
- ((PDCP_USE_NETLINK)?"usenetlink":""));
- if (PDCP_USE_NETLINK) {
- nas_getparams();
-
- if(UE_NAS_USE_TUN) {
- int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)? MAX_MOBILES_PER_ENB : 1;
- netlink_init_tun("ue",num_if, id);
- if (IS_SOFTMODEM_NOS1)
- nas_config(1, 1, 2, "ue");
- netlink_init_mbms_tun("uem", id);
- nas_config_mbms(1, 2, 2, "uem");
- LOG_I(PDCP, "UE pdcp will use tun interface\n");
- } else if(ENB_NAS_USE_TUN) {
- netlink_init_tun("enb", 1, 0);
- nas_config(1, 1, 1, "enb");
- if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){
- netlink_init_mbms_tun("enm", 0);
- nas_config_mbms(1, 2, 1, "enm");
- LOG_I(PDCP, "ENB pdcp will use mbms tun interface\n");
- }
- LOG_I(PDCP, "ENB pdcp will use tun interface\n");
- } else {
- LOG_I(PDCP, "pdcp will use kernel modules\n");
- netlink_init();
+ if (UE_NAS_USE_TUN) {
+ int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? MAX_MOBILES_PER_ENB : 1;
+ tun_init("oaitun_ue", num_if, id);
+ if (IS_SOFTMODEM_NOS1)
+ tun_config(1, "10.0.1.2", NULL, "oaitun_ue");
+ tun_init_mbms("oaitun_uem", id + 1);
+ tun_config(1, "10.0.2.2", NULL, "oaitun_uem");
+ LOG_I(PDCP, "UE pdcp will use tun interface\n");
+ } else if (ENB_NAS_USE_TUN) {
+ tun_init("oaitun_enb", 1, 0);
+ tun_config(1, "10.0.1.1", NULL, "oaitun_enb");
+ if (pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT) {
+ tun_init_mbms("oaitun_enm", 1);
+ tun_config(1, "10.0.2.1", NULL, "oaitun_enm");
+ LOG_I(PDCP, "ENB pdcp will use mbms tun interface\n");
}
- }else{
- if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){
- LOG_W(PDCP, "ENB pdcp will use tun interface for MBMS\n");
- netlink_init_mbms_tun("enm", 0);
- nas_config_mbms_s1(1, 2, 1, "enm");
- }else
- LOG_E(PDCP, "ENB pdcp will not use tun interface\n");
- }
+ LOG_I(PDCP, "ENB pdcp will use tun interface\n");
+ } else if (pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT) {
+ tun_init_mbms("oaitun_enm", 0);
+ tun_config(1, "10.0.2.1", NULL, "oaitun_enm");
+ LOG_I(PDCP, "ENB pdcp will use mbms tun interface\n");
+ }
pthread_create(&pdcp_stats_thread_desc,NULL,pdcp_stats_thread,NULL);
@@ -2362,7 +2343,7 @@ pdcp_free (
void pdcp_module_cleanup (void)
//-----------------------------------------------------------------------------
{
- netlink_cleanup();
+ // empty - we could free all contexts, not implemented
}
//-----------------------------------------------------------------------------
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
index 4a7f71b315..7a2ce5b84c 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
@@ -47,43 +47,16 @@
#include "openair3/SECU/secu_defs.h"
-typedef rlc_op_status_t (*send_rlc_data_req_func_t)(const protocol_ctxt_t *const,
- const srb_flag_t,
- const MBMS_flag_t,
- const rb_id_t,
- const mui_t,
- confirm_t,
- sdu_size_t,
- uint8_t *,
- const uint32_t *const,
- const uint32_t *const);
-
-typedef bool(pdcp_data_ind_t)(const protocol_ctxt_t *,
- const srb_flag_t,
- const MBMS_flag_t,
- const rb_id_t,
- const sdu_size_t,
- uint8_t *,
- const uint32_t *const,
- const uint32_t *const);
-typedef pdcp_data_ind_t* pdcp_data_ind_func_t;
-
#define MAX_NUMBER_NETIF 1 //16
#define ENB_NAS_USE_TUN_W_MBMS_BIT (1<< 10)
-#define PDCP_USE_NETLINK_BIT (1<< 11)
-#define LINK_ENB_PDCP_TO_IP_DRIVER_BIT (1<< 13)
#define LINK_ENB_PDCP_TO_GTPV1U_BIT (1<< 14)
#define UE_NAS_USE_TUN_BIT (1<< 15)
#define ENB_NAS_USE_TUN_BIT (1<< 16)
typedef struct {
uint64_t optmask;
- send_rlc_data_req_func_t send_rlc_data_req_func;
- pdcp_data_ind_func_t pdcp_data_ind_func;
} pdcp_params_t;
-#define PDCP_USE_NETLINK ( get_pdcp_optmask() & PDCP_USE_NETLINK_BIT)
-#define LINK_ENB_PDCP_TO_IP_DRIVER ( get_pdcp_optmask() & LINK_ENB_PDCP_TO_IP_DRIVER_BIT)
#define LINK_ENB_PDCP_TO_GTPV1U ( get_pdcp_optmask() & LINK_ENB_PDCP_TO_GTPV1U_BIT)
#define UE_NAS_USE_TUN ( get_pdcp_optmask() & UE_NAS_USE_TUN_BIT)
#define ENB_NAS_USE_TUN ( get_pdcp_optmask() & ENB_NAS_USE_TUN_BIT)
@@ -279,7 +252,7 @@ bool cu_f1u_data_req(protocol_ctxt_t *ctxt_pP,
const uint32_t *const sourceL2Id,
const uint32_t *const destinationL2Id);
-/*! \fn bool pdcp_data_ind(const protocol_ctxt_t* const, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, uint8_t*, bool)
+/*! \fn bool pdcp_data_ind(const protocol_ctxt_t* const, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, uint8_t*, uint32_t, uint32_t)
* \brief This functions handles data transfer indications coming from RLC
* \param[in] ctxt_pP Running context.
* \param[in] Shows if rb is SRB
@@ -287,12 +260,20 @@ bool cu_f1u_data_req(protocol_ctxt_t *ctxt_pP,
* \param[in] rab_id Radio Bearer ID
* \param[in] sdu_buffer_size Size of incoming SDU in bytes
* \param[in] sdu_buffer Buffer carrying SDU
- * \param[in] is_data_plane flag to indicate whether the userplane data belong to the control plane or data plane
+ * \param[in] srcID
+ * \param[in] dstID
* \return TRUE on success, false otherwise
* \note None
* @ingroup _pdcp
*/
-pdcp_data_ind_t pdcp_data_ind;
+bool pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP,
+ const srb_flag_t srb_flagP,
+ const MBMS_flag_t MBMS_flagP,
+ const rb_id_t rb_idP,
+ const sdu_size_t sdu_buffer_sizeP,
+ uint8_t *const sdu_buffer_pP,
+ const uint32_t *const srcID,
+ const uint32_t *const dstID);
/*! \fn void rrc_pdcp_config_req(const protocol_ctxt_t* const ,uint32_t,rb_id_t,uint8_t)
* \brief This functions initializes relevant PDCP entity
@@ -381,9 +362,6 @@ int pdcp_fifo_flush_sdus ( const protocol_ctxt_t *const ct
int pdcp_fifo_read_input_sdus_remaining_bytes ( const protocol_ctxt_t *const ctxt_pP);
int pdcp_fifo_read_input_sdus ( const protocol_ctxt_t *const ctxt_pP);
void pdcp_fifo_read_input_sdus_from_otg ( const protocol_ctxt_t *const ctxt_pP);
-void pdcp_set_rlc_data_req_func(send_rlc_data_req_func_t send_rlc_data_req);
-void pdcp_set_pdcp_data_ind_func(pdcp_data_ind_func_t pdcp_data_ind);
-pdcp_data_ind_func_t get_pdcp_data_ind_func(void);
//-----------------------------------------------------------------------------
int pdcp_fifo_flush_mbms_sdus ( const protocol_ctxt_t *const ctxt_pP);
int pdcp_fifo_read_input_mbms_sdus_fromtun ( const protocol_ctxt_t *const ctxt_pP);
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
index 11ee36669b..5f54bf6f04 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
@@ -31,8 +31,6 @@
#define PDCP_FIFO_C
-
-
extern int otg_enabled;
#include "pdcp.h"
@@ -49,7 +47,6 @@ extern int otg_enabled;
#include "../MAC/mac_extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
-#include "NETWORK_DRIVER/LITE/constant.h"
//#include "SIMULATION/ETH_TRANSPORT/extern.h"
#include "common/utils/LOG/log.h"
#include "UTIL/OTG/otg_tx.h"
@@ -63,23 +60,12 @@ extern int otg_enabled;
#include
#include
-#include "NETWORK_DRIVER/UE_IP/constant.h"
-
-extern char nl_rx_buf[NL_MAX_PAYLOAD];
-extern struct sockaddr_nl nas_src_addr, nas_dest_addr;
-extern struct nlmsghdr *nas_nlh_tx;
-extern struct nlmsghdr *nas_nlh_rx;
-extern struct iovec nas_iov_tx;
-extern struct iovec nas_iov_rx;
extern int nas_sock_fd[MAX_MOBILES_PER_ENB];
extern int nas_sock_mbms_fd;
-extern struct msghdr nas_msg_tx;
-extern struct msghdr nas_msg_rx;
-
-
+static char nl_rx_buf[NL_MAX_PAYLOAD];
# include "openair3/ocp-gtpu/gtp_itf.h"
@@ -136,12 +122,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
log_dump(PDCP, pdcpData, pdcpHead->data_size, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n");
ret = write(nas_sock_fd[0], pdcpData, pdcpHead->data_size);
LOG_T(PDCP,"[NB PDCP_FIFOS] ret %d TRIED TO PUSH DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[0],pdcpHead->data_size);
- } else if (PDCP_USE_NETLINK) {
- int sizeToWrite= sizeof (pdcp_data_ind_header_t) + pdcpHead->data_size;
- memcpy(NLMSG_DATA(nas_nlh_tx), (uint8_t *) pdcpHead, sizeToWrite);
- nas_nlh_tx->nlmsg_len = sizeToWrite;
- ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0);
- } // PDCP_USE_NETLINK
+ }
AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s), nas_sock_fd[0]: %d\n", errno, strerror(errno), nas_sock_fd[0]);
@@ -418,13 +399,14 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx
rb_id_t rab_id = 0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 1 );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 1 );
+ struct msghdr nas_msg_rx;
len = recvmsg(nas_sock_fd[0], &nas_msg_rx, 0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
if (len > 0) {
- for (nas_nlh_rx = (struct nlmsghdr *) nl_rx_buf;
- NLMSG_OK (nas_nlh_rx, len);
- nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, len)) {
+ for (struct nlmsghdr *nas_nlh_rx = (struct nlmsghdr *)nl_rx_buf;
+ NLMSG_OK(nas_nlh_rx, len);
+ nas_nlh_rx = NLMSG_NEXT(nas_nlh_rx, len)) {
if (nas_nlh_rx->nlmsg_type == NLMSG_DONE) {
LOG_D(PDCP, "[PDCP][NETLINK] RX NLMSG_DONE\n");
//return;
@@ -526,7 +508,7 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx
ctxt.rntiMaybeUEid = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
if (rab_id != 0) {
- if (rab_id == UE_IP_DEFAULT_RAB_ID) {
+ if (rab_id == 1) {
LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%lx, enb_flag=%d)\n", ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag);
key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag);
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
@@ -700,7 +682,7 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
//UE
if (!ctxt.enb_flag) {
if (rab_id != 0) {
- if (rab_id == UE_IP_DEFAULT_RAB_ID) {
+ if (rab_id == 1) {
LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%lx, enb_flag=%d)\n", ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag);
key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag);
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
@@ -807,15 +789,10 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
} /* pdcp_fifo_read_input_sdus_frompc5s */
//-----------------------------------------------------------------------------
-int pdcp_fifo_read_input_sdus (const protocol_ctxt_t *const ctxt_pP) {
- if (UE_NAS_USE_TUN || ENB_NAS_USE_TUN) {
- return pdcp_fifo_read_input_sdus_fromtun (ctxt_pP);
- } else if (PDCP_USE_NETLINK) {
- pdcp_fifo_read_input_sdus_frompc5s (ctxt_pP);
- return pdcp_fifo_read_input_sdus_fromnetlinksock(ctxt_pP);
- } /* PDCP_USE_NETLINK */
-
- return 0;
+int pdcp_fifo_read_input_sdus(const protocol_ctxt_t *const ctxt_pP)
+{
+ DevAssert(UE_NAS_USE_TUN || ENB_NAS_USE_TUN);
+ return pdcp_fifo_read_input_sdus_fromtun(ctxt_pP);
}
//TTN for D2D (PC5S)
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
deleted file mode 100644
index b832fee136..0000000000
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file pdcp_netlink.c
- * \brief pdcp communication with linux IP interface,
- * have a look at http://man7.org/linux/man-pages/man7/netlink.7.html for netlink.
- * Read operation from netlink should be achieved in an asynchronous way to avoid
- * subframe overload, netlink congestion...
- * \author Sebastien ROUX
- * \date 2013
- * \version 0.1
- * @ingroup pdcp
- */
-
-#define _GNU_SOURCE // required for pthread_setname_np()
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-/* Bugfix for version of GCC = 4.4.3 (Ubuntu 10.04) */
-#if GCC_VERSION <= 40403
- #include
-#endif
-
-#include
-
-#include "assertions.h"
-#include "queue.h"
-#include "liblfds611.h"
-
-#include "common/utils/LOG/log.h"
-#include "common/utils/system.h"
-#include "LAYER2/MAC/mac_extern.h"
-
-#include "pdcp.h"
-#include "pdcp_primitives.h"
-
-
-#define PDCP_QUEUE_NB_ELEMENTS 200
-
-extern char nl_rx_buf[NL_MAX_PAYLOAD];
-extern struct nlmsghdr *nas_nlh_rx;
-extern struct iovec nas_iov_rx;
-extern int nas_sock_fd;
-extern struct msghdr nas_msg_rx;
-
-
-static pthread_t pdcp_netlink_thread;
-
-/* We use lock-free queues between the User-plane driver running in kernel-space
- * and the corresponding entity in User-space.
- * one queue for eNBs (index 0)/one queue for UEs (index 1)
- */
-static struct lfds611_queue_state **pdcp_netlink_queue_enb = NULL;
-static struct lfds611_queue_state **pdcp_netlink_queue_ue = NULL;
-static uint32_t *pdcp_netlink_nb_element_enb = NULL;
-static uint32_t *pdcp_netlink_nb_element_ue = NULL;
-
-time_stats_t ip_pdcp_stats_tmp;
-
-static void *pdcp_netlink_thread_fct(void *arg);
-
-//-----------------------------------------------------------------------------
-int
-pdcp_netlink_init(
- void
-)
-//-----------------------------------------------------------------------------
-{
- int i;
- int nb_inst_enb;
- int nb_inst_ue;
-
- reset_meas(&ip_pdcp_stats_tmp);
- nb_inst_enb = 1;
- nb_inst_ue = 1;
-
- if (LINK_ENB_PDCP_TO_GTPV1U) {
- nb_inst_enb = 0;
- LOG_I(PDCP, "[NETLINK] Creating 0 queues for eNB Netlink -> PDCP communication\n");
- } else {
- /* #warning " LG: When there will be handover in, there will problems because dim is based on local nums of ues" */
- pdcp_netlink_queue_enb = calloc(nb_inst_enb, sizeof(struct lfds611_queue_state *));
- pdcp_netlink_nb_element_enb = malloc(nb_inst_enb * sizeof(uint32_t));
- LOG_I(PDCP, "[NETLINK] Creating %d queues for eNB Netlink -> PDCP communication\n", nb_inst_enb);
-
- for (i = 0; i < nb_inst_enb; i++) {
- pdcp_netlink_nb_element_enb[i] = 0;
-
- if (lfds611_queue_new(&pdcp_netlink_queue_enb[i], PDCP_QUEUE_NB_ELEMENTS) < 0) {
- LOG_E(PDCP, "Failed to create new FIFO for eNB Netlink -> PDCP communcation instance %d\n", i);
- exit(EXIT_FAILURE);
- }
- }
- }
-
- if (nb_inst_ue > 0) {
- pdcp_netlink_queue_ue = calloc(nb_inst_ue, sizeof(struct lfds611_queue_state *));
- pdcp_netlink_nb_element_ue = malloc(nb_inst_ue * sizeof(uint32_t));
- LOG_I(PDCP, "[NETLINK] Creating %d queues for UE Netlink -> PDCP communication\n", nb_inst_ue);
-
- for (i = 0; i < nb_inst_ue; i++) {
- pdcp_netlink_nb_element_ue[i] = 0;
-
- if (lfds611_queue_new(&pdcp_netlink_queue_ue[i], PDCP_QUEUE_NB_ELEMENTS) < 0) {
- LOG_E(PDCP, "Failed to create new FIFO for UE Netlink -> PDCP communcation instance %d\n", i);
- exit(EXIT_FAILURE);
- }
- }
- }
-
- if ((nb_inst_ue + nb_inst_enb) > 0) {
- /* Create one thread that fetchs packets from the netlink.
- * When the netlink fifo is full, packets are silently dropped, this behaviour
- * should be avoided if we want a reliable link.
- */
- threadCreate(&pdcp_netlink_thread, pdcp_netlink_thread_fct, (void*)NULL, "PDCP netlink", -1, OAI_PRIORITY_RT_LOW );
- }
-
- return 0;
-}
-
-//-----------------------------------------------------------------------------
-int
-pdcp_netlink_dequeue_element(
- const protocol_ctxt_t *const ctxt_pP,
- struct pdcp_netlink_element_s **data_ppP
-)
-//-----------------------------------------------------------------------------
-{
- int ret = 0;
-
- if (ctxt_pP->enb_flag) {
- ret = lfds611_queue_dequeue(pdcp_netlink_queue_enb[ctxt_pP->module_id], (void **)data_ppP);
-
- if (ret != 0) {
- LOG_D(PDCP,"[NETLINK]De-queueing packet for eNB instance %d\n", ctxt_pP->module_id);
- }
- } else {
- ret = lfds611_queue_dequeue(pdcp_netlink_queue_ue[ctxt_pP->module_id], (void **)data_ppP);
-
- if (ret != 0) {
- LOG_D(PDCP, "[NETLINK]De-queueing packet for UE instance %d\n", ctxt_pP->module_id);
- }
- }
-
- return ret;
-}
-
-//-----------------------------------------------------------------------------
-static
-void *pdcp_netlink_thread_fct(void *arg)
-//-----------------------------------------------------------------------------
-{
- int len = 0;
- struct pdcp_netlink_element_s *new_data_p = NULL;
- uint8_t pdcp_thread_read_state ;
- eNB_flag_t eNB_flag = 0;
- module_id_t module_id = 0;
- pdcp_thread_read_state = 0;
- memset(nl_rx_buf, 0, NL_MAX_PAYLOAD);
- LOG_I(PDCP, "[NETLINK_THREAD] binding to fd %d\n",nas_sock_fd);
-
- while (1) {
- len = recvmsg(nas_sock_fd, &nas_msg_rx, 0);
-
- if (len == 0) {
- /* Other peer (kernel) has performed an orderly shutdown
- */
- LOG_E(PDCP, "[NETLINK_THREAD] Kernel module has closed the netlink\n");
- exit(EXIT_FAILURE);
- } else if (len < 0) {
- /* There was an error */
- LOG_E(PDCP, "[NETLINK_THREAD] An error occured while reading netlink (%d:%s)\n",
- errno, strerror(errno));
- exit(EXIT_FAILURE);
- } else {
- /* Normal read.
- * NOTE: netlink messages can be assembled to form a multipart message
- */
- for (nas_nlh_rx = (struct nlmsghdr *) nl_rx_buf;
- NLMSG_OK(nas_nlh_rx, (unsigned int)len);
- nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, len)) {
- start_meas(&ip_pdcp_stats_tmp);
-
- /* There is no need to check for nlmsg_type because
- * the header is not set in our drivers.
- */
- if (pdcp_thread_read_state == 0) {
- new_data_p = malloc(sizeof(struct pdcp_netlink_element_s));
-
- if (nas_nlh_rx->nlmsg_len == sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)) {
- pdcp_thread_read_state = 1;
- memcpy((void *)&new_data_p->pdcp_read_header, (void *)NLMSG_DATA(nas_nlh_rx), sizeof(pdcp_data_req_header_t));
- LOG_I(PDCP, "[NETLINK_THREAD] RX pdcp_data_req_header_t inst %u, "
- "rb_id %ld data_size %d\n",
- new_data_p->pdcp_read_header.inst,
- new_data_p->pdcp_read_header.rb_id,
- new_data_p->pdcp_read_header.data_size);
- } else {
- LOG_E(PDCP, "[NETLINK_THREAD] WRONG size %d should be sizeof "
- "%lu ((pdcp_data_req_header_t) + sizeof(struct nlmsghdr))\n",
- nas_nlh_rx->nlmsg_len,
- sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr));
- }
- } else {
- pdcp_thread_read_state = 0;
- module_id = 0;
- new_data_p->data = malloc(sizeof(uint8_t) * new_data_p->pdcp_read_header.data_size);
- /* Copy the data */
- memcpy(new_data_p->data, NLMSG_DATA(nas_nlh_rx), new_data_p->pdcp_read_header.data_size);
-
- if (eNB_flag) {
- if (pdcp_netlink_nb_element_enb[module_id]
- > PDCP_QUEUE_NB_ELEMENTS) {
- LOG_E(PDCP, "[NETLINK_THREAD][Mod %02x] We reached maximum number of elements in eNB pdcp queue (%lu)\n",
- module_id, (intptr_t)pdcp_netlink_nb_element_enb);
- }
-
- LOG_I(PDCP,"[NETLINK_THREAD] IP->PDCP : En-queueing packet for eNB module id %d\n", module_id);
- /* Enqueue the element in the right queue */
- lfds611_queue_guaranteed_enqueue(pdcp_netlink_queue_enb[module_id], new_data_p);
- stop_meas(&ip_pdcp_stats_tmp);
- copy_meas(&eNB_pdcp_stats[module_id].pdcp_ip,&ip_pdcp_stats_tmp);
- } else {
- if (pdcp_netlink_nb_element_ue[module_id]
- > PDCP_QUEUE_NB_ELEMENTS) {
- LOG_E(PDCP, "[NETLINK_THREAD][Mod %02x] We reached maximum number of elements in UE pdcp queue (%lu)\n",
- module_id, (intptr_t)pdcp_netlink_nb_element_ue);
- }
-
- LOG_I(PDCP,"[NETLINK_THREAD] IP->PDCP : En-queueing packet for UE module id %d\n", module_id);
- /* Enqueue the element in the right queue */
- lfds611_queue_guaranteed_enqueue(pdcp_netlink_queue_ue[module_id], new_data_p);
- stop_meas(&ip_pdcp_stats_tmp);
- copy_meas(&UE_pdcp_stats[module_id].pdcp_ip,&ip_pdcp_stats_tmp);
- }
- }
- }
- }
- }
-
- return NULL;
-}
-
diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
index 4582a85795..d9efb52776 100644
--- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
+++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
@@ -367,14 +367,14 @@ static void enqueue_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP,
if (pthread_mutex_unlock(&pq.m) != 0) abort();
}
-bool pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const MBMS_flag_t MBMS_flagP,
- const rb_id_t rb_id,
- const sdu_size_t sdu_buffer_size,
- uint8_t *const sdu_buffer,
- const uint32_t *const srcID,
- const uint32_t *const dstID)
+bool nr_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP,
+ const srb_flag_t srb_flagP,
+ const MBMS_flag_t MBMS_flagP,
+ const rb_id_t rb_id,
+ const sdu_size_t sdu_buffer_size,
+ uint8_t *const sdu_buffer,
+ const uint32_t *const srcID,
+ const uint32_t *const dstID)
{
enqueue_pdcp_data_ind(ctxt_pP,
srb_flagP,
@@ -594,7 +594,7 @@ void nr_pdcp_layer_init(bool uses_e1)
#include "nfapi/oai_integration/vendor_ext.h"
#include "executables/lte-softmodem.h"
-#include "openair2/RRC/NAS/nas_config.h"
+#include "common/utils/tun_if.h"
uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id)
{
@@ -608,48 +608,29 @@ uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id)
initialized = 1;
if (pthread_mutex_unlock(&m) != 0) abort();
-#if 0
- pdcp_optmask = _pdcp_optmask;
- return pdcp_optmask;
-#endif
- /* temporary enforce netlink when UE_NAS_USE_TUN is set,
- this is while switching from noS1 as build option
- to noS1 as config option */
- if ( _pdcp_optmask & UE_NAS_USE_TUN_BIT) {
- pdcp_optmask = pdcp_optmask | PDCP_USE_NETLINK_BIT ;
- }
-
pdcp_optmask = pdcp_optmask | _pdcp_optmask ;
- LOG_I(PDCP, "pdcp init,%s %s\n",
- ((LINK_ENB_PDCP_TO_GTPV1U)?"usegtp":""),
- ((PDCP_USE_NETLINK)?"usenetlink":""));
- if (PDCP_USE_NETLINK) {
- nas_getparams();
-
- if(UE_NAS_USE_TUN) {
- char *ifsuffix_ue = get_softmodem_params()->nsa ? "nrue" : "ue";
- int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)? MAX_MOBILES_PER_ENB : 1;
- netlink_init_tun(ifsuffix_ue, num_if, id);
- //Add --nr-ip-over-lte option check for next line
- if (IS_SOFTMODEM_NOS1){
- nas_config(1, 1, !get_softmodem_params()->nsa ? 2 : 3, ifsuffix_ue);
- set_qfi_pduid(7, 10);
- }
- LOG_I(PDCP, "UE pdcp will use tun interface\n");
- start_pdcp_tun_ue();
- } else if(ENB_NAS_USE_TUN) {
- char *ifsuffix_base_s = get_softmodem_params()->nsa ? "gnb" : "enb";
- netlink_init_tun(ifsuffix_base_s, 1, id);
- nas_config(1, 1, 1, ifsuffix_base_s);
- LOG_I(PDCP, "ENB pdcp will use tun interface\n");
- start_pdcp_tun_enb();
- } else {
- LOG_I(PDCP, "pdcp will use kernel modules\n");
- abort();
- netlink_init();
+ if (UE_NAS_USE_TUN) {
+ char *ifprefix = get_softmodem_params()->nsa ? "oaitun_nrue" : "oaitun_ue";
+ int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)
+ ? MAX_MOBILES_PER_ENB
+ : 1;
+ tun_init(ifprefix, num_if, id);
+ if (IS_SOFTMODEM_NOS1) {
+ const char *ip = !get_softmodem_params()->nsa ? "10.0.1.2" : "10.0.1.3";
+ tun_config(1, ip, NULL, ifprefix);
+ set_qfi_pduid(7, 10);
}
+ LOG_I(PDCP, "UE pdcp will use tun interface\n");
+ start_pdcp_tun_ue();
+ } else if (ENB_NAS_USE_TUN) {
+ char *ifprefix = get_softmodem_params()->nsa ? "oaitun_gnb" : "oaitun_enb";
+ tun_init(ifprefix, 1, id);
+ tun_config(1, "10.0.1.1", NULL, ifprefix);
+ LOG_I(PDCP, "ENB pdcp will use tun interface\n");
+ start_pdcp_tun_enb();
}
+
return pdcp_optmask ;
}
@@ -1313,7 +1294,7 @@ bool cu_f1u_data_req(protocol_ctxt_t *ctxt_pP,
exit(1);
}
memcpy(memblock, sdu_buffer, sdu_buffer_size);
- int ret=pdcp_data_ind(ctxt_pP,srb_flagP, false, rb_id, sdu_buffer_size, memblock, NULL, NULL);
+ int ret = nr_pdcp_data_ind(ctxt_pP, srb_flagP, false, rb_id, sdu_buffer_size, memblock, NULL, NULL);
if (!ret) {
LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__);
/* what to do in case of failure? for the moment: nothing */
@@ -1337,16 +1318,6 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP,
return false;
}
-void pdcp_set_pdcp_data_ind_func(pdcp_data_ind_func_t pdcp_data_ind)
-{
- /* nothing to do */
-}
-
-void pdcp_set_rlc_data_req_func(send_rlc_data_req_func_t send_rlc_data_req)
-{
- /* nothing to do */
-}
-
//Dummy function needed due to LTE dependencies
void
pdcp_mbms_run ( const protocol_ctxt_t *const ctxt_pP){
diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h
index 54a5e0dcbc..101200615e 100644
--- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h
+++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h
@@ -37,14 +37,14 @@ void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP,
sdu_size_t sdu_sizeP,
uint8_t *sdu_pP);
-bool pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const MBMS_flag_t MBMS_flagP,
- const rb_id_t rb_id,
- const sdu_size_t sdu_buffer_size,
- uint8_t *const sdu_buffer,
- const uint32_t *const srcID,
- const uint32_t *const dstID);
+bool nr_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP,
+ const srb_flag_t srb_flagP,
+ const MBMS_flag_t MBMS_flagP,
+ const rb_id_t rb_id,
+ const sdu_size_t sdu_buffer_size,
+ uint8_t *const sdu_buffer,
+ const uint32_t *const srcID,
+ const uint32_t *const dstID);
void nr_pdcp_add_drbs(eNB_flag_t enb_flag,
ue_id_t UEid,
diff --git a/openair2/LAYER2/nr_rlc/asn1_utils.c b/openair2/LAYER2/nr_rlc/asn1_utils.c
index 999cb79a52..fd64d89481 100644
--- a/openair2/LAYER2/nr_rlc/asn1_utils.c
+++ b/openair2/LAYER2/nr_rlc/asn1_utils.c
@@ -135,7 +135,7 @@ int decode_poll_byte(int v)
}
if (tab[v] == -1) return -1;
- return tab[v] * 1024;
+ return tab[v];
}
int decode_max_retx_threshold(int v)
diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
index 4f34a64999..46b4dad519 100644
--- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
+++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
@@ -519,7 +519,7 @@ rb_found:
}
memcpy(memblock, buf, size);
LOG_D(PDCP, "Calling PDCP layer from RLC in %s\n", __FUNCTION__);
- if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock, NULL, NULL)) {
+ if (!nr_pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock, NULL, NULL)) {
LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__);
/* what to do in case of failure? for the moment: nothing */
}
diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c
index d9798f6138..e8e70aec41 100644
--- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c
+++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c
@@ -418,7 +418,7 @@ rb_found:
exit(1);
}
memcpy(memblock, buf, size);
- if (!get_pdcp_data_ind_func()(&ctx, is_srb, is_mbms, rb_id, size, memblock, NULL, NULL)) {
+ if (!pdcp_data_ind(&ctx, is_srb, is_mbms, rb_id, size, memblock, NULL, NULL)) {
LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed (is_srb %d rb_id %d rnti %d)\n",
__FILE__, __LINE__, __FUNCTION__,
is_srb, rb_id, ue->rnti);
diff --git a/openair2/NETWORK_DRIVER/LITE/RB_TOOL/Makefile b/openair2/NETWORK_DRIVER/LITE/RB_TOOL/Makefile
deleted file mode 100644
index a939acb7ce..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/RB_TOOL/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-CC = gcc
-
-NAS_DIR = ..
-
-rb_tool: rb_tool.c
- $(CC) rb_tool.c -o rb_tool -I../ -g -ggdb
-
-all: rb_tool
-
-clean:
- rm rb_tool
diff --git a/openair2/NETWORK_DRIVER/LITE/RB_TOOL/rb_tool.c b/openair2/NETWORK_DRIVER/LITE/RB_TOOL/rb_tool.c
deleted file mode 100644
index 465e134d76..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/RB_TOOL/rb_tool.c
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/***************************************************************************
- rb_tool.c - User-space utility for driving NASMESH IOCTL interface
- -------------------
- copyright : (C) 2008 by Eurecom
- email : raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr
-***************************************************************************
-
-***************************************************************************/
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-//#include "rrc_nas_primitives.h"
-#include "ioctl.h"
-#include "constant.h"
-
-
-#define NIPADDR(addr) \
- (uint8_t)(addr & 0x000000FF), \
- (uint8_t)((addr & 0x0000FF00) >> 8), \
- (uint8_t)((addr & 0x00FF0000) >> 16), \
- (uint8_t)((addr & 0xFF000000) >> 24)
-
-
-
-#define NIP6ADDR(addr) \
- ntohs((addr)->s6_addr16[0]), \
- ntohs((addr)->s6_addr16[1]), \
- ntohs((addr)->s6_addr16[2]), \
- ntohs((addr)->s6_addr16[3]), \
- ntohs((addr)->s6_addr16[4]), \
- ntohs((addr)->s6_addr16[5]), \
- ntohs((addr)->s6_addr16[6]), \
- ntohs((addr)->s6_addr16[7])
-
-
-// Global variables
-
-int fd;
-//ioctl
-char dummy_buffer[1024];
-struct oai_nw_drv_ioctl gifr;
-//int wait_start_nas;
-
-//---------------------------------------------------------------------------
-void IAL_NAS_ioctl_init(int inst)
-//---------------------------------------------------------------------------
-{
- struct oai_nw_drv_msg_statistic_reply *msgrep;
- int err,rc;
- sprintf(gifr.name, "oai%d",inst);
- // Get an UDP IPv6 socket ??
- fd=socket(AF_INET6, SOCK_DGRAM, 0);
-
- if (fd<0) {
- printf("Error opening socket\n");
- exit(1);
- }
-
- sprintf(gifr.name, "oai%d",inst);
- gifr.type = OAI_NW_DRV_MSG_STATISTIC_REQUEST;
- memset ((void *)dummy_buffer,0,800);
- gifr.msg= &(dummy_buffer[0]);
- msgrep=(struct oai_nw_drv_msg_statistic_reply *)(gifr.msg);
- printf("ioctl :Statistics requested\n");
- err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
-
- if (err<0) {
- printf("IOCTL error, err=%d\n",err);
- rc = -1;
- }
-
- printf("tx_packets = %u, rx_packets = %u\n", msgrep->tx_packets, msgrep->rx_packets);
- printf("tx_bytes = %u, rx_bytes = %u\n", msgrep->tx_bytes, msgrep->rx_bytes);
- printf("tx_errors = %u, rx_errors = %u\n", msgrep->tx_errors, msgrep->rx_errors);
- printf("tx_dropped = %u, rx_dropped = %u\n", msgrep->tx_dropped, msgrep->rx_dropped);
-}
-
-#define NO_ACTION_RB 0
-#define ADD_RB 1
-#define DEL_RB 2
-
-//---------------------------------------------------------------------------
-int main(int argc,char **argv)
-//---------------------------------------------------------------------------
-{
- int done;
- int rc;
- int meas_polling_counter;
- fd_set readfds;
- struct timeval tv;
- int i;
- int err;
- char *buffer;
- int c;
- int action;
- int rbset = 0;
- int cxset = 0;
- int classrefset = 0;
- int instset = 0;
- int saddr_ipv4set = 0;
- int saddr_ipv6set = 0;
- int daddr_ipv4set = 0;
- int daddr_ipv6set = 0;
- int dscpset = 0;
- int dplen = 0;
- int splen = 0;
- int mpls_outlabelset = 0;
- int mpls_inlabelset;
- char rb[20];
- char cx[20];
- char classref[20];
- char dscp[20];
- char inst[20];
- char mpls_outgoinglabel[100];
- char mpls_incominglabel[100];
- int index;
- struct oai_nw_drv_msg_rb_establishment_request *msgreq;
- struct oai_nw_drv_msg_class_add_request *msgreq_class;
- in_addr_t saddr_ipv4;
- in_addr_t daddr_ipv4;
- struct in6_addr saddr_ipv6;
- struct in6_addr daddr_ipv6;
- unsigned int mpls_outlabel;
- unsigned int mpls_inlabel;
- char addr_str[46];
- char mask_len_delims[] = "/";
- char *result;
- // scan options
- rb[0] = '\0';
- cx[0] = '\0';
- dscp[0] = '\0';
- mpls_incominglabel[0] = '\0';
- mpls_outgoinglabel[0] = '\0';
- action = NO_ACTION_RB;
-
- while ((c = getopt (argc, argv, "adr:i:c:f:l:m:s:t:x:y:z:")) != -1)
- switch (c) {
- case 'a':
- action = ADD_RB;
- break;
-
- case 'd':
- action = DEL_RB;
- break;
-
- case 'r':
- strcpy(rb,optarg);
- rbset = 1;
- break;
-
- case 'i':
- strcpy(inst,optarg);
- instset = 1;
- break;
-
- case 'c':
- strcpy(cx,optarg);
- cxset = 1;
- break;
-
- case 'f':
- strcpy(classref,optarg);
- classrefset = 1;
- break;
-
- case 'l':
- strcpy(mpls_outgoinglabel,optarg);
- mpls_outlabelset=1;
- break;
-
- case 'm':
- strcpy(mpls_incominglabel,optarg);
- mpls_inlabelset=1;
- break;
-
- case 's':
- result = strtok( optarg, mask_len_delims );
-
- if ( result != NULL ) {
- inet_aton(result,&saddr_ipv4);
- printf("Arg Source Addr IPv4 string: %s\n",result);
- saddr_ipv4set = 1;
- } else {
- printf("Arg Source Addr IPv4 string: ERROR\n");
- break;
- }
-
- result = strtok( NULL, mask_len_delims );
-
- if ( result != NULL ) {
- splen = atoi(result);
- } else {
- splen = 32;
- }
-
- printf("Arg Source Addr IPv4 mask len: %d\n",splen);
- break;
-
- case 't':
- result = strtok( optarg, mask_len_delims );
-
- if ( result != NULL ) {
- inet_aton(result,&daddr_ipv4);
- printf("Arg Dest Addr IPv4 string: %s\n",result);
- daddr_ipv4set = 1;
- } else {
- printf("Arg Dest Addr IPv4 string: ERROR\n");
- break;
- }
-
- result = strtok( NULL, mask_len_delims );
-
- if ( result != NULL ) {
- dplen = atoi(result);
- } else {
- dplen = 32;
- }
-
- printf("Arg Dest Addr IPv4 mask len: %d\n",dplen);
- break;
-
- case 'x':
- result = strtok( optarg, mask_len_delims );
-
- if ( result != NULL ) {
- printf("Arg Source Addr IPv6 string: %s\n",result);
- inet_pton(AF_INET6,result,(void *)&saddr_ipv6);
- saddr_ipv6set = 1;
- } else {
- printf("Arg Source Addr IPv6 string: ERROR\n");
- break;
- }
-
- result = strtok( NULL, mask_len_delims );
-
- if ( result != NULL ) {
- splen = atoi(result);
- } else {
- splen = 128;
- }
-
- printf("Arg Source Addr IPv6 mask len: %d\n",splen);
- break;
-
- case 'y':
- result = strtok( optarg, mask_len_delims );
-
- if ( result != NULL ) {
- printf("Arg Dest Addr IPv6 string: %s\n",result);
- inet_pton(AF_INET6,result,(void *)&daddr_ipv6);
- daddr_ipv6set = 1;
- } else {
- printf("Arg Dest Addr IPv6 string: ERROR\n");
- break;
- }
-
- result = strtok( NULL, mask_len_delims );
-
- if ( result != NULL ) {
- dplen = atoi(result);
- } else {
- dplen = 128;
- }
-
- printf("Arg Dest Addr IPv6 mask len: %d\n",dplen);
- break;
-
- case 'z':
- dscpset=1;
- strcpy(dscp,optarg);
- break;
-
- case '?':
- if (isprint (optopt))
- fprintf (stderr, "Unknown option `-%c'.\n", optopt);
- else
- fprintf (stderr,
- "Unknown option character `\\x%x'.\n",
- optopt);
-
- return 1;
-
- default:
- abort ();
- }
-
- printf ("action = %d, rb = %s,cx = %s\n", action, rb, cx);
-
- if (rbset==0) {
- printf("ERROR: Specify a RAB id!!\n");
- exit(-1);
- }
-
- if (cxset==0) {
- printf("ERROR: Specify an LCR !!\n");
- exit(-1);
- }
-
- if (classrefset==0) {
- printf("ERROR: Specify an Class reference !!\n");
- exit(-1);
- }
-
- if (instset==0) {
- printf("ERROR: Specify an interface !!\n");
- exit(-1);
- }
-
- if ((mpls_outlabelset == 0) && (saddr_ipv4set==0) && (saddr_ipv6set==0)) {
- printf("ERROR: Specify a source IP address\n");
- exit(-1);
- }
-
- if ((mpls_outlabelset == 0) && (daddr_ipv4set==0) && (daddr_ipv6set==0)) {
- printf("ERROR: Specify a destination IP address\n");
- exit(-1);
- }
-
- if ((mpls_outlabelset == 1) && (mpls_inlabelset == 0)) {
- printf("ERROR: Specify an incoming MPLS label\n");
- exit(-1);
- }
-
- if ((mpls_inlabelset == 1) && (mpls_outlabelset == 0)) {
- printf("ERROR: Specify an outgoing MPLS label\n");
- exit(-1);
- }
-
- IAL_NAS_ioctl_init(atoi(inst));
- msgreq = (struct oai_nw_drv_msg_rb_establishment_request *)(gifr.msg);
- msgreq->rab_id = atoi(rb);
- msgreq->lcr = atoi(cx);
- msgreq->qos = 0;
-
- if (action == ADD_RB) {
- gifr.type = OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REQUEST;
- printf("OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REQUEST: RB %d LCR %d QOS %d\n ", msgreq->rab_id, msgreq->lcr, msgreq->qos);
- err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
- }
-
- // only add classification rule
- if ((action == ADD_RB ) || (action == NO_ACTION_RB)) {
- if (saddr_ipv4set == 1) {
- msgreq_class = (struct oai_nw_drv_msg_class_add_request *)(gifr.msg);
- msgreq_class->rab_id = atoi(rb);
- msgreq_class->lcr = atoi(cx);
- msgreq_class->version = 4;
- msgreq_class->classref = atoi(classref) + (msgreq_class->lcr<<8);
- msgreq_class->dir = OAI_NW_DRV_DIRECTION_SEND;
- msgreq_class->fct = OAI_NW_DRV_FCT_QOS_SEND;
- msgreq_class->saddr.ipv4 = saddr_ipv4;
- msgreq_class->daddr.ipv4 = daddr_ipv4;
- msgreq_class->dplen = dplen;
- msgreq_class->splen = splen;
- // TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
- msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
-
- if (dscpset==0) {
- msgreq_class->dscp=0;
- } else {
- msgreq_class->dscp=atoi(dscp);
- }
-
- printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_SEND RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
- printf("IPV4: Source = %d.%d.%d.%d/%d ", NIPADDR(msgreq_class->saddr.ipv4), msgreq_class->splen);
- printf(" IPV4: Dest = %d.%d.%d.%d/%d\n", NIPADDR(msgreq_class->daddr.ipv4), msgreq_class->dplen);
- gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
- err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
- msgreq_class->rab_id = atoi(rb);
- msgreq_class->lcr = atoi(cx);
- msgreq_class->version = 4;
- msgreq_class->classref = atoi(classref) + 1 + (msgreq_class->lcr<<8);
- msgreq_class->dir = OAI_NW_DRV_DIRECTION_RECEIVE;
- msgreq_class->fct = OAI_NW_DRV_FCT_QOS_SEND;
- msgreq_class->daddr.ipv4 = saddr_ipv4;
- msgreq_class->saddr.ipv4 = daddr_ipv4;
- msgreq_class->dplen = splen;
- msgreq_class->splen = dplen;
- printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_RECEIVE RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
- printf("IPV4: Source = %d.%d.%d.%d/%d ", NIPADDR(msgreq_class->saddr.ipv4), msgreq_class->splen);
- printf("IPV4: Dest = %d.%d.%d.%d/%d\n", NIPADDR(msgreq_class->daddr.ipv4), msgreq_class->dplen);
- gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
- err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
- }
-
- if (saddr_ipv6set == 1) {
- msgreq_class = (struct oai_nw_drv_msg_class_add_request *)(gifr.msg);
- msgreq_class->rab_id = atoi(rb);
- msgreq_class->lcr = atoi(cx);
- msgreq_class->version = 6;
- msgreq_class->dplen = dplen;
- msgreq_class->splen = splen;
-
- if (dscpset==0)
- msgreq_class->dscp = 0;
- else
- msgreq_class->dscp = atoi(dscp);
-
- msgreq_class->classref = atoi(classref) + (msgreq_class->lcr<<8);
- msgreq_class->dir = OAI_NW_DRV_DIRECTION_SEND;
- msgreq_class->fct = OAI_NW_DRV_FCT_QOS_SEND;
- // TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
- msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
- memcpy(&msgreq_class->saddr.ipv6,&saddr_ipv6,16);
- memcpy(&msgreq_class->daddr.ipv6,&daddr_ipv6,16);
- printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_SEND RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
- printf("IPV6: Source = %x:%x:%x:%x:%x:%x:%x:%x/%d ", NIP6ADDR(&msgreq_class->saddr.ipv6), msgreq_class->splen);
- printf("IPV6: Dest = %x:%x:%x:%x:%x:%x:%x:%x/%d\n", NIP6ADDR(&msgreq_class->daddr.ipv6), msgreq_class->dplen);
- gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
- err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
- msgreq_class->rab_id = atoi(rb);
- msgreq_class->lcr = atoi(cx);
- msgreq_class->dplen = splen;
- msgreq_class->splen = dplen;
- msgreq_class->classref = atoi(classref) + 1 + (msgreq_class->lcr<<8);
- msgreq_class->dir = OAI_NW_DRV_DIRECTION_RECEIVE;
- memcpy(&msgreq_class->daddr.ipv6,&saddr_ipv6,16);
- memcpy(&msgreq_class->saddr.ipv6,&daddr_ipv6,16);
- printf("OAI_NW_DRV_MSG_CLASS_ADD_REQUEST: OAI_NW_DRV_DIRECTION_RECEIVE RB %d LCR %d ClassRef %d ", msgreq_class->rab_id, msgreq_class->lcr, msgreq_class->classref);
- printf("IPV6: Source = %x:%x:%x:%x:%x:%x:%x:%x/%d ", NIP6ADDR(&msgreq_class->saddr.ipv6), msgreq_class->splen);
- printf("IPV6: Dest = %x:%x:%x:%x:%x:%x:%x:%x/%d\n", NIP6ADDR(&msgreq_class->daddr.ipv6), msgreq_class->dplen);
- gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
- err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
- }
-
- if (mpls_inlabelset == 1) {
- msgreq_class = (struct oai_nw_drv_msg_class_add_request *)(gifr.msg);
- msgreq_class->rab_id = atoi(rb);
- msgreq_class->lcr = atoi(cx);
- msgreq_class->version = OAI_NW_DRV_MPLS_VERSION_CODE;
-
- if (dscpset==0)
- msgreq_class->dscp=0;
- else
- msgreq_class->dscp=atoi(dscp);
-
- msgreq_class->classref = atoi(classref) + (msgreq_class->lcr<<8);
- //msgreq_class->classref = 4 + (msgreq_class->lcr<<3);
- msgreq_class->dir=OAI_NW_DRV_DIRECTION_SEND;
- msgreq_class->fct=OAI_NW_DRV_FCT_QOS_SEND;
- // TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
- msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
- mpls_outlabel = atoi(mpls_outgoinglabel);
- printf("Setting MPLS outlabel %u with exp %d\n",mpls_outlabel,msgreq_class->dscp);
- msgreq_class->daddr.mpls_label = mpls_outlabel;
- gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
- err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
- msgreq_class->rab_id = atoi(rb);
- msgreq_class->lcr = atoi(cx);
- msgreq_class->classref = atoi(classref) + 1 + (msgreq_class->lcr<<8);
- //msgreq_class->classref = 5 + (msgreq_class->lcr<<3);
- msgreq_class->dir=OAI_NW_DRV_DIRECTION_RECEIVE;
- // TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
- msgreq_class->protocol = OAI_NW_DRV_PROTOCOL_DEFAULT;
- mpls_inlabel = atoi(mpls_incominglabel);
- printf("Setting MPLS inlabel %u with exp %d\n",mpls_inlabel,msgreq_class->dscp);
- msgreq_class->daddr.mpls_label = mpls_inlabel;
- gifr.type = OAI_NW_DRV_MSG_CLASS_ADD_REQUEST;
- err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
- }
- } else if (action == DEL_RB) {
- gifr.type = OAI_NW_DRV_MSG_RB_RELEASE_REQUEST;
- err=ioctl(fd, OAI_NW_DRV_IOCTL_RRM, &gifr);
- }
-}
diff --git a/openair2/NETWORK_DRIVER/LITE/classifier.c b/openair2/NETWORK_DRIVER/LITE/classifier.c
deleted file mode 100644
index bc6888279b..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/classifier.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file classifier.c
-* \brief Classify IP packets
-* \author Navid Nikaein, Lionel GAUTHIER, Raymond knopp
-* \company Eurecom
-* \email: navid.nikaein@eurecom.fr, lionel.gauthier@eurecom.fr, knopp@eurecom.fr
-*/
-
-
-#include "local.h"
-#include "proto_extern.h"
-#include
-#include
-#ifdef MPLS
-#include
-#endif
-
-
-#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0)
-#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000)
-#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000)
-#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000)
-#define IN_MULTICAST(a) IN_CLASSD(a)
-#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
-#define IN_BADCLASS(a) IN_EXPERIMENTAL((a))
-/* Address to accept any incoming messages. */
-#define INADDR_ANY ((unsigned long int) 0x00000000)
-/* Address to send to all hosts. */
-#define INADDR_BROADCAST ((unsigned long int) 0xffffffff)
-/* Address indicating an error return. */
-#define INADDR_NONE ((unsigned long int) 0xffffffff)
-
-
-#define NIPADDR(addr) \
- (uint8_t)(addr & 0x000000FF), \
- (uint8_t)((addr & 0x0000FF00) >> 8), \
- (uint8_t)((addr & 0x00FF0000) >> 16), \
- (uint8_t)((addr & 0xFF000000) >> 24)
-
-#define NIP6ADDR(addr) \
- ntohs((addr)->s6_addr16[0]), \
- ntohs((addr)->s6_addr16[1]), \
- ntohs((addr)->s6_addr16[2]), \
- ntohs((addr)->s6_addr16[3]), \
- ntohs((addr)->s6_addr16[4]), \
- ntohs((addr)->s6_addr16[5]), \
- ntohs((addr)->s6_addr16[6]), \
- ntohs((addr)->s6_addr16[7])
-
-
-#define IN6_IS_ADDR_UNSPECIFIED(a) \
- (((__const uint32_t *) (a))[0] == 0 \
- && ((__const uint32_t *) (a))[1] == 0 \
- && ((__const uint32_t *) (a))[2] == 0 \
- && ((__const uint32_t *) (a))[3] == 0)
-
-#define IN6_IS_ADDR_LOOPBACK(a) \
- (((__const uint32_t *) (a))[0] == 0 \
- && ((__const uint32_t *) (a))[1] == 0 \
- && ((__const uint32_t *) (a))[2] == 0 \
- && ((__const uint32_t *) (a))[3] == htonl (1))
-
-#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
-
-#define IN6_IS_ADDR_LINKLOCAL(a) \
- ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
- == htonl (0xfe800000))
-
-#define IN6_IS_ADDR_SITELOCAL(a) \
- ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
- == htonl (0xfec00000))
-
-#define IN6_IS_ADDR_V4MAPPED(a) \
- ((((__const uint32_t *) (a))[0] == 0) \
- && (((__const uint32_t *) (a))[1] == 0) \
- && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
-
-#define IN6_IS_ADDR_V4COMPAT(a) \
- ((((__const uint32_t *) (a))[0] == 0) \
- && (((__const uint32_t *) (a))[1] == 0) \
- && (((__const uint32_t *) (a))[2] == 0) \
- && (ntohl (((__const uint32_t *) (a))[3]) > 1))
-
-#define IN6_ARE_ADDR_EQUAL(a,b) \
- ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0]) \
- && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \
- && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \
- && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
-
-#define IN6_IS_ADDR_MC_NODELOCAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) \
- && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1))
-
-#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) \
- && ((((__const uint8_t *) (a))[1] & 0xf) == 0x2))
-
-#define IN6_IS_ADDR_MC_SITELOCAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) \
- && ((((__const uint8_t *) (a))[1] & 0xf) == 0x5))
-
-#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) \
- && ((((__const uint8_t *) (a))[1] & 0xf) == 0x8))
-
-#define IN6_IS_ADDR_MC_GLOBAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) \
- && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe))
-
-#define IN6_ARE_ADDR_MASKED_EQUAL(a,b,m) \
- (((((__const uint32_t *) (a))[0] & (((__const uint32_t *) (m))[0])) == (((__const uint32_t *) (b))[0] & (((__const uint32_t *) (m))[0]))) \
- && ((((__const uint32_t *) (a))[1] & (((__const uint32_t *) (m))[1])) == (((__const uint32_t *) (b))[1] & (((__const uint32_t *) (m))[1]))) \
- && ((((__const uint32_t *) (a))[2] & (((__const uint32_t *) (m))[2])) == (((__const uint32_t *) (b))[2] & (((__const uint32_t *) (m))[2]))) \
- && ((((__const uint32_t *) (a))[3] & (((__const uint32_t *) (m))[3])) == (((__const uint32_t *) (b))[3] & (((__const uint32_t *) (m))[3]))))
-
-#define IN_ARE_ADDR_MASKED_EQUAL(a,b,m) \
- (((((__const uint8_t *) (a))[0] & (((__const uint8_t *) (m))[0])) == (((__const uint8_t *) (b))[0] & (((__const uint8_t *) (m))[0]))) \
- && ((((__const uint8_t *) (a))[1] & (((__const uint8_t *) (m))[1])) == (((__const uint8_t *) (b))[1] & (((__const uint8_t *) (m))[1]))) \
- && ((((__const uint8_t *) (a))[2] & (((__const uint8_t *) (m))[2])) == (((__const uint8_t *) (b))[2] & (((__const uint8_t *) (m))[2]))) \
- && ((((__const uint8_t *) (a))[3] & (((__const uint8_t *) (m))[3])) == (((__const uint8_t *) (b))[3] & (((__const uint8_t *) (m))[3]))))
-
-
-//---------------------------------------------------------------------------
-// Find the IP traffic type (UNICAST, MULTICAST, BROADCAST)
-ip_traffic_type_t oai_nw_drv_find_traffic_type(struct sk_buff *skb)
-{
- //---------------------------------------------------------------------------
- ip_traffic_type_t traffic_type = TRAFFIC_IPVX_TYPE_UNKNOWN;
-
- if (skb!=NULL) {
- switch (ntohs(skb->protocol)) {
- case ETH_P_IPV6:
- traffic_type = TRAFFIC_IPV6_TYPE_UNKNOWN;
-#ifdef OAI_DRV_DEBUG_CLASS
- printk("SOURCE ADDR %X:%X:%X:%X:%X:%X:%X:%X",NIP6ADDR(&(ipv6_hdr(skb)->saddr)));
- printk(" DEST ADDR %X:%X:%X:%X:%X:%X:%X:%X\n",NIP6ADDR(&(ipv6_hdr(skb)->daddr)));
-#endif
-
- if (IN6_IS_ADDR_MULTICAST(&ipv6_hdr(skb)->daddr.in6_u.u6_addr32[0])) {
- traffic_type = TRAFFIC_IPV6_TYPE_MULTICAST;
-
- } else {
- traffic_type = TRAFFIC_IPV6_TYPE_UNICAST;
- }
-
- break;
-
-
- case ETH_P_IP:
- traffic_type = TRAFFIC_IPV4_TYPE_UNKNOWN;
-
- //print_TOOL_pk_ipv4((struct iphdr *)skb->network_header);
- if (IN_MULTICAST(htonl(ip_hdr(skb)->daddr))) {
- traffic_type = TRAFFIC_IPV4_TYPE_MULTICAST;
- } else {
- traffic_type = TRAFFIC_IPV4_TYPE_UNICAST;
- }
-
- // TO DO BROADCAST
-
- break;
-
- case ETH_P_ARP:
- traffic_type = TRAFFIC_IPV4_TYPE_BROADCAST;
- break;
-
- default:
- ;
- }
- }
-
- return traffic_type;
-}
-
diff --git a/openair2/NETWORK_DRIVER/LITE/common.c b/openair2/NETWORK_DRIVER/LITE/common.c
deleted file mode 100644
index 2ae6f5279d..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/common.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file common.c
-* \brief implementation of emultor tx and rx
-* \author Navid Nikaein, Lionel GAUTHIER, and Raymomd Knopp
-* \date 2011
-* \version 1.0
-* \company Eurecom
-* \email: navid.nikaein@eurecom.fr, lionel.gauthier@eurecom.fr
-*/
-
-#include "local.h"
-#include "proto_extern.h"
-#ifndef OAI_NW_DRIVER_USE_NETLINK
-#include "rtai_fifos.h"
-#endif
-
-
-#include
-#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
-#include
-#endif
-
-#include
-#include
-
-#define NIPADDR(addr) \
- (uint8_t)(addr & 0x000000FF), \
- (uint8_t)((addr & 0x0000FF00) >> 8), \
- (uint8_t)((addr & 0x00FF0000) >> 16), \
- (uint8_t)((addr & 0xFF000000) >> 24)
-
-#define NIP6ADDR(addr) \
- ntohs((addr)->s6_addr16[0]), \
- ntohs((addr)->s6_addr16[1]), \
- ntohs((addr)->s6_addr16[2]), \
- ntohs((addr)->s6_addr16[3]), \
- ntohs((addr)->s6_addr16[4]), \
- ntohs((addr)->s6_addr16[5]), \
- ntohs((addr)->s6_addr16[6]), \
- ntohs((addr)->s6_addr16[7])
-
-
-//#define OAI_DRV_DEBUG_SEND
-//#define OAI_DRV_DEBUG_RECEIVE
-void oai_nw_drv_common_class_wireless2ip(uint16_t dlen,
- void *pdcp_sdu,
- int inst,
- OaiNwDrvRadioBearerId_t rb_id)
-{
-
- //---------------------------------------------------------------------------
- struct sk_buff *skb;
- struct ipversion *ipv;
- struct oai_nw_drv_priv *gpriv=netdev_priv(oai_nw_drv_dev[inst]);
- unsigned int hard_header_len = 0;
- uint16_t *p_ether_type;
- uint16_t ether_type;
-#ifdef OAI_DRV_DEBUG_RECEIVE
- int i;
- unsigned char *addr;
-#endif
- unsigned char protocol;
- struct iphdr *network_header;
-
-#ifdef NAS_ADDRESS_FIX
- uint32_t odaddr,osaddr;
- unsigned char *addr,*daddr,*saddr,*ifaddr;
- uint16_t *cksum,check;
-#endif // NAS_ADDRESS_FIX
-#ifdef OAI_DRV_DEBUG_RECEIVE
- printk("[OAI_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__, rb_id,inst,dlen);
-#endif
-
- skb = dev_alloc_skb( dlen + 2 );
-
- if(!skb) {
- printk("[OAI_IP_DRV][%s] low on memory\n",__FUNCTION__);
- ++gpriv->stats.rx_dropped;
- return;
- }
-
- skb_reserve(skb,2);
- memcpy(skb_put(skb, dlen), pdcp_sdu,dlen);
-
- skb->dev = oai_nw_drv_dev[inst];
- hard_header_len = oai_nw_drv_dev[inst]->hard_header_len;
-
- skb_set_mac_header(skb, 0);
- skb_set_network_header(skb, hard_header_len);
- skb->mark = rb_id;
- skb->pkt_type = PACKET_HOST;
-
-
-#ifdef OAI_DRV_DEBUG_RECEIVE
- printk("[OAI_IP_DRV][%s] Receiving packet @%p of size %d from PDCP \n",__FUNCTION__, skb->data, skb->len);
-
- for (i=0; ilen; i++)
- printk("%2x ",((unsigned char *)(skb->data))[i]);
-
- printk("\n");
-#endif
-
-
-
- // LG TEST skb->ip_summed = CHECKSUM_NONE;
- skb->ip_summed = CHECKSUM_UNNECESSARY;
-
-
- ipv = (struct ipversion *)skb_network_header(skb);
-
- switch (ipv->version) {
-
- case 6:
-#ifdef OAI_DRV_DEBUG_RECEIVE
- printk("[OAI_IP_DRV][%s] receive IPv6 message\n",__FUNCTION__);
-#endif
- skb_set_network_header(skb, hard_header_len);
-
- //skb->network_header = &skb->data[hard_header_len];
- if (hard_header_len == 0) {
- skb->protocol = htons(ETH_P_IPV6);
- } else {
-#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
- skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]);
-#else
-#endif
- }
-
- //printk("Writing packet with protocol %x\n",ntohs(skb->protocol));
- break;
-
- case 4:
-#ifdef NAS_ADDRESS_FIX
- // Make the third byte of both the source and destination equal to the fourth of the destination
- daddr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr;
- odaddr = ((struct iphdr *)skb->data)->daddr;
- //sn = addr[3];
- saddr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr;
- osaddr = ((struct iphdr *)&skb->data[hard_header_len])->saddr;
-
- if (daddr[0] == saddr[0]) {// same network
- daddr[2] = daddr[3]; // set third byte of destination to that of local machine so that local IP stack accepts the packet
- saddr[2] = daddr[3]; // set third byte of source to that of local machine so that local IP stack accepts the packet
- } else { // get the 3rd byte from device address in net_device structure
- ifaddr = (unsigned char *)(&(((struct in_device *)((oai_nw_drv_dev[inst])->ip_ptr))->ifa_list->ifa_local));
-
- if (saddr[0] == ifaddr[0]) { // source is in same network as local machine
- daddr[0] += saddr[3]; // fix address of remote destination to undo change at source
- saddr[2] = ifaddr[2]; // set third byte to that of local machine so that local IP stack accepts the packet
- } else { // source is remote machine from outside network
- saddr[0] -= daddr[3]; // fix address of remote source to be understood by destination
- daddr[2] = daddr[3]; // fix 3rd byte of local address to be understood by IP stack of
- // destination
- }
- }
-
-#endif //NAS_ADDRESS_FIX
-#ifdef OAI_DRV_DEBUG_RECEIVE
- //printk("NAS_TOOL_RECEIVE: receive IPv4 message\n");
- addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr;
-
- if (addr) {
- //addr[2]^=0x01;
- printk("[OAI_IP_DRV][%s] Source %d.%d.%d.%d\n",__FUNCTION__, addr[0],addr[1],addr[2],addr[3]);
- }
-
- addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr;
-
- if (addr) {
- //addr[2]^=0x01;
- printk("[OAI_IP_DRV][%s] Dest %d.%d.%d.%d\n",__FUNCTION__, addr[0],addr[1],addr[2],addr[3]);
- }
-
- printk("[OAI_IP_DRV][%s] protocol %d\n",__FUNCTION__, ((struct iphdr *)&skb->data[hard_header_len])->protocol);
-#endif
-
- skb_set_network_header(skb, hard_header_len);
- //skb->network_header = &skb->data[hard_header_len];
- network_header = (struct iphdr *)skb_network_header(skb);
- protocol = network_header->protocol;
-
-#ifdef OAI_DRV_DEBUG_RECEIVE
-
- switch (protocol) {
- case IPPROTO_IP:
- printk("[OAI_IP_DRV][%s] Received Raw IPv4 packet\n",__FUNCTION__);
- break;
-
- case IPPROTO_IPV6:
- printk("[OAI_IP_DRV][%s] Received Raw IPv6 packet\n",__FUNCTION__);
- break;
-
- case IPPROTO_ICMP:
- printk("[OAI_IP_DRV][%s] Received Raw ICMP packet\n",__FUNCTION__);
- break;
-
- case IPPROTO_TCP:
- printk("[OAI_IP_DRV][%s] Received TCP packet\n",__FUNCTION__);
- break;
-
- case IPPROTO_UDP:
- printk("[OAI_IP_DRV][%s] Received UDP packet\n",__FUNCTION__);
- break;
-
- default:
- break;
- }
-
-#endif
-
-#ifdef NAS_ADDRESS_FIX
- network_header->check = 0;
- network_header->check = ip_fast_csum((unsigned char *) network_header, network_header->ihl);
- //printk("[OAI_IP_DRV][COMMON][RECEIVE] IP Fast Checksum %x \n", network_header->check);
-
- switch(protocol) {
- case IPPROTO_TCP:
-
- cksum = (uint16_t*)&(((struct tcphdr*)((network_header + (network_header->ihl<<2))))->check);
- check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum));
- //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, tcp_hdrlen(skb), IPPROTO_TCP, ~(*cksum));
- //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_TCP, ~(*cksum));
-
- *cksum = csum_tcpudp_magic(~osaddr, ~odaddr, 0, 0, ~check);
- //*cksum = csum_tcpudp_magic(~osaddr, ~odaddr, dlen, IPPROTO_TCP, ~check);
-#ifdef OAI_DRV_DEBUG_RECEIVE
- printk("[OAI_IP_DRV][%s] Inst %d TCP packet calculated CS %x, CS = %x (before), SA (%x)%x, DA (%x)%x\n",__FUNCTION__,
- inst,
- network_header->check,
- *cksum,
- osaddr,
- ((struct iphdr *)skb->data)->saddr,
- odaddr,
- ((struct iphdr *)skb->data)->daddr);
-
- printk("[OAI_IP_DRV][%s] Inst %d TCP packet NEW CS %x\n",__FUNCTION__,
- inst,
- *cksum);
-#endif
- break;
-
- case IPPROTO_UDP:
- cksum = (uint16_t*)&(((struct udphdr*)((network_header + (network_header->ihl<<2))))->check);
- check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, 0,0, ~(*cksum));
- // check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, udp_hdr(skb)->len, IPPROTO_UDP, ~(*cksum));
- //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, dlen, IPPROTO_UDP, ~(*cksum));
-
- *cksum= csum_tcpudp_magic(~osaddr, ~odaddr,0,0, ~check);
- //*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,udp_hdr(skb)->len, IPPROTO_UDP, ~check);
- //*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,dlen, IPPROTO_UDP, ~check);
-
-#ifdef OAI_DRV_DEBUG_RECEIVE
- printk("[OAI_IP_DRV][%s] Inst %d UDP packet CS = %x (before), SA (%x)%x, DA (%x)%x\n",__FUNCTION__,
- inst,*cksum,osaddr,((struct iphdr *)&skb->data[hard_header_len])->saddr,odaddr,((struct iphdr *)&skb->data[hard_header_len])->daddr);
-
- printk("[OAI_IP_DRV][%s] Inst %d UDP packet NEW CS %x\n",__FUNCTION__,inst,*cksum);
-#endif
- //if ((check = *cksum) != 0) {
- // src, dst, len, proto, sum
- // }
- break;
-
- default:
- break;
- }
-
-#endif //NAS_ADDRESS_FIX
-
- if (hard_header_len == 0) {
- skb->protocol = htons(ETH_P_IP);
- } else {
-#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
- skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]);
-#else
-#endif
- }
-
- //printk("[OAI_IP_DRV][COMMON] Writing packet with protocol %x\n",ntohs(skb->protocol));
- break;
-
- default:
- // fill skb->pkt_type, skb->dev
-
- skb->protocol = eth_type_trans(skb, oai_nw_drv_dev[inst]);
- // minus 1(short) instead of 2(bytes) because uint16_t*
- p_ether_type = (uint16_t *)(skb_network_header(skb)-2);
- ether_type = ntohs(*p_ether_type);
-
- switch (ether_type) {
- case ETH_P_ARP:
-#ifdef OAI_DRV_DEBUG_RECEIVE
- printk("[OAI_IP_DRV][%s] ether_type = ETH_P_ARP\n",__FUNCTION__);
-#endif
- //skb->pkt_type = PACKET_HOST;
- skb->protocol = htons(ETH_P_ARP);
- break;
-
- default:
- ;
- }
-
- printk("[OAI_IP_DRV][%s] begin RB %d Inst %d Length %d bytes\n",__FUNCTION__,rb_id,inst,dlen);
- printk("[OAI_IP_DRV][%s] Inst %d: receive unknown message (version=%d)\n",__FUNCTION__,inst,ipv->version);
- }
-
- ++gpriv->stats.rx_packets;
- gpriv->stats.rx_bytes += dlen;
-#ifdef OAI_DRV_DEBUG_RECEIVE
- printk("[OAI_IP_DRV][%s] sending packet of size %d to kernel\n",__FUNCTION__,skb->len);
-
- for (i=0; ilen; i++)
- printk("%2x ",((unsigned char *)(skb->data))[i]);
-
- printk("\n");
-#endif //OAI_DRV_DEBUG_RECEIVE
- netif_rx_ni(skb);
-#ifdef OAI_DRV_DEBUG_RECEIVE
- printk("[OAI_IP_DRV][%s] end\n",__FUNCTION__);
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete the data
-void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst)
-{
- //---------------------------------------------------------------------------
- struct oai_nw_drv_priv *priv=netdev_priv(oai_nw_drv_dev[inst]);
- ++priv->stats.tx_dropped;
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (QoS SAP)
-void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst)
-{
- //---------------------------------------------------------------------------
- struct pdcp_data_req_header_s pdcph;
- struct oai_nw_drv_priv *priv=netdev_priv(oai_nw_drv_dev[inst]);
-#ifdef LOOPBACK_TEST
- int i;
-#endif
-#ifdef OAI_DRV_DEBUG_SEND
- int j;
-#endif
- unsigned int bytes_wrote;
- // Start debug information
-#ifdef OAI_DRV_DEBUG_SEND
- printk("[OAI_IP_DRV][%s] inst %d begin \n",__FUNCTION__,inst);
-#endif
-
- if (skb==NULL) {
-#ifdef OAI_DRV_DEBUG_SEND
- printk("[OAI_IP_DRV][%s] input parameter skb is NULL \n",__FUNCTION__);
-#endif
- return;
- }
-
- pdcph.data_size = skb->len;
- pdcph.rb_id = skb->mark;
- pdcph.inst = inst;
- pdcph.traffic_type = oai_nw_drv_find_traffic_type(skb);
-
-
- bytes_wrote = oai_nw_drv_netlink_send((char *)&pdcph,OAI_NW_DRV_PDCPH_SIZE);
-#ifdef OAI_DRV_DEBUG_SEND
- printk("[OAI_IP_DRV][%s] Wrote %d bytes (header for %d byte skb) to PDCP RB %d via netlink\n",__FUNCTION__,
- bytes_wrote,skb->len, pdcph.rb_id);
-#endif
-
-
- if (bytes_wrote != OAI_NW_DRV_PDCPH_SIZE) {
- printk("[OAI_IP_DRV][%s] problem while writing PDCP's header (bytes wrote = %d to fifo %d)\n",__FUNCTION__,bytes_wrote,IP2PDCP_FIFO);
- printk("rb_id %u, Wrote %u, Header Size %lu \n", pdcph.rb_id , bytes_wrote, OAI_NW_DRV_PDCPH_SIZE);
- priv->stats.tx_dropped ++;
- return;
- }
-
- bytes_wrote += oai_nw_drv_netlink_send((char *)skb->data,skb->len);
-
-
- if (bytes_wrote != skb->len+OAI_NW_DRV_PDCPH_SIZE) {
- printk("[OAI_IP_DRV][%s] Inst %d, RB_ID %u: problem while writing PDCP's data, bytes_wrote = %u, Data_len %u, PDCPH_SIZE %lu\n",
- __FUNCTION__,
- inst,
- pdcph.rb_id,
- bytes_wrote,
- skb->len,
- OAI_NW_DRV_PDCPH_SIZE); // congestion
-
- priv->stats.tx_dropped ++;
- return;
- }
-
-#ifdef OAI_DRV_DEBUG_SEND
- printk("[OAI_IP_DRV][%s] Sending packet of size %d to PDCP traffic type %d\n",__FUNCTION__,skb->len, pdcph.traffic_type);
-
- for (j=0; jlen; j++)
- printk("%2x ",((unsigned char *)(skb->data))[j]);
-
- printk("\n");
-#endif
-
- priv->stats.tx_bytes += skb->len;
- priv->stats.tx_packets ++;
-#ifdef OAI_DRV_DEBUG_SEND
- printk("[OAI_IP_DRV][%s] end \n",__FUNCTION__);
-#endif
-}
-
-
-//---------------------------------------------------------------------------
-void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh)
-{
- //---------------------------------------------------------------------------
-
- struct pdcp_data_ind_header_s *pdcph = (struct pdcp_data_ind_header_s *)NLMSG_DATA(nlh);
- struct oai_nw_drv_priv *priv;
-
- priv = netdev_priv(oai_nw_drv_dev[pdcph->inst]);
-
-#ifdef OAI_DRV_DEBUG_RECEIVE
- printk("[OAI_IP_DRV][%s] QOS receive from PDCP, size %d, rab %d, inst %d\n",__FUNCTION__,
- pdcph->data_size,pdcph->rb_id,pdcph->inst);
-#endif //OAI_DRV_DEBUG_RECEIVE
-
- oai_nw_drv_common_class_wireless2ip(pdcph->data_size,
- (unsigned char *)NLMSG_DATA(nlh) + OAI_NW_DRV_PDCPH_SIZE,
- pdcph->inst,
- pdcph->rb_id);
-}
-
-
diff --git a/openair2/NETWORK_DRIVER/LITE/constant.h b/openair2/NETWORK_DRIVER/LITE/constant.h
deleted file mode 100644
index efeba0b86d..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/constant.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#ifndef _OAI_NW_DRV_CST
-#define _OAI_NW_DRV_CST
-
-#define MAX_MEASURE_NB 5
-#define OAI_NW_DRV_MAX_LENGTH 180
-
-//Debug flags
-//#define OAI_NW_DRV_DEBUG_DC
-#define OAI_NW_DRV_DEBUG_SEND
-#define OAI_NW_DRV_DEBUG_RECEIVE
-//#define OAI_NW_DRV_DEBUG_CLASS
-//#define OAI_NW_DRV_DEBUG_GC
-//#define OAI_NW_DRV_DEBUG_DC_MEASURE
-//#define OAI_NW_DRV_DEBUG_TIMER
-//#define OAI_NW_DRV_DEBUG_DEVICE
-//#define OAI_NW_DRV_DEBUG_INTERRUPT
-//#define OAI_NW_DRV_DEBUG_TOOL
-
-// Other flags
-#define DEMO_3GSM
-
-// General Constants
-#define OAI_NW_DRV_MTU 1500
-#define OAI_NW_DRV_TX_QUEUE_LEN 100
-#define OAI_NW_DRV_ADDR_LEN 8
-#define OAI_NW_DRV_INET6_ADDRSTRLEN 46
-#define OAI_NW_DRV_INET_ADDRSTRLEN 16
-
-#define OAI_NW_DRV_RESET_RX_FLAGS 0
-
-#define OAI_NW_DRV_CX_MAX 32 //Identical to RRC constant
-//#define OAI_NW_DRV_CX_MULTICAST_ALLNODE 2
-
-#define OAI_NW_DRV_RETRY_LIMIT_DEFAULT 5
-
-#define OAI_NW_DRV_MESSAGE_MAXLEN 5004
-
-#define OAI_NW_DRV_SIG_SRB3 3
-#define OAI_NW_DRV_SIG_SRB4 3 // not used yet
-
-//peer-to-peer messages between NAS entities
-#define OAI_NW_DRV_CMD_OPEN_RB 1
-
-//#define OAI_NW_DRV_IID1_CONTROL 0x0
-//#define OAI_NW_DRV_IID2_CONTROL __constant_htonl(0xffffffff)
-
-//#define OAI_NW_DRV_STATE_IDLE 0
-//#define OAI_NW_DRV_STATE_CONNECTED 1
-//#define OAI_NW_DRV_STATE_ESTABLISHMENT_REQUEST 2
-//#define OAI_NW_DRV_STATE_ESTABLISHMENT_FAILURE 3
-//#define OAI_NW_DRV_STATE_RELEASE_FAILURE 4
-#define OAI_NW_DRV_CX_RELEASE_UNDEF_CAUSE 1
-
-// MT+RG NAS States
-#define OAI_NW_DRV_IDLE 0x01
-// Connection
-#define OAI_NW_DRV_CX_FACH 0x06
-#define OAI_NW_DRV_CX_DCH 0x0A
-#define OAI_NW_DRV_CX_RECEIVED 0x10
-#define OAI_NW_DRV_CX_CONNECTING 0x04
-#define OAI_NW_DRV_CX_RELEASING 0x08
-#define OAI_NW_DRV_CX_CONNECTING_FAILURE 0x14
-#define OAI_NW_DRV_CX_RELEASING_FAILURE 0x18
-// Radio Bearers
-#define OAI_NW_DRV_RB_ESTABLISHING 0x24
-#define OAI_NW_DRV_RB_RELEASING 0x28
-#define OAI_NW_DRV_RB_DCH 0x2A
-
-
-#define OAI_NW_DRV_TIMER_ESTABLISHMENT_DEFAULT 12
-#define OAI_NW_DRV_TIMER_RELEASE_DEFAULT 2
-#define OAI_NW_DRV_TIMER_IDLE UINT_MAX
-#define OAI_NW_DRV_TIMER_TICK HZ
-
-#define OAI_NW_DRV_PDCPH_SIZE sizeof(struct pdcp_data_req_header_s)
-#define OAI_NW_DRV_IPV4_SIZE 20
-#define OAI_NW_DRV_IPV6_SIZE 40
-
-#define OAI_NW_DRV_DIRECTION_SEND 0
-#define OAI_NW_DRV_DIRECTION_RECEIVE 1
-#define OAI_NW_DRV_DIRECTION_FORWARD 2
-
-// function number
-#define OAI_NW_DRV_FCT_DEL_SEND 1
-#define OAI_NW_DRV_FCT_QOS_SEND 2
-#define OAI_NW_DRV_FCT_DC_SEND 3
-#define OAI_NW_DRV_FCT_CTL_SEND 4
-
-// type of IOCTL command
-#define OAI_NW_DRV_IOCTL_RRM 0x89F0
-
-// Error cause
-#define OAI_NW_DRV_ERROR_ALREADYEXIST 1
-#define OAI_NW_DRV_ERROR_NOMEMORY 3
-#define OAI_NW_DRV_ERROR_NOTMT 9
-#define OAI_NW_DRV_ERROR_NOTRG 10
-#define OAI_NW_DRV_ERROR_NOTIDLE 11
-#define OAI_NW_DRV_ERROR_NOTCONNECTED 12
-#define OAI_NW_DRV_ERROR_NORB 14
-#define OAI_NW_DRV_ERROR_NOTCORRECTVALUE 32
-#define OAI_NW_DRV_ERROR_NOTCORRECTLCR 33
-#define OAI_NW_DRV_ERROR_NOTCORRECTDIR 34
-#define OAI_NW_DRV_ERROR_NOTCORRECTDSCP 35
-#define OAI_NW_DRV_ERROR_NOTCORRECTVERSION 36
-#define OAI_NW_DRV_ERROR_NOTCORRECTRABI 37
-
-
-/**********************************************************/
-/* Constants related with IP protocols */
-/**********************************************************/
-
-//#define OAI_NW_DRV_PORT_CONTROL __constant_htons(0xc45)
-//#define OAI_NW_DRV_PORT_AUTHENTICATION __constant_htons(1811)
-
-#define OAI_NW_DRV_TRAFFICCLASS_MASK __constant_htonl(0x0fc00000)
-
-// Network control codepoint 111000 + IP version 6
-#define OAI_NW_DRV_FLOWINFO_NCONTROL __constant_htonl(0x6e000000)
-// network control codepoint 111000
-#define OAI_NW_DRV_DSCP_NCONTROL 56 //0x38
-// default codepoint 1000000
-#define OAI_NW_DRV_DSCP_DEFAULT 64
-#define OAI_NW_DRV_DSCP_MAX 193
-
-#define OAI_NW_DRV_PROTOCOL_DEFAULT 0
-#define OAI_NW_DRV_PROTOCOL_TCP IPPROTO_TCP
-#define OAI_NW_DRV_PROTOCOL_UDP IPPROTO_UDP
-#define OAI_NW_DRV_PROTOCOL_ICMP4 IPPROTO_ICMP
-#define OAI_NW_DRV_PROTOCOL_ICMP6 IPPROTO_ICMPV6
-//#warning "OAI_NW_DRV_PROTOCOL_ARP value 200 may collide with new defined values in kernel"
-#define OAI_NW_DRV_PROTOCOL_ARP 200
-
-#define OAI_NW_DRV_PORT_DEFAULT __constant_htons(65535)
-#define OAI_NW_DRV_PORT_HTTP __constant_htons(80)
-
-#define OAI_NW_DRV_IP_VERSION_ALL 0
-#define OAI_NW_DRV_IP_VERSION_4 4
-#define OAI_NW_DRV_IP_VERSION_6 6
-
-#define OAI_NW_DRV_DEFAULT_IPV4_ADDR 0
-#define OAI_NW_DRV_DEFAULT_IPV6_ADDR0 0
-#define OAI_NW_DRV_DEFAULT_IPV6_ADDR1 0
-#define OAI_NW_DRV_DEFAULT_IPV6_ADDR2 0
-#define OAI_NW_DRV_DEFAULT_IPV6_ADDR3 0
-
-
-#define OAI_NW_DRV_MPLS_VERSION_CODE 99
-
-#define OAI_NW_DRV_NB_INSTANCES_MAX 8
-
-
-#endif
-
diff --git a/openair2/NETWORK_DRIVER/LITE/device.c b/openair2/NETWORK_DRIVER/LITE/device.c
deleted file mode 100644
index 59340784c1..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/device.c
+++ /dev/null
@@ -1,635 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file device.c
-* \brief Networking Device Driver for OpenAirInterface Ethernet
-* \author navid.nikaein, Lionel Gauthier, raymond.knopp,
-* \company Eurecom
-* \email:navid.nikaein@eurecom.fr, lionel.gauthier@eurecom.fr, raymond.knopp@eurecom.fr
-
-*/
-/*******************************************************************************/
-
-#include "constant.h"
-#include "local.h"
-#include "proto_extern.h"
-
-//#include
-#include
-#include
-#include
-#include
-#include
-#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
-#include
-#endif
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
-#include
-#endif
-
-
-struct net_device *oai_nw_drv_dev[OAI_NW_DRV_NB_INSTANCES_MAX];
-
-#ifdef OAI_NW_DRIVER_USE_NETLINK
-extern void oai_nw_drv_netlink_release(void);
-extern int oai_nw_drv_netlink_init(void);
-#endif
-
-uint8_t NULL_IMEI[14]= {0x05, 0x04, 0x03, 0x01, 0x02 ,0x00, 0x00, 0x00, 0x05, 0x04, 0x03 ,0x00, 0x01, 0x08};
-
-static unsigned char oai_nw_drv_IMEI[14];
-static int m_arg=0;
-static unsigned int oai_nw_drv_is_clusterhead=0;
-//---------------------------------------------------------------------------
-int oai_nw_drv_find_inst(struct net_device *dev)
-{
- //---------------------------------------------------------------------------
- int i;
-
- for (i=0; ilock = SPIN_LOCK_UNLOCKED;
-
-#ifdef OAI_DRV_DEBUG_INTERRUPT
- printk("INTERRUPT - begin\n");
-#endif
- // spin_lock_irqsave(&priv->lock,flags);
- cxi=0;
- // mesh_GC_receive();
- // mesh_DC_receive(naspriv->cx+cxi);
-#ifndef OAI_NW_DRIVER_USE_NETLINK
- oai_nw_drv_common_wireless2ip();
-#endif
- // spin_unlock_irqrestore(&priv->lock,flags);
-#ifdef OAI_DRV_DEBUG_INTERRUPT
- printk("INTERRUPT: end\n");
-#endif
- // return 0;
-}
-#endif //NETLINK
-//---------------------------------------------------------------------------
-void oai_nw_drv_timer(unsigned long data)
-{
- //---------------------------------------------------------------------------
- struct oai_nw_drv_priv *priv=(struct oai_nw_drv_priv *)data;
- spin_lock(&priv->lock);
- (priv->timer).function=oai_nw_drv_timer;
- (priv->timer).expires=jiffies+OAI_NW_DRV_TIMER_TICK;
- (priv->timer).data=data;
- add_timer(&priv->timer);
- spin_unlock(&priv->lock);
- return;
- // add_timer(&gpriv->timer);
- // spin_unlock(&gpriv->lock);
-}
-
-//---------------------------------------------------------------------------
-// Called by ifconfig when the device is activated by ifconfig
-int oai_nw_drv_open(struct net_device *dev)
-{
- //---------------------------------------------------------------------------
- struct oai_nw_drv_priv *priv=netdev_priv(dev);
-
- // Address has already been set at init
-#ifndef OAI_NW_DRIVER_USE_NETLINK
-
- if (pdcp_2_oai_nw_drv_irq==-EBUSY) {
- printk("[OAI_IP_DRV][%s] : irq failure\n", __FUNCTION__);
- return -EBUSY;
- }
-
-#endif //OAI_NW_DRIVER_USE_NETLINK
-
- if(!netif_queue_stopped(dev))
- netif_start_queue(dev);
- else
- netif_wake_queue(dev);
-
- init_timer(&priv->timer);
- (priv->timer).expires = jiffies+OAI_NW_DRV_TIMER_TICK;
- (priv->timer).data = (unsigned long)priv;
- (priv->timer).function = oai_nw_drv_timer;
- //add_timer(&priv->timer);
-
- printk("[OAI_IP_DRV][%s] name = %s\n", __FUNCTION__, dev->name);
- return 0;
-}
-
-//---------------------------------------------------------------------------
-// Called by ifconfig when the device is desactivated
-int oai_nw_drv_stop(struct net_device *dev)
-{
- //---------------------------------------------------------------------------
- struct oai_nw_drv_priv *priv = netdev_priv(dev);
-
- printk("[OAI_IP_DRV][%s] Begin\n", __FUNCTION__);
- del_timer(&(priv->timer));
- netif_stop_queue(dev);
- // MOD_DEC_USE_COUNT;
- printk("[OAI_IP_DRV][%s] End\n", __FUNCTION__);
- return 0;
-}
-
-//---------------------------------------------------------------------------
-void oai_nw_drv_teardown(struct net_device *dev)
-{
- //---------------------------------------------------------------------------
- struct oai_nw_drv_priv *priv;
- int inst;
-
- printk("[OAI_IP_DRV][%s] Begin\n", __FUNCTION__);
-
- if (dev) {
- priv = netdev_priv(dev);
- inst = oai_nw_drv_find_inst(dev);
-
- if ((inst<0) || (inst>=OAI_NW_DRV_NB_INSTANCES_MAX)) {
- printk("[OAI_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__);
- return;
- }
-
- /*oai_nw_drv_class_flush_recv_classifier(priv);
-
- for (cxi=0;cxicx+cxi);
- oai_nw_drv_class_flush_send_classifier(priv->cx+cxi);
- }*/
- printk("[OAI_IP_DRV][%s] End\n", __FUNCTION__);
- } // check dev
- else {
- printk("[OAI_IP_DRV][%s] Device is null\n", __FUNCTION__);
- }
-}
-//---------------------------------------------------------------------------
-int oai_nw_drv_set_config(struct net_device *dev, struct ifmap *map)
-{
- //---------------------------------------------------------------------------
- printk("[OAI_IP_DRV][%s] Begin\n", __FUNCTION__);
-
- if (dev->flags & IFF_UP)
- return -EBUSY;
-
- if (map->base_addr != dev->base_addr) {
- printk(KERN_WARNING "[OAI_IP_DRV][%s] Can't change I/O address\n", __FUNCTION__);
- return -EOPNOTSUPP;
- }
-
- if (map->irq != dev->irq)
- dev->irq = map->irq;
-
- printk("[OAI_IP_DRV][%s] End\n", __FUNCTION__);
- return 0;
-}
-
-//---------------------------------------------------------------------------
-//
-int oai_nw_drv_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
-{
- //---------------------------------------------------------------------------
- int inst;
-
- if (dev) {
- inst = oai_nw_drv_find_inst(dev);
- } else {
- printk("[OAI_IP_DRV][%s] ERROR, device is null\n", __FUNCTION__);
- return -1;
- }
-
- if ((inst>=0) && (inst= KERNEL_VERSION(4,7,0)
- netif_trans_update(dev);
-#else
- dev->trans_start = jiffies;
-#endif
-#ifdef OAI_DRV_DEBUG_DEVICE
- printk("[OAI_IP_DRV][%s] step 1\n", __FUNCTION__);
-#endif
- oai_nw_drv_common_ip2wireless(skb,inst);
-#ifdef OAI_DRV_DEBUG_DEVICE
- printk("[OAI_IP_DRV][%s] step 2\n", __FUNCTION__);
-#endif
- dev_kfree_skb(skb);
-#ifdef OAI_DRV_DEBUG_DEVICE
- printk("[OAI_IP_DRV][%s] step 3\n", __FUNCTION__);
-#endif
- netif_wake_queue(dev);
-#ifdef OAI_DRV_DEBUG_DEVICE
- printk("[OAI_IP_DRV][%s] end\n", __FUNCTION__);
-#endif
- } else {
- printk("[OAI_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__);
- return(-1);
- }
-
- return 0;
-}
-
-//---------------------------------------------------------------------------
-struct net_device_stats *oai_nw_drv_get_stats(struct net_device *dev)
-{
- //---------------------------------------------------------------------------
- // return &((struct oai_nw_drv_priv *)dev->priv)->stats;
- struct oai_nw_drv_priv *priv = netdev_priv(dev);
- //printk("[OAI_IP_DRV][%s]\n", __FUNCTION__);
- return &priv->stats;
-}
-//---------------------------------------------------------------------------
-int oai_nw_drv_set_mac_address(struct net_device *dev, void *mac)
-{
- //---------------------------------------------------------------------------
- struct sockaddr *addr = mac;
- printk("[OAI_IP_DRV][%s] CHANGE MAC ADDRESS\n", __FUNCTION__);
- memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
- return 0;
-}
-//---------------------------------------------------------------------------
-int oai_nw_drv_change_mtu(struct net_device *dev, int mtu)
-{
- //---------------------------------------------------------------------------
- printk("[OAI_IP_DRV][%s] CHANGE MTU %d bytes\n", __FUNCTION__, mtu);
-
- if ((mtu<50) || (mtu>1500))
- return -EINVAL;
-
- dev->mtu = mtu;
- return 0;
-}
-//---------------------------------------------------------------------------
-void oai_nw_drv_change_rx_flags(struct net_device *dev, int flags)
-{
- //---------------------------------------------------------------------------
- struct oai_nw_drv_priv *priv = netdev_priv(dev);
- printk("[OAI_IP_DRV][%s] CHANGE RX FLAGS %08X\n", __FUNCTION__, flags);
- priv->rx_flags ^= flags;
-}
-
-//---------------------------------------------------------------------------
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
-void oai_nw_drv_tx_timeout(struct net_device *dev, unsigned int txqueue)
-#else
-void oai_nw_drv_tx_timeout(struct net_device *dev)
-#endif
-{
- //---------------------------------------------------------------------------
- // Transmitter timeout, serious problems.
- struct oai_nw_drv_priv *priv = netdev_priv(dev);
-
- printk("[OAI_IP_DRV][%s] begin\n", __FUNCTION__);
- // (struct oai_nw_drv_priv *)(dev->priv)->stats.tx_errors++;
- (priv->stats).tx_errors++;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
- netif_trans_update(dev);
-#else
- dev->trans_start = jiffies;
-#endif
- netif_wake_queue(dev);
- printk("[OAI_IP_DRV][%s] transmit timed out %s\n", __FUNCTION__,dev->name);
-}
-
-static const struct net_device_ops nasmesh_netdev_ops = {
- .ndo_open = oai_nw_drv_open,
- .ndo_stop = oai_nw_drv_stop,
- .ndo_start_xmit = oai_nw_drv_hard_start_xmit,
- .ndo_validate_addr = NULL,
- .ndo_get_stats = oai_nw_drv_get_stats,
- .ndo_set_mac_address = oai_nw_drv_set_mac_address,
- .ndo_set_config = oai_nw_drv_set_config,
- .ndo_do_ioctl = oai_nw_drv_CTL_ioctl,
- .ndo_change_mtu = oai_nw_drv_change_mtu,
- .ndo_tx_timeout = oai_nw_drv_tx_timeout,
- .ndo_change_rx_flags = oai_nw_drv_change_rx_flags,
-};
-/*.ndo_set_multicast_list = NULL,*/
-
-//---------------------------------------------------------------------------
-// Initialisation of the network device
-void oai_nw_drv_init(struct net_device *dev)
-{
- //---------------------------------------------------------------------------
- uint8_t cxi;
- struct oai_nw_drv_priv *priv;
- int index;
-
- if (dev) {
-
- priv = netdev_priv(dev);
-
- memset(priv, 0, sizeof(struct oai_nw_drv_priv));
-
-
-#ifndef OAI_NW_DRIVER_TYPE_ETHERNET
- dev->type = ARPHRD_EURECOM_LTE;
- dev->features = NETIF_F_NO_CSUM;
- dev->hard_header_len = 0;
- dev->addr_len = ETH_ALEN; // 6
- dev->flags = IFF_BROADCAST | IFF_MULTICAST | IFF_NOARP;
- dev->tx_queue_len = NAS_TX_QUEUE_LEN;
- dev->mtu = NAS_MTU;
-#endif
- // Can be one of the following enum defined in include/linux/netdevice.h:
- // enum netdev_state_t {
- // __LINK_STATE_START,
- // __LINK_STATE_PRESENT,
- // __LINK_STATE_NOCARRIER,
- // __LINK_STATE_LINKWATCH_PENDING,
- // __LINK_STATE_DORMANT,
- // };
- set_bit(__LINK_STATE_PRESENT, &dev->state);
-
- //
- dev->netdev_ops = &nasmesh_netdev_ops;
-#ifdef OAI_NW_DRIVER_TYPE_ETHERNET
- printk("[OAI_IP_DRV][%s] Driver type ETHERNET\n", __FUNCTION__);
- // Memo: linux-source-3.2.0/net/ethernet/eth.c:
- //334 void ether_setup(struct net_device *dev)
- //335 {
- //336 dev->header_ops = ð_header_ops;
- //337 dev->type = ARPHRD_ETHER;
- //338 dev->hard_header_len = ETH_HLEN;
- //339 dev->mtu = ETH_DATA_LEN;
- //340 dev->addr_len = ETH_ALEN;
- //341 dev->tx_queue_len = 1000; /* Ethernet wants good queues */
- //342 dev->flags = IFF_BROADCAST|IFF_MULTICAST;
- //343 dev->priv_flags |= IFF_TX_SKB_SHARING;
- //344
- //345 memset(dev->broadcast, 0xFF, ETH_ALEN);
- //346 }
- ether_setup(dev);
-#endif
- //
- // Initialize private structure
- priv->rx_flags = OAI_NW_DRV_RESET_RX_FLAGS;
- priv->sap[OAI_NW_DRV_RAB_INPUT_SAPI] = PDCP2IP_FIFO;//QOS_DEVICE_CONVERSATIONAL_INPUT;
- priv->sap[OAI_NW_DRV_RAB_OUTPUT_SAPI] = IP2PDCP_FIFO;//QOS_DEVICE_STREAMING_INPUT;
-
- // priv->retry_limit=RETRY_LIMIT_DEFAULT;
- // priv->timer_establishment=TIMER_ESTABLISHMENT_DEFAULT;
- // priv->timer_release=TIMER_RELEASE_DEFAULT;
-
- /*for (dscpi=0; dscpirclassifier[dscpi]=NULL;
- }
- priv->nrclassifier=0;*/
- //
- for (cxi=0; cxicx[cxi].sap[NAS_DC_INPUT_SAPI] = RRC_DEVICE_DC_INPUT0;
- // priv->cx[cxi].sap[NAS_DC_OUTPUT_SAPI] = RRC_DEVICE_DC_OUTPUT0;
- priv->cx[cxi].state = OAI_NW_DRV_IDLE;
- priv->cx[cxi].countimer = OAI_NW_DRV_TIMER_IDLE;
- priv->cx[cxi].retry = 0;
- priv->cx[cxi].lcr = cxi;
- /*priv->cx[cxi].rb = NULL;
- priv->cx[cxi].num_rb = 0;
- // initialisation of the classifier
- for (dscpi=0; dscpi<65; ++dscpi) {
- priv->cx[cxi].sclassifier[dscpi] = NULL;
- priv->cx[cxi].fclassifier[dscpi] = NULL;
- }
-
- priv->cx[cxi].nsclassifier=0;
- priv->cx[cxi].nfclassifier=0;
- */
- // initialisation of the IP address
- oai_nw_drv_TOOL_eNB_imei2iid(oai_nw_drv_IMEI, (uint8_t *)priv->cx[cxi].iid6, dev->addr_len);
- priv->cx[cxi].iid4=0;
- //
- }
-
- spin_lock_init(&priv->lock);
- //this requires kernel patch for OAI driver: typically for RF/hard realtime emu experimentation
-#define ADDRCONF
-#ifdef ADDRCONF
-
-#ifdef OAI_NW_DRIVER_USE_NETLINK
- oai_nw_drv_TOOL_eNB_imei2iid(oai_nw_drv_IMEI, dev->dev_addr, dev->addr_len);// IMEI to device address (for stateless autoconfiguration address)
-
- oai_nw_drv_TOOL_eNB_imei2iid(oai_nw_drv_IMEI, (uint8_t *)priv->cx[0].iid6, dev->addr_len);
-#else
- oai_nw_drv_TOOL_imei2iid(oai_nw_drv_IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address)
- oai_nw_drv_TOOL_imei2iid(oai_nw_drv_IMEI, (uint8_t *)priv->cx[0].iid6);
-#endif
- // this is more appropriate for user space soft realtime emulation
-#else
-
- // LG: strange
- for (index = 0; index < dev->addr_len; index++) {
- dev->dev_addr[index] = 16*oai_nw_drv_IMEI[index]+oai_nw_drv_IMEI[index+1]);
- }
-
- memcpy((uint8_t *)priv->cx[0].iid6,&oai_nw_drv_IMEI[0],dev->addr_len);
-
- printk("INIT: init IMEI to IID\n");
-#endif
- printk("[OAI_IP_DRV][%s] Setting HW addr to : ", __FUNCTION__);
-
- for (index = 0; index < dev->addr_len; index++) {
- printk("%02X", dev->dev_addr[index]);
- }
-
- printk("\n[OAI_IP_DRV][%s] Setting priv->cx to : ", __FUNCTION__);
-
- for (index = 0; index < 8; index++) {
- printk("%02X", ((uint8_t *)(priv->cx[0].iid6))[index]);
- }
-
- printk("\n");
- printk("[OAI_IP_DRV][%s] INIT: end\n", __FUNCTION__);
- return;
- } else {
- printk("[OAI_IP_DRV][%s] ERROR, Device is NULL!!\n", __FUNCTION__);
- return;
- }
-}
-//---------------------------------------------------------------------------
-int init_module (void)
-{
- //---------------------------------------------------------------------------
- int err,inst, index;
- struct oai_nw_drv_priv *priv;
- char devicename[100];
-
-
- // Initialize parameters shared with RRC
- printk("[OAI_IP_DRV][%s] Starting NASMESH, number of IMEI parameters %d, IMEI ", __FUNCTION__, m_arg);
-
- for (index = 0; index < m_arg; index++) {
- printk("%02X", oai_nw_drv_IMEI[index]);
- }
-
- printk("\n");
-
-#ifndef OAI_NW_DRIVER_USE_NETLINK
-
- if (pdcp_2_oai_nw_drv_irq == -EBUSY || pdcp_2_oai_nw_drv_irq == -EINVAL) {
- printk("[OAI_IP_DRV][%s] No interrupt resource available\n", __FUNCTION__);
- return -EBUSY;
- } else
- printk("[OAI_IP_DRV][%s] Interrupt %d\n", __FUNCTION__, pdcp_2_oai_nw_drv_irq);
-
-#endif //NETLINK
-
- for (inst=0; inst 0x0F) {
- oai_nw_drv_IMEI[8] = oai_nw_drv_IMEI[9] >> 4;
- oai_nw_drv_IMEI[9] = oai_nw_drv_IMEI[9] & 0x0F;
- }
- }
-
- // linux/net/core/dev.c line 4767
- err= register_netdev(oai_nw_drv_dev[inst]);
-
- if (err) {
- printk("[OAI_IP_DRV][%s] (inst %d): error %i registering device %s\n", __FUNCTION__, inst,err, oai_nw_drv_dev[inst]->name);
- } else {
- printk("[OAI_IP_DRV][%s] registering device %s, ifindex = %d\n\n", __FUNCTION__,oai_nw_drv_dev[inst]->name, oai_nw_drv_dev[inst]->ifindex);
- }
- }
- }
-
-#ifdef OAI_NW_DRIVER_USE_NETLINK
- printk("[OAI_IP_DRV][%s] NETLINK INIT\n", __FUNCTION__);
-
- if ((err=oai_nw_drv_netlink_init()) == -1)
- printk("[OAI_IP_DRV][%s] NETLINK failed\n", __FUNCTION__);
-
-#endif //NETLINK
-
- return err;
-
-}
-
-//---------------------------------------------------------------------------
-void cleanup_module(void)
-{
- //---------------------------------------------------------------------------
- int inst;
-
- printk("[OAI_IP_DRV][CLEANUP]nasmesh_cleanup_module: begin\n");
-
-#ifndef OAI_NW_DRIVER_USE_NETLINK
-
- if (pdcp_2_oai_nw_drv_irq!=-EBUSY) {
- pdcp_2_oai_nw_drv_irq=0;
- // Start IRQ linux
- //free_irq(priv->irq, NULL);
- // End IRQ linux
- }
-
-#else // NETLINK
-#endif //NETLINK
-
- for (inst=0; inst"DRV_COPYRIGHT
-
-
-module_param_array_named(oai_nw_drv_IMEI,oai_nw_drv_IMEI,byte,&m_arg,0);
-//module_param_array(oai_nw_drv_IMEI,byte,&m_arg,0444);
-MODULE_PARM_DESC(oai_nw_drv_IMEI,"The IMEI Hardware address (64-bit, decimal nibbles)");
-
-//module_param(oai_nw_drv_is_clusterhead,uint,0444);
-module_param_named(oai_nw_drv_is_clusterhead,oai_nw_drv_is_clusterhead,uint,0444);
-MODULE_PARM_DESC(oai_nw_drv_is_clusterhead,"The Clusterhead Indicator");
-
-//MODULE_AUTHOR(DRV_AUTHOR);
-//MODULE_DESCRIPTION(DRV_DESCRIPTION);
-//MODULE_LICENSE("GPL");
-//MODULE_VERSION(DRV_VERSION);
-
diff --git a/openair2/NETWORK_DRIVER/LITE/ioctl.c b/openair2/NETWORK_DRIVER/LITE/ioctl.c
deleted file mode 100644
index 85c213c5ff..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/ioctl.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#include "local.h"
-#include "ioctl.h"
-#include "proto_extern.h"
-
-#include
-#include
-#include
-
-#define NIP6ADDR(addr) \
- ntohs((addr)->s6_addr16[0]), \
- ntohs((addr)->s6_addr16[1]), \
- ntohs((addr)->s6_addr16[2]), \
- ntohs((addr)->s6_addr16[3]), \
- ntohs((addr)->s6_addr16[4]), \
- ntohs((addr)->s6_addr16[5]), \
- ntohs((addr)->s6_addr16[6]), \
- ntohs((addr)->s6_addr16[7])
-
-uint8_t g_msgrep[OAI_NW_DRV_LIST_CLASS_MAX*sizeof(struct oai_nw_drv_msg_class_list_reply)+1];
-
-// Statistic
-//---------------------------------------------------------------------------
-void oai_nw_drv_set_msg_statistic_reply(struct oai_nw_drv_msg_statistic_reply *msgrep,
- struct oai_nw_drv_priv *priv)
-{
- //---------------------------------------------------------------------------
- msgrep->rx_packets=priv->stats.rx_packets;
- msgrep->tx_packets=priv->stats.tx_packets;
- msgrep->rx_bytes=priv->stats.rx_bytes;
- msgrep->tx_bytes=priv->stats.tx_bytes;
- msgrep->rx_errors=priv->stats.rx_errors;
- msgrep->tx_errors=priv->stats.tx_errors;
- msgrep->rx_dropped=priv->stats.rx_dropped;
- msgrep->tx_dropped=priv->stats.tx_dropped;
-}
-
-//---------------------------------------------------------------------------
-int oai_nw_drv_ioCTL_statistic_request(struct oai_nw_drv_ioctl *gifr,
- struct oai_nw_drv_priv *priv)
-{
- //---------------------------------------------------------------------------
- struct oai_nw_drv_msg_statistic_reply msgrep;
- printk("NAS_IOCTL_STATISTIC: stat requested\n");
- oai_nw_drv_set_msg_statistic_reply(&msgrep,priv);
-
- if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
- printk("NAS_IOCTL_STATISTIC: copy_to_user failure\n");
- return -EFAULT;
- }
-
- return 0;
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// IMEI
-// Messages for IMEI transfer
-
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// IOCTL command
-//---------------------------------------------------------------------------
-int oai_nw_drv_CTL_ioctl(struct net_device *dev,
- struct ifreq *ifr,
- int cmd)
-{
- //---------------------------------------------------------------------------
- struct oai_nw_drv_ioctl *gifr;
- struct oai_nw_drv_priv *priv=netdev_priv(dev);
-
- int r;
-
- // printk("NAS_CTL_IOCTL: begin ioctl for instance %d\n",find_inst(dev));
-
- switch(cmd) {
- case OAI_NW_DRV_IOCTL_RRM:
- gifr=(struct oai_nw_drv_ioctl *)ifr;
-
- switch(gifr->type) {
- case OAI_NW_DRV_MSG_STATISTIC_REQUEST:
- r=oai_nw_drv_ioCTL_statistic_request(gifr,priv);
- break;
-
-
- default:
- // printk("NAS_IOCTL_RRM: unkwon request type, type=%x\n", gifr->type);
- r=-EFAULT;
- }
-
- break;
-
- default:
- // printk("NAS_CTL_IOCTL: Unknown ioctl command, cmd=%x\n", cmd);
- r=-EFAULT;
- }
-
- // printk("NAS_CTL_IOCTL: end\n");
- return r;
-}
-
-//---------------------------------------------------------------------------
-void oai_nw_drv_CTL_send(struct sk_buff *skb, int inst)
-{
- //---------------------------------------------------------------------------
- printk("NAS_CTL_SEND - void \n");
-}
diff --git a/openair2/NETWORK_DRIVER/LITE/ioctl.h b/openair2/NETWORK_DRIVER/LITE/ioctl.h
deleted file mode 100644
index d5bab2038c..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/ioctl.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/***************************************************************************
- ioctl.h - description
- -------------------
- copyright : (C) 2002 by Eurecom
- email : michelle.wetterwald@eurecom.fr
- yan.moret@eurecom.fr
- knopp@eurecom.fr
- ***************************************************************************
-
- ***************************************************************************/
-#ifndef OAI_IOCTL_H
-#define OAI_IOCTL_H
-
-#include
-#include
-#include
-#include
-#include
-
-#include "sap.h"
-
-
-//#include
-
-#define OAI_NW_DRV_MSG_MAXLEN 1100/// change???
-
-// type of CTL message
-#define OAI_NW_DRV_MSG_STATISTIC_REQUEST 1
-#define OAI_NW_DRV_MSG_STATISTIC_REPLY 2
-#define OAI_NW_DRV_MSG_ECHO_REQUEST 3
-#define OAI_NW_DRV_MSG_ECHO_REPLY 4
-#define OAI_NW_DRV_MSG_CX_ESTABLISHMENT_REQUEST 5
-#define OAI_NW_DRV_MSG_CX_ESTABLISHMENT_REPLY 6
-#define OAI_NW_DRV_MSG_CX_RELEASE_REQUEST 7
-#define OAI_NW_DRV_MSG_CX_RELEASE_REPLY 8
-#define OAI_NW_DRV_MSG_CX_LIST_REQUEST 9
-#define OAI_NW_DRV_MSG_CX_LIST_REPLY 10
-#define OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REQUEST 11
-#define OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REPLY 12
-#define OAI_NW_DRV_MSG_RB_RELEASE_REQUEST 13
-#define OAI_NW_DRV_MSG_RB_RELEASE_REPLY 14
-#define OAI_NW_DRV_MSG_RB_LIST_REQUEST 15
-#define OAI_NW_DRV_MSG_RB_LIST_REPLY 16
-#define OAI_NW_DRV_MSG_CLASS_ADD_REQUEST 17
-#define OAI_NW_DRV_MSG_CLASS_ADD_REPLY 18
-#define OAI_NW_DRV_MSG_CLASS_DEL_REQUEST 19
-#define OAI_NW_DRV_MSG_CLASS_DEL_REPLY 20
-#define OAI_NW_DRV_MSG_CLASS_LIST_REQUEST 21
-#define OAI_NW_DRV_MSG_CLASS_LIST_REPLY 22
-#define OAI_NW_DRV_MSG_MEAS_REQUEST 23
-#define OAI_NW_DRV_MSG_MEAS_REPLY 24
-#define OAI_NW_DRV_MSG_IMEI_REQUEST 25
-#define OAI_NW_DRV_MSG_IMEI_REPLY 26
-
-// Max number of entry of a message list
-#define OAI_NW_DRV_LIST_CX_MAX 32
-#define OAI_NW_DRV_LIST_RB_MAX 32
-#define OAI_NW_DRV_LIST_CLASS_MAX 32
-
-typedef unsigned short oai_nw_drv_MsgType_t;
-
-struct oai_nw_drv_ioctl {
- char name[IFNAMSIZ];
- oai_nw_drv_MsgType_t type;
- char *msg;
-};
-
-struct oai_nw_drv_msg_statistic_reply {
- unsigned int rx_packets;
- unsigned int tx_packets;
- unsigned int rx_bytes;
- unsigned int tx_bytes;
- unsigned int rx_errors;
- unsigned int tx_errors;
- unsigned int rx_dropped;
- unsigned int tx_dropped;
-};
-
-struct oai_nw_drv_msg_cx_list_reply {
- OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
- unsigned char state;
- OaiNwDrvCellID_t cellid; // cell identification
- unsigned int iid6[2]; // IPv6 interface identification
- unsigned char iid4; // IPv4 interface identification
- unsigned short num_rb;
- unsigned short nsclassifier;
-};
-struct oai_nw_drv_msg_cx_establishment_reply {
- int status;
-};
-struct oai_nw_drv_msg_cx_establishment_request {
- OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
- OaiNwDrvCellID_t cellid; // Cell identification
-};
-struct oai_nw_drv_msg_cx_release_reply {
- int status;
-};
-struct oai_nw_drv_msg_cx_release_request {
- OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
-};
-
-struct oai_nw_drv_msg_rb_list_reply {
- OaiNwDrvRadioBearerId_t rab_id;
- OaiNwDrvSapId_t sapi;
- OaiNwDrvQoSTrafficClass_t qos;
- unsigned char state;
-};
-struct oai_nw_drv_msg_rb_list_request {
- OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
-};
-struct oai_nw_drv_msg_rb_establishment_reply {
- int status;
-};
-struct oai_nw_drv_msg_rb_establishment_request {
- OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
- OaiNwDrvRadioBearerId_t rab_id;
- OaiNwDrvQoSTrafficClass_t qos;
-};
-
-struct oai_nw_drv_msg_rb_release_reply {
- int status;
-};
-struct oai_nw_drv_msg_rb_release_request {
- OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
- OaiNwDrvRadioBearerId_t rab_id;
-};
-/*
-struct saddr {
-
- struct in6_addr ipv6;
- unsigned int ipv4;
-};
-
-struct daddr {
-
- struct in6_addr ipv6;
- unsigned int ipv4;
- unsigned int mpls_label;
-};
-*/
-struct oai_nw_drv_msg_class_add_request {
- OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
- OaiNwDrvRadioBearerId_t rab_id;
- OaiNwDrvRadioBearerId_t rab_id_rx;
- unsigned char dir; // direction (send or receive, forward)
- unsigned char dscp; // codepoint
- unsigned char fct;
- unsigned short classref;
- unsigned char version;
-
- //struct daddr daddr;
- //struct saddr saddr;
-
- unsigned char splen; // prefix length
-
- union {
- struct in6_addr ipv6;
-
- // begin navid
- //in_addr_t ipv4;
- unsigned int ipv4;
- //end navid
-
- unsigned int mpls_label;
- } daddr; // IP destination address
-
- union {
- struct in6_addr ipv6;
-
- // begin navid
- //in_addr_t ipv4;
- unsigned int ipv4;
- //end navid
-
- } saddr; // IP source address
-
-
- unsigned char dplen; // prefix length
-
- unsigned char protocol; //!< transport layer protocol type (ANY,TCP,UDP,ICMPv4,ICMPv6)
- unsigned char protocol_message_type; //!< transport layer protocol message (ROUTER_ADV, ROUTER_SOLL, etc.)
- unsigned short sport; //!< source port
- unsigned short dport; //!< destination port
-};
-
-struct oai_nw_drv_msg_class_add_reply {
- int status;
-};
-struct oai_nw_drv_msg_class_del_request {
- OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
- unsigned char dir; // direction (send or receive)
- unsigned char dscp; // codepoint
- unsigned short classref;
-};
-struct oai_nw_drv_msg_class_del_reply {
- int status;
-};
-#define oai_nw_drv_msg_class_list_reply oai_nw_drv_msg_class_add_request
-struct oai_nw_drv_msg_class_list_request {
- OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
- unsigned char dir;
- unsigned char dscp;
-};
-
-
-// Messages for Measurement transfer - MW 01/04/2005
-typedef unsigned int nioctlProviderId_t;
-typedef unsigned short nioctlSignalLoss_t;
-typedef struct nioctlMeasures {
- OaiNwDrvCellID_t cell_id;
- OaiNwDrvSigLevel_t level;
- nioctlProviderId_t provider_id;
-} nioctlMeasures_t;
-
-struct oai_nw_drv_msg_measure_request {
- OaiNwDrvNumRGsMeas_t num_cells;
- OaiNwDrvCellID_t cellid[OAI_NW_DRV_MAX_MEASURE_NB]; // Cell identification
- unsigned short num_providers;
- nioctlProviderId_t provider_id[OAI_NW_DRV_MAX_MEASURE_NB]; // Provider identification
-};
-struct oai_nw_drv_msg_measure_reply {
- OaiNwDrvNumRGsMeas_t num_cells;
- nioctlMeasures_t measures[OAI_NW_DRV_MAX_MEASURE_NB];
- nioctlSignalLoss_t signal_lost_flag;
-};
-
-// Messages for Measurement transfer - MW 01/04/2005
-typedef unsigned int nioctlL2Id_t[2];
-
-struct oai_nw_drv_msg_l2id_reply {
- nioctlL2Id_t l2id;
-};
-
-
-#endif
diff --git a/openair2/NETWORK_DRIVER/LITE/local.h b/openair2/NETWORK_DRIVER/LITE/local.h
deleted file mode 100644
index 4ceae1b929..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/local.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/***************************************************************************
- local.h - description
- -------------------
- copyright : (C) 2002 by Eurecom
- email :navid.nikaein@eurecom.fr
- lionel.gauthier@eurecom.fr
- knopp@eurecom.fr
- ***************************************************************************
-
- ***************************************************************************/
-
-#ifndef OAI_LOCAL_H
-#define OAI_LOCAL_H
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-//#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define PDCP2IP_FIFO 21
-#define IP2PDCP_FIFO 22
-
-#include "constant.h"
-#include "common/platform_types.h"
-#include "sap.h"
-
-struct cx_entity {
- int sap[OAI_NW_DRV_SAPI_CX_MAX];
- uint8_t state; // state of the connection
- OaiNwDrvLocalConnectionRef_t lcr; // Local connection reference
- OaiNwDrvCellID_t cellid; // cell identification
- uint32_t countimer; // timeout's counter
- uint8_t retry; // number of retransmission
-
- uint32_t iid6[2]; // IPv6 interface identification
- uint8_t iid4; // IPv4 interface identification
- int lastRRCprimitive;
- //measures
- int req_prov_id [OAI_NW_DRV_MAX_MEASURE_NB];
- int num_measures;
- int meas_cell_id[OAI_NW_DRV_MAX_MEASURE_NB];
- int meas_level [OAI_NW_DRV_MAX_MEASURE_NB];
- int provider_id [OAI_NW_DRV_MAX_MEASURE_NB];
-};
-
-struct oai_nw_drv_priv {
- int irq;
- int rx_flags;
- struct timer_list timer;
- spinlock_t lock;
- struct net_device_stats stats;
- uint8_t retry_limit;
- uint32_t timer_establishment;
- uint32_t timer_release;
- struct cx_entity cx[OAI_NW_DRV_CX_MAX];
- //struct classifier_entity *rclassifier[OAI_NW_DRV_DSCP_MAX]; // receive classifier
- uint16_t nrclassifier;
- int sap[OAI_NW_DRV_SAPI_MAX];
- struct sock *nl_sk;
- uint8_t nlmsg[OAI_NW_DRV_PRIMITIVE_MAX_LENGTH+sizeof(struct nlmsghdr)];
- uint8_t xbuffer[OAI_NW_DRV_PRIMITIVE_MAX_LENGTH]; // transmition buffer
- uint8_t rbuffer[OAI_NW_DRV_PRIMITIVE_MAX_LENGTH]; // reception buffer
-};
-
-struct ipversion {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
- uint8_t reserved:4,
- version:4;
-#else
- uint8_t version:4,
- reserved:4;
-#endif
-};
-
-typedef struct pdcp_data_req_header_s {
- rb_id_t rb_id;
- sdu_size_t data_size;
- signed int inst;
- ip_traffic_type_t traffic_type;
-} pdcp_data_req_header_t;
-
-typedef struct pdcp_data_ind_header_s {
- rb_id_t rb_id;
- sdu_size_t data_size;
- signed int inst;
- ip_traffic_type_t dummy_traffic_type;
-} pdcp_data_ind_header_t;
-
-
-
-extern struct net_device *oai_nw_drv_dev[OAI_NW_DRV_NB_INSTANCES_MAX];
-
-extern uint8_t OAI_NW_DRV_NULL_IMEI[14];
-
-
-
-#endif
diff --git a/openair2/NETWORK_DRIVER/LITE/netlink.c b/openair2/NETWORK_DRIVER/LITE/netlink.c
deleted file mode 100644
index 2ad104b421..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/netlink.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file netlink.c
-* \brief establish a netlink
-* \author Navid Nikaein, Lionel Gauthier, and Raymond knopp
-* \company Eurecom
-* \email:navid.nikaein@eurecom.fr, lionel.gauthier@eurecom.fr, knopp@eurecom.fr
-*/
-
-#include
-
-//#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#include "local.h"
-#include "proto_extern.h"
-
-//#define NETLINK_DEBUG 1
-
-
-#define OAI_IP_DRIVER_NETLINK_ID 31
-#define NL_DEST_PID 1
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
-struct netlink_kernel_cfg oai_netlink_cfg;
-#endif
-
-static struct sock *nas_nl_sk = NULL;
-static int exit_netlink_thread=0;
-static int nas_netlink_rx_thread(void *);
-
-
-static DEFINE_MUTEX(nasmesh_mutex);
-
-static inline void nasmesh_lock(void)
-{
- mutex_lock(&nasmesh_mutex);
-}
-
-static inline void nasmesh_unlock(void)
-{
- mutex_unlock(&nasmesh_mutex);
-}
-
-// This can also be implemented using thread to get the data from PDCP without blocking.
-static void nas_nl_data_ready (struct sk_buff *skb)
-{
- // wake_up_interruptible(skb->sk->sk_sleep);
- //nasmesh_lock();
- //netlink_rcv_skb(skb, &my_rcv_msg);// my_rcv_msg is the call back func>
- //nasmesh_unlock();
-
- struct nlmsghdr *nlh = NULL;
-
- if (skb) {
-#ifdef NETLINK_DEBUG
- printk("[OAI_IP_DRV][NETLINK] Received socket from PDCP\n");
-#endif //NETLINK_DEBUG
- nlh = (struct nlmsghdr *)skb->data;
- oai_nw_drv_common_wireless2ip(nlh);
- //kfree_skb(skb); // not required,
- }
-}
-
-
-int oai_nw_drv_netlink_init(void)
-{
-
- printk("[OAI_IP_DRV][NETLINK] Running init ...\n");
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
- oai_netlink_cfg.groups = 0;
- oai_netlink_cfg.input = nas_nl_data_ready;
- oai_netlink_cfg.cb_mutex = &nasmesh_mutex;
- oai_netlink_cfg.bind = NULL;
-
- nas_nl_sk = netlink_kernel_create(
- &init_net,
- OAI_IP_DRIVER_NETLINK_ID,
-# if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
- THIS_MODULE,
-# endif
- &oai_netlink_cfg);
-#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
- nas_nl_sk = netlink_kernel_create(
- &init_net,
- OAI_IP_DRIVER_NETLINK_ID,
- 0,
- nas_nl_data_ready,
- &nasmesh_mutex, // NULL
- THIS_MODULE);
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
-
- if (nas_nl_sk == NULL) {
-
- printk("[OAI_IP_DRV][NETLINK] netlink_kernel_create failed \n");
- return(-1);
- }
-
-
-
- return(0);
-
-}
-
-
-void oai_nw_drv_netlink_release(void)
-{
-
- exit_netlink_thread=1;
- printk("[OAI_IP_DRV][NETLINK] Releasing netlink socket\n");
-
- if(nas_nl_sk) {
- netlink_kernel_release(nas_nl_sk); //or skb->sk
-
- }
-
- // printk("[OAI_IP_DRV][NETLINK] Removing netlink_rx_thread\n");
- //kthread_stop(netlink_rx_thread);
-
-}
-
-
-
-
-int oai_nw_drv_netlink_send(unsigned char *data,unsigned int len)
-{
-
-
- struct sk_buff *nl_skb = alloc_skb(NLMSG_SPACE(len),GFP_ATOMIC);
- struct nlmsghdr *nlh = (struct nlmsghdr *)nl_skb->data;
- int status;
-
-
- // printk("[OAI_IP_DRV][NETLINK] Sending %d bytes (%d)\n",len,NLMSG_SPACE(len));
- skb_put(nl_skb, NLMSG_SPACE(len));
- memcpy(NLMSG_DATA(nlh),data,len);
-
- nlh->nlmsg_len = NLMSG_SPACE(len);
-
-
- nlh->nlmsg_pid = 0; /* from kernel */
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
- NETLINK_CB(nl_skb).portid = 0;
-#else
- NETLINK_CB(nl_skb).pid = 0;
-#endif
-
-#ifdef NETLINK_DEBUG
- printk("[OAI_IP_DRV][NETLINK] In nas_netlink_send, nl_skb %p, nl_sk %x, nlh %p, nlh->nlmsg_len %d\n",nl_skb,nas_nl_sk,nlh,nlh->nlmsg_len);
-#endif //DEBUG_NETLINK
-
- if (nas_nl_sk) {
-
- // nasmesh_lock();
- status = netlink_unicast(nas_nl_sk, nl_skb, NL_DEST_PID, MSG_DONTWAIT);
- // mutex_unlock(&nasmesh_mutex);
-
- if (status < 0) {
- printk("[OAI_IP_DRV][NETLINK] SEND status is %d\n",status);
- return(0);
- } else {
-#ifdef NETLINK_DEBUG
- printk("[OAI_IP_DRV][NETLINK] SEND status is %d\n",status);
-#endif
- return len;
- }
- } else {
- printk("[OAI_IP_DRV][SEND] socket is NULL\n");
- return(0);
- }
-}
diff --git a/openair2/NETWORK_DRIVER/LITE/proto_extern.h b/openair2/NETWORK_DRIVER/LITE/proto_extern.h
deleted file mode 100644
index d4289ca1f2..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/proto_extern.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/***************************************************************************
- proto_extern.h - description
- -------------------
- copyright : (C) 2002 by Eurecom
- email : michelle.wetterwald@eurecom.fr
- yan.moret@eurecom.fr
- knopp@eurecom.fr
- ***************************************************************************
-
-***************************************************************************/
-
-#ifndef __NETWORK_DRIVER_LITE_PROTO_EXTERN__H__
-#define __NETWORK_DRIVER_LITE_PROTO_EXTERN__H__
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-//#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "local.h"
-
-// device.c
-
-
-/** @defgroup _oai_nw_drv_impl_ OAI Network Device for RRC Lite
-* @ingroup _ref_implementation_
-* @{
-\fn int oai_nw_drv_find_inst(struct net_device *dev)
-\brief This function determines the instance id for a particular device pointer.
-@param dev Pointer to net_device structure
- */
-int oai_nw_drv_find_inst(struct net_device *dev);
-
-// common.c
-/**
-\fn void oai_nw_drv_common_class_wireless2ip(unsigned short dlen, void* pdcp_sdu,int inst,OaiNwDrvRadioBearerId_t rb_id)
-\brief Receive classified LTE packet, build skbuff struct with it and deliver it to the OS network layer.
-@param dlen Length of SDU in bytes
-@param pdcp_sdu Pointer to received SDU
-@param inst Instance number
-@param rb_id Radio Bearer Id
- */
-void oai_nw_drv_common_class_wireless2ip(unsigned short dlen,
- void *pdcp_sdu,
- int inst,
- OaiNwDrvRadioBearerId_t rb_id);
-
-/**
-\fn void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst)
-\brief Request the transfer of data (QoS SAP)
-@param skb pointer to socket buffer
-@param inst device instance
- */
-void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst);
-
-/**
-\fn void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst)
-\brief Drop the IP packet comming from the OS network layer.
-@param skb pointer to socket buffer
-@param inst device instance
- */
-void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst);
-
-#ifndef OAI_NW_DRIVER_USE_NETLINK
-/**
-\fn void oai_nw_drv_common_wireless2ip()
-\brief Retrieve PDU from PDCP through RT-fifos for delivery to the IP stack.
- */
-void oai_nw_drv_common_wireless2ip(void);
-#else
-/**
-\fn void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh)
-\brief Retrieve PDU from PDCP through netlink sockets for delivery to the IP stack.
- */
-void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh);
-#endif //OAI_NW_DRIVER_USE_NETLINK
-
-
-#ifdef OAI_NW_DRIVER_USE_NETLINK
-/**
-\fn int oai_nw_drv_netlink_send(unsigned char *data,unsigned int len)
-\brief Request the transfer of data by PDCP via netlink socket
-@param data pointer to SDU
-@param len length of SDU in bytes
-@returns Numeber of bytes transfered by netlink socket
- */
-int oai_nw_drv_netlink_send(unsigned char *data,unsigned int len);
-
-/**
-\fn void oai_nw_drv_COMMON_QOS_receive(struct nlmsghdr *nlh)
-\brief Request a PDU from PDCP
-@param nlh pointer to netlink message header
- */
-void oai_nw_drv_COMMON_QOS_receive(struct nlmsghdr *nlh);
-
-#endif //OAI_NW_DRIVER_USE_NETLINK
-
-
-
-// iocontrol.c
-void oai_nw_drv_CTL_send(struct sk_buff *skb, int inst);
-int oai_nw_drv_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
-
-// classifier.c
-
-/**
- \brief Find the IP traffic type (UNICAST, MULTICAST, BROADCAST) of the IP packet attached to sk_buff.
-*/
-ip_traffic_type_t oai_nw_drv_find_traffic_type(struct sk_buff *skb);
-
-
-
-// tool.c
-void oai_nw_drv_TOOL_imei2iid(unsigned char *imei, unsigned char *iid);
-void oai_nw_drv_TOOL_eNB_imei2iid(unsigned char *imei, unsigned char *iid, unsigned char len);
-unsigned char oai_nw_drv_TOOL_get_dscp6(struct ipv6hdr *iph);
-unsigned char oai_nw_drv_TOOL_get_dscp4(struct iphdr *iph);
-unsigned char *oai_nw_drv_TOOL_get_protocol6(struct ipv6hdr *iph, unsigned char *protocol);
-unsigned char *oai_nw_drv_TOOL_get_protocol4(struct iphdr *iph, unsigned char *protocol);
-char *oai_nw_drv_TOOL_get_udpmsg(struct udphdr *udph);
-unsigned short oai_nw_drv_TOOL_udpcksum(struct in6_addr *saddr, struct in6_addr *daddr, unsigned char proto, unsigned int udplen, void *data);
-int oai_nw_drv_TOOL_network6(struct in6_addr *addr, struct in6_addr *prefix, unsigned char plen);
-int oai_nw_drv_TOOL_network4(unsigned int *addr, unsigned int *prefix, unsigned char plen);
-void print_TOOL_pk_icmp6(struct icmp6hdr *icmph);
-
-void print_TOOL_pk_all(struct sk_buff *skb);
-void print_TOOL_pk_ipv6(struct ipv6hdr *iph);
-void print_TOOL_state(unsigned char state);
-void oai_nw_drv_tool_print_buffer(char * buffer,int length);
-#ifdef OAI_NW_DRIVER_USE_NETLINK
-// netlink.c
-
-void oai_nw_drv_netlink_release(void);
-int oai_nw_drv_netlink_init(void);
-
-#endif
-
-/** @} */
-#endif
diff --git a/openair2/NETWORK_DRIVER/LITE/sap.h b/openair2/NETWORK_DRIVER/LITE/sap.h
deleted file mode 100644
index d72a1b10df..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/sap.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#ifndef OAI_SAP_H
-#define OAI_SAP_H
-typedef unsigned short OaiNwDrvRadioBearerId_t;
-typedef unsigned int OaiNwDrvSapId_t; // Id of the QoS SAP to use
-typedef unsigned short OaiNwDrvQoSTrafficClass_t; // QoS traffic class requested
-typedef unsigned int OaiNwDrvLocalConnectionRef_t; // local identifier
-typedef unsigned short OaiNwDrvCellID_t; // ID of the cell for connection
-typedef unsigned short OaiNwDrvNumRGsMeas_t; // number of RGs that could be measured
-typedef unsigned int OaiNwDrvSigLevel_t; // Signal level measured
-
-#define OAI_NW_DRV_SAPI_CX_MAX 2
-#define OAI_NW_DRV_MAX_MEASURE_NB 5
-#define OAI_NW_DRV_PRIMITIVE_MAX_LENGTH 180 // maximum length of a NAS primitive
-#define OAI_NW_DRV_SAPI_MAX 4
-#define OAI_NW_DRV_RAB_INPUT_SAPI 2
-#define OAI_NW_DRV_RAB_OUTPUT_SAPI 3
-#define OAI_NW_DRV_MAX_RABS 8 * 64 //NB_RAB_MAX * MAX_MOBILES_PER_RG //27 // = MAXURAB
-#define OAI_NW_DRV_LIST_RB_MAX 32
-#endif
diff --git a/openair2/NETWORK_DRIVER/LITE/tool.c b/openair2/NETWORK_DRIVER/LITE/tool.c
deleted file mode 100644
index d8d0030dd9..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/tool.c
+++ /dev/null
@@ -1,747 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#include "local.h"
-#include "proto_extern.h"
-
-//#include
-//#include
-//#include
-//#include
-//#include
-//#include
-
-//#define OAI_NW_DRV_DEBUG_TOOL 1
-
-
-
-//---------------------------------------------------------------------------
-uint8_t oai_nw_drv_TOOL_get_dscp6(struct ipv6hdr *iph)
-{
- //---------------------------------------------------------------------------
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_GET_DSCP6 - begin \n");
-#endif
-
- if (iph==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_GET_DSCP6 - input parameter iph is NULL \n");
-#endif
- return 0;
- }
-
- // End debug information
- return (ntohl(((*(__u32 *)iph)&OAI_NW_DRV_TRAFFICCLASS_MASK)))>>22;
- //return ntohs(*(const __be16 *)iph) >> 4; // see linux/dsfield.h
-
-}
-
-//---------------------------------------------------------------------------
-uint8_t oai_nw_drv_TOOL_get_dscp4(struct iphdr *iph)
-{
- //---------------------------------------------------------------------------
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_GET_DSCP4 - begin \n");
-#endif
-
- if (iph==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_GET_DSCP4 - input parameter iph is NULL \n");
-#endif
- return 0;
- }
-
- // End debug information
- return (iph->tos);
-
-}
-
-//---------------------------------------------------------------------------
-int oai_nw_drv_TOOL_network6(struct in6_addr *addr, struct in6_addr *prefix, uint8_t plen)
-{
- //---------------------------------------------------------------------------
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_NETWORK6 - begin \n");
-#endif
-
- if (addr==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_NETWORK6 - input parameter addr is NULL \n");
-#endif
- return 0;
- }
-
- if (prefix==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_NETWORK6 - input parameter prefix is NULL \n");
-#endif
- return 0;
- }
-
- // End debug information
- switch(plen/32) {
- case 0:
- return (((addr->s6_addr32[0]>>(32-plen))<<(32-plen))==prefix->s6_addr[0]);
-
- case 1:
- return ((addr->s6_addr32[0]==prefix->s6_addr[0])&&
- (((addr->s6_addr32[1]>>(64-plen))<<(64-plen))==prefix->s6_addr[1]));
-
- case 2:
- return ((addr->s6_addr32[0]==prefix->s6_addr[0])&&
- (addr->s6_addr32[1]==prefix->s6_addr[1])&&
- (((addr->s6_addr32[2]>>(96-plen))<<(96-plen))==prefix->s6_addr[2]));
-
- case 3:
- return ((addr->s6_addr32[0]==prefix->s6_addr[0])&&
- (addr->s6_addr32[1]==prefix->s6_addr[1])&&
- (addr->s6_addr32[2]==prefix->s6_addr[2])&&
- (((addr->s6_addr32[3]>>(128-plen))<<(128-plen))==prefix->s6_addr[3]));
-
- default:
- return ((addr->s6_addr32[0]==prefix->s6_addr[0])&&
- (addr->s6_addr32[1]==prefix->s6_addr[1])&&
- (addr->s6_addr32[2]==prefix->s6_addr[2])&&
- (addr->s6_addr32[3]==prefix->s6_addr[3]));
- }
-}
-
-//---------------------------------------------------------------------------
-int oai_nw_drv_TOOL_network4(uint32_t *addr, uint32_t *prefix, uint8_t plen)
-{
- //---------------------------------------------------------------------------
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_NETWORK4 - begin \n");
-#endif
-
- if (addr==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_NETWORK4 - input parameter addr is NULL \n");
-#endif
- return 0;
- }
-
- if (prefix==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_NETWORK4 - input parameter prefix is NULL \n");
-#endif
- return 0;
- }
-
- // End debug information
- if (plen>=32)
- return (*addr==*prefix);
- else
- return (((*addr>>(32-plen))<<(32-plen))==*prefix);
-}
-
-//---------------------------------------------------------------------------
-//struct udphdr *oai_nw_drv_TOOL_get_udp6(struct ipv6hdr *iph){
-//---------------------------------------------------------------------------
-// return (struct udphdr *)((char *)iph+OAI_NW_DRV_IPV6_SIZE); // to modify
-//}
-
-//---------------------------------------------------------------------------
-uint8_t *oai_nw_drv_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol)
-{
- //---------------------------------------------------------------------------
- uint16_t size;
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_GET_PROTOCOL6 - begin \n");
-#endif
-
- if (iph==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_GET_PROTOCOL6 - input parameter iph is NULL \n");
-#endif
- return NULL;
- }
-
- if (protocol==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_GET_PROTOCOL6 - input parameter protocol is NULL \n");
-#endif
- return NULL;
- }
-
- // End debug information
- *protocol=iph->nexthdr;
- size=OAI_NW_DRV_IPV6_SIZE;
-
- while (1) {
- switch(*protocol) {
- case IPPROTO_UDP:
- case IPPROTO_TCP:
- case IPPROTO_ICMPV6:
- return (uint8_t *)((uint8_t *)iph+size);
-
- case IPPROTO_HOPOPTS:
- case IPPROTO_ROUTING:
- case IPPROTO_DSTOPTS:
- *protocol=((uint8_t *)iph+size)[0];
- size+=((uint8_t *)iph+size)[1]*8+8;
- break;
-
- case IPPROTO_FRAGMENT:
- *protocol=((uint8_t *)iph+size)[0];
- size+=((uint8_t *)iph+size)[1]+8;
- break;
-
- case IPPROTO_NONE:
- case IPPROTO_AH:
- case IPPROTO_ESP:
- default:
- return NULL;
- }
- }
-}
-
-//---------------------------------------------------------------------------
-uint8_t *oai_nw_drv_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol)
-{
- //---------------------------------------------------------------------------
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_GET_PROTOCOL4 - begin \n");
-#endif
-
- if (iph==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_GET_PROTOCOL4 - input parameter iph is NULL \n");
-#endif
- return NULL;
- }
-
- if (protocol==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_GET_PROTOCOL4 - input parameter protocol is NULL \n");
-#endif
- return NULL;
- }
-
- // End debug information
- *protocol=iph->protocol;
-
- switch(*protocol) {
- case IPPROTO_UDP:
- case IPPROTO_TCP:
- case IPPROTO_ICMP:
- return (uint8_t *)((uint8_t *)iph+iph->tot_len);
-
- default:
- return NULL;
- }
-}
-
-//---------------------------------------------------------------------------
-// Convert the IMEI to iid
-void oai_nw_drv_TOOL_imei2iid(uint8_t *imei, uint8_t *iid)
-{
- //---------------------------------------------------------------------------
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_IMEI2IID - begin \n");
-#endif
-
- if (imei==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_IMEI2IID - input parameter imei is NULL \n");
-#endif
- return;
- }
-
- if (iid==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_IMEI2IID - input parameter iid is NULL \n");
-#endif
- return;
- }
-
- // End debug information
- memset(iid, 0, OAI_NW_DRV_ADDR_LEN);
- iid[0] = 0x03;
- iid[1] = 16*imei[0]+imei[1];
- iid[2] = 16*imei[2]+imei[3];
- iid[3] = 16*imei[4]+imei[5];
- iid[4] = 16*imei[6]+imei[7];
- iid[5] = 16*imei[8]+imei[9];
- iid[6] = 16*imei[10]+imei[11];
- iid[7] = 16*imei[12]+imei[13];
-}
-//---------------------------------------------------------------------------
-// Convert the IMEI to iid
-void oai_nw_drv_TOOL_eNB_imei2iid(unsigned char *imei, unsigned char *iid, unsigned char len)
-{
- //---------------------------------------------------------------------------
- unsigned int index;
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_eNB_IMEI2IID - begin \n");
-#endif
-
- if (imei==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_eNB_IMEI2IID - input parameter imei is NULL \n");
-#endif
- return;
- }
-
- if (iid==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_eNB_IMEI2IID - input parameter iid is NULL \n");
-#endif
- return;
- }
-
- // End debug information
- memset(iid, 0, len);
- iid[0] = 0x00; // to be compatible between link local and global
-
- // len -1 because of insertion of 0 above
- for (index = 0; index < (len-1); index++) {
- iid[index+1] = 16*imei[index*2]+imei[index*2+1];
- }
-}
-
-//struct udphdr *oai_nw_drv_TOOL_get_udp4(struct iphdr *iph)
-//{
-// return (struct udphdr *)((char *)iph+OAI_NW_DRV_IPV4_SIZE); // to modify
-//}
-
-
-//---------------------------------------------------------------------------
-char *oai_nw_drv_TOOL_get_udpmsg(struct udphdr *udph)
-{
- //---------------------------------------------------------------------------
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_GET_UDPMSG - begin \n");
-#endif
-
- if (udph==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_GET_UDPMSG - input parameter udph is NULL \n");
-#endif
- return NULL;
- }
-
- // End debug information
- return ((char *)udph+sizeof(struct udphdr));
-}
-
-//---------------------------------------------------------------------------
-// Compute the UDP checksum (the data size must be odd)
-uint16_t oai_nw_drv_TOOL_udpcksum(struct in6_addr *saddr, struct in6_addr *daddr, uint8_t proto, uint32_t udplen, void *data)
-{
- //---------------------------------------------------------------------------
- uint32_t i;
- uint16_t *data16;
- uint32_t csum=0;
-
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_UDPCKSUM - begin \n");
-#endif
-
- if (saddr==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_UDPCKSUM - input parameter saddr is NULL \n");
-#endif
- return 0;
- }
-
- if (daddr==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_UDPCKSUM - input parameter daddr is NULL \n");
-#endif
- return 0;
- }
-
- if (data==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_UDPCKSUM - input parameter data is NULL \n");
-#endif
- return 0;
- }
-
- // End debug information
- data16=data;
-
- for (i=0; i<8; ++i) {
- csum+=ntohs(saddr->s6_addr16[i]);
-
- if (csum>0xffff)
- csum-=0xffff;
- }
-
- for (i=0; i<8; ++i) {
- csum+=ntohs(daddr->s6_addr16[i]);
-
- if (csum>0xffff)
- csum-=0xffff;
- }
-
- csum+=(udplen>>16); // udplen checksum
-
- if (csum>0xffff)
- csum -= 0xffff;
-
- csum+=udplen & 0xffff;
-
- if (csum>0xffff)
- csum -= 0xffff;
-
- csum+=proto; // protocol checksum
-
- if (csum>0xffff)
- csum-=0xffff;
-
- for (i = 0; 2*i < udplen; i++) {
- csum+=ntohs(data16[i]);
-
- if (csum>0xffff)
- csum-=0xffff;
- }
-
- return htons((uint16_t)(~csum)&0xffff);
-}
-
-//---------------------------------------------------------------------------
-void print_TOOL_pk_udp(struct udphdr *udph)
-{
- //---------------------------------------------------------------------------
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("PRINT_TOOL_PK_UDP - begin \n");
-#endif
-
- if (udph==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_PK_UDP - input parameter udph is NULL \n");
-#endif
- return;
- }
-
- // End debug information
- if (udph!=NULL) {
- printk("UDP:\t source = %u, dest = %u, len = %u, check = %x\n", ntohs(udph->source), ntohs(udph->dest), ntohs(udph->len), udph->check);
- }
-}
-
-//---------------------------------------------------------------------------
-void print_TOOL_pk_tcp(struct tcphdr *tcph)
-{
- //---------------------------------------------------------------------------
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("PRINT_TOOL_PK_TDP - begin \n");
-#endif
-
- if (tcph==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_PK_TDP - input parameter tcph is NULL \n");
-#endif
- return;
- }
-
- // End debug information
- if (tcph!=NULL) {
- printk("TCP:\t source = %u, dest = %u\n", tcph->source, tcph->dest);
- }
-}
-
-//---------------------------------------------------------------------------
-void print_TOOL_pk_icmp6(struct icmp6hdr *icmph)
-{
- //---------------------------------------------------------------------------
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("PRINT_TOOL_PK_ICMP6 - begin \n");
-#endif
-
- if (icmph==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_PK_ICMP6 - input parameter icmph is NULL \n");
-#endif
- return;
- }
-
- // End debug information
- if (icmph!=NULL) {
- printk("ICMPv6:\t type= %d, code = %d\n", icmph->icmp6_type, icmph->icmp6_code);
-
- switch(icmph->icmp6_type) {
- case ICMPV6_DEST_UNREACH:
- printk("Destination unreachable\n");
- break;
-
- case ICMPV6_PKT_TOOBIG:
- printk("Packet too big\n");
- break;
-
- case ICMPV6_TIME_EXCEED:
- printk("Time exceeded\n");
- break;
-
- case ICMPV6_PARAMPROB:
- printk("Parameter problem\n");
- break;
-
- case ICMPV6_ECHO_REQUEST:
- printk("Echo request\n");
- break;
-
- case ICMPV6_ECHO_REPLY:
- printk("Echo reply\n");
- break;
-
- case ICMPV6_MGM_QUERY:
- printk("Multicast listener query\n");
- break;
-
- case ICMPV6_MGM_REPORT:
- printk("Multicast listener report\n");
- break;
-
- case ICMPV6_MGM_REDUCTION:
- printk("Multicast listener done\n");
- break;
-
- case NDISC_ROUTER_SOLICITATION:
- printk("Router solicitation\n");
- break;
-
- case NDISC_ROUTER_ADVERTISEMENT:
- printk("Router advertisment\n");
- break;
-
- case NDISC_NEIGHBOUR_SOLICITATION:
- printk("Neighbour solicitation\n");
- break;
-
- case NDISC_NEIGHBOUR_ADVERTISEMENT:
- printk("Neighbour advertisment\n");
- break;
-
- case NDISC_REDIRECT:
- printk("redirect message\n");
- break;
- }
- }
-}
-
-//---------------------------------------------------------------------------
-void print_TOOL_pk_ipv6(struct ipv6hdr *iph)
-{
- //---------------------------------------------------------------------------
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("PRINT_TOOL_PK_IPv6 - begin \n");
-#endif
-
- if (iph==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_PK_IPv6 - input parameter iph is NULL \n");
-#endif
- return;
- }
-
- // End debug information
-
- if (iph!=NULL) {
- // char addr[OAI_NW_DRV_INET6_ADDRSTRLEN];
- printk("IP:\t version = %u, priority = %u, payload_len = %u\n", iph->version, iph->priority, ntohs(iph->payload_len));
- printk("\t fl0 = %u, fl1 = %u, fl2 = %u\n",iph->flow_lbl[0],iph->flow_lbl[1],iph->flow_lbl[2]);
- printk("\t next header = %u, hop_limit = %u\n", iph->nexthdr, iph->hop_limit);
-
- // inet_ntop(AF_INET6, (void *)(&iph->saddr), addr, OAI_NW_DRV_INET6_ADDRSTRLEN);
- // printk("\t saddr = %s",addr);
- // inet_ntop(AF_INET6, (void *)(&iph->daddr), addr, OAI_NW_DRV_INET6_ADDRSTRLEN);
- // printk(", daddr = %s\n",addr);
- switch(iph->nexthdr) {
- case IPPROTO_UDP:
- print_TOOL_pk_udp((struct udphdr *)((char *)iph+sizeof(struct ipv6hdr)));
- break;
-
- case IPPROTO_TCP:
- print_TOOL_pk_tcp((struct tcphdr *)((char *)iph+sizeof(struct ipv6hdr)));
- break;
-
- case IPPROTO_ICMPV6:
- print_TOOL_pk_icmp6((struct icmp6hdr *)((char *)iph+sizeof(struct ipv6hdr)));
- break;
-
- case IPPROTO_IPV6:
- print_TOOL_pk_ipv6((struct ipv6hdr *)((char *)iph+sizeof(struct ipv6hdr)));
- break;
-
- default:
- printk("Unknown upper layer\n");
- }
- }
-}
-
-//---------------------------------------------------------------------------
-void print_TOOL_pk_ipv4(struct iphdr *iph)
-{
- //---------------------------------------------------------------------------
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("PRINT_TOOL_PK_IPv4 - begin \n");
-#endif
-
- if (iph==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_PK_IPv4 - input parameter iph is NULL \n");
-#endif
- return;
- }
-
- // End debug information
-
- if (iph!=NULL) {
- // char addr[OAI_NW_DRV_INET_ADDRSTRLEN];
- printk("IP:\t version = %u, IP length = %u\n", iph->version, iph->ihl);
- // inet_ntop(AF_INET, (void *)(&iph->saddr), addr, OAI_NW_DRV_INET_ADDRSTRLEN);
- // printk("\t saddr = %s", addr);
- // inet_ntop(AF_INET, (void *)(&iph->saddr), addr, OAI_NW_DRV_INET_ADDRSTRLEN);
- // printk("\t saddr = %s", addr);
- }
-}
-
-//---------------------------------------------------------------------------
-void print_TOOL_pk_all(struct sk_buff *skb)
-{
- //---------------------------------------------------------------------------
- printk("Skb:\t %u, len = %u\n", (unsigned int)skb, skb->len);
- //navid: need to calculate the current used space: fixme?
- printk("Skb:\t available buf space = %u \n", skb->truesize);
-
- switch (ntohs(skb->protocol)) {
- case ETH_P_IPV6:
- print_TOOL_pk_ipv6((struct ipv6hdr *)skb->network_header);
- break;
-
- case ETH_P_IP:
- print_TOOL_pk_ipv4((struct iphdr *)skb->network_header);
- break;
- }
-}
-
-//---------------------------------------------------------------------------
-/*int isdigit(char c)
-{
- switch(c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- return 1;
- default:
- return 0;
- }
-}*/
-
-/*int oai_nw_drv_TOOL_inet_pton4(char *src, uint32_t *dst)
-{
- uint32_t val;
- int n;
- uint8_t c;
- uint32_t parts[4];
-
- c = *src;
- val=0;
- n=0
- for (;;)
- {
- for (;;)
- {
- if (isdigit(c))
- {
- val = (val * 10) + c - '0';
- c = *++src;
- }
- else
- break;
- }
- if (c == '.')
- {
- if (n>4)
- return -1;
- parts[n]=val;
- c = *++src;
- ++n;
- }
- else
- break;
- }
- if ((c != '\0')||(n!=3))
- return (0);
- if ((parts[0] | parts[1] | parts[2] | val) > 256)
- return (0);
- val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
- if (dst)
- dst = htonl(val);
- return (1);
-}*/
-
-
-
-//-----------------------------------------------------------------------------
-// Print the content of a buffer in hexadecimal
-void oai_nw_drv_tool_print_buffer(char * buffer,int length)
-{
- //-----------------------------------------------------------------------------
- int i;
-
- // Start debug information
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_PRINT_BUFFER - begin \n");
-#endif
-
- if (buffer==NULL) {
-#ifdef OAI_NW_DRV_DEBUG_TOOL
- printk("OAI_NW_DRV_TOOL_PRINT_BUFFER - input parameter buffer is NULL \n");
-#endif
- return;
- }
-
- // End debug information
- printk("\nBuffer content: ");
-
- for (i=0; i
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-
-//
-
-//#include "ral_cdma_variables.h"
-//#include "ral_cdma_proto.h"
-
-#include "rrc_nas_primitives.h"
-#include "ioctl.h"
-#include "constant.h"
-
-//#include "nasmt_constant.h"
-//#include "nasmt_iocontrol.h"
-
-
-
-// Global variables
-//int sd_graal;
-int fd;
-//char myIPAddr[16]; // local IP Address
-//int meas_counter;
-//struct ralu_priv ru_priv;
-//struct ralu_priv *ralupriv;
-//ioctl
-char dummy_buffer[1024];
-struct nas_ioctl gifr;
-//int wait_start_nas;
-
-/*
-//---------------------------------------------------------------------------
-int NAS_RALconnect(void)
-//---------------------------------------------------------------------------
-{
- struct sockaddr_un remote;
- int len,s;
-
- if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
- perror("NAS_RALconnect - socket");
- exit(1);
- }
- //
- printf("Trying to connect to NAS ...\n");
- remote.sun_family = AF_UNIX;
- strcpy(remote.sun_path, SOCKET_RAL_TD_CDMA_NAME);
- len = strlen(remote.sun_path) + sizeof(remote.sun_family);
-
- while (wait_start_graal){
- if (connect(s, (struct sockaddr *)&remote, len) == -1) {
- perror("NAS_RALconnect - waiting for connection - ");
- // exit(1);
- wait_start_graal = 1;
- sleep(5);
- } else {
- wait_start_graal =0;
- printf("RAL connected to NAS.\n");
- }
-
- }
- return s;
-}
-
-*/
-
-//---------------------------------------------------------------------------
-void IAL_NAS_ioctl_init(int inst)
-//---------------------------------------------------------------------------
-{
- struct nas_msg_statistic_reply *msgrep;
- int err;
- sprintf(gifr.name, "oai%d",inst);
- // Get an UDP IPv6 socket ??
- fd=socket(AF_INET6, SOCK_DGRAM, 0);
-
- if (fd<0) {
- printf("Error opening socket\n");
- exit(1);
- }
-
- sprintf(gifr.name, "oai%d",inst);
- gifr.type = NAS_MSG_STATISTIC_REQUEST;
- memset ((void *)dummy_buffer,0,800);
- gifr.msg= &(dummy_buffer[0]);
- msgrep=(struct nas_msg_statistic_reply *)(gifr.msg);
- printf("ioctl :Statistics requested\n");
- err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
-
- if (err<0) {
- printf("IOCTL error, err=%d\n",err);
- }
-
- printf("tx_packets = %u, rx_packets = %u\n", msgrep->tx_packets, msgrep->rx_packets);
- printf("tx_bytes = %u, rx_bytes = %u\n", msgrep->tx_bytes, msgrep->rx_bytes);
- printf("tx_errors = %u, rx_errors = %u\n", msgrep->tx_errors, msgrep->rx_errors);
- printf("tx_dropped = %u, rx_dropped = %u\n", msgrep->tx_dropped, msgrep->rx_dropped);
-}
-
-
-#define ADD_RB 0
-#define DEL_RB 1
-
-//---------------------------------------------------------------------------
-int main(int argc,char **argv)
-//---------------------------------------------------------------------------
-{
- int err = 0;
- int c = 0;
- int action=0,rbset=0,cxset=0,instset=0,saddr_ipv4set=0,saddr_ipv6set=0,daddr_ipv4set=0,daddr_ipv6set=0,dscpset=0,mpls_outlabelset=0,mpls_inlabelset=0;
- char rb[100],cx[100],dscp[100],inst[100],mpls_outgoinglabel[100],mpls_incominglabel[100];
- struct nas_msg_rb_establishment_request *msgreq = NULL;
- struct nas_msg_class_add_request *msgreq_class = NULL;
- in_addr_t saddr_ipv4 = 0,daddr_ipv4 = 0;
- struct in6_addr saddr_ipv6,daddr_ipv6;
- unsigned int mpls_outlabel=0,mpls_inlabel=0;
- char addr_str[46];
- // scan options
- rb[0] = '\0';
- cx[0] = '\0';
- dscp[0] = '\0';
- mpls_incominglabel[0] = '\0';
- mpls_outgoinglabel[0] = '\0';
-
- while ((c = getopt (argc, argv, "adr:i:c:l:m:s:t:x:y:z:")) != -1)
- switch (c) {
- case 'a':
- action = ADD_RB;
- break;
-
- case 'd':
- action = DEL_RB;
- break;
-
- case 'r':
- strcpy(rb,optarg);
- rbset = 1;
- break;
-
- case 'i':
- strcpy(inst,optarg);
- instset = 1;
- break;
-
- case 'c':
- strcpy(cx,optarg);
- cxset = 1;
- break;
-
- case 'l':
- strcpy(mpls_outgoinglabel,optarg);
- mpls_outlabelset=1;
- break;
-
- case 'm':
- strcpy(mpls_incominglabel,optarg);
- mpls_inlabelset=1;
- break;
-
- case 's': {
- struct in_addr a;
- inet_aton(optarg,&a);
- saddr_ipv4 = a.s_addr;
- saddr_ipv4set = 1;
- break;
- }
-
- case 't': {
- struct in_addr a;
- inet_aton(optarg,&a);
- daddr_ipv4 = a.s_addr;
- daddr_ipv4set = 1;
- break;
- }
-
- case 'x':
- printf("IPv6: %s\n",optarg);
- inet_pton(AF_INET6,optarg,(void *)&saddr_ipv6);
- saddr_ipv6set = 1;
- break;
-
- case 'y':
- inet_pton(AF_INET6,optarg,(void *)&daddr_ipv6);
- daddr_ipv6set = 1;
- break;
-
- case 'z':
- dscpset=1;
- strcpy(dscp,optarg);
- break;
-
- case '?':
- if (isprint (optopt))
- fprintf (stderr, "Unknown option `-%c'.\n", optopt);
- else
- fprintf (stderr,
- "Unknown option character `\\x%x'.\n",
- optopt);
-
- return 1;
-
- default:
- abort ();
- }
-
- printf ("action = %d, rb = %s,cx = %s\n", action, rb, cx);
-
- if (rbset==0) {
- printf("ERROR: Specify a RAB id!!\n");
- exit(-1);
- }
-
- if (cxset==0) {
- printf("ERROR: Specify an LCR !!\n");
- exit(-1);
- }
-
- if (instset==0) {
- printf("ERROR: Specify an interface !!\n");
- exit(-1);
- }
-
- if ((mpls_outlabelset == 0) && (saddr_ipv4set==0) && (saddr_ipv6set==0)) {
- printf("ERROR: Specify a source IP address\n");
- exit(-1);
- }
-
- if ((mpls_outlabelset == 0) && (daddr_ipv4set==0) && (daddr_ipv6set==0)) {
- printf("ERROR: Specify a destination IP address\n");
- exit(-1);
- }
-
- if ((mpls_outlabelset == 1) && (mpls_inlabelset == 0)) {
- printf("ERROR: Specify an incoming MPLS label\n");
- exit(-1);
- }
-
- if ((mpls_inlabelset == 1) && (mpls_outlabelset == 0)) {
- printf("ERROR: Specify an outgoing MPLS label\n");
- exit(-1);
- }
-
- IAL_NAS_ioctl_init(atoi(inst));
- msgreq = (struct nas_msg_rb_establishment_request *)(gifr.msg);
- msgreq->rab_id = atoi(rb);
- msgreq->lcr = atoi(cx);
- msgreq->qos = 0;
-
- if (action == ADD_RB) {
- gifr.type = NAS_MSG_RB_ESTABLISHMENT_REQUEST;
- err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
-
- if (err == -1) perror("ioctl");
-
- if (saddr_ipv4set == 1) {
- msgreq_class = (struct nas_msg_class_add_request *)(gifr.msg);
- msgreq_class->rab_id = atoi(rb);
- msgreq_class->lcr = atoi(cx);
- msgreq_class->version = 4;
- msgreq_class->classref = 0 + (msgreq_class->lcr<<3);
- msgreq_class->dir = NAS_DIRECTION_SEND;
- msgreq_class->fct = NAS_FCT_QOS_SEND;
- msgreq_class->saddr.ipv4 = saddr_ipv4;
- msgreq_class->daddr.ipv4 = daddr_ipv4;
- // TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
- msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
-
- if (dscpset==0)
- msgreq_class->dscp=0;
- else
- msgreq_class->dscp=atoi(dscp);
-
- gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
- err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
-
- if (err == -1) perror("ioctl");
-
- msgreq_class->rab_id = atoi(rb);
- msgreq_class->lcr = atoi(cx);
- msgreq_class->classref = 1+(msgreq_class->lcr<<3);
- msgreq_class->dir = NAS_DIRECTION_RECEIVE;
- msgreq_class->daddr.ipv4 = saddr_ipv4;
- msgreq_class->saddr.ipv4 = daddr_ipv4;
- gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
- err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
-
- if (err == -1) perror("ioctl");
- }
-
- if (saddr_ipv6set == 1) {
- msgreq_class = (struct nas_msg_class_add_request *)(gifr.msg);
- msgreq_class->rab_id = atoi(rb);
- msgreq_class->lcr = atoi(cx);
- msgreq_class->version = 6;
-
- if (dscpset==0)
- msgreq_class->dscp=0;
- else
- msgreq_class->dscp=atoi(dscp);
-
- msgreq_class->classref = 2+(msgreq_class->lcr<<3);
- msgreq_class->dir=NAS_DIRECTION_SEND;
- msgreq_class->fct=NAS_FCT_QOS_SEND;
- // TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
- msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
- memcpy(&msgreq_class->saddr.ipv6,&saddr_ipv6,16);
- memcpy(&msgreq_class->daddr.ipv6,&daddr_ipv6,16);
- inet_ntop(AF_INET6,(void *)&saddr_ipv6,addr_str,46);
- printf("IPV6: Source %s\n",addr_str);
- inet_ntop(AF_INET6,(void *)&daddr_ipv6,addr_str,46);
- printf("IPV6: Dest %s\n",addr_str);
- gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
- err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
-
- if (err == -1) perror("ioctl");
-
- msgreq_class->rab_id = atoi(rb);
- msgreq_class->lcr = atoi(cx);
- msgreq_class->classref = 3+(msgreq_class->lcr<<3);
- msgreq_class->dir=NAS_DIRECTION_RECEIVE;
- memcpy(&msgreq_class->daddr.ipv6,&saddr_ipv6,16);
- memcpy(&msgreq_class->saddr.ipv6,&daddr_ipv6,16);
- gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
- err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
-
- if (err == -1) perror("ioctl");
- }
-
- if (mpls_inlabelset == 1) {
- msgreq_class = (struct nas_msg_class_add_request *)(gifr.msg);
- msgreq_class->rab_id = atoi(rb);
- msgreq_class->lcr = atoi(cx);
- msgreq_class->version = NAS_MPLS_VERSION_CODE;
-
- if (dscpset==0)
- msgreq_class->dscp=0;
- else
- msgreq_class->dscp=atoi(dscp);
-
- msgreq_class->classref = 4 + (msgreq_class->lcr<<3);
- msgreq_class->dir=NAS_DIRECTION_SEND;
- msgreq_class->fct=NAS_FCT_QOS_SEND;
- // TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
- msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
- mpls_outlabel = atoi(mpls_outgoinglabel);
- printf("Setting MPLS outlabel %u with exp %d\n",mpls_outlabel,msgreq_class->dscp);
- msgreq_class->daddr.mpls_label = mpls_outlabel;
- gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
- err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
-
- if (err == -1) perror("ioctl");
-
- msgreq_class->rab_id = atoi(rb);
- msgreq_class->lcr = atoi(cx);
- msgreq_class->classref = 5 + (msgreq_class->lcr<<3);
- msgreq_class->dir=NAS_DIRECTION_RECEIVE;
- // TO BE FIXED WHEN WE CAN SPECIFY A PROTOCOL-based rule
- msgreq_class->protocol = NAS_PROTOCOL_DEFAULT;
- mpls_inlabel = atoi(mpls_incominglabel);
- printf("Setting MPLS inlabel %u with exp %d\n",mpls_inlabel,msgreq_class->dscp);
- msgreq_class->daddr.mpls_label = mpls_inlabel;
- gifr.type = NAS_MSG_CLASS_ADD_REQUEST;
- err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
-
- if (err == -1) perror("ioctl");
- }
- } else if (action == DEL_RB) {
- gifr.type = NAS_MSG_RB_RELEASE_REQUEST;
- err=ioctl(fd, NAS_IOCTL_RRM, &gifr);
-
- if (err == -1) perror("ioctl");
- }
-}
diff --git a/openair2/NETWORK_DRIVER/MESH/TESTBENCH/testbench.c b/openair2/NETWORK_DRIVER/MESH/TESTBENCH/testbench.c
deleted file mode 100644
index 121d3bba8b..0000000000
--- a/openair2/NETWORK_DRIVER/MESH/TESTBENCH/testbench.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-typedef unsigned int sdu_size_t;
-typedef unsigned int rb_id_t;
-
-typedef struct pdcp_data_req_header_t {
- rb_id_t rb_id;
- sdu_size_t data_size;
- int inst;
-} pdcp_data_req_header_t;
-
-typedef struct pdcp_data_ind_header_t {
- rb_id_t rb_id;
- sdu_size_t data_size;
- int inst;
-} pdcp_data_ind_header_t;
-
-#define MAX_PAYLOAD 1024 /* maximum payload size*/
-struct sockaddr_nl src_addr, dest_addr;
-struct nlmsghdr *nlh = NULL;
-struct iovec iov;
-int sock_fd;
-struct msghdr msg;
-
-
-void foo( int sig )
-{
-
- printf("I got cntl-C, closing socket\n");
-
-
- close(sock_fd);
- exit(-1);
-}
-
-
-#define OAI_IP_DRIVER_NETLINK_ID 31
-
-void main()
-{
-
-
- struct sigaction newaction;
- int i=0;
- int ret;
- int len;
-
- newaction.sa_handler = foo;
-
- if ( sigaction( SIGINT, &newaction, NULL ) == -1)
- perror("Could not install the new signal handler");
-
- sock_fd = socket(PF_NETLINK, SOCK_RAW,OAI_IP_DRIVER_NETLINK_ID);
-
- printf("Opened socket with fd %d\n",sock_fd);
-
- ret = fcntl(sock_fd,F_SETFL,O_NONBLOCK);
- printf("fcntl returns %d\n",ret);
-
- memset(&src_addr, 0, sizeof(src_addr));
- src_addr.nl_family = AF_NETLINK;
- src_addr.nl_pid = 1;//getpid(); /* self pid */
- src_addr.nl_groups = 0; /* not in mcast groups */
- ret = bind(sock_fd, (struct sockaddr*)&src_addr,
- sizeof(src_addr));
- printf("bind returns %d\n",ret);
-
- memset(&dest_addr, 0, sizeof(dest_addr));
- dest_addr.nl_family = AF_NETLINK;
- dest_addr.nl_pid = 0; /* For Linux Kernel */
- dest_addr.nl_groups = 0; /* unicast */
-
- nlh=(struct nlmsghdr *)malloc(NLMSG_SPACE(MAX_PAYLOAD));
- /* Fill the netlink message header */
- nlh->nlmsg_len = NLMSG_SPACE(MAX_PAYLOAD);
- nlh->nlmsg_pid = 1;//getpid(); /* self pid */
- nlh->nlmsg_flags = 0;
-
- iov.iov_base = (void *)nlh;
- iov.iov_len = nlh->nlmsg_len;
- memset(&msg,0,sizeof(msg));
- msg.msg_name = (void *)&dest_addr;
- msg.msg_namelen = sizeof(dest_addr);
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
-
-
- /* Read message from kernel */
- memset(nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
-
- while (1) {
- len = recvmsg(sock_fd, &msg, 0);
-
-
- if (len<0) {
-
- // exit(-1);
- } else {
- printf("Received socket with length %d (nlmsg_len = %d)\n",len,nlh->nlmsg_len);
- }
-
- usleep(1000);
- i=i+1;
-
- if ((i % 100) == 0)
- printf("%d\n",i);
-
- /*
- for (i=0;inlmsg_len - sizeof(struct nlmsghdr);i++) {
- printf("%x ",
- ((unsigned char *)NLMSG_DATA(nlh))[i]);
- }
- */
- }
-
- /* Close Netlink Socket */
-
-}
-
-
-
-
diff --git a/openair2/NETWORK_DRIVER/MESH/classifier.c b/openair2/NETWORK_DRIVER/MESH/classifier.c
deleted file mode 100644
index 32d60917f6..0000000000
--- a/openair2/NETWORK_DRIVER/MESH/classifier.c
+++ /dev/null
@@ -1,758 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file classifier.c
-* \brief Classify IP packets
-* \author Navid Nikaein, Lionel GAUTHIER, Raymond knopp
-* \company Eurecom
-* \email: navid.nikaein@eurecom.fr, lionel.gauthier@eurecom.fr, knopp@eurecom.fr
-*/
-
-
-#include "local.h"
-#include "proto_extern.h"
-
-#include
-#include
-
-
-//#define MPLS
-
-#ifdef MPLS
- #include
-#endif
-
-
-//#define NAS_DEBUG_CLASS 1
-//#define NAS_DEBUG_SEND 1
-
-//---------------------------------------------------------------------------
-// Add a new classifier rule (send direction)
-struct classifier_entity *nas_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref) {
- //---------------------------------------------------------------------------
- struct classifier_entity *gc;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_ADD_SCLASSIFIER: begin for dscp %d, classref %d\n", dscp,classref);
-#endif
-
- if (cx==NULL) {
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_ADD_SCLASSIFIER - input parameter cx is NULL \n");
-#endif
- return NULL;
- }
-
- for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next) {
- if (gc->classref==classref) {
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_ADD_SCLASSIFIER: classifier already exist for dscp %d, classref %d\n",dscp,classref);
-#endif
- return gc;
- }
- }
-
- gc=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_KERNEL);
-
- if (gc==NULL)
- return NULL;
-
- gc->next=cx->sclassifier[dscp];
- gc->classref=classref;
- cx->sclassifier[dscp]=gc;
- ++cx->nsclassifier;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_ADD_SCLASSIFIER: classifier created for dscp %d, classref %d\n",dscp,classref);
-#endif
- return gc;
-}
-
-//---------------------------------------------------------------------------
-// Add a new classifier rule (receive direction)
-struct classifier_entity *nas_CLASS_add_rclassifier(uint8_t dscp,
- uint16_t classref,
- struct nas_priv *gpriv) {
- //---------------------------------------------------------------------------
- struct classifier_entity *gc;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_ADD_RCLASSIFIER: begin\n");
-#endif
-
- for (gc=gpriv->rclassifier[dscp]; gc!=NULL; gc=gc->next) {
- if (gc->classref==classref) {
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_ADD_RCLASSIFIER: classifier already exist for dscp %d, classref %d\n",dscp,classref);
-#endif
- return gc;
- }
- }
-
- gc=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_KERNEL);
-
- if (gc==NULL)
- return NULL;
-
- gc->next=gpriv->rclassifier[dscp];
- gc->classref=classref;
- gpriv->rclassifier[dscp]=gc;
- ++gpriv->nrclassifier;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_ADD_RCLASSIFIER: classifier created for dscp %d, classref %d\n",dscp,classref);
-#endif
- return gc;
-}
-
-//---------------------------------------------------------------------------
-// Add a new classifier rule (forwarding)
-struct classifier_entity *nas_CLASS_add_fclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref) {
- //---------------------------------------------------------------------------
- struct classifier_entity *gc;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_ADD_FCLASSIFIER: begin for dscp %d, classref %d\n", dscp,classref);
-#endif
-
- if (cx==NULL) {
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_ADD_FCLASSIFIER - input parameter cx is NULL \n");
-#endif
- return NULL;
- }
-
- for (gc=cx->fclassifier[dscp]; gc!=NULL; gc=gc->next) {
- if (gc->classref==classref) {
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_ADD_SCLASSIFIER: classifier already exist for dscp %d, classref %d\n",dscp,classref);
-#endif
- return gc;
- }
- }
-
- gc=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_KERNEL);
-
- if (gc==NULL)
- return NULL;
-
- gc->next=cx->fclassifier[dscp];
- gc->classref=classref;
- cx->fclassifier[dscp]=gc;
- ++cx->nfclassifier;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_ADD_FCLASSIFIER: classifier created for dscp %d, classref %d\n",dscp,classref);
-#endif
- return gc;
-}
-
-
-//---------------------------------------------------------------------------
-void nas_CLASS_flush_sclassifier(struct cx_entity *cx) {
- //---------------------------------------------------------------------------
- uint8_t dscpi;
- struct classifier_entity *gc;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_FLUSH_SCLASSIFIER: begin\n");
-#endif
-
- if (cx==NULL) {
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_FLUSH_SCLASSIFIER - input parameter cx is NULL \n");
-#endif
- return;
- }
-
- //
- for (dscpi=0; dscpisclassifier[dscpi]; gc!=NULL; gc=cx->sclassifier[dscpi]) {
- cx->sclassifier[dscpi]=gc->next;
- kfree(gc);
- }
- }
-
- cx->nsclassifier=0;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_FLUSH_SCLASSIFIER: end\n");
-#endif
-}
-//---------------------------------------------------------------------------
-void nas_CLASS_flush_fclassifier(struct cx_entity *cx) {
- //---------------------------------------------------------------------------
- uint8_t dscpi;
- struct classifier_entity *gc;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_FLUSH_FCLASSIFIER: begin\n");
-#endif
-
- if (cx==NULL) {
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_FLUSH_FCLASSIFIER - input parameter cx is NULL \n");
-#endif
- return;
- }
-
- //
- for (dscpi=0; dscpifclassifier[dscpi]; gc!=NULL; gc=cx->fclassifier[dscpi]) {
- cx->fclassifier[dscpi]=gc->next;
- kfree(gc);
- }
- }
-
- cx->nfclassifier=0;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_FLUSH_FCLASSIFIER: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-void nas_CLASS_flush_rclassifier(struct nas_priv *gpriv) {
- //---------------------------------------------------------------------------
- uint8_t dscpi;
- struct classifier_entity *gc;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_FLUSH_RCLASSIFIER: begin\n");
-#endif
-
- for (dscpi=0; dscpirclassifier[dscpi]; gc!=NULL; gc=gpriv->rclassifier[dscpi]) {
- gpriv->rclassifier[dscpi]=gc->next;
- kfree(gc);
- }
- }
-
- gpriv->nrclassifier=0;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_FLUSH_RCLASSIFIER: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete a classifier rule (send direction)
-void nas_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref) {
- //---------------------------------------------------------------------------
- struct classifier_entity *p,*np;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_DEL_SCLASSIFIER: begin\n");
-#endif
-
- if (cx==NULL) {
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_DEL_SCLASSIFIER - input parameter cx is NULL \n");
-#endif
- return;
- }
-
- //
- p=cx->sclassifier[dscp];
-
- if (p==NULL)
- return;
-
- if (p->classref==classref) {
- cx->sclassifier[dscp]=p->next;
- kfree(p);
- --cx->nsclassifier;
- return;
- }
-
- for (np=p->next; np!=NULL; p=np) {
- if (np->classref==classref) {
- p->next=np->next;
- kfree(np);
- --cx->nsclassifier;
- return;
- }
- }
-
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_DEL_SCLASSIFIER: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete a classifier rule (send direction)
-void nas_CLASS_del_fclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref) {
- //---------------------------------------------------------------------------
- struct classifier_entity *p,*np;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_DEL_FCLASSIFIER: begin\n");
-#endif
-
- if (cx==NULL) {
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_DEL_FCLASSIFIER - input parameter cx is NULL \n");
-#endif
- return;
- }
-
- //
- p=cx->fclassifier[dscp];
-
- if (p==NULL)
- return;
-
- if (p->classref==classref) {
- cx->fclassifier[dscp]=p->next;
- kfree(p);
- --cx->nfclassifier;
- return;
- }
-
- for (np=p->next; np!=NULL; p=np) {
- if (np->classref==classref) {
- p->next=np->next;
- kfree(np);
- --cx->nfclassifier;
- return;
- }
- }
-
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_DEL_FCLASSIFIER: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete a classifier rule (receive direction)
-void nas_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref,struct nas_priv *gpriv) {
- //---------------------------------------------------------------------------
- struct classifier_entity *p,*np;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_DEL_RCLASSIFIER: begin\n");
-#endif
- p=gpriv->rclassifier[dscp];
-
- if (p==NULL)
- return;
-
- if (p->classref==classref) {
- gpriv->rclassifier[dscp]=p->next;
- kfree(p);
- --gpriv->nrclassifier;
- return;
- }
-
- for (np=p->next; np!=NULL; p=np) {
- if (np->classref==classref) {
- p->next=np->next;
- kfree(np);
- --gpriv->nrclassifier;
- return;
- }
- }
-
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_DEL_RCLASSIFIER: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Search the entity with the IPv6 address 'addr'
-// Navid: the ipv6 classifier is not fully tested
-struct cx_entity *nas_CLASS_cx6(struct sk_buff *skb,
- unsigned char dscp,
- struct nas_priv *gpriv,
- int inst,
- unsigned char *cx_searcher) {
- //---------------------------------------------------------------------------
- unsigned char cxi;
- unsigned int *addr,*dst=NULL;
- struct cx_entity *default_ip=NULL;
- struct classifier_entity *p=NULL;
-
- if (skb!=NULL) {
- for (cxi=*cx_searcher; cxicx[cxi].sclassifier[dscp];
-
- while (p!=NULL) {
- if (p->version == 6) { // verify that this is an IPv4 rule
- if ((addr = (unsigned int *)(&(p->daddr.ipv6)))== NULL) {
- printk("nas_CLASS_cx6: addr is null \n");
- p = p->next;
- continue;
- }
-
-#ifdef NAS_DEBUG_CLASS
- printk("cx %d : %X,%X.%X,%X\n",cxi,addr[0],addr[1],addr[2],addr[3]);
-#endif //NAS_DEBUG_CLASS
-
-
- if ( (dst = &((struct iphdr *)(skb_network_header(skb)))->daddr) == NULL) {
- printk("nas_CLASS_cx6: dst addr is null \n");
- p = p->next;
- continue;
- }
-
- if ((addr[0] == dst[0]) &&
- (addr[1] == dst[1]) &&
- (addr[2] == dst[2]) &&
- (addr[3] == dst[3])) {
- //#ifdef NAS_DEBUG_CLASS
- printk("nas_CLASS_cx6: found cx %d: %X.%X.%X.%X\n",cxi,
- dst[0],
- dst[1],
- dst[2],
- dst[3]);
- //#endif //NAS_DEBUG_CLASS
- return gpriv->cx+cxi;
- }
-
- /*
- else if ((addr[0]==NAS_DEFAULT_IPV6_ADDR0) &&
- (addr[1]==NAS_DEFAULT_IPV6_ADDR1) &&
- (addr[2]==NAS_DEFAULT_IPV6_ADDR2) &&
- (addr[3]==NAS_DEFAULT_IPV6_ADDR3))
- default_ip = gpriv->cx+cxi;
- */
- }
-
- // Go to next classifier entry for connection
- p = p->next;
- }
- }
- }
-
-
- if (dst ) {
- printk("nas_CLASS_cx6 NOT FOUND: %X.%X.%X.%X\n",
- dst[0],
- dst[1],
- dst[2],
- dst[3]);
- }
-
- return default_ip;
-}
-
-//---------------------------------------------------------------------------
-// Search the entity with the IPv4 address 'addr'
-struct cx_entity *nas_CLASS_cx4(struct sk_buff *skb,
- unsigned char dscp,
- struct nas_priv *gpriv,
- int inst,
- unsigned char *cx_searcher) {
- //---------------------------------------------------------------------------
- unsigned char cxi;
- unsigned char *addr;
- uint32_t daddr;
- struct cx_entity *default_ip=NULL;
- struct classifier_entity *p=NULL;
-
- // if (inst >0)
- // return(gpriv->cx); //dump to clusterhead
-
- if (skb!=NULL) {
- daddr = ((struct iphdr *)(skb_network_header(skb)))->daddr;
-
- if (daddr!=0) {
-#ifdef NAS_DEBUG_CLASS
- printk("[NAS][CLASS][IPv4] Searching for %d.%d.%d.%d\n",
- ((unsigned char *)&daddr)[0],
- ((unsigned char *)&daddr)[1],
- ((unsigned char *)&daddr)[2],
- ((unsigned char *)&daddr)[3]);
-#endif
-
- for (cxi=*cx_searcher; cxicx[cxi].sclassifier[dscp];
-
- while (p!=NULL) {
- if (p->version == 4) { // verify that this is an IPv4 rule
-#ifdef NAS_DEBUG_CLASS
- addr = (char *)(&(p->daddr.ipv4));
- printk("found classifier cx %d for destination: %d.%d.%d.%d\n",cxi,addr[0],addr[1],addr[2],addr[3]);
-#endif //NAS_DEBUG_CLASS
-
- if ((p->daddr.ipv4)== daddr) {
- addr = (char *)(&(p->daddr.ipv4));
-#ifdef NAS_DEBUG_CLASS
- printk("found cx %d: %d.%d.%d.%d\n",cxi,
- addr[0],
- addr[1],
- addr[2],
- addr[3]);
-#endif //NAS_DEBUG_CLASS
- return gpriv->cx+cxi;
- }
-
- /*
- else if (gpriv->cx[cxi].sclassifier[dscp]->daddr.ipv4==NAS_DEFAULT_IPV4_ADDR) {
- #ifdef NAS_DEBUG_CLASS
- printk("found default_ip rule\n");
- #endif //NAS_DEBUG_CLASS
- default_ip = gpriv->cx+cxi;
- }
- */
- }
-
- // goto to next classification rule for the connection
- p = p->next;
- }
- }
- }
- }
-
- return default_ip;
-}
-
-#ifdef MPLS
-//---------------------------------------------------------------------------
-// Search the entity with the mpls label and given exp
-struct cx_entity *nas_CLASS_MPLS(struct sk_buff *skb,
- unsigned char exp,
- struct nas_priv *gpriv,
- int inst,
- unsigned char *cx_searcher) {
- //---------------------------------------------------------------------------
- unsigned char cxi;
- struct cx_entity *default_label=NULL;
- struct classifier_entity *p=NULL;
- // if (inst >0)
- // return(gpriv->cx); //dump to clusterhead
-#ifdef NAS_DEBUG_CLASS
- printk("[NAS][CLASS][MPLS] Searching for label %d\n",MPLSCB(skb)->label);
-#endif
-
- for (cxi=*cx_searcher; cxicx[cxi].sclassifier[exp];
-
- while (p!=NULL) {
- if (p->version == NAS_MPLS_VERSION_CODE) { // verify that this is an MPLS rule
-#ifdef NAS_DEBUG_CLASS
- printk("cx %d : label %d\n",cxi,p->daddr.mpls_label);
-#endif //NAS_DEBUG_CLASS
-
- if (p->daddr.mpls_label==MPLSCB(skb)->label) {
-#ifdef NAS_DEBUG_CLASS
- printk("found cx %d: label %d, RB %d\n",cxi,
- MPLSCB(skb)->label,
- p->rab_id);
-#endif //NAS_DEBUG_CLASS
- return gpriv->cx+cxi;
- }
-
- /*
- else if (gpriv->cx[cxi].sclassifier[dscp]->daddr.ipv4==NAS_DEFAULT_IPV4_ADDR) {
- #ifdef NAS_DEBUG_CLASS
- printk("found default_ip rule\n");
- #endif //NAS_DEBUG_CLASS
- default_ip = gpriv->cx+cxi;
- }
- */
- }
-
- // goto to next classification rule for the connection
- p = p->next;
- }
- }
-
- return default_label;
-}
-
-#endif
-
-//---------------------------------------------------------------------------
-// Search the sending function
-void nas_CLASS_send(struct sk_buff *skb,int inst) {
- //---------------------------------------------------------------------------
- struct classifier_entity *p, *sp;
- uint8_t *protocolh,version;
- uint8_t protocol, dscp /*, exp,label*/ ;
- uint16_t classref;
- struct cx_entity *cx;
- //unsigned int i;
- //unsigned int router_adv = 0;
- struct net_device *dev=nasdev[inst];
- struct nas_priv *gpriv=netdev_priv(dev);
- unsigned char cx_searcher,no_connection=1;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_SEND: begin - inst %d\n",inst);
-#endif
-
- if (skb==NULL) {
-#ifdef NAS_DEBUG_SEND
- printk("NAS_CLASS_SEND - input parameter skb is NULL \n");
-#endif
- return;
- }
-
-#ifdef NAS_DEBUG_SEND
- printk("[NAS][CLASS][SEND] Got packet from kernel:\n");
-
- for (int i=0; i<256; i++)
- printk("%2x ",((unsigned char *)skb->data)[i]);
-
- printk("\n");
-#endif
- // find all connections related to socket
- cx_searcher = 0;
- no_connection = 1;
- //while (cx_searcherprotocol)) {
- case ETH_P_IPV6:
- version = 6;
- protocolh=nas_TOOL_get_protocol6(
- (struct ipv6hdr *)(skb_network_header(skb)),
- &protocol);
- dscp=nas_TOOL_get_dscp6(
- (struct ipv6hdr *)(skb_network_header(skb))
- );
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_SEND: %p %d %p %d %p \n",skb, dscp, gpriv, inst, &cx_searcher);
-#endif
- cx=nas_CLASS_cx6(skb,dscp,gpriv,inst,&cx_searcher);
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_SEND: Got IPv6 packet, dscp = %d\n",dscp);
-#endif
- break;
-
- case ETH_P_IP:
- dscp=nas_TOOL_get_dscp4((struct iphdr *)(skb_network_header(skb)));
- cx=nas_CLASS_cx4(skb,dscp,gpriv,inst,&cx_searcher);
- protocolh=nas_TOOL_get_protocol4(
- (struct iphdr *)(skb_network_header(skb)),
- &protocol);
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_SEND: Got IPv4 packet (%x), dscp = %d, cx = %x\n",ntohs(skb->protocol),dscp,cx);
-#endif
- version = 4;
- break;
-#ifdef MPLS
-
- case ETH_P_MPLS_UC:
- cx=nas_CLASS_MPLS(skb,MPLSCB(skb)->exp,gpriv,inst,&cx_searcher);
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_SEND: Got MPLS unicast packet, exp = %d, label = %d, cx = %x\n",MPLSCB(skb)->exp,MPLSCB(skb)->label,cx);
-#endif
- dscp = MPLSCB(skb)->exp;
- version = NAS_MPLS_VERSION_CODE;
- protocol = version;
- break;
-#endif
-
- default:
- printk("NAS_CLASS_SEND: Unknown protocol\n");
- version = 0;
- return;
- }
-
- // If a valid connection for the DSCP/EXP with destination address
- // is found scan all protocol-based classification rules
-
- if (cx) {
- classref=0;
- sp=NULL;
-#ifdef NAS_DEBUG_CLASS
- printk("[NAS][CLASSIFIER] DSCP/EXP %d : looking for classifier entry\n",dscp);
-#endif
-
- for (p=cx->sclassifier[dscp]; p!=NULL; p=p->next) {
-#ifdef NAS_DEBUG_CLASS
- printk("[NAS][CLASSIFIER] DSCP %d p->classref=%d,p->protocol=%d,p->version=%d\n",dscp,p->classref,p->protocol,p->version);
-#endif
- // Check if transport protocol/message match
- /*
- if ((p->protocol == protocol))
- if ((protocol == NAS_PROTOCOL_ICMP6) && (version == 6))
- if (p->protocol_message_type == (p->protocol_message_type )) {
- printk("[GRAAL][CLASSIFIER] Router advertisement\n");
- }
- */
- // normal rule checks that network protocol version matches
-
- if (p->version == version) {
- sp=p;
- classref=sp->classref;
- break;
- }
- }
-
- if (sp!=NULL) {
-#ifdef NAS_DEBUG_CLASS
- char sfct[10], sprotocol[10];
-
- if (sp->fct==nas_COMMON_QOS_send)
- strcpy(sfct, "qos");
-
- if (sp->fct==nas_CTL_send)
- strcpy(sfct, "ctl");
-
- if (sp->fct==nas_COMMON_del_send)
- strcpy(sfct, "del");
-
- if (sp->fct==nas_mesh_DC_send_sig_data_request)
- strcpy(sfct, "dc");
-
- switch(protocol) {
- case NAS_PROTOCOL_UDP:
- strcpy(sprotocol, "udp");
- printk("udp packet\n");
- break;
-
- case NAS_PROTOCOL_TCP:
- strcpy(sprotocol, "tcp");
- printk("tcp packet\n");
- break;
-
- case NAS_PROTOCOL_ICMP4:
- strcpy(sprotocol, "icmp4");
- printk("icmp4 packet\n");
- break;
-
- case NAS_PROTOCOL_ICMP6:
- strcpy(sprotocol, "icmp6");
- print_TOOL_pk_icmp6((struct icmp6hdr *)protocolh);
- break;
-#ifdef MPLS
-
- case NAS_MPLS_VERSION_CODE:
- strcpy(sprotocol,"mpls");
- break;
-#endif
- }
-
- printk("NAS_CLASS_SEND: (dscp %u, %s) received, (classref %u, fct %s, rab_id %u) classifier rule\n",
- dscp, sprotocol, sp->classref, sfct, sp->rab_id);
-#endif
- sp->fct(skb, cx, sp,inst, NULL);
- } // if classifier entry match found
- else {
- printk("NAS_CLASS_SEND: no corresponding item in the classifier, so the message is dropped\n");
- // nas_COMMON_del_send(skb, cx, NULL,inst);
- }
-
- no_connection = 0;
- } // if connection found
-
-#ifdef NAS_DEBUG_CLASS
-
- if (no_connection == 1)
- printk("NAS_CLASS_SEND: no corresponding connection, so the message is dropped\n");
-
-#endif /* NAS_DEBUG_CLASS */
- // } // while loop over connections
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_CLASS_SEND: end\n");
-#endif
-}
diff --git a/openair2/NETWORK_DRIVER/MESH/common.c b/openair2/NETWORK_DRIVER/MESH/common.c
deleted file mode 100644
index c04acded3e..0000000000
--- a/openair2/NETWORK_DRIVER/MESH/common.c
+++ /dev/null
@@ -1,618 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file common.c
-* \brief implementation of emultor tx and rx
-* \author Navid Nikaein, Lionel GAUTHIER, and Raymomd Knopp
-* \date 2011
-* \version 1.0
-* \company Eurecom
-* \email: navid.nikaein@eurecom.fr, lionel.gauthier@eurecom.fr
-*/
-
-#include "local.h"
-#include "proto_extern.h"
-
-//#define NAS_DEBUG_RECEIVE 1
-//#define NAS_DEBUG_SEND 1
-//#define NAS_DEBUG_CLASS 1
-//#define NAS_ADDRESS_FIX 1
-
-#include
-
-#include
-#include
-
-
-void nas_COMMON_receive(uint16_t dlen,
- void *pdcp_sdu,
- int inst,
- struct classifier_entity *rclass,
- nasRadioBearerId_t rb_id)
-{
-
- //---------------------------------------------------------------------------
- struct sk_buff *skb;
- struct ipversion *ipv;
- struct nas_priv *gpriv=netdev_priv(nasdev[inst]);
-
- //int i;
-
- unsigned char protocol;
-
-
- //struct udphdr *uh;
- //struct tcphdr *th;
-
- struct iphdr *network_header;
-
-#ifdef NAS_DEBUG_RECEIVE
-
- printk("NAS_COMMON_RECEIVE: begin RB %d Inst %d Length %d bytes\n",rb_id,inst,dlen);
-#endif
- skb = dev_alloc_skb( dlen + 2 );
-
- if(!skb) {
- printk("NAS_COMMON_RECEIVE: low on memory\n");
- ++gpriv->stats.rx_dropped;
- return;
- }
-
- skb_reserve(skb,2);
- memcpy(skb_put(skb, dlen), pdcp_sdu,dlen);
-
- skb->dev = nasdev[inst];
-
- skb_reset_mac_header(skb);
- //printk("[NAC_COMMIN_RECEIVE]: Packet Type %d (%d,%d)",skb->pkt_type,PACKET_HOST,PACKET_BROADCAST);
- skb->pkt_type = PACKET_HOST;
-
- if (rclass->version != NAS_MPLS_VERSION_CODE) { // This is an IP packet
-
- skb->ip_summed = CHECKSUM_NONE;
-
-
- ipv = (struct ipversion *)skb->data;
-
- switch (ipv->version) {
- case 6:
-#ifdef NAS_DEBUG_RECEIVE
- printk("NAS_COMMON_RECEIVE: receive IPv6 message\n");
-#endif
-
-
- skb_reset_network_header(skb);
-
- skb->protocol = htons(ETH_P_IPV6);
- // printk("Writing packet with protocol %x\n",ntohs(skb->protocol));
-
- break;
-
- case 4:
-#ifdef NAS_ADDRESS_FIX
- // Make the third byte of both the source and destination equal to the fourth of the destination
-
- unsigned char * ifaddr, *saddr, daddr;
- uint32_t odaddr = 0, osaddr;
- daddr = (unsigned char *)&((struct iphdr *)skb->data)->daddr;
- odaddr = ((struct iphdr *)skb->data)->daddr;
- //sn = addr[3];
- saddr = (unsigned char *)&((struct iphdr *)skb->data)->saddr;
- osaddr = ((struct iphdr *)skb->data)->saddr;
-
- if (daddr[0] == saddr[0]) {// same network
- daddr[2] = daddr[3]; // set third byte of destination to that of local machine so that local IP stack accepts the packet
- saddr[2] = daddr[3]; // set third byte of source to that of local machine so that local IP stack accepts the packet
- } else { // get the 3rd byte from device address in net_device structure
- ifaddr = (unsigned char *)(&(((struct in_device *)((nasdev[inst])->ip_ptr))->ifa_list->ifa_local));
-
- if (saddr[0] == ifaddr[0]) { // source is in same network as local machine
- daddr[0] += saddr[3]; // fix address of remote destination to undo change at source
- saddr[2] = ifaddr[2]; // set third byte to that of local machine so that local IP stack accepts the packet
- } else { // source is remote machine from outside network
- saddr[0] -= daddr[3]; // fix address of remote source to be understood by destination
- daddr[2] = daddr[3]; // fix 3rd byte of local address to be understood by IP stack of
- // destination
- }
- }
-
-#endif //NAS_ADDRESS_FIX
-#ifdef NAS_DEBUG_RECEIVE
- // printk("NAS_TOOL_RECEIVE: receive IPv4 message\n");
- addr = (unsigned char *)&((struct iphdr *)skb->data)->saddr;
-
- if (addr) {
- // addr[2]^=0x01;
- printk("[NAS][COMMON][RECEIVE] Source %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
- }
-
- addr = (unsigned char *)&((struct iphdr *)skb->data)->daddr;
-
- if (addr) {
- // addr[2]^=0x01;
- printk("[NAS][COMMON][RECEIVE] Dest %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
- }
-
- printk("[NAS][COMMON][RECEIVE] protocol %d\n",((struct iphdr *)skb->data)->protocol);
-
-#endif
-
- skb_reset_network_header(skb);
- network_header = (struct iphdr *)skb_network_header(skb);
- protocol = network_header->protocol;
-
-#ifdef NAS_DEBUG_RECEIVE
-
- switch (protocol) {
- case IPPROTO_IP:
- printk("[NAS][COMMON][RECEIVE] Received Raw IPv4 packet\n");
- break;
-
- case IPPROTO_IPV6:
- printk("[NAS][COMMON][RECEIVE] Received Raw IPv6 packet\n");
- break;
-
- case IPPROTO_ICMP:
- printk("[NAS][COMMON][RECEIVE] Received Raw ICMP packet\n");
- break;
-
- case IPPROTO_TCP:
- printk("[NAS][COMMON][RECEIVE] Received TCP packet\n");
- break;
-
- case IPPROTO_UDP:
- printk("[NAS][COMMON][RECEIVE] Received UDP packet\n");
- break;
-
- default:
- break;
- }
-
-#endif
-
-#ifdef NAS_ADDRESS_FIX
-
-#ifdef NAS_DEBUG_RECEIVE
- printk("NAS_COMMON_RECEIVE: dumping the packet before the csum recalculation (len %d)\n",skb->len);
-
- for (i=0; ilen; i++)
- printk("%2x ",((unsigned char *)(skb->data))[i]);
-
- printk("\n");
-#endif //NAS_DEBUG_RECEIVE
-
-
- network_header->check = 0;
- network_header->check = ip_fast_csum((unsigned char *) network_header,
- network_header->ihl);
-#ifdef NAS_DEBUG_RECEIVE
- printk("[NAS][COMMON][RECEIVE] IP Fast Checksum %x \n", network_header->check);
-#endif
-
- // if (!(skb->nh.iph->frag_off & htons(IP_OFFSET))) {
-
-
-
-
- switch(protocol) {
-
- case IPPROTO_TCP:
-
- uint16_t *cksum,check;
- cksum = (uint16_t*)&(((struct tcphdr*)(((char *)network_header + (network_header->ihl<<2))))->check);
- //check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, tcp_hdrlen(skb), IPPROTO_TCP, ~(*cksum));
-
-#ifdef NAS_DEBUG_RECEIVE
- printk("[NAS][COMMON] Inst %d TCP packet calculated CS %x, CS = %x (before), SA (%x)%x, DA (%x)%x\n",
- inst,
- network_header->check,
- *cksum,
- osaddr,
- ((struct iphdr *)skb->data)->saddr,
- odaddr,
- ((struct iphdr *)skb->data)->daddr);
-#endif
- check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr,0,0, ~(*cksum));
- *cksum = csum_tcpudp_magic(~osaddr, ~odaddr, 0, 0, ~check);
-
-#ifdef NAS_DEBUG_RECEIVE
- printk("[NAS][COMMON] Inst %d TCP packet NEW CS %x\n",
- inst,
- *cksum);
-#endif
- break;
-
- case IPPROTO_UDP:
-
- cksum = (uint16_t*)&(((struct udphdr*)(((char *)network_header + (network_header->ihl<<2))))->check);
- // check = csum_tcpudp_magic(((struct iphdr *)network_header)->saddr, ((struct iphdr *)network_header)->daddr, udp_hdr(skb)->len, IPPROTO_UDP, ~(*cksum));
-#ifdef NAS_DEBUG_RECEIVE
- printk("[NAS][COMMON] Inst %d UDP packet CS = %x (before), SA (%x)%x, DA (%x)%x\n",
- inst,
- *cksum,
- osaddr,
- ((struct iphdr *)skb->data)->saddr,
- odaddr,
- ((struct iphdr *)skb->data)->daddr);
-#endif
- check = csum_tcpudp_magic(((struct iphdr *)skb->data)->saddr, ((struct iphdr *)skb->data)->daddr, 0,0, ~(*cksum));
- *cksum= csum_tcpudp_magic(~osaddr, ~odaddr,0,0, ~check);
- //*cksum= csum_tcpudp_magic(~osaddr, ~odaddr,udp_hdr(skb)->len, IPPROTO_UDP, ~check);
-
-#ifdef NAS_DEBUG_RECEIVE
- printk("[NAS][COMMON] Inst %d UDP packet NEW CS %x\n",
- inst,
- *cksum);
-#endif
- // if ((check = *cksum) != 0) {
- // src, dst, len, proto, sum
-
-
- // }
-
- break;
-
- default:
- break;
- }
-
- // }
-
-#endif //NAS_ADDRESS_FIX
-
- skb->protocol = htons(ETH_P_IP);
- // printk("[NAS][COMMON] Writing packet with protocol %x\n",ntohs(skb->protocol));
- break;
-
- default:
- printk("NAS_COMMON_RECEIVE: begin RB %d Inst %d Length %d bytes\n",rb_id,inst,dlen);
-
- printk("[NAS][COMMON] Inst %d: receive unknown message (version=%d)\n",inst,ipv->version);
-
- }
- } else { // This is an MPLS packet
-
-#ifdef NAS_DEBUG_RECEIVE
- printk("NAS_COMMON_RECEIVE: Received an MPLS packet on RB %d\n",rb_id);
-#endif
- skb->protocol = htons(ETH_P_MPLS_UC);
-
- }
-
- ++gpriv->stats.rx_packets;
- gpriv->stats.rx_bytes += dlen;
-#ifdef NAS_DEBUG_RECEIVE
- printk("NAS_COMMON_RECEIVE: sending packet of size %d to kernel\n",skb->len);
-
- for (i=0; ilen; i++)
- printk("%2x ",((unsigned char *)(skb->data))[i]);
-
- printk("\n");
-#endif //NAS_DEBUG_RECEIVE
- netif_rx_ni(skb);
-#ifdef NAS_DEBUG_RECEIVE
- printk("NAS_COMMON_RECEIVE: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete the data
-void nas_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp,int inst,struct nas_priv *gpriv)
-{
- struct nas_priv *priv=netdev_priv(nasdev[inst]);
- //---------------------------------------------------------------------------
- ++priv->stats.tx_dropped;
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (QoS SAP)
-
-void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst, struct nas_priv *gpriv)
-{
- //---------------------------------------------------------------------------
- struct pdcp_data_req_header_s pdcph;
- struct nas_priv *priv=netdev_priv(nasdev[inst]);
-#ifdef LOOPBACK_TEST
- int i;
-#endif
- unsigned int bytes_wrote;
- //unsigned char j;
- // Start debug information
-#ifdef NAS_DEBUG_SEND
- printk("NAS_COMMON_QOS_SEND - inst %d begin \n",inst);
-#endif
-
- // if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
- // {
- // priv->stats.tx_dropped ++;
- // printk("NAS_QOS_SEND: No connected, so message are dropped \n");
- // return;
- // }
- if (skb==NULL) {
-#ifdef NAS_DEBUG_SEND
- printk("NAS_COMMON_QOS_SEND - input parameter skb is NULL \n");
-#endif
- return;
- }
-
- if (gc==NULL) {
-#ifdef NAS_DEBUG_SEND
- printk("NAS_COMMON_QOS_SEND - input parameter gc is NULL \n");
-#endif
- return;
- }
-
- if (cx==NULL) {
-#ifdef NAS_DEBUG_SEND
- printk("NAS_COMMON_QOS_SEND - input parameter cx is NULL \n");
-#endif
- return;
- }
-
- // End debug information
- if (gc->rb==NULL) {
- gc->rb=nas_COMMON_search_rb(cx, gc->rab_id);
-
- if (gc->rb==NULL) {
- ++priv->stats.tx_dropped;
- printk("NAS_COMMON_QOS_SEND: No corresponding Radio Bearer, so message are dropped, rab_id=%u \n", gc->rab_id);
- return;
- }
- }
-
-#ifdef NAS_DEBUG_SEND
- printk("NAS_COMMON_QOS_SEND #1 :");
- printk("lcr %u, rab_id %u, rab_id %u, skb_len %d\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id,skb->len);
- nas_print_classifier(gc);
-#endif
- pdcph.data_size = skb->len;
- pdcph.rb_id = (gc->rb)->rab_id;
- pdcph.inst = inst;
- pdcph.sourceL2Id = 0;
- pdcph.destinationL2Id = 0;
-
- bytes_wrote = nas_netlink_send((char *)&pdcph,NAS_PDCPH_SIZE);
-#ifdef NAS_DEBUG_SEND
- printk("[NAS] Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n",
- bytes_wrote,skb->len);
-#endif
-
- if (bytes_wrote != NAS_PDCPH_SIZE) {
- printk("NAS_COMMON_QOS_SEND: problem while writing PDCP's header (bytes wrote = %d )\n",bytes_wrote);
- printk("rb_id %ld, Wrote %d, Header Size %lu\n", pdcph.rb_id , bytes_wrote, NAS_PDCPH_SIZE);
- return;
- }
-
- bytes_wrote += nas_netlink_send((char *)skb->data,skb->len);
-
- if (bytes_wrote != skb->len+NAS_PDCPH_SIZE) {
- printk("NAS_COMMON_QOS_SEND: Inst %d, RB_ID %ld: problem while writing PDCP's data, bytes_wrote = %d, Data_len %d, PDCPH_SIZE %lu\n",
- inst,
- pdcph.rb_id,
- bytes_wrote,
- skb->len,
- NAS_PDCPH_SIZE); // congestion
- return;
- }
-
-#ifdef NAS_DEBUG_SEND
- printk("NAS_SEND: Sending packet of size %d to PDCP \n",skb->len);
-
- for (j=0; jlen; j++)
- printk("%2x ",((unsigned char *)(skb->data))[j]);
-
- printk("\n");
-#endif
-
- priv->stats.tx_bytes += skb->len;
- priv->stats.tx_packets ++;
-#ifdef NAS_DEBUG_SEND
- printk("NAS_COMMON_QOS_SEND - end \n");
-#endif
-}
-
-void nas_COMMON_QOS_receive(struct nlmsghdr *nlh)
-{
-
- struct pdcp_data_ind_header_s *pdcph = (struct pdcp_data_ind_header_s *)NLMSG_DATA(nlh);
- struct classifier_entity *rclass;
- struct nas_priv *priv;
-
- priv = netdev_priv(nasdev[pdcph->inst]);
-
-
-#ifdef NAS_DEBUG_RECEIVE
- printk("[NAS][COMMON][NETLINK] QOS receive from PDCP, size %d, rab %d, inst %d\n",
- pdcph->data_size,pdcph->rb_id,pdcph->inst);
-#endif //NAS_DEBUG_RECEIVE
-
- rclass = nas_COMMON_search_class_for_rb(pdcph->rb_id,priv);
-
- if (rclass) {
-#ifdef NAS_DEBUG_RECEIVE
- printk("[NAS][COMMON][NETLINK] Found corresponding connection in classifier for RAB\n");
-#endif //NAS_DEBUG_RECEIVE
-
- nas_COMMON_receive(pdcph->data_size,
- (unsigned char *)NLMSG_DATA(nlh) + NAS_PDCPH_SIZE,
- pdcph->inst,
- rclass,
- pdcph->rb_id);
- }
-
-}
-
-//---------------------------------------------------------------------------
-struct cx_entity *nas_COMMON_search_cx(nasLocalConnectionRef_t lcr,struct nas_priv *priv)
-{
- //---------------------------------------------------------------------------
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_COMMON_SEARCH_CX - lcr %d\n",lcr);
-#endif
-
- if (lcrcx+lcr;
- else
- return NULL;
-}
-
-//---------------------------------------------------------------------------
-// Search a Radio Bearer
-struct rb_entity *nas_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id)
-{
- //---------------------------------------------------------------------------
- struct rb_entity *rb;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_COMMON_SEARCH_RB - rab_id %d\n", rab_id);
-#endif
-
- for (rb=cx->rb; rb!=NULL; rb=rb->next) {
-#ifdef NAS_DEBUG_CLASS
- printk("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS\n");
- printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.rab_id %u \n", rb->rab_id, rab_id);
- //printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.sapi %u \n", rb->sapi);
- //printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.qos %u \n", rb->qos);
- //printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.state %u \n", rb->state);
- //printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.retry %u \n", rb->retry);
- //printk("NAS_COMMON_SEARCH_RB - rab_id %d Comparing rb_entity.countimer %u \n\n", rb->countimer);
-#endif
-
- if (rb->rab_id==rab_id)
- return rb;
- }
-
- return NULL;
-}
-
- //
- // Search for a classifier with corresponding radio bearer
-
- struct classifier_entity *nas_COMMON_search_class_for_rb(nasRadioBearerId_t rab_id,struct nas_priv *priv)
-{
-
- //struct rb_entity *rb;
- int dscp;
- struct classifier_entity *rclass;
-
-#ifdef NAS_DEBUG_CLASS
- printk("[NAS][COMMON] NAS_COMMON_SEARCH_CLASS_FOR_RB - rab_id %d\n", rab_id);
-#endif
-
- for (dscp=0; dscprclassifier[%d] = %p\n",dscp,priv->rclassifier[dscp]);
- for (rclass=priv->rclassifier[dscp]; rclass!=NULL; rclass=rclass->next) {
-#ifdef NAS_DEBUG_CLASS
- printk("[NAS][COMMON] NAS_COMMON_SEARCH_CLASS_FOR_RB - dscp %d, rb %d\n", dscp,rclass->rab_id);
-#endif
-
- if (rclass->rab_id==rab_id)
- return rclass;
- }
- }
-
- return NULL;
-
-}
-
-//---------------------------------------------------------------------------
-struct rb_entity *nas_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasQoSTrafficClass_t qos)
-{
- //--------------------------------------------------------------------------
- struct rb_entity *rb;
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_COMMON_ADD_RB - begin for rab_id %d , qos %d\n", rab_id, qos );
-#endif
-
- if (cx==NULL) {
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_COMMON_ADD_RB - input parameter cx is NULL \n");
-#endif
- return NULL;
- }
-
- rb=nas_COMMON_search_rb(cx, rab_id);
-
- if (rb==NULL) {
- rb=(struct rb_entity *)kmalloc(sizeof(struct rb_entity), GFP_KERNEL);
-
- if (rb!=NULL) {
- rb->retry=0;
- rb->countimer=NAS_TIMER_IDLE;
- rb->rab_id=rab_id;
- // rb->rab_id=rab_id+(32*cx->lcr);
-#ifdef NAS_DEBUG_DC
- printk("NAS_COMMON_ADD_RB: rab_id=%u, mt_id=%u\n",rb->rab_id, cx->lcr);
-#endif
- rb->qos=qos;
- rb->sapi=NAS_RAB_INPUT_SAPI;
- rb->state=NAS_IDLE;
- rb->next=cx->rb;
- cx->rb=rb;
- ++cx->num_rb;
- } else
- printk("NAS_ADD_CTL_RB: no memory\n");
- }
-
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_COMMON_ADD_RB - end \n" );
-#endif
- return rb;
-}
-
-//---------------------------------------------------------------------------
-void nas_COMMON_flush_rb(struct cx_entity *cx)
-{
- //---------------------------------------------------------------------------
- struct rb_entity *rb;
- struct classifier_entity *gc;
- uint8_t dscp;
- // End debug information
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_COMMON_FLUSH_RB - begin\n");
-#endif
-
- if (cx==NULL) {
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_COMMON_FLUSH_RB - input parameter cx is NULL \n");
-#endif
- return;
- }
-
- // End debug information
- for (rb=cx->rb; rb!=NULL; rb=cx->rb) {
- printk("NAS_COMMON_FLUSH_RB: del rab_id %u\n", rb->rab_id);
- cx->rb=rb->next;
- kfree(rb);
- }
-
- cx->num_rb=0;
- cx->rb=NULL;
-
- for(dscp=0; dscpsclassifier[dscp]; gc!=NULL; gc=gc->next)
- gc->rb=NULL;
- }
-
-#ifdef NAS_DEBUG_CLASS
- printk("NAS_COMMON_FLUSH_RB - end\n");
-#endif
-}
diff --git a/openair2/NETWORK_DRIVER/MESH/constant.h b/openair2/NETWORK_DRIVER/MESH/constant.h
deleted file mode 100644
index 5347c5a784..0000000000
--- a/openair2/NETWORK_DRIVER/MESH/constant.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#ifndef _NAS_CST
-#define _NAS_CST
-
-#define MAX_MEASURE_NB 5
-#define NAS_MAX_LENGTH 180
-
-//Debug flags
-//#define NAS_DEBUG_DC
-//#define NAS_DEBUG_SEND
-//#define NAS_DEBUG_RECEIVE
-//#define NAS_DEBUG_CLASS
-//#define NAS_DEBUG_GC
-//#define NAS_DEBUG_DC_MEASURE
-//#define NAS_DEBUG_TIMER
-//#define NAS_DEBUG_DEVICE
-//#define NAS_DEBUG_INTERRUPT
-//#define NAS_DEBUG_TOOL
-
-// Other flags
-#define DEMO_3GSM
-
-// General Constants
-#define NAS_MTU 1500
-#define NAS_TX_QUEUE_LEN 100
-#define NAS_ADDR_LEN 8
-#define NAS_INET6_ADDRSTRLEN 46
-#define NAS_INET_ADDRSTRLEN 16
-
-#define NAS_CX_MAX 32 //128 //Identical to RRC constant: no you cannot
-/* increase to 128 without risking stack problems: KEEP ATTENTION TO COMPILATION WARNINGS */
-//#define NAS_CX_MULTICAST_ALLNODE 2
-
-#define NAS_RETRY_LIMIT_DEFAULT 5
-
-#define NAS_MESSAGE_MAXLEN 5004
-
-#define NAS_SIG_SRB3 3
-#define NAS_SIG_SRB4 3 // not used yet
-
-//peer-to-peer messages between NAS entities
-#define NAS_CMD_OPEN_RB 1
-
-//#define NAS_IID1_CONTROL 0x0
-//#define NAS_IID2_CONTROL __constant_htonl(0xffffffff)
-
-//#define NAS_STATE_IDLE 0
-//#define NAS_STATE_CONNECTED 1
-//#define NAS_STATE_ESTABLISHMENT_REQUEST 2
-//#define NAS_STATE_ESTABLISHMENT_FAILURE 3
-//#define NAS_STATE_RELEASE_FAILURE 4
-#define NAS_CX_RELEASE_UNDEF_CAUSE 1
-
-// MT+RG NAS States
-#define NAS_IDLE 0x01
-// Connection
-#define NAS_CX_FACH 0x06
-#define NAS_CX_DCH 0x0A
-#define NAS_CX_RECEIVED 0x10
-#define NAS_CX_CONNECTING 0x04
-#define NAS_CX_RELEASING 0x08
-#define NAS_CX_CONNECTING_FAILURE 0x14
-#define NAS_CX_RELEASING_FAILURE 0x18
-// Radio Bearers
-#define NAS_RB_ESTABLISHING 0x24
-#define NAS_RB_RELEASING 0x28
-#define NAS_RB_DCH 0x2A
-
-
-#define NAS_TIMER_ESTABLISHMENT_DEFAULT 12
-#define NAS_TIMER_RELEASE_DEFAULT 2
-#define NAS_TIMER_IDLE UINT_MAX
-#define NAS_TIMER_TICK HZ
-
-#define NAS_PDCPH_SIZE sizeof(struct pdcp_data_req_header_s)
-#define NAS_IPV4_SIZE 20
-#define NAS_IPV6_SIZE 40
-
-#define NAS_DIRECTION_SEND 0
-#define NAS_DIRECTION_RECEIVE 1
-#define NAS_DIRECTION_FORWARD 2
-
-// function number
-#define NAS_FCT_DEL_SEND 1
-#define NAS_FCT_QOS_SEND 2
-#define NAS_FCT_DC_SEND 3
-#define NAS_FCT_CTL_SEND 4
-
-// type of IOCTL command
-#define NAS_IOCTL_RRM 0x89F0
-
-// Error cause
-#define NAS_ERROR_ALREADYEXIST 1
-#define NAS_ERROR_NOMEMORY 3
-#define NAS_ERROR_NOTMT 9
-#define NAS_ERROR_NOTRG 10
-#define NAS_ERROR_NOTIDLE 11
-#define NAS_ERROR_NOTCONNECTED 12
-#define NAS_ERROR_NORB 14
-#define NAS_ERROR_NOTCORRECTVALUE 32
-#define NAS_ERROR_NOTCORRECTLCR 33
-#define NAS_ERROR_NOTCORRECTDIR 34
-#define NAS_ERROR_NOTCORRECTDSCP 35
-#define NAS_ERROR_NOTCORRECTVERSION 36
-#define NAS_ERROR_NOTCORRECTRABI 37
-
-
-/**********************************************************/
-/* Constants related with IP protocols */
-/**********************************************************/
-
-//#define NAS_PORT_CONTROL __constant_htons(0xc45)
-//#define NAS_PORT_AUTHENTICATION __constant_htons(1811)
-
-#define NAS_TRAFFICCLASS_MASK __constant_htonl(0x0fc00000)
-
-// Network control codepoint 111000 + IP version 6
-#define NAS_FLOWINFO_NCONTROL __constant_htonl(0x6e000000)
-// network control codepoint 111000
-#define NAS_DSCP_NCONTROL 56 //0x38
-// default codepoint 1000000
-#define NAS_DSCP_DEFAULT 64
-#define NAS_DSCP_MAX 193
-
-#define NAS_PROTOCOL_DEFAULT 0
-#define NAS_PROTOCOL_TCP IPPROTO_TCP
-#define NAS_PROTOCOL_UDP IPPROTO_UDP
-#define NAS_PROTOCOL_ICMP4 IPPROTO_ICMP
-#define NAS_PROTOCOL_ICMP6 IPPROTO_ICMPV6
-
-#define NAS_PORT_DEFAULT __constant_htons(65535)
-#define NAS_PORT_HTTP __constant_htons(80)
-
-#define NAS_VERSION_DEFAULT 0
-#define NAS_VERSION_4 4
-#define NAS_VERSION_6 0 //?MW
-
-#define NAS_DEFAULT_IPV4_ADDR 0
-#define NAS_DEFAULT_IPV6_ADDR0 0
-#define NAS_DEFAULT_IPV6_ADDR1 0
-#define NAS_DEFAULT_IPV6_ADDR2 0
-#define NAS_DEFAULT_IPV6_ADDR3 0
-
-
-#define NAS_MPLS_VERSION_CODE 99
-
-#define NB_INSTANCES_MAX 64 //16
-
-
-#endif
-
-
-
diff --git a/openair2/NETWORK_DRIVER/MESH/device.c b/openair2/NETWORK_DRIVER/MESH/device.c
deleted file mode 100644
index d86e32e561..0000000000
--- a/openair2/NETWORK_DRIVER/MESH/device.c
+++ /dev/null
@@ -1,509 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file device.c
-* \brief Networking Device Driver for OpenAirInterface MESH
-* \author navid.nikaein, yan.moret(no longer valid), michelle.wetterwald, raymond.knopp
-* \company Eurecom
-* \email: raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr, michelle.wetterwald@eurecom.fr,
-
-*/
-/*******************************************************************************/
-
-#include "constant.h"
-#include "local.h"
-#include "proto_extern.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include