diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index ad97588d9b3cf80814d9eea138f4da52c02b78a5..d7d542f863f7ae3ae2bab44c6d4fd5b7f58bafee 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -8,7 +8,7 @@ pipeline { disableConcurrentBuilds() timestamps() gitLabConnection('OAI GitLab') - gitlabBuilds(builds: ["Build eNb-USRP", "Build basic-sim", "Build phy-sim", "Analysis with cppcheck"]) + gitlabBuilds(builds: ["Build eNb-USRP", "Build basic-sim", "Build phy-sim", "Build eNb-ethernet", "Build UE-ethernet", "Analysis with cppcheck", "Test phy-sim"]) } stages { @@ -47,33 +47,83 @@ pipeline { } } + stage ("Start VM -- cppcheck") { + steps { + sh "./ci-scripts/createVM.sh --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + } + } + + stage ("Start VM -- enb-usrp") { + steps { + sh "./ci-scripts/createVM.sh --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + } + } + + stage ("Start VM -- basic-sim") { + steps { + sh "./ci-scripts/createVM.sh --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + } + } + + stage ("Start VM -- phy-sim") { + steps { + sh "./ci-scripts/createVM.sh --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + } + } + + stage ("Start VM -- enb-ethernet") { + steps { + sh "./ci-scripts/createVM.sh --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + } + } + + stage ("Start VM -- ue-ethernet") { + steps { + sh "./ci-scripts/createVM.sh --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + } + } + stage ("Variant Builds") { parallel { stage ("Analysis with cppcheck") { steps { gitlabCommitStatus(name: "Analysis with cppcheck") { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck" + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } } stage ("Build eNb-USRP") { steps { gitlabCommitStatus(name: "Build eNb-USRP") { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp" + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } } stage ("Build basic simulator") { steps { gitlabCommitStatus(name: "Build basic-sim") { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim" + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } } stage ("Build physical simulators") { steps { gitlabCommitStatus(name: "Build phy-sim") { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim" + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + } + } + } + stage ("Build eNb-ethernet") { + steps { + gitlabCommitStatus(name: "Build eNb-ethernet") { + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + } + } + } + stage ("Build UE-ethernet") { + steps { + gitlabCommitStatus(name: "Build UE-ethernet") { + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } } @@ -82,7 +132,7 @@ pipeline { always { script { dir ('archives') { - sh "zip -r vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck" + sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth" } if(fileExists('archives/vm_build_logs.zip')) { archiveArtifacts artifacts: 'archives/vm_build_logs.zip' @@ -99,11 +149,49 @@ pipeline { } } } + + stage ("Variant Tests") { + parallel { + stage ("Test physical simulators") { + steps { + gitlabCommitStatus(name: "Test phy-sim") { + sh "./ci-scripts/runTestOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + } + } + } + stage ("Test basic simulator") { + steps { + //gitlabCommitStatus(name: "Test basic-sim") { + sh "./ci-scripts/runTestOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + //} + } + } + } + post { + always { + script { + dir ('archives') { + sh "if [ -d */test ]; then zip -r -qq vm_tests_logs.zip */test ; fi" + } + if(fileExists('archives/vm_tests_logs.zip')) { + archiveArtifacts artifacts: 'archives/vm_tests_logs.zip' + archiveArtifacts artifacts: 'archives/*/test/results_autotests*.xml' + } + } + } + } + } + stage ("Destroy all Virtual Machines") { + steps { + sh "./ci-scripts/destroyAllRunningVM.sh --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + } + } } post { always { script { - echo "End of script" + // Stage destroy may not be run if error in previous stage + sh "./ci-scripts/destroyAllRunningVM.sh --job-name ${JOB_NAME} --build-id ${BUILD_ID}" } } success { diff --git a/ci-scripts/buildOnVM.sh b/ci-scripts/buildOnVM.sh index b5fef44ba65415c76970ec7ae7bfb84d978403e0..c8ff90c11e33eff71da478af3a9d9d0039442240 100755 --- a/ci-scripts/buildOnVM.sh +++ b/ci-scripts/buildOnVM.sh @@ -15,13 +15,21 @@ function usage { echo "" echo "Options:" echo "--------" + echo " --job-name #### OR -jn ####" + echo " Specify the name of the Jenkins job." + echo "" + echo " --build-id #### OR -id ####" + echo " Specify the build ID of the Jenkins job." + echo "" echo " --workspace #### OR -ws ####" echo " Specify the workspace." echo "" - echo " --variant enb-usrp OR -v1" - echo " --variant basic-sim OR -v2" - echo " --variant phy-sim OR -v3" - echo " --variant cppcheck OR -v4" + echo " --variant enb-usrp OR -v1" + echo " --variant basic-sim OR -v2" + echo " --variant phy-sim OR -v3" + echo " --variant cppcheck OR -v4" + echo " --variant enb-ethernet OR -v7" + echo " --variant ue-ethernet OR -v8" echo " Specify the variant to build." echo "" echo " --keep-vm-alive OR -k" @@ -36,14 +44,16 @@ function variant_usage { echo "OAI VM Build Check script" echo " Original Author: Raphael Defosseux" echo "" - echo " --variant enb-usrp OR -v1" - echo " --variant basic-sim OR -v2" - echo " --variant phy-sim OR -v3" - echo " --variant cppcheck OR -v4" + echo " --variant enb-usrp OR -v1" + echo " --variant basic-sim OR -v2" + echo " --variant phy-sim OR -v3" + echo " --variant cppcheck OR -v4" + echo " --variant enb-ethernet OR -v7" + echo " --variant ue-ethernet OR -v8" echo "" } -if [ $# -lt 1 ] || [ $# -gt 5 ] +if [ $# -lt 1 ] || [ $# -gt 9 ] then echo "Syntax Error: not the correct number of arguments" echo "" @@ -51,6 +61,9 @@ then exit 1 fi +VM_TEMPLATE=ci- +JOB_NAME=XX +BUILD_ID=XX VM_NAME=ci-enb-usrp ARCHIVES_LOC=enb_usrp LOG_PATTERN=.Rel14.txt @@ -68,6 +81,16 @@ case $key in usage exit 0 ;; + -jn|--job-name) + JOB_NAME="$2" + shift + shift + ;; + -id|--build-id) + BUILD_ID="$2" + shift + shift + ;; -ws|--workspace) JENKINS_WKSP="$2" shift @@ -109,6 +132,22 @@ case $key in BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2" shift ;; + -v7) + VM_NAME=ci-enb-ethernet + ARCHIVES_LOC=enb_eth + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=6 + BUILD_OPTIONS="--eNB -t ETHERNET --noS1" + shift + ;; + -v8) + VM_NAME=ci-ue-ethernet + ARCHIVES_LOC=ue_eth + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=6 + BUILD_OPTIONS="--UE -t ETHERNET --noS1" + shift + ;; --variant) variant="$2" case $variant in @@ -140,6 +179,20 @@ case $key in NB_PATTERN_FILES=1 BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2" ;; + enb-ethernet) + VM_NAME=ci-enb-ethernet + ARCHIVES_LOC=enb_eth + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=6 + BUILD_OPTIONS="--eNB -t ETHERNET --noS1" + ;; + ue-ethernet) + VM_NAME=ci-ue-ethernet + ARCHIVES_LOC=ue_eth + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=6 + BUILD_OPTIONS="--UE -t ETHERNET --noS1" + ;; *) echo "" echo "Syntax Error: Invalid Variant option -> $variant" @@ -170,6 +223,14 @@ then exit 1 fi +if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ] +then + VM_TEMPLATE=ci- +else + VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}- +fi + +VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"` VM_CMDS=${VM_NAME}_cmds.txt ARCHIVES_LOC=${JENKINS_WKSP}/archives/${ARCHIVES_LOC} @@ -179,10 +240,16 @@ echo "JENKINS_WKSP = $JENKINS_WKSP" echo "ARCHIVES_LOC = $ARCHIVES_LOC" echo "BUILD_OPTIONS = $BUILD_OPTIONS" -echo "############################################################" -echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base" -echo "############################################################" -uvt-kvm create $VM_NAME release=xenial --memory 2048 --cpu 4 --unsafe-caching --template ci-scripts/template-host.xml +IS_VM_ALIVE=`uvt-kvm list | grep -c $VM_NAME` + +if [ $IS_VM_ALIVE -eq 0 ] +then + echo "############################################################" + echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base" + echo "############################################################" + uvt-kvm create $VM_NAME release=xenial --memory 2048 --cpu 4 --unsafe-caching --template ci-scripts/template-host.xml +fi + echo "Waiting for VM to be started" uvt-kvm wait $VM_NAME --insecure @@ -199,7 +266,7 @@ echo "############################################################" echo "Running install and build script on VM ($VM_NAME)" echo "############################################################" echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $VM_CMDS -if [ "$VM_NAME" == "ci-cppcheck" ] +if [[ "$VM_NAME" == *"-cppcheck"* ]] then echo "echo \"sudo apt-get --yes --quiet install zip cppcheck \"" >> $VM_CMDS echo "sudo apt-get update > zip-install.txt 2>&1" >> $VM_CMDS @@ -210,9 +277,9 @@ else fi echo "mkdir tmp" >> $VM_CMDS echo "cd tmp" >> $VM_CMDS -echo "echo \"unzip -qq ../localZip.zip\"" >> $VM_CMDS -echo "unzip -qq ../localZip.zip" >> $VM_CMDS -if [ "$VM_NAME" == "ci-cppcheck" ] +echo "echo \"unzip -qq -DD ../localZip.zip\"" >> $VM_CMDS +echo "unzip -qq -DD ../localZip.zip" >> $VM_CMDS +if [[ "$VM_NAME" == *"-cppcheck"* ]] then echo "mkdir cmake_targets/log" >> $VM_CMDS echo "cp /home/ubuntu/zip-install.txt cmake_targets/log" >> $VM_CMDS @@ -243,7 +310,7 @@ then fi scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.txt $ARCHIVES_LOC -if [ "$VM_NAME" == "ci-cppcheck" ] +if [[ "$VM_NAME" == *"-cppcheck"* ]] then scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.xml $ARCHIVES_LOC fi diff --git a/ci-scripts/createVM.sh b/ci-scripts/createVM.sh new file mode 100755 index 0000000000000000000000000000000000000000..02d9523d676c033bc55c54e2c2d5a7fc662f98ed --- /dev/null +++ b/ci-scripts/createVM.sh @@ -0,0 +1,167 @@ +#!/bin/bash + +function usage { + echo "OAI VM Creation script" + echo " Original Author: Raphael Defosseux" + echo " Requirements:" + echo " -- uvtool uvtool-libvirt apt-cacher" + echo " -- xenial image already synced" + echo " Default:" + echo " -- eNB with USRP" + echo "" + echo "Usage:" + echo "------" + echo " createVM.sh [OPTIONS]" + echo "" + echo "Options:" + echo "--------" + echo " --job-name #### OR -jn ####" + echo " Specify the name of the Jenkins job." + echo "" + echo " --build-id #### OR -id ####" + echo " Specify the build ID of the Jenkins job." + echo "" + echo " --variant enb-usrp OR -v1" + echo " --variant basic-sim OR -v2" + echo " --variant phy-sim OR -v3" + echo " --variant cppcheck OR -v4" + echo " --variant enb-ethernet OR -v7" + echo " --variant ue-ethernet OR -v8" + echo " Specify the variant to build." + echo "" + echo " --help OR -h" + echo " Print this help message." + echo "" +} + +function variant_usage { + echo "OAI VM Build Check script" + echo " Original Author: Raphael Defosseux" + echo "" + echo " --variant enb-usrp OR -v1" + echo " --variant basic-sim OR -v2" + echo " --variant phy-sim OR -v3" + echo " --variant cppcheck OR -v4" + echo " --variant enb-ethernet OR -v7" + echo " --variant ue-ethernet OR -v8" + echo "" +} + +if [ $# -lt 1 ] || [ $# -gt 6 ] +then + echo "Syntax Error: not the correct number of arguments" + echo "" + usage + exit 1 +fi + +VM_TEMPLATE=ci- +JOB_NAME=XX +BUILD_ID=XX +VM_NAME=ci-enb-usrp + +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -h|--help) + shift + usage + exit 0 + ;; + -jn|--job-name) + JOB_NAME="$2" + shift + shift + ;; + -id|--build-id) + BUILD_ID="$2" + shift + shift + ;; + -v1) + VM_NAME=ci-enb-usrp + shift + ;; + -v2) + VM_NAME=ci-basic-sim + shift + ;; + -v3) + VM_NAME=ci-phy-sim + shift + ;; + -v4) + VM_NAME=ci-cppcheck + shift + ;; + -v7) + VM_NAME=ci-enb-ethernet + shift + ;; + -v8) + VM_NAME=ci-ue-ethernet + shift + ;; + --variant) + variant="$2" + case $variant in + enb-usrp) + VM_NAME=ci-enb-usrp + ;; + basic-sim) + VM_NAME=ci-basic-sim + ;; + phy-sim) + VM_NAME=ci-phy-sim + ;; + cppcheck) + VM_NAME=ci-cppcheck + ;; + enb-ethernet) + VM_NAME=ci-enb-ethernet + ;; + ue-ethernet) + VM_NAME=ci-ue-ethernet + ;; + *) + echo "" + echo "Syntax Error: Invalid Variant option -> $variant" + echo "" + variant_usage + exit 1 + esac + shift + shift + ;; + *) + echo "Syntax Error: unknown option: $key" + echo "" + usage + exit 1 +esac +done + +if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ] +then + VM_TEMPLATE=ci- +else + VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}- +fi + +VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"` +VM_CMDS=${VM_NAME}_cmds.txt + +echo "VM_NAME = $VM_NAME" + +echo "############################################################" +echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base" +echo "############################################################" +uvt-kvm create $VM_NAME release=xenial --memory 2048 --cpu 4 --unsafe-caching --template ci-scripts/template-host.xml +echo "Waiting for VM to be started" +uvt-kvm wait $VM_NAME --insecure + +VM_IP_ADDR=`uvt-kvm ip $VM_NAME` +echo "$VM_NAME has for IP addr = $VM_IP_ADDR" +exit 0 diff --git a/ci-scripts/destroyAllRunningVM.sh b/ci-scripts/destroyAllRunningVM.sh new file mode 100755 index 0000000000000000000000000000000000000000..c9eb43b4ef235d83a0803c9055c5cd772406d629 --- /dev/null +++ b/ci-scripts/destroyAllRunningVM.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +function usage { + echo "OAI VM Destroy script" + echo " Original Author: Raphael Defosseux" + echo "" + echo "Usage:" + echo "------" + echo " destroyAllRunningVM.sh [OPTIONS]" + echo "" + echo "Options:" + echo "--------" + echo " --job-name #### OR -jn ####" + echo " Specify the name of the Jenkins job." + echo "" + echo " --build-id #### OR -id ####" + echo " Specify the build ID of the Jenkins job." + echo "" + echo " --help OR -h" + echo " Print this help message." + echo "" +} + +if [ $# -gt 4 ] +then + echo "Syntax Error: not the correct number of arguments" + echo "" + usage + exit 1 +fi + +VM_TEMPLATE=ci- +JOB_NAME=XX +BUILD_ID=XX + +while [[ $# -gt 0 ]] +do +key="$1" +case $key in + -h|--help) + shift + usage + exit 0 + ;; + -jn|--job-name) + JOB_NAME="$2" + shift + shift + ;; + -id|--build-id) + BUILD_ID="$2" + shift + shift + ;; + *) + echo "Syntax Error: unknown option: $key" + echo "" + usage + exit 1 +esac +done + +if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ] +then + VM_TEMPLATE=ci- +else + VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}- +fi + +LIST_CI_VM=`uvt-kvm list | grep $VM_TEMPLATE` + +for CI_VM in $LIST_CI_VM +do + VM_IP_ADDR=`uvt-kvm ip $CI_VM` + echo "VM to destroy: $CI_VM -- IP $VM_IP_ADDR" + uvt-kvm destroy $CI_VM + ssh-keygen -R $VM_IP_ADDR +done + +exit 0 + diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh index 3a19bae812929e0630709e979a1228be21f332b9..694e92e478d2b30ca999b7b87b7d52e4db116cc2 100755 --- a/ci-scripts/reportBuildLocally.sh +++ b/ci-scripts/reportBuildLocally.sh @@ -232,6 +232,10 @@ function sca_summary_table_footer { echo " <th>Total</th>" >> ./build_results.html echo " <th>Unknown</th>" >> ./build_results.html echo " <th>Unknown</th>" >> ./build_results.html + if [ -f ccp_error_cnt.txt ] + then + rm -f ccp_error_cnt.txt + fi fi echo " </tr>" >> ./build_results.html echo " </table>" >> ./build_results.html @@ -505,6 +509,24 @@ summary_table_row "UL Simulator - Release 14" ./archives/phy_sim/ulsim.Rel14.txt summary_table_row "Coding - Release 14" ./archives/phy_sim/coding.Rel14.txt "Built target coding" ./phy_sim_row3.html summary_table_footer +summary_table_header "OAI Build eNB -- ETHERNET transport option" +summary_table_row "LTE SoftModem w/o S1 - Release 14" ./archives/enb_eth/lte-softmodem-nos1.Rel14.txt "Built target lte-softmodem" ./enb_eth_row1.html +summary_table_row "Coding - Release 14" ./archives/enb_eth/coding.Rel14.txt "Built target coding" ./enb_eth_row2.html +summary_table_row "OAI ETHERNET transport - Release 14" ./archives/enb_eth/oai_eth_transpro.Rel14.txt "Built target oai_eth_transpro" ./enb_eth_row3.html +summary_table_row "Parameters Lib Config - Release 14" ./archives/enb_eth/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_eth_row4.html +summary_table_row "RB Tools - Release 14" ./archives/enb_eth/rb_tool.Rel14.txt "Built target rb_tool" ./enb_eth_row5.html +summary_table_row "NAS Mesh - Release 14" ./archives/enb_eth/nasmesh.Rel14.txt "Built target nasmesh" ./enb_eth_row6.html +summary_table_footer + +summary_table_header "OAI Build UE -- ETHERNET transport option" +summary_table_row "LTE UE SoftModem w/o S1 - Release 14" ./archives/ue_eth/lte-uesoftmodem-nos1.Rel14.txt "Built target lte-uesoftmodem" ./ue_eth_row1.html +summary_table_row "Coding - Release 14" ./archives/ue_eth/coding.Rel14.txt "Built target coding" ./ue_eth_row2.html +summary_table_row "OAI ETHERNET transport - Release 14" ./archives/ue_eth/oai_eth_transpro.Rel14.txt "Built target oai_eth_transpro" ./ue_eth_row3.html +summary_table_row "Parameters Lib Config - Release 14" ./archives/ue_eth/params_libconfig.Rel14.txt "Built target params_libconfig" ./ue_eth_row4.html +summary_table_row "RB Tools - Release 14" ./archives/ue_eth/rb_tool.Rel14.txt "Built target rb_tool" ./ue_eth_row5.html +summary_table_row "NAS Mesh - Release 14" ./archives/ue_eth/nasmesh.Rel14.txt "Built target nasmesh" ./ue_eth_row6.html +summary_table_footer + echo " <h3>Details</h3>" >> ./build_results.html for DETAILS_TABLE in `ls ./enb_usrp_row*.html` @@ -519,7 +541,15 @@ for DETAILS_TABLE in `ls ./phy_sim_row*.html` do cat $DETAILS_TABLE >> ./build_results.html done -rm -f ./enb_usrp_row*.html ./basic_sim_row*.html ./phy_sim_row*.html +for DETAILS_TABLE in `ls ./enb_eth_row*.html` +do + cat $DETAILS_TABLE >> ./build_results.html +done +for DETAILS_TABLE in `ls ./ue_eth_row*.html` +do + cat $DETAILS_TABLE >> ./build_results.html +done +rm -f ./enb_usrp_row*.html ./basic_sim_row*.html ./phy_sim_row*.html ./enb_eth_row*.html ./ue_eth_row*.html echo "</body>" >> ./build_results.html echo "</html>" >> ./build_results.html diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh new file mode 100755 index 0000000000000000000000000000000000000000..56ea35a5f29813892244f4431bededbad7033b1e --- /dev/null +++ b/ci-scripts/runTestOnVM.sh @@ -0,0 +1,293 @@ +#!/bin/bash + +function usage { + echo "OAI VM Test Run script" + echo " Original Author: Raphael Defosseux" + echo " Default:" + echo " -- eNB with USRP" + echo "" + echo "Usage:" + echo "------" + echo " runTestOnVM.sh [OPTIONS]" + echo "" + echo "Options:" + echo "--------" + echo " --job-name #### OR -jn ####" + echo " Specify the name of the Jenkins job." + echo "" + echo " --build-id #### OR -id ####" + echo " Specify the build ID of the Jenkins job." + echo "" + echo " --workspace #### OR -ws ####" + echo " Specify the workspace." + echo "" + echo " --variant enb-usrp OR -v1" + echo " --variant basic-sim OR -v2" + echo " --variant phy-sim OR -v3" + echo " --variant cppcheck OR -v4" + echo " --variant enb-ethernet OR -v7" + echo " --variant ue-ethernet OR -v8" + echo " Specify the variant to build." + echo "" + echo " --keep-vm-alive OR -k" + echo " Keep the VM alive after the build." + echo "" + echo " --help OR -h" + echo " Print this help message." + echo "" +} + +function variant_usage { + echo "OAI VM Test Run script" + echo " Original Author: Raphael Defosseux" + echo "" + echo " --variant enb-usrp OR -v1" + echo " --variant basic-sim OR -v2" + echo " --variant phy-sim OR -v3" + echo " --variant cppcheck OR -v4" + echo " --variant enb-ethernet OR -v7" + echo " --variant ue-ethernet OR -v8" + echo "" +} + +if [ $# -lt 1 ] || [ $# -gt 9 ] +then + echo "Syntax Error: not the correct number of arguments" + echo "" + usage + exit 1 +fi + +VM_TEMPLATE=ci- +JOB_NAME=XX +BUILD_ID=XX +VM_NAME=ci-enb-usrp +ARCHIVES_LOC=enb_usrp/test +KEEP_VM_ALIVE=0 +RUN_OPTIONS="none" +STATUS=0 + +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -h|--help) + shift + usage + exit 0 + ;; + -jn|--job-name) + JOB_NAME="$2" + shift + shift + ;; + -id|--build-id) + BUILD_ID="$2" + shift + shift + ;; + -ws|--workspace) + JENKINS_WKSP="$2" + shift + shift + ;; + -k|--keep-vm-alive) + KEEP_VM_ALIVE=1 + shift + ;; + -v1) + VM_NAME=ci-enb-usrp + shift + ;; + -v2) + VM_NAME=ci-basic-sim + shift + ;; + -v3) + VM_NAME=ci-phy-sim + RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b" + ARCHIVES_LOC=phy_sim/test + shift + ;; + -v4) + VM_NAME=ci-cppcheck + shift + ;; + -v7) + VM_NAME=ci-enb-ethernet + shift + ;; + -v8) + VM_NAME=ci-ue-ethernet + shift + ;; + --variant) + variant="$2" + case $variant in + enb-usrp) + VM_NAME=ci-enb-usrp + ;; + basic-sim) + VM_NAME=ci-basic-sim + ;; + phy-sim) + VM_NAME=ci-phy-sim + RUN_OPTIONS="./run_exec_autotests.bash -g \"01510*\" -q -np -b" + ARCHIVES_LOC=phy_sim/test + ;; + cppcheck) + VM_NAME=ci-cppcheck + ;; + enb-ethernet) + VM_NAME=ci-enb-ethernet + ;; + ue-ethernet) + VM_NAME=ci-ue-ethernet + ;; + *) + echo "" + echo "Syntax Error: Invalid Variant option -> $variant" + echo "" + variant_usage + exit 1 + esac + shift + shift + ;; + *) + echo "Syntax Error: unknown option: $key" + echo "" + usage + exit 1 +esac +done + +if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ] +then + VM_TEMPLATE=ci- +else + VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}- +fi + +VM_NAME=`echo $VM_NAME | sed -e "s#ci-#$VM_TEMPLATE#"` +VM_CMDS=${VM_NAME}_cmds.txt +ARCHIVES_LOC=${JENKINS_WKSP}/archives/${ARCHIVES_LOC} + +echo "VM_NAME = $VM_NAME" +echo "VM_CMD_FILE = $VM_CMDS" +echo "JENKINS_WKSP = $JENKINS_WKSP" +echo "ARCHIVES_LOC = $ARCHIVES_LOC" + +echo "############################################################" +echo "Waiting for VM to be started" +echo "############################################################" +uvt-kvm wait $VM_NAME --insecure + +VM_IP_ADDR=`uvt-kvm ip $VM_NAME` +echo "$VM_NAME has for IP addr = $VM_IP_ADDR" + +if [ "$RUN_OPTIONS" == "none" ] +then + echo "No run on VM testing for this variant currently" +else + + echo "############################################################" + echo "Running test script on VM ($VM_NAME)" + echo "############################################################" + echo "echo \"sudo apt-get --yes --quiet install bc \"" > $VM_CMDS + echo "sudo apt-get update > bc-install.txt 2>&1" >> $VM_CMDS + echo "sudo apt-get --yes install bc >> bc-install.txt 2>&1" >> $VM_CMDS + echo "cd tmp" >> $VM_CMDS + echo "echo \"source oaienv\"" >> $VM_CMDS + echo "source oaienv" >> $VM_CMDS + echo "echo \"cd cmake_targets/autotests\"" >> $VM_CMDS + echo "cd cmake_targets/autotests" >> $VM_CMDS + echo "echo \"rm -Rf log\"" >> $VM_CMDS + echo "rm -Rf log" >> $VM_CMDS + echo "$RUN_OPTIONS" | sed -e 's@"@\\"@g' -e 's@^@echo "@' -e 's@$@"@' >> $VM_CMDS + echo "$RUN_OPTIONS" >> $VM_CMDS + echo "cp /home/ubuntu/bc-install.txt log" >> $VM_CMDS + echo "cd log" >> $VM_CMDS + echo "zip -r -qq tmp.zip *.* 0*" >> $VM_CMDS + + ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS + + echo "############################################################" + echo "Creating a tmp folder to store results and artifacts" + echo "############################################################" + + if [ -d $ARCHIVES_LOC ] + then + rm -Rf $ARCHIVES_LOC + fi + mkdir --parents $ARCHIVES_LOC + + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/autotests/log/tmp.zip $ARCHIVES_LOC + pushd $ARCHIVES_LOC + unzip -qq -DD tmp.zip + rm tmp.zip + if [ -f results_autotests.xml ] + then + FUNCTION=`echo $VM_NAME | sed -e "s@$VM_TEMPLATE@@"` + NEW_NAME=`echo "results_autotests.xml" | sed -e "s@results_autotests@results_autotests-$FUNCTION@"` + mv results_autotests.xml $NEW_NAME + fi + popd + + if [ $KEEP_VM_ALIVE -eq 0 ] + then + echo "############################################################" + echo "Destroying VM" + echo "############################################################" + uvt-kvm destroy $VM_NAME + ssh-keygen -R $VM_IP_ADDR + fi + rm -f $VM_CMDS + + echo "############################################################" + echo "Checking build status" + echo "############################################################" + + LOG_FILES=`ls $ARCHIVES_LOC/results_autotests*.xml` + NB_FOUND_FILES=0 + NB_RUNS=0 + NB_FAILURES=0 + + for FULLFILE in $LOG_FILES + do + TESTSUITES=`egrep "testsuite errors" $FULLFILE` + for TESTSUITE in $TESTSUITES + do + if [[ "$TESTSUITE" == *"tests="* ]] + then + RUNS=`echo $TESTSUITE | awk 'BEGIN{FS="="}{print $2}END{}' | sed -e "s@'@@g" ` + NB_RUNS=$((NB_RUNS + RUNS)) + fi + if [[ "$TESTSUITE" == *"failures="* ]] + then + FAILS=`echo $TESTSUITE | awk 'BEGIN{FS="="}{print $2}END{}' | sed -e "s@'@@g" ` + NB_FAILURES=$((NB_FAILURES + FAILS)) + fi + done + NB_FOUND_FILES=$((NB_FOUND_FILES + 1)) + done + + echo "NB_FOUND_FILES = $NB_FOUND_FILES" + echo "NB_RUNS = $NB_RUNS" + echo "NB_FAILURES = $NB_FAILURES" + + if [ $NB_FOUND_FILES -eq 0 ]; then STATUS=-1; fi + if [ $NB_RUNS -eq 0 ]; then STATUS=-1; fi + if [ $NB_FAILURES -ne 0 ]; then STATUS=-1; fi + + if [ $STATUS -eq 0 ] + then + echo "STATUS seems OK" + else + echo "STATUS failed?" + fi + +fi + +exit $STATUS diff --git a/ci-scripts/template.xsl b/ci-scripts/template.xsl new file mode 100644 index 0000000000000000000000000000000000000000..64fb23e4cdce86ad44ec94b31ff10dee44134a72 --- /dev/null +++ b/ci-scripts/template.xsl @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output method="html" version="4" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/> + <!-- main body --> + <xsl:template match="/"> + <html> + <body> + <h3>TEMPLATE Results Summary</h3> + <table border="1"> + <tr bgcolor="lightcyan"> + <!--Header only so select first row to get headers--> + <th>Hostname</th> + <th>Nb Tests</th> + <th>Failures</th> + <th>Timestamp</th> + </tr> + <!--Get all the other rows--> + <xsl:for-each select="testsuites/testsuite"> + <tr> + <td> + <xsl:value-of select="@hostname"/> + </td> + <td> + <xsl:value-of select="@tests"/> + </td> + <td> + <xsl:value-of select="@failures"/> + </td> + <td> + <xsl:value-of select="@timestamp"/> + </td> + </tr> + </xsl:for-each> + </table> + <h4>Details</h4> + <table border="1"> + <tr bgcolor="lightcyan"> + <!--Header only so select first row to get headers--> + <th>Test Name</th> + <th>Result</th> + <th>Time</th> + </tr> + <!--Get all the other rows--> + <xsl:for-each select="testsuites/testsuite/testcase"> + <tr> + <td> + <xsl:value-of select="@name"/> + </td> + <td> + <xsl:value-of select="@RESULT"/> + </td> + <td> + <xsl:value-of select="@time"/> + </td> + </tr> + </xsl:for-each> + </table> + </body> + </html> + </xsl:template> +</xsl:stylesheet> diff --git a/cmake_targets/autotests/run_exec_autotests.bash b/cmake_targets/autotests/run_exec_autotests.bash index ff38ae9d3c2431fba0c3e4792777d08c3b54f02e..6c5b9193b60eb6d68ff10a65ca6216f04346554e 100755 --- a/cmake_targets/autotests/run_exec_autotests.bash +++ b/cmake_targets/autotests/run_exec_autotests.bash @@ -200,6 +200,7 @@ function test_compile() { #\param $14 -> tags to help identify the test case for readability in output xml file #\param $15 => password for the user to run certain commands as sudo #\param $16 => test config file params to be modified +#\param $17 => bypass flag if main_exec if available function test_compile_and_run() { xUnit_start @@ -221,6 +222,7 @@ function test_compile_and_run() { tags=${14} mypassword=${15} test_config_file=${16} + bypass_compile=${17} build_dir=$tdir/$1/build #exec_file=$build_dir/$6 @@ -231,8 +233,6 @@ function test_compile_and_run() { rm -fr $log_dir mkdir -p $log_dir - rm -fr $OPENAIR_DIR/cmake_targets/log - echo "" > $temp_exec_log echo "" > $log_file #echo "log_dir = $log_dir" @@ -257,7 +257,13 @@ function test_compile_and_run() { main_exec_args_array=() readarray -t main_exec_args_array <<< "$exec_args" - + REAL_MAIN_EXEC=`eval "echo $main_exec"` + if [ "$bypass_compile" == "1" ] && [ -f $REAL_MAIN_EXEC ] + then + echo "Bypassing compilation for $main_exec" + else + rm -fr $OPENAIR_DIR/cmake_targets/log + #for search_expr in "${compile_prog_array[@]}" #do echo "Compiling test case $test_case_name Log file = $log_file" @@ -283,6 +289,7 @@ function test_compile_and_run() { }>> $log_file 2>&1 echo "</COMPILATION LOG>" >> $log_file 2>&1 #done + fi #process the test case if it is that of execution if [ "$class" == "execution" ]; then @@ -393,10 +400,18 @@ Options Run test cases in a group. For example, ./run_exec_autotests "0101* 010102" -p Use password for logging +-np | --no-password + No need for a password +-q | --quiet + Quiet mode; eliminate informational messages and comment prompts. +-b | --bypass-compile + Bypass compilation of main-exec if already present ' } function main () { +QUIET=0 +BYPASS_COMPILE=0 RUN_GROUP=0 SET_PASSWORD=0 passwd="" @@ -419,6 +434,16 @@ until [ -z "$1" ] SET_PASSWORD=1 passwd=$2 shift 2;; + -np|--no-password) + SET_PASSWORD=1 + shift ;; + -q|--quiet) + QUIET=1 + shift ;; + -b|--bypass-compile) + BYPASS_COMPILE=1 + echo "bypass option ON" + shift ;; -h | --help) print_help exit 1;; @@ -449,15 +474,15 @@ xml_conf="$OPENAIR_DIR/cmake_targets/autotests/test_case_list.xml" test_case_list=`xmlstarlet sel -T -t -m /testCaseList/testCase -s A:N:- "@id" -v "@id" -n $xml_conf` test_case_excl_list=`xmlstarlet sel -t -v "/testCaseList/TestCaseExclusionList" $xml_conf` -echo "Test Case Exclusion List = $test_case_excl_list " +if [ $QUIET -eq 0 ]; then echo "Test Case Exclusion List = $test_case_excl_list "; fi test_case_excl_list=`sed "s/\+/\*/g" <<< "$test_case_excl_list" ` # Replace + with * for bash string substituion read -a test_case_excl_array <<< "$test_case_excl_list" -echo "test_case_list = $test_case_list" +if [ $QUIET -eq 0 ]; then echo "test_case_list = $test_case_list"; fi -echo "Test Case Exclusion List = $test_case_excl_list \n" +if [ $QUIET -eq 0 ]; then echo "Test Case Exclusion List = $test_case_excl_list \n"; fi readarray -t test_case_array <<<"$test_case_list" @@ -484,7 +509,7 @@ for search_expr in "${test_case_array[@]}" do if [[ $search_expr == $search_excl ]];then flag_run_test_case=0 - echo_info "Test case $search_expr match found in test case excl group. Will skip the test case for execution..." + if [ $QUIET -eq 0 ]; then echo_info "Test case $search_expr match found in test case excl group. Will skip the test case for execution..."; fi break fi done @@ -533,8 +558,8 @@ for search_expr in "${test_case_array[@]}" search_array_true=() - IFS=\" #set the shell's field separator - set -f #don't try to glob + IFS=\" #set the shell field separator + set -f #dont try to glob #set -- $search_expr_true #split on $IFS for i in $search_expr_true do echo "i = $i" @@ -551,7 +576,7 @@ for search_expr in "${test_case_array[@]}" test_compile "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" elif [ "$class" == "execution" ]; then echo \'passwd\' | $SUDO killall -q oaisim_nos1 - test_compile_and_run "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" "$mypassword" "$test_config_file" + test_compile_and_run "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" "$mypassword" "$test_config_file" "$BYPASS_COMPILE" else echo "Unexpected class of test case...Skipping the test case $name ...." fi diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index d9ed38a4ec84faa06c69e610a37f07e039efbb1a..27f43f6f2f73eb0b6df9b3be8880664ec56f035f 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -955,7 +955,7 @@ <compile_prog_args> --phy_simulators -c </compile_prog_args> <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec> <pre_exec_args></pre_exec_args> - <main_exec> $OPENAIR_DIR/cmake_targets/lte-simulators/build/dlsim</main_exec> + <main_exec> $OPENAIR_DIR/targets/bin/dlsim.Rel14</main_exec> <main_exec_args> -m5 -gF -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70 -m4 -gF -s0 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O70 -m15 -gF -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70 @@ -989,7 +989,7 @@ <compile_prog_args> --phy_simulators -c </compile_prog_args> <pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec> <pre_exec_args></pre_exec_args> - <main_exec> $OPENAIR_DIR/cmake_targets/lte-simulators/build/ulsim</main_exec> + <main_exec> $OPENAIR_DIR/targets/bin/ulsim.Rel14</main_exec> <main_exec_args> -B25 -m5 -y1 -gN -x1 -s6 -w1.0 -e.1 -P -n500 -O70 -L -B25 -m16 -y1 -gN -x1 -s12 -w1.0 -e.1 -P -n500 -O70 -L -B50 -m5 -y1 -gN -x1 -s6 -w1.0 -e.1 -P -n500 -O70 -L diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 338c43480d755625dbe38f40858dbbfeb9cd4a73..eb354755b6c26af087ec17ba28cbb39679c29769 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -527,7 +527,7 @@ function main() { echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file echo "set ( XFORMS $XFORMS )" >> $cmake_file echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file - echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file +# echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index 09f37b994567f4664134cb99cf314f41819cd606..2d5133a450ffd7d41e19c472b0e8ca919ba32c93 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -516,7 +516,7 @@ int config_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfap uint8_t num_tlv = 0; //struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; - // Panos: In the case of nfapi_mode = 3 (UE = PNF) we should not have dependency on any eNB var. So we aim + // In the case of nfapi_mode = 3 (UE = PNF) we should not have dependency on any eNB var. So we aim // to keep only the necessary just to keep the nfapi FSM rolling by sending a dummy response. LTE_DL_FRAME_PARMS *fp; if (nfapi_mode!=3) { @@ -1117,7 +1117,6 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi } if(phy_info->timing_info_mode & 0x2) { - //printf("Panos-D: start_request () Enabling timing_info_mode_aperiodic \n"); p7_config->timing_info_mode_aperiodic = 1; } @@ -1185,9 +1184,6 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] DJP - HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__); p7_config_g = p7_config; - //NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Panos-D: start_request, BUFFER SIZE: %d", p7_config_g->subframe_buffer_size); - //printf("Panos-D: start_request, bUFFER SIZE: %d", p7_config_g->subframe_buffer_size); - // Need to wait for main thread to create RU structures while(config_sync_var<0) { @@ -1201,13 +1197,7 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi printf("[PNF] About to call init_eNB_afterRU()\n"); - // Panos: Instead - /*if (nfapi_mode == 3) { - init_UE_stub(1,0,uecap_xer_in); - }*/ - //else{ if (nfapi_mode != 3) { - // Panos init_eNB_afterRU(); } diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7.c b/nfapi/open-nFAPI/vnf/src/vnf_p7.c index 3c469c942bc028c81f8cbbf1492850891be06604..cea259c35b354d3179d178da2ce6faf3f9104f70 100644 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7.c @@ -1248,12 +1248,12 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PNF:SFN/SF:%d VNF:SFN/SF:%d deltaSFNSF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind.last_sfn_sf), NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), vnf_pnf_sfnsf_delta); - // Panos: Careful here!!! + // Panos: Careful here!!! Modification of the original nfapi-code //if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1) if (vnf_pnf_sfnsf_delta>0 || vnf_pnf_sfnsf_delta < 0) { NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SF DELTA between PNF and VNF delta:%d VNF:%d PNF:%d\n\n\n\n\n\n\n\n\n", __FUNCTION__, vnf_pnf_sfnsf_delta, NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), NFAPI_SFNSF2DEC(ind.last_sfn_sf)); - // Panos: Careful here!!! + // Panos: Careful here!!! Modification of the original nfapi-code vnf_p7->p7_connections[0].sfn_sf = ind.last_sfn_sf; } } diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h index e36b88c036b1f7426f9bcba8f4519f0b46c86d34..de17bbee0b9856833664acf3375a07a1f612cc4f 100644 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -161,12 +161,12 @@ typedef struct { UE_rxtx_proc_t proc_rxtx[RX_NB_TH]; } UE_proc_t; -/// Panos: Structure holding timer_thread related elements (phy_stub_UE mode) +/// Structure holding timer_thread related elements (phy_stub_UE mode) typedef struct { pthread_t pthread_timer; - /// Panos: mutex for waiting SF ticking + /// mutex for waiting SF ticking pthread_mutex_t mutex_ticking; - /// Panos: \brief ticking var for ticking thread. + /// \brief ticking var for ticking thread. /// \internal This variable is protected by \ref mutex_ticking. int ticking_var; /// condition variable for timer_thread; diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index 8829e635f6aea6797e127176ec1d40ccd8c70f04..15ed0cf963c14844c66cd7bf0eb9493f23b54e92 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -512,7 +512,6 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id { int Mod_id = ue->Mod_id; int CC_id = ue->CC_id; - // Panos: Substitute call to ue_get_SR() with the filled ue_SR_config->SR_payload (0, or 1). SR_payload = ue_get_SR(Mod_id, CC_id, frame_tx, @@ -2760,7 +2759,6 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin ue->pbch_vars[eNB_id]->pdu_errors_conseq++; ue->pbch_vars[eNB_id]->pdu_errors++; - // Panos: Substitute call to rrc_out_of_sync_ind() with fill_bch_incication(sync=0). if (ue->mac_enabled == 1) rrc_out_of_sync_ind(ue->Mod_id,frame_rx,eNB_id); else AssertFatal(ue->pbch_vars[eNB_id]->pdu_errors_conseq<100, "More that 100 consecutive PBCH errors! Exiting!\n"); @@ -3436,7 +3434,6 @@ void process_rar(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, runmode_t mo subframe_rx, ue->prach_resources[eNB_id]->ra_PreambleIndex); - // Panos: Substitute call to ue_process_rar() with call to fill_dlsch_rar_indication() timing_advance = ue_process_rar(ue->Mod_id, ue->CC_id, frame_rx, @@ -3767,7 +3764,6 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, switch (pdsch) { case PDSCH: - // Panos: Substitute call to ue_send_sdu() with call to fill_dlsch_indication() ue_send_sdu(ue->Mod_id, CC_id, frame_rx, @@ -3777,8 +3773,6 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, eNB_id); break; case SI_PDSCH: - // Panos: Substitute call with call to fill_dlsch_indication() - LOG_D(PHY,"%d.%d: Decoding SI message\n",frame_rx,subframe_rx); ue_decode_si(ue->Mod_id, CC_id, frame_rx, @@ -3787,7 +3781,6 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, ue->dlsch_SI[eNB_id]->harq_processes[0]->TBS>>3); break; case P_PDSCH: - // Panos: Substitute call with call to fill_dlsch_indication() ue_decode_p(ue->Mod_id, CC_id, frame_rx, @@ -3796,7 +3789,6 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, ue->dlsch_SI[eNB_id]->harq_processes[0]->TBS>>3); break; case RA_PDSCH: - // Panos: Substitute with call to fill_dlsch_rar_indication() process_rar(ue,proc,eNB_id,mode,abstraction_flag); break; case PDSCH1: diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index 917c149833f9d21df65dc988c70fa0ec14007078..f2c906bf661e2aa0e93c75fa8e55f831124f0e41 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -67,16 +67,23 @@ # define MAX_MODULES NB_MODULES_MAX -#ifdef LARGE_SCALE +#ifndef UE_EXPANSION +# ifdef LARGE_SCALE # define MAX_MOBILES_PER_ENB 128 # define MAX_MOBILES_PER_ENB_NB_IoT 128 # define MAX_eNB 2 -#else +# else # define MAX_MOBILES_PER_ENB 16 # define MAX_MOBILES_PER_ENB_NB_IoT 16 # define MAX_eNB 2 +# endif +#else +# define MAX_MOBILES_PER_ENB 256 +# define MAX_MOBILES_PER_ENB_NB_IoT 256 +# define MAX_eNB 2 #endif + #define MAX_MANAGED_ENB_PER_MOBILE 2 ///NB-IOT diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 3b65dfafdbafa734c709bef2e263f0641b733010..345ad599c858f628bdda9bd3f7460c2edbf455a8 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -230,47 +230,6 @@ void RCconfig_flexran() } -/*void UE_config_stub_pnf(void) { - int j; - paramdef_t L1_Params[] = L1PARAMS_DESC; - paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST,NULL,0}; - - config_getlist( &L1_ParamList,L1_Params,sizeof(L1_Params)/sizeof(paramdef_t), NULL); - if (L1_ParamList.numelt > 0) { - for (j=0; j<L1_ParamList.numelt; j++){ - //nb_L1_CC = *(L1_ParamList.paramarray[j][L1_CC_IDX].uptr); // Number of component carriers is of no use for the - // phy_stub mode UE pnf. Maybe we can completely skip it. - - if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) { - sf_ahead = 4; // Need 4 subframe gap between RX and TX - } - // Panos: Right now that we have only one UE (thread) it is ok to put the eth_params in the UE_mac_inst. - // Later I think we have to change that to attribute eth_params to a global element for all the UEs. - else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) { - stub_eth_params.local_if_name = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr)); - stub_eth_params.my_addr = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr)); - stub_eth_params.remote_addr = strdup(*(L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr)); - stub_eth_params.my_portc = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr); - stub_eth_params.remote_portc = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTC_IDX].iptr); - stub_eth_params.my_portd = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr); - stub_eth_params.remote_portd = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr); - stub_eth_params.transp_preference = ETH_UDP_MODE; - - - sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2 - //configure_nfapi_pnf(UE_mac_inst[0].eth_params_n.remote_addr, UE_mac_inst[0].eth_params_n.remote_portc, UE_mac_inst[0].eth_params_n.my_addr, UE_mac_inst[0].eth_params_n.my_portd, UE_mac_inst[0].eth_params_n.remote_portd); - configure_nfapi_pnf(stub_eth_params.remote_addr, stub_eth_params.remote_portc, stub_eth_params.my_addr, stub_eth_params.my_portd, stub_eth_params.remote_portd); - } - else { // other midhaul - } - } - } - else { - - } -}*/ - - void RCconfig_L1(void) { int i,j; paramdef_t L1_Params[] = L1PARAMS_DESC; @@ -338,7 +297,6 @@ void RCconfig_L1(void) { configure_nfapi_pnf(RC.eNB[j][0]->eth_params_n.remote_addr, RC.eNB[j][0]->eth_params_n.remote_portc, RC.eNB[j][0]->eth_params_n.my_addr, RC.eNB[j][0]->eth_params_n.my_portd, RC.eNB[j][0]->eth_params_n .remote_portd); } else { // other midhaul - //printf("Panos-D: RCconfig_L1 12 \n"); } }// j=0..num_inst printf("Initializing northbound interface for L1\n"); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 654f69ba91eb83175a96c6b1b0855223575b7e45..b72a51cc36c847e6f5e6f64c380c6722c4f4d66a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -1006,7 +1006,7 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, #endif { // This is normal LTE case - LOG_D(MAC, "Panos-D: generate_Msg4 1 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP); + LOG_D(MAC, "generate_Msg4 1 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP); if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) { // Get RRCConnectionSetup for Piggyback @@ -1326,7 +1326,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP, ra->rnti, round, frameP, subframeP); // DLSCH Config //DJP - fix this pdu_index = -1 - LOG_D(MAC, "Panos:D: check_Msg4_retransmission() before fill_nfapi_dlsch_config() with pdu_index = -1 \n"); + LOG_D(MAC, "check_Msg4_retransmission() before fill_nfapi_dlsch_config() with pdu_index = -1 \n"); fill_nfapi_dlsch_config(mac, dl_req_body, ra->msg4_TBsize, -1 /* retransmission, no pdu_index */ diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index a7f5afd51d294a819914527d6bbc958b1afe03fc..fd58b401473a27fb9d35b5aaf725ecc76fba894b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -34,7 +34,8 @@ #include "assertions.h" #include "PHY/phy_extern.h" - +#include "PHY/LTE_TRANSPORT/transport_common_proto.h" +#include "SIMULATION/TOOLS/sim.h" #include "LAYER2/MAC/mac_proto.h" #include "LAYER2/MAC/mac_extern.h" #include "LAYER2/MAC/eNB_scheduler_fairRR.h" @@ -53,6 +54,9 @@ extern uint8_t nfapi_mode; extern volatile int16_t phy_tx_txdataF_end; extern int oai_exit; #endif +extern uint16_t sfnsf_add_subframe(uint16_t frameP, uint16_t subframeP, int offset); +extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset); + /* internal vars */ DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs]; int last_dlsch_ue_id[MAX_NUM_CCs] = {-1}; @@ -581,7 +585,7 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, LTE_eNB_UE_stats *eNB_UE_stats2 = NULL; UE_sched_ctrl *ue_sched_ctl1, *ue_sched_ctl2; #endif - + memset(min_rb_unit,0,sizeof(min_rb_unit)); for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { if (mbsfn_flag[CC_id] > 0) // If this CC is allocated for MBSFN skip it here @@ -606,7 +610,7 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, frameP, subframeP, N_RBG[CC_id], - nb_rbs_required, + (uint16_t (*)[NUMBER_OF_UE_MAX])nb_rbs_required, rballoc_sub, MIMO_mode_indicator); @@ -615,12 +619,12 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, #if (!defined(PRE_SCD_THREAD)) // Store the DLSCH buffer for each logical channel - store_dlsch_buffer(Mod_id, frameP, subframeP); + store_dlsch_buffer(Mod_id,0, frameP, subframeP); // Calculate the number of RBs required by each UE on the basis of logical channel's buffer - assign_rbs_required(Mod_id, frameP, subframeP, nb_rbs_required, + assign_rbs_required(Mod_id, 0, frameP, subframeP, nb_rbs_required, min_rb_unit); #else memcpy(nb_rbs_required, pre_nb_rbs_required[dlsch_ue_select_tbl_in_use] , sizeof(uint16_t)*MAX_NUM_CCs*NUMBER_OF_UE_MAX); @@ -679,8 +683,8 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, transmission_mode, min_rb_unit[CC_id], N_RB_DL, - nb_rbs_required, - nb_rbs_required_remaining, + (uint16_t (*)[NUMBER_OF_UE_MAX])nb_rbs_required, + (uint16_t (*)[NUMBER_OF_UE_MAX])nb_rbs_required_remaining, rballoc_sub, MIMO_mode_indicator); temp_total_rbs_count -= ue_sched_ctl->pre_nb_available_rbs[CC_id]; @@ -795,7 +799,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP, uint8_t CC_id; int UE_id; - unsigned char aggregation; +// unsigned char aggregation; mac_rlc_status_resp_t rlc_status; unsigned char header_len_dcch = 0, header_len_dcch_tmp = 0; unsigned char header_len_dtch = 0, header_len_dtch_tmp = @@ -814,7 +818,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP, eNB_MAC_INST *eNB = RC.mac[module_idP]; COMMON_channels_t *cc = eNB->common_channels; UE_list_t *UE_list = &eNB->UE_list; - int continue_flag = 0; + // int continue_flag = 0; int32_t normalized_rx_power, target_rx_power; int32_t tpc = 1; static int32_t tpc_accumulated = 0; @@ -884,7 +888,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP, } //weight = get_ue_weight(module_idP,UE_id); - aggregation = 2; +// aggregation = 2; for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { N_RB_DL[CC_id] = to_prb(cc[CC_id].mib->message.dl_Bandwidth); min_rb_unit[CC_id] = get_min_rb_unit(module_idP, CC_id); @@ -943,7 +947,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP, eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id]; ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; - +/* switch(get_tmode(module_idP,CC_id,UE_id)){ case 1: case 2: @@ -962,7 +966,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP, aggregation = 2; break; } - +*/ if (cc[CC_id].tdd_Config != NULL) { //TDD set_ue_dai (subframeP, UE_id, @@ -972,7 +976,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP, // update UL DAI after DLSCH scheduling set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP); } -#warning RK->CR This old API call has to be revisited for FAPI, or logic must be changed +//#warning RK->CR This old API call has to be revisited for FAPI, or logic must be changed #if 0 /* add "fake" DCI to have CCE_allocation_infeasible work properly for next allocations */ /* if we don't add it, next allocations may succeed but overall allocations may fail */ @@ -1661,7 +1665,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP, } //#endif #ifdef DEBUG_eNB_SCHEDULER - LOG_T(MAC, "[eNB %d] First 16 bytes of DLSCH : \n"); + LOG_T(MAC, "[eNB %d] First 16 bytes of DLSCH : \n",module_idP ); for (i = 0; i < 16; i++) { LOG_T(MAC, "%x.", dlsch_buffer[i]); @@ -2672,19 +2676,19 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, if(N_RB_UL == 25){ if (first_rb[CC_id] >= N_RB_UL-1) { LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d N_RB_UL %d first_rb %d: dropping, not enough RBs\n", - module_idP,frameP,subframeP,UE_id,rnti,CC_id, N_RB_UL, first_rb); + module_idP,frameP,subframeP,UE_id,rnti,CC_id, N_RB_UL, first_rb[CC_id]); break; } }else if(N_RB_UL == 50){ if (first_rb[CC_id] >= N_RB_UL-2) { LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d N_RB_UL %d first_rb %d: dropping, not enough RBs\n", - module_idP,frameP,subframeP,UE_id,rnti,CC_id, N_RB_UL, first_rb); + module_idP,frameP,subframeP,UE_id,rnti,CC_id, N_RB_UL, first_rb[CC_id]); break; } }else if(N_RB_UL == 100){ if (first_rb[CC_id] >= N_RB_UL-3) { LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d N_RB_UL %d first_rb %d: dropping, not enough RBs\n", - module_idP,frameP,subframeP,UE_id,rnti,CC_id, N_RB_UL, first_rb); + module_idP,frameP,subframeP,UE_id,rnti,CC_id, N_RB_UL, first_rb[CC_id]); break; } } diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index 81c053ba0e0f4522ef419fb035e5ab4a724cb6a3..8515d14a79430618ce992a8de8c32dc8cbe540a9 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -328,7 +328,6 @@ typedef struct { uint8_t Buffer_size0:6; } __attribute__ ((__packed__)) BSR_LONG; -// Panos: /*!\brief mac control element: sidelink buffer status report */ typedef struct { uint8_t DST_1:4; @@ -1529,13 +1528,13 @@ typedef struct { time_stats_t rx_si; /// UE PCCH rx processing time including RLC interface (mac_rrc_data_ind) time_stats_t rx_p; - /// Panos: Mutex for nfapi UL_INFO + /// Mutex for nfapi UL_INFO pthread_mutex_t UL_INFO_mutex; - /// Panos: UE_Mode variable should be used in the case of Phy_stub operation since we won't have access to PHY_VARS_UE + /// UE_Mode variable should be used in the case of Phy_stub operation since we won't have access to PHY_VARS_UE /// where the UE_mode originally is for the full stack operation mode. The transitions between the states of the UE_Mode /// will be triggered within phy_stub_ue.c in this case UE_MODE_t UE_mode[NUMBER_OF_CONNECTED_eNB_MAX]; - /// Panos: Phy_stub mode: Boolean variable to distinguish whether a Msg3 or a regular ULSCH data pdu should be generated + /// Phy_stub mode: Boolean variable to distinguish whether a Msg3 or a regular ULSCH data pdu should be generated /// after the reception of NFAPI_UL_CONFIG_ULSCH_PDU_TYPE. uint8_t first_ULSCH_Tx; uint8_t SI_Decoded; diff --git a/openair2/LAYER2/MAC/mac_proto.h b/openair2/LAYER2/MAC/mac_proto.h index d4748c83cac4d739ee34e4e15706d284d0f47cbd..3202adfa0fef71bde127424c6c0dc0657e16c56c 100644 --- a/openair2/LAYER2/MAC/mac_proto.h +++ b/openair2/LAYER2/MAC/mac_proto.h @@ -441,6 +441,7 @@ void set_ue_dai(sub_frame_t subframeP, int UE_id, uint8_t CC_id, uint8_t tdd_config, UE_list_t * UE_list); +uint8_t frame_subframe2_dl_harq_pid(TDD_Config_t *tdd_Config, int abs_frameP, sub_frame_t subframeP); /** \brief First stage of PCH Scheduling. Gets a PCH SDU from RRC if available and computes the MCS required to transport it as a function of the SDU length. It assumes a length less than or equal to 64 bytes (MCS 6, 3 PRBs). @param Mod_id Instance ID of eNB @param frame Frame index @@ -675,6 +676,8 @@ int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti, int harq_pid ); int rrc_mac_remove_ue(module_id_t Mod_id, rnti_t rntiP); +void store_dlsch_buffer(module_id_t Mod_id, slice_id_t slice_id, frame_t frameP, sub_frame_t subframeP); +void assign_rbs_required(module_id_t Mod_id, slice_id_t slice_id, frame_t frameP, sub_frame_t subframe, uint16_t nb_rbs_required[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB], int min_rb_unit[NFAPI_CC_MAX]); int maxround(module_id_t Mod_id, uint16_t rnti, int frame, sub_frame_t subframe, uint8_t ul_flag); diff --git a/openair2/LAYER2/MAC/main.c b/openair2/LAYER2/MAC/main.c index d32da8ac7259fad0c17cfb06c266669059a71e76..30ee279c947ba77cb12012cca1ee71180cb047ef 100644 --- a/openair2/LAYER2/MAC/main.c +++ b/openair2/LAYER2/MAC/main.c @@ -62,6 +62,7 @@ void mac_top_init_eNB(void) RC.mac = (eNB_MAC_INST **) malloc16(RC.nb_macrlc_inst * sizeof(eNB_MAC_INST *)); + bzero(RC.mac, RC.nb_macrlc_inst * sizeof(eNB_MAC_INST *)); } AssertFatal(RC.mac != NULL, "can't ALLOCATE %zu Bytes for %d eNB_MAC_INST with size %zu \n", diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index 94362d499af6eec3a7f419c72b09b0d0b4f22fd0..c6dc605a274a770eb96637a8e20e101704a2ec2c 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -299,8 +299,8 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id, uint8_t Size = 0; UE_MODE_t UE_mode; - // Panos: Modification for phy_stub_ue operation - if(nfapi_mode == 3) { // Panos: phy_stub_ue mode + // Modification for phy_stub_ue operation + if(nfapi_mode == 3) { // phy_stub_ue mode UE_mode = UE_mac_inst[module_idP].UE_mode[0]; LOG_D(MAC, "ue_get_rach , UE_mode: %d", UE_mode); } diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 4948562e0ff38cd3386ee56ede6395c61f81ef27..592ba42b26be5f659ee00dbd740214e7e8a15d3e 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -475,8 +475,8 @@ ue_send_sdu(module_id_t module_idP, LOG_E(MAC, "[UE %d][RAPROC] Contention detected, RA failed\n", module_idP); - if(nfapi_mode == 3) { // Panos: phy_stub mode - // Panos: Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to + if(nfapi_mode == 3) { // phy_stub mode + // Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to // PRACH state. LOG_I(MAC, "nfapi_mode3: Setting UE_mode BACK to PRACH 1\n"); UE_mac_inst[module_idP].UE_mode[eNB_index] = PRACH; @@ -502,7 +502,7 @@ ue_send_sdu(module_id_t module_idP, RA_contention_resolution_timer_active = 0; if(nfapi_mode == 3) // phy_stub mode { - //Panos: Modification for phy_stub mode operation here. We only need to change the ue_mode to PUSCH + // Modification for phy_stub mode operation here. We only need to change the ue_mode to PUSCH UE_mac_inst[module_idP].UE_mode[eNB_index] = PUSCH; } else { // Full stack mode @@ -519,7 +519,7 @@ ue_send_sdu(module_id_t module_idP, payload_ptr[0]); #endif - // Panos: Eliminate call to process_timing_advance for the phy_stub UE operation mode. Is this correct? + // Eliminate call to process_timing_advance for the phy_stub UE operation mode. Is this correct? if (nfapi_mode!=3) { process_timing_advance(module_idP,CC_id,payload_ptr[0]); @@ -881,17 +881,6 @@ void ue_send_sl_sdu(module_id_t module_idP, } else { //SL_DISCOVERY uint16_t len = sdu_len; LOG_I( MAC, "SL DISCOVERY \n"); - // Panos: Ask TTN if we should be calling mac_rrc_data_ind_ue() instead of mac_rrc_data_ind() now! - /*mac_rrc_data_ind(module_idP, - CC_id, - frameP,subframeP, - UE_mac_inst[module_idP].crnti, - SL_DISCOVERY, - sdu, //(uint8_t*)&UE_mac_inst[Mod_id].SL_Discovery[0].Rx_buffer.Payload[0], - len, - ENB_FLAG_NO, - eNB_index, - 0);*/ mac_rrc_data_ind_ue(module_idP, CC_id, frameP,subframeP, @@ -1623,7 +1612,6 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t * ulsch_buffer, uint16_t buflen, uint8_t * access_mode) { - //LOG_I(MAC, "Panos-D: UE[%d] In ue_get_sdu() 1 \n", module_idP); uint8_t total_rlc_pdu_header_len = 0, rlc_pdu_header_len_last = 0; uint16_t buflen_remain = 0; uint8_t bsr_len = 0, bsr_ce_len = 0, bsr_header_len = 0; @@ -1997,7 +1985,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, // build PHR and update the timers if (phr_ce_len == sizeof(POWER_HEADROOM_CMD)) { if(nfapi_mode ==3){ - //Panos: Substitute with a static value for the MAC layer abstraction (phy_stub mode) + //Substitute with a static value for the MAC layer abstraction (phy_stub mode) phr_p->PH = 40; } else{ @@ -2212,7 +2200,6 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, buflen - sdu_length_total - payload_offset); // cycle through SDUs and place in ulsch_buffer if (sdu_length_total) { - //LOG_I(MAC, "Panos-D: [UE %d] ue_get_sdu() 2 before copying to ulsch_buffer, SFN/SF: %d/%d \n \n \n", module_idP, frameP, subframe); memcpy(&ulsch_buffer[payload_offset], ulsch_buff, sdu_length_total); } @@ -2466,8 +2453,8 @@ ue_scheduler(const module_id_t module_idP, LOG_E(MAC, "Module id %u Contention resolution timer expired, RA failed\n", module_idP); - if(nfapi_mode == 3) { // Panos: phy_stub mode - // Panos: Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to + if(nfapi_mode == 3) { // phy_stub mode + // Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to // PRACH state. LOG_I(MAC, "nfapi_mode3: Setting UE_mode to PRACH 2 \n"); UE_mac_inst[module_idP].UE_mode[eNB_indexP] = PRACH; @@ -3201,16 +3188,6 @@ SLDCH_t *ue_get_sldch(module_id_t Mod_id,int CC_id,frame_t frame_tx,sub_frame_t //UE_MAC_INST *ue = &UE_mac_inst[Mod_id]; SLDCH_t *sldch = &UE_mac_inst[Mod_id].sldch; - // Panos: Ask TTN if we should be calling mac_rrc_data_req_ue() instead of mac_rrc_data_req() now! - /*sldch->payload_length = mac_rrc_data_req(Mod_id, - CC_id, - frame_tx, - SL_DISCOVERY, - 1, - (char*)(sldch->payload), //&UE_mac_inst[Mod_id].SL_Discovery[0].Tx_buffer.Payload[0], - 0, - 0, //eNB_indexP - 0);*/ sldch->payload_length = mac_rrc_data_req_ue(Mod_id, CC_id, diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 5b89e8cddeb12dc9358dabbc4a630dd926243df2..ec605faa713e03b804a47d411c407e6f58ce4317 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -491,7 +491,6 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) int prose_addr_len; char send_buf[BUFSIZE], receive_buf[BUFSIZE]; - // Panos: Remove the following definitions due to warnings of unused variables. //int optval; int bytes_received; sidelink_pc5s_element *sl_pc5s_msg_recv = NULL; diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index 6ba7e883b16e3fc78527f51c45d7252f83bc5cbf..d922a1dae29fd9cae3ec44e751df3b9adbb1061c 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -368,19 +368,16 @@ mac_rlc_status_resp_t mac_rlc_status_ind( } else #endif { - //LOG_I(RLC, "Panos-D mac_rlc_status_ind 1 enb_flagP: %d, channel_idP: %d, srb_flag: %d \n", enb_flagP, channel_idP, srb_flag); key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag); } } - //LOG_I(RLC, "Panos-D mac_rlc_status_ind 2 enb_flagP: %d, channel_idP: %d, srb_flag: %d \n", enb_flagP, channel_idP, srb_flag); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_OK) { rlc_mode = rlc_union_p->mode; } else { rlc_mode = RLC_MODE_NONE; - //LOG_D(RLC , "Panos-D: mac_rlc_status_ind() In RLC_MODE_NONE \n"); //LOG_W(RLC , "[%s] RLC not configured lcid %u module %u!\n", __FUNCTION__, channel_idP, module_idP); //LOG_D(RLC , "[%s] RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP); } diff --git a/openair2/PHY_INTERFACE/UE_MAC_interface.h b/openair2/PHY_INTERFACE/UE_MAC_interface.h index 0e4777d0b028cf0e5af141fc23a538e77448503f..d010109f998192d5b3f412241aa973d8f83e07e3 100644 --- a/openair2/PHY_INTERFACE/UE_MAC_interface.h +++ b/openair2/PHY_INTERFACE/UE_MAC_interface.h @@ -192,14 +192,14 @@ typedef struct{ }UE_MAC_BCH_indication_body_t; -// Panos: Corresponding to inputs of MAC functions: ue_send_sdu(), ue_decode_si(), ue_decode_p(). +// Corresponding to inputs of MAC functions: ue_send_sdu(), ue_decode_si(), ue_decode_p(). typedef struct{ uint8_t* data; uint16_t data_len; }UE_MAC_dlsch_pdu; -// Panos: Corresponding to inputs of MAC function: process_rar(). +// Corresponding to inputs of MAC function: process_rar(). typedef struct{ rnti_t ra_rnti; uint8_t* rar_input_buffer; // Originating from PHY diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 588cde5231d917d1db71b172563c13ab1eee3a26..299c12a7a0247d549ab1e980b729d6c6f1f07a61 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -68,7 +68,7 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND pdu->data = ulsch_buffer; // estimate timing advance for MAC //sync_pos = lte_est_timing_advance_pusch(eNB,UE_id); - timing_advance_update = 0; //Panos: Don't know what to put here + timing_advance_update = 0; // Don't know what to put here pdu->rx_indication_rel8.timing_advance = timing_advance_update; int SNRtimes10 = 640; @@ -105,10 +105,10 @@ void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_I pdu->instance_length = 0; // don't know what to do with this // pdu->rx_ue_information.handle = handle; pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG; - pdu->rx_ue_information.rnti = rnti; //UE_mac_inst[Mod_id].crnti;; //Panos: Is this the right RNTI? + pdu->rx_ue_information.rnti = rnti; //UE_mac_inst[Mod_id].crnti - // Panos dependency from PHY not sure how to substitute this. Should we hardcode it? + // dependency from PHY not sure how to substitute this. Should we hardcode it? //int SNRtimes10 = dB_fixed_times10(stat) - 200;//(10*eNB->measurements.n0_power_dB[0]); int SNRtimes10 = 640; @@ -130,7 +130,7 @@ void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_ pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); - //Panos: REMEMBER HAVE EXCHANGED THE FOLLOWING TWO LINES HERE! + // REMEMBER HAVE EXCHANGED THE FOLLOWING TWO LINES HERE! nfapi_crc_indication_pdu_t *pdu = &UL_INFO->crc_ind.crc_indication_body.crc_pdu_list[UL_INFO->crc_ind.crc_indication_body.number_of_crcs]; UL_INFO->crc_ind.sfn_sf = frame<<4| subframe; @@ -172,9 +172,9 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL UL_INFO->rach_ind.rach_indication_body.preamble_list = (nfapi_preamble_pdu_t*)malloc(UL_INFO->rach_ind.rach_indication_body.number_of_preambles*sizeof(nfapi_preamble_pdu_t)); UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.tl.tag = NFAPI_PREAMBLE_REL8_TAG; - UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.timing_advance = 0; //Panos: Not sure about that + UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.timing_advance = 0; // Not sure about that - //Panos: The two following should get extracted from the call to get_prach_resources(). + //The two following should get extracted from the call to get_prach_resources(). UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.preamble = ra_PreambleIndex; UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti = ra_RNTI; //UL_INFO->rach_ind.rach_indication_body.number_of_preambles++; @@ -191,7 +191,7 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti, UL_INFO->rach_ind.rach_indication_body.preamble_list[0].preamble_rel13.rach_resource_type); - //Panos: This function is currently defined only in the nfapi-RU-RAU-split so we should call it when we merge + // This function is currently defined only in the nfapi-RU-RAU-split so we should call it when we merge // with that branch. oai_nfapi_rach_ind(&UL_INFO->rach_ind); free(UL_INFO->rach_ind.rach_indication_body.preamble_list); @@ -210,12 +210,12 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subfram pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG; pdu->rx_ue_information.rnti = rnti; - //Panos: Since we assume that CRC flag is always 0 (ACK) I guess that data_offset should always be 0. + // Since we assume that CRC flag is always 0 (ACK) I guess that data_offset should always be 0. pdu->cqi_indication_rel9.data_offset = 0; // by default set O to rank 1 value //pdu->cqi_indication_rel9.length = (ulsch_harq->Or1>>3) + ((ulsch_harq->Or1&7) > 0 ? 1 : 0); - // Panos: Not useful field for our case + // Not useful field for our case pdu->cqi_indication_rel9.tl.tag = NFAPI_CQI_INDICATION_REL9_TAG; pdu->cqi_indication_rel9.length = 0; pdu->cqi_indication_rel9.ri[0] = 0; @@ -225,7 +225,7 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subfram pdu->cqi_indication_rel9.number_of_cc_reported = 1; pdu->ul_cqi_information.channel = 1; // PUSCH - //Panos: Not sure how to substitute this. This should be the actual CQI value? So can + // Not sure how to substitute this. This should be the actual CQI value? So can // we hardcode it to a specific value? //memcpy((void*)raw_pdu->pdu,ulsch_harq->o,pdu->cqi_indication_rel9.length); raw_pdu->pdu[0] = 7; @@ -255,18 +255,18 @@ void fill_ulsch_harq_indication_UE_MAC(int Mod_id, int frame,int subframe, UL_IN pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG; pdu->rx_ue_information.rnti = rnti; - //Panos: For now we consider only FDD + // For now we consider only FDD //if (eNB->frame_parms.frame_type == FDD) { pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG; pdu->harq_indication_fdd_rel13.mode = 0; pdu->harq_indication_fdd_rel13.number_of_ack_nack = harq_information->harq_information_rel10.harq_size; - //Panos: Could this be wrong? Is the number_of_ack_nack field equivalent to O_ACK? + // Could this be wrong? Is the number_of_ack_nack field equivalent to O_ACK? //pdu->harq_indication_fdd_rel13.number_of_ack_nack = ulsch_harq->O_ACK; for (i=0;i<harq_information->harq_information_rel10.harq_size;i++) { - pdu->harq_indication_fdd_rel13.harq_tb_n[i] = 1; //Panos: Assuming always an ACK (No NACK or DTX) + pdu->harq_indication_fdd_rel13.harq_tb_n[i] = 1; // Assuming always an ACK (No NACK or DTX) } @@ -319,7 +319,7 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id, pdu->harq_indication_fdd_rel13.number_of_ack_nack = 1; //AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); - pdu->harq_indication_fdd_rel13.harq_tb_n[0] = 1; //Panos: Assuming always an ACK (No NACK or DTX) + pdu->harq_indication_fdd_rel13.harq_tb_n[0] = 1; // Assuming always an ACK (No NACK or DTX) } @@ -328,8 +328,8 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id, pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG; pdu->harq_indication_fdd_rel13.mode = 0; pdu->harq_indication_fdd_rel13.number_of_ack_nack = 2; - pdu->harq_indication_fdd_rel13.harq_tb_n[0] = 1; //Panos: Assuming always an ACK (No NACK or DTX) - pdu->harq_indication_fdd_rel13.harq_tb_n[1] = 1; //Panos: Assuming always an ACK (No NACK or DTX) + pdu->harq_indication_fdd_rel13.harq_tb_n[0] = 1; // Assuming always an ACK (No NACK or DTX) + pdu->harq_indication_fdd_rel13.harq_tb_n[1] = 1; // Assuming always an ACK (No NACK or DTX) } else AssertFatal(1==0,"only format 1a/b for now, received \n"); @@ -362,15 +362,14 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id, fill_crc_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, 0, index, rnti); fill_rx_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, UE_mac_inst[Mod_id].RA_prach_resources.Msg3,buflen, rnti, index); Msg3_transmitted(Mod_id, 0, frame, 0); - // Panos: Modification + // Modification UE_mac_inst[Mod_id].UE_mode[0] = PUSCH; UE_mac_inst[Mod_id].first_ULSCH_Tx = 0; - // Panos: This should be done after the reception of the respective hi_dci0 + // This should be done after the reception of the respective hi_dci0 //UE_mac_inst[Mod_id].first_ULSCH_Tx = 0; } else { - //LOG_I(MAC, "Panos-D: handle_nfapi_ul_pdu_UE_MAC 2.3 \n"); ue_get_sdu( Mod_id, 0, frame, subframe, 0, ulsch_buffer, buflen, &access_mode); fill_crc_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, 0, index, rnti); fill_rx_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, ulsch_buffer,buflen, rnti, index); @@ -393,12 +392,11 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id, fill_rx_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, UE_mac_inst[Mod_id].RA_prach_resources.Msg3,buflen, rnti, index); Msg3_transmitted(Mod_id, 0, frame, 0); //UE_mac_inst[Mod_id].first_ULSCH_Tx = 0; - // Panos: Modification + // Modification UE_mac_inst[Mod_id].UE_mode[0] = PUSCH; UE_mac_inst[Mod_id].first_ULSCH_Tx = 0; } else { - //LOG_I(MAC, "Panos-D: handle_nfapi_ul_pdu_UE_MAC 3.1 \n"); ue_get_sdu( Mod_id, 0, frame, subframe, 0, ulsch_buffer, buflen, &access_mode); fill_crc_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, 0, index, rnti); fill_rx_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, ulsch_buffer,buflen, rnti, index); @@ -421,7 +419,7 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id, fill_rx_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, UE_mac_inst[Mod_id].RA_prach_resources.Msg3,buflen, rnti, index); Msg3_transmitted(Mod_id, 0, frame, 0); //UE_mac_inst[Mod_id].first_ULSCH_Tx = 0; - // Panos: Modification + // Modification UE_mac_inst[Mod_id].UE_mode[0] = PUSCH; UE_mac_inst[Mod_id].first_ULSCH_Tx = 0; } @@ -448,7 +446,7 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id, fill_rx_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, UE_mac_inst[Mod_id].RA_prach_resources.Msg3,buflen, rnti, index); Msg3_transmitted(Mod_id, 0, frame, 0); //UE_mac_inst[Mod_id].first_ULSCH_Tx = 0; - // Panos: Modification + // Modification UE_mac_inst[Mod_id].UE_mode[0] = PUSCH; UE_mac_inst[Mod_id].first_ULSCH_Tx = 0; } @@ -788,13 +786,9 @@ int hi_dci0_req_UE_MAC(nfapi_hi_dci0_request_t* req, module_id_t Mod_id) int memcpy_dl_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request_t* req) { - //module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change. - //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){ dl_config_req = (nfapi_dl_config_request_t*)malloc(sizeof(nfapi_dl_config_request_t)); - //LOG_I(MAC, "Panos-D: memcpy_dl_config_req 1, Mod_id:%d \n", Mod_id); - //UE_mac_inst[Mod_id].dl_config_req->header = req->header; dl_config_req->sfn_sf = req->sfn_sf; @@ -822,10 +816,6 @@ int memcpy_dl_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request int memcpy_ul_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req) { - //LOG_D(MAC, "Panos-D: memcpy_ul_config_req 1 \n"); - - //module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change. - //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){ @@ -857,8 +847,6 @@ int memcpy_ul_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request int memcpy_tx_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req) { - //module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change. - tx_req_num_elems = req->tx_request_body.number_of_pdus; tx_request_pdu_list = (nfapi_tx_request_pdu_t*) calloc(tx_req_num_elems, sizeof(nfapi_tx_request_pdu_t)); @@ -884,7 +872,6 @@ int memcpy_hi_dci0_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t* { //if(req!=0){ - //module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change. //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){ hi_dci0_req = (nfapi_hi_dci0_request_t*)malloc(sizeof(nfapi_hi_dci0_request_t)); @@ -929,7 +916,7 @@ void UE_config_stub_pnf(void) { if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) { sf_ahead = 4; // Need 4 subframe gap between RX and TX } - // Panos: Right now that we have only one UE (thread) it is ok to put the eth_params in the UE_mac_inst. + // Right now that we have only one UE (thread) it is ok to put the eth_params in the UE_mac_inst. // Later I think we have to change that to attribute eth_params to a global element for all the UEs. else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) { stub_eth_params.local_if_name = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr)); diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h index 9865be3eebb2eab81fd10acde8b97bafe6fe2846..9060951b26068a974ed92c7b21e25772054ac96b 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.h +++ b/openair2/PHY_INTERFACE/phy_stub_UE.h @@ -21,7 +21,7 @@ UL_IND_t *UL_INFO; nfapi_tx_request_pdu_t* tx_request_pdu_list; // New -/// Panos: Pointers to config_request types. Used from nfapi callback functions. +/// Pointers to config_request types. Used from nfapi callback functions. nfapi_dl_config_request_t* dl_config_req; nfapi_ul_config_request_t* ul_config_req; nfapi_hi_dci0_request_t* hi_dci0_req; @@ -35,7 +35,7 @@ eth_params_t stub_eth_params; -// Panos: This function should return all the sched_response config messages which concern a specific UE. Inside this +// This function should return all the sched_response config messages which concern a specific UE. Inside this // function we should somehow make the translation of config message's rnti to Mod_ID. Sched_Rsp_t get_nfapi_sched_response(uint8_t Mod_id); diff --git a/openair2/RRC/LTE/L2_interface_ue.c b/openair2/RRC/LTE/L2_interface_ue.c index 90751ecf25c927c4b13055c45fb60b84f9eb58e4..1b0b2fa7754e1a9aadd127e9d53b3f7a4fca1b5d 100644 --- a/openair2/RRC/LTE/L2_interface_ue.c +++ b/openair2/RRC/LTE/L2_interface_ue.c @@ -403,7 +403,6 @@ void rrc_in_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index) UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt=0; if (UE_rrc_inst[Mod_idP].Info[eNB_index].T310_active==1) { - LOG_D(RRC, "Panos-D: rrc_in_sync_ind 1 \n"); UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt++; } diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index 25d4868c2f1a761af6750b9208fc9fd5a2bf8e16..28121caebbfbdc73b45206ebe4596eeff7d01cd9 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -786,7 +786,6 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* co char message_string[10000]; size_t message_string_size; - //LOG_I(RRC, "Panos-D: rrc_ue_decode_ccch, Before xer_sprint() \n"); if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *)dl_ccch_msg)) > 0) { MessageDef *msg_p; @@ -1977,7 +1976,6 @@ rrc_ue_process_securityModeCommand( char message_string[20000]; size_t message_string_size; - //LOG_I(RRC, "Panos-D: rrc_ue_process_securityModeCommand, Before xer_sprint() \n"); if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { MessageDef *msg_p; @@ -2089,7 +2087,6 @@ rrc_ue_process_ueCapabilityEnquiry( char message_string[20000]; size_t message_string_size; - //LOG_I(RRC, "Panos-D: rrc_ue_process_ueCapabilityEnquiry, Before xer_sprint() \n"); if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { MessageDef *msg_p; @@ -2484,7 +2481,6 @@ rrc_ue_decode_dcch( char message_string[30000]; size_t message_string_size; - //LOG_I(RRC, "Panos-D: rrc_ue_decode_dcch, Before xer_sprint() \n"); if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *)dl_dcch_msg)) > 0) { msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; @@ -3020,7 +3016,6 @@ int decode_BCCH_DLSCH_Message( char message_string[15000]; size_t message_string_size; - LOG_I(RRC, "Panos-D: decode_BCCH_DLSCH_Message, Before xer_sprint() SI_status %d\n", UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus); if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) { MessageDef *msg_p; @@ -3046,8 +3041,6 @@ int decode_BCCH_DLSCH_Message( sizeof(SystemInformationBlockType1_t) ); LOG_D( RRC, "[UE %"PRIu8"] Decoding First SIB1\n", ctxt_pP->module_id ); - //LOG_I( RRC, "Panos-D: decode_BCCH_DLSCH_Message1 BEFORE decode_SIB1"); - //printf("Panos-D: decode_BCCH_DLSCH_Message1 BEFORE decode_SIB1"); decode_SIB1( ctxt_pP, eNB_index, rsrq, rsrp ); } } @@ -3066,8 +3059,6 @@ int decode_BCCH_DLSCH_Message( LOG_I( RRC, "[UE %"PRIu8"] Decoding SI for frameP %"PRIu32"\n", ctxt_pP->module_id, ctxt_pP->frame ); - //LOG_I( RRC, "Panos-D: decode_BCCH_DLSCH_Message1 BEFORE OTHER decode_SI"); - //printf("Panos-D: decode_BCCH_DLSCH_Message1 BEFORE OTHER decode_SI"); decode_SI( ctxt_pP, eNB_index ); //if (nfapi_mode == 3) UE_mac_inst[ctxt_pP->module_id].SI_Decoded = 1; @@ -3916,12 +3907,10 @@ uint64_t arfcn_to_freq(long arfcn) { //----------------------------------------------------------------------------- int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) { - //LOG_D( RRC, "Panos-D: decode_SI 1 \n"); SystemInformation_t** si = &UE_rrc_inst[ctxt_pP->module_id].si[eNB_index]; int new_sib = 0; SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; - //LOG_D( RRC, "Panos-D: decode_SI 2 \n"); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_IN ); // Dump contents @@ -3930,20 +3919,16 @@ uint64_t arfcn_to_freq(long arfcn) { LOG_D( RRC, "[UE] (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count %d\n", (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count ); } else { - //LOG_D( RRC, "Panos-D: decode_SI 2.3 \n"); LOG_D( RRC, "[UE] Unknown criticalExtension version (not Rel8)\n" ); return -1; } - LOG_D( RRC, "Panos-D: decode_SI 3 \n"); for (int i=0; i<(*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count; i++) { - //LOG_I( RRC, "Panos-D: SI count %d\n", i ); struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *typeandinfo; typeandinfo = (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.array[i]; switch(typeandinfo->present) { case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2: - //LOG_D( RRC, "Panos-D: decode_SI 4 \n"); if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&2) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=2; new_sib=1; @@ -4033,7 +4018,6 @@ uint64_t arfcn_to_freq(long arfcn) { break; // case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3: - //LOG_D( RRC, "Panos-D: decode_SI 5 \n"); if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&4) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=4; new_sib=1; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 03504c99b8e1e677671cc0031615705fe8bad621..758d64898599af53947849d190cdee47fec18c11 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -710,7 +710,6 @@ void rrc_eNB_emulation_notify_ue_module_id( const uint8_t cell_identity_byte2P, const uint8_t cell_identity_byte3P) { - LOG_I(RRC, "Panos-D: rrc_eNB_emulation_notify_ue_module_id 1 \n"); module_id_t enb_module_id; struct rrc_eNB_ue_context_s* ue_context_p = NULL; int CC_id; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf index 15e52c7cdd9131f49b59c71c55d84cdbce46387a..69166672d79298d91ff605d5fa2fbf21b5cc6515 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf @@ -198,7 +198,7 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - phy_test_mode = 1; + phy_test_mode = 0; puSch10xSnr = 200; puCch10xSnr = 200; } diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index a418d09a0f586f6752abf54e48097c64ee9e78db..f75a284840742644107ec25d466aaa4dfe38e345 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -449,11 +449,13 @@ static void* eNB_thread_rxtx( void* param ) { exit_fun( "ERROR pthread_cond_signal" ); } pthread_mutex_unlock( &proc->mutex_rxtx ); - if(get_nprocs() >= 8) wakeup_tx(eNB,eNB->proc.ru_proc); - else - { - phy_procedures_eNB_TX(eNB, proc, 1); - wakeup_txfh(proc,eNB->proc.ru_proc); + if (nfapi_mode!=2){ + if(get_nprocs() >= 8) wakeup_tx(eNB,eNB->proc.ru_proc); + else + { + phy_procedures_eNB_TX(eNB, proc, 1); + wakeup_txfh(proc,eNB->proc.ru_proc); + } } } // while !oai_exit @@ -1013,7 +1015,7 @@ void init_eNB_proc(int inst) { //pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, proc_rxtx ); - // Panos: Should we also include here the case where single_thread_flag = 1 ? + //Should we also include here the case where single_thread_flag = 1 ? if(nfapi_mode!=2){ pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, proc ); pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, tx_thread, proc); diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index f21fbf1c4f187c7dff436fa821ce3e535f904a0d..1d272f458cdf8c5c8d03a42d28fa2bd8e00d024f 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -1774,10 +1774,6 @@ static void* ru_thread( void* param ) { // wakeup all eNB processes waiting for this RU if (ru->num_eNB>0) wakeup_eNBs(ru); - // wait until eNBs are finished subframe RX n and TX n+sf_ahead - if ((get_nprocs() > 4) && (ru->num_eNB>0)) - wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread"); - #ifndef PHY_TX_THREAD if(get_nprocs() <= 4 || ru->num_eNB==0){ // do TX front-end processing if needed (precoding and/or IDFTs) diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 42f2565ef9b8487a712e7d90af91f33ca687a150..98ae9dac0f638427ce4ef64049734783103c6a1d 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -185,7 +185,7 @@ PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, ue->Mod_id = UE_id; ue->mac_enabled = 1; - // Panos: In phy_stub_UE (MAC-to-MAC) mode these init functions don't need to get called. Is this correct? + // In phy_stub_UE (MAC-to-MAC) mode these init functions don't need to get called. Is this correct? if (nfapi_mode!=3) { // initialize all signal buffers @@ -357,7 +357,7 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti printf("UE threads created by %ld\n", gettid()); } -// Panos: Initiating all UEs within a single set of threads for PHY_STUB. Future extensions -> multiple +// Initiating all UEs within a single set of threads for PHY_STUB. Future extensions -> multiple // set of threads for multiple UEs. void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_iface) { @@ -1006,8 +1006,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { LOG_E( MAC, "[SCHED][UE] error unlocking mutex for UE RXn_TXnp4\n" ); exit_fun("nothing to add"); } - LOG_D(MAC," Panos-D [UE_phy_stub_thread_rxn_txnp4 1] Frame: %d, Subframe: %d \n" "\n" "\n", timer_frame, timer_subframe); - proc->subframe_rx=timer_subframe; proc->frame_rx = timer_frame; @@ -1018,14 +1016,14 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { oai_subframe_ind(timer_frame, timer_subframe); - // Panos: Guessing that the next 4 lines are not needed for the phy_stub mode. + //Guessing that the next 4 lines are not needed for the phy_stub mode. /*initRefTimes(t2); initRefTimes(t3); pickTime(current); updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");*/ - //Panos: Not sure whether we should put the memory allocation here and not sure how much memory + // Not sure whether we should put the memory allocation here and not sure how much memory //we should allocate for each subframe cycle. UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t)); @@ -1157,7 +1155,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); } } // mode is PRACH - // Panos: Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger + // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). // Generate UL_indications which correspond to UL traffic. if(ul_config_req!=NULL){ //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ @@ -1297,7 +1295,7 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) { phy_stub_ticking->ticking_var = -1; proc->subframe_rx=proc->sub_frame_start; - //PANOS: CAREFUL HERE! + // CAREFUL HERE! wait_sync("UE_phy_stub_thread_rxn_txnp4"); while (!oai_exit) { @@ -1317,8 +1315,6 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) { LOG_E( MAC, "[SCHED][UE] error unlocking mutex for UE RXn_TXnp4\n" ); exit_fun("nothing to add"); } - LOG_D(MAC," Panos-D [UE_phy_stub_thread_rxn_txnp4 1] Frame: %d, Subframe: %d \n" "\n" "\n", timer_frame, timer_subframe); - proc->subframe_rx=timer_subframe; proc->frame_rx = timer_frame; @@ -1361,7 +1357,6 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) { } //if(UE_mac_inst[Mod_id].hi_dci0_req!= NULL){ if (hi_dci0_req!=NULL && hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){ - LOG_I( MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind 4 \n"); hi_dci0_req_UE_MAC(hi_dci0_req, Mod_id); //if(UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){ free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list); @@ -1425,7 +1420,6 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) { if (UE->mode != loop_through_memory){ if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH) ) { - //LOG_D(MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 before RACH \n"); // check if we have PRACH opportunity @@ -1440,7 +1434,7 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) { //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); } } // mode is PRACH - // Panos: Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger + // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). // Generate UL_indications which correspond to UL traffic. if(ul_config_req!= NULL && ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ @@ -1833,12 +1827,12 @@ void init_UE_single_thread_stub(int nb_inst) { pthread_attr_init (&UE->proc.attr_ue); pthread_attr_setstacksize(&UE->proc.attr_ue,8192);//5*PTHREAD_STACK_MIN); - // Panos: Don't need synch for phy_stub mode + // Don't need synch for phy_stub mode //pthread_mutex_init(&UE->proc.mutex_synch,NULL); //pthread_cond_init(&UE->proc.cond_synch,NULL); // the threads are not yet active, therefore access is allowed without locking - // Panos: In phy_stub_UE mode due to less heavy processing operations we don't need two threads + // In phy_stub_UE mode due to less heavy processing operations we don't need two threads //int nb_threads=RX_NB_TH; int nb_threads=1; for (int i=0; i<nb_threads; i++) { @@ -1855,7 +1849,7 @@ void init_UE_single_thread_stub(int nb_inst) { pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, UE_phy_stub_single_thread_rxn_txnp4, rtd); } - // Panos: Remove thread for UE_sync in phy_stub_UE mode. + // Remove thread for UE_sync in phy_stub_UE mode. //pthread_create(&UE->proc.pthread_synch,NULL,UE_thread_synch,(void*)UE); } @@ -1885,12 +1879,12 @@ void init_UE_threads_stub(int inst) { pthread_attr_init (&UE->proc.attr_ue); pthread_attr_setstacksize(&UE->proc.attr_ue,8192);//5*PTHREAD_STACK_MIN); - // Panos: Don't need synch for phy_stub mode + // Don't need synch for phy_stub mode //pthread_mutex_init(&UE->proc.mutex_synch,NULL); //pthread_cond_init(&UE->proc.cond_synch,NULL); // the threads are not yet active, therefore access is allowed without locking - // Panos: In phy_stub_UE mode due to less heavy processing operations we don't need two threads + // In phy_stub_UE mode due to less heavy processing operations we don't need two threads //int nb_threads=RX_NB_TH; int nb_threads=1; for (int i=0; i<nb_threads; i++) { @@ -1908,7 +1902,7 @@ void init_UE_threads_stub(int inst) { } - // Panos: Remove thread for UE_sync in phy_stub_UE mode. + // Remove thread for UE_sync in phy_stub_UE mode. //pthread_create(&UE->proc.pthread_synch,NULL,UE_thread_synch,(void*)UE); } @@ -1988,168 +1982,6 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg) -/*static void* timer_thread( void* param ) { - thread_top_init("timer_thread",1,870000L,1000000L,1000000L); - timer_subframe =9; - timer_frame =1023; - //phy_stub_ticking = (SF_ticking*)malloc(sizeof(SF_ticking)); - phy_stub_ticking->ticking_var = -1; - PHY_VARS_UE *UE; - UE = PHY_vars_UE_g[0][0]; - double t_diff; - int external_timer = 0; - - - //struct timespec pselect_start; - - - //struct timespec sf_duration; - //sf_duration.tv_sec = 0; - //sf_duration.tv_nsec = 1e6; - - - wait_sync("timer_thread"); - - //pthread_mutex_init(&phy_stub_ticking->mutex_ticking,NULL); - //pthread_cond_init(&phy_stub_ticking->cond_ticking,NULL); - - // struct timespec start = {0}; - // struct timespec end = {0}; - //sleepValue.tv_nsec = 1000000; - opp_enabled = 1; - - // first check if we are receiving timing indications - if(nfapi_mode==4) { - usleep(10000); - if (UE->instance_cnt_timer > 0) { - external_timer = 1; - int absSFm1 = ((emulator_absSF+10239)%10240); - timer_frame = absSFm1/10; - timer_subframe = absSFm1%10; - pthread_mutex_lock(&UE->timer_mutex); - UE->instance_cnt_timer = -1; - pthread_mutex_unlock(&UE->timer_mutex); - LOG_I(PHY,"Running with external timer\n"); - } - else LOG_I(PHY,"Running with internal timer\n"); - } - - struct timespec t_start; - struct timespec t_now; - struct timespec t_sleep; - uint64_t T_0; - uint64_t T_now; - uint64_t T_next_SF; - uint64_t T_sleep; - uint64_t sf_cnt = 0; //Total Subframe counter - - clock_gettime(CLOCK_MONOTONIC, &t_start); - T_0 = (uint64_t) t_start.tv_sec*1000000000 + t_start.tv_nsec; - LOG_I(MAC, "Panos-D: timer_thread(), T_0 value: %" PRId64 "\n", T_0); - //printf("%" PRId64 "\n", t); - - while (!oai_exit) { - - // these are local subframe/frame counters to check that we are in synch with the fronthaul timing. - // They are set on the first rx/tx in the underly FH routines. - if (timer_subframe==9) { - timer_subframe=0; - timer_frame++; - timer_frame&=1023; - } else { - timer_subframe++; - } - //printf("[timer_thread] Frame: %d, Subframe: %d \n", timer_frame, timer_subframe); - //LOG_I(MAC," Panos-D [timer_thread] Frame: %d, Subframe: %d \n", timer_frame, timer_subframe); - //AssertFatal( 0 == pthread_cond_signal(&phy_stub_ticking->cond_ticking), ""); - AssertFatal(pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) ==0,""); - phy_stub_ticking->ticking_var++; - // This should probably be a call to pthread_cond_broadcast when we introduce support for multiple UEs (threads) - if(phy_stub_ticking->ticking_var == 0){ - //AssertFatal(phy_stub_ticking->ticking_var == 0,"phy_stub_ticking->ticking_var = %d", - //phy_stub_ticking->ticking_var); - if (pthread_cond_signal(&phy_stub_ticking->cond_ticking) != 0) { - //LOG_E( PHY, "[SCHED][UE %d] ERROR pthread_cond_signal for UE RX thread\n", UE->Mod_id); - LOG_E( PHY, "timer_thread ERROR pthread_cond_signal for UE_thread\n"); - exit_fun("nothing to add"); - } - } - else - LOG_I(MAC, "Panos-D: timer_thread() Timing problem! \n"); - - AssertFatal(pthread_mutex_unlock(&phy_stub_ticking->mutex_ticking) ==0,""); - start_meas(&UE->timer_stats); - - - //clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start); // get initial time-stamp - if (external_timer == 0) { - sf_cnt++; - T_next_SF = T_0 + sf_cnt*1000000; - do{ - clock_gettime(CLOCK_MONOTONIC, &t_now); - T_now =(uint64_t) t_now.tv_sec*1000000000 + t_now.tv_nsec; - }while(T_now < T_next_SF); - //usleep(1000); - UE_tport_t pdu; - pdu.header.packet_type = TTI_SYNC; - pdu.header.absSF = (timer_frame*10)+timer_subframe; - if (nfapi_mode!=3){ - multicast_link_write_sock(0, - &pdu, - sizeof(UE_tport_header_t)); - } - - } - 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"); - } - //clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end); // get final time-stamp - - //double t_ns = (double)(end.tv_sec - start.tv_sec) * 1.0e9 + - // (double)(end.tv_nsec - start.tv_nsec); - //printf("Panos-D: [timer_thread] REAL TIME difference: %f", t_ns); - - - stop_meas(&UE->timer_stats); - t_diff = get_time_meas_us(&UE->timer_stats); - - //printf("Panos-D: Absolute time: %lld, diff: %lld, diff_now: %lld \n",UE->timer_stats.p_time, UE->timer_stats.diff, UE->timer_stats.diff_now); - //LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",module_idP); - //if (t_diff > 1100) - - - // LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff); - //LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff); - - //printf("Panos-D: Absolute time: %f", t_diff); - - - stop_meas(&UE->timer_stats); - t_diff = get_time_meas_us(&UE->timer_stats); - //printf("Panos-D: Absolute time: %lld, diff: %lld, diff_now: %lld \n",UE->timer_stats.p_time, UE->timer_stats.diff, UE->timer_stats.diff_now); - //LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",module_idP); - //if (t_diff > 1100) LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff); - //printf("Panos-D: Absolute time: %f", t_diff); - - //UE->proc.ticking_var++; - // pthread_cond_signal() //Send signal to ue_thread()? - // We also need to somehow pass the information of SFN/SF - } - free(phy_stub_ticking); - pthread_cond_destroy(&phy_stub_ticking->cond_ticking); - pthread_mutex_destroy(&phy_stub_ticking->mutex_ticking); - return 0; - -}*/ - - - - - - - - // Panos: This timer thread is used only in the phy_stub mode as an independent timer // which will be ticking and provide the SFN/SF values that will be used from the UE threads @@ -2280,151 +2112,6 @@ static void* timer_thread( void* param ) { - - - - - - - - - - - - - - - - -/*static void* timer_thread( void* param ) { - thread_top_init("timer_thread",1,870000L,1000000L,1000000L); - timer_subframe =9; - timer_frame =1023; - //phy_stub_ticking = (SF_ticking*)malloc(sizeof(SF_ticking)); - phy_stub_ticking->ticking_var = -1; - PHY_VARS_UE *UE; - UE = PHY_vars_UE_g[0][0]; - double t_diff; - int external_timer = 0; - - wait_sync("timer_thread"); - - //pthread_mutex_init(&phy_stub_ticking->mutex_ticking,NULL); - //pthread_cond_init(&phy_stub_ticking->cond_ticking,NULL); - - // struct timespec start = {0}; - // struct timespec end = {0}; - //sleepValue.tv_nsec = 1000000; - opp_enabled = 1; - - // first check if we are receiving timing indications - if(nfapi_mode==4) { - usleep(10000); - if (UE->instance_cnt_timer > 0) { - external_timer = 1; - int absSFm1 = ((emulator_absSF+10239)%10240); - timer_frame = absSFm1/10; - timer_subframe = absSFm1%10; - pthread_mutex_lock(&UE->timer_mutex); - UE->instance_cnt_timer = -1; - pthread_mutex_unlock(&UE->timer_mutex); - LOG_I(PHY,"Running with external timer\n"); - } - else LOG_I(PHY,"Running with internal timer\n"); - } - - while (!oai_exit) { - - // these are local subframe/frame counters to check that we are in synch with the fronthaul timing. - // They are set on the first rx/tx in the underly FH routines. - if (timer_subframe==9) { - timer_subframe=0; - timer_frame++; - timer_frame&=1023; - } else { - timer_subframe++; - } - //printf("[timer_thread] Frame: %d, Subframe: %d \n", timer_frame, timer_subframe); - //LOG_I(MAC," Panos-D [timer_thread] Frame: %d, Subframe: %d \n", timer_frame, timer_subframe); - //AssertFatal( 0 == pthread_cond_signal(&phy_stub_ticking->cond_ticking), ""); - AssertFatal(pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) ==0,""); - phy_stub_ticking->ticking_var++; - // This should probably be a call to pthread_cond_broadcast when we introduce support for multiple UEs (threads) - if(phy_stub_ticking->ticking_var == 0){ - //AssertFatal(phy_stub_ticking->ticking_var == 0,"phy_stub_ticking->ticking_var = %d", - // phy_stub_ticking->ticking_var); - if (pthread_cond_signal(&phy_stub_ticking->cond_ticking) != 0) { - //LOG_E( PHY, "[SCHED][UE %d] ERROR pthread_cond_signal for UE RX thread\n", UE->Mod_id); - LOG_E( PHY, "timer_thread ERROR pthread_cond_signal for UE_thread\n"); - exit_fun("nothing to add"); - } - } - - AssertFatal(pthread_mutex_unlock(&phy_stub_ticking->mutex_ticking) ==0,""); - start_meas(&UE->timer_stats); - - - //clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start); // get initial time-stamp - if (external_timer == 0) { - usleep(1000); - UE_tport_t pdu; - pdu.header.packet_type = TTI_SYNC; - pdu.header.absSF = (timer_frame*10)+timer_subframe; - multicast_link_write_sock(0, - &pdu, - sizeof(UE_tport_header_t)); - - } - 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"); - } - //clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end); // get final time-stamp - - //double t_ns = (double)(end.tv_sec - start.tv_sec) * 1.0e9 + - // (double)(end.tv_nsec - start.tv_nsec); - //printf("Panos-D: [timer_thread] REAL TIME difference: %f", t_ns); - - - stop_meas(&UE->timer_stats); - t_diff = get_time_meas_us(&UE->timer_stats); - - //printf("Panos-D: Absolute time: %lld, diff: %lld, diff_now: %lld \n",UE->timer_stats.p_time, UE->timer_stats.diff, UE->timer_stats.diff_now); - //LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",module_idP); - //if (t_diff > 1100) - - - // LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff); - //LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff); - - //printf("Panos-D: Absolute time: %f", t_diff); - - - stop_meas(&UE->timer_stats); - t_diff = get_time_meas_us(&UE->timer_stats); - //printf("Panos-D: Absolute time: %lld, diff: %lld, diff_now: %lld \n",UE->timer_stats.p_time, UE->timer_stats.diff, UE->timer_stats.diff_now); - //LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",module_idP); - //if (t_diff > 1100) LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff); - //printf("Panos-D: Absolute time: %f", t_diff); - - //UE->proc.ticking_var++; - // pthread_cond_signal() //Send signal to ue_thread()? - // We also need to somehow pass the information of SFN/SF - } - free(phy_stub_ticking); - pthread_cond_destroy(&phy_stub_ticking->cond_ticking); - pthread_mutex_destroy(&phy_stub_ticking->mutex_ticking); - return 0; - -}*/ - - - - - - - - int init_timer_thread(void) { //PHY_VARS_UE *UE=PHY_vars_UE_g[0]; PHY_VARS_UE *UE=PHY_vars_UE_g[0][0]; diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 68e8dc998180497b21a742b3a7857c1e7290123e..560f24fe2d39a1cc07516ebf80e0b12b48f4389d 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -826,7 +826,7 @@ int main( int argc, char **argv ) printf("NFAPI_MODE value: %d \n", nfapi_mode); - // Panos: Not sure if the following is needed here + // Not sure if the following is needed here /*if (CONFIG_ISFLAGSET(CONFIG_ABORT)) { if (UE_flag == 0) { fprintf(stderr,"Getting configuration failed\n"); @@ -1047,7 +1047,7 @@ int main( int argc, char **argv ) printf("cannot create ITTI tasks\n"); exit(-1); // need a softer mode } - if(nfapi_mode==3){ //Panos: Here we should add another nfapi_mode for the case of Supervised LTE-D2D + if(nfapi_mode==3){ // Here we should add another nfapi_mode for the case of Supervised LTE-D2D UE_config_stub_pnf(); } printf("ITTI tasks created\n"); @@ -1085,8 +1085,6 @@ int main( int argc, char **argv ) printf("NFAPI MODE:%s\n", nfapi_mode_str); - - // connect the TX/RX buffers