diff --git a/README.txt b/README.txt index 6280cd5ec6..8fb670de98 100644 --- a/README.txt +++ b/README.txt @@ -43,6 +43,7 @@ openairinterface5g RELEASE NOTES: +v1.1.1 -> November 2019. Bug fix in the TDD Fair Round-Robin scheduler v1.1.0 -> July 2019. This version adds the following implemented features: * Experimental support of LTE-M - Single LTE-M UE attachment, legacy-LTE UE attachment is disabled diff --git a/ci-scripts/.gitignore b/ci-scripts/.gitignore new file mode 100644 index 0000000000..d77a672c0c --- /dev/null +++ b/ci-scripts/.gitignore @@ -0,0 +1,7 @@ +enb_*.log +ue_*.log +ping_*.* +iperf_*.* +phones_list.txt +modules_list.txt +test_results*.html diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index efd574efc9..2792e3556a 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -44,7 +44,28 @@ pipeline { disableConcurrentBuilds() timestamps() gitLabConnection('OAI GitLab') - gitlabBuilds(builds: ["Build gNB-USRP", "Build nr-UE-USRP", "Build eNB-USRP", "Build basic-sim", "Build phy-sim", "Build eNB-ethernet", "Build UE-ethernet", "Analysis with cppcheck", "Test phy-sim", "Test basic-sim", "Test L2-sim", "Test-Mono-FDD-Band7", "Test-Mono-TDD-Band40", "Test-IF4p5-FDD-Band7", "Test-IF4p5-TDD-Band40", "Test-Mono-FDD-Band13", "Test-IF4p5-TDD-Band38-Multi-RRU" , "Test-Mono-FDD-Band13-X2-HO", "Test-TDD-Band78-gNB-NR-UE"]) + gitlabBuilds(builds: [ + "Build gNB-USRP", + "Build nr-UE-USRP", + "Build eNB-USRP", + "Build basic-sim", + "Build phy-sim", + "Build eNB-ethernet", + "Build UE-ethernet", + "Analysis with cppcheck", + "Test phy-sim", + "Test basic-sim", + "Test L2-sim", + "Test-Mono-FDD-Band7", + "Test-Mono-TDD-Band40", + "Test-IF4p5-FDD-Band7", + "Test-IF4p5-TDD-Band40", + "Test-Mono-FDD-Band13-LTE-M", + "Test-IF4p5-TDD-Band38-Multi-RRU", + "Test-eNB-OAI-UE-FDD-Band7", + "Test-Mono-FDD-Band13-X2-HO", + "Test-TDD-Band78-gNB-NR-UE" + ]) ansiColor('xterm') } @@ -542,7 +563,7 @@ pipeline { steps { script { sh "sleep 60" - triggerSlaveJob ('eNB-CI-MONO-FDD-Band13-B210', 'Test-Mono-FDD-Band13') + triggerSlaveJob ('eNB-CI-MONO-FDD-Band13-B210', 'Test-Mono-FDD-Band13-LTE-M') } } post { diff --git a/ci-scripts/Jenkinsfile-inria-r2lab b/ci-scripts/Jenkinsfile-inria-r2lab new file mode 100644 index 0000000000..6ae7522999 --- /dev/null +++ b/ci-scripts/Jenkinsfile-inria-r2lab @@ -0,0 +1,421 @@ +#!/bin/groovy +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +// Abstraction function to send social media messages: +// like on Slack or Mattermost +def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) { + if (params.pipelineUsesSlack != null) { + if (params.pipelineUsesSlack) { + slackSend channel: pipeChannel, color: pipeColor, message: pipeMessage + } + } +} + +// Location of the test XML file to be run +def testXMLFile = params.pythonTestXmlFile +def mainPythonAllXmlFiles = "" +def buildStageStatus = true + +// Name of the test stage +def testStageName = params.pipelineTestStageName + +// Name of the branch to work on +def ranRepoBranch = params.pythonWorkingBranch + +// Lease booking parameters +def r2labStartTime = params.R2LAB_LeaseBookStartTime +def r2labDuration = params.R2LAB_LeaseBookDuration + + +// Fixed deployment +def r2labBaseIpAddr = '192.168.3.' +def r2labPythonExeIdx = '14' +def r2labPythonExe = 'fit' + r2labPythonExeIdx +def r2labENB0Idx = '23' +def r2labENB0 = 'fit' + r2labENB0Idx +def r2labENB0IpAddr = r2labBaseIpAddr + r2labENB0Idx +def r2labEPC0Idx = '17' +def r2labEPC0 = 'fit' + r2labEPC0Idx +def r2labEPC0IpAddr = r2labBaseIpAddr + r2labEPC0Idx +def r2labUE0Idx = '6' +def r2labUE0 = 'fit0' + r2labUE0Idx +def r2labUE0IpAddr = r2labBaseIpAddr + r2labUE0Idx + +pipeline { + agent { + label 'master' + } + + options { + disableConcurrentBuilds() + timestamps() + ansiColor('xterm') + } + + stages { + stage ("Book session") { + steps { + script { + echo '\u2705 \u001B[32mVerify Parameters\u001B[0m' + + def allParametersPresent = true + if (params.R2LAB_Credentials == null) { + allParametersPresent = false + } + if (params.R2LAB_FitNode_Credentials == null) { + allParametersPresent = false + } + if (params.R2LAB_LeaseBookStartTime == null) { + allParametersPresent = false + } + if (params.R2LAB_LeaseBookDuration == null) { + allParametersPresent = false + } + + // If not present picking a default Stage Name + if (params.pipelineTestStageName == null) { + // picking default + testStageName = 'Tests at Inria R2LAB' + } + // If not present picking a default branch name + if (params.pythonWorkingBranch == null) { + ranRepoBranch = 'develop' + } + + if (params.pythonTestXmlFile == null) { + // picking default + testXMLFile = 'xml_files/inria/enb_usrp210_band7_build.xml' + echo "Test XML file(default): ${testXMLFile}" + mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " " + } else { + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " " + echo "Test XML file : ${xmlFile}" + } + } + + if (!allParametersPresent) { + currentBuild.result = 'ABORTED' + error('Stopping early because no R2LAB credentials') + } + + JOB_TIMESTAMP = sh returnStdout: true, script: 'date --rfc-3339=seconds | sed -e "s#+00:00##"' + JOB_TIMESTAMP = JOB_TIMESTAMP.trim() + + echo '\u2705 \u001B[32mBook a Session\u001B[0m' + + BOOK_TIMESTAMP = sh returnStdout: true, script: 'date --rfc-3339=date' + BOOK_TIMESTAMP = BOOK_TIMESTAMP.trim() + + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.R2LAB_Credentials}", usernameVariable: 'r2labuser', passwordVariable: 'r2labpassword'] + ]) { + sh "python3 /home/eurecom/inria-scripts/booking-lease.py --book-lease --from ${BOOK_TIMESTAMP}T${r2labStartTime} --duration ${r2labDuration} --slice inria_oaici ${r2labuser} ${r2labpassword}" + sh "python3 /home/eurecom/inria-scripts/booking-lease.py --get-leases ${r2labuser} ${r2labpassword}" + } + } + } + } + stage ("Load Images") { + steps { + script { + echo '\u2705 \u001B[32mLoad Image for Python Executor\u001B[0m' + sh "ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-enb-ue ${r2labPythonExeIdx} > /dev/null 2>&1'" + sh "ssh -t inria_oaici@faraday.inria.fr 'rwait --silent ${r2labPythonExeIdx}'" + + echo '\u2705 \u001B[32mLoad Image for one eNB\u001B[0m' + sh "ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-enb-ue ${r2labENB0Idx} > /dev/null 2>&1'" + sh "ssh -t inria_oaici@faraday.inria.fr 'rwait --silent ${r2labENB0Idx}'" + sh "ssh -t inria_oaici@faraday.inria.fr 'uon ${r2labENB0Idx}'" + + echo '\u2705 \u001B[32mLoad Image for one OAI UE\u001B[0m' + sh "ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-enb-ue ${r2labUE0Idx} > /dev/null 2>&1'" + sh "ssh -t inria_oaici@faraday.inria.fr 'rwait --silent ${r2labUE0Idx}'" + sh "ssh -t inria_oaici@faraday.inria.fr 'uon ${r2labUE0Idx}'" + + echo '\u2705 \u001B[32mLoad Image for one EPC\u001B[0m' + sh "ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-epc ${r2labEPC0Idx} > /dev/null 2>&1'" + sh "ssh -t inria_oaici@faraday.inria.fr 'rwait --silent ${r2labEPC0Idx}'" + + sh "ssh -t inria_oaici@faraday.inria.fr 'nodes ${r2labUE0Idx},${r2labPythonExeIdx},${r2labEPC0Idx},${r2labENB0Idx} && st'" + } + } + } + stage ("Prepare Python Executor") { + steps { + script { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.R2LAB_FitNode_Credentials}", usernameVariable: 'fituser', passwordVariable: 'fitpasswd'] + ]) { + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g && git fetch --all --prune --quiet\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g && git checkout --quiet ${ranRepoBranch}\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g && git pull --quiet origin ${ranRepoBranch}\"'" + GIT_COMMIT_TO_RUN = sh returnStdout: true, script: "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g && git log -n1 --pretty=format:%H\"' | grep -v fit" + GIT_COMMIT_TO_RUN = GIT_COMMIT_TO_RUN.trim() + echo "Latest commit to use is ${GIT_COMMIT_TO_RUN}" + + // Putting the adaptation parameters for the OAI UE + sh "ssh -t inria_oaici@faraday.inria.fr 'scp /home/inria_oaici/for-ci/adapt_usim_parameters_${r2labUE0}.sed ${fituser}@${r2labUE0}:/tmp/adapt_usim_parameters.sed'" + sh "ssh -t inria_oaici@faraday.inria.fr 'scp /home/inria_oaici/for-ci/phones_list.txt ${fituser}@${r2labEPC0}:/tmp'" + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S cp /tmp/phones_list.txt /etc/ci\"'" + + // Out of rload, the sub-network-interfaces are not up + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:m11 172.16.1.102 up\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:m10 192.168.10.110 up\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:sxu 172.55.55.102 up\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:s1u 192.168.248.159 up\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:sxc 172.55.55.101 up\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:s5c 172.58.58.102 up\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:p5c 172.58.58.101 up\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:s11 172.16.1.104 up\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"ifconfig\"'" + + // Adding routes on the EPC + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ip route add default via 192.168.3.100 dev control table lte\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ip rule add from 12.0.0.0/8 table lte\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ip rule add from 12.1.1.0/8 table lte\"'" + + // Adding a route on the eNB for the S1U interface + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labENB0} \"echo ${fitpasswd} | sudo -S ip route add 192.168.248.0/24 via ${r2labEPC0IpAddr} dev control\"'" + + // For the moment, simple way to route traffic from python executor to any UEs + sh "ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"echo ${fitpasswd} | sudo -S ip route add 12.1.1.0/24 via ${r2labEPC0IpAddr} dev control\"'" + } + } + } + } + stage ("Build and Test") { + steps { + script { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.R2LAB_FitNode_Credentials}", usernameVariable: 'fituser', passwordVariable: 'fitpasswd'] + ]) { + sh "ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=InitiateHtml --ranRepository=https://gitlab.eurecom.fr/oai/openairinterface5g --ranBranch=${ranRepoBranch} --ranCommitID=${GIT_COMMIT_TO_RUN} --ranAllowMerge=false --ADBIPAddress=${r2labEPC0IpAddr} --ADBUserName=${fituser} --ADBPassword=${fitpasswd} --ADBType=distributed ${mainPythonAllXmlFiles}\"'" + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + try { + sh "ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=TesteNB --ranRepository=https://gitlab.eurecom.fr/oai/openairinterface5g --ranBranch=${ranRepoBranch} --ranCommitID=${GIT_COMMIT_TO_RUN} --ranAllowMerge=false --eNBIPAddress=${r2labENB0IpAddr} --eNBUserName=${fituser} --eNBPassword=${fitpasswd} --eNBSourceCodePath=/home/${fituser}/openairinterface5g --UEIPAddress=${r2labUE0IpAddr} --UEUserName=${fituser} --UEPassword=${fitpasswd} --UESourceCodePath=/home/${fituser}/openairinterface5g --EPCIPAddress=${r2labEPC0IpAddr} --EPCType=OAI-Rel14-CUPS --EPCUserName=${fituser} --EPCPassword=${fitpasswd} --EPCSourceCodePath=/home/${fituser}/openair-cn --ADBIPAddress=${r2labEPC0IpAddr} --ADBUserName=${fituser} --ADBPassword=${fitpasswd} --ADBType=distributed --XMLTestFile=${xmlFile}\"'" + } catch (Exception e) { + currentBuild.result = 'FAILURE' + buildStageStatus = false + } + } + sh "ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${r2labENB0IpAddr} --eNBUserName=${fituser} --eNBPassword=${fitpasswd}\"'" + } + } + } + } + stage ("Prepare Log Collection") { + steps { + sh "ssh -t inria_oaici@faraday.inria.fr 'mkdir -p /home/inria_oaici/archives'" + sh "ssh -t inria_oaici@faraday.inria.fr 'touch /home/inria_oaici/archives/no_error.txt'" + sh "ssh -t inria_oaici@faraday.inria.fr 'rm -f /home/inria_oaici/archives/*.*'" + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.R2LAB_FitNode_Credentials}", usernameVariable: 'fituser', passwordVariable: 'fitpasswd'] + ]) { + sh "ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labPythonExe}:/home/${fituser}/openairinterface5g/ci-scripts/test_results.html /home/inria_oaici/archives'" + } + sh "scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/test_results.html ." + script { + if(fileExists("./test_results.html")) { + sh "mv ./test_results.html test_results-${JOB_NAME}.html" + sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: ${BUILD_ID}#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-${JOB_NAME}.html" + archiveArtifacts "test_results-${JOB_NAME}.html" + } + } + } + } + stage ("Log Collection") { + parallel { + stage('Log Collection (OAI eNB - Build)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.R2LAB_FitNode_Credentials}", usernameVariable: 'fituser', passwordVariable: 'fitpasswd'] + ]) { + echo '\u2705 \u001B[32mLog Collection (OAI eNB - Build)\u001B[0m' + sh "ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectBuild --eNBIPAddress=${r2labENB0IpAddr} --eNBUserName=${fituser} --eNBPassword=${fitpasswd} --eNBSourceCodePath=/home/${fituser}/openairinterface5g\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labENB0}:/home/${fituser}/openairinterface5g/cmake_targets/build.log.zip /home/inria_oaici/archives/enb.build.log.zip'" + } + sh "scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/enb.build.log.zip enb.build.log.${env.BUILD_ID}.zip" + script { + if(fileExists("enb.build.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "enb.build.log.${env.BUILD_ID}.zip" + } + } + } + } + stage('Log Collection (OAI UE - Build)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.R2LAB_FitNode_Credentials}", usernameVariable: 'fituser', passwordVariable: 'fitpasswd'] + ]) { + echo '\u2705 \u001B[32mLog Collection (OAI UE - Build)\u001B[0m' + sh "ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectBuild --UEIPAddress=${r2labUE0IpAddr} --UEUserName=${fituser} --UEPassword=${fitpasswd} --UESourceCodePath=/home/${fituser}/openairinterface5g\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labUE0}:/home/${fituser}/openairinterface5g/cmake_targets/build.log.zip /home/inria_oaici/archives/ue.build.log.zip'" + } + sh "scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/ue.build.log.zip ue.build.log.${env.BUILD_ID}.zip" + script { + if(fileExists("ue.build.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "ue.build.log.${env.BUILD_ID}.zip" + } + } + } + } + stage('Log Collection (OAI eNB - Runs)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.R2LAB_FitNode_Credentials}", usernameVariable: 'fituser', passwordVariable: 'fitpasswd'] + ]) { + echo '\u2705 \u001B[32mLog Collection (OAI eNB - Runs)\u001B[0m' + sh "ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollecteNB --eNBIPAddress=${r2labENB0IpAddr} --eNBUserName=${fituser} --eNBPassword=${fitpasswd} --eNBSourceCodePath=/home/${fituser}/openairinterface5g\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labENB0}:/home/${fituser}/openairinterface5g/cmake_targets/enb.log.zip /home/inria_oaici/archives/enb.run.log.zip'" + } + sh "scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/enb.run.log.zip enb.run.log.${env.BUILD_ID}.zip" + script { + if(fileExists("enb.run.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "enb.run.log.${env.BUILD_ID}.zip" + } + } + } + } + stage('Log Collection (OAI UE - Runs)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.R2LAB_FitNode_Credentials}", usernameVariable: 'fituser', passwordVariable: 'fitpasswd'] + ]) { + echo '\u2705 \u001B[32mLog Collection (OAI UE - Runs)\u001B[0m' + sh "ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectOAIUE --UEIPAddress=${r2labUE0IpAddr} --UEUserName=${fituser} --UEPassword=${fitpasswd} --UESourceCodePath=/home/${fituser}/openairinterface5g\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labUE0}:/home/${fituser}/openairinterface5g/cmake_targets/ue.log.zip /home/inria_oaici/archives/ue.run.log.zip'" + } + sh "scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/ue.run.log.zip ue.run.log.${env.BUILD_ID}.zip" + script { + if(fileExists("ue.run.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "ue.run.log.${env.BUILD_ID}.zip" + } + } + } + } + stage('Log Collection (MME)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.R2LAB_FitNode_Credentials}", usernameVariable: 'fituser', passwordVariable: 'fitpasswd'] + ]) { + echo '\u2705 \u001B[32mLog Collection (MME)\u001B[0m' + sh "ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectMME --EPCIPAddress=${r2labEPC0IpAddr} --EPCUserName=${fituser} --EPCPassword=${fitpasswd} --EPCSourceCodePath=/home/${fituser}/openair-cn --EPCType=OAI-Rel14-CUPS\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labEPC0}:/home/${fituser}/openair-cn/scripts/mme.log.zip /home/inria_oaici/archives/mme.log.zip'" + } + sh "scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/mme.log.zip mme.log.${env.BUILD_ID}.zip" + script { + if(fileExists("mme.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "mme.log.${env.BUILD_ID}.zip" + } + } + } + } + stage('Log Collection (HSS)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.R2LAB_FitNode_Credentials}", usernameVariable: 'fituser', passwordVariable: 'fitpasswd'] + ]) { + echo '\u2705 \u001B[32mLog Collection (HSS)\u001B[0m' + sh "ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectHSS --EPCIPAddress=${r2labEPC0IpAddr} --EPCUserName=${fituser} --EPCPassword=${fitpasswd} --EPCSourceCodePath=/home/${fituser}/openair-cn --EPCType=OAI-Rel14-CUPS\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labEPC0}:/home/${fituser}/openair-cn/scripts/hss.log.zip /home/inria_oaici/archives/hss.log.zip'" + } + sh "scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/hss.log.zip hss.log.${env.BUILD_ID}.zip" + script { + if(fileExists("hss.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "hss.log.${env.BUILD_ID}.zip" + } + } + } + } + stage('Log Collection (SPGW)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.R2LAB_FitNode_Credentials}", usernameVariable: 'fituser', passwordVariable: 'fitpasswd'] + ]) { + echo '\u2705 \u001B[32mLog Collection (SPGW)\u001B[0m' + sh "ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectSPGW --EPCIPAddress=${r2labEPC0IpAddr} --EPCUserName=${fituser} --EPCPassword=${fitpasswd} --EPCSourceCodePath=/home/${fituser}/openair-cn --EPCType=OAI-Rel14-CUPS\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labEPC0}:/home/${fituser}/openair-cn/scripts/spgw.log.zip /home/inria_oaici/archives/spgw.log.zip'" + } + sh "scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/spgw.log.zip spgw.log.${env.BUILD_ID}.zip" + script { + if(fileExists("spgw.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "spgw.log.${env.BUILD_ID}.zip" + } + } + } + } + stage('Log Collection (Ping)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.R2LAB_FitNode_Credentials}", usernameVariable: 'fituser', passwordVariable: 'fitpasswd'] + ]) { + echo '\u2705 \u001B[32mLog Collection (Ping)\u001B[0m' + sh "ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectPing --EPCIPAddress=${r2labEPC0IpAddr} --EPCUserName=${fituser} --EPCPassword=${fitpasswd} --EPCSourceCodePath=/home/${fituser}/openair-cn --EPCType=OAI-Rel14-CUPS\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labEPC0}:/home/${fituser}/openair-cn/scripts/ping.log.zip /home/inria_oaici/archives/ping.log.zip'" + } + sh "scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/ping.log.zip ping.log.${env.BUILD_ID}.zip" + script { + if(fileExists("ping.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "ping.log.${env.BUILD_ID}.zip" + } + } + } + } + stage('Log Collection (Iperf)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.R2LAB_FitNode_Credentials}", usernameVariable: 'fituser', passwordVariable: 'fitpasswd'] + ]) { + echo '\u2705 \u001B[32mLog Collection (Iperf)\u001B[0m' + sh "ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectIperf --EPCIPAddress=${r2labEPC0IpAddr} --EPCUserName=${fituser} --EPCPassword=${fitpasswd} --EPCSourceCodePath=/home/${fituser}/openair-cn --EPCType=OAI-Rel14-CUPS\"'" + sh "ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labEPC0}:/home/${fituser}/openair-cn/scripts/iperf.log.zip /home/inria_oaici/archives/iperf.log.zip'" + } + sh "scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/iperf.log.zip iperf.log.${env.BUILD_ID}.zip" + script { + if(fileExists("iperf.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "iperf.log.${env.BUILD_ID}.zip" + } + } + } + } + } + } + stage ("Clean-up Log Collection") { + steps { + sh "ssh -t inria_oaici@faraday.inria.fr 'rm -Rf /home/inria_oaici/archives'" + } + } + } + + post { + always { + script { + echo '\u2705 \u001B[32mShutdown every node\u001B[0m' + sh 'ssh -t inria_oaici@faraday.inria.fr "all-off"' + sh 'ssh -t inria_oaici@faraday.inria.fr "all-off"' + } + } + } +} diff --git a/ci-scripts/doc/vm_based_simulator_build.md b/ci-scripts/doc/vm_based_simulator_build.md index ca3ab356ea..28fbc955d5 100644 --- a/ci-scripts/doc/vm_based_simulator_build.md +++ b/ci-scripts/doc/vm_based_simulator_build.md @@ -51,18 +51,20 @@ Mandatory Options: Options: -------- # OpenAirInterface Build Variants - --variant enb-usrp OR -v1 - --variant basic-sim OR -v2 - --variant phy-sim OR -v3 - --variant cppcheck OR -v4 - --variant enb-ethernet OR -v7 - --variant ue-ethernet OR -v8 + --variant enb-usrp OR -v1 ( build and test ) + --variant basic-sim OR -v2 ( build and test ) + --variant phy-sim OR -v3 ( build and test ) + --variant cppcheck OR -v4 ( build and test ) + --variant gnb-usrp OR -v5 ( build and test ) + --variant nr-ue-usrp OR -v6 ( build and test ) + --variant enb-ethernet OR -v7 ( build and test ) + --variant ue-ethernet OR -v8 ( build and test ) # non-OSA Build Variants - --variant flexran-rtc OR -v10 + --variant flexran-rtc OR -v10 ( build and test non-OSA ) # OpenAirInterface Test Variants - --variant l1-sim OR -v20 - --variant rf-sim OR -v21 - --variant l2-sim OR -v22 + --variant l1-sim OR -v20 ( test ) + --variant rf-sim OR -v21 ( test ) + --variant l2-sim OR -v22 ( test ) Specify the variant to build. --keep-vm-alive OR -k diff --git a/ci-scripts/doc/vm_based_simulator_check_build.md b/ci-scripts/doc/vm_based_simulator_check_build.md index d66b8ff2a0..86d26ff8ed 100644 --- a/ci-scripts/doc/vm_based_simulator_check_build.md +++ b/ci-scripts/doc/vm_based_simulator_check_build.md @@ -34,6 +34,7 @@ Source file concerned: `ci-scripts/waitBuildOnVM.sh` * and copy them locally in the workspace at $ARCHIVES_LOC * List all log files that match the pattern. Each should have * the `Built target` pattern (the library/executable SHALL link) +* Evaluate the remaining space on VM disk * The number of patterned log files SHALL match $NB_PATTERN_FILES defined in `ci-scripts/oai-ci-vm-tool` script for the variant --- diff --git a/ci-scripts/doc/vm_based_simulator_create.md b/ci-scripts/doc/vm_based_simulator_create.md index c54d69ca14..09ce26c553 100644 --- a/ci-scripts/doc/vm_based_simulator_create.md +++ b/ci-scripts/doc/vm_based_simulator_create.md @@ -44,18 +44,20 @@ Mandatory Options: Specify the build ID of the Jenkins job. # OpenAirInterface Build Variants - --variant enb-usrp OR -v1 - --variant basic-sim OR -v2 - --variant phy-sim OR -v3 - --variant cppcheck OR -v4 - --variant enb-ethernet OR -v7 - --variant ue-ethernet OR -v8 + --variant enb-usrp OR -v1 ( build and test ) + --variant basic-sim OR -v2 ( build and test ) + --variant phy-sim OR -v3 ( build and test ) + --variant cppcheck OR -v4 ( build and test ) + --variant gnb-usrp OR -v5 ( build and test ) + --variant nr-ue-usrp OR -v6 ( build and test ) + --variant enb-ethernet OR -v7 ( build and test ) + --variant ue-ethernet OR -v8 ( build and test ) # non-OSA Build Variants - --variant flexran-rtc OR -v10 + --variant flexran-rtc OR -v10 ( build and test non-OSA ) # OpenAirInterface Test Variants - --variant l1-sim OR -v20 - --variant rf-sim OR -v21 - --variant l2-sim OR -v22 + --variant l1-sim OR -v20 ( test ) + --variant rf-sim OR -v21 ( test ) + --variant l2-sim OR -v22 ( test ) Specify the variant to build. --help OR -h @@ -73,7 +75,7 @@ This is the function that is being called from the main oai-vm-tool script. The main purpose is to start a VM instance: ```bash -uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu $VM_CPU --unsafe-caching --template ci-scripts/template-host.xml +uvt-kvm create $VM_NAME release=xenial --memory $VM_MEMORY --cpu $VM_CPU --disk $VM_DISK --unsafe-caching --template ci-scripts/template-host.xml ``` Variables are set in the main script based on the options. diff --git a/ci-scripts/doc/vm_based_simulator_test.md b/ci-scripts/doc/vm_based_simulator_test.md index 0be7ae5d3a..73308b972e 100644 --- a/ci-scripts/doc/vm_based_simulator_test.md +++ b/ci-scripts/doc/vm_based_simulator_test.md @@ -72,18 +72,20 @@ Options: Specify the workspace. # OpenAirInterface Build Variants - --variant enb-usrp OR -v1 - --variant basic-sim OR -v2 - --variant phy-sim OR -v3 - --variant cppcheck OR -v4 - --variant enb-ethernet OR -v7 - --variant ue-ethernet OR -v8 + --variant enb-usrp OR -v1 ( build and test ) + --variant basic-sim OR -v2 ( build and test ) + --variant phy-sim OR -v3 ( build and test ) + --variant cppcheck OR -v4 ( build and test ) + --variant gnb-usrp OR -v5 ( build and test ) + --variant nr-ue-usrp OR -v6 ( build and test ) + --variant enb-ethernet OR -v7 ( build and test ) + --variant ue-ethernet OR -v8 ( build and test ) # non-OSA Build Variants - --variant flexran-rtc OR -v10 + --variant flexran-rtc OR -v10 ( build and test non-OSA ) # OpenAirInterface Test Variants - --variant l1-sim OR -v20 - --variant rf-sim OR -v21 - --variant l2-sim OR -v22 + --variant l1-sim OR -v20 ( test ) + --variant rf-sim OR -v21 ( test ) + --variant l2-sim OR -v22 ( test ) Specify the variant to build. --keep-vm-alive OR -k diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 35574512f1..049c7c5b41 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -121,6 +121,7 @@ class SSHConnection(): self.ADBIPAddress = '' self.ADBUserName = '' self.ADBPassword = '' + self.ADBCentralized = True self.testCase_id = '' self.testXMLfiles = [] self.nbTestXMLfiles = 0 @@ -143,6 +144,11 @@ class SSHConnection(): self.nbMaxUEtoAttach = -1 self.UEDevices = [] self.UEDevicesStatus = [] + self.UEDevicesRemoteServer = [] + self.UEDevicesRemoteUser = [] + self.UEDevicesOffCmd = [] + self.UEDevicesOnCmd = [] + self.UEDevicesRebootCmd = [] self.CatMDevices = [] self.UEIPAddresses = [] self.htmlFile = '' @@ -181,6 +187,7 @@ class SSHConnection(): self.flexranCtrlInstalled = False self.flexranCtrlStarted = False self.expectedNbOfConnectedUEs = 0 + self.startTime = 0 def open(self, ipaddress, username, password): count = 0 @@ -208,7 +215,7 @@ class SSHConnection(): logging.debug('self.sshresponse = ' + str(self.sshresponse)) elif self.sshresponse == 2: # Checking if we are really on the remote client defined by its IP address - self.command('stdbuf -o0 ifconfig | egrep --color=never "inet addr:"', '\$', 5) + self.command('stdbuf -o0 ifconfig | egrep --color=never "inet addr:|inet "', '\$', 5) result = re.search(str(ipaddress), str(self.ssh.before)) if result is None: self.close() @@ -634,19 +641,33 @@ class SSHConnection(): Usage() sys.exit('Insufficient Parameter') self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - if re.match('OAI', self.EPCType, re.IGNORECASE): + if re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): + logging.debug('Using the OAI EPC Release 14 Cassandra-based HSS') + self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5) + logging.debug('\u001B[1m Launching tshark on all interfaces \u001B[0m') + EPC_PcapFileName = 'epc_' + self.testCase_id + '.pcap' + self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f ' + EPC_PcapFileName, '\$', 5) + self.command('echo $USER; nohup sudo tshark -f "tcp port not 22 and port not 53" -i any -w ' + self.EPCSourceCodePath + '/scripts/' + EPC_PcapFileName + ' > /tmp/tshark.log 2>&1 &', self.EPCUserName, 5) + self.command('echo ' + self.EPCPassword + ' | sudo -S mkdir -p logs', '\$', 5) + self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f hss_' + self.testCase_id + '.log logs/hss*.*', '\$', 5) + self.command('echo "oai_hss -j /usr/local/etc/oai/hss_rel14.json" > ./my-hss.sh', '\$', 5) + self.command('chmod 755 ./my-hss.sh', '\$', 5) + self.command('sudo daemon --unsafe --name=hss_daemon --chdir=' + self.EPCSourceCodePath + '/scripts -o ' + self.EPCSourceCodePath + '/scripts/hss_' + self.testCase_id + '.log ./my-hss.sh', '\$', 5) + elif re.match('OAI', self.EPCType, re.IGNORECASE): logging.debug('Using the OAI EPC HSS') self.command('cd ' + self.EPCSourceCodePath, '\$', 5) self.command('source oaienv', '\$', 5) self.command('cd scripts', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S ./run_hss 2>&1 | stdbuf -o0 awk \'{ print strftime("[%Y/%m/%d %H:%M:%S] ",systime()) $0 }\' | stdbuf -o0 tee -a hss_' + self.testCase_id + '.log &', 'Core state: 2 -> 3', 35) - else: + elif re.match('ltebox', self.EPCType, re.IGNORECASE): logging.debug('Using the ltebox simulated HSS') self.command('if [ -d ' + self.EPCSourceCodePath + '/scripts ]; then echo ' + self.eNBPassword + ' | sudo -S rm -Rf ' + self.EPCSourceCodePath + '/scripts ; fi', '\$', 5) self.command('mkdir -p ' + self.EPCSourceCodePath + '/scripts', '\$', 5) self.command('cd /opt/hss_sim0609', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f hss.log daemon.log', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S echo "Starting sudo session" && sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real ', '\$', 5) + else: + logging.error('This option should not occur!') self.close() self.CreateHtmlTestRow(self.EPCType, 'OK', ALL_PROCESSES_OK) @@ -655,7 +676,14 @@ class SSHConnection(): Usage() sys.exit('Insufficient Parameter') self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - if re.match('OAI', self.EPCType, re.IGNORECASE): + if re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): + logging.debug('Using the OAI EPC Release 14 MME') + self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5) + self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f mme_' + self.testCase_id + '.log', '\$', 5) + self.command('echo "./run_mme --config-file /usr/local/etc/oai/mme.conf --set-virt-if" > ./my-mme.sh', '\$', 5) + self.command('chmod 755 ./my-mme.sh', '\$', 5) + self.command('sudo daemon --unsafe --name=mme_daemon --chdir=' + self.EPCSourceCodePath + '/scripts -o ' + self.EPCSourceCodePath + '/scripts/mme_' + self.testCase_id + '.log ./my-mme.sh', '\$', 5) + elif re.match('OAI', self.EPCType, re.IGNORECASE): self.command('cd ' + self.EPCSourceCodePath, '\$', 5) self.command('source oaienv', '\$', 5) self.command('cd scripts', '\$', 5) @@ -666,9 +694,11 @@ class SSHConnection(): sys.exit(1) host_name = result.group('host_name') self.command('echo ' + self.EPCPassword + ' | sudo -S ./run_mme 2>&1 | stdbuf -o0 tee -a mme_' + self.testCase_id + '.log &', 'MME app initialization complete', 100) - else: + elif re.match('ltebox', self.EPCType, re.IGNORECASE): self.command('cd /opt/ltebox/tools', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S ./start_mme', '\$', 5) + else: + logging.error('This option should not occur!') self.close() self.CreateHtmlTestRow(self.EPCType, 'OK', ALL_PROCESSES_OK) @@ -677,14 +707,27 @@ class SSHConnection(): Usage() sys.exit('Insufficient Parameter') self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - if re.match('OAI', self.EPCType, re.IGNORECASE): + if re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): + logging.debug('Using the OAI EPC Release 14 SPGW-CUPS') + self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5) + self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f spgwc_' + self.testCase_id + '.log spgwu_' + self.testCase_id + '.log', '\$', 5) + self.command('echo "spgwc -c /usr/local/etc/oai/spgw_c.conf" > ./my-spgwc.sh', '\$', 5) + self.command('chmod 755 ./my-spgwc.sh', '\$', 5) + self.command('sudo daemon --unsafe --name=spgwc_daemon --chdir=' + self.EPCSourceCodePath + '/scripts -o ' + self.EPCSourceCodePath + '/scripts/spgwc_' + self.testCase_id + '.log ./my-spgwc.sh', '\$', 5) + time.sleep(5) + self.command('echo "spgwu -c /usr/local/etc/oai/spgw_u.conf" > ./my-spgwu.sh', '\$', 5) + self.command('chmod 755 ./my-spgwu.sh', '\$', 5) + self.command('sudo daemon --unsafe --name=spgwu_daemon --chdir=' + self.EPCSourceCodePath + '/scripts -o ' + self.EPCSourceCodePath + '/scripts/spgwu_' + self.testCase_id + '.log ./my-spgwu.sh', '\$', 5) + elif re.match('OAI', self.EPCType, re.IGNORECASE): self.command('cd ' + self.EPCSourceCodePath, '\$', 5) self.command('source oaienv', '\$', 5) self.command('cd scripts', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S ./run_spgw 2>&1 | stdbuf -o0 tee -a spgw_' + self.testCase_id + '.log &', 'Initializing SPGW-APP task interface: DONE', 30) - else: + elif re.match('ltebox', self.EPCType, re.IGNORECASE): self.command('cd /opt/ltebox/tools', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S ./start_xGw', '\$', 5) + else: + logging.error('This option should not occur!') self.close() self.CreateHtmlTestRow(self.EPCType, 'OK', ALL_PROCESSES_OK) @@ -866,12 +909,31 @@ class SSHConnection(): self.close() - def InitializeUE_common(self, device_id): - logging.debug('send adb commands') + def InitializeUE_common(self, device_id, idx): try: self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) + if not self.ADBCentralized: + # Reboot UE + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' ' + self.UEDevicesRebootCmd[idx], '\$', 60) + # Wait + time.sleep(60) + # Put in LTE-Mode only + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "settings put global preferred_network_mode 11"\'', '\$', 60) + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "settings put global preferred_network_mode1 11"\'', '\$', 60) + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "settings put global preferred_network_mode2 11"\'', '\$', 60) + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "settings put global preferred_network_mode3 11"\'', '\$', 60) + # enable data service + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "svc data enable"\'', '\$', 60) + # we need to do radio on/off cycle to make sure of above changes + # airplane mode off // radio on + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' ' + self.UEDevicesOnCmd[idx], '\$', 60) + time.sleep(10) + # airplane mode on // radio off + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' ' + self.UEDevicesOffCmd[idx], '\$', 60) + self.close() + return # enable data service - self.command('stdbuf -o0 adb -s ' + device_id + ' shell svc data enable', '\$', 60) + self.command('stdbuf -o0 adb -s ' + device_id + ' shell "svc data enable"', '\$', 60) # The following commands are deprecated since we no longer work on Android 7+ # self.command('stdbuf -o0 adb -s ' + device_id + ' shell settings put global airplane_mode_on 1', '\$', 10) @@ -893,11 +955,13 @@ class SSHConnection(): Usage() sys.exit('Insufficient Parameter') multi_jobs = [] + i = 0 for device_id in self.UEDevices: - p = Process(target = self.InitializeUE_common, args = (device_id,)) + p = Process(target = self.InitializeUE_common, args = (device_id,i,)) p.daemon = True p.start() multi_jobs.append(p) + i += 1 for job in multi_jobs: job.join() self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) @@ -939,7 +1003,12 @@ class SSHConnection(): result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args)) # We may have to regenerate the .u* files if result is None: - self.command('sed -e "s#93#92#" -e "s#8baf473f2f8fd09487cccbd7097c6862#fec86ba6eb707ed08905757b1bb44b8f#" -e "s#e734f8734007d6c5ce7a0508809e7e9c#C42449363BBAD02B66D16BC975D77CC1#" ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf > ../../../openair3/NAS/TOOLS/ci-ue_eurecom_test_sfr.conf', '\$', 5) + self.command('ls /tmp/*.sed', '\$', 5) + result = re.search('adapt_usim_parameters', str(self.ssh.before)) + if result is not None: + self.command('sed -f /tmp/adapt_usim_parameters.sed ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf > ../../../openair3/NAS/TOOLS/ci-ue_eurecom_test_sfr.conf', '\$', 5) + else: + self.command('sed -e "s#93#92#" -e "s#8baf473f2f8fd09487cccbd7097c6862#fec86ba6eb707ed08905757b1bb44b8f#" -e "s#e734f8734007d6c5ce7a0508809e7e9c#C42449363BBAD02B66D16BC975D77CC1#" ../../../openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf > ../../../openair3/NAS/TOOLS/ci-ue_eurecom_test_sfr.conf', '\$', 5) self.command('echo ' + self.UEPassword + ' | sudo -S rm -Rf .u*', '\$', 5) self.command('echo ' + self.UEPassword + ' | sudo -S ../../../targets/bin/conf2uedata -c ../../../openair3/NAS/TOOLS/ci-ue_eurecom_test_sfr.conf -o .', '\$', 5) self.command('echo "ulimit -c unlimited && ./'+ self.air_interface +'-uesoftmodem ' + self.Initialize_OAI_UE_args + '" > ./my-lte-uesoftmodem-run' + str(self.UE_instance) + '.sh', '\$', 5) @@ -1027,13 +1096,14 @@ class SSHConnection(): result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args)) if result is None: self.command('ifconfig oaitun_ue1', '\$', 4) - result = re.search('inet addr', str(self.ssh.before)) + # ifconfig output is different between ubuntu 16 and ubuntu 18 + result = re.search('inet addr:1|inet 1', str(self.ssh.before)) if result is not None: logging.debug('\u001B[1m oaitun_ue1 interface is mounted and configured\u001B[0m') tunnelInterfaceStatus = True else: self.command('ifconfig oaitun_ue1', '\$', 4) - result = re.search('inet addr', str(self.ssh.before)) + result = re.search('inet addr:1|inet 1', str(self.ssh.before)) if result is not None: logging.debug('\u001B[1m oaitun_ue1 interface is mounted and configured\u001B[0m') tunnelInterfaceStatus = True @@ -1049,6 +1119,11 @@ class SSHConnection(): if fullSyncStatus and gotSyncStatus and tunnelInterfaceStatus: self.CreateHtmlTestRow(self.Initialize_OAI_UE_args, 'OK', ALL_PROCESSES_OK, 'OAI UE') logging.debug('\u001B[1m Initialize OAI UE Completed\u001B[0m') + if (self.ADBIPAddress != 'none'): + self.UEDevices = [] + self.UEDevices.append('OAI-UE') + self.UEDevicesStatus = [] + self.UEDevicesStatus.append(UE_STATUS_DETACHED) else: if self.air_interface == 'lte': self.htmlUEFailureMsg = 'oaitun_ue1 interface is either NOT mounted or NOT configured' @@ -1298,18 +1373,25 @@ class SSHConnection(): except: os.kill(os.getppid(),signal.SIGUSR1) - def AttachUE_common(self, device_id, statusQueue, lock): + def AttachUE_common(self, device_id, statusQueue, lock, idx): try: self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) - if device_id == '84B7N16418004022': - self.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/on"', '\$', 60) + if self.ADBCentralized: + if device_id == '84B7N16418004022': + self.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/on"', '\$', 60) + else: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/on', '\$', 60) else: - self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/on', '\$', 60) + # airplane mode off // radio on + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' ' + self.UEDevicesOnCmd[idx], '\$', 60) time.sleep(2) max_count = 45 count = max_count while count > 0: - self.command('stdbuf -o0 adb -s ' + device_id + ' shell dumpsys telephony.registry | grep mDataConnectionState', '\$', 15) + if self.ADBCentralized: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell "dumpsys telephony.registry" | grep -m 1 mDataConnectionState', '\$', 15) + else: + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "dumpsys telephony.registry"\' | grep -m 1 mDataConnectionState', '\$', 60) result = re.search('mDataConnectionState.*=(?P[0-9\-]+)', str(self.ssh.before)) if result is None: logging.debug('\u001B[1;37;41m mDataConnectionState Not Found! \u001B[0m') @@ -1331,15 +1413,21 @@ class SSHConnection(): count = count - 1 if count == 15 or count == 30: logging.debug('\u001B[1;30;43m Retry UE (' + device_id + ') Flight Mode Off \u001B[0m') - if device_id == '84B7N16418004022': - self.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/off"', '\$', 60) + if self.ADBCentralized: + if device_id == '84B7N16418004022': + self.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/off"', '\$', 60) + else: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/off', '\$', 60) else: - self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/off', '\$', 60) + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' ' + self.UEDevicesOffCmd[idx], '\$', 60) time.sleep(0.5) - if device_id == '84B7N16418004022': - self.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/on"', '\$', 60) + if self.ADBCentralized: + if device_id == '84B7N16418004022': + self.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/on"', '\$', 60) + else: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/on', '\$', 60) else: - self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/on', '\$', 60) + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' ' + self.UEDevicesOnCmd[idx], '\$', 60) time.sleep(0.5) logging.debug('\u001B[1mWait UE (' + device_id + ') a second until mDataConnectionState=2 (' + str(max_count-count) + ' times)\u001B[0m') time.sleep(1) @@ -1372,7 +1460,7 @@ class SSHConnection(): for device_id in self.UEDevices: if (self.nbMaxUEtoAttach == -1) or (nb_ue_to_connect < self.nbMaxUEtoAttach): self.UEDevicesStatus[nb_ue_to_connect] = UE_STATUS_ATTACHING - p = Process(target = self.AttachUE_common, args = (device_id, status_queue, lock,)) + p = Process(target = self.AttachUE_common, args = (device_id, status_queue, lock,nb_ue_to_connect,)) p.daemon = True p.start() multi_jobs.append(p) @@ -1413,13 +1501,16 @@ class SSHConnection(): self.CreateHtmlTestRowQueue('N/A', 'KO', len(self.UEDevices), html_queue) self.AutoTerminateUEandeNB() - def DetachUE_common(self, device_id): + def DetachUE_common(self, device_id, idx): try: self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) - if device_id == '84B7N16418004022': - self.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/off"', '\$', 60) + if self.ADBCentralized: + if device_id == '84B7N16418004022': + self.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/off"', '\$', 60) + else: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/off', '\$', 60) else: - self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/off', '\$', 60) + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' ' + self.UEDevicesOffCmd[idx], '\$', 60) logging.debug('\u001B[1mUE (' + device_id + ') Detach Completed\u001B[0m') self.close() except: @@ -1440,7 +1531,7 @@ class SSHConnection(): cnt = 0 for device_id in self.UEDevices: self.UEDevicesStatus[cnt] = UE_STATUS_DETACHING - p = Process(target = self.DetachUE_common, args = (device_id,)) + p = Process(target = self.DetachUE_common, args = (device_id,cnt,)) p.daemon = True p.start() multi_jobs.append(p) @@ -1517,11 +1608,14 @@ class SSHConnection(): job.join() self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) - def DataDisableUE_common(self, device_id): + def DataDisableUE_common(self, device_id, idx): try: self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) - # enable data service - self.command('stdbuf -o0 adb -s ' + device_id + ' shell svc data disable', '\$', 60) + # disable data service + if self.ADBCentralized: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell "svc data disable"', '\$', 60) + else: + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "svc data disable"\'', '\$', 60) logging.debug('\u001B[1mUE (' + device_id + ') Disabled Data Service\u001B[0m') self.close() except: @@ -1532,20 +1626,25 @@ class SSHConnection(): Usage() sys.exit('Insufficient Parameter') multi_jobs = [] + i = 0 for device_id in self.UEDevices: - p = Process(target = self.DataDisableUE_common, args = (device_id,)) + p = Process(target = self.DataDisableUE_common, args = (device_id,i,)) p.daemon = True p.start() multi_jobs.append(p) + i += 1 for job in multi_jobs: job.join() self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) - def DataEnableUE_common(self, device_id): + def DataEnableUE_common(self, device_id, idx): try: self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) # enable data service - self.command('stdbuf -o0 adb -s ' + device_id + ' shell svc data enable', '\$', 60) + if self.ADBCentralized: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell "svc data enable"', '\$', 60) + else: + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "svc data enable"\'', '\$', 60) logging.debug('\u001B[1mUE (' + device_id + ') Enabled Data Service\u001B[0m') self.close() except: @@ -1556,11 +1655,13 @@ class SSHConnection(): Usage() sys.exit('Insufficient Parameter') multi_jobs = [] + i = 0 for device_id in self.UEDevices: - p = Process(target = self.DataEnableUE_common, args = (device_id,)) + p = Process(target = self.DataEnableUE_common, args = (device_id,i,)) p.daemon = True p.start() multi_jobs.append(p) + i += 1 for job in multi_jobs: job.join() self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) @@ -1570,8 +1671,34 @@ class SSHConnection(): Usage() sys.exit('Insufficient Parameter') self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) - self.command('adb devices', '\$', 15) - self.UEDevices = re.findall("\\\\r\\\\n([A-Za-z0-9]+)\\\\tdevice",str(self.ssh.before)) + if self.ADBCentralized: + self.command('adb devices', '\$', 15) + self.UEDevices = re.findall("\\\\r\\\\n([A-Za-z0-9]+)\\\\tdevice",str(self.ssh.before)) + self.close() + else: + if (os.path.isfile('./phones_list.txt')): + os.remove('./phones_list.txt') + self.command('ls /etc/*/phones*.txt', '\$', 5) + result = re.search('/etc/ci/phones_list.txt', str(self.ssh.before)) + self.close() + if (result is not None) and (len(self.UEDevices) == 0): + self.copyin(self.ADBIPAddress, self.ADBUserName, self.ADBPassword, '/etc/ci/phones_list.txt', '.') + if (os.path.isfile('./phones_list.txt')): + phone_list_file = open('./phones_list.txt', 'r') + for line in phone_list_file.readlines(): + line = line.strip() + result = re.search('^#', line) + if result is not None: + continue + comma_split = line.split(",") + self.UEDevices.append(comma_split[0]) + self.UEDevicesRemoteServer.append(comma_split[1]) + self.UEDevicesRemoteUser.append(comma_split[2]) + self.UEDevicesOffCmd.append(comma_split[3]) + self.UEDevicesOnCmd.append(comma_split[4]) + self.UEDevicesRebootCmd.append(comma_split[5]) + phone_list_file.close() + if terminate_ue_flag == False: if len(self.UEDevices) == 0: logging.debug('\u001B[1;37;41m UE Not Found! \u001B[0m') @@ -1581,25 +1708,36 @@ class SSHConnection(): while cnt < len(self.UEDevices): self.UEDevicesStatus.append(UE_STATUS_DETACHED) cnt += 1 - self.close() def GetAllCatMDevices(self, terminate_ue_flag): if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': Usage() sys.exit('Insufficient Parameter') self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) - self.command('lsusb | egrep "Future Technology Devices International, Ltd FT2232C" | sed -e "s#:.*##" -e "s# #_#g"', '\$', 15) - self.CatMDevices = re.findall("\\\\r\\\\n([A-Za-z0-9_]+)",str(self.ssh.before)) + if self.ADBCentralized: + self.command('lsusb | egrep "Future Technology Devices International, Ltd FT2232C" | sed -e "s#:.*##" -e "s# #_#g"', '\$', 15) + self.CatMDevices = re.findall("\\\\r\\\\n([A-Za-z0-9_]+)",str(self.ssh.before)) + else: + if (os.path.isfile('./modules_list.txt')): + os.remove('./modules_list.txt') + self.command('ls /etc/*/modules*.txt', '\$', 5) + result = re.search('/etc/ci/modules_list.txt', str(self.ssh.before)) + self.close() + if result is not None: + logging.debug('Found a module list file on ADB server') if terminate_ue_flag == False: if len(self.CatMDevices) == 0: logging.debug('\u001B[1;37;41m CAT-M UE Not Found! \u001B[0m') sys.exit(1) self.close() - def CheckUEStatus_common(self, lock, device_id, statusQueue): + def CheckUEStatus_common(self, lock, device_id, statusQueue, idx): try: self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) - self.command('stdbuf -o0 adb -s ' + device_id + ' shell dumpsys telephony.registry', '\$', 15) + if self.ADBCentralized: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell "dumpsys telephony.registry"', '\$', 15) + else: + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "dumpsys telephony.registry"\'', '\$', 60) result = re.search('mServiceState=(?P[0-9]+)', str(self.ssh.before)) serviceState = 'Service State: UNKNOWN' if result is not None: @@ -1656,11 +1794,13 @@ class SSHConnection(): multi_jobs = [] lock = Lock() status_queue = SimpleQueue() + i = 0 for device_id in self.UEDevices: - p = Process(target = self.CheckUEStatus_common, args = (lock,device_id,status_queue,)) + p = Process(target = self.CheckUEStatus_common, args = (lock,device_id,status_queue,i,)) p.daemon = True p.start() multi_jobs.append(p) + i += 1 for job in multi_jobs: job.join() if self.flexranCtrlInstalled and self.flexranCtrlStarted: @@ -1716,9 +1856,12 @@ class SSHConnection(): sys.exit('Insufficient Parameter') self.open(self.UEIPAddress, self.UEUserName, self.UEPassword) self.command('ifconfig oaitun_ue1', '\$', 4) - result = re.search('inet addr:(?P[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)', str(self.ssh.before)) + result = re.search('inet addr:(?P[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)|inet (?P[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)', str(self.ssh.before)) if result is not None: - UE_IPAddress = result.group('ueipaddress') + if result.group('ueipaddress') is not None: + UE_IPAddress = result.group('ueipaddress') + else: + UE_IPAddress = result.group('ueipaddress2') logging.debug('\u001B[1mUE (' + self.UEDevices[0] + ') IP Address is ' + UE_IPAddress + '\u001B[0m') self.UEIPAddresses.append(UE_IPAddress) else: @@ -1734,7 +1877,10 @@ class SSHConnection(): continue count = 0 while count < 4: - self.command('stdbuf -o0 adb -s ' + device_id + ' shell ip addr show | grep rmnet', '\$', 15) + if self.ADBCentralized: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell "ip addr show | grep rmnet"', '\$', 15) + else: + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "ip addr show | grep rmnet"\'', '\$', 60) result = re.search('inet (?P[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\/[0-9]+[0-9a-zA-Z\.\s]+', str(self.ssh.before)) if result is None: logging.debug('\u001B[1;37;41m UE IP Address Not Found! \u001B[0m') @@ -2277,17 +2423,33 @@ class SSHConnection(): ipnumbers[3] = '1' EPC_Iperf_UE_IPAddress = ipnumbers[0] + '.' + ipnumbers[1] + '.' + ipnumbers[2] + '.' + ipnumbers[3] - # Launch iperf server on EPC side - self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5) - self.command('rm -f iperf_server_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) + # Launch iperf server on EPC side (true for ltebox and old open-air-cn0 + # But for OAI-Rel14-CUPS, we launch from python executor and we are using its IP address as iperf client address + launchFromEpc = True + if re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): + launchFromEpc = False + cmd = 'hostname -I' + ret = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, encoding='utf-8') + if ret.stdout is not None: + EPC_Iperf_UE_IPAddress = ret.stdout.strip() port = 5001 + idx - if udpIperf: - self.command('echo $USER; nohup iperf -u -s -i 1 -p ' + str(port) + ' > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.EPCUserName, 5) + if launchFromEpc: + self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) + self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5) + self.command('rm -f iperf_server_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) + if udpIperf: + self.command('echo $USER; nohup iperf -u -s -i 1 -p ' + str(port) + ' > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.EPCUserName, 5) + else: + self.command('echo $USER; nohup iperf -s -i 1 -p ' + str(port) + ' > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.EPCUserName, 5) + self.close() else: - self.command('echo $USER; nohup iperf -s -i 1 -p ' + str(port) + ' > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.EPCUserName, 5) + if udpIperf: + cmd = 'nohup iperf -u -s -i 1 -p ' + str(port) + ' > iperf_server_' + self.testCase_id + '_' + device_id + '.log 2>&1 &' + else: + cmd = 'nohup iperf -s -i 1 -p ' + str(port) + ' > iperf_server_' + self.testCase_id + '_' + device_id + '.log 2>&1 &' + logging.debug(cmd + '\n') + subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, encoding='utf-8') time.sleep(0.5) - self.close() # Launch iperf client on UE if (device_id == 'OAI-UE'): @@ -2323,15 +2485,23 @@ class SSHConnection(): self.close() # Kill iperf server on EPC side - self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - self.command('killall --signal SIGKILL iperf', self.EPCUserName, 5) - self.close() + if launchFromEpc: + self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) + self.command('killall --signal SIGKILL iperf', self.EPCUserName, 5) + self.close() + else: + cmd = 'killall --signal SIGKILL iperf' + logging.debug(cmd + '\n') + subprocess.run(cmd, shell=True) + time.sleep(1) + self.copyout(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, 'iperf_server_' + self.testCase_id + '_' + device_id + '.log', self.EPCSourceCodePath + '/scripts') # in case of failure, retrieve server log if (clientStatus == -1): - time.sleep(1) - if (os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')): - os.remove('iperf_server_' + self.testCase_id + '_' + device_id + '.log') - self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.') + if launchFromEpc: + time.sleep(1) + if (os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')): + os.remove('iperf_server_' + self.testCase_id + '_' + device_id + '.log') + self.copyin(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, self.EPCSourceCodePath + '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.') self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options) # in case of OAI-UE if (device_id == 'OAI-UE'): @@ -2351,7 +2521,10 @@ class SSHConnection(): self.command('if [ ! -d ' + self.EPCSourceCodePath + '/scripts ]; then mkdir -p ' + self.EPCSourceCodePath + '/scripts ; fi', '\$', 5) self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5) # Checking if iperf / iperf3 are installed - self.command('adb -s ' + device_id + ' shell "ls /data/local/tmp"', '\$', 5) + if self.ADBCentralized: + self.command('adb -s ' + device_id + ' shell "ls /data/local/tmp"', '\$', 5) + else: + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "ls /data/local/tmp"\'', '\$', 60) result = re.search('iperf3', str(self.ssh.before)) if result is None: result = re.search('iperf', str(self.ssh.before)) @@ -2385,22 +2558,32 @@ class SSHConnection(): else: self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5) - if (useIperf3): - self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/iperf3 -s &', '\$', 5) + if self.ADBCentralized: + if (useIperf3): + self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/iperf3 -s &', '\$', 5) + else: + self.command('rm -f iperf_server_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) + result = re.search('-u', str(self.iperf_args)) + if result is None: + self.command('echo $USER; nohup adb -s ' + device_id + ' shell "/data/local/tmp/iperf -s -i 1" > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5) + udpIperf = False + else: + self.command('echo $USER; nohup adb -s ' + device_id + ' shell "/data/local/tmp/iperf -u -s -i 1" > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5) else: self.command('rm -f iperf_server_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) - result = re.search('-u', str(self.iperf_args)) - if result is None: - self.command('echo $USER; nohup adb -s ' + device_id + ' shell "/data/local/tmp/iperf -s -i 1" > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5) - udpIperf = False - else: - self.command('echo $USER; nohup adb -s ' + device_id + ' shell "/data/local/tmp/iperf -u -s -i 1" > iperf_server_' + self.testCase_id + '_' + device_id + '.log &', self.ADBUserName, 5) + self.command('echo $USER; nohup ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "/data/local/tmp/iperf -u -s -i 1" > iperf_server_' + self.testCase_id + '_' + device_id + '.log &\' > /dev/null 2>&1', self.ADBUserName, 60) + time.sleep(0.5) self.close() - # Launch the IPERF client on the EPC side for DL - self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5) + # Launch the IPERF client on the EPC side for DL (true for ltebox and old open-air-cn + # But for OAI-Rel14-CUPS, we launch from python executor + launchFromEpc = True + if re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): + launchFromEpc = False + if launchFromEpc: + self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) + self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5) iperf_time = self.Iperf_ComputeTime() time.sleep(0.5) @@ -2410,16 +2593,31 @@ class SSHConnection(): modified_options = str(self.iperf_args) time.sleep(0.5) - self.command('rm -f iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) + if launchFromEpc: + self.command('rm -f iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) + else: + if (os.path.isfile('iperf_' + self.testCase_id + '_' + device_id + '.log')): + os.remove('iperf_' + self.testCase_id + '_' + device_id + '.log') if (useIperf3): self.command('stdbuf -o0 iperf3 -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0) clientStatus = 0 self.Iperf_analyzeV3Output(lock, UE_IPAddress, device_id, statusQueue) else: - iperf_status = self.command('stdbuf -o0 iperf -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0) + if launchFromEpc: + iperf_status = self.command('stdbuf -o0 iperf -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 | stdbuf -o0 tee iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', int(iperf_time)*5.0) + else: + cmd = 'iperf -c ' + UE_IPAddress + ' ' + modified_options + ' 2>&1 > iperf_' + self.testCase_id + '_' + device_id + '.log' + message = cmd + '\n' + logging.debug(cmd) + ret = subprocess.run(cmd, shell=True) + iperf_status = ret.returncode + self.copyout(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, 'iperf_' + self.testCase_id + '_' + device_id + '.log', self.EPCSourceCodePath + '/scripts') + self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) + self.command('cat ' + self.EPCSourceCodePath + '/scripts/iperf_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) if iperf_status < 0: - self.close() + if launchFromEpc: + self.close() message = 'iperf on UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT !' logging.debug('\u001B[1;37;41m ' + message + ' \u001B[0m') self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, message) @@ -2433,11 +2631,17 @@ class SSHConnection(): self.command('killall iperf', '\$', 5) else: self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) - self.command('stdbuf -o0 adb -s ' + device_id + ' shell ps | grep --color=never iperf | grep -v grep', '\$', 5) + if self.ADBCentralized: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell ps | grep --color=never iperf | grep -v grep', '\$', 5) + else: + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "ps" | grep --color=never iperf | grep -v grep\'', '\$', 60) result = re.search('shell +(?P\d+)', str(self.ssh.before)) if result is not None: pid_iperf = result.group('pid') - self.command('stdbuf -o0 adb -s ' + device_id + ' shell kill -KILL ' + pid_iperf, '\$', 5) + if self.ADBCentralized: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell kill -KILL ' + pid_iperf, '\$', 5) + else: + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "kill -KILL ' + pid_iperf + '"\'', '\$', 60) self.close() # if the client report is absent, try to analyze the server log file if (clientStatus == -1): @@ -2453,7 +2657,8 @@ class SSHConnection(): # in case of OAI UE: if (device_id == 'OAI-UE'): if (os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')): - pass + if not launchFromEpc: + self.copyout(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, 'iperf_server_' + self.testCase_id + '_' + device_id + '.log', self.EPCSourceCodePath + '/scripts') else: self.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.') self.copyout(self.EPCIPAddress, self.EPCUserName, self.EPCPassword, 'iperf_server_' + self.testCase_id + '_' + device_id + '.log', self.EPCSourceCodePath + '/scripts') @@ -2737,10 +2942,14 @@ class SSHConnection(): try: self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) self.command('stdbuf -o0 ps -aux | grep --color=never hss | grep -v grep', '\$', 5) - if re.match('OAI', self.EPCType, re.IGNORECASE): + if re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): + result = re.search('oai_hss -j', str(self.ssh.before)) + elif re.match('OAI', self.EPCType, re.IGNORECASE): result = re.search('\/bin\/bash .\/run_', str(self.ssh.before)) - else: + elif re.match('ltebox', self.EPCType, re.IGNORECASE): result = re.search('hss_sim s6as diam_hss', str(self.ssh.before)) + else: + logging.error('This should not happen!') if result is None: logging.debug('\u001B[1;37;41m HSS Process Not Found! \u001B[0m') status_queue.put(HSS_PROCESS_FAILED) @@ -2754,10 +2963,14 @@ class SSHConnection(): try: self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) self.command('stdbuf -o0 ps -aux | grep --color=never mme | grep -v grep', '\$', 5) - if re.match('OAI', self.EPCType, re.IGNORECASE): + if re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): + result = re.search('mme -c', str(self.ssh.before)) + elif re.match('OAI', self.EPCType, re.IGNORECASE): result = re.search('\/bin\/bash .\/run_', str(self.ssh.before)) - else: + elif re.match('ltebox', self.EPCType, re.IGNORECASE): result = re.search('mme', str(self.ssh.before)) + else: + logging.error('This should not happen!') if result is None: logging.debug('\u001B[1;37;41m MME Process Not Found! \u001B[0m') status_queue.put(MME_PROCESS_FAILED) @@ -2770,12 +2983,17 @@ class SSHConnection(): def CheckSPGWProcess(self, status_queue): try: self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - if re.match('OAI', self.EPCType, re.IGNORECASE): + if re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): + self.command('stdbuf -o0 ps -aux | grep --color=never spgw | grep -v grep', '\$', 5) + result = re.search('spgwu -c ', str(self.ssh.before)) + elif re.match('OAI', self.EPCType, re.IGNORECASE): self.command('stdbuf -o0 ps -aux | grep --color=never spgw | grep -v grep', '\$', 5) result = re.search('\/bin\/bash .\/run_', str(self.ssh.before)) - else: + elif re.match('ltebox', self.EPCType, re.IGNORECASE): self.command('stdbuf -o0 ps -aux | grep --color=never xGw | grep -v grep', '\$', 5) result = re.search('xGw', str(self.ssh.before)) + else: + logging.error('This should not happen!') if result is None: logging.debug('\u001B[1;37;41m SPGW Process Not Found! \u001B[0m') status_queue.put(SPGW_PROCESS_FAILED) @@ -3275,12 +3493,12 @@ class SSHConnection(): if result is not None: self.command('echo ' + lPassWord + ' | sudo -S daemon --name=enb' + str(self.eNB_instance) + '_daemon --stop', '\$', 5) self.command('echo ' + lPassWord + ' | sudo -S killall --signal SIGINT -r .*-softmodem || true', '\$', 5) - time.sleep(5) + time.sleep(10) self.command('stdbuf -o0 ps -aux | grep --color=never softmodem | grep -v grep', '\$', 5) result = re.search('-softmodem', str(self.ssh.before)) if result is not None: self.command('echo ' + lPassWord + ' | sudo -S killall --signal SIGKILL -r .*-softmodem || true', '\$', 5) - time.sleep(2) + time.sleep(5) self.command('rm -f my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) self.close() # If tracer options is on, stopping tshark on EPC side @@ -3340,49 +3558,77 @@ class SSHConnection(): def TerminateHSS(self): self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - if re.match('OAI', self.EPCType, re.IGNORECASE): + if re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): + self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGINT oai_hss || true', '\$', 5) + time.sleep(2) + self.command('stdbuf -o0 ps -aux | grep hss | grep -v grep', '\$', 5) + result = re.search('oai_hss -j', str(self.ssh.before)) + if result is not None: + self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL oai_hss || true', '\$', 5) + self.command('rm -f ' + self.EPCSourceCodePath + '/scripts/my-hss.sh', '\$', 5) + elif re.match('OAI', self.EPCType, re.IGNORECASE): self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGINT run_hss oai_hss || true', '\$', 5) time.sleep(2) self.command('stdbuf -o0 ps -aux | grep hss | grep -v grep', '\$', 5) result = re.search('\/bin\/bash .\/run_', str(self.ssh.before)) if result is not None: self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL run_hss oai_hss || true', '\$', 5) - else: + elif re.match('ltebox', self.EPCType, re.IGNORECASE): self.command('cd ' + self.EPCSourceCodePath, '\$', 5) self.command('cd scripts', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S daemon --name=simulated_hss --stop', '\$', 5) time.sleep(1) self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL hss_sim', '\$', 5) + else: + logging.error('This should not happen!') self.close() self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) def TerminateMME(self): self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - if re.match('OAI', self.EPCType, re.IGNORECASE): + if re.match('OAI', self.EPCType, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGINT run_mme mme || true', '\$', 5) time.sleep(2) self.command('stdbuf -o0 ps -aux | grep mme | grep -v grep', '\$', 5) - result = re.search('\/bin\/bash .\/run_', str(self.ssh.before)) + result = re.search('mme -c', str(self.ssh.before)) if result is not None: self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL run_mme mme || true', '\$', 5) - else: + self.command('rm -f ' + self.EPCSourceCodePath + '/scripts/my-mme.sh', '\$', 5) + elif re.match('ltebox', self.EPCType, re.IGNORECASE): self.command('cd /opt/ltebox/tools', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S ./stop_mme', '\$', 5) + else: + logging.error('This should not happen!') self.close() self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) def TerminateSPGW(self): self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - if re.match('OAI', self.EPCType, re.IGNORECASE): + if re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): + self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGINT spgwc spgwu || true', '\$', 5) + time.sleep(2) + self.command('stdbuf -o0 ps -aux | grep spgw | grep -v grep', '\$', 5) + result = re.search('spgwc -c |spgwu -c ', str(self.ssh.before)) + if result is not None: + self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL spgwc spgwu || true', '\$', 5) + self.command('rm -f ' + self.EPCSourceCodePath + '/scripts/my-spgw*.sh', '\$', 5) + self.command('stdbuf -o0 ps -aux | grep tshark | grep -v grep', '\$', 5) + result = re.search('-w ', str(self.ssh.before)) + if result is not None: + self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGINT tshark || true', '\$', 5) + self.command('echo ' + self.EPCPassword + ' | sudo -S chmod 666 ' + self.EPCSourceCodePath + '/scripts/*.pcap', '\$', 5) + elif re.match('OAI', self.EPCType, re.IGNORECASE): self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGINT run_spgw spgw || true', '\$', 5) time.sleep(2) self.command('stdbuf -o0 ps -aux | grep spgw | grep -v grep', '\$', 5) result = re.search('\/bin\/bash .\/run_', str(self.ssh.before)) if result is not None: self.command('echo ' + self.EPCPassword + ' | sudo -S killall --signal SIGKILL run_spgw spgw || true', '\$', 5) - else: + elif re.match('ltebox', self.EPCType, re.IGNORECASE): self.command('cd /opt/ltebox/tools', '\$', 5) self.command('echo ' + self.EPCPassword + ' | sudo -S ./stop_xGw', '\$', 5) + else: + logging.error('This should not happen!') self.close() self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) @@ -3401,18 +3647,30 @@ class SSHConnection(): self.flexranCtrlStarted = False self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) - def TerminateUE_common(self, device_id): + def TerminateUE_common(self, device_id, idx): try: self.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) # back in airplane mode on (ie radio off) - self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/off', '\$', 60) + if self.ADBCentralized: + if device_id == '84B7N16418004022': + self.command('stdbuf -o0 adb -s ' + device_id + ' shell "su - root -c /data/local/tmp/off"', '\$', 60) + else: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell /data/local/tmp/off', '\$', 60) + else: + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' ' + self.UEDevicesOffCmd[idx], '\$', 60) logging.debug('\u001B[1mUE (' + device_id + ') Detach Completed\u001B[0m') - self.command('stdbuf -o0 adb -s ' + device_id + ' shell ps | grep --color=never iperf | grep -v grep', '\$', 5) + if self.ADBCentralized: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell "ps | grep --color=never iperf | grep -v grep"', '\$', 5) + else: + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "ps | grep --color=never iperf | grep -v grep"\'', '\$', 60) result = re.search('shell +(?P\d+)', str(self.ssh.before)) if result is not None: pid_iperf = result.group('pid') - self.command('stdbuf -o0 adb -s ' + device_id + ' shell kill -KILL ' + pid_iperf, '\$', 5) + if self.ADBCentralized: + self.command('stdbuf -o0 adb -s ' + device_id + ' shell "kill -KILL ' + pid_iperf + '"', '\$', 5) + else: + self.command('ssh ' + self.UEDevicesRemoteUser[idx] + '@' + self.UEDevicesRemoteServer[idx] + ' \'adb -s ' + device_id + ' shell "kill -KILL ' + pid_iperf + '"\'', '\$', 60) self.close() except: os.kill(os.getppid(),signal.SIGUSR1) @@ -3421,11 +3679,13 @@ class SSHConnection(): terminate_ue_flag = True self.GetAllUEDevices(terminate_ue_flag) multi_jobs = [] + i = 0 for device_id in self.UEDevices: - p = Process(target= SSH.TerminateUE_common, args = (device_id,)) + p = Process(target= SSH.TerminateUE_common, args = (device_id,i,)) p.daemon = True p.start() multi_jobs.append(p) + i += 1 for job in multi_jobs: job.join() self.CreateHtmlTestRow('N/A', 'OK', ALL_PROCESSES_OK) @@ -3437,7 +3697,7 @@ class SSHConnection(): result = re.search('-uesoftmodem', str(self.ssh.before)) if result is not None: self.command('echo ' + self.UEPassword + ' | sudo -S killall --signal SIGINT -r .*-uesoftmodem || true', '\$', 5) - time.sleep(5) + time.sleep(10) self.command('ps -aux | grep --color=never softmodem | grep -v grep', '\$', 5) result = re.search('-uesoftmodem', str(self.ssh.before)) if result is not None: @@ -3670,41 +3930,47 @@ class SSHConnection(): def LogCollectHSS(self): self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - self.command('cd ' + self.EPCSourceCodePath, '\$', 5) - self.command('cd scripts', '\$', 5) + self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5) self.command('rm -f hss.log.zip', '\$', 5) - if re.match('OAI', self.EPCType, re.IGNORECASE): + if re.match('OAI', self.EPCType, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): self.command('zip hss.log.zip hss*.log', '\$', 60) - self.command('rm hss*.log', '\$', 5) - else: + self.command('echo ' + self.EPCPassword + ' | sudo -S rm hss*.log', '\$', 5) + if re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): + self.command('zip hss.log.zip logs/hss*.* *.pcap', '\$', 60) + self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f logs/hss*.* *.pcap', '\$', 5) + elif re.match('ltebox', self.EPCType, re.IGNORECASE): self.command('cp /opt/hss_sim0609/hss.log .', '\$', 60) self.command('zip hss.log.zip hss.log', '\$', 60) + else: + logging.error('This option should not occur!') self.close() def LogCollectMME(self): self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - self.command('cd ' + self.EPCSourceCodePath, '\$', 5) - self.command('cd scripts', '\$', 5) + self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5) self.command('rm -f mme.log.zip', '\$', 5) - if re.match('OAI', self.EPCType, re.IGNORECASE): + if re.match('OAI', self.EPCType, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): self.command('zip mme.log.zip mme*.log', '\$', 60) - self.command('rm mme*.log', '\$', 5) - else: + self.command('echo ' + self.EPCPassword + ' | sudo -S rm mme*.log', '\$', 5) + elif re.match('ltebox', self.EPCType, re.IGNORECASE): self.command('cp /opt/ltebox/var/log/*Log.0 .', '\$', 5) self.command('zip mme.log.zip mmeLog.0 s1apcLog.0 s1apsLog.0 s11cLog.0 libLog.0 s1apCodecLog.0', '\$', 60) + else: + logging.error('This option should not occur!') self.close() def LogCollectSPGW(self): self.open(self.EPCIPAddress, self.EPCUserName, self.EPCPassword) - self.command('cd ' + self.EPCSourceCodePath, '\$', 5) - self.command('cd scripts', '\$', 5) + self.command('cd ' + self.EPCSourceCodePath + '/scripts', '\$', 5) self.command('rm -f spgw.log.zip', '\$', 5) - if re.match('OAI', self.EPCType, re.IGNORECASE): + if re.match('OAI', self.EPCType, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.EPCType, re.IGNORECASE): self.command('zip spgw.log.zip spgw*.log', '\$', 60) - self.command('rm spgw*.log', '\$', 5) - else: + self.command('echo ' + self.EPCPassword + ' | sudo -S rm spgw*.log', '\$', 5) + elif re.match('ltebox', self.EPCType, re.IGNORECASE): self.command('cp /opt/ltebox/var/log/xGwLog.0 .', '\$', 5) self.command('zip spgw.log.zip xGwLog.0', '\$', 60) + else: + logging.error('This option should not occur!') self.close() def LogCollectOAIUE(self): @@ -3922,6 +4188,7 @@ class SSHConnection(): self.htmlFile.write('
\n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') + self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') @@ -3945,7 +4212,7 @@ class SSHConnection(): def CreateHtmlTabFooter(self, passStatus): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): self.htmlFile.write(' \n') - self.htmlFile.write(' \n') + self.htmlFile.write(' \n') if passStatus: self.htmlFile.write(' \n') else: @@ -4019,7 +4286,9 @@ class SSHConnection(): def CreateHtmlTestRow(self, options, status, processesStatus, machine='eNB'): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): + currentTime = int(round(time.time() * 1000)) - self.startTime self.htmlFile.write(' \n') + self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') @@ -4087,8 +4356,10 @@ class SSHConnection(): def CreateHtmlTestRowQueue(self, options, status, ue_status, ue_queue): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): + currentTime = int(round(time.time() * 1000)) - self.startTime addOrangeBK = False self.htmlFile.write(' \n') + self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') @@ -4127,9 +4398,9 @@ class SSHConnection(): # Usage() #----------------------------------------------------------- def Usage(): - print('------------------------------------------------------------') + print('----------------------------------------------------------------------------------------------------------------------') print('main.py Ver:' + Version) - print('------------------------------------------------------------') + print('----------------------------------------------------------------------------------------------------------------------') print('Usage: python main.py [options]') print(' --help Show this help.') print(' --mode=[Mode]') @@ -4137,25 +4408,35 @@ def Usage(): print(' InitiateHtml, FinalizeHtml') print(' TerminateeNB, TerminateUE, TerminateHSS, TerminateMME, TerminateSPGW') print(' LogCollectBuild, LogCollecteNB, LogCollectHSS, LogCollectMME, LogCollectSPGW, LogCollectPing, LogCollectIperf') - print(' --eNBRepository=[eNB\'s Repository URL] or --ranRepository=[OAI RAN Repository URL]') - print(' --eNBBranch=[eNB\'s Branch Name] or --ranBranch=[OAI RAN Repository Branch') - print(' --eNBCommitID=[eNB\'s Commit Number] or --ranCommitID=[OAI RAN Repository Commit SHA-1') - print(' --eNB_AllowMerge=[eNB\'s Allow Merge Request (with target branch)] or --ranAllowMerge=true/false') - print(' --eNBTargetBranch=[eNB\'s Target Branch in case of a Merge Request] or --ranTargetBranch=[Target Branch]') + print('---------------------------------------------------------------------------------------------------- Git Options --') + print(' --ranRepository=[OAI RAN Repository URL]') + print(' --ranBranch=[OAI RAN Repository Branch]') + print(' --ranCommitID=[OAI RAN Repository Commit SHA-1]') + print(' --ranAllowMerge=[Allow Merge Request (with target branch) (true or false)]') + print(' --ranTargetBranch=[Target Branch in case of a Merge Request]') + print('--------------------------------------------------------------------------------------------- eNB Server Options --') print(' --eNBIPAddress=[eNB\'s IP Address]') print(' --eNBUserName=[eNB\'s Login User Name]') print(' --eNBPassword=[eNB\'s Login Password]') print(' --eNBSourceCodePath=[eNB\'s Source Code Path]') + print('------------------------------------------------------------------------------------------ OAI UE Server Options --') + print(' --UEIPAddress=[UE\'s IP Address]') + print(' --UEUserName=[UE\'s Login User Name]') + print(' --UEPassword=[UE\'s Login Password]') + print(' --UESourceCodePath=[UE\'s Source Code Path]') + print('--------------------------------------------------------------------------------------------- EPC Server Options --') print(' --EPCIPAddress=[EPC\'s IP Address]') print(' --EPCUserName=[EPC\'s Login User Name]') print(' --EPCPassword=[EPC\'s Login Password]') print(' --EPCSourceCodePath=[EPC\'s Source Code Path]') - print(' --EPCType=[EPC\'s Type: OAI or ltebox]') + print(' --EPCType=[EPC\'s Type: OAI or ltebox or OAI-Rel14-CUPS]') + print('--------------------------------------------------------------------------------------------- ABD Server Options --') print(' --ADBIPAddress=[ADB\'s IP Address]') print(' --ADBUserName=[ADB\'s Login User Name]') print(' --ADBPassword=[ADB\'s Login Password]') + print('----------------------------------------------------------------------------------------------------------------------') print(' --XMLTestFile=[XML Test File to be run]') - print('------------------------------------------------------------') + print('----------------------------------------------------------------------------------------------------------------------') def CheckClassValidity(action,id): if action != 'Build_eNB' and action != 'WaitEndBuild_eNB' and action != 'Initialize_eNB' and action != 'Terminate_eNB' and action != 'Initialize_UE' and action != 'Terminate_UE' and action != 'Attach_UE' and action != 'Detach_UE' and action != 'Build_OAI_UE' and action != 'Initialize_OAI_UE' and action != 'Terminate_OAI_UE' and action != 'DataDisable_UE' and action != 'DataEnable_UE' and action != 'CheckStatusUE' and action != 'Ping' and action != 'Iperf' and action != 'Reboot_UE' and action != 'Initialize_FlexranCtrl' and action != 'Terminate_FlexranCtrl' and action != 'Initialize_HSS' and action != 'Terminate_HSS' and action != 'Initialize_MME' and action != 'Terminate_MME' and action != 'Initialize_SPGW' and action != 'Terminate_SPGW' and action != 'Initialize_CatM_module' and action != 'Terminate_CatM_module' and action != 'Attach_CatM_module' and action != 'Detach_CatM_module' and action != 'Ping_CatM_module' and action != 'IdleSleep' and action != 'Perform_X2_Handover': @@ -4416,16 +4697,25 @@ while len(argvs) > 1: SSH.EPCSourceCodePath = matchReg.group(1) elif re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE) - if re.match('OAI', matchReg.group(1), re.IGNORECASE) or re.match('ltebox', matchReg.group(1), re.IGNORECASE): + if re.match('OAI', matchReg.group(1), re.IGNORECASE) or re.match('ltebox', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-CUPS', matchReg.group(1), re.IGNORECASE): SSH.EPCType = matchReg.group(1) else: - sys.exit('Invalid EPC Type: ' + matchReg.group(1) + ' -- (should be OAI or ltebox)') + sys.exit('Invalid EPC Type: ' + matchReg.group(1) + ' -- (should be OAI or ltebox or OAI-Rel14-CUPS)') elif re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-ADBIPAddress=(.+)$', myArgv, re.IGNORECASE) SSH.ADBIPAddress = matchReg.group(1) elif re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-ADBUserName=(.+)$', myArgv, re.IGNORECASE) SSH.ADBUserName = matchReg.group(1) + elif re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-ADBType=(.+)$', myArgv, re.IGNORECASE) + if re.match('centralized', matchReg.group(1), re.IGNORECASE) or re.match('distributed', matchReg.group(1), re.IGNORECASE): + if re.match('distributed', matchReg.group(1), re.IGNORECASE): + SSH.ADBCentralized = False + else: + SSH.ADBCentralized = True + else: + sys.exit('Invalid ADB Type: ' + matchReg.group(1) + ' -- (should be centralized or distributed)') elif re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-ADBPassword=(.+)$', myArgv, re.IGNORECASE) SSH.ADBPassword = matchReg.group(1) @@ -4627,6 +4917,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re cnt = 0 SSH.prematureExit = True + SSH.startTime = int(round(time.time() * 1000)) while cnt < SSH.repeatCounts[0] and SSH.prematureExit: SSH.prematureExit = False for test_case_id in todo_tests: diff --git a/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm2.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm2.xml index 9c98ba4a8e..2a035396c5 100644 --- a/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm2.xml +++ b/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm2.xml @@ -25,7 +25,7 @@ test-05-tm2Test-05MHz-TM2tasks - 2 + 3 030201 040101 @@ -36,7 +36,7 @@ Initialize_eNB Initialize eNB (TDD/Band40/5MHz) - -O ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf + -O ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf --MACRLCs.[0].scheduler_mode default diff --git a/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml index ba059209ec..f98ed1600a 100644 --- a/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml +++ b/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml @@ -28,7 +28,7 @@ 030201 040101 - 030124 040301 040521 040622 040621 040623 040624 040625 040662 040661 040663 040664 040665 040401 040201 030201 + 030124 040301 040521 040622 040621 040623 040662 040401 040201 030201 diff --git a/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1_default_scheduler.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1_default_scheduler.xml new file mode 100644 index 0000000000..fd018f7a9c --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1_default_scheduler.xml @@ -0,0 +1,150 @@ + + + test-20-tm1-defSched + Test-20MHz-TM1-default-scheduler + tasks + + 030201 + 040101 + 030125 040301 040522 040627 040626 040628 040629 040630 040667 040666 040668 040669 040670 040401 040201 030201 + + + + + Initialize_eNB + Initialize eNB (TDD/Band40/20MHz/info) + -O ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf --MACRLCs.[0].scheduler_mode default + + + + Terminate_eNB + Terminate eNB + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + Ping + ping (20MHz - 20 sec) + -c 20 + 25 + + + + Iperf + iperf (20MHz - DL/27.5Mbps/UDP)(30 sec)(balanced) + -u -b 27.5M -t 30 -i 1 + 50 + balanced + + + + Iperf + iperf (20MHz - DL/27.5Mbps/UDP)(30 sec)(single-ue) + -u -b 27.5M -t 30 -i 1 + 50 + single-ue + + + + Iperf + iperf (20MHz - DL/27.5Mbps/UDP)(30 sec)(unbalanced) + -u -b 27.5M -t 30 -i 1 + 50 + unbalanced + + + + Iperf + iperf (20MHz - DL/TCP)(30 sec)(single-ue) + -t 30 -i 1 -fm + 50 + single-ue + + + + Iperf + iperf (20MHz - DL/TCP)(30 sec) + -t 30 -i 1 -fm + 50 + + + + Iperf + iperf (20MHz - UL/7Mbps/UDP)(30 sec)(balanced) + -u -b 7M -t 30 -i 1 -R + 50 + balanced + + + + Iperf + iperf (20MHz - UL/7Mbps/UDP)(30 sec)(single-ue) + -u -b 7M -t 30 -i 1 -R + 50 + single-ue + + + + Iperf + iperf (20MHz - UL/7Mbps/UDP)(30 sec)(unbalanced) + -u -b 7M -t 30 -i 1 -R + 50 + unbalanced + + + + Iperf + iperf (20MHz - UL/TCP)(30 sec)(single-ue) + -t 30 -i 1 -fm -R + 50 + single-ue + + + + Iperf + iperf (20MHz - UL/TCP)(30 sec) + -t 30 -i 1 -fm -R + 50 + + + diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1_cdrx.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1_cdrx.xml index f62c31dd5a..a76f188bc4 100644 --- a/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1_cdrx.xml +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1_cdrx.xml @@ -56,7 +56,6 @@ Attach_UE Attach UE - 1 diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml index 15d641efeb..cb54ba31ee 100644 --- a/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml +++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml @@ -43,7 +43,7 @@ Initialize_eNB Initialize RCC (TDD/Band40/20MHz/info) - -O ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf + -O ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf --MACRLCs.[0].scheduler_mode default 1 diff --git a/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_epc_start.xml b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_epc_start.xml new file mode 100644 index 0000000000..51aaba439e --- /dev/null +++ b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_epc_start.xml @@ -0,0 +1,53 @@ + + + epc-start-oai-ue + EPC-Start-OAI-UE + log-in + + 050101 000001 060101 000001 070101 + + + + + IdleSleep + Sleep + 20 + + + + Initialize_HSS + Initialize HSS + + + + Initialize_MME + Initialize MME + + + + Initialize_SPGW + Initialize SPGW + + + diff --git a/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_epc_stop.xml b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_epc_stop.xml new file mode 100644 index 0000000000..07fb6951f8 --- /dev/null +++ b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_epc_stop.xml @@ -0,0 +1,47 @@ + + + epc-closure + EPC-Closure + log-out + + 050201 060201 070201 + + + + + Terminate_HSS + Terminate HSS + + + + Terminate_MME + Terminate MME + + + + Terminate_SPGW + Terminate SPGW + + + diff --git a/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_terminate.xml b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_terminate.xml new file mode 100644 index 0000000000..962aec4129 --- /dev/null +++ b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_terminate.xml @@ -0,0 +1,42 @@ + + + terminate-enb-oai-ue + Terminate-all-eNBs-OAI-UEs + tasks + + 030201 090109 + + + + + Terminate_eNB + Terminate eNB + + + + Terminate_OAI_UE + Terminate OAI UE + + + diff --git a/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1.xml new file mode 100644 index 0000000000..1471b9a016 --- /dev/null +++ b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1.xml @@ -0,0 +1,103 @@ + + + test-05-tm1-oai-ue + Test-05MHz-TM1-OAI-UE + tasks + 4 + + 030201 090109 + 030102 000001 090102 000002 040503 000002 040603 040604 040643 040644 000002 090109 000001 030201 + + + + + IdleSleep + Sleep for 10 sec + 10 + + + + IdleSleep + Sleep for 3 sec + 3 + + + + Initialize_eNB + Initialize eNB (FDD/Band7/5MHz) + -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --eNBs.[0].rrc_inactivity_threshold 0 --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].pusch_p0_Nominal -90 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --eNBs.[0].tracking_area_code 600 --eNBs.[0].plmn_list.[0].mnc 95 --THREAD_STRUCT.[0].parallel_config PARALLEL_RU_L1_TRX_SPLIT + + + + Terminate_eNB + Terminate eNB + + + + Initialize_OAI_UE + Initialize OAI UE (FDD/Band7/5MHz) + -C 2680000000 -r 25 --ue-rxgain 130 --ue-txgain 1 --ue-max-power -6 --ue-scan-carrier --nokrnmod 1 + + + + Terminate_OAI_UE + Terminate OAI UE + + + + Ping + ping (5MHz - 20 sec) + -I 192.168.248.159 -c 20 + 5 + + + + Iperf + iperf (5MHz - DL/1Mbps/UDP)(30 sec) + -u -b 1M -t 30 -i 1 -fm + 50 + + + + Iperf + iperf (5MHz - DL/12Mbps/UDP)(30 sec) + -u -b 12M -t 30 -i 1 -fm + 50 + + + + Iperf + iperf (5MHz - UL/1Mbps/UDP)(30 sec) + -u -b 1M -t 30 -i 1 -fm -R + 50 + + + + Iperf + iperf (5MHz - UL/2Mbps/UDP)(30 sec) + -u -b 2M -t 30 -i 1 -fm -R + 50 + + + diff --git a/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1_nos1.xml b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1_nos1.xml new file mode 100644 index 0000000000..dff0761bd3 --- /dev/null +++ b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1_nos1.xml @@ -0,0 +1,118 @@ + + + test-05-tm1-nos1-tunnel + Test-05MHz-TM1-noS1-tunnel + tasks + 2 + + 030201 090109 + 030101 000001 090101 000002 040501 040502 000001 040601 040602 040641 040642 000001 090109 030201 + + + + + IdleSleep + Sleep + 10 + + + + IdleSleep + Sleep + 5 + + + + IdleSleep + Sleep + 60 + + + + Initialize_eNB + Initialize eNB (FDD/Band7/5MHz) + -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --noS1 --eNBs.[0].rrc_inactivity_threshold 0 --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].pusch_p0_Nominal -90 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --eNBs.[0].tracking_area_code 600 --eNBs.[0].plmn_list.[0].mnc 95 --THREAD_STRUCT.[0].parallel_config PARALLEL_RU_L1_TRX_SPLIT + + + + Terminate_eNB + Terminate eNB + + + + Initialize_OAI_UE + Initialize OAI UE (FDD/Band7/5MHz) + -C 2680000000 -r 25 --ue-rxgain 130 --ue-txgain 1 --ue-max-power -6 --ue-scan-carrier --nokrnmod 1 --noS1 + + + + Terminate_OAI_UE + Terminate OAI UE + + + + Ping + ping (5MHz - 20 sec)(from eNB to OAI UE) + -I oaitun_enb1 -c 20 10.0.1.2 + 5 + + + + Ping + ping (5MHz - 20 sec)(from OAI UE to eNB) + -I oaitun_ue1 -c 20 10.0.1.1 + 5 + + + + Iperf + iperf (5MHz - DL/1Mbps/UDP)(30 sec) + -c 10.0.1.2 -u -b 1M -t 30 -i 1 -fm -B 10.0.1.1 + 50 + + + + Iperf + iperf (5MHz - DL/10Mbps/UDP)(30 sec) + -c 10.0.1.2 -u -b 10M -t 30 -i 1 -fm -B 10.0.1.1 + 50 + + + + Iperf + iperf (5MHz - UL/1Mbps/UDP)(30 sec) + -c 10.0.1.1 -u -b 1M -t 30 -i 1 -fm -B 10.0.1.2 -R + 50 + balanced + + + + Iperf + iperf (5MHz - UL/2Mbps/UDP)(30 sec) + -c 10.0.1.1 -u -b 2M -t 30 -i 1 -fm -B 10.0.1.2 -R + 50 + balanced + + + diff --git a/ci-scripts/xml_files/inria/enb_usrp210_band7_build.xml b/ci-scripts/xml_files/inria/enb_usrp210_band7_build.xml new file mode 100644 index 0000000000..776c92106d --- /dev/null +++ b/ci-scripts/xml_files/inria/enb_usrp210_band7_build.xml @@ -0,0 +1,38 @@ + + + build-tab-enb0 + Build eNB0 + wrench + + 010101 + + + + + Build_eNB + Build eNB (USRP) + -w USRP -c --eNB + + + diff --git a/ci-scripts/xml_files/inria/enb_usrp210_band7_epc_start.xml b/ci-scripts/xml_files/inria/enb_usrp210_band7_epc_start.xml new file mode 100644 index 0000000000..5fc3a2e960 --- /dev/null +++ b/ci-scripts/xml_files/inria/enb_usrp210_band7_epc_start.xml @@ -0,0 +1,53 @@ + + + epc-start + EPC-Start + log-in + + 050102 000001 060102 000001 070102 + + + + + IdleSleep + Sleep + 20 + + + + Initialize_HSS + Initialize HSS + + + + Initialize_MME + Initialize MME + + + + Initialize_SPGW + Initialize SPGW + + + diff --git a/ci-scripts/xml_files/inria/enb_usrp210_band7_epc_stop.xml b/ci-scripts/xml_files/inria/enb_usrp210_band7_epc_stop.xml new file mode 100644 index 0000000000..617e78b3bf --- /dev/null +++ b/ci-scripts/xml_files/inria/enb_usrp210_band7_epc_stop.xml @@ -0,0 +1,53 @@ + + + epc-stop + EPC-Stop + log-out + + 050201 060201 070201 + 040101 + + + + + Terminate_HSS + Terminate HSS + + + + Terminate_MME + Terminate MME + + + + Terminate_SPGW + Terminate SPGW + + + + Initialize_UE + Initialize UE + + + diff --git a/ci-scripts/xml_files/inria/enb_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/inria/enb_usrp210_band7_test_05mhz_tm1.xml new file mode 100644 index 0000000000..5843539f72 --- /dev/null +++ b/ci-scripts/xml_files/inria/enb_usrp210_band7_test_05mhz_tm1.xml @@ -0,0 +1,108 @@ + + + test-05-tm1 + Test-05MHz-TM1 + tasks + 2 + + 030201 040101 + 030102 000002 040301 000002 040504 000001 040401 000002 030201 + + + + + Initialize_UE + Initialize UE + + + + IdleSleep + Sleep for 10 sec + 10 + + + + IdleSleep + Sleep for 3 sec + 3 + + + + Initialize_eNB + Initialize eNB (FDD/Band7/5MHz) + -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --eNBs.[0].rrc_inactivity_threshold 0 --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].pusch_p0_Nominal -90 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --eNBs.[0].tracking_area_code 600 --eNBs.[0].plmn_list.[0].mnc 95 --THREAD_STRUCT.[0].parallel_config PARALLEL_RU_L1_TRX_SPLIT + + + + Terminate_eNB + Terminate eNB + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + Ping + ping (5MHz - 20 sec) + -I 192.168.248.159 -c 20 + 5 + + + + Iperf + iperf (5MHz - DL/1Mbps/UDP)(30 sec) + -u -b 1M -t 30 -i 1 -fm + 50 + + + + Iperf + iperf (5MHz - DL/12Mbps/UDP)(30 sec) + -u -b 12M -t 30 -i 1 -fm + 50 + + + + Iperf + iperf (5MHz - UL/1Mbps/UDP)(30 sec) + -u -b 1M -t 30 -i 1 -fm -R + 50 + + + + Iperf + iperf (5MHz - UL/2Mbps/UDP)(30 sec) + -u -b 2M -t 30 -i 1 -fm -R + 50 + + + diff --git a/ci-scripts/xml_files/inria/ue_usrp210_band7_build.xml b/ci-scripts/xml_files/inria/ue_usrp210_band7_build.xml new file mode 100644 index 0000000000..7d7ae6e0df --- /dev/null +++ b/ci-scripts/xml_files/inria/ue_usrp210_band7_build.xml @@ -0,0 +1,38 @@ + + + build-tab-ue0 + Build UE0 + wrench + +090101 + + + + + Build_OAI_UE + Build OAI UE + -w USRP --UE + + + diff --git a/common/utils/T/tracer/hacks/multi-rru-clean.c b/common/utils/T/tracer/hacks/multi-rru-clean.c index c85dc0de7f..791ef6fac9 100644 --- a/common/utils/T/tracer/hacks/multi-rru-clean.c +++ b/common/utils/T/tracer/hacks/multi-rru-clean.c @@ -12,6 +12,7 @@ void usage(void) "usage: \n" "options:\n" " -d this option is mandatory\n" + " -e trace given event (default CALIBRATION_CHANNEL_ESTIMATES)\n" ); exit(1); } @@ -88,6 +89,7 @@ int main(int n, char **v) int number_of_tags = -1; char *input_filename = NULL; char *output_filename = NULL; + char *event_name = "CALIBRATION_CHANNEL_ESTIMATES"; int i; FILE *in; FILE *out; @@ -107,6 +109,8 @@ int main(int n, char **v) if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage(); if (!strcmp(v[i], "-d")) { if (i > n-2) usage(); database_filename = v[++i]; continue; } + if (!strcmp(v[i], "-e")) { if (i > n-2) usage(); + event_name = v[++i]; continue; } if (number_of_tags == -1) { number_of_tags = atoi(v[i]); if (number_of_tags <= 0) {usage();} continue; } if (input_filename == NULL) { input_filename = v[i]; continue; } @@ -124,7 +128,7 @@ int main(int n, char **v) database = parse_database(database_filename); - channel_estimate_id = event_id_from_name(database, "CALIBRATION_CHANNEL_ESTIMATES"); + channel_estimate_id = event_id_from_name(database, event_name); f = get_format(database, channel_estimate_id); frame_arg = get_field(&f, "frame", "int"); diff --git a/executables/nr-ru.c b/executables/nr-ru.c index fccbcc975e..a9c306461c 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -806,7 +806,6 @@ static void *ru_thread_asynch_rxtx( void *param ) { printf( "devices ok (ru_thread_asynch_rx)\n"); while (!oai_exit) { - if (oai_exit) break; if (subframe==9) { subframe=0; @@ -854,7 +853,7 @@ static void *ru_thread_prach( void *param ) { LOG_I(PHY,"%s() RU configured - RACH processing thread running\n", __FUNCTION__); while (!oai_exit) { - if (oai_exit) break; + if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"ru_prach_thread") < 0) break; @@ -1159,7 +1158,7 @@ int setup_RU_buffers(RU_t *ru) { frame_parms = ru->nr_frame_parms; printf("setup_RU_buffers: frame_parms = %p\n",frame_parms); } else { - printf("RU[%d] not initialized\n", ru->idx); + printf("ru pointer is NULL\n"); return(-1); } @@ -1259,7 +1258,6 @@ static void *ru_thread_tx( void *param ) { } while (!oai_exit) { - if (oai_exit) break; LOG_D(PHY,"ru_thread_tx: Waiting for TX processing\n"); // wait until eNBs are finished subframe RX n and TX n+4 diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 24288d76d3..ca48554229 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -574,7 +574,7 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) { } int computeSamplesShift(PHY_VARS_NR_UE *UE) { - if ( getenv("RFSIMULATOR") != 0) { + if (IS_SOFTMODEM_RFSIM) { LOG_E(PHY,"SET rx_offset %d \n",UE->rx_offset); //UE->rx_offset_diff=0; return 0; @@ -791,7 +791,7 @@ if (slot_nr==18) msgToPush->key=slot_nr; pushTpool(Tpool, msgToPush); - if (getenv("RFSIMULATOR") || IS_SOFTMODEM_NOS1) { //getenv("RFSIMULATOR") + if (IS_SOFTMODEM_RFSIM || IS_SOFTMODEM_NOS1) { //getenv("RFSIMULATOR") // FixMe: Wait previous thread is done, because race conditions seems too bad // in case of actual RF board, the overlap between threads mitigate the issue // We must receive one message, that proves the slot processing is done diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c index ed8dd3b49a..95ee3fed17 100644 --- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c +++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c @@ -317,6 +317,7 @@ int test_ldpc(short No_iteration, for (i = 0; i < block_length+(nrows-no_punctured_columns) * Zc - removed_bit; i++) if (channel_input[j][i]!=channel_input_optim[j][i]) { printf("differ in seg %u pos %u (%u,%u)\n", j, i, channel_input[j][i], channel_input_optim[j][i]); + free(channel_output); return (-1); } //else{ diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index 36b6bbf826..7fcaa0646c 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -215,6 +215,8 @@ if (logFlag){ free(encoder_outputByte); free(channel_output); free(modulated_input); + if (logFlag) + fclose(logFile); return 0; #endif @@ -317,13 +319,13 @@ if (logFlag){ if (nBitError>0) blockErrorState=1; #ifdef DEBUG_POLARTEST for (int i = 0; i < testArrayLength; i++) - printf("[polartest/decoderState=%d] testInput[%d]=0x%08x, estimatedOutput[%d]=0x%08x\n",decoderState, i, testInput[i], i, estimatedOutput[i]); + printf("[polartest/decoderState=%u] testInput[%d]=0x%08x, estimatedOutput[%d]=0x%08x\n",decoderState, i, testInput[i], i, estimatedOutput[i]); #endif //Iteration times are in microseconds. timeEncoderCumulative+=(timeEncoder.diff/(cpu_freq_GHz*1000.0)); timeDecoderCumulative+=(timeDecoder.diff/(cpu_freq_GHz*1000.0)); - if (logFlag) fprintf(logFile,",%f,%d,%d,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(cpu_freq_GHz*1000.0)), (timeDecoder.diff/(cpu_freq_GHz*1000.0))); + if (logFlag) fprintf(logFile,",%f,%d,%u,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(cpu_freq_GHz*1000.0)), (timeDecoder.diff/(cpu_freq_GHz*1000.0))); if (nBitError<0) { blockErrorCumulative++; diff --git a/openair1/PHY/CODING/lte_segmentation.c b/openair1/PHY/CODING/lte_segmentation.c index 5116c765b8..7b8308656a 100644 --- a/openair1/PHY/CODING/lte_segmentation.c +++ b/openair1/PHY/CODING/lte_segmentation.c @@ -59,7 +59,7 @@ int lte_segmentation(unsigned char *input_buffer, } if ((*C)>MAX_NUM_DLSCH_SEGMENTS) { - printf("%d\n",*(int*)0); + printf("%d\n",*(int *)0); LOG_E(PHY,"lte_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime); return(-1); } @@ -105,7 +105,7 @@ int lte_segmentation(unsigned char *input_buffer, #endif *Kminus = (*Kplus - 64); } else { - printf("lte_segmentation.c: Illegal codeword size !!!\n"); + LOG_E(PHY,"lte_segmentation.c: Illegal codeword size !!!\n"); return(-1); } diff --git a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c index 5da223dc64..5988c9067d 100644 --- a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c +++ b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c @@ -494,7 +494,8 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,int fprintf(fd," int i2;\n"); fprintf(fd2," int i2;\n"); fprintf(fd," for (i2=0; i2<%d; i2++) {\n",Zc>>shift); - fprintf(fd2," for (i2=0; i2<%d; i2++) {\n",Zc>>(shift-1)); + if (shift > 0) + fprintf(fd2," for (i2=0; i2<%d; i2++) {\n",Zc>>(shift-1)); for (i2=0; i2 < 1; i2++) { //t=Kb*Zc+i2; diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c index 7ec530242e..53119a1c2b 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c @@ -252,6 +252,7 @@ int8_t polar_decoder(double *input, nr_free_uint8_3D_array(bit, polarParams->N, (polarParams->n+1)); nr_free_double_3D_array(llr, polarParams->N, (polarParams->n+1)); nr_free_uint8_2D_array(crcChecksum, polarParams->crcParityBits); + free(tempECGM); return(-1); } @@ -522,6 +523,7 @@ int8_t polar_decoder_dci(double *input, nr_free_uint8_3D_array(bit, polarParams->N, (polarParams->n+1)); nr_free_double_3D_array(llr, polarParams->N, (polarParams->n+1)); nr_free_uint8_2D_array(crcChecksum, polarParams->crcParityBits); + free(tempECGM); return(-1); } diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c index bf8a90e0d9..daa2346098 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c @@ -470,7 +470,7 @@ void computeBeta(const t_nrPolar_params *pp,decoder_node_t *node) { int ssr4len = node->Nv/2/8; register __m128i allones=*((__m128i*)all1); for (int i=0;iuci_vars[i].active >0) && - (eNB->uci_vars[i].rnti==rnti) && - (eNB->uci_vars[i].frame==frame) && - (eNB->uci_vars[i].subframe==subframe)) return(i); + (eNB->uci_vars[i].rnti==rnti) && + (eNB->uci_vars[i].frame==frame) && + (eNB->uci_vars[i].subframe==subframe)) return(i); else if ((eNB->uci_vars[i].active == 0) && (first_free_index==-1)) first_free_index=i; } + if (type == SEARCH_EXIST) return(-1); - else return(first_free_index); + + if (first_free_index==-1) + LOG_E(MAC,"UCI table is full\n"); + + return(first_free_index); } diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index 59fa853c4d..39556902fc 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -561,8 +561,8 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag) else tc = *decoder8; - if(ulsch_harq->repetition_number == 1){ - memset(pusch_rep_buffer,0,(sizeof(int32_t)*3*(6144+64))) ; // reset the buffer every new repetitions + if(ulsch_harq->repetition_number == 1) { + memset(pusch_rep_buffer,0,(sizeof(int32_t)*3*(6144+64))) ; // reset the buffer every new repetitions } for (r=0; rC; r++) { @@ -579,11 +579,10 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag) (uint8_t *)&dummy_w[r][0], (r==0) ? ulsch_harq->F : 0); #ifdef DEBUG_ULSCH_DECODING - printf("Rate Matching Segment %u (coded bits (G) %d,unpunctured/repeated bits %u, Q_m %d, nb_rb %d, Nl %d)...\n", + printf("Rate Matching Segment %u (coded bits (G) %d,unpunctured/repeated bits %u, Q_m %d, Nl %d)...\n", r, G, Kr*3, - Q_m, - nb_rb, + ulsch_harq->Qm, ulsch_harq->Nl); #endif start_meas(&eNB->ulsch_rate_unmatching_stats); @@ -608,27 +607,23 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag) } stop_meas(&eNB->ulsch_rate_unmatching_stats); - max_Ncb = 3*ulsch_harq->RTC[r]*32 ; - if(ulsch_harq->total_number_of_repetitions > 1) - { - if (ulsch_harq->rvidx==1) - { // Store the result of HARQ combining in the last emtc repetitions of sequence 0,2,3,1 - for (int nn=0;nnw[r][nn] ; - } + if(ulsch_harq->total_number_of_repetitions > 1) { + if (ulsch_harq->rvidx==1) { + // Store the result of HARQ combining in the last emtc repetitions of sequence 0,2,3,1 + for (int nn=0; nnw[r][nn] ; } - if (ulsch_harq->repetition_number == ulsch_harq->total_number_of_repetitions) - { - for (int nn=0;nnw[r][nn] = pusch_rep_buffer[nn] ; - } - } } + if (ulsch_harq->repetition_number == ulsch_harq->total_number_of_repetitions) { + for (int nn=0; nnw[r][nn] = pusch_rep_buffer[nn] ; + } + } + } + r_offset += E; start_meas(&eNB->ulsch_deinterleaving_stats); sub_block_deinterleaving_turbo(4+Kr, @@ -727,11 +722,13 @@ static inline unsigned int lte_gold_unscram(unsigned int *x1, unsigned int *x2, // printf("n=%d : c %x\n",n,x1^x2); } -unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, +unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, + L1_rxtx_proc_t *proc, uint8_t UE_id, uint8_t control_only_flag, uint8_t Nbundled, - uint8_t llr8_flag) { + uint8_t llr8_flag) +{ int16_t *ulsch_llr = eNB->pusch_vars[UE_id]->llr; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; LTE_eNB_ULSCH_t *ulsch = eNB->ulsch[UE_id]; @@ -762,12 +759,13 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, int frame = proc->frame_rx; int subframe = proc->subframe_rx; LTE_UL_eNB_HARQ_t *ulsch_harq; + LOG_D(PHY,"ue_type %d\n",ulsch->ue_type); - if (ulsch->ue_type>0) harq_pid = 0; - else { + if (ulsch->ue_type>0) + harq_pid = 0; + else harq_pid = subframe2harq_pid(frame_parms,proc->frame_rx,subframe); - } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING0+harq_pid,1); // x1 is set in lte_gold_generic diff --git a/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c index 7404d2f6b8..afa46de820 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c @@ -278,6 +278,7 @@ char phich_string[13][4] = {"","1/6","","1/2","","","one","","","","","","two"}; char duplex_string[2][4] = {"FDD","TDD"}; char prefix_string[2][9] = {"NORMAL","EXTENDED"}; + int initial_sync(PHY_VARS_UE *ue, runmode_t mode) { int32_t sync_pos,sync_pos2,sync_pos_slot; int32_t metric_fdd_ncp=0,metric_fdd_ecp=0,metric_tdd_ncp=0,metric_tdd_ecp=0; @@ -557,13 +558,12 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) { ue->measurements.rx_power_avg_dB[0] = dB_fixed(ue->measurements.rx_power_avg[0]); LOG_I(PHY,"[UE%d] Initial sync : Estimated power: %d dB\n",ue->Mod_id,ue->measurements.rx_power_avg_dB[0] ); - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) + if (IS_SOFTMODEM_BASICSIM ) phy_adjust_gain(ue,ue->measurements.rx_power_avg_dB[0],0); } else { - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) + if (IS_SOFTMODEM_BASICSIM ) phy_adjust_gain(ue,dB_fixed(ue->measurements.rssi),0); } return ret; } - diff --git a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c index 8139c496ae..49fa484c26 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c @@ -80,7 +80,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 int i, prach_len; uint16_t first_nonzero_root_idx=0; - if ( !(IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) ) { + if ( !(IS_SOFTMODEM_BASICSIM ) ) { prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset); #ifdef PRACH_DEBUG LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, @@ -473,7 +473,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 AssertFatal(prach_fmt<4, "prach_fmt4 not fully implemented" ); - if (!(IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) ) { + if (!(IS_SOFTMODEM_BASICSIM ) ) { int j; int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti; LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow ); diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index 16fc94a59f..5460e2b4f1 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -103,7 +103,11 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, break; default: - printf("pusch_channel_estimation: nushift=%d -> ERROR\n",nushift); +#ifdef DEBUG_CH + if (debug_ch_est) + fclose(debug_ch_est); + +#endif return(-1); break; } @@ -193,7 +197,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); #ifdef DEBUG_CH - fprintf(debug_ch_est, "pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); + fprintf(debug_ch_est, "pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); //printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); #endif multadd_real_vector_complex_scalar(fm, @@ -208,7 +212,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); #ifdef DEBUG_PUSCH - printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); + printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); #endif multadd_real_vector_complex_scalar(fmm, ch, @@ -225,7 +229,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); #ifdef DEBUG_PUSCH - printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); + printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); #endif multadd_real_vector_complex_scalar(fm, ch, @@ -243,7 +247,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); #ifdef DEBUG_PUSCH printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])); - printf("pilot %d: rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]); + printf("pilot %u: rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]); #endif multadd_real_vector_complex_scalar(fmr, ch, @@ -258,7 +262,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); #ifdef DEBUG_PUSCH - printf("pilot %d: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); + printf("pilot %u: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); #endif multadd_real_vector_complex_scalar(fr, ch, diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h index d982a17ea7..77d5c6802f 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h @@ -80,7 +80,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch, time_stats_t *dlsch_modulation_stats); -void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); +void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr); void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index 244e29a243..dae5586224 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -48,11 +48,12 @@ //#define DEBUG_DLSCH_CODING //#define DEBUG_DLSCH_FREE 1 -void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch) +void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr) { int i; int r; - + + NR_gNB_DLSCH_t *dlsch = *dlschptr; if (dlsch) { #ifdef DEBUG_DLSCH_FREE printf("Freeing dlsch %p\n",dlsch); @@ -232,7 +233,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(unsigned char Kmimo, LOG_D(PHY,"new_gNB_dlsch exit flag %d, size of %ld\n", exit_flag, sizeof(NR_gNB_DLSCH_t)); - free_gNB_dlsch(dlsch); + free_gNB_dlsch(&dlsch); return(NULL); @@ -278,7 +279,7 @@ int nr_dlsch_encoding(unsigned char *a, unsigned int G; unsigned int crc=1; - uint8_t harq_pid = dlsch->harq_ids[frame%2][slot]; + uint8_t harq_pid = dlsch->harq_ids[frame&2][slot]; AssertFatal(harq_pid<8 && harq_pid>=0,"illegal harq_pid %d\b",harq_pid); nfapi_nr_dl_config_dlsch_pdu_rel15_t rel15 = dlsch->harq_processes[harq_pid]->dlsch_pdu.dlsch_pdu_rel15; uint16_t nb_rb = rel15.n_prb; @@ -458,7 +459,7 @@ int nr_dlsch_encoding(unsigned char *a, #ifdef DEBUG_DLSCH_CODING for (int i =0; i<16; i++) - printf("output ratematching e[%d]= %d r_offset %d\n", i,dlsch->harq_processes[harq_pid]->e[i+r_offset], r_offset); + printf("output ratematching e[%d]= %d r_offset %u\n", i,dlsch->harq_processes[harq_pid]->e[i+r_offset], r_offset); #endif nr_interleaving_ldpc(E, @@ -469,7 +470,7 @@ int nr_dlsch_encoding(unsigned char *a, #ifdef DEBUG_DLSCH_CODING for (int i =0; i<16; i++) - printf("output interleaving f[%d]= %d r_offset %d\n", i,dlsch->harq_processes[harq_pid]->f[i+r_offset], r_offset); + printf("output interleaving f[%d]= %d r_offset %u\n", i,dlsch->harq_processes[harq_pid]->f[i+r_offset], r_offset); if (r==dlsch->harq_processes[harq_pid]->C-1) write_output("enc_output.m","enc",dlsch->harq_processes[harq_pid]->f,G,1,4); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index 2e8f2af5f5..e78d7aadee 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -283,10 +283,9 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, uint8_t harq_pid, uint8_t is_crnti) { - uint32_t A,E; uint32_t G; - uint32_t ret,offset; + uint32_t ret, offset; int32_t no_iteration_ldpc, length_dec; uint32_t r,r_offset=0,Kr=8424,Kr_bytes,K_bytes_F,err_flag=0; uint8_t crc_type; @@ -313,10 +312,10 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, int16_t z [68*384]; int8_t l [68*384]; - uint8_t kc=255; - uint8_t Ilbrm = 0; - uint32_t Tbslbrm = 950984; - double Coderate = 0.0; + uint8_t kc = 255; + uint8_t Ilbrm = 0; + uint32_t Tbslbrm = 950984; + double Coderate = 0.0; // ------------------------------------------------------------------ uint16_t nb_rb = nfapi_ulsch_pdu_rel15->number_rbs; @@ -528,7 +527,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, write_output("decoder_in.m","dec",&harq_process->d[0][0],(3*8*Kr_bytes)+12,1,0); } - printf("decoder input(segment %u) :",r); + printf("decoder input(segment %u) :", r); int i; for (i=0;i<(3*8*Kr_bytes)+12;i++) printf("%d : %d\n",i,harq_process->d[r][i]); @@ -705,13 +704,9 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0)); #ifdef DEBUG_ULSCH_DECODING - printf("Segment %u : Kr= %u bytes\n",r,Kr_bytes); - printf("copied %d bytes to b sequence (harq_pid %d)\n", - (Kr_bytes - (harq_process->F>>3)-((harq_process->C>1)?3:0)),harq_pid); - printf("b[0] = %x,c[%d] = %x\n", - harq_process->b[offset], - harq_process->F>>3, - harq_process->c[r]); + printf("Segment %u : Kr = %u bytes\n", r, Kr_bytes); + printf("copied %d bytes to b sequence (harq_pid %d)\n", (Kr_bytes - (harq_process->F>>3)-((harq_process->C>1)?3:0)), harq_pid); + printf("b[0] = %x, c[%d] = %x\n", harq_process->b[offset], harq_process->F>>3, harq_process->c[r]); #endif } diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index aaa304ec63..09dadabaa5 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -192,12 +192,12 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, - uint8_t eNB_offset, - unsigned char Ns, - unsigned char symbol, - int dmrss, - uint8_t ssb_index, - uint8_t n_hf) + uint8_t eNB_offset, + unsigned char Ns, + unsigned char symbol, + int dmrss, + uint8_t ssb_index, + uint8_t n_hf) { int pilot[200] __attribute__((aligned(16))); unsigned char aarx,p; diff --git a/openair1/PHY/NR_UE_TRANSPORT/cic_filter_nr.c b/openair1/PHY/NR_UE_TRANSPORT/cic_filter_nr.c index 98248d02dd..b2a7471d82 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/cic_filter_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/cic_filter_nr.c @@ -438,6 +438,7 @@ void cic_decimator(int16_t *input_buffer, int16_t *output_buffer, int length, in fir_filter_basic(input, output, new_length, FIR_TAPS_NUMBER, filter_taps, SHARPENED_FIR_SCALING_ACC); #endif + free(filter_taps_fixed_point); } else { diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 3c6784be7e..ea90111bcc 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -253,6 +253,7 @@ void pdcch_channel_level(int32_t **dl_ch_estimates_ext, avg128P = _mm_setzero_si128(); dl_ch128=(__m128i *)&dl_ch_estimates_ext[aarx][0]; #elif defined(__arm__) + dl_ch128=(int16x8_t *)&dl_ch_estimates_ext[aarx][0]; #endif for (rb=0; rb<(nb_rb*3)>>2; rb++) { @@ -375,7 +376,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, * then the IQ symbol is going to be found at the position 0+c_rb-N_RB_DL/2 in rxdataF and * we have to point the pointer at (1+c_rb-N_RB_DL/2) in rxdataF */ - LOG_DDD("n_BWP_start=%d, coreset_nbr_rb=%d\n",n_BWP_start,coreset_nbr_rb); + LOG_DDD("n_BWP_start=%u, coreset_nbr_rb=%u\n",n_BWP_start,coreset_nbr_rb); for (c_rb = n_BWP_start; c_rb < (n_BWP_start + coreset_nbr_rb + (BIT_TO_NBR_RB_CORESET_FREQ_DOMAIN * offset_discontiguous)); c_rb++) { //c_rb_tmp = 0; @@ -762,8 +763,8 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, } } - LOG_DD("symbol_mon=(%d) and start_symbol=(%d)\n",symbol_mon,start_symbol); - LOG_DD("coreset_freq_dom=(%ld) n_rb_offset=(%d) coreset_time_dur=(%d) n_shift=(%d) reg_bundle_size_L=(%d) coreset_interleaver_size_R=(%d) scrambling_ID=(%d) \n", + LOG_DD("symbol_mon=(%u) and start_symbol=(%u)\n",symbol_mon,start_symbol); + LOG_DD("coreset_freq_dom=(%lu) n_rb_offset=(%u) coreset_time_dur=(%d) n_shift=(%d) reg_bundle_size_L=(%d) coreset_interleaver_size_R=(%d) scrambling_ID=(%d) \n", coreset_freq_dom,n_rb_offset,coreset_time_dur,n_shift,reg_bundle_size_L,coreset_interleaver_size_R,pdcch_DMRS_scrambling_id); // // according to 38.213 v15.1.0: a PDCCH monitoring pattern within a slot, @@ -780,7 +781,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, // for (int j=0; j < coreset_nbr_act; j++) { // for each active CORESET (max number of active CORESETs in a BWP is 3), // we calculate the number of RB for each CORESET bitmap - LOG_DD("coreset_freq_dom=(%ld)\n",coreset_freq_dom); + LOG_DD("coreset_freq_dom=(%lu)\n",coreset_freq_dom); int i; //for each bit in the coreset_freq_dom bitmap for (i = 0; i < 45; i++) { @@ -789,8 +790,8 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, } coreset_nbr_rb = 6 * coreset_nbr_rb; // coreset_nbr_rb has to be multiplied by 6 to indicate the number of PRB or REG(=12 RE) within the CORESET - LOG_DD("coreset_freq_dom=(%ld,%lx), coreset_nbr_rb=%d\n", coreset_freq_dom,coreset_freq_dom,coreset_nbr_rb); - LOG_DD("coreset_nbr_rb=%d, coreset_nbr_reg=%d, coreset_C=(%d/(%d*%d))=%d\n", + LOG_DD("coreset_freq_dom=(%lu,%lx), coreset_nbr_rb=%u\n", coreset_freq_dom,coreset_freq_dom,coreset_nbr_rb); + LOG_DD("coreset_nbr_rb=%u, coreset_nbr_reg=%u, coreset_C=(%u/(%d*%d))=%u\n", coreset_nbr_rb, coreset_time_dur * coreset_nbr_rb, coreset_time_dur * coreset_nbr_rb, @@ -1163,9 +1164,9 @@ void nr_dci_decoding_procedure0(int s, LOG_DDD("debug1(%d)=nCCE[p]/L2 | nCCE[%d](%d) | L2(%d)\n",nCCE[p] / L2,p,nCCE[p],L2); LOG_DDD("debug2(%d)=L2*m_p_s_L_max | L2(%d) | m_p_s_L_max(%d)\n",L2*m_p_s_L_max,L2,m_p_s_L_max); CCEind = (((Yk + (uint16_t)(floor((m*nCCE[p])/(L2*m_p_s_L_max))) + n_ci) % (uint16_t)(floor(nCCE[p] / L2))) * L2); - LOG_DDD("CCEind(%d) = (((Yk(%u) + ((m(%u)*nCCE[p](%d))/(L2(%d)*m_p_s_L_max(%d)))) %% (nCCE[p] / L2)) * L2)\n", + LOG_DDD("CCEind(%u) = (((Yk(%u) + ((m(%u)*nCCE[p](%u))/(L2(%d)*m_p_s_L_max(%d)))) %% (nCCE[p] / L2)) * L2)\n", CCEind,Yk,m,nCCE[p],L2,m_p_s_L_max); - LOG_DDD("n_candidate(m)=%u | CCEind=%d |",m,CCEind); + LOG_DDD("n_candidate(m)=%u | CCEind=%u |",m,CCEind); if (CCEind < 32) CCEmap = CCEmap0; @@ -1173,7 +1174,7 @@ void nr_dci_decoding_procedure0(int s, CCEmap = CCEmap1; else if (CCEind < 96) CCEmap = CCEmap2; - else AssertFatal(1==0,"Illegal CCEind %d (Yk %u, m %u, nCCE %d, L2 %d\n", CCEind, Yk, m, nCCE[p], L2); + else AssertFatal(1==0,"Illegal CCEind %u (Yk %u, m %u, nCCE %u, L2 %u\n", CCEind, Yk, m, nCCE[p], L2); switch (L2) { case 1: @@ -1220,7 +1221,7 @@ void nr_dci_decoding_procedure0(int s, LOG_DDD("... we enter function dci_decoding(sizeof_bits=%d L=%d) -----\n",sizeof_bits,L); LOG_DDD("... we have to replace this part of the code by polar decoding\n"); // for (int m=0; m < (nCCE[p]*6*9*2); m++) - LOG_DDD("(polar decoding)-> polar intput (with coreset_time_dur=%d, coreset_nbr_rb=%d, p=%d, CCEind=%d): \n", + LOG_DDD("(polar decoding)-> polar intput (with coreset_time_dur=%d, coreset_nbr_rb=%d, p=%d, CCEind=%u): \n", coreset_time_dur,coreset_nbr_rb,p,CCEind); /* int reg_p=0,reg_e=0; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 8f810d36d3..1089c08542 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -380,10 +380,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]); #if DISABLE_LOG_X - printf("[AbsSFN %d.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n", + printf("[AbsSFN %u.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n", frame,nr_tti_rx,slot,symbol,ue->high_speed_flag,type,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); #else - LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n", + LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n", frame,nr_tti_rx,slot,symbol,ue->high_speed_flag,type,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); #endif #endif @@ -404,9 +404,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]); #if DISABLE_LOG_X - printf("[AbsSFN %d.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_tti_rx,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); + printf("[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_tti_rx,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); #else - LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_tti_rx,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); + LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_tti_rx,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); #endif #endif @@ -483,9 +483,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]); #if DISABLE_LOG_X - printf("[AbsSFN %d.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_tti_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); + printf("[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_tti_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); #else - LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_tti_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); + LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_tti_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); #endif #endif @@ -596,9 +596,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]); #if DISABLE_LOG_X - printf("[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,nr_tti_rx,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); + printf("[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,nr_tti_rx,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); #else - LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,nr_tti_rx,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); + LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,nr_tti_rx,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); #endif #endif // MRC @@ -641,9 +641,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]); #if DISABLE_LOG_X - printf("[AbsSFN %d.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_tti_rx,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); + printf("[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_tti_rx,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); #else - LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_tti_rx,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); + LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_tti_rx,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); #endif #endif @@ -1018,9 +1018,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]); #if DISABLE_LOG_X - printf("[AbsSFN %d.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_tti_rx,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); + printf("[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_tti_rx,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); #else - LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_tti_rx,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); + LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_tti_rx,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); #endif #endif // Please keep it: useful for debugging @@ -1091,7 +1091,7 @@ void nr_dlsch_deinterleaving(uint8_t symbol, uint32_t *bundle_deint = malloc(N_bundle*sizeof(uint32_t)); - printf("N_bundle %d L %d nb_rb_pdsch %d\n",N_bundle, L,nb_rb_pdsch); + printf("N_bundle %u L %d nb_rb_pdsch %d\n",N_bundle, L,nb_rb_pdsch); if (symbol==start_symbol) nb_re = 6; @@ -1117,6 +1117,7 @@ void nr_dlsch_deinterleaving(uint8_t symbol, //printf("k %d m %d bundle_deint %d llr_deint %d\n", k, m, bundle_deint[k], llr_deint[bundle_deint[k]*nb_re*L+m]); } } + free(bundle_deint); } //============================================================================================== @@ -2455,7 +2456,7 @@ unsigned short nr_dlsch_extract_rbs_dual(int **rxdataF, int prb,nb_rb=0; unsigned short k; int i,j,aarx; - int32_t *dl_ch0=NULL,*dl_ch0p=NULL,*dl_ch0_ext=NULL,*dl_ch1=NULL,*dl_ch1p=NULL,*dl_ch1_ext=NULL,*rxF=NULL,*rxF_ext=NULL; + int32_t *dl_ch0=NULL,*dl_ch0_ext=NULL,*dl_ch1=NULL,*dl_ch1_ext=NULL,*rxF=NULL,*rxF_ext=NULL; k = frame_parms->first_carrier_offset + 516; //0 @@ -2511,8 +2512,8 @@ unsigned short nr_dlsch_extract_rbs_dual(int **rxdataF, if ((i&1)!=frame_parms->nushift) { rxF_ext[j]=rxF[i]; // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); - dl_ch0_ext[j]=dl_ch0p[i]; - dl_ch1_ext[j++]=dl_ch1p[i]; + dl_ch0_ext[j]=dl_ch0[i]; + dl_ch1_ext[j++]=dl_ch1[i]; } } dl_ch0_ext+=6; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index a4a329b2cf..d5b993e391 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -61,7 +61,7 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlsch); NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag); -void free_nr_ue_ulsch(NR_UE_ULSCH_t *ulsch); +void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulsch); NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, uint8_t abstraction_flag); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index cbe0a816ff..cacc9f92d0 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -42,9 +42,10 @@ -void free_nr_ue_ulsch(NR_UE_ULSCH_t *ulsch) +void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulschptr) { int i, r; + NR_UE_ULSCH_t *ulsch = *ulschptr; if (ulsch) { #ifdef DEBUG_ULSCH_FREE @@ -80,7 +81,7 @@ void free_nr_ue_ulsch(NR_UE_ULSCH_t *ulsch) } } free16(ulsch,sizeof(NR_UE_ULSCH_t)); - ulsch = NULL; + *ulschptr = NULL; } } @@ -179,7 +180,7 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, } LOG_E(PHY,"new_ue_ulsch exit flag, size of %d , %zu\n",exit_flag, sizeof(LTE_UE_ULSCH_t)); - free_nr_ue_ulsch(ulsch); + free_nr_ue_ulsch(&ulsch); return(NULL); diff --git a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c index e838b4b747..351c4ea22a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c @@ -77,7 +77,7 @@ void nr_group_sequence_hopping (pucch_GroupHopping_t PUCCH_GroupHopping, // initialization to be removed PUCCH_GroupHopping=neither; n_id=10; - printf("\t\t [nr_group_sequence_hopping] initialization PUCCH_GroupHopping=%d, n_id=%d -> variable initializations TO BE REMOVED\n",PUCCH_GroupHopping,n_id); + printf("\t\t [nr_group_sequence_hopping] initialization PUCCH_GroupHopping=%u, n_id=%u -> variable initializations TO BE REMOVED\n",PUCCH_GroupHopping,n_id); #endif uint8_t f_ss=0,f_gh=0; *u=0; @@ -159,14 +159,14 @@ double nr_cyclic_shift_hopping(uint32_t n_id, #ifdef DEBUG_NR_PUCCH_TX // initialization to be remo.ved c_init=10; - printf("\t\t [nr_cyclic_shift_hopping] initialization c_init=%d -> variable initialization TO BE REMOVED\n",c_init); + printf("\t\t [nr_cyclic_shift_hopping] initialization c_init=%u -> variable initialization TO BE REMOVED\n",c_init); #endif uint32_t x1,s = lte_gold_generic(&x1, &c_init, 1); // TS 38.211 Subclause 5.2.1 uint8_t n_cs=0; int l = 32, minShift = (14*8*nr_tti_tx )+ 8*(lnormal+lprime); int tmpShift =0; #ifdef DEBUG_NR_PUCCH_TX - printf("\t\t [nr_cyclic_shift_hopping] calculating alpha (cyclic shift) using c_init=%d -> \n",c_init); + printf("\t\t [nr_cyclic_shift_hopping] calculating alpha (cyclic shift) using c_init=%u -> \n",c_init); #endif for (int m=0; m<8; m++) { @@ -306,7 +306,7 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, //((int16_t *)txptr[0][re_offset])[1] = (int16_t)((int32_t)amp * x_n_im[(12*l)+n])>>15; //txptr[re_offset] = (x_n_re[(12*l)+n]<<16) + x_n_im[(12*l)+n]; #ifdef DEBUG_NR_PUCCH_TX - printf("\t [nr_generate_pucch0] mapping to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \ttxptr(%d)=(x_n(l=%d,n=%d)=(%d,%d))\n", + printf("\t [nr_generate_pucch0] mapping to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \ttxptr(%u)=(x_n(l=%d,n=%d)=(%d,%d))\n", amp,frame_parms->ofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,re_offset, l,n,((int16_t *)&txdataF[0][re_offset])[0],((int16_t *)&txdataF[0][re_offset])[1]); #endif @@ -330,7 +330,7 @@ void nr_generate_pucch1(PHY_VARS_NR_UE *ue, uint8_t timeDomainOCC, uint8_t nr_bit) { #ifdef DEBUG_NR_PUCCH_TX - printf("\t [nr_generate_pucch1] start function at slot(nr_tti_tx)=%d payload=%d m0=%d nrofSymbols=%d startingSymbolIndex=%d startingPRB=%d startingPRB_intraSlotHopping=%d timeDomainOCC=%d nr_bit=%d\n", + printf("\t [nr_generate_pucch1] start function at slot(nr_tti_tx)=%d payload=%lu m0=%d nrofSymbols=%d startingSymbolIndex=%d startingPRB=%d startingPRB_intraSlotHopping=%d timeDomainOCC=%d nr_bit=%d\n", nr_tti_tx,payload,m0,nrofSymbols,startingSymbolIndex,startingPRB,startingPRB_intraSlotHopping,timeDomainOCC,nr_bit); #endif /* @@ -368,7 +368,7 @@ void nr_generate_pucch1(PHY_VARS_NR_UE *ue, } // printf("d_re=%d\td_im=%d\n",(int)d_re,(int)d_im); #ifdef DEBUG_NR_PUCCH_TX - printf("\t [nr_generate_pucch1] sequence modulation: payload=%x \tde_re=%d \tde_im=%d\n",payload,d_re,d_im); + printf("\t [nr_generate_pucch1] sequence modulation: payload=%lx \tde_re=%d \tde_im=%d\n",payload,d_re,d_im); #endif /* * Defining cyclic shift hopping TS 38.211 Subclause 6.3.2.2.2 @@ -625,7 +625,7 @@ void nr_generate_pucch1(PHY_VARS_NR_UE *ue, ((int16_t *)&txdataF[0][re_offset])[0] = z_re[i+n]; ((int16_t *)&txdataF[0][re_offset])[1] = z_im[i+n]; #ifdef DEBUG_NR_PUCCH_TX - printf("\t [nr_generate_pucch1] mapping PUCCH to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_pucch[%d]=txptr(%d)=(x_n(l=%d,n=%d)=(%d,%d))\n", + printf("\t [nr_generate_pucch1] mapping PUCCH to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_pucch[%d]=txptr(%u)=(x_n(l=%d,n=%d)=(%d,%d))\n", amp,frame_parms->ofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,i+n,re_offset, l,n,((int16_t *)&txdataF[0][re_offset])[0],((int16_t *)&txdataF[0][re_offset])[1]); #endif @@ -635,7 +635,7 @@ void nr_generate_pucch1(PHY_VARS_NR_UE *ue, ((int16_t *)&txdataF[0][re_offset])[0] = z_dmrs_re[i+n]; ((int16_t *)&txdataF[0][re_offset])[1] = z_dmrs_im[i+n]; #ifdef DEBUG_NR_PUCCH_TX - printf("\t [nr_generate_pucch1] mapping DM-RS to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_dm-rs[%d]=txptr(%d)=(x_n(l=%d,n=%d)=(%d,%d))\n", + printf("\t [nr_generate_pucch1] mapping DM-RS to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_dm-rs[%d]=txptr(%u)=(x_n(l=%d,n=%d)=(%d,%d))\n", amp,frame_parms->ofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,i+n,re_offset, l,n,((int16_t *)&txdataF[0][re_offset])[0],((int16_t *)&txdataF[0][re_offset])[1]); #endif @@ -961,7 +961,7 @@ inline void nr_pucch2_3_4_scrambling(uint16_t M_bit,uint16_t rnti,uint16_t n_id, x2 = ((rnti)<<15)+n_id; s = lte_gold_generic(&x1, &x2, 1); #ifdef DEBUG_NR_PUCCH_TX - printf("\t\t [nr_pucch2_3_4_scrambling] gold sequence s=%lx\n",s); + printf("\t\t [nr_pucch2_3_4_scrambling] gold sequence s=%x\n",s); #endif for (i=0; iofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,i+k,re_offset, l,n,((int16_t *)&txdataF[0][re_offset])[0],((int16_t *)&txdataF[0][re_offset])[1]); #endif @@ -1222,7 +1222,7 @@ void nr_generate_pucch2(PHY_VARS_NR_UE *ue, ((int16_t *)&txdataF[0][re_offset])[1] = (int16_t)((int32_t)(amp*ONE_OVER_SQRT2*(1-(2*((uint8_t)((s>>((2*m)+1))&1)))))>>15); m++; #ifdef DEBUG_NR_PUCCH_TX - printf("\t [nr_generate_pucch2] (n=%d,i=%d) mapping DM-RS to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_dm-rs[%d]=txptr(%d)=(x_n(l=%d,n=%d)=(%d,%d))\n", + printf("\t [nr_generate_pucch2] (n=%d,i=%d) mapping DM-RS to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_dm-rs[%d]=txptr(%u)=(x_n(l=%d,n=%d)=(%d,%d))\n", n,i,amp,frame_parms->ofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,i+kk,re_offset, l,n,((int16_t *)&txdataF[0][re_offset])[0],((int16_t *)&txdataF[0][re_offset])[1]); #endif @@ -1240,6 +1240,9 @@ void nr_generate_pucch2(PHY_VARS_NR_UE *ue, } } } + free(d_re); + free(d_im); + free(btilde); } //#if 0 void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, @@ -1260,7 +1263,7 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, uint8_t occ_length_format4, uint8_t occ_index_format4) { #ifdef DEBUG_NR_PUCCH_TX - printf("\t [nr_generate_pucch3_4] start function at slot(nr_tti_tx)=%d with payload=%d and nr_bit=%d\n", nr_tti_tx, payload, nr_bit); + printf("\t [nr_generate_pucch3_4] start function at slot(nr_tti_tx)=%d with payload=%lu and nr_bit=%d\n", nr_tti_tx, payload, nr_bit); #endif // b is the block of bits transmitted on the physical channel after payload coding uint64_t b; @@ -1665,7 +1668,7 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, } #ifdef DEBUG_NR_PUCCH_TX - printf("re_offset=%d,(rb+startingPRB)=%d\n",re_offset,(rb+startingPRB)); + printf("re_offset=%u,(rb+startingPRB)=%d\n",re_offset,(rb+startingPRB)); #endif //txptr = &txdataF[0][re_offset]; @@ -1679,7 +1682,7 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, ((int16_t *)&txdataF[0][re_offset])[0] = z_re[n+k]; ((int16_t *)&txdataF[0][re_offset])[1] = z_im[n+k]; #ifdef DEBUG_NR_PUCCH_TX - printf("\t [nr_generate_pucch3_4] (l=%d,rb=%d,n=%d,k=%d) mapping PUCCH to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_pucch[%d]=txptr(%d)=(z(l=%d,n=%d)=(%d,%d))\n", + printf("\t [nr_generate_pucch3_4] (l=%d,rb=%d,n=%d,k=%d) mapping PUCCH to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_pucch[%d]=txptr(%u)=(z(l=%d,n=%d)=(%d,%d))\n", l,rb,n,k,amp,frame_parms->ofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,n+k,re_offset, l,n,((int16_t *)&txdataF[0][re_offset])[0],((int16_t *)&txdataF[0][re_offset])[1]); #endif @@ -1691,7 +1694,7 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, ((int16_t *)&txdataF[0][re_offset])[1] = (int16_t)((((int32_t)(32767*cos(alpha*((n+j)%N_ZC)))*r_u_v_base_im[n+j])>>15) + (((int32_t)(32767*sin(alpha*((n+j)%N_ZC)))*r_u_v_base_re[n+j])>>15)); #ifdef DEBUG_NR_PUCCH_TX - printf("\t [nr_generate_pucch3_4] (l=%d,rb=%d,n=%d,j=%d) mapping DM-RS to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_dm-rs[%d]=txptr(%d)=(r_u_v(l=%d,n=%d)=(%d,%d))\n", + printf("\t [nr_generate_pucch3_4] (l=%d,rb=%d,n=%d,j=%d) mapping DM-RS to RE \t amp=%d \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \tz_dm-rs[%d]=txptr(%u)=(r_u_v(l=%d,n=%d)=(%d,%d))\n", l,rb,n,j,amp,frame_parms->ofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,n+j,re_offset, l,n,((int16_t *)&txdataF[0][re_offset])[0],((int16_t *)&txdataF[0][re_offset])[1]); #endif @@ -1705,5 +1708,8 @@ void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, if (table_6_4_1_3_3_2_1_dmrs_positions[nrofSymbols-4][l] == 1) j+=12; } } + free(z_re); + free(z_im); + free(btilde); } diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index 778070b347..66ac415872 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -345,9 +345,9 @@ void phy_scope_gNB(FD_phy_scope_gnb *form, I_pucch[ind] = (float)pucch1ab_comp[2*(ind)]; Q_pucch[ind] = (float)pucch1ab_comp[2*(ind)+1]; - A_pucch[ind] = 10*log10(pucch1_comp[ind]); + A_pucch[ind] = pucch1_comp?(10*log10(pucch1_comp[ind])):0; B_pucch[ind] = ind; - C_pucch[ind] = (float)pucch1_thres[ind]; + C_pucch[ind] = pucch1_thres?(float)pucch1_thres[ind]:0; } fl_set_xyplot_data(form->pucch_comp,I_pucch,Q_pucch,10240,"","",""); fl_set_xyplot_data(form->pucch_comp1,B_pucch,A_pucch,1024,"","",""); @@ -840,7 +840,7 @@ void phy_scope_nrUE(FD_phy_scope_nrue *form, free(bit); free(bit_pdcch); free(llr_pdcch); - + free(chest_t_abs); /* free(chest_f_abs); for (arx=0; arxactive == 0) return; - if (dlsch0 && (!dlsch1)) { + if (!dlsch1) { int harq_pid = dlsch0->current_harq_pid; uint16_t pdsch_start_rb = dlsch0->harq_processes[harq_pid]->start_rb; uint16_t pdsch_nb_rb = dlsch0->harq_processes[harq_pid]->nb_rb; diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index e67735de71..7248add73b 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -25,8 +25,7 @@ * \date 2011 * \version 0.1 * \company Eurecom - * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr, javier.morgad -e@ieee.org + * \email: {knopp, florian.kaltenberger, navid.nikaein}@eurecom.fr, javier.morgade@ieee.org * \note * \warning */ @@ -184,13 +183,16 @@ unsigned int get_tx_amp(int power_dBm, int gain_dB; double gain_lin; - if (power_dBm<=power_max_dBm) + if ( (power_dBm<=power_max_dBm) && ! IS_SOFTMODEM_RFSIM) gain_dB = power_dBm - power_max_dBm; else gain_dB = 0; gain_lin = pow(10,.1*gain_dB); AssertFatal((nb_rb >0) && (nb_rb <= N_RB_UL),"Illegal nb_rb/N_RB_UL combination (%d/%d)\n",nb_rb,N_RB_UL); + LOG_D(PHY," tx gain: %d = %d * sqrt ( pow(10, 0.1*max(0,%d-%d)) * %d/%d ) (gain lin=%f (dB=%d))\n", + (int)(AMP*sqrt(gain_lin*N_RB_UL/(double)nb_rb)), + AMP, power_dBm, power_max_dBm, N_RB_UL, nb_rb, gain_lin, gain_dB); return((int)(AMP*sqrt(gain_lin*N_RB_UL/(double)nb_rb))); } @@ -1152,7 +1154,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, nsymb = (frame_parms->Ncp == 0) ? 14 : 12; - if (!(IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) ) { + if (!IS_SOFTMODEM_BASICSIM) { ulsch_start = (ue->rx_offset+subframe_tx*frame_parms->samples_per_tti- ue->hw_timing_advance- ue->timing_advance- @@ -1183,7 +1185,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, } for (aa=0; aanb_antennas_tx; aa++) { - int *Buff = (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) ? &ue->common_vars.txdata[aa][ulsch_start] :dummy_tx_buffer; + int *Buff = IS_SOFTMODEM_BASICSIM ? &ue->common_vars.txdata[aa][ulsch_start] :dummy_tx_buffer; if (frame_parms->Ncp == 1) { PHY_ofdm_mod(&ue->common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size], @@ -1204,7 +1206,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, &ue->frame_parms); } - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) { + if (IS_SOFTMODEM_BASICSIM) { apply_7_5_kHz(ue,&ue->common_vars.txdata[aa][ulsch_start],0); apply_7_5_kHz(ue,&ue->common_vars.txdata[aa][ulsch_start],1); } else { @@ -1212,7 +1214,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, apply_7_5_kHz(ue,dummy_tx_buffer,1); } - if (!(IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) ) { + if (!(IS_SOFTMODEM_BASICSIM) ) { overflow = ulsch_start - 9*frame_parms->samples_per_tti; for (k=ulsch_start,l=0; ksamples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,ulsch_start+frame_parms->samples_per_tti); k++,l++) { @@ -1316,7 +1318,7 @@ void ue_prach_procedures(PHY_VARS_UE *ue, ue->prach_resources[eNB_id]->ra_RNTI); ue->tx_total_RE[subframe_tx] = 96; - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) { + if (IS_SOFTMODEM_BASICSIM) { ue->prach_vars[eNB_id]->amp = get_tx_amp(ue->tx_power_dBm[subframe_tx], ue->tx_power_max_dBm, ue->frame_parms.N_RB_UL, @@ -1690,7 +1692,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue, ue->tx_total_RE[subframe_tx] = nb_rb*12; - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) { + if (IS_SOFTMODEM_BASICSIM) { tx_amp = AMP; } else { tx_amp = get_tx_amp(ue->tx_power_dBm[subframe_tx], @@ -1767,7 +1769,7 @@ void ue_srs_procedures(PHY_VARS_UE *ue, Po_SRS = ue->tx_power_max_dBm; } - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) { + if (IS_SOFTMODEM_BASICSIM) { tx_amp = AMP; } else { if (ue->mac_enabled==1) { @@ -2010,7 +2012,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue, ue->tx_power_dBm[subframe_tx] = Po_PUCCH; ue->tx_total_RE[subframe_tx] = 12; - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) { + if (IS_SOFTMODEM_BASICSIM) { tx_amp = AMP; } else { tx_amp = get_tx_amp(Po_PUCCH, @@ -2091,7 +2093,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue, ue->tx_power_dBm[subframe_tx] = Po_PUCCH; ue->tx_total_RE[subframe_tx] = 12; - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) { + if (IS_SOFTMODEM_BASICSIM) { tx_amp = AMP; } else { tx_amp = get_tx_amp(Po_PUCCH, @@ -2346,7 +2348,7 @@ void ue_measurement_procedures(uint16_t l, // symbol index of each slot [0..6 // AGC VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_IN); - if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) + if (IS_SOFTMODEM_BASICSIM) phy_adjust_gain (ue,dB_fixed(ue->measurements.rssi),0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL, VCD_FUNCTION_OUT); @@ -2423,8 +2425,6 @@ void ue_pbch_procedures(uint8_t eNB_id, dummy[2] = ue->pbch_vars[eNB_id]->decoded_output[0]; trace_pdu( DIRECTION_DOWNLINK, dummy, WS_C_RNTI, ue->Mod_id, 0, 0, frame_rx, subframe_rx, 0, 0); - LOG_D(OPT,"[UE %d][PBCH] Frame %d trace pdu for PBCH\n", - ue->Mod_id, subframe_rx); } if (pbch_tx_ant>2) { @@ -2871,8 +2871,7 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, int abstraction_flag, - uint8_t fembms_flag - ) { + uint8_t fembms_flag) { int subframe_rx = proc->subframe_rx; int frame_rx = proc->frame_rx; int pmch_mcs=-1; @@ -3532,7 +3531,6 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, ue->dlsch_SI[eNB_id]->harq_processes[0]->b, ue->dlsch_SI[eNB_id]->harq_processes[0]->TBS>>3); } - break; case P_PDSCH: @@ -4401,6 +4399,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, void phy_procedures_UE_SL_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc) { } + int phy_procedures_UE_RX(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t eNB_id, @@ -4880,7 +4879,6 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, } - void phy_procedures_UE_lte(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t eNB_id, diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 2980187c42..7820ed8417 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -621,7 +621,7 @@ int main(int argc, char **argv) for (i = 0; i < 2; i++) { printf("gNB %d\n", i); - free_gNB_dlsch(gNB->dlsch[0][i]); + free_gNB_dlsch(&(gNB->dlsch[0][i])); printf("UE %d\n", i); free_nr_ue_dlsch(&(UE->dlsch[0][0][i])); } diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 8d8140e192..48df6d3f17 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -75,30 +75,28 @@ void config_common(int Mod_idP,int CC_idP,int Nid_cell,int nr_bandP,uint64_t SSB int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) {return(0);} uint64_t get_softmodem_optmask(void) {return 0;} -mac_rlc_status_resp_t mac_rlc_status_ind( const module_id_t module_idP, - const rnti_t rntiP, - const eNB_index_t eNB_index, - const frame_t frameP, - const sub_frame_t subframeP, - const eNB_flag_t enb_flagP, - const MBMS_flag_t MBMS_flagP, - const logical_chan_id_t channel_idP, - const tb_size_t tb_sizeP, - const uint32_t sourceL2Id, - const uint32_t destinationL2Id) -{mac_rlc_status_resp_t mac_rlc_status_resp={0}; return mac_rlc_status_resp;} -tbs_size_t mac_rlc_data_req( const module_id_t module_idP, - const rnti_t rntiP, - const eNB_index_t eNB_index, - const frame_t frameP, - const eNB_flag_t enb_flagP, - const MBMS_flag_t MBMS_flagP, - const logical_chan_id_t channel_idP, - const tb_size_t tb_sizeP, - char *buffer_pP, - const uint32_t sourceL2Id, - const uint32_t destinationL2Id ) -{return 0;} +mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP, + const rnti_t rntiP, + const eNB_index_t eNB_index, + const frame_t frameP, + const sub_frame_t subframeP, + const eNB_flag_t enb_flagP, + const MBMS_flag_t MBMS_flagP, + const logical_chan_id_t channel_idP, + const tb_size_t tb_sizeP, + const uint32_t sourceL2Id, + const uint32_t destinationL2Id) {mac_rlc_status_resp_t mac_rlc_status_resp = {0}; return mac_rlc_status_resp;} +tbs_size_t mac_rlc_data_req(const module_id_t module_idP, + const rnti_t rntiP, + const eNB_index_t eNB_index, + const frame_t frameP, + const eNB_flag_t enb_flagP, + const MBMS_flag_t MBMS_flagP, + const logical_chan_id_t channel_idP, + const tb_size_t tb_sizeP, + char *buffer_pP, + const uint32_t sourceL2Id, + const uint32_t destinationL2Id) {return 0;} int generate_dlsch_header(unsigned char *mac_header, unsigned char num_sdus, unsigned short *sdu_lengths, @@ -862,7 +860,7 @@ int main(int argc, char **argv) if (errors_scrambling > 0) { if (n_trials == 1) - printf("errors_scrambling = %d (trial %d)\n", errors_scrambling, trial); + printf("errors_scrambling = %u (trial %d)\n", errors_scrambling, trial); } if (errors_bit > 0) { diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index ec257f5ceb..4c4348dce9 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -81,9 +81,9 @@ #define MAX_eNB 2 #define MAX_gNB 2 #else - #define MAX_MOBILES_PER_ENB 16 - #define MAX_MOBILES_PER_ENB_NB_IoT 16 - #define MAX_MOBILES_PER_GNB 16 + #define MAX_MOBILES_PER_ENB 4 + #define MAX_MOBILES_PER_ENB_NB_IoT 4 + #define MAX_MOBILES_PER_GNB 4 #define MAX_eNB 2 #define MAX_gNB 2 #endif diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 2082663fce..06386adbb7 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -183,7 +183,7 @@ void RCconfig_L1(void) { if (RC.eNB[j] == NULL) { RC.eNB[j] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB **)); LOG_I(PHY,"RC.eNB[%d] = %p\n",j,RC.eNB[j]); - memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB ** *)); + memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB***)); } for (i=0; i0) { // Output a list of all eNBs. @@ -334,7 +335,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "f1") == 0) { paramdef_t SCTPParams[] = SCTPPARAMS_DESC; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; - sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,i,ENB_CONFIG_STRING_SCTP_CONFIG); + sprintf(aprefix,"%s.[%u].%s",ENB_CONFIG_STRING_ENB_LIST,i,ENB_CONFIG_STRING_SCTP_CONFIG); config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); rrc->node_id = *(ENBParamList.paramarray[0][ENB_ENB_ID_IDX].uptr); LOG_I(ENB_APP,"F1AP: gNB_CU_id[%d] %d\n",k,rrc->node_id); @@ -443,16 +444,16 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { // Cell params, MIB/SIB1 in DU RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = ccparams_lte.tdd_config; AssertFatal (ccparams_lte.tdd_config <= LTE_TDD_Config__subframeAssignment_sa6, - "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!", + "Failed to parse eNB configuration file %s, enb %u illegal tdd_config %d (should be 0-%d)!", RC.config_file_name, i, ccparams_lte.tdd_config, LTE_TDD_Config__subframeAssignment_sa6); RRC_CONFIGURATION_REQ (msg_p).tdd_config_s[j] = ccparams_lte.tdd_config_s; AssertFatal (ccparams_lte.tdd_config_s <= LTE_TDD_Config__specialSubframePatterns_ssp8, - "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %d (should be 0-%d)!", + "Failed to parse eNB configuration file %s, enb %u illegal tdd_config_s %d (should be 0-%d)!", RC.config_file_name, i, ccparams_lte.tdd_config_s, LTE_TDD_Config__specialSubframePatterns_ssp8); if (!ccparams_lte.prefix_type) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d define %s: NORMAL,EXTENDED!\n", + "Failed to parse eNB configuration file %s, enb %u define %s: NORMAL,EXTENDED!\n", RC.config_file_name, i, ENB_CONFIG_STRING_PREFIX_TYPE); else if (strcmp(ccparams_lte.prefix_type, "NORMAL") == 0) { RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = NORMAL; @@ -460,13 +461,13 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = EXTENDED; } else { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n", RC.config_file_name, i, ccparams_lte.prefix_type); } if (!ccparams_lte.pbch_repetition) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d define %s: TRUE,FALSE!\n", + "Failed to parse eNB configuration file %s, enb %u define %s: TRUE,FALSE!\n", RC.config_file_name, i, ENB_CONFIG_STRING_PBCH_REPETITION); else if (strcmp(ccparams_lte.pbch_repetition, "TRUE") == 0) { RRC_CONFIGURATION_REQ (msg_p).pbch_repetition[j] = 1; @@ -474,7 +475,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).pbch_repetition[j] = 0; } else { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pbch_repetition choice: TRUE or FALSE !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for pbch_repetition choice: TRUE or FALSE !\n", RC.config_file_name, i, ccparams_lte.pbch_repetition); } @@ -485,7 +486,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if (ccparams_lte.Nid_cell>503) { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for Nid_cell choice: 0...503 !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for Nid_cell choice: 0...503 !\n", RC.config_file_name, i, ccparams_lte.Nid_cell); } @@ -498,7 +499,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { (ccparams_lte.N_RB_DL!=75) && (ccparams_lte.N_RB_DL!=100)) { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for N_RB_DL choice: 6,15,25,50,75,100 !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for N_RB_DL choice: 6,15,25,50,75,100 !\n", RC.config_file_name, i, ccparams_lte.N_RB_DL); } @@ -508,7 +509,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).frame_type[j] = TDD; } else { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for frame_type choice: FDD or TDD !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for frame_type choice: FDD or TDD !\n", RC.config_file_name, i, ccparams_lte.frame_type); } @@ -522,7 +523,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.nb_antenna_ports <1) || (ccparams_lte.nb_antenna_ports > 2)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antenna_ports choice: 1..2 !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for nb_antenna_ports choice: 1..2 !\n", RC.config_file_name, i, ccparams_lte.nb_antenna_ports); RRC_CONFIGURATION_REQ (msg_p).nb_antenna_ports[j] = ccparams_lte.nb_antenna_ports; @@ -533,19 +534,19 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.prach_root <0) || (ccparams_lte.prach_root > 1023)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_root choice: 0..1023 !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for prach_root choice: 0..1023 !\n", RC.config_file_name, i, ccparams_lte.prach_root); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].prach_config_index = ccparams_lte.prach_config_index; if ((ccparams_lte.prach_config_index <0) || (ccparams_lte.prach_config_index > 63)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_config_index choice: 0..1023 !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for prach_config_index choice: 0..1023 !\n", RC.config_file_name, i, ccparams_lte.prach_config_index); if (!ccparams_lte.prach_high_speed) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n", + "Failed to parse eNB configuration file %s, enb %u define %s: ENABLE,DISABLE!\n", RC.config_file_name, i, ENB_CONFIG_STRING_PRACH_HIGH_SPEED); else if (strcmp(ccparams_lte.prach_high_speed, "ENABLE") == 0) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].prach_high_speed = TRUE; @@ -553,7 +554,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].prach_high_speed = FALSE; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prach_config choice: ENABLE,DISABLE !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for prach_config choice: ENABLE,DISABLE !\n", RC.config_file_name, i, ccparams_lte.prach_high_speed); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].prach_zero_correlation = ccparams_lte.prach_zero_correlation; @@ -561,7 +562,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.prach_zero_correlation <0) || (ccparams_lte.prach_zero_correlation > 15)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_zero_correlation choice: 0..15!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for prach_zero_correlation choice: 0..15!\n", RC.config_file_name, i, ccparams_lte.prach_zero_correlation); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].prach_freq_offset = ccparams_lte.prach_freq_offset; @@ -569,7 +570,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.prach_freq_offset <0) || (ccparams_lte.prach_freq_offset > 94)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_freq_offset choice: 0..94!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for prach_freq_offset choice: 0..94!\n", RC.config_file_name, i, ccparams_lte.prach_freq_offset); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_delta_shift = ccparams_lte.pucch_delta_shift-1; @@ -577,7 +578,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.pucch_delta_shift <1) || (ccparams_lte.pucch_delta_shift > 3)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_delta_shift choice: 1..3!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for pucch_delta_shift choice: 1..3!\n", RC.config_file_name, i, ccparams_lte.pucch_delta_shift); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_nRB_CQI = ccparams_lte.pucch_nRB_CQI; @@ -585,7 +586,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.pucch_nRB_CQI <0) || (ccparams_lte.pucch_nRB_CQI > 98)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nRB_CQI choice: 0..98!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for pucch_nRB_CQI choice: 0..98!\n", RC.config_file_name, i, ccparams_lte.pucch_nRB_CQI); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_nCS_AN = ccparams_lte.pucch_nCS_AN; @@ -593,7 +594,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.pucch_nCS_AN <0) || (ccparams_lte.pucch_nCS_AN > 7)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nCS_AN choice: 0..7!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for pucch_nCS_AN choice: 0..7!\n", RC.config_file_name, i, ccparams_lte.pucch_nCS_AN); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_n1_AN = ccparams_lte.pucch_n1_AN; @@ -601,7 +602,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.pucch_n1_AN <0) || (ccparams_lte.pucch_n1_AN > 2047)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_n1_AN choice: 0..2047!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for pucch_n1_AN choice: 0..2047!\n", RC.config_file_name, i, ccparams_lte.pucch_n1_AN); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pdsch_referenceSignalPower = ccparams_lte.pdsch_referenceSignalPower; @@ -609,7 +610,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.pdsch_referenceSignalPower <-60) || (ccparams_lte.pdsch_referenceSignalPower > 50)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pdsch_referenceSignalPower choice:-60..50!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for pdsch_referenceSignalPower choice:-60..50!\n", RC.config_file_name, i, ccparams_lte.pdsch_referenceSignalPower); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pdsch_p_b = ccparams_lte.pdsch_p_b; @@ -617,7 +618,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.pdsch_p_b <0) || (ccparams_lte.pdsch_p_b > 3)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pdsch_p_b choice: 0..3!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for pdsch_p_b choice: 0..3!\n", RC.config_file_name, i, ccparams_lte.pdsch_p_b); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_n_SB = ccparams_lte.pusch_n_SB; @@ -625,12 +626,12 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.pusch_n_SB <1) || (ccparams_lte.pusch_n_SB > 4)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_n_SB choice: 1..4!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for pusch_n_SB choice: 1..4!\n", RC.config_file_name, i, ccparams_lte.pusch_n_SB); if (!ccparams_lte.pusch_hoppingMode) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d define %s: interSubframe,intraAndInterSubframe!\n", + "Failed to parse eNB configuration file %s, enb %u define %s: interSubframe,intraAndInterSubframe!\n", RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_HOPPINGMODE); else if (strcmp(ccparams_lte.pusch_hoppingMode,"interSubFrame")==0) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_hoppingMode = LTE_PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame; @@ -638,7 +639,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_hoppingMode = LTE_PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_intraAndInterSubFrame; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_hoppingMode choice: interSubframe,intraAndInterSubframe!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for pusch_hoppingMode choice: interSubframe,intraAndInterSubframe!\n", RC.config_file_name, i, ccparams_lte.pusch_hoppingMode); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_hoppingOffset = ccparams_lte.pusch_hoppingOffset; @@ -646,12 +647,12 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.pusch_hoppingOffset<0) || (ccparams_lte.pusch_hoppingOffset>98)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_hoppingOffset choice: 0..98!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for pusch_hoppingOffset choice: 0..98!\n", RC.config_file_name, i, ccparams_lte.pusch_hoppingMode); if (!ccparams_lte.pusch_enable64QAM) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n", + "Failed to parse eNB configuration file %s, enb %u define %s: ENABLE,DISABLE!\n", RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_ENABLE64QAM); else if (strcmp(ccparams_lte.pusch_enable64QAM, "ENABLE") == 0) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_enable64QAM = TRUE; @@ -659,12 +660,12 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_enable64QAM = FALSE; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_enable64QAM choice: ENABLE,DISABLE!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for pusch_enable64QAM choice: ENABLE,DISABLE!\n", RC.config_file_name, i, ccparams_lte.pusch_enable64QAM); if (!ccparams_lte.pusch_groupHoppingEnabled) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n", + "Failed to parse eNB configuration file %s, enb %u define %s: ENABLE,DISABLE!\n", RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_GROUP_HOPPING_EN); else if (strcmp(ccparams_lte.pusch_groupHoppingEnabled, "ENABLE") == 0) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_groupHoppingEnabled = TRUE; @@ -672,7 +673,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_groupHoppingEnabled= FALSE; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_groupHoppingEnabled choice: ENABLE,DISABLE!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for pusch_groupHoppingEnabled choice: ENABLE,DISABLE!\n", RC.config_file_name, i, ccparams_lte.pusch_groupHoppingEnabled); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_groupAssignment = ccparams_lte.pusch_groupAssignment; @@ -680,12 +681,12 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.pusch_groupAssignment<0)|| (ccparams_lte.pusch_groupAssignment>29)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_groupAssignment choice: 0..29!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for pusch_groupAssignment choice: 0..29!\n", RC.config_file_name, i, ccparams_lte.pusch_groupAssignment); if (!ccparams_lte.pusch_sequenceHoppingEnabled) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n", + "Failed to parse eNB configuration file %s, enb %u define %s: ENABLE,DISABLE!\n", RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_SEQUENCE_HOPPING_EN); else if (strcmp(ccparams_lte.pusch_sequenceHoppingEnabled, "ENABLE") == 0) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_sequenceHoppingEnabled = TRUE; @@ -693,7 +694,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_sequenceHoppingEnabled = FALSE; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_sequenceHoppingEnabled choice: ENABLE,DISABLE!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for pusch_sequenceHoppingEnabled choice: ENABLE,DISABLE!\n", RC.config_file_name, i, ccparams_lte.pusch_sequenceHoppingEnabled); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_nDMRS1= ccparams_lte.pusch_nDMRS1; //cyclic_shift in RRC! @@ -701,7 +702,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.pusch_nDMRS1 <0) || (ccparams_lte.pusch_nDMRS1>7)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_nDMRS1 choice: 0..7!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for pusch_nDMRS1 choice: 0..7!\n", RC.config_file_name, i, ccparams_lte.pusch_nDMRS1); if (strcmp(ccparams_lte.phich_duration,"NORMAL")==0) { @@ -710,7 +711,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].phich_duration= LTE_PHICH_Config__phich_Duration_extended; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for phich_duration choice: NORMAL,EXTENDED!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for phich_duration choice: NORMAL,EXTENDED!\n", RC.config_file_name, i, ccparams_lte.phich_duration); if (strcmp(ccparams_lte.phich_resource,"ONESIXTH")==0) { @@ -723,7 +724,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].phich_resource= LTE_PHICH_Config__phich_Resource_two; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for phich_resource choice: ONESIXTH,HALF,ONE,TWO!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for phich_resource choice: ONESIXTH,HALF,ONE,TWO!\n", RC.config_file_name, i, ccparams_lte.phich_resource); printf("phich.resource %ld (%s), phich.duration %ld (%s)\n", @@ -736,7 +737,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].srs_enable= FALSE; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_BandwidthConfig choice: ENABLE,DISABLE !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for srs_BandwidthConfig choice: ENABLE,DISABLE !\n", RC.config_file_name, i, ccparams_lte.srs_enable); if (RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].srs_enable== TRUE) { @@ -744,7 +745,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.srs_BandwidthConfig < 0) || (ccparams_lte.srs_BandwidthConfig >7)) - AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value %d for srs_BandwidthConfig choice: 0...7\n", + AssertFatal (0, "Failed to parse eNB configuration file %s, enb %u unknown value %d for srs_BandwidthConfig choice: 0...7\n", RC.config_file_name, i, ccparams_lte.srs_BandwidthConfig); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].srs_SubframeConfig= ccparams_lte.srs_SubframeConfig; @@ -752,7 +753,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.srs_SubframeConfig<0) || (ccparams_lte.srs_SubframeConfig>15)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for srs_SubframeConfig choice: 0..15 !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for srs_SubframeConfig choice: 0..15 !\n", RC.config_file_name, i, ccparams_lte.srs_SubframeConfig); if (strcmp(ccparams_lte.srs_ackNackST, "ENABLE") == 0) { @@ -761,7 +762,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].srs_ackNackST= FALSE; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_BandwidthConfig choice: ENABLE,DISABLE !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for srs_BandwidthConfig choice: ENABLE,DISABLE !\n", RC.config_file_name, i, ccparams_lte.srs_ackNackST); if (strcmp(ccparams_lte.srs_MaxUpPts, "ENABLE") == 0) { @@ -770,7 +771,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].srs_MaxUpPts= FALSE; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_MaxUpPts choice: ENABLE,DISABLE !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for srs_MaxUpPts choice: ENABLE,DISABLE !\n", RC.config_file_name, i, ccparams_lte.srs_MaxUpPts); } @@ -779,7 +780,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.pusch_p0_Nominal<-126) || (ccparams_lte.pusch_p0_Nominal>24)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_p0_Nominal choice: -126..24 !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for pusch_p0_Nominal choice: -126..24 !\n", RC.config_file_name, i, ccparams_lte.pusch_p0_Nominal); if (strcmp(ccparams_lte.pusch_alpha,"AL0")==0) { @@ -800,7 +801,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pusch_alpha= LTE_Alpha_r12_al1; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_Alpha choice: AL0,AL04,AL05,AL06,AL07,AL08,AL09,AL1!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for pucch_Alpha choice: AL0,AL04,AL05,AL06,AL07,AL08,AL09,AL1!\n", RC.config_file_name, i, ccparams_lte.pusch_alpha); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_p0_Nominal= ccparams_lte.pucch_p0_Nominal; @@ -808,7 +809,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.pucch_p0_Nominal<-127) || (ccparams_lte.pucch_p0_Nominal>-96)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_p0_Nominal choice: -127..-96 !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for pucch_p0_Nominal choice: -127..-96 !\n", RC.config_file_name, i, ccparams_lte.pucch_p0_Nominal); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].msg3_delta_Preamble= ccparams_lte.msg3_delta_Preamble; @@ -816,7 +817,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.msg3_delta_Preamble<-1) || (ccparams_lte.msg3_delta_Preamble>6)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for msg3_delta_Preamble choice: -1..6 !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for msg3_delta_Preamble choice: -1..6 !\n", RC.config_file_name, i, ccparams_lte.msg3_delta_Preamble); if (strcmp(ccparams_lte.pucch_deltaF_Format1,"deltaF_2")==0) { @@ -827,7 +828,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_deltaF_Format1= LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF2; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format1 choice: deltaF_2,dltaF0,deltaF2!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for pucch_deltaF_Format1 choice: deltaF_2,dltaF0,deltaF2!\n", RC.config_file_name, i, ccparams_lte.pucch_deltaF_Format1); if (strcmp(ccparams_lte.pucch_deltaF_Format1b,"deltaF1")==0) { @@ -838,7 +839,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_deltaF_Format1b= LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF5; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format1b choice: deltaF1,dltaF3,deltaF5!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for pucch_deltaF_Format1b choice: deltaF1,dltaF3,deltaF5!\n", RC.config_file_name, i, ccparams_lte.pucch_deltaF_Format1b); if (strcmp(ccparams_lte.pucch_deltaF_Format2,"deltaF_2")==0) { @@ -851,7 +852,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_deltaF_Format2= LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF2; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format2 choice: deltaF_2,dltaF0,deltaF1,deltaF2!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for pucch_deltaF_Format2 choice: deltaF_2,dltaF0,deltaF1,deltaF2!\n", RC.config_file_name, i, ccparams_lte.pucch_deltaF_Format2); if (strcmp(ccparams_lte.pucch_deltaF_Format2a,"deltaF_2")==0) { @@ -862,7 +863,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_deltaF_Format2a= LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF2; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format2a choice: deltaF_2,dltaF0,deltaF2!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for pucch_deltaF_Format2a choice: deltaF_2,dltaF0,deltaF2!\n", RC.config_file_name, i, ccparams_lte.pucch_deltaF_Format2a); if (strcmp(ccparams_lte.pucch_deltaF_Format2b,"deltaF_2")==0) { @@ -873,7 +874,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pucch_deltaF_Format2b= LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF2; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format2b choice: deltaF_2,dltaF0,deltaF2!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for pucch_deltaF_Format2b choice: deltaF_2,dltaF0,deltaF2!\n", RC.config_file_name, i, ccparams_lte.pucch_deltaF_Format2b); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].rach_numberOfRA_Preambles= (ccparams_lte.rach_numberOfRA_Preambles/4)-1; @@ -882,7 +883,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { (ccparams_lte.rach_numberOfRA_Preambles>64) || ((ccparams_lte.rach_numberOfRA_Preambles&3)!=0)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_numberOfRA_Preambles choice: 4,8,12,...,64!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for rach_numberOfRA_Preambles choice: 4,8,12,...,64!\n", RC.config_file_name, i, ccparams_lte.rach_numberOfRA_Preambles); if (strcmp(ccparams_lte.rach_preamblesGroupAConfig, "ENABLE") == 0) { @@ -893,7 +894,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { (ccparams_lte.rach_numberOfRA_Preambles>60) || ((ccparams_lte.rach_numberOfRA_Preambles&3)!=0)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_sizeOfRA_PreamblesGroupA choice: 4,8,12,...,60!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for rach_sizeOfRA_PreamblesGroupA choice: 4,8,12,...,60!\n", RC.config_file_name, i, ccparams_lte.rach_sizeOfRA_PreamblesGroupA); switch (ccparams_lte.rach_messageSizeGroupA) { @@ -915,7 +916,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { default: AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_messageSizeGroupA choice: 56,144,208,256!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for rach_messageSizeGroupA choice: 56,144,208,256!\n", RC.config_file_name, i, ccparams_lte.rach_messageSizeGroupA); break; } @@ -938,13 +939,13 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].rach_messagePowerOffsetGroupB= LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB18; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rach_messagePowerOffsetGroupB choice: minusinfinity,dB0,dB5,dB8,dB10,dB12,dB15,dB18!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for rach_messagePowerOffsetGroupB choice: minusinfinity,dB0,dB5,dB8,dB10,dB12,dB15,dB18!\n", RC.config_file_name, i, ccparams_lte.rach_messagePowerOffsetGroupB); } else if (strcmp(ccparams_lte.rach_preamblesGroupAConfig, "DISABLE") == 0) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].rach_preamblesGroupAConfig= FALSE; } else AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rach_preamblesGroupAConfig choice: ENABLE,DISABLE !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for rach_preamblesGroupAConfig choice: ENABLE,DISABLE !\n", RC.config_file_name, i, ccparams_lte.rach_preamblesGroupAConfig); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].rach_preambleInitialReceivedTargetPower= (ccparams_lte.rach_preambleInitialReceivedTargetPower+120)/2; @@ -953,7 +954,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { (ccparams_lte.rach_preambleInitialReceivedTargetPower>-90) || ((ccparams_lte.rach_preambleInitialReceivedTargetPower&1)!=0)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_preambleInitialReceivedTargetPower choice: -120,-118,...,-90 !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for rach_preambleInitialReceivedTargetPower choice: -120,-118,...,-90 !\n", RC.config_file_name, i, ccparams_lte.rach_preambleInitialReceivedTargetPower); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].rach_powerRampingStep= ccparams_lte.rach_powerRampingStep/2; @@ -962,7 +963,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { (ccparams_lte.rach_powerRampingStep>6) || ((ccparams_lte.rach_powerRampingStep&1)!=0)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_powerRampingStep choice: 0,2,4,6 !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for rach_powerRampingStep choice: 0,2,4,6 !\n", RC.config_file_name, i, ccparams_lte.rach_powerRampingStep); switch (ccparams_lte.rach_preambleTransMax) { @@ -1012,7 +1013,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { default: AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_preambleTransMax choice: 3,4,5,6,7,8,10,20,50,100,200!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for rach_preambleTransMax choice: 3,4,5,6,7,8,10,20,50,100,200!\n", RC.config_file_name, i, ccparams_lte.rach_preambleTransMax); break; } @@ -1023,7 +1024,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { (ccparams_lte.rach_raResponseWindowSize==9)|| (ccparams_lte.rach_raResponseWindowSize>10)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_raResponseWindowSize choice: 2,3,4,5,6,7,8,10!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for rach_raResponseWindowSize choice: 2,3,4,5,6,7,8,10!\n", RC.config_file_name, i, ccparams_lte.rach_preambleTransMax); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].rach_macContentionResolutionTimer= (ccparams_lte.rach_macContentionResolutionTimer/8)-1; @@ -1032,7 +1033,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { (ccparams_lte.rach_macContentionResolutionTimer>64) || ((ccparams_lte.rach_macContentionResolutionTimer&7)!=0)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_macContentionResolutionTimer choice: 8,16,...,56,64!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for rach_macContentionResolutionTimer choice: 8,16,...,56,64!\n", RC.config_file_name, i, ccparams_lte.rach_preambleTransMax); RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].rach_maxHARQ_Msg3Tx= ccparams_lte.rach_maxHARQ_Msg3Tx; @@ -1040,7 +1041,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.rach_maxHARQ_Msg3Tx<0) || (ccparams_lte.rach_maxHARQ_Msg3Tx>8)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_maxHARQ_Msg3Tx choice: 1..8!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for rach_maxHARQ_Msg3Tx choice: 1..8!\n", RC.config_file_name, i, ccparams_lte.rach_preambleTransMax); switch (ccparams_lte.pcch_defaultPagingCycle) { @@ -1062,7 +1063,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { default: AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pcch_defaultPagingCycle choice: 32,64,128,256!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for pcch_defaultPagingCycle choice: 32,64,128,256!\n", RC.config_file_name, i, ccparams_lte.pcch_defaultPagingCycle); break; } @@ -1084,7 +1085,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { } else if (strcmp(ccparams_lte.pcch_nB, "oneThirtySecondT") == 0) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].pcch_nB= LTE_PCCH_Config__nB_oneThirtySecondT; } else { - AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pcch_nB choice: fourT,twoT,oneT,halfT,quarterT,oneighthT,oneSixteenthT,oneThirtySecondT !\n", + AssertFatal (0, "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for pcch_nB choice: fourT,twoT,oneT,halfT,quarterT,oneighthT,oneSixteenthT,oneThirtySecondT !\n", RC.config_file_name, i, ccparams_lte.pcch_nB); @@ -1098,7 +1099,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].drx_Config_present = LTE_DRX_Config_PR_setup; } else { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for drx_Config_present choice: prNothing, prRelease, prSetup!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for drx_Config_present choice: prNothing, prRelease, prSetup!\n", RC.config_file_name, i, ccparams_lte.drx_Config_present); } @@ -1136,7 +1137,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].drx_onDurationTimer = (long) LTE_DRX_Config__setup__onDurationTimer_psf200; } else { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for drx_onDurationTimer choice !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for drx_onDurationTimer choice !\n", RC.config_file_name, i, ccparams_lte.drx_onDurationTimer); break; } @@ -1207,7 +1208,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].drx_InactivityTimer = (long) LTE_DRX_Config__setup__drx_InactivityTimer_spare1; } else { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for drx_InactivityTimer choice !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for drx_InactivityTimer choice !\n", RC.config_file_name, i, ccparams_lte.drx_InactivityTimer); break; } @@ -1216,7 +1217,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if (!ccparams_lte.mbms_dedicated_serving_cell) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d define %s: TRUE,FALSE!\n", + "Failed to parse eNB configuration file %s, enb %u define %s: TRUE,FALSE!\n", RC.config_file_name, i, ENB_CONFIG_STRING_MBMS_DEDICATED_SERVING_CELL); else if (strcmp(ccparams_lte.mbms_dedicated_serving_cell, "ENABLE") == 0) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].mbms_dedicated_serving_cell = TRUE; @@ -1224,7 +1225,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].mbms_dedicated_serving_cell = FALSE; } else { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for mbms_dedicated_serving_cell choice: TRUE or FALSE !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for mbms_dedicated_serving_cell choice: TRUE or FALSE !\n", RC.config_file_name, i, ccparams_lte.mbms_dedicated_serving_cell); } @@ -1233,7 +1234,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.ue_multiple_max < 1) || (ccparams_lte.ue_multiple_max > 4)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..4!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for ue_multiple_max choice: 1..4!\n", RC.config_file_name, i, ccparams_lte.ue_multiple_max); break; @@ -1242,7 +1243,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.ue_multiple_max < 1) || (ccparams_lte.ue_multiple_max > 8)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..8!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for ue_multiple_max choice: 1..8!\n", RC.config_file_name, i, ccparams_lte.ue_multiple_max); break; @@ -1251,14 +1252,14 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.ue_multiple_max < 1) || (ccparams_lte.ue_multiple_max > 16)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..16!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for ue_multiple_max choice: 1..16!\n", RC.config_file_name, i, ccparams_lte.ue_multiple_max); break; default: AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for N_RB_DL choice: 25,50,100 !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for N_RB_DL choice: 25,50,100 !\n", RC.config_file_name, i, ccparams_lte.N_RB_DL); break; } @@ -1281,7 +1282,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].drx_RetransmissionTimer = (long) LTE_DRX_Config__setup__drx_RetransmissionTimer_psf33; } else { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for drx_RetransmissionTimer choice !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%s\" for drx_RetransmissionTimer choice !\n", RC.config_file_name, i, ccparams_lte.drx_RetransmissionTimer); break; } @@ -1339,7 +1340,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { offsetMaxLimit = 2560; } else { AssertFatal (0, - "Failed to parse eNB configuration file \"%s\", enb %d unknown string value \"%s\" for drx_longDrx_CycleStartOffset_present choice !\n", + "Failed to parse eNB configuration file \"%s\", enb %u unknown string value \"%s\" for drx_longDrx_CycleStartOffset_present choice !\n", RC.config_file_name, i, ccparams_lte.drx_longDrx_CycleStartOffset_present); } @@ -1347,7 +1348,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].drx_longDrx_CycleStartOffset = ccparams_lte.drx_longDrx_CycleStartOffset; } else { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d incoherent value \"%d\" for drx_longDrx_CycleStartOffset !\n", + "Failed to parse eNB configuration file %s, enb %u incoherent value \"%d\" for drx_longDrx_CycleStartOffset !\n", RC.config_file_name, i, ccparams_lte.drx_longDrx_CycleStartOffset); } } @@ -1355,7 +1356,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if (strcmp(ccparams_lte.drx_shortDrx_Cycle, "") == 0 || ccparams_lte.drx_shortDrx_ShortCycleTimer == 0) { if (strcmp(ccparams_lte.drx_shortDrx_Cycle, "") != 0 || ccparams_lte.drx_shortDrx_ShortCycleTimer != 0) { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d incoherent values \"%s\" - \"%d\" for drx_shortDrx_Cycle or drx_shortDrx_ShortCycleTimer choice !\n", + "Failed to parse eNB configuration file %s, enb %u incoherent values \"%s\" - \"%d\" for drx_shortDrx_Cycle or drx_shortDrx_ShortCycleTimer choice !\n", RC.config_file_name, i, ccparams_lte.drx_shortDrx_Cycle, ccparams_lte.drx_shortDrx_ShortCycleTimer); } else { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].drx_shortDrx_Cycle = -1; @@ -1412,13 +1413,13 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].drx_shortDrx_Cycle = LTE_DRX_Config__setup__shortDRX__shortDRX_Cycle_sf640; } else { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d incoherent value \"%s\" for drx_shortDrx_Cycle !\n", + "Failed to parse eNB configuration file %s, enb %u incoherent value \"%s\" for drx_shortDrx_Cycle !\n", RC.config_file_name, i, ccparams_lte.drx_shortDrx_Cycle); } if (cycleNb > 0 && (offsetMaxLimit % cycleNb != 0 || cycleNb == offsetMaxLimit)) { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d incompatible (not multiple) values \"%d\" - \"%d\" for drx_shortDrx_Cycle and drx_longDrx_CycleStartOffset choice !\n", + "Failed to parse eNB configuration file %s, enb %u incompatible (not multiple) values \"%d\" - \"%d\" for drx_shortDrx_Cycle and drx_longDrx_CycleStartOffset choice !\n", RC.config_file_name, i, cycleNb, offsetMaxLimit); } @@ -1426,7 +1427,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].drx_shortDrx_ShortCycleTimer = ccparams_lte.drx_shortDrx_ShortCycleTimer; } else { AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for drx_shortDrx_ShortCycleTimer choice !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for drx_shortDrx_ShortCycleTimer choice !\n", RC.config_file_name, i, ccparams_lte.drx_shortDrx_ShortCycleTimer ); } } @@ -1450,7 +1451,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { default: AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for bcch_modificationPeriodCoeff choice: 2,4,8,16", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for bcch_modificationPeriodCoeff choice: 2,4,8,16", RC.config_file_name, i, ccparams_lte.bcch_modificationPeriodCoeff); break; } @@ -1493,7 +1494,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { default: AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TransmissionMode choice: 1,2,3,4,5,6,7", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for ue_TransmissionMode choice: 1,2,3,4,5,6,7", RC.config_file_name, i, ccparams_lte.ue_TransmissionMode); break; } @@ -1505,7 +1506,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.ue_multiple_max < 1) || (ccparams_lte.ue_multiple_max > 4)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..4!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for ue_multiple_max choice: 1..4!\n", RC.config_file_name, i, ccparams_lte.ue_multiple_max); break; @@ -1514,7 +1515,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.ue_multiple_max < 1) || (ccparams_lte.ue_multiple_max > 8)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..8!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for ue_multiple_max choice: 1..8!\n", RC.config_file_name, i, ccparams_lte.ue_multiple_max); break; @@ -1523,14 +1524,14 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if ((ccparams_lte.ue_multiple_max < 1) || (ccparams_lte.ue_multiple_max > 16)) AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..16!\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for ue_multiple_max choice: 1..16!\n", RC.config_file_name, i, ccparams_lte.ue_multiple_max); break; default: AssertFatal (0, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for N_RB_DL choice: 25,50,100 !\n", + "Failed to parse eNB configuration file %s, enb %u unknown value \"%d\" for N_RB_DL choice: 25,50,100 !\n", RC.config_file_name, i, ccparams_lte.N_RB_DL); break; } @@ -1599,7 +1600,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { default: AssertFatal (0, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_max_retx_threshold %u!\n", + "Bad config value when parsing eNB configuration file %s, enb %u srb1_max_retx_threshold %d!\n", RC.config_file_name, i, srb1_params.srb1_max_retx_threshold); } @@ -1637,7 +1638,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { rrc->srb1_poll_pdu = LTE_PollPDU_pInfinity; else AssertFatal (0, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_pdu %u!\n", + "Bad config value when parsing eNB configuration file %s, enb %u srb1_poll_pdu %d!\n", RC.config_file_name, i, srb1_params.srb1_poll_pdu); } @@ -1705,7 +1706,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { rrc->srb1_poll_byte = LTE_PollByte_kBinfinity; else AssertFatal (0, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_byte %u!\n", + "Bad config value when parsing eNB configuration file %s, enb %u srb1_poll_byte %d!\n", RC.config_file_name, i, srb1_params.srb1_poll_byte); } @@ -1715,7 +1716,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { rrc->srb1_timer_poll_retransmit = (srb1_params.srb1_timer_poll_retransmit - 300)/50 + 50; } else { AssertFatal (0, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_poll_retransmit %u!\n", + "Bad config value when parsing eNB configuration file %s, enb %u srb1_timer_poll_retransmit %d!\n", RC.config_file_name, i, srb1_params.srb1_timer_poll_retransmit); } @@ -1725,7 +1726,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { rrc->srb1_timer_status_prohibit = (srb1_params.srb1_timer_status_prohibit - 300)/50 + 51; } else { AssertFatal (0, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_status_prohibit %u!\n", + "Bad config value when parsing eNB configuration file %s, enb %u srb1_timer_status_prohibit %d!\n", RC.config_file_name, i, srb1_params.srb1_timer_status_prohibit); } @@ -1856,7 +1857,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { default: AssertFatal (0, - "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_reordering %u!\n", + "Bad config value when parsing eNB configuration file %s, enb %u srb1_timer_reordering %d!\n", RC.config_file_name, i, srb1_params.srb1_timer_reordering); } } @@ -1879,13 +1880,13 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL); int num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt; AssertFatal (i0) { // Output a list of all eNBs. config_getlist( &ENBParamList,ENBParams,sizeof(ENBParams)/sizeof(paramdef_t),NULL); AssertFatal(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr != NULL, - "eNB id %d is not defined in configuration file\n",i); + "eNB id %u is not defined in configuration file\n",i); F1AP_SETUP_REQ (msg_p).num_cells_available = 0; for (k=0; k ulsch_pdu.ulsch_pdu_rel8.size = get_TBS_UL (ra->msg3_mcs, ra->msg3_nb_rb); // Re13 fields ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.ue_type = ra->rach_resource_type > 2 ? 2 : 1; + if (ra->rach_resource_type > 0) { - pusch_maxNumRepetitionCEmodeA_r13= *(rrc->configuration.pusch_maxNumRepetitionCEmodeA_r13[CC_id]); - ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions= pusch_repetition_Table8_2_36213[pusch_maxNumRepetitionCEmodeA_r13][ra->pusch_repetition_levels]; - } - else{ - ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions=1; + pusch_maxNumRepetitionCEmodeA_r13= *(rrc->configuration.pusch_maxNumRepetitionCEmodeA_r13[CC_id]); + ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions= pusch_repetition_Table8_2_36213[pusch_maxNumRepetitionCEmodeA_r13][ra->pusch_repetition_levels]; + } else { + ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions=1; } + ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number = 1; ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io = (ra->Msg3_frame * 10) + ra->Msg3_subframe; ul_req_body->number_of_pdus++; @@ -269,10 +270,9 @@ void generate_Msg2(module_id_t module_idP, uint16_t absSF_Msg2 = (10 * ra->Msg2_frame) + ra->Msg2_subframe; if (ra->rach_resource_type > 0) { - PUSCH_Rep_Level= *(rrc->configuration.pusch_repetitionLevelCEmodeA_r13[CC_idP]); - } - else { - PUSCH_Rep_Level= 0; + PUSCH_Rep_Level= *(rrc->configuration.pusch_repetitionLevelCEmodeA_r13[CC_idP]); + } else { + PUSCH_Rep_Level= 0; } if (absSF > absSF_Msg2) { @@ -415,7 +415,7 @@ void generate_Msg2(module_id_t module_idP, } ra->pusch_repetition_levels = PUSCH_Rep_Level; - + if((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) { /* Program PDSCH */ LOG_D(MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming PDSCH\n", @@ -902,11 +902,10 @@ generate_Msg4(module_id_t module_idP, ul_req_body->number_of_pdus++; T (T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT (module_idP), T_INT (CC_idP), T_INT (ra->rnti), T_INT (frameP), T_INT (subframeP), T_INT (0 /*harq_pid always 0? */ ), T_BUFFER (&mac->UE_list.DLSCH_pdu[CC_idP][0][UE_id].payload[0], ra->msg4_TBsize)); - - if (opt_enabled == 1) { - trace_pdu (1, (uint8_t *) mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0], ra->msg4_rrc_sdu_length, UE_id, 3, UE_RNTI (module_idP, UE_id), mac->frame, mac->subframe, 0, 0); - LOG_D (OPT, "[eNB %d][DLSCH] CC_id %d Frame %d trace pdu for rnti %x with size %d\n", module_idP, CC_idP, frameP, UE_RNTI (module_idP, UE_id), ra->msg4_rrc_sdu_length); - } + trace_pdu (DIRECTION_DOWNLINK, (uint8_t *) mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0], + ra->msg4_rrc_sdu_length, + UE_id, 3, UE_RNTI (module_idP, UE_id), + mac->frame, mac->subframe, 0, 0); } // Msg4 frame/subframe } // rach_resource_type > 0 else { @@ -1079,20 +1078,12 @@ generate_Msg4(module_id_t module_idP, T_INT(subframeP), T_INT(0 /*harq_pid always 0? */ ), T_BUFFER(&mac->UE_list.DLSCH_pdu[CC_idP][0][UE_id]. payload[0], ra->msg4_TBsize)); - - if (opt_enabled == 1) { - trace_pdu(DIRECTION_DOWNLINK, - (uint8_t *) mac-> - UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0], - rrc_sdu_length, UE_id, WS_C_RNTI, - UE_RNTI(module_idP, UE_id), mac->frame, - mac->subframe, 0, 0); - LOG_D(OPT, - "[eNB %d][DLSCH] CC_id %d Frame %d trace pdu for rnti %x with size %d\n", - module_idP, CC_idP, frameP, UE_RNTI(module_idP, - UE_id), - rrc_sdu_length); - } + trace_pdu(DIRECTION_DOWNLINK, + (uint8_t *) mac-> + UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0], + rrc_sdu_length, UE_id, WS_C_RNTI, + UE_RNTI(module_idP, UE_id), mac->frame, + mac->subframe, 0, 0); if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR) { set_dl_ue_select_msg4(CC_idP, 4, UE_id, ra->rnti); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c index 469aade040..f5cd3a0753 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c @@ -26,7 +26,6 @@ * \email: navid.nikaein@eurecom.fr * \version 1.0 * @ingroup _mac - */ #include "assertions.h" @@ -279,16 +278,10 @@ schedule_SIB1_MBMS(module_id_t module_idP, eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG; eNB->TX_req[CC_id].tx_request_body.number_of_pdus++; eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST; - - if (opt_enabled == 1) { - trace_pdu(DIRECTION_DOWNLINK, - &cc->BCCH_BR_pdu[0].payload[0], - bcch_sdu_length, - 0xffff, WS_SI_RNTI, 0xffff, eNB->frame, eNB->subframe, 0, 0); - LOG_D(OPT, - "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n", - module_idP, frameP, CC_id, 0xffff, bcch_sdu_length); - } + trace_pdu(DIRECTION_DOWNLINK, + &cc->BCCH_BR_pdu[0].payload[0], + bcch_sdu_length, + 0xffff, WS_SI_RNTI, 0xffff, eNB->frame, eNB->subframe, 0, 0); if (cc->tdd_Config != NULL) { //TDD LOG_D(MAC, @@ -509,16 +502,10 @@ schedule_SIB1_BR(module_id_t module_idP, eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG; eNB->TX_req[CC_id].tx_request_body.number_of_pdus++; eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST; - - if (opt_enabled == 1) { - trace_pdu(DIRECTION_DOWNLINK, - &cc->BCCH_BR_pdu[0].payload[0], - bcch_sdu_length, - 0xffff, WS_SI_RNTI, 0xffff, eNB->frame, eNB->subframe, 0, 0); - LOG_D(OPT, - "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n", - module_idP, frameP, CC_id, 0xffff, bcch_sdu_length); - } + trace_pdu(DIRECTION_DOWNLINK, + &cc->BCCH_BR_pdu[0].payload[0], + bcch_sdu_length, + 0xffff, WS_SI_RNTI, 0xffff, eNB->frame, eNB->subframe, 0, 0); if (cc->tdd_Config != NULL) { //TDD LOG_D(MAC, @@ -696,18 +683,13 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP, TX_req->segments[0].segment_length = bcch_sdu_length; TX_req->segments[0].segment_data = cc->BCCH_BR_pdu[i+1].payload; eNB->TX_req[CC_id].tx_request_body.number_of_pdus++; - - if (opt_enabled == 1) { - trace_pdu(DIRECTION_DOWNLINK, - &cc->BCCH_BR_pdu[i + 1].payload[0], - bcch_sdu_length, - 0xffff, - WS_SI_RNTI, - 0xffff, eNB->frame, eNB->subframe, 0, - 0); - LOG_D(OPT, "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n", - module_idP, frameP, CC_id, 0xffff, bcch_sdu_length); - } + trace_pdu(DIRECTION_DOWNLINK, + &cc->BCCH_BR_pdu[i + 1].payload[0], + bcch_sdu_length, + 0xffff, + WS_SI_RNTI, + 0xffff, eNB->frame, eNB->subframe, 0, + 0); if (cc->tdd_Config != NULL) { //TDD LOG_D(MAC, "[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (TDD) for CC_id %d SI-BR %d bytes\n", @@ -901,18 +883,11 @@ schedule_SI_MBMS(module_id_t module_idP, frame_t frameP, T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(0xffff), T_INT(frameP), T_INT(subframeP), T_INT(0), T_BUFFER(cc->BCCH_MBMS_pdu.payload, bcch_sdu_length)); - - if (opt_enabled == 1) { - trace_pdu(DIRECTION_DOWNLINK, - &cc->BCCH_MBMS_pdu.payload[0], - bcch_sdu_length, - 0xffff, - WS_SI_RNTI, 0xffff, eNB->frame, eNB->subframe, 0, 0); - LOG_D(OPT, - "[eNB %d][BCH-MBMS] Frame %d trace pdu for CC_id %d rnti %x with size %d\n", - module_idP, frameP, CC_id, 0xffff, - bcch_sdu_length); - } + trace_pdu(DIRECTION_DOWNLINK, + &cc->BCCH_MBMS_pdu.payload[0], + bcch_sdu_length, + 0xffff, + WS_SI_RNTI, 0xffff, eNB->frame, eNB->subframe, 0, 0); if (0/*cc->tdd_Config != NULL*/) { //TDD not for FeMBMS LOG_D(MAC, @@ -1177,18 +1152,11 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(0xffff), T_INT(frameP), T_INT(subframeP), T_INT(0), T_BUFFER(cc->BCCH_pdu.payload, bcch_sdu_length)); - - if (opt_enabled == 1) { - trace_pdu(DIRECTION_DOWNLINK, - &cc->BCCH_pdu.payload[0], - bcch_sdu_length, - 0xffff, - WS_SI_RNTI, 0xffff, eNB->frame, eNB->subframe, 0, 0); - LOG_D(OPT, - "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n", - module_idP, frameP, CC_id, 0xffff, - bcch_sdu_length); - } + trace_pdu(DIRECTION_DOWNLINK, + &cc->BCCH_pdu.payload[0], + bcch_sdu_length, + 0xffff, + WS_SI_RNTI, 0xffff, eNB->frame, eNB->subframe, 0, 0); if (cc->tdd_Config != NULL) { //TDD LOG_D(MAC, diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index 398915e36f..c717f8b901 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -1398,27 +1398,17 @@ schedule_ue_spec(module_id_t module_idP, dlsch_pdu->payload[0][offset + sdu_length_total + j] = 0; } - if (opt_enabled == 1) { - trace_pdu(DIRECTION_DOWNLINK, - (uint8_t *) dlsch_pdu->payload[0], - TBS, - module_idP, - WS_C_RNTI, - UE_RNTI(module_idP, - UE_id), - eNB->frame, - eNB->subframe, - 0, - 0); - LOG_D(OPT, "[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n", - module_idP, - CC_id, - frameP, - UE_RNTI(module_idP, - UE_id), - TBS); - } - + trace_pdu(DIRECTION_DOWNLINK, + (uint8_t *) dlsch_pdu->payload[0], + TBS, + module_idP, + WS_C_RNTI, + UE_RNTI(module_idP, + UE_id), + eNB->frame, + eNB->subframe, + 0, + 0); T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), @@ -1482,7 +1472,7 @@ schedule_ue_spec(module_id_t module_idP, tpc = 1; //0 } - LOG_D(MAC, "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, snr/target snr %d/%d\n", + LOG_D(MAC, "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, snr/target snr %d/%d (normal case)\n", module_idP, frameP, subframeP, @@ -2319,25 +2309,16 @@ schedule_ue_spec_br(module_id_t module_idP, UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = (char)(taus()&0xff); } - if (opt_enabled == 1) { - trace_pdu(1, - (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], - TBS, - module_idP, - 3, - UE_RNTI(module_idP,UE_id), - mac->frame, - mac->subframe, - 0, - 0); - LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n", - module_idP, - CC_id, - frameP, - UE_RNTI(module_idP, UE_id), - TBS); - } - + trace_pdu(DIRECTION_DOWNLINK, + (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], + TBS, + module_idP, + 3, + UE_RNTI(module_idP,UE_id), + mac->frame, + mac->subframe, + 0, + 0); T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), @@ -2530,25 +2511,16 @@ schedule_ue_spec_br(module_id_t module_idP, T_INT (subframeP), T_INT (0 /* harq_pid always 0? */ ), T_BUFFER (&mac->UE_list.DLSCH_pdu[CC_id][0][UE_id].payload[0], TX_req->pdu_length)); - - if (opt_enabled == 1) { - trace_pdu(1, - (uint8_t *) mac->UE_list.DLSCH_pdu[CC_id][0][(unsigned char) UE_id].payload[0], - TX_req->pdu_length, - UE_id, - 3, - rnti, - frameP, - subframeP, - 0, - 0); - LOG_D(OPT, "[eNB %d][DLSCH] CC_id %d Frame %d trace pdu for rnti %x with size %d\n", - module_idP, - CC_id, - frameP, - rnti, - TX_req->pdu_length); - } + trace_pdu(1, + (uint8_t *) mac->UE_list.DLSCH_pdu[CC_id][0][(unsigned char) UE_id].payload[0], + TX_req->pdu_length, + UE_id, + 3, + rnti, + frameP, + subframeP, + 0, + 0); } // end else if ((subframeP == 7) && (round_DL < 8)) } // end loop on UE_id } @@ -3145,25 +3117,16 @@ schedule_PCH(module_id_t module_idP, continue; } - if (opt_enabled == 1) { - trace_pdu(DIRECTION_DOWNLINK, - &eNB->common_channels[CC_id].PCCH_pdu.payload[0], - pcch_sdu_length, - 0xffff, - PCCH, - P_RNTI, - eNB->frame, - eNB->subframe, - 0, - 0); - LOG_D(OPT,"[eNB %d][PCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n", - module_idP, - frameP, - CC_id, - 0xffff, - pcch_sdu_length); - } - + trace_pdu(DIRECTION_DOWNLINK, + &eNB->common_channels[CC_id].PCCH_pdu.payload[0], + pcch_sdu_length, + 0xffff, + PCCH, + P_RNTI, + eNB->frame, + eNB->subframe, + 0, + 0); eNB->eNB_stats[CC_id].total_num_pcch_pdu++; eNB->eNB_stats[CC_id].pcch_buffer = pcch_sdu_length; eNB->eNB_stats[CC_id].total_pcch_buffer += pcch_sdu_length; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 04757dab16..8d887409e1 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -1681,14 +1681,9 @@ schedule_ue_spec_fairRR(module_id_t module_idP, UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset+sdu_length_total+j] = (char)(taus()&0xff); } - if (opt_enabled == 1) { - trace_pdu(DIRECTION_DOWNLINK, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], - TBS, module_idP, WS_RA_RNTI, UE_RNTI(module_idP, UE_id), - eNB->frame, eNB->subframe,0,0); - LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n", - module_idP, CC_id, frameP, UE_RNTI(module_idP, UE_id), TBS); - } - + trace_pdu(DIRECTION_DOWNLINK, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], + TBS, module_idP, WS_RA_RNTI, UE_RNTI(module_idP, UE_id), + eNB->frame, eNB->subframe,0,0); T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP), T_INT(harq_pid), T_BUFFER(UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], TBS)); UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; @@ -1974,6 +1969,7 @@ void ulsch_scheduler_pre_ue_select_fairRR( int format_flag; nfapi_hi_dci0_request_body_t *HI_DCI0_req; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu; + int rrc_status; for ( CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++ ) { //save ulsch dci number @@ -2069,9 +2065,11 @@ void ulsch_scheduler_pre_ue_select_fairRR( } UE_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + rrc_status = mac_eNB_get_rrc_status(module_idP, rnti); if ( ((UE_sched_ctl->ul_inactivity_timer>20)&&(UE_sched_ctl->ul_scheduled==0)) || - ((UE_sched_ctl->ul_inactivity_timer>10)&&(UE_sched_ctl->ul_scheduled==0)&&(mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP,UE_id)) < RRC_CONNECTED))) { + ((UE_sched_ctl->ul_inactivity_timer>10)&&(UE_sched_ctl->ul_scheduled==0)&&(rrc_status < RRC_CONNECTED)) || + ((UE_sched_ctl->cqi_req_timer>300)&&((rrc_status >= RRC_CONNECTED))) ) { first_ue_id[CC_id][ue_first_num[CC_id]]= UE_id; first_ue_total[CC_id] [ue_first_num[CC_id]] = 0; ue_first_num[CC_id]++; @@ -2176,10 +2174,12 @@ void ulsch_scheduler_pre_ue_select_fairRR( int bytes_to_schedule = UE_list->UE_template[CC_id][UE_id].estimated_ul_buffer - UE_list->UE_template[CC_id][UE_id].scheduled_ul_bytes; if (bytes_to_schedule < 0) bytes_to_schedule = 0; + rrc_status = mac_eNB_get_rrc_status(module_idP, rnti); if ( (bytes_to_schedule > 0) || (UE_list->UE_template[CC_id][UE_id].ul_SR > 0) || ((UE_sched_ctl->ul_inactivity_timer>20)&&(UE_sched_ctl->ul_scheduled==0)) || - ((UE_sched_ctl->ul_inactivity_timer>10)&&(UE_sched_ctl->ul_scheduled==0)&&(mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP,UE_id)) < RRC_CONNECTED)) ) { + ((UE_sched_ctl->ul_inactivity_timer>10)&&(UE_sched_ctl->ul_scheduled==0)&&(rrc_status < RRC_CONNECTED)) || + ((UE_sched_ctl->cqi_req_timer>300)&&((rrc_status >= RRC_CONNECTED))) ) { hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi]; format_flag = 2; aggregation=get_aggregation(get_bw_index(module_idP,CC_id),UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0); @@ -2761,19 +2761,25 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, if (status < RRC_CONNECTED) cqi_req = 0; - else if (UE_sched_ctrl->cqi_req_timer>30) { + else if (UE_sched_ctrl->cqi_received == 1){ + LOG_D(MAC,"Clearing CQI request timer\n"); + UE_sched_ctrl->cqi_req_flag = 0; + UE_sched_ctrl->cqi_received = 0; + UE_sched_ctrl->cqi_req_timer = 0; + cqi_req = 0; + }else if (UE_sched_ctrl->cqi_req_timer>30) { cqi_req = 1; // To be safe , do not ask CQI in special SFs:36.213/7.2.3 CQI definition if (cc->tdd_Config) { switch (cc->tdd_Config->subframeAssignment) { case 1: - if( sched_subframeP == 1 || sched_subframeP == 6 ) cqi_req=0; + if( subframeP == 1 || subframeP == 6 ) cqi_req=0; break; case 3: - if( sched_subframeP == 1 ) cqi_req=0; + if( subframeP == 1 ) cqi_req=0; break; @@ -2784,7 +2790,6 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, } if(cqi_req == 1) { - UE_sched_ctrl->cqi_req_timer=0; UE_sched_ctrl->cqi_req_flag |= 1 << sched_subframeP; } } else @@ -2818,7 +2823,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, } if (tpc!=1) { - LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n", + LOG_D(MAC,"[eNB %d] ULSCH schedulerRR: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n", module_idP,frameP,subframeP,harq_pid,tpc, tpc_accumulated,snr,target_snr); } @@ -2863,6 +2868,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, //store for possible retransmission UE_template->nb_rb_ul[harq_pid] = rb_table[rb_table_index]; UE_template->first_rb_ul[harq_pid] = first_rb[CC_id]; + UE_template->cqi_req[harq_pid] = cqi_req; UE_sched_ctrl->ul_scheduled |= (1<head) @@ -3030,6 +3036,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, //store for possible retransmission UE_template->nb_rb_ul[harq_pid] = ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; UE_template->first_rb_ul[harq_pid] = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb; + cqi_req = UE_template->cqi_req[harq_pid]; UE_sched_ctrl->ul_scheduled |= (1<= MAX_MBSFN_AREA) { LOG_W(MAC, @@ -81,9 +79,8 @@ get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id, } } -int -schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, - sub_frame_t subframeP) { + +int schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, sub_frame_t subframeP) { int mcch_flag = 0, mtch_flag = 0, msi_flag = 0; int mbsfn_period = 0; // 1<<(RC.mac[module_idP]->mbsfn_SubframeConfig[0]->radioframeAllocationPeriod); int mcch_period = 0; //32<<(RC.mac[module_idP]->mbsfn_AreaInfo[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9); @@ -734,15 +731,8 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, } /* Tracing of PDU is done on UE side */ - if (opt_enabled == 1) { - trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) cc->MCH_pdu.payload, TBS, module_idP, WS_M_RNTI, 0xffff, // M_RNTI = 6 in wirehsark - RC.mac[module_idP]->frame, - RC.mac[module_idP]->subframe, 0, 0); - LOG_D(OPT, - "[eNB %d][MCH] CC_id %d Frame %d : MAC PDU with size %d\n", - module_idP, CC_id, frameP, TBS); - } - + trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) cc->MCH_pdu.payload, TBS, module_idP, WS_M_RNTI, 0xffff, // M_RNTI = 6 in wireshark + RC.mac[module_idP]->frame, RC.mac[module_idP]->subframe, 0, 0); /* for (j=0;jMCH_pdu.payload[j+offset]); @@ -771,8 +761,8 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, */ } -MCH_PDU *get_mch_sdu(module_id_t module_idP, int CC_id, frame_t frameP, - sub_frame_t subframeP) { + +MCH_PDU *get_mch_sdu(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t subframeP) { // RC.mac[module_idP]->MCH_pdu.mcs=0; //LOG_D(MAC," MCH_pdu.mcs is %d\n", RC.mac[module_idP]->MCH_pdu.mcs); //#warning "MCH pdu should take the CC_id index" diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 3405f31cc1..0c6a97823a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -2495,6 +2495,7 @@ UE_is_to_be_scheduled(module_id_t module_idP, { UE_TEMPLATE *UE_template = &RC.mac[module_idP]->UE_list.UE_template[CC_id][UE_id]; UE_sched_ctrl_t *UE_sched_ctl = &RC.mac[module_idP]->UE_list.UE_sched_ctrl[UE_id]; + int rrc_status; // do not schedule UE if UL is not working if (UE_sched_ctl->ul_failure_timer > 0 || UE_sched_ctl->ul_out_of_sync > 0) @@ -2506,13 +2507,14 @@ UE_is_to_be_scheduled(module_id_t module_idP, UE_id, ue_rnti); + rrc_status = mac_eNB_get_rrc_status(module_idP, ue_rnti); + if (UE_template->scheduled_ul_bytes < UE_template->estimated_ul_buffer || UE_template->ul_SR > 0 || // uplink scheduling request (UE_sched_ctl->ul_inactivity_timer > 19 && UE_sched_ctl->ul_scheduled == 0) || // every 2 frames when RRC_CONNECTED (UE_sched_ctl->ul_inactivity_timer > 10 && - UE_sched_ctl->ul_scheduled == 0 && - mac_eNB_get_rrc_status(module_idP, - ue_rnti) < RRC_CONNECTED)) { // every Frame when not RRC_CONNECTED + UE_sched_ctl->ul_scheduled == 0 && rrc_status < RRC_CONNECTED) || // every Frame when not RRC_CONNECTED + (UE_sched_ctl->cqi_req_timer > 300 && rrc_status >= RRC_CONNECTED)) { // cqi req timer expired long ago (do not put too low value) LOG_D(MAC, "[eNB %d][PUSCH] UE %d/%x should be scheduled (BSR0 estimated size %d, SR %d)\n", module_idP, UE_id, diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index e3b74d388c..430f73cd9d 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -85,11 +85,10 @@ uint8_t rb_table[34] = { }; // This table hold the possible number of MTC repetition for CE ModeA -const uint8_t pusch_repetition_Table8_2_36213[3][4]= -{ - {1 , 2 , 4 , 8 }, - {1 , 4 , 8 , 16}, - {1 , 4 , 16, 32} +const uint8_t pusch_repetition_Table8_2_36213[3][4]= { + {1, 2, 4, 8 }, + {1, 4, 8, 16}, + {1, 4, 16, 32} }; extern mui_t rrc_eNB_mui; @@ -142,15 +141,7 @@ rx_sdu(const module_id_t enb_mod_idP, memset(rx_lengths, 0, NB_RB_MAX * sizeof(unsigned short)); start_meas(&mac->rx_ulsch_sdu); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU, 1); - - if (opt_enabled == 1) { - trace_pdu(DIRECTION_UPLINK, sduP, sdu_lenP, 0, WS_C_RNTI, current_rnti, frameP, subframeP, 0, 0); - LOG_D(OPT, "[eNB %d][ULSCH] Frame %d rnti %x with size %d\n", - enb_mod_idP, - frameP, - current_rnti, - sdu_lenP); - } + trace_pdu(DIRECTION_UPLINK, sduP, sdu_lenP, 0, WS_C_RNTI, current_rnti, frameP, subframeP, 0, 0); if (UE_id != -1) { UE_scheduling_control = &(UE_list->UE_sched_ctrl[UE_id]); @@ -301,22 +292,20 @@ rx_sdu(const module_id_t enb_mod_idP, if (ra->msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) { cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); } else { - if (ra->rach_resource_type > 0) { - cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); // TODO: Currently we don't support retransmission of Msg3 ( If in error Cancel RA procedure and reattach) - } - else - { - // first_rb = UE_template_ptr->first_rb_ul[harq_pid]; // UE_id = -1 !!!! - ra->msg3_round++; - /* Prepare handling of retransmission */ - get_Msg3allocret(&mac->common_channels[CC_idP], - ra->Msg3_subframe, - ra->Msg3_frame, - &ra->Msg3_frame, - &ra->Msg3_subframe); - // prepare handling of retransmission - add_msg3(enb_mod_idP, CC_idP, ra, frameP, subframeP); - } + if (ra->rach_resource_type > 0) { + cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); // TODO: Currently we don't support retransmission of Msg3 ( If in error Cancel RA procedure and reattach) + } else { + // first_rb = UE_template_ptr->first_rb_ul[harq_pid]; // UE_id = -1 !!!! + ra->msg3_round++; + /* Prepare handling of retransmission */ + get_Msg3allocret(&mac->common_channels[CC_idP], + ra->Msg3_subframe, + ra->Msg3_frame, + &ra->Msg3_frame, + &ra->Msg3_subframe); + // prepare handling of retransmission + add_msg3(enb_mod_idP, CC_idP, ra, frameP, subframeP); + } } /* TODO: program NACK for PHICH? */ @@ -466,13 +455,15 @@ rx_sdu(const module_id_t enb_mod_idP, RA_t *ra = &(mac->common_channels[CC_idP].ra[RA_id]); int8_t ret = mac_rrc_data_ind(enb_mod_idP, CC_idP, - frameP, subframeP, + frameP, + subframeP, UE_id, old_rnti, DCCH, (uint8_t *) payload_ptr, rx_lengths[i], - 0,ra->rach_resource_type > 0 + 0, + ra->rach_resource_type > 0 ); /* Received a new rnti */ @@ -1944,8 +1935,8 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP, UE_list_t *UE_list = &(eNB->UE_list); UE_TEMPLATE *UE_template = NULL; UE_sched_ctrl_t *UE_sched_ctrl = NULL; - uint8_t Total_Num_Rep_ULSCH,pusch_maxNumRepetitionCEmodeA_r13; - uint8_t UL_Scheduling_DCI_SF,UL_Scheduling_DCI_Frame_Even_Odd_Flag; //TODO: To be removed after scheduler relaxation Task + uint8_t Total_Num_Rep_ULSCH,pusch_maxNumRepetitionCEmodeA_r13; + uint8_t UL_Scheduling_DCI_SF,UL_Scheduling_DCI_Frame_Even_Odd_Flag; //TODO: To be removed after scheduler relaxation Task if (sched_subframeP < subframeP) { sched_frame++; @@ -2013,366 +2004,361 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP, N_RB_UL); RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = UE_template->estimated_ul_buffer; VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO, UE_template->estimated_ul_buffer); - pusch_maxNumRepetitionCEmodeA_r13= *(rrc->configuration.pusch_maxNumRepetitionCEmodeA_r13[CC_id]); Total_Num_Rep_ULSCH = pusch_repetition_Table8_2_36213[pusch_maxNumRepetitionCEmodeA_r13][UE_template->pusch_repetition_levels]; - UL_Scheduling_DCI_SF = (40-4 - Total_Num_Rep_ULSCH)%10; //TODO: [eMTC Scheduler] To be removed after scheduler relaxation task - UL_Scheduling_DCI_Frame_Even_Odd_Flag= ! (((40-4 - Total_Num_Rep_ULSCH)/10 )%2); //TODO: [eMTC Scheduler] To be removed after scheduler relaxation task + UL_Scheduling_DCI_SF = (40-4 - Total_Num_Rep_ULSCH)%10; //TODO: [eMTC Scheduler] To be removed after scheduler relaxation task + UL_Scheduling_DCI_Frame_Even_Odd_Flag= ! (((40-4 - Total_Num_Rep_ULSCH)/10 )%2); //TODO: [eMTC Scheduler] To be removed after scheduler relaxation task /* If frameP odd don't schedule */ - if ((frameP&1) == UL_Scheduling_DCI_Frame_Even_Odd_Flag) //TODO: [eMTC Scheduler] To be removed after scheduler relaxation task - { + if ((frameP&1) == UL_Scheduling_DCI_Frame_Even_Odd_Flag) { //TODO: [eMTC Scheduler] To be removed after scheduler relaxation task + //if ((UE_is_to_be_scheduled(module_idP, CC_id, UE_id) > 0) && (subframeP == 5)) { + if ((UE_template->ul_SR > 0 || round_UL > 0 || status < RRC_CONNECTED) && (subframeP == UL_Scheduling_DCI_SF)) { + /* + * if there is information on bsr of DCCH, DTCH, + * or if there is UL_SR, + * or if there is a packet to retransmit, + * or we want to schedule a periodic feedback every frame + */ + LOG_D(MAC,"[eNB %d][PUSCH %d] Frame %d subframe %d Scheduling UE %d/%x in round_UL %d(SR %d,UL_inactivity timer %d,UL_failure timer %d,cqi_req_timer %d)\n", + module_idP, + harq_pid, + frameP, + subframeP, + UE_id, + rnti, + round_UL, + UE_template->ul_SR, + UE_sched_ctrl->ul_inactivity_timer, + UE_sched_ctrl->ul_failure_timer, + UE_sched_ctrl->cqi_req_timer); + /* Reset the scheduling request */ + emtc_active[CC_id] = 1; + UE_template->ul_SR = 0; + status = mac_eNB_get_rrc_status(module_idP,rnti); + cqi_req = 0; + /* Power control: compute the expected ULSCH RX snr (for the stats) */ + /* This is the normalized snr and this should be constant (regardless of mcs) */ + snr = (5 * UE_sched_ctrl->pusch_snr[CC_id] - 640) / 10; + target_snr = eNB->puSch10xSnr / 10; /* TODO: target_rx_power was 178, what to put? */ + /* This assumes accumulated tpc */ + /* Make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out */ + int32_t framex10psubframe = UE_template->pusch_tpc_tx_frame * 10 + UE_template->pusch_tpc_tx_subframe; + if (((framex10psubframe + 10) <= (frameP * 10 + subframeP)) || // normal case + ((framex10psubframe > (frameP * 10 + subframeP)) && (((10240 - framex10psubframe + frameP * 10 + subframeP) >= 10)))) { // frame wrap-around + UE_template->pusch_tpc_tx_frame = frameP; + UE_template->pusch_tpc_tx_subframe = subframeP; - //if ((UE_is_to_be_scheduled(module_idP, CC_id, UE_id) > 0) && (subframeP == 5)) { - if ((UE_template->ul_SR > 0 || round_UL > 0 || status < RRC_CONNECTED) && (subframeP == UL_Scheduling_DCI_SF)) { - /* - * if there is information on bsr of DCCH, DTCH, - * or if there is UL_SR, - * or if there is a packet to retransmit, - * or we want to schedule a periodic feedback every frame - */ - LOG_D(MAC,"[eNB %d][PUSCH %d] Frame %d subframe %d Scheduling UE %d/%x in round_UL %d(SR %d,UL_inactivity timer %d,UL_failure timer %d,cqi_req_timer %d)\n", - module_idP, - harq_pid, - frameP, - subframeP, - UE_id, - rnti, - round_UL, - UE_template->ul_SR, - UE_sched_ctrl->ul_inactivity_timer, - UE_sched_ctrl->ul_failure_timer, - UE_sched_ctrl->cqi_req_timer); - /* Reset the scheduling request */ - emtc_active[CC_id] = 1; - UE_template->ul_SR = 0; - status = mac_eNB_get_rrc_status(module_idP,rnti); - cqi_req = 0; - /* Power control: compute the expected ULSCH RX snr (for the stats) */ - /* This is the normalized snr and this should be constant (regardless of mcs) */ - snr = (5 * UE_sched_ctrl->pusch_snr[CC_id] - 640) / 10; - target_snr = eNB->puSch10xSnr / 10; /* TODO: target_rx_power was 178, what to put? */ - /* This assumes accumulated tpc */ - /* Make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out */ - int32_t framex10psubframe = UE_template->pusch_tpc_tx_frame * 10 + UE_template->pusch_tpc_tx_subframe; - - if (((framex10psubframe + 10) <= (frameP * 10 + subframeP)) || // normal case - ((framex10psubframe > (frameP * 10 + subframeP)) && (((10240 - framex10psubframe + frameP * 10 + subframeP) >= 10)))) { // frame wrap-around - UE_template->pusch_tpc_tx_frame = frameP; - UE_template->pusch_tpc_tx_subframe = subframeP; - - if (snr > target_snr + 4) { - tpc = 0; //-1 - UE_sched_ctrl->tpc_accumulated[CC_id]--; - } else if (snr < target_snr - 4) { - tpc = 2; //+1 - UE_sched_ctrl->tpc_accumulated[CC_id]++; + if (snr > target_snr + 4) { + tpc = 0; //-1 + UE_sched_ctrl->tpc_accumulated[CC_id]--; + } else if (snr < target_snr - 4) { + tpc = 2; //+1 + UE_sched_ctrl->tpc_accumulated[CC_id]++; + } else { + tpc = 1; //0 + } } else { tpc = 1; //0 } - } else { - tpc = 1; //0 - } - if (tpc != 1) { - LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n", - module_idP, - frameP, - subframeP, - harq_pid, - tpc, - UE_sched_ctrl->tpc_accumulated[CC_id], - snr, - target_snr); - } - - /* New transmission */ - if (round_UL == 0) { - ndi = 1 - UE_template->oldNDI_UL[harq_pid]; - UE_template->oldNDI_UL[harq_pid] = ndi; - UE_template->mcs_UL[harq_pid] = 4; - UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid], 6); - UE_list->eNB_UE_stats[CC_id][UE_id].snr = snr; - UE_list->eNB_UE_stats[CC_id][UE_id].target_snr = target_snr; - UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1 = 4; - UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 = UE_template->mcs_UL[harq_pid]; - UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx += 6; - UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS = UE_template->TBS_UL[harq_pid]; - T(T_ENB_MAC_UE_UL_SCHEDULE, - T_INT(module_idP), - T_INT(CC_id), - T_INT(rnti), - T_INT(frameP), - T_INT(subframeP), - T_INT(harq_pid), - T_INT(UE_template->mcs_UL[harq_pid]), - T_INT(0), - T_INT(6), - T_INT(UE_template->TBS_UL[harq_pid]), - T_INT(ndi)); - /* Store for possible retransmission */ - UE_template->nb_rb_ul[harq_pid] = 6; - UE_sched_ctrl->ul_scheduled |= (1 << harq_pid); - - if (UE_id == UE_list->head) { - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SCHEDULED, UE_sched_ctrl->ul_scheduled); + if (tpc != 1) { + LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n", + module_idP, + frameP, + subframeP, + harq_pid, + tpc, + UE_sched_ctrl->tpc_accumulated[CC_id], + snr, + target_snr); } - /* Adjust total UL buffer status by TBS, wait for UL sdus to do final update */ - UE_template->scheduled_ul_bytes += UE_template->TBS_UL[harq_pid]; - LOG_D(MAC, "scheduled_ul_bytes, new %d\n", UE_template->scheduled_ul_bytes); - /* Cyclic shift for DMRS */ - cshift = 0; // values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1) - /* save it for a potential retransmission */ - UE_template->cshift[harq_pid] = cshift; - AssertFatal (UE_template->physicalConfigDedicated != NULL, "UE_template->physicalConfigDedicated is null\n"); - AssertFatal (UE_template->physicalConfigDedicated->ext4 != NULL, "UE_template->physicalConfigDedicated->ext4 is null\n"); - AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 != NULL, "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 is null\n"); - AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == LTE_EPDCCH_Config_r11__config_r11_PR_setup, - "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n"); - AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 != NULL, - "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n"); - LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0]; - AssertFatal(epdcch_setconfig_r11 != NULL, "epdcch_setconfig_r11 is null\n"); - AssertFatal(epdcch_setconfig_r11->ext2 != NULL, "epdcch_setconfig_r11->ext2 is null\n"); - AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13 != NULL, "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null"); - AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->present == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13_PR_setup, - "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n"); - AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 != NULL, "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 is null"); - AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present == LTE_EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310_PR_setup, - "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n"); - LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL 6-0A MPDCCH for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d, UESS MPDCCH Narrowband %d\n", - harq_pid, - frameP, - subframeP, - UE_id, - rnti, - sched_frame, - sched_subframeP, - (int)epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1); - UE_template->first_rb_ul[harq_pid] = narrowband_to_first_rb (cc, epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1); - hi_dci0_pdu = &(hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci + hi_dci0_req->number_of_hi]); - memset((void *) hi_dci0_pdu, 0, sizeof(nfapi_hi_dci0_request_pdu_t)); - hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE; - hi_dci0_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu)); - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 5 : 4; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type > 1) ? 2 : 1; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_narrowband = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_prb_pairs = 6; // checked above that it has to be this - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_transmission_type = epdcch_setconfig_r11->transmissionType_r11; // distibuted - AssertFatal(UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 != NULL, - "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n"); - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ecce_index = 0; // Note: this should be dynamic - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.aggreagation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4 - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti_type = 4; // other - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti = rnti; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type < 3) ? 1 : 2; // already set above... - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.transmission_power = 6000; // 0dB - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_start = UE_template->first_rb_ul[harq_pid]; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_resource_blocks = 6; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB = 3 - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.pusch_repetition_levels = UE_template->pusch_repetition_levels; - AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13 == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__mpdcch_pdsch_HoppingConfig_r13_off, - "epdcch_setconfig_r11->ext2->mpdcch_config_r13->mpdcch_pdsch_HoppingConfig_r13 is not off\n"); - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.frequency_hopping_flag = 1 - epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.redudency_version = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.new_data_indication = UE_template->oldNDI_UL[harq_pid]; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.harq_process = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tpc = tpc; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.csi_request = cqi_req; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ul_inex = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dai_presence_flag = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dl_assignment_index = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.srs_request = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_subframe_repetition_number = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tcp_bitmap = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.total_dci_length_include_padding = 29; // hard-coded for 10 MHz - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_tx_antenna_ports = 1; - hi_dci0_req->number_of_dci++; - LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG. Request for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d, UESS mpdcch narrowband %d\n", - harq_pid, - frameP, - subframeP, - UE_id, - rnti, - sched_frame, - sched_subframeP, - (int)epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1); - fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus], - cqi_req, - cc, - UE_template->physicalConfigDedicated, - get_tmode(module_idP,CC_id,UE_id), - eNB->ul_handle, - rnti, - UE_template->first_rb_ul[harq_pid], // resource_block_start - UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks - UE_template->mcs_UL[harq_pid], - cshift, // cyclic_shift_2_for_drms - 0, // frequency_hopping_enabled_flag - 0, // frequency_hopping_bits - UE_template->oldNDI_UL[harq_pid], // new_data_indication - rvidx_tab[round_UL&3], // redundancy_version - harq_pid, // harq_process_number - 0, // ul_tx_mode - 0, // current_tx_nb - 0, // n_srs - UE_template->TBS_UL[harq_pid] - ); - fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus], - UE_template->rach_resource_type > 2 ? 2 : 1, - Total_Num_Rep_ULSCH, // total_number_of_repetitions - 1, // repetition_number - (frameP * 10) + subframeP); - ul_req_tmp->number_of_pdus++; - eNB->ul_handle++; - add_ue_ulsch_info(module_idP, - CC_id, - UE_id, - subframeP, - S_UL_SCHEDULED); - LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n", - module_idP, - CC_id, - frameP, - subframeP, - UE_id); - } else { // round_UL > 0 => retransmission - /* In LTE-M the UL HARQ process is asynchronous */ - T(T_ENB_MAC_UE_UL_SCHEDULE_RETRANSMISSION, - T_INT(module_idP), - T_INT(CC_id), - T_INT(rnti), - T_INT(frameP), - T_INT(subframeP), - T_INT(harq_pid), - T_INT(UE_template->mcs_UL[harq_pid]), - T_INT(0), - T_INT(6), - T_INT(round_UL)); - AssertFatal (UE_template->physicalConfigDedicated != NULL, "UE_template->physicalConfigDedicated is null\n"); - AssertFatal (UE_template->physicalConfigDedicated->ext4 != NULL, "UE_template->physicalConfigDedicated->ext4 is null\n"); - AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 != NULL, "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 is null\n"); - AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == LTE_EPDCCH_Config_r11__config_r11_PR_setup, - "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n"); - AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 != NULL, - "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n"); - LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0]; - AssertFatal(epdcch_setconfig_r11 != NULL, "epdcch_setconfig_r11 is null\n"); - AssertFatal(epdcch_setconfig_r11->ext2 != NULL, "epdcch_setconfig_r11->ext2 is null\n"); - AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13 != NULL, "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null"); - AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13 != NULL, "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null"); - AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->present == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13_PR_setup, - "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n"); - AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 != NULL, "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 is null"); - AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present == LTE_EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310_PR_setup, - "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n"); - LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL 6-0A MPDCCH for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d,UESS MPDCCH Narrowband %d\n", - harq_pid, - frameP, - subframeP, - UE_id, - rnti, - sched_frame, - sched_subframeP, - (int)epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1); - UE_template->first_rb_ul[harq_pid] = narrowband_to_first_rb(cc, epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1); - hi_dci0_pdu = &(hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci+hi_dci0_req->number_of_hi]); - memset((void *) hi_dci0_pdu, 0, sizeof(nfapi_hi_dci0_request_pdu_t)); - hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE; - hi_dci0_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu)); - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 5 : 4; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type > 1) ? 2 : 1; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_narrowband = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_prb_pairs = 6; // checked above that it has to be this - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_transmission_type = epdcch_setconfig_r11->transmissionType_r11; // distibuted - AssertFatal(UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 != NULL, - "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n"); - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ecce_index = 0; // Note: this should be dynamic - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.aggreagation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4 - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti_type = 4; // other - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti = rnti; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type < 3) ? 1 : 2; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.transmission_power = 6000; // 0dB - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_start = UE_template->first_rb_ul[harq_pid]; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_resource_blocks = 6; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB=3 - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.pusch_repetition_levels = 0; - AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13 == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__mpdcch_pdsch_HoppingConfig_r13_off, - "epdcch_setconfig_r11->ext2->mpdcch_config_r13->mpdcch_pdsch_HoppingConfig_r13 is not off\n"); - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.frequency_hopping_flag = 1 - epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.redudency_version = rvidx_tab[round_UL&3]; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.new_data_indication = UE_template->oldNDI_UL[harq_pid]; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.harq_process = harq_pid; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tpc = tpc; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.csi_request = cqi_req; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ul_inex = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dai_presence_flag = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dl_assignment_index = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.srs_request = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_subframe_repetition_number = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tcp_bitmap = 0; - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.total_dci_length_include_padding = 29; // hard-coded for 10 MHz - hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_tx_antenna_ports = 1; - hi_dci0_req->number_of_dci++; - fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus], - cqi_req, - cc, - UE_template->physicalConfigDedicated, - get_tmode(module_idP,CC_id,UE_id), - eNB->ul_handle, - rnti, - UE_template->first_rb_ul[harq_pid], // resource_block_start - UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks - UE_template->mcs_UL[harq_pid], - cshift, // cyclic_shift_2_for_drms - 0, // frequency_hopping_enabled_flag - 0, // frequency_hopping_bits - UE_template->oldNDI_UL[harq_pid], // new_data_indication - rvidx_tab[round_UL&3], // redundancy_version - harq_pid, // harq_process_number - 0, // ul_tx_mode - 0, // current_tx_nb - 0, // n_srs - UE_template->TBS_UL[harq_pid] - ); - fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus], - UE_template->rach_resource_type>2 ? 2 : 1, - 1, //total_number_of_repetitions - 1, //repetition_number - (frameP * 10) + subframeP); - ul_req_tmp->number_of_pdus++; - eNB->ul_handle++; - } - } // UE_is_to_be_scheduled - } // ULCCs - } // loop over UE_id + /* New transmission */ + if (round_UL == 0) { + ndi = 1 - UE_template->oldNDI_UL[harq_pid]; + UE_template->oldNDI_UL[harq_pid] = ndi; + UE_template->mcs_UL[harq_pid] = 4; + UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid], 6); + UE_list->eNB_UE_stats[CC_id][UE_id].snr = snr; + UE_list->eNB_UE_stats[CC_id][UE_id].target_snr = target_snr; + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1 = 4; + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 = UE_template->mcs_UL[harq_pid]; + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx += 6; + UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS = UE_template->TBS_UL[harq_pid]; + T(T_ENB_MAC_UE_UL_SCHEDULE, + T_INT(module_idP), + T_INT(CC_id), + T_INT(rnti), + T_INT(frameP), + T_INT(subframeP), + T_INT(harq_pid), + T_INT(UE_template->mcs_UL[harq_pid]), + T_INT(0), + T_INT(6), + T_INT(UE_template->TBS_UL[harq_pid]), + T_INT(ndi)); + /* Store for possible retransmission */ + UE_template->nb_rb_ul[harq_pid] = 6; + UE_sched_ctrl->ul_scheduled |= (1 << harq_pid); + + if (UE_id == UE_list->head) { + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SCHEDULED, UE_sched_ctrl->ul_scheduled); + } + + /* Adjust total UL buffer status by TBS, wait for UL sdus to do final update */ + UE_template->scheduled_ul_bytes += UE_template->TBS_UL[harq_pid]; + LOG_D(MAC, "scheduled_ul_bytes, new %d\n", UE_template->scheduled_ul_bytes); + /* Cyclic shift for DMRS */ + cshift = 0; // values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1) + /* save it for a potential retransmission */ + UE_template->cshift[harq_pid] = cshift; + AssertFatal (UE_template->physicalConfigDedicated != NULL, "UE_template->physicalConfigDedicated is null\n"); + AssertFatal (UE_template->physicalConfigDedicated->ext4 != NULL, "UE_template->physicalConfigDedicated->ext4 is null\n"); + AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 != NULL, "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 is null\n"); + AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == LTE_EPDCCH_Config_r11__config_r11_PR_setup, + "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n"); + AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 != NULL, + "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n"); + LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0]; + AssertFatal(epdcch_setconfig_r11 != NULL, "epdcch_setconfig_r11 is null\n"); + AssertFatal(epdcch_setconfig_r11->ext2 != NULL, "epdcch_setconfig_r11->ext2 is null\n"); + AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13 != NULL, "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null"); + AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->present == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13_PR_setup, + "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n"); + AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 != NULL, "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 is null"); + AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present == LTE_EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310_PR_setup, + "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n"); + LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL 6-0A MPDCCH for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d, UESS MPDCCH Narrowband %d\n", + harq_pid, + frameP, + subframeP, + UE_id, + rnti, + sched_frame, + sched_subframeP, + (int)epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1); + UE_template->first_rb_ul[harq_pid] = narrowband_to_first_rb (cc, epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1); + hi_dci0_pdu = &(hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci + hi_dci0_req->number_of_hi]); + memset((void *) hi_dci0_pdu, 0, sizeof(nfapi_hi_dci0_request_pdu_t)); + hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE; + hi_dci0_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu)); + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 5 : 4; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type > 1) ? 2 : 1; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_narrowband = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_prb_pairs = 6; // checked above that it has to be this + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_transmission_type = epdcch_setconfig_r11->transmissionType_r11; // distibuted + AssertFatal(UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 != NULL, + "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n"); + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ecce_index = 0; // Note: this should be dynamic + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.aggreagation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4 + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti_type = 4; // other + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti = rnti; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type < 3) ? 1 : 2; // already set above... + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.transmission_power = 6000; // 0dB + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_start = UE_template->first_rb_ul[harq_pid]; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_resource_blocks = 6; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB = 3 + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.pusch_repetition_levels = UE_template->pusch_repetition_levels; + AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13 == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__mpdcch_pdsch_HoppingConfig_r13_off, + "epdcch_setconfig_r11->ext2->mpdcch_config_r13->mpdcch_pdsch_HoppingConfig_r13 is not off\n"); + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.frequency_hopping_flag = 1 - epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.redudency_version = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.new_data_indication = UE_template->oldNDI_UL[harq_pid]; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.harq_process = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tpc = tpc; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.csi_request = cqi_req; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ul_inex = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dai_presence_flag = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dl_assignment_index = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.srs_request = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_subframe_repetition_number = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tcp_bitmap = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.total_dci_length_include_padding = 29; // hard-coded for 10 MHz + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_tx_antenna_ports = 1; + hi_dci0_req->number_of_dci++; + LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG. Request for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d, UESS mpdcch narrowband %d\n", + harq_pid, + frameP, + subframeP, + UE_id, + rnti, + sched_frame, + sched_subframeP, + (int)epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1); + fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus], + cqi_req, + cc, + UE_template->physicalConfigDedicated, + get_tmode(module_idP,CC_id,UE_id), + eNB->ul_handle, + rnti, + UE_template->first_rb_ul[harq_pid], // resource_block_start + UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks + UE_template->mcs_UL[harq_pid], + cshift, // cyclic_shift_2_for_drms + 0, // frequency_hopping_enabled_flag + 0, // frequency_hopping_bits + UE_template->oldNDI_UL[harq_pid], // new_data_indication + rvidx_tab[round_UL&3], // redundancy_version + harq_pid, // harq_process_number + 0, // ul_tx_mode + 0, // current_tx_nb + 0, // n_srs + UE_template->TBS_UL[harq_pid] + ); + fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus], + UE_template->rach_resource_type > 2 ? 2 : 1, + Total_Num_Rep_ULSCH, // total_number_of_repetitions + 1, // repetition_number + (frameP * 10) + subframeP); + ul_req_tmp->number_of_pdus++; + eNB->ul_handle++; + add_ue_ulsch_info(module_idP, + CC_id, + UE_id, + subframeP, + S_UL_SCHEDULED); + LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n", + module_idP, + CC_id, + frameP, + subframeP, + UE_id); + } else { // round_UL > 0 => retransmission + /* In LTE-M the UL HARQ process is asynchronous */ + T(T_ENB_MAC_UE_UL_SCHEDULE_RETRANSMISSION, + T_INT(module_idP), + T_INT(CC_id), + T_INT(rnti), + T_INT(frameP), + T_INT(subframeP), + T_INT(harq_pid), + T_INT(UE_template->mcs_UL[harq_pid]), + T_INT(0), + T_INT(6), + T_INT(round_UL)); + AssertFatal (UE_template->physicalConfigDedicated != NULL, "UE_template->physicalConfigDedicated is null\n"); + AssertFatal (UE_template->physicalConfigDedicated->ext4 != NULL, "UE_template->physicalConfigDedicated->ext4 is null\n"); + AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 != NULL, "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 is null\n"); + AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == LTE_EPDCCH_Config_r11__config_r11_PR_setup, + "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n"); + AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 != NULL, + "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n"); + LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0]; + AssertFatal(epdcch_setconfig_r11 != NULL, "epdcch_setconfig_r11 is null\n"); + AssertFatal(epdcch_setconfig_r11->ext2 != NULL, "epdcch_setconfig_r11->ext2 is null\n"); + AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13 != NULL, "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null"); + AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13 != NULL, "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null"); + AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->present == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13_PR_setup, + "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n"); + AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 != NULL, "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 is null"); + AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present == LTE_EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310_PR_setup, + "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n"); + LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL 6-0A MPDCCH for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d,UESS MPDCCH Narrowband %d\n", + harq_pid, + frameP, + subframeP, + UE_id, + rnti, + sched_frame, + sched_subframeP, + (int)epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1); + UE_template->first_rb_ul[harq_pid] = narrowband_to_first_rb(cc, epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1); + hi_dci0_pdu = &(hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci+hi_dci0_req->number_of_hi]); + memset((void *) hi_dci0_pdu, 0, sizeof(nfapi_hi_dci0_request_pdu_t)); + hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE; + hi_dci0_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu)); + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 5 : 4; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type > 1) ? 2 : 1; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_narrowband = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 - 1; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_prb_pairs = 6; // checked above that it has to be this + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_transmission_type = epdcch_setconfig_r11->transmissionType_r11; // distibuted + AssertFatal(UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 != NULL, + "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n"); + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ecce_index = 0; // Note: this should be dynamic + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.aggreagation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4 + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti_type = 4; // other + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti = rnti; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type < 3) ? 1 : 2; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.transmission_power = 6000; // 0dB + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_start = UE_template->first_rb_ul[harq_pid]; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_resource_blocks = 6; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB=3 + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.pusch_repetition_levels = 0; + AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13 == LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__mpdcch_pdsch_HoppingConfig_r13_off, + "epdcch_setconfig_r11->ext2->mpdcch_config_r13->mpdcch_pdsch_HoppingConfig_r13 is not off\n"); + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.frequency_hopping_flag = 1 - epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.redudency_version = rvidx_tab[round_UL&3]; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.new_data_indication = UE_template->oldNDI_UL[harq_pid]; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.harq_process = harq_pid; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tpc = tpc; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.csi_request = cqi_req; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ul_inex = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dai_presence_flag = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dl_assignment_index = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.srs_request = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_subframe_repetition_number = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tcp_bitmap = 0; + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.total_dci_length_include_padding = 29; // hard-coded for 10 MHz + hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_tx_antenna_ports = 1; + hi_dci0_req->number_of_dci++; + fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus], + cqi_req, + cc, + UE_template->physicalConfigDedicated, + get_tmode(module_idP,CC_id,UE_id), + eNB->ul_handle, + rnti, + UE_template->first_rb_ul[harq_pid], // resource_block_start + UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks + UE_template->mcs_UL[harq_pid], + cshift, // cyclic_shift_2_for_drms + 0, // frequency_hopping_enabled_flag + 0, // frequency_hopping_bits + UE_template->oldNDI_UL[harq_pid], // new_data_indication + rvidx_tab[round_UL&3], // redundancy_version + harq_pid, // harq_process_number + 0, // ul_tx_mode + 0, // current_tx_nb + 0, // n_srs + UE_template->TBS_UL[harq_pid] + ); + fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus], + UE_template->rach_resource_type>2 ? 2 : 1, + 1, //total_number_of_repetitions + 1, //repetition_number + (frameP * 10) + subframeP); + ul_req_tmp->number_of_pdus++; + eNB->ul_handle++; + } + } // UE_is_to_be_scheduled + } // ULCCs + } // loop over UE_id } // Schedule new ULSCH // This section is to repeat ULSCH PDU for a number of MTC repetitions - for(int i=0;inumber_of_pdus;i++) - { - ul_config_pdu = &ul_req_tmp->ul_config_pdu_list[i]; - if (ul_config_pdu->pdu_type!=NFAPI_UL_CONFIG_ULSCH_PDU_TYPE) // Repeat ULSCH PDUs only - continue ; + for(int i=0; inumber_of_pdus; i++) { + ul_config_pdu = &ul_req_tmp->ul_config_pdu_list[i]; - if(ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number < ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions) - { - ul_req_body_Rep = &eNB->UL_req_tmp[CC_id][(sched_subframeP+1)%10].ul_config_request_body; - ul_config_pdu_Rep = &ul_req_body_Rep->ul_config_pdu_list[ul_req_body_Rep->number_of_pdus]; - memcpy ((void *) ul_config_pdu_Rep, ul_config_pdu, sizeof (nfapi_ul_config_request_pdu_t)); - ul_config_pdu_Rep->ulsch_pdu.ulsch_pdu_rel8.handle = eNB->ul_handle++; - ul_config_pdu_Rep->ulsch_pdu.ulsch_pdu_rel13.repetition_number = ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number +1; - ul_req_body_Rep->number_of_pdus++; - } //repetition_number < total_number_of_repetitions + if (ul_config_pdu->pdu_type!=NFAPI_UL_CONFIG_ULSCH_PDU_TYPE) // Repeat ULSCH PDUs only + continue ; + + if(ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number < ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions) { + ul_req_body_Rep = &eNB->UL_req_tmp[CC_id][(sched_subframeP+1)%10].ul_config_request_body; + ul_config_pdu_Rep = &ul_req_body_Rep->ul_config_pdu_list[ul_req_body_Rep->number_of_pdus]; + memcpy ((void *) ul_config_pdu_Rep, ul_config_pdu, sizeof (nfapi_ul_config_request_pdu_t)); + ul_config_pdu_Rep->ulsch_pdu.ulsch_pdu_rel8.handle = eNB->ul_handle++; + ul_config_pdu_Rep->ulsch_pdu.ulsch_pdu_rel13.repetition_number = ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number +1; + ul_req_body_Rep->number_of_pdus++; + } //repetition_number < total_number_of_repetitions } // For loop on PDUs } diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index 1f34ab3df2..bd4e4de2a4 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -2014,6 +2014,14 @@ static int ue_ul_compare(const void *_a, const void *_b, void *_params) { UE_list->UE_template[pCCid2][UE_id2].pre_assigned_mcs_ul) return 1; + if (UE_list->UE_sched_ctrl[UE_id1].cqi_req_timer > + UE_list->UE_sched_ctrl[UE_id2].cqi_req_timer) + return -1; + + if (UE_list->UE_sched_ctrl[UE_id1].cqi_req_timer < + UE_list->UE_sched_ctrl[UE_id2].cqi_req_timer) + return 1; + return 0; } diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index b6bab6e3d7..19b1c7708b 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -255,17 +255,11 @@ Msg1_transmitted(module_id_t module_idP, uint8_t CC_id, "Transmission on secondary CCs is not supported yet\n"); // start contention resolution timer UE_mac_inst[module_idP].RA_attempt_number++; - - if (opt_enabled) { - trace_pdu(DIRECTION_UPLINK, NULL, 0, module_idP, WS_NO_RNTI, - UE_mac_inst[module_idP].RA_prach_resources. - ra_PreambleIndex, UE_mac_inst[module_idP].txFrame, - UE_mac_inst[module_idP].txSubframe, 0, - UE_mac_inst[module_idP].RA_attempt_number); - LOG_D(OPT, - "[UE %d][RAPROC] TX MSG1 Frame %d trace pdu for rnti %x with size %d\n", - module_idP, frameP, 1, UE_mac_inst[module_idP].RA_Msg3_size); - } + trace_pdu(DIRECTION_UPLINK, NULL, 0, module_idP, WS_NO_RNTI, + UE_mac_inst[module_idP].RA_prach_resources. + ra_PreambleIndex, UE_mac_inst[module_idP].txFrame, + UE_mac_inst[module_idP].txSubframe, 0, + UE_mac_inst[module_idP].RA_attempt_number); } @@ -280,19 +274,11 @@ Msg3_transmitted(module_id_t module_idP, uint8_t CC_id, module_idP, frameP); UE_mac_inst[module_idP].RA_contention_resolution_cnt = 0; UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 1; - - if (opt_enabled) { // msg3 - trace_pdu(DIRECTION_UPLINK, &UE_mac_inst[module_idP].CCCH_pdu.payload[0], - UE_mac_inst[module_idP].RA_Msg3_size, module_idP, WS_C_RNTI, - UE_mac_inst[module_idP].crnti, - UE_mac_inst[module_idP].txFrame, - UE_mac_inst[module_idP].txSubframe, 0, 0); - LOG_D(OPT, - "[UE %d][RAPROC] MSG3 Frame %d trace pdu Preamble %d with size %d\n", - module_idP, frameP, UE_mac_inst[module_idP].crnti - /*UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex */ - , UE_mac_inst[module_idP].RA_Msg3_size); - } + trace_pdu(DIRECTION_UPLINK, &UE_mac_inst[module_idP].CCCH_pdu.payload[0], + UE_mac_inst[module_idP].RA_Msg3_size, module_idP, WS_C_RNTI, + UE_mac_inst[module_idP].crnti, + UE_mac_inst[module_idP].txFrame, + UE_mac_inst[module_idP].txSubframe, 0, 0); } diff --git a/openair2/LAYER2/MAC/rar_tools.c b/openair2/LAYER2/MAC/rar_tools.c index 6999e4ab5e..23ac209389 100644 --- a/openair2/LAYER2/MAC/rar_tools.c +++ b/openair2/LAYER2/MAC/rar_tools.c @@ -53,7 +53,8 @@ fill_rar(const module_id_t module_idP, RA_t *ra, const frame_t frameP, uint8_t *const dlsch_buffer, - const uint16_t N_RB_UL, const uint8_t input_buffer_length) + const uint16_t N_RB_UL, + const uint8_t input_buffer_length) //------------------------------------------------------------------------------ { RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *) dlsch_buffer; @@ -93,16 +94,9 @@ fill_rar(const module_id_t module_idP, rar[3] = (((ra->msg3_mcs & 0x7) << 5)) | ((ra->msg3_TPC & 7) << 2) | ((ra->msg3_ULdelay & 1) << 1) | (ra->msg3_cqireq & 1); - - if (opt_enabled) { - trace_pdu(DIRECTION_DOWNLINK, dlsch_buffer, input_buffer_length, module_idP, WS_RA_RNTI, 1, - RC.mac[module_idP]->frame, RC.mac[module_idP]->subframe, - 0, 0); - LOG_D(OPT, - "[eNB %d][RAPROC] CC_id %d RAR Frame %d trace pdu for rnti %x and rapid %d size %d\n", - module_idP, CC_id, frameP, ra->rnti, rarh->RAPID, - input_buffer_length); - } + trace_pdu(DIRECTION_DOWNLINK, dlsch_buffer, input_buffer_length, module_idP, WS_RA_RNTI, 1, + RC.mac[module_idP]->frame, RC.mac[module_idP]->subframe, + 0, 0); return (ra->rnti); } @@ -194,24 +188,16 @@ unsigned short fill_rar_br(eNB_MAC_INST *eNB, ra->preamble_index, ra->timing_offset); - if (opt_enabled) { - trace_pdu(DIRECTION_DOWNLINK, - dlsch_buffer, - input_buffer_length, - eNB->Mod_id, - WS_RA_RNTI, - 1, - eNB->frame, - eNB->subframe, - 0, - 0); - LOG_D(OPT, "[RAPROC] RAR Frame %d trace pdu for rnti %x and rapid %d size %d\n", - frameP, - ra->rnti, - rarh->RAPID, - input_buffer_length); - } + trace_pdu(DIRECTION_DOWNLINK, + dlsch_buffer, + input_buffer_length, + eNB->Mod_id, + WS_RA_RNTI, + 1, + eNB->frame, + eNB->subframe, + 0, + 0); return (ra->rnti); } - diff --git a/openair2/LAYER2/MAC/rar_tools_ue.c b/openair2/LAYER2/MAC/rar_tools_ue.c index 35d1f7925e..611aaf865b 100644 --- a/openair2/LAYER2/MAC/rar_tools_ue.c +++ b/openair2/LAYER2/MAC/rar_tools_ue.c @@ -41,103 +41,96 @@ #define DEBUG_RAR //------------------------------------------------------------------------------ -uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const frame_t frameP, const rnti_t ra_rnti, uint8_t * const dlsch_buffer, rnti_t * const t_crnti, const uint8_t preamble_index, uint8_t * selected_rar_buffer // output argument for storing the selected RAR header and RAR payload - ) +uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const frame_t frameP, const rnti_t ra_rnti, uint8_t *const dlsch_buffer, rnti_t *const t_crnti, const uint8_t preamble_index, + uint8_t *selected_rar_buffer // output argument for storing the selected RAR header and RAR payload + ) //------------------------------------------------------------------------------ { - uint16_t ret = 0; // return value + uint16_t ret = 0; // return value + RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *) dlsch_buffer; + // RAR_PDU *rar = (RAR_PDU *)(dlsch_buffer+1); + uint8_t *rar = (uint8_t *) (dlsch_buffer + 1); + // get the last RAR payload for working with CMW500 + uint8_t n_rarpy = 0; // number of RAR payloads + uint8_t n_rarh = 0; // number of MAC RAR subheaders + uint8_t best_rx_rapid = -1; // the closest RAPID receive from all RARs - RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *) dlsch_buffer; - // RAR_PDU *rar = (RAR_PDU *)(dlsch_buffer+1); - uint8_t *rar = (uint8_t *) (dlsch_buffer + 1); + while (1) { + n_rarh++; - // get the last RAR payload for working with CMW500 - uint8_t n_rarpy = 0; // number of RAR payloads - uint8_t n_rarh = 0; // number of MAC RAR subheaders - uint8_t best_rx_rapid = -1; // the closest RAPID receive from all RARs - while (1) { - n_rarh++; - if (rarh->T == 1) { - n_rarpy++; - LOG_D(MAC, "RAPID %d\n", rarh->RAPID); - } - - if (rarh->RAPID == preamble_index) { - LOG_D(PHY, "Found RAR with the intended RAPID %d\n", - rarh->RAPID); - rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6); - break; - } - - if (abs((int) rarh->RAPID - (int) preamble_index) < - abs((int) best_rx_rapid - (int) preamble_index)) { - best_rx_rapid = rarh->RAPID; - rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6); - } - - if (rarh->E == 0) { - LOG_I(PHY, - "No RAR found with the intended RAPID. The closest RAPID in all RARs is %d\n", - best_rx_rapid); - break; - } else { - rarh++; - } - }; - LOG_D(MAC, "number of RAR subheader %d; number of RAR pyloads %d\n", - n_rarh, n_rarpy); - - if (CC_id > 0) { - LOG_W(MAC, "Should not have received RAR on secondary CCs! \n"); - return (0xffff); + if (rarh->T == 1) { + n_rarpy++; + LOG_D(MAC, "RAPID %d\n", rarh->RAPID); } - LOG_I(MAC, - "[UE %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n", - module_idP, frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2], - rar[3], rar[4], rar[5], rarh->RAPID, preamble_index); -#ifdef DEBUG_RAR - LOG_D(MAC, "[UE %d][RAPROC] rarh->E %d\n", module_idP, rarh->E); - LOG_D(MAC, "[UE %d][RAPROC] rarh->T %d\n", module_idP, rarh->T); - LOG_D(MAC, "[UE %d][RAPROC] rarh->RAPID %d\n", module_idP, - rarh->RAPID); - - // LOG_I(MAC,"[UE %d][RAPROC] rar->R %d\n",module_idP,rar->R); - LOG_D(MAC, "[UE %d][RAPROC] rar->Timing_Advance_Command %d\n", - module_idP, (((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4)); - // LOG_I(MAC,"[UE %d][RAPROC] rar->hopping_flag %d\n",module_idP,rar->hopping_flag); - // LOG_I(MAC,"[UE %d][RAPROC] rar->rb_alloc %d\n",module_idP,rar->rb_alloc); - // LOG_I(MAC,"[UE %d][RAPROC] rar->mcs %d\n",module_idP,rar->mcs); - // LOG_I(MAC,"[UE %d][RAPROC] rar->TPC %d\n",module_idP,rar->TPC); - // LOG_I(MAC,"[UE %d][RAPROC] rar->UL_delay %d\n",module_idP,rar->UL_delay); - // LOG_I(MAC,"[UE %d][RAPROC] rar->cqi_req %d\n",module_idP,rar->cqi_req); - LOG_D(MAC, "[UE %d][RAPROC] rar->t_crnti %x\n", module_idP, - (uint16_t) rar[5] + (rar[4] << 8)); -#endif - - if (opt_enabled) { - LOG_D(OPT, - "[UE %d][RAPROC] CC_id %d RAR Frame %d trace pdu for ra-RNTI %x\n", - module_idP, CC_id, frameP, ra_rnti); - trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) dlsch_buffer, n_rarh + n_rarpy * 6, - module_idP, WS_RA_RNTI, ra_rnti, UE_mac_inst[module_idP].rxFrame, - UE_mac_inst[module_idP].rxSubframe, 0, 0); + if (rarh->RAPID == preamble_index) { + LOG_D(PHY, "Found RAR with the intended RAPID %d\n", + rarh->RAPID); + rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6); + break; } - if (preamble_index == rarh->RAPID) { - *t_crnti = (uint16_t) rar[5] + (rar[4] << 8); //rar->t_crnti; - UE_mac_inst[module_idP].crnti = *t_crnti; //rar->t_crnti; - //return(rar->Timing_Advance_Command); - ret = ((((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4)); + if (abs((int) rarh->RAPID - (int) preamble_index) < + abs((int) best_rx_rapid - (int) preamble_index)) { + best_rx_rapid = rarh->RAPID; + rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6); + } + + if (rarh->E == 0) { + LOG_I(PHY, + "No RAR found with the intended RAPID. The closest RAPID in all RARs is %d\n", + best_rx_rapid); + break; } else { - UE_mac_inst[module_idP].crnti = 0; - ret = (0xffff); + rarh++; } + }; - // move the selected RAR to the front of the RA_PDSCH buffer - memcpy(selected_rar_buffer + 0, (uint8_t *) rarh, 1); - memcpy(selected_rar_buffer + 1, (uint8_t *) rar, 6); + LOG_D(MAC, "number of RAR subheader %d; number of RAR pyloads %d\n", + n_rarh, n_rarpy); - return ret; + if (CC_id > 0) { + LOG_W(MAC, "Should not have received RAR on secondary CCs! \n"); + return (0xffff); + } + LOG_I(MAC, + "[UE %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n", + module_idP, frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2], + rar[3], rar[4], rar[5], rarh->RAPID, preamble_index); +#ifdef DEBUG_RAR + LOG_D(MAC, "[UE %d][RAPROC] rarh->E %d\n", module_idP, rarh->E); + LOG_D(MAC, "[UE %d][RAPROC] rarh->T %d\n", module_idP, rarh->T); + LOG_D(MAC, "[UE %d][RAPROC] rarh->RAPID %d\n", module_idP, + rarh->RAPID); + // LOG_I(MAC,"[UE %d][RAPROC] rar->R %d\n",module_idP,rar->R); + LOG_D(MAC, "[UE %d][RAPROC] rar->Timing_Advance_Command %d\n", + module_idP, (((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4)); + // LOG_I(MAC,"[UE %d][RAPROC] rar->hopping_flag %d\n",module_idP,rar->hopping_flag); + // LOG_I(MAC,"[UE %d][RAPROC] rar->rb_alloc %d\n",module_idP,rar->rb_alloc); + // LOG_I(MAC,"[UE %d][RAPROC] rar->mcs %d\n",module_idP,rar->mcs); + // LOG_I(MAC,"[UE %d][RAPROC] rar->TPC %d\n",module_idP,rar->TPC); + // LOG_I(MAC,"[UE %d][RAPROC] rar->UL_delay %d\n",module_idP,rar->UL_delay); + // LOG_I(MAC,"[UE %d][RAPROC] rar->cqi_req %d\n",module_idP,rar->cqi_req); + LOG_D(MAC, "[UE %d][RAPROC] rar->t_crnti %x\n", module_idP, + (uint16_t) rar[5] + (rar[4] << 8)); +#endif + trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) dlsch_buffer, n_rarh + n_rarpy * 6, + module_idP, WS_RA_RNTI, ra_rnti, UE_mac_inst[module_idP].rxFrame, + UE_mac_inst[module_idP].rxSubframe, 0, 0); + + if (preamble_index == rarh->RAPID) { + *t_crnti = (uint16_t) rar[5] + (rar[4] << 8); //rar->t_crnti; + UE_mac_inst[module_idP].crnti = *t_crnti; //rar->t_crnti; + //return(rar->Timing_Advance_Command); + ret = ((((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4)); + } else { + UE_mac_inst[module_idP].crnti = 0; + ret = (0xffff); + } + + // move the selected RAR to the front of the RA_PDSCH buffer + memcpy(selected_rar_buffer + 0, (uint8_t *) rarh, 1); + memcpy(selected_rar_buffer + 1, (uint8_t *) rar, 6); + return ret; } diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 504faabef5..74c834c4d0 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -392,17 +392,9 @@ ue_send_sdu(module_id_t module_idP, #endif VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME (VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_IN); - //LOG_D(MAC,"sdu: %x.%x.%x\n",sdu[0],sdu[1],sdu[2]); - - if (opt_enabled) { - trace_pdu(DIRECTION_DOWNLINK, sdu, sdu_len, module_idP, WS_C_RNTI, - UE_mac_inst[module_idP].crnti, frameP, subframeP, 0, 0); - LOG_D(OPT, - "[UE %d][DLSCH] Frame %d trace pdu for rnti %x with size %d\n", - module_idP, frameP, UE_mac_inst[module_idP].crnti, sdu_len); - } - + trace_pdu(DIRECTION_DOWNLINK, sdu, sdu_len, module_idP, WS_C_RNTI, + UE_mac_inst[module_idP].crnti, frameP, subframeP, 0, 0); payload_ptr = parse_header(sdu, &num_ce, &num_sdu, rx_ces, rx_lcids, rx_lengths, sdu_len); @@ -605,19 +597,16 @@ void ue_decode_si_mbms(module_id_t module_idP, int CC_id, frame_t frameP, stop_meas(&UE_mac_inst[module_idP].rx_si); #endif - if (opt_enabled == 1) { - trace_pdu(DIRECTION_UPLINK, - (uint8_t *) pdu, - len, - module_idP, - WS_SI_RNTI, - 0xffff, - UE_mac_inst[module_idP].rxFrame, - UE_mac_inst[module_idP].rxSubframe, 0, 0); - LOG_D(OPT, - "[UE %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n", - module_idP, frameP, CC_id, 0xffff, len); - } + trace_pdu(DIRECTION_UPLINK, + (uint8_t *) pdu, + len, + module_idP, + WS_SI_RNTI, + 0xffff, + UE_mac_inst[module_idP].rxFrame, + UE_mac_inst[module_idP].rxSubframe, + 0, + 0); } @@ -640,20 +629,14 @@ ue_decode_si(module_id_t module_idP, int CC_id, frame_t frameP, #if UE_TIMING_TRACE stop_meas(&UE_mac_inst[module_idP].rx_si); #endif - - if (opt_enabled == 1) { - trace_pdu(DIRECTION_UPLINK, - (uint8_t *) pdu, - len, - module_idP, - WS_SI_RNTI, - 0xffff, - UE_mac_inst[module_idP].rxFrame, - UE_mac_inst[module_idP].rxSubframe, 0, 0); - LOG_D(OPT, - "[UE %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n", - module_idP, frameP, CC_id, 0xffff, len); - } + trace_pdu(DIRECTION_UPLINK, + (uint8_t *) pdu, + len, + module_idP, + WS_SI_RNTI, + 0xffff, + UE_mac_inst[module_idP].rxFrame, + UE_mac_inst[module_idP].rxSubframe, 0, 0); } void @@ -676,20 +659,14 @@ ue_decode_p(module_id_t module_idP, int CC_id, frame_t frameP, #if UE_TIMING_TRACE stop_meas(&UE_mac_inst[module_idP].rx_p); #endif - - if (opt_enabled == 1) { - trace_pdu(DIRECTION_UPLINK, - (uint8_t *) pdu, - len, - module_idP, - WS_SI_RNTI, - P_RNTI, - UE_mac_inst[module_idP].rxFrame, - UE_mac_inst[module_idP].rxSubframe, 0, 0); - LOG_D(OPT, - "[UE %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n", - module_idP, frameP, CC_id, P_RNTI, len); - } + trace_pdu(DIRECTION_UPLINK, + (uint8_t *) pdu, + len, + module_idP, + WS_SI_RNTI, + P_RNTI, + UE_mac_inst[module_idP].rxFrame, + UE_mac_inst[module_idP].rxSubframe, 0, 0); } unsigned char *parse_mch_header(unsigned char *mac_header, @@ -2422,17 +2399,10 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, #if UE_TIMING_TRACE stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu); #endif - - if (opt_enabled) { - trace_pdu(DIRECTION_UPLINK, ulsch_buffer, buflen, module_idP, WS_C_RNTI, - UE_mac_inst[module_idP].crnti, - UE_mac_inst[module_idP].txFrame, - UE_mac_inst[module_idP].txSubframe, 0, 0); - LOG_D(OPT, - "[UE %d][ULSCH] Frame %d subframe %d trace pdu for rnti %x with size %d\n", - module_idP, frameP, subframe, UE_mac_inst[module_idP].crnti, - buflen); - } + trace_pdu(DIRECTION_UPLINK, ulsch_buffer, buflen, module_idP, WS_C_RNTI, + UE_mac_inst[module_idP].crnti, + UE_mac_inst[module_idP].txFrame, + UE_mac_inst[module_idP].txSubframe, 0, 0); } diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index a74615c3d3..9d75b06fa5 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -33,30 +33,23 @@ #ifndef __LAYER2_NR_MAC_DEFS_H__ #define __LAYER2_NR_MAC_DEFS_H__ - - #include #include #include - #include "platform_types.h" - #include "NR_DRX-Config.h" #include "NR_SchedulingRequestConfig.h" #include "NR_BSR-Config.h" #include "NR_TAG-Config.h" #include "NR_PHR-Config.h" #include "NR_RNTI-Value.h" - #include "NR_MIB.h" #include "NR_MAC-CellGroupConfig.h" #include "NR_PhysicalCellGroupConfig.h" #include "NR_SpCellConfig.h" - #include "NR_ServingCellConfig.h" #include "fapi_nr_ue_interface.h" #include "NR_IF_Module.h" - #include "PHY/defs_nr_common.h" #define NB_NR_UE_MAC_INST 1 @@ -72,13 +65,13 @@ typedef enum { typedef struct { //// MAC config - NR_DRX_Config_t *drx_Config; - NR_SchedulingRequestConfig_t *schedulingRequestConfig; - NR_BSR_Config_t *bsr_Config; - NR_TAG_Config_t *tag_Config; - NR_PHR_Config_t *phr_Config; - NR_RNTI_Value_t *cs_RNTI; - NR_MIB_t *mib; + NR_DRX_Config_t *drx_Config; + NR_SchedulingRequestConfig_t *schedulingRequestConfig; + NR_BSR_Config_t *bsr_Config; + NR_TAG_Config_t *tag_Config; + NR_PHR_Config_t *phr_Config; + NR_RNTI_Value_t *cs_RNTI; + NR_MIB_t *mib; /// Type0-PDCCH seach space fapi_nr_dl_config_dci_dl_pdu_rel15_t type0_pdcch_dci_config; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index ef94d5db7e..34a59e7000 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -82,6 +82,8 @@ uint8_t table_9_2_2_1[16][8]={ {1,0, 14,4, 0,3,6,9}, {1,0, 14,26,0,3,0,0} }; + + int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, @@ -217,17 +219,17 @@ int8_t nr_ue_process_dlsch(module_id_t module_id, return 0; } -int8_t nr_ue_decode_mib( - UE_nr_rxtx_proc_t *proc, - module_id_t module_id, - int cc_id, - uint8_t gNB_index, - uint8_t extra_bits, // 8bits 38.212 c7.1.1 - uint32_t ssb_length, - uint32_t ssb_index, - void *pduP, - uint16_t cell_id ){ +int8_t nr_ue_decode_mib(UE_nr_rxtx_proc_t *proc, + module_id_t module_id, + int cc_id, + uint8_t gNB_index, + uint8_t extra_bits, // 8bits 38.212 c7.1.1 + uint32_t ssb_length, + uint32_t ssb_index, + void *pduP, + uint16_t cell_id) +{ LOG_I(MAC,"[L2][MAC] decode mib\n"); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); @@ -435,18 +437,16 @@ int8_t nr_ue_decode_mib( mac->type0_pdcch_dci_config.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE; mac->type0_pdcch_dci_config.coreset.pdcch_dmrs_scrambling_id = cell_id; - - // type0-pdcch search space float big_o; float big_m; uint32_t temp; - SFN_C_TYPE sfn_c=SFN_C_IMPOSSIBLE; // only valid for mux=1 - uint32_t n_c=UINT_MAX; - uint32_t number_of_search_space_per_slot=UINT_MAX; - uint32_t first_symbol_index=UINT_MAX; - uint32_t search_space_duration; // element of search space - uint32_t coreset_duration; // element of coreset + SFN_C_TYPE sfn_c = SFN_C_IMPOSSIBLE; // only valid for mux=1 + uint32_t n_c = UINT_MAX; + uint32_t number_of_search_space_per_slot = UINT_MAX; + uint32_t first_symbol_index = UINT_MAX; + uint32_t search_space_duration; // element of search space + uint32_t coreset_duration; // element of coreset // 38.213 table 10.1-1 @@ -496,7 +496,7 @@ int8_t nr_ue_decode_mib( // 38.213 Table 13-13 AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n"); // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot -// sfn_c = SFN_C_EQ_SFN_SSB; + //sfn_c = SFN_C_EQ_SFN_SSB; n_c = get_ssb_slot(ssb_index); switch(ssb_index & 0x3){ // ssb_index(i) mod 4 case 0: @@ -518,7 +518,7 @@ int8_t nr_ue_decode_mib( // 38.213 Table 13-14 AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n"); // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot -// sfn_c = SFN_C_EQ_SFN_SSB; + //sfn_c = SFN_C_EQ_SFN_SSB; n_c = get_ssb_slot(ssb_index); switch(ssb_index & 0x7){ // ssb_index(i) mod 8 case 0: @@ -560,7 +560,7 @@ int8_t nr_ue_decode_mib( // 38.213 Table 13-15 AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n"); // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot -// sfn_c = SFN_C_EQ_SFN_SSB; + //sfn_c = SFN_C_EQ_SFN_SSB; n_c = get_ssb_slot(ssb_index); switch(ssb_index & 0x3){ // ssb_index(i) mod 4 case 0: @@ -601,8 +601,8 @@ int8_t nr_ue_decode_mib( mac->type0_pdcch_ss_n_c = n_c; // fill in the elements in config request inside P5 message - mac->phy_config.Mod_id = module_id; - mac->phy_config.CC_id = cc_id; + mac->phy_config.Mod_id = module_id; + mac->phy_config.CC_id = cc_id; mac->phy_config.config_req.pbch_config.system_frame_number = frame; // after calculation mac->phy_config.config_req.pbch_config.subcarrier_spacing_common = mac->mib->subCarrierSpacingCommon; @@ -624,7 +624,6 @@ int8_t nr_ue_decode_mib( } - // TODO: change to UE parameter, scs: 15KHz, slot duration: 1ms uint32_t get_ssb_frame(uint32_t test){ return test; diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c index 3626a09721..b5cda35193 100644 --- a/openair2/PHY_INTERFACE/IF_Module.c +++ b/openair2/PHY_INTERFACE/IF_Module.c @@ -34,7 +34,8 @@ void handle_rach(UL_IND_t *UL_info) { NFAPI_SFNSF2SF(UL_RCC_INFO.rach_ind[j].sfn_sf), UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.preamble, UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.timing_advance, - UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.rnti,0 + UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.rnti, + 0 ); free(UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list); UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles = 0; @@ -52,7 +53,8 @@ void handle_rach(UL_IND_t *UL_info) { NFAPI_SFNSF2SF(UL_info->rach_ind.sfn_sf), UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.preamble, UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.timing_advance, - UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti,0 + UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti, + 0 ); } } @@ -382,10 +384,10 @@ static void dump_ul(UL_IND_t *u) { A("XXXX crc_ind %d\n", u->crc_ind.crc_indication_body.number_of_crcs); A("XXXX sr_ind %d\n", u->sr_ind.sr_indication_body.number_of_srs); - A("XXXX cqi_ind %d\n", u->cqi_ind.number_of_cqis); + A("XXXX cqi_ind %d\n", u->cqi_ind.cqi_indication_body.number_of_cqis); - for (i = 0; i < u->cqi_ind.number_of_cqis; i++) { - nfapi_cqi_indication_pdu_t *v = &u->cqi_ind.cqi_pdu_list[i]; + for (i = 0; i < u->cqi_ind.cqi_indication_body.number_of_cqis; i++) { + nfapi_cqi_indication_pdu_t *v = &u->cqi_ind.cqi_indication_body.cqi_pdu_list[i]; A("XXXX cqi ind %d\n", i); A("XXXX cqi ul_cqi %d channel %d\n", v->ul_cqi_information.ul_cqi, v->ul_cqi_information.channel); diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c index b15299418e..48cc432a06 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c @@ -187,9 +187,8 @@ uint8_t do_MIB_FeMBMS(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_ LTE_BCCH_BCH_Message_MBMS_t *mib_fembms=&carrier->mib_fembms; uint8_t sfn = (uint8_t)((frame>>2)&0xff); uint16_t *spare = calloc(1,sizeof(uint16_t)); - uint16_t *additionalNonMBSFNSubframes = calloc(1,sizeof(uint16_t)); - if( spare == NULL || additionalNonMBSFNSubframes == NULL ) abort(); + if( spare == NULL ) abort(); switch (N_RB_DL) { case 6: @@ -217,7 +216,7 @@ uint8_t do_MIB_FeMBMS(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_ break; default: - AssertFatal(1==0,"Unknown dl_Bandwidth %d\n",N_RB_DL); + AssertFatal(1==0,"Unknown dl_Bandwidth %u\n",N_RB_DL); } LOG_I(RRC,"[MIB] systemBandwidth %x, additional non MBMS subframes %x, sfn %x\n", @@ -287,7 +286,7 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich break; default: - AssertFatal(1==0,"Unknown dl_Bandwidth %d\n",N_RB_DL); + AssertFatal(1==0,"Unknown dl_Bandwidth %u\n",N_RB_DL); } AssertFatal(phich_Resource <= LTE_PHICH_Config__phich_Resource_two,"Illegal phich_Resource\n"); @@ -1021,7 +1020,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13 = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13)); memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13, 0, - sizeof(sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13))); + sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13)); if (*configuration->fdd_DownlinkOrTddSubframeBitmapBR_r13[CC_id]) { sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->present @@ -1183,7 +1182,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13 = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13)); memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13, 0, - sizeof(sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13))); + sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13)); sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->present = LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13_PR_subframePattern10_r13; sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern10_r13.buf = calloc(2, sizeof(uint8_t)); diff --git a/openair2/UTIL/OPT/README.txt b/openair2/UTIL/OPT/README.txt index c56aeda93d..2ac68f83fd 100644 --- a/openair2/UTIL/OPT/README.txt +++ b/openair2/UTIL/OPT/README.txt @@ -1,13 +1,20 @@ + How to configure wireshark for dissecting LTE protocols: - start the wireshark as a sudoers -- goto analyze->enabled prototols + - goto analyze->enabled prototols => enable mac_lte_udp and rlc_lte_udp -- goto edit/preferences and expand Protocols -- select UDP and check "try heuristic sub-dissectors first" -- select MAC-LTE, and check all the options (checkboxes), and set the "which layer info to show in info column" to "MAC info" -- select RLC-LTE, and check all the options except the "May see RLC headers only", and set the "call PDCP dissector for DRB PDUs" to "12-bit SN". Optionally you may select the sequence analysis for RLC AM/UM. + - goto edit/preferences and expand Protocols + - select UDP and check "try heuristic sub-dissectors first" + - select MAC-LTE, and check all the options (checkboxes), and set the "which layer info to show in info column" to "MAC info" + - select RLC-LTE, and check all the options except the "May see RLC headers only", and + set the "call PDCP dissector for DRB PDUs" to "12-bit SN". Optionally you may select the sequence analysis for RLC AM/UM. -How to use -- start eNB or UE with option -W (or -P if you want to make a pcap file) -- capture on local interface "lo" -- filter out the ICMP/DNS/TCP messages (e.g. "!icmp && !dns && !tcp") + How to use + - start eNB or UE with option --opt.type wireshark + --opt options are: + --opt.type none/wireshark/pcap + --opt.ip 127.0.0.1 to specify the output IP address (default: 127.0.0.1) + output port is always: 9999 (to change it, change constant: PACKET_MAC_LTE_DEFAULT_UDP_PORT in OAI code) + --opt.path file_name to specify the file name (pcap) + - capture on local interface "lo" + - filter out the ICMP/DNS/TCP messages (e.g. "!icmp && !dns && !tcp") diff --git a/openair2/UTIL/OPT/opt.h b/openair2/UTIL/OPT/opt.h index 38a834b73e..86f1a045d8 100644 --- a/openair2/UTIL/OPT/opt.h +++ b/openair2/UTIL/OPT/opt.h @@ -110,22 +110,17 @@ typedef enum radio_type_e { * function def */ -void trace_pdu(int direction, - uint8_t *pdu_buffer, - unsigned int pdu_buffer_size, - int ueid, - int rntiType, - int rnti, - uint16_t sysFrame, - uint8_t subframe, - int oob_event, - int oob_event_value); +extern int opt_enabled; +#define trace_pdu(x...) if (opt_enabled) trace_pdu_implementation(x) + +void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size, + int ueid, int rntiType, int rnti, uint16_t sysFrame, uint8_t subframe, + int oob_event, int oob_event_value); int init_opt(void); void terminate_opt(void); -extern int opt_enabled; //double *timing_analyzer(int index, int direction ); #endif /* OPT_H_ */ diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c index 3f07ad0a09..f8cd0ef64c 100644 --- a/openair2/UTIL/OPT/probe.c +++ b/openair2/UTIL/OPT/probe.c @@ -386,17 +386,22 @@ static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context, extern RAN_CONTEXT_t RC; #include /* Remote serveraddress (where Wireshark is running) */ -void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size, - int ueid, int rntiType, int rnti, uint16_t sysFrameNumber, uint8_t subFrameNumber, int oob_event, - int oob_event_value) { +void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size, + int ueid, int rntiType, int rnti, uint16_t sysFrameNumber, uint8_t subFrameNumber, int oob_event, + int oob_event_value) { MAC_Context_Info_t pdu_context; int radioType=FDD_RADIO; + LOG_D(OPT,"sending packet to wireshark: direction=%s, size: %d, ueid: %d, rnti: %x, frame/sf: %d.%d\n", + direction?"DL":"UL", pdu_buffer_size, ueid, rnti, sysFrameNumber,subFrameNumber); - if (RC.eNB[0][0]!=NULL) + if (RC.eNB && RC.eNB[0][0]!=NULL) radioType=RC.eNB[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO; - - if (PHY_vars_UE_g[0][0] != NULL) + else if (PHY_vars_UE_g && PHY_vars_UE_g[0][0] != NULL) radioType=PHY_vars_UE_g[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO; + else { + LOG_E(OPT,"not a eNB neither a UE!!! \n"); + return; + } switch (opt_type) { case OPT_WIRESHARK : diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index abff420436..e2418bcb76 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -945,6 +945,8 @@ extern "C" { std::cerr << "USRP device initialized in subframes replay mode for " << s->recplay_state->u_sf_loops << " loops. Use mmap=" << s->recplay_state->use_mmap << std::endl; } else { + // hotfix! to be checked later + uhd::set_thread_priority_safe(1.0); // Initialize USRP device int vers=0,subvers=0,subsubvers=0; int bw_gain_adjust=0; diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index cfaa7b8f53..906314a67c 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -439,35 +439,33 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi b->headerMode=false; if ( t->nextTimestamp == 0 ) { // First block in UE, resync with the eNB current TS - t->nextTimestamp=b->th.timestamp> nsamps_for_initial ? - b->th.timestamp - nsamps_for_initial : - 0; - b->lastReceivedTS=b->th.timestamp> nsamps_for_initial ? - b->th.timestamp : - nsamps_for_initial; - LOG_W(HW,"UE got first timestamp: starting at %lu\n", t->nextTimestamp); - b->trashingPacket=true; - } else if ( b->lastReceivedTS < b->th.timestamp) { + t->nextTimestamp = b->th.timestamp > nsamps_for_initial ? b->th.timestamp - nsamps_for_initial : 0; + b->lastReceivedTS = b->th.timestamp > nsamps_for_initial ? b->th.timestamp : nsamps_for_initial; + LOG_W(HW,"UE got first timestamp: starting at %lu\n", t->nextTimestamp); + b->trashingPacket=true; + } else if ( b->lastReceivedTS < b->th.timestamp) { int nbAnt= b->th.nbAnt; for (uint64_t index=b->lastReceivedTS; index < b->th.timestamp; index++ ) { for (int a=0; a < nbAnt; a++) { - b->circularBuf[(index*nbAnt+a)%CirSize].r=0; - b->circularBuf[(index*nbAnt+a)%CirSize].i=0; + b->circularBuf[(index*nbAnt+a)%CirSize].r = 0; + b->circularBuf[(index*nbAnt+a)%CirSize].i = 0; } } + if (b->lastReceivedTS != 0 && b->th.timestamp-b->lastReceivedTS > 50 ) LOG_W(HW,"UEsock: %d gap of: %ld in reception\n", fd, b->th.timestamp-b->lastReceivedTS ); - b->lastReceivedTS=b->th.timestamp; + b->lastReceivedTS=b->th.timestamp; } else if ( b->lastReceivedTS > b->th.timestamp && b->th.size == 1 ) { - LOG_W(HW,"Received Rx/Tx synchro out of order\n"); - b->trashingPacket=true; - } else if ( b->lastReceivedTS == b->th.timestamp ) { - // normal case - } else { - abort(); - AssertFatal(false, "received data in past: current is %lu, new reception: %lu!\n", b->lastReceivedTS, b->th.timestamp); } + LOG_W(HW,"Received Rx/Tx synchro out of order\n"); + b->trashingPacket=true; + } else if ( b->lastReceivedTS == b->th.timestamp ) { + // normal case + } else { + abort(); + AssertFatal(false, "received data in past: current is %lu, new reception: %lu!\n", b->lastReceivedTS, b->th.timestamp); + } pthread_mutex_lock(&Sockmutex); @@ -481,17 +479,17 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi if ( b->headerMode==false ) { LOG_D(HW,"UEsock: %d Set b->lastReceivedTS %ld\n", fd, b->lastReceivedTS); - if ( ! b->trashingPacket ) { - b->lastReceivedTS=b->th.timestamp+b->th.size-byteToSample(b->remainToTransfer,b->th.nbAnt); - } + if ( ! b->trashingPacket ) { + b->lastReceivedTS=b->th.timestamp+b->th.size-byteToSample(b->remainToTransfer,b->th.nbAnt); + } - if ( b->remainToTransfer==0) { - LOG_D(HW,"UEsock: %d Completed block reception: %ld\n", fd, b->lastReceivedTS); - b->headerMode=true; - b->transferPtr=(char *)&b->th; - b->remainToTransfer=sizeof(samplesBlockHeader_t); - b->th.magic=-1; - b->trashingPacket=false; + if ( b->remainToTransfer==0) { + LOG_D(HW,"UEsock: %d Completed block reception: %ld\n", fd, b->lastReceivedTS); + b->headerMode=true; + b->transferPtr=(char *)&b->th; + b->remainToTransfer=sizeof(samplesBlockHeader_t); + b->th.magic=-1; + b->trashingPacket=false; } } } diff --git a/targets/ARCH/rfsimulator/stored_node.c b/targets/ARCH/rfsimulator/stored_node.c index 1ddd853fc1..2b77c5322d 100644 --- a/targets/ARCH/rfsimulator/stored_node.c +++ b/targets/ARCH/rfsimulator/stored_node.c @@ -7,6 +7,24 @@ volatile int oai_exit = 0; +int fullread(int fd, void *_buf, int count) { + char *buf = _buf; + int ret = 0; + int l; + + while (count) { + l = read(fd, buf, count); + + if (l <= 0) return -1; + + count -= l; + buf += l; + ret += l; + } + + return ret; +} + void fullwrite(int fd, void *_buf, int count) { char *buf = _buf; int l; @@ -63,10 +81,9 @@ sin_addr: bool connected=false; while(!connected) { - LOG_I(HW,"rfsimulator: trying to connect to %s:%d\n", IP, port); - + //LOG_I(HW,"rfsimulator: trying to connect to %s:%d\n", IP, port); if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == 0) { - LOG_I(HW,"rfsimulator: connection established\n"); + //LOG_I(HW,"rfsimulator: connection established\n"); connected=true; } @@ -108,12 +125,13 @@ int main(int argc, char *argv[]) { if (strcmp(argv[2],"server")==0) { serviceSock=server_start(atoi(argv[3])); } else { - client_start(argv[2],atoi(argv[3])); + serviceSock=client_start(argv[2],atoi(argv[3])); } samplesBlockHeader_t header; int bufSize=100000; void *buff=malloc(bufSize); + uint64_t readTS=0; while (1) { //Rewind the file to loop on the samples @@ -125,9 +143,11 @@ int main(int argc, char *argv[]) { AssertFatal(read(fd,&header,sizeof(header)), ""); fullwrite(serviceSock, &header, sizeof(header)); int dataSize=sizeof(int32_t)*header.size*header.nbAnt; + uint64_t wroteTS=header.timestamp; if (dataSize>bufSize) { - void * new_buff = realloc(buff, dataSize); + void *new_buff = realloc(buff, dataSize); + if (new_buff == NULL) { free(buff); AssertFatal(1, "Could not reallocate"); @@ -139,9 +159,18 @@ int main(int argc, char *argv[]) { AssertFatal(read(fd,buff,dataSize) == dataSize, ""); fullwrite(serviceSock, buff, dataSize); // Purge incoming samples - setblocking(serviceSock, notBlocking); + setblocking(serviceSock, blocking); - while(recv(serviceSock,buff, bufSize, MSG_DONTWAIT) > 0) { + while(readTS < wroteTS) { + if ( fullread(serviceSock, &header,sizeof(header)) != sizeof(header) || + fullread(serviceSock, buff, sizeof(int32_t)*header.size*header.nbAnt) != + sizeof(int32_t)*header.size*header.nbAnt + ) { + printf("error: %s\n", strerror(errno)); + exit(1); + } + + readTS=header.timestamp; } } diff --git a/targets/RT/USER/lte-hwlat2.c b/targets/RT/USER/lte-hwlat2.c index 57d2dbaad1..85ec61e44f 100644 --- a/targets/RT/USER/lte-hwlat2.c +++ b/targets/RT/USER/lte-hwlat2.c @@ -1197,7 +1197,7 @@ void histogram_save_in_csv( histo_time_t *histo , char *file_sufix) fprintf( fp, "%d-%.0f;%u\n", min_val, histo[i].max, histo[i].count ); min_val = histo[i].max; } - + free(csv_filename); fclose( fp ); } diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index af96fa68dc..e81b1ddc06 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -25,7 +25,7 @@ * \date 2019 * \version 0.1 * \company Eurecom - * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr + * \email: {knopp, florian.kaltenberger, navid.nikaein}@eurecom.fr * \note * \warning */ @@ -160,8 +160,8 @@ static inline void fh_if4p5_south_out(RU_t *ru, LOG_D(PHY,"ENTERED fh_if4p5_south_out Sending IF4p5 for frame %d subframe %d ru %d\n",ru->proc.frame_tx,ru->proc.tti_tx,ru->idx); - if (subframe_select(ru->frame_parms,subframe)!=SF_UL) { - send_IF4p5(ru,frame, subframe, IF4p5_PDLFFT); + if (subframe_select(ru->frame_parms, subframe)!=SF_UL) { + send_IF4p5(ru, frame, subframe, IF4p5_PDLFFT); ru->south_out_cnt++; LOG_D(PHY,"south_out_cnt %d\n",ru->south_out_cnt); } @@ -257,22 +257,21 @@ void fh_if4p5_south_in(RU_t *ru, } //calculate timestamp_rx, timestamp_tx based on frame and subframe - proc->tti_rx = sf; - proc->frame_rx= f; + proc->tti_rx = sf; + proc->frame_rx = f; proc->timestamp_rx = ((proc->frame_rx * 10) + proc->tti_rx ) * fp->samples_per_tti ; // proc->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti); if (get_nprocs()<=4) { - proc->tti_tx = (sf+sf_ahead)%10; - proc->frame_tx= (sf>(9-sf_ahead)) ? (f+1)&1023 : f; + proc->tti_tx = (sf+sf_ahead)%10; + proc->frame_tx = (sf>(9-sf_ahead)) ? (f+1)&1023 : f; } LOG_D(PHY,"Setting proc for (%d,%d)\n",sf,f); if (proc->first_rx == 0) { if (proc->tti_rx != *subframe) { - LOG_E(PHY,"Received Timestamp (IF4p5) doesn't correspond to the time we think it is (proc->tti_rx %d, subframe %d, symbol_mask %x)\n", - proc->tti_rx,*subframe,proc->symbol_mask[*subframe]); + LOG_E(PHY,"Received Timestamp (IF4p5) doesn't correspond to the time we think it is (proc->tti_rx %d, subframe %d, symbol_mask %x)\n", proc->tti_rx, *subframe, proc->symbol_mask[*subframe]); *subframe=sf; //exit_fun("Exiting"); } @@ -299,7 +298,7 @@ void fh_if4p5_south_in(RU_t *ru, VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, proc->frame_tx ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, proc->tti_tx ); }*/ - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_SOUTH_IN_RU +ru->idx,f ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_SOUTH_IN_RU+ru->idx,f); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_SOUTH_IN_RU+ru->idx,sf); proc->symbol_mask[sf] = 0; VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, proc->timestamp_rx&0xffffffff); @@ -480,11 +479,9 @@ void fh_if4p5_north_asynch_in(RU_t *ru, LTE_DL_FRAME_PARMS *fp = ru->frame_parms; RU_proc_t *proc = &ru->proc; uint16_t packet_type; - uint32_t symbol_number,symbol_mask,symbol_mask_full; - int tti_tx,frame_tx, ret; + uint32_t symbol_number = 0, symbol_mask = 0, symbol_mask_full; + int tti_tx, frame_tx, ret; LOG_D(PHY, "%s(ru:%p frame, subframe)\n", __FUNCTION__, ru); - symbol_number = 0; - symbol_mask = 0; symbol_mask_full = ((subframe_select(fp,*subframe) == SF_S) ? (1<dl_symbols_in_S_subframe) : (1<symbols_per_tti))-1; LOG_D(PHY,"fh_if4p5_north_asynch_in: RU %d, frame %d, subframe %d\n", ru->idx, *frame, *subframe); @@ -503,7 +500,7 @@ void fh_if4p5_north_asynch_in(RU_t *ru, if ((subframe_select(fp,tti_tx) == SF_DL) && (symbol_number == 0)) start_meas(&ru->rx_fhaul); - LOG_D(PHY,"subframe %d (%d): frame %d, subframe %d, symbol %d\n", *subframe,subframe_select(fp,*subframe),frame_tx,tti_tx,symbol_number); + LOG_D(PHY,"subframe %d (%d): frame %d, subframe %d, symbol %d\n", *subframe, subframe_select(fp,*subframe), frame_tx, tti_tx, symbol_number); if (proc->first_tx != 0) { *frame = frame_tx; @@ -526,8 +523,8 @@ void fh_if4p5_north_asynch_in(RU_t *ru, if (subframe_select(fp,tti_tx) == SF_DL) stop_meas(&ru->rx_fhaul); ru->north_in_cnt++; - proc->tti_tx = tti_tx; - proc->frame_tx= frame_tx; + proc->tti_tx = tti_tx; + proc->frame_tx = frame_tx; if ((frame_tx == 0)&&(tti_tx == 0)) proc->frame_tx_unwrap += 1024; @@ -542,9 +539,9 @@ void fh_if4p5_north_asynch_in(RU_t *ru, VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN, tti_tx); } - if (ru->feptx_ofdm) ru->feptx_ofdm(ru,frame_tx,tti_tx); + if (ru->feptx_ofdm) ru->feptx_ofdm(ru, frame_tx, tti_tx); - if (ru->fh_south_out) ru->fh_south_out(ru,frame_tx,tti_tx,proc->timestamp_tx); + if (ru->fh_south_out) ru->fh_south_out(ru, frame_tx, tti_tx, proc->timestamp_tx); } @@ -560,7 +557,7 @@ void fh_if5_north_out(RU_t *ru) { // RRU IF4p5 northbound interface (RX) void fh_if4p5_north_out(RU_t *ru) { - RU_proc_t *proc=&ru->proc; + RU_proc_t *proc = &ru->proc; LTE_DL_FRAME_PARMS *fp = ru->frame_parms; const int subframe = proc->tti_rx; @@ -570,7 +567,7 @@ void fh_if4p5_north_out(RU_t *ru) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_NORTH_OUT, proc->frame_rx ); } - LOG_D(PHY,"fh_if4p5_north_out: Sending IF4p5_PULFFT SFN.SF %d.%d\n",proc->frame_rx,proc->tti_rx); + LOG_D(PHY,"fh_if4p5_north_out: Sending IF4p5_PULFFT SFN.SF %d.%d\n", proc->frame_rx, proc->tti_rx); if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) { /// **** in TDD during DL send_IF4 of ULTICK to RCC **** /// @@ -587,11 +584,11 @@ void fh_if4p5_north_out(RU_t *ru) { /* add fail safe for late command */ typedef enum { - STATE_BURST_NORMAL = 0, + STATE_BURST_NORMAL = 0, STATE_BURST_TERMINATE = 1, - STATE_BURST_STOP_1 = 2, - STATE_BURST_STOP_2 = 3, - STATE_BURST_RESTART = 4, + STATE_BURST_STOP_1 = 2, + STATE_BURST_STOP_2 = 3, + STATE_BURST_RESTART = 4, } late_control_e; volatile late_control_e late_control=STATE_BURST_NORMAL; @@ -737,7 +734,7 @@ void rx_rf(RU_t *ru, if (ru->fh_north_asynch_in == NULL) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, proc->frame_tx ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, proc->tti_rx ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, proc->tti_tx ); } } } @@ -928,11 +925,12 @@ static void *ru_thread_asynch_rxtx( void *param ) { // asynchronous receive from south (Mobipass) if (ru->fh_south_asynch_in) { - ru->fh_south_asynch_in(ru,&frame,&subframe); + ru->fh_south_asynch_in(ru, &frame, &subframe); } // asynchronous receive from north (RRU IF4/IF5) else if (ru->fh_north_asynch_in) { - if (subframe_select(ru->frame_parms,subframe)!=SF_UL) ru->fh_north_asynch_in(ru,&frame,&subframe); + if (subframe_select(ru->frame_parms,subframe)!=SF_UL) + ru->fh_north_asynch_in(ru, &frame, &subframe); } else AssertFatal(1==0,"Unknown function in ru_thread_asynch_rxtx\n"); } @@ -1167,9 +1165,7 @@ void do_ru_synch(RU_t *ru) { } -int check_sync(RU_t *ru, - RU_t *ru_master, - int subframe) { +int check_sync(RU_t *ru, RU_t *ru_master, int subframe) { if (fabs(ru_master->proc.t[subframe].tv_nsec - ru->proc.t[subframe].tv_nsec) > 500000) return 0; @@ -1179,23 +1175,22 @@ int check_sync(RU_t *ru, void wakeup_L1s(RU_t *ru) { PHY_VARS_eNB **eNB_list = ru->eNB_list; - LOG_D(PHY,"wakeup_L1s (num %d) for RU %d (%d.%d)\n", ru->num_eNB, ru->idx, ru->proc.frame_rx,ru->proc.tti_rx); - PHY_VARS_eNB *eNB = eNB_list[0]; - L1_proc_t *proc = &eNB->proc; + PHY_VARS_eNB *eNB = eNB_list[0]; + L1_proc_t *proc = &eNB->proc; struct timespec t; - LOG_D(PHY,"wakeup_L1s (num %d) for RU %d ru->eNB_top:%p\n", ru->num_eNB, ru->idx, ru->eNB_top); + LOG_D(PHY, "wakeup_L1s (num %d) for RU %d (%d.%d) ru->eNB_top:%p\n", ru->num_eNB, ru->idx, ru->proc.frame_rx, ru->proc.tti_rx, ru->eNB_top); // call eNB function directly char string[20]; - sprintf(string,"Incoming RU %d",ru->idx); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU +ru->idx, ru->proc.frame_rx); + sprintf(string, "Incoming RU %d", ru->idx); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.tti_rx); AssertFatal(0==pthread_mutex_lock(&proc->mutex_RU),""); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU+ru->idx, 1); //printf("wakeup_L1s: Frame %d, Subframe %d: RU %d done (wait_cnt %d),RU_mask[%d] %x\n", // ru->proc.frame_rx,ru->proc.subframe_rx,ru->idx,ru->wait_cnt,ru->proc.subframe_rx,proc->RU_mask[ru->proc.subframe_rx]); - // VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx); - // VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.subframe_rx); - clock_gettime(CLOCK_MONOTONIC,&ru->proc.t[ru->proc.tti_rx]); + //VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx); + //VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.subframe_rx); + clock_gettime(CLOCK_MONOTONIC, &ru->proc.t[ru->proc.tti_rx]); if (proc->RU_mask[ru->proc.tti_rx] == 0) { //clock_gettime(CLOCK_MONOTONIC,&proc->t[ru->proc.subframe_rx]); @@ -1211,21 +1206,21 @@ void wakeup_L1s(RU_t *ru) { eNB->RU_list[i]->idx, eNB->RU_list[i]->proc.frame_rx, eNB->RU_list[i]->proc.tti_rx, ru_states[eNB->RU_list[i]->state]); if (ru == eNB->RU_list[i] && eNB->RU_list[i]->wait_cnt == 0) { - // AssertFatal((proc->RU_mask&(1<Mod_id,ru->proc.frame_rx,ru->proc.subframe_rx,ru->idx,eNB->num_RU,proc->RU_mask); + //AssertFatal((proc->RU_mask&(1<Mod_id,ru->proc.frame_rx,ru->proc.subframe_rx,ru->idx,eNB->num_RU,proc->RU_mask); proc->RU_mask[ru->proc.tti_rx] |= (1<RU_list[i]->state == RU_SYNC ||*/(eNB->RU_list[i]->is_slave==1 && eNB->RU_list[i]->wait_cnt>0 && ru!=eNB->RU_list[i] && ru->is_slave==0)) { + } else if (/*eNB->RU_list[i]->state == RU_SYNC ||*/(eNB->RU_list[i]->is_slave==1 && eNB->RU_list[i]->wait_cnt>0 && ru!=eNB->RU_list[i] && ru->is_slave==0) ) { proc->RU_mask[ru->proc.tti_rx] |= (1<cnt %d, i->cnt %d\n",ru->idx,ru->proc.subframe_rx,proc->RU_mask[ru->proc.subframe_rx],i,ru->proc.frame_rx,ru->is_slave,ru->wait_cnt,eNB->RU_list[i]->wait_cnt); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_MASK_RU, proc->RU_mask[ru->proc.tti_rx]); - if (ru->is_slave == 0 && ( (proc->RU_mask[ru->proc.tti_rx]&(1<RU_list[i]->state == RU_RUN) { // This is master & the RRU has already been received - if (check_sync(eNB->RU_list[i],eNB->RU_list[0],ru->proc.tti_rx) == 0) + if (ru->is_slave == 0 && ( (proc->RU_mask[ru->proc.tti_rx]&(1<RU_list[i]->state == RU_RUN) { //This is master & the RRU has already been received + if (check_sync(eNB->RU_list[i],eNB->RU_list[0],ru->proc.tti_rx) == 0) LOG_E(PHY,"RU %d is not SYNC, subframe %d, time %f this is master\n", eNB->RU_list[i]->idx, ru->proc.tti_rx, fabs(eNB->RU_list[i]->proc.t[ru->proc.tti_rx].tv_nsec - eNB->RU_list[0]->proc.t[ru->proc.tti_rx].tv_nsec)); } else if (ru->is_slave == 1 && ru->state == RU_RUN && ( (proc->RU_mask[ru->proc.tti_rx]&(1<<0)) == 1)) { // master already received. TODO: we assume that RU0 is master. - if (check_sync(ru,eNB->RU_list[0],ru->proc.tti_rx) == 0) + if (check_sync(ru,eNB->RU_list[0],ru->proc.tti_rx) == 0) LOG_E(PHY,"RU %d is not SYNC time, subframe %d, time %f\n", ru->idx, ru->proc.tti_rx, fabs(ru->proc.t[ru->proc.tti_rx].tv_nsec - eNB->RU_list[0]->proc.t[ru->proc.tti_rx].tv_nsec)); } @@ -1238,16 +1233,14 @@ void wakeup_L1s(RU_t *ru) { LOG_D(PHY,"ru_mask is %d \n ", proc->RU_mask[ru->proc.tti_rx]); LOG_D(PHY,"the number of RU is %d, the current ru is RU %d \n ", (1<num_RU)-1, ru->idx); LOG_D(PHY,"ru->proc.subframe_rx is %d \n", ru->proc.tti_rx); - LOG_D(PHY,"Reseting mask frame %d, subframe %d, this is RU %d\n",ru->proc.frame_rx, ru->proc.tti_rx, ru->idx); + LOG_D(PHY,"Resetting mask frame %d, subframe %d, this is RU %d\n", ru->proc.frame_rx, ru->proc.tti_rx, ru->idx); proc->RU_mask[ru->proc.tti_rx] = 0; VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_MASK_RU, proc->RU_mask[ru->proc.tti_rx]); clock_gettime(CLOCK_MONOTONIC,&t); //stop_meas(&proc->ru_arrival_time); - /* AssertFatal(t.tv_nsec < proc->t[ru->proc.subframe_rx].tv_nsec+5000000, - "Time difference for subframe %d (Frame %d) => %lu > 5ms, this is RU %d\n", - ru->proc.subframe_rx, ru->proc.frame_rx, t.tv_nsec - proc->t[ru->proc.subframe_rx].tv_nsec, ru->idx); - */ - // VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx); + /*AssertFatal(t.tv_nsec < proc->t[ru->proc.subframe_rx].tv_nsec+5000000, "Time difference for subframe %d (Frame %d) => %lu > 5ms, this is RU %d\n", + ru->proc.subframe_rx, ru->proc.frame_rx, t.tv_nsec - proc->t[ru->proc.subframe_rx].tv_nsec, ru->idx);*/ + //VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx); //VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.subframe_rx); AssertFatal(0==pthread_mutex_unlock(&proc->mutex_RU),""); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_LOCK_MUTEX_RU+ru->idx, 0 ); @@ -1287,7 +1280,7 @@ void wakeup_L1s(RU_t *ru) { } -static inline int wakeup_prach_ru(RU_t *ru) { +void wakeup_prach_ru(RU_t *ru) { struct timespec wait; int time_ns = 5000000L, ret; clock_gettime(CLOCK_REALTIME,&wait); @@ -1317,14 +1310,12 @@ static inline int wakeup_prach_ru(RU_t *ru) { } else LOG_W(PHY,"RU prach thread busy, skipping\n"); AssertFatal((ret=pthread_mutex_unlock( &ru->proc.mutex_prach ))==0,"mutex_unlock returns %d\n",ret); - return(0); } -inline int wakeup_prach_ru_br(RU_t *ru) { - int ret; +void wakeup_prach_ru_br(RU_t *ru) { struct timespec wait; - int time_ns = 5000000L; + int time_ns = 5000000L, ret; clock_gettime(CLOCK_REALTIME,&wait); wait.tv_nsec += time_ns; @@ -1345,15 +1336,12 @@ inline int wakeup_prach_ru_br(RU_t *ru) { } else LOG_W(PHY,"RU prach thread busy, skipping\n"); AssertFatal((ret=pthread_mutex_unlock( &ru->proc.mutex_prach_br ))==0,"mutex_unlock returns %d\n",ret); - return(0); } - // this is for RU with local RF unit void fill_rf_config(RU_t *ru, char *rf_config_file) { - int i; LTE_DL_FRAME_PARMS *fp = ru->frame_parms; openair0_config_t *cfg = &ru->openair0_cfg; //printf("////////////////numerology in config = %d\n",numerology); @@ -1417,7 +1405,7 @@ void fill_rf_config(RU_t *ru, cfg->rx_num_channels=ru->nb_rx; cfg->clock_source=get_softmodem_params()->clock_source; - for (i=0; inb_tx; i++) { + for (int i=0; inb_tx; i++) { cfg->tx_freq[i] = (double)fp->dl_CarrierFreq; cfg->rx_freq[i] = (double)fp->ul_CarrierFreq; cfg->tx_gain[i] = (double)ru->att_tx; @@ -1606,7 +1594,7 @@ static void *ru_thread_tx( void *param ) { } } - LOG_D(PHY,"ru_thread_tx: releasing RU TX in %d.%d\n",proc->frame_tx,proc->tti_tx); + LOG_D(PHY,"ru_thread_tx: releasing RU TX in %d.%d\n", proc->frame_tx, proc->tti_tx); release_thread(&proc->mutex_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx"); for(int i = 0; inum_eNB; i++) { @@ -1638,7 +1626,7 @@ static void *ru_thread_tx( void *param ) { AssertFatal((ret=pthread_mutex_unlock(&eNB_proc->mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret); AssertFatal((ret=pthread_mutex_lock( &L1_proc->mutex_RUs))==0,"mutex_lock returns %d\n",ret); L1_proc->instance_cnt_RUs = 0; - LOG_D(PHY,"ru_thread_tx: Signaling RU TX done in %d.%d\n",proc->frame_tx,proc->tti_tx); + LOG_D(PHY,"ru_thread_tx: Signaling RU TX done in %d.%d\n", proc->frame_tx, proc->tti_tx); // the thread can now be woken up LOG_D(PHY,"ru_thread_tx: clearing mask and Waking up L1 thread\n"); @@ -1661,8 +1649,8 @@ static void *ru_thread_tx( void *param ) { static void *ru_thread( void *param ) { - RU_t *ru = (RU_t *)param; - RU_proc_t *proc = &ru->proc; + RU_t *ru = (RU_t *)param; + RU_proc_t *proc = &ru->proc; int subframe = 9; int frame = 1023; int resynch_done = 0; @@ -1680,7 +1668,7 @@ static void *ru_thread( void *param ) { //pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); pthread_setname_np( pthread_self(),"ru thread"); LOG_I(PHY,"thread ru created id=%ld\n", syscall(__NR_gettid)); - LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx, NB_functions[ru->function], NB_timing[ru->if_timing]); + LOG_I(PHY,"Starting RU %d (%s,%s),\n", ru->idx, NB_functions[ru->function], NB_timing[ru->if_timing]); if(get_softmodem_params()->emulate_rf) { fill_rf_config(ru,ru->rf_config_file); @@ -1865,7 +1853,7 @@ static void *ru_thread( void *param ) { wakeup_slaves(proc); // do RX front-end processing (frequency-shift, dft) if needed - if (ru->feprx) ru->feprx(ru,proc->tti_rx); + if (ru->feprx) ru->feprx(ru, proc->tti_rx); // wakeup all eNB processes waiting for this RU AssertFatal((ret=pthread_mutex_lock(&proc->mutex_eNBs))==0,"mutex_lock returns %d\n",ret); @@ -1908,7 +1896,7 @@ static void *ru_thread( void *param ) { if(!(get_softmodem_params()->emulate_rf)) { //if(!emulate_rf){ // do outgoing fronthaul (south) if needed - if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,proc->frame_tx,proc->tti_tx,proc->timestamp_tx); + if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru, proc->frame_tx, proc->tti_tx, proc->timestamp_tx); if ((ru->fh_north_out) && (ru->state!=RU_CHECK_SYNC)) ru->fh_north_out(ru); } else { @@ -1956,6 +1944,7 @@ static void *ru_thread( void *param ) { return NULL; } + // This thread run the initial synchronization like a UE void *ru_thread_synch(void *arg) { RU_t *ru = (RU_t *)arg; @@ -2108,14 +2097,14 @@ static void *eNB_thread_phy_tx( void *param ) { phy_tx_txdataF_end = 1; if(pthread_mutex_lock(&ru->proc.mutex_rf_tx) != 0) { - LOG_E( PHY, "[RU] ERROR pthread_mutex_lock for rf tx thread (IC %d)\n", ru->proc.instance_cnt_rf_tx); - exit_fun( "error locking mutex_rf_tx" ); + LOG_E(PHY, "[RU] ERROR pthread_mutex_lock for rf tx thread (IC %d)\n", ru->proc.instance_cnt_rf_tx); + exit_fun("error locking mutex_rf_tx"); } if (ru->proc.instance_cnt_rf_tx==-1) { ++ru->proc.instance_cnt_rf_tx; - ru->proc.frame_tx = proc->frame_phy_tx; - ru->proc.tti_tx = proc->subframe_phy_tx; + ru->proc.frame_tx = proc->frame_phy_tx; + ru->proc.tti_tx = proc->subframe_phy_tx; ru->proc.timestamp_tx = proc->timestamp_phy_tx; // the thread can now be woken up AssertFatal(pthread_cond_signal(&ru->proc.cond_rf_tx) == 0, "ERROR pthread_cond_signal for rf_tx thread\n"); @@ -2200,15 +2189,16 @@ int stop_rf(RU_t *ru) { extern void configure_ru(int idx, void *arg); -extern void fep_full(RU_t *ru,int subframe); -extern void feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx); -extern void feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx); -extern void feptx_prec(RU_t *ru,int frame_tx,int tti_tx); +extern void fep_full(RU_t *ru, int subframe); +extern void feptx_ofdm(RU_t *ru, int frame_tx, int tti_tx); +extern void feptx_ofdm_2thread(RU_t *ru, int frame_tx, int tti_tx); +extern void feptx_prec(RU_t *ru, int frame_tx, int tti_tx); extern void init_fep_thread(RU_t *ru, pthread_attr_t *attr_fep); extern void init_feptx_thread(RU_t *ru, pthread_attr_t *attr_feptx); extern void kill_fep_thread(RU_t *ru); extern void kill_feptx_thread(RU_t *ru); -extern void ru_fep_full_2thread(RU_t *ru,int subframe); +extern void ru_fep_full_2thread(RU_t *ru, int subframe); +extern void *ru_thread_control( void *param ); void reset_proc(RU_t *ru) { @@ -2226,15 +2216,11 @@ void reset_proc(RU_t *ru) { } -extern void *ru_thread_control( void *param ); - - void init_RU_proc(RU_t *ru) { - int i=0,ret; + int i=0, ret; RU_proc_t *proc; - pthread_attr_t *attr_FH=NULL, *attr_FH1=NULL, *attr_prach=NULL, *attr_asynch=NULL, *attr_synch=NULL, *attr_emulateRF=NULL, *attr_ctrl=NULL; + pthread_attr_t *attr_FH=NULL, *attr_FH1=NULL, *attr_prach=NULL, *attr_asynch=NULL, *attr_synch=NULL, *attr_emulateRF=NULL, *attr_ctrl=NULL, *attr_prach_br=NULL; //pthread_attr_t *attr_fep=NULL; - pthread_attr_t *attr_prach_br=NULL; #ifndef OCP_FRAMEWORK LOG_I(PHY,"Initializing RU proc %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]); #endif @@ -2614,9 +2600,9 @@ void set_function_spec_param(RU_t *ru) { case REMOTE_IF5: // the remote unit is IF5 RRU ru->do_prach = 0; - ru->feprx = (get_thread_worker_conf() == WORKER_DISABLE) ? fep_full : fep_full; // this is frequency-shift + DFTs - ru->feptx_prec = feptx_prec; // need to do transmit Precoding + IDFTs - ru->feptx_ofdm = (get_thread_worker_conf() == WORKER_DISABLE) ? feptx_ofdm : feptx_ofdm_2thread; // need to do transmit Precoding + IDFTs + ru->feprx = (get_thread_worker_conf() == WORKER_DISABLE) ? fep_full : fep_full; // this is frequency-shift + DFTs + ru->feptx_prec = feptx_prec; // need to do transmit Precoding + IDFTs + ru->feptx_ofdm = (get_thread_worker_conf() == WORKER_DISABLE) ? feptx_ofdm : feptx_ofdm_2thread; // need to do transmit Precoding + IDFTs if (ru->if_timing == synch_to_other) { ru->fh_south_in = fh_slave_south_in; // synchronize to master @@ -2679,16 +2665,12 @@ void set_function_spec_param(RU_t *ru) { //extern void RCconfig_RU(void); -void init_RU(char *rf_config_file, - clock_source_t clock_source, - clock_source_t time_source, - int send_dmrssync) { - int ru_id; + +void init_RU(char *rf_config_file, clock_source_t clock_source, clock_source_t time_source, int send_dmrssync) { + int ru_id, i, CC_id; RU_t *ru; PHY_VARS_eNB *eNB0 = (PHY_VARS_eNB *)NULL; LTE_DL_FRAME_PARMS *fp = (LTE_DL_FRAME_PARMS *)NULL; - int i; - int CC_id; // create status mask RC.ru_mask = 0; pthread_mutex_init(&RC.ru_mutex,NULL); @@ -2706,25 +2688,25 @@ void init_RU(char *rf_config_file, for (ru_id=0; ru_idrf_config_file = rf_config_file; - ru->idx = ru_id; - ru->ts_offset = 0; + ru->idx = ru_id; + ru->ts_offset = 0; if (ru->is_slave == 1) { - ru->in_synch = 0; + ru->in_synch = 0; ru->generate_dmrs_sync = 0; } else { - ru->in_synch = 1; - ru->generate_dmrs_sync=send_dmrssync; + ru->in_synch = 1; + ru->generate_dmrs_sync = send_dmrssync; } - ru->cmd = EMPTY; - ru->south_out_cnt= 0; + ru->cmd = EMPTY; + ru->south_out_cnt = 0; // use eNB_list[0] as a reference for RU frame parameters // NOTE: multiple CC_id are not handled here yet! - ru->openair0_cfg.clock_source = clock_source; - ru->openair0_cfg.time_source = time_source; + ru->openair0_cfg.clock_source = clock_source; + ru->openair0_cfg.time_source = time_source; //ru->generate_dmrs_sync = (ru->is_slave == 0) ? 1 : 0; if ((ru->is_slave == 0) && (ru->ota_sync_enable == 1)) @@ -2750,8 +2732,8 @@ void init_RU(char *rf_config_file, } } - eNB0 = ru->eNB_list[0]; - fp = ru->frame_parms; + eNB0 = ru->eNB_list[0]; + fp = ru->frame_parms; LOG_D(PHY, "RU FUnction:%d ru->if_south:%d\n", ru->function, ru->if_south); LOG_D(PHY, "eNB0:%p fp:%p\n", eNB0, fp); @@ -2772,14 +2754,14 @@ void init_RU(char *rf_config_file, } } - LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],NB_timing[ru->if_timing],ru->function); + LOG_I(PHY, "Initializing RRU descriptor %d : (%s,%s,%d)\n", ru_id, ru_if_types[ru->if_south], NB_timing[ru->if_timing], ru->function); set_function_spec_param(ru); - LOG_I(PHY,"Starting ru_thread %d, is_slave %d, send_dmrs %d\n",ru_id,ru->is_slave,ru->generate_dmrs_sync); + LOG_I(PHY, "Starting ru_thread %d, is_slave %d, send_dmrs %d\n", ru_id, ru->is_slave, ru->generate_dmrs_sync); init_RU_proc(ru); } // for ru_id // sleep(1); - LOG_D(HW,"[lte-softmodem.c] RU threads created\n"); + LOG_D(HW, "[lte-softmodem.c] RU threads created\n"); }
Relative Time (ms)Test IdTest DescTest Options
Final Tab StatusFinal Tab StatusPASS
' + format(currentTime / 1000, '.1f') + '' + self.testCase_id + '' + self.desc + '' + str(options) + '
' + format(currentTime / 1000, '.1f') + '' + self.testCase_id + '' + self.desc + '' + str(options) + '